omniroute 0.3.0 → 0.4.0
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/README.md +35 -1150
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +28 -23
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/prerender-manifest.json +75 -3
- package/app/.next/routes-manifest.json +30 -0
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/health/page.js +2 -0
- package/app/.next/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -0
- package/app/.next/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -0
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/settings/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page.js +2 -2
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +2 -2
- package/app/.next/server/app/_global-error.rsc +3 -3
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js +1 -1
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +5 -5
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/auth/login/route.js +1 -1
- package/app/.next/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cache/route.js +2 -0
- package/app/.next/server/app/api/cache/route.js.nft.json +1 -0
- package/app/.next/server/app/api/cache/route_client-reference-manifest.js +1 -0
- package/app/.next/server/app/api/cache/stats/route.js +1 -1
- package/app/.next/server/app/api/cache/stats/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -157
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/backups/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/backups/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/cline-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-profiles/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/codex-profiles/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/guide-settings/[toolId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/kilo-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route.js +1 -156
- package/app/.next/server/app/api/cloud/auth/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route.js +1 -156
- package/app/.next/server/app/api/cloud/credentials/update/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route.js +1 -156
- package/app/.next/server/app/api/cloud/model/resolve/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/metrics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route.js +1 -1
- package/app/.next/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/test/route.js +1 -156
- package/app/.next/server/app/api/combos/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/compliance/audit-log/route.js +1 -156
- package/app/.next/server/app/api/compliance/audit-log/route.js.nft.json +1 -1
- package/app/.next/server/app/api/compliance/audit-log/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/db-backups/route.js +1 -156
- package/app/.next/server/app/api/db-backups/route.js.nft.json +1 -1
- package/app/.next/server/app/api/db-backups/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/evals/[suiteId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/evals/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/fallback/chains/route.js +3 -1
- package/app/.next/server/app/api/fallback/chains/route.js.nft.json +1 -1
- package/app/.next/server/app/api/fallback/chains/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route.js +1 -1
- package/app/.next/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route.js +1 -1
- package/app/.next/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/availability/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/catalog/route.js +2 -156
- package/app/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/catalog/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/route.js +2 -156
- package/app/.next/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/monitoring/health/route.js +2 -0
- package/app/.next/server/app/api/monitoring/health/route.js.nft.json +1 -0
- package/app/.next/server/app/api/monitoring/health/route_client-reference-manifest.js +1 -0
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +2 -2
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/policies/route.js +3 -1
- package/app/.next/server/app/api/policies/route.js.nft.json +1 -1
- package/app/.next/server/app/api/policies/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/defaults/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/models/route.js +1 -156
- package/app/.next/server/app/api/pricing/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/route.js +1 -156
- package/app/.next/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-models/route.js +1 -156
- package/app/.next/server/app/api/provider-models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route.js +1 -156
- package/app/.next/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route.js +2 -156
- package/app/.next/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +2 -156
- package/app/.next/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route.js +1 -156
- package/app/.next/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route.js +2 -1
- package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js +2 -156
- package/app/.next/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -156
- package/app/.next/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/rate-limit/route.js +1 -156
- package/app/.next/server/app/api/rate-limit/route.js.nft.json +1 -1
- package/app/.next/server/app/api/rate-limit/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/rate-limits/route.js +1 -1
- package/app/.next/server/app/api/rate-limits/route.js.nft.json +1 -1
- package/app/.next/server/app/api/rate-limits/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/resilience/reset/route.js +1 -1
- package/app/.next/server/app/api/resilience/reset/route.js.nft.json +1 -1
- package/app/.next/server/app/api/resilience/reset/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/resilience/route.js +1 -156
- package/app/.next/server/app/api/resilience/route.js.nft.json +1 -1
- package/app/.next/server/app/api/resilience/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/combo-defaults/route.js +1 -156
- package/app/.next/server/app/api/settings/combo-defaults/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/combo-defaults/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/ip-filter/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/proxy/route.js +1 -156
- package/app/.next/server/app/api/settings/proxy/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxy/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/proxy/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route.js +1 -156
- package/app/.next/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route.js +1 -1
- package/app/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/system-prompt/route.js +1 -156
- package/app/.next/server/app/api/settings/system-prompt/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/system-prompt/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/thinking-budget/route.js +1 -156
- package/app/.next/server/app/api/settings/thinking-budget/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/thinking-budget/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/storage/health/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/cloud/route.js +1 -1
- package/app/.next/server/app/api/sync/cloud/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/initialize/route.js +1 -1
- package/app/.next/server/app/api/sync/initialize/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/telemetry/summary/route.js +1 -1
- package/app/.next/server/app/api/telemetry/summary/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/token-health/route.js +1 -156
- package/app/.next/server/app/api/token-health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/token-health/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/detect/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js +1 -156
- package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/analytics/route.js +1 -156
- package/app/.next/server/app/api/usage/analytics/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/analytics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/budget/route.js +3 -1
- package/app/.next/server/app/api/usage/budget/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/budget/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/call-logs/[id]/route.js +1 -156
- package/app/.next/server/app/api/usage/call-logs/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/call-logs/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/call-logs/route.js +1 -156
- package/app/.next/server/app/api/usage/call-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/call-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/history/route.js +1 -156
- package/app/.next/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/logs/route.js +1 -156
- package/app/.next/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/proxy-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route.js +1 -156
- package/app/.next/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js +1 -156
- package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/images/generations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js +1 -156
- package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js +2 -1
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/moderations/route.js +1 -156
- package/app/.next/server/app/api/v1/moderations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/moderations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route.js +1 -156
- package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route.js +1 -156
- package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/rerank/route.js +1 -156
- package/app/.next/server/app/api/v1/rerank/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/rerank/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js +1 -156
- package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -156
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js +2 -1
- package/app/.next/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page.js +1 -1
- package/app/.next/server/app/callback/page.js.nft.json +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +5 -5
- package/app/.next/server/app/callback.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +7 -7
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +7 -7
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +7 -7
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/health.html +1 -0
- package/app/.next/server/app/dashboard/health.meta +17 -0
- package/app/.next/server/app/dashboard/health.rsc +24 -0
- package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health/__PAGE__.segment.rsc +9 -0
- package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health.segment.rsc +4 -0
- package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +4 -0
- package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk.segment.rsc +5 -0
- package/app/.next/server/app/dashboard/health.segments/_full.segment.rsc +24 -0
- package/app/.next/server/app/dashboard/health.segments/_head.segment.rsc +6 -0
- package/app/.next/server/app/dashboard/health.segments/_index.segment.rsc +9 -0
- package/app/.next/server/app/dashboard/health.segments/_tree.segment.rsc +5 -0
- package/app/.next/server/app/dashboard/onboarding.html +1 -1
- package/app/.next/server/app/dashboard/onboarding.rsc +6 -6
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard/onboarding/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard/onboarding.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/onboarding.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/onboarding.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/onboarding.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/onboarding.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +7 -7
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +7 -7
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +6 -6
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings.html +1 -1
- package/app/.next/server/app/dashboard/settings.rsc +7 -7
- package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard/settings/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/settings.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.html +2 -2
- package/app/.next/server/app/dashboard/translator.rsc +7 -7
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.html +2 -2
- package/app/.next/server/app/dashboard/usage.rsc +7 -7
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/docs/page.js +3 -2
- package/app/.next/server/app/docs/page.js.nft.json +1 -1
- package/app/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/docs.html +1 -1
- package/app/.next/server/app/docs.rsc +21 -20
- package/app/.next/server/app/docs.segments/_full.segment.rsc +21 -20
- package/app/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/docs.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/app/.next/server/app/forbidden/page.js +2 -0
- package/app/.next/server/app/forbidden/page.js.nft.json +1 -0
- package/app/.next/server/app/forbidden/page_client-reference-manifest.js +1 -0
- package/app/.next/server/app/forbidden.html +1 -0
- package/app/.next/server/app/forbidden.meta +15 -0
- package/app/.next/server/app/forbidden.rsc +23 -0
- package/app/.next/server/app/forbidden.segments/_full.segment.rsc +23 -0
- package/app/.next/server/app/forbidden.segments/_head.segment.rsc +6 -0
- package/app/.next/server/app/forbidden.segments/_index.segment.rsc +9 -0
- package/app/.next/server/app/forbidden.segments/_tree.segment.rsc +5 -0
- package/app/.next/server/app/forbidden.segments/forbidden/__PAGE__.segment.rsc +9 -0
- package/app/.next/server/app/forbidden.segments/forbidden.segment.rsc +4 -0
- package/app/.next/server/app/forgot-password/page.js +2 -0
- package/app/.next/server/app/forgot-password/page.js.nft.json +1 -0
- package/app/.next/server/app/forgot-password/page_client-reference-manifest.js +1 -0
- package/app/.next/server/app/forgot-password.html +1 -0
- package/app/.next/server/app/forgot-password.meta +15 -0
- package/app/.next/server/app/forgot-password.rsc +23 -0
- package/app/.next/server/app/forgot-password.segments/_full.segment.rsc +23 -0
- package/app/.next/server/app/forgot-password.segments/_head.segment.rsc +6 -0
- package/app/.next/server/app/forgot-password.segments/_index.segment.rsc +9 -0
- package/app/.next/server/app/forgot-password.segments/_tree.segment.rsc +5 -0
- package/app/.next/server/app/forgot-password.segments/forgot-password/__PAGE__.segment.rsc +9 -0
- package/app/.next/server/app/forgot-password.segments/forgot-password.segment.rsc +4 -0
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +5 -5
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page.js +1 -1
- package/app/.next/server/app/landing/page.js.nft.json +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +5 -5
- package/app/.next/server/app/landing.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page.js +1 -1
- package/app/.next/server/app/login/page.js.nft.json +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +6 -6
- package/app/.next/server/app/login.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/page.js +1 -1
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/privacy/page.js +1 -1
- package/app/.next/server/app/privacy/page.js.nft.json +1 -1
- package/app/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/privacy.html +1 -1
- package/app/.next/server/app/privacy.rsc +20 -21
- package/app/.next/server/app/privacy.segments/_full.segment.rsc +20 -21
- package/app/.next/server/app/privacy.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/privacy.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/privacy.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/privacy.segments/privacy/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/privacy.segments/privacy.segment.rsc +1 -1
- package/app/.next/server/app/terms/page.js +1 -1
- package/app/.next/server/app/terms/page.js.nft.json +1 -1
- package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/terms.html +1 -1
- package/app/.next/server/app/terms.rsc +21 -19
- package/app/.next/server/app/terms.segments/_full.segment.rsc +21 -19
- package/app/.next/server/app/terms.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/terms.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/terms.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/terms.segments/terms/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/terms.segments/terms.segment.rsc +1 -1
- package/app/.next/server/app-paths-manifest.json +28 -23
- package/app/.next/server/chunks/1228.js +3 -1
- package/app/.next/server/chunks/152.js +1 -1
- package/app/.next/server/chunks/1746.js +1 -0
- package/app/.next/server/chunks/216.js +37 -0
- package/app/.next/server/chunks/2399.js +1 -1
- package/app/.next/server/chunks/3676.js +2 -1
- package/app/.next/server/chunks/4004.js +1 -1
- package/app/.next/server/chunks/4352.js +46 -0
- package/app/.next/server/chunks/4436.js +1 -1
- package/app/.next/server/chunks/4443.js +1 -1
- package/app/.next/server/chunks/{8259.js → 4469.js} +52 -2
- package/app/.next/server/chunks/4755.js +3 -3
- package/app/.next/server/chunks/4832.js +2 -2
- package/app/.next/server/chunks/5040.js +1 -1
- package/app/.next/server/chunks/5727.js +1 -0
- package/app/.next/server/chunks/7093.js +2 -0
- package/app/.next/server/chunks/7615.js +9 -2
- package/app/.next/server/chunks/7763.js +1 -0
- package/app/.next/server/chunks/7802.js +1 -0
- package/app/.next/server/chunks/7968.js +3 -1
- package/app/.next/server/chunks/8392.js +1 -0
- package/app/.next/server/chunks/8847.js +3 -0
- package/app/.next/server/chunks/9263.js +1 -0
- package/app/.next/server/middleware.js +207 -2
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +2 -2
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/H6LKncewEoggilnvYL9Ff/_buildManifest.js +1 -0
- package/app/.next/static/chunks/1525-ec661e96acc6574e.js +21 -0
- package/app/.next/static/chunks/3191-0bbb8ebd1bd32d1d.js +1 -0
- package/app/.next/static/chunks/{6941-0643e7aebf5ed645.js → 6941-77ce2b3be7709b94.js} +1 -1
- package/app/.next/static/chunks/7896-6e5648294ec51150.js +2 -0
- package/app/.next/static/chunks/9751-3a35163d337d54ea.js +37 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-148b0ad18f6bec86.js → page-4cec40aa933b932e.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-28e46119138cf102.js → page-962f1e2bfe0d0b8d.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-5caaa75c0ab78bc1.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-81352b2272952085.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-3d3dabe4363d421d.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-57279ed20b5399be.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/{page-4bd8ea64f2e8008b.js → page-9667287d75830fd5.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-d08547fcb1031577.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-26179a630baa2686.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/{page-c891465a1a2938d2.js → page-6190920e7526556c.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/{page-7a0943932e7e5e51.js → page-d1066b6c4c28fe46.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/{layout-e84875e22efbf437.js → layout-b6fc79d0628b97e3.js} +1 -1
- package/app/.next/static/chunks/app/_global-error/page-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/_not-found/page-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/auth/login/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/auth/logout/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cache/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cache/stats/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/backups/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/cline-settings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/codex-profiles/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/guide-settings/[toolId]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/kilo-settings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/runtime/[toolId]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/auth/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/credentials/update/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/model/resolve/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/models/alias/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/combos/[id]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/combos/metrics/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/combos/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/combos/test/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/compliance/audit-log/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/db-backups/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/evals/[suiteId]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/evals/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/fallback/chains/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/init/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/keys/[id]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/keys/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/models/alias/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/models/availability/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/models/catalog/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/models/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/monitoring/health/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/cursor/import/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/import/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/policies/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/pricing/defaults/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/pricing/models/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/pricing/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/provider-models/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/validate/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/models/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/test/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/providers/client/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/providers/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/providers/test-batch/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/providers/validate/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/rate-limit/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/rate-limits/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/resilience/reset/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/resilience/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/restart/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/sessions/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/settings/combo-defaults/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/settings/ip-filter/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/settings/proxy/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/settings/proxy/test/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/settings/require-login/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/settings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/settings/system-prompt/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/settings/thinking-budget/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/shutdown/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/storage/health/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/sync/cloud/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/sync/initialize/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/tags/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/telemetry/summary/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/token-health/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/translator/detect/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/translator/history/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/translator/load/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/translator/save/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/translator/send/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/translator/translate/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/[connectionId]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/analytics/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/budget/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/call-logs/[id]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/call-logs/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/history/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/logs/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/proxy-logs/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/usage/request-logs/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/api/chat/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/audio/speech/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/chat/completions/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/embeddings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/images/generations/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/messages/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/models/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/moderations/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/providers/[provider]/chat/completions/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/providers/[provider]/embeddings/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/providers/[provider]/images/generations/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/rerank/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/responses/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/api/v1beta/models/route-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/app/forbidden/page-6806872971c364f0.js +1 -0
- package/app/.next/static/chunks/app/forgot-password/page-9c116a597f3df4d1.js +1 -0
- package/app/.next/static/chunks/app/global-error-6abc2976016d7bd1.js +1 -0
- package/app/.next/static/chunks/app/layout-6504ce60623b0a41.js +1 -0
- package/app/.next/static/chunks/app/login/{page-e99ed6a85e91ae7c.js → page-93ac51059ef434b7.js} +1 -1
- package/app/.next/static/chunks/app/not-found-e1af8b9c5785b71b.js +1 -0
- package/app/.next/static/chunks/app/page-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-c02303813bcb9777.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-c02303813bcb9777.js +1 -0
- package/app/.next/static/css/2ecfad7c4409b17e.css +1 -0
- package/app/package.json +2 -2
- package/package.json +2 -2
- package/app/.next/server/chunks/1969.js +0 -1
- package/app/.next/server/chunks/21.js +0 -46
- package/app/.next/server/chunks/4412.js +0 -156
- package/app/.next/server/chunks/481.js +0 -156
- package/app/.next/server/chunks/5267.js +0 -1
- package/app/.next/server/chunks/5640.js +0 -1
- package/app/.next/server/chunks/9328.js +0 -156
- package/app/.next/static/HcUrNktdfL89Ss5F7FHxP/_buildManifest.js +0 -1
- package/app/.next/static/chunks/1525-213a0aff01eb1c70.js +0 -21
- package/app/.next/static/chunks/7896-5591822b8348e380.js +0 -1
- package/app/.next/static/chunks/8013-04b90e92e614b5d9.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-ab8b870377087bc7.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-bc5764734a448526.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-fb1fa9ae8a3af8c8.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-fc3451fe77f856f1.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-95b884cdbf859e56.js +0 -1
- package/app/.next/static/chunks/app/_global-error/page-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/_not-found/page-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/auth/login/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/auth/logout/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cache/stats/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/backups/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/cline-settings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/codex-profiles/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/guide-settings/[toolId]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/kilo-settings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/runtime/[toolId]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/auth/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/credentials/update/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/model/resolve/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/models/alias/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/combos/[id]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/combos/metrics/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/combos/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/combos/test/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/compliance/audit-log/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/db-backups/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/evals/[suiteId]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/evals/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/fallback/chains/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/init/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/keys/[id]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/keys/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/models/alias/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/models/availability/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/models/catalog/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/models/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/cursor/import/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/import/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/policies/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/pricing/defaults/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/pricing/models/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/pricing/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/provider-models/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/validate/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/models/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/test/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/providers/client/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/providers/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/providers/test-batch/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/providers/validate/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/rate-limit/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/rate-limits/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/resilience/reset/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/resilience/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/restart/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/sessions/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/settings/combo-defaults/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/settings/ip-filter/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/settings/proxy/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/settings/proxy/test/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/settings/require-login/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/settings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/settings/system-prompt/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/settings/thinking-budget/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/shutdown/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/storage/health/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/sync/cloud/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/sync/initialize/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/tags/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/telemetry/summary/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/token-health/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/translator/detect/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/translator/history/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/translator/load/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/translator/save/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/translator/send/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/translator/translate/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/[connectionId]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/analytics/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/budget/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/call-logs/[id]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/call-logs/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/history/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/logs/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/proxy-logs/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/usage/request-logs/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/api/chat/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/audio/speech/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/chat/completions/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/embeddings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/images/generations/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/messages/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/models/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/moderations/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/providers/[provider]/chat/completions/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/providers/[provider]/embeddings/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/providers/[provider]/images/generations/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/rerank/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/responses/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/api/v1beta/models/route-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/app/global-error-bbdc13af28c5aba1.js +0 -1
- package/app/.next/static/chunks/app/layout-485b011f69e6ed37.js +0 -1
- package/app/.next/static/chunks/app/not-found-2ba4520c9df30430.js +0 -1
- package/app/.next/static/chunks/app/page-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-329f30be723f33ce.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-329f30be723f33ce.js +0 -1
- package/app/.next/static/css/2862d4067eab20b2.css +0 -1
- /package/app/.next/static/{HcUrNktdfL89Ss5F7FHxP → H6LKncewEoggilnvYL9Ff}/_ssgManifest.js +0 -0
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-57279ed20b5399be.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{29556:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>u});var s=i(95155),a=i(12115),r=i(14051),l=i(73321),n=i(98500),o=i(5772),d=i(71525),c=i(55757),p=i(18595),m=i(26853);function u(){let e=(0,l.useParams)(),t=(0,l.useRouter)(),i=e.id,[r,u]=(0,a.useState)([]),[f,v]=(0,a.useState)(!0),[g,w]=(0,a.useState)(null),[A,S]=(0,a.useState)(!1),[T,$]=(0,a.useState)(!1),[R,E]=(0,a.useState)(!1),[I,O]=(0,a.useState)(!1),[_,P]=(0,a.useState)(null),[q,U]=(0,a.useState)(null),[D,K]=(0,a.useState)({}),[L,M]=(0,a.useState)(!1),{copied:F,copy:z}=(0,m.C)(),V=(0,a.useRef)(!1),J=(0,a.useRef)(!1),[B,W]=(0,a.useState)(null),[Z,G]=(0,a.useState)(null),[Q,H]=(0,a.useState)(!1),X=g?{id:g.id,name:g.name||("anthropic-compatible"===g.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===g.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===g.type?"AC":"OC",apiType:g.apiType,baseUrl:g.baseUrl,type:g.type}:c.IS[i]||c.zN[i]||c.fg[i],Y=!!c.IS[i]||!!c.zN[i],ee=(0,p.KC)(i),et=(0,c.wG)(i),ei=(0,c.mq)(i),es=(0,c.gb)(i),ea=ei||es,er=ea?i:et,el=ea?g?.prefix||i:et,en=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&K(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),eo=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"})]),s=await e.json(),a=await t.json();if(e.ok){let e=(s.connections||[]).filter(e=>e.provider===i);u(e)}if(t.ok){let e=(a.nodes||[]).find(e=>e.id===i)||null;if(!e&&ea)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===i)||null))break}w(e)}}catch(e){console.log("Error fetching connections:",e)}finally{v(!1)}},[i,ea]),ed=async e=>{try{let t=await fetch(`/api/provider-nodes/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(w(s.node),await eo(),O(!1))}catch(e){console.log("Error updating provider node:",e)}};(0,a.useEffect)(()=>{eo(),en(),fetch("/api/settings/proxy").then(e=>e.ok?e.json():null).then(e=>G(e)).catch(()=>{})},[eo,en]),(0,a.useEffect)(()=>{f||0!==r.length||!X||ea||V.current||J.current||(V.current=!0,Y?S(!0):$(!0))},[f]);let ec=async(e,t,i=et)=>{let s=`${i}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await en();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},ep=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await en()}catch(e){console.log("Error deleting alias:",e)}},em=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&u(r.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},eu=(0,a.useCallback)(()=>{eo(),S(!1)},[eo]),ex=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,...e})})).ok&&(await eo(),$(!1))}catch(e){console.log("Error saving connection:",e)}},eh=async e=>{try{(await fetch(`/api/providers/${_.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eo(),E(!1))}catch(e){console.log("Error updating connection:",e)}},ef=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&u(i=>i.map(i=>i.id===e?{...i,isActive:t}:i))}catch(e){console.log("Error updating connection status:",e)}},ey=async(e,t)=>{try{(await fetch("/api/rate-limits",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:e,enabled:t})})).ok&&u(i=>i.map(i=>i.id===e?{...i,rateLimitProtection:t}:i))}catch(e){console.error("Error toggling rate limit:",e)}},eb=async e=>{if(e&&!q){U(e);try{let t=await fetch(`/api/providers/${e}/test`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>({}));alert(e.error||"Failed to retest connection");return}await eo()}catch(e){console.error("Error retesting connection:",e)}finally{U(null)}}},ev=async(e,t)=>{if(e&&t)try{let i=t.priority,s=e.priority;i===s&&(i=r.indexOf(e)>r.indexOf(t)?t.priority-.5:t.priority+.5),await Promise.all([fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:i})}),fetch(`/api/providers/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:s})})]),await eo()}catch(e){console.log("Error swapping priority:",e)}},eg=async()=>{if(Q)return;let e=r.find(e=>!1!==e.isActive);if(e){H(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),i=await t.json();if(!t.ok)return void alert(i.error||"Failed to import models");let s=i.models||[];if(0===s.length)return void alert("No models returned from /models.");let a=0;for(let e of s){let t=e.id||e.name||e.model;if(!t)continue;let i=t.split("/"),s=i[i.length-1];D[s]||(await ec(t,s,er),a+=1)}0===a&&alert("No new models were added (all already exist)."),await en()}catch(e){console.log("Error importing models:",e)}finally{H(!1)}}},ej=r.some(e=>!1!==e.isActive);return f?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(d.Qv,{}),(0,s.jsx)(d.Qv,{})]}):X?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(n,{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${X.color}15`},children:L?(0,s.jsx)("span",{className:"text-sm font-bold",style:{color:X.color},children:X.textIcon||X.id.slice(0,2).toUpperCase()}):(0,s.jsx)(o.default,{src:ei&&X.apiType?"responses"===X.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":es?"/providers/anthropic-m.png":`/providers/${X.id}.png`,alt:X.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>M(!0)})}),(0,s.jsxs)("div",{children:[X.website?(0,s.jsxs)("a",{href:X.website,target:"_blank",rel:"noopener noreferrer",className:"text-3xl font-semibold tracking-tight hover:underline inline-flex items-center gap-2",style:{color:X.color},children:[X.name,(0,s.jsx)("span",{className:"material-symbols-outlined text-lg opacity-60",children:"open_in_new"})]}):(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:X.name}),(0,s.jsxs)("p",{className:"text-text-muted",children:[r.length," connection",1===r.length?"":"s"]})]})]})]}),ea&&g&&(0,s.jsxs)(d.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:es?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:[es?"Messages API":"responses"===g.apiType?"Responses API":"Chat Completions"," ","\xb7 ",(g.baseUrl||"").replace(/\/$/,""),"/",es?"messages":"responses"===g.apiType?"responses":"chat/completions"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>$(!0),disabled:r.length>0,children:"Add"}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>O(!0),children:"Edit"}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${es?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${i}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),r.length>0&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),(0,s.jsxs)(d.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),!ea&&(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>Y?S(!0):$(!0),children:"Add"})]}),0===r.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:Y?"lock":"key"})}),(0,s.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!ea&&(0,s.jsx)(d.$n,{icon:"add",onClick:()=>Y?S(!0):$(!0),children:"Add Connection"})]}):(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:r.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,t)=>(0,s.jsx)(j,{connection:e,isOAuth:Y,isFirst:0===t,isLast:t===r.length-1,onMoveUp:()=>ev(e,r[t-1]),onMoveDown:()=>ev(e,r[t+1]),onToggleActive:t=>ef(e.id,t),onToggleRateLimit:t=>ey(e.id,t),onRetest:()=>eb(e.id),isRetesting:q===e.id,onEdit:()=>{P(e),E(!0)},onDelete:()=>em(e.id),onReauth:Y?()=>S(!0):void 0,onProxy:()=>W({level:"key",id:e.id,label:e.name||e.email||e.id}),hasProxy:!!Z?.keys?.[e.id]},e.id))})]}),(0,s.jsxs)(d.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:X.passthroughModels?"Model Aliases":"Available Models"}),(()=>{if(ea)return(0,s.jsx)(b,{providerStorageAlias:er,providerDisplayAlias:el,modelAliases:D,copied:F,onCopy:z,onSetAlias:ec,onDeleteAlias:ep,connections:r,isAnthropic:es});if(X.passthroughModels)return(0,s.jsx)(h,{providerAlias:et,modelAliases:D,copied:F,onCopy:z,onSetAlias:ec,onDeleteAlias:ep});let e=(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:eg,disabled:!ej||Q,children:Q?"Importing...":"Import from /models"}),!ej&&(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Add a connection to enable importing."})]});return 0===ee.length?(0,s.jsxs)("div",{children:[e,(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No models configured"})]}):(0,s.jsxs)("div",{children:[e,(0,s.jsx)("div",{className:"flex flex-wrap gap-3",children:ee.map(e=>{let t=`${er}/${e.id}`,a=`${i}/${e.id}`,r=Object.entries(D).find(([,e])=>e===t||e===a)?.[0];return(0,s.jsx)(x,{model:e,fullModel:`${el}/${e.id}`,alias:r,copied:F,onCopy:z,onSetAlias:t=>ec(e.id,t,er),onDeleteAlias:()=>ep(r)},e.id)})})]})})(),!ea&&(0,s.jsx)(y,{providerId:i,providerAlias:el,copied:F,onCopy:z})]}),"kiro"===i?(0,s.jsx)(d.Mh,{isOpen:A,providerInfo:X,onSuccess:eu,onClose:()=>{J.current=!0,S(!1)}}):"cursor"===i?(0,s.jsx)(d.G9,{isOpen:A,onSuccess:eu,onClose:()=>{J.current=!0,S(!1)}}):(0,s.jsx)(d.LF,{isOpen:A,provider:i,providerInfo:X,onSuccess:eu,onClose:()=>{J.current=!0,S(!1)}}),(0,s.jsx)(N,{isOpen:T,provider:i,providerName:X.name,isCompatible:ea,isAnthropic:es,onSave:ex,onClose:()=>$(!1)}),(0,s.jsx)(k,{isOpen:R,connection:_,onSave:eh,onClose:()=>E(!1)}),ea&&(0,s.jsx)(C,{isOpen:I,node:g,onSave:ed,onClose:()=>O(!1),isAnthropic:es}),B&&(0,s.jsx)(d.KN,{isOpen:!!B,onClose:()=>W(null),level:B.level,levelId:B.id,levelLabel:B.label})]}):(0,s.jsxs)("div",{className:"text-center py-20",children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,s.jsx)(n,{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function x({model:e,fullModel:t,alias:i,copied:a,onCopy:r}){return(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>r(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})})]})}function h({providerAlias:e,modelAliases:t,copied:i,onCopy:r,onSetAlias:l,onDeleteAlias:n}){let[o,c]=(0,a.useState)(""),[p,m]=(0,a.useState)(!1),u=Object.entries(t).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),x=async()=>{let e;if(!o.trim()||p)return;let i=o.trim(),s=(e=i.split("/"))[e.length-1];if(t[s])return void alert(`Alias "${s}" already exists. Please use a different model or edit existing alias.`);m(!0);try{await l(i,s),c("")}catch(e){console.log("Error adding model:",e)}finally{m(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"OpenRouter supports any model. Add models and create aliases for quick access."}),(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{htmlFor:"new-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID (from OpenRouter)"}),(0,s.jsx)("input",{id:"new-model-input",type:"text",value:o,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&x(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:x,disabled:!o.trim()||p,children:p?"Adding...":"Add"})]}),u.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:u.map(({modelId:e,fullModel:t,alias:a})=>(0,s.jsx)(f,{modelId:e,fullModel:t,copied:i,onCopy:r,onDeleteAlias:()=>n(a)},t))})]})}function f({modelId:e,fullModel:t,copied:i,onCopy:a,onDeleteAlias:r}){return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e}`?"check":"content_copy"})})]})]}),(0,s.jsx)("button",{onClick:r,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function y({providerId:e,providerAlias:t,copied:i,onCopy:r}){let[l,n]=(0,a.useState)([]),[o,c]=(0,a.useState)(""),[p,m]=(0,a.useState)(""),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!0),y=(0,a.useCallback)(async()=>{try{let t=await fetch(`/api/provider-models?provider=${e}`);if(t.ok){let e=await t.json();n(e.models||[])}}catch(e){console.error("Failed to fetch custom models:",e)}finally{f(!1)}},[e]);(0,a.useEffect)(()=>{y()},[y]);let b=async()=>{if(o.trim()&&!u){x(!0);try{(await fetch("/api/provider-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,modelId:o.trim(),modelName:p.trim()||void 0})})).ok&&(c(""),m(""),await y())}catch(e){console.error("Failed to add custom model:",e)}finally{x(!1)}}},v=async t=>{try{await fetch(`/api/provider-models?provider=${e}&model=${encodeURIComponent(t)}`,{method:"DELETE"}),await y()}catch(e){console.error("Failed to remove custom model:",e)}};return(0,s.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[(0,s.jsxs)("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-primary",children:"tune"}),"Custom Models"]}),(0,s.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Add model IDs not in the default list. These will be available for routing."}),(0,s.jsxs)("div",{className:"flex items-end gap-2 mb-3",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{htmlFor:"custom-model-id",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"custom-model-id",type:"text",value:o,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&b(),placeholder:"e.g. gpt-4.5-turbo",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsxs)("div",{className:"w-40",children:[(0,s.jsx)("label",{htmlFor:"custom-model-name",className:"text-xs text-text-muted mb-1 block",children:"Display Name"}),(0,s.jsx)("input",{id:"custom-model-name",type:"text",value:p,onChange:e=>m(e.target.value),onKeyDown:e=>"Enter"===e.key&&b(),placeholder:"Optional",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:b,disabled:!o.trim()||u,children:u?"Adding...":"Add"})]}),h?(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Loading..."}):l.length>0?(0,s.jsx)("div",{className:"flex flex-col gap-2",children:l.map(e=>{let a=`${t}/${e.id}`,l=`custom-${e.id}`;return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-primary",children:"tune"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e.name||e.id}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:a}),(0,s.jsx)("button",{onClick:()=>r(a,l),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===l?"check":"content_copy"})})]})]}),(0,s.jsx)("button",{onClick:()=>v(e.id),className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]},e.id)})}):(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"No custom models added yet."})]})}function b({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:i,copied:r,onCopy:l,onSetAlias:n,onDeleteAlias:o,connections:c,isAnthropic:p}){let[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!1),v=Object.entries(i).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),g=e=>{let s,a=(s=e.split("/"))[s.length-1];if(!i[a])return a;let r=`${t}-${a}`;return i[r]?null:r},j=async()=>{if(!m.trim()||x)return;let t=m.trim(),i=g(t);if(!i)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await n(t,i,e),u("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},N=async()=>{if(y)return;let t=c.find(e=>!1!==e.isActive);if(t){b(!0);try{let i=await fetch(`/api/providers/${t.id}/models`),s=await i.json();if(!i.ok)return void alert(s.error||"Failed to import models");let a=s.models||[];if(0===a.length)return void alert("No models returned from /models.");let r=0;for(let t of a){let i=t.id||t.name||t.model;if(!i)continue;let s=g(i);s&&(await n(i,s,e),r+=1)}0===r&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{b(!1)}}},k=c.some(e=>!1!==e.isActive);return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",p?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,s.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&j(),placeholder:p?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:j,disabled:!m.trim()||x,children:x?"Adding...":"Add"}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:N,disabled:!k||y,children:y?"Importing...":"Import from /models"})]}),!k&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),v.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:v.map(({modelId:e,fullModel:i,alias:a})=>(0,s.jsx)(f,{modelId:e,fullModel:`${t}/${e}`,copied:r,onCopy:l,onDeleteAlias:()=>o(a)},i))})]})}function v({until:e}){let[t,i]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void i("");let s=Math.floor(t/1e3);if(s<60)i(`${s}s`);else if(s<3600)i(`${Math.floor(s/60)}m ${s%60}s`);else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);i(`${e}h ${t}m`)}};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}x.propTypes={model:r.shape({id:r.string.isRequired}).isRequired,fullModel:r.string.isRequired,alias:r.string,copied:r.string,onCopy:r.func.isRequired},h.propTypes={providerAlias:r.string.isRequired,modelAliases:r.object.isRequired,copied:r.string,onCopy:r.func.isRequired,onSetAlias:r.func.isRequired,onDeleteAlias:r.func.isRequired},f.propTypes={modelId:r.string.isRequired,fullModel:r.string.isRequired,copied:r.string,onCopy:r.func.isRequired,onDeleteAlias:r.func.isRequired},y.propTypes={providerId:r.string.isRequired,providerAlias:r.string.isRequired,copied:r.string,onCopy:r.func.isRequired},b.propTypes={providerStorageAlias:r.string.isRequired,providerDisplayAlias:r.string.isRequired,modelAliases:r.object.isRequired,copied:r.string,onCopy:r.func.isRequired,onSetAlias:r.func.isRequired,onDeleteAlias:r.func.isRequired,connections:r.arrayOf(r.shape({id:r.string,isActive:r.bool})).isRequired,isAnthropic:r.bool},v.propTypes={until:r.string.isRequired};let g={runtime_error:{label:"Local runtime",variant:"warning"},upstream_auth_error:{label:"Upstream auth",variant:"error"},auth_missing:{label:"Missing credential",variant:"warning"},token_refresh_failed:{label:"Refresh failed",variant:"warning"},token_expired:{label:"Token expired",variant:"warning"},upstream_rate_limited:{label:"Rate limited",variant:"warning"},upstream_unavailable:{label:"Upstream unavailable",variant:"error"},network_error:{label:"Network error",variant:"warning"},unsupported:{label:"Test unsupported",variant:"default"},upstream_error:{label:"Upstream error",variant:"error"}};function j({connection:e,isOAuth:t,isFirst:i,isLast:r,onMoveUp:l,onMoveDown:n,onToggleActive:o,onToggleRateLimit:c,onRetest:p,isRetesting:m,onEdit:u,onDelete:x,onReauth:h,onProxy:f,hasProxy:y}){let b=t?e.name||e.email||e.displayName||"OAuth Account":e.name,[j,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t=()=>{N(e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now())};t();let i=e.rateLimitedUntil?setInterval(t,1e3):null;return()=>{i&&clearInterval(i)}},[e.rateLimitedUntil]);let k="unavailable"!==e.testStatus||j?e.testStatus:"active",C=function(e,t,i){if(!1===e.isActive)return{statusVariant:"default",statusLabel:"disabled",errorType:null,errorBadge:null,errorTextClass:"text-text-muted"};if("active"===t||"success"===t)return{statusVariant:"success",statusLabel:"connected",errorType:null,errorBadge:null,errorTextClass:"text-text-muted"};let s=function(e,t){if(t)return"upstream_rate_limited";if(e.lastErrorType)return e.lastErrorType;let i=Number(e.errorCode);if(401===i||403===i)return"upstream_auth_error";if(429===i)return"upstream_rate_limited";if(i>=500)return"upstream_unavailable";let s=(e.lastError||"").toLowerCase();return s?s.includes("runtime")||s.includes("not runnable")||s.includes("not installed")||s.includes("healthcheck")?"runtime_error":s.includes("refresh failed")?"token_refresh_failed":s.includes("token expired")||s.includes("expired")?"token_expired":s.includes("invalid api key")||s.includes("token invalid")||s.includes("revoked")||s.includes("access denied")||s.includes("unauthorized")?"upstream_auth_error":s.includes("rate limit")||s.includes("quota")||s.includes("too many requests")||s.includes("429")?"upstream_rate_limited":s.includes("fetch failed")||s.includes("network")||s.includes("timeout")||s.includes("econn")||s.includes("enotfound")?"network_error":s.includes("not supported")?"unsupported":"upstream_error":null}(e,i),a=s&&g[s]||null;return"runtime_error"===s?{statusVariant:"warning",statusLabel:"runtime issue",errorType:s,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"upstream_auth_error"===s||"auth_missing"===s||"token_refresh_failed"===s||"token_expired"===s?{statusVariant:"error",statusLabel:"auth failed",errorType:s,errorBadge:a,errorTextClass:"text-red-500"}:"upstream_rate_limited"===s?{statusVariant:"warning",statusLabel:"rate limited",errorType:s,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"network_error"===s?{statusVariant:"warning",statusLabel:"network issue",errorType:s,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"unsupported"===s?{statusVariant:"default",statusLabel:"test unsupported",errorType:s,errorBadge:a,errorTextClass:"text-text-muted"}:{statusVariant:"error",statusLabel:t||"error",errorType:s,errorBadge:a,errorTextClass:"text-red-500"}}(e,k,j),w=!!e.rateLimitProtection;return(0,s.jsxs)("div",{className:`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:l,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:n,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:t?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:b}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[(0,s.jsx)(d.Ex,{variant:C.statusVariant,size:"sm",dot:!0,children:C.statusLabel}),j&&!1!==e.isActive&&(0,s.jsx)(v,{until:e.rateLimitedUntil}),C.errorBadge&&!1!==e.isActive&&(0,s.jsx)(d.Ex,{variant:C.errorBadge.variant,size:"sm",children:C.errorBadge.label}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:`text-xs truncate max-w-[300px] ${C.errorTextClass}`,title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),(0,s.jsx)("span",{className:"text-text-muted/30 select-none",children:"|"}),(0,s.jsxs)("button",{onClick:()=>c(!w),className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium transition-all cursor-pointer ${w?"bg-emerald-500/15 text-emerald-500 hover:bg-emerald-500/25":"bg-black/[0.03] dark:bg-white/[0.03] text-text-muted/50 hover:text-text-muted hover:bg-black/[0.06] dark:hover:bg-white/[0.06]"}`,title:w?"Click to disable rate limit protection":"Click to enable rate limit protection",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"shield"}),w?"Protected":"Unprotected"]}),y&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-text-muted/30 select-none",children:"|"}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs font-medium bg-primary/15 text-primary",title:"Proxy configured",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"vpn_lock"}),"Proxy"]})]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"refresh",loading:m,disabled:!1===e.isActive,onClick:p,className:"!h-7 !px-2 text-xs",title:"Retest authentication",children:"Retest"}),(0,s.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:o,title:e.isActive??!0?"Disable connection":"Enable connection"}),(0,s.jsxs)("div",{className:"flex gap-1 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h&&(0,s.jsx)("button",{onClick:h,className:"p-2 hover:bg-amber-500/10 rounded text-amber-600 hover:text-amber-500",title:"Re-authenticate this connection",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"passkey"})}),(0,s.jsx)("button",{onClick:u,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,s.jsx)("button",{onClick:f,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",title:"Proxy config",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"vpn_lock"})}),(0,s.jsx)("button",{onClick:x,className:"p-2 hover:bg-red-500/10 rounded text-red-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]})]})}function N({isOpen:e,provider:t,providerName:i,isCompatible:r,isAnthropic:l,onSave:n,onClose:o}){let[c,p]=(0,a.useState)({name:"",apiKey:"",priority:1}),[m,u]=(0,a.useState)(!1),[x,h]=(0,a.useState)(null),[f,y]=(0,a.useState)(!1),b=async()=>{u(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})}),i=await e.json();h(i.valid?"success":"failed")}catch{h("failed")}finally{u(!1)}},v=async()=>{if(t&&c.apiKey){y(!0);try{let e=!1;try{u(!0),h(null);let i=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await i.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{u(!1)}await n({name:c.name,apiKey:c.apiKey,priority:c.priority,testStatus:e?"active":"unknown"})}finally{y(!1)}}};return t?(0,s.jsx)(d.aF,{isOpen:e,title:`Add ${i||t} API Key`,onClose:o,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(d.pd,{label:"Name",value:c.name,onChange:e=>p({...c,name:e.target.value}),placeholder:"Production Key"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.pd,{label:"API Key",type:"password",value:c.apiKey,onChange:e=>p({...c,apiKey:e.target.value}),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.$n,{onClick:b,disabled:!c.apiKey||m||f,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,s.jsx)(d.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),r&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:l?`Validation checks ${i||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${i||"OpenAI Compatible"} via /models on your base URL.`}),(0,s.jsx)(d.pd,{label:"Priority",type:"number",value:c.priority,onChange:e=>p({...c,priority:Number.parseInt(e.target.value)||1})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!c.name||!c.apiKey||f,children:f?"Saving...":"Save"}),(0,s.jsx)(d.$n,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function k({isOpen:e,connection:t,onSave:i,onClose:r}){let[l,n]=(0,a.useState)({name:"",priority:1,apiKey:"",healthCheckInterval:60}),[o,p]=(0,a.useState)(!1),[m,u]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[f,y]=(0,a.useState)(null),[b,v]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(n({name:t.name||"",priority:t.priority||1,apiKey:"",healthCheckInterval:t.healthCheckInterval??60}),u(null),y(null))},[t]);let j=async()=>{if(t?.provider){p(!0),u(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),i=await e.json();u({valid:!!i.valid,diagnosis:i.diagnosis||null,message:i.error||null})}catch{u({valid:!1,diagnosis:{type:"network_error"},message:"Failed to test connection"})}finally{p(!1)}}},N=async()=>{if(t?.provider&&l.apiKey){h(!0),y(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:l.apiKey})}),i=await e.json();y(i.valid?"success":"failed")}catch{y("failed")}finally{h(!1)}}},k=async()=>{v(!0);try{let e={name:l.name,priority:l.priority,healthCheckInterval:l.healthCheckInterval};if(!C&&l.apiKey){e.apiKey=l.apiKey;let i="success"===f;if(!i)try{h(!0),y(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:l.apiKey})});i=!!(await e.json()).valid,y(i?"success":"failed")}catch{y("failed")}finally{h(!1)}i&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null,e.lastErrorType=null,e.lastErrorSource=null,e.errorCode=null,e.rateLimitedUntil=null)}await i(e)}finally{v(!1)}};if(!t)return null;let C="oauth"===t.authType,w=(0,c.mq)(t.provider)||(0,c.gb)(t.provider),A=!m?.valid&&m?.diagnosis?.type&&g[m.diagnosis.type]||null;return(0,s.jsx)(d.aF,{isOpen:e,title:"Edit Connection",onClose:r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(d.pd,{label:"Name",value:l.name,onChange:e=>n({...l,name:e.target.value}),placeholder:C?"Account name":"Production Key"}),C&&t.email&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,s.jsx)("p",{className:"font-medium",children:t.email})]}),C&&(0,s.jsx)(d.pd,{label:"Health Check (min)",type:"number",value:l.healthCheckInterval,onChange:e=>n({...l,healthCheckInterval:Math.max(0,Number.parseInt(e.target.value)||0)}),hint:"Proactive token refresh interval. 0 = disabled."}),(0,s.jsx)(d.pd,{label:"Priority",type:"number",value:l.priority,onChange:e=>n({...l,priority:Number.parseInt(e.target.value)||1})}),!C&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.pd,{label:"API Key",type:"password",value:l.apiKey,onChange:e=>n({...l,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.$n,{onClick:N,disabled:!l.apiKey||x||b,variant:"secondary",children:x?"Checking...":"Check"})})]}),f&&(0,s.jsx)(d.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"})]}),!w&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(d.$n,{onClick:j,variant:"secondary",disabled:o,children:o?"Testing...":"Test Connection"}),m&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Ex,{variant:m.valid?"success":"error",children:m.valid?"Valid":"Failed"}),A&&(0,s.jsx)(d.Ex,{variant:A.variant,children:A.label})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.$n,{onClick:k,fullWidth:!0,disabled:b,children:b?"Saving...":"Save"}),(0,s.jsx)(d.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function C({isOpen:e,node:t,onSave:i,onClose:r,isAnthropic:l}){let[n,o]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,p]=(0,a.useState)(!1),[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[f,y]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(l?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,l]);let b=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){p(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};l||(e.apiType=n.apiType),await i(e)}finally{p(!1)}}},v=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:m,type:l?"anthropic-compatible":"openai-compatible"})}),t=await e.json();y(t.valid?"success":"failed")}catch{y("failed")}finally{h(!1)}};return t?(0,s.jsx)(d.aF,{isOpen:e,title:`Edit ${l?"Anthropic":"OpenAI"} Compatible`,onClose:r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(d.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${l?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,s.jsx)(d.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:l?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!l&&(0,s.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,s.jsx)(d.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:l?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${l?"Anthropic":"OpenAI"}-compatible API.`}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>u(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.$n,{onClick:v,disabled:!m||x||!n.baseUrl.trim(),variant:"secondary",children:x?"Checking...":"Check"})})]}),f&&(0,s.jsx)(d.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.$n,{onClick:b,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,s.jsx)(d.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}j.propTypes={connection:r.shape({id:r.string,name:r.string,email:r.string,displayName:r.string,rateLimitedUntil:r.string,rateLimitProtection:r.bool,testStatus:r.string,isActive:r.bool,priority:r.number,lastError:r.string,lastErrorType:r.string,lastErrorSource:r.string,errorCode:r.oneOfType([r.string,r.number]),globalPriority:r.number}).isRequired,isOAuth:r.bool.isRequired,isFirst:r.bool.isRequired,isLast:r.bool.isRequired,onMoveUp:r.func.isRequired,onMoveDown:r.func.isRequired,onToggleActive:r.func.isRequired,onToggleRateLimit:r.func.isRequired,onRetest:r.func.isRequired,isRetesting:r.bool,onEdit:r.func.isRequired,onDelete:r.func.isRequired,onReauth:r.func},N.propTypes={isOpen:r.bool.isRequired,provider:r.string,providerName:r.string,isCompatible:r.bool,isAnthropic:r.bool,onSave:r.func.isRequired,onClose:r.func.isRequired},k.propTypes={isOpen:r.bool.isRequired,connection:r.shape({id:r.string,name:r.string,email:r.string,priority:r.number,authType:r.string,provider:r.string}),onSave:r.func.isRequired,onClose:r.func.isRequired},C.propTypes={isOpen:r.bool.isRequired,node:r.shape({id:r.string,name:r.string,prefix:r.string,apiType:r.string,baseUrl:r.string}),onSave:r.func.isRequired,onClose:r.func.isRequired,isAnthropic:r.bool}},80209:(e,t,i)=>{Promise.resolve().then(i.bind(i,29556))}},e=>{e.O(0,[8500,9751,600,3191,7896,1525,8441,3794,7358],()=>e(e.s=80209)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{28033:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>p});var a=t(95155),s=t(12115),i=t(73321),l=t(98500),d=t(71525),o=t(81172);let n=Object.values(o.Q2).map(e=>({value:e.id,label:e.name})),c=Object.values(o.MA).map(e=>({value:e.id,label:e.name}));function p(){let e=(0,i.useRouter)(),[r,t]=(0,s.useState)(!1),[p,u]=(0,s.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[h,m]=(0,s.useState)({}),x=(e,r)=>{u(t=>({...t,[e]:r})),h[e]&&m(r=>({...r,[e]:null}))},b=async r=>{let a;if(r.preventDefault(),a={},p.provider||(a.provider="Please select a provider"),"api_key"!==p.authMethod||p.apiKey||(a.apiKey="API Key is required"),m(a),0===Object.keys(a).length){t(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();m({submit:e.error||"Failed to create provider"})}}catch(e){m({submit:"An error occurred. Please try again."})}finally{t(!1)}}},v=o.Q2[p.provider];return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8",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.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,a.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-6",children:[(0,a.jsx)(d.l6,{label:"Provider",options:n,value:p.provider,onChange:e=>x("provider",e.target.value),placeholder:"Select a provider",error:h.provider,required:!0}),v&&(0,a.jsxs)(d.Zp.Section,{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:v.color},children:v.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:v.name}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("label",{className:"text-sm font-medium",children:["Authentication Method ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("div",{className:"flex gap-3",children:c.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${p.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,a.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===p.authMethod&&(0,a.jsx)(d.pd,{label:"API Key",type:"password",placeholder:"Enter your API key",value:p.apiKey,onChange:e=>x("apiKey",e.target.value),error:h.apiKey,hint:"Your API key will be encrypted and stored securely.",required:!0}),"oauth2"===p.authMethod&&(0,a.jsxs)(d.Zp.Section,{children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Connect your account using OAuth2 authentication."}),(0,a.jsx)(d.$n,{type:"button",variant:"secondary",icon:"link",children:"Connect with OAuth2"})]}),(0,a.jsx)(d.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:p.displayName,onChange:e=>x("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,a.jsx)(d.lM,{checked:p.isActive,onChange:e=>x("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),h.submit&&(0,a.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:h.submit}),(0,a.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,a.jsx)(l,{href:"/dashboard/providers",className:"flex-1",children:(0,a.jsx)(d.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,a.jsx)(d.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}},52914:(e,r,t)=>{Promise.resolve().then(t.bind(t,28033))}},e=>{e.O(0,[8500,600,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{28033:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>p});var a=t(95155),s=t(12115),i=t(73321),l=t(98500),d=t(71525),o=t(81172);let n=Object.values(o.Q2).map(e=>({value:e.id,label:e.name})),c=Object.values(o.MA).map(e=>({value:e.id,label:e.name}));function p(){let e=(0,i.useRouter)(),[r,t]=(0,s.useState)(!1),[p,u]=(0,s.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[h,m]=(0,s.useState)({}),x=(e,r)=>{u(t=>({...t,[e]:r})),h[e]&&m(r=>({...r,[e]:null}))},b=async r=>{let a;if(r.preventDefault(),a={},p.provider||(a.provider="Please select a provider"),"api_key"!==p.authMethod||p.apiKey||(a.apiKey="API Key is required"),m(a),0===Object.keys(a).length){t(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();m({submit:e.error||"Failed to create provider"})}}catch(e){m({submit:"An error occurred. Please try again."})}finally{t(!1)}}},v=o.Q2[p.provider];return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8",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.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,a.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-6",children:[(0,a.jsx)(d.l6,{label:"Provider",options:n,value:p.provider,onChange:e=>x("provider",e.target.value),placeholder:"Select a provider",error:h.provider,required:!0}),v&&(0,a.jsxs)(d.Zp.Section,{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:v.color},children:v.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:v.name}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("label",{className:"text-sm font-medium",children:["Authentication Method ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("div",{className:"flex gap-3",children:c.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${p.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,a.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===p.authMethod&&(0,a.jsx)(d.pd,{label:"API Key",type:"password",placeholder:"Enter your API key",value:p.apiKey,onChange:e=>x("apiKey",e.target.value),error:h.apiKey,hint:"Your API key will be encrypted and stored securely.",required:!0}),"oauth2"===p.authMethod&&(0,a.jsxs)(d.Zp.Section,{children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Connect your account using OAuth2 authentication."}),(0,a.jsx)(d.$n,{type:"button",variant:"secondary",icon:"link",children:"Connect with OAuth2"})]}),(0,a.jsx)(d.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:p.displayName,onChange:e=>x("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,a.jsx)(d.lM,{checked:p.isActive,onChange:e=>x("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),h.submit&&(0,a.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:h.submit}),(0,a.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,a.jsx)(l,{href:"/dashboard/providers",className:"flex-1",children:(0,a.jsx)(d.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,a.jsx)(d.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}},52914:(e,r,t)=>{Promise.resolve().then(t.bind(t,28033))}},e=>{e.O(0,[8500,9751,600,3191,7896,1525,8441,3794,7358],()=>e(e.s=52914)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{95720:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>h});var r=s(95155),a=s(12115),l=s(5772),i=s(14051),n=s(71525),o=s(81172),d=s(55757),c=s(98500),p=s(45567);let m={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function x(){let[e,t]=(0,a.useState)(null),[s,l]=(0,a.useState)(!0),[i,o]=(0,a.useState)(null),d=(0,p.i)(),c=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{l(!1)}},[]);(0,a.useEffect)(()=>{c();let e=setInterval(c,3e4);return()=>clearInterval(e)},[c]);let x=async(e,t)=>{o(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(d.success(`Cooldown cleared for ${t}`),await c()):d.error("Failed to clear cooldown")}catch{d.error("Failed to clear cooldown")}finally{o(null)}};if(s)return(0,r.jsx)(n.Zp,{className:"p-6 mt-6",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"monitoring"}),"Loading model availability..."]})});let u=e?.models||[],h=e?.unavailableCount||u.filter(e=>"available"!==e.status).length;if(0===u.length||0===h)return(0,r.jsx)(n.Zp,{className:"p-6 mt-6",children:(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,r.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"verified"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-main",children:"Model Availability"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"All models operational"})]})]})});let b={};return u.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";b[t]||(b[t]=[]),b[t].push(e)}),(0,r.jsxs)(n.Zp,{className:"p-6 mt-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"warning"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-main",children:"Model Availability"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:[h," model",1!==h?"s":""," with issues"]})]})]}),(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:c,className:"text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"refresh"})})]}),(0,r.jsx)("div",{className:"flex flex-col gap-3",children:Object.entries(b).map(([e,t])=>(0,r.jsxs)("div",{className:"border border-border/30 rounded-lg p-3",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-text-main mb-2 capitalize",children:e}),(0,r.jsx)("div",{className:"flex flex-col gap-1.5",children:t.map(e=>{let t=m[e.status]||m.unknown,s=i===`${e.provider}:${e.model}`;return(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:t.color},children:t.icon}),(0,r.jsx)("span",{className:"font-mono text-sm text-text-main",children:e.model}),(0,r.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${t.color}15`,color:t.color},children:t.label}),e.cooldownUntil&&(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["until ",new Date(e.cooldownUntil).toLocaleTimeString()]})]}),"cooldown"===e.status&&(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:()=>x(e.provider,e.model),disabled:s,className:"text-xs",children:s?"Clearing...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})]})}function u(e,t,s){let a=[];if(e>0&&a.push((0,r.jsxs)(n.Ex,{variant:"success",size:"sm",dot:!0,children:[e," Connected"]},"connected")),t>0){let e=s?`${t} Error (${s})`:`${t} Error`;a.push((0,r.jsx)(n.Ex,{variant:"error",size:"sm",dot:!0,children:e},"error"))}return 0===a.length?(0,r.jsx)("span",{className:"text-text-muted",children:"No connections"}):a}function h(){let[e,t]=(0,a.useState)([]),[s,l]=(0,a.useState)([]),[i,c]=(0,a.useState)(!0),[m,u]=(0,a.useState)(!1),[h,j]=(0,a.useState)(!1),[N,C]=(0,a.useState)(null),[w,k]=(0,a.useState)(null),T=(0,p.i)();(0,a.useEffect)(()=>{(async()=>{try{let[e,s]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),r=await e.json(),a=await s.json();e.ok&&t(r.connections||[]),s.ok&&l(a.nodes||[])}catch(e){console.log("Error fetching data:",e)}finally{c(!1)}})()},[]);let A=(t,s)=>{let r=e.filter(e=>e.provider===t&&e.authType===s),a=e=>{let t=e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now();return"unavailable"!==e.testStatus||t?e.testStatus:"active"},l=r.filter(e=>{let t=a(e);return"active"===t||"success"===t}).length,i=r.filter(e=>{let t=a(e);return"error"===t||"expired"===t||"unavailable"===t}),n=i.length,o=r.length,d=i.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:l,error:n,total:o,errorCode:d?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let s=Number(e.errorCode);if(Number.isFinite(s)&&s>=400)return String(s);let r=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(e.lastError);if("401"===r||"403"===r)return"AUTH";if(r&&"ERR"!==r)return r;let a=(e.lastError||"").toLowerCase();return a.includes("runtime")||a.includes("not runnable")||a.includes("not installed")?"RUNTIME":a.includes("invalid api key")||a.includes("token invalid")||a.includes("revoked")||a.includes("unauthorized")?"AUTH":"ERR"}(d):null,errorTime:d?.lastErrorAt?function(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 r=Math.floor(s/24);return`${r}d ago`}(d.lastErrorAt):null}},U=async(e,t=null)=>{if(!N){C("provider"===e?t:e),k(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),r=await s.json();if(k(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?T.success(`All ${s} tests passed`):T.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){k({error:"Test request failed"}),T.error("Provider test failed")}finally{C(null)}}},I=s.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})),$=s.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"}));return i?(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(n.Qv,{}),(0,r.jsx)(n.Qv,{})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"OAuth Providers"}),(0,r.jsxs)("button",{onClick:()=>U("oauth"),disabled:!!N,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"oauth"===N?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:"Test all OAuth connections","aria-label":"Test all OAuth connections",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"oauth"===N?"sync":"play_arrow"}),"oauth"===N?"Testing...":"Test All"]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(o.zN).map(([e,t])=>(0,r.jsx)(b,{providerId:e,provider:t,stats:A(e,"oauth")},e))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Free Providers"}),(0,r.jsxs)("button",{onClick:()=>U("free"),disabled:!!N,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"free"===N?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:"Test all Free connections","aria-label":"Test all Free provider connections",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"free"===N?"sync":"play_arrow"}),"free"===N?"Testing...":"Test All"]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(d.IS).map(([e,t])=>(0,r.jsx)(b,{providerId:e,provider:t,stats:A(e,"oauth")},e))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"API Key Providers"}),(0,r.jsxs)("button",{onClick:()=>U("apikey"),disabled:!!N,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"apikey"===N?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:"Test all API Key connections","aria-label":"Test all API Key connections",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"apikey"===N?"sync":"play_arrow"}),"apikey"===N?"Testing...":"Test All"]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(o.fg).map(([e,t])=>(0,r.jsx)(f,{providerId:e,provider:t,stats:A(e,"apikey")},e))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"API Key Compatible Providers"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(I.length>0||$.length>0)&&(0,r.jsxs)("button",{onClick:()=>U("compatible"),disabled:!!N,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"compatible"===N?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:"Test all Compatible connections",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"compatible"===N?"sync":"play_arrow"}),"compatible"===N?"Testing...":"Test All"]}),(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>j(!0),children:"Add Anthropic Compatible"}),(0,r.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>u(!0),className:"!bg-white !text-black hover:!bg-gray-100",children:"Add OpenAI Compatible"})]})]}),0===I.length&&0===$.length?(0,r.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"extension"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"No compatible providers added yet"}),(0,r.jsx)("p",{className:"text-text-muted text-xs mt-1",children:"Use the buttons above to add OpenAI or Anthropic compatible endpoints"})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[...I,...$].map(e=>(0,r.jsx)(f,{providerId:e.id,provider:e,stats:A(e.id,"apikey")},e.id))})]}),(0,r.jsx)(g,{isOpen:m,onClose:()=>u(!1),onCreated:e=>{l(t=>[...t,e]),u(!1)}}),(0,r.jsx)(v,{isOpen:h,onClose:()=>j(!1),onCreated:e=>{l(t=>[...t,e]),j(!1)}}),w&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[10vh]",onClick:()=>k(null),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,r.jsxs)("div",{className:"relative bg-bg-primary border border-border rounded-xl w-full max-w-[600px] max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-bg-primary/95 backdrop-blur-sm rounded-t-xl",children:[(0,r.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,r.jsx)("button",{onClick:()=>k(null),className:"p-1 rounded-lg hover:bg-bg-subtle text-text-muted hover:text-text-primary transition-colors","aria-label":"Close test results",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,r.jsx)("div",{className:"p-5",children:(0,r.jsx)(y,{results:w})})]})]}),(0,r.jsx)(x,{})]})}function b({providerId:e,provider:t,stats:s}){let{connected:i,error:o,errorCode:d,errorTime:p}=s,[m,x]=(0,a.useState)(!1);return(0,r.jsx)(c,{href:`/dashboard/providers/${e}`,className:"group",children:(0,r.jsx)(n.Zp,{padding:"xs",className:"h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}15`},children:m?(0,r.jsx)("span",{className:"text-xs font-bold",style:{color:t.color},children:t.textIcon||t.id.slice(0,2).toUpperCase()}):(0,r.jsx)(l.default,{src:`/providers/${t.id}.png`,alt:t.name,width:30,height:30,className:"object-contain rounded-lg max-w-[32px] max-h-[32px]",sizes:"32px",onError:()=>x(!0)})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold",children:t.name}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:[u(i,o,d),p&&(0,r.jsxs)("span",{className:"text-text-muted",children:["• ",p]})]})]})]}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"chevron_right"})]})})})}function f({providerId:e,provider:t,stats:s}){let{connected:i,error:o,errorCode:p,errorTime:m}=s,x=e.startsWith(d.JH),h=e.startsWith(d.DI),[b,f]=(0,a.useState)(!1);return(0,r.jsx)(c,{href:`/dashboard/providers/${e}`,className:"group",children:(0,r.jsx)(n.Zp,{padding:"xs",className:"h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}15`},children:b?(0,r.jsx)("span",{className:"text-xs font-bold",style:{color:t.color},children:t.textIcon||t.id.slice(0,2).toUpperCase()}):(0,r.jsx)(l.default,{src:x?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":h?"/providers/anthropic-m.png":`/providers/${t.id}.png`,alt:t.name,width:30,height:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",sizes:"30px",onError:()=>f(!0)})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold",children:t.name}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:[u(i,o,p),x&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"responses"===t.apiType?"Responses":"Chat"}),h&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"Messages"}),m&&(0,r.jsxs)("span",{className:"text-text-muted",children:["• ",m]})]})]})]}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"chevron_right"})]})})})}function g({isOpen:e,onClose:t,onCreated:s}){let[l,i]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[o,d]=(0,a.useState)(!1),[c,p]=(0,a.useState)(""),[m,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{i(e=>({...e,baseUrl:"https://api.openai.com/v1"}))},[l.apiType]);let b=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){d(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l.name,prefix:l.prefix,apiType:l.apiType,baseUrl:l.baseUrl,type:"openai-compatible"})}),t=await e.json();e.ok&&(s(t.node),i({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),p(""),h(null))}catch(e){console.log("Error creating OpenAI Compatible node:",e)}finally{d(!1)}}},f=async()=>{x(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:c,type:"openai-compatible"})}),t=await e.json();h(t.valid?"success":"failed")}catch{h("failed")}finally{x(!1)}};return(0,r.jsx)(n.aF,{isOpen:e,title:"Add OpenAI Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:l.name,onChange:e=>i({...l,name:e.target.value}),placeholder:"OpenAI Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:l.prefix,onChange:e=>i({...l,prefix:e.target.value}),placeholder:"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(n.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:l.apiType,onChange:e=>i({...l,apiType:e.target.value})}),(0,r.jsx)(n.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>i({...l,baseUrl:e.target.value}),placeholder:"https://api.openai.com/v1",hint:"Use the base URL (ending in /v1) for your OpenAI-compatible API."}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>p(e.target.value),className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(n.$n,{onClick:f,disabled:!c||m||!l.baseUrl.trim(),variant:"secondary",children:m?"Checking...":"Check"})})]}),u&&(0,r.jsx)(n.Ex,{variant:"success"===u?"success":"error",children:"success"===u?"Valid":"Invalid"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(n.$n,{onClick:b,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||o,children:o?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function v({isOpen:e,onClose:t,onCreated:s}){let[l,i]=(0,a.useState)({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),[o,d]=(0,a.useState)(!1),[c,p]=(0,a.useState)(""),[m,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(h(null),p(""))},[e]);let b=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){d(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l.name,prefix:l.prefix,baseUrl:l.baseUrl,type:"anthropic-compatible"})}),t=await e.json();e.ok&&(s(t.node),i({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),p(""),h(null))}catch(e){console.log("Error creating Anthropic Compatible node:",e)}finally{d(!1)}}},f=async()=>{x(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:c,type:"anthropic-compatible"})}),t=await e.json();h(t.valid?"success":"failed")}catch{h("failed")}finally{x(!1)}};return(0,r.jsx)(n.aF,{isOpen:e,title:"Add Anthropic Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:l.name,onChange:e=>i({...l,name:e.target.value}),placeholder:"Anthropic Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:l.prefix,onChange:e=>i({...l,prefix:e.target.value}),placeholder:"ac-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(n.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>i({...l,baseUrl:e.target.value}),placeholder:"https://api.anthropic.com/v1",hint:"Use the base URL (ending in /v1) for your Anthropic-compatible API. The system will append /messages."}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>p(e.target.value),className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(n.$n,{onClick:f,disabled:!c||m||!l.baseUrl.trim(),variant:"secondary",children:m?"Checking...":"Check"})})]}),u&&(0,r.jsx)(n.Ex,{variant:"success"===u?"success":"error",children:"success"===u?"Valid":"Invalid"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(n.$n,{onClick:b,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||o,children:o?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function y({results:e}){if(e.error&&!e.results)return(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,r.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:t,mode:s}=e,a=e.results||[];return(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[t&&(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs mb-1",children:[(0,r.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:[t.failed," failed"]}),(0,r.jsxs)("span",{className:"text-text-muted ml-auto",children:[t.total," tested"]})]}),a.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs px-3 py-2 rounded-lg bg-black/[0.03] dark:bg-white/[0.03]",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"font-medium",children:e.connectionName}),(0,r.jsxs)("span",{className:"text-text-muted ml-1.5",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,r.jsxs)("span",{className:"text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,r.jsx)("span",{className:`text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===a.length&&(0,r.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}b.propTypes={providerId:i.string.isRequired,provider:i.shape({id:i.string.isRequired,name:i.string.isRequired,color:i.string,textIcon:i.string}).isRequired,stats:i.shape({connected:i.number,error:i.number,errorCode:i.string,errorTime:i.string}).isRequired},f.propTypes={providerId:i.string.isRequired,provider:i.shape({id:i.string.isRequired,name:i.string.isRequired,color:i.string,textIcon:i.string,apiType:i.string}).isRequired,stats:i.shape({connected:i.number,error:i.number,errorCode:i.string,errorTime:i.string}).isRequired},g.propTypes={isOpen:i.bool.isRequired,onClose:i.func.isRequired,onCreated:i.func.isRequired},v.propTypes={isOpen:i.bool.isRequired,onClose:i.func.isRequired,onCreated:i.func.isRequired},y.propTypes={results:i.shape({mode:i.string,results:i.array,summary:i.shape({total:i.number,passed:i.number,failed:i.number}),error:i.string}).isRequired}},96105:(e,t,s)=>{Promise.resolve().then(s.bind(s,95720))}},e=>{e.O(0,[8500,9751,600,3191,7896,1525,8441,3794,7358],()=>e(e.s=96105)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2791],{3116:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>I});var a=s(95155),l=s(12115),r=s(61592),i=s(81172),n=s(71525);function d(){let[e,t]=(0,l.useState)([]),[s,r]=(0,l.useState)(!1),[i,d]=(0,l.useState)(!1),[c,o]=(0,l.useState)({type:"",message:""}),[m,x]=(0,l.useState)(null),[u,p]=(0,l.useState)(null),[h,b]=(0,l.useState)(!1),[g,f]=(0,l.useState)({type:"",message:""}),[j,v]=(0,l.useState)({driver:"sqlite",dbPath:"~/.omniroute/storage.sqlite",sizeBytes:0,retentionDays:90,lastBackupAt:null}),y=async()=>{r(!0);try{let e=await fetch("/api/db-backups"),s=await e.json();t(s.backups||[])}catch(e){console.error("Failed to fetch backups:",e)}finally{r(!1)}},N=async()=>{try{let e=await fetch("/api/storage/health");if(!e.ok)return;let t=await e.json();v(e=>({...e,...t}))}catch(e){console.error("Failed to fetch storage health:",e)}},k=async()=>{b(!0),f({type:"",message:""});try{let e=await fetch("/api/db-backups",{method:"PUT"}),t=await e.json();e.ok?(t.filename?f({type:"success",message:`Backup created: ${t.filename}`}):f({type:"info",message:t.message||"No changes since last backup"}),await N(),i&&await y()):f({type:"error",message:t.error||"Backup failed"})}catch{f({type:"error",message:"An error occurred"})}finally{b(!1)}},w=async e=>{x(e),o({type:"",message:""});try{let t=await fetch("/api/db-backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({backupId:e})}),s=await t.json();t.ok?(o({type:"success",message:`Restored! ${s.connectionCount} connections, ${s.nodeCount} nodes, ${s.comboCount} combos, ${s.apiKeyCount} API keys.`}),await y(),await N()):o({type:"error",message:s.error||"Restore failed"})}catch{o({type:"error",message:"An error occurred during restore"})}finally{x(null),p(null)}};(0,l.useEffect)(()=>{N()},[]);let C=e=>e&&0!==e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`:"0 B";return(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"database"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"System & Storage"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"All data stored locally on your machine"})]}),(0,a.jsx)(n.Ex,{variant:"success",size:"sm",children:j.driver||"json"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[(0,a.jsxs)("div",{className:"p-3 rounded-lg bg-bg border border-border",children:[(0,a.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wide mb-1",children:"Database Path"}),(0,a.jsx)("p",{className:"text-sm font-mono text-text-main break-all",children:j.dbPath||"~/.omniroute/storage.sqlite"})]}),(0,a.jsxs)("div",{className:"p-3 rounded-lg bg-bg border border-border",children:[(0,a.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wide mb-1",children:"Database Size"}),(0,a.jsx)("p",{className:"text-sm font-mono text-text-main",children:C(j.sizeBytes)})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-bg border border-border mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-500","aria-hidden":"true",children:"schedule"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Last Backup"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:j.lastBackupAt?`${new Date(j.lastBackupAt).toLocaleString("pt-BR")} (${(e=>{if(!e)return null;let t=Math.floor((new Date-new Date(e))/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`})(j.lastBackupAt)})`:"No backup yet"})]})]}),(0,a.jsxs)(n.$n,{variant:"outline",size:"sm",onClick:k,loading:h,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"backup"}),"Backup Now"]})]}),g.message&&(0,a.jsx)("div",{className:`p-3 rounded-lg mb-4 text-sm ${"success"===g.type?"bg-green-500/10 text-green-500 border border-green-500/20":"info"===g.type?"bg-blue-500/10 text-blue-500 border border-blue-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===g.type?"check_circle":"info"===g.type?"info":"error"}),g.message]})}),(0,a.jsxs)("div",{className:"pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-amber-500","aria-hidden":"true",children:"restore"}),(0,a.jsx)("p",{className:"font-medium",children:"Backup & Restore"})]}),(0,a.jsx)(n.$n,{variant:"outline",size:"sm",onClick:()=>{d(!i),i||0!==e.length||y()},children:i?"Hide":"View Backups"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Database snapshots are created automatically before restore and every 15 minutes when data changes. Retention: 24 hourly + 30 daily backups with smart rotation."}),c.message&&(0,a.jsx)("div",{className:`p-3 rounded-lg mb-3 text-sm ${"success"===c.type?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===c.type?"check_circle":"error"}),c.message]})}),i&&(0,a.jsx)("div",{className:"flex flex-col gap-2",children:s?(0,a.jsxs)("div",{className:"flex items-center justify-center py-6 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px] mr-2","aria-hidden":"true",children:"progress_activity"}),"Loading backups..."]}):0===e.length?(0,a.jsxs)("div",{className:"text-center py-6 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] mb-2 block opacity-40","aria-hidden":"true",children:"folder_off"}),"No backups available yet. Backups will be created automatically when data changes."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[e.length," backup(s) available"]}),(0,a.jsxs)("button",{onClick:y,className:"text-xs text-primary hover:underline flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"refresh"}),"Refresh"]})]}),e.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-black/[0.02] dark:bg-white/[0.02] border border-border/50 hover:border-border transition-colors",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-500","aria-hidden":"true",children:"description"}),(0,a.jsx)("span",{className:"text-sm font-medium truncate",children:new Date(e.createdAt).toLocaleString("pt-BR")}),(0,a.jsx)(n.Ex,{variant:"pre-restore"===e.reason?"warning":"manual"===e.reason?"success":"default",size:"sm",children:e.reason})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted ml-6",children:[(0,a.jsxs)("span",{children:[e.connectionCount," connection(s)"]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:C(e.size)})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 ml-3",children:u===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-xs text-amber-500 font-medium",children:"Confirm?"}),(0,a.jsx)(n.$n,{variant:"primary",size:"sm",onClick:()=>w(e.id),loading:m===e.id,className:"!bg-amber-500 hover:!bg-amber-600",children:"Yes"}),(0,a.jsx)(n.$n,{variant:"outline",size:"sm",onClick:()=>p(null),children:"No"})]}):(0,a.jsxs)(n.$n,{variant:"outline",size:"sm",onClick:()=>p(e.id),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"restore"}),"Restore"]})})]},e.id))]})})]})]})}let c=[{value:"disabled",label:"Disabled",icon:"block"},{value:"blacklist",label:"Blacklist",icon:"do_not_disturb"},{value:"whitelist",label:"Whitelist",icon:"verified_user"},{value:"whitelist-priority",label:"WL Priority",icon:"priority_high"}];function o(){let[e,t]=(0,l.useState)({enabled:!1,mode:"blacklist",blacklist:[],whitelist:[],tempBans:[]}),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)(""),[o,m]=(0,l.useState)("blacklist");(0,l.useEffect)(()=>{x()},[]);let x=async()=>{try{let e=await fetch("/api/settings/ip-filter");e.ok&&t(await e.json())}catch{}finally{r(!1)}},u=async e=>{try{let s=await fetch("/api/settings/ip-filter",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});s.ok&&t(await s.json())}catch{}},p=()=>{i.trim()&&(u({["blacklist"===o?"addBlacklist":"addWhitelist"]:i.trim()}),d(""))},h=(e,t)=>{u({["blacklist"===t?"removeBlacklist":"removeWhitelist"]:e})},b=e.enabled?e.mode:"disabled";return(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-red-500/10 text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"security"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"IP Access Control"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Block or allow specific IP addresses"})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-4 gap-2 mb-5",children:c.map(e=>(0,a.jsxs)("button",{onClick:()=>{var t;"disabled"===(t=e.value)?u({enabled:!1}):u({enabled:!0,mode:t})},disabled:s,className:`flex flex-col items-center gap-1.5 p-3 rounded-lg border text-center transition-all ${b===e.value?"border-red-500/50 bg-red-500/5 ring-1 ring-red-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] ${b===e.value?"text-red-400":"text-text-muted"}`,children:e.icon}),(0,a.jsx)("span",{className:`text-xs font-medium ${b===e.value?"text-red-400":"text-text-muted"}`,children:e.label})]},e.value))}),e.enabled&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex gap-2 items-end",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(n.pd,{label:"Add IP Address",placeholder:"192.168.1.0/24 or 10.0.*.*",value:i,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&p()})}),(0,a.jsxs)("div",{className:"flex gap-1 pb-[2px]",children:[(0,a.jsx)(n.$n,{size:"sm",variant:"blacklist"===o?"danger":"secondary",onClick:()=>{m("blacklist"),i.trim()&&p()},children:"+ Block"}),(0,a.jsx)(n.$n,{size:"sm",variant:"whitelist"===o?"primary":"secondary",onClick:()=>{m("whitelist"),i.trim()&&p()},children:"+ Allow"})]})]}),e.blacklist.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:["Blocked (",e.blacklist.length,")"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.blacklist.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-mono bg-red-500/10 text-red-400 border border-red-500/20",children:[e,(0,a.jsx)("button",{onClick:()=>h(e,"blacklist"),className:"hover:text-red-300",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e))})]}),e.whitelist.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:["Allowed (",e.whitelist.length,")"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.whitelist.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-mono bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[e,(0,a.jsx)("button",{onClick:()=>h(e,"whitelist"),className:"hover:text-emerald-300",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e))})]}),e.tempBans.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:["Temporary Bans (",e.tempBans.length,")"]}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:e.tempBans.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-orange-500/5 border border-orange-500/20 text-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-xs text-orange-400",children:e.ip}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["— ",e.reason]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted tabular-nums",children:[Math.ceil(e.remainingMs/6e4),"m left"]}),(0,a.jsx)("button",{onClick:()=>u({removeBan:e.ip}),className:"text-text-muted hover:text-orange-400",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]},e.ip))})]})]})]})}var m=s(45567);let x={closed:{icon:"check_circle",color:"#22c55e",label:"Closed"},"half-open":{icon:"pending",color:"#f59e0b",label:"Half-Open"},open:{icon:"error",color:"#ef4444",label:"Open"}};function u(){let[e,t]=(0,l.useState)(null),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)(null),c=(0,m.i)(),o=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/policies");if(e.ok){let s=await e.json();t(s)}}catch{}finally{r(!1)}},[]);(0,l.useEffect)(()=>{o();let e=setInterval(o,15e3);return()=>clearInterval(e)},[o]);let u=async e=>{d(e);try{(await fetch("/api/policies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"unlock",identifier:e})})).ok?(c.success(`Unlocked: ${e}`),await o()):c.error("Failed to unlock")}catch{c.error("Failed to unlock")}finally{d(null)}};if(s)return(0,a.jsx)(n.Zp,{className:"p-6 mt-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"security"}),"Loading policies..."]})});let p=e?.circuitBreakers||[],h=e?.lockedIdentifiers||[];return p.some(e=>"closed"!==e.state)||h.length>0?(0,a.jsxs)(n.Zp,{className:"p-6 mt-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-red-500/10 text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"gpp_maybe"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-text-main",children:"Policies & Circuit Breakers"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Active issues detected"})]})]}),(0,a.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:o,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"refresh"})})]}),p.filter(e=>"closed"!==e.state).length>0&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-muted mb-2",children:"Circuit Breakers"}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:p.filter(e=>"closed"!==e.state).map((e,t)=>{let s=x[e.state]||x.open;return(0,a.jsx)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:s.color},children:s.icon}),(0,a.jsx)("span",{className:"text-sm text-text-main font-medium",children:e.name||e.provider||"Unknown"}),(0,a.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${s.color}15`,color:s.color},children:s.label}),e.failures>0&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[e.failures," failures"]})]})},e.name||t)})})]}),h.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-muted mb-2",children:"Locked Identifiers"}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:h.map((e,t)=>{let s="string"==typeof e?e:e.identifier||e.id;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-red-400",children:"lock"}),(0,a.jsx)("span",{className:"font-mono text-sm text-text-main",children:s}),"object"==typeof e&&e.lockedAt&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["since ",new Date(e.lockedAt).toLocaleString()]})]}),(0,a.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:()=>u(s),disabled:i===s,className:"text-xs",children:i===s?"Unlocking...":"Force Unlock"})]},s||t)})})]})]}):(0,a.jsx)(n.Zp,{className:"p-6 mt-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"verified_user"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-text-main",children:"Policies & Circuit Breakers"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"All systems operational — no lockouts or tripped breakers"})]})]})})}function p(){let[e,t]=(0,l.useState)({requireLogin:!1,hasPassword:!1}),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)({current:"",new:"",confirm:""}),[c,m]=(0,l.useState)({type:"",message:""}),[x,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{t(e),r(!1)}).catch(()=>r(!1))},[]);let h=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&t(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},b=async e=>{if(e.preventDefault(),i.new!==i.confirm)return void m({type:"error",message:"Passwords do not match"});p(!0),m({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:i.current,newPassword:i.new})}),t=await e.json();e.ok?(m({type:"success",message:"Password updated successfully"}),d({current:"",new:"",confirm:""})):m({type:"error",message:t.error||"Failed to update password"})}catch{m({type:"error",message:"An error occurred"})}finally{p(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"shield"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Security"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Require login"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"When ON, dashboard requires password. When OFF, access without login."})]}),(0,a.jsx)(n.lM,{checked:!0===e.requireLogin,onChange:()=>h(!e.requireLogin),disabled:s})]}),!0===e.requireLogin&&(0,a.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[e.hasPassword&&(0,a.jsx)(n.pd,{label:"Current Password",type:"password",placeholder:"Enter current password",value:i.current,onChange:e=>d({...i,current:e.target.value}),required:!0}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsx)(n.pd,{label:"New Password",type:"password",placeholder:"Enter new password",value:i.new,onChange:e=>d({...i,new:e.target.value}),required:!0}),(0,a.jsx)(n.pd,{label:"Confirm New Password",type:"password",placeholder:"Confirm new password",value:i.confirm,onChange:e=>d({...i,confirm:e.target.value}),required:!0})]}),c.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===c.type?"text-red-500":"text-green-500"}`,children:c.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(n.$n,{type:"submit",variant:"primary",loading:x,children:e.hasPassword?"Update Password":"Set Password"})})]})]})]}),(0,a.jsx)(o,{}),(0,a.jsx)(u,{})]})}let h=["#6366f1","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899","#14b8a6"];function b(){let[e,t]=(0,l.useState)({}),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)(!1),[c,o]=(0,l.useState)(""),[x,u]=(0,l.useState)(""),[p,b]=(0,l.useState)(!1),g=(0,m.i)(),f=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/fallback/chains");if(e.ok){let s=await e.json();t(s.chains||s||{})}}catch{}finally{r(!1)}},[]);(0,l.useEffect)(()=>{f()},[f]);let j=async()=>{if(!c.trim()||!x.trim())return void g.warning("Please fill model name and providers");let e=x.split(",").map(e=>e.trim()).filter(Boolean).map((e,t)=>({provider:e,priority:t+1,enabled:!0}));if(0===e.length)return void g.warning("Add at least one provider");b(!0);try{(await fetch("/api/fallback/chains",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:c.trim(),chain:e})})).ok?(g.success(`Chain created for ${c.trim()}`),o(""),u(""),d(!1),await f()):g.error("Failed to create chain")}catch{g.error("Failed to create chain")}finally{b(!1)}},v=async e=>{if(confirm(`Delete fallback chain for "${e}"?`))try{(await fetch("/api/fallback/chains",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:e})})).ok?(g.success(`Chain deleted for ${e}`),await f()):g.error("Failed to delete chain")}catch{g.error("Failed to delete chain")}};if(s)return(0,a.jsx)(n.Zp,{className:"p-6 mt-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"timeline"}),"Loading fallback chains..."]})});let y=Object.entries(e);return(0,a.jsxs)(n.Zp,{className:"mt-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4 p-6 pb-0",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"timeline"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Fallback Chains"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Define provider fallback order per model"})]}),(0,a.jsx)(n.$n,{size:"sm",variant:"primary",onClick:()=>d(!i),children:i?"Cancel":"+ Add Chain"})]}),i&&(0,a.jsxs)("div",{className:"mx-6 p-4 rounded-lg border border-border/30 bg-surface/20 mb-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 mb-3",children:[(0,a.jsx)(n.pd,{label:"Model Name",placeholder:"claude-sonnet-4-20250514",value:c,onChange:e=>o(e.target.value)}),(0,a.jsx)(n.pd,{label:"Providers (comma-separated, in priority order)",placeholder:"anthropic, openai, gemini",value:x,onChange:e=>u(e.target.value)})]}),(0,a.jsx)(n.$n,{variant:"primary",size:"sm",onClick:j,loading:p,children:"Create Chain"})]}),(0,a.jsx)("div",{className:"px-6 pb-6",children:0===y.length?(0,a.jsx)(n.pp,{icon:"timeline",title:"No Fallback Chains",description:"Create a chain to define provider fallback order for a model."}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:y.map(([e,t])=>(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 rounded-lg border border-border/20 bg-surface/20 hover:bg-surface/40 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,a.jsx)("span",{className:"font-mono text-sm text-text-main truncate max-w-[200px]",children:e}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,a.jsx)("div",{className:"flex gap-1.5 flex-wrap",children:(Array.isArray(t)?t:[]).map((e,t)=>(0,a.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:`${h[t%h.length]}20`,color:h[t%h.length],border:`1px solid ${h[t%h.length]}40`},children:[t+1,". ",e.provider]},`${e.provider}-${t}`))})]}),(0,a.jsx)("button",{onClick:()=>v(e),className:"text-text-muted hover:text-red-400 transition-colors ml-2",title:"Delete chain",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},e))})})]})}let g=[{value:"fill-first",label:"Fill First",desc:"Use accounts in priority order",icon:"vertical_align_top"},{value:"round-robin",label:"Round Robin",desc:"Cycle through all accounts",icon:"loop"},{value:"p2c",label:"P2C",desc:"Pick 2 random, use the healthier one",icon:"balance"}];function f(){let[e,t]=(0,l.useState)({fallbackStrategy:"fill-first"}),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)([]),[c,o]=(0,l.useState)(""),[m,x]=(0,l.useState)("");(0,l.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{t(e),d(e.wildcardAliases||[]),r(!1)}).catch(()=>r(!1))},[]);let u=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&t(t=>({...t,...e}))}catch(e){console.error("Failed to update settings:",e)}},p=async()=>{if(!c.trim()||!m.trim())return;let e=[...i,{pattern:c.trim(),target:m.trim()}];await u({wildcardAliases:e}),d(e),o(""),x("")},h=async e=>{let t=i.filter((t,s)=>s!==e);await u({wildcardAliases:t}),d(t)};return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"route"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Routing Strategy"})]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2 mb-4",children:g.map(t=>(0,a.jsxs)("button",{onClick:()=>u({fallbackStrategy:t.value}),disabled:s,className:`flex flex-col items-center gap-2 p-4 rounded-lg border text-center transition-all ${e.fallbackStrategy===t.value?"border-blue-500/50 bg-blue-500/5 ring-1 ring-blue-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[24px] ${e.fallbackStrategy===t.value?"text-blue-400":"text-text-muted"}`,children:t.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:`text-sm font-medium ${e.fallbackStrategy===t.value?"text-blue-400":""}`,children:t.label}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:t.desc})]})]},t.value))}),"round-robin"===e.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-3 border-t border-border/30",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Calls per account before switching"})]}),(0,a.jsx)(n.pd,{type:"number",min:"1",max:"10",value:e.stickyRoundRobinLimit||3,onChange:e=>u({stickyRoundRobinLimit:parseInt(e.target.value)}),disabled:s,className:"w-20 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-3 border-t border-border/30 mt-3",children:["round-robin"===e.fallbackStrategy&&`Distributing requests across accounts with ${e.stickyRoundRobinLimit||3} calls per account.`,"fill-first"===e.fallbackStrategy&&"Using accounts in priority order (Fill First).","p2c"===e.fallbackStrategy&&"Power of Two Choices: picks 2 random accounts and routes to the healthier one."]})]}),(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"alt_route"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Model Aliases"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Wildcard patterns to remap model names • Use * and ?"})]})]}),i.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-1.5 mb-4",children:i.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,a.jsx)("span",{className:"font-mono text-purple-400",children:e.pattern}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,a.jsx)("span",{className:"font-mono text-text-main",children:e.target})]}),(0,a.jsx)("button",{onClick:()=>h(t),className:"text-text-muted hover:text-red-400 transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},t))}),(0,a.jsxs)("div",{className:"flex gap-2 items-end",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(n.pd,{label:"Pattern",placeholder:"claude-sonnet-*",value:c,onChange:e=>o(e.target.value)})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(n.pd,{label:"Target Model",placeholder:"claude-sonnet-4-20250514",value:m,onChange:e=>x(e.target.value)})}),(0,a.jsx)(n.$n,{size:"sm",variant:"primary",onClick:p,className:"mb-[2px]",children:"+ Add"})]})]}),(0,a.jsx)(b,{})]})}function j(){let[e,t]=(0,l.useState)({strategy:"priority",maxRetries:1,retryDelayMs:2e3,timeoutMs:12e4,healthCheckEnabled:!0,healthCheckTimeoutMs:3e3,maxComboDepth:3,trackMetrics:!0}),[s,i]=(0,l.useState)({}),[d,c]=(0,l.useState)(""),[o,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{fetch("/api/settings/combo-defaults").then(e=>e.json()).then(e=>{e.comboDefaults&&t(e.comboDefaults),e.providerOverrides&&i(e.providerOverrides)}).catch(e=>console.error("Failed to fetch combo defaults:",e))},[]);let x=async()=>{m(!0);try{await fetch("/api/settings/combo-defaults",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboDefaults:e,providerOverrides:s})})}catch(e){console.error("Failed to save combo defaults:",e)}finally{m(!1)}},u=()=>{let e=d.trim().toLowerCase();e&&!s[e]&&(i(t=>({...t,[e]:{maxRetries:1,timeoutMs:12e4}})),c(""))};return(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"tune"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Combo Defaults"}),(0,a.jsx)("span",{className:"text-xs text-text-muted ml-auto",children:"Global combo configuration"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:"Default Strategy"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applied to new combos without explicit strategy"})]}),(0,a.jsx)("div",{role:"tablist","aria-label":"Combo strategy",className:"inline-flex p-0.5 rounded-md bg-black/5 dark:bg-white/5",children:["priority","weighted","round-robin"].map(s=>(0,a.jsx)("button",{role:"tab","aria-selected":e.strategy===s,onClick:()=>t(e=>({...e,strategy:s})),className:(0,r.cn)("px-3 py-1 rounded text-xs font-medium transition-all capitalize",e.strategy===s?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:"round-robin"===s?"Round-Robin":s},s))})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border/50",children:[{key:"maxRetries",label:"Max Retries",min:0,max:5},{key:"retryDelayMs",label:"Retry Delay (ms)",min:500,max:1e4,step:500},{key:"timeoutMs",label:"Timeout (ms)",min:5e3,max:3e5,step:5e3},{key:"maxComboDepth",label:"Max Nesting Depth",min:1,max:10}].map(({key:s,label:l,min:r,max:i,step:d})=>(0,a.jsx)(n.pd,{label:l,type:"number",min:r,max:i,step:d||1,value:e[s]??"",onChange:e=>t(t=>({...t,[s]:parseInt(e.target.value)||0})),className:"text-sm"},s))}),"round-robin"===e.strategy&&(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border/50",children:[(0,a.jsx)(n.pd,{label:"Concurrency / Model",type:"number",min:1,max:20,value:e.concurrencyPerModel??"",placeholder:"3",onChange:e=>t(t=>({...t,concurrencyPerModel:parseInt(e.target.value)||0})),className:"text-sm"}),(0,a.jsx)(n.pd,{label:"Queue Timeout (ms)",type:"number",min:1e3,max:12e4,step:1e3,value:e.queueTimeoutMs??"",placeholder:"30000",onChange:e=>t(t=>({...t,queueTimeoutMs:parseInt(e.target.value)||0})),className:"text-sm"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:"Health Check"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Pre-check provider availability"})]}),(0,a.jsx)(n.lM,{checked:!1!==e.healthCheckEnabled,onChange:()=>t(e=>({...e,healthCheckEnabled:!e.healthCheckEnabled}))})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:"Track Metrics"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Record per-combo request metrics"})]}),(0,a.jsx)(n.lM,{checked:!1!==e.trackMetrics,onChange:()=>t(e=>({...e,trackMetrics:!e.trackMetrics}))})]})]}),(0,a.jsxs)("div",{className:"pt-3 border-t border-border/50",children:[(0,a.jsx)("p",{className:"font-medium text-sm mb-2",children:"Provider Overrides"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Override timeout and retries per provider. Provider settings override global defaults."}),Object.entries(s).map(([e,t])=>(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,a.jsx)("span",{className:"text-xs font-mono font-medium min-w-[80px]",children:e}),(0,a.jsx)(n.pd,{type:"number",min:"0",max:"5",value:t.maxRetries??1,onChange:t=>i(s=>({...s,[e]:{...s[e],maxRetries:parseInt(t.target.value)||0}})),className:"text-xs w-16","aria-label":`${e} max retries`}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"retries"}),(0,a.jsx)(n.pd,{type:"number",min:"5000",max:"300000",step:"5000",value:t.timeoutMs??12e4,onChange:t=>i(s=>({...s,[e]:{...s[e],timeoutMs:parseInt(t.target.value)||12e4}})),className:"text-xs w-24","aria-label":`${e} timeout ms`}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"ms"}),(0,a.jsx)("button",{onClick:()=>{i(t=>{let s={...t};return delete s[e],s})},className:"ml-auto text-red-400 hover:text-red-500 transition-colors","aria-label":`Remove ${e} override`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]},e)),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,a.jsx)(n.pd,{type:"text",placeholder:"e.g. google, openai...",value:d,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&u(),className:"text-xs flex-1","aria-label":"New provider name"}),(0,a.jsx)(n.$n,{variant:"outline",size:"sm",onClick:u,disabled:!d.trim(),children:"Add"})]})]}),(0,a.jsx)("div",{className:"pt-3 border-t border-border/50",children:(0,a.jsx)(n.$n,{variant:"primary",size:"sm",onClick:x,loading:o,children:"Save Combo Defaults"})})]})]})}function v(){let[e,t]=(0,l.useState)(!1),[s,r]=(0,l.useState)(null),i=(0,l.useRef)(!0),d=async()=>{try{let e=await fetch("/api/settings/proxy?level=global");if(e.ok){let t=await e.json();r(t.proxy||null)}}catch{}};return(0,l.useEffect)(()=>(i.current=!0,async function(){try{let e=await fetch("/api/settings/proxy?level=global");if(!i.current)return;if(e.ok){let t=await e.json();i.current&&r(t.proxy||null)}}catch{}}(),()=>{i.current=!1}),[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"vpn_lock"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:"Global Proxy"})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Configure a global outbound proxy for all API calls. Individual providers, combos, and keys can override this."}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[s?(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded text-xs font-bold uppercase bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[s.type,"://",s.host,":",s.port]})}):(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"No global proxy configured"}),(0,a.jsx)(n.$n,{size:"sm",variant:s?"secondary":"primary",icon:"settings",onClick:()=>{d(),t(!0)},children:s?"Edit":"Configure"})]})]})}),(0,a.jsx)(n.KN,{isOpen:e,onClose:()=>t(!1),level:"global",levelLabel:"Global",onSaved:d})]})}var y=s(2946);function N(){let{theme:e,setTheme:t,isDark:s}=(0,y.D)();return(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"palette"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Appearance"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Dark Mode"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Switch between light and dark themes"})]}),(0,a.jsx)(n.lM,{checked:s,onChange:()=>t(s?"light":"dark")})]}),(0,a.jsx)("div",{className:"pt-4 border-t border-border",children:(0,a.jsx)("div",{role:"tablist","aria-label":"Theme selection",className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5",children:["light","dark","system"].map(s=>(0,a.jsxs)("button",{role:"tab","aria-selected":e===s,onClick:()=>t(s),className:(0,r.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all",e===s?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"light"===s?"light_mode":"dark"===s?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"capitalize",children:s})]},s))})})]})]})}let k=[{value:"passthrough",label:"Passthrough",desc:"No changes — client controls thinking budget",icon:"arrow_forward"},{value:"auto",label:"Auto",desc:"Strip all thinking config — let provider decide",icon:"auto_awesome"},{value:"custom",label:"Custom",desc:"Set a fixed token budget for all requests",icon:"tune"},{value:"adaptive",label:"Adaptive",desc:"Scale budget based on request complexity",icon:"trending_up"}],w=[{value:"none",label:"None (0 tokens)"},{value:"low",label:"Low (1K tokens)"},{value:"medium",label:"Medium (10K tokens)"},{value:"high",label:"High (128K tokens)"}];function C(){let[e,t]=(0,l.useState)({mode:"passthrough",customBudget:10240,effortLevel:"medium"}),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)(!1),[c,o]=(0,l.useState)("");(0,l.useEffect)(()=>{fetch("/api/settings/thinking-budget").then(e=>e.json()).then(e=>{t(e),r(!1)}).catch(()=>r(!1))},[]);let m=async s=>{let a={...e,...s};t(a),d(!0),o("");try{(await fetch("/api/settings/thinking-budget",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok?(o("saved"),setTimeout(()=>o(""),2e3)):o("error")}catch{o("error")}finally{d(!1)}};return(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"psychology"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Thinking Budget"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Control AI reasoning token usage across all requests"})]}),"saved"===c&&(0,a.jsxs)("span",{className:"ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," Saved"]})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 mb-5",children:k.map(t=>(0,a.jsxs)("button",{onClick:()=>m({mode:t.value}),disabled:s||i,className:`flex items-start gap-3 p-3 rounded-lg border text-left transition-all ${e.mode===t.value?"border-violet-500/50 bg-violet-500/5 ring-1 ring-violet-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] mt-0.5 ${e.mode===t.value?"text-violet-500":"text-text-muted"}`,children:t.icon}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:`text-sm font-medium ${e.mode===t.value?"text-violet-400":""}`,children:t.label}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:t.desc})]})]},t.value))}),"custom"===e.mode&&(0,a.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Token Budget"}),(0,a.jsxs)("span",{className:"text-sm font-mono tabular-nums text-violet-400",children:[e.customBudget.toLocaleString()," tokens"]})]}),(0,a.jsx)("input",{type:"range",min:"0",max:"131072",step:"1024",value:e.customBudget,onChange:e=>m({customBudget:parseInt(e.target.value)}),className:"w-full accent-violet-500"}),(0,a.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mt-1",children:[(0,a.jsx)("span",{children:"Off"}),(0,a.jsx)("span",{children:"1K"}),(0,a.jsx)("span",{children:"10K"}),(0,a.jsx)("span",{children:"64K"}),(0,a.jsx)("span",{children:"128K"})]})]}),"adaptive"===e.mode&&(0,a.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30",children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-3",children:"Base Effort Level"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Adaptive mode scales from this base level based on message count, tool usage, and prompt length."}),(0,a.jsx)("div",{className:"grid grid-cols-4 gap-2",children:w.map(t=>(0,a.jsx)("button",{onClick:()=>m({effortLevel:t.value}),disabled:s||i,className:`px-3 py-2 rounded-lg text-xs font-medium border transition-all ${e.effortLevel===t.value?"border-violet-500/50 bg-violet-500/10 text-violet-400":"border-border/50 text-text-muted hover:border-border"}`,children:t.value.charAt(0).toUpperCase()+t.value.slice(1)},t.value))})]})]})}function S(){let[e,t]=(0,l.useState)({enabled:!1,prompt:""}),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)(""),[c,o]=(0,l.useState)(null);(0,l.useEffect)(()=>{fetch("/api/settings/system-prompt").then(e=>e.json()).then(e=>{t(e),r(!1)}).catch(()=>r(!1))},[]);let m=async s=>{let a={...e,...s};t(a),d("");try{(await fetch("/api/settings/system-prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(d("saved"),setTimeout(()=>d(""),2e3))}catch{d("error")}};return(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"edit_note"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Global System Prompt"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Injected into all requests at proxy level"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:["saved"===i&&(0,a.jsxs)("span",{className:"text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," Saved"]}),(0,a.jsx)(n.lM,{checked:e.enabled,onChange:()=>m({enabled:!e.enabled}),disabled:s})]})]}),e.enabled&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{value:e.prompt,onChange:e=>{var s;return s=e.target.value,void(t(e=>({...e,prompt:s})),c&&clearTimeout(c),o(setTimeout(()=>{m({prompt:s})},800)))},placeholder:"Enter system prompt to inject into all requests...",rows:5,className:"w-full px-4 py-3 rounded-lg border border-border/50 bg-surface/30 text-sm placeholder:text-text-muted/50 resize-y min-h-[120px] focus:outline-none focus:ring-1 focus:ring-amber-500/30 focus:border-amber-500/50 transition-colors",disabled:s}),(0,a.jsxs)("div",{className:"absolute bottom-2 right-3 text-xs text-text-muted/60 tabular-nums",children:[e.prompt.length," chars"]})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted/70 flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),"This prompt is prepended to the system message of every request. Use for global instructions, safety guidelines, or response formatting rules. Send ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-surface/50",children:"_skipSystemPrompt: true"})," in a request to bypass."]})]})]})}let $=["input","output","cached","reasoning","cache_creation"],P={input:"Input",output:"Output",cached:"Cached",reasoning:"Reasoning",cache_creation:"Cache Write"};function A(){let[e,t]=(0,l.useState)({}),[s,r]=(0,l.useState)({}),[i,d]=(0,l.useState)(!0),[c,o]=(0,l.useState)(!1),[m,x]=(0,l.useState)(""),[u,p]=(0,l.useState)(null),[h,b]=(0,l.useState)(new Set),[g,f]=(0,l.useState)(""),[j,v]=(0,l.useState)(new Set);(0,l.useEffect)(()=>{y()},[]);let y=async()=>{d(!0);try{let[e,s]=await Promise.all([fetch("/api/pricing/models"),fetch("/api/pricing")]);e.ok&&t(await e.json()),s.ok&&r(await s.json())}catch(e){console.error("Failed to load pricing data:",e)}finally{d(!1)}},N=(0,l.useMemo)(()=>Object.entries(e).map(([e,t])=>({alias:e,...t,pricedModels:s[e]?Object.keys(s[e]).length:0})).sort((e,t)=>t.modelCount-e.modelCount),[e,s]),k=(0,l.useMemo)(()=>{if(!g.trim())return N;let e=g.toLowerCase();return N.filter(t=>t.alias.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.models.some(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)))},[N,g]),w=(0,l.useMemo)(()=>{let e=N.reduce((e,t)=>e+t.modelCount,0),t=Object.values(s).reduce((e,t)=>e+Object.keys(t).length,0);return{providers:N.length,totalModels:e,pricedCount:t}},[N,s]),C=(0,l.useCallback)(e=>{b(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),S=(0,l.useCallback)((e,t,s,a)=>{let l=parseFloat(a);isNaN(l)||l<0||(r(a=>{let r={...a};return r[e]||(r[e]={}),r[e][t]||(r[e][t]={input:0,output:0,cached:0,reasoning:0,cache_creation:0}),r[e][t]={...r[e][t],[s]:l},r}),v(t=>new Set(t).add(e)))},[]),$=(0,l.useCallback)(async e=>{o(!0),x("");try{let t=s[e]||{},a=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})});if(a.ok)x(`✅ ${e.toUpperCase()} saved`),v(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>x(""),3e3);else{let e=await a.json();x(`❌ Error: ${e.error}`)}}catch(e){x(`❌ Save failed: ${e.message}`)}finally{o(!1)}},[s]),P=(0,l.useCallback)(async e=>{if(confirm(`Reset all pricing for ${e.toUpperCase()} to defaults?`))try{let t=await fetch(`/api/pricing?provider=${e}`,{method:"DELETE"});if(t.ok){let s=await t.json();r(s),x(`🔄 ${e.toUpperCase()} reset to defaults`),v(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>x(""),3e3)}}catch(e){x(`❌ Reset failed: ${e.message}`)}},[]),A=(0,l.useCallback)(e=>{p(t=>t===e?null:e)},[]),L=(0,l.useMemo)(()=>u?k.filter(e=>e.alias===u):k,[k,u]);return i?(0,a.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,a.jsx)("div",{className:"text-text-muted animate-pulse",children:"Loading pricing data..."})}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between flex-wrap gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-bold",children:"Model Pricing"}),(0,a.jsxs)("p",{className:"text-text-muted text-sm mt-1",children:["Configure cost rates per model • All rates in"," ",(0,a.jsx)("strong",{children:"$/1M tokens"})]})]}),(0,a.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:"Providers"}),(0,a.jsx)("div",{className:"text-lg font-bold",children:w.providers})]}),(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:"Registry"}),(0,a.jsx)("div",{className:"text-lg font-bold",children:w.totalModels})]}),(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:"Priced"}),(0,a.jsx)("div",{className:"text-lg font-bold text-success",children:w.pricedCount})]})]})]}),m&&(0,a.jsx)("div",{className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm",children:m}),(0,a.jsxs)("div",{className:"flex gap-3 items-center flex-wrap",children:[(0,a.jsxs)("div",{className:"relative flex-1 min-w-[200px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-text-muted text-lg",children:"search"}),(0,a.jsx)("input",{type:"text",placeholder:"Search providers or models...",value:g,onChange:e=>f(e.target.value),className:"w-full pl-10 pr-3 py-2 bg-bg-base border border-border rounded-lg focus:outline-none focus:border-primary text-sm"})]}),u&&(0,a.jsxs)("button",{onClick:()=>p(null),className:"px-3 py-2 text-xs bg-primary/10 text-primary border border-primary/20 rounded-lg hover:bg-primary/20 transition-colors flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"}),u.toUpperCase()," — Show All"]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:N.map(e=>(0,a.jsxs)("button",{onClick:()=>A(e.alias),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-all ${u===e.alias?"bg-primary text-white shadow-sm":j.has(e.alias)?"bg-yellow-500/15 text-yellow-400 border border-yellow-500/30":"bg-bg-subtle text-text-muted hover:bg-bg-hover border border-transparent"}`,children:[e.alias.toUpperCase()," ",(0,a.jsxs)("span",{className:"opacity-60",children:["(",e.modelCount,")"]})]},e.alias))}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[L.map(e=>(0,a.jsx)(T,{provider:e,pricingData:s[e.alias]||{},isExpanded:h.has(e.alias),isEdited:j.has(e.alias),onToggle:()=>C(e.alias),onPricingChange:(t,s,a)=>S(e.alias,t,s,a),onSave:()=>$(e.alias),onReset:()=>P(e.alias),saving:c},e.alias)),0===L.length&&(0,a.jsx)("div",{className:"text-center py-12 text-text-muted",children:"No providers match your search."})]}),(0,a.jsxs)(n.Zp,{className:"p-4 mt-2",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"info"}),"How Pricing Works"]}),(0,a.jsxs)("div",{className:"text-xs text-text-muted space-y-1",children:[(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:"Input"}),": tokens sent to the model •"," ",(0,a.jsx)("strong",{children:"Output"}),": tokens generated •"," ",(0,a.jsx)("strong",{children:"Cached"}),": reused input (~50% of input rate) •"," ",(0,a.jsx)("strong",{children:"Reasoning"}),": thinking tokens (falls back to Output) •"," ",(0,a.jsx)("strong",{children:"Cache Write"}),": creating cache entries (falls back to Input)"]}),(0,a.jsx)("p",{children:"Cost = (input \xd7 input_rate) + (output \xd7 output_rate) + (cached \xd7 cached_rate) per million tokens."})]})]})]})}function T({provider:e,pricingData:t,isExpanded:s,isEdited:l,onToggle:r,onPricingChange:i,onSave:n,onReset:d,saving:c}){let o=Object.keys(t).length,m="oauth"===e.authType?"OAuth":"apikey"===e.authType?"API Key":e.authType;return(0,a.jsxs)("div",{className:`border rounded-lg overflow-hidden transition-colors ${l?"border-yellow-500/40 bg-yellow-500/5":"border-border"}`,children:[(0,a.jsxs)("button",{onClick:r,className:"w-full flex items-center justify-between px-4 py-3 hover:bg-bg-hover/50 transition-colors text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg transition-transform ${s?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-sm",children:e.id.charAt(0).toUpperCase()+e.id.slice(1)}),(0,a.jsxs)("span",{className:"text-text-muted text-xs ml-2",children:["(",e.alias.toUpperCase(),")"]})]}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:m}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:e.format})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[l&&(0,a.jsx)("span",{className:"text-yellow-500 text-xs font-medium",children:"unsaved"}),(0,a.jsxs)("span",{className:"text-text-muted text-xs",children:[o,"/",e.modelCount," priced"]}),(0,a.jsx)("div",{className:"w-16 h-1.5 bg-bg-subtle rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${e.modelCount>0?Math.round(o/e.modelCount*100):0}%`}})})]})]}),s&&(0,a.jsxs)("div",{className:"border-t border-border",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 bg-bg-subtle/50",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[e.modelCount," models •"," ",o," with pricing configured"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),d()},className:"px-2.5 py-1 text-[11px] text-red-400 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",children:"Reset Defaults"}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},disabled:c||!l,className:"px-2.5 py-1 text-[11px] bg-primary text-white rounded hover:bg-primary/90 transition-colors disabled:opacity-40",children:c?"Saving...":"Save Provider"})]})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"text-[11px] text-text-muted uppercase bg-bg-subtle/30",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-2 text-left font-semibold",children:"Model"}),$.map(e=>(0,a.jsx)("th",{className:"px-2 py-2 text-right font-semibold w-24",children:P[e]},e))]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border/50",children:e.models.map(e=>(0,a.jsx)(L,{model:e,pricing:t[e.id],onPricingChange:(t,s)=>i(e.id,t,s)},e.id))})]})})]})]})}function L({model:e,pricing:t,onPricingChange:s}){let l=t&&Object.values(t).some(e=>e>0);return(0,a.jsxs)("tr",{className:"hover:bg-bg-hover/30 group",children:[(0,a.jsx)("td",{className:"px-4 py-1.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${l?"bg-success":"bg-text-muted/30"}`}),(0,a.jsx)("span",{className:"font-medium text-xs",children:e.name}),e.custom&&(0,a.jsx)("span",{className:"px-1 py-0.5 text-[8px] font-bold bg-blue-500/15 text-blue-400 border border-blue-500/20 rounded uppercase",children:"custom"}),(0,a.jsx)("span",{className:"text-text-muted text-[10px] opacity-0 group-hover:opacity-100 transition-opacity",children:e.id})]})}),$.map(e=>(0,a.jsx)("td",{className:"px-2 py-1.5",children:(0,a.jsx)("input",{type:"number",step:"0.01",min:"0",value:t?.[e]||0,onChange:t=>s(e,t.target.value),className:"w-full px-2 py-1 text-right text-xs bg-transparent border border-transparent hover:border-border focus:border-primary focus:bg-bg-base rounded transition-colors outline-none tabular-nums"})},e))]})}let E=[{key:"timestamp",label:"Time"},{key:"action",label:"Action"},{key:"actor",label:"Actor"},{key:"details",label:"Details"}];function B(){let[e,t]=(0,l.useState)([]),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)(""),[c,o]=(0,l.useState)({}),[x,u]=(0,l.useState)({timestamp:!0,action:!0,actor:!0,details:!0}),p=(0,m.i)();(0,l.useEffect)(()=>{fetch("/api/compliance/audit-log?limit=100").then(e=>e.json()).then(e=>{t(Array.isArray(e)?e:e.logs||[]),r(!1)}).catch(()=>{r(!1),p.error("Failed to load audit log")})},[]);let h=[...new Set(e.map(e=>e.action).filter(Boolean))],b=[...new Set(e.map(e=>e.actor).filter(Boolean))],g=e.filter(e=>{if(i){let t=i.toLowerCase();if(!(e.action?.toLowerCase().includes(t)||e.actor?.toLowerCase().includes(t)||e.details&&JSON.stringify(e.details).toLowerCase().includes(t)))return!1}return(!c.action||e.action===c.action)&&(!c.actor||e.actor===c.actor)}),f=E.filter(e=>x[e.key]),j=(0,l.useCallback)(e=>{u(t=>({...t,[e]:!t[e]}))},[]),v=(0,l.useCallback)((e,t)=>{switch(t.key){case"timestamp":return(0,a.jsx)("span",{className:"font-mono text-xs text-text-muted whitespace-nowrap",children:e.timestamp?new Date(e.timestamp).toLocaleString():"—"});case"action":return(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent/10 text-accent",children:e.action||"—"});case"actor":return(0,a.jsx)("span",{className:"text-text-main",children:e.actor||"system"});case"details":return(0,a.jsx)("span",{className:"text-text-muted text-xs max-w-xs truncate block",children:e.details?JSON.stringify(e.details):"—"});default:return e[t.key]||"—"}},[]);return(0,a.jsxs)(n.Zp,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"policy"}),"Audit Log"]}),(0,a.jsx)(n.tD,{columns:E,visible:x,onToggle:j})]}),(0,a.jsx)(n.Qn,{searchValue:i,onSearchChange:d,placeholder:"Search audit logs...",filters:[{key:"action",label:"Action",options:h},{key:"actor",label:"Actor",options:b}],activeFilters:c,onFilterChange:(e,t)=>o(s=>({...s,[e]:t}))}),(0,a.jsx)(n.bQ,{columns:f,data:g,renderCell:v,loading:s,maxHeight:"400px",emptyIcon:"\uD83D\uDCCB",emptyMessage:"No audit events found"})]})}function O(){let[e,t]=(0,l.useState)(null),[s,r]=(0,l.useState)(!1),i=()=>{fetch("/api/cache/stats").then(e=>e.json()).then(t).catch(()=>{})};(0,l.useEffect)(i,[]);let d=async()=>{r(!0);try{await fetch("/api/cache/stats",{method:"DELETE"}),i()}finally{r(!1)}};return(0,a.jsxs)(n.Zp,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"cached"}),"Prompt Cache"]}),(0,a.jsx)("button",{onClick:d,disabled:s,className:"px-3 py-1.5 text-xs rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:s?"Flushing…":"Flush Cache"})]}),e?(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Size"}),(0,a.jsxs)("p",{className:"font-mono text-lg text-text-main",children:[e.size,"/",e.maxSize]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Hit Rate"}),(0,a.jsxs)("p",{className:"font-mono text-lg text-text-main",children:[e.hitRate?.toFixed(1)??0,"%"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Hits"}),(0,a.jsx)("p",{className:"font-mono text-text-main",children:e.hits??0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Evictions"}),(0,a.jsx)("p",{className:"font-mono text-text-main",children:e.evictions??0})]})]}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Loading cache stats…"})]})}let R={CLOSED:{bg:"bg-emerald-500/15",text:"text-emerald-400",border:"border-emerald-500/30",label:"CLOSED",icon:"check_circle"},OPEN:{bg:"bg-red-500/15",text:"text-red-400",border:"border-red-500/30",label:"OPEN",icon:"error"},HALF_OPEN:{bg:"bg-amber-500/15",text:"text-amber-400",border:"border-amber-500/30",label:"HALF-OPEN",icon:"warning"}};function M({breakers:e,onReset:t,loading:s}){let l=e.filter(e=>"CLOSED"!==e.state),r=e.length;return(0,a.jsx)(n.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"electrical_services"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:"Circuit Breakers"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:l.length>0?`${l.length} tripped`:`${r} healthy`}),l.length>0&&(0,a.jsx)(n.$n,{size:"sm",variant:"danger",icon:"restart_alt",onClick:t,disabled:s,children:"Reset All"})]})]}),0===e.length?(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No circuit breakers active yet. They are created automatically when requests flow through the combo pipeline."}):(0,a.jsx)("div",{className:"space-y-2",children:e.map(e=>{let t=R[e.state]||R.CLOSED;return(0,a.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-black/5 dark:bg-white/5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-base ${t.text}`,"aria-hidden":"true",children:t.icon}),(0,a.jsx)("span",{className:"text-sm font-medium",children:e.name.replace("combo:","")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[e.failureCount>0&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[e.failureCount," failure",1!==e.failureCount?"s":""]}),(0,a.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-bold uppercase ${t.bg} ${t.text} border ${t.border}`,children:t.label})]})]},e.name)})})]})})}function _({profiles:e,onSave:t,saving:s}){let[r,i]=(0,l.useState)(!1),[d,c]=(0,l.useState)(e);(0,l.useEffect)(()=>{c(e)},[e]);let o=[{key:"transientCooldown",label:"Transient Cooldown",suffix:"ms"},{key:"rateLimitCooldown",label:"Rate Limit Cooldown",suffix:"ms"},{key:"maxBackoffLevel",label:"Max Backoff Level",suffix:""},{key:"circuitBreakerThreshold",label:"CB Threshold",suffix:" fails"},{key:"circuitBreakerReset",label:"CB Reset Time",suffix:"ms"}];return(0,a.jsx)(n.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"tune"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:"Provider Profiles"})]}),r?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(n.$n,{size:"sm",variant:"secondary",onClick:()=>i(!1),children:"Cancel"}),(0,a.jsx)(n.$n,{size:"sm",variant:"primary",icon:"save",onClick:()=>{t(d),i(!1)},disabled:s,children:"Save"})]}):(0,a.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>i(!0),children:"Edit"})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Separate resilience settings for OAuth (session-based) and API Key (metered) providers. OAuth providers have stricter thresholds due to lower rate limits."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:["oauth","apikey"].map(t=>(0,a.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4",children:[(0,a.jsxs)("h3",{className:"text-sm font-bold uppercase tracking-wider mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base","aria-hidden":"true",children:"oauth"===t?"lock":"key"}),"oauth"===t?"OAuth Providers":"API Key Providers"]}),(0,a.jsx)("div",{className:"space-y-2",children:o.map(({key:s,label:l,suffix:i})=>(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:l}),r?(0,a.jsx)("input",{type:"number",min:"0",value:d?.[t]?.[s]??0,onChange:e=>c({...d,[t]:{...d[t],[s]:Number(e.target.value)}}),className:"w-24 px-2 py-1 text-xs rounded bg-white/10 border border-white/20 text-right"}):(0,a.jsxs)("span",{className:"text-sm font-mono",children:[e?.[t]?.[s]??"—",i&&e?.[t]?.[s]!=null?i:""]})]},s))})]},t))})]})})}function D({rateLimitStatus:e,defaults:t}){var s;return(0,a.jsx)(n.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"speed"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:"Rate Limiting"})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"API Key providers are automatically rate-limited with safe defaults. Limits are learned from response headers and adapt over time."}),(0,a.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4 mb-4",children:[(0,a.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider mb-2 text-text-muted",children:"Default Safety Net"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-lg font-bold",children:t?.requestsPerMinute??"—"}),(0,a.jsx)("div",{className:"text-xs text-text-muted",children:"RPM"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-lg font-bold",children:(s=t?.minTimeBetweenRequests)&&!(s<=0)?s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${(s/6e4).toFixed(1)}m`:"—"}),(0,a.jsx)("div",{className:"text-xs text-text-muted",children:"Min Gap"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-lg font-bold",children:t?.concurrentRequests??"—"}),(0,a.jsx)("div",{className:"text-xs text-text-muted",children:"Max Concurrent"})]})]})]}),e&&e.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Active Limiters"}),e.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-black/5 dark:bg-white/5",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:e.provider||e.key}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[null!=e.reservoir&&(0,a.jsxs)("span",{children:["Reservoir: ",e.reservoir]}),null!=e.running&&(0,a.jsxs)("span",{children:["Running: ",e.running]}),null!=e.queued&&(0,a.jsxs)("span",{children:["Queued: ",e.queued]})]})]},t))]}):(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No active rate limiters yet."})]})})}function F(){let[e,t]=(0,l.useState)(null),[s,r]=(0,l.useState)(!0),[i,d]=(0,l.useState)(!1),[c,o]=(0,l.useState)(null),m=(0,l.useCallback)(async()=>{try{r(!0);let e=await fetch("/api/resilience");if(!e.ok)throw Error(`Failed to load: ${e.status}`);let s=await e.json();t(s),o(null)}catch(e){o(e.message)}finally{r(!1)}},[]);(0,l.useEffect)(()=>{m();let e=setInterval(m,1e4);return()=>clearInterval(e)},[m]);let x=async()=>{try{if(r(!0),!(await fetch("/api/resilience/reset",{method:"POST"})).ok)throw Error("Reset failed");await m()}catch(e){o(e.message)}finally{r(!1)}},u=async e=>{try{if(d(!0),!(await fetch("/api/resilience",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({profiles:e})})).ok)throw Error("Save failed");await m()}catch(e){o(e.message)}finally{d(!1)}};return s&&!e?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"hourglass_empty"}),"Loading resilience status..."]}):c&&!e?(0,a.jsxs)(n.Zp,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-red-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"error"}),(0,a.jsx)("span",{className:"text-sm",children:c})]}),(0,a.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:m,className:"mt-3",children:"Retry"})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(M,{breakers:e?.circuitBreakers||[],onReset:x,loading:s}),(0,a.jsx)(_,{profiles:e?.profiles||{},onSave:u,saving:i}),(0,a.jsx)(D,{rateLimitStatus:e?.rateLimitStatus||[],defaults:e?.defaults||{}})]})}let z=[{id:"general",label:"General",icon:"settings"},{id:"ai",label:"AI",icon:"smart_toy"},{id:"security",label:"Security",icon:"shield"},{id:"routing",label:"Routing",icon:"route"},{id:"resilience",label:"Resilience",icon:"electrical_services"},{id:"pricing",label:"Pricing",icon:"payments"},{id:"advanced",label:"Advanced",icon:"tune"},{id:"compliance",label:"Compliance",icon:"policy"}];function I(){let[e,t]=(0,l.useState)("general");return(0,a.jsx)("div",{className:"max-w-2xl mx-auto",children:(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)("div",{role:"tablist","aria-label":"Settings sections",className:"inline-flex items-center p-1 rounded-lg bg-black/5 dark:bg-white/5 self-start",children:z.map(s=>(0,a.jsxs)("button",{role:"tab","aria-selected":e===s.id,tabIndex:e===s.id?0:-1,onClick:()=>t(s.id),className:(0,r.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all text-sm",e===s.id?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:s.icon}),(0,a.jsx)("span",{className:"hidden sm:inline",children:s.label})]},s.id))}),(0,a.jsxs)("div",{role:"tabpanel","aria-label":z.find(t=>t.id===e)?.label,children:["general"===e&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(d,{}),(0,a.jsx)(N,{})]})}),"ai"===e&&(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(C,{}),(0,a.jsx)(S,{})]}),"security"===e&&(0,a.jsx)(p,{}),"routing"===e&&(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(f,{}),(0,a.jsx)(j,{})]}),"pricing"===e&&(0,a.jsx)(A,{}),"resilience"===e&&(0,a.jsx)(F,{}),"advanced"===e&&(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(v,{}),(0,a.jsx)(O,{})]}),"compliance"===e&&(0,a.jsx)(B,{})]}),(0,a.jsxs)("div",{className:"text-center text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[i.vQ.name," v",i.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:"Local Mode — All data stored on your machine"})]})]})})}},21680:(e,t,s)=>{Promise.resolve().then(s.bind(s,3116))}},e=>{e.O(0,[8500,9751,600,3191,7896,1525,8441,3794,7358],()=>e(e.s=21680)),_N_E=e.O()}]);
|