zevairouter 1.0.217 → 1.0.218
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/cli/app/.next-cli-build/BUILD_ID +1 -1
- package/cli/app/.next-cli-build/app-path-routes-manifest.json +9 -9
- package/cli/app/.next-cli-build/build-manifest.json +2 -2
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cache/stats/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/changelog/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-gateway/accounts/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/context/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/context/bulk/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/context/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/cli-tools/keys/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/media/videos/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/enable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/health/ready/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/init/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/keys/[id]/rotate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/metrics/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-token/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/quota-cookie/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-token/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/quota-cookie/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-token/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/bulk-delete/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/codebuddy/discover-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js +6 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/auth/setup/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/auth/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/auth/unlock/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/input/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/resize/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/stream/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback.html +1 -1
- package/cli/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.html +1 -1
- package/cli/app/.next-cli-build/server/app/index.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/landing.html +1 -1
- package/cli/app/.next-cli-build/server/app/landing.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/login.html +1 -1
- package/cli/app/.next-cli-build/server/app/login.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/provider-icons/[provider]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app-paths-manifest.json +9 -9
- package/cli/app/.next-cli-build/server/chunks/1131.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/2030.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/3069.js +1 -0
- package/cli/app/.next-cli-build/server/chunks/3815.js +1 -0
- package/cli/app/.next-cli-build/server/chunks/3949.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3999.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/419.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4404.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4621.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/4795.js +1 -0
- package/cli/app/.next-cli-build/server/chunks/4827.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5000.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5295.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5307.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5330.js +9 -9
- package/cli/app/.next-cli-build/server/chunks/5470.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5681.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/7319.js +32 -32
- package/cli/app/.next-cli-build/server/chunks/7634.js +10 -0
- package/cli/app/.next-cli-build/server/chunks/7828.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8255.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8306.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/891.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/9489.js +1 -1
- package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/middleware.js +1 -1
- package/cli/app/.next-cli-build/server/pages/404.html +1 -1
- package/cli/app/.next-cli-build/server/pages/500.html +1 -1
- package/cli/app/.next-cli-build/static/chunks/620-c2ba2409e6cafad7.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9c76ee6300be467c.js +3 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-1b2bb1f80cea643b.js → page-d86194dabdc9cfe4.js} +1 -1
- package/cli/app/CHANGELOG.md +11 -0
- package/cli/app/package.json +1 -1
- package/cli/app/src/lib/oauth/services/xai.js +27 -2
- package/cli/package.json +1 -1
- package/package.json +1 -1
- package/cli/app/.next-cli-build/server/chunks/7276.js +0 -10
- package/cli/app/.next-cli-build/server/chunks/8202.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/620-700fb60057bd1425.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7aeac0028e9fd7e6.js +0 -3
- /package/cli/app/.next-cli-build/static/{ir3OIfROswA1ox35QE0IO → R9w63ASKg7GahWlig16er}/_buildManifest.js +0 -0
- /package/cli/app/.next-cli-build/static/{ir3OIfROswA1ox35QE0IO → R9w63ASKg7GahWlig16er}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{28915:(e,t,s)=>{"use strict";s.d(t,{x6:()=>a.fetchJson,E2:()=>i,gs:()=>r});var a=s(68211);function i(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}function r(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}},42911:(e,t,s)=>{Promise.resolve().then(s.bind(s,72440))},68211:(e,t,s)=>{"use strict";s.d(t,{fetchJson:()=>i});let a={"Content-Type":"application/json"};async function i(e,t={}){let{body:s,headers:r,...n}=t,l={...n,headers:{...a,...r}};void 0!==s&&"string"!=typeof s?l.body=JSON.stringify(s):void 0!==s&&(l.body=s);let o=await fetch(e,l),d=await o.text(),c=null;if(d)try{c=JSON.parse(d)}catch{let t=Error(`Non-JSON response from ${e} (HTTP ${o.status})`);throw t.status=o.status,t.rawBody=d.slice(0,300),t}if(!o.ok){let e=c&&(c.error?.message||c.error||c.message)||`Request failed (HTTP ${o.status})`,t=Error("string"==typeof e?e:`HTTP ${o.status}`);throw t.status=o.status,t.data=c,t}return c}i.get=(e,t)=>i(e,{...t,method:"GET"}),i.post=(e,t,s)=>i(e,{...s,method:"POST",body:t}),i.put=(e,t,s)=>i(e,{...s,method:"PUT",body:t}),i.patch=(e,t,s)=>i(e,{...s,method:"PATCH",body:t}),i.del=(e,t)=>i(e,{...t,method:"DELETE"})},70217:(e,t,s)=>{"use strict";s.d(t,{BU:()=>u,G9:()=>l,d4:()=>d,gJ:()=>a,i2:()=>c});let a=[{id:"all",label:"All"},{id:"active",label:"Active",keys:["active"]},{id:"errors",label:"Errors",keys:["connection_error","auth_error","quota_exhausted","rate_limited","banned","cooldown","unknown"]},{id:"connection",label:"Connection",keys:["connection_error"]},{id:"auth",label:"Auth",keys:["auth_error"]},{id:"limit",label:"Limit",keys:["rate_limited","cooldown"]},{id:"exhausted",label:"Exhausted",keys:["quota_exhausted"]},{id:"banned",label:"Banned",keys:["banned"]},{id:"disabled",label:"Disabled",keys:["disabled"]}],i={active:{label:"active",severity:"success",terminal:!1},disabled:{label:"disabled",severity:"default",terminal:!1},connection_error:{label:"connection error",severity:"error",terminal:!1},auth_error:{label:"auth error",severity:"error",terminal:!0},quota_exhausted:{label:"exhausted",severity:"error",terminal:!0},rate_limited:{label:"rate limited",severity:"warning",terminal:!1},banned:{label:"banned",severity:"error",terminal:!0},cooldown:{label:"cooldown",severity:"warning",terminal:!1},unknown:{label:"unknown",severity:"default",terminal:!1}},r={policy_suspended:"banned",credential_rejected:"auth_error",reauth_required:"auth_error",authentication:"auth_error",entitlement_or_quota:"quota_exhausted",rate_limited:"rate_limited",permission_denied:"auth_error",upstream_transient:"connection_error"};function n(e){if(!e)return"";if("string"==typeof e)return e.toLowerCase();try{return JSON.stringify(e).toLowerCase()}catch{return String(e).toLowerCase()}}function l(e={},t=Date.now()){let s=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>new Date(e).getTime()).filter(e=>Number.isFinite(e)&&e>t);return s.length>0?new Date(Math.min(...s)).toISOString():null}function o(e,t=""){let s=i[e]||i.unknown;return{key:e,...s,reason:t}}function d(e={}){var t;let s=(t=e).quarantinedAt?o(r[n(t.failureClass)]||"unknown",t.quarantineReason||t.lastError||"Connection is quarantined"):null;if(s)return s;if(!1===e.isActive)return o("disabled","Connection is disabled");if(function(e={}){return null!==l(e)}(e))return o("cooldown","Model cooldown is active");if(function(e){if(!e)return!1;let t=new Date(e).getTime();return Number.isFinite(t)&&t>Date.now()}(e.rateLimitedUntil))return o("rate_limited","Rate limit cooldown is active");let a=n(e.testStatus||e.status),i=n(e.lastErrorType||e.errorType),c=n(e.errorCode||e.statusCode),u=n(e.lastError||e.error),m=`${a} ${i} ${c} ${u}`.trim();return!m||["active","success","ok"].includes(a)?o("active",""):m.includes("ban")||m.includes("suspend")||m.includes("restricted")?o("banned",e.lastError||"Account appears restricted"):m.includes("exhaust")||m.includes("quota exceeded")||m.includes("insufficient_quota")||m.includes("payment required")||"402"===c?o("quota_exhausted",e.lastError||"Quota exhausted"):i.includes("rate_limited")||m.includes("rate limit")||m.includes("too many requests")||"429"===c?o("rate_limited",e.lastError||"Rate limited"):i.includes("auth")||i.includes("token")||m.includes("unauthorized")||m.includes("invalid api key")||m.includes("token invalid")||m.includes("token expired")||m.includes("revoked")||"401"===c||"403"===c?o("auth_error",e.lastError||"Authentication failed"):i.includes("network")||m.includes("network")||m.includes("timeout")||m.includes("fetch failed")||m.includes("econn")||m.includes("dns")||m.includes("proxy")?o("connection_error",e.lastError||"Connection failed"):["error","expired","unavailable","failed"].includes(a)?o("connection_error",e.lastError||e.testStatus||"Connection failed"):o("unknown",e.lastError||e.testStatus||"")}function c(e,t){if(!t||"all"===t)return!0;let s=a.find(e=>e.id===t);return!s||s.keys.includes(d(e).key)}function u(e){return e?.severity==="success"?"success":e?.severity==="error"?"error":"default"}},72440:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>G});var a=s(95155),i=s(12115),r=s(73321),n=s(98500),l=s.n(n),o=s(5772),d=s(35497),c=s(52679);let u=["kiro","codebuddy","codebuddy-cn","qoder","antigravity","cloudflare-ai","grok-cli"];function m(e){return u.includes(String(e||""))}function p(e){let t=String(e||"").trim();return t&&m(t)?`/dashboard/automation?provider=${encodeURIComponent(t)}`:"/dashboard/automation"}var x=s(28777),h=s(11059),f=s(73006);let g=new Map;async function b(e){if(!e?.url||!e?.type)return[];let t=g.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let a=(await s.json()).data??[];return g.set(e.url,{data:a,expiresAt:Date.now()+6e5}),a}catch{return[]}}var y=s(70217),v=s(51716),j=s(14051),w=s.n(j);function k({model:e,fullModel:t,alias:s,copied:i,onCopy:r,testStatus:n,isCustom:l,isFree:o,onDeleteAlias:d,onTest:c,isTesting:u,onDisable:m,thinkingSuffix:p}){let x="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0,h=p?`${t}(${p})`:t;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===n?"border-green-500/40":"error"===n?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:x?{color:x}:void 0,children:"ok"===n?"check_circle":"error"===n?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,a.jsx)("code",{className:"max-w-[72vw] truncate rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:h}),e.name&&(0,a.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:e.name})]}),c&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:c,disabled:u,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${u?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:u?{animation:"spin 1s linear infinite"}:void 0,children:u?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:u?"Testing...":"Test"})]}),(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:()=>r(h,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e.id}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:i===`model-${e.id}`?"Copied!":"Copy"})]}),l?(0,a.jsx)("button",{onClick:d,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,a.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function N({models:e,modelAliases:t,providerStorageAlias:s,providerDisplayAlias:a}){let i={...t||{}},r=new Set(Object.values(i)),n=[];for(let t of Array.isArray(e)?e:[]){let e=function(e){if(!e)return"";if("string"==typeof e)return e.trim();let t=e.id||e.name||e.model;return"string"==typeof t?t.trim():""}(t);if(!e)continue;let l=`${s}/${e}`;if(r.has(l))continue;let o=function(e,t,s){let a=e.split("/"),i=a[a.length-1];if(!i)return"";if(!t[i])return i;let r=`${s}-${i}`;if(!t[r])return r;let n=2;for(;t[`${r}-${n}`];)n+=1;return`${r}-${n}`}(e,i,a);o&&(n.push({alias:o,model:l,modelId:e}),i[o]=l,r.add(l))}return n}function C({modelId:e,fullModel:t,copied:s,onCopy:i,onDeleteAlias:r,onTest:n,testStatus:l,isTesting:o}){let d="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>i(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),n&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:n,disabled:o,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:o?"Testing...":"Test"})]})]})]}),(0,a.jsx)("button",{onClick:r,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function S({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:r,onCopy:n,onSetAlias:l,onDeleteAlias:o,onAliasesChanged:c,connections:u,isAnthropic:m}){let[p,x]=(0,i.useState)(""),[h,f]=(0,i.useState)(!1),[g,b]=(0,i.useState)(!1),[y,v]=(0,i.useState)(()=>new Set),[j,w]=(0,i.useState)({}),k=async t=>{let s=`${e}/${t}`;v(e=>new Set(e).add(t));try{let e=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s})}),t=await e.json();w(e=>({...e,[s]:t.ok?"ok":"error"}))}catch{w(e=>({...e,[s]:"error"}))}finally{v(e=>{let s=new Set(e);return s.delete(t),s})}},$=Object.entries(s).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),A=async()=>{if(!p.trim()||h)return;let a=p.trim(),[i]=N({models:[{id:a}],modelAliases:s,providerStorageAlias:e,providerDisplayAlias:t});if(!i)return void alert("This model already exists.");f(!0);try{await l(a,i.alias,e),x("")}catch(e){console.log("Error adding model:",e),alert(e?.message||`Failed to add model "${a}".`)}finally{f(!1)}},T=async()=>{if(g)return;let a=u.find(e=>!1!==e.isActive);if(a){b(!0);try{let i=await fetch(`/api/providers/${a.id}/models`),r=await i.json();if(!i.ok)return void alert(r.error||"Failed to import models");let n=r.models||[];if(0===n.length)return void alert("No models returned from /models.");let l=N({models:n,modelAliases:s,providerStorageAlias:e,providerDisplayAlias:t});if(0===l.length)return void alert("No new models were added.");let o=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({aliases:l.map(({alias:e,model:t})=>({alias:e,model:t}))})}),d=await o.json();if(!o.ok)throw Error(d.error||"Failed to save imported models.");await c(),alert(`Successfully added ${d.count||l.length} models.`)}catch(e){console.log("Error importing models:",e),alert(e?.message||"Failed to import models from /models.")}finally{b(!1)}}},I=u.some(e=>!1!==e.isActive);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",m?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,a.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,a.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-compatible-model-input",type:"text",value:p,onChange:e=>x(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:m?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:A,disabled:!p.trim()||h,children:h?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:T,disabled:!I||g,children:g?"Importing...":"Import from /models"})]}),!I&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),$.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:$.map(({modelId:s,fullModel:i,alias:l})=>(0,a.jsx)(C,{modelId:s,fullModel:`${t}/${s}`,copied:r,onCopy:n,onDeleteAlias:()=>o(l),onTest:u.length>0?()=>k(s):void 0,testStatus:j[`${e}/${s}`],isTesting:y.has(s)},i))})]})}k.propTypes={model:w().shape({id:w().string.isRequired}).isRequired,fullModel:w().string.isRequired,alias:w().string,copied:w().string,onCopy:w().func.isRequired,testStatus:w().oneOf(["ok","error"]),isCustom:w().bool,isFree:w().bool,onDeleteAlias:w().func,onTest:w().func,isTesting:w().bool,onDisable:w().func,thinkingSuffix:w().string},w().string.isRequired,w().string.isRequired,w().string,w().func.isRequired,w().func.isRequired,w().func,w().oneOf(["ok","error"]),w().bool,w().string.isRequired,w().object.isRequired,w().string,w().func.isRequired,w().func.isRequired,w().func.isRequired,S.propTypes={providerStorageAlias:w().string.isRequired,providerDisplayAlias:w().string.isRequired,modelAliases:w().object.isRequired,copied:w().string,onCopy:w().func.isRequired,onSetAlias:w().func.isRequired,onDeleteAlias:w().func.isRequired,onAliasesChanged:w().func.isRequired,connections:w().arrayOf(w().shape({id:w().string,isActive:w().bool})).isRequired,isAnthropic:w().bool};var $=s(81277);function A({until:e}){let[t,s]=(0,i.useState)("");return((0,i.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime();if(!Number.isFinite(t))return void s("");let a=t-Date.now();if(a<=0)return void s("");let i=Math.floor(a/1e3);if(i<60)s(`${i}s`);else if(i<3600)s(`${Math.floor(i/60)}m ${i%60}s`);else{let e=Math.floor(i/3600),t=Math.floor(i%3600/60);s(`${e}h ${t}m`)}};t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[e]),t)?(0,a.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function T({connection:e,proxyPools:t,isOAuth:s,isFirst:r,isLast:n,onMoveUp:l,onMoveDown:o,onToggleActive:c,onUpdateProxy:u,onEdit:m,onDelete:p,autoPingEnabled:x=!1,onToggleAutoPing:h,oneByOneStatus:f=null}){let[g,b]=(0,i.useState)(!1),[v,j]=(0,i.useState)(!1),w=(0,i.useRef)(null),k=(0,i.useMemo)(()=>new Map((t||[]).map(e=>[e.id,e])),[t]),N=(0,i.useMemo)(()=>t||[],[t]),C=e.providerSpecificData?.proxyPoolId||null,S=C?k.get(C):null,I=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,E=!!C||I,P=S?`Pool: ${S.name}`:C?`Pool: ${C} (inactive/missing)`:I?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",O="";if(S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);O=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{O=t}}let R=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",_="default";S?.isActive===!0?_="success":(C||I)&&(_="error"),(0,i.useEffect)(()=>{if(!g)return;let e=e=>{w.current&&!w.current.contains(e.target)&&b(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let D=async e=>{j(!0);try{await u("__none__"===e?null:e)}finally{j(!1),b(!1)}},q=e.authType||(s?"oauth":"apikey"),z="oauth"===q,U="cookie"===q,M=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),L=z?M(e.email)?e.email:M(e.name)?e.name:e.name||e.email||e.displayName||"OAuth Account":e.name||e.email||e.displayName||"API Key",F=(0,$.c)(e),J=null!==F,K="unavailable"!==e.testStatus||J?e.testStatus:"active",B=(0,y.d4)(e),V=!!e.quarantinedAt,G={policy_suspended:"Policy suspension",credential_rejected:"Credential rejected",reauth_required:"Sign-in required",authentication:"Repeated authentication failure"}[e.failureClass]||e.quarantineReason||"Account quarantined",H=Number.isFinite(Date.parse(e.quarantinedAt))?new Date(e.quarantinedAt).toLocaleString():e.quarantinedAt||null,W=e.modelLockReason?.resetsAt,Q=Number.isFinite(Date.parse(W))?new Date(W).toLocaleString():W||null,Z=()=>f?"queued"===f.state?"queued":"testing"===f.state?"testing":"success"===f.state?"success":"failed"===f.state?f.error?`failed: ${f.error}`:"failed":null:null;return(0,a.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive&&!V?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,a.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,a.jsx)("button",{onClick:l,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:o,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:U?"cookie":z?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:L}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,a.jsx)(d.Ex,{variant:(()=>{if(!1===e.isActive)return"default";let t=(0,y.BU)(B);return"active"!==B.key?t:"active"===K||"success"===K?"success":"error"===K||"expired"===K||"unavailable"===K?"error":"default"})(),size:"sm",dot:!0,children:B.label||K||"unknown"}),(0,a.jsx)(d.Ex,{variant:"default",size:"sm",children:z?"OAuth":U?"Cookie":"API Key"}),V&&(0,a.jsx)(d.Ex,{variant:"error",size:"sm",children:"Quarantined"}),E&&(0,a.jsx)(d.Ex,{variant:_,size:"sm",children:"Proxy"}),e.autoDisabledAt&&!V&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["token_expired"===e.autoDisabledReason?"Token expired":"banned"===e.autoDisabledReason?"Banned":"quota_exhausted"===e.autoDisabledReason?"Quota exhausted":"Auto-disabled"," — ",new Date(e.autoDisabledAt).toLocaleDateString()]}),V&&(0,a.jsxs)("span",{className:"max-w-full truncate text-xs text-red-600 dark:text-red-400 sm:max-w-[420px]",title:`${e.quarantineReason||G}${H?` - ${H}`:""}`,children:[G,H?` - ${H}`:""]}),J&&!1!==e.isActive&&(0,a.jsx)(A,{until:F}),J&&e.modelLockReason&&!1!==e.isActive&&(0,a.jsxs)("span",{className:"max-w-full truncate text-xs text-amber-600 dark:text-amber-400 sm:max-w-[360px]",title:`${e.modelLockReason.reason}${Q?` — resets ${Q}`:""}`,children:[e.modelLockReason.model,e.modelLockReason.providerErrorCode?` (${e.modelLockReason.providerErrorCode})`:"",Q?` — resets ${Q}`:""]}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),Z()&&(0,a.jsx)(d.Ex,{variant:f?"success"===f.state?"success":"failed"===f.state?"error":"testing"===f.state?"primary":"default":"default",size:"sm",children:Z()})]}),E&&(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:P,children:P}),O&&(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:O}),R&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:R,children:["no_proxy: ",R]})]}),V&&!1===e.isActive&&(0,a.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Re-enable only permits router requests again; it does not change the account's upstream status."})]})]}),(0,a.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[N.length>0&&(0,a.jsxs)("div",{className:"relative",ref:w,children:[(0,a.jsxs)("button",{onClick:()=>b(e=>!e),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${E?"text-primary":"text-text-muted hover:text-primary"}`,disabled:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:v?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),g&&(0,a.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 max-w-[78vw] min-w-[160px] rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,a.jsx)("button",{onClick:()=>D("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),N.map(e=>(0,a.jsx)("button",{onClick:()=>D(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),h&&(0,a.jsxs)("button",{onClick:()=>h(!x),className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${x?"text-primary":"text-text-muted hover:text-primary"}`,title:x?"Disable quota auto-ping for this account":"Warm the 5-hour quota window after reset with a tiny request",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]}),(0,a.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:p,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,a.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable connection":V?"Re-enable routing only; upstream suspension or credential status is unchanged":"Enable connection"})]})]})}A.propTypes={until:w().string.isRequired},T.propTypes={connection:w().shape({id:w().string,name:w().string,email:w().string,displayName:w().string,modelLockUntil:w().string,testStatus:w().string,isActive:w().bool,lastError:w().string,failureClass:w().string,quarantinedAt:w().string,quarantineReason:w().string,priority:w().number,globalPriority:w().number}).isRequired,proxyPools:w().arrayOf(w().shape({id:w().string,name:w().string,proxyUrl:w().string,noProxy:w().string,isActive:w().bool})),isOAuth:w().bool.isRequired,isFirst:w().bool.isRequired,isLast:w().bool.isRequired,onMoveUp:w().func.isRequired,onMoveDown:w().func.isRequired,onToggleActive:w().func.isRequired,onUpdateProxy:w().func,autoPingEnabled:w().bool,onToggleAutoPing:w().func,onEdit:w().func.isRequired,onDelete:w().func.isRequired,oneByOneStatus:w().shape({state:w().string,error:w().string})};var I=s(28915);let E=`name1|sk-key1
|
|
2
|
+
name2|sk-key2
|
|
3
|
+
sk-key-only-auto-named`;function P({isOpen:e,provider:t,providerName:s,isCompatible:r,isAnthropic:n,authType:l,authHint:o,website:u,proxyPools:m,error:p,onSave:x,onBulkDone:h,onClose:f}){let g="__none__",b="ollama-local"===t,y="notion-ai"===t,v="cookie"===l,j="xai"===t&&!v,w=v?"Cookie Value":"qoder"===t?"Personal Access Token (PAT)":"API Key",k=v?"grok-web"===t?"sso=xxxxx... or just the raw value":y?"token_v2=xxxxx..., full Cookie header, or cookie-export JSON":"eyJhbGciOi...":j?"xai-...":"qoder"===t?"pt-...":"",N="azure"===t,C="cloudflare-ai"===t,S=c.Q2?.[t]?.regions||null,$=c.Q2?.[t]?.defaultRegion||S?.[0]?.id||"",[A,T]=(0,i.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:""}),[O,R]=(0,i.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[_,D]=(0,i.useState)({accountId:""}),[q,z]=(0,i.useState)({spaceId:"",spaceViewId:"",userId:"",clientVersion:"",cell:""}),[U,M]=(0,i.useState)($),[L,F]=(0,i.useState)(!1),[J,K]=(0,i.useState)(null),[B,V]=(0,i.useState)(!1),[G,H]=(0,i.useState)("single"),[W,Q]=(0,i.useState)(""),[Z,X]=(0,i.useState)(null),Y=(0,i.useRef)(!1);(0,i.useEffect)(()=>{e&&!Y.current&&(T({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:""}),R({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),D({accountId:""}),z({spaceId:"",spaceViewId:"",userId:"",clientVersion:"",cell:""}),M($),K(null),H("single"),Q(""),X(null)),Y.current=e},[e]);let ee=()=>{if(b&&A.ollamaHostUrl.trim())return{baseUrl:A.ollamaHostUrl.trim()};if(N)return{azureEndpoint:O.azureEndpoint,apiVersion:O.apiVersion,deployment:O.deployment,organization:O.organization};if(C)return{accountId:_.accountId};if(y){let e=Object.entries({spaceId:q.spaceId.trim(),spaceViewId:q.spaceViewId.trim(),userId:q.userId.trim(),clientVersion:q.clientVersion.trim(),cell:q.cell.trim()}).filter(([,e])=>e);return e.length>0?Object.fromEntries(e):void 0}if(S&&U)return{region:U}},et=async()=>{F(!0);try{let e=await (0,I.x6)("/api/providers/validate",{method:"POST",body:{provider:t,apiKey:A.apiKey,providerSpecificData:ee()}});K(e.valid?"success":"failed")}catch{K("unknown")}finally{F(!1)}},es=async()=>{if(t&&(b||A.apiKey)&&(b||A.name)&&(!r||A.defaultModel.trim())){V(!0);try{let e=!1;try{F(!0),K(null),e=!!(await (0,I.x6)("/api/providers/validate",{method:"POST",body:{provider:t,apiKey:A.apiKey,providerSpecificData:ee()}})).valid,K(e?"success":"failed")}catch{K("unknown")}finally{F(!1)}let s=Number.parseInt(A.priority,10);await x({name:A.name||(b?"Ollama Local":""),apiKey:A.apiKey,defaultModel:r?A.defaultModel.trim():void 0,priority:Number.isFinite(s)?s:1,proxyPoolId:A.proxyPoolId===g?null:A.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:ee()})}finally{V(!1)}}},ea=async()=>{let e=W.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;V(!0),X(null);let s=0,a=0,i=[],r=[];for(let n=0;n<e.length;n++){let l=e[n].split("|"),o=l.length>=2?l.slice(1).join("|").trim():l[0].trim(),d=l.length>=2?l[0].trim():"Key",c=`${d} ${n+1}`;try{await (0,I.x6)("/api/providers",{method:"POST",body:{provider:t,apiKey:o,name:c,priority:1,testStatus:"unknown"}}),s++}catch(t){a++,i.push({line:e[n],message:t?.message||"Request failed"}),r.push(e[n])}}V(!1),X({success:s,failed:a,failedRows:i}),Q(r.join("\n")),s>0&&h&&h()};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${w}`,onClose:f,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[!y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"single"===G?"primary":"ghost",onClick:()=>{H("single"),X(null)},children:"Single"}),(0,a.jsx)(d.$n,{size:"sm",variant:"bulk"===G?"primary":"ghost",onClick:()=>{H("bulk"),X(null)},children:"Bulk Add"})]}),"bulk"===G&&!y&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,a.jsx)("code",{children:"name|apiKey"})," or just ",(0,a.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:E,value:W,onChange:e=>Q(e.target.value)}),Z&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${Z.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",Z.success," added",Z.failed>0?`, ✗ ${Z.failed} failed`:""]}),Z.failedRows?.length>0&&(0,a.jsx)("ul",{className:"text-xs text-red-500 flex flex-col gap-0.5",children:Z.failedRows.map((e,t)=>(0,a.jsxs)("li",{className:"break-words",children:[(0,a.jsx)("span",{className:"font-mono",children:e.line.length>40?`${e.line.slice(0,40)}…`:e.line}),` — ${e.message}`]},t))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:ea,fullWidth:!0,disabled:B||!W.trim(),children:B?"Adding...":"Add All Keys"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),("single"===G||y)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.pd,{label:"Name",value:A.name,onChange:e=>T({...A,name:e.target.value}),placeholder:b?"Ollama Local":"Production Key"}),b&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:e=>T({...A,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:et,disabled:L||B,variant:"secondary",children:L?"Checking...":"Check"})})]}),!b&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:w,type:v?"text":"password",value:A.apiKey,onChange:e=>T({...A,apiKey:e.target.value}),placeholder:k,className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:et,disabled:!A.apiKey||L||B,variant:"secondary",children:L?"Checking...":"Check"})})]}),j&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),v&&o&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[o,u&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",u.replace(/^https?:\/\//,"")]})]})]}),y&&(0,a.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-accent/20 bg-sidebar/50 p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"Notion workspace metadata (optional)"}),(0,a.jsx)("p",{className:"text-xs leading-relaxed text-text-muted",children:"Space ID and User ID are optional. The router resolves them from Notion's authenticated getSpaces endpoint; enter them only to override discovery. They are metadata only, and the cookie stays in the encrypted provider credential store."}),(0,a.jsx)(d.pd,{label:"Space ID (optional)",value:q.spaceId,onChange:e=>z({...q,spaceId:e.target.value}),placeholder:"Auto-resolved from Notion"}),(0,a.jsx)(d.pd,{label:"User ID (optional)",value:q.userId,onChange:e=>z({...q,userId:e.target.value}),placeholder:"Auto-resolved from Notion"}),(0,a.jsx)(d.pd,{label:"Space View ID (optional)",value:q.spaceViewId,onChange:e=>z({...q,spaceViewId:e.target.value}),placeholder:"Leave blank to use Space ID"}),(0,a.jsx)(d.pd,{label:"Notion client version (optional)",value:q.clientVersion,onChange:e=>z({...q,clientVersion:e.target.value}),placeholder:"Copy from the browser request if required"}),(0,a.jsx)(d.pd,{label:"Cell (optional)",value:q.cell,onChange:e=>z({...q,cell:e.target.value}),placeholder:"Copy x-notion-cell if your request has it"})]}),S&&(0,a.jsx)(d.l6,{label:"Region",value:U,onChange:e=>M(e.target.value),options:S.map(e=>({value:e.id,label:e.label}))}),r&&(0,a.jsx)(d.pd,{label:"Default Model",value:A.defaultModel,onChange:e=>T({...A,defaultModel:e.target.value}),placeholder:n?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),b&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,a.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,a.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),J&&(0,a.jsx)(d.Ex,{variant:"success"===J?"success":"failed"===J?"error":"default",children:"success"===J?"Valid":"failed"===J?"Invalid":"Could not validate"}),p&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:p}),r&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),C&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,a.jsx)(d.pd,{label:"Account ID",value:_.accountId,onChange:e=>D({..._,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,a.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),N&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"Azure Endpoint",value:O.azureEndpoint,onChange:e=>R({...O,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:O.deployment,onChange:e=>R({...O,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:O.apiVersion,onChange:e=>R({...O,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:O.organization,onChange:e=>R({...O,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:A.priority,onChange:e=>T({...A,priority:e.target.value}),onBlur:e=>{let t=Number.parseInt(e.target.value,10);T(e=>({...e,priority:Number.isFinite(t)?t:1}))}}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:e=>T({...A,proxyPoolId:e.target.value}),options:[{value:g,label:"None"},...(m||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(m||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:es,fullWidth:!0,disabled:B||!b&&(!A.name||!A.apiKey)||r&&!A.defaultModel.trim()||N&&(!O.azureEndpoint||!O.deployment||!O.organization)||C&&!_.accountId,children:B?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function O({isOpen:e,node:t,onSave:s,onClose:r,isAnthropic:n}){let[l,o]=(0,i.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,u]=(0,i.useState)(!1),[m,p]=(0,i.useState)(""),[x,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1),[b,y]=(0,i.useState)(null);(0,i.useEffect)(()=>{t&&(o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(n?"https://api.anthropic.com/v1":"https://api.openai.com/v1")}),p(""),h(""),y(null))},[t,n]);let v=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){u(!0);try{let e={name:l.name,prefix:l.prefix,baseUrl:l.baseUrl};n||(e.apiType=l.apiType),await s(e)}finally{u(!1)}}},j=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:m,type:n?"anthropic-compatible":"openai-compatible",modelId:x.trim()||void 0})}),t=await e.json();y(t.valid?"success":"failed")}catch{y("failed")}finally{g(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${n?"Anthropic":"OpenAI"} Compatible`,onClose:r,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(d.pd,{label:"Name",value:l.name,onChange:e=>o({...l,name:e.target.value}),placeholder:`${n?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:l.prefix,onChange:e=>o({...l,prefix:e.target.value}),placeholder:n?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!n&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:l.apiType,onChange:e=>o({...l,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>o({...l,baseUrl:e.target.value}),placeholder:n?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${n?"Anthropic":"OpenAI"}-compatible API.`}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>p(e.target.value),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:j,disabled:!m||f||!l.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,a.jsx)(d.pd,{label:"Model ID (optional)",value:x,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),b&&(0,a.jsx)(d.Ex,{variant:"success"===b?"success":"error",children:"success"===b?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function R({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:r,onClose:n}){let[l,o]=(0,i.useState)(""),[c,u]=(0,i.useState)(null),[m,p]=(0,i.useState)(""),[x,h]=(0,i.useState)(!1);(0,i.useEffect)(()=>{e&&(o(""),u(null),p(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},g=async()=>{let e=f(l.trim());if(e){u("testing"),p("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),a=await s.json();u(a.ok?"ok":"error"),p(a.error||"")}catch(e){u("error"),p(e.message)}}},b=async()=>{let e=f(l.trim());if(e&&!x){h(!0);try{await r(e)}finally{h(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:n,title:"Add Custom Model",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:l,onChange:e=>{o(e.target.value),u(null),p("")},onKeyDown:e=>{"Enter"===e.key&&g()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,a.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:g,disabled:!l.trim()||"testing"===c,children:"testing"===c?"Testing...":"Test"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,a.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:f(l.trim())||"model-id"})]})]}),"ok"===c&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===c&&(0,a.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,a.jsx)("span",{children:m||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{onClick:n,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:b,fullWidth:!0,size:"sm",disabled:!l.trim()||x,children:x?"Adding...":"Add Model"})]})]})})}P.propTypes={isOpen:w().bool.isRequired,provider:w().string,providerName:w().string,isCompatible:w().bool,isAnthropic:w().bool,authType:w().string,authHint:w().string,website:w().string,proxyPools:w().arrayOf(w().shape({id:w().string,name:w().string})),error:w().string,onSave:w().func.isRequired,onBulkDone:w().func,onClose:w().func.isRequired},O.propTypes={isOpen:w().bool.isRequired,node:w().shape({id:w().string,name:w().string,prefix:w().string,apiType:w().string,baseUrl:w().string}),onSave:w().func.isRequired,onClose:w().func.isRequired,isAnthropic:w().bool},R.propTypes={isOpen:w().bool.isRequired,providerAlias:w().string.isRequired,providerDisplayAlias:w().string.isRequired,onSave:w().func.isRequired,onClose:w().func.isRequired};let _="/api/providers/codebuddy/discover-models",D={verified:"Verified",recognized:"Recognized",unavailable:"Unavailable",credential_rejected:"Credential rejected",error:"Inconclusive",skipped:"Skipped"},q={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",recognized:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",unavailable:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]"};function z(e,t){return e?.error||t}function U({isOpen:e,connections:t,onModelsAdded:s,onClose:r}){let n=(0,i.useMemo)(()=>t.filter(e=>"codebuddy"===e.provider&&!1!==e.isActive),[t]),[l,o]=(0,i.useState)(null),[c,u]=(0,i.useState)(!1),[m,p]=(0,i.useState)(""),[x,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(()=>new Set),[b,y]=(0,i.useState)(""),[v,j]=(0,i.useState)(!1),[w,k]=(0,i.useState)(!1),[N,C]=(0,i.useState)([]),[S,$]=(0,i.useState)(()=>new Set),A=(0,i.useCallback)(async()=>{u(!0),p(""),h(""),j(!1),C([]);try{let e=await fetch(_,{cache:"no-store"}),t=await e.json();if(!e.ok)throw Error(z(t,"Could not refresh model candidates"));o(t),g(new Set((t.hidden||[]).map(e=>e.id)))}catch(e){p(e.message)}finally{u(!1)}},[]);(0,i.useEffect)(()=>{e&&(y(e=>n.some(t=>t.id===e)?e:n[0]?.id||""),A())},[n,e,A]);let T=async()=>{if(b&&0!==f.size&&!w){k(!0),p(""),h("");try{let e=await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:b,models:[...f]})}),t=await e.json();if(!e.ok)throw Error(z(t,"Hidden model scan failed"));C(t.results||[]),j(!1)}catch(e){p(e.message)}finally{k(!1)}}},I=(0,i.useMemo)(()=>new Map(N.map(e=>[e.id,e])),[N]),E=(0,i.useMemo)(()=>(l?.hidden||[]).filter(e=>{let t=I.get(e.id)?.status;return e.previouslyVerified||"verified"===t||"recognized"===t}),[l,I]),P=async e=>{let t=e.filter(e=>!S.has(e.id));if(!t.length)return;$(e=>new Set([...e,...t.map(e=>e.id)])),p(""),h("");let a=[];try{for(let e of t){let t=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:"cb",id:e.id,type:"llm",name:e.name})}),s=await t.json();if(!t.ok)throw Error(z(s,`Could not add ${e.id}`));a.push(e)}window.dispatchEvent(new Event("customModelChanged")),await s?.(a),h(`${a.length} model${1===a.length?"":"s"} added to CodeBuddy Global.`)}catch(e){a.length&&(window.dispatchEvent(new Event("customModelChanged")),await s?.(a)),p(e.message)}finally{$(e=>{let s=new Set(e);return t.forEach(e=>s.delete(e.id)),s})}},O=E.filter(e=>f.has(e.id));return(0,a.jsx)(d.aF,{isOpen:e,onClose:r,title:"Discover CodeBuddy Global Models",size:"full",children:(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsx)("div",{className:"overflow-hidden rounded-xl border border-cyan-500/20 bg-gradient-to-br from-cyan-500/[0.10] via-transparent to-amber-500/[0.08] p-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Live package candidates"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"Refreshing reads Tencent's current CLI manifests and does not call a model or use credits."}),l?.version&&(0,a.jsxs)("p",{className:"mt-2 font-mono text-xs text-cyan-700 dark:text-cyan-300",children:["codebuddy-code@",l.version]})]}),(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:c,onClick:A,children:"Refresh Candidates"})]})}),m&&(0,a.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:m}),x&&(0,a.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:x}),l?.warnings?.map(e=>(0,a.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-300",children:e},e)),l&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.official?.length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Official Global"})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.hidden?.length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Hidden candidates"})]}),(0,a.jsxs)("div",{className:"col-span-2 rounded-lg border border-border bg-surface-2 px-3 py-2 sm:col-span-1",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.hidden?.filter(e=>e.previouslyVerified).length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Previously verified"})]})]}),(0,a.jsxs)("section",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Hidden route candidates"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"From alternate official manifests; availability is not guaranteed on Global SaaS."})]}),(0,a.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>g(f.size===(l.hidden?.length||0)?new Set:new Set(l.hidden.map(e=>e.id))),children:f.size===(l.hidden?.length||0)?"Clear":"Select all"})]}),(0,a.jsx)("div",{className:"max-h-64 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:(l.hidden||[]).map(e=>{let t=I.get(e.id);return(0,a.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:f.has(e.id),onChange:()=>{var t;return t=e.id,void g(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"mt-1 accent-primary"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block truncate text-sm font-medium text-text-main",children:e.name}),(0,a.jsx)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:e.id}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:e.sources.length?e.sources.join(" + "):"request history"})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[e.previouslyVerified&&(0,a.jsx)("span",{className:"rounded-full bg-green-500/10 px-2 py-0.5 text-[10px] font-medium text-green-700 dark:text-green-300",children:"previous success"}),t&&(0,a.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${q[t.status]||q.error}`,children:D[t.status]||t.status}),(e.previouslyVerified||["verified","recognized"].includes(t?.status))&&(0,a.jsx)("button",{type:"button",onClick:t=>{t.preventDefault(),P([e])},className:"text-xs font-semibold text-primary hover:underline",disabled:S.has(e.id),children:S.has(e.id)?"Adding...":"Add"})]})]},e.id)})})]}),(0,a.jsxs)("section",{className:"rounded-xl border border-amber-500/25 bg-amber-500/[0.07] p-4",children:[(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,a.jsx)(d.l6,{label:"CodeBuddy Global connection",value:b,onChange:e=>y(e.target.value),options:n.map(e=>({value:e.id,label:e.name||e.email||e.id})),placeholder:"No active Global connection",disabled:!n.length||w,hint:"Every probe is pinned to this connection."}),(0,a.jsxs)(d.$n,{size:"sm",icon:"radar",onClick:()=>j(!0),disabled:!b||0===f.size||w,children:["Scan Hidden Models (",f.size,")"]})]}),!n.length&&(0,a.jsx)("p",{className:"mt-2 text-xs text-red-500",children:"Add and activate a CodeBuddy Global connection before scanning."}),v&&(0,a.jsxs)("div",{className:"mt-4 rounded-lg border border-amber-500/40 bg-surface px-3 py-3",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm credit-using scan"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"These are real completion probes and may consume CodeBuddy credits. Scanning uses at most 3 concurrent requests and stops scheduling if the selected credential is rejected."}),(0,a.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>j(!1),disabled:w,children:"Cancel"}),(0,a.jsx)(d.$n,{size:"sm",icon:"science",loading:w,onClick:T,children:"Start Credit Scan"})]})]})]}),N.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[N.filter(e=>"verified"===e.status).length," verified, ",N.filter(e=>"recognized"===e.status).length," recognized, ",N.filter(e=>"unavailable"===e.status).length," unavailable"]}),(0,a.jsxs)(d.$n,{size:"sm",icon:"playlist_add",onClick:()=>P(O),disabled:!O.length||S.size>0,children:["Add Selected Available (",O.length,")"]})]})]})]})})}U.propTypes={isOpen:w().bool.isRequired,connections:w().arrayOf(w().object).isRequired,onModelsAdded:w().func,onClose:w().func.isRequired};let M="kiro-bulk-import-active-job",L="Bulk import progress expired or was cleared.",F={claude:"claudeAutoPing",codex:"codexAutoPing"};function J(e){return["completed","cancelled","failed"].includes(e)}async function K(e){if(!e)return null;let t=await fetch(`/api/oauth/kiro/bulk-import/${e}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function B(e="active"){let t=await fetch(`/api/oauth/kiro/bulk-import/latest?scope=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function V(e){let t=new AbortController,s=window.setTimeout(()=>t.abort(),8e3);try{let s=await fetch(e,{cache:"no-store",signal:t.signal}),a=null;try{a=await s.json()}catch{a=null}return{response:s,data:a}}finally{window.clearTimeout(s)}}function G(){let e,t=(0,r.useParams)(),s=(0,r.useRouter)(),n=t.id,[u,g]=(0,i.useState)([]),[j,w]=(0,i.useState)(!0),[N,C]=(0,i.useState)(""),[$,A]=(0,i.useState)(null),[I,E]=(0,i.useState)([]),[_,D]=(0,i.useState)(!1),[q,z]=(0,i.useState)(!1),[G,H]=(0,i.useState)(!1),[W,Q]=(0,i.useState)(!1),[Z,X]=(0,i.useState)(""),[Y,ee]=(0,i.useState)(!1),[et,es]=(0,i.useState)(!1),[ea,ei]=(0,i.useState)(!1),[er,en]=(0,i.useState)(null),[el,eo]=(0,i.useState)({}),[ed,ec]=(0,i.useState)(!1),[eu,em]=(0,i.useState)({}),[ep,ex]=(0,i.useState)({}),[eh,ef]=(0,i.useState)(()=>new Set),[eg,eb]=(0,i.useState)(!1),[ey,ev]=(0,i.useState)(!1),[ej,ew]=(0,i.useState)([]),[ek,eN]=(0,i.useState)("__none__"),[eC,eS]=(0,i.useState)(!1),[e$,eA]=(0,i.useState)(!1),[eT,eI]=(0,i.useState)(null),[eE,eP]=(0,i.useState)(""),[eO,eR]=(0,i.useState)("auto"),[e_,eD]=(0,i.useState)({}),[eq,ez]=(0,i.useState)([]),[eU,eM]=(0,i.useState)([]),[eL,eF]=(0,i.useState)([]),[eJ,eK]=(0,i.useState)(null),[eB,eV]=(0,i.useState)(!1),[eG,eH]=(0,i.useState)(!1),[eW,eQ]=(0,i.useState)(!1),[eZ,eX]=(0,i.useState)(null),[eY,e0]=(0,i.useState)({}),[e1,e2]=(0,i.useState)(null),e5=(0,i.useRef)(!1),e3=(0,i.useRef)(null),e4=(0,i.useRef)("1"),[e6,e7]=(0,i.useState)(!1),[e8,e9]=(0,i.useState)(null),[te,tt]=(0,i.useState)(""),[ts,ta]=(0,i.useState)(1),[ti,tr]=(0,i.useState)(20),[tn,tl]=(0,i.useState)("all"),[to,td]=(0,i.useState)(""),[tc,tu]=(0,i.useState)(1),[tm,tp]=(0,i.useState)(20),{copied:tx,copy:th}=(0,h.C)(),tf=(0,i.useRef)(0),tg=(0,i.useRef)([]),tb=(0,i.useRef)(!0),ty="ag_risk_confirmed",tv=(0,i.useCallback)(()=>{e9(null),tt(""),tf.current=0,window.localStorage.removeItem(M)},[]),tj=()=>{D(!0)},tw=()=>{"kiro"===n&&e8?.jobId&&J(e8.status)&&tv(),s.push(p(n))},tk=()=>{X(""),Q(!0)},tN=()=>{t$?(()=>{if(m(n))return"antigravity"===n&&"true"!==window.localStorage.getItem(ty)?eV(!0):tw();if("antigravity"===n&&"true"!==window.localStorage.getItem(ty))return eV(!0);t$?tj():(X(""),Q(!0))})():tk()},tC=$?{id:$.id,name:$.name||("anthropic-compatible"===$.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===$.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===$.type?"AC":"OC",apiType:$.apiType,baseUrl:$.baseUrl,type:$.type}:c.zN[n]||c.fg[n]||c.IS[n]||c.nJ[n]||c.br[n],tS=tC?.authModes||[],t$=!!c.zN[n]||!!c.IS[n]||tS.includes("oauth"),tA=!!c.fg[n]||tS.includes("apikey"),tT=!!c.IS[n]?.noAuth,tI=(0,x.KC)(n),tE=(0,c.wG)(n),tP=(0,c.mq)(n),tO=(0,c.gb)(n),tR=tP||tO,t_=!tR&&t$&&tA,tD=m(n),tq="xai"===n?"Grok Build OAuth":"OAuth",tz="xai"===n?"xAI API Key":"qoder"===n?"Qoder PAT":"API Key",tU=c.Q2[n]?.thinkingConfig||c.s9.extended,tM=tR?n:tE,tL=tR?$?.prefix||n:tE,tF=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tM)}`,{cache:"no-store"}),t=await e.json();e.ok&&eF(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tM]),tJ=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tM,ids:[e]})})).ok&&await tF()}catch(e){console.log("Error disabling model:",e)}},tK=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tM)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tF()}catch(e){console.log("Error enabling model:",e)}},tB=async e=>{e.length&&eK({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eK(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tM,ids:e})})).ok&&await tF()}catch(e){console.log("Error disabling all models:",e)}}})},tV=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tM)}`,{method:"DELETE"})).ok&&await tF()}catch(e){console.log("Error enabling all models:",e)}},tG=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&eo(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===n&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eM(e.models)}).catch(()=>{})},[n]);let tH=(0,i.useCallback)(async()=>{try{C("");let[e,t,s,a]=await Promise.allSettled([V("/api/providers"),V("/api/provider-nodes"),V("/api/proxy-pools?isActive=true"),V("/api/settings")]),i="fulfilled"===e.status?e.value.response:null,r="fulfilled"===e.status?e.value.data:{},l="fulfilled"===t.status?t.value.response:null,o="fulfilled"===t.status?t.value.data:{},d="fulfilled"===s.status?s.value.response:null,c="fulfilled"===s.status?s.value.data:{},u="fulfilled"===a.status?a.value.response:null,m=u?.ok&&a.value.data||{};if(i?.ok){let e=(r.connections||[]).filter(e=>e.provider===n);tg.current=e,g(e)}else C("Connections could not be loaded.");d?.ok&&E(c.proxyPools||[]);let p=(m.providerStrategies||{})[n]||{};eI(p.fallbackStrategy||null),eP(null!=p.stickyRoundRobinLimit?String(p.stickyRoundRobinLimit):"1"),e4.current=null!=p.stickyRoundRobinLimit?String(p.stickyRoundRobinLimit):"1";let x=(m.providerThinking||{})[n]||{};eR(x.mode||"auto");let h=F[n];if(eD(h&&m?.[h]?.connections||{}),l?.ok){let e=(o.nodes||[]).find(e=>e.id===n)||null;if(!e&&tR)for(let t=0;t<3;t+=1){if(await new Promise(e=>setTimeout(e,150)),!tb.current)return;let{response:t,data:s}=await V("/api/provider-nodes");if(!tb.current)return;if(t.ok&&(e=(s.nodes||[]).find(e=>e.id===n)||null))break}A(e)}}catch(e){console.log("Error fetching connections:",e),tb.current&&C("Connections could not be loaded.")}finally{tb.current&&w(!1)}},[n,tR]),tW=async e=>{try{let t=await fetch(`/api/provider-nodes/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(A(s.node),await tH(),es(!1))}catch(e){console.log("Error updating provider node:",e)}},tQ=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},i={};e&&(i.fallbackStrategy=e),"round-robin"===e&&""!==t&&(i.stickyRoundRobinLimit=Number(t)||3);let r={...a};0===Object.keys(i).length?delete r[n]:r[n]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:r})})}catch(e){console.log("Error saving provider strategy:",e)}},tZ=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[n]={mode:e}:delete s[n],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},tX=async(e,t)=>{let s=F[n];if(!s)return;let a={...e_,[e]:t};eD(a);try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[s]||{},connections:a};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:t})})).ok)throw Error("Failed to save auto-ping setting")}catch(e){eD(e_),console.log("Error saving auto-ping config:",e)}};(0,i.useEffect)(()=>{tH(),tG(),tF()},[tH,tG,tF]),(0,i.useEffect)(()=>(tb.current=!0,()=>{tb.current=!1}),[]),(0,i.useEffect)(()=>{eK(null),em({}),ex({}),ef(new Set),ez([]),e0({}),e2(null),eX(null),eH(!1),eQ(!1),e5.current=!0,tt("")},[n]),(0,i.useEffect)(()=>{ta(1),tu(1),tl("all"),td("")},[n]),(0,i.useEffect)(()=>{ta(1)},[tn,ti,to]),(0,i.useEffect)(()=>{ec(!1)},[n]),(0,i.useEffect)(()=>{tu(1)},[tm,eL.length,tI.length,eU.length]),(0,i.useEffect)(()=>{if("kiro"!==n)return;let e=window.localStorage.getItem(M),t=!1;return(async()=>{try{if(tt(""),e8?.jobId)return;let a=await B();if(!t&&a.res.ok&&a.data?.job){e9(a.data.job),tf.current=a.data.job.summary?.success||0,window.localStorage.setItem(M,a.data.job.jobId);return}if(e){var s;let a=await K(e);if(!t&&a?.res.ok&&a.data?.job&&(s=a.data.job.status,["queued","running","needs_manual"].includes(s))){e9(a.data.job),tf.current=a.data.job.summary?.success||0;return}tv(),tt(L)}}catch{t||tt(L)}})(),()=>{t=!0}},[tv,e8?.jobId,n]),(0,i.useEffect)(()=>{if(!("kiro"!==n||!e8?.jobId||J(e8.status)))return(0,v.M)(async e=>{let t=await K(e8.jobId);if(!e()){if(t?.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>tf.current&&(tf.current=s,await tH(),e()))return;tt(""),e9(t.data.job);return}if(t?.res.status===404){let t=await B();if(e())return;if(t.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>tf.current&&(tf.current=s,await tH(),e()))return;tt(""),e9(t.data.job),window.localStorage.setItem(M,t.data.job.jobId);return}tv(),tt(L)}}},2e3)},[tv,tH,e8?.jobId,e8?.status,n]),(0,i.useEffect)(()=>{let e=(c.zN[n]||c.fg[n]||c.IS[n]||c.nJ[n])?.modelsFetcher;e&&b(e).then(ez)},[n]);let tY=async(e,t,s=tE)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await tG();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},t0=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tG()}catch(e){console.log("Error deleting alias:",e)}},t1=async()=>{if(e6)return;let e=u.find(e=>!1!==e.isActive);if(!e)return void alert((0,f.Tl)("Please add an active Qoder connection first"));e7(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,f.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,f.Tl)("No models returned"));let i={...el},r=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,""),a=`${tM}/${s}`;!Object.values(i).includes(a)&&(i[s]||(await tY(s,s,tM),i[s]=a,r+=1))}0===r?alert((0,f.Tl)("All models already exist, no new models added")):alert((0,f.Tl)("Successfully added")+` ${r} `+(0,f.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,f.Tl)("Error fetching models")+": "+e.message)}finally{e7(!1)}},t2=async()=>{let e=[...u];if(eG||0===e.length)return;let t=Object.fromEntries(e.map(e=>[e.id,{state:"queued",error:null}]));e5.current=!1,eH(!0),eQ(!1),eX(null),e0(t),e2({total:e.length,completed:0,passed:0,failed:0,stopped:!1});let s=0,a=0;try{for(let t=0;t<e.length;t+=1){if(e5.current){e2({total:e.length,completed:t,passed:s,failed:a,stopped:!0});break}let i=e[t];if(!tg.current.some(e=>e.id===i.id)){e0(e=>({...e,[i.id]:{state:"skipped",error:null}})),e2({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1});continue}eX(i.id),e0(e=>({...e,[i.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${i.id}/test`,{method:"POST"}),t=await e.json(),r=!!t.valid;r?s+=1:a+=1,e0(e=>({...e,[i.id]:{state:r?"success":"failed",error:r?null:t.error||null}}))}catch(e){a+=1,e0(t=>({...t,[i.id]:{state:"failed",error:e.message||"Test failed"}}))}e2({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1}),t<e.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eX(null),eH(!1),eQ(!1),e5.current=!1}},t5=async e=>{eK({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eK(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&g(u.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},t3=()=>{tH(),D(!1)},t4=(0,i.useCallback)(e=>{(e9(e),tt(""),e?.jobId)?(window.localStorage.setItem(M,e.jobId),tf.current=Math.max(tf.current,e.summary?.success||0)):tv()},[tv]),t6=async e=>{X("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tH(),Q(!1);return}X(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),X("Failed to save connection")}},t7=async e=>{try{(await fetch(`/api/providers/${er.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tH(),ee(!1))}catch(e){console.log("Error updating connection:",e)}},t8=async(e,t)=>{try{let s=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(s.ok){let a=await s.json().catch(()=>null);g(s=>s.map(s=>s.id===e?{...s,isActive:t,...a?.connection||{}}:s))}}catch(e){console.log("Error updating connection status:",e)}},t9=async(e,t)=>{let s=[...u];[s[e],s[t]]=[s[t],s[e]],g(s);try{let[a,i]=await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e+1})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t+1})})]);a.ok&&i.ok||(console.log("Priority swap rejected:",a.status,i.status),await tH())}catch(e){console.log("Error swapping priority:",e),await tH()}},se=(0,i.useMemo)(()=>{let e=to.trim().toLowerCase();return u.filter(t=>!!(0,y.i2)(t,tn)&&(!e||[t.name,t.email,t.id,t.account,t.username,t.label,t.authType,t.notes,t.proxyPoolId].filter(Boolean).join(" ").toLowerCase().includes(e)))},[u,tn,to]),st=(0,i.useMemo)(()=>y.gJ.reduce((e,t)=>(e[t.id]="all"===t.id?u.length:u.filter(e=>(0,y.i2)(e,t.id)).length,e),{}),[u]),ss=ej.filter(e=>u.some(t=>t.id===e)),sa=u.filter(e=>ss.includes(e.id)),si="codebuddy"===n?(sa.length>0?sa:u).map(e=>e.id):[],sr=se.length>0&&se.every(e=>ss.includes(e.id)),sn=(()=>{if(0===sa.length)return"";let e=new Set(sa.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=I.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),sl=()=>{eC||ei(!1)},so=async e=>{eS(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tH(),ei(!1)}finally{eS(!1)}},sd=e=>so(sa.map(t=>({connectionId:t.id,proxyPoolId:e}))),sc=e=>{let t="gsuite"===e?"GSuite (non-Gmail)":"Gmail (@gmail.com)";eK({title:`Delete ${t}`,message:`Delete ALL ${t} accounts for this provider? This cannot be undone.`,onConfirm:async()=>{eK(null);try{(await fetch("/api/providers/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:tC?.id||n,emailFilter:e})})).ok&&(ew([]),await tH())}catch(e){console.error("bulk delete error:",e)}}})},su=Math.max(1,Math.ceil(se.length/ti)),sm=Math.min(ts,su),sp=se.slice((sm-1)*ti,sm*ti),sx=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:sp.map((e,t)=>{let s,i=u.findIndex(t=>t.id===e.id);return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("label",{className:"flex w-8 shrink-0 items-center justify-center",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,ss.includes(s)),onChange:()=>{var t;return t=e.id,void ew(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"size-4 rounded border-black/20 dark:border-white/20","aria-label":`Select ${e.name||e.email||e.id}`})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(T,{connection:e,proxyPools:I,isOAuth:t$,isFirst:0===i,isLast:i===u.length-1,onMoveUp:()=>t9(i,i-1),onMoveDown:()=>t9(i,i+1),onToggleActive:t=>t8(e.id,t),autoPingEnabled:!0===e_[e.id],onToggleAutoPing:F[n]&&"oauth"===e.authType?t=>tX(e.id,t):void 0,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&g(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{en(e),ee(!0)},onDelete:()=>t5(e.id),oneByOneStatus:eY[e.id]||null})})]},e.id)})}),sh=I.filter(e=>!0===e.isActive),sf=(0,a.jsx)(d.aF,{isOpen:ea,onClose:sl,title:`Apply Proxy (${sa.length} selected)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=I.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):so(sa.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:eC||0===sh.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>sd(null),disabled:eC,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),I.map(e=>(0,a.jsxs)("button",{onClick:()=>sd(e.id),disabled:eC||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),eC&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:sl,variant:"ghost",fullWidth:!0,disabled:eC,children:"Cancel"})]})}),sg=async e=>{ef(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tM}/${e}`})}),s=await t.json();em(t=>({...t,[e]:s.ok?"ok":"error"})),ex(t=>({...t,[e]:s.ok?"":s.error||"Model not reachable"}))}catch{em(t=>({...t,[e]:"error"})),ex(t=>({...t,[e]:"Network error"}))}finally{ef(t=>{let s=new Set(t);return s.delete(e),s})}};return j?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):tC?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(l(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${tC.color}15`},children:ed?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:tC.color},children:tC.textIcon||tC.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.default,{src:tP&&tC.apiType?"responses"===tC.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":tO?"/providers/anthropic-m.png":`/providers/${tC.id}.png`,alt:tC.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>ec(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:tC.name}),(tC.notice?.apiKeyUrl||tC.notice?.signupUrl||tC.website)&&(0,a.jsxs)("a",{href:tC.notice?.apiKeyUrl||tC.notice?.signupUrl||tC.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),tC.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[u.length," connection",1===u.length?"":"s"]})]})]})]}),tC.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:tC.deprecationNotice})]}),tC.notice?.text&&!tC.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:tC.notice.text}),tC.notice.apiKeyUrl&&(0,a.jsx)("a",{href:tC.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),tR&&$&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:tO?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tO?"Messages API":"responses"===$.apiType?"Responses API":"Chat Completions"," \xb7 ",($.baseUrl||"").replace(/\/$/,""),"/",tO?"messages":"responses"===$.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{X(""),Q(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>es(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eK({title:"Delete Compatible Node",message:`Delete this ${tO?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eK(null);try{(await fetch(`/api/provider-nodes/${n}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tT?(0,a.jsx)(d.gw,{providerId:n}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[u.length>0&&I.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>{if(0===sa.length)return;let e=[...new Set(sa.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"))];eN(1===e.length?e[0]:"__none__"),ei(!0)},disabled:0===sa.length,children:"Apply Proxy"}),u.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:t2,disabled:eG,children:eG?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eG&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eG&&(e5.current=!0,eQ(!0))},disabled:eW,children:eW?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Thinking"}),(0,a.jsx)("select",{value:eO,onChange:e=>{var t;eR(t=e.target.value),tZ(t)},className:"text-xs px-2 py-1 border border-border rounded-md bg-background focus:outline-none focus:border-primary",title:"Forces reasoning_effort on requests; model chips copy as alias/model(level)",children:(tU?.options||c.mt).map(e=>(0,a.jsx)("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===eT,onChange:e=>{let t=e?"round-robin":null,s=e?eE||"1":eE;e&&!eE&&eP("1"),e4.current=s,e3.current&&(clearTimeout(e3.current),e3.current=null),eI(t),tQ(t,s)}}),"round-robin"===eT&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:eE,onChange:e=>{var t;eP(t=e.target.value),e4.current=t,e3.current&&clearTimeout(e3.current),e3.current=setTimeout(()=>{tQ("round-robin",e4.current)},500)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),u.length>0&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-black/5 bg-black/[0.02] p-3 dark:border-white/5 dark:bg-white/[0.02]",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,a.jsx)("input",{type:"checkbox",checked:sr,onChange:()=>{sr?ew(e=>e.filter(e=>!se.some(t=>t.id===e))):ew(e=>Array.from(new Set([...e,...se.map(e=>e.id)])))},className:"size-4 rounded border-black/20 dark:border-white/20"}),sr?"Unselect visible":"Select visible"]}),(0,a.jsxs)(d.Ex,{variant:"default",children:[se.length," visible"]}),sa.length>0&&(0,a.jsxs)(d.Ex,{variant:"default",children:[sa.length," selected"]}),sn&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:sn}),sa.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>{ew([]),eN("__none__")},children:"Clear"}),sa.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:()=>{0!==sa.length&&eK({title:"Delete Selected Connections",message:`Delete ${sa.length} selected connection(s)? This permanently removes the selected accounts.`,onConfirm:async()=>{eK(null);let e=[],t=0;for(let s of sa)try{(await fetch(`/api/providers/${s.id}`,{method:"DELETE"})).ok?e.push(s.id):t+=1}catch(e){console.log("Error deleting selected connection:",e),t+=1}ew(t=>t.filter(t=>!e.includes(t))),t>0&&alert(`Deleted ${e.length} connection(s); ${t} failed.`),await tH()}})},children:["Delete Selected (",sa.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"domain",onClick:()=>sc("gsuite"),children:"Delete GSuite"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"mail",onClick:()=>sc("gmail"),children:"Delete Gmail"})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:y.gJ.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>tl(e.id),className:`rounded-full border px-2.5 py-1 text-xs transition-colors ${tn===e.id?"border-primary/50 bg-primary/10 text-primary":"border-border text-text-muted hover:border-primary/30 hover:text-text-main"}`,children:[e.label,(0,a.jsx)("span",{className:"ml-1 text-[10px] opacity-70",children:st[e.id]||0})]},e.id))}),u.length>=20&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle",children:"search"}),(0,a.jsx)("input",{type:"search",value:to,onChange:e=>td(e.target.value),placeholder:`Search ${u.length} connections (email, name, id)…`,className:"w-full rounded-lg border border-border bg-background py-2 pl-8 pr-3 text-xs text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40"})]})]}),N?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:N})]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{w(!0),tH()},children:"Retry"})]}):0===u.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:t$?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),t_&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tq," or ",tz,"."]})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[tD&&(0,a.jsx)(d.$n,{size:"sm",icon:"automation",onClick:tw,children:"Open Automation"}),t_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tj,children:tq}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:tk,children:tz})]}):tD?null:(0,a.jsxs)(a.Fragment,{children:[!tR&&"iflow"===n&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>z(!0),children:"Cookie"}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:tN,children:tR?"Add API Key":"iflow"===n?"OAuth":"Add Connection"})]})]})]}),"kiro"===n&&e8?.jobId&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",e8.status," | Success: ",e8.summary?.success||0," | Running: ",e8.summary?.running||0," | Queued: ",e8.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(p("kiro")),children:"Resume Bulk Progress"}),J(e8.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:tv,children:"Clear"})]})]}),"kiro"===n&&!e8?.jobId&&te&&(0,a.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:te})]}):(0,a.jsxs)(a.Fragment,{children:[e1&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",e1.total]}),(0,a.jsxs)("span",{children:["Completed: ",e1.completed]}),(0,a.jsxs)("span",{children:["Passed: ",e1.passed]}),(0,a.jsxs)("span",{children:["Failed: ",e1.failed]}),e1.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),eG&&eZ&&(0,a.jsxs)("span",{children:["Running: ",u.find(e=>e.id===eZ)?.name||eZ]})]})}),"kiro"===n&&e8?.jobId&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",e8.status," | Success: ",e8.summary?.success||0," | Running: ",e8.summary?.running||0," | Queued: ",e8.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(p("kiro")),children:"Resume Bulk Progress"}),J(e8.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:tv,children:"Clear"})]})]}),"kiro"===n&&!e8?.jobId&&te&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:te}),sx,"kiro"===n&&su>1&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Page ",sm," of ",su," • Showing ",(sm-1)*ti+1,"-",Math.min(sm*ti,se.length)," of ",se.length," connections"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:sm<=1,onClick:()=>ta(e=>Math.max(1,e-1)),children:"Previous"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:sm>=su,onClick:()=>ta(e=>Math.min(su,e+1)),children:"Next"})]})]}),"kiro"!==n&&se.length>0&&(0,a.jsx)(d.dK,{currentPage:sm,pageSize:ti,totalItems:se.length,onPageChange:ta,onPageSizeChange:e=>{tr(e),ta(1)},className:"mt-2"}),u.length>0&&0===se.length&&(0,a.jsx)("div",{className:"py-8 text-center text-sm text-text-muted",children:"No connections match this status filter."}),!tR&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===n&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>z(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codebuddy"===n&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>{u.length>1&&0===sa.length?alert("Select the CodeBuddy connection(s) that should use this quota cookie first."):H(!0)},title:"Attach CodeBuddy web cookie for quota tracking",className:"w-full sm:w-auto",children:"Quota Cookie"}),tD&&(0,a.jsx)(d.$n,{size:"sm",icon:"automation",onClick:tw,className:"w-full sm:w-auto",children:"Open Automation"}),t_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tj,className:"w-full sm:w-auto",children:tq}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:tk,className:"w-full sm:w-auto",children:tz})]}):tD?null:(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:tN,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!tR&&(e=[...tI,...eU.filter(e=>!tI.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!eL.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eL.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tV,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tB(e),children:"Disable All"})]}))]}),Object.values(ep).some(Boolean)&&(0,a.jsx)("div",{className:"mb-3 flex flex-col gap-1",children:Object.entries(ep).filter(([,e])=>!!e).map(([e,t])=>(0,a.jsxs)("p",{className:"text-xs text-red-500 break-words",children:[e,": ",t]},e))}),(()=>{let e,t,s;if(tR)return(0,a.jsx)(S,{providerStorageAlias:tM,providerDisplayAlias:tL,modelAliases:el,copied:tx,onCopy:th,onSetAlias:tY,onDeleteAlias:t0,onAliasesChanged:tG,connections:u,isAnthropic:tO});let i=[...tI,...eU.filter(e=>!tI.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),r=new Set(eL),l=i.filter(e=>!r.has(e.id)),o=i.filter(e=>r.has(e.id)),c=Object.entries(el).filter(([e,t])=>{let s=`${tM}/`;if(!t.startsWith(s))return!1;let a=t.slice(s.length);return tC.passthroughModels?!tI.some(e=>e.id===a):!tI.some(e=>e.id===a)&&e===a}).map(([e,t])=>({id:t.slice(`${tM}/`.length),alias:e,fullModel:t})),m=Math.min(tc,Math.max(1,Math.ceil(l.length/tm))),p=l.slice((m-1)*tm,m*tm);return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[c.map(e=>(0,a.jsx)(k,{model:{id:e.id},fullModel:`${tL}/${e.id}`,alias:e.alias,copied:tx,onCopy:th,onSetAlias:()=>{},onDeleteAlias:()=>t0(e.alias),testStatus:eu[e.id],onTest:u.length>0||tT?()=>sg(e.id):void 0,isTesting:eh.has(e.id),isCustom:!0,isFree:!1,thinkingSuffix:eO&&"auto"!==eO&&"off"!==eO&&"none"!==eO?eO:null},e.id)),p.map(e=>{let t=`${tM}/${e.id}`,s=`${n}/${e.id}`,i=Object.entries(el).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(k,{model:e,fullModel:`${tL}/${e.id}`,alias:i,copied:tx,onCopy:th,onSetAlias:t=>tY(e.id,t,tM),onDeleteAlias:()=>t0(i),testStatus:eu[e.id],onTest:u.length>0||tT?()=>sg(e.id):void 0,isTesting:eh.has(e.id),isFree:e.isFree,onDisable:()=>tJ(e.id),thinkingSuffix:eO&&"auto"!==eO&&"off"!==eO&&"none"!==eO?eO:null},e.id)}),l.length>tm&&(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(d.dK,{currentPage:m,pageSize:tm,totalItems:l.length,onPageChange:tu,onPageSizeChange:e=>{tp(e),tu(1)}})}),(0,a.jsxs)("button",{onClick:()=>eb(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"codebuddy"===n&&(0,a.jsxs)("button",{onClick:()=>ev(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-cyan-500/50 px-3 py-2 text-xs text-cyan-700 transition-colors hover:border-cyan-500 hover:bg-cyan-500/[0.07] dark:text-cyan-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Discover Models"]}),"qoder"===n&&u.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:t1,disabled:e6,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:e6?{animation:"spin 1s linear infinite"}:void 0,children:e6?"progress_activity":"download"}),e6?(0,f.Tl)("Fetching..."):(0,f.Tl)("Fetch Qoder Models")]}),eq.length>0&&(e=new Set(Object.values(el)),t=new Set(tI.map(e=>e.id)),0===(s=eq.filter(s=>!e.has(`${tM}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await tY(e.id,t,tM)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)("button",{onClick:()=>tK(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),sf,"kiro"===n?(0,a.jsx)(d.Mh,{isOpen:_,providerInfo:tC,onSuccess:t3,onRefresh:tH,initialBulkJobId:e8?.jobId||null,onBulkJobChange:t4,onClose:()=>D(!1)}):"cursor"===n?(0,a.jsx)(d.G9,{isOpen:_,onSuccess:t3,onClose:()=>D(!1)}):"gitlab"===n?(0,a.jsx)(d.vj,{isOpen:_,providerInfo:tC,onSuccess:t3,onClose:()=>D(!1)}):(0,a.jsx)(d.LF,{isOpen:_,provider:n,providerInfo:tC,onSuccess:t3,onClose:()=>D(!1)}),"iflow"===n&&(0,a.jsx)(d.vE,{isOpen:q,onSuccess:()=>{tH(),z(!1)},onClose:()=>z(!1)}),"codebuddy"===n&&(0,a.jsx)(d.xl,{isOpen:G,connectionIds:si,onSuccess:()=>{tH(),H(!1)},onClose:()=>H(!1)}),(0,a.jsx)(P,{isOpen:W,provider:n,providerName:tC.name,isCompatible:tR,isAnthropic:tO,authType:tC?.authType,authHint:tC?.authHint,website:tC?.website,proxyPools:I,error:Z,onSave:t6,onBulkDone:tH,onClose:()=>{X(""),Q(!1)}}),(0,a.jsx)(d.wI,{isOpen:Y,connection:er,proxyPools:I,onSave:t7,onClose:()=>ee(!1)}),tR&&(0,a.jsx)(O,{isOpen:et,node:$,onSave:tW,onClose:()=>es(!1),isAnthropic:tO}),!tR&&(0,a.jsx)(R,{isOpen:eg,providerAlias:tM,providerDisplayAlias:tL,onSave:async e=>{let t=tC?.passthroughModels?e.split("/").pop():e;await tY(e,t,tM),eb(!1)},onClose:()=>eb(!1)}),"codebuddy"===n&&(0,a.jsx)(U,{isOpen:ey,connections:u,onModelsAdded:async e=>{for(let t of e)await tY(t.id,t.id,"cb");await tG()},onClose:()=>ev(!1)}),(0,a.jsx)(d.uo,{isOpen:eB,onClose:()=>eV(!1),onConfirm:()=>{(window.localStorage.setItem(ty,"true"),eV(!1),m("antigravity"))?s.push(p("antigravity")):t$?tj():tk()},title:"Risk Notice",message:tC?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!eJ,onClose:()=>{e$||eK(null)},onConfirm:async()=>{if(e$)return;let e=eJ?.onConfirm;if(e){eA(!0);try{await e()}finally{eA(!1)}}},title:eJ?.title||"Confirm",message:eJ?.message,variant:"danger",loading:e$})]}):(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(l(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},81277:(e,t,s)=>{"use strict";s.d(t,{c:()=>r});var a=s(12115),i=s(70217);function r(e={}){let[t,s]=(0,a.useState)(null),n=JSON.stringify(Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).sort(([e],[t])=>e.localeCompare(t)));return(0,a.useEffect)(()=>(function(e,t,s={}){let a=s.now||Date.now,r=s.setTimer||globalThis.setTimeout,n=s.clearTimer||globalThis.clearTimeout,l=!1,o=null,d=()=>{if(o=null,l)return;let s=a(),n=(0,i.G9)(e,s);t(n),n&&(o=r(d,Math.min(Math.max(1,new Date(n).getTime()-s+1),0x7fffffff)))};return o=r(d,0),()=>{l=!0,null!==o&&n(o),o=null}})(Object.fromEntries(JSON.parse(n)),s),[n]),t}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=42911)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{5498:(e,t,r)=>{Promise.resolve().then(r.bind(r,23686)),Promise.resolve().then(r.bind(r,25086))},23686:(e,t,r)=>{"use strict";r.d(t,{default:()=>$});var a=r(95155),s=r(12115),n=r(57250),l=r(42793);function i(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function o(e){if(e?.unlimited===!0)return e?.remainingPercentage!==void 0&&Number.isFinite(Number(e.remainingPercentage))?Math.max(0,Math.min(100,Math.round(Number(e.remainingPercentage)))):100;if(e?.remainingPercentage!==void 0&&Number.isFinite(Number(e.remainingPercentage)))return Math.max(0,Math.min(100,Math.round(Number(e.remainingPercentage))));if(e?.remaining!==void 0&&Number.isFinite(Number(e.remaining))){let t=Number(e.remaining);if(t>=0&&t<=100&&!(e.total>100&&t<=100&&null!=e.used))return e.total>0?i(e.used,e.total):Math.round(t)}return i(e?.used,e?.total)}function d(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"autoclaw":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:"points"===e?"Points":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message&&!t.quotas?r.push({name:"error",isError:!0,used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"grok-cli":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=!0===t.unlimited||!(t.total>0)&&t.remainingPercentage>0;r.push({name:e,used:t.used||0,total:a?0:t.total||0,resetAt:t.resetAt||null,remainingPercentage:null!=t.remainingPercentage?t.remainingPercentage:a?100:void 0,unlimited:a})});break;case"cloudflare-ai":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=!0===t.unlimited||!(t.total>0);r.push({name:e,used:t.used||0,total:a?0:t.total||0,resetAt:t.resetAt||null,remainingPercentage:null!=t.remainingPercentage?t.remainingPercentage:100*!!a,unlimited:a})});break;default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,...null!=t.remainingPercentage?{remainingPercentage:t.remainingPercentage}:{},...!0===t.unlimited?{unlimited:!0}:{}})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,l.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,s=r.modelKey||r.name;return(e.get(a)??999)-(e.get(s)??999)})}return r}let c=["name","used","total","resetAt","remaining","remainingPercentage","unlimited","message","isError","unit","modelKey"];function u({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:n=!1,paginate:l=!0,totalCount:i}){let[d,m]=(0,s.useState)(1),[x,h]=(0,s.useState)(e);x===e||Array.isArray(x)&&Array.isArray(e)&&x.length===e.length&&x.every((t,r)=>{let a=e[r];return t&&a?c.every(e=>String(t[e]??null)===String(a[e]??null)):t===a})||h(e);let b=(0,s.useMemo)(()=>x.map((e,t)=>({...e,index:t,remaining:o(e)})),[x]),p=(0,s.useMemo)(()=>"remaining-asc"===r?[...b].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...b].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):b,[b,r]),g=l?Math.max(1,Math.ceil(p.length/10)):1;if((0,s.useEffect)(()=>{m(1)},[r,x]),(0,s.useEffect)(()=>{m(e=>Math.min(e,g))},[g]),!e||0===e.length)return null;let f=l?p.slice((d-1)*10,10*d):p,y=0===p.length?0:(d-1)*10+1,v=l?Math.min(10*d,p.length):p.length,k=Number.isFinite(i)?i:p.length,j=t?"py-1 px-1.5":"py-2 px-3",w=t?"text-[11px]":"text-sm",N=t?"text-[11px]":"text-sm",C=t?"text-[10px] leading-tight":"text-xs";return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:[k," quota",k>1?"s":""]}),n&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full table-fixed text-left",children:(0,a.jsx)("tbody",{children:f.map(e=>{var r;if(e.isError)return(0,a.jsx)("tr",{className:"border-b border-black/5 dark:border-white/5",children:(0,a.jsx)("td",{colSpan:3,className:`${j}`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[14px] text-red-500",children:"error"}),(0,a.jsx)("span",{className:`${w} text-red-600 dark:text-red-400 truncate`,children:e.message||"Failed to load quota"})]})})},`error-${e.index}`);let s=(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},n=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let s=Math.ceil(a/6e4);if(s<60)return`${s}m`;let n=Math.floor(s/60),l=s%60;if(n<24)return`${n}h ${l}m`;let i=Math.floor(n/24);return`${i}d ${n%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),l=function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()+1);let n="";n=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${n}, ${l}`}catch{return null}}(e.resetAt);return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${j} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,a.jsx)("span",{className:`${w} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${j} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsx)("span",{className:"text-text-muted",children:!0!==e.unlimited&&e.total>0?`${e.used.toLocaleString()} / ${e.total.toLocaleString()}`:!0===e.unlimited?"Included / ∞":`${e.used.toLocaleString()} / ∞`}),(0,a.jsx)("span",{className:`font-medium ${s.text}`,children:Number.isFinite(e.remaining)?`${e.remaining}%`:"—"})]})]})}),(0,a.jsx)("td",{className:`${j} w-[25%]`,children:"-"!==n||l?t?(0,a.jsx)("div",{className:`${N} text-text-primary font-medium truncate`,title:l||"",children:"-"!==n?`in ${n}`:l}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==n&&(0,a.jsxs)("div",{className:`${N} text-text-primary font-medium`,children:["in ",n]}),l&&(0,a.jsx)("div",{className:`${C} text-text-muted`,children:l})]}):(0,a.jsx)("div",{className:`${N} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),g>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Showing ",y,"-",v," of ",p.length]}),(0,a.jsxs)("span",{children:["Page ",d," / ",g]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>m(e=>Math.max(1,e-1)),disabled:1===d,className:"flex h-11 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:h-7 sm:rounded-md sm:px-2 sm:text-[10px]",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>m(e=>Math.min(g,e+1)),disabled:d===g,className:"flex h-11 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:h-7 sm:rounded-md sm:px-2 sm:text-[10px]",children:"Next"})]})]})]})}var m=r(98542),x=r(84588),h=r(35497),b=r(52679);function p(e,t){if(!t)return e;let r=new Date(t);return!Number.isFinite(r.getTime())||e&&r.getTime()<=e.getTime()?e:r}function g(e){let t=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);return t(e.email)?e.email:(t(e.name),e.name)}function f(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function y(e){return b.Q2[e]?.name||e}function v(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function k(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function j(e,t){return await e(t)}let w="quotaAutoRefresh",N=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],C=[{value:"single",label:"Satuan",icon:"account_circle"},{value:"bulk",label:"Bulk",icon:"stacks"}],S=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}],A=[10,20,50,100];function $(){let[e,t]=(0,s.useState)([]),[r,l]=(0,s.useState)({}),[c,$]=(0,s.useState)({}),[P,q]=(0,s.useState)({}),[E,T]=(0,s.useState)(!0),[M,F]=(0,s.useState)(null),[z,_]=(0,s.useState)(!1),[O,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(60),[R,U]=(0,s.useState)(!0),[H,K]=(0,s.useState)(null),[B,J]=(0,s.useState)(null),[Q,W]=(0,s.useState)(null),[Y,G]=(0,s.useState)(null),[V,X]=(0,s.useState)(!1),[Z,ee]=(0,s.useState)(null),[et,er]=(0,s.useState)(null),[ea,es]=(0,s.useState)(null),[en,el]=(0,s.useState)([]),[ei,eo]=(0,s.useState)("all"),[ed,ec]=(0,s.useState)([]),[eu,em]=(0,s.useState)("single"),[ex,eh]=(0,s.useState)("all"),[eb,ep]=(0,s.useState)("default"),[eg,ef]=(0,s.useState)(!1),[ey,ev]=(0,s.useState)(!1),[ek,ej]=(0,s.useState)(!1),[ew,eN]=(0,s.useState)({}),[eC,eS]=(0,s.useState)(!1),[eA,e$]=(0,s.useState)({}),[eP,eq]=(0,s.useState)({}),[eE,eT]=(0,s.useState)({}),[eM,eF]=(0,s.useState)(1),[ez,e_]=(0,s.useState)(20),[eO,eD]=(0,s.useState)(String(20)),[eL,eI]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eR,eU]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eH=(0,s.useRef)(null),eK=(0,s.useRef)(null),eB=(0,s.useRef)(null),eJ=(0,s.useRef)(0),eQ=async()=>{let e=et?.connection;if(e){es(e.id);try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{method:"POST"}),r=await t.json();if(!t.ok)throw Error(r.error||r.message||"Failed to use reset credit");er(null),await eG(e.id,e.provider)}catch(e){J({message:e.message||"Failed to use Codex reset credit"})}finally{es(null)}}},eW=(0,s.useCallback)(async(e=eM)=>{let r=++eJ.current;try{var a,s;let n=new URLSearchParams({page:String(e),pageSize:String(ez),accountStatus:ex,sort:"priority"});"all"!==ei&&n.set("provider",ei);let l=await fetch(`/api/providers/client?${n.toString()}`);if(!l.ok){let e=await l.json().catch(()=>({}));throw Error(e.error||`Failed to fetch connections (HTTP ${l.status})`)}let i=await l.json();if(r!==eJ.current)return[];let o=i.connections||[],d=(a=i.pagination,a||{page:1,pageSize:ez,total:0,totalPages:1}),c=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,o.length);return t(o),ec(i.providerOptions||[]),eI(d),eU(c),eF((s=i.pagination,s?.page||e)),K(null),o}catch(e){if(console.error("Error fetching connections:",e),r!==eJ.current)return[];return t([]),ec([]),eI({page:1,pageSize:ez,total:0,totalPages:1}),eU({eligibleConnections:0,providerFilteredConnections:0}),K(e.message||"Failed to fetch connections"),[]}},[ex,eM,ez,ei]),eY=(0,s.useCallback)(async(e,t,r=!1)=>{$(t=>({...t,[e]:!0})),q(t=>({...t,[e]:null}));try{var a;let s=await fetch(`/api/usage/${e}${r?"?refresh=1":""}`);if(!s.ok){let r=(await s.json().catch(()=>({}))).error||s.statusText;if(404===s.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===s.status)return console.warn(`[ProviderLimits] Auth error for ${t}:`,r),q(t=>({...t,[e]:r})),null;throw Error(`HTTP ${s.status}: ${r}`)}let n=await s.json(),i=(a=d(t,n),{quotas:a,plan:n.plan||null,message:n.message||null,cached:!0===n.cached,stale:!0===n.stale,fetchedAt:n.fetchedAt||null,refreshError:n.refreshError||null,raw:n});return l(t=>({...t,[e]:i})),{fetchedAt:n.fetchedAt||null}}catch(r){return console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),q(t=>({...t,[e]:r.message||"Failed to fetch quota"})),null}finally{$(t=>({...t,[e]:!1}))}},[]),eG=(0,s.useCallback)(async(e,t)=>{let r=await eY(e,t,!0);F(e=>p(e,r?.fetchedAt))},[eY]),eV=(0,s.useCallback)(async(e,t=!1)=>{if(e&&"all"!==e){eq(t=>({...t,[e]:!0})),eT(t=>({...t,[e]:!1}));try{let r=`/api/usage/aggregate?provider=${encodeURIComponent(e)}${t?"&refresh=1":""}`,a=await fetch(r);if(!a.ok)throw Error("Failed to fetch aggregate");let s=await a.json(),n=d(e,s);return e$(t=>({...t,[e]:{quotas:n,plan:s.plan||null,accountCount:s.accountCount||0,accountsWithQuota:s.accountsWithQuota||0,deadCount:s.deadCount||0,cached:!0===s.cached,fetchedAt:s.fetchedAt||null}})),{fetchedAt:s.fetchedAt||null}}catch(t){return console.error(`[ProviderLimits] Aggregate fetch error for ${e}:`,t),eT(t=>({...t,[e]:!0})),null}finally{eq(t=>({...t,[e]:!1}))}}},[]),eX=(0,s.useCallback)(async(e,t)=>{if("bulk"===eu&&t){let e=await eV(t,!0);F(t=>p(t,e?.fetchedAt));return}if(!e?.length)return;$(t=>({...t,...Object.fromEntries(e.map(e=>[e,!0]))}));let r=await Promise.all(e.map(e=>eY(e,t,!0)));F(e=>r.reduce((e,t)=>p(e,t?.fetchedAt),e))},[eY,eu,eV]),eZ=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){W(e),J(null);try{let t=await fetch(`/api/providers/${e}`,{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||`HTTP ${t.status}`)}l(t=>{let r={...t};return delete r[e],r}),$(t=>{let r={...t};return delete r[e],r}),q(t=>{let r={...t};return delete r[e],r}),await j(eW,eM)}catch(e){console.error("Error deleting connection:",e),J({type:"error",message:e.message||"Failed to delete connection"})}finally{W(null)}}},[eW,eM]),e0=(0,s.useCallback)(async(e,t)=>{G(e),J(null);try{let r=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error||`HTTP ${r.status}`)}await j(eW,eM)}catch(e){console.error("Error updating connection status:",e),await j(eW,eM),J({type:"error",message:e.message||"Failed to update connection status"})}finally{G(null)}},[eW,eM]),e1=(0,s.useCallback)(async e=>{if(!Z?.id)return;let t=Z.id,r=Z.provider;J(null);try{let a=await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`HTTP ${a.status}`)}await eW(),X(!1),ee(null),b.wb.includes(r)&&await eY(t,r)}catch(e){console.error("Error saving connection:",e),J({type:"error",message:e.message||"Failed to save connection"})}},[Z,eW,eY]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&el(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let e5=(0,s.useCallback)(async()=>{if(!O){D(!0),I(60);try{let e=await eW(eM);$(v(e)),q(t=>k(t,e)),l(t=>k(t,e));let t=await Promise.all(e.map(e=>eY(e.id,e.provider,!0)));if("bulk"===eu){let e="all"!==ei?[ei]:ed.map(e=>e.value||e).filter(e=>"all"!==e),r=await Promise.all(e.map(e=>eV(e,!0)));t.push(...r)}F(e=>t.reduce((e,t)=>p(e,t?.fetchedAt),e))}catch(e){console.error("Error refreshing all providers:",e)}finally{D(!1)}}},[O,eW,eY,eM,eu,ei,ed,eV]);(0,s.useEffect)(()=>{(async()=>{U(!0);let e=await eW(eM);U(!1),$(v(e)),q(t=>k(t,e)),l(t=>k(t,e));let t=await Promise.all(e.map(e=>eY(e.id,e.provider)));F(e=>t.reduce((e,t)=>p(e,t?.fetchedAt),e))})()},[eW,eY,eM]),(0,s.useEffect)(()=>{"bulk"!==eu||("all"!==ei?[ei]:ed.map(e=>e.value||e).filter(e=>"all"!==e)).forEach(e=>eV(e))},[eu,ei,ed,eV]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(w);T(null===e||"true"===e),_(!0)},[]),(0,s.useEffect)(()=>{z&&window.localStorage.setItem(w,String(E))},[E,z]),(0,s.useEffect)(()=>{eB.current=e5},[e5]);let e2=(0,s.useCallback)(()=>{eH.current&&(clearInterval(eH.current),eH.current=null),eK.current&&(clearInterval(eK.current),eK.current=null)},[]),e3=(0,s.useCallback)(()=>{eH.current||eK.current||(eH.current=setInterval(()=>{eB.current?.()},6e4),eK.current=setInterval(()=>{I(e=>e<=1?60:e-1)},1e3))},[]);(0,s.useEffect)(()=>z&&E?(document.hidden||e3(),e2):void e2(),[E,z,e3,e2]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?e2():E&&z&&e3()};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[E,z,e3,e2]);let e4=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=f(e,t),n=f(r,t),l="remaining-asc"===s?a-n:n-a;return 0!==l?l:(g(e)||"").localeCompare(g(r)||"")});if(!r)return e;let n=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=n(e)-n(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(g(e)||"").localeCompare(g(t)||"")})})(e,r,eg,ei,eb),[e,r,eg,ei,eb]),e8=(0,s.useMemo)(()=>{let e;return e=new Map,e4.forEach(t=>{t.provider&&(e.has(t.provider)||e.set(t.provider,[]),e.get(t.provider).push(t))}),[...e.entries()].map(([e,t])=>(function(e,t,r,a,s){if(!t.length)return null;let n=[],l=[],i=null,o=!1;return t.forEach(e=>{let t=r[e.id];Array.isArray(t?.quotas)&&n.push(...t.quotas),t?.message&&!i&&(i=t.message),s[e.id]&&l.push(s[e.id]),a[e.id]&&(o=!0)}),{id:`${e}-aggregate`,provider:e,name:y(e),email:`${t.length} accounts`,isActive:t.some(e=>e.isActive??!0),isAggregate:!0,quota:{quotas:function(e=[]){let t=new Map;return e.forEach(e=>{if(!e?.name)return;let r=t.get(e.name)||{name:e.name,used:0,total:0,resetAt:e.resetAt||null,remainingPercentage:null,unlimited:!1,_pctSum:0,_pctCount:0};r.used+=Number(e.used)||0,r.total+=Number(e.total)||0,!0===e.unlimited&&(r.unlimited=!0),null!=e.remainingPercentage&&Number.isFinite(Number(e.remainingPercentage))&&(r._pctSum+=Number(e.remainingPercentage),r._pctCount+=1),e.resetAt&&(!r.resetAt||new Date(e.resetAt).getTime()<new Date(r.resetAt).getTime())&&(r.resetAt=e.resetAt),t.set(e.name,r)}),[...t.values()].map(e=>{let{_pctSum:t,_pctCount:r,...a}=e;return a.unlimited?(a.remainingPercentage=100,a.total=0):a.total>0?a.remainingPercentage=(a.total-a.used)/a.total*100:r>0?a.remainingPercentage=t/r:a.remainingPercentage=0,a})}(n),message:0===n.length&&i||null},isLoading:o,error:!n.length&&l.length>0?l[0]:null,connectionIds:t.map(e=>e.id)}})(e,t,r,c,P)).filter(Boolean)},[e4,r,c,P]),e6=(0,s.useMemo)(()=>Object.keys(eA).length?e8.map(e=>{let t=eA[e.provider];return t&&t.quotas?.length?{...e,email:`${t.accountCount||e.connectionIds?.length||0} accounts`,quota:{...e.quota,quotas:t.quotas,message:null},isLoading:eP[e.provider]||!1}:e}):e8,[e8,eA,eP]),e7=(0,s.useMemo)(()=>"bulk"===eu?e6:e4,[eu,e6,e4]),e9=e=>{let t=r[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=i(e.used,e.total))},te=(0,s.useCallback)(async(e,t)=>{if(e.length&&!eC){eS(!0),J(null);try{let r=(await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})))).filter(e=>!e.ok).length;await j(eW,eM),r>0&&J({type:"error",message:`Failed to update ${r} of ${e.length} connections`})}catch(e){console.error("Error bulk toggling connections:",e),await j(eW,eM),J({type:"error",message:e.message||"Failed to update connections"})}finally{eS(!1)}}},[eC,eW,eM]),tt="all"===ei?"All providers":ei,tr=eR.eligibleConnections>0,ta=(0,s.useCallback)(async()=>{U(!0);let e=await eW(eM);if(U(!1),!e.length)return;$(v(e)),l(t=>k(t,e));let t=await Promise.all(e.map(e=>eY(e.id,e.provider)));F(e=>t.reduce((e,t)=>p(e,t?.fetchedAt),e))},[eW,eY,eM]),ts=e7.length>0,tn=eR.eligibleConnections?eR.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===ei?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ex?"turned off":"active"===ex?"active":"matching"} accounts found for ${ei}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},tl=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eL),ti=!A.includes(ez);return R||tr?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.75rem] gap-2 sm:flex sm:w-auto sm:flex-wrap sm:items-center sm:gap-1.5",children:[(0,a.jsxs)("div",{className:"relative min-w-0",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>ev(e=>!e),className:"flex h-11 w-full min-w-0 items-center justify-between gap-1 rounded-xl border border-black/10 bg-black/[0.02] px-3 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10 sm:h-8 sm:w-auto sm:rounded-lg sm:px-2","aria-haspopup":"menu","aria-expanded":ey,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===ei?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(n.A,{src:`/providers/${ei}.png`,alt:ei,size:18,className:"size-[18px] rounded object-contain",fallbackText:ei.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate capitalize",children:tt})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),ey&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>ev(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ei&&eF(1),eo("all"),ev(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ei?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===ei&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:ed.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ei!==e&&eF(1),eo(e),ev(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ei===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(n.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium capitalize",children:e}),ei===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ex,onChange:e=>{let t=e.target.value;ex!==t&&eF(1),eh(t)},className:"h-11 min-w-0 rounded-xl border border-black/10 bg-black/[0.02] px-3 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10 sm:h-8 sm:rounded-lg sm:px-2","aria-label":"Filter accounts by status",children:N.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsx)("button",{type:"button",onClick:e5,disabled:O,className:"flex size-11 shrink-0 items-center justify-center rounded-xl border border-black/10 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg",title:"Refresh all","aria-label":"Refresh all quotas",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] sm:text-[14px] ${O?"animate-spin":""}`,children:"refresh"})}),(0,a.jsx)("div",{className:"col-span-2 inline-flex min-h-11 min-w-0 overflow-hidden rounded-xl border border-black/10 bg-black/[0.02] dark:border-white/10 dark:bg-white/[0.03] sm:h-8 sm:min-h-0 sm:rounded-lg",children:C.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>em(e.value),"aria-pressed":eu===e.value,className:`flex min-h-11 flex-1 items-center justify-center gap-1.5 px-3 text-xs font-medium transition-colors sm:min-h-0 sm:flex-none sm:justify-start sm:px-2 sm:font-normal ${eu===e.value?"bg-primary text-white":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,title:`Show quota in ${e.label} mode`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px] sm:text-[14px]",children:e.icon}),(0,a.jsx)("span",{children:e.label})]},e.value))}),(0,a.jsx)("button",{type:"button",onClick:()=>ej(e=>!e),"aria-expanded":ek,className:`flex size-11 items-center justify-center rounded-xl border text-text-primary transition-colors sm:hidden ${ek?"border-primary/30 bg-primary/10 text-primary":"border-black/10 hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,"aria-label":ek?"Hide more actions":"Show more actions",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"tune"})}),(0,a.jsxs)("div",{className:`${ek?"flex":"hidden"} col-span-3 flex-col gap-2 rounded-2xl border border-black/10 bg-black/[0.02] p-3 dark:border-white/10 dark:bg-white/[0.03] sm:contents`,children:["codex"===ei&&(0,a.jsx)("select",{value:eb,onChange:e=>ep(e.target.value),className:"h-11 w-full rounded-xl border border-black/10 bg-surface px-3 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/10 sm:h-8 sm:w-auto sm:rounded-lg sm:bg-black/[0.02] sm:px-2 dark:sm:bg-white/[0.03]","aria-label":"Sort Codex quotas by remaining",children:S.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>ef(e=>!e),"aria-pressed":eg,className:`flex h-11 w-full shrink-0 items-center justify-between gap-2 rounded-xl border px-3 text-xs transition-colors sm:h-8 sm:w-auto sm:justify-start sm:rounded-lg sm:px-2 ${eg?"border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-400":"border-black/10 bg-surface text-text-primary hover:bg-black/5 dark:border-white/10 dark:bg-transparent dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] sm:text-[14px]",children:"hourglass_top"}),(0,a.jsx)("span",{children:"Expiring first"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] sm:hidden",children:eg?"check_circle":"circle"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{te(e4.filter(e=>(e.isActive??!0)&&e9(e)).map(e=>e.id),!1)},disabled:eC,className:"flex h-11 w-full shrink-0 items-center gap-2 rounded-xl border border-red-500/30 bg-surface px-3 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50 dark:bg-transparent sm:h-8 sm:w-auto sm:rounded-lg sm:px-2",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] sm:text-[14px]",children:"block"}),(0,a.jsx)("span",{children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{te(e4.filter(e=>!(e.isActive??!0)&&!e9(e)).map(e=>e.id),!0)},disabled:eC,className:"flex h-11 w-full shrink-0 items-center gap-2 rounded-xl border border-emerald-500/30 bg-surface px-3 text-xs text-emerald-600 transition-colors hover:bg-emerald-500/10 disabled:opacity-50 dark:bg-transparent dark:text-emerald-400 sm:h-8 sm:w-auto sm:rounded-lg sm:px-2",title:"Enable connections that still have quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] sm:text-[14px]",children:"check_circle"}),(0,a.jsx)("span",{children:"Turn on Available"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>T(e=>!e),className:"flex h-11 w-full shrink-0 items-center justify-between gap-2 rounded-xl border border-black/10 bg-surface px-3 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-transparent dark:hover:bg-white/5 sm:h-8 sm:w-auto sm:justify-start sm:rounded-lg sm:px-2",title:E?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 text-text-primary",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] sm:text-[14px] ${E?"text-primary":"text-text-muted"}`,children:E?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{children:"Auto-refresh"})]}),E&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",L,"s)"]})]})]})]})}),B&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-xs text-red-700 dark:text-red-300",role:"alert",children:[(0,a.jsx)("span",{children:B.message}),(0,a.jsx)("button",{type:"button",onClick:()=>J(null),"aria-label":"Dismiss",className:"shrink-0 text-red-500 hover:text-red-700 dark:hover:text-red-200",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}),!R&&H&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-xs text-red-700 dark:text-red-300",role:"alert",children:[(0,a.jsxs)("span",{children:["Failed to refresh providers: ",H]}),(0,a.jsx)("button",{type:"button",onClick:ta,className:"shrink-0 font-medium underline hover:no-underline",children:"Retry"})]}),"bulk"===eu&&Object.values(eE).some(Boolean)&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",role:"status",children:"Couldn't load server-side totals for some providers — bulk cards show data for the current page only."}),ts?(0,a.jsxs)(a.Fragment,{children:[eg&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:e7.map(e=>{let t,s=!0===e.isAggregate,l=s?e.quota:r[e.id],i=s?e.isLoading:c[e.id],d=s?e.error:P[e.id],h=l?.quotas||[],b=!0===ew[e.id],p=b?h:function(e,t=3){return e.map((e,t)=>({quota:e,index:t})).sort((e,t)=>{let r=o(e.quota)-o(t.quota);if(0!==r)return r;let a=e.quota.resetAt?new Date(e.quota.resetAt).getTime():1/0,s=t.quota.resetAt?new Date(t.quota.resetAt).getTime():1/0;return a!==s?a-s:e.index-t.index}).slice(0,t).map(({quota:e})=>e)}(h),f=!1===e.isActive,v=!s&&(Q===e.id||Y===e.id),k=s?0:Number.isFinite(t=Number(l?.raw?.resetCredits?.availableCount))?Math.max(0,t):0;return(0,a.jsxs)(x.default,{padding:"none",className:`min-w-0 ${f?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"border-b border-black/10 px-3 py-2 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(n.A,{src:`/providers/${e.provider}.png`,alt:e.provider,size:32,className:"object-contain",fallbackText:e.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:e.name||y(e.provider)}),g(e)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:g(e)}):null]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[!s&&"codex"===e.provider&&(0,a.jsxs)("button",{type:"button",onClick:()=>er({connection:e,count:k}),disabled:k<=0||v||ea===e.id,"aria-label":"Use one Codex reset credit",className:"flex h-11 items-center gap-1 rounded-xl px-2 text-amber-600 transition-colors hover:bg-amber-500/10 disabled:cursor-not-allowed disabled:opacity-40 dark:text-amber-400 sm:h-8 sm:rounded-lg",title:k>0?"Use one reset credit":"No reset credits available",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"restart_alt"}),(0,a.jsx)("span",{className:"text-[10px] tabular-nums",children:k})]}),(0,a.jsx)("button",{type:"button",onClick:()=>s?eX(e.connectionIds,e.provider):eG(e.id,e.provider),disabled:i||v,"aria-label":"Refresh quota",className:"flex size-11 items-center justify-center rounded-xl transition-colors hover:bg-black/5 disabled:opacity-50 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg",title:"Refresh quota",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${i?"animate-spin":""}`,children:"refresh"})}),!s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",onClick:()=>{ee(e),X(!0)},disabled:v,"aria-label":"Edit connection",className:"flex size-11 items-center justify-center rounded-xl text-text-muted transition-colors hover:bg-black/5 hover:text-primary disabled:opacity-50 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg",title:"Edit connection",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eZ(e.id),disabled:v,"aria-label":"Delete connection",className:"flex size-11 items-center justify-center rounded-xl text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50 sm:size-8 sm:rounded-lg",title:"Delete connection",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${Q===e.id?"animate-pulse":""}`,children:"delete"})}),(0,a.jsx)("div",{className:"inline-flex size-11 items-center justify-center sm:h-8 sm:w-auto sm:pl-0.5",title:e.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(m.default,{size:"sm",touchTarget:!0,checked:e.isActive??!0,disabled:v,onChange:t=>e0(e.id,t)})})]})]})]})}),(0,a.jsx)("div",{className:"px-2 py-1.5",children:i?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):d?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:d})]}):h.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"sm:hidden",children:[(0,a.jsx)(u,{quotas:p,totalCount:h.length,paginate:!1,compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==eb}),h.length>3&&(0,a.jsxs)("button",{type:"button",onClick:()=>eN(t=>({...t,[e.id]:!b})),className:"mt-2 flex h-11 w-full items-center justify-center gap-1.5 rounded-xl border border-black/10 bg-black/[0.02] text-xs font-medium text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/5","aria-expanded":b,children:[(0,a.jsx)("span",{children:b?"Show less":`Show ${h.length-p.length} more`}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:b?"expand_less":"expand_more"})]})]}),(0,a.jsx)("div",{className:"hidden sm:block",children:(0,a.jsx)(u,{quotas:h,compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==eb})}),l?.message?(0,a.jsx)("p",{className:"px-1 text-[10px] text-text-muted",children:l.message}):null,l?.refreshError?(0,a.jsxs)("p",{className:"rounded-lg bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-700 dark:text-amber-300",children:["Showing last successful quota; refresh failed: ",l.refreshError]}):null]}):l?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:l.message})}):(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("p",{className:"text-xs",children:"No quota data available"})})})]},e.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:tl}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:ti?"custom":String(ez),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eF(1),e_(r),eD(String(r)))},className:"h-11 rounded-xl border border-black/10 bg-black/[0.02] px-3 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10 sm:h-8 sm:rounded-lg sm:px-2","aria-label":"Accounts per page",children:[A.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eO,onChange:e=>eD(e.target.value),onBlur:()=>{let e=Number.parseInt(eO,10);if(!Number.isFinite(e))return void eD(String(ez));let t=Math.min(500,Math.max(1,e));eF(1),e_(t),eD(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eO,10);if(!Number.isFinite(t))return void eD(String(ez));let r=Math.min(500,Math.max(1,t));eF(1),e_(r),eD(String(r))},className:"h-11 w-24 rounded-xl border border-black/10 bg-black/[0.02] px-3 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10 sm:h-8 sm:w-20 sm:rounded-lg sm:px-2","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eL.page," / ",eL.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eF(1),disabled:eL.page<=1||R||O,className:"flex h-11 items-center rounded-xl border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:h-8 sm:rounded-lg",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eF(e=>Math.max(1,e-1)),disabled:eL.page<=1||R||O,className:"flex size-11 items-center justify-center rounded-xl border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg","aria-label":"Previous accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eF(e=>Math.min(eL.totalPages,e+1)),disabled:eL.page>=eL.totalPages||R||O,className:"flex size-11 items-center justify-center rounded-xl border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg","aria-label":"Next accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eF(eL.totalPages),disabled:eL.page>=eL.totalPages||R||O,className:"flex h-11 items-center rounded-xl border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:h-8 sm:rounded-lg",children:"Last Page"})]})]})})]}):(0,a.jsx)(x.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:tn.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:tn.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:tn.description})]})}),(0,a.jsx)(h.wI,{isOpen:V,connection:Z,proxyPools:en,onSave:e1,onClose:()=>{X(!1),ee(null)}}),(0,a.jsx)(h.uo,{isOpen:!!et,onClose:()=>er(null),onConfirm:eQ,title:"Use Codex Reset Credit",message:`Use 1 reset credit for ${g(et?.connection||{})||"this Codex account"}? This permanently spends one credit and cannot be undone. Available: ${et?.count??0}.`,confirmText:"Use 1 Credit",variant:"danger",loading:!!(et?.connection?.id&&ea===et.connection.id)})]}):H?(0,a.jsx)(x.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-red-500 opacity-30",children:"error"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"Failed to Load Providers"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:H}),(0,a.jsxs)("button",{type:"button",onClick:ta,className:"mt-4 inline-flex items-center gap-2 rounded-xl border border-black/10 px-4 py-2 text-sm text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"refresh"}),"Retry"]})]})}):(0,a.jsx)(x.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=5498)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{5498:(e,t,r)=>{Promise.resolve().then(r.bind(r,23686)),Promise.resolve().then(r.bind(r,25086))},23686:(e,t,r)=>{"use strict";r.d(t,{default:()=>$});var a=r(95155),s=r(12115),n=r(57250),l=r(78681);function i(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function o(e){if(e?.unlimited===!0)return e?.remainingPercentage!==void 0&&Number.isFinite(Number(e.remainingPercentage))?Math.max(0,Math.min(100,Math.round(Number(e.remainingPercentage)))):100;if(e?.remainingPercentage!==void 0&&Number.isFinite(Number(e.remainingPercentage)))return Math.max(0,Math.min(100,Math.round(Number(e.remainingPercentage))));if(e?.remaining!==void 0&&Number.isFinite(Number(e.remaining))){let t=Number(e.remaining);if(t>=0&&t<=100&&!(e.total>100&&t<=100&&null!=e.used))return e.total>0?i(e.used,e.total):Math.round(t)}return i(e?.used,e?.total)}function d(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"autoclaw":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:"points"===e?"Points":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message&&!t.quotas?r.push({name:"error",isError:!0,used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"grok-cli":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=!0===t.unlimited||!(t.total>0)&&t.remainingPercentage>0;r.push({name:e,used:t.used||0,total:a?0:t.total||0,resetAt:t.resetAt||null,remainingPercentage:null!=t.remainingPercentage?t.remainingPercentage:a?100:void 0,unlimited:a})});break;case"cloudflare-ai":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=!0===t.unlimited||!(t.total>0);r.push({name:e,used:t.used||0,total:a?0:t.total||0,resetAt:t.resetAt||null,remainingPercentage:null!=t.remainingPercentage?t.remainingPercentage:100*!!a,unlimited:a})});break;default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,...null!=t.remainingPercentage?{remainingPercentage:t.remainingPercentage}:{},...!0===t.unlimited?{unlimited:!0}:{}})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,l.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,s=r.modelKey||r.name;return(e.get(a)??999)-(e.get(s)??999)})}return r}let c=["name","used","total","resetAt","remaining","remainingPercentage","unlimited","message","isError","unit","modelKey"];function u({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:n=!1,paginate:l=!0,totalCount:i}){let[d,m]=(0,s.useState)(1),[x,h]=(0,s.useState)(e);x===e||Array.isArray(x)&&Array.isArray(e)&&x.length===e.length&&x.every((t,r)=>{let a=e[r];return t&&a?c.every(e=>String(t[e]??null)===String(a[e]??null)):t===a})||h(e);let b=(0,s.useMemo)(()=>x.map((e,t)=>({...e,index:t,remaining:o(e)})),[x]),p=(0,s.useMemo)(()=>"remaining-asc"===r?[...b].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...b].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):b,[b,r]),g=l?Math.max(1,Math.ceil(p.length/10)):1;if((0,s.useEffect)(()=>{m(1)},[r,x]),(0,s.useEffect)(()=>{m(e=>Math.min(e,g))},[g]),!e||0===e.length)return null;let f=l?p.slice((d-1)*10,10*d):p,y=0===p.length?0:(d-1)*10+1,v=l?Math.min(10*d,p.length):p.length,k=Number.isFinite(i)?i:p.length,j=t?"py-1 px-1.5":"py-2 px-3",w=t?"text-[11px]":"text-sm",N=t?"text-[11px]":"text-sm",C=t?"text-[10px] leading-tight":"text-xs";return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:[k," quota",k>1?"s":""]}),n&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full table-fixed text-left",children:(0,a.jsx)("tbody",{children:f.map(e=>{var r;if(e.isError)return(0,a.jsx)("tr",{className:"border-b border-black/5 dark:border-white/5",children:(0,a.jsx)("td",{colSpan:3,className:`${j}`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[14px] text-red-500",children:"error"}),(0,a.jsx)("span",{className:`${w} text-red-600 dark:text-red-400 truncate`,children:e.message||"Failed to load quota"})]})})},`error-${e.index}`);let s=(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},n=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let s=Math.ceil(a/6e4);if(s<60)return`${s}m`;let n=Math.floor(s/60),l=s%60;if(n<24)return`${n}h ${l}m`;let i=Math.floor(n/24);return`${i}d ${n%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),l=function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()+1);let n="";n=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${n}, ${l}`}catch{return null}}(e.resetAt);return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${j} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,a.jsx)("span",{className:`${w} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${j} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsx)("span",{className:"text-text-muted",children:!0!==e.unlimited&&e.total>0?`${e.used.toLocaleString()} / ${e.total.toLocaleString()}`:!0===e.unlimited?"Included / ∞":`${e.used.toLocaleString()} / ∞`}),(0,a.jsx)("span",{className:`font-medium ${s.text}`,children:Number.isFinite(e.remaining)?`${e.remaining}%`:"—"})]})]})}),(0,a.jsx)("td",{className:`${j} w-[25%]`,children:"-"!==n||l?t?(0,a.jsx)("div",{className:`${N} text-text-primary font-medium truncate`,title:l||"",children:"-"!==n?`in ${n}`:l}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==n&&(0,a.jsxs)("div",{className:`${N} text-text-primary font-medium`,children:["in ",n]}),l&&(0,a.jsx)("div",{className:`${C} text-text-muted`,children:l})]}):(0,a.jsx)("div",{className:`${N} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),g>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Showing ",y,"-",v," of ",p.length]}),(0,a.jsxs)("span",{children:["Page ",d," / ",g]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>m(e=>Math.max(1,e-1)),disabled:1===d,className:"flex h-11 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:h-7 sm:rounded-md sm:px-2 sm:text-[10px]",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>m(e=>Math.min(g,e+1)),disabled:d===g,className:"flex h-11 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:h-7 sm:rounded-md sm:px-2 sm:text-[10px]",children:"Next"})]})]})]})}var m=r(98542),x=r(84588),h=r(35497),b=r(52679);function p(e,t){if(!t)return e;let r=new Date(t);return!Number.isFinite(r.getTime())||e&&r.getTime()<=e.getTime()?e:r}function g(e){let t=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);return t(e.email)?e.email:(t(e.name),e.name)}function f(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function y(e){return b.Q2[e]?.name||e}function v(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function k(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function j(e,t){return await e(t)}let w="quotaAutoRefresh",N=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],C=[{value:"single",label:"Satuan",icon:"account_circle"},{value:"bulk",label:"Bulk",icon:"stacks"}],S=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}],A=[10,20,50,100];function $(){let[e,t]=(0,s.useState)([]),[r,l]=(0,s.useState)({}),[c,$]=(0,s.useState)({}),[P,q]=(0,s.useState)({}),[E,T]=(0,s.useState)(!0),[M,F]=(0,s.useState)(null),[z,_]=(0,s.useState)(!1),[O,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(60),[R,U]=(0,s.useState)(!0),[H,K]=(0,s.useState)(null),[B,J]=(0,s.useState)(null),[Q,W]=(0,s.useState)(null),[Y,G]=(0,s.useState)(null),[V,X]=(0,s.useState)(!1),[Z,ee]=(0,s.useState)(null),[et,er]=(0,s.useState)(null),[ea,es]=(0,s.useState)(null),[en,el]=(0,s.useState)([]),[ei,eo]=(0,s.useState)("all"),[ed,ec]=(0,s.useState)([]),[eu,em]=(0,s.useState)("single"),[ex,eh]=(0,s.useState)("all"),[eb,ep]=(0,s.useState)("default"),[eg,ef]=(0,s.useState)(!1),[ey,ev]=(0,s.useState)(!1),[ek,ej]=(0,s.useState)(!1),[ew,eN]=(0,s.useState)({}),[eC,eS]=(0,s.useState)(!1),[eA,e$]=(0,s.useState)({}),[eP,eq]=(0,s.useState)({}),[eE,eT]=(0,s.useState)({}),[eM,eF]=(0,s.useState)(1),[ez,e_]=(0,s.useState)(20),[eO,eD]=(0,s.useState)(String(20)),[eL,eI]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eR,eU]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eH=(0,s.useRef)(null),eK=(0,s.useRef)(null),eB=(0,s.useRef)(null),eJ=(0,s.useRef)(0),eQ=async()=>{let e=et?.connection;if(e){es(e.id);try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{method:"POST"}),r=await t.json();if(!t.ok)throw Error(r.error||r.message||"Failed to use reset credit");er(null),await eG(e.id,e.provider)}catch(e){J({message:e.message||"Failed to use Codex reset credit"})}finally{es(null)}}},eW=(0,s.useCallback)(async(e=eM)=>{let r=++eJ.current;try{var a,s;let n=new URLSearchParams({page:String(e),pageSize:String(ez),accountStatus:ex,sort:"priority"});"all"!==ei&&n.set("provider",ei);let l=await fetch(`/api/providers/client?${n.toString()}`);if(!l.ok){let e=await l.json().catch(()=>({}));throw Error(e.error||`Failed to fetch connections (HTTP ${l.status})`)}let i=await l.json();if(r!==eJ.current)return[];let o=i.connections||[],d=(a=i.pagination,a||{page:1,pageSize:ez,total:0,totalPages:1}),c=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,o.length);return t(o),ec(i.providerOptions||[]),eI(d),eU(c),eF((s=i.pagination,s?.page||e)),K(null),o}catch(e){if(console.error("Error fetching connections:",e),r!==eJ.current)return[];return t([]),ec([]),eI({page:1,pageSize:ez,total:0,totalPages:1}),eU({eligibleConnections:0,providerFilteredConnections:0}),K(e.message||"Failed to fetch connections"),[]}},[ex,eM,ez,ei]),eY=(0,s.useCallback)(async(e,t,r=!1)=>{$(t=>({...t,[e]:!0})),q(t=>({...t,[e]:null}));try{var a;let s=await fetch(`/api/usage/${e}${r?"?refresh=1":""}`);if(!s.ok){let r=(await s.json().catch(()=>({}))).error||s.statusText;if(404===s.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===s.status)return console.warn(`[ProviderLimits] Auth error for ${t}:`,r),q(t=>({...t,[e]:r})),null;throw Error(`HTTP ${s.status}: ${r}`)}let n=await s.json(),i=(a=d(t,n),{quotas:a,plan:n.plan||null,message:n.message||null,cached:!0===n.cached,stale:!0===n.stale,fetchedAt:n.fetchedAt||null,refreshError:n.refreshError||null,raw:n});return l(t=>({...t,[e]:i})),{fetchedAt:n.fetchedAt||null}}catch(r){return console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),q(t=>({...t,[e]:r.message||"Failed to fetch quota"})),null}finally{$(t=>({...t,[e]:!1}))}},[]),eG=(0,s.useCallback)(async(e,t)=>{let r=await eY(e,t,!0);F(e=>p(e,r?.fetchedAt))},[eY]),eV=(0,s.useCallback)(async(e,t=!1)=>{if(e&&"all"!==e){eq(t=>({...t,[e]:!0})),eT(t=>({...t,[e]:!1}));try{let r=`/api/usage/aggregate?provider=${encodeURIComponent(e)}${t?"&refresh=1":""}`,a=await fetch(r);if(!a.ok)throw Error("Failed to fetch aggregate");let s=await a.json(),n=d(e,s);return e$(t=>({...t,[e]:{quotas:n,plan:s.plan||null,accountCount:s.accountCount||0,accountsWithQuota:s.accountsWithQuota||0,deadCount:s.deadCount||0,cached:!0===s.cached,fetchedAt:s.fetchedAt||null}})),{fetchedAt:s.fetchedAt||null}}catch(t){return console.error(`[ProviderLimits] Aggregate fetch error for ${e}:`,t),eT(t=>({...t,[e]:!0})),null}finally{eq(t=>({...t,[e]:!1}))}}},[]),eX=(0,s.useCallback)(async(e,t)=>{if("bulk"===eu&&t){let e=await eV(t,!0);F(t=>p(t,e?.fetchedAt));return}if(!e?.length)return;$(t=>({...t,...Object.fromEntries(e.map(e=>[e,!0]))}));let r=await Promise.all(e.map(e=>eY(e,t,!0)));F(e=>r.reduce((e,t)=>p(e,t?.fetchedAt),e))},[eY,eu,eV]),eZ=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){W(e),J(null);try{let t=await fetch(`/api/providers/${e}`,{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||`HTTP ${t.status}`)}l(t=>{let r={...t};return delete r[e],r}),$(t=>{let r={...t};return delete r[e],r}),q(t=>{let r={...t};return delete r[e],r}),await j(eW,eM)}catch(e){console.error("Error deleting connection:",e),J({type:"error",message:e.message||"Failed to delete connection"})}finally{W(null)}}},[eW,eM]),e0=(0,s.useCallback)(async(e,t)=>{G(e),J(null);try{let r=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error||`HTTP ${r.status}`)}await j(eW,eM)}catch(e){console.error("Error updating connection status:",e),await j(eW,eM),J({type:"error",message:e.message||"Failed to update connection status"})}finally{G(null)}},[eW,eM]),e1=(0,s.useCallback)(async e=>{if(!Z?.id)return;let t=Z.id,r=Z.provider;J(null);try{let a=await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`HTTP ${a.status}`)}await eW(),X(!1),ee(null),b.wb.includes(r)&&await eY(t,r)}catch(e){console.error("Error saving connection:",e),J({type:"error",message:e.message||"Failed to save connection"})}},[Z,eW,eY]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&el(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let e5=(0,s.useCallback)(async()=>{if(!O){D(!0),I(60);try{let e=await eW(eM);$(v(e)),q(t=>k(t,e)),l(t=>k(t,e));let t=await Promise.all(e.map(e=>eY(e.id,e.provider,!0)));if("bulk"===eu){let e="all"!==ei?[ei]:ed.map(e=>e.value||e).filter(e=>"all"!==e),r=await Promise.all(e.map(e=>eV(e,!0)));t.push(...r)}F(e=>t.reduce((e,t)=>p(e,t?.fetchedAt),e))}catch(e){console.error("Error refreshing all providers:",e)}finally{D(!1)}}},[O,eW,eY,eM,eu,ei,ed,eV]);(0,s.useEffect)(()=>{(async()=>{U(!0);let e=await eW(eM);U(!1),$(v(e)),q(t=>k(t,e)),l(t=>k(t,e));let t=await Promise.all(e.map(e=>eY(e.id,e.provider)));F(e=>t.reduce((e,t)=>p(e,t?.fetchedAt),e))})()},[eW,eY,eM]),(0,s.useEffect)(()=>{"bulk"!==eu||("all"!==ei?[ei]:ed.map(e=>e.value||e).filter(e=>"all"!==e)).forEach(e=>eV(e))},[eu,ei,ed,eV]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(w);T(null===e||"true"===e),_(!0)},[]),(0,s.useEffect)(()=>{z&&window.localStorage.setItem(w,String(E))},[E,z]),(0,s.useEffect)(()=>{eB.current=e5},[e5]);let e2=(0,s.useCallback)(()=>{eH.current&&(clearInterval(eH.current),eH.current=null),eK.current&&(clearInterval(eK.current),eK.current=null)},[]),e3=(0,s.useCallback)(()=>{eH.current||eK.current||(eH.current=setInterval(()=>{eB.current?.()},6e4),eK.current=setInterval(()=>{I(e=>e<=1?60:e-1)},1e3))},[]);(0,s.useEffect)(()=>z&&E?(document.hidden||e3(),e2):void e2(),[E,z,e3,e2]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?e2():E&&z&&e3()};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[E,z,e3,e2]);let e4=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=f(e,t),n=f(r,t),l="remaining-asc"===s?a-n:n-a;return 0!==l?l:(g(e)||"").localeCompare(g(r)||"")});if(!r)return e;let n=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=n(e)-n(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(g(e)||"").localeCompare(g(t)||"")})})(e,r,eg,ei,eb),[e,r,eg,ei,eb]),e8=(0,s.useMemo)(()=>{let e;return e=new Map,e4.forEach(t=>{t.provider&&(e.has(t.provider)||e.set(t.provider,[]),e.get(t.provider).push(t))}),[...e.entries()].map(([e,t])=>(function(e,t,r,a,s){if(!t.length)return null;let n=[],l=[],i=null,o=!1;return t.forEach(e=>{let t=r[e.id];Array.isArray(t?.quotas)&&n.push(...t.quotas),t?.message&&!i&&(i=t.message),s[e.id]&&l.push(s[e.id]),a[e.id]&&(o=!0)}),{id:`${e}-aggregate`,provider:e,name:y(e),email:`${t.length} accounts`,isActive:t.some(e=>e.isActive??!0),isAggregate:!0,quota:{quotas:function(e=[]){let t=new Map;return e.forEach(e=>{if(!e?.name)return;let r=t.get(e.name)||{name:e.name,used:0,total:0,resetAt:e.resetAt||null,remainingPercentage:null,unlimited:!1,_pctSum:0,_pctCount:0};r.used+=Number(e.used)||0,r.total+=Number(e.total)||0,!0===e.unlimited&&(r.unlimited=!0),null!=e.remainingPercentage&&Number.isFinite(Number(e.remainingPercentage))&&(r._pctSum+=Number(e.remainingPercentage),r._pctCount+=1),e.resetAt&&(!r.resetAt||new Date(e.resetAt).getTime()<new Date(r.resetAt).getTime())&&(r.resetAt=e.resetAt),t.set(e.name,r)}),[...t.values()].map(e=>{let{_pctSum:t,_pctCount:r,...a}=e;return a.unlimited?(a.remainingPercentage=100,a.total=0):a.total>0?a.remainingPercentage=(a.total-a.used)/a.total*100:r>0?a.remainingPercentage=t/r:a.remainingPercentage=0,a})}(n),message:0===n.length&&i||null},isLoading:o,error:!n.length&&l.length>0?l[0]:null,connectionIds:t.map(e=>e.id)}})(e,t,r,c,P)).filter(Boolean)},[e4,r,c,P]),e6=(0,s.useMemo)(()=>Object.keys(eA).length?e8.map(e=>{let t=eA[e.provider];return t&&t.quotas?.length?{...e,email:`${t.accountCount||e.connectionIds?.length||0} accounts`,quota:{...e.quota,quotas:t.quotas,message:null},isLoading:eP[e.provider]||!1}:e}):e8,[e8,eA,eP]),e7=(0,s.useMemo)(()=>"bulk"===eu?e6:e4,[eu,e6,e4]),e9=e=>{let t=r[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=i(e.used,e.total))},te=(0,s.useCallback)(async(e,t)=>{if(e.length&&!eC){eS(!0),J(null);try{let r=(await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})))).filter(e=>!e.ok).length;await j(eW,eM),r>0&&J({type:"error",message:`Failed to update ${r} of ${e.length} connections`})}catch(e){console.error("Error bulk toggling connections:",e),await j(eW,eM),J({type:"error",message:e.message||"Failed to update connections"})}finally{eS(!1)}}},[eC,eW,eM]),tt="all"===ei?"All providers":ei,tr=eR.eligibleConnections>0,ta=(0,s.useCallback)(async()=>{U(!0);let e=await eW(eM);if(U(!1),!e.length)return;$(v(e)),l(t=>k(t,e));let t=await Promise.all(e.map(e=>eY(e.id,e.provider)));F(e=>t.reduce((e,t)=>p(e,t?.fetchedAt),e))},[eW,eY,eM]),ts=e7.length>0,tn=eR.eligibleConnections?eR.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===ei?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ex?"turned off":"active"===ex?"active":"matching"} accounts found for ${ei}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},tl=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eL),ti=!A.includes(ez);return R||tr?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.75rem] gap-2 sm:flex sm:w-auto sm:flex-wrap sm:items-center sm:gap-1.5",children:[(0,a.jsxs)("div",{className:"relative min-w-0",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>ev(e=>!e),className:"flex h-11 w-full min-w-0 items-center justify-between gap-1 rounded-xl border border-black/10 bg-black/[0.02] px-3 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10 sm:h-8 sm:w-auto sm:rounded-lg sm:px-2","aria-haspopup":"menu","aria-expanded":ey,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===ei?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(n.A,{src:`/providers/${ei}.png`,alt:ei,size:18,className:"size-[18px] rounded object-contain",fallbackText:ei.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate capitalize",children:tt})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),ey&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>ev(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ei&&eF(1),eo("all"),ev(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ei?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===ei&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:ed.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ei!==e&&eF(1),eo(e),ev(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ei===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(n.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium capitalize",children:e}),ei===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ex,onChange:e=>{let t=e.target.value;ex!==t&&eF(1),eh(t)},className:"h-11 min-w-0 rounded-xl border border-black/10 bg-black/[0.02] px-3 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10 sm:h-8 sm:rounded-lg sm:px-2","aria-label":"Filter accounts by status",children:N.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsx)("button",{type:"button",onClick:e5,disabled:O,className:"flex size-11 shrink-0 items-center justify-center rounded-xl border border-black/10 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg",title:"Refresh all","aria-label":"Refresh all quotas",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] sm:text-[14px] ${O?"animate-spin":""}`,children:"refresh"})}),(0,a.jsx)("div",{className:"col-span-2 inline-flex min-h-11 min-w-0 overflow-hidden rounded-xl border border-black/10 bg-black/[0.02] dark:border-white/10 dark:bg-white/[0.03] sm:h-8 sm:min-h-0 sm:rounded-lg",children:C.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>em(e.value),"aria-pressed":eu===e.value,className:`flex min-h-11 flex-1 items-center justify-center gap-1.5 px-3 text-xs font-medium transition-colors sm:min-h-0 sm:flex-none sm:justify-start sm:px-2 sm:font-normal ${eu===e.value?"bg-primary text-white":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,title:`Show quota in ${e.label} mode`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px] sm:text-[14px]",children:e.icon}),(0,a.jsx)("span",{children:e.label})]},e.value))}),(0,a.jsx)("button",{type:"button",onClick:()=>ej(e=>!e),"aria-expanded":ek,className:`flex size-11 items-center justify-center rounded-xl border text-text-primary transition-colors sm:hidden ${ek?"border-primary/30 bg-primary/10 text-primary":"border-black/10 hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,"aria-label":ek?"Hide more actions":"Show more actions",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"tune"})}),(0,a.jsxs)("div",{className:`${ek?"flex":"hidden"} col-span-3 flex-col gap-2 rounded-2xl border border-black/10 bg-black/[0.02] p-3 dark:border-white/10 dark:bg-white/[0.03] sm:contents`,children:["codex"===ei&&(0,a.jsx)("select",{value:eb,onChange:e=>ep(e.target.value),className:"h-11 w-full rounded-xl border border-black/10 bg-surface px-3 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/10 sm:h-8 sm:w-auto sm:rounded-lg sm:bg-black/[0.02] sm:px-2 dark:sm:bg-white/[0.03]","aria-label":"Sort Codex quotas by remaining",children:S.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>ef(e=>!e),"aria-pressed":eg,className:`flex h-11 w-full shrink-0 items-center justify-between gap-2 rounded-xl border px-3 text-xs transition-colors sm:h-8 sm:w-auto sm:justify-start sm:rounded-lg sm:px-2 ${eg?"border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-400":"border-black/10 bg-surface text-text-primary hover:bg-black/5 dark:border-white/10 dark:bg-transparent dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] sm:text-[14px]",children:"hourglass_top"}),(0,a.jsx)("span",{children:"Expiring first"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] sm:hidden",children:eg?"check_circle":"circle"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{te(e4.filter(e=>(e.isActive??!0)&&e9(e)).map(e=>e.id),!1)},disabled:eC,className:"flex h-11 w-full shrink-0 items-center gap-2 rounded-xl border border-red-500/30 bg-surface px-3 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50 dark:bg-transparent sm:h-8 sm:w-auto sm:rounded-lg sm:px-2",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] sm:text-[14px]",children:"block"}),(0,a.jsx)("span",{children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{te(e4.filter(e=>!(e.isActive??!0)&&!e9(e)).map(e=>e.id),!0)},disabled:eC,className:"flex h-11 w-full shrink-0 items-center gap-2 rounded-xl border border-emerald-500/30 bg-surface px-3 text-xs text-emerald-600 transition-colors hover:bg-emerald-500/10 disabled:opacity-50 dark:bg-transparent dark:text-emerald-400 sm:h-8 sm:w-auto sm:rounded-lg sm:px-2",title:"Enable connections that still have quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] sm:text-[14px]",children:"check_circle"}),(0,a.jsx)("span",{children:"Turn on Available"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>T(e=>!e),className:"flex h-11 w-full shrink-0 items-center justify-between gap-2 rounded-xl border border-black/10 bg-surface px-3 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-transparent dark:hover:bg-white/5 sm:h-8 sm:w-auto sm:justify-start sm:rounded-lg sm:px-2",title:E?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 text-text-primary",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] sm:text-[14px] ${E?"text-primary":"text-text-muted"}`,children:E?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{children:"Auto-refresh"})]}),E&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",L,"s)"]})]})]})]})}),B&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-xs text-red-700 dark:text-red-300",role:"alert",children:[(0,a.jsx)("span",{children:B.message}),(0,a.jsx)("button",{type:"button",onClick:()=>J(null),"aria-label":"Dismiss",className:"shrink-0 text-red-500 hover:text-red-700 dark:hover:text-red-200",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}),!R&&H&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-xs text-red-700 dark:text-red-300",role:"alert",children:[(0,a.jsxs)("span",{children:["Failed to refresh providers: ",H]}),(0,a.jsx)("button",{type:"button",onClick:ta,className:"shrink-0 font-medium underline hover:no-underline",children:"Retry"})]}),"bulk"===eu&&Object.values(eE).some(Boolean)&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",role:"status",children:"Couldn't load server-side totals for some providers — bulk cards show data for the current page only."}),ts?(0,a.jsxs)(a.Fragment,{children:[eg&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:e7.map(e=>{let t,s=!0===e.isAggregate,l=s?e.quota:r[e.id],i=s?e.isLoading:c[e.id],d=s?e.error:P[e.id],h=l?.quotas||[],b=!0===ew[e.id],p=b?h:function(e,t=3){return e.map((e,t)=>({quota:e,index:t})).sort((e,t)=>{let r=o(e.quota)-o(t.quota);if(0!==r)return r;let a=e.quota.resetAt?new Date(e.quota.resetAt).getTime():1/0,s=t.quota.resetAt?new Date(t.quota.resetAt).getTime():1/0;return a!==s?a-s:e.index-t.index}).slice(0,t).map(({quota:e})=>e)}(h),f=!1===e.isActive,v=!s&&(Q===e.id||Y===e.id),k=s?0:Number.isFinite(t=Number(l?.raw?.resetCredits?.availableCount))?Math.max(0,t):0;return(0,a.jsxs)(x.default,{padding:"none",className:`min-w-0 ${f?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"border-b border-black/10 px-3 py-2 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(n.A,{src:`/providers/${e.provider}.png`,alt:e.provider,size:32,className:"object-contain",fallbackText:e.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:e.name||y(e.provider)}),g(e)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:g(e)}):null]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[!s&&"codex"===e.provider&&(0,a.jsxs)("button",{type:"button",onClick:()=>er({connection:e,count:k}),disabled:k<=0||v||ea===e.id,"aria-label":"Use one Codex reset credit",className:"flex h-11 items-center gap-1 rounded-xl px-2 text-amber-600 transition-colors hover:bg-amber-500/10 disabled:cursor-not-allowed disabled:opacity-40 dark:text-amber-400 sm:h-8 sm:rounded-lg",title:k>0?"Use one reset credit":"No reset credits available",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"restart_alt"}),(0,a.jsx)("span",{className:"text-[10px] tabular-nums",children:k})]}),(0,a.jsx)("button",{type:"button",onClick:()=>s?eX(e.connectionIds,e.provider):eG(e.id,e.provider),disabled:i||v,"aria-label":"Refresh quota",className:"flex size-11 items-center justify-center rounded-xl transition-colors hover:bg-black/5 disabled:opacity-50 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg",title:"Refresh quota",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${i?"animate-spin":""}`,children:"refresh"})}),!s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",onClick:()=>{ee(e),X(!0)},disabled:v,"aria-label":"Edit connection",className:"flex size-11 items-center justify-center rounded-xl text-text-muted transition-colors hover:bg-black/5 hover:text-primary disabled:opacity-50 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg",title:"Edit connection",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eZ(e.id),disabled:v,"aria-label":"Delete connection",className:"flex size-11 items-center justify-center rounded-xl text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50 sm:size-8 sm:rounded-lg",title:"Delete connection",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${Q===e.id?"animate-pulse":""}`,children:"delete"})}),(0,a.jsx)("div",{className:"inline-flex size-11 items-center justify-center sm:h-8 sm:w-auto sm:pl-0.5",title:e.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(m.default,{size:"sm",touchTarget:!0,checked:e.isActive??!0,disabled:v,onChange:t=>e0(e.id,t)})})]})]})]})}),(0,a.jsx)("div",{className:"px-2 py-1.5",children:i?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):d?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:d})]}):h.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"sm:hidden",children:[(0,a.jsx)(u,{quotas:p,totalCount:h.length,paginate:!1,compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==eb}),h.length>3&&(0,a.jsxs)("button",{type:"button",onClick:()=>eN(t=>({...t,[e.id]:!b})),className:"mt-2 flex h-11 w-full items-center justify-center gap-1.5 rounded-xl border border-black/10 bg-black/[0.02] text-xs font-medium text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/5","aria-expanded":b,children:[(0,a.jsx)("span",{children:b?"Show less":`Show ${h.length-p.length} more`}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:b?"expand_less":"expand_more"})]})]}),(0,a.jsx)("div",{className:"hidden sm:block",children:(0,a.jsx)(u,{quotas:h,compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==eb})}),l?.message?(0,a.jsx)("p",{className:"px-1 text-[10px] text-text-muted",children:l.message}):null,l?.refreshError?(0,a.jsxs)("p",{className:"rounded-lg bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-700 dark:text-amber-300",children:["Showing last successful quota; refresh failed: ",l.refreshError]}):null]}):l?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:l.message})}):(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("p",{className:"text-xs",children:"No quota data available"})})})]},e.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:tl}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:ti?"custom":String(ez),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eF(1),e_(r),eD(String(r)))},className:"h-11 rounded-xl border border-black/10 bg-black/[0.02] px-3 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10 sm:h-8 sm:rounded-lg sm:px-2","aria-label":"Accounts per page",children:[A.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eO,onChange:e=>eD(e.target.value),onBlur:()=>{let e=Number.parseInt(eO,10);if(!Number.isFinite(e))return void eD(String(ez));let t=Math.min(500,Math.max(1,e));eF(1),e_(t),eD(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eO,10);if(!Number.isFinite(t))return void eD(String(ez));let r=Math.min(500,Math.max(1,t));eF(1),e_(r),eD(String(r))},className:"h-11 w-24 rounded-xl border border-black/10 bg-black/[0.02] px-3 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10 sm:h-8 sm:w-20 sm:rounded-lg sm:px-2","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eL.page," / ",eL.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eF(1),disabled:eL.page<=1||R||O,className:"flex h-11 items-center rounded-xl border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:h-8 sm:rounded-lg",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eF(e=>Math.max(1,e-1)),disabled:eL.page<=1||R||O,className:"flex size-11 items-center justify-center rounded-xl border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg","aria-label":"Previous accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eF(e=>Math.min(eL.totalPages,e+1)),disabled:eL.page>=eL.totalPages||R||O,className:"flex size-11 items-center justify-center rounded-xl border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:size-8 sm:rounded-lg","aria-label":"Next accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eF(eL.totalPages),disabled:eL.page>=eL.totalPages||R||O,className:"flex h-11 items-center rounded-xl border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5 sm:h-8 sm:rounded-lg",children:"Last Page"})]})]})})]}):(0,a.jsx)(x.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:tn.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:tn.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:tn.description})]})}),(0,a.jsx)(h.wI,{isOpen:V,connection:Z,proxyPools:en,onSave:e1,onClose:()=>{X(!1),ee(null)}}),(0,a.jsx)(h.uo,{isOpen:!!et,onClose:()=>er(null),onConfirm:eQ,title:"Use Codex Reset Credit",message:`Use 1 reset credit for ${g(et?.connection||{})||"this Codex account"}? This permanently spends one credit and cannot be undone. Available: ${et?.count??0}.`,confirmText:"Use 1 Credit",variant:"danger",loading:!!(et?.connection?.id&&ea===et.connection.id)})]}):H?(0,a.jsx)(x.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-red-500 opacity-30",children:"error"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"Failed to Load Providers"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:H}),(0,a.jsxs)("button",{type:"button",onClick:ta,className:"mt-4 inline-flex items-center gap-2 rounded-xl border border-black/10 px-4 py-2 text-sm text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"refresh"}),"Retry"]})]})}):(0,a.jsx)(x.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=5498)),_N_E=e.O()}]);
|
package/cli/app/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Unreleased
|
|
2
2
|
|
|
3
|
+
# v1.0.218 (2026-08-14)
|
|
4
|
+
|
|
5
|
+
## Added
|
|
6
|
+
- **Qoder Personal Access Tokens now work across validation, model discovery, chat, connection tests, and quota tracking**: stored `pt-` credentials are exchanged for short-lived `jt-` runtime tokens, concurrent exchanges are coalesced, and job-token traffic uses Qoder's compatible API host without replacing the saved PAT.
|
|
7
|
+
- **Ollama Cloud, Kimi, and DeepSeek now expose authoritative live usage**: API-key connections participate in quota refresh, authentication and exhaustion remain distinct, and transient failures preserve the last successful snapshot as stale instead of fabricating zero balance.
|
|
8
|
+
- **Codex exposes model-aware `max` and `ultra` reasoning**: Sol and Terra accept `ultra`, Luna clamps it to `max`, unknown models clamp conservatively to `xhigh`, and explicit request effort keeps precedence over model suffixes and defaults.
|
|
9
|
+
|
|
10
|
+
## Fixes
|
|
11
|
+
- **Claude identity headers are isolated per request**: concurrent clients can no longer inherit another request's Claude Code session metadata, while authorization, cookies, and forwarding headers remain excluded.
|
|
12
|
+
- **OAuth credentials refresh independently of quota and chat traffic**: active expiring connections refresh with bounded concurrency, stale writes are discarded, permanent refresh rejection stops polling, and shutdown waits for an active sweep before database buffers close.
|
|
13
|
+
|
|
3
14
|
# v1.0.217 (2026-08-14)
|
|
4
15
|
|
|
5
16
|
## Fixes
|