@thangnm.nip/irouter 0.0.5 → 0.0.7
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/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +3 -3
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/employees/[keyId]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/employees/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/employees/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/employees/stats/route.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next/server/app/api/version/route.js +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +4 -4
- package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/employees.html +1 -1
- package/app/.next/server/app/dashboard/employees.rsc +6 -6
- package/app/.next/server/app/dashboard/employees.segments/!KGRhc2hib2FyZCk/dashboard/employees/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/employees.segments/!KGRhc2hib2FyZCk/dashboard/employees.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/employees.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/employees.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/employees.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/employees.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/employees.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/employees.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.html +1 -1
- package/app/.next/server/app/dashboard/mitm.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.html +2 -2
- package/app/.next/server/app/dashboard/quota.rsc +5 -5
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.html +1 -1
- package/app/.next/server/app/dashboard/translator.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +5 -5
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +4 -4
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +4 -4
- package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +5 -5
- package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +3 -3
- package/app/.next/server/chunks/1424.js +1 -1
- package/app/.next/server/chunks/2664.js +1 -1
- package/app/.next/server/chunks/3093.js +1 -1
- package/app/.next/server/chunks/412.js +1 -1
- package/app/.next/server/chunks/4989.js +1 -1
- package/app/.next/server/middleware-build-manifest.js +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/static/chunks/{5497-e7c459dae96a00af.js → 5497-895f5aeae6865844.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/employees/page-759cf0824c54aa0a.js +1 -0
- package/app/.next/static/chunks/app/{layout-38a7dc76628b492f.js → layout-eef0e315aaedee4b.js} +1 -1
- package/app/.next/static/css/{5cdf9af08f4fc616.css → 0c8e33fc14ea047b.css} +1 -1
- package/app/package.json +1 -1
- package/package.json +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/employees/page-ddde5fb116c5e82f.js +0 -1
- /package/app/.next/static/{YqCpOGNVnSdwTRz3OXLXi → Zuy5P2lh2UzDvTuMBJHLu}/_buildManifest.js +0 -0
- /package/app/.next/static/{YqCpOGNVnSdwTRz3OXLXi → Zuy5P2lh2UzDvTuMBJHLu}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.id=412,exports.ids=[412],exports.modules={267:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(74429),g=c(51126),h=c(99258);let i=a=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}})[a]||{name:a,flag:"\uD83C\uDF10"};function j({className:a=""}){let[b,c]=(0,e.useState)("en"),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(!1),o=(0,e.useRef)(null),p=async a=>{if(a!==b&&!k){l(!0),n(!1);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:a})}),await (0,h.wn)(),c(a)}catch(a){console.error("Failed to set locale:",a)}finally{l(!1)}}};return(0,d.jsxs)("div",{className:a,children:[(0,d.jsxs)("button",{onClick:()=>n(!m),disabled:k,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,d.jsx)("span",{className:"text-xl",children:i(b).flag}),(0,d.jsx)("span",{className:"text-sm font-medium",children:i(b).name}),(0,d.jsx)("span",{className:"material-symbols-outlined text-base",children:m?"expand_less":"expand_more"})]}),m&&(0,f.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>n(!1)}),(0,d.jsxs)("div",{ref:o,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,d.jsx)("button",{onClick:()=>n(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,d.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:g.YZ.map(a=>{let c=b===a,e=i(a);return(0,d.jsxs)("button",{onClick:()=>p(a),disabled:k,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${c?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${k?"opacity-70 cursor-wait":""}`,title:e.name,children:[(0,d.jsx)("span",{className:"text-2xl",children:e.flag}),(0,d.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:e.name}),c&&(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},a)})})})]})]}),document.body)]})}},4770:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({label:a,options:b=[],value:c,onChange:g,placeholder:h="Select an option",error:i,hint:j,disabled:k=!1,required:l=!1,className:m,selectClassName:n,...o}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",m),children:[a&&(0,d.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[a,l&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsxs)("select",{value:c,onChange:g,disabled:k,className:(0,e.cn)("w-full py-2 px-3 pr-10 text-sm text-text-main","bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md appearance-none","focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none","transition-all disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",i?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"",n),...o,children:[(0,d.jsx)("option",{value:"",disabled:!0,children:h}),b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))]}),(0,d.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),i&&(0,d.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),i]}),j&&!i&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:j})]})}},5291:(a,b,c)=>{c.d(b,{default:()=>k});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(79346),i=c(86209),j=c(56110);function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:f}){let[g,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(null),q=(0,e.useCallback)((a,b)=>{"builder-id"===a?l("builder-id"):"idc"===a?(l("idc"),p(b)):"social"===a?(l("social"),n(b.provider)):"import"===a&&c?.()},[c]),r=()=>{l(null),n(null),p(null)};return g?"builder-id"===g||"idc"===g?(0,d.jsx)(h.default,{isOpen:a,provider:"kiro",providerInfo:b,onSuccess:()=>{l(null),p(null),c?.(),f?.()},onClose:r,idcConfig:o}):"social"===g&&m?(0,d.jsx)(j.default,{isOpen:a,provider:m,onSuccess:()=>{l(null),n(null),c?.(),f?.()},onClose:r}):null:(0,d.jsx)(i.default,{isOpen:a,onMethodSelect:q,onClose:f})}k.propTypes={isOpen:g().bool.isRequired,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},14190:(a,b,c)=>{c.d(b,{A:()=>r});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(80322),i=c(21621),j=c(28946),k=c(22393),l=c(54206),m=c(40369),n=c(83385),o=c(17660);let p=a=>a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a||0),q=a=>`$${(a||0).toFixed(4)}`;function r({period:a="7d"}){let[b,c]=(0,e.useState)([]),[f,g]=(0,e.useState)(!0),[s,t]=(0,e.useState)("tokens");(0,e.useCallback)(async()=>{g(!0);try{let b=await fetch(`/api/usage/chart?period=${a}`);if(b.ok){let a=await b.json();c(a)}}catch(a){console.error("Failed to fetch chart data:",a)}finally{g(!1)}},[a]);let u=b.some(a=>a.tokens>0||a.cost>0);return(0,d.jsxs)(o.default,{className:"p-4 flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h3",{className:"font-semibold text-sm text-text-muted uppercase",children:"Usage Trend"}),(0,d.jsxs)("div",{className:"flex items-center gap-1 bg-bg-subtle rounded-lg p-1 border border-border",children:[(0,d.jsx)("button",{onClick:()=>t("cost"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"cost"===s?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Cost"}),(0,d.jsx)("button",{onClick:()=>t("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===s?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),f?(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):u?(0,d.jsx)(h.u,{width:"100%",height:200,children:(0,d.jsxs)(i.Q,{data:b,margin:{top:4,right:8,left:0,bottom:0},children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,d.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,d.jsx)(j.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,d.jsx)(k.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,d.jsx)(l.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===s?p:q,width:50}),(0,d.jsx)(m.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(a,b)=>"tokens"===b?[p(a),"Tokens"]:[q(a),"Cost"]}),"tokens"===s?(0,d.jsx)(n.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,d.jsx)(n.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}r.propTypes={period:g().string}},17660:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({children:a,title:b,subtitle:c,icon:g,action:h,padding:i="md",hover:j=!1,className:k,...l}){return(0,d.jsxs)("div",{className:(0,e.cn)("bg-surface","border border-black/5 dark:border-white/5","rounded-lg shadow-sm",j&&"hover:shadow-md hover:border-primary/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[i],k),...l,children:[(b||h)&&(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[g&&(0,d.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:g})}),(0,d.jsxs)("div",{children:[b&&(0,d.jsx)("h3",{className:"text-text-main font-semibold",children:b}),c&&(0,d.jsx)("p",{className:"text-sm text-text-muted",children:c})]})]}),h]}),a]})}f.Section=function({children:a,className:b,...c}){return(0,d.jsx)("div",{className:(0,e.cn)("p-4 rounded-lg","bg-black/[0.02] dark:bg-white/[0.02]","border border-black/5 dark:border-white/5",b),...c,children:a})},f.Row=function({children:a,className:b,...c}){return(0,d.jsx)("div",{className:(0,e.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-black/5 dark:border-white/5 last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]",b),...c,children:a})},f.ListItem=function({children:a,actions:b,className:c,...f}){return(0,d.jsxs)("div",{className:(0,e.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]","transition-colors",c),...f,children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:a}),b&&(0,d.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:b})]})}},25919:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({src:a,alt:b="Avatar",name:c,size:g="md",className:h}){let i={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return a?(0,d.jsx)("div",{className:(0,e.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",i[g],h),style:{backgroundImage:`url(${a})`},role:"img","aria-label":b}):(0,d.jsx)("div",{className:(0,e.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",i[g],(a=>{if(!a)return"bg-primary";let b=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],c=a.charCodeAt(0)%b.length;return b[c]})(c),h),role:"img","aria-label":b,children:(a=>{if(!a)return"?";let b=a.split(" ");return b.length>=2?`${b[0][0]}${b[1][0]}`.toUpperCase():a.substring(0,2).toUpperCase()})(c)})}},32971:(a,b,c)=>{c.d(b,{default:()=>e});var d=c(48249);function e({text:a,children:b,position:c="top"}){return(0,d.jsxs)("div",{className:"relative inline-flex group",children:[b,(0,d.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[c]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug bg-gray-900 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-150 whitespace-normal`,children:a})]})}},39645:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(67484),f=c(95145),g=c(99070);function h({isOpen:a,onClose:b,title:c="Manual Configuration",configs:i=[]}){let[j,k]=(0,e.useState)(null),l=async(a,b)=>{try{await navigator.clipboard.writeText(a),k(b),setTimeout(()=>k(null),2e3)}catch(a){console.log("Failed to copy:",a)}};return(0,d.jsx)(f.default,{isOpen:a,onClose:b,title:c,size:"xl",children:(0,d.jsx)("div",{className:"flex flex-col gap-4",children:i.map((a,b)=>(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:a.filename}),(0,d.jsxs)(g.default,{variant:"ghost",size:"sm",onClick:()=>l(a.content,b),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:j===b?"check":"content_copy"}),j===b?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:a.content})]},b))})})}},41371:(a,b,c)=>{c.d(b,{i:()=>f});var d=c(31417);let e=0,f=(0,d.v)((a,b)=>({notifications:[],addNotification:c=>{let d=++e,f={id:d,type:c.type||"info",message:c.message,title:c.title||null,duration:c.duration??5e3,dismissible:c.dismissible??!0,createdAt:Date.now()};return a(a=>({notifications:[...a.notifications,f]})),f.duration>0&&setTimeout(()=>b().removeNotification(d),f.duration),d},removeNotification:b=>{a(a=>({notifications:a.notifications.filter(a=>a.id!==b)}))},clearAll:()=>a({notifications:[]}),success:(a,c)=>b().addNotification({type:"success",message:a,title:c}),error:(a,c)=>b().addNotification({type:"error",message:a,title:c,duration:8e3}),warning:(a,c)=>b().addNotification({type:"warning",message:a,title:c}),info:(a,c)=>b().addNotification({type:"info",message:a,title:c})}))},42118:(a,b,c)=>{c.d(b,{D:()=>i});var d=c(67484),e=c(13033);function f(a){return()=>{}}function g(){return!1}function h(){return!1}function i(){let{theme:a,setTheme:b,toggleTheme:c,initTheme:i}=(0,e.A)(),j=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,setTheme:b,toggleTheme:c,isDark:"dark"===a||"system"===a&&j}}},42196:(a,b,c)=>{c.d(b,{default:()=>r});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(2116),i=c.n(h),j=c(19099),k=c(71404),l=c(12020),m=c(99070),n=c(95145);let o=[{href:"/dashboard/employees",label:"E Dashboard",icon:"badge"},{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],p=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"}],q=[{href:"/dashboard/profile",label:"Settings",icon:"settings"}];function r({onClose:a}){let b=(0,j.usePathname)(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),y=a=>"/dashboard/endpoint"===a?"/dashboard"===b||b.startsWith("/dashboard/endpoint"):b.startsWith(a),z=async()=>{h(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(a){}h(!1),f(!1),t(!0)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("aside",{className:"flex w-72 flex-col border-r border-black/5 dark:border-white/5 bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,d.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,d.jsxs)(i(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,d.jsx)("img",{src:"/favicon.svg",alt:"iRouter",className:"size-9 rounded"}),(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:l.vQ.name}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["v",l.vQ.version]})]})]}),u&&(0,d.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",u.latestVersion]}),(0,d.jsx)("code",{className:"text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono select-all",children:"npm install -g 9router@latest"})]})]}),(0,d.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[o.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",y(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",y(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href)),(0,d.jsxs)("div",{className:"pt-4 mt-2",children:[(0,d.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"Debug"}),w&&(0,d.jsxs)(i(),{href:"/dashboard/translator",onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",y("/dashboard/translator")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",y("/dashboard/translator")?"fill-1":"group-hover:text-primary transition-colors"),children:"translate"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:"Translator"})]}),p.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",y(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",y(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href))]}),(0,d.jsxs)("div",{className:"pt-4 mt-2",children:[(0,d.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),q.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",y(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",y(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href))]})]}),(0,d.jsxs)("div",{className:"p-3 border-t border-black/5 dark:border-white/5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-surface/50 mb-2",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-6 rounded-md bg-blue-500/10 text-blue-500 shrink-0 mt-0.5",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"})}),(0,d.jsx)("div",{className:"flex flex-col",children:(0,d.jsx)("span",{className:"text-xs font-medium text-text-main leading-relaxed",children:"Service is running in terminal. You can close this web page. Shutdown will stop the service."})})]}),(0,d.jsx)(m.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>f(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})]})]}),(0,d.jsx)(n.ConfirmModal,{isOpen:c,onClose:()=>f(!1),onConfirm:z,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:g}),s&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"text-center p-8",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,d.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,d.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,d.jsx)(m.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}r.propTypes={onClose:g().func}},42507:(a,b,c)=>{c.d(b,{default:()=>K});var d=c(48249),e=c(67484),f=c(19099),g=c(75171),h=c(17660),i=c(49885),j=c.n(i);let k=a=>new Intl.NumberFormat().format(a||0);function l({stats:a}){let b;return(0,d.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,d.jsxs)(h.default,{className:"px-4 py-3 flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Requests"}),(0,d.jsx)("span",{className:"text-2xl font-bold",children:k(a.totalRequests)})]}),(0,d.jsxs)(h.default,{className:"px-4 py-3 flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Input Tokens"}),(0,d.jsx)("span",{className:"text-2xl font-bold text-primary",children:k(a.totalPromptTokens)})]}),(0,d.jsxs)(h.default,{className:"px-4 py-3 flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Output Tokens"}),(0,d.jsx)("span",{className:"text-2xl font-bold text-success",children:k(a.totalCompletionTokens)})]}),(0,d.jsxs)(h.default,{className:"px-4 py-3 flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Est. Cost"}),(0,d.jsxs)("span",{className:"text-2xl font-bold text-warning",children:["~",(b=a.totalCost,`$${(b||0).toFixed(2)}`)]}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"Estimated, not actual billing"})]})]})}l.propTypes={stats:j().object.isRequired};let m=a=>new Intl.NumberFormat().format(a||0),n=a=>`$${(a||0).toFixed(2)}`;function o(a){if(!a)return"Never";let b=Math.floor((Date.now()-new Date(a))/6e4);return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:new Date(a).toLocaleDateString()}function p({field:a,currentSort:b,currentOrder:c}){return b!==a?(0,d.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,d.jsx)("span",{className:"ml-1",children:"asc"===c?"↑":"↓"})}function q({item:a,viewMode:b,isSummary:c=!1}){return"tokens"===b?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.promptTokens?"—":m(a.promptTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.completionTokens?"—":m(a.completionTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:m(a.totalTokens)})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.inputCost?"—":n(a.inputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.outputCost?"—":n(a.outputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:n(a.totalCost||a.cost)})]})}function r({title:a,columns:b,groupedData:c,tableType:f,sortBy:g,sortOrder:i,onToggleSort:j,viewMode:k,storageKey:l,renderDetailCells:m,renderSummaryCells:n,emptyMessage:o}){let[s,t]=(0,e.useState)(new Set),u=(0,e.useCallback)(a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),v=(0,e.useMemo)(()=>"tokens"===k?[{field:"promptTokens",label:"Input Tokens"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[k]),w=b.length+v.length;return(0,d.jsxs)(h.default,{className:"overflow-hidden",children:[(0,d.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,d.jsx)("h3",{className:"font-semibold",children:a})}),(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,d.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,d.jsxs)("tr",{children:[b.map(a=>(0,d.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===a.align?"text-right":""}`,onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(p,{field:a.field,currentSort:g,currentOrder:i})]},a.field)),v.map(a=>(0,d.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(p,{field:a.field,currentSort:g,currentOrder:i})]},a.field))]})}),(0,d.jsxs)("tbody",{className:"divide-y divide-border",children:[c.map(a=>(0,d.jsxs)(e.Fragment,{children:[(0,d.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>u(a.groupKey),children:[(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${s.has(a.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,d.jsx)("span",{className:`font-medium transition-colors ${a.summary.pending>0?"text-primary":""}`,children:a.groupKey})]})}),n(a),(0,d.jsx)(q,{item:a.summary,viewMode:k,isSummary:!0})]}),s.has(a.groupKey)&&a.items.map(a=>(0,d.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[m(a),(0,d.jsx)(q,{item:a,viewMode:k})]},`detail-${a.key}`))]},a.groupKey)),0===c.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:w,className:"px-6 py-8 text-center text-text-muted",children:o})})]})]})})]})}p.propTypes={field:j().string.isRequired,currentSort:j().string.isRequired,currentOrder:j().string.isRequired},q.propTypes={item:j().object.isRequired,viewMode:j().string.isRequired,isSummary:j().bool},r.propTypes={title:j().string.isRequired,columns:j().arrayOf(j().shape({field:j().string.isRequired,label:j().string.isRequired,align:j().string})).isRequired,groupedData:j().array.isRequired,tableType:j().string.isRequired,sortBy:j().string.isRequired,sortOrder:j().string.isRequired,onToggleSort:j().func.isRequired,viewMode:j().string.isRequired,storageKey:j().string.isRequired,renderDetailCells:j().func.isRequired,renderSummaryCells:j().func.isRequired,emptyMessage:j().string.isRequired};var s=c(96103),t=c(22805);c(71763);var u=c(96919);function v({data:a}){let{label:b,color:c,imageUrl:f,textIcon:g,active:h}=a,[i,j]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"flex items-center gap-2.5 px-4 py-2.5 rounded-lg border-2 transition-all duration-300 bg-bg",style:{borderColor:h?c:"var(--color-border)",boxShadow:h?`0 0 16px ${c}40`:"none",minWidth:"150px"},children:[(0,d.jsx)(s.h7,{type:"target",position:t.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"target",position:t.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"target",position:t.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"target",position:t.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:`${c}15`},children:i?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:c},children:g}):(0,d.jsx)("img",{src:f,alt:b,className:"w-6 h-6 rounded-sm object-contain",onError:()=>j(!0)})}),(0,d.jsx)("span",{className:"text-base font-medium truncate",style:{color:h?c:"var(--color-text)"},children:b}),h&&(0,d.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,d.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:c}}),(0,d.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:c}})]})]})}function w({data:a}){return(0,d.jsxs)("div",{className:"flex items-center justify-center px-5 py-3 rounded-xl border-2 border-primary bg-primary/5 shadow-md min-w-[130px]",children:[(0,d.jsx)(s.h7,{type:"source",position:t.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"source",position:t.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"source",position:t.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"source",position:t.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("img",{src:"/favicon.svg",alt:"iRouter",className:"w-6 h-6 mr-2"}),(0,d.jsx)("span",{className:"text-sm font-bold text-primary",children:"iRouter"}),a.activeCount>0&&(0,d.jsx)("span",{className:"ml-2 px-1.5 py-0.5 rounded-full bg-primary text-white text-xs font-bold",children:a.activeCount})]})}v.propTypes={data:j().object.isRequired},w.propTypes={data:j().object.isRequired};let x={provider:v,router:w};function y({providers:a=[],activeRequests:b=[],lastProvider:c="",errorProvider:f=""}){let g=(0,e.useMemo)(()=>b.map(a=>a.provider?.toLowerCase()).filter(Boolean).sort().join(","),[b]),h=c?.toLowerCase()||"",i=f?.toLowerCase()||"",j=(0,e.useMemo)(()=>new Set(g?g.split(","):[]),[g]),k=(0,e.useMemo)(()=>new Set(h?[h]:[]),[h]),l=(0,e.useMemo)(()=>new Set(i?[i]:[]),[i]),{nodes:m,edges:n}=(0,e.useMemo)(()=>(function(a,b,c,d){let e=a.length,f=Math.max(320,204*e/(2*Math.PI)),g=Math.max(200,.55*f);if(0===e)return{nodes:[{id:"router",type:"router",position:{x:0,y:0},data:{activeCount:0},draggable:!1}],edges:[]};let h=[],i=[];return h.push({id:"router",type:"router",position:{x:-60,y:-22},data:{activeCount:b.size},draggable:!1}),a.forEach((a,j)=>{var k,l;let m,n,o=(k=a.provider,u.Q2[k]||{color:"#6b7280",name:k}),p=b.has(a.provider?.toLowerCase()),q=!p&&c.has(a.provider?.toLowerCase()),r=!p&&d.has(a.provider?.toLowerCase()),s=`provider-${a.provider}`,t={label:(o.name!==a.provider?o.name:null)||a.name||a.provider,color:o.color||"#6b7280",imageUrl:(l=a.provider,`/providers/${l}.png`),textIcon:o.textIcon||(a.provider||"?").slice(0,2).toUpperCase(),active:p},v=-Math.PI/2+2*Math.PI*j/e,w=f*Math.cos(v),x=g*Math.sin(v);Math.abs(v+Math.PI/2)<Math.PI/4||Math.abs(v-3*Math.PI/2)<Math.PI/4?(m="top",n="bottom"):Math.abs(v-Math.PI/2)<Math.PI/4?(m="bottom",n="top"):w>0?(m="right",n="left"):(m="left",n="right"),h.push({id:s,type:"provider",position:{x:w-90,y:x-15},data:t,draggable:!1}),i.push({id:`e-${s}`,source:"router",sourceHandle:m,target:s,targetHandle:n,animated:p,style:(o.color,r?{stroke:"#ef4444",strokeWidth:2.5,opacity:.9}:p?{stroke:"#22c55e",strokeWidth:2.5,opacity:.9}:q?{stroke:"#f59e0b",strokeWidth:2,opacity:.7}:{stroke:"var(--color-border)",strokeWidth:1,opacity:.3})})}),{nodes:h,edges:i}})(a,j,k,l),[a,g,h,i]),o=(0,e.useMemo)(()=>a.map(a=>a.provider).sort().join(","),[a]),p=(0,e.useRef)(null),q=(0,e.useCallback)(a=>{p.current=a,setTimeout(()=>a.fitView({padding:.3}),50)},[]);return(0,d.jsx)("div",{className:"w-full rounded-lg border border-border bg-bg-subtle/30",style:{height:480},children:0===a.length?(0,d.jsx)("div",{className:"h-full flex items-center justify-center text-text-muted text-sm",children:"No providers connected"}):(0,d.jsx)(s.Gc,{nodes:m,edges:n,nodeTypes:x,fitView:!0,fitViewOptions:{padding:.3},onInit:q,proOptions:{hideAttribution:!0},panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1},o)})}y.propTypes={providers:j().arrayOf(j().shape({id:j().string,provider:j().string,name:j().string})),activeRequests:j().arrayOf(j().shape({provider:j().string,model:j().string,account:j().string})),lastProvider:j().string,errorProvider:j().string};var z=c(14190);function A({timestamp:a}){let b,[,c]=(0,e.useState)(0);return(0,d.jsx)(d.Fragment,{children:(b=Math.floor((Date.now()-new Date(a))/1e3))<60?`${b}s ago`:b<3600?`${Math.floor(b/60)}m ago`:b<86400?`${Math.floor(b/3600)}h ago`:`${Math.floor(b/86400)}d ago`})}function B({requests:a=[]}){return(0,d.jsxs)(h.default,{className:"flex flex-col overflow-hidden",padding:"sm",style:{height:480},children:[(0,d.jsx)("div",{className:"px-1 py-2 border-b border-border shrink-0",children:(0,d.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Recent Requests"})}),a.length?(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,d.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg z-10",children:(0,d.jsxs)("tr",{className:"border-b border-border",children:[(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted w-2"}),(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"API Key"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=!a.status||"ok"===a.status||"success"===a.status;return(0,d.jsxs)("tr",{className:"hover:bg-bg-subtle transition-colors",children:[(0,d.jsx)("td",{className:"py-1.5",children:(0,d.jsx)("span",{className:`block w-1.5 h-1.5 rounded-full ${c?"bg-success":"bg-error"}`})}),(0,d.jsx)("td",{className:"py-1.5 font-mono truncate max-w-[120px]",title:a.model,children:a.model}),(0,d.jsx)("td",{className:"py-1.5 truncate max-w-[100px] text-text-muted",title:a.keyName,children:a.keyName||"—"}),(0,d.jsxs)("td",{className:"py-1.5 text-right whitespace-nowrap",children:[(0,d.jsxs)("span",{className:"text-primary",children:[m(a.promptTokens),"↑"]})," ",(0,d.jsxs)("span",{className:"text-success",children:[m(a.completionTokens),"↓"]})]}),(0,d.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,d.jsx)(A,{timestamp:a.timestamp})})]},b)})})]})}):(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function C(a,b={},c,d){return Object.entries(a||{}).map(([a,c])=>{let d=(c.promptTokens||0)+(c.completionTokens||0),e=c.cost||0,f=d>0?(c.promptTokens||0)*(e/d):0,g=d>0?(c.completionTokens||0)*(e/d):0;return{...c,key:a,totalTokens:d,totalCost:e,inputCost:f,outputCost:g,pending:b[a]||0}}).sort((a,b)=>{let e=a[c],f=b[c];return("string"==typeof e&&(e=e.toLowerCase()),"string"==typeof f&&(f=f.toLowerCase()),e<f)?"asc"===d?-1:1:e>f?"asc"===d?1:-1:0})}function D(a,b){if(!Array.isArray(a))return[];let c={};return a.forEach(a=>{let d=function(a,b){switch(b){case"rawModel":return a.rawModel||"Unknown Model";case"accountName":return a.accountName||`Account ${a.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":return a.keyName||"Unknown Key";case"endpoint":return a.endpoint||"Unknown Endpoint";default:return a[b]||"Unknown"}}(a,b);c[d]||(c[d]={groupKey:d,summary:{requests:0,promptTokens:0,completionTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let e=c[d].summary;e.requests+=a.requests||0,e.promptTokens+=a.promptTokens||0,e.completionTokens+=a.completionTokens||0,e.totalTokens+=a.totalTokens||0,e.cost+=a.cost||0,e.inputCost+=a.inputCost||0,e.outputCost+=a.outputCost||0,e.pending+=a.pending||0,a.lastUsed&&(!e.lastUsed||new Date(a.lastUsed)>new Date(e.lastUsed))&&(e.lastUsed=a.lastUsed),c[d].items.push(a)}),Object.values(c)}let E=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],F=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"accountName",label:"Account"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],G=[{field:"keyName",label:"API Key Name"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],H=[{field:"endpoint",label:"Endpoint"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],I=[{value:"model",label:"Usage by Model"},{value:"account",label:"Usage by Account"},{value:"apiKey",label:"Usage by API Key"},{value:"endpoint",label:"Usage by Endpoint"}],J=[{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function K(){let a=(0,f.useRouter)(),b=(0,f.useSearchParams)(),c=b.get("sortBy")||"rawModel",h=b.get("sortOrder")||"asc",[i,j]=(0,e.useState)(null),[k,n]=(0,e.useState)(!0),[p,q]=(0,e.useState)(!1),[s,t]=(0,e.useState)("model"),[u,v]=(0,e.useState)([]),[w,x]=(0,e.useState)("7d"),A=(0,e.useCallback)((c,d)=>{let e=new URLSearchParams(b.toString());e.get("sortBy")===d?e.set("sortOrder","asc"===e.get("sortOrder")?"desc":"asc"):(e.set("sortBy",d),e.set("sortOrder","asc")),a.replace(`?${e.toString()}`,{scroll:!1})},[b,a]),K=(0,e.useMemo)(()=>{if(!i)return null;switch(s){case"model":{let a=i.pending?.byModel||{};return{columns:E,groupedData:D(C(i.byModel,a,c,h),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(g.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.lastUsed)})]})}}case"account":{let a={};return i?.pending?.byAccount&&Object.entries(i.byAccount||{}).forEach(([b,c])=>{let d=i.pending.byAccount[c.connectionId];if(d){let e=c.provider?`${c.rawModel} (${c.provider})`:c.rawModel;a[b]=d[e]||0}}),{columns:F,groupedData:D(C(i.byAccount,a,c,h),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.accountName||`Account ${a.connectionId?.slice(0,8)}...`}),(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(g.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.lastUsed)})]})}}case"apiKey":return{columns:G,groupedData:D(C(i.byApiKey,{},c,h),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium",children:a.keyName}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(g.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.lastUsed)})]})};default:return{columns:H,groupedData:D(C(i.byEndpoint,{},c,h),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:a.endpoint}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(g.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.lastUsed)})]})}}},[i,s,c,h]);if(!i&&!k)return(0,d.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let L=(0,d.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 self-end",children:[(0,d.jsx)("div",{className:"flex items-center gap-1 bg-bg-subtle rounded-lg p-1 border border-border",children:J.map(a=>(0,d.jsx)("button",{onClick:()=>x(a.value),disabled:p,className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${w===a.value?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:a.label},a.value))}),p&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),k?L:(0,d.jsx)(l,{stats:i}),k?L:(0,d.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[2fr_1fr] gap-2 items-stretch",children:[(0,d.jsx)(y,{providers:u,activeRequests:i.activeRequests||[],lastProvider:i.recentRequests?.[0]?.provider||"",errorProvider:i.errorProvider||""}),(0,d.jsx)(B,{requests:i.recentRequests||[]})]}),k?L:(0,d.jsx)(z.A,{period:w}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("div",{className:"flex items-center justify-between",children:(0,d.jsx)("select",{value:s,onChange:a=>t(a.target.value),className:"px-3 py-1.5 rounded-lg border border-border bg-bg-subtle text-sm font-medium text-text focus:outline-none focus:ring-2 focus:ring-primary/50",children:I.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))})}),k?L:K&&(0,d.jsx)(r,{title:"",columns:K.columns,groupedData:K.groupedData,tableType:s,sortBy:c,sortOrder:h,onToggleSort:A,storageKey:K.storageKey,renderSummaryCells:K.renderSummaryCells,renderDetailCells:K.renderDetailCells,emptyMessage:K.emptyMessage})]})]})}},48781:(a,b,c)=>{c.d(b,{default:()=>k});var d=c(48249),e=c(2116),f=c.n(e),g=c(12020);let h=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],i=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],j=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function k(){return(0,d.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,d.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,d.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,d.jsx)("div",{className:"size-6 text-primary",children:(0,d.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,d.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,d.jsx)("span",{className:"text-xl font-bold text-text-main",children:g.vQ.name})]}),(0,d.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,d.jsxs)("div",{className:"flex gap-4",children:[(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:h.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:j.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]})]}),(0,d.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",g.vQ.name," Inc. All rights reserved."]}),(0,d.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},50377:(a,b,c)=>{c.d(b,{C:()=>e});var d=c(67484);function e(a=2e3){let[b,c]=(0,d.useState)(null),f=(0,d.useRef)(null);return{copied:b,copy:(0,d.useCallback)((b,d="default")=>{navigator.clipboard.writeText(b),c(d),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{c(null)},a)},[a])}}},50412:(a,b,c)=>{c.d(b,{Ex:()=>j.default,$n:()=>d.default,Zp:()=>g.default,Qv:()=>i.CardSkeleton,G9:()=>t.default,vE:()=>u.default,pd:()=>e.default,Mh:()=>s.default,c5:()=>q.default,uR:()=>o.default,aF:()=>h.default,rq:()=>n.default,LF:()=>m.default,gM:()=>r.default,Iz:()=>v.default,l6:()=>f.default,UW:()=>l.default,lM:()=>k.default,m_:()=>w.default,jK:()=>p.default});var d=c(99070),e=c(83552),f=c(4770),g=c(17660),h=c(95145),i=c(74812);c(25919);var j=c(75171),k=c(95514),l=c(53845);c(19308),c(42196),c(86739),c(48781);var m=c(79346),n=c(83352),o=c(39645),p=c(42507),q=c(267),r=c(91809);c(86209);var s=c(5291);c(56110);var t=c(51109),u=c(79488),v=c(91099),w=c(32971);c(85306),c(53838)},51109:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),v=async()=>{q(!0),m(null),s(!1),u(!1);try{let a=await fetch("/api/oauth/cursor/auto-import"),b=await a.json();b.found?(g(b.accessToken),k(b.machineId),s(!0)):b.windowsManual?u(!0):m(b.error||"Could not auto-detect tokens")}catch(a){m("Failed to auto-detect tokens")}finally{q(!1)}},w=async()=>{if(!f.trim())return void m("Please enter an access token");if(!j.trim())return void m("Please enter a machine ID");o(!0),m(null);try{let a=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:f.trim(),machineId:j.trim()})}),d=await a.json();if(!a.ok)throw Error(d.error||"Import failed");b?.(),c()}catch(a){m(a.message)}finally{o(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:"Connect Cursor IDE",onClose:c,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[p&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!p&&(0,d.jsxs)(d.Fragment,{children:[r&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),t&&(0,d.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,d.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Run this command in your terminal, then click ",(0,d.jsx)("strong",{children:"Retry"}),":"]}),(0,d.jsx)("pre",{className:"text-xs bg-black/10 dark:bg-white/10 rounded p-2 font-mono select-all",children:"npm i better-sqlite3 -g"}),(0,d.jsx)(h.$n,{onClick:v,variant:"outline",fullWidth:!0,children:"Retry"})]}),!r&&!t&&!l&&(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(h.pd,{value:j,onChange:a=>k(a.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),l&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:l})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:w,fullWidth:!0,disabled:n||!f.trim()||!j.trim(),children:n?"Importing...":"Import Token"}),(0,d.jsx)(h.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func.isRequired}},53838:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(49885),f=c.n(e),g=c(53845);function h({children:a}){return(0,d.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,d.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,d.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,d.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,d.jsx)(g.default,{variant:"card"})}),(0,d.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:a})]})}h.propTypes={children:f().node.isRequired}},53845:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(42118),f=c(71404);function g({className:a,variant:b="default"}){let{theme:c,toggleTheme:h,isDark:i}=(0,e.D)(),j={default:(0,f.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted","hover:bg-black/5","hover:text-text-main","transition-colors"),card:(0,f.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60","hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-md","text-text-muted-light hover:text-primary","hover:text-primary","transition-all group")};return(0,d.jsx)("button",{onClick:h,className:(0,f.cn)(j[b],a),"aria-label":`Switch to ${i?"light":"dark"} mode`,title:`Switch to ${i?"light":"dark"} mode`,children:(0,d.jsx)("span",{className:(0,f.cn)("material-symbols-outlined text-[22px]","card"===b&&"transition-transform duration-300 group-hover:rotate-12"),children:i?"light_mode":"dark_mode"})})}},56110:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,onSuccess:c,onClose:f}){let[g,k]=(0,e.useState)("loading"),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(null),{copied:t,copy:u}=(0,i.C)(),v=async()=>{try{let a;s(null);try{a=new URL(p)}catch(a){throw Error("Invalid callback URL format")}let d=a.searchParams.get("code");a.searchParams.get("state");let e=a.searchParams.get("error");if(e)throw Error(a.searchParams.get("error_description")||e);if(!d)throw Error("No authorization code found in URL");let f=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,codeVerifier:n.codeVerifier,provider:b})}),g=await f.json();if(!f.ok)throw Error(g.error);k("success"),c?.()}catch(a){s(a.message),k("error")}},w="google"===b?"Google":"GitHub";return(0,d.jsx)(h.aF,{isOpen:a,title:`Connect Kiro via ${w}`,onClose:f,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",w," authentication"]})]}),"input"===g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:l,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===t?"check":"content_copy",onClick:()=>u(l,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,d.jsx)(h.pd,{value:p,onChange:a=>q(a.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:v,fullWidth:!0,disabled:!p,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",w," has been connected."]}),(0,d.jsx)(h.$n,{onClick:f,fullWidth:!0,children:"Done"})]}),"error"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:r}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:()=>k("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}j.propTypes={isOpen:g().bool.isRequired,provider:g().oneOf(["google","github"]).isRequired,onSuccess:g().func,onClose:g().func.isRequired}},71404:(a,b,c)=>{c.d(b,{cn:()=>d});function d(...a){return a.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},74812:(a,b,c)=>{c.d(b,{CardSkeleton:()=>i,PageLoading:()=>g,Skeleton:()=>h,Spinner:()=>f,default:()=>j});var d=c(48249),e=c(71404);function f({size:a="md",className:b}){return(0,d.jsx)("span",{className:(0,e.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[a],b),children:"progress_activity"})}function g({message:a="Loading..."}){return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,d.jsx)(f,{size:"xl"}),(0,d.jsx)("p",{className:"mt-4 text-text-muted",children:a})]})}function h({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-lg bg-border",a),...b})}function i(){return(0,d.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)(h,{className:"h-4 w-24"}),(0,d.jsx)(h,{className:"size-10 rounded-lg"})]}),(0,d.jsx)(h,{className:"h-8 w-16 mb-2"}),(0,d.jsx)(h,{className:"h-3 w-20"})]})}function j({type:a="spinner",...b}){switch(a){case"page":return(0,d.jsx)(g,{...b});case"skeleton":return(0,d.jsx)(h,{...b});case"card":return(0,d.jsx)(i,{...b});default:return(0,d.jsx)(f,{...b})}}},75171:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={default:"bg-black/5 dark:bg-white/10 text-text-muted",primary:"bg-primary/10 text-primary",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},g={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function h({children:a,variant:b="default",size:c="md",dot:i=!1,icon:j,className:k}){return(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",f[b],g[c],k),children:[i&&(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full","success"===b&&"bg-green-500","warning"===b&&"bg-yellow-500","error"===b&&"bg-red-500","info"===b&&"bg-blue-500","primary"===b&&"bg-primary","default"===b&&"bg-gray-500")}),j&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:j}),a]})}},79346:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,providerInfo:c,onSuccess:f,onClose:g}){let[k,l]=(0,e.useState)("waiting"),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),y=(0,e.useRef)(null),z=(0,e.useRef)(!1),{copied:A,copy:B}=(0,i.C)(),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)("/callback?code=...");(0,e.useRef)(!1);let G=(0,e.useCallback)(async(a,c)=>{if(m)try{let d=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirectUri:m.redirectUri,codeVerifier:m.codeVerifier,state:c})}),e=await d.json();if(!d.ok)throw Error(e.error);l("success"),f?.()}catch(a){r(a.message),l("error")}},[m,b,f]),H=(0,e.useCallback)(async(a,c,d,e)=>{z.current=!1,x(!0);for(let g=0;g<60;g++){if(z.current){console.log("[OAuthModal] Polling aborted"),x(!1);return}if(await new Promise(a=>setTimeout(a,1e3*d)),z.current){console.log("[OAuthModal] Polling aborted after sleep"),x(!1);return}try{let g=await fetch(`/api/oauth/${b}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a,codeVerifier:c,extraData:e})}),h=await g.json();if(h.success){z.current=!0,l("success"),x(!1),f?.();return}if("expired_token"===h.error||"access_denied"===h.error)throw Error(h.errorDescription||h.error);"slow_down"===h.error&&(d=Math.min(d+5,30))}catch(a){r(a.message),l("error"),x(!1);return}}r("Authorization timeout"),l("error"),x(!1)},[b,f]),I=(0,e.useCallback)(async()=>{if(b)try{let a;if(r(null),["github","qwen","kiro","kimi-coding","kilocode"].includes(b)){t(!0),l("waiting");let a=await fetch(`/api/oauth/${b}/device-code`),c=await a.json();if(!a.ok)throw Error(c.error);v(c);let d=c.verification_uri_complete||c.verification_uri;d&&window.open(d,"_blank");let e="kiro"===b?{_clientId:c._clientId,_clientSecret:c._clientSecret}:null;H(c.device_code,c.codeVerifier,c.interval||5,e);return}if("codex"===b)a="http://localhost:1455/auth/callback";else{let b=window.location.port||("https:"===window.location.protocol?"443":"80");a=`http://localhost:${b}/callback`}let c=await fetch(`/api/oauth/${b}/authorize?redirect_uri=${encodeURIComponent(a)}`),d=await c.json();if(!c.ok)throw Error(d.error);n({...d,redirectUri:a}),"codex"!==b&&C?(l("waiting"),y.current=window.open(d.authUrl,"oauth_popup","width=600,height=700"),y.current||l("input")):(l("input"),window.open(d.authUrl,"_blank"))}catch(a){r(a.message),l("error")}},[b,C,H]),J=async()=>{try{r(null);let a=new URL(o),b=a.searchParams.get("code"),c=a.searchParams.get("state"),d=a.searchParams.get("error");if(d)throw Error(a.searchParams.get("error_description")||d);if(!b)throw Error("No authorization code found in URL");await G(b,c)}catch(a){r(a.message),l("error")}},K=(0,e.useCallback)(()=>{g()},[g]);return b&&c?(0,d.jsx)(h.aF,{isOpen:a,title:`Connect ${c.name}`,onClose:K,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["waiting"===k&&!s&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Waiting for Authorization"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Complete the authorization in the popup window."}),(0,d.jsx)(h.$n,{variant:"ghost",onClick:()=>l("input"),children:"Popup blocked? Enter URL manually"})]}),"waiting"===k&&s&&u&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-center py-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the URL below and enter the code:"}),(0,d.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Verification URL"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 text-sm break-all",children:u.verification_uri}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"verify_url"===A?"check":"content_copy",onClick:()=>B(u.verification_uri,"verify_url")})]})]}),(0,d.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:u.user_code}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"user_code"===A?"check":"content_copy",onClick:()=>B(u.user_code,"user_code")})]})]})]}),w&&(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"input"===k&&!s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:m?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===A?"check":"content_copy",onClick:()=>B(m?.authUrl,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser."}),(0,d.jsx)(h.pd,{value:o,onChange:a=>p(a.target.value),placeholder:E,className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:J,fullWidth:!0,disabled:!o,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:K,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===k&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",c.name," account has been connected."]}),(0,d.jsx)(h.$n,{onClick:K,fullWidth:!0,children:"Done"})]}),"error"===k&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:q}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:I,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:K,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}j.propTypes={isOpen:g().bool.isRequired,provider:g().string,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},79488:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!1),p=async()=>{if(!f.trim())return void m("Please paste your cookie");k(!0),m(null);try{let a=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:f.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"Authentication failed");o(!0),setTimeout(()=>{b?.(),q()},1500)}catch(a){m(a.message)}finally{k(!1)}},q=()=>{g(""),m(null),o(!1),c?.()};return(0,d.jsx)(h.aF,{isOpen:a,onClose:q,title:"iFlow Cookie Authentication",children:(0,d.jsx)("div",{className:"space-y-4",children:n?(0,d.jsxs)("div",{className:"text-center py-8",children:[(0,d.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,d.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,d.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,d.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,d.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,d.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,d.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,d.jsx)("li",{children:"Login to your account"}),(0,d.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,d.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,d.jsx)("li",{children:"Paste it below"})]})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:j})]}),l&&(0,d.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,d.jsx)("p",{className:"text-sm text-error",children:l})}),(0,d.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:q,disabled:j,fullWidth:!0,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:p,loading:j,fullWidth:!0,children:"Authenticate"})]})]})})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func}},83352:(a,b,c)=>{c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(95145),i=c(91431),j=c(96919);let k=[...Object.keys(j.zN),...Object.keys(j.fg)];function l({isOpen:a,onClose:b,onSelect:c,selectedModel:f,activeProviders:g=[],title:m="Select Model",modelAliases:n={}}){let[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)([]),[s,t]=(0,e.useState)([]),u=(0,e.useMemo)(()=>({...j.zN,...j.fg}),[]),v=(0,e.useMemo)(()=>{let a={};return[...new Set([...g.map(a=>a.provider)])].sort((a,b)=>{let c=k.indexOf(a),d=k.indexOf(b);return(-1===c?999:c)-(-1===d?999:d)}).forEach(b=>{let c=i.Xg[b]||b,d=u[b]||{name:b,color:"#666"},e=(0,j.mq)(b)||(0,j.gb)(b);if(d.passthroughModels){let e=Object.entries(n).filter(([,a])=>a.startsWith(`${c}/`)).map(([a,b])=>({id:b.replace(`${c}/`,""),name:a,value:b}));if(e.length>0){let f=s.find(a=>a.id===b),g=f?.name||d.name;a[b]={name:g,alias:c,color:d.color,models:e}}}else if(e){let c=g.find(a=>a.provider===b),e=s.find(a=>a.id===b),f=c?.name||e?.name||d.name,h=c?.providerSpecificData?.prefix||e?.prefix||b,i=Object.entries(n).filter(([,a])=>a.startsWith(`${b}/`)).map(([a,c])=>({id:c.replace(`${b}/`,""),name:a,value:`${h}/${c.replace(`${b}/`,"")}`})),j=i.length>0?i:[{id:`__placeholder__${b}`,name:`${h}/model-id`,value:`${h}/model-id`,isPlaceholder:!0}];a[b]={name:f,alias:h,color:d.color,models:j,isCustom:!0,hasModels:i.length>0}}else{let e=(0,i.KC)(b),f=new Set(e.map(a=>a.id)),g=Object.entries(n).filter(([a,b])=>b.startsWith(`${c}/`)&&a===b.replace(`${c}/`,"")&&!f.has(b.replace(`${c}/`,""))).map(([,a])=>{let b=a.replace(`${c}/`,"");return{id:b,name:b,value:a,isCustom:!0}}),h=[...e.map(a=>({id:a.id,name:a.name,value:`${c}/${a.id}`})),...g];h.length>0&&(a[b]={name:d.name,alias:c,color:d.color,models:h})}}),a},[g,n,u,s]),w=(0,e.useMemo)(()=>{if(!o.trim())return q;let a=o.toLowerCase();return q.filter(b=>b.name.toLowerCase().includes(a))},[q,o]),x=(0,e.useMemo)(()=>{if(!o.trim())return v;let a=o.toLowerCase(),b={};return Object.entries(v).forEach(([c,d])=>{let e=d.models.filter(b=>b.name.toLowerCase().includes(a)||b.id.toLowerCase().includes(a)),f=d.name.toLowerCase().includes(a);(e.length>0||f)&&(b[c]={...d,models:e})}),b},[v,o]),y=a=>{c(a),b(),p("")};return(0,d.jsxs)(h.default,{isOpen:a,onClose:()=>{b(),p("")},title:m,size:"md",className:"p-4!",children:[(0,d.jsx)("div",{className:"mb-3",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,d.jsx)("input",{type:"text",placeholder:"Search...",value:o,onChange:a=>p(a.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,d.jsxs)("div",{className:"max-h-[300px] overflow-y-auto space-y-3",children:[w.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",w.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:w.map(a=>{let b=f===a.name;return(0,d.jsx)("button",{onClick:()=>y({id:a.name,name:a.name,value:a.name}),className:`
|
|
1
|
+
"use strict";exports.id=412,exports.ids=[412],exports.modules={267:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(74429),g=c(51126),h=c(99258);let i=a=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}})[a]||{name:a,flag:"\uD83C\uDF10"};function j({className:a=""}){let[b,c]=(0,e.useState)("en"),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(!1),o=(0,e.useRef)(null),p=async a=>{if(a!==b&&!k){l(!0),n(!1);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:a})}),await (0,h.wn)(),c(a)}catch(a){console.error("Failed to set locale:",a)}finally{l(!1)}}};return(0,d.jsxs)("div",{className:a,children:[(0,d.jsxs)("button",{onClick:()=>n(!m),disabled:k,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,d.jsx)("span",{className:"text-xl",children:i(b).flag}),(0,d.jsx)("span",{className:"text-sm font-medium",children:i(b).name}),(0,d.jsx)("span",{className:"material-symbols-outlined text-base",children:m?"expand_less":"expand_more"})]}),m&&(0,f.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>n(!1)}),(0,d.jsxs)("div",{ref:o,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,d.jsx)("button",{onClick:()=>n(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,d.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:g.YZ.map(a=>{let c=b===a,e=i(a);return(0,d.jsxs)("button",{onClick:()=>p(a),disabled:k,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${c?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${k?"opacity-70 cursor-wait":""}`,title:e.name,children:[(0,d.jsx)("span",{className:"text-2xl",children:e.flag}),(0,d.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:e.name}),c&&(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},a)})})})]})]}),document.body)]})}},4770:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({label:a,options:b=[],value:c,onChange:g,placeholder:h="Select an option",error:i,hint:j,disabled:k=!1,required:l=!1,className:m,selectClassName:n,...o}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",m),children:[a&&(0,d.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[a,l&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsxs)("select",{value:c,onChange:g,disabled:k,className:(0,e.cn)("w-full py-2 px-3 pr-10 text-sm text-text-main","bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md appearance-none","focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none","transition-all disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",i?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"",n),...o,children:[(0,d.jsx)("option",{value:"",disabled:!0,children:h}),b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))]}),(0,d.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),i&&(0,d.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),i]}),j&&!i&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:j})]})}},5291:(a,b,c)=>{c.d(b,{default:()=>k});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(79346),i=c(86209),j=c(56110);function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:f}){let[g,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(null),q=(0,e.useCallback)((a,b)=>{"builder-id"===a?l("builder-id"):"idc"===a?(l("idc"),p(b)):"social"===a?(l("social"),n(b.provider)):"import"===a&&c?.()},[c]),r=()=>{l(null),n(null),p(null)};return g?"builder-id"===g||"idc"===g?(0,d.jsx)(h.default,{isOpen:a,provider:"kiro",providerInfo:b,onSuccess:()=>{l(null),p(null),c?.(),f?.()},onClose:r,idcConfig:o}):"social"===g&&m?(0,d.jsx)(j.default,{isOpen:a,provider:m,onSuccess:()=>{l(null),n(null),c?.(),f?.()},onClose:r}):null:(0,d.jsx)(i.default,{isOpen:a,onMethodSelect:q,onClose:f})}k.propTypes={isOpen:g().bool.isRequired,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},14190:(a,b,c)=>{c.d(b,{A:()=>r});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(80322),i=c(21621),j=c(28946),k=c(22393),l=c(54206),m=c(40369),n=c(83385),o=c(17660);let p=a=>a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a||0),q=a=>`$${(a||0).toFixed(4)}`;function r({period:a="7d"}){let[b,c]=(0,e.useState)([]),[f,g]=(0,e.useState)(!0),[s,t]=(0,e.useState)("tokens");(0,e.useCallback)(async()=>{g(!0);try{let b=await fetch(`/api/usage/chart?period=${a}`);if(b.ok){let a=await b.json();c(a)}}catch(a){console.error("Failed to fetch chart data:",a)}finally{g(!1)}},[a]);let u=b.some(a=>a.tokens>0||a.cost>0);return(0,d.jsxs)(o.default,{className:"p-4 flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h3",{className:"font-semibold text-sm text-text-muted uppercase",children:"Usage Trend"}),(0,d.jsxs)("div",{className:"flex items-center gap-1 bg-bg-subtle rounded-lg p-1 border border-border",children:[(0,d.jsx)("button",{onClick:()=>t("cost"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"cost"===s?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Cost"}),(0,d.jsx)("button",{onClick:()=>t("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===s?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),f?(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):u?(0,d.jsx)(h.u,{width:"100%",height:200,children:(0,d.jsxs)(i.Q,{data:b,margin:{top:4,right:8,left:0,bottom:0},children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,d.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,d.jsx)(j.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,d.jsx)(k.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,d.jsx)(l.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===s?p:q,width:50}),(0,d.jsx)(m.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(a,b)=>"tokens"===b?[p(a),"Tokens"]:[q(a),"Cost"]}),"tokens"===s?(0,d.jsx)(n.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,d.jsx)(n.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}r.propTypes={period:g().string}},17660:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({children:a,title:b,subtitle:c,icon:g,action:h,padding:i="md",hover:j=!1,className:k,...l}){return(0,d.jsxs)("div",{className:(0,e.cn)("bg-surface","border border-black/5 dark:border-white/5","rounded-lg shadow-sm",j&&"hover:shadow-md hover:border-primary/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[i],k),...l,children:[(b||h)&&(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[g&&(0,d.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:g})}),(0,d.jsxs)("div",{children:[b&&(0,d.jsx)("h3",{className:"text-text-main font-semibold",children:b}),c&&(0,d.jsx)("p",{className:"text-sm text-text-muted",children:c})]})]}),h]}),a]})}f.Section=function({children:a,className:b,...c}){return(0,d.jsx)("div",{className:(0,e.cn)("p-4 rounded-lg","bg-black/[0.02] dark:bg-white/[0.02]","border border-black/5 dark:border-white/5",b),...c,children:a})},f.Row=function({children:a,className:b,...c}){return(0,d.jsx)("div",{className:(0,e.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-black/5 dark:border-white/5 last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]",b),...c,children:a})},f.ListItem=function({children:a,actions:b,className:c,...f}){return(0,d.jsxs)("div",{className:(0,e.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]","transition-colors",c),...f,children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:a}),b&&(0,d.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:b})]})}},25919:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({src:a,alt:b="Avatar",name:c,size:g="md",className:h}){let i={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return a?(0,d.jsx)("div",{className:(0,e.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",i[g],h),style:{backgroundImage:`url(${a})`},role:"img","aria-label":b}):(0,d.jsx)("div",{className:(0,e.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",i[g],(a=>{if(!a)return"bg-primary";let b=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],c=a.charCodeAt(0)%b.length;return b[c]})(c),h),role:"img","aria-label":b,children:(a=>{if(!a)return"?";let b=a.split(" ");return b.length>=2?`${b[0][0]}${b[1][0]}`.toUpperCase():a.substring(0,2).toUpperCase()})(c)})}},32971:(a,b,c)=>{c.d(b,{default:()=>e});var d=c(48249);function e({text:a,children:b,position:c="top"}){return(0,d.jsxs)("div",{className:"relative inline-flex group",children:[b,(0,d.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[c]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug bg-gray-900 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-150 whitespace-normal`,children:a})]})}},39645:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(67484),f=c(95145),g=c(99070);function h({isOpen:a,onClose:b,title:c="Manual Configuration",configs:i=[]}){let[j,k]=(0,e.useState)(null),l=async(a,b)=>{try{await navigator.clipboard.writeText(a),k(b),setTimeout(()=>k(null),2e3)}catch(a){console.log("Failed to copy:",a)}};return(0,d.jsx)(f.default,{isOpen:a,onClose:b,title:c,size:"xl",children:(0,d.jsx)("div",{className:"flex flex-col gap-4",children:i.map((a,b)=>(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:a.filename}),(0,d.jsxs)(g.default,{variant:"ghost",size:"sm",onClick:()=>l(a.content,b),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:j===b?"check":"content_copy"}),j===b?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:a.content})]},b))})})}},41371:(a,b,c)=>{c.d(b,{i:()=>f});var d=c(31417);let e=0,f=(0,d.v)((a,b)=>({notifications:[],addNotification:c=>{let d=++e,f={id:d,type:c.type||"info",message:c.message,title:c.title||null,duration:c.duration??5e3,dismissible:c.dismissible??!0,createdAt:Date.now()};return a(a=>({notifications:[...a.notifications,f]})),f.duration>0&&setTimeout(()=>b().removeNotification(d),f.duration),d},removeNotification:b=>{a(a=>({notifications:a.notifications.filter(a=>a.id!==b)}))},clearAll:()=>a({notifications:[]}),success:(a,c)=>b().addNotification({type:"success",message:a,title:c}),error:(a,c)=>b().addNotification({type:"error",message:a,title:c,duration:8e3}),warning:(a,c)=>b().addNotification({type:"warning",message:a,title:c}),info:(a,c)=>b().addNotification({type:"info",message:a,title:c})}))},42118:(a,b,c)=>{c.d(b,{D:()=>i});var d=c(67484),e=c(13033);function f(a){return()=>{}}function g(){return!1}function h(){return!1}function i(){let{theme:a,setTheme:b,toggleTheme:c,initTheme:i}=(0,e.A)(),j=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,setTheme:b,toggleTheme:c,isDark:"dark"===a||"system"===a&&j}}},42196:(a,b,c)=>{c.d(b,{default:()=>r});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(2116),i=c.n(h),j=c(19099),k=c(71404),l=c(12020),m=c(99070),n=c(95145);let o=[{href:"/dashboard/employees",label:"E Dashboard",icon:"badge"},{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],p=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"}],q=[{href:"/dashboard/profile",label:"Settings",icon:"settings"}];function r({onClose:a}){let b=(0,j.usePathname)(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),y=a=>"/dashboard/endpoint"===a?"/dashboard"===b||b.startsWith("/dashboard/endpoint"):b.startsWith(a),z=async()=>{h(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(a){}h(!1),f(!1),t(!0)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("aside",{className:"flex w-72 flex-col border-r border-black/5 dark:border-white/5 bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,d.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,d.jsxs)(i(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,d.jsx)("img",{src:"/favicon.svg",alt:"iRouter",className:"size-9 rounded"}),(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:l.vQ.name}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["v",l.vQ.version]})]})]}),u&&(0,d.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",u.latestVersion]}),(0,d.jsx)("code",{className:"text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono select-all",children:"npm install -g 9router@latest"})]})]}),(0,d.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[o.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",y(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",y(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href)),(0,d.jsxs)("div",{className:"pt-4 mt-2",children:[(0,d.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"Debug"}),w&&(0,d.jsxs)(i(),{href:"/dashboard/translator",onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",y("/dashboard/translator")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",y("/dashboard/translator")?"fill-1":"group-hover:text-primary transition-colors"),children:"translate"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:"Translator"})]}),p.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",y(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",y(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href))]}),(0,d.jsxs)("div",{className:"pt-4 mt-2",children:[(0,d.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),q.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",y(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",y(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href))]})]}),(0,d.jsxs)("div",{className:"p-3 border-t border-black/5 dark:border-white/5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-surface/50 mb-2",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-6 rounded-md bg-blue-500/10 text-blue-500 shrink-0 mt-0.5",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"})}),(0,d.jsx)("div",{className:"flex flex-col",children:(0,d.jsx)("span",{className:"text-xs font-medium text-text-main leading-relaxed",children:"Service is running in terminal. You can close this web page. Shutdown will stop the service."})})]}),(0,d.jsx)(m.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>f(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})]})]}),(0,d.jsx)(n.ConfirmModal,{isOpen:c,onClose:()=>f(!1),onConfirm:z,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:g}),s&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"text-center p-8",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,d.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,d.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,d.jsx)(m.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}r.propTypes={onClose:g().func}},42507:(a,b,c)=>{c.d(b,{default:()=>K});var d=c(48249),e=c(67484),f=c(19099),g=c(75171),h=c(17660),i=c(49885),j=c.n(i);let k=a=>new Intl.NumberFormat().format(a||0);function l({stats:a}){let b;return(0,d.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,d.jsxs)(h.default,{className:"px-4 py-3 flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Requests"}),(0,d.jsx)("span",{className:"text-2xl font-bold",children:k(a.totalRequests)})]}),(0,d.jsxs)(h.default,{className:"px-4 py-3 flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Input Tokens"}),(0,d.jsx)("span",{className:"text-2xl font-bold text-primary",children:k(a.totalPromptTokens)})]}),(0,d.jsxs)(h.default,{className:"px-4 py-3 flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Output Tokens"}),(0,d.jsx)("span",{className:"text-2xl font-bold text-success",children:k(a.totalCompletionTokens)})]}),(0,d.jsxs)(h.default,{className:"px-4 py-3 flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Est. Cost"}),(0,d.jsxs)("span",{className:"text-2xl font-bold text-warning",children:["~",(b=a.totalCost,`$${(b||0).toFixed(2)}`)]}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"Estimated, not actual billing"})]})]})}l.propTypes={stats:j().object.isRequired};let m=a=>new Intl.NumberFormat().format(a||0),n=a=>`$${(a||0).toFixed(2)}`;function o(a){if(!a)return"Never";let b=Math.floor((Date.now()-new Date(a))/6e4);return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:new Date(a).toLocaleDateString()}function p({field:a,currentSort:b,currentOrder:c}){return b!==a?(0,d.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,d.jsx)("span",{className:"ml-1",children:"asc"===c?"↑":"↓"})}function q({item:a,viewMode:b,isSummary:c=!1}){return"tokens"===b?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.promptTokens?"—":m(a.promptTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.completionTokens?"—":m(a.completionTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:m(a.totalTokens)})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.inputCost?"—":n(a.inputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.outputCost?"—":n(a.outputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:n(a.totalCost||a.cost)})]})}function r({title:a,columns:b,groupedData:c,tableType:f,sortBy:g,sortOrder:i,onToggleSort:j,viewMode:k,storageKey:l,renderDetailCells:m,renderSummaryCells:n,emptyMessage:o}){let[s,t]=(0,e.useState)(new Set),u=(0,e.useCallback)(a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),v=(0,e.useMemo)(()=>"tokens"===k?[{field:"promptTokens",label:"Input Tokens"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[k]),w=b.length+v.length;return(0,d.jsxs)(h.default,{className:"overflow-hidden",children:[(0,d.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,d.jsx)("h3",{className:"font-semibold",children:a})}),(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,d.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,d.jsxs)("tr",{children:[b.map(a=>(0,d.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===a.align?"text-right":""}`,onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(p,{field:a.field,currentSort:g,currentOrder:i})]},a.field)),v.map(a=>(0,d.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(p,{field:a.field,currentSort:g,currentOrder:i})]},a.field))]})}),(0,d.jsxs)("tbody",{className:"divide-y divide-border",children:[c.map(a=>(0,d.jsxs)(e.Fragment,{children:[(0,d.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>u(a.groupKey),children:[(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${s.has(a.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,d.jsx)("span",{className:`font-medium transition-colors ${a.summary.pending>0?"text-primary":""}`,children:a.groupKey})]})}),n(a),(0,d.jsx)(q,{item:a.summary,viewMode:k,isSummary:!0})]}),s.has(a.groupKey)&&a.items.map(a=>(0,d.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[m(a),(0,d.jsx)(q,{item:a,viewMode:k})]},`detail-${a.key}`))]},a.groupKey)),0===c.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:w,className:"px-6 py-8 text-center text-text-muted",children:o})})]})]})})]})}p.propTypes={field:j().string.isRequired,currentSort:j().string.isRequired,currentOrder:j().string.isRequired},q.propTypes={item:j().object.isRequired,viewMode:j().string.isRequired,isSummary:j().bool},r.propTypes={title:j().string.isRequired,columns:j().arrayOf(j().shape({field:j().string.isRequired,label:j().string.isRequired,align:j().string})).isRequired,groupedData:j().array.isRequired,tableType:j().string.isRequired,sortBy:j().string.isRequired,sortOrder:j().string.isRequired,onToggleSort:j().func.isRequired,viewMode:j().string.isRequired,storageKey:j().string.isRequired,renderDetailCells:j().func.isRequired,renderSummaryCells:j().func.isRequired,emptyMessage:j().string.isRequired};var s=c(96103),t=c(22805);c(71763);var u=c(96919);function v({data:a}){let{label:b,color:c,imageUrl:f,textIcon:g,active:h}=a,[i,j]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"flex items-center gap-2.5 px-4 py-2.5 rounded-lg border-2 transition-all duration-300 bg-bg",style:{borderColor:h?c:"var(--color-border)",boxShadow:h?`0 0 16px ${c}40`:"none",minWidth:"150px"},children:[(0,d.jsx)(s.h7,{type:"target",position:t.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"target",position:t.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"target",position:t.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"target",position:t.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:`${c}15`},children:i?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:c},children:g}):(0,d.jsx)("img",{src:f,alt:b,className:"w-6 h-6 rounded-sm object-contain",onError:()=>j(!0)})}),(0,d.jsx)("span",{className:"text-base font-medium truncate",style:{color:h?c:"var(--color-text)"},children:b}),h&&(0,d.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,d.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:c}}),(0,d.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:c}})]})]})}function w({data:a}){return(0,d.jsxs)("div",{className:"flex items-center justify-center px-5 py-3 rounded-xl border-2 border-primary bg-primary/5 shadow-md min-w-[130px]",children:[(0,d.jsx)(s.h7,{type:"source",position:t.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"source",position:t.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"source",position:t.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(s.h7,{type:"source",position:t.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("img",{src:"/favicon.svg",alt:"iRouter",className:"w-6 h-6 mr-2"}),(0,d.jsx)("span",{className:"text-sm font-bold text-primary",children:"iRouter"}),a.activeCount>0&&(0,d.jsx)("span",{className:"ml-2 px-1.5 py-0.5 rounded-full bg-primary text-white text-xs font-bold",children:a.activeCount})]})}v.propTypes={data:j().object.isRequired},w.propTypes={data:j().object.isRequired};let x={provider:v,router:w};function y({providers:a=[],activeRequests:b=[],lastProvider:c="",errorProvider:f=""}){let g=(0,e.useMemo)(()=>b.map(a=>a.provider?.toLowerCase()).filter(Boolean).sort().join(","),[b]),h=c?.toLowerCase()||"",i=f?.toLowerCase()||"",j=(0,e.useMemo)(()=>new Set(g?g.split(","):[]),[g]),k=(0,e.useMemo)(()=>new Set(h?[h]:[]),[h]),l=(0,e.useMemo)(()=>new Set(i?[i]:[]),[i]),{nodes:m,edges:n}=(0,e.useMemo)(()=>(function(a,b,c,d){let e=a.length,f=Math.max(320,204*e/(2*Math.PI)),g=Math.max(200,.55*f);if(0===e)return{nodes:[{id:"router",type:"router",position:{x:0,y:0},data:{activeCount:0},draggable:!1}],edges:[]};let h=[],i=[];return h.push({id:"router",type:"router",position:{x:-60,y:-22},data:{activeCount:b.size},draggable:!1}),a.forEach((a,j)=>{var k,l;let m,n,o=(k=a.provider,u.Q2[k]||{color:"#6b7280",name:k}),p=b.has(a.provider?.toLowerCase()),q=!p&&c.has(a.provider?.toLowerCase()),r=!p&&d.has(a.provider?.toLowerCase()),s=`provider-${a.provider}`,t={label:(o.name!==a.provider?o.name:null)||a.name||a.provider,color:o.color||"#6b7280",imageUrl:(l=a.provider,`/providers/${l}.png`),textIcon:o.textIcon||(a.provider||"?").slice(0,2).toUpperCase(),active:p},v=-Math.PI/2+2*Math.PI*j/e,w=f*Math.cos(v),x=g*Math.sin(v);Math.abs(v+Math.PI/2)<Math.PI/4||Math.abs(v-3*Math.PI/2)<Math.PI/4?(m="top",n="bottom"):Math.abs(v-Math.PI/2)<Math.PI/4?(m="bottom",n="top"):w>0?(m="right",n="left"):(m="left",n="right"),h.push({id:s,type:"provider",position:{x:w-90,y:x-15},data:t,draggable:!1}),i.push({id:`e-${s}`,source:"router",sourceHandle:m,target:s,targetHandle:n,animated:p,style:(o.color,r?{stroke:"#ef4444",strokeWidth:2.5,opacity:.9}:p?{stroke:"#22c55e",strokeWidth:2.5,opacity:.9}:q?{stroke:"#f59e0b",strokeWidth:2,opacity:.7}:{stroke:"var(--color-border)",strokeWidth:1,opacity:.3})})}),{nodes:h,edges:i}})(a,j,k,l),[a,g,h,i]),o=(0,e.useMemo)(()=>a.map(a=>a.provider).sort().join(","),[a]),p=(0,e.useRef)(null),q=(0,e.useCallback)(a=>{p.current=a,setTimeout(()=>a.fitView({padding:.3}),50)},[]);return(0,d.jsx)("div",{className:"w-full rounded-lg border border-border bg-bg-subtle/30",style:{height:480},children:0===a.length?(0,d.jsx)("div",{className:"h-full flex items-center justify-center text-text-muted text-sm",children:"No providers connected"}):(0,d.jsx)(s.Gc,{nodes:m,edges:n,nodeTypes:x,fitView:!0,fitViewOptions:{padding:.3},onInit:q,proOptions:{hideAttribution:!0},panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1},o)})}y.propTypes={providers:j().arrayOf(j().shape({id:j().string,provider:j().string,name:j().string})),activeRequests:j().arrayOf(j().shape({provider:j().string,model:j().string,account:j().string})),lastProvider:j().string,errorProvider:j().string};var z=c(14190);function A({timestamp:a}){let b,[,c]=(0,e.useState)(0);return(0,d.jsx)(d.Fragment,{children:(b=Math.floor((Date.now()-new Date(a))/1e3))<60?`${b}s ago`:b<3600?`${Math.floor(b/60)}m ago`:b<86400?`${Math.floor(b/3600)}h ago`:`${Math.floor(b/86400)}d ago`})}function B({requests:a=[]}){return(0,d.jsxs)(h.default,{className:"flex flex-col overflow-hidden",padding:"sm",style:{height:480},children:[(0,d.jsx)("div",{className:"px-1 py-2 border-b border-border shrink-0",children:(0,d.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Recent Requests"})}),a.length?(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,d.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg z-10",children:(0,d.jsxs)("tr",{className:"border-b border-border",children:[(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted w-2"}),(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,d.jsx)("th",{className:"py-1.5 pl-3 text-left font-semibold text-text-muted",children:"API Key"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=!a.status||"ok"===a.status||"success"===a.status;return(0,d.jsxs)("tr",{className:"hover:bg-bg-subtle transition-colors",children:[(0,d.jsx)("td",{className:"py-1.5",children:(0,d.jsx)("span",{className:`block w-1.5 h-1.5 rounded-full ${c?"bg-success":"bg-error"}`})}),(0,d.jsx)("td",{className:"py-1.5 font-mono truncate max-w-[120px]",title:a.model,children:a.model}),(0,d.jsx)("td",{className:"py-1.5 pl-3 truncate max-w-[100px] text-secondary",title:a.keyName,children:a.keyName||"—"}),(0,d.jsxs)("td",{className:"py-1.5 text-right whitespace-nowrap",children:[(0,d.jsxs)("span",{className:"text-primary",children:[m(a.promptTokens),"↑"]})," ",(0,d.jsxs)("span",{className:"text-success",children:[m(a.completionTokens),"↓"]})]}),(0,d.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,d.jsx)(A,{timestamp:a.timestamp})})]},b)})})]})}):(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function C(a,b={},c,d){return Object.entries(a||{}).map(([a,c])=>{let d=(c.promptTokens||0)+(c.completionTokens||0),e=c.cost||0,f=d>0?(c.promptTokens||0)*(e/d):0,g=d>0?(c.completionTokens||0)*(e/d):0;return{...c,key:a,totalTokens:d,totalCost:e,inputCost:f,outputCost:g,pending:b[a]||0}}).sort((a,b)=>{let e=a[c],f=b[c];return("string"==typeof e&&(e=e.toLowerCase()),"string"==typeof f&&(f=f.toLowerCase()),e<f)?"asc"===d?-1:1:e>f?"asc"===d?1:-1:0})}function D(a,b){if(!Array.isArray(a))return[];let c={};return a.forEach(a=>{let d=function(a,b){switch(b){case"rawModel":return a.rawModel||"Unknown Model";case"accountName":return a.accountName||`Account ${a.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":return a.keyName||"Unknown Key";case"endpoint":return a.endpoint||"Unknown Endpoint";default:return a[b]||"Unknown"}}(a,b);c[d]||(c[d]={groupKey:d,summary:{requests:0,promptTokens:0,completionTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let e=c[d].summary;e.requests+=a.requests||0,e.promptTokens+=a.promptTokens||0,e.completionTokens+=a.completionTokens||0,e.totalTokens+=a.totalTokens||0,e.cost+=a.cost||0,e.inputCost+=a.inputCost||0,e.outputCost+=a.outputCost||0,e.pending+=a.pending||0,a.lastUsed&&(!e.lastUsed||new Date(a.lastUsed)>new Date(e.lastUsed))&&(e.lastUsed=a.lastUsed),c[d].items.push(a)}),Object.values(c)}let E=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],F=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"accountName",label:"Account"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],G=[{field:"keyName",label:"API Key Name"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],H=[{field:"endpoint",label:"Endpoint"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],I=[{value:"model",label:"Usage by Model"},{value:"account",label:"Usage by Account"},{value:"apiKey",label:"Usage by API Key"},{value:"endpoint",label:"Usage by Endpoint"}],J=[{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function K(){let a=(0,f.useRouter)(),b=(0,f.useSearchParams)(),c=b.get("sortBy")||"rawModel",h=b.get("sortOrder")||"asc",[i,j]=(0,e.useState)(null),[k,n]=(0,e.useState)(!0),[p,q]=(0,e.useState)(!1),[s,t]=(0,e.useState)("model"),[u,v]=(0,e.useState)([]),[w,x]=(0,e.useState)("7d"),A=(0,e.useCallback)((c,d)=>{let e=new URLSearchParams(b.toString());e.get("sortBy")===d?e.set("sortOrder","asc"===e.get("sortOrder")?"desc":"asc"):(e.set("sortBy",d),e.set("sortOrder","asc")),a.replace(`?${e.toString()}`,{scroll:!1})},[b,a]),K=(0,e.useMemo)(()=>{if(!i)return null;switch(s){case"model":{let a=i.pending?.byModel||{};return{columns:E,groupedData:D(C(i.byModel,a,c,h),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(g.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.lastUsed)})]})}}case"account":{let a={};return i?.pending?.byAccount&&Object.entries(i.byAccount||{}).forEach(([b,c])=>{let d=i.pending.byAccount[c.connectionId];if(d){let e=c.provider?`${c.rawModel} (${c.provider})`:c.rawModel;a[b]=d[e]||0}}),{columns:F,groupedData:D(C(i.byAccount,a,c,h),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.accountName||`Account ${a.connectionId?.slice(0,8)}...`}),(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(g.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.lastUsed)})]})}}case"apiKey":return{columns:G,groupedData:D(C(i.byApiKey,{},c,h),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium",children:a.keyName}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(g.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.lastUsed)})]})};default:return{columns:H,groupedData:D(C(i.byEndpoint,{},c,h),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:a.endpoint}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(g.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:m(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:o(a.lastUsed)})]})}}},[i,s,c,h]);if(!i&&!k)return(0,d.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let L=(0,d.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 self-end",children:[(0,d.jsx)("div",{className:"flex items-center gap-1 bg-bg-subtle rounded-lg p-1 border border-border",children:J.map(a=>(0,d.jsx)("button",{onClick:()=>x(a.value),disabled:p,className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${w===a.value?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:a.label},a.value))}),p&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),k?L:(0,d.jsx)(l,{stats:i}),k?L:(0,d.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[2fr_1fr] gap-2 items-stretch",children:[(0,d.jsx)(y,{providers:u,activeRequests:i.activeRequests||[],lastProvider:i.recentRequests?.[0]?.provider||"",errorProvider:i.errorProvider||""}),(0,d.jsx)(B,{requests:i.recentRequests||[]})]}),k?L:(0,d.jsx)(z.A,{period:w}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("div",{className:"flex items-center justify-between",children:(0,d.jsx)("select",{value:s,onChange:a=>t(a.target.value),className:"px-3 py-1.5 rounded-lg border border-border bg-bg-subtle text-sm font-medium text-text focus:outline-none focus:ring-2 focus:ring-primary/50",children:I.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))})}),k?L:K&&(0,d.jsx)(r,{title:"",columns:K.columns,groupedData:K.groupedData,tableType:s,sortBy:c,sortOrder:h,onToggleSort:A,storageKey:K.storageKey,renderSummaryCells:K.renderSummaryCells,renderDetailCells:K.renderDetailCells,emptyMessage:K.emptyMessage})]})]})}},48781:(a,b,c)=>{c.d(b,{default:()=>k});var d=c(48249),e=c(2116),f=c.n(e),g=c(12020);let h=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],i=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],j=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function k(){return(0,d.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,d.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,d.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,d.jsx)("div",{className:"size-6 text-primary",children:(0,d.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,d.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,d.jsx)("span",{className:"text-xl font-bold text-text-main",children:g.vQ.name})]}),(0,d.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,d.jsxs)("div",{className:"flex gap-4",children:[(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:h.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:j.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]})]}),(0,d.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",g.vQ.name," Inc. All rights reserved."]}),(0,d.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},50377:(a,b,c)=>{c.d(b,{C:()=>e});var d=c(67484);function e(a=2e3){let[b,c]=(0,d.useState)(null),f=(0,d.useRef)(null);return{copied:b,copy:(0,d.useCallback)((b,d="default")=>{navigator.clipboard.writeText(b),c(d),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{c(null)},a)},[a])}}},50412:(a,b,c)=>{c.d(b,{Ex:()=>j.default,$n:()=>d.default,Zp:()=>g.default,Qv:()=>i.CardSkeleton,G9:()=>t.default,vE:()=>u.default,pd:()=>e.default,Mh:()=>s.default,c5:()=>q.default,uR:()=>o.default,aF:()=>h.default,rq:()=>n.default,LF:()=>m.default,gM:()=>r.default,Iz:()=>v.default,l6:()=>f.default,UW:()=>l.default,lM:()=>k.default,m_:()=>w.default,jK:()=>p.default});var d=c(99070),e=c(83552),f=c(4770),g=c(17660),h=c(95145),i=c(74812);c(25919);var j=c(75171),k=c(95514),l=c(53845);c(19308),c(42196),c(86739),c(48781);var m=c(79346),n=c(83352),o=c(39645),p=c(42507),q=c(267),r=c(91809);c(86209);var s=c(5291);c(56110);var t=c(51109),u=c(79488),v=c(91099),w=c(32971);c(85306),c(53838)},51109:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),v=async()=>{q(!0),m(null),s(!1),u(!1);try{let a=await fetch("/api/oauth/cursor/auto-import"),b=await a.json();b.found?(g(b.accessToken),k(b.machineId),s(!0)):b.windowsManual?u(!0):m(b.error||"Could not auto-detect tokens")}catch(a){m("Failed to auto-detect tokens")}finally{q(!1)}},w=async()=>{if(!f.trim())return void m("Please enter an access token");if(!j.trim())return void m("Please enter a machine ID");o(!0),m(null);try{let a=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:f.trim(),machineId:j.trim()})}),d=await a.json();if(!a.ok)throw Error(d.error||"Import failed");b?.(),c()}catch(a){m(a.message)}finally{o(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:"Connect Cursor IDE",onClose:c,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[p&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!p&&(0,d.jsxs)(d.Fragment,{children:[r&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),t&&(0,d.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,d.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Run this command in your terminal, then click ",(0,d.jsx)("strong",{children:"Retry"}),":"]}),(0,d.jsx)("pre",{className:"text-xs bg-black/10 dark:bg-white/10 rounded p-2 font-mono select-all",children:"npm i better-sqlite3 -g"}),(0,d.jsx)(h.$n,{onClick:v,variant:"outline",fullWidth:!0,children:"Retry"})]}),!r&&!t&&!l&&(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(h.pd,{value:j,onChange:a=>k(a.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),l&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:l})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:w,fullWidth:!0,disabled:n||!f.trim()||!j.trim(),children:n?"Importing...":"Import Token"}),(0,d.jsx)(h.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func.isRequired}},53838:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(49885),f=c.n(e),g=c(53845);function h({children:a}){return(0,d.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,d.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,d.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,d.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,d.jsx)(g.default,{variant:"card"})}),(0,d.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:a})]})}h.propTypes={children:f().node.isRequired}},53845:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(42118),f=c(71404);function g({className:a,variant:b="default"}){let{theme:c,toggleTheme:h,isDark:i}=(0,e.D)(),j={default:(0,f.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted","hover:bg-black/5","hover:text-text-main","transition-colors"),card:(0,f.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60","hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-md","text-text-muted-light hover:text-primary","hover:text-primary","transition-all group")};return(0,d.jsx)("button",{onClick:h,className:(0,f.cn)(j[b],a),"aria-label":`Switch to ${i?"light":"dark"} mode`,title:`Switch to ${i?"light":"dark"} mode`,children:(0,d.jsx)("span",{className:(0,f.cn)("material-symbols-outlined text-[22px]","card"===b&&"transition-transform duration-300 group-hover:rotate-12"),children:i?"light_mode":"dark_mode"})})}},56110:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,onSuccess:c,onClose:f}){let[g,k]=(0,e.useState)("loading"),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(null),{copied:t,copy:u}=(0,i.C)(),v=async()=>{try{let a;s(null);try{a=new URL(p)}catch(a){throw Error("Invalid callback URL format")}let d=a.searchParams.get("code");a.searchParams.get("state");let e=a.searchParams.get("error");if(e)throw Error(a.searchParams.get("error_description")||e);if(!d)throw Error("No authorization code found in URL");let f=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,codeVerifier:n.codeVerifier,provider:b})}),g=await f.json();if(!f.ok)throw Error(g.error);k("success"),c?.()}catch(a){s(a.message),k("error")}},w="google"===b?"Google":"GitHub";return(0,d.jsx)(h.aF,{isOpen:a,title:`Connect Kiro via ${w}`,onClose:f,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",w," authentication"]})]}),"input"===g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:l,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===t?"check":"content_copy",onClick:()=>u(l,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,d.jsx)(h.pd,{value:p,onChange:a=>q(a.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:v,fullWidth:!0,disabled:!p,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",w," has been connected."]}),(0,d.jsx)(h.$n,{onClick:f,fullWidth:!0,children:"Done"})]}),"error"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:r}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:()=>k("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}j.propTypes={isOpen:g().bool.isRequired,provider:g().oneOf(["google","github"]).isRequired,onSuccess:g().func,onClose:g().func.isRequired}},71404:(a,b,c)=>{c.d(b,{cn:()=>d});function d(...a){return a.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},74812:(a,b,c)=>{c.d(b,{CardSkeleton:()=>i,PageLoading:()=>g,Skeleton:()=>h,Spinner:()=>f,default:()=>j});var d=c(48249),e=c(71404);function f({size:a="md",className:b}){return(0,d.jsx)("span",{className:(0,e.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[a],b),children:"progress_activity"})}function g({message:a="Loading..."}){return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,d.jsx)(f,{size:"xl"}),(0,d.jsx)("p",{className:"mt-4 text-text-muted",children:a})]})}function h({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-lg bg-border",a),...b})}function i(){return(0,d.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)(h,{className:"h-4 w-24"}),(0,d.jsx)(h,{className:"size-10 rounded-lg"})]}),(0,d.jsx)(h,{className:"h-8 w-16 mb-2"}),(0,d.jsx)(h,{className:"h-3 w-20"})]})}function j({type:a="spinner",...b}){switch(a){case"page":return(0,d.jsx)(g,{...b});case"skeleton":return(0,d.jsx)(h,{...b});case"card":return(0,d.jsx)(i,{...b});default:return(0,d.jsx)(f,{...b})}}},75171:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={default:"bg-black/5 dark:bg-white/10 text-text-muted",primary:"bg-primary/10 text-primary",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},g={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function h({children:a,variant:b="default",size:c="md",dot:i=!1,icon:j,className:k}){return(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",f[b],g[c],k),children:[i&&(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full","success"===b&&"bg-green-500","warning"===b&&"bg-yellow-500","error"===b&&"bg-red-500","info"===b&&"bg-blue-500","primary"===b&&"bg-primary","default"===b&&"bg-gray-500")}),j&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:j}),a]})}},79346:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,providerInfo:c,onSuccess:f,onClose:g}){let[k,l]=(0,e.useState)("waiting"),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),y=(0,e.useRef)(null),z=(0,e.useRef)(!1),{copied:A,copy:B}=(0,i.C)(),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)("/callback?code=...");(0,e.useRef)(!1);let G=(0,e.useCallback)(async(a,c)=>{if(m)try{let d=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirectUri:m.redirectUri,codeVerifier:m.codeVerifier,state:c})}),e=await d.json();if(!d.ok)throw Error(e.error);l("success"),f?.()}catch(a){r(a.message),l("error")}},[m,b,f]),H=(0,e.useCallback)(async(a,c,d,e)=>{z.current=!1,x(!0);for(let g=0;g<60;g++){if(z.current){console.log("[OAuthModal] Polling aborted"),x(!1);return}if(await new Promise(a=>setTimeout(a,1e3*d)),z.current){console.log("[OAuthModal] Polling aborted after sleep"),x(!1);return}try{let g=await fetch(`/api/oauth/${b}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a,codeVerifier:c,extraData:e})}),h=await g.json();if(h.success){z.current=!0,l("success"),x(!1),f?.();return}if("expired_token"===h.error||"access_denied"===h.error)throw Error(h.errorDescription||h.error);"slow_down"===h.error&&(d=Math.min(d+5,30))}catch(a){r(a.message),l("error"),x(!1);return}}r("Authorization timeout"),l("error"),x(!1)},[b,f]),I=(0,e.useCallback)(async()=>{if(b)try{let a;if(r(null),["github","qwen","kiro","kimi-coding","kilocode"].includes(b)){t(!0),l("waiting");let a=await fetch(`/api/oauth/${b}/device-code`),c=await a.json();if(!a.ok)throw Error(c.error);v(c);let d=c.verification_uri_complete||c.verification_uri;d&&window.open(d,"_blank");let e="kiro"===b?{_clientId:c._clientId,_clientSecret:c._clientSecret}:null;H(c.device_code,c.codeVerifier,c.interval||5,e);return}if("codex"===b)a="http://localhost:1455/auth/callback";else{let b=window.location.port||("https:"===window.location.protocol?"443":"80");a=`http://localhost:${b}/callback`}let c=await fetch(`/api/oauth/${b}/authorize?redirect_uri=${encodeURIComponent(a)}`),d=await c.json();if(!c.ok)throw Error(d.error);n({...d,redirectUri:a}),"codex"!==b&&C?(l("waiting"),y.current=window.open(d.authUrl,"oauth_popup","width=600,height=700"),y.current||l("input")):(l("input"),window.open(d.authUrl,"_blank"))}catch(a){r(a.message),l("error")}},[b,C,H]),J=async()=>{try{r(null);let a=new URL(o),b=a.searchParams.get("code"),c=a.searchParams.get("state"),d=a.searchParams.get("error");if(d)throw Error(a.searchParams.get("error_description")||d);if(!b)throw Error("No authorization code found in URL");await G(b,c)}catch(a){r(a.message),l("error")}},K=(0,e.useCallback)(()=>{g()},[g]);return b&&c?(0,d.jsx)(h.aF,{isOpen:a,title:`Connect ${c.name}`,onClose:K,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["waiting"===k&&!s&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Waiting for Authorization"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Complete the authorization in the popup window."}),(0,d.jsx)(h.$n,{variant:"ghost",onClick:()=>l("input"),children:"Popup blocked? Enter URL manually"})]}),"waiting"===k&&s&&u&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-center py-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the URL below and enter the code:"}),(0,d.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Verification URL"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 text-sm break-all",children:u.verification_uri}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"verify_url"===A?"check":"content_copy",onClick:()=>B(u.verification_uri,"verify_url")})]})]}),(0,d.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:u.user_code}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"user_code"===A?"check":"content_copy",onClick:()=>B(u.user_code,"user_code")})]})]})]}),w&&(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"input"===k&&!s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:m?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===A?"check":"content_copy",onClick:()=>B(m?.authUrl,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser."}),(0,d.jsx)(h.pd,{value:o,onChange:a=>p(a.target.value),placeholder:E,className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:J,fullWidth:!0,disabled:!o,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:K,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===k&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",c.name," account has been connected."]}),(0,d.jsx)(h.$n,{onClick:K,fullWidth:!0,children:"Done"})]}),"error"===k&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:q}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:I,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:K,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}j.propTypes={isOpen:g().bool.isRequired,provider:g().string,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},79488:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!1),p=async()=>{if(!f.trim())return void m("Please paste your cookie");k(!0),m(null);try{let a=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:f.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"Authentication failed");o(!0),setTimeout(()=>{b?.(),q()},1500)}catch(a){m(a.message)}finally{k(!1)}},q=()=>{g(""),m(null),o(!1),c?.()};return(0,d.jsx)(h.aF,{isOpen:a,onClose:q,title:"iFlow Cookie Authentication",children:(0,d.jsx)("div",{className:"space-y-4",children:n?(0,d.jsxs)("div",{className:"text-center py-8",children:[(0,d.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,d.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,d.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,d.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,d.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,d.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,d.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,d.jsx)("li",{children:"Login to your account"}),(0,d.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,d.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,d.jsx)("li",{children:"Paste it below"})]})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:j})]}),l&&(0,d.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,d.jsx)("p",{className:"text-sm text-error",children:l})}),(0,d.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:q,disabled:j,fullWidth:!0,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:p,loading:j,fullWidth:!0,children:"Authenticate"})]})]})})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func}},83352:(a,b,c)=>{c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(95145),i=c(91431),j=c(96919);let k=[...Object.keys(j.zN),...Object.keys(j.fg)];function l({isOpen:a,onClose:b,onSelect:c,selectedModel:f,activeProviders:g=[],title:m="Select Model",modelAliases:n={}}){let[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)([]),[s,t]=(0,e.useState)([]),u=(0,e.useMemo)(()=>({...j.zN,...j.fg}),[]),v=(0,e.useMemo)(()=>{let a={};return[...new Set([...g.map(a=>a.provider)])].sort((a,b)=>{let c=k.indexOf(a),d=k.indexOf(b);return(-1===c?999:c)-(-1===d?999:d)}).forEach(b=>{let c=i.Xg[b]||b,d=u[b]||{name:b,color:"#666"},e=(0,j.mq)(b)||(0,j.gb)(b);if(d.passthroughModels){let e=Object.entries(n).filter(([,a])=>a.startsWith(`${c}/`)).map(([a,b])=>({id:b.replace(`${c}/`,""),name:a,value:b}));if(e.length>0){let f=s.find(a=>a.id===b),g=f?.name||d.name;a[b]={name:g,alias:c,color:d.color,models:e}}}else if(e){let c=g.find(a=>a.provider===b),e=s.find(a=>a.id===b),f=c?.name||e?.name||d.name,h=c?.providerSpecificData?.prefix||e?.prefix||b,i=Object.entries(n).filter(([,a])=>a.startsWith(`${b}/`)).map(([a,c])=>({id:c.replace(`${b}/`,""),name:a,value:`${h}/${c.replace(`${b}/`,"")}`})),j=i.length>0?i:[{id:`__placeholder__${b}`,name:`${h}/model-id`,value:`${h}/model-id`,isPlaceholder:!0}];a[b]={name:f,alias:h,color:d.color,models:j,isCustom:!0,hasModels:i.length>0}}else{let e=(0,i.KC)(b),f=new Set(e.map(a=>a.id)),g=Object.entries(n).filter(([a,b])=>b.startsWith(`${c}/`)&&a===b.replace(`${c}/`,"")&&!f.has(b.replace(`${c}/`,""))).map(([,a])=>{let b=a.replace(`${c}/`,"");return{id:b,name:b,value:a,isCustom:!0}}),h=[...e.map(a=>({id:a.id,name:a.name,value:`${c}/${a.id}`})),...g];h.length>0&&(a[b]={name:d.name,alias:c,color:d.color,models:h})}}),a},[g,n,u,s]),w=(0,e.useMemo)(()=>{if(!o.trim())return q;let a=o.toLowerCase();return q.filter(b=>b.name.toLowerCase().includes(a))},[q,o]),x=(0,e.useMemo)(()=>{if(!o.trim())return v;let a=o.toLowerCase(),b={};return Object.entries(v).forEach(([c,d])=>{let e=d.models.filter(b=>b.name.toLowerCase().includes(a)||b.id.toLowerCase().includes(a)),f=d.name.toLowerCase().includes(a);(e.length>0||f)&&(b[c]={...d,models:e})}),b},[v,o]),y=a=>{c(a),b(),p("")};return(0,d.jsxs)(h.default,{isOpen:a,onClose:()=>{b(),p("")},title:m,size:"md",className:"p-4!",children:[(0,d.jsx)("div",{className:"mb-3",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,d.jsx)("input",{type:"text",placeholder:"Search...",value:o,onChange:a=>p(a.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,d.jsxs)("div",{className:"max-h-[300px] overflow-y-auto space-y-3",children:[w.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",w.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:w.map(a=>{let b=f===a.name;return(0,d.jsx)("button",{onClick:()=>y({id:a.name,name:a.name,value:a.name}),className:`
|
|
2
2
|
px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
|
|
3
3
|
${b?"bg-primary text-white border-primary":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
|
|
4
4
|
`,children:a.name},a.id)})})]}),Object.entries(x).map(([a,b])=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:b.color}}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:b.name}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",b.models.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.models.map(a=>{let b=f===a.value,c=a.isPlaceholder;return(0,d.jsx)("button",{onClick:()=>y(a),title:c?"Select to pre-fill, then edit model ID in the input":void 0,className:`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";exports.id=4989,exports.ids=[4989],exports.modules={47370:(a,b,c)=>{c.d(b,{BY:()=>F,E5:()=>B,SL:()=>n.getRequestDetails,Zx:()=>C,_V:()=>w,calculateCost:()=>D,getUsageDb:()=>z,j$:()=>G,ox:()=>n.o,rg:()=>y,sZ:()=>A,uw:()=>x});var d=c(82996),e=c(11259),f=c(94735),g=c(33873),h=c.n(g),i=c(21820),j=c.n(i),k=c(29021),l=c.n(k),m=c(1932),n=c(90336);let o="u">typeof caches||"object"==typeof caches,p=function(){if(o)return"/tmp";if(process.env.DATA_DIR)return process.env.DATA_DIR;try{let a=process.platform,b=j().homedir(),c=function(){if(o)return"9router";let a=h().dirname((0,m.fileURLToPath)("file:///Users/nip/Desktop/WORKSPACE/iCheck/iCheck.AI.Workflows/9router/src/lib/usageDb.js")),b=h().resolve(a,"../../../package.json");try{let a=JSON.parse(l().readFileSync(b,"utf-8"));return a.config?.appName||"9router"}catch{return"9router"}}();if("win32"===a)return h().join(process.env.APPDATA||h().join(b,"AppData","Roaming"),c);return h().join(b,`.${c}`)}catch(a){return console.error("[usageDb] Failed to get user data directory:",a.message),h().join(process.cwd(),".9router")}}(),q=o?null:h().join(p,"usage.json"),r=o?null:h().join(p,"log.txt");if(!o&&l()&&"function"==typeof l().existsSync)try{l().existsSync(p)||(l().mkdirSync(p,{recursive:!0}),console.log(`[usageDb] Created data directory: ${p}`))}catch(a){console.error("[usageDb] Failed to create data directory:",a.message)}let s={history:[]},t=null;global._pendingRequests||(global._pendingRequests={byModel:{},byAccount:{}});let u=global._pendingRequests;global._lastErrorProvider||(global._lastErrorProvider={provider:"",ts:0});let v=global._lastErrorProvider;global._statsEmitter||(global._statsEmitter=new f.EventEmitter,global._statsEmitter.setMaxListeners(50));let w=global._statsEmitter;function x(a,b,c,d,e=!1){let f=b?`${a} (${b})`:a;u.byModel[f]||(u.byModel[f]=0),u.byModel[f]=Math.max(0,u.byModel[f]+(d?1:-1)),c&&(u.byAccount[c]||(u.byAccount[c]={}),u.byAccount[c][f]||(u.byAccount[c][f]=0),u.byAccount[c][f]=Math.max(0,u.byAccount[c][f]+(d?1:-1))),!d&&e&&b&&(v.provider=b.toLowerCase(),v.ts=Date.now());let g=new Date().toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});console.log(`[${g}] [PENDING] ${d?"START":"END"}${e?" (ERROR)":""} | provider=${b} | model=${a}`),w.emit("pending")}async function y(){let a=[],b={};try{let{getProviderConnections:a}=await Promise.all([c.e(9718),c.e(4755)]).then(c.bind(c,89718));for(let c of(await a()))b[c.id]=c.name||c.email||c.id}catch{}for(let[c,d]of Object.entries(u.byAccount))for(let[e,f]of Object.entries(d))if(f>0){let d=b[c]||`Account ${c.slice(0,8)}...`,g=e.match(/^(.*) \((.*)\)$/),h=g?g[1]:e,i=g?g[2]:"unknown";a.push({model:h,provider:i,account:d,count:f})}let d=await z();await d.read();let e=d.data.history||[],f={};try{let{getApiKeys:a}=await Promise.all([c.e(9718),c.e(4755)]).then(c.bind(c,89718));for(let b of(await a()))f[b.key]=b.name||b.key.slice(0,8)+"..."}catch{}let g=new Set;return{activeRequests:a,recentRequests:[...e].sort((a,b)=>new Date(b.timestamp)-new Date(a.timestamp)).map(a=>{let b=a.tokens||{},c=b.prompt_tokens||b.input_tokens||0,d=b.completion_tokens||b.output_tokens||0,e=a.apiKey?f[a.apiKey]||a.apiKey.slice(0,8)+"...":"Local";return{timestamp:a.timestamp,model:a.model,provider:a.provider||"",promptTokens:c,completionTokens:d,status:a.status||"ok",keyName:e}}).filter(a=>{if(0===a.promptTokens&&0===a.completionTokens)return!1;let b=a.timestamp?a.timestamp.slice(0,16):"",c=`${a.model}|${a.provider}|${a.promptTokens}|${a.completionTokens}|${b}`;return!g.has(c)&&(g.add(c),!0)}).slice(0,20),errorProvider:Date.now()-v.ts<1e4?v.provider:""}}async function z(){if(o)return t||((t=new d.t({read:async()=>{},write:async()=>{}},s)).data=s),t;if(!t){let a=new e.Pv(q);t=new d.t(a,s);try{await t.read()}catch(a){if(a instanceof SyntaxError)console.warn("[DB] Corrupt Usage JSON detected, resetting to defaults..."),t.data=s,await t.write();else throw a}t.data||(t.data=s,await t.write())}return t}async function A(a){if(!o)try{let b=await z();a.timestamp||(a.timestamp=new Date().toISOString()),Array.isArray(b.data.history)||(b.data.history=[]);let c=await D(a.provider,a.model,a.tokens);if(a.cost=c,b.data.history.push(a),"number"!=typeof b.data.totalRequestCounter?b.data.totalRequestCounter=b.data.history.length:b.data.totalRequestCounter+=1,b.data.history.length>
|
|
1
|
+
"use strict";exports.id=4989,exports.ids=[4989],exports.modules={47370:(a,b,c)=>{c.d(b,{BY:()=>F,E5:()=>B,SL:()=>n.getRequestDetails,Zx:()=>C,_V:()=>w,calculateCost:()=>D,getUsageDb:()=>z,j$:()=>G,ox:()=>n.o,rg:()=>y,sZ:()=>A,uw:()=>x});var d=c(82996),e=c(11259),f=c(94735),g=c(33873),h=c.n(g),i=c(21820),j=c.n(i),k=c(29021),l=c.n(k),m=c(1932),n=c(90336);let o="u">typeof caches||"object"==typeof caches,p=function(){if(o)return"/tmp";if(process.env.DATA_DIR)return process.env.DATA_DIR;try{let a=process.platform,b=j().homedir(),c=function(){if(o)return"9router";let a=h().dirname((0,m.fileURLToPath)("file:///Users/nip/Desktop/WORKSPACE/iCheck/iCheck.AI.Workflows/9router/src/lib/usageDb.js")),b=h().resolve(a,"../../../package.json");try{let a=JSON.parse(l().readFileSync(b,"utf-8"));return a.config?.appName||"9router"}catch{return"9router"}}();if("win32"===a)return h().join(process.env.APPDATA||h().join(b,"AppData","Roaming"),c);return h().join(b,`.${c}`)}catch(a){return console.error("[usageDb] Failed to get user data directory:",a.message),h().join(process.cwd(),".9router")}}(),q=o?null:h().join(p,"usage.json"),r=o?null:h().join(p,"log.txt");if(!o&&l()&&"function"==typeof l().existsSync)try{l().existsSync(p)||(l().mkdirSync(p,{recursive:!0}),console.log(`[usageDb] Created data directory: ${p}`))}catch(a){console.error("[usageDb] Failed to create data directory:",a.message)}let s={history:[]},t=null;global._pendingRequests||(global._pendingRequests={byModel:{},byAccount:{}});let u=global._pendingRequests;global._lastErrorProvider||(global._lastErrorProvider={provider:"",ts:0});let v=global._lastErrorProvider;global._statsEmitter||(global._statsEmitter=new f.EventEmitter,global._statsEmitter.setMaxListeners(50));let w=global._statsEmitter;function x(a,b,c,d,e=!1){let f=b?`${a} (${b})`:a;u.byModel[f]||(u.byModel[f]=0),u.byModel[f]=Math.max(0,u.byModel[f]+(d?1:-1)),c&&(u.byAccount[c]||(u.byAccount[c]={}),u.byAccount[c][f]||(u.byAccount[c][f]=0),u.byAccount[c][f]=Math.max(0,u.byAccount[c][f]+(d?1:-1))),!d&&e&&b&&(v.provider=b.toLowerCase(),v.ts=Date.now());let g=new Date().toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});console.log(`[${g}] [PENDING] ${d?"START":"END"}${e?" (ERROR)":""} | provider=${b} | model=${a}`),w.emit("pending")}async function y(){let a=[],b={};try{let{getProviderConnections:a}=await Promise.all([c.e(9718),c.e(4755)]).then(c.bind(c,89718));for(let c of(await a()))b[c.id]=c.name||c.email||c.id}catch{}for(let[c,d]of Object.entries(u.byAccount))for(let[e,f]of Object.entries(d))if(f>0){let d=b[c]||`Account ${c.slice(0,8)}...`,g=e.match(/^(.*) \((.*)\)$/),h=g?g[1]:e,i=g?g[2]:"unknown";a.push({model:h,provider:i,account:d,count:f})}let d=await z();await d.read();let e=d.data.history||[],f={};try{let{getApiKeys:a}=await Promise.all([c.e(9718),c.e(4755)]).then(c.bind(c,89718));for(let b of(await a()))f[b.key]=b.name||b.key.slice(0,8)+"..."}catch{}let g=new Set;return{activeRequests:a,recentRequests:[...e].sort((a,b)=>new Date(b.timestamp)-new Date(a.timestamp)).map(a=>{let b=a.tokens||{},c=b.prompt_tokens||b.input_tokens||0,d=b.completion_tokens||b.output_tokens||0,e=a.apiKey?f[a.apiKey]||a.apiKey.slice(0,8)+"...":"Local";return{timestamp:a.timestamp,model:a.model,provider:a.provider||"",promptTokens:c,completionTokens:d,status:a.status||"ok",keyName:e}}).filter(a=>{if(0===a.promptTokens&&0===a.completionTokens)return!1;let b=a.timestamp?a.timestamp.slice(0,16):"",c=`${a.model}|${a.provider}|${a.promptTokens}|${a.completionTokens}|${b}`;return!g.has(c)&&(g.add(c),!0)}).slice(0,20),errorProvider:Date.now()-v.ts<1e4?v.provider:""}}async function z(){if(o)return t||((t=new d.t({read:async()=>{},write:async()=>{}},s)).data=s),t;if(!t){let a=new e.Pv(q);t=new d.t(a,s);try{await t.read()}catch(a){if(a instanceof SyntaxError)console.warn("[DB] Corrupt Usage JSON detected, resetting to defaults..."),t.data=s,await t.write();else throw a}t.data||(t.data=s,await t.write())}return t}async function A(a){if(!o)try{let b=await z();a.timestamp||(a.timestamp=new Date().toISOString()),Array.isArray(b.data.history)||(b.data.history=[]);let c=await D(a.provider,a.model,a.tokens);if(a.cost=c,b.data.history.push(a),"number"!=typeof b.data.totalRequestCounter?b.data.totalRequestCounter=b.data.history.length:b.data.totalRequestCounter+=1,b.data.history.length>5e4){let a=b.data.history.length-5e4,c=b.data.history.splice(0,a);for(let a of(b.data.prunedStats||(b.data.prunedStats={requests:0,cost:0,promptTokens:0,completionTokens:0}),c)){b.data.prunedStats.requests+=1,b.data.prunedStats.cost+=a.cost||0;let c=a.tokens||{};b.data.prunedStats.promptTokens+=c.prompt_tokens||c.input_tokens||0,b.data.prunedStats.completionTokens+=c.completion_tokens||c.output_tokens||0}}await b.write(),w.emit("update")}catch(a){console.error("Failed to save usage stats:",a)}}async function B({model:a,provider:b,connectionId:d,tokens:e,status:f}){if(!o)try{let g=function(a=new Date){let b=a=>String(a).padStart(2,"0"),c=b(a.getDate()),d=b(a.getMonth()+1),e=a.getFullYear(),f=b(a.getHours()),g=b(a.getMinutes()),h=b(a.getSeconds());return`${c}-${d}-${e} ${f}:${g}:${h}`}(),h=b?.toUpperCase()||"-",i=d?d.slice(0,8):"-";try{let{getProviderConnections:a}=await Promise.all([c.e(9718),c.e(4755)]).then(c.bind(c,89718)),b=(await a()).find(a=>a.id===d);b&&(i=b.name||b.email||i)}catch{}let j=e?.prompt_tokens!==void 0?e.prompt_tokens:"-",k=e?.completion_tokens!==void 0?e.completion_tokens:"-",m=`${g} | ${a||"-"} | ${h} | ${i} | ${j} | ${k} | ${f}
|
|
2
2
|
`;l().appendFileSync(r,m);let n=l().readFileSync(r,"utf-8").trim().split("\n");n.length>200&&l().writeFileSync(r,n.slice(-200).join("\n")+"\n")}catch(a){console.error("Failed to append to log.txt:",a.message)}}async function C(a=200){if(o)return[];if(!l()||"function"!=typeof l().existsSync)return console.error("[usageDb] fs module not available in this environment"),[];if(!r)return console.error("[usageDb] LOG_FILE path not defined"),[];if(!l().existsSync(r))return console.log(`[usageDb] Log file does not exist: ${r}`),[];try{return l().readFileSync(r,"utf-8").trim().split("\n").slice(-a).reverse()}catch(a){return console.error("[usageDb] Failed to read log.txt:",a.message),console.error("[usageDb] LOG_FILE path:",r),[]}}async function D(a,b,d){if(!d||!a||!b)return 0;try{let{getPricingForModel:e}=await Promise.all([c.e(9718),c.e(4755)]).then(c.bind(c,89718)),f=await e(a,b);if(!f)return 0;let g=0,h=d.prompt_tokens||d.input_tokens||0,i=d.cached_tokens||d.cache_read_input_tokens||0,j=Math.max(0,h-i);if(g+=j*(f.input/1e6),i>0){let a=f.cached||f.input;g+=a/1e6*i}let k=d.completion_tokens||d.output_tokens||0;g+=k*(f.output/1e6);let l=d.reasoning_tokens||0;if(l>0){let a=f.reasoning||f.output;g+=a/1e6*l}let m=d.cache_creation_input_tokens||0;if(m>0){let a=f.cache_creation||f.input;g+=a/1e6*m}return g}catch(a){return console.error("Error calculating cost:",a),0}}let E={"24h":864e5,"7d":6048e5,"30d":2592e6,"60d":5184e6};async function F(a="all"){let b=await z(),d=b.data.history||[];if(a&&E[a]){let b=Date.now()-E[a];d=d.filter(a=>new Date(a.timestamp).getTime()>=b)}let{getProviderConnections:e,getApiKeys:f,getProviderNodes:g}=await Promise.all([c.e(9718),c.e(4755)]).then(c.bind(c,89718)),h=[];try{h=await e()}catch(a){console.warn("Could not fetch provider connections for usage stats:",a.message)}let i={};for(let a of h)i[a.id]=a.name||a.email||a.id;let j={};try{for(let a of(await g()))a.id&&a.name&&(j[a.id]=a.name)}catch{}let k=[];try{k=await f()}catch(a){console.warn("Could not fetch API keys for usage stats:",a.message)}let l={};for(let a of k)l[a.key]={name:a.name,id:a.id,createdAt:a.createdAt};let m=new Set,n=[...d].sort((a,b)=>new Date(b.timestamp)-new Date(a.timestamp)).map(a=>{let b=a.tokens||{},c=b.prompt_tokens||b.input_tokens||0,d=b.completion_tokens||b.output_tokens||0,e=a.apiKey?l[a.apiKey]?.name||a.apiKey.slice(0,8)+"...":"Local";return{timestamp:a.timestamp,model:a.model,provider:a.provider||"",promptTokens:c,completionTokens:d,status:a.status||"ok",keyName:e}}).filter(a=>{if(0===a.promptTokens&&0===a.completionTokens)return!1;let b=a.timestamp?a.timestamp.slice(0,16):"",c=`${a.model}|${a.provider}|${a.promptTokens}|${a.completionTokens}|${b}`;return!m.has(c)&&(m.add(c),!0)}).slice(0,20);b.data.prunedStats;let o={totalRequests:(!a||"all"===a||!E[a])&&b.data.totalRequestCounter||d.length,totalPromptTokens:0,totalCompletionTokens:0,totalCost:0,byProvider:{},byModel:{},byAccount:{},byApiKey:{},byEndpoint:{},last10Minutes:[],pending:u,activeRequests:[],recentRequests:n,errorProvider:Date.now()-v.ts<1e4?v.provider:""};for(let[a,b]of Object.entries(u.byAccount))for(let[c,d]of Object.entries(b))if(d>0){let b=i[a]||`Account ${a.slice(0,8)}...`,e=c.match(/^(.*) \((.*)\)$/),f=e?e[1]:c,g=e?e[2]:"unknown";o.activeRequests.push({model:f,provider:g,account:b,count:d})}let p=new Date,q=new Date(6e4*Math.floor(p.getTime()/6e4)),r=new Date(q.getTime()-54e4),s={};for(let a=0;a<10;a++){let b=new Date(q.getTime()-(9-a)*6e4).getTime();s[b]={requests:0,promptTokens:0,completionTokens:0,cost:0},o.last10Minutes.push(s[b])}for(let a of d){let b=a.tokens?.prompt_tokens||0,c=a.tokens?.completion_tokens||0,d=new Date(a.timestamp),e=a.cost||0;if(o.totalPromptTokens+=b,o.totalCompletionTokens+=c,o.totalCost+=e,d>=r&&d<=p){let a=6e4*Math.floor(d.getTime()/6e4);s[a]&&(s[a].requests++,s[a].promptTokens+=b,s[a].completionTokens+=c,s[a].cost+=e)}o.byProvider[a.provider]||(o.byProvider[a.provider]={requests:0,promptTokens:0,completionTokens:0,cost:0}),o.byProvider[a.provider].requests++,o.byProvider[a.provider].promptTokens+=b,o.byProvider[a.provider].completionTokens+=c,o.byProvider[a.provider].cost+=e;let f=a.provider?`${a.model} (${a.provider})`:a.model,g=j[a.provider]||a.provider;if(o.byModel[f]||(o.byModel[f]={requests:0,promptTokens:0,completionTokens:0,cost:0,rawModel:a.model,provider:g,lastUsed:a.timestamp}),o.byModel[f].requests++,o.byModel[f].promptTokens+=b,o.byModel[f].completionTokens+=c,o.byModel[f].cost+=e,new Date(a.timestamp)>new Date(o.byModel[f].lastUsed)&&(o.byModel[f].lastUsed=a.timestamp),a.connectionId){let d=i[a.connectionId]||`Account ${a.connectionId.slice(0,8)}...`,f=`${a.model} (${a.provider} - ${d})`;o.byAccount[f]||(o.byAccount[f]={requests:0,promptTokens:0,completionTokens:0,cost:0,rawModel:a.model,provider:g,connectionId:a.connectionId,accountName:d,lastUsed:a.timestamp}),o.byAccount[f].requests++,o.byAccount[f].promptTokens+=b,o.byAccount[f].completionTokens+=c,o.byAccount[f].cost+=e,new Date(a.timestamp)>new Date(o.byAccount[f].lastUsed)&&(o.byAccount[f].lastUsed=a.timestamp)}if(a.apiKey&&"string"==typeof a.apiKey){let d=l[a.apiKey],f=d?.name||a.apiKey.slice(0,8)+"...",h=a.apiKey,i=`${h}|${a.model}|${a.provider||"unknown"}`;o.byApiKey[i]||(o.byApiKey[i]={requests:0,promptTokens:0,completionTokens:0,cost:0,rawModel:a.model,provider:g,apiKey:a.apiKey,keyName:f,apiKeyKey:h,lastUsed:a.timestamp});let j=o.byApiKey[i];j.requests++,j.promptTokens+=b,j.completionTokens+=c,j.cost+=e,new Date(a.timestamp)>new Date(j.lastUsed)&&(j.lastUsed=a.timestamp)}else{let d="local-no-key";o.byApiKey[d]||(o.byApiKey[d]={requests:0,promptTokens:0,completionTokens:0,cost:0,rawModel:a.model,provider:g,apiKey:null,keyName:"Local (No API Key)",apiKeyKey:d,lastUsed:a.timestamp});let f=o.byApiKey[d];f.requests++,f.promptTokens+=b,f.completionTokens+=c,f.cost+=e,new Date(a.timestamp)>new Date(f.lastUsed)&&(f.lastUsed=a.timestamp)}let h=a.endpoint||"Unknown",k=`${h}|${a.model}|${a.provider||"unknown"}`;o.byEndpoint[k]||(o.byEndpoint[k]={requests:0,promptTokens:0,completionTokens:0,cost:0,endpoint:h,rawModel:a.model,provider:g,lastUsed:a.timestamp});let m=o.byEndpoint[k];m.requests++,m.promptTokens+=b,m.completionTokens+=c,m.cost+=e,new Date(a.timestamp)>new Date(m.lastUsed)&&(m.lastUsed=a.timestamp)}return o}async function G(a="7d",b=null){let c,d,e,f=(await z()).data.history||[],g=Date.now();b&&(f=f.filter(a=>a.apiKey===b)),"24h"===a?(c=24,d=36e5,e=a=>new Date(a).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})):"7d"===a?(c=7,d=864e5,e=a=>new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric"})):"30d"===a?(c=30,d=864e5,e=a=>new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric"})):(c=60,d=864e5,e=a=>new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric"}));let h=g-c*d,i=Array.from({length:c},(a,b)=>{let c=h+b*d;return{label:e(c),tokens:0,cost:0,_ts:c}});for(let a of f){let b=new Date(a.timestamp).getTime();if(b<h||b>g)continue;let e=Math.min(Math.floor((b-h)/d),c-1),f=a.tokens?.prompt_tokens||0,j=a.tokens?.completion_tokens||0;i[e].tokens+=f+j,i[e].cost+=a.cost||0}return i.map(({label:a,tokens:b,cost:c})=>({label:a,tokens:b,cost:c}))}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/
|
|
1
|
+
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/Zuy5P2lh2UzDvTuMBJHLu/_buildManifest.js","static/Zuy5P2lh2UzDvTuMBJHLu/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-1094c4a28660424b.js","static/chunks/4bd1b696-e356ca5ba0218e27.js","static/chunks/3794-bd789ebba15af837.js","static/chunks/main-app-825c409f56c59467.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/e4af272ccee01ff0-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/e4af272ccee01ff0-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/0c8e33fc14ea047b.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-1094c4a28660424b.js"/><script src="/_next/static/chunks/4bd1b696-e356ca5ba0218e27.js" async=""></script><script src="/_next/static/chunks/3794-bd789ebba15af837.js" async=""></script><script src="/_next/static/chunks/main-app-825c409f56c59467.js" async=""></script><script src="/_next/static/chunks/1a258343-4af2572c60ed5a11.js" async=""></script><script src="/_next/static/chunks/5772-81f907ca6ec17897.js" async=""></script><script src="/_next/static/chunks/6902-59c9bd4da89daa6c.js" async=""></script><script src="/_next/static/chunks/2652-5d3ad13224961c58.js" async=""></script><script src="/_next/static/chunks/5497-895f5aeae6865844.js" async=""></script><script src="/_next/static/chunks/app/(dashboard)/layout-a064f316272c9651.js" async=""></script><script src="/_next/static/chunks/app/layout-eef0e315aaedee4b.js" async=""></script><link rel="preload" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap" as="style"/><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><title>404: This page could not be found.</title><meta name="theme-color" content="#0a0a0a"/><title>iRouter - Enterprise AI Infrastructure Management</title><meta name="description" content="One endpoint for all your AI providers. Manage keys, monitor usage, and scale effortlessly."/><link rel="manifest" href="/manifest.webmanifest"/><link rel="icon" href="/favicon.ico?603d046c9a6fdfbb" type="image/x-icon" sizes="16x16"/><link rel="icon" href="/favicon.svg"/><link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap" rel="stylesheet"/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="__variable_f367f3 font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-1094c4a28660424b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[21110,[\"3862\",\"static/chunks/1a258343-4af2572c60ed5a11.js\",\"5772\",\"static/chunks/5772-81f907ca6ec17897.js\",\"6902\",\"static/chunks/6902-59c9bd4da89daa6c.js\",\"2652\",\"static/chunks/2652-5d3ad13224961c58.js\",\"5497\",\"static/chunks/5497-895f5aeae6865844.js\",\"9305\",\"static/chunks/app/(dashboard)/layout-a064f316272c9651.js\"],\"ThemeProvider\"]\n3:I[94635,[\"2652\",\"static/chunks/2652-5d3ad13224961c58.js\",\"7177\",\"static/chunks/app/layout-eef0e315aaedee4b.js\"],\"RuntimeI18nProvider\"]\n4:I[57121,[],\"\"]\n5:I[74581,[],\"\"]\n6:I[90484,[],\"OutletBoundary\"]\n7:\"$Sreact.suspense\"\na:I[90484,[],\"ViewportBoundary\"]\nc:I[90484,[],\"MetadataBoundary\"]\ne:I[27123,[],\"default\",1]\n:HL[\"/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/0c8e33fc14ea047b.css\",\"style\"]\n:HL[\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\u0026display=swap\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/0c8e33fc14ea047b.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"link\",null,{\"rel\":\"preconnect\",\"href\":\"https://fonts.googleapis.com\"}],[\"$\",\"link\",null,{\"rel\":\"preconnect\",\"href\":\"https://fonts.gstatic.com\",\"crossOrigin\":\"anonymous\"}],[\"$\",\"link\",null,{\"href\":\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\u0026display=swap\",\"rel\":\"stylesheet\"}]]}],[\"$\",\"body\",null,{\"className\":\"__variable_f367f3 font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@8\"}]}]]}],{},null,false,null]},null,false,\"$@9\"]},null,false,null],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"Zuy5P2lh2UzDvTuMBJHLu\"}\n"])</script><script>self.__next_f.push([1,"f:[]\n9:\"$Wf\"\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"2\",{\"name\":\"theme-color\",\"content\":\"#0a0a0a\"}]]\n"])</script><script>self.__next_f.push([1,"10:I[86869,[],\"IconMark\"]\n8:null\nd:[[\"$\",\"title\",\"0\",{\"children\":\"iRouter - Enterprise AI Infrastructure Management\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"One endpoint for all your AI providers. Manage keys, monitor usage, and scale effortlessly.\"}],[\"$\",\"link\",\"2\",{\"rel\":\"manifest\",\"href\":\"/manifest.webmanifest\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"3\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?603d046c9a6fdfbb\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/favicon.svg\"}],[\"$\",\"$L10\",\"5\",{}]]\n"])</script></body></html>
|