vansrouter 0.91.81 → 0.91.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +17 -17
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-fitness/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/providers/bulk/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard/proxy-fitness/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard/proxy-fitness.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/masuk/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +17 -17
- package/app/.next-cli-build/server/chunks/1693.js +1 -1
- package/app/.next-cli-build/server/chunks/2247.js +1 -1
- package/app/.next-cli-build/server/chunks/2557.js +4 -4
- package/app/.next-cli-build/server/chunks/2764.js +1 -1
- package/app/.next-cli-build/server/chunks/3280.js +1 -1
- package/app/.next-cli-build/server/chunks/4574.js +1 -1
- package/app/.next-cli-build/server/chunks/5302.js +1 -1
- package/app/.next-cli-build/server/chunks/7104.js +1 -1
- package/app/.next-cli-build/server/chunks/9536.js +1 -1
- package/app/.next-cli-build/server/chunks/9984.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/app/.next-cli-build/static/chunks/{4385-8c9a0e1234e80c01.js → 4385-24249afd9e192496.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-3f8a44de6089689e.js → page-176606799cc947aa.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-85770718a5ce696c.js +1 -0
- package/app/package.json +1 -1
- package/app/src/app/(dashboard)/dashboard/proxy-pools/RelayDeployModal.js +1 -1
- package/app/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.js +32 -5
- package/app/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.js +26 -0
- package/package.json +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-f03d828c4ad65425.js +0 -1
- /package/app/.next-cli-build/static/{mLzfM8ZQNM3n-fkmS1xpC → DsIP1InInSX1jxI1CwKX9}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{mLzfM8ZQNM3n-fkmS1xpC → DsIP1InInSX1jxI1CwKX9}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812,8937],{15327:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>k});var l=r(15102),o=r(82030),a=r(10736),n=r(25795);async function s(e,t,r){let l=[];for(let o of e){try{l.push(await t(o))}catch{l.push("fail")}r?.(l.length,e.length)}return l}function i(e){return e.reduce((e,t)=>(e[t]=(e[t]||0)+1,e),{})}var c=r(28937),d=r.n(c),p=r(7665),u=r(88140),m=r(41488);function x({isOpen:e,onClose:t,title:r,intro:o,bullets:a,tokenSteps:n,tokenStepsTitle:s,fields:i,deployLabel:c,onDeploy:d,deploying:h,deployDisabled:y,accent:g}){let f={blue:"bg-blue-500/5 border border-blue-500/10",teal:"bg-teal-500/5 border border-teal-500/10",neutral:"bg-black/5 dark:bg-white/5 border border-black/10 dark:border-white/10"},b={blue:"border-t border-blue-500/10",teal:"border-t border-teal-500/10",neutral:"border-t border-black/10 dark:border-white/10"},v=f[g]||f.neutral,k=b[g]||b.neutral;return(0,l.jsx)(p.A,{isOpen:e,title:r,onClose:t,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:`rounded-lg p-3 flex flex-col gap-1.5 ${v}`,children:[(0,l.jsxs)("p",{className:"text-sm text-text-main font-medium",children:["What is ",r.replace(/^Deploy /,""),"?"]}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:o}),(0,l.jsx)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:a.map(e=>(0,l.jsx)("li",{children:e},e))}),n.length>0&&(0,l.jsxs)("div",{className:`mt-2 pt-2 text-xs text-text-muted ${k}`,children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:s}),(0,l.jsx)("ol",{className:"list-decimal pl-4 space-y-0.5",children:n.map(e=>(0,l.jsx)("li",{children:e},e))})]})]}),i.map(e=>(0,l.jsx)(m.A,{label:e.label,value:e.value,onChange:e.onChange,placeholder:e.placeholder,hint:e.hint,type:e.type},e.label)),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(u.A,{fullWidth:!0,onClick:d,disabled:y||h,children:h?"Deploying... (may take ~1 min)":c}),(0,l.jsx)(u.A,{fullWidth:!0,variant:"ghost",onClick:t,disabled:h,children:"Cancel"})]})]})})}function h(e={}){return{name:e.name||"",proxyUrl:e.proxyUrl||"",noProxy:e.noProxy||"",isActive:!1!==e.isActive,strictProxy:!0===e.strictProxy}}x.propTypes={isOpen:d().bool.isRequired,onClose:d().func.isRequired,title:d().string.isRequired,intro:d().string.isRequired,bullets:d().arrayOf(d().string).isRequired,tokenSteps:d().arrayOf(d().string),tokenStepsTitle:d().string,fields:d().arrayOf(d().shape({label:d().string.isRequired,value:d().string.isRequired,onChange:d().func.isRequired,placeholder:d().string,hint:d().node,type:d().string})).isRequired,deployLabel:d().string.isRequired,onDeploy:d().func.isRequired,deploying:d().bool,deployDisabled:d().bool,accent:d().string};let y=(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]});function g({isOpen:e,editingProxyPool:t,formData:r,saving:o,onClose:n,onSave:s,onChange:i}){return(0,l.jsx)(a.Modal,{isOpen:e,title:t?"Edit Proxy Pool":"Add Proxy Pool",onClose:n,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(a.Input,{label:"Name",value:r.name,onChange:e=>i("name",e.target.value),placeholder:"Office Proxy"}),(0,l.jsx)(a.Input,{label:"Proxy URL",value:r.proxyUrl,onChange:e=>i("proxyUrl",e.target.value),placeholder:"http://127.0.0.1:7897"}),(0,l.jsx)(a.Input,{label:"No Proxy",value:r.noProxy,onChange:e=>i("noProxy",e.target.value),placeholder:"localhost,127.0.0.1,.internal",hint:"Comma-separated hosts/domains to bypass proxy"}),(0,l.jsx)(f,{label:"Active",description:"Inactive pools are ignored by runtime resolution.",checked:r.isActive,onChange:()=>i("isActive",!r.isActive),disabled:o}),(0,l.jsx)(f,{label:"Strict Proxy",description:"Fail request if proxy is unreachable instead of falling back to direct.",checked:r.strictProxy,onChange:()=>i("strictProxy",!r.strictProxy),disabled:o}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(a.Button,{fullWidth:!0,onClick:s,disabled:!r.name.trim()||!r.proxyUrl.trim()||o,children:o?"Saving...":"Save"}),(0,l.jsx)(a.Button,{fullWidth:!0,variant:"ghost",onClick:n,disabled:o,children:"Cancel"})]})]})})}function f({label:e,description:t,checked:r,onChange:o,disabled:n}){return(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:e}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:t})]}),(0,l.jsx)(a.Toggle,{checked:!0===r,onChange:o,disabled:n})]})}function b({isOpen:e,text:t,importing:r,onChange:o,onImport:n,onClose:s}){return(0,l.jsx)(a.Modal,{isOpen:e,title:"Batch Import Proxies",onClose:s,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{htmlFor:"proxy-batch-import",className:"text-sm font-medium text-text-main mb-1 block",children:"Paste Proxy List (One per line)"}),(0,l.jsx)("textarea",{id:"proxy-batch-import",value:t,onChange:e=>o(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(a.Button,{fullWidth:!0,onClick:n,disabled:!t.trim()||r,children:r?"Importing...":"Import"}),(0,l.jsx)(a.Button,{fullWidth:!0,variant:"ghost",onClick:s,disabled:r,children:"Cancel"})]})]})})}function v({pool:e,selected:t,testing:r,onSelect:o,onToggle:n,onTest:s,onEdit:i,onDelete:c}){var d;return(0,l.jsxs)("div",{className:"flex flex-col gap-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[(0,l.jsx)("input",{type:"checkbox",checked:t,onChange:o,"aria-label":`Select proxy ${e.name||e.id}`,className:"mt-1 size-4 shrink-0 rounded border-black/20 dark:border-white/20"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("p",{className:"min-w-0 max-w-full truncate text-sm font-medium sm:max-w-[18rem]",children:e.name}),(0,l.jsx)(a.Badge,{variant:"active"===(d=e.testStatus)?"success":"error"===d?"error":"default",size:"sm",dot:!0,children:e.testStatus||"unknown"}),(0,l.jsx)(a.Badge,{variant:e.isActive?"success":"default",size:"sm",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,l.jsx)(a.Badge,{variant:"default",size:"sm",children:"vercel relay"}),"cloudflare"===e.type&&(0,l.jsx)(a.Badge,{variant:"default",size:"sm",children:"cloudflare relay"}),(0,l.jsxs)(a.Badge,{variant:"default",size:"sm",children:[e.boundConnectionCount||0," bound"]})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate mt-1",children:e.proxyUrl}),e.noProxy?(0,l.jsxs)("p",{className:"text-xs text-text-muted truncate",children:["No proxy: ",e.noProxy]}):null,(0,l.jsxs)("p",{className:"text-[11px] text-text-muted mt-1",children:["Last tested: ",function(e){if(!e)return"Never";let t=new Date(e);return Number.isNaN(t.getTime())?"Never":t.toLocaleString()}(e.lastTestedAt),e.lastError?` \xb7 ${e.lastError}`:""]})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,l.jsx)(a.Toggle,{size:"sm",checked:!0===e.isActive,onChange:n,title:e.isActive?"Disable":"Enable"}),(0,l.jsx)("button",{type:"button",onClick:s,className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Test proxy",disabled:r,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:r?{animation:"spin 1s linear infinite"}:void 0,children:r?"progress_activity":"science"})}),(0,l.jsx)("button",{type:"button",onClick:i,className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Edit",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,l.jsx)("button",{type:"button",onClick:c,className:"p-2 rounded hover:bg-red-500/10 text-red-500",title:"Delete",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]})}function k(){let[e,t]=(0,o.useState)([]),[r,c]=(0,o.useState)(!0),[d,p]=(0,o.useState)(!1),[u,m]=(0,o.useState)(!1),[f,k]=(0,o.useState)(!1),[j,w]=(0,o.useState)(!1),[N,C]=(0,o.useState)(!1),[P,D]=(0,o.useState)(!1),[T,S]=(0,o.useState)(!1),[$,A]=(0,o.useState)(null),[O,I]=(0,o.useState)(()=>h()),[U,R]=(0,o.useState)(""),[E,_]=(0,o.useState)({vercelToken:"",projectName:"vercel-relay"}),[B,F]=(0,o.useState)({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),[q,z]=(0,o.useState)({denoToken:"",orgDomain:"",projectName:""}),[L,W]=(0,o.useState)({netlifyToken:"",projectName:"netlify-relay"}),[V,J]=(0,o.useState)(!1),[G,M]=(0,o.useState)(!1),[H,Y]=(0,o.useState)(!1),[K,Q]=(0,o.useState)(null),[X,Z]=(0,o.useState)([]),[ee,et]=(0,o.useState)(!1),[er,el]=(0,o.useState)({current:0,total:0}),[eo,ea]=(0,o.useState)(!1),[en,es]=(0,o.useState)({label:"",current:0,total:0}),[ei,ec]=(0,o.useState)(null),ed=(0,o.useRef)(null),ep=(0,n.i)();(0,o.useEffect)(()=>{let e=e=>{ed.current&&!ed.current.contains(e.target)&&S(!1)};return T&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[T]);let eu=(0,o.useCallback)(async()=>{try{let e=await fetch("/api/proxy-pools?includeUsage=true",{cache:"no-store"}),r=await e.json();e.ok&&t(r.proxyPools||[])}catch(e){console.log("Error fetching proxy pools:",e)}finally{c(!1)}},[]);(0,o.useEffect)(()=>{eu()},[eu]);let em=()=>{A(null),I(h())},ex=()=>{em(),p(!0)},eh=()=>{p(!1),em()},ey=async()=>{let e={name:O.name.trim(),proxyUrl:O.proxyUrl.trim(),noProxy:O.noProxy.trim(),isActive:!0===O.isActive,strictProxy:!0===O.strictProxy};if(e.name&&e.proxyUrl){J(!0);try{let t=!!$,r=await fetch(t?`/api/proxy-pools/${$.id}`:"/api/proxy-pools",{method:t?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)await eu(),eh(),ep.success($?"Proxy pool updated":"Proxy pool created");else{let e=await r.json();ep.error(e.error||"Failed to save proxy pool")}}catch(e){console.log("Error saving proxy pool:",e)}finally{J(!1)}}},eg=async e=>{ec({title:"Delete Proxy Pool",message:`Delete proxy pool "${e.name}"?`,onConfirm:async()=>{ec(null);try{let r=await fetch(`/api/proxy-pools/${e.id}`,{method:"DELETE"});if(r.ok){t(t=>t.filter(t=>t.id!==e.id)),ep.success("Proxy pool deleted");return}let l=await r.json();409===r.status?ep.warning(`Cannot delete: ${l.boundConnectionCount||0} connection(s) are still using this pool.`):ep.error(l.error||"Failed to delete proxy pool")}catch(e){console.log("Error deleting proxy pool:",e),ep.error("Failed to delete proxy pool")}}})},ef=async e=>{Q(e);try{let t=await fetch(`/api/proxy-pools/${e}/test`,{method:"POST"}),r=await t.json();if(!t.ok)return void ep.error(r.error||"Failed to test proxy");await eu(),ep.success(r.ok?"Proxy test passed":"Proxy test failed")}catch(e){console.log("Error testing proxy pool:",e),ep.error("Failed to test proxy")}finally{Q(null)}},eb=async e=>{let r=!e.isActive;t(t=>t.map(t=>t.id===e.id?{...t,isActive:r}:t));try{(await fetch(`/api/proxy-pools/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})})).ok||(t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t)),ep.error("Failed to update active state"))}catch(r){console.log("Error toggling active:",r),t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t))}},ev=X.filter(t=>e.some(e=>e.id===t)),ek=e.length>0&&ev.length===e.length,ej=()=>Z([]),ew=async t=>{let r=X.length>0?X:e.map(e=>e.id);if(0!==r.length){ea(!0),es({label:t?"Activating":"Deactivating",current:0,total:r.length});try{let e=await s(r,async e=>(await fetch(`/api/proxy-pools/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok?"ok":"fail",e=>es(t=>({...t,current:e}))),{ok:l=0,fail:o=0}=i(e);await eu(),ep.success(`${t?"Activated":"Deactivated"} ${l}${o?`, failed ${o}`:""}`)}finally{es({label:"",current:0,total:0}),ea(!1)}}},eN=async()=>{0!==X.length&&ec({title:"Delete Proxy Pools",message:`Delete ${X.length} proxy pool(s)?`,onConfirm:async()=>{ec(null),ea(!0);let e=[...X];es({label:"Deleting",current:0,total:e.length});try{let t=await s(e,async e=>{let t=await fetch(`/api/proxy-pools/${e}`,{method:"DELETE"});return t.ok?"ok":409===t.status?"blocked":"fail"},e=>es(t=>({...t,current:e}))),{ok:r=0,blocked:l=0,fail:o=0}=i(t);await eu(),ej(),ep.success(`Deleted ${r}${l?`, ${l} bound`:""}${o?`, ${o} failed`:""}`)}finally{es({label:"",current:0,total:0}),ea(!1)}}})},eC=async()=>{let t=X.length>0?e.filter(e=>X.includes(e.id)):e;if(0===t.length)return;et(!0),el({current:0,total:t.length});let r=0,l=[],o=0,a=[...t],n=async()=>{for(;a.length>0;){let e=a.shift();if(!e)break;try{let t=await fetch(`/api/proxy-pools/${e.id}/test`,{method:"POST"}),o=await t.json();t.ok&&o.ok?r+=1:l.push(e.id)}catch{l.push(e.id)}finally{el({current:o+=1,total:t.length})}}};await Promise.all(Array.from({length:Math.min(10,t.length)},n)),await eu(),et(!1),el({current:0,total:0}),l.length>0?ec({title:"Disable Dead Proxies",message:`Alive: ${r}, Dead: ${l.length}.
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812,8937],{15327:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>k});var l=r(15102),o=r(82030),a=r(10736),n=r(25795);async function s(e,t,r){let l=[];for(let o of e){try{l.push(await t(o))}catch{l.push("fail")}r?.(l.length,e.length)}return l}function i(e){return e.reduce((e,t)=>(e[t]=(e[t]||0)+1,e),{})}var c=r(28937),d=r.n(c),p=r(7665),u=r(88140),m=r(41488);function x({isOpen:e,onClose:t,title:r,intro:o,bullets:a,tokenSteps:n=[],tokenStepsTitle:s,fields:i,deployLabel:c,onDeploy:d,deploying:h,deployDisabled:y,accent:g}){let f={blue:"bg-blue-500/5 border border-blue-500/10",teal:"bg-teal-500/5 border border-teal-500/10",neutral:"bg-black/5 dark:bg-white/5 border border-black/10 dark:border-white/10"},b={blue:"border-t border-blue-500/10",teal:"border-t border-teal-500/10",neutral:"border-t border-black/10 dark:border-white/10"},v=f[g]||f.neutral,k=b[g]||b.neutral;return(0,l.jsx)(p.A,{isOpen:e,title:r,onClose:t,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:`rounded-lg p-3 flex flex-col gap-1.5 ${v}`,children:[(0,l.jsxs)("p",{className:"text-sm text-text-main font-medium",children:["What is ",r.replace(/^Deploy /,""),"?"]}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:o}),(0,l.jsx)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:a.map(e=>(0,l.jsx)("li",{children:e},e))}),n.length>0&&(0,l.jsxs)("div",{className:`mt-2 pt-2 text-xs text-text-muted ${k}`,children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:s}),(0,l.jsx)("ol",{className:"list-decimal pl-4 space-y-0.5",children:n.map(e=>(0,l.jsx)("li",{children:e},e))})]})]}),i.map(e=>(0,l.jsx)(m.A,{label:e.label,value:e.value,onChange:e.onChange,placeholder:e.placeholder,hint:e.hint,type:e.type},e.label)),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(u.A,{fullWidth:!0,onClick:d,disabled:y||h,children:h?"Deploying... (may take ~1 min)":c}),(0,l.jsx)(u.A,{fullWidth:!0,variant:"ghost",onClick:t,disabled:h,children:"Cancel"})]})]})})}function h(e={}){return{name:e.name||"",proxyUrl:e.proxyUrl||"",noProxy:e.noProxy||"",isActive:!1!==e.isActive,strictProxy:!0===e.strictProxy}}x.propTypes={isOpen:d().bool.isRequired,onClose:d().func.isRequired,title:d().string.isRequired,intro:d().string.isRequired,bullets:d().arrayOf(d().string).isRequired,tokenSteps:d().arrayOf(d().string),tokenStepsTitle:d().string,fields:d().arrayOf(d().shape({label:d().string.isRequired,value:d().string.isRequired,onChange:d().func.isRequired,placeholder:d().string,hint:d().node,type:d().string})).isRequired,deployLabel:d().string.isRequired,onDeploy:d().func.isRequired,deploying:d().bool,deployDisabled:d().bool,accent:d().string};let y=(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]});function g({isOpen:e,editingProxyPool:t,formData:r,saving:o,onClose:n,onSave:s,onChange:i}){return(0,l.jsx)(a.Modal,{isOpen:e,title:t?"Edit Proxy Pool":"Add Proxy Pool",onClose:n,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(a.Input,{label:"Name",value:r.name,onChange:e=>i("name",e.target.value),placeholder:"Office Proxy"}),(0,l.jsx)(a.Input,{label:"Proxy URL",value:r.proxyUrl,onChange:e=>i("proxyUrl",e.target.value),placeholder:"http://127.0.0.1:7897"}),(0,l.jsx)(a.Input,{label:"No Proxy",value:r.noProxy,onChange:e=>i("noProxy",e.target.value),placeholder:"localhost,127.0.0.1,.internal",hint:"Comma-separated hosts/domains to bypass proxy"}),(0,l.jsx)(f,{label:"Active",description:"Inactive pools are ignored by runtime resolution.",checked:r.isActive,onChange:()=>i("isActive",!r.isActive),disabled:o}),(0,l.jsx)(f,{label:"Strict Proxy",description:"Fail request if proxy is unreachable instead of falling back to direct.",checked:r.strictProxy,onChange:()=>i("strictProxy",!r.strictProxy),disabled:o}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(a.Button,{fullWidth:!0,onClick:s,disabled:!r.name.trim()||!r.proxyUrl.trim()||o,children:o?"Saving...":"Save"}),(0,l.jsx)(a.Button,{fullWidth:!0,variant:"ghost",onClick:n,disabled:o,children:"Cancel"})]})]})})}function f({label:e,description:t,checked:r,onChange:o,disabled:n}){return(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:e}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:t})]}),(0,l.jsx)(a.Toggle,{checked:!0===r,onChange:o,disabled:n})]})}function b({isOpen:e,text:t,importing:r,onChange:o,onImport:n,onClose:s}){return(0,l.jsx)(a.Modal,{isOpen:e,title:"Batch Import Proxies",onClose:s,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{htmlFor:"proxy-batch-import",className:"text-sm font-medium text-text-main mb-1 block",children:"Paste Proxy List (One per line)"}),(0,l.jsx)("textarea",{id:"proxy-batch-import",value:t,onChange:e=>o(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(a.Button,{fullWidth:!0,onClick:n,disabled:!t.trim()||r,children:r?"Importing...":"Import"}),(0,l.jsx)(a.Button,{fullWidth:!0,variant:"ghost",onClick:s,disabled:r,children:"Cancel"})]})]})})}function v({pool:e,selected:t,testing:r,onSelect:o,onToggle:n,onTest:s,onEdit:i,onDelete:c}){var d;return(0,l.jsxs)("div",{className:"flex flex-col gap-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[(0,l.jsx)("input",{type:"checkbox",checked:t,onChange:o,"aria-label":`Select proxy ${e.name||e.id}`,className:"mt-1 size-4 shrink-0 rounded border-black/20 dark:border-white/20"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("p",{className:"min-w-0 max-w-full truncate text-sm font-medium sm:max-w-[18rem]",children:e.name}),(0,l.jsx)(a.Badge,{variant:"active"===(d=e.testStatus)?"success":"error"===d?"error":"default",size:"sm",dot:!0,children:e.testStatus||"unknown"}),(0,l.jsx)(a.Badge,{variant:e.isActive?"success":"default",size:"sm",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,l.jsx)(a.Badge,{variant:"default",size:"sm",children:"vercel relay"}),"cloudflare"===e.type&&(0,l.jsx)(a.Badge,{variant:"default",size:"sm",children:"cloudflare relay"}),(0,l.jsxs)(a.Badge,{variant:"default",size:"sm",children:[e.boundConnectionCount||0," bound"]})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate mt-1",children:e.proxyUrl}),e.noProxy?(0,l.jsxs)("p",{className:"text-xs text-text-muted truncate",children:["No proxy: ",e.noProxy]}):null,(0,l.jsxs)("p",{className:"text-[11px] text-text-muted mt-1",children:["Last tested: ",function(e){if(!e)return"Never";let t=new Date(e);return Number.isNaN(t.getTime())?"Never":t.toLocaleString()}(e.lastTestedAt),e.lastError?` \xb7 ${e.lastError}`:""]})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,l.jsx)(a.Toggle,{size:"sm",checked:!0===e.isActive,onChange:n,title:e.isActive?"Disable":"Enable"}),(0,l.jsx)("button",{type:"button",onClick:s,className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Test proxy",disabled:r,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:r?{animation:"spin 1s linear infinite"}:void 0,children:r?"progress_activity":"science"})}),(0,l.jsx)("button",{type:"button",onClick:i,className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Edit",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,l.jsx)("button",{type:"button",onClick:c,className:"p-2 rounded hover:bg-red-500/10 text-red-500",title:"Delete",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]})}function k(){let[e,t]=(0,o.useState)([]),[r,c]=(0,o.useState)(!0),[d,p]=(0,o.useState)(!1),[u,m]=(0,o.useState)(!1),[f,k]=(0,o.useState)(!1),[j,w]=(0,o.useState)(!1),[N,C]=(0,o.useState)(!1),[P,D]=(0,o.useState)(!1),[T,S]=(0,o.useState)(!1),[$,A]=(0,o.useState)(null),[O,I]=(0,o.useState)(()=>h()),[U,R]=(0,o.useState)(""),[E,_]=(0,o.useState)({vercelToken:"",projectName:"vercel-relay"}),[B,F]=(0,o.useState)({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),[q,z]=(0,o.useState)({denoToken:"",orgDomain:"",projectName:""}),[L,W]=(0,o.useState)({netlifyToken:"",projectName:"netlify-relay"}),[V,J]=(0,o.useState)(!1),[G,M]=(0,o.useState)(!1),[H,Y]=(0,o.useState)(!1),[K,Q]=(0,o.useState)(null),[X,Z]=(0,o.useState)([]),[ee,et]=(0,o.useState)(!1),[er,el]=(0,o.useState)({current:0,total:0}),[eo,ea]=(0,o.useState)(!1),[en,es]=(0,o.useState)({label:"",current:0,total:0}),[ei,ec]=(0,o.useState)(null),ed=(0,o.useRef)(null),ep=(0,n.i)();(0,o.useEffect)(()=>{let e=e=>{ed.current&&!ed.current.contains(e.target)&&S(!1)};return T&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[T]);let eu=(0,o.useCallback)(async()=>{try{let e=await fetch("/api/proxy-pools?includeUsage=true",{cache:"no-store"}),r=await e.json();e.ok&&t(r.proxyPools||[])}catch(e){console.log("Error fetching proxy pools:",e)}finally{c(!1)}},[]);(0,o.useEffect)(()=>{eu()},[eu]);let em=()=>{A(null),I(h())},ex=()=>{em(),p(!0)},eh=()=>{p(!1),em()},ey=async()=>{let e={name:O.name.trim(),proxyUrl:O.proxyUrl.trim(),noProxy:O.noProxy.trim(),isActive:!0===O.isActive,strictProxy:!0===O.strictProxy};if(e.name&&e.proxyUrl){J(!0);try{let t=!!$,r=await fetch(t?`/api/proxy-pools/${$.id}`:"/api/proxy-pools",{method:t?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)await eu(),eh(),ep.success($?"Proxy pool updated":"Proxy pool created");else{let e=await r.json();ep.error(e.error||"Failed to save proxy pool")}}catch(e){console.log("Error saving proxy pool:",e)}finally{J(!1)}}},eg=async e=>{ec({title:"Delete Proxy Pool",message:`Delete proxy pool "${e.name}"?`,onConfirm:async()=>{ec(null);try{let r=await fetch(`/api/proxy-pools/${e.id}`,{method:"DELETE"});if(r.ok){t(t=>t.filter(t=>t.id!==e.id)),ep.success("Proxy pool deleted");return}let l=await r.json();409===r.status?ep.warning(`Cannot delete: ${l.boundConnectionCount||0} connection(s) are still using this pool.`):ep.error(l.error||"Failed to delete proxy pool")}catch(e){console.log("Error deleting proxy pool:",e),ep.error("Failed to delete proxy pool")}}})},ef=async e=>{Q(e);try{let t=await fetch(`/api/proxy-pools/${e}/test`,{method:"POST"}),r=await t.json();if(!t.ok)return void ep.error(r.error||"Failed to test proxy");await eu(),ep.success(r.ok?"Proxy test passed":"Proxy test failed")}catch(e){console.log("Error testing proxy pool:",e),ep.error("Failed to test proxy")}finally{Q(null)}},eb=async e=>{let r=!e.isActive;t(t=>t.map(t=>t.id===e.id?{...t,isActive:r}:t));try{(await fetch(`/api/proxy-pools/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})})).ok||(t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t)),ep.error("Failed to update active state"))}catch(r){console.log("Error toggling active:",r),t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t))}},ev=X.filter(t=>e.some(e=>e.id===t)),ek=e.length>0&&ev.length===e.length,ej=()=>Z([]),ew=async t=>{let r=X.length>0?X:e.map(e=>e.id);if(0!==r.length){ea(!0),es({label:t?"Activating":"Deactivating",current:0,total:r.length});try{let e=await s(r,async e=>(await fetch(`/api/proxy-pools/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok?"ok":"fail",e=>es(t=>({...t,current:e}))),{ok:l=0,fail:o=0}=i(e);await eu(),ep.success(`${t?"Activated":"Deactivated"} ${l}${o?`, failed ${o}`:""}`)}finally{es({label:"",current:0,total:0}),ea(!1)}}},eN=async()=>{0!==X.length&&ec({title:"Delete Proxy Pools",message:`Delete ${X.length} proxy pool(s)?`,onConfirm:async()=>{ec(null),ea(!0);let e=[...X];es({label:"Deleting",current:0,total:e.length});try{let t=await s(e,async e=>{let t=await fetch(`/api/proxy-pools/${e}`,{method:"DELETE"});return t.ok?"ok":409===t.status?"blocked":"fail"},e=>es(t=>({...t,current:e}))),{ok:r=0,blocked:l=0,fail:o=0}=i(t);await eu(),ej(),ep.success(`Deleted ${r}${l?`, ${l} bound`:""}${o?`, ${o} failed`:""}`)}finally{es({label:"",current:0,total:0}),ea(!1)}}})},eC=async()=>{let t=X.length>0?e.filter(e=>X.includes(e.id)):e;if(0===t.length)return;et(!0),el({current:0,total:t.length});let r=0,l=[],o=0,a=[...t],n=async()=>{for(;a.length>0;){let e=a.shift();if(!e)break;try{let t=await fetch(`/api/proxy-pools/${e.id}/test`,{method:"POST"}),o=await t.json();t.ok&&o.ok?r+=1:l.push(e.id)}catch{l.push(e.id)}finally{el({current:o+=1,total:t.length})}}};await Promise.all(Array.from({length:Math.min(10,t.length)},n)),await eu(),et(!1),el({current:0,total:0}),l.length>0?ec({title:"Disable Dead Proxies",message:`Alive: ${r}, Dead: ${l.length}.
|
|
2
2
|
|
|
3
3
|
Disable ${l.length} dead proxies?`,onConfirm:async()=>{ec(null),ea(!0);try{await Promise.all(l.map(e=>fetch(`/api/proxy-pools/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:!1})}).catch(()=>{}))),await eu(),ep.success(`Disabled ${l.length} dead proxies`)}finally{ea(!1)}}}):ep.success(`Health check done. Alive: ${r}, Dead: ${l.length}`)},eP=()=>{H||k(!1)},eD=()=>{H||w(!1)},eT=()=>{H||C(!1)},eS=()=>{H||D(!1)},e$=async()=>{if(E.vercelToken.trim()){Y(!0);try{let e=await fetch("/api/proxy-pools/vercel-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),t=await e.json();e.ok?(await eu(),eP(),ep.success(`Deployed: ${t.deployUrl}`)):ep.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Vercel relay:",e),ep.error("Deploy failed")}finally{Y(!1)}}},eA=async()=>{if(B.accountId.trim()&&B.apiToken.trim()){Y(!0);try{let e=await fetch("/api/proxy-pools/cloudflare-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)}),t=await e.json();e.ok?(await eu(),eD(),ep.success(`Deployed: ${t.deployUrl}`)):ep.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Cloudflare relay:",e),ep.error("Deploy failed")}finally{Y(!1)}}},eO=async()=>{if(L.netlifyToken.trim()){Y(!0);try{let e=await fetch("/api/proxy-pools/netlify-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)}),t=await e.json();e.ok?(await eu(),eS(),ep.success(`Deployed: ${t.deployUrl}`)):ep.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Netlify relay:",e),ep.error("Deploy failed")}finally{Y(!1)}}},eI=async()=>{if(q.denoToken.trim()){Y(!0);try{let e=await fetch("/api/proxy-pools/deno-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)}),t=await e.json();e.ok?(await eu(),eT(),ep.success(`Deployed: ${t.deployUrl}`)):ep.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Deno relay:",e),ep.error("Deploy failed")}finally{Y(!1)}}},eU=async()=>{let t=U.split(/\r?\n/).flatMap(e=>{let t=e.trim();return t?[t]:[]});if(0===t.length)return void ep.warning("Please paste at least one proxy line.");let r=[],l=[];if(t.forEach((e,t)=>{try{let l=function(e){let t=e.trim();if(!t)return null;if(t.includes("://")){let e=new URL(t),r=e.port?`${e.hostname}:${e.port}`:e.hostname;return{proxyUrl:e.toString(),name:`Imported ${r}`}}let r=t.split(":");if(4===r.length){let[e,t,l,o]=r;if(!e||!t||!l||!o)throw Error("Invalid host:port:user:pass format");return{proxyUrl:new URL(`http://${encodeURIComponent(l)}:${encodeURIComponent(o)}@${e}:${t}`).toString(),name:`Imported ${e}:${t}`}}throw Error("Unsupported format")}(e);l&&r.push({...l,lineNumber:t+1})}catch(e){l.push(`Line ${t+1}: ${e.message}`)}}),l.length>0)return void ep.error(`Invalid proxy format:
|
|
4
4
|
${l.join("\n")}`);M(!0);try{let t=new Set(e.map(e=>`${(e.proxyUrl||"").trim()}|||${(e.noProxy||"").trim()}`)),l=0,o=0,a=0,{accepted:n,skipped:c}=function(e,t){let r=[],l=0;for(let o of e){let e=`${o.proxyUrl}|||`;if(t.has(e)){l+=1;continue}t.add(e),r.push(o)}return{accepted:r,skipped:l}}(r,t);o+=c,es({label:"Importing",current:0,total:n.length});let d=await s(n,async e=>(await fetch("/api/proxy-pools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,proxyUrl:e.proxyUrl,noProxy:"",isActive:!0})})).ok?"ok":"fail",e=>es(t=>({...t,current:e}))),p=i(d);l=p.ok||0,a=p.fail||0,await eu(),m(!1),ep.success(`Batch import completed: Created ${l}, Skipped ${o}, Failed ${a}`)}catch(e){console.log("Error batch importing proxies:",e),ep.error("Batch import failed")}finally{es({label:"",current:0,total:0}),M(!1)}},eR=(0,o.useMemo)(()=>e.filter(e=>!0===e.isActive).length,[e]);return r?(0,l.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsx)(a.CardSkeleton,{}),(0,l.jsx)(a.CardSkeleton,{})]}):(0,l.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsx)("div",{className:"min-w-0",children:(0,l.jsx)("h1",{className:"text-xl font-semibold sm:text-2xl",children:"Proxy Pools"})}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)("div",{className:"relative",ref:ed,children:[(0,l.jsxs)(a.Button,{size:"sm",variant:"secondary",icon:"rocket_launch",onClick:()=>S(!T),children:["Deploy Relay",(0,l.jsx)("span",{className:"material-symbols-outlined ml-1 text-[18px]",children:T?"expand_less":"expand_more"})]}),T&&(0,l.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-48 rounded-xl border border-black/10 bg-white p-1 shadow-xl dark:border-white/10 dark:bg-zinc-900 sm:left-auto sm:right-0",children:[(0,l.jsxs)("button",{type:"button",onClick:()=>{F({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),w(!0),S(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-orange-500",children:"cloud"}),"Cloudflare Relay"]}),(0,l.jsxs)("button",{type:"button",onClick:()=>{_({vercelToken:"",projectName:"vercel-relay"}),k(!0),S(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-blue-500",children:"cloud_upload"}),"Vercel Relay"]}),(0,l.jsxs)("button",{type:"button",onClick:()=>{z({denoToken:"",orgDomain:"",projectName:""}),C(!0),S(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-green-500",children:"terminal"}),"Deno Relay"]}),(0,l.jsxs)("button",{onClick:()=>{D(!0),S(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-teal-500",children:"deployed_code"}),"Netlify Relay"]})]})]}),(0,l.jsx)(a.Button,{size:"sm",variant:"secondary",icon:"upload",onClick:()=>{R(""),m(!0)},children:"Batch Import"}),(0,l.jsx)(a.Button,{size:"sm",icon:"add",onClick:ex,children:"Add Proxy Pool"})]})]}),(0,l.jsxs)(a.Card,{children:[(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.length>0&&(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:ek,onChange:()=>Z(ek?[]:e.map(e=>e.id)),className:"size-4 rounded border-black/20 dark:border-white/20"}),ek?"Unselect all":"Select all"]}),(0,l.jsxs)(a.Badge,{variant:"default",children:["Total: ",e.length]}),(0,l.jsxs)(a.Badge,{variant:"success",children:["Active: ",eR]})]}),(X.length>0||ee||en.total>0)&&(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"checklist"}),(0,l.jsx)("span",{className:"text-xs font-medium text-primary",children:en.total>0?`${en.label} ${en.current}/${en.total}`:X.length>0?`${X.length} selected`:"All pools"}),en.total>0&&(0,l.jsx)("div",{className:"w-full basis-full",role:"progressbar","aria-valuemin":"0","aria-valuemax":en.total,"aria-valuenow":en.current,"aria-label":`${en.label} progress`,children:(0,l.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-primary/15",children:(0,l.jsx)("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${en.current/en.total*100}%`}})})}),(0,l.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,l.jsx)(a.Button,{size:"sm",icon:ee?"progress_activity":"health_and_safety",onClick:eC,disabled:ee||eo||0===e.length,children:ee?`Checking ${er.current}/${er.total}`:"Health Check"}),X.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.Button,{size:"sm",variant:"secondary",icon:"toggle_on",onClick:()=>ew(!0),disabled:eo||ee,children:"Activate"}),(0,l.jsx)(a.Button,{size:"sm",variant:"secondary",icon:"toggle_off",onClick:()=>ew(!1),disabled:eo||ee,children:"Deactivate"}),(0,l.jsx)(a.Button,{size:"sm",variant:"secondary",icon:"delete",onClick:eN,disabled:eo||ee,children:"Delete"}),(0,l.jsx)(a.Button,{size:"sm",variant:"ghost",onClick:ej,disabled:eo||ee,children:"Clear"})]})]})]}),0===e.length?(0,l.jsxs)("div",{className:"text-center py-10",children:[(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No proxy pool entries yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create a proxy pool entry, then assign it to connections."}),(0,l.jsx)(a.Button,{icon:"add",onClick:ex,children:"Add Proxy Pool"})]}):(0,l.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.04] dark:divide-white/[0.05]",children:e.map(e=>(0,l.jsx)(v,{pool:e,selected:X.includes(e.id),testing:K===e.id,onSelect:()=>{let t;return t=e.id,Z(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},onToggle:()=>eb(e),onTest:()=>ef(e.id),onEdit:()=>{A(e),I(h(e)),p(!0)},onDelete:()=>eg(e)},e.id))})]}),(0,l.jsx)(b,{isOpen:u,text:U,importing:G,onChange:R,onImport:eU,onClose:()=>{G||m(!1)}}),(0,l.jsx)(x,{isOpen:f,onClose:eP,title:"Deploy Vercel Relay",accent:"blue",intro:"Deploys an edge relay function to Vercel. All AI provider requests will be forwarded through Vercel's edge network, masking your real IP from providers.",bullets:["Your IP is replaced by Vercel's dynamic edge IPs (hundreds of IPs across 20+ global regions)","Vercel serves millions of apps — providers can't block Vercel IPs without affecting legitimate traffic","Free tier: 100GB bandwidth/month, 500K edge invocations","Deploy multiple relays on different accounts for more IP diversity"],fields:[{label:"Vercel API Token",value:E.vercelToken,onChange:e=>_(t=>({...t,vercelToken:e.target.value})),placeholder:"your-vercel-api-token",hint:y,type:"password"},{label:"Project Name",value:E.projectName,onChange:e=>_(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Vercel project. Leave empty for auto-generated name."}],deployLabel:"Deploy",onDeploy:e$,deploying:H,deployDisabled:!E.vercelToken.trim()}),(0,l.jsx)(x,{isOpen:j,onClose:eD,title:"Deploy Cloudflare Relay",accent:"neutral",intro:"Deploys a Worker to Cloudflare's global edge network. All AI provider requests are forwarded through Cloudflare's edge, masking your real IP.",bullets:["Free tier: 100,000 requests/day","Workers run on Cloudflare's global network","Deploy multiple workers for more IP diversity"],fields:[{label:"Cloudflare API Token",value:B.apiToken,onChange:e=>F(t=>({...t,apiToken:e.target.value})),placeholder:"your-cloudflare-api-token",hint:"Token is used once for deployment and not stored.",type:"password"},{label:"Account ID",value:B.accountId,onChange:e=>F(t=>({...t,accountId:e.target.value})),placeholder:"your-account-id",hint:"Found in the Cloudflare dashboard sidebar."},{label:"Worker Name",value:B.workerName,onChange:e=>F(t=>({...t,workerName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Worker. Leave empty for auto-generated name."}],deployLabel:"Deploy Relay",onDeploy:eA,deploying:H,deployDisabled:!B.apiToken.trim()||!B.accountId.trim()}),(0,l.jsx)(x,{isOpen:N,onClose:eT,title:"Deploy Deno Relay",accent:"neutral",intro:"Deploys a relay worker to Deno Deploy's global edge network. All AI provider requests are forwarded through Deno's edge, masking your real IP.",bullets:["Deno Deploy v2 runs on a high-performance global edge network","Free tier: 1M requests & 100GiB outbound traffic per month","No per-request CPU time limits (unlike Vercel/Cloudflare)","Support up to 20 active apps & 50 custom domains","Deploy multiple relays for maximum IP diversity"],tokenStepsTitle:"How to generate API token:",tokenSteps:[(0,l.jsxs)(l.Fragment,{children:["Go to ",(0,l.jsx)("b",{children:"console.deno.com"})]}),(0,l.jsxs)(l.Fragment,{children:["Select your ",(0,l.jsx)("b",{children:"Organization"})," → ",(0,l.jsx)("b",{children:"Settings"})," → ",(0,l.jsx)("b",{children:"Organization Tokens"})]}),(0,l.jsxs)(l.Fragment,{children:["Create a ",(0,l.jsx)("b",{children:"Organization Token"})," (prefix ",(0,l.jsx)("b",{children:"ddo_"}),")"]})],fields:[{label:"Deno Deploy API Token",value:q.denoToken,onChange:e=>z(t=>({...t,denoToken:e.target.value})),placeholder:"ddo_xxxxxxxxxxxxxxxx",hint:"Token is used once for deployment, not stored. Found in Organization Settings.",type:"password"},{label:"Organization Domain",value:q.orgDomain,onChange:e=>z(t=>({...t,orgDomain:e.target.value})),placeholder:"your-org.deno.net",hint:"Organization's default domain. Your relay URL will be in the format: https://my-relay.your-org.deno.net"},{label:"App Name",value:q.projectName,onChange:e=>z(t=>({...t,projectName:e.target.value})),placeholder:"deno-relay",hint:"Unique app name. Leave empty for auto-generated name."}],deployLabel:"Deploy Relay",onDeploy:eI,deploying:H,deployDisabled:!q.denoToken.trim()||!q.orgDomain.trim()}),(0,l.jsx)(x,{isOpen:P,onClose:eS,title:"Deploy Netlify Relay",accent:"teal",intro:"Deploys a serverless relay function to Netlify's global edge network. All AI provider requests are forwarded through Netlify's edge, masking your real IP.",bullets:["Runs on Netlify Functions with a 60-second execution limit and streaming support","Free tier: 125,000 function invocations and 100GB bandwidth per month","Relay URL format: https://your-site.netlify.app/.netlify/functions/relay","Deploy multiple relays on different accounts for more IP diversity"],tokenStepsTitle:"How to generate API token:",tokenSteps:[(0,l.jsxs)(l.Fragment,{children:["Go to ",(0,l.jsx)("b",{children:"User Settings"})," → ",(0,l.jsx)("b",{children:"Applications"})," → ",(0,l.jsx)("b",{children:"Personal access tokens"})]}),(0,l.jsxs)(l.Fragment,{children:["Select ",(0,l.jsx)("b",{children:"New access token"})," and generate a token"]}),(0,l.jsx)(l.Fragment,{children:"Copy the token — you won't see it again after leaving the page"})],fields:[{label:"Netlify API Token",value:L.netlifyToken,onChange:e=>W(t=>({...t,netlifyToken:e.target.value})),placeholder:"nfp_xxxxxxxxxxxxxxxx",hint:(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://app.netlify.com/user/applications#personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"},{label:"Site Name",value:L.projectName,onChange:e=>W(t=>({...t,projectName:e.target.value})),placeholder:"netlify-relay",hint:"Unique site name (lowercase letters, numbers, hyphens). Your relay URL will be https://site-name.netlify.app/.netlify/functions/relay"}],deployLabel:"Deploy",onDeploy:eO,deploying:H,deployDisabled:!L.netlifyToken.trim()}),(0,l.jsx)(g,{isOpen:d,editingProxyPool:$,formData:O,saving:V,onClose:eh,onSave:ey,onChange:(e,t)=>I(r=>({...r,[e]:t}))}),(0,l.jsx)(a.ConfirmModal,{isOpen:!!ei,onClose:()=>ec(null),onConfirm:ei?.onConfirm,title:ei?.title||"Confirm",message:ei?.message,variant:"danger"})]})}l.Fragment},28937:(e,t,r)=>{e.exports=r(41979)()},41979:(e,t,r)=>{"use strict";var l=r(78784);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,a,n){if(n!==l){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return r.PropTypes=r,r}},78784:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},90536:(e,t,r)=>{Promise.resolve().then(r.bind(r,15327))}},e=>{e.O(0,[3885,7523,7236,4385,736,2147,3204,7358],()=>e(e.s=90536)),_N_E=e.O()}]);
|
package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-85770718a5ce696c.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{5244:(e,t,r)=>{Promise.resolve().then(r.bind(r,30742)),Promise.resolve().then(r.bind(r,70665)),Promise.resolve().then(r.bind(r,47056))},30742:(e,t,r)=>{"use strict";r.d(t,{default:()=>d});var a=r(15102),s=r(82030),i=r(62758),l=r(97955);let n={daily:"Daily",weekly:"Weekly",monthly:"Monthly","one-time":"One-time",rolling:"Rolling"},o={daily:{variant:"success"},weekly:{variant:"info"},"one-time":{variant:"warning"},monthly:{variant:"default",className:"bg-purple-500/10 text-purple-600 dark:text-purple-400"},rolling:{variant:"default",className:"bg-cyan-500/10 text-cyan-600 dark:text-cyan-400"}};function d({tiers:e=[]}){let[t,r]=(0,s.useState)(null),[c,u]=(0,s.useState)(""),[m,x]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/providers",{cache:"no-store"}).then(e=>e.ok?e.json():null).then(t=>{if(e||!t)return;let a=new Set;for(let e of t.connections||[])!1!==e.isActive&&(e.provider&&a.add(e.provider),e.alias&&a.add(e.alias));r(a)}).catch(()=>{e||r(new Set)}),()=>{e=!0}},[]);let h=(0,s.useMemo)(()=>{let r=new Map;for(let t of e){let e=t.providerId;r.has(e)||r.set(e,{id:e,name:t.providerName||e,alias:t.providerAlias||null,refresh:t.freeRefresh||null,models:[]});let a=r.get(e);!a.refresh&&t.freeRefresh&&(a.refresh=t.freeRefresh),t.modelId&&a.models.push({id:t.modelId,name:t.modelName||t.modelId})}let a=c.trim().toLowerCase(),s=[...r.values()].map(e=>({...e,connected:!!(t&&(t.has(e.id)||e.alias&&t.has(e.alias)))}));return(a?s.filter(e=>e.name.toLowerCase().includes(a)||(e.alias||"").toLowerCase().includes(a)||e.models.some(e=>e.name.toLowerCase().includes(a)||e.id.toLowerCase().includes(a))):s).sort((e,t)=>e.connected!==t.connected?e.connected?-1:1:e.name.localeCompare(t.name))},[e,t,c]),p=h.filter(e=>e.connected).length,b=t?h.length-p:0,g=m||c.trim()?h:h.filter(e=>e.connected);return(0,a.jsx)(i.A,{padding:"lg",title:"Available free tiers",subtitle:"Provider free allowances from the registry. Connected providers first; the rest are behind the toggle.",children:0===e.length?(0,a.jsx)("p",{className:"py-6 text-center text-sm text-text-muted",children:"No free tiers found."}):(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("input",{type:"search",value:c,onChange:e=>u(e.target.value),placeholder:"Filter by provider or model…","aria-label":"Filter free tiers by provider or model",className:"min-w-[12rem] flex-1 rounded border border-border bg-surface px-2.5 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:[p," connected",null===t?" (checking…)":` \xb7 ${b} without an account`]}),b>0&&!c.trim()&&(0,a.jsxs)("button",{type:"button",onClick:()=>x(e=>!e),"aria-pressed":m,className:"rounded border border-border px-2.5 py-1.5 text-xs text-text-muted transition-colors hover:border-primary hover:text-primary",children:[m?"Hide":"Show"," providers without an account"]})]}),0===g.length?(0,a.jsx)("p",{className:"py-6 text-center text-sm text-text-muted",children:null===t?"Checking your connections…":"No free tier matches. Add a connection for a provider below, or clear the filter."}):(0,a.jsx)("div",{className:"flex flex-col divide-y divide-black/5 dark:divide-white/5",children:g.map(e=>{let r=o[e.refresh]||{variant:"default"};return(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 py-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-primary",children:e.name}),e.alias&&e.alias!==e.name&&(0,a.jsx)("span",{className:"font-mono text-[10px] text-text-muted",children:e.alias}),e.connected?(0,a.jsx)(l.A,{size:"sm",variant:"success",children:"Connected"}):t?(0,a.jsx)("span",{className:"text-[11px] italic text-text-muted",children:"no account yet"}):null,e.refresh?(0,a.jsx)(l.A,{size:"sm",variant:r.variant,className:r.className,children:n[e.refresh]||e.refresh}):(0,a.jsx)("span",{className:"text-xs italic text-text-muted",title:"Reset cadence not documented","aria-label":"Reset cadence not documented",children:"—"}),(0,a.jsx)("span",{className:"ml-auto text-[11px] text-text-muted",children:0===e.models.length?"free tier available":`${e.models.length} free model${e.models.length>1?"s":""}`})]}),e.models.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.models.map(e=>(0,a.jsx)("span",{title:e.id,className:"rounded bg-black/[0.04] px-1.5 py-0.5 font-mono text-[11px] text-text-muted dark:bg-white/[0.06]",children:e.name},e.id))})]},e.id)})})]})})}},70665:(e,t,r)=>{"use strict";r.d(t,{default:()=>R});var a=r(15102),s=r(82030),i=r(93278),l=r(31704),n=r(51427);let o=new Set(["antigravity","gemini-cli","cursor"]),d="quotaCacheData",c="quotaAutoRefresh",u=[10,20,50,100],m=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],x=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function h(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function p(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function b(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function g(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function f(e,t){return await e(t)}function y(){try{let e=window.localStorage.getItem(d);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function v(e,t){try{let r=y();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(d,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function w(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}let k=[];function j({quotas:e=k,compact:t=!1,sortMode:r="default",showSortLabel:i=!1}){let[l,n]=(0,s.useState)(1),o=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):w(e?.used,e?.total)})),[e]),d=(0,s.useMemo)(()=>"remaining-asc"===r?o.toSorted((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?o.toSorted((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):o,[o,r]),c=Math.max(1,Math.ceil(d.length/10)),[u,m]=(0,s.useState)(r),[x,h]=(0,s.useState)(e),[p,b]=(0,s.useState)(c);if(r!==u||e!==x?(m(r),h(e),b(c),n(1)):c!==p&&(b(c),n(e=>Math.min(e,c))),!e||0===e.length)return null;let g=d.slice((l-1)*10,10*l),f=0===d.length?0:(l-1)*10+1,y=Math.min(10*l,d.length),v=t?"py-1 px-1.5":"py-2 px-3",N=t?"text-[11px]":"text-sm",C=t?"text-[11px]":"text-sm",S=t?"text-[10px] leading-tight":"text-xs";return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:[d.length," quota",d.length>1?"s":""]}),i&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full min-w-[420px] table-fixed text-left",children:(0,a.jsx)("tbody",{children:g.map(e=>{var r;let s=!0===e.unlimited,i=!0===e.isCreditBalance,l=i?{text:"text-blue-600 dark:text-blue-400",bg:"bg-blue-500",bgLight:"bg-blue-500/10",emoji:"\uD83D\uDCB0"}:(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},n=e.neverExpires?"-":function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let s=Math.ceil(a/6e4);if(s<60)return`${s}m`;let i=Math.floor(s/60),l=s%60;if(i<24)return`${i}h ${l}m`;let n=Math.floor(i/24);return`${n}d ${i%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),o=!e.neverExpires&&!e.resetAt&&!!e.detailUrl,d=e.neverExpires?"Never expires":o?"See details":function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()+1);let i="";i=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${i}, ${l}`}catch{return null}}(e.resetAt),c=o&&e.detailUrl?e.detailUrl:d,u=!1!==e.recurring?`in ${n}`:`expires in ${n}`;return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${v} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:l.emoji}),(0,a.jsx)("span",{className:`${N} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${v} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[!s&&!i&&(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${l.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${l.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsx)("span",{className:"text-text-muted",title:s?`${e.used.toLocaleString()} used \xb7 Unlimited`:i?`Credit balance: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}`,children:s?`${e.used.toLocaleString()} used \xb7 Unlimited`:i?`Credit: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}`}),(0,a.jsx)("span",{className:`font-medium ${s?"text-green-600 dark:text-green-400":l.text}`,children:s?"Unlimited":i?"":`${e.remaining}%`})]})]})}),(0,a.jsx)("td",{className:`${v} w-[25%]`,children:"-"!==n||d?t?(0,a.jsx)("div",{className:`${C} text-text-primary font-medium truncate`,title:c||"",children:"-"!==n?u:d}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==n&&(0,a.jsx)("div",{className:`${C} text-text-primary font-medium`,children:u}),o?(0,a.jsxs)("a",{href:e.detailUrl,target:"_blank",rel:"noopener noreferrer",className:`${S} text-text-muted inline-flex items-center gap-0.5 hover:text-text-primary hover:underline`,title:`Open usage details: ${c}`,"aria-label":`Open usage details for ${e.name}`,children:[d,(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"})]}):d&&(0,a.jsx)("div",{className:`${S} text-text-muted`,children:d})]}):(0,a.jsx)("div",{className:`${C} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),c>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Showing ",f,"-",y," of ",d.length]}),(0,a.jsxs)("span",{children:["Page ",l," / ",c]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>n(e=>Math.max(1,e-1)),disabled:1===l,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>n(e=>Math.min(c,e+1)),disabled:l===c,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var N=r(52252),C=r(18419),S=r(62758),A=r(10736),$=r(31038),P=r(21577);let E={"builder-id":"AWS Builder ID",idc:"IAM Identity Center",google:"Google",github:"GitHub",imported:"Imported Token",api_key:"API Key"},q={claude:"claudeAutoPing",codex:"codexAutoPing"},D={claude:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",codex:"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota."};function T(e){return e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null}function M(e){let t=e.providerSpecificData?.region;if(t)return t;let r=e.providerSpecificData?.profileArn;return("string"==typeof r?r.split(":")[3]:"")||""}let _={five_hour:"session",seven_day:"weekly",seven_day_overage_included:"weekly",seven_day_opus:"Opus weekly",seven_day_sonnet:"Sonnet weekly"};function L(e){let t=[...new Set((e||[]).map(e=>_[e]).filter(Boolean))];return t.length?`${t.join(" + ")} limits`:"limits"}function O(e){if(!e)return"N/A";let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"N/A"}function I(e){if(!e)return"N/A";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return"N/A";if(t<=0)return"Expired";let r=Math.ceil(t/36e5),a=Math.floor(r/24),s=r%24;return a>0?`${a}d ${s}h`:`${s}h`}function R(){let e,{copied:t,copy:r}=(0,P.C)(),k=(0,i.useSearchParams)(),_=(0,i.useRouter)(),R=(0,i.usePathname)(),[F,U]=(0,s.useState)([]),[z,B]=(0,s.useState)({}),[J,K]=(0,s.useState)({}),[W,G]=(0,s.useState)({}),[H,V]=(0,s.useState)(!0),[Y,Q]=(0,s.useState)({claude:{},codex:{}}),[X,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(!1),[er,ea]=(0,s.useState)(!1),[es,ei]=(0,s.useState)(60),[el,en]=(0,s.useState)(!0),[eo,ed]=(0,s.useState)(null),[ec,eu]=(0,s.useState)(null),[em,ex]=(0,s.useState)(null),[eh,ep]=(0,s.useState)(null),[eb,eg]=(0,s.useState)(null),[ef,ey]=(0,s.useState)(!1),[ev,ew]=(0,s.useState)(null),[ek,ej]=(0,s.useState)([]),[eN,eC]=(0,s.useState)(()=>k?.get("provider")||"all"),eS=(0,s.useCallback)(e=>{eC(e);try{let t=new URLSearchParams(k?.toString()||"");"all"===e?t.delete("provider"):t.set("provider",e);let r=t.toString()?`${R}?${t.toString()}`:R;_.replace(r,{scroll:!1})}catch{}},[R,_,k]),[eA,e$]=(0,s.useState)([]),[eP,eE]=(0,s.useState)("all"),[eq,eD]=(0,s.useState)("all"),[eT,eM]=(0,s.useState)("default"),[e_,eL]=(0,s.useState)(!1),[eO,eI]=(0,s.useState)(!1),[eR,eF]=(0,s.useState)(!1),[eU,ez]=(0,s.useState)(!1),[eB,eJ]=(0,s.useState)(1),[eK,eW]=(0,s.useState)(20),[eG,eH]=(0,s.useState)(String(20)),[eV,eY]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eQ,eX]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eZ=(0,s.useRef)(null),e0=(0,s.useRef)(null),e1=(0,s.useRef)(0),e5=(0,s.useRef)((e=0,{begin:()=>++e,isLatest:t=>t===e})),e2=(0,s.useRef)(!1);(0,s.useEffect)(()=>{let e=k?.get("provider")||"all";eC(t=>t===e?t:e)},[k]);let e3=(0,s.useCallback)(async(e=eB)=>{let t=e5.current.begin();try{var r,a;let s=new URLSearchParams({page:String(e),pageSize:String(eK),accountStatus:eq,sort:"priority"});"all"!==eN&&s.set("provider",eN);let i=await fetch(`/api/providers/client?${s.toString()}`,{cache:"no-store"});if(!i.ok)throw Error("Failed to fetch connections");let l=await i.json();if(!e5.current.isLatest(t))return null;let n=l.connections||[],o=(r=l.pagination,r||{page:1,pageSize:eK,total:0,totalPages:1}),d=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(l.totals,n.length);return U(n),e$(l.providerOptions||[]),eY(o),eX(d),eJ((a=l.pagination,a?.page||e)),n}catch(e){if(!e5.current.isLatest(t))return null;return console.error("Error fetching connections:",e),U([]),e$([]),eY({page:1,pageSize:eK,total:0,totalPages:1}),eX({eligibleConnections:0,providerFilteredConnections:0}),[]}},[eq,eB,eK,eN]),e4=(0,s.useCallback)(async(e,t,{force:r=!1}={})=>{K(t=>({...t,[e]:!0})),G(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let a=await fetch(`/api/usage/${e}${r?"?force=1":""}`,{cache:"no-store"});if(!a.ok){let r=(await a.json().catch(()=>({}))).error||a.statusText;if(404===a.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===a.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,r);let a={quotas:[],message:r};B(t=>({...t,[e]:a})),v(e,a);return}throw Error(`HTTP ${a.status}: ${r}`)}let s=await a.json();console.log(`[ProviderLimits] Got quota for ${t}:`,s);let i={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=e;"spark_session"===e?a="Spark (5h)":"spark_weekly"===e?a="Spark (Weekly)":"session"===e?a="5h":"weekly"===e?a="Weekly":"review_session"===e?a="Review (5h)":"review_weekly"===e&&(a="Review (Weekly)"),r.push({name:a,quotaType:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":case"qoder-cn":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{t&&0!==(Number(t.total)||0)&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":"addOn"===e?"Add-on":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null,neverExpires:!0===t.neverExpires,detailUrl:t.detailUrl||null})});break;case"cursor":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codebuddy-cn":case"codebuddy-intl":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})});break;case"kimi":case"deepseek":t.quotas&&Object.entries(t.quotas).forEach(([t,a])=>{r.push({name:t,used:a.used||0,total:a.total||0,resetAt:a.resetAt||null,remainingPercentage:a.remainingPercentage,..."deepseek"===e.toLowerCase()?{isCreditBalance:!0===a.isCreditBalance,currency:a.currency||"USD"}:{}})});break;case"freebuff":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})});break;case"grok-cli":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"zed":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,unlimited:t.unlimited})});break;case"minimax-code":case"minimax-code-global":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,remainingPercentage:t.remainingPercentage,resetAt:t.resetAt||null,message:t.message,isCreditBalance:t.isCreditBalance,currency:t.currency})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,n.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,s=r.modelKey||r.name;return(e.get(a)??999)-(e.get(s)??999)})}return r}(t,s),plan:s.plan||null,message:s.message||null,raw:s};B(t=>({...t,[e]:i})),v(e,i)}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),G(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{K(t=>({...t,[e]:!1}))}},[]),e8=(0,s.useCallback)(async(e,t)=>{await e4(e,t,{force:!0}),Z(new Date)},[e4]),e6=(0,s.useCallback)(async(e,t)=>{if(("codex"===t||"claude"===t)&&!em){ex(e),G(t=>({...t,[e]:null}));try{let r="claude"===t?await fetch(`/api/usage/${e}/claude-reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grantId:z[e]?.raw?.resetCredits?.nextGrantId})}):await fetch(`/api/usage/${e}/codex-reset-credits`,{method:"POST"}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.error||a.code||"Failed to reset limit");await e4(e,t,{force:!0}),Z(new Date)}catch(t){G(r=>({...r,[e]:t.message||"Failed to reset limit"}))}finally{ex(null)}}},[e4,em,z]),e7=(0,s.useCallback)((e,t)=>{eg({connection:e,loading:!1,error:null,data:{kind:"claude",...t}})},[]),e9=(0,s.useCallback)(async e=>{eg({connection:e,loading:!0,error:null,data:null});try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||r.message||"Failed to load Codex reset credits");let a=Array.isArray(r.credits)?[...r.credits]:[];a.sort((e,t)=>{let r=e.expiresAt?new Date(e.expiresAt).getTime():1/0,a=t.expiresAt?new Date(t.expiresAt).getTime():1/0;return r-a}),eg({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){eg({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),te=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){ed(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){B(t=>{let r={...t};return delete r[e],r}),K(t=>{let r={...t};return delete r[e],r}),G(t=>{let r={...t};return delete r[e],r});try{let t=y();t[e]&&(delete t[e],window.localStorage.setItem(d,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await f(e3,eB)}}catch(e){console.error("Error deleting connection:",e)}finally{ed(null)}}},[e3,eB]),tt=(0,s.useCallback)(async(e,t)=>{eu(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(B(e=>({...e})),await f(e3,eB))}catch(e){console.error("Error updating connection status:",e)}finally{eu(null)}},[e3,eB]),tr=(0,s.useCallback)(async e=>{if(!ev?.id)return;let t=ev.id,r=ev.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await e3(),ey(!1),ew(null),$.wb.includes(r)&&await e4(t,r))}catch(e){console.error("Error saving connection:",e)}},[ev,e3,e4]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&ej(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let ta=(0,s.useCallback)(async(e=!1)=>{if(e2.current)return;e2.current=!0,ea(!0),ei(60);let t=e1.current+=1,r=Math.round(10);try{let a=await e3(eB);if(!a)return;K(b(a)),G(e=>g(e,a)),B(e=>g(e,a)),await Promise.all(a.filter(a=>e||"claude"!==a.provider||t%r==0).map(e=>e4(e.id,e.provider))),Z(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{e2.current=!1,ea(!1)}},[e3,e4,eB]);(0,s.useEffect)(()=>{let e=!1;return(async()=>{en(!0);let t=await e3(eB);e||(en(!1),!t||(K(b(t)),G(e=>g(e,t)),B(e=>g(e,t)),await Promise.all(t.map(e=>e4(e.id,e.provider))),e||Z(new Date)))})(),()=>{e=!0}},[e3,e4,eB]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(c);V(null===e||"true"===e),et(!0)},[]),(0,s.useEffect)(()=>{ee&&window.localStorage.setItem(c,String(H))},[H,ee]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>Q({claude:e?.claudeAutoPing?.connections||{},codex:e?.codexAutoPing?.connections||{}})).catch(()=>{})},[]);let ts=(0,s.useCallback)(async(e,t,r)=>{let a=q[t];if(!a)return;let s={...Y[t]||{},[e]:r};Q({...Y,[t]:s});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[a]||{},connections:s};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:t})})}catch{Q(Y)}},[Y]);(0,s.useEffect)(()=>{if(!ee||!H){eZ.current&&(clearInterval(eZ.current),eZ.current=null),e0.current&&(clearInterval(e0.current),e0.current=null);return}return eZ.current=setInterval(()=>{ta()},6e4),e0.current=setInterval(()=>{ei(e=>e<=1?60:e-1)},1e3),()=>{eZ.current&&clearInterval(eZ.current),e0.current&&clearInterval(e0.current)}},[H,ta,ee]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eZ.current&&(clearInterval(eZ.current),eZ.current=null),e0.current&&(clearInterval(e0.current),e0.current=null)):H&&ee&&(eZ.current=setInterval(()=>ta(),6e4),e0.current=setInterval(()=>{ei(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[H,ta,ee]),(0,s.useEffect)(()=>{eE("all")},[eN]);let ti=(0,s.useMemo)(()=>eN&&o.has(eN)?(0,n.KC)(eN).map(e=>({id:e.id,name:e.name||e.id})):[],[eN]),tl=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=p(e,t),i=p(r,t),l="remaining-asc"===s?a-i:i-a;return 0!==l?l:(h(e)||"").localeCompare(h(r)||"")});if(!r){let t=new Map;for(let r of e){let e=r.provider||"";t.has(e)||t.set(e,[]),t.get(e).push(r)}return Array.from(t.values()).flat()}let i=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=i(e)-i(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(h(e)||"").localeCompare(h(t)||"")})})("all"===eN?F:F.filter(e=>e.provider===eN),z,e_,eN,eT),[F,z,e_,eN,eT]),tn=e=>{let t=z[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=w(e.used,e.total))},to=(0,s.useCallback)(async(e,t)=>{if(e.length&&!eR){eF(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await f(e3,eB)}catch(e){console.error("Error bulk toggling connections:",e)}finally{eF(!1)}}},[eR,e3,eB]),td=(0,s.useMemo)(()=>tl.filter(e=>(function(e,t,r){if(e?.provider!=="codex")return!1;let a="string"==typeof t?.message?t.message:"",s="string"==typeof r?r:"";return a.includes("Usage API temporarily unavailable (401)")||a.includes("temporarily unavailable (401)")||a.includes("Codex connected")&&a.includes("401")||s.includes("temporarily unavailable (401)")||s.includes("HTTP 401")})(e,z[e.id],W[e.id])).map(e=>e.id),[tl,z,W]),tc=(0,s.useCallback)(async()=>{if(td.length&&!eU&&confirm(`Delete ${td.length} Codex connection(s) with "Usage API temporarily unavailable (401)"?`)){ez(!0);try{await Promise.all(td.map(e=>fetch(`/api/providers/${e}`,{method:"DELETE"}))),B(e=>{let t={...e};for(let e of td)delete t[e];return t}),K(e=>{let t={...e};for(let e of td)delete t[e];return t}),G(e=>{let t={...e};for(let e of td)delete t[e];return t});try{let e=y(),t=!1;for(let r of td)e[r]&&(delete e[r],t=!0);t&&window.localStorage.setItem(d,JSON.stringify(e))}catch(e){console.error("Error deleting cache entries:",e)}await f(e3,eB)}catch(e){console.error("Error bulk deleting codex unavailable connections:",e)}finally{ez(!1)}}},[td,eU,e3,eB]),tu="all"===eN?"All providers":eN,tm=eQ.eligibleConnections>0,tx=tl.length>0,th=eQ.eligibleConnections?eQ.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===eN?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===eq?"turned off":"active"===eq?"active":"matching"} accounts found for ${eN}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},tp=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eV),tb=!u.includes(eK);return el||tm?el||tx?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-end",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eI(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eO,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===eN?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(l.A,{src:`/providers/${eN}.webp`,alt:eN,size:18,className:"size-[18px] rounded object-contain",fallbackText:eN.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate capitalize hidden lg:inline",children:tu})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),eO&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>eI(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-1.5 w-52 overflow-hidden rounded-xl border border-black/10 bg-surface/95 p-1 shadow-lg shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-60",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==eN&&eJ(1),eS("all"),eI(!1)},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors ${"all"===eN?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"apps"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===eN&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[16px]",children:"check"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-60 overflow-y-auto pr-0.5",children:eA.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{eN!==e&&eJ(1),eS(e),eI(!1)},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors ${eN===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(l.A,{src:`/providers/${e}.webp`,alt:e,size:18,className:"size-[18px] rounded object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium capitalize",children:e}),eN===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[16px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:eq,onChange:e=>{let t=e.target.value;eq!==t&&eJ(1),eD(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:m.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===eN&&(0,a.jsx)("select",{value:eT,onChange:e=>eM(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:x.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),o.has(eN)&&ti.length>0&&(0,a.jsxs)("select",{value:eP,onChange:e=>eE(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter quotas by model",children:[(0,a.jsx)("option",{value:"all",children:"All models"}),ti.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,a.jsxs)("button",{type:"button",onClick:()=>eL(e=>!e),"aria-pressed":e_,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${e_?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"hourglass_top"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{to(tl.filter(e=>(e.isActive??!0)&&tn(e)).map(e=>e.id),!1)},disabled:eR,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"block"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{to(tl.filter(e=>!(e.isActive??!0)&&!tn(e)).map(e=>e.id),!0)},disabled:eR,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 disabled:opacity-50",title:"Enable connections that still have quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]}),"codex"===eN&&(0,a.jsxs)("button",{type:"button",onClick:tc,disabled:eU||0===td.length,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/40 bg-red-500/10 px-2 text-xs text-red-600 dark:text-red-400 transition-colors hover:bg-red-500/20 disabled:opacity-40 disabled:cursor-not-allowed",title:td.length>0?`Delete ${td.length} Codex connection(s) with "Usage API temporarily unavailable (401)"`:"No Codex 401 unavailable connections on current page",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${eU?"animate-spin":""}`,children:eU?"progress_activity":"delete_sweep"}),(0,a.jsxs)("span",{className:"hidden sm:inline",children:["Delete 401 (",td.length,")"]}),(0,a.jsxs)("span",{className:"sm:hidden",children:["401 (",td.length,")"]})]}),(0,a.jsxs)("button",{onClick:()=>V(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",title:H?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${H?"text-primary":"text-text-muted"}`,children:H?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),H&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",es,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>ta(!0),disabled:er,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",title:"Refresh all",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${er?"animate-spin":""}`,children:"refresh"})})]})}),e_&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:tl.map(e=>{var s;let i,n,o,d=z[e.id],c=J[e.id],u=W[e.id],m=!1===e.isActive,x="codex"===e.provider,p="claude"===e.provider?d?.raw?.resetCredits:null,b=x?"Codex reset credit":"Claude limit reset",g=Number.isFinite(n="number"==typeof(i=d?.raw?.resetCredits?.availableCount)?i:Number(i))?Math.max(0,n):0,f=em===e.id,y=eo===e.id||ec===e.id||f;return(0,a.jsxs)(S.A,{padding:"none",className:`min-w-0 ${m?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(l.A,{src:`/providers/${e.provider}.webp`,alt:e.provider,size:32,className:"object-contain",fallbackText:e.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:e.provider}),h(e)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:h(e)}):null,T(e)?(0,a.jsx)("p",{className:"text-[11px] text-text-muted/80 truncate",children:T(e)}):null,"kiro"===e.provider&&(0,a.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[(0,a.jsx)("span",{className:"rounded-full bg-brand-500/10 px-2 py-0.5 text-[10px] font-semibold text-brand-600 dark:text-brand-300",children:(o=e.providerSpecificData?.authMethod)&&E[o]?E[o]:"api_key"===e.authType?"API Key":"OAuth"}),M(e)&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-semibold text-blue-600 dark:text-blue-400",children:M(e)}),(0,a.jsx)("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-semibold ${m?"bg-surface-2 text-text-muted":"active"===e.testStatus||"success"===e.testStatus?"bg-green-500/10 text-green-600 dark:text-green-400":"error"===e.testStatus||"expired"===e.testStatus||"unavailable"===e.testStatus?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-surface-2 text-text-muted"}`,children:m?"disabled":e.testStatus||"unknown"}),e.providerSpecificData?.profileArn&&(0,a.jsxs)("button",{type:"button",onClick:()=>r(e.providerSpecificData.profileArn,e.id),title:e.providerSpecificData.profileArn,className:"inline-flex max-w-full items-center gap-1 rounded-full border border-border-subtle px-2 py-0.5 text-[10px] text-text-muted transition-colors hover:text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t===e.id?"check":"content_copy"}),(0,a.jsx)("code",{className:"truncate font-mono",children:e.providerSpecificData.profileArn})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(x||p)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(C.A,{text:g>0?p?`Use your reset now (${g} left, use by ${O(p.expiresAt)}) \xb7 refills ${L(p.clears)}`:`Use one ${b}. Available: ${g}`:`No ${b}s available`,children:(0,a.jsxs)("button",{type:"button",onClick:()=>ep({connection:e,resetCreditCount:g}),disabled:g<=0||c||y,"aria-label":g>0?`Use one ${b}. ${g} available.`:`No ${b}s available`,className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 text-[11px] font-medium tabular-nums transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/60 disabled:cursor-not-allowed disabled:opacity-60 ${g>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-black/10 bg-black/[0.02] text-text-muted dark:border-white/10 dark:bg-white/[0.03]"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${f?"animate-spin":""}`,children:f?"progress_activity":"restart_alt"}),(0,a.jsx)("span",{children:g})]})}),(0,a.jsx)(C.A,{text:x?"View Codex reset credit expiry":"View Claude Code reset expiry",children:(0,a.jsx)("button",{type:"button",onClick:()=>x?e9(e):e7(e,p),disabled:c||y,"aria-label":x?"View Codex reset credit expiry":"View Claude Code reset expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-muted transition-colors hover:bg-black/5 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"schedule"})})})]}),q[e.provider]&&"oauth"===e.authType&&(0,a.jsx)(C.A,{text:D[e.provider],children:(0,a.jsx)("button",{type:"button",onClick:()=>ts(e.id,e.provider,Y[e.provider]?.[e.id]!==!0),"aria-label":"Toggle auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${Y[e.provider]?.[e.id]===!0?"text-primary":"text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"})})}),(0,a.jsx)(C.A,{text:"Refresh quota",children:(0,a.jsx)("button",{type:"button",onClick:()=>e8(e.id,e.provider),disabled:c||y,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${c?"animate-spin":""}`,children:"refresh"})})}),(0,a.jsx)(C.A,{text:"Edit connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>{ew(e),ey(!0)},disabled:y,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})})}),(0,a.jsx)(C.A,{text:"Delete connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>te(e.id),disabled:y,"aria-label":"Delete connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${eo===e.id?"animate-pulse":""}`,children:"delete"})})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:e.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(N.A,{size:"sm",checked:e.isActive??!0,disabled:y,onChange:t=>tt(e.id,t)})})]})]})}),(0,a.jsx)("div",{className:"px-2 py-1.5",children:c?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):u?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:u})]}):d?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:d.message})}):(0,a.jsx)(j,{quotas:(s=d?.quotas,Array.isArray(s)&&"all"!==eP&&eP?s.filter(e=>(e&&(e.modelKey||e.name)||"")===eP):s||[]),compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==eT})})]},e.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:tp}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:tb?"custom":String(eK),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eJ(1),eW(r),eH(String(r)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[u.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eG,onChange:e=>eH(e.target.value),onBlur:()=>{let e=Number.parseInt(eG,10);if(!Number.isFinite(e))return void eH(String(eK));let t=Math.min(500,Math.max(1,e));eJ(1),eW(t),eH(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eG,10);if(!Number.isFinite(t))return void eH(String(eK));let r=Math.min(500,Math.max(1,t));eJ(1),eW(r),eH(String(r))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eV.page," / ",eV.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eJ(1),disabled:eV.page<=1||el||er,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eJ(e=>Math.max(1,e-1)),disabled:eV.page<=1||el||er,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Previous accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eJ(e=>Math.min(eV.totalPages,e+1)),disabled:eV.page>=eV.totalPages||el||er,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Next accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eJ(eV.totalPages),disabled:eV.page>=eV.totalPages||el||er,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,a.jsx)(A.ConfirmModal,{isOpen:!!eh,onClose:()=>{em||ep(null)},onConfirm:async()=>{let e=eh?.connection;e&&(await e6(e.id,e.provider),ep(null))},title:eh?.connection?.provider==="claude"?"Reset Claude limits?":"Reset Codex limit?",message:eh?.connection?.provider==="claude"?`Refills your ${L(z[eh.connection.id]?.raw?.resetCredits?.clears)} now for ${h(eh.connection)||"this account"} \xb7 your weekly reset day stays ${O(z[eh.connection.id]?.raw?.resetCredits?.weeklyResetsAt)}. This cannot be undone. Resets left: ${eh.resetCreditCount??0}.`:`Use 1 Codex reset credit for ${h(eh?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${eh?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!em}),eb&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"w-full max-w-2xl overflow-hidden rounded-2xl border border-black/15 bg-white shadow-2xl ring-1 ring-black/10 dark:border-white/15 dark:bg-neutral-950 dark:ring-white/10",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-black/10 bg-black/[0.03] px-4 py-3 dark:border-white/10 dark:bg-white/[0.04]",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-text-primary",children:eb.data?.kind==="claude"?"Claude Code Limit Resets":"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs text-text-muted",children:h(eb.connection)||(eb.data?.kind==="claude"?"Claude account":"Codex account")})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eg(null),className:"flex h-8 w-8 items-center justify-center rounded-lg text-text-muted transition-colors hover:bg-black/5 hover:text-text-primary dark:hover:bg-white/5","aria-label":"Close reset credit expiry modal",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,a.jsx)("div",{className:"max-h-[70vh] overflow-auto bg-white p-4 dark:bg-neutral-950",children:eb.loading?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading reset credits..."]}):eb.error?(0,a.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-300",children:eb.error}):eb.data?.kind==="claude"&&eb.data.grants?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[eb.data.availableCount??0," reset",1===eb.data.availableCount?"":"s"," left"]}),(0,a.jsxs)("span",{children:["Weekly reset day: ",O(eb.data.weeklyResetsAt)]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Reset"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Left"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Refills"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Use By"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:(eb.data.grants||[]).map(e=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsxs)("td",{className:"px-3 py-2",children:[(0,a.jsx)("div",{className:"text-text-primary",children:e.label||e.id}),(0,a.jsx)("span",{className:"mt-1 inline-block rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.resetsLeft<=0?"used":e.paused?"paused":e.endsAt&&new Date(e.endsAt).getTime()<=Date.now()?"expired":e.usableNow?"usable now":e.startsAt&&new Date(e.startsAt).getTime()>Date.now()?"not started":e.useRequiresLimit?"at limit only":"unavailable"})]}),(0,a.jsxs)("td",{className:"whitespace-nowrap px-3 py-2 font-medium tabular-nums text-text-primary",children:[e.resetsLeft," / ",e.resetsTotal]}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:L(e.clears)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:O(e.endsAt)}),(0,a.jsx)("td",{className:"whitespace-nowrap px-3 py-2 font-medium text-text-primary",children:I(e.endsAt)})]},e.id))})]})})]}):eb.data?.credits?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[eb.data.credits.length," reset credit",1===eb.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[eb.data.availableCount??0," available"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Granted At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Expires At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:eb.data.credits.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.status||"unknown"})}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:O(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:O(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-text-primary",children:I(e.expiresAt)})]},`${e.status}-${e.expiresAt||t}`))})]})})]}):(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-8 text-center text-sm text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:eb.data?.kind==="claude"?"No limit resets available for this account.":"No reset credit details returned for this account."})})]})}),(0,a.jsx)(A.EditConnectionModal,{isOpen:ef,connection:ev,proxyPools:ek,onSave:tr,onClose:()=>{ey(!1),ew(null)}})]}):(0,a.jsx)(S.A,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:th.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:th.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:th.description})]})}):(0,a.jsx)(S.A,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}}},e=>{e.O(0,[3885,7523,7236,4385,736,2147,3204,7358],()=>e(e.s=5244)),_N_E=e.O()}]);
|
package/app/package.json
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
sortVisibleConnections,
|
|
15
15
|
buildLoadingState,
|
|
16
16
|
filterQuotaStateByConnections,
|
|
17
|
+
scopeConnectionsToProvider,
|
|
18
|
+
createLatestRequestTracker,
|
|
17
19
|
getConnectionsEmptyMessage,
|
|
18
20
|
getPageSizeLabel,
|
|
19
21
|
getConnectionsPaginationSummary,
|
|
@@ -193,6 +195,7 @@ export default function ProviderLimits() {
|
|
|
193
195
|
router.replace(newUrl, { scroll: false });
|
|
194
196
|
} catch { /* non-fatal: URL sync is best-effort */ }
|
|
195
197
|
}, [pathname, router, searchParams]);
|
|
198
|
+
|
|
196
199
|
const [providerOptions, setProviderOptions] = useState([]);
|
|
197
200
|
const [modelFilter, setModelFilter] = useState("all");
|
|
198
201
|
const [accountFilter, setAccountFilter] = useState("all");
|
|
@@ -220,9 +223,19 @@ export default function ProviderLimits() {
|
|
|
220
223
|
const intervalRef = useRef(null);
|
|
221
224
|
const countdownRef = useRef(null);
|
|
222
225
|
const tickCountRef = useRef(0);
|
|
226
|
+
const connectionsRequestsRef = useRef(createLatestRequestTracker());
|
|
227
|
+
const refreshingAllRef = useRef(false);
|
|
228
|
+
|
|
229
|
+
// The providerFilter initializer runs once; follow later URL changes so
|
|
230
|
+
// browser back/forward and direct navigation cannot leave a stale filter.
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
const urlProvider = searchParams?.get("provider") || "all";
|
|
233
|
+
_setProviderFilter((current) => (current === urlProvider ? current : urlProvider));
|
|
234
|
+
}, [searchParams]);
|
|
223
235
|
|
|
224
236
|
const fetchConnections = useCallback(
|
|
225
237
|
async (targetPage = page) => {
|
|
238
|
+
const requestToken = connectionsRequestsRef.current.begin();
|
|
226
239
|
try {
|
|
227
240
|
const params = new URLSearchParams({
|
|
228
241
|
page: String(targetPage),
|
|
@@ -237,10 +250,13 @@ export default function ProviderLimits() {
|
|
|
237
250
|
|
|
238
251
|
const response = await fetch(
|
|
239
252
|
`/api/providers/client?${params.toString()}`,
|
|
253
|
+
{ cache: "no-store" },
|
|
240
254
|
);
|
|
241
255
|
if (!response.ok) throw new Error("Failed to fetch connections");
|
|
242
256
|
|
|
243
257
|
const data = await response.json();
|
|
258
|
+
if (!connectionsRequestsRef.current.isLatest(requestToken)) return null;
|
|
259
|
+
|
|
244
260
|
const connectionList = data.connections || [];
|
|
245
261
|
const nextPagination = getSafePagination(data.pagination, pageSize);
|
|
246
262
|
const nextTotals = getSafeTotals(data.totals, connectionList.length);
|
|
@@ -252,6 +268,7 @@ export default function ProviderLimits() {
|
|
|
252
268
|
setPage(getPaginationPageValue(data.pagination, targetPage));
|
|
253
269
|
return connectionList;
|
|
254
270
|
} catch (error) {
|
|
271
|
+
if (!connectionsRequestsRef.current.isLatest(requestToken)) return null;
|
|
255
272
|
console.error("Error fetching connections:", error);
|
|
256
273
|
setConnections([]);
|
|
257
274
|
setProviderOptions([]);
|
|
@@ -260,7 +277,7 @@ export default function ProviderLimits() {
|
|
|
260
277
|
return [];
|
|
261
278
|
}
|
|
262
279
|
},
|
|
263
|
-
[accountFilter,
|
|
280
|
+
[accountFilter, page, pageSize, providerFilter],
|
|
264
281
|
);
|
|
265
282
|
|
|
266
283
|
// Fetch quota for a specific connection
|
|
@@ -272,7 +289,7 @@ export default function ProviderLimits() {
|
|
|
272
289
|
console.log(
|
|
273
290
|
`[ProviderLimits] Fetching quota for ${provider} (${connectionId})`,
|
|
274
291
|
);
|
|
275
|
-
const response = await fetch(`/api/usage/${connectionId}${force ? "?force=1" : ""}
|
|
292
|
+
const response = await fetch(`/api/usage/${connectionId}${force ? "?force=1" : ""}`, { cache: "no-store" });
|
|
276
293
|
|
|
277
294
|
if (!response.ok) {
|
|
278
295
|
const errorData = await response.json().catch(() => ({}));
|
|
@@ -522,8 +539,9 @@ export default function ProviderLimits() {
|
|
|
522
539
|
}, []);
|
|
523
540
|
|
|
524
541
|
const refreshAll = useCallback(async (force = false) => {
|
|
525
|
-
if (
|
|
542
|
+
if (refreshingAllRef.current) return;
|
|
526
543
|
|
|
544
|
+
refreshingAllRef.current = true;
|
|
527
545
|
setRefreshingAll(true);
|
|
528
546
|
setCountdown(60);
|
|
529
547
|
|
|
@@ -535,6 +553,7 @@ export default function ProviderLimits() {
|
|
|
535
553
|
|
|
536
554
|
try {
|
|
537
555
|
const visibleConnections = await fetchConnections(page);
|
|
556
|
+
if (!visibleConnections) return;
|
|
538
557
|
|
|
539
558
|
setLoading(buildLoadingState(visibleConnections));
|
|
540
559
|
setErrors((prev) =>
|
|
@@ -554,15 +573,19 @@ export default function ProviderLimits() {
|
|
|
554
573
|
} catch (error) {
|
|
555
574
|
console.error("Error refreshing all providers:", error);
|
|
556
575
|
} finally {
|
|
576
|
+
refreshingAllRef.current = false;
|
|
557
577
|
setRefreshingAll(false);
|
|
558
578
|
}
|
|
559
|
-
}, [
|
|
579
|
+
}, [fetchConnections, fetchQuota, page]);
|
|
560
580
|
|
|
561
581
|
useEffect(() => {
|
|
582
|
+
let cancelled = false;
|
|
562
583
|
const initializeData = async () => {
|
|
563
584
|
setConnectionsLoading(true);
|
|
564
585
|
const visibleConnections = await fetchConnections(page);
|
|
586
|
+
if (cancelled) return;
|
|
565
587
|
setConnectionsLoading(false);
|
|
588
|
+
if (!visibleConnections) return;
|
|
566
589
|
|
|
567
590
|
// Always fetch fresh quota on mount, no cache display
|
|
568
591
|
setLoading(buildLoadingState(visibleConnections));
|
|
@@ -576,10 +599,14 @@ export default function ProviderLimits() {
|
|
|
576
599
|
await Promise.all(
|
|
577
600
|
visibleConnections.map((conn) => fetchQuota(conn.id, conn.provider)),
|
|
578
601
|
);
|
|
602
|
+
if (cancelled) return;
|
|
579
603
|
setLastUpdated(new Date());
|
|
580
604
|
};
|
|
581
605
|
|
|
582
606
|
initializeData();
|
|
607
|
+
return () => {
|
|
608
|
+
cancelled = true;
|
|
609
|
+
};
|
|
583
610
|
}, [fetchConnections, fetchQuota, page]);
|
|
584
611
|
|
|
585
612
|
useEffect(() => {
|
|
@@ -701,7 +728,7 @@ export default function ProviderLimits() {
|
|
|
701
728
|
const sortedConnections = useMemo(
|
|
702
729
|
() =>
|
|
703
730
|
sortVisibleConnections(
|
|
704
|
-
connections,
|
|
731
|
+
scopeConnectionsToProvider(connections, providerFilter),
|
|
705
732
|
quotaData,
|
|
706
733
|
expiringFirst,
|
|
707
734
|
providerFilter,
|
|
@@ -149,6 +149,32 @@ export function filterQuotaStateByConnections(state, connections) {
|
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Keep only connections from the selected provider. The API already filters,
|
|
154
|
+
* but a late response from a previous filter must not put another provider's
|
|
155
|
+
* accounts back on screen.
|
|
156
|
+
*/
|
|
157
|
+
export function scopeConnectionsToProvider(connections, providerFilter) {
|
|
158
|
+
if (providerFilter === "all") return connections;
|
|
159
|
+
return connections.filter((connection) => connection.provider === providerFilter);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Latest-wins token for overlapping async requests. Only the most recently
|
|
164
|
+
* started request may commit its result.
|
|
165
|
+
*/
|
|
166
|
+
export function createLatestRequestTracker() {
|
|
167
|
+
let latest = 0;
|
|
168
|
+
return {
|
|
169
|
+
begin() {
|
|
170
|
+
return ++latest;
|
|
171
|
+
},
|
|
172
|
+
isLatest(token) {
|
|
173
|
+
return token === latest;
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
152
178
|
export function getConnectionsPageRange(pagination) {
|
|
153
179
|
if (!pagination.total) {
|
|
154
180
|
return { start: 0, end: 0 };
|