omniroute 1.4.9 → 1.4.11
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 +36 -36
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/prerender-manifest.json +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/api-manager/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/audit-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/costs/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/costs/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/health/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/limits/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/limits/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_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.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/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +4 -4
- 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 +2 -2
- 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/api/auth/login/route.js +1 -1
- package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cache/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cache/stats/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/backups/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/backups/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/cline-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/cline-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-profiles/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-profiles/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/guide-settings/[toolId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/kilo-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/status/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/status/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/metrics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route.js +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/compliance/audit-log/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/db-backups/export/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/db-backups/exportAll/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/db-backups/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/db-backups/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/evals/[suiteId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/evals/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/fallback/chains/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route.js +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/logs/console/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/availability/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/catalog/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/monitoring/health/route.js +1 -1
- package/app/.next/server/app/api/monitoring/health/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/policies/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/defaults/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-metrics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/rate-limit/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/rate-limits/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/resilience/reset/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/resilience/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/combo-defaults/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/ip-filter/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/proxy/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/proxy/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route.js +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/system-prompt/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/thinking-budget/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/storage/health/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/telemetry/summary/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/token-health/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/detect/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/analytics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/budget/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/call-logs/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/call-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/proxy-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/moderations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/rerank/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/docs/page.js +1 -1
- package/app/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/forbidden/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/forgot-password/page.js +1 -1
- package/app/.next/server/app/forgot-password/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login/page.js +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +36 -36
- package/app/.next/server/chunks/1259.js +1 -1
- package/app/.next/server/chunks/1960.js +1 -1
- package/app/.next/server/chunks/1990.js +1 -1
- package/app/.next/server/chunks/2180.js +3 -1
- package/app/.next/server/chunks/2910.js +3 -1
- package/app/.next/server/chunks/3498.js +5 -3
- package/app/.next/server/chunks/4488.js +3 -1
- package/app/.next/server/chunks/9824.js +2 -2
- package/app/.next/server/middleware.js +3 -1
- package/app/.next/server/pages/500.html +2 -2
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/chunks/{5846-756d72eb0e01a60c.js → 5846-19c878280decbd16.js} +1 -1
- package/app/.next/static/chunks/{993-961f6e199b93539a.js → 993-e3050ebfd4f5032f.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-a50474b6ebdf468a.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-012be9f38cda4c4a.js → page-ad885fdf9806e9a6.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-08f3ed204d01b6a0.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-fbe1442b61df950a.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-6b6d62c5872aee46.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-b351778975cb8622.js +4 -0
- package/app/.next/static/chunks/app/forgot-password/page-a440e0c1675842bf.js +1 -0
- package/app/.next/static/chunks/app/login/page-164f6b6b41167c5a.js +1 -0
- package/app/.next/static/css/{a0c29bb208bb9dfe.css → e90887a86e63903f.css} +1 -1
- package/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/app/package.json +1 -1
- package/package.json +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-3fcbbdb2221f0b0c.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-f256689b8410bd74.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-a5a48afa8c125ada.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-62c6fceede3a5549.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-75c8b38a55e13042.js +0 -4
- package/app/.next/static/chunks/app/forgot-password/page-057ea91c6f140e0b.js +0 -1
- package/app/.next/static/chunks/app/login/page-c1d7bfab91a7877c.js +0 -1
- /package/app/.next/static/{oaQaCPrOo77oe3OAEMAe- → g7Mie-iq39oZ7ts610YtL}/_buildManifest.js +0 -0
- /package/app/.next/static/{oaQaCPrOo77oe3OAEMAe- → g7Mie-iq39oZ7ts610YtL}/_ssgManifest.js +0 -0
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
`,children:e.name},e.id)})})]}),Object.entries(T).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:t.color}}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary",children:t.name}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",t.models.length,")"]})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(e=>{let t=l===e.value;return(0,r.jsxs)("button",{onClick:()=>I(e),className:`
|
|
19
19
|
px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
|
|
20
20
|
${t?"bg-primary text-white border-primary":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
|
|
21
|
-
`,children:[e.name,e.isCustom?" ★":""]},e.id)})})]},e)),0===Object.keys(T).length&&0===S.length&&(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,r.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}x.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object}},89938:(e,t,s)=>{s.d(t,{default:()=>j});var r=s(95155),a=s(73321),l=s(98500),n=s.n(l),i=s(5772),o=s(14051),c=s.n(o),d=s(40993),x=s(50910),m=s(12115);let u={healthy:{icon:"check_circle",color:"#22c55e",tooltip:"All tokens healthy"},warning:{icon:"warning",color:"#f59e0b",tooltip:"Some tokens need attention"},error:{icon:"error",color:"#ef4444",tooltip:"Token refresh failures detected"},unknown:{icon:"help",color:"#6b7280",tooltip:"Health status unknown"}};function p(){let e=(0,x.c)("stats"),[t,s]=(0,m.useState)(null),[a,l]=(0,m.useState)(!1);if((0,m.useEffect)(()=>{let e=async()=>{try{let e=await fetch("/api/token-health");if(e.ok){let t=await e.json();s(t)}}catch{}};e();let t=setInterval(e,6e4);return()=>clearInterval(t)},[]),!t||0===t.total)return null;let n=u[t.status]||u.unknown;return(0,r.jsxs)("div",{className:"relative",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[(0,r.jsxs)("button",{className:"flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-surface/30 transition-colors",title:n.tooltip,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:{color:n.color},children:n.icon}),t.errored>0&&(0,r.jsx)("span",{className:"text-xs font-medium",style:{color:n.color},children:t.errored})]}),a&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-1 z-50 min-w-[200px] p-3 rounded-lg shadow-lg",style:{background:"rgba(15, 15, 25, 0.95)",border:"1px solid rgba(255,255,255,0.1)",backdropFilter:"blur(12px)"},children:[(0,r.jsx)("p",{className:"text-xs font-medium text-text-main mb-2",children:e("tokenHealth")}),(0,r.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{className:"text-text-muted",children:e("totalOAuth")}),(0,r.jsx)("span",{className:"text-text-main",children:t.total})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{className:"text-emerald-400",children:e(">healthy</")}),(0,r.jsx)("span",{className:"text-text-main",children:t.healthy})]}),t.errored>0&&(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{className:"text-red-400",children:e(">errored</")}),(0,r.jsx)("span",{className:"text-text-main",children:t.errored})]}),t.warning>0&&(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{className:"text-amber-400",children:e(">warning</")}),(0,r.jsx)("span",{className:"text-text-main",children:t.warning})]}),t.lastCheckAt&&(0,r.jsxs)("div",{className:"flex justify-between mt-1 pt-1 border-t border-white/5",children:[(0,r.jsx)("span",{className:"text-text-muted",children:e("lastCheck")}),(0,r.jsx)("span",{className:"text-text-muted",children:new Date(t.lastCheckAt).toLocaleTimeString()})]})]})]})]})}let h=[{code:"en",label:"EN",name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},{code:"pt-BR",label:"PT-BR",name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"}],b="NEXT_LOCALE";var f=s(33418);function g(){let e=(0,f.Ym)(),t=(0,a.useRouter)(),[s,l]=(0,m.useState)(!1),n=(0,m.useRef)(null),i=h.find(t=>t.code===e)||h[0];return(0,m.useEffect)(()=>{let e=e=>{n.current&&!n.current.contains(e.target)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,r.jsxs)("div",{ref:n,className:"relative",children:[(0,r.jsxs)("button",{onClick:()=>l(!s),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-sm font-medium text-text-main hover:bg-surface-hover transition-all border border-transparent hover:border-border",title:i.name,children:[(0,r.jsx)("span",{className:"text-base leading-none",children:i.flag}),(0,r.jsx)("span",{className:"text-xs font-semibold tracking-wide",children:i.label}),(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px] text-text-muted transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,r.jsx)("div",{className:"absolute right-0 top-full mt-1 w-40 rounded-xl border border-border bg-bg shadow-xl z-50 overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150",children:h.map(s=>(0,r.jsxs)("button",{onClick:()=>(s=>{if(s===e)return void l(!1);document.cookie=`${b}=${s};path=/;max-age=31536000;samesite=lax`;try{localStorage.setItem(b,s)}catch{}l(!1),t.refresh()})(s.code),className:`w-full flex items-center gap-2.5 px-3 py-2.5 text-sm transition-colors ${s.code===e?"bg-primary/10 text-primary font-semibold":"text-text-main hover:bg-surface-hover"}`,children:[(0,r.jsx)("span",{className:"text-base leading-none",children:s.flag}),(0,r.jsx)("span",{className:"flex-1 text-left",children:s.name}),s.code===e&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check"})]},s.code))})]})}var y=s(20909);function j({onMenuClick:e,showMenuButton:t=!0}){let s=(0,a.usePathname)(),l=(0,a.useRouter)(),o=(0,x.c)("header"),{title:c,description:m,breadcrumbs:u}=function(e){let t=(0,x.c)("header");if(!e)return{title:"",description:"",breadcrumbs:[]};let s=e.match(/\/providers\/([^/]+)$/);if(s){let e=s[1],r=y.zN[e]||y.IS[e]||y.fg[e];if(r)return{title:r.name,description:"",breadcrumbs:[{label:t("providers"),href:"/dashboard/providers"},{label:r.name,image:`/providers/${r.id}.png`}]};if(e.startsWith(y.JH))return{title:t("openaiCompatible"),description:"",breadcrumbs:[{label:t("providers"),href:"/dashboard/providers"},{label:t("openaiCompatible"),image:"/providers/oai-cc.png"}]};if(e.startsWith(y.DI))return{title:t("anthropicCompatible"),description:"",breadcrumbs:[{label:t("providers"),href:"/dashboard/providers"},{label:t("anthropicCompatible"),image:"/providers/anthropic-m.png"}]}}return e.includes("/providers")?{title:t("providers"),description:t("providerDescription"),breadcrumbs:[]}:e.includes("/combos")?{title:t("combos"),description:t("comboDescription"),breadcrumbs:[]}:e.includes("/usage")?{title:t("usage"),description:t("usageDescription"),breadcrumbs:[]}:e.includes("/analytics")?{title:t("analytics"),description:t("analyticsDescription"),breadcrumbs:[]}:e.includes("/cli-tools")?{title:t("cliTools"),description:t("cliToolsDescription"),breadcrumbs:[]}:"/dashboard"===e?{title:t("home"),description:t("homeDescription"),breadcrumbs:[]}:e.includes("/endpoint")?{title:t("endpoint"),description:t("endpointDescription"),breadcrumbs:[]}:e.includes("/profile")?{title:t("settings"),description:t("settingsDescription"),breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}}(s),h=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(l.push("/login"),l.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,r.jsxs)("header",{className:"flex items-center justify-between px-8 py-5 border-b border-black/5 dark:border-white/5 bg-bg/80 backdrop-blur-xl z-10 sticky top-0",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden",children:t&&(0,r.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,r.jsx)("div",{className:"hidden lg:flex flex-col",children:u.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:u.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,r.jsx)(n(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,r.jsx)(i.default,{src:e.image,alt:e.label,width:28,height:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",sizes:"28px",onError:e=>{e.currentTarget.style.display="none"}}),(0,r.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:e.label})]})]},`${e.label}-${e.href||"current"}`))}):c?(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:c}),m&&(0,r.jsx)("p",{className:"text-sm text-text-muted",children:m})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[(0,r.jsx)(g,{}),(0,r.jsx)(d.UW,{}),(0,r.jsx)(p,{}),(0,r.jsx)("button",{onClick:h,className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-all",title:o("logout"),children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"logout"})})]})]})}j.propTypes={onMenuClick:c().func,showMenuButton:c().bool}},91961:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(95155),a=s(12115),l=s(71361),n=s(35806);function i({isOpen:e,onClose:t,title:s="Manual Configuration",configs:i=[]}){let[o,c]=(0,a.useState)(null),d=async(e,t)=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select(),document.execCommand("copy"),document.body.removeChild(t)}c(t),setTimeout(()=>c(null),2e3)}catch(e){console.log("Failed to copy:",e)}};return(0,r.jsx)(l.default,{isOpen:e,onClose:t,title:s,size:"xl",children:(0,r.jsx)("div",{className:"flex flex-col gap-4",children:i.map((e,t)=>(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,r.jsxs)(n.default,{variant:"ghost",size:"sm",onClick:()=>d(e.content,t),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:o===t?"check":"content_copy"}),o===t?"Copied!":"Copy"]})]}),(0,r.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:e.content})]},t))})})}},92542:(e,t,s)=>{s.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>c});var r=s(95155),a=s(67040);function l({size:e="md",className:t}){return(0,r.jsx)("span",{role:"status","aria-label":"Loading",className:(0,a.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function n({message:e="Loading..."}){return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,r.jsx)(l,{size:"xl"}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function i({className:e,...t}){return(0,r.jsx)("div",{"aria-hidden":"true",className:(0,a.cn)("animate-pulse rounded-lg bg-border",e),...t})}function o(){return(0,r.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(i,{className:"h-4 w-24"}),(0,r.jsx)(i,{className:"size-10 rounded-lg"})]}),(0,r.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,r.jsx)(i,{className:"h-3 w-20"})]})}function c({type:e="spinner",...t}){switch(e){case"page":return(0,r.jsx)(n,{...t});case"skeleton":return(0,r.jsx)(i,{...t});case"card":return(0,r.jsx)(o,{...t});default:return(0,r.jsx)(l,{...t})}}},92701:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(80178),o=s(1652),c=s(18150);function d({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let[n,d]=(0,a.useState)(null),[x,m]=(0,a.useState)(null),[u,p]=(0,a.useState)(null),h=(0,a.useCallback)((e,t)=>{"builder-id"===e?d("builder-id"):"idc"===e?(d("idc"),p(t)):"social"===e?(d("social"),m(t.provider)):"import"===e&&s?.()},[s]),b=()=>{d(null),m(null),p(null)};return n?"builder-id"===n||"idc"===n?(0,r.jsx)(i.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{d(null),p(null),s?.()},onClose:b,idcConfig:u}):"social"===n&&x?(0,r.jsx)(c.default,{isOpen:e,provider:x,onSuccess:()=>{d(null),m(null),s?.()},onClose:b}):null:(0,r.jsx)(o.default,{isOpen:e,onMethodSelect:h,onClose:l})}d.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},97050:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(95155),a=s(14051),l=s.n(a),n=s(6261);function i({children:e}){return(0,r.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,r.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,r.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,r.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,r.jsx)(n.default,{variant:"card"})}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}i.propTypes={children:l().node.isRequired}},97550:(e,t,s)=>{s.d(t,{D:()=>o});var r=s(12115),a=s(76851);function l(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function n(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:s,initTheme:o}=(0,a.A)(),c=(0,r.useSyncExternalStore)(l,n,i);(0,r.useEffect)(()=>{o()},[o]),(0,r.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o();return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e,o]);let d="dark"===e||"system"===e&&c;return{theme:e,setTheme:t,toggleTheme:s,isDark:d}}},99023:(e,t,s)=>{s.d(t,{default:()=>x});var r=s(95155),a=s(50910),l=s(98500),n=s.n(l),i=s(52529);let o=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"https://github.com/diegosouzapw/OmniRoute/releases",external:!0}],c=[{label:"Documentation",href:"/docs"},{label:"API Reference",href:"/docs#api-reference"},{label:"Help Center",href:"https://github.com/diegosouzapw/OmniRoute/discussions",external:!0}],d=[{label:"About",href:"https://github.com/diegosouzapw/OmniRoute",external:!0},{label:"Blog",href:"https://github.com/diegosouzapw/OmniRoute/releases",external:!0},{label:"Contact",href:"https://github.com/diegosouzapw/OmniRoute/issues/new/choose",external:!0},{label:"Terms",href:"/terms"},{label:"Privacy",href:"/privacy"}];function x(){let e=(0,a.c)("stats"),t=e=>e.external?(0,r.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary transition-colors",children:e.label}):(0,r.jsx)(n(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label});return(0,r.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,r.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,r.jsx)("div",{className:"size-6 text-primary",children:(0,r.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,r.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,r.jsx)("span",{className:"text-xl font-bold text-text-main",children:i.vQ.name})]}),(0,r.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,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute/discussions",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Community Discussions",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:e(">product</")}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,r.jsx)("li",{children:t(e)},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:e(">resources</")}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:c.map(e=>(0,r.jsx)("li",{children:t(e)},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:e(">company</")}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,r.jsx)("li",{children:t(e)},e.label))})]})]}),(0,r.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",i.vQ.name," Inc. All rights reserved."]}),(0,r.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,r.jsx)("a",{href:"/docs",className:"hover:text-primary transition-colors",children:"Documentation"}),(0,r.jsx)(n(),{href:"/terms",className:"hover:text-primary transition-colors",children:"Terms"}),(0,r.jsx)(n(),{href:"/privacy",className:"hover:text-primary transition-colors",children:"Privacy"}),(0,r.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute/blob/main/LICENSE",target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary transition-colors",children:"License"})]})]})]})})}},99333:(e,t,s)=>{s.d(t,{Gp:()=>l,Ie:()=>n,Kf:()=>a,RY:()=>r,Yh:()=>d,_Z:()=>c,ng:()=>o});let r={github:{bg:"#6e40c9",text:"#fff",label:"GitHub"},kiro:{bg:"#FF9900",text:"#000",label:"Kiro"},antigravity:{bg:"#4285F4",text:"#fff",label:"AG"},claude:{bg:"#D97757",text:"#fff",label:"Claude"},codex:{bg:"#10A37F",text:"#fff",label:"Codex"},gemini:{bg:"#34A853",text:"#fff",label:"Gemini"},qwen:{bg:"#6366F1",text:"#fff",label:"Qwen"},iflow:{bg:"#EC4899",text:"#fff",label:"iFlow"},fireworks:{bg:"#F97316",text:"#fff",label:"Fireworks"},kimi:{bg:"#06B6D4",text:"#fff",label:"Kimi"},"gemini-cli":{bg:"#34A853",text:"#fff",label:"Gemini CLI"}},a={openai:{bg:"#10A37F",text:"#fff",label:"OpenAI"},claude:{bg:"#D97757",text:"#fff",label:"Claude"},gemini:{bg:"#4285F4",text:"#fff",label:"Gemini"},warmup:{bg:"#F59E0B",text:"#000",label:"Warmup"},bypass:{bg:"#6B7280",text:"#fff",label:"Bypass"}},l={http:{bg:"#3B82F6",text:"#fff",label:"HTTP"},https:{bg:"#10B981",text:"#fff",label:"HTTPS"},socks5:{bg:"#8B5CF6",text:"#fff",label:"SOCKS5"}},n={key:{bg:"#F59E0B",text:"#000",label:"Key"},combo:{bg:"#8B5CF6",text:"#fff",label:"Combo"},provider:{bg:"#3B82F6",text:"#fff",label:"Provider"},global:{bg:"#6B7280",text:"#fff",label:"Global"},direct:{bg:"#374151",text:"#9CA3AF",label:"Direct"}},i=["#D97757","#60A5FA","#34D399","#A78BFA","#F472B6","#FBBF24","#38BDF8","#FB923C","#818CF8","#2DD4BF","#E879F9","#F87171","#4ADE80","#C084FC","#FB7185"];function o(e){return i[e%i.length]}function c(e){return e>=200&&e<300?{bg:"#059669",text:"#fff"}:e>=400&&e<500?{bg:"#D97706",text:"#fff"}:e>=500?{bg:"#DC2626",text:"#fff"}:0===e?{bg:"#6366F1",text:"#fff"}:{bg:"#6B7280",text:"#fff"}}function d(e){return"success"===e?{bg:"#059669",text:"#fff"}:"error"===e?{bg:"#DC2626",text:"#fff"}:"timeout"===e?{bg:"#D97706",text:"#fff"}:{bg:"#6B7280",text:"#fff"}}}}]);
|
|
21
|
+
`,children:[e.name,e.isCustom?" ★":""]},e.id)})})]},e)),0===Object.keys(T).length&&0===S.length&&(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,r.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}x.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object}},89938:(e,t,s)=>{s.d(t,{default:()=>j});var r=s(95155),a=s(73321),l=s(98500),n=s.n(l),i=s(5772),o=s(14051),c=s.n(o),d=s(40993),x=s(50910),m=s(12115);let u={healthy:{icon:"check_circle",color:"#22c55e",tooltip:"All tokens healthy"},warning:{icon:"warning",color:"#f59e0b",tooltip:"Some tokens need attention"},error:{icon:"error",color:"#ef4444",tooltip:"Token refresh failures detected"},unknown:{icon:"help",color:"#6b7280",tooltip:"Health status unknown"}};function p(){let e=(0,x.c)("stats"),[t,s]=(0,m.useState)(null),[a,l]=(0,m.useState)(!1);if((0,m.useEffect)(()=>{let e=async()=>{try{let e=await fetch("/api/token-health");if(e.ok){let t=await e.json();s(t)}}catch{}};e();let t=setInterval(e,6e4);return()=>clearInterval(t)},[]),!t||0===t.total)return null;let n=u[t.status]||u.unknown;return(0,r.jsxs)("div",{className:"relative",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[(0,r.jsxs)("button",{className:"flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-surface/30 transition-colors",title:n.tooltip,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:{color:n.color},children:n.icon}),t.errored>0&&(0,r.jsx)("span",{className:"text-xs font-medium",style:{color:n.color},children:t.errored})]}),a&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-1 z-50 min-w-[200px] p-3 rounded-lg shadow-lg",style:{background:"rgba(15, 15, 25, 0.95)",border:"1px solid rgba(255,255,255,0.1)",backdropFilter:"blur(12px)"},children:[(0,r.jsx)("p",{className:"text-xs font-medium text-text-main mb-2",children:e("tokenHealth")}),(0,r.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{className:"text-text-muted",children:e("totalOAuth")}),(0,r.jsx)("span",{className:"text-text-main",children:t.total})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{className:"text-emerald-400",children:e("healthy")}),(0,r.jsx)("span",{className:"text-text-main",children:t.healthy})]}),t.errored>0&&(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{className:"text-red-400",children:e("errored")}),(0,r.jsx)("span",{className:"text-text-main",children:t.errored})]}),t.warning>0&&(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{className:"text-amber-400",children:e("warning")}),(0,r.jsx)("span",{className:"text-text-main",children:t.warning})]}),t.lastCheckAt&&(0,r.jsxs)("div",{className:"flex justify-between mt-1 pt-1 border-t border-white/5",children:[(0,r.jsx)("span",{className:"text-text-muted",children:e("lastCheck")}),(0,r.jsx)("span",{className:"text-text-muted",children:new Date(t.lastCheckAt).toLocaleTimeString()})]})]})]})]})}let h=[{code:"en",label:"EN",name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},{code:"pt-BR",label:"PT-BR",name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"}],b="NEXT_LOCALE";var f=s(33418);function g(){let e=(0,f.Ym)(),t=(0,a.useRouter)(),[s,l]=(0,m.useState)(!1),n=(0,m.useRef)(null),i=h.find(t=>t.code===e)||h[0];return(0,m.useEffect)(()=>{let e=e=>{n.current&&!n.current.contains(e.target)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,r.jsxs)("div",{ref:n,className:"relative",children:[(0,r.jsxs)("button",{onClick:()=>l(!s),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-sm font-medium text-text-main hover:bg-surface-hover transition-all border border-transparent hover:border-border",title:i.name,children:[(0,r.jsx)("span",{className:"text-base leading-none",children:i.flag}),(0,r.jsx)("span",{className:"text-xs font-semibold tracking-wide",children:i.label}),(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px] text-text-muted transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,r.jsx)("div",{className:"absolute right-0 top-full mt-1 w-40 rounded-xl border border-border bg-bg shadow-xl z-50 overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150",children:h.map(s=>(0,r.jsxs)("button",{onClick:()=>(s=>{if(s===e)return void l(!1);document.cookie=`${b}=${s};path=/;max-age=31536000;samesite=lax`;try{localStorage.setItem(b,s)}catch{}l(!1),t.refresh()})(s.code),className:`w-full flex items-center gap-2.5 px-3 py-2.5 text-sm transition-colors ${s.code===e?"bg-primary/10 text-primary font-semibold":"text-text-main hover:bg-surface-hover"}`,children:[(0,r.jsx)("span",{className:"text-base leading-none",children:s.flag}),(0,r.jsx)("span",{className:"flex-1 text-left",children:s.name}),s.code===e&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check"})]},s.code))})]})}var y=s(20909);function j({onMenuClick:e,showMenuButton:t=!0}){let s=(0,a.usePathname)(),l=(0,a.useRouter)(),o=(0,x.c)("header"),{title:c,description:m,breadcrumbs:u}=function(e){let t=(0,x.c)("header");if(!e)return{title:"",description:"",breadcrumbs:[]};let s=e.match(/\/providers\/([^/]+)$/);if(s){let e=s[1],r=y.zN[e]||y.IS[e]||y.fg[e];if(r)return{title:r.name,description:"",breadcrumbs:[{label:t("providers"),href:"/dashboard/providers"},{label:r.name,image:`/providers/${r.id}.png`}]};if(e.startsWith(y.JH))return{title:t("openaiCompatible"),description:"",breadcrumbs:[{label:t("providers"),href:"/dashboard/providers"},{label:t("openaiCompatible"),image:"/providers/oai-cc.png"}]};if(e.startsWith(y.DI))return{title:t("anthropicCompatible"),description:"",breadcrumbs:[{label:t("providers"),href:"/dashboard/providers"},{label:t("anthropicCompatible"),image:"/providers/anthropic-m.png"}]}}return e.includes("/providers")?{title:t("providers"),description:t("providerDescription"),breadcrumbs:[]}:e.includes("/combos")?{title:t("combos"),description:t("comboDescription"),breadcrumbs:[]}:e.includes("/usage")?{title:t("usage"),description:t("usageDescription"),breadcrumbs:[]}:e.includes("/analytics")?{title:t("analytics"),description:t("analyticsDescription"),breadcrumbs:[]}:e.includes("/cli-tools")?{title:t("cliTools"),description:t("cliToolsDescription"),breadcrumbs:[]}:"/dashboard"===e?{title:t("home"),description:t("homeDescription"),breadcrumbs:[]}:e.includes("/endpoint")?{title:t("endpoint"),description:t("endpointDescription"),breadcrumbs:[]}:e.includes("/profile")?{title:t("settings"),description:t("settingsDescription"),breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}}(s),h=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(l.push("/login"),l.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,r.jsxs)("header",{className:"flex items-center justify-between px-8 py-5 border-b border-black/5 dark:border-white/5 bg-bg/80 backdrop-blur-xl z-10 sticky top-0",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden",children:t&&(0,r.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,r.jsx)("div",{className:"hidden lg:flex flex-col",children:u.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:u.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,r.jsx)(n(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,r.jsx)(i.default,{src:e.image,alt:e.label,width:28,height:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",sizes:"28px",onError:e=>{e.currentTarget.style.display="none"}}),(0,r.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:e.label})]})]},`${e.label}-${e.href||"current"}`))}):c?(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:c}),m&&(0,r.jsx)("p",{className:"text-sm text-text-muted",children:m})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[(0,r.jsx)(g,{}),(0,r.jsx)(d.UW,{}),(0,r.jsx)(p,{}),(0,r.jsx)("button",{onClick:h,className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-all",title:o("logout"),children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"logout"})})]})]})}j.propTypes={onMenuClick:c().func,showMenuButton:c().bool}},91961:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(95155),a=s(12115),l=s(71361),n=s(35806);function i({isOpen:e,onClose:t,title:s="Manual Configuration",configs:i=[]}){let[o,c]=(0,a.useState)(null),d=async(e,t)=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select(),document.execCommand("copy"),document.body.removeChild(t)}c(t),setTimeout(()=>c(null),2e3)}catch(e){console.log("Failed to copy:",e)}};return(0,r.jsx)(l.default,{isOpen:e,onClose:t,title:s,size:"xl",children:(0,r.jsx)("div",{className:"flex flex-col gap-4",children:i.map((e,t)=>(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,r.jsxs)(n.default,{variant:"ghost",size:"sm",onClick:()=>d(e.content,t),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:o===t?"check":"content_copy"}),o===t?"Copied!":"Copy"]})]}),(0,r.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:e.content})]},t))})})}},92542:(e,t,s)=>{s.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>c});var r=s(95155),a=s(67040);function l({size:e="md",className:t}){return(0,r.jsx)("span",{role:"status","aria-label":"Loading",className:(0,a.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function n({message:e="Loading..."}){return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,r.jsx)(l,{size:"xl"}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function i({className:e,...t}){return(0,r.jsx)("div",{"aria-hidden":"true",className:(0,a.cn)("animate-pulse rounded-lg bg-border",e),...t})}function o(){return(0,r.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(i,{className:"h-4 w-24"}),(0,r.jsx)(i,{className:"size-10 rounded-lg"})]}),(0,r.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,r.jsx)(i,{className:"h-3 w-20"})]})}function c({type:e="spinner",...t}){switch(e){case"page":return(0,r.jsx)(n,{...t});case"skeleton":return(0,r.jsx)(i,{...t});case"card":return(0,r.jsx)(o,{...t});default:return(0,r.jsx)(l,{...t})}}},92701:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(80178),o=s(1652),c=s(18150);function d({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let[n,d]=(0,a.useState)(null),[x,m]=(0,a.useState)(null),[u,p]=(0,a.useState)(null),h=(0,a.useCallback)((e,t)=>{"builder-id"===e?d("builder-id"):"idc"===e?(d("idc"),p(t)):"social"===e?(d("social"),m(t.provider)):"import"===e&&s?.()},[s]),b=()=>{d(null),m(null),p(null)};return n?"builder-id"===n||"idc"===n?(0,r.jsx)(i.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{d(null),p(null),s?.()},onClose:b,idcConfig:u}):"social"===n&&x?(0,r.jsx)(c.default,{isOpen:e,provider:x,onSuccess:()=>{d(null),m(null),s?.()},onClose:b}):null:(0,r.jsx)(o.default,{isOpen:e,onMethodSelect:h,onClose:l})}d.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},97050:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(95155),a=s(14051),l=s.n(a),n=s(6261);function i({children:e}){return(0,r.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,r.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,r.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,r.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,r.jsx)(n.default,{variant:"card"})}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}i.propTypes={children:l().node.isRequired}},97550:(e,t,s)=>{s.d(t,{D:()=>o});var r=s(12115),a=s(76851);function l(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function n(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:s,initTheme:o}=(0,a.A)(),c=(0,r.useSyncExternalStore)(l,n,i);(0,r.useEffect)(()=>{o()},[o]),(0,r.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o();return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e,o]);let d="dark"===e||"system"===e&&c;return{theme:e,setTheme:t,toggleTheme:s,isDark:d}}},99023:(e,t,s)=>{s.d(t,{default:()=>x});var r=s(95155),a=s(50910),l=s(98500),n=s.n(l),i=s(52529);let o=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"https://github.com/diegosouzapw/OmniRoute/releases",external:!0}],c=[{label:"Documentation",href:"/docs"},{label:"API Reference",href:"/docs#api-reference"},{label:"Help Center",href:"https://github.com/diegosouzapw/OmniRoute/discussions",external:!0}],d=[{label:"About",href:"https://github.com/diegosouzapw/OmniRoute",external:!0},{label:"Blog",href:"https://github.com/diegosouzapw/OmniRoute/releases",external:!0},{label:"Contact",href:"https://github.com/diegosouzapw/OmniRoute/issues/new/choose",external:!0},{label:"Terms",href:"/terms"},{label:"Privacy",href:"/privacy"}];function x(){let e=(0,a.c)("stats"),t=e=>e.external?(0,r.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary transition-colors",children:e.label}):(0,r.jsx)(n(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label});return(0,r.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,r.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,r.jsx)("div",{className:"size-6 text-primary",children:(0,r.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,r.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,r.jsx)("span",{className:"text-xl font-bold text-text-main",children:i.vQ.name})]}),(0,r.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,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute/discussions",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Community Discussions",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:e("product")}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,r.jsx)("li",{children:t(e)},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:e("resources")}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:c.map(e=>(0,r.jsx)("li",{children:t(e)},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:e("company")}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,r.jsx)("li",{children:t(e)},e.label))})]})]}),(0,r.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",i.vQ.name," Inc. All rights reserved."]}),(0,r.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,r.jsx)("a",{href:"/docs",className:"hover:text-primary transition-colors",children:"Documentation"}),(0,r.jsx)(n(),{href:"/terms",className:"hover:text-primary transition-colors",children:"Terms"}),(0,r.jsx)(n(),{href:"/privacy",className:"hover:text-primary transition-colors",children:"Privacy"}),(0,r.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute/blob/main/LICENSE",target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary transition-colors",children:"License"})]})]})]})})}},99333:(e,t,s)=>{s.d(t,{Gp:()=>l,Ie:()=>n,Kf:()=>a,RY:()=>r,Yh:()=>d,_Z:()=>c,ng:()=>o});let r={github:{bg:"#6e40c9",text:"#fff",label:"GitHub"},kiro:{bg:"#FF9900",text:"#000",label:"Kiro"},antigravity:{bg:"#4285F4",text:"#fff",label:"AG"},claude:{bg:"#D97757",text:"#fff",label:"Claude"},codex:{bg:"#10A37F",text:"#fff",label:"Codex"},gemini:{bg:"#34A853",text:"#fff",label:"Gemini"},qwen:{bg:"#6366F1",text:"#fff",label:"Qwen"},iflow:{bg:"#EC4899",text:"#fff",label:"iFlow"},fireworks:{bg:"#F97316",text:"#fff",label:"Fireworks"},kimi:{bg:"#06B6D4",text:"#fff",label:"Kimi"},"gemini-cli":{bg:"#34A853",text:"#fff",label:"Gemini CLI"}},a={openai:{bg:"#10A37F",text:"#fff",label:"OpenAI"},claude:{bg:"#D97757",text:"#fff",label:"Claude"},gemini:{bg:"#4285F4",text:"#fff",label:"Gemini"},warmup:{bg:"#F59E0B",text:"#000",label:"Warmup"},bypass:{bg:"#6B7280",text:"#fff",label:"Bypass"}},l={http:{bg:"#3B82F6",text:"#fff",label:"HTTP"},https:{bg:"#10B981",text:"#fff",label:"HTTPS"},socks5:{bg:"#8B5CF6",text:"#fff",label:"SOCKS5"}},n={key:{bg:"#F59E0B",text:"#000",label:"Key"},combo:{bg:"#8B5CF6",text:"#fff",label:"Combo"},provider:{bg:"#3B82F6",text:"#fff",label:"Provider"},global:{bg:"#6B7280",text:"#fff",label:"Global"},direct:{bg:"#374151",text:"#9CA3AF",label:"Direct"}},i=["#D97757","#60A5FA","#34D399","#A78BFA","#F472B6","#FBBF24","#38BDF8","#FB923C","#818CF8","#2DD4BF","#E879F9","#F87171","#4ADE80","#C084FC","#FB7185"];function o(e){return i[e%i.length]}function c(e){return e>=200&&e<300?{bg:"#059669",text:"#fff"}:e>=400&&e<500?{bg:"#D97706",text:"#fff"}:e>=500?{bg:"#DC2626",text:"#fff"}:0===e?{bg:"#6366F1",text:"#fff"}:{bg:"#6B7280",text:"#fff"}}function d(e){return"success"===e?{bg:"#059669",text:"#fff"}:"error"===e?{bg:"#DC2626",text:"#fff"}:"timeout"===e?{bg:"#D97706",text:"#fff"}:{bg:"#6B7280",text:"#fff"}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8978],{53701:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>o});var l=a(95155),n=a(12115),r=a(40993),i=a(50910),c=a(67671);let d=[{name:"contains",label:"Contains",icon:"search",color:"text-sky-400",bg:"bg-sky-500/10",description:"Checks if the response contains a specific text (case-insensitive)"},{name:"exact",label:"Exact Match",icon:"check_circle",color:"text-emerald-400",bg:"bg-emerald-500/10",description:"Response must be an exact character-for-character match"},{name:"regex",label:"Regex Pattern",icon:"code",color:"text-amber-400",bg:"bg-amber-500/10",description:"Matches response against a regular expression pattern"},{name:"custom",label:"Custom Function",icon:"tune",color:"text-violet-400",bg:"bg-violet-500/10",description:"Uses a custom function for advanced evaluation logic"}];function x(){let e=(0,i.c)("usage"),[s,a]=(0,n.useState)([]),[x,o]=(0,n.useState)(null),[p,u]=(0,n.useState)(!0),[h,g]=(0,n.useState)(null),[f,b]=(0,n.useState)({current:0,total:0}),[j,v]=(0,n.useState)({}),[N,y]=(0,n.useState)(""),[k,w]=(0,n.useState)(null),[C,S]=(0,n.useState)(!1),R=(0,c.i)(),$=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/evals");if(e.ok){let s=await e.json();a(Array.isArray(s)?s:s.suites||[])}}catch{}finally{u(!1)}},[]),E=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/keys");if(!e.ok)return;let s=await e.json(),a=s?.keys?.[0]?.key||null;o(a)}catch{}},[]);(0,n.useEffect)(()=>{$(),E()},[$,E]);let L=async e=>{try{let s={"Content-Type":"application/json"};x&&(s.Authorization=`Bearer ${x}`);let a=await fetch("/v1/chat/completions",{method:"POST",headers:s,body:JSON.stringify({model:e.model||"gpt-4o",messages:e.input?.messages||[],max_tokens:512,stream:!1})});if(!a.ok)return`[ERROR: HTTP ${a.status}]`;let l=await a.json();return l.choices?.[0]?.message?.content||"[No content returned]"}catch(e){return`[ERROR: ${e.message}]`}},M=async e=>{let s=e.cases||[];if(0===s.length)return void R.warning("No test cases defined for this suite");g(e.id),b({current:0,total:s.length});try{let a={};for(let e=0;e<s.length;e++){b({current:e+1,total:s.length});let l=await L(s[e]);a[s[e].id]=l}let l=await fetch("/api/evals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({suiteId:e.id,outputs:a})}),n=await l.json();if(v(s=>({...s,[e.id]:n})),n.summary){let{passed:s,failed:a,total:l}=n.summary;0===a?R.success(`All ${l} cases passed ✅`,`Eval: ${e.name}`):R.warning(`${s}/${l} passed, ${a} failed`,`Eval: ${e.name}`)}w(e.id)}catch{R.error("Eval run failed")}finally{g(null),b({current:0,total:0})}},T=s.filter(e=>!N||e.name?.toLowerCase().includes(N.toLowerCase())||e.id?.toLowerCase().includes(N.toLowerCase())),_=s.reduce((e,s)=>e+(s.cases?.length||s.caseCount||0),0),O=[...new Set(s.flatMap(e=>(e.cases||[]).map(e=>e.model)).filter(Boolean))];if(p)return(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted p-8 animate-pulse",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"science"}),"Loading eval suites..."]});if(0===s.length)return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(m,{}),(0,l.jsx)(r.pp,{icon:"science",title:"No Eval Suites Found",description:"Eval suites can be defined via the API or in code. They test model outputs against expected results using strategies like contains, regex, exact match, and custom functions."})]});let P=[{key:"caseName",label:"Case"},{key:"status",label:"Status"},{key:"durationMs",label:"Latency"},{key:"details",label:"Details"}];return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(m,{}),(0,l.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Suites"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-violet-400",children:s.length})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Test Cases"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-sky-400",children:_})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Models"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-emerald-400",children:O.length})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Coverage"}),(0,l.jsxs)("div",{className:"text-2xl font-bold mt-1 text-amber-400",children:[d.length," strategies"]})]})]}),(0,l.jsxs)(r.Zp,{className:"p-0 overflow-hidden",children:[(0,l.jsxs)("button",{onClick:()=>S(!C),className:"w-full flex items-center justify-between px-6 py-4 hover:bg-surface/30 transition-colors text-left",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"help"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"How It Works"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Learn how evaluations validate your LLM responses"})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted transition-transform duration-200 ${C?"rotate-180":""}`,children:"expand_more"})]}),C&&(0,l.jsxs)("div",{className:"px-6 pb-6 border-t border-border/10",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4",children:[(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-violet-500/5 border border-violet-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-violet-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-violet-400",children:"1"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e("define")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Create test cases with input prompts and expected output criteria using strategies like contains, regex, or exact match."})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-sky-500/5 border border-sky-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-sky-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-sky-400",children:"2"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e("run")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Execute test cases against your LLM endpoints through OmniRoute. Each case is sent as a real API request."})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-emerald-500/5 border border-emerald-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-emerald-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-emerald-400",children:"3"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e("evaluate")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Responses are compared against expected criteria. See pass/fail for each case with latency metrics and detailed feedback."})]})]}),(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide mb-3",children:"Evaluation Strategies"}),(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:d.map(e=>(0,l.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg ${e.bg} border border-transparent`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-[18px] ${e.color}`,children:e.icon}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:`text-xs font-mono font-semibold ${e.color}`,children:e.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description})]})]},e.name))})]}),O.length>0&&(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide mb-3",children:"Models Under Test"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:O.map(e=>(0,l.jsx)("span",{className:"px-3 py-1.5 rounded-full text-xs font-mono font-medium bg-primary/10 text-primary border border-primary/20",children:e},e))})]})]})]}),(0,l.jsxs)(r.Zp,{className:"p-6",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,l.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"science"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-lg font-semibold",children:e("evalSuites")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Click a suite to view test cases, then run to evaluate your LLM endpoints"})]})]}),(0,l.jsx)(r.Qn,{searchValue:N,onSearchChange:y,placeholder:"Search suites...",filters:[],activeFilters:{},onFilterChange:()=>{},children:null}),(0,l.jsx)("div",{className:"flex flex-col gap-3 mt-4",children:T.map(e=>{let s=j[e.id],a=h===e.id,n=k===e.id,i=e.cases?.length||e.caseCount||0,c=[...new Set((e.cases||[]).map(e=>e.model).filter(Boolean))];return(0,l.jsxs)("div",{className:"border border-border/30 rounded-lg overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-surface/30 transition-colors",onClick:()=>w(n?null:e.id),children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted",children:n?"expand_more":"chevron_right"}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("p",{className:"text-sm font-medium text-text-main",children:e.name||e.id}),s?.summary&&(0,l.jsxs)("span",{className:`px-2 py-0.5 rounded-full text-xs font-semibold ${100===s.summary.passRate?"bg-emerald-500/10 text-emerald-400":s.summary.passRate>=80?"bg-amber-500/10 text-amber-400":"bg-red-500/10 text-red-400"}`,children:[s.summary.passRate,"% pass"]})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:[i," case",1!==i?"s":"",e.description&&(0,l.jsxs)("span",{className:"ml-1",children:["— ",e.description]})]}),c.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:c.map(e=>(0,l.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono text-text-muted bg-black/5 dark:bg-white/5",children:e},e))})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[a&&f.total>0&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-24 h-1.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full bg-violet-500 rounded-full transition-all duration-300",style:{width:`${f.current/f.total*100}%`}})}),(0,l.jsxs)("span",{className:"text-xs text-text-muted font-mono tabular-nums",children:[f.current,"/",f.total]})]}),(0,l.jsx)(r.$n,{size:"sm",variant:"primary",onClick:s=>{s.stopPropagation(),M(e)},loading:a,disabled:a,children:a?`Running ${f.current}/${f.total}...`:"Run Eval"})]})]}),n&&(0,l.jsx)("div",{className:"border-t border-border/20 p-4",children:s?.results?(0,l.jsxs)(l.Fragment,{children:[s.summary&&(0,l.jsxs)("div",{className:"flex items-center gap-4 mb-4 p-3 rounded-lg bg-surface/30 border border-border/20",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("span",{className:`text-lg font-bold ${100===s.summary.passRate?"text-emerald-400":s.summary.passRate>=80?"text-amber-400":"text-red-400"}`,children:[s.summary.passRate,"%"]}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"pass rate"})]}),(0,l.jsxs)("div",{className:"text-xs text-text-muted",children:[s.summary.passed," passed \xb7 ",s.summary.failed," ","failed \xb7 ",s.summary.total," total"]}),(0,l.jsx)("div",{className:"flex-1 h-2 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${s.summary.passRate}%`,background:100===s.summary.passRate?"linear-gradient(90deg, #22c55e, #16a34a)":s.summary.passRate>=80?"linear-gradient(90deg, #f59e0b, #d97706)":"linear-gradient(90deg, #ef4444, #dc2626)"}})})]}),(0,l.jsx)(r.bQ,{columns:P,data:s.results.map((e,s)=>({...e,id:e.caseId||s})),renderCell:(e,s)=>{if("status"===s.key)return e.passed?(0,l.jsx)("span",{className:"text-emerald-400",children:"✅ Passed"}):(0,l.jsx)("span",{className:"text-red-400",children:"❌ Failed"});if("durationMs"===s.key)return(0,l.jsx)("span",{className:"text-text-muted text-xs font-mono",children:null!=e.durationMs?`${e.durationMs}ms`:"—"});if("details"===s.key){let s=e.details||{};return(0,l.jsx)("span",{className:"text-text-muted text-xs truncate max-w-[300px] block",children:String(s.searchTerm?`Contains: "${s.searchTerm}"`:s.pattern?`Regex: ${s.pattern}`:s.expected?`Expected: "${String(s.expected).slice(0,50)}"`:e.error||"—")})}return(0,l.jsx)("span",{className:"text-sm text-text-main",children:e[s.key]||"—"})},maxHeight:"400px",emptyMessage:"No results yet"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted",children:"checklist"}),(0,l.jsxs)("span",{className:"text-xs text-text-muted font-medium",children:["Test Cases (",(e.cases||[]).length,")"]})]}),(0,l.jsx)(r.bQ,{columns:[{key:"name",label:"Case"},{key:"model",label:"Model"},{key:"strategy",label:"Strategy"},{key:"expected",label:"Expected"}],data:(e.cases||[]).map((e,s)=>({id:e.id||s,name:e.name,model:e.model||"—",strategy:e.expected?.strategy||"—",expected:e.expected?.value?String(e.expected.value).slice(0,80):"—"})),renderCell:(e,s)=>{if("strategy"===s.key){let s=d.find(s=>s.name===e.strategy);return(0,l.jsx)("span",{className:`text-xs font-mono font-semibold ${s?.color||"text-text-muted"}`,children:e.strategy})}return"model"===s.key?(0,l.jsx)("span",{className:"text-xs font-mono text-primary/80",children:e.model}):"expected"===s.key?(0,l.jsx)("span",{className:"text-text-muted text-xs font-mono truncate max-w-[300px] block",children:e.expected}):(0,l.jsx)("span",{className:"text-sm text-text-main",children:e[s.key]||"—"})},maxHeight:"400px",emptyMessage:"No test cases defined"}),(0,l.jsxs)("p",{className:"text-xs text-text-muted mt-3 flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),'Click "Run Eval" to execute all cases against your LLM endpoint. Each test sends a real request through OmniRoute.']})]})})]},e.id)})})]})]})}function m(){return(0,l.jsx)(r.Zp,{className:"p-0 overflow-hidden",children:(0,l.jsx)("div",{className:"p-6",style:{background:"linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.05) 50%, rgba(16, 185, 129, 0.05) 100%)"},children:(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"p-3 rounded-xl bg-violet-500/10 text-violet-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[28px]",children:"science"})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("h2",{className:"text-xl font-bold text-text-main mb-1",children:t("modelEvals")}),(0,l.jsx)("p",{className:"text-sm text-text-muted leading-relaxed max-w-2xl",children:"Test and validate your LLM endpoints by running predefined evaluation suites. Each suite contains test cases that send real prompts through OmniRoute and compare responses against expected criteria — helping you detect regressions, compare models, and ensure response quality across providers."}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mt-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-emerald-400",children:"verified"}),"Quality Validation"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-sky-400",children:"compare"}),"Model Comparison"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-400",children:"bug_report"}),"Regression Detection"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-violet-400",children:"speed"}),"Latency Benchmarks"]})]})]})]})})})}function o(){let[e,s]=(0,n.useState)("overview"),a=(0,i.c)("analytics"),c={overview:a("overviewDescription"),evals:a("evalsDescription")};return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[28px]",children:"analytics"}),a("title")]}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:c[e]})]}),(0,l.jsx)(r.Iz,{options:[{value:"overview",label:a("overview")},{value:"evals",label:a("evals")}],value:e,onChange:s}),"overview"===e&&(0,l.jsx)(n.Suspense,{fallback:(0,l.jsx)(r.Qv,{}),children:(0,l.jsx)(r.cn,{})}),"evals"===e&&(0,l.jsx)(x,{})]})}},69589:(e,s,a)=>{Promise.resolve().then(a.bind(a,53701))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=69589)),_N_E=e.O()}]);
|
|
@@ -12,4 +12,4 @@ model_provider = "omniroute"
|
|
|
12
12
|
name = "OmniRoute"
|
|
13
13
|
base_url = "${ei()}"
|
|
14
14
|
wire_api = "responses"
|
|
15
|
-
`},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:g},null,2)}])})]})}let u=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function p({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:p,lastConfiguredAt:h}){let g,f,y,b,[j,N]=(0,l.useState)(null),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(!1),[S,_]=(0,l.useState)(!1),[A,O]=(0,l.useState)(null),[E,P]=(0,l.useState)(""),[I,$]=(0,l.useState)(""),[T,L]=(0,l.useState)(!1),[R,M]=(0,l.useState)({}),[z,U]=(0,l.useState)(!1),[K,F]=(0,l.useState)(""),D=(0,l.useRef)(!1),[B,H]=(0,l.useState)([]),[J,q]=(0,l.useState)(!1),[W,G]=(0,l.useState)(null),Z=!!(j?.installed&&j?.runnable),V=(()=>{if(!Z)return null;let e=j.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id);if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=m&&u&&e.baseUrl?.startsWith(u);return t||s?"configured":"other"})()||p?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!E&&P(d[0].key)},[d,E]),(0,l.useEffect)(()=>{t&&!j&&(Y(),X(),es())},[t,j]);let X=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&M(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,l.useEffect)(()=>{if(j?.installed&&!D.current){D.current=!0;let e=j.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id);e&&(e.model&&$(e.model),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&P(e.apiKey))}},[j,d]);let Y=async()=>{k(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{k(!1)}},Q=()=>{let e=K||i;return e.endsWith("/v1")?e:`${e}/v1`},ee=async()=>{C(!0),O(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_omniroute"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Q(),apiKey:e,model:I})}),s=await t.json();t.ok?(O({type:"success",text:"Settings applied successfully!"}),Y()):O({type:"error",text:s.error||"Failed to apply settings"})}catch(e){O({type:"error",text:e.message})}finally{C(!1)}},et=async()=>{_(!0),O(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(O({type:"success",text:"Settings reset successfully!"}),$(""),P(""),Y()):O({type:"error",text:t.error||"Failed to reset settings"})}catch(e){O({type:"error",text:e.message})}finally{_(!1)}},es=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=droid"),t=await e.json();e.ok&&H(t.backups||[])}catch(e){console.log("Error fetching backups:",e)}},ea=async e=>{G(e),O(null);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"droid",backupId:e})}),s=await t.json();t.ok?(O({type:"success",text:"Backup restored!"}),Y(),es()):O({type:"error",text:s.error||"Failed to restore"})}catch(e){O({type:"error",text:e.message})}finally{G(null)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(o.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:V,batchStatus:p,lastConfiguredAt:h})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!v&&j&&!Z&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:j.installed?"Factory Droid CLI not runnable":"Factory Droid CLI not installed"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:j.installed?`Factory Droid CLI was found but failed runtime healthcheck${j.reason?` (${j.reason})`:""}.`:"Please install Factory Droid CLI to use this feature."})]})]}),!v&&Z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id)?.baseUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.customModels.find(e=>"custom:OmniRoute-0"===e.id).baseUrl})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(g=K||i).endsWith("/v1")?g:`${g}/v1`,onChange:e=>F(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),K&&K!==i&&(0,a.jsx)("button",{onClick:()=>F(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:E,onChange:e=>P(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:I,onChange:e=>$(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>L(!0),disabled:!n,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${n?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),I&&(0,a.jsx)("button",{onClick:()=>$(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),A&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,a.jsx)("span",{children:A.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ee,disabled:!I,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:et,disabled:!j?.hasOmniRoute,loading:S,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>U(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{q(!J),J||es()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"history"}),"Backups",B.length>0&&` (${B.length})`]})]}),J&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"history"}),"Config Backups"]}),0===B.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No backups yet. Backups are created automatically before each Apply or Reset."}):(0,a.jsx)("div",{className:"space-y-1.5",children:B.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"description"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono",title:e.id,children:e.id}),(0,a.jsx)("span",{className:"text-text-muted whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()}),(0,a.jsx)("button",{onClick:()=>ea(e.id),disabled:W===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:W===e.id?"...":"Restore"})]},e.id))})]})]})]}),(0,a.jsx)(r.rq,{isOpen:T,onClose:()=>L(!1),onSelect:e=>{$(e.value),L(!1)},selectedModel:I,activeProviders:x,modelAliases:R,title:"Select Model for Factory Droid"}),(0,a.jsx)(r.uR,{isOpen:z,onClose:()=>U(!1),title:"Factory Droid - Manual Configuration",configs:(f=E&&E.trim()?E:m?"<API_KEY_FROM_DASHBOARD>":"sk_omniroute",y={customModels:[{model:I||"provider/model-id",id:"custom:OmniRoute-0",index:0,baseUrl:Q(),apiKey:f,displayName:I||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},b="u">typeof navigator&&navigator.platform,[{filename:b?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(y,null,2)}])})]})}let h=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function g({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let g,f,[y,b]=(0,l.useState)(null),[j,N]=(0,l.useState)(!1),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(!1),[S,_]=(0,l.useState)(null),[A,O]=(0,l.useState)(""),[E,P]=(0,l.useState)(""),[I,$]=(0,l.useState)(!1),[T,L]=(0,l.useState)({}),[R,M]=(0,l.useState)(!1),[z,U]=(0,l.useState)(""),K=(0,l.useRef)(!1),[F,D]=(0,l.useState)([]),[B,H]=(0,l.useState)(!1),[J,q]=(0,l.useState)(null),W=!!(y?.installed&&y?.runnable),G=(()=>{if(!W)return null;let e=y.settings?.models?.providers?.omniroute;if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=m&&h&&e.baseUrl?.startsWith(h);return t||s?"configured":"other"})()||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!A&&O(d[0].key)},[d,A]),(0,l.useEffect)(()=>{t&&!y&&(V(),Z(),ee())},[t,y]);let Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&L(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,l.useEffect)(()=>{if(y?.installed&&!K.current){K.current=!0;let e=y.settings?.models?.providers?.omniroute;if(e){let t=y.settings?.agents?.defaults?.model?.primary;t&&P(t.replace("omniroute/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&O(e.apiKey)}}},[y,d]);let V=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{N(!1)}},X=()=>{let e=z||i;return e.endsWith("/v1")?e:`${e}/v1`},Y=async()=>{k(!0),_(null);try{let e=A?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_omniroute"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:X(),apiKey:e,model:E})}),s=await t.json();t.ok?(_({type:"success",text:"Settings applied successfully!"}),V()):_({type:"error",text:s.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{k(!1)}},Q=async()=>{C(!0),_(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(_({type:"success",text:"Settings reset successfully!"}),P(""),O(""),V()):_({type:"error",text:t.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{C(!1)}},ee=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=openclaw"),t=await e.json();e.ok&&D(t.backups||[])}catch(e){console.log("Error fetching backups:",e)}},et=async e=>{q(e),_(null);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"openclaw",backupId:e})}),s=await t.json();t.ok?(_({type:"success",text:"Backup restored!"}),V(),ee()):_({type:"error",text:s.error||"Failed to restore"})}catch(e){_({type:"error",text:e.message})}finally{q(null)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(o.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:G,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!j&&y&&!W&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:y.installed?"Open Claw CLI not runnable":"Open Claw CLI not installed"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:y.installed?`Open Claw CLI was found but failed runtime healthcheck${y.reason?` (${y.reason})`:""}.`:"Please install Open Claw CLI to use this feature."})]})]}),!j&&W&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.settings?.models?.providers?.omniroute?.baseUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:y.settings.models.providers.omniroute.baseUrl})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(g=z||i).endsWith("/v1")?g:`${g}/v1`,onChange:e=>U(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),z&&z!==i&&(0,a.jsx)("button",{onClick:()=>U(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:A,onChange:e=>O(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:E,onChange:e=>P(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>$(!0),disabled:!n,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${n?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),E&&(0,a.jsx)("button",{onClick:()=>P(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),S&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===S.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,a.jsx)("span",{children:S.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Y,disabled:!E,loading:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,disabled:!y?.hasOmniRoute,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>M(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{H(!B),B||ee()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"history"}),"Backups",F.length>0&&` (${F.length})`]})]}),B&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"history"}),"Config Backups"]}),0===F.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No backups yet. Backups are created automatically before each Apply or Reset."}):(0,a.jsx)("div",{className:"space-y-1.5",children:F.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"description"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono",title:e.id,children:e.id}),(0,a.jsx)("span",{className:"text-text-muted whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()}),(0,a.jsx)("button",{onClick:()=>et(e.id),disabled:J===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:J===e.id?"...":"Restore"})]},e.id))})]})]})]}),(0,a.jsx)(r.rq,{isOpen:I,onClose:()=>$(!1),onSelect:e=>{P(e.value),$(!1)},selectedModel:E,activeProviders:x,modelAliases:T,title:"Select Model for Open Claw"}),(0,a.jsx)(r.uR,{isOpen:R,onClose:()=>M(!1),title:"Open Claw - Manual Configuration",configs:(f=A&&A.trim()?A:m?"<API_KEY_FROM_DASHBOARD>":"sk_omniroute",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`omniroute/${E||"provider/model-id"}`}}},models:{providers:{omniroute:{baseUrl:X(),apiKey:f,api:"openai-completions",models:[{id:E||"provider/model-id",name:(E||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let f=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function y({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let[h,g]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),[j,N]=(0,l.useState)(!1),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)(""),[A,O]=(0,l.useState)(""),[E,P]=(0,l.useState)(!1),[I,$]=(0,l.useState)({}),[T,L]=(0,l.useState)(!1),[R,M]=(0,l.useState)(""),z=(0,l.useRef)(!1),[U,K]=(0,l.useState)([]),[F,D]=(0,l.useState)(!1),[B,H]=(0,l.useState)(null),J=!!(h?.installed&&h?.runnable),q=(()=>{if(!J)return null;if(!h.hasOmniRoute)return"not_configured";let e=h.settings?.openAiBaseUrl||"",t=e.includes("localhost")||e.includes("127.0.0.1"),s=m&&f&&e.startsWith(f);return t||s?"configured":"other"})(),W=q||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,l.useEffect)(()=>{t&&!h&&(X(),G(),Z())},[t,h]),(0,l.useEffect)(()=>{if(h?.settings&&!z.current){let e=h.settings.openAiModelId;e&&(O(e),z.current=!0)}},[h]);let G=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let t=await e.json();$(t.aliases||{})}}catch{}},Z=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=cline");if(e.ok){let t=await e.json();K(t.backups||[])}}catch{}},V=async e=>{H(e);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"cline",backupId:e})});if(t.ok)C({type:"success",text:"Backup restored! Reloading status..."}),await X(),await Z();else{let e=await t.json();C({type:"error",text:e.error||"Failed to restore backup"})}}catch(e){C({type:"error",text:e.message})}finally{H(null)}},X=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/cline-settings"),t=await e.json();g(t)}catch(e){g({error:e.message})}finally{b(!1)}},Y=async()=>{N(!0),C(null);try{let e=R||i||"http://localhost:20128",t=e.endsWith("/v1")?e:`${e}/v1`,s=await fetch("/api/cli-tools/cline-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:t,apiKey:S||"sk_omniroute",model:A})}),a=await s.json();s.ok?(C({type:"success",text:a.message||"Applied!"}),await X(),await Z()):C({type:"error",text:a.error||"Failed"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},Q=async()=>{k(!0),C(null);try{let e=await fetch("/api/cli-tools/cline-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:t.message||"Reset!"}),O(""),z.current=!1,await X(),await Z()):C({type:"error",text:t.error||"Failed"})}catch(e){C({type:"error",text:e.message})}finally{k(!1)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:e.image?(0,a.jsx)(o.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:e.color},children:"terminal"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:W,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[y&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Cline CLI..."})]}),h&&!y&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-bg-secondary/50 border-border",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${J?"text-green-500":"text-yellow-500"}`,children:J?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:J?"Cline CLI detected and ready":h.installed?"Cline CLI installed but not runnable":"Cline CLI not detected"}),h.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.commandPath})]}),h.globalStatePath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Config:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.globalStatePath})]})]})]}),J&&(0,a.jsxs)(a.Fragment,{children:["configured"===q&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-500 text-lg",children:"check_circle"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-green-700 dark:text-green-300",children:"OmniRoute is configured as OpenAI-compatible provider"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Provider: ",(0,a.jsx)("strong",{children:"openai"})," • Model:"," ",(0,a.jsx)("strong",{children:h.settings?.openAiModelId||"—"})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"Model"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:A,onChange:e=>O(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)(r.$n,{variant:"outline",size:"sm",onClick:()=>P(!0),disabled:!n,children:"Select"}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"API Key"}),d&&d.length>0?(0,a.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:m?"No API keys available":"Using default: sk_omniroute"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Y,disabled:!A,loading:j,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"configured"===q?"Update Config":"Apply Config"]}),"configured"===q&&(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,loading:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restart_alt"}),"Reset"]})]}),w&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${"success"===w.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"success"===w.type?"check_circle":"error"}),(0,a.jsx)("span",{children:w.text})]}),(0,a.jsxs)("div",{className:"border-t border-border pt-3 mt-1",children:[(0,a.jsxs)("button",{onClick:()=>D(!F),className:"flex items-center gap-2 text-sm text-text-muted hover:text-text transition-colors",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] transition-transform ${F?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"backup"}),"Backups ",U.length>0&&`(${U.length})`]}),F&&U.length>0&&(0,a.jsx)("div",{className:"mt-2 flex flex-col gap-1.5 pl-6",children:U.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 rounded bg-bg-secondary/50 text-xs",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium",children:e.originalFile}),(0,a.jsx)("span",{className:"text-text-muted",children:new Date(e.createdAt).toLocaleString()})]}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>V(e.id),loading:B===e.id,children:"Restore"})]},e.id))}),F&&0===U.length&&(0,a.jsx)("p",{className:"mt-2 pl-6 text-xs text-text-muted",children:"No backups available."})]})]})]})]}),(0,a.jsx)(r.rq,{isOpen:E,onClose:()=>P(!1),onSelect:e=>{O(e.value),P(!1)},selectedModel:A,activeProviders:x,title:"Select Model for Cline"}),T&&(0,a.jsx)(r.uR,{isOpen:T,onClose:()=>L(!1),title:"Cline Manual Configuration",onApply:e=>{e.model&&O(e.model),e.apiKey&&_(e.apiKey),e.baseUrl&&M(e.baseUrl),L(!1)},currentConfig:{model:A,apiKey:S,baseUrl:R||i}})]})}function b({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let[h,g]=(0,l.useState)(null),[f,y]=(0,l.useState)(!1),[b,j]=(0,l.useState)(!1),[N,v]=(0,l.useState)(!1),[k,w]=(0,l.useState)(null),[C,S]=(0,l.useState)(""),[_,A]=(0,l.useState)(""),[O,E]=(0,l.useState)(!1),[P,I]=(0,l.useState)({}),[$,T]=(0,l.useState)(!1),[L,R]=(0,l.useState)(""),M=(0,l.useRef)(!1),[z,U]=(0,l.useState)([]),[K,F]=(0,l.useState)(!1),[D,B]=(0,l.useState)(null),H=!!(h?.installed&&h?.runnable),J=H?h.hasOmniRoute?"configured":"not_configured":null,q=J||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!C&&S(d[0].key)},[d,C]),(0,l.useEffect)(()=>{t&&!h&&(V(),W(),G())},[t,h]);let W=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let t=await e.json();I(t.aliases||{})}}catch{}},G=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=kilo");if(e.ok){let t=await e.json();U(t.backups||[])}}catch{}},Z=async e=>{B(e);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"kilo",backupId:e})});if(t.ok)w({type:"success",text:"Backup restored! Reloading status..."}),await V(),await G();else{let e=await t.json();w({type:"error",text:e.error||"Failed to restore backup"})}}catch(e){w({type:"error",text:e.message})}finally{B(null)}},V=async()=>{y(!0);try{let e=await fetch("/api/cli-tools/kilo-settings"),t=await e.json();g(t)}catch(e){g({error:e.message})}finally{y(!1)}},X=async()=>{j(!0),w(null);try{let e=L||i||"http://localhost:20128",t=e.endsWith("/v1")?e:`${e}/v1`,s=await fetch("/api/cli-tools/kilo-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:t,apiKey:C||"sk_omniroute",model:_})}),a=await s.json();s.ok?(w({type:"success",text:a.message||"Applied!"}),await V(),await G()):w({type:"error",text:a.error||"Failed"})}catch(e){w({type:"error",text:e.message})}finally{j(!1)}},Y=async()=>{v(!0),w(null);try{let e=await fetch("/api/cli-tools/kilo-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:t.message||"Reset!"}),A(""),M.current=!1,await V(),await G()):w({type:"error",text:t.error||"Failed"})}catch(e){w({type:"error",text:e.message})}finally{v(!1)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:e.image?(0,a.jsx)(o.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:e.color},children:"terminal"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:q,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[f&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Kilo Code CLI..."})]}),h&&!f&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-bg-secondary/50 border-border",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${H?"text-green-500":"text-yellow-500"}`,children:H?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:H?"Kilo Code CLI detected and ready":h.installed?"Kilo Code CLI installed but not runnable":"Kilo Code CLI not detected"}),h.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.commandPath})]}),h.authPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Auth:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.authPath})]})]})]}),H&&(0,a.jsxs)(a.Fragment,{children:["configured"===J&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-500 text-lg",children:"check_circle"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-green-700 dark:text-green-300",children:"OmniRoute is configured as OpenAI-compatible provider"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Providers: ",(0,a.jsx)("strong",{children:h.settings?.auth?.join(", ")||"—"})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"Model"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:_,onChange:e=>A(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)(r.$n,{variant:"outline",size:"sm",onClick:()=>E(!0),disabled:!n,children:"Select"}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"API Key"}),d&&d.length>0?(0,a.jsx)("select",{value:C,onChange:e=>S(e.target.value),className:"px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:m?"No API keys available":"Using default: sk_omniroute"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,disabled:!_,loading:b,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"configured"===J?"Update Config":"Apply Config"]}),"configured"===J&&(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Y,loading:N,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restart_alt"}),"Reset"]})]}),k&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"success"===k.type?"check_circle":"error"}),(0,a.jsx)("span",{children:k.text})]}),(0,a.jsxs)("div",{className:"border-t border-border pt-3 mt-1",children:[(0,a.jsxs)("button",{onClick:()=>F(!K),className:"flex items-center gap-2 text-sm text-text-muted hover:text-text transition-colors",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] transition-transform ${K?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"backup"}),"Backups ",z.length>0&&`(${z.length})`]}),K&&z.length>0&&(0,a.jsx)("div",{className:"mt-2 flex flex-col gap-1.5 pl-6",children:z.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 rounded bg-bg-secondary/50 text-xs",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium",children:e.originalFile}),(0,a.jsx)("span",{className:"text-text-muted",children:new Date(e.createdAt).toLocaleString()})]}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>Z(e.id),loading:D===e.id,children:"Restore"})]},e.id))}),K&&0===z.length&&(0,a.jsx)("p",{className:"mt-2 pl-6 text-xs text-text-muted",children:"No backups available."})]})]})]})]}),(0,a.jsx)(r.rq,{isOpen:O,onClose:()=>E(!1),onSelect:e=>{A(e.value),E(!1)},selectedModel:_,activeProviders:x,title:"Select Model for Kilo Code"}),$&&(0,a.jsx)(r.uR,{isOpen:$,onClose:()=>T(!1),title:"Kilo Code Manual Configuration",onApply:e=>{e.model&&A(e.model),e.apiKey&&S(e.apiKey),e.baseUrl&&R(e.baseUrl),T(!1)},currentConfig:{model:_,apiKey:C,baseUrl:L||i}})]})}function j({toolId:e,tool:t,isExpanded:s,onToggle:i,baseUrl:n,apiKeys:c,activeProviders:d=[],cloudEnabled:x=!1,batchStatus:m}){let u,p,h,[g,f]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),[j,N]=(0,l.useState)(""),[v,k]=(0,l.useState)(null),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)(!1),A=(0,l.useRef)(!1),[O,E]=(0,l.useState)(()=>c?.length>0?c[0].key:"");(0,l.useEffect)(()=>{let t=localStorage.getItem(`omniroute-cli-model-${e}`);t&&N(t);let s=localStorage.getItem(`omniroute-cli-key-${e}`);s&&c?.some(e=>e.key===s)&&E(s)},[e,c]);let P=(0,l.useCallback)(t=>{N(t),t?localStorage.setItem(`omniroute-cli-model-${e}`,t):localStorage.removeItem(`omniroute-cli-model-${e}`)},[e]),I=(0,l.useCallback)(t=>{E(t),t&&localStorage.setItem(`omniroute-cli-key-${e}`,t)},[e]);(0,l.useEffect)(()=>{!s||v||A.current||(A.current=!0,fetch(`/api/cli-tools/runtime/${e}`).then(e=>e.json()).then(e=>k(e)).catch(e=>k({error:e?.message||"runtime_check_failed"})))},[s,v,e]);let $=e=>{let t=O&&O.trim()?O:x?"your-api-key":"sk_omniroute",s=n||"http://localhost:20128",a=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,a).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,j||"provider/model-id")},T=async(e,t)=>{await navigator.clipboard.writeText($(e)),f(t),setTimeout(()=>f(null),2e3)},L=d.length>0,R=s&&null===v,M=async()=>{_(!0),C(null);try{let t=O&&O.trim()?O:x?"":"sk_omniroute",s=n||"http://localhost:20128",a=s.endsWith("/v1")?s:`${s}/v1`,l=await fetch(`/api/cli-tools/guide-settings/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:a,apiKey:t,model:j})}),r=await l.json();l.ok?C({type:"success",text:r.message||"Configuration saved!"}):C({type:"error",text:r.error||"Failed to save"})}catch(e){C({type:"error",text:e.message})}finally{_(!1)}},z=["continue"].includes(e),U=()=>!t.requiresCloud||!!x;return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:i,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,a.jsx)(o.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):t.icon?(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,a.jsx)(o.default,{src:`/providers/${e}.png`,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(u=v?.reason==="not_required"||"guide"===t.configType,p=v?v.installed&&v.runnable:m?.installed&&m?.runnable,h=v?v.installed:m?.installed,u?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-blue-500"}),"Guide"]}):p?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),"Detected"]}):!1===h&&(v||m)?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-zinc-500/10 text-zinc-500 dark:text-zinc-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-zinc-400 dark:bg-zinc-500"}),"Not installed"]}):h&&!p&&(v||m)?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-yellow-500"}),"Not ready"]}):null)]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,a.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[R&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking runtime..."})]}),!R&&v&&!v.error&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-blue-500 text-lg",children:"not_required"===v.reason?"info":v.installed&&v.runnable?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:"not_required"===v.reason?"Guide-only integration: no local binary required":v.installed&&v.runnable?"CLI runtime detected and healthy":v.installed?`CLI found but not runnable${v.reason?` (${v.reason})`:""}`:"CLI runtime not detected"}),v.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:v.commandPath})]}),v.configPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Config path:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:v.configPath})]})]})]}),!R&&v?.error&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500 text-lg",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Failed to check runtime status."})]}),t.notes&&0!==t.notes.length?(0,a.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&x)return null;let s="warning"===e.type,l="cloudCheck"===e.type&&!x,r="bg-blue-500/10 border-blue-500/30",i="text-blue-600 dark:text-blue-400",n="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",i="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",o="warning"):l&&(r="bg-red-500/10 border-red-500/30",i="text-red-600 dark:text-red-400",n="text-red-500",o="error"),(0,a.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${n}`,children:o}),(0,a.jsx)("p",{className:`text-sm ${i}`,children:e.text})]},t)})}):null,U()&&t.guideSteps.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,a.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,a.jsx)("div",{className:"mt-2 flex items-center gap-2",children:c&&c.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("select",{value:O,onChange:e=>I(e.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:c.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,a.jsx)("button",{onClick:()=>T(O,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===g?"check":"content_copy"})})]}):(0,a.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_omniroute"})}),"modelSelector"===e.type&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:j,onChange:e=>P(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>b(!0),disabled:!L,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${L?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),j&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:()=>T(j,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===g?"check":"content_copy"})}),(0,a.jsx)("button",{onClick:()=>P(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:$(e.value)}),e.copyable&&(0,a.jsx)("button",{onClick:()=>T(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:g===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),U()&&t.codeBlock&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,a.jsxs)("button",{onClick:()=>T(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===g?"check":"content_copy"}),"codeblock"===g?"Copied!":"Copy"]})]}),(0,a.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,a.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:$(t.codeBlock.code)})})]}),U()&&(0,a.jsxs)("div",{className:"mt-2",children:[w&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs mb-2 ${"success"===w.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===w.type?"check_circle":"error"}),(0,a.jsx)("span",{children:w.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[z&&(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:M,disabled:!j,loading:S,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Config"]}),t.codeBlock&&(0,a.jsxs)(r.$n,{variant:z?"outline":"primary",size:"sm",onClick:()=>T(t.codeBlock.code,"codeblock"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"codeblock"===g?"check":"content_copy"}),"codeblock"===g?"Copied!":"Copy Config"]}),j&&(0,a.jsxs)("span",{className:"text-xs text-text-muted flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-green-500",children:"check_circle"}),"Selection saved"]})]})]})]}):(0,a.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,a.jsx)(r.rq,{isOpen:y,onClose:()=>b(!1),onSelect:e=>{P(e.value)},selectedModel:j,activeProviders:d,title:"Select Model"})]})}function N({tool:e,isExpanded:t,onToggle:s,baseUrl:i,apiKeys:n,activeProviders:c,hasActiveProviders:d,cloudEnabled:x}){let[m,u]=(0,l.useState)(null),[p,h]=(0,l.useState)(!1),[g,f]=(0,l.useState)(!1),[y,b]=(0,l.useState)(""),[j,N]=(0,l.useState)(""),[v,k]=(0,l.useState)(null),[w,C]=(0,l.useState)({}),[S,_]=(0,l.useState)(!1),[A,O]=(0,l.useState)(null);(0,l.useEffect)(()=>{n?.length>0&&!j&&N(n[0].key)},[n,j]),(0,l.useEffect)(()=>{t&&!m&&(P(),E())},[t,m]);let E=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm/alias?tool=antigravity");if(e.ok){let t=(await e.json()).aliases||{};Object.keys(t).length>0&&C(t)}}catch(e){console.log("Error loading saved mappings:",e)}},P=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();u(t)}}catch(e){console.log("Error fetching status:",e),u({running:!1})}},I="u">typeof navigator&&navigator.userAgent?.includes("Windows"),$=async e=>{h(!0),k(null);try{let t=j?.trim()||(n?.length>0?n[0].key:null)||(x?null:"sk_omniroute"),s=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t,sudoPassword:e})}),a=await s.json();s.ok?(k({type:"success",text:"MITM started"}),f(!1),b(""),P()):k({type:"error",text:a.error||"Failed to start"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},T=async e=>{h(!0),k(null);try{let t=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:e})}),s=await t.json();t.ok?(k({type:"success",text:"MITM stopped"}),f(!1),b(""),P()):k({type:"error",text:s.error||"Failed to stop"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},L=()=>{y.trim()?m?.running?T(y):$(y):k({type:"error",text:"Sudo password is required"})},R=(e,t)=>{C(s=>({...s,[e]:t}))},M=async()=>{h(!0),k(null);try{let e=await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"antigravity",mappings:w})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to save mappings")}k({type:"success",text:"Mappings saved!"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},z=m?.running;return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(o.default,{src:"/providers/antigravity.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),z?(0,a.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,a.jsx)(r.Ex,{variant:"default",size:"sm",children:"Inactive"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:z?(0,a.jsxs)("button",{onClick:()=>{I||m?.hasCachedPassword?T(""):(f(!0),k(null))},disabled:p,className:"px-4 py-2 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-sm flex items-center gap-2 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"stop_circle"}),"Stop MITM"]}):(0,a.jsxs)("button",{onClick:()=>{I||m?.hasCachedPassword?$(""):(f(!0),k(null))},disabled:p||!d,className:"px-4 py-2 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-sm flex items-center gap-2 hover:bg-primary/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"play_circle"}),"Start MITM"]})}),v?.type==="error"&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{children:v.text})]}),z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),n.length>0?(0,a.jsx)("select",{value:j,onChange:e=>N(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:n.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),e.defaultModels.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:w[e.alias]||"",onChange:t=>R(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>{O(e.alias),_(!0)},disabled:!d,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),w[e.alias]&&(0,a.jsx)("button",{onClick:()=>R(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:M,disabled:p||0===Object.keys(w).length,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Mappings"]})})]}),!z&&(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 px-1",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Intercepts Antigravity traffic via DNS redirect, letting you reroute models through OmniRoute."]}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted",children:[(0,a.jsx)("span",{children:"1. Generates SSL cert & adds to system keychain"}),(0,a.jsxs)("span",{children:["2. Redirects"," ",(0,a.jsx)("code",{className:"text-[10px] bg-surface px-1 rounded",children:"daily-cloudcode-pa.googleapis.com"})," ","→ localhost"]}),(0,a.jsx)("span",{children:"3. Maps Antigravity models to any provider via OmniRoute"})]})]})]}),(0,a.jsx)(r.aF,{isOpen:g,onClose:()=>{f(!1),b(""),k(null)},title:"Sudo Password Required",size:"sm",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and DNS configuration"})]}),(0,a.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"!==e.key||p||L()}}),v&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===v.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===v.type?"check_circle":"error"}),(0,a.jsx)("span",{children:v.text})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{f(!1),b(""),k(null)},disabled:p,children:"Cancel"}),(0,a.jsx)(r.$n,{variant:"primary",size:"sm",onClick:L,loading:p,children:"Confirm"})]})]})}),(0,a.jsx)(r.rq,{isOpen:S,onClose:()=>_(!1),onSelect:e=>{A&&C(t=>({...t,[A]:e.value}))},selectedModel:A?w[A]:null,activeProviders:c,title:`Select model for ${A}`})]})}s(41463).env.NEXT_PUBLIC_CLOUD_URL;var v=s(50910);let k=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function w({machineId:e}){let t,s,o,c=(0,v.c)("cliTools"),[d,u]=(0,l.useState)([]),[h,f]=(0,l.useState)(!0),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)({}),[A,O]=(0,l.useState)(!1),[E,P]=(0,l.useState)([]),[I,$]=(0,l.useState)({}),[T,L]=(0,l.useState)(!1);(0,l.useEffect)(()=>{U(),R(),M(),z()},[]);let R=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();O(t.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},M=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();P(t.keys||[])}}catch(e){console.log("Error fetching API keys:",e)}},z=async()=>{try{let e=await fetch("/api/cli-tools/status");if(e.ok){let t=await e.json();$(t||{})}}catch(e){console.log("Error fetching CLI tool statuses:",e)}finally{L(!0)}},U=async()=>{try{let e=await fetch("/api/providers"),t=await e.json();e.ok&&u(t.connections||[])}catch(e){console.log("Error fetching connections:",e)}finally{f(!1)}},K=()=>d.filter(e=>!1!==e.isActive),F=(0,l.useCallback)((e,t,s)=>{_(a=>a[e]?.[t]===s?a:{...a,[e]:{...a[e],[t]:s}})},[]);if(h||!T)return(0,a.jsx)("div",{className:"flex flex-col gap-6",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{})]})});let D=(t=K(),s=[],o=new Set,t.forEach(e=>{let t=n.Xg[e.provider]||e.provider;(0,n.KC)(e.provider).forEach(a=>{let l=`${t}/${a.id}`;o.has(l)||(o.add(l),s.push({value:l,label:`${t}/${a.id}`,provider:e.provider,alias:t,connectionName:e.name,modelId:a.id}))})}),s).length>0;return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[!D&&(0,a.jsx)(r.Zp,{className:"border-yellow-500/50 bg-yellow-500/5",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:c("noActiveProviders")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:c("noActiveProvidersDesc")})]})]})}),(0,a.jsx)("div",{className:"flex flex-col gap-4",children:Object.entries(i).map(([e,t])=>((e,t)=>{let s={tool:t,isExpanded:w===e,onToggle:()=>C(w===e?null:e),baseUrl:A&&k?k:window.location.origin,apiKeys:E,batchStatus:I[e]||null,lastConfiguredAt:I[e]?.lastConfiguredAt||null};switch(e){case"claude":return(0,a.jsx)(x,{...s,activeProviders:K(),modelMappings:S[e]||{},onModelMappingChange:(t,s)=>F(e,t,s),hasActiveProviders:D,cloudEnabled:A},e);case"codex":return(0,a.jsx)(m,{...s,activeProviders:K(),cloudEnabled:A},e);case"droid":return(0,a.jsx)(p,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"openclaw":return(0,a.jsx)(g,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"antigravity":return(0,a.jsx)(N,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"cline":return(0,a.jsx)(y,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"kilo":return(0,a.jsx)(b,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);default:return(0,a.jsx)(j,{toolId:e,...s,activeProviders:K(),cloudEnabled:A},e)}})(e,t))})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=33782)),_N_E=e.O()}]);
|
|
15
|
+
`},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:g},null,2)}])})]})}let u=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function p({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:p,lastConfiguredAt:h}){let g,f,y,b,[j,N]=(0,l.useState)(null),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(!1),[S,_]=(0,l.useState)(!1),[A,O]=(0,l.useState)(null),[E,P]=(0,l.useState)(""),[I,$]=(0,l.useState)(""),[T,L]=(0,l.useState)(!1),[R,M]=(0,l.useState)({}),[z,U]=(0,l.useState)(!1),[K,F]=(0,l.useState)(""),D=(0,l.useRef)(!1),[B,H]=(0,l.useState)([]),[J,q]=(0,l.useState)(!1),[W,G]=(0,l.useState)(null),Z=!!(j?.installed&&j?.runnable),V=(()=>{if(!Z)return null;let e=j.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id);if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=m&&u&&e.baseUrl?.startsWith(u);return t||s?"configured":"other"})()||p?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!E&&P(d[0].key)},[d,E]),(0,l.useEffect)(()=>{t&&!j&&(Y(),X(),es())},[t,j]);let X=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&M(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,l.useEffect)(()=>{if(j?.installed&&!D.current){D.current=!0;let e=j.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id);e&&(e.model&&$(e.model),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&P(e.apiKey))}},[j,d]);let Y=async()=>{k(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{k(!1)}},Q=()=>{let e=K||i;return e.endsWith("/v1")?e:`${e}/v1`},ee=async()=>{C(!0),O(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_omniroute"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Q(),apiKey:e,model:I})}),s=await t.json();t.ok?(O({type:"success",text:"Settings applied successfully!"}),Y()):O({type:"error",text:s.error||"Failed to apply settings"})}catch(e){O({type:"error",text:e.message})}finally{C(!1)}},et=async()=>{_(!0),O(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(O({type:"success",text:"Settings reset successfully!"}),$(""),P(""),Y()):O({type:"error",text:t.error||"Failed to reset settings"})}catch(e){O({type:"error",text:e.message})}finally{_(!1)}},es=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=droid"),t=await e.json();e.ok&&H(t.backups||[])}catch(e){console.log("Error fetching backups:",e)}},ea=async e=>{G(e),O(null);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"droid",backupId:e})}),s=await t.json();t.ok?(O({type:"success",text:"Backup restored!"}),Y(),es()):O({type:"error",text:s.error||"Failed to restore"})}catch(e){O({type:"error",text:e.message})}finally{G(null)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(o.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:V,batchStatus:p,lastConfiguredAt:h})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!v&&j&&!Z&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:j.installed?"Factory Droid CLI not runnable":"Factory Droid CLI not installed"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:j.installed?`Factory Droid CLI was found but failed runtime healthcheck${j.reason?` (${j.reason})`:""}.`:"Please install Factory Droid CLI to use this feature."})]})]}),!v&&Z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id)?.baseUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.customModels.find(e=>"custom:OmniRoute-0"===e.id).baseUrl})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(g=K||i).endsWith("/v1")?g:`${g}/v1`,onChange:e=>F(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),K&&K!==i&&(0,a.jsx)("button",{onClick:()=>F(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:E,onChange:e=>P(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:I,onChange:e=>$(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>L(!0),disabled:!n,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${n?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),I&&(0,a.jsx)("button",{onClick:()=>$(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),A&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,a.jsx)("span",{children:A.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ee,disabled:!I,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:et,disabled:!j?.hasOmniRoute,loading:S,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>U(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{q(!J),J||es()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"history"}),"Backups",B.length>0&&` (${B.length})`]})]}),J&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"history"}),"Config Backups"]}),0===B.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No backups yet. Backups are created automatically before each Apply or Reset."}):(0,a.jsx)("div",{className:"space-y-1.5",children:B.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"description"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono",title:e.id,children:e.id}),(0,a.jsx)("span",{className:"text-text-muted whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()}),(0,a.jsx)("button",{onClick:()=>ea(e.id),disabled:W===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:W===e.id?"...":"Restore"})]},e.id))})]})]})]}),(0,a.jsx)(r.rq,{isOpen:T,onClose:()=>L(!1),onSelect:e=>{$(e.value),L(!1)},selectedModel:I,activeProviders:x,modelAliases:R,title:"Select Model for Factory Droid"}),(0,a.jsx)(r.uR,{isOpen:z,onClose:()=>U(!1),title:"Factory Droid - Manual Configuration",configs:(f=E&&E.trim()?E:m?"<API_KEY_FROM_DASHBOARD>":"sk_omniroute",y={customModels:[{model:I||"provider/model-id",id:"custom:OmniRoute-0",index:0,baseUrl:Q(),apiKey:f,displayName:I||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},b="u">typeof navigator&&navigator.platform,[{filename:b?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(y,null,2)}])})]})}let h=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function g({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let g,f,[y,b]=(0,l.useState)(null),[j,N]=(0,l.useState)(!1),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(!1),[S,_]=(0,l.useState)(null),[A,O]=(0,l.useState)(""),[E,P]=(0,l.useState)(""),[I,$]=(0,l.useState)(!1),[T,L]=(0,l.useState)({}),[R,M]=(0,l.useState)(!1),[z,U]=(0,l.useState)(""),K=(0,l.useRef)(!1),[F,D]=(0,l.useState)([]),[B,H]=(0,l.useState)(!1),[J,q]=(0,l.useState)(null),W=!!(y?.installed&&y?.runnable),G=(()=>{if(!W)return null;let e=y.settings?.models?.providers?.omniroute;if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=m&&h&&e.baseUrl?.startsWith(h);return t||s?"configured":"other"})()||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!A&&O(d[0].key)},[d,A]),(0,l.useEffect)(()=>{t&&!y&&(V(),Z(),ee())},[t,y]);let Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&L(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,l.useEffect)(()=>{if(y?.installed&&!K.current){K.current=!0;let e=y.settings?.models?.providers?.omniroute;if(e){let t=y.settings?.agents?.defaults?.model?.primary;t&&P(t.replace("omniroute/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&O(e.apiKey)}}},[y,d]);let V=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{N(!1)}},X=()=>{let e=z||i;return e.endsWith("/v1")?e:`${e}/v1`},Y=async()=>{k(!0),_(null);try{let e=A?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_omniroute"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:X(),apiKey:e,model:E})}),s=await t.json();t.ok?(_({type:"success",text:"Settings applied successfully!"}),V()):_({type:"error",text:s.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{k(!1)}},Q=async()=>{C(!0),_(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(_({type:"success",text:"Settings reset successfully!"}),P(""),O(""),V()):_({type:"error",text:t.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{C(!1)}},ee=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=openclaw"),t=await e.json();e.ok&&D(t.backups||[])}catch(e){console.log("Error fetching backups:",e)}},et=async e=>{q(e),_(null);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"openclaw",backupId:e})}),s=await t.json();t.ok?(_({type:"success",text:"Backup restored!"}),V(),ee()):_({type:"error",text:s.error||"Failed to restore"})}catch(e){_({type:"error",text:e.message})}finally{q(null)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(o.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:G,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!j&&y&&!W&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:y.installed?"Open Claw CLI not runnable":"Open Claw CLI not installed"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:y.installed?`Open Claw CLI was found but failed runtime healthcheck${y.reason?` (${y.reason})`:""}.`:"Please install Open Claw CLI to use this feature."})]})]}),!j&&W&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.settings?.models?.providers?.omniroute?.baseUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:y.settings.models.providers.omniroute.baseUrl})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(g=z||i).endsWith("/v1")?g:`${g}/v1`,onChange:e=>U(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),z&&z!==i&&(0,a.jsx)("button",{onClick:()=>U(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:A,onChange:e=>O(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:E,onChange:e=>P(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>$(!0),disabled:!n,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${n?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),E&&(0,a.jsx)("button",{onClick:()=>P(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),S&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===S.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,a.jsx)("span",{children:S.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Y,disabled:!E,loading:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,disabled:!y?.hasOmniRoute,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>M(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{H(!B),B||ee()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"history"}),"Backups",F.length>0&&` (${F.length})`]})]}),B&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"history"}),"Config Backups"]}),0===F.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No backups yet. Backups are created automatically before each Apply or Reset."}):(0,a.jsx)("div",{className:"space-y-1.5",children:F.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"description"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono",title:e.id,children:e.id}),(0,a.jsx)("span",{className:"text-text-muted whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()}),(0,a.jsx)("button",{onClick:()=>et(e.id),disabled:J===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:J===e.id?"...":"Restore"})]},e.id))})]})]})]}),(0,a.jsx)(r.rq,{isOpen:I,onClose:()=>$(!1),onSelect:e=>{P(e.value),$(!1)},selectedModel:E,activeProviders:x,modelAliases:T,title:"Select Model for Open Claw"}),(0,a.jsx)(r.uR,{isOpen:R,onClose:()=>M(!1),title:"Open Claw - Manual Configuration",configs:(f=A&&A.trim()?A:m?"<API_KEY_FROM_DASHBOARD>":"sk_omniroute",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`omniroute/${E||"provider/model-id"}`}}},models:{providers:{omniroute:{baseUrl:X(),apiKey:f,api:"openai-completions",models:[{id:E||"provider/model-id",name:(E||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let f=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function y({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let[h,g]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),[j,N]=(0,l.useState)(!1),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)(""),[A,O]=(0,l.useState)(""),[E,P]=(0,l.useState)(!1),[I,$]=(0,l.useState)({}),[T,L]=(0,l.useState)(!1),[R,M]=(0,l.useState)(""),z=(0,l.useRef)(!1),[U,K]=(0,l.useState)([]),[F,D]=(0,l.useState)(!1),[B,H]=(0,l.useState)(null),J=!!(h?.installed&&h?.runnable),q=(()=>{if(!J)return null;if(!h.hasOmniRoute)return"not_configured";let e=h.settings?.openAiBaseUrl||"",t=e.includes("localhost")||e.includes("127.0.0.1"),s=m&&f&&e.startsWith(f);return t||s?"configured":"other"})(),W=q||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,l.useEffect)(()=>{t&&!h&&(X(),G(),Z())},[t,h]),(0,l.useEffect)(()=>{if(h?.settings&&!z.current){let e=h.settings.openAiModelId;e&&(O(e),z.current=!0)}},[h]);let G=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let t=await e.json();$(t.aliases||{})}}catch{}},Z=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=cline");if(e.ok){let t=await e.json();K(t.backups||[])}}catch{}},V=async e=>{H(e);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"cline",backupId:e})});if(t.ok)C({type:"success",text:"Backup restored! Reloading status..."}),await X(),await Z();else{let e=await t.json();C({type:"error",text:e.error||"Failed to restore backup"})}}catch(e){C({type:"error",text:e.message})}finally{H(null)}},X=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/cline-settings"),t=await e.json();g(t)}catch(e){g({error:e.message})}finally{b(!1)}},Y=async()=>{N(!0),C(null);try{let e=R||i||"http://localhost:20128",t=e.endsWith("/v1")?e:`${e}/v1`,s=await fetch("/api/cli-tools/cline-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:t,apiKey:S||"sk_omniroute",model:A})}),a=await s.json();s.ok?(C({type:"success",text:a.message||"Applied!"}),await X(),await Z()):C({type:"error",text:a.error||"Failed"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},Q=async()=>{k(!0),C(null);try{let e=await fetch("/api/cli-tools/cline-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:t.message||"Reset!"}),O(""),z.current=!1,await X(),await Z()):C({type:"error",text:t.error||"Failed"})}catch(e){C({type:"error",text:e.message})}finally{k(!1)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:e.image?(0,a.jsx)(o.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:e.color},children:"terminal"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:W,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[y&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Cline CLI..."})]}),h&&!y&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-bg-secondary/50 border-border",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${J?"text-green-500":"text-yellow-500"}`,children:J?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:J?"Cline CLI detected and ready":h.installed?"Cline CLI installed but not runnable":"Cline CLI not detected"}),h.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.commandPath})]}),h.globalStatePath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Config:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.globalStatePath})]})]})]}),J&&(0,a.jsxs)(a.Fragment,{children:["configured"===q&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-500 text-lg",children:"check_circle"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-green-700 dark:text-green-300",children:"OmniRoute is configured as OpenAI-compatible provider"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Provider: ",(0,a.jsx)("strong",{children:"openai"})," • Model:"," ",(0,a.jsx)("strong",{children:h.settings?.openAiModelId||"—"})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"Model"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:A,onChange:e=>O(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)(r.$n,{variant:"outline",size:"sm",onClick:()=>P(!0),disabled:!n,children:"Select"}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"API Key"}),d&&d.length>0?(0,a.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:m?"No API keys available":"Using default: sk_omniroute"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Y,disabled:!A,loading:j,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"configured"===q?"Update Config":"Apply Config"]}),"configured"===q&&(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,loading:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restart_alt"}),"Reset"]})]}),w&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${"success"===w.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"success"===w.type?"check_circle":"error"}),(0,a.jsx)("span",{children:w.text})]}),(0,a.jsxs)("div",{className:"border-t border-border pt-3 mt-1",children:[(0,a.jsxs)("button",{onClick:()=>D(!F),className:"flex items-center gap-2 text-sm text-text-muted hover:text-text transition-colors",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] transition-transform ${F?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"backup"}),"Backups ",U.length>0&&`(${U.length})`]}),F&&U.length>0&&(0,a.jsx)("div",{className:"mt-2 flex flex-col gap-1.5 pl-6",children:U.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 rounded bg-bg-secondary/50 text-xs",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium",children:e.originalFile}),(0,a.jsx)("span",{className:"text-text-muted",children:new Date(e.createdAt).toLocaleString()})]}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>V(e.id),loading:B===e.id,children:"Restore"})]},e.id))}),F&&0===U.length&&(0,a.jsx)("p",{className:"mt-2 pl-6 text-xs text-text-muted",children:"No backups available."})]})]})]})]}),(0,a.jsx)(r.rq,{isOpen:E,onClose:()=>P(!1),onSelect:e=>{O(e.value),P(!1)},selectedModel:A,activeProviders:x,title:"Select Model for Cline"}),T&&(0,a.jsx)(r.uR,{isOpen:T,onClose:()=>L(!1),title:"Cline Manual Configuration",onApply:e=>{e.model&&O(e.model),e.apiKey&&_(e.apiKey),e.baseUrl&&M(e.baseUrl),L(!1)},currentConfig:{model:A,apiKey:S,baseUrl:R||i}})]})}function b({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let[h,g]=(0,l.useState)(null),[f,y]=(0,l.useState)(!1),[b,j]=(0,l.useState)(!1),[N,v]=(0,l.useState)(!1),[k,w]=(0,l.useState)(null),[C,S]=(0,l.useState)(""),[_,A]=(0,l.useState)(""),[O,E]=(0,l.useState)(!1),[P,I]=(0,l.useState)({}),[$,T]=(0,l.useState)(!1),[L,R]=(0,l.useState)(""),M=(0,l.useRef)(!1),[z,U]=(0,l.useState)([]),[K,F]=(0,l.useState)(!1),[D,B]=(0,l.useState)(null),H=!!(h?.installed&&h?.runnable),J=H?h.hasOmniRoute?"configured":"not_configured":null,q=J||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!C&&S(d[0].key)},[d,C]),(0,l.useEffect)(()=>{t&&!h&&(V(),W(),G())},[t,h]);let W=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let t=await e.json();I(t.aliases||{})}}catch{}},G=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=kilo");if(e.ok){let t=await e.json();U(t.backups||[])}}catch{}},Z=async e=>{B(e);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"kilo",backupId:e})});if(t.ok)w({type:"success",text:"Backup restored! Reloading status..."}),await V(),await G();else{let e=await t.json();w({type:"error",text:e.error||"Failed to restore backup"})}}catch(e){w({type:"error",text:e.message})}finally{B(null)}},V=async()=>{y(!0);try{let e=await fetch("/api/cli-tools/kilo-settings"),t=await e.json();g(t)}catch(e){g({error:e.message})}finally{y(!1)}},X=async()=>{j(!0),w(null);try{let e=L||i||"http://localhost:20128",t=e.endsWith("/v1")?e:`${e}/v1`,s=await fetch("/api/cli-tools/kilo-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:t,apiKey:C||"sk_omniroute",model:_})}),a=await s.json();s.ok?(w({type:"success",text:a.message||"Applied!"}),await V(),await G()):w({type:"error",text:a.error||"Failed"})}catch(e){w({type:"error",text:e.message})}finally{j(!1)}},Y=async()=>{v(!0),w(null);try{let e=await fetch("/api/cli-tools/kilo-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:t.message||"Reset!"}),A(""),M.current=!1,await V(),await G()):w({type:"error",text:t.error||"Failed"})}catch(e){w({type:"error",text:e.message})}finally{v(!1)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:e.image?(0,a.jsx)(o.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:e.color},children:"terminal"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:q,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[f&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Kilo Code CLI..."})]}),h&&!f&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-bg-secondary/50 border-border",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${H?"text-green-500":"text-yellow-500"}`,children:H?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:H?"Kilo Code CLI detected and ready":h.installed?"Kilo Code CLI installed but not runnable":"Kilo Code CLI not detected"}),h.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.commandPath})]}),h.authPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Auth:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.authPath})]})]})]}),H&&(0,a.jsxs)(a.Fragment,{children:["configured"===J&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-500 text-lg",children:"check_circle"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-green-700 dark:text-green-300",children:"OmniRoute is configured as OpenAI-compatible provider"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Providers: ",(0,a.jsx)("strong",{children:h.settings?.auth?.join(", ")||"—"})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"Model"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:_,onChange:e=>A(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)(r.$n,{variant:"outline",size:"sm",onClick:()=>E(!0),disabled:!n,children:"Select"}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"API Key"}),d&&d.length>0?(0,a.jsx)("select",{value:C,onChange:e=>S(e.target.value),className:"px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:m?"No API keys available":"Using default: sk_omniroute"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,disabled:!_,loading:b,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"configured"===J?"Update Config":"Apply Config"]}),"configured"===J&&(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Y,loading:N,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restart_alt"}),"Reset"]})]}),k&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"success"===k.type?"check_circle":"error"}),(0,a.jsx)("span",{children:k.text})]}),(0,a.jsxs)("div",{className:"border-t border-border pt-3 mt-1",children:[(0,a.jsxs)("button",{onClick:()=>F(!K),className:"flex items-center gap-2 text-sm text-text-muted hover:text-text transition-colors",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] transition-transform ${K?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"backup"}),"Backups ",z.length>0&&`(${z.length})`]}),K&&z.length>0&&(0,a.jsx)("div",{className:"mt-2 flex flex-col gap-1.5 pl-6",children:z.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 rounded bg-bg-secondary/50 text-xs",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium",children:e.originalFile}),(0,a.jsx)("span",{className:"text-text-muted",children:new Date(e.createdAt).toLocaleString()})]}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>Z(e.id),loading:D===e.id,children:"Restore"})]},e.id))}),K&&0===z.length&&(0,a.jsx)("p",{className:"mt-2 pl-6 text-xs text-text-muted",children:"No backups available."})]})]})]})]}),(0,a.jsx)(r.rq,{isOpen:O,onClose:()=>E(!1),onSelect:e=>{A(e.value),E(!1)},selectedModel:_,activeProviders:x,title:"Select Model for Kilo Code"}),$&&(0,a.jsx)(r.uR,{isOpen:$,onClose:()=>T(!1),title:"Kilo Code Manual Configuration",onApply:e=>{e.model&&A(e.model),e.apiKey&&S(e.apiKey),e.baseUrl&&R(e.baseUrl),T(!1)},currentConfig:{model:_,apiKey:C,baseUrl:L||i}})]})}function j({toolId:e,tool:t,isExpanded:s,onToggle:i,baseUrl:n,apiKeys:c,activeProviders:d=[],cloudEnabled:x=!1,batchStatus:m}){let u,p,h,[g,f]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),[j,N]=(0,l.useState)(""),[v,k]=(0,l.useState)(null),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)(!1),A=(0,l.useRef)(!1),[O,E]=(0,l.useState)(()=>c?.length>0?c[0].key:"");(0,l.useEffect)(()=>{let t=localStorage.getItem(`omniroute-cli-model-${e}`);t&&N(t);let s=localStorage.getItem(`omniroute-cli-key-${e}`);s&&c?.some(e=>e.key===s)&&E(s)},[e,c]);let P=(0,l.useCallback)(t=>{N(t),t?localStorage.setItem(`omniroute-cli-model-${e}`,t):localStorage.removeItem(`omniroute-cli-model-${e}`)},[e]),I=(0,l.useCallback)(t=>{E(t),t&&localStorage.setItem(`omniroute-cli-key-${e}`,t)},[e]);(0,l.useEffect)(()=>{!s||v||A.current||(A.current=!0,fetch(`/api/cli-tools/runtime/${e}`).then(e=>e.json()).then(e=>k(e)).catch(e=>k({error:e?.message||"runtime_check_failed"})))},[s,v,e]);let $=e=>{let t=O&&O.trim()?O:x?"your-api-key":"sk_omniroute",s=n||"http://localhost:20128",a=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,a).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,j||"provider/model-id")},T=async(e,t)=>{await navigator.clipboard.writeText($(e)),f(t),setTimeout(()=>f(null),2e3)},L=d.length>0,R=s&&null===v,M=async()=>{_(!0),C(null);try{let t=O&&O.trim()?O:x?"":"sk_omniroute",s=n||"http://localhost:20128",a=s.endsWith("/v1")?s:`${s}/v1`,l=await fetch(`/api/cli-tools/guide-settings/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:a,apiKey:t,model:j})}),r=await l.json();l.ok?C({type:"success",text:r.message||"Configuration saved!"}):C({type:"error",text:r.error||"Failed to save"})}catch(e){C({type:"error",text:e.message})}finally{_(!1)}},z=["continue"].includes(e),U=()=>!t.requiresCloud||!!x;return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:i,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,a.jsx)(o.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):t.icon?(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,a.jsx)(o.default,{src:`/providers/${e}.png`,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(u=v?.reason==="not_required"||"guide"===t.configType,p=v?v.installed&&v.runnable:m?.installed&&m?.runnable,h=v?v.installed:m?.installed,u?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-blue-500"}),"Guide"]}):p?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),"Detected"]}):!1===h&&(v||m)?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-zinc-500/10 text-zinc-500 dark:text-zinc-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-zinc-400 dark:bg-zinc-500"}),"Not installed"]}):h&&!p&&(v||m)?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-yellow-500"}),"Not ready"]}):null)]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,a.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[R&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking runtime..."})]}),!R&&v&&!v.error&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-blue-500 text-lg",children:"not_required"===v.reason?"info":v.installed&&v.runnable?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:"not_required"===v.reason?"Guide-only integration: no local binary required":v.installed&&v.runnable?"CLI runtime detected and healthy":v.installed?`CLI found but not runnable${v.reason?` (${v.reason})`:""}`:"CLI runtime not detected"}),v.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:v.commandPath})]}),v.configPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Config path:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:v.configPath})]})]})]}),!R&&v?.error&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500 text-lg",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Failed to check runtime status."})]}),t.notes&&0!==t.notes.length?(0,a.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&x)return null;let s="warning"===e.type,l="cloudCheck"===e.type&&!x,r="bg-blue-500/10 border-blue-500/30",i="text-blue-600 dark:text-blue-400",n="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",i="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",o="warning"):l&&(r="bg-red-500/10 border-red-500/30",i="text-red-600 dark:text-red-400",n="text-red-500",o="error"),(0,a.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${n}`,children:o}),(0,a.jsx)("p",{className:`text-sm ${i}`,children:e.text})]},t)})}):null,U()&&t.guideSteps.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,a.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,a.jsx)("div",{className:"mt-2 flex items-center gap-2",children:c&&c.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("select",{value:O,onChange:e=>I(e.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:c.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,a.jsx)("button",{onClick:()=>T(O,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===g?"check":"content_copy"})})]}):(0,a.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_omniroute"})}),"modelSelector"===e.type&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:j,onChange:e=>P(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>b(!0),disabled:!L,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${L?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),j&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:()=>T(j,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===g?"check":"content_copy"})}),(0,a.jsx)("button",{onClick:()=>P(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:$(e.value)}),e.copyable&&(0,a.jsx)("button",{onClick:()=>T(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:g===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),U()&&t.codeBlock&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,a.jsxs)("button",{onClick:()=>T(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===g?"check":"content_copy"}),"codeblock"===g?"Copied!":"Copy"]})]}),(0,a.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,a.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:$(t.codeBlock.code)})})]}),U()&&(0,a.jsxs)("div",{className:"mt-2",children:[w&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs mb-2 ${"success"===w.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===w.type?"check_circle":"error"}),(0,a.jsx)("span",{children:w.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[z&&(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:M,disabled:!j,loading:S,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Config"]}),t.codeBlock&&(0,a.jsxs)(r.$n,{variant:z?"outline":"primary",size:"sm",onClick:()=>T(t.codeBlock.code,"codeblock"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"codeblock"===g?"check":"content_copy"}),"codeblock"===g?"Copied!":"Copy Config"]}),j&&(0,a.jsxs)("span",{className:"text-xs text-text-muted flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-green-500",children:"check_circle"}),"Selection saved"]})]})]})]}):(0,a.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,a.jsx)(r.rq,{isOpen:y,onClose:()=>b(!1),onSelect:e=>{P(e.value)},selectedModel:j,activeProviders:d,title:"Select Model"})]})}function N({tool:e,isExpanded:t,onToggle:s,baseUrl:i,apiKeys:n,activeProviders:c,hasActiveProviders:d,cloudEnabled:x}){let[m,u]=(0,l.useState)(null),[p,h]=(0,l.useState)(!1),[g,f]=(0,l.useState)(!1),[y,b]=(0,l.useState)(""),[j,N]=(0,l.useState)(""),[v,k]=(0,l.useState)(null),[w,C]=(0,l.useState)({}),[S,_]=(0,l.useState)(!1),[A,O]=(0,l.useState)(null);(0,l.useEffect)(()=>{n?.length>0&&!j&&N(n[0].key)},[n,j]),(0,l.useEffect)(()=>{t&&!m&&(P(),E())},[t,m]);let E=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm/alias?tool=antigravity");if(e.ok){let t=(await e.json()).aliases||{};Object.keys(t).length>0&&C(t)}}catch(e){console.log("Error loading saved mappings:",e)}},P=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();u(t)}}catch(e){console.log("Error fetching status:",e),u({running:!1})}},I="u">typeof navigator&&navigator.userAgent?.includes("Windows"),$=async e=>{h(!0),k(null);try{let t=j?.trim()||(n?.length>0?n[0].key:null)||(x?null:"sk_omniroute"),s=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t,sudoPassword:e})}),a=await s.json();s.ok?(k({type:"success",text:"MITM started"}),f(!1),b(""),P()):k({type:"error",text:a.error||"Failed to start"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},T=async e=>{h(!0),k(null);try{let t=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:e})}),s=await t.json();t.ok?(k({type:"success",text:"MITM stopped"}),f(!1),b(""),P()):k({type:"error",text:s.error||"Failed to stop"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},L=()=>{y.trim()?m?.running?T(y):$(y):k({type:"error",text:"Sudo password is required"})},R=(e,t)=>{C(s=>({...s,[e]:t}))},M=async()=>{h(!0),k(null);try{let e=await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"antigravity",mappings:w})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to save mappings")}k({type:"success",text:"Mappings saved!"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},z=m?.running;return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(o.default,{src:"/providers/antigravity.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),z?(0,a.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,a.jsx)(r.Ex,{variant:"default",size:"sm",children:"Inactive"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:z?(0,a.jsxs)("button",{onClick:()=>{I||m?.hasCachedPassword?T(""):(f(!0),k(null))},disabled:p,className:"px-4 py-2 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-sm flex items-center gap-2 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"stop_circle"}),"Stop MITM"]}):(0,a.jsxs)("button",{onClick:()=>{I||m?.hasCachedPassword?$(""):(f(!0),k(null))},disabled:p||!d,className:"px-4 py-2 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-sm flex items-center gap-2 hover:bg-primary/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"play_circle"}),"Start MITM"]})}),v?.type==="error"&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{children:v.text})]}),z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),n.length>0?(0,a.jsx)("select",{value:j,onChange:e=>N(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:n.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),e.defaultModels.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:w[e.alias]||"",onChange:t=>R(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>{O(e.alias),_(!0)},disabled:!d,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),w[e.alias]&&(0,a.jsx)("button",{onClick:()=>R(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:M,disabled:p||0===Object.keys(w).length,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Mappings"]})})]}),!z&&(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 px-1",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Intercepts Antigravity traffic via DNS redirect, letting you reroute models through OmniRoute."]}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted",children:[(0,a.jsx)("span",{children:"1. Generates SSL cert & adds to system keychain"}),(0,a.jsxs)("span",{children:["2. Redirects"," ",(0,a.jsx)("code",{className:"text-[10px] bg-surface px-1 rounded",children:"daily-cloudcode-pa.googleapis.com"})," ","→ localhost"]}),(0,a.jsx)("span",{children:"3. Maps Antigravity models to any provider via OmniRoute"})]})]})]}),(0,a.jsx)(r.aF,{isOpen:g,onClose:()=>{f(!1),b(""),k(null)},title:"Sudo Password Required",size:"sm",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and DNS configuration"})]}),(0,a.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"!==e.key||p||L()}}),v&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===v.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===v.type?"check_circle":"error"}),(0,a.jsx)("span",{children:v.text})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{f(!1),b(""),k(null)},disabled:p,children:"Cancel"}),(0,a.jsx)(r.$n,{variant:"primary",size:"sm",onClick:L,loading:p,children:"Confirm"})]})]})}),(0,a.jsx)(r.rq,{isOpen:S,onClose:()=>_(!1),onSelect:e=>{A&&C(t=>({...t,[A]:e.value}))},selectedModel:A?w[A]:null,activeProviders:c,title:`Select model for ${A}`})]})}s(41463).env.NEXT_PUBLIC_CLOUD_URL;var v=s(50910);let k=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function w({machineId:e}){let t,s,o,c=(0,v.c)("cliTools"),[d,u]=(0,l.useState)([]),[h,f]=(0,l.useState)(!0),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)({}),[A,O]=(0,l.useState)(!1),[E,P]=(0,l.useState)([]),[I,$]=(0,l.useState)({}),[T,L]=(0,l.useState)(!1);(0,l.useEffect)(()=>{U(),R(),M(),z()},[]);let R=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();O(t.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},M=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();P(t.keys||[])}}catch(e){console.log("Error fetching API keys:",e)}},z=async()=>{try{let e=new AbortController,t=setTimeout(()=>e.abort(),8e3),s=await fetch("/api/cli-tools/status",{signal:e.signal});if(clearTimeout(t),s.ok){let e=await s.json();$(e||{})}}catch(e){console.log("CLI tool status check timed out or failed:",e)}finally{L(!0)}},U=async()=>{try{let e=await fetch("/api/providers"),t=await e.json();e.ok&&u(t.connections||[])}catch(e){console.log("Error fetching connections:",e)}finally{f(!1)}},K=()=>d.filter(e=>!1!==e.isActive),F=(0,l.useCallback)((e,t,s)=>{_(a=>a[e]?.[t]===s?a:{...a,[e]:{...a[e],[t]:s}})},[]);if(h||!T)return(0,a.jsx)("div",{className:"flex flex-col gap-6",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{})]})});let D=(t=K(),s=[],o=new Set,t.forEach(e=>{let t=n.Xg[e.provider]||e.provider;(0,n.KC)(e.provider).forEach(a=>{let l=`${t}/${a.id}`;o.has(l)||(o.add(l),s.push({value:l,label:`${t}/${a.id}`,provider:e.provider,alias:t,connectionName:e.name,modelId:a.id}))})}),s).length>0;return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[!D&&(0,a.jsx)(r.Zp,{className:"border-yellow-500/50 bg-yellow-500/5",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:c("noActiveProviders")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:c("noActiveProvidersDesc")})]})]})}),(0,a.jsx)("div",{className:"flex flex-col gap-4",children:Object.entries(i).map(([e,t])=>((e,t)=>{let s={tool:t,isExpanded:w===e,onToggle:()=>C(w===e?null:e),baseUrl:A&&k?k:window.location.origin,apiKeys:E,batchStatus:I[e]||null,lastConfiguredAt:I[e]?.lastConfiguredAt||null};switch(e){case"claude":return(0,a.jsx)(x,{...s,activeProviders:K(),modelMappings:S[e]||{},onModelMappingChange:(t,s)=>F(e,t,s),hasActiveProviders:D,cloudEnabled:A},e);case"codex":return(0,a.jsx)(m,{...s,activeProviders:K(),cloudEnabled:A},e);case"droid":return(0,a.jsx)(p,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"openclaw":return(0,a.jsx)(g,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"antigravity":return(0,a.jsx)(N,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"cline":return(0,a.jsx)(y,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"kilo":return(0,a.jsx)(b,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);default:return(0,a.jsx)(j,{toolId:e,...s,activeProviders:K(),cloudEnabled:A},e)}})(e,t))})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=33782)),_N_E=e.O()}]);
|