omniroute 3.4.5 → 3.4.6
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/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/agents/page_client-reference-manifest.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/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/auto-combo/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cache/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cache/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_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_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/media/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/memory/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/playground/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/search-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/400/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/401/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/403/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/408/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/429/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/500/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/502/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/503/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.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/monitoring/health/route.js +3 -3
- package/app/.next/server/app/api/provider-models/route.js +2 -2
- package/app/.next/server/app/api/provider-nodes/[id]/route.js +2 -2
- package/app/.next/server/app/api/provider-nodes/route.js +3 -3
- package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/sync-models/route.js +3 -3
- package/app/.next/server/app/api/providers/[id]/sync-models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js +6 -6
- package/app/.next/server/app/api/providers/route.js +4 -4
- package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js +5 -5
- package/app/.next/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -1
- package/app/.next/server/app/api/system/version/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js +2 -2
- package/app/.next/server/app/api/usage/provider-limits/route.js +5 -5
- package/app/.next/server/app/api/usage/provider-limits/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/route.js +4 -4
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/route.js +4 -4
- package/app/.next/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.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_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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/maintenance/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/offline/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/status/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0.7zz6j._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0.lz97q._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0.m9_5-._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__00-bzx_._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__00hsd7k._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__00i_ryi._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__01fudn9._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__024slax._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__030_-af._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__03gl9dh._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__03x69ll._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__047np0t._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__04lc9.m._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__05u48b-._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__06dr~pl._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__06hr_sx._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__06r5eje._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__07.ui7z._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__075j.5s._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__07ju0wx._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__07wj.c4._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__08-9vz.._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0908q-_._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__09blmoy._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__09c50mp._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0a.3c_r._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0bkx9sd._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0c4v_hg._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0c5t729._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0cem6i6._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0d-qyrk._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0d-rd-n._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0djfz6n._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0dmb7bd._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0e7dp.z._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0el_v65._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0enebbv._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0enecpa._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0eps0zu._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0fbv0zh._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0fmf-tk._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0fw0v5q._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0g0b9au._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0gukblk._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0h-q5l0._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0h1fgwr._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0h86b7i._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0h~a5f1._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0irqapk._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0j0ez8_._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0jacr87._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0jnihz9._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0jp3yj4._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0llqbda._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0m-356c._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0mj7x5~._.js +8 -8
- package/app/.next/server/chunks/[root-of-the-server]__0mpnloa._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0n-~kvf._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0n.gjo8._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0n0nara._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0ncz8xj._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0oph175._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0p3a7_l._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0pl_899._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0prott7._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0pwiejj._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0pxqo8v._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0q04t~4._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0q9h_5u._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0qaruz-._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0qka2s7._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0rnvi83._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0rpwwig._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0rs2ec_._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0s1dq3.._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0s1ya.l._.js +5 -5
- package/app/.next/server/chunks/[root-of-the-server]__0svm~lc._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0t83olx._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0tsl88m._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0uctzvq._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0vkqjj1._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0vwq47l._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0vx1juw._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0vzvfbd._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0w39cdo._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0wc__c~._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0y2h760._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0y_c7uk._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__0~8fltv._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0~dj8ev._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__10.x-iq._.js +4 -4
- package/app/.next/server/chunks/[root-of-the-server]__10e1a_z._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__10o_k-p._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__10smy7g._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__11wa4b~._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__11xpr8u._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__122-jdl._.js +8 -8
- package/app/.next/server/chunks/[root-of-the-server]__12e9-l1._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__12gh.g1._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__136nal9._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__13_i443._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__13c-d_4._.js +2 -2
- package/app/.next/server/chunks/_0-jnvci._.js +1 -1
- package/app/.next/server/chunks/_0-~thzo._.js +1 -1
- package/app/.next/server/chunks/_00.pgsp._.js +1 -1
- package/app/.next/server/chunks/_013gowh._.js +1 -1
- package/app/.next/server/chunks/{_03c-j3o._.js → _02~yzex._.js} +2 -2
- package/app/.next/server/chunks/_036lxbr._.js +1 -1
- package/app/.next/server/chunks/_05reh6o._.js +1 -1
- package/app/.next/server/chunks/_0a3.3sc._.js +1 -1
- package/app/.next/server/chunks/_0c.abwr._.js +1 -1
- package/app/.next/server/chunks/_0due8oe._.js +2 -2
- package/app/.next/server/chunks/_0h-j8c2._.js +1 -1
- package/app/.next/server/chunks/_0k43pd6._.js +3 -3
- package/app/.next/server/chunks/_0vx-r0i._.js +2 -2
- package/app/.next/server/chunks/_10.rw9f._.js +1 -1
- package/app/.next/server/chunks/_13mo7j5._.js +1 -1
- package/app/.next/server/chunks/src_0f_le~m._.js +1 -1
- package/app/.next/server/chunks/ssr/_008ht2n._.js +2 -2
- package/app/.next/server/chunks/ssr/_0oo1f90._.js +2 -2
- package/app/.next/server/chunks/ssr/_0~laquj._.js +1 -1
- package/app/.next/server/chunks/ssr/src_04gjot1._.js +1 -1
- package/app/.next/server/chunks/ssr/src_app_(dashboard)_dashboard_cache_04_vca6._.js +1 -1
- package/app/.next/server/chunks/ssr/{src_app_(dashboard)_dashboard_settings_0ni3aus._.js → src_app_(dashboard)_dashboard_settings_09gq48u._.js} +2 -2
- package/app/.next/server/chunks/ssr/src_i18n_messages_en_json_[json]_cjs_13rg.m2._.js +1 -1
- package/app/.next/server/chunks/ssr/src_i18n_messages_pt-BR_json_[json]_cjs_01n5fvn._.js +1 -1
- package/app/.next/server/chunks/ssr/src_i18n_messages_pt_json_[json]_cjs_0fwb8p.._.js +1 -1
- package/app/.next/server/chunks/ssr/src_shared_0jy4djq._.js +3 -0
- package/app/.next/server/chunks/ssr/src_shared_components_0v5o286._.js +3 -0
- package/app/.next/server/middleware-build-manifest.js +3 -3
- package/app/.next/server/pages/500.html +1 -1
- 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/{03~_6b5~n101_.js → 0.ap2gsi3d-1e.js} +1 -1
- package/app/.next/static/chunks/08iujr48xci8k.js +1 -0
- package/app/.next/static/chunks/{0up_y.7qkqwxz.js → 08n6n76lz~vt6.js} +1 -1
- package/app/.next/static/chunks/{060zmf~qn1q6y.js → 0f611s~575pn8.js} +1 -1
- package/app/.next/static/chunks/0y5kx9rgeb6~_.js +1 -0
- package/app/.next/static/chunks/13xz-222deqiy.js +1 -0
- package/app/CHANGELOG.md +18 -0
- package/app/docs/openapi.yaml +1 -1
- package/app/llm.txt +2 -2
- package/app/open-sse/handlers/chatCore.ts +2 -2
- package/app/open-sse/package.json +1 -1
- package/app/open-sse/translator/request/claude-to-gemini.ts +17 -0
- package/app/open-sse/translator/request/openai-to-gemini.ts +14 -3
- package/app/open-sse/utils/stream.ts +2 -2
- package/app/package-lock.json +3 -3
- package/app/package.json +1 -1
- package/app/src/app/(dashboard)/dashboard/cache/components/CacheTrends.tsx +19 -12
- package/app/src/app/(dashboard)/dashboard/cache/page.tsx +0 -3
- package/app/src/app/(dashboard)/dashboard/memory/page.tsx +20 -20
- package/app/src/i18n/messages/en.json +55 -1
- package/app/src/i18n/messages/pt-BR.json +53 -0
- package/app/src/i18n/messages/pt.json +54 -1
- package/app/src/shared/constants/providers.ts +40 -0
- package/app/src/shared/constants/sidebarVisibility.ts +6 -0
- package/app/src/shared/utils/circuitBreaker.ts +14 -4
- package/package.json +1 -1
- package/app/.next/server/chunks/ssr/src_05ekey-._.js +0 -3
- package/app/.next/server/chunks/ssr/src_100xxow._.js +0 -3
- package/app/.next/static/chunks/05tcrkqknq.20.js +0 -1
- package/app/.next/static/chunks/0eng4c9gz1s4..js +0 -1
- package/app/.next/static/chunks/0go~kwn1zgxnd.js +0 -1
- /package/app/.next/static/{Dbb1D6OoD7WlyZuPBm3L6 → ImZm5czz4prt8gnJPx7vv}/_buildManifest.js +0 -0
- /package/app/.next/static/{Dbb1D6OoD7WlyZuPBm3L6 → ImZm5czz4prt8gnJPx7vv}/_clientMiddlewareManifest.js +0 -0
- /package/app/.next/static/{Dbb1D6OoD7WlyZuPBm3L6 → ImZm5czz4prt8gnJPx7vv}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[296248,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(818465),j=a.i(32886),k=a.i(415925),l=b([f]);[f]=l.then?(await l)():l,a.s(["default",0,function(){let[a,b]=(0,e.useState)([]),[c,f]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)({type:"",message:""}),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)({type:"",message:""}),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)({type:"",message:""}),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(null),H=(0,e.useRef)(null),I=(0,j.useLocale)(),J=(0,k.useTranslations)("settings"),K=(0,k.useTranslations)("common"),[L,M]=(0,e.useState)({driver:"sqlite",dbPath:"~/.omniroute/storage.sqlite",sizeBytes:0,retentionDays:{app:7,call:7},lastBackupAt:null}),N=async()=>{f(!0);try{let a=await fetch("/api/db-backups"),c=await a.json();b(c.backups||[])}catch(a){console.error("Failed to fetch backups:",a)}finally{f(!1)}},O=async()=>{try{let a=await fetch("/api/storage/health");if(!a.ok)return;let b=await a.json();M(a=>({...a,...b}))}catch(a){console.error("Failed to fetch storage health:",a)}},P=async()=>{u(!0),w({type:"",message:""});try{let a=await fetch("/api/db-backups",{method:"PUT"}),b=await a.json();a.ok?(b.filename?w({type:"success",message:J("backupCreated",{file:b.filename})}):w({type:"info",message:b.message||J("noChangesSinceBackup")}),await O(),l&&await N()):w({type:"error",message:b.error||J("backupFailed")})}catch{w({type:"error",message:J("errorOccurred")})}finally{u(!1)}},Q=async a=>{q(a),o({type:"",message:""});try{let b=await fetch("/api/db-backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({backupId:a})}),c=await b.json();b.ok?(o({type:"success",message:J("restoreSuccess",{connections:c.connectionCount,nodes:c.nodeCount,combos:c.comboCount,apiKeys:c.apiKeyCount})}),await N(),await O()):o({type:"error",message:c.error||J("restoreFailed")})}catch{o({type:"error",message:J("errorDuringRestore")})}finally{q(null),s(null)}};(0,e.useEffect)(()=>{O()},[]);let R=async()=>{y(!0);try{let a=await fetch("/api/db-backups/export");if(!a.ok){let b=await a.json();throw Error(b.error||J("exportFailed"))}let b=await a.blob(),c=URL.createObjectURL(b),d=(a.headers.get("Content-Disposition")||"").match(/filename="(.+)"/),e=d?d[1]:`omniroute-backup-${new Date().toISOString().replace(/[:.]/g,"-")}.sqlite`,f=document.createElement("a");f.href=c,f.download=e,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(c)}catch(a){console.error("Export failed:",a),C({type:"error",message:J("exportFailedWithError",{error:a.message})})}finally{y(!1)}},S=async()=>{if(F){A(!0),C({type:"",message:""}),E(!1);try{let a=await F.arrayBuffer(),b=await fetch(`/api/db-backups/import?filename=${encodeURIComponent(F.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:a}),c=await b.json();b.ok?(C({type:"success",message:J("importSuccess",{connections:c.connectionCount,nodes:c.nodeCount,combos:c.comboCount,apiKeys:c.apiKeyCount})}),await O(),l&&await N()):C({type:"error",message:c.error||J("importFailed")})}catch{C({type:"error",message:J("errorDuringImport")})}finally{A(!1),G(null)}}},T=a=>a&&0!==a?a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`:"0 B";return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"database"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:J("systemStorage")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:J("allDataLocal")})]}),(0,d.jsx)(i.Badge,{variant:"success",size:"sm",children:L.driver||"json"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-4",children:[(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg border border-border",children:[(0,d.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wide mb-1",children:J("databasePath")}),(0,d.jsx)("p",{className:"text-sm font-mono text-text-main break-all",children:L.dbPath||"~/.omniroute/storage.sqlite"})]}),(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg border border-border",children:[(0,d.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wide mb-1",children:J("databaseSize")}),(0,d.jsx)("p",{className:"text-sm font-mono text-text-main",children:T(L.sizeBytes)})]})]}),(0,d.jsx)("div",{className:"p-3 rounded-lg bg-bg border border-border mb-4",children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-text-main",children:"Log retention policy"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Request logs follow ",(0,d.jsx)("code",{children:"CALL_LOG_RETENTION_DAYS"}),". Application and audit logs follow ",(0,d.jsx)("code",{children:"APP_LOG_RETENTION_DAYS"}),"."]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(i.Badge,{variant:"default",size:"sm",children:["Call ",L.retentionDays.call,"d"]}),(0,d.jsxs)(i.Badge,{variant:"default",size:"sm",children:["App ",L.retentionDays.app,"d"]})]})]})}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:R,loading:x,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"download"}),J("exportDatabase")]}),(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:async()=>{y(!0);try{let a=await fetch("/api/db-backups/exportAll");if(!a.ok)throw Error(J("exportFailed"));let b=await a.blob(),c=(a.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),d=c?.[1]||"omniroute-full-backup.tar.gz",e=URL.createObjectURL(b),f=document.createElement("a");f.href=e,f.download=d,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(e)}catch(a){C({type:"error",message:J("fullExportFailedWithError",{error:a.message})})}finally{y(!1)}},loading:x,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"folder_zip"}),J("exportAll")]}),(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>{H.current?.click()},loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"upload"}),J("importDatabase")]}),(0,d.jsx)("input",{ref:H,type:"file",accept:".sqlite",className:"hidden",onChange:a=>{let b=a.target.files?.[0];if(b){if(!b.name.endsWith(".sqlite"))return void C({type:"error",message:J("invalidFileType")});G(b),E(!0),H.current&&(H.current.value="")}}})]}),D&&F&&(0,d.jsx)("div",{className:"p-4 rounded-lg mb-4 bg-amber-500/10 border border-amber-500/30",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px] text-amber-500 mt-0.5","aria-hidden":"true",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-amber-500 mb-1",children:J("confirmDbImport")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:J("confirmDbImportDesc",{file:F.name})}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(h.Button,{variant:"primary",size:"sm",onClick:S,className:"!bg-amber-500 hover:!bg-amber-600",children:J("yesImport")}),(0,d.jsx)(h.Button,{variant:"outline",size:"sm",onClick:()=>{E(!1),G(null)},children:K("cancel")})]})]})]})}),B.message&&(0,d.jsx)("div",{className:`p-3 rounded-lg mb-4 text-sm ${"success"===B.type?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===B.type?"check_circle":"error"}),B.message]})}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-bg border border-border mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-500","aria-hidden":"true",children:"schedule"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:J("lastBackup")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:L.lastBackupAt?`${new Date(L.lastBackupAt).toLocaleString(I)} (${(a=>{if(!a)return null;let b=new Date,c=new Date(a),d=Math.floor((b-c)/6e4);if(d<1)return J("justNow");if(d<60)return J("minutesAgo",{count:d});let e=Math.floor(d/60);if(e<24)return J("hoursAgo",{count:e});let f=Math.floor(e/24);return J("daysAgo",{count:f})})(L.lastBackupAt)})`:J("noBackupYet")})]})]}),(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:P,loading:t,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"backup"}),J("backupNow")]})]}),v.message&&(0,d.jsx)("div",{className:`p-3 rounded-lg mb-4 text-sm ${"success"===v.type?"bg-green-500/10 text-green-500 border border-green-500/20":"info"===v.type?"bg-blue-500/10 text-blue-500 border border-blue-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===v.type?"check_circle":"info"===v.type?"info":"error"}),v.message]})}),(0,d.jsxs)("div",{className:"pt-3 border-t border-border/50",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-amber-500","aria-hidden":"true",children:"restore"}),(0,d.jsx)("p",{className:"font-medium",children:J("backupRestore")})]}),(0,d.jsx)(h.Button,{variant:"outline",size:"sm",onClick:()=>{m(!l),l||0!==a.length||N()},children:l?J("hide"):J("viewBackups")})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-3",children:J("backupRetentionDesc")}),n.message&&(0,d.jsx)("div",{className:`p-3 rounded-lg mb-3 text-sm ${"success"===n.type?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===n.type?"check_circle":"error"}),n.message]})}),l&&(0,d.jsx)("div",{className:"flex flex-col gap-2",children:c?(0,d.jsxs)("div",{className:"flex items-center justify-center py-6 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px] mr-2","aria-hidden":"true",children:"progress_activity"}),J("loadingBackups")]}):0===a.length?(0,d.jsxs)("div",{className:"text-center py-6 text-text-muted text-sm",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px] mb-2 block opacity-40","aria-hidden":"true",children:"folder_off"}),J("noBackupsYet")]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:J("backupsAvailable",{count:a.length})}),(0,d.jsxs)("button",{onClick:N,className:"text-xs text-primary hover:underline flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"refresh"}),J("refresh")]})]}),a.map(a=>{var b;return(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-black/[0.02] dark:bg-white/[0.02] border border-border/50 hover:border-border transition-colors",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-500","aria-hidden":"true",children:"description"}),(0,d.jsx)("span",{className:"text-sm font-medium truncate",children:new Date(a.createdAt).toLocaleString(I)}),(0,d.jsx)(i.Badge,{variant:"pre-restore"===a.reason?"warning":"manual"===a.reason?"success":"default",size:"sm",children:(b=a.reason,"manual"===b?J("backupReasonManual"):"pre-restore"===b?J("backupReasonPreRestore"):b)})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted ml-6",children:[(0,d.jsx)("span",{children:J("connectionsCount",{count:a.connectionCount})}),(0,d.jsx)("span",{children:"•"}),(0,d.jsx)("span",{children:T(a.size)})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 ml-3",children:r===a.id?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-xs text-amber-500 font-medium",children:J("confirm")}),(0,d.jsx)(h.Button,{variant:"primary",size:"sm",onClick:()=>Q(a.id),loading:p===a.id,className:"!bg-amber-500 hover:!bg-amber-600",children:J("yes")}),(0,d.jsx)(h.Button,{variant:"outline",size:"sm",onClick:()=>s(null),children:J("no")})]}):(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>s(a.id),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"restore"}),J("restore")]})})]},a.id)})]})})]})]})}]),c()}catch(a){c(a)}},!1),130361,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(415925),k=b([f]);[f]=k.then?(await k)():k;let l=[{value:"disabled",labelKey:"ipModeDisabled",icon:"block"},{value:"blacklist",labelKey:"ipModeBlacklist",icon:"do_not_disturb"},{value:"whitelist",labelKey:"ipModeWhitelist",icon:"verified_user"},{value:"whitelist-priority",labelKey:"ipModeWhitelistPriority",icon:"priority_high"}];a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!1,mode:"blacklist",blacklist:[],whitelist:[],tempBans:[]}),[c,f]=(0,e.useState)(!0),[k,m]=(0,e.useState)(""),[n,o]=(0,e.useState)("blacklist"),p=(0,j.useTranslations)("settings");(0,e.useEffect)(()=>{q()},[]);let q=async()=>{try{let a=await fetch("/api/settings/ip-filter");a.ok&&b(await a.json())}catch{}finally{f(!1)}},r=async a=>{try{let c=await fetch("/api/settings/ip-filter",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});c.ok&&b(await c.json())}catch{}},s=()=>{k.trim()&&(r({["blacklist"===n?"addBlacklist":"addWhitelist"]:k.trim()}),m(""))},t=(a,b)=>{r({["blacklist"===b?"removeBlacklist":"removeWhitelist"]:a})},u=a.enabled?a.mode:"disabled";return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-red-500/10 text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"security"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:p("ipAccessControl")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:p("ipAccessControlDesc")})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 mb-5",children:l.map(a=>(0,d.jsxs)("button",{onClick:()=>{var b;return b=a.value,void("disabled"===b?r({enabled:!1}):r({enabled:!0,mode:b}))},disabled:c,className:`flex flex-col items-center gap-1.5 p-3 rounded-lg border text-center transition-all ${u===a.value?"border-red-500/50 bg-red-500/5 ring-1 ring-red-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[20px] ${u===a.value?"text-red-400":"text-text-muted"}`,children:a.icon}),(0,d.jsx)("span",{className:`text-xs font-medium ${u===a.value?"text-red-400":"text-text-muted"}`,children:p(a.labelKey)})]},a.value))}),a.enabled&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 items-stretch sm:items-end",children:[(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)(i.Input,{label:p("addIpAddress"),placeholder:p("ipAddressPlaceholder"),value:k,onChange:a=>m(a.target.value),onKeyDown:a=>"Enter"===a.key&&s()})}),(0,d.jsxs)("div",{className:"flex gap-1 pb-[2px]",children:[(0,d.jsx)(h.Button,{size:"sm",variant:"blacklist"===n?"danger":"secondary",onClick:()=>{o("blacklist"),k.trim()&&s()},children:p("block")}),(0,d.jsx)(h.Button,{size:"sm",variant:"whitelist"===n?"primary":"secondary",onClick:()=>{o("whitelist"),k.trim()&&s()},children:p("allow")})]})]}),a.blacklist.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:p("blocked",{count:a.blacklist.length})}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.blacklist.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-mono bg-red-500/10 text-red-400 border border-red-500/20",children:[a,(0,d.jsx)("button",{onClick:()=>t(a,"blacklist"),className:"hover:text-red-300",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},a))})]}),a.whitelist.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:p("allowed",{count:a.whitelist.length})}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.whitelist.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-mono bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[a,(0,d.jsx)("button",{onClick:()=>t(a,"whitelist"),className:"hover:text-emerald-300",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},a))})]}),a.tempBans.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:p("temporaryBans",{count:a.tempBans.length})}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.tempBans.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 rounded-lg bg-orange-500/5 border border-orange-500/20 text-sm",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("span",{className:"font-mono text-xs text-orange-400 shrink-0",children:a.ip}),(0,d.jsxs)("span",{className:"text-xs text-text-muted truncate",children:["— ",a.reason]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted tabular-nums",children:p("minLeft",{min:Math.ceil(a.remainingMs/6e4)})}),(0,d.jsx)("button",{onClick:()=>{let b;return b=a.ip,r({removeBan:b})},className:"text-text-muted hover:text-orange-400",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]},a.ip))})]})]})]})}]),c()}catch(a){c(a)}},!1),860500,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(415925),j=b([f]);[f]=j.then?(await j)():j,a.s(["default",0,function(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!0),j=(0,i.useTranslations)("settings");(0,e.useEffect)(()=>{let a=!1;return async function(){let c=sessionStorage.getItem("omniroute_login_time"),d=Date.now(),e=j("unknown");if(c){let a=d-parseInt(c,10),b=Math.floor(a/36e5),f=Math.floor(a%36e5/6e4);e=b>0?`${b}h ${f}m`:`${f}m`}let g=!1;try{let a=await fetch("/api/auth/status",{method:"GET",cache:"no-store"});if(a.ok){let b=await a.json();g=!0===b.authenticated}}catch{}a||(b({authenticated:g,loginTime:c?new Date(parseInt(c,10)).toLocaleString():null,sessionAge:e,ipAddress:"—",userAgent:navigator.userAgent.split(" ").slice(-2).join(" ")||j("unknown")}),f(!1))}(),()=>{a=!0}},[]);let k=async()=>{try{await fetch("/api/auth/logout",{method:"POST"}),sessionStorage.removeItem("omniroute_login_time"),window.location.href="/"}catch{window.location.href="/"}};return c?(0,d.jsx)(g.Card,{children:(0,d.jsx)("div",{className:"animate-pulse h-32 bg-black/5 dark:bg-white/5 rounded-lg"})}):(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"person"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:j("session")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",role:"list","aria-label":j("sessionDetailsAria"),children:[(0,d.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,d.jsx)("span",{className:"text-text-muted",children:j("status")}),(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full ${a?.authenticated?"bg-green-500":"bg-yellow-500"}`,"aria-hidden":"true"}),a?.authenticated?j("authenticated"):j("guest")]})]}),a?.loginTime&&(0,d.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,d.jsx)("span",{className:"text-text-muted",children:j("loginTime")}),(0,d.jsx)("span",{className:"font-mono text-xs",children:a.loginTime})]}),(0,d.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,d.jsx)("span",{className:"text-text-muted",children:j("sessionAge")}),(0,d.jsx)("span",{className:"font-mono text-xs",children:a?.sessionAge})]}),(0,d.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,d.jsx)("span",{className:"text-text-muted",children:j("browser")}),(0,d.jsx)("span",{className:"font-mono text-xs truncate max-w-[200px]",children:a?.userAgent})]})]}),(0,d.jsxs)("div",{className:"flex gap-3 mt-4 pt-4 border-t border-border/50",children:[(0,d.jsx)(h.Button,{variant:"secondary",onClick:()=>{confirm(j("clearLocalDataConfirm"))&&(localStorage.clear(),sessionStorage.clear(),window.location.reload())},children:j("clearLocalData")}),a?.authenticated&&(0,d.jsx)(h.Button,{variant:"danger",onClick:k,children:j("logout")})]})]})}]),c()}catch(a){c(a)}},!1),547655,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(709918),k=a.i(662073),l=a.i(130361),m=a.i(860500),n=a.i(415925),o=b([f,k,l,m]);[f,k,l,m]=o.then?(await o)():o,a.s(["default",0,function(){let[a,b]=(0,e.useState)({requireLogin:!1,hasPassword:!1}),[c,f]=(0,e.useState)(!0),[o,p]=(0,e.useState)({current:"",new:"",confirm:""}),[q,r]=(0,e.useState)({type:"",message:""}),[s,t]=(0,e.useState)(!1),u=(0,n.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let v=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:a})})).ok&&b(b=>({...b,requireLogin:a}))}catch(a){console.error("Failed to update require login:",a)}},w=async(a,c)=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:c})})).ok&&b(b=>({...b,[a]:c}))}catch(b){console.error(`Failed to update ${a}:`,b)}},x=async a=>{if(a.preventDefault(),o.new!==o.confirm)return void r({type:"error",message:u("passwordsNoMatch")});t(!0),r({type:"",message:""});try{let a=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:o.current,newPassword:o.new})}),b=await a.json();a.ok?(r({type:"success",message:u("passwordUpdated")}),p({current:"",new:"",confirm:""})):r({type:"error",message:b.error||u("failedUpdatePassword")})}catch{r({type:"error",message:u("errorOccurred")})}finally{t(!1)}},y=a.blockedProviders||[];return(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"shield"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:u("security")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:u("requireLogin")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:u("requireLoginDesc")})]}),(0,d.jsx)(j.Toggle,{checked:!0===a.requireLogin,onChange:()=>v(!a.requireLogin),disabled:c})]}),!0===a.requireLogin&&(0,d.jsxs)("form",{onSubmit:x,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[a.hasPassword&&(0,d.jsx)(i.Input,{label:u("currentPassword"),type:"password",placeholder:u("enterCurrentPassword"),value:o.current,onChange:a=>p({...o,current:a.target.value}),required:!0}),(0,d.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,d.jsx)(i.Input,{label:u("newPassword"),type:"password",placeholder:u("enterNewPassword"),value:o.new,onChange:a=>p({...o,new:a.target.value}),required:!0}),(0,d.jsx)(i.Input,{label:u("confirmPassword"),type:"password",placeholder:u("confirmPasswordPlaceholder"),value:o.confirm,onChange:a=>p({...o,confirm:a.target.value}),required:!0})]}),q.message&&(0,d.jsx)("p",{className:`text-sm ${"error"===q.type?"text-red-500":"text-green-500"}`,children:q.message}),(0,d.jsx)("div",{className:"pt-2",children:(0,d.jsx)(h.Button,{type:"submit",variant:"primary",loading:s,children:a.hasPassword?u("updatePassword"):u("setPassword")})})]})]})]}),(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-600 dark:text-amber-400",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"api"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:u("apiEndpointProtection")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:u("requireAuthModels")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:u("requireAuthModelsDesc")})]}),(0,d.jsx)(j.Toggle,{checked:!0===a.requireAuthForModels,onChange:()=>w("requireAuthForModels",!a.requireAuthForModels),disabled:c})]}),(0,d.jsxs)("div",{className:"pt-4 border-t border-border/50",children:[(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("p",{className:"font-medium",children:u("blockedProviders")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:u("blockedProvidersDesc")})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.values(k.AI_PROVIDERS).map(b=>{let e=y.includes(b.id);return(0,d.jsxs)("button",{onClick:()=>{var c;let d,e;return c=b.id,e=(d=a.blockedProviders||[]).includes(c)?d.filter(a=>a!==c):[...d,c],void w("blockedProviders",e)},disabled:c,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all border ${e?"bg-red-500/10 border-red-500/30 text-red-600 dark:text-red-400":"bg-black/[0.02] dark:bg-white/[0.02] border-transparent text-text-muted hover:bg-black/[0.05] dark:hover:bg-white/[0.05]"}`,title:e?u("unblockProviderTitle",{provider:b.name}):u("blockProviderTitle",{provider:b.name}),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:{color:e?void 0:b.color},children:e?"block":b.icon}),b.name,e&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px] text-red-500",children:"close"})]},b.id)})}),y.length>0&&(0,d.jsxs)("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-2 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),u("providersBlocked",{count:y.length})]})]})]})]}),(0,d.jsx)(m.default,{}),(0,d.jsx)(l.default,{})]})}]),c()}catch(a){c(a)}},!1),754828,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(609754),k=a.i(240246),l=a.i(415925),m=b([f]);[f]=m.then?(await m)():m;let n=["#6366f1","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899","#14b8a6"];a.s(["default",0,function(){let[a,b]=(0,e.useState)({}),[c,f]=(0,e.useState)(!0),[m,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(!1),v=(0,k.useNotificationStore)(),w=(0,l.useTranslations)("settings"),x=(0,l.useTranslations)("common"),y=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/fallback/chains");if(a.ok){let c=await a.json();b(c.chains||c||{})}}catch{}finally{f(!1)}},[]);(0,e.useEffect)(()=>{y()},[y]);let z=async()=>{if(!p.trim()||!r.trim())return void v.warning(w("fillModelAndProviders"));let a=r.split(",").map(a=>a.trim()).filter(Boolean).map((a,b)=>({provider:a,priority:b+1,enabled:!0}));if(0===a.length)return void v.warning(w("addAtLeastOneProvider"));u(!0);try{(await fetch("/api/fallback/chains",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:p.trim(),chain:a})})).ok?(v.success(w("chainCreated",{model:p.trim()})),q(""),s(""),o(!1),await y()):v.error(w("failedCreateChain"))}catch{v.error(w("failedCreateChain"))}finally{u(!1)}},A=async a=>{if(confirm(w("deleteChainConfirm",{model:a})))try{(await fetch("/api/fallback/chains",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a})})).ok?(v.success(w("chainDeleted",{model:a})),await y()):v.error(w("failedDeleteChain"))}catch{v.error(w("failedDeleteChain"))}};if(c)return(0,d.jsx)(g.Card,{className:"p-6 mt-6",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"timeline"}),w("loadingFallbackChains")]})});let B=Object.entries(a);return(0,d.jsxs)(g.Card,{className:"mt-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4 p-6 pb-0",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"timeline"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:w("fallbackChainsTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:w("fallbackChainsDesc")})]}),(0,d.jsx)(h.Button,{size:"sm",variant:"primary",onClick:()=>o(!m),children:m?x("cancel"):w("addChain")})]}),m&&(0,d.jsxs)("div",{className:"mx-6 p-4 rounded-lg border border-border/30 bg-surface/20 mb-4",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 mb-3",children:[(0,d.jsx)(i.Input,{label:w("modelName"),placeholder:w("modelNamePlaceholder"),value:p,onChange:a=>q(a.target.value)}),(0,d.jsx)(i.Input,{label:w("providersCommaSeparated"),placeholder:w("providersCommaSeparatedPlaceholder"),value:r,onChange:a=>s(a.target.value)})]}),(0,d.jsx)(h.Button,{variant:"primary",size:"sm",onClick:z,loading:t,children:w("createChain")})]}),(0,d.jsx)("div",{className:"px-6 pb-6",children:0===B.length?(0,d.jsx)(j.EmptyState,{icon:"timeline",title:w("noFallbackChains"),description:w("noFallbackChainsDesc")}):(0,d.jsx)("div",{className:"flex flex-col gap-2",children:B.map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 rounded-lg border border-border/20 bg-surface/20 hover:bg-surface/40 transition-colors",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"font-mono text-sm text-text-main truncate max-w-[200px]",children:a}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("div",{className:"flex gap-1.5 flex-wrap",children:(Array.isArray(b)?b:[]).map((a,b)=>(0,d.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:`${n[b%n.length]}20`,color:n[b%n.length],border:`1px solid ${n[b%n.length]}40`},children:[b+1,". ",a.provider]},`${a.provider}-${b}`))})]}),(0,d.jsx)("button",{onClick:()=>A(a),className:"text-text-muted hover:text-red-400 transition-colors ml-2",title:w("deleteChain"),children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},a))})})]})}]),c()}catch(a){c(a)}},!1),72926,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(489108),i=a.i(294023),j=a.i(754828),k=a.i(669805),l=a.i(415925),m=b([f,j]);[f,j]=m.then?(await m)():m;let n=k.ROUTING_STRATEGIES.filter(a=>k.SETTINGS_FALLBACK_STRATEGY_VALUES.includes(a.value)).map(a=>({value:a.value,labelKey:a.labelKey,descKey:a.settingsDescKey,icon:a.icon}));a.s(["default",0,function(){let[a,b]=(0,e.useState)({fallbackStrategy:"fill-first",alwaysPreserveClientCache:"auto"}),[c,f]=(0,e.useState)(!0),[k,m]=(0,e.useState)([]),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),s=(0,l.useTranslations)("settings"),t=n.reduce((a,b)=>(a[b.value]=b.descKey,a),{});(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>a.json()).then(a=>{b(a),m(a.wildcardAliases||[]),f(!1)}).catch(()=>f(!1))},[]);let u=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&b(b=>({...b,...a}))}catch(a){console.error("Failed to update settings:",a)}},v=async()=>{if(!o.trim()||!q.trim())return;let a=[...k,{pattern:o.trim(),target:q.trim()}];await u({wildcardAliases:a}),m(a),p(""),r("")},w=async a=>{let b=k.filter((b,c)=>c!==a);await u({wildcardAliases:b}),m(b)};return(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"route"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("routingStrategy")})]}),(0,d.jsxs)("div",{className:"mb-4 rounded-lg border border-blue-500/20 bg-blue-500/5 p-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-blue-700 dark:text-blue-300",children:s("routingAdvancedGuideTitle")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s("routingAdvancedGuideHint1")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:s("routingAdvancedGuideHint2")})]}),(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-2 mb-4",style:{gridAutoRows:"1fr"},children:n.map(b=>(0,d.jsxs)("button",{onClick:()=>u({fallbackStrategy:b.value}),disabled:c,className:`flex flex-col items-center gap-2 p-4 rounded-lg border text-center transition-all ${a.fallbackStrategy===b.value?"border-blue-500/50 bg-blue-500/5 ring-1 ring-blue-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[24px] ${a.fallbackStrategy===b.value?"text-blue-400":"text-text-muted"}`,children:b.icon}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:`text-sm font-medium ${a.fallbackStrategy===b.value?"text-blue-400":""}`,children:s(b.labelKey)}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:s(b.descKey)})]})]},b.value))}),"round-robin"===a.fallbackStrategy&&(0,d.jsxs)("div",{className:"flex items-center justify-between pt-3 border-t border-border/30",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:s("stickyLimit")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:s("stickyLimitDesc")})]}),(0,d.jsx)(h.Input,{type:"number",min:"1",max:"10",value:a.stickyRoundRobinLimit||3,onChange:a=>u({stickyRoundRobinLimit:parseInt(a.target.value)}),disabled:c,className:"w-20 text-center"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted italic pt-3 border-t border-border/30 mt-3",children:s(t[a.fallbackStrategy]||"fillFirstDesc")})]}),(0,d.jsx)(g.Card,{children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500 h-fit",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"network_ping"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("adaptiveVolumeRouting")||"Adaptive Volume Routing"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-1",children:s("adaptiveVolumeRoutingDesc")||"Automatically adjusts traffic volume between providers based on real-time latency and error rates."})]})]}),(0,d.jsx)("div",{className:"pt-1",children:(0,d.jsxs)("label",{className:"relative inline-flex items-center cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",className:"sr-only peer",checked:!!a.adaptiveVolumeRouting,onChange:a=>u({adaptiveVolumeRouting:a.target.checked}),disabled:c}),(0,d.jsx)("div",{className:"w-11 h-6 bg-border peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary"})]})})]})}),(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"alt_route"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("modelAliases")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:s("modelAliasesDesc")})]})]}),k.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-1.5 mb-4",children:k.map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm",children:[(0,d.jsx)("span",{className:"font-mono text-purple-400 break-all",children:a.pattern}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("span",{className:"font-mono text-text-main break-all",children:a.target})]}),(0,d.jsx)("button",{onClick:()=>w(b),className:"shrink-0 text-text-muted hover:text-red-400 transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},b))}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 items-stretch sm:items-end",children:[(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)(h.Input,{label:s("pattern"),placeholder:s("aliasPatternPlaceholder"),value:o,onChange:a=>p(a.target.value)})}),(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)(h.Input,{label:s("targetModel"),placeholder:s("aliasTargetPlaceholder"),value:q,onChange:a=>r(a.target.value)})}),(0,d.jsx)(i.Button,{size:"sm",variant:"primary",onClick:v,className:"mb-[2px] sm:w-auto w-full",children:s("add")})]})]}),(0,d.jsx)(j.default,{}),(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"cached"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:"Client Cache Control"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Configure how client-side cache_control headers are handled"})]})]}),(0,d.jsx)("div",{className:"space-y-3",children:[{value:"auto",label:"Auto (Recommended)",desc:"Preserve cache_control only for caching-aware clients (Claude Code) with deterministic routing"},{value:"always",label:"Always Preserve",desc:"Always forward client cache_control headers to upstream providers"},{value:"never",label:"Never Preserve",desc:"Always remove client cache_control headers, let OmniRoute manage caching"}].map(b=>(0,d.jsxs)("button",{onClick:()=>u({alwaysPreserveClientCache:b.value}),disabled:c,className:`w-full flex flex-col items-start gap-1 p-3 rounded-lg border text-left transition-all ${a.alwaysPreserveClientCache===b.value?"border-green-500/50 bg-green-500/5 ring-1 ring-green-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[16px] ${a.alwaysPreserveClientCache===b.value?"text-green-400":"text-text-muted"}`,children:a.alwaysPreserveClientCache===b.value?"check_circle":"radio_button_unchecked"}),(0,d.jsx)("span",{className:`text-sm font-medium ${a.alwaysPreserveClientCache===b.value?"text-green-400":""}`,children:b.label})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted ml-7",children:b.desc})]},b.value))})]})]})}]),c()}catch(a){c(a)}},!1),589980,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(709918),k=a.i(171302),l=a.i(669805),m=a.i(415925),n=b([f]);[f]=n.then?(await n)():n,a.s(["default",0,function(){let[a,b]=(0,e.useState)({strategy:"priority",maxRetries:1,retryDelayMs:2e3,timeoutMs:12e4,healthCheckEnabled:!0,healthCheckTimeoutMs:3e3,maxComboDepth:3,trackMetrics:!0}),[c,f]=(0,e.useState)({}),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(!1),r=(0,m.useTranslations)("settings"),s=(0,m.useTranslations)("common"),t=l.ROUTING_STRATEGIES.map(a=>({value:a.value,label:r(a.labelKey),icon:a.icon})),u=[{key:"maxRetries",label:r("maxRetriesLabel"),min:0,max:5},{key:"retryDelayMs",label:r("retryDelayLabel"),min:500,max:1e4,step:500},{key:"timeoutMs",label:r("timeoutLabel"),min:5e3,max:3e5,step:5e3},{key:"maxComboDepth",label:r("maxNestingDepth"),min:1,max:10}];(0,e.useEffect)(()=>{fetch("/api/settings/combo-defaults").then(a=>a.json()).then(a=>{a.comboDefaults&&b(a.comboDefaults),a.providerOverrides&&f(a.providerOverrides)}).catch(a=>console.error("Failed to fetch combo defaults:",a))},[]);let v=async()=>{q(!0);try{await fetch("/api/settings/combo-defaults",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboDefaults:a,providerOverrides:c})})}catch(a){console.error("Failed to save combo defaults:",a)}finally{q(!1)}},w=()=>{let a=n.trim().toLowerCase();a&&!c[a]&&(f(b=>({...b,[a]:{maxRetries:1,timeoutMs:12e4}})),o(""))};return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"tune"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:r("comboDefaultsTitle")}),(0,d.jsx)("span",{className:"text-xs text-text-muted ml-auto",children:r("globalComboConfig")})]}),(0,d.jsxs)("div",{className:"mb-4 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:r("comboDefaultsGuideTitle")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:r("comboDefaultsGuideHint1")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:r("comboDefaultsGuideHint2")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium text-sm",children:r("defaultStrategy")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:r("defaultStrategyDesc")})]}),(0,d.jsx)("div",{role:"tablist","aria-label":r("comboStrategyAria"),className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-1 p-0.5 rounded-md bg-black/5 dark:bg-white/5",children:t.map(c=>(0,d.jsxs)("button",{role:"tab","aria-selected":a.strategy===c.value,onClick:()=>b(a=>({...a,strategy:c.value})),className:(0,k.cn)("px-2 py-1 rounded text-xs font-medium transition-all flex items-center justify-center gap-0.5",a.strategy===c.value?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:c.icon}),c.label]},c.value))})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border/50",children:u.map(({key:c,label:e,min:f,max:g,step:h})=>(0,d.jsx)(i.Input,{label:e,type:"number",min:f,max:g,step:h||1,value:a[c]??"",onChange:a=>b(b=>({...b,[c]:parseInt(a.target.value)||0})),className:"text-sm"},c))}),"round-robin"===a.strategy&&(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border/50",children:[(0,d.jsx)(i.Input,{label:r("concurrencyPerModel"),type:"number",min:1,max:20,value:a.concurrencyPerModel??"",placeholder:"3",onChange:a=>b(b=>({...b,concurrencyPerModel:parseInt(a.target.value)||0})),className:"text-sm"}),(0,d.jsx)(i.Input,{label:r("queueTimeout"),type:"number",min:1e3,max:12e4,step:1e3,value:a.queueTimeoutMs??"",placeholder:"30000",onChange:a=>b(b=>({...b,queueTimeoutMs:parseInt(a.target.value)||0})),className:"text-sm"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 pt-3 border-t border-border/50",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium text-sm",children:r("healthCheck")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:r("healthCheckDesc")})]}),(0,d.jsx)(j.Toggle,{checked:!1!==a.healthCheckEnabled,onChange:()=>b(a=>({...a,healthCheckEnabled:!a.healthCheckEnabled}))})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium text-sm",children:r("trackMetrics")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:r("trackMetricsDesc")})]}),(0,d.jsx)(j.Toggle,{checked:!1!==a.trackMetrics,onChange:()=>b(a=>({...a,trackMetrics:!a.trackMetrics}))})]})]}),(0,d.jsxs)("div",{className:"pt-3 border-t border-border/50",children:[(0,d.jsx)("p",{className:"font-medium text-sm mb-2",children:r("providerOverrides")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-3",children:r("providerOverridesDesc")}),Object.entries(c).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-2 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,d.jsx)("span",{className:"text-xs font-mono font-medium min-w-[80px]",children:a}),(0,d.jsx)(i.Input,{type:"number",min:"0",max:"5",value:b.maxRetries??1,onChange:b=>f(c=>({...c,[a]:{...c[a],maxRetries:parseInt(b.target.value)||0}})),className:"text-xs w-16","aria-label":r("providerMaxRetriesAria",{provider:a})}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:r("retries")}),(0,d.jsx)(i.Input,{type:"number",min:"5000",max:"300000",step:"5000",value:b.timeoutMs??12e4,onChange:b=>f(c=>({...c,[a]:{...c[a],timeoutMs:parseInt(b.target.value)||12e4}})),className:"text-xs w-24","aria-label":r("providerTimeoutAria",{provider:a})}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:r("ms")}),(0,d.jsx)("button",{onClick:()=>{f(b=>{let c={...b};return delete c[a],c})},className:"ml-auto text-red-400 hover:text-red-500 transition-colors","aria-label":r("removeProviderOverrideAria",{provider:a}),children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]},a)),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,d.jsx)(i.Input,{type:"text",placeholder:r("newProviderNamePlaceholder"),value:n,onChange:a=>o(a.target.value),onKeyDown:a=>"Enter"===a.key&&w(),className:"text-xs flex-1","aria-label":r("newProviderNameAria")}),(0,d.jsx)(h.Button,{variant:"outline",size:"sm",onClick:w,disabled:!n.trim(),children:s("add")})]})]}),(0,d.jsx)("div",{className:"pt-3 border-t border-border/50",children:(0,d.jsx)(h.Button,{variant:"primary",size:"sm",onClick:v,loading:p,children:r("saveComboDefaults")})})]})]})}]),c()}catch(a){c(a)}},!1),928050,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(294023),h=a.i(292216),i=a.i(563203),j=b([f]);[f]=j.then?(await j)():j;let k={id:"",name:"",type:"http",host:"",port:"8080",username:"",password:"",region:"",notes:"",status:"active"};a.s(["default",0,function(){let[a,b]=(0,e.useState)([]),[c,f]=(0,e.useState)(!1),[j,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(k),[s,t]=(0,e.useState)({}),[u,v]=(0,e.useState)({}),[w,x]=(0,e.useState)({}),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)("provider"),[I,J]=(0,e.useState)(""),[K,L]=(0,e.useState)(""),M=(0,e.useMemo)(()=>q.id||"",[q.id]),N=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/settings/proxies/health?hours=24"),b=await a.json().catch(()=>({}));if(!a.ok)return;let c=Array.isArray(b?.items)?b.items:[],d=Object.fromEntries(c.map(a=>[a.proxyId,a]));v(d)}catch{}},[]),O=(0,e.useCallback)(async a=>{if(a.length)try{let b=await Promise.all(a.map(a=>fetch(`/api/settings/proxies/assignments?proxyId=${encodeURIComponent(a)}`).then(a=>a.ok?a.json():null).then(b=>{let c=Array.isArray(b?.items)?b.items:[],d=new Set,e=c.filter(a=>{let b=`${a.scope}:${a.scopeId??""}`;return!d.has(b)&&(d.add(b),!0)});return[a,{count:e.length,assignments:e}]}).catch(()=>[a,{count:0,assignments:[]}])));t(Object.fromEntries(b))}catch{}},[]),P=(0,e.useCallback)(async()=>{f(!0),l(null);try{let a=await fetch("/api/settings/proxies"),c=await a.json().catch(()=>({}));if(!a.ok){l(c?.error?.message||"Failed to load proxy registry"),b([]);return}let d=Array.isArray(c?.items)?c.items:[];b(d);let e=d.map(a=>a.id).filter(Boolean);N(),O(e)}catch(a){l(a?.message||"Failed to load proxy registry"),b([])}finally{f(!1)}},[N,O]);(0,e.useEffect)(()=>{P()},[P]),(0,e.useEffect)(()=>{a.length>0&&!K&&L(a[0].id)},[a,K]);let Q=async a=>{if(!y){z(a.id),x(b=>({...b,[a.id]:null}));try{let b=await fetch("/api/settings/proxy/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyId:a.id,proxy:{type:a.type||"http",host:a.host,port:String(a.port||8080)}})}),c=await b.json().catch(()=>({}));if(!b.ok)return void x(b=>({...b,[a.id]:{success:!1,error:c?.error?.message||"Test failed"}}));x(b=>({...b,[a.id]:{success:!0,...c}}))}catch(b){x(c=>({...c,[a.id]:{success:!1,error:b?.message}}))}finally{z(null)}}},R=async()=>{if(!q.name.trim()||!q.host.trim())return void l("Name and host are required");p(!0),l(null);let a=q.username.trim(),b=q.password.trim(),c={...M?{id:M}:{},name:q.name.trim(),type:q.type,host:q.host.trim(),port:Number(q.port||8080),region:q.region.trim()||null,notes:q.notes.trim()||null,status:q.status};(!M||a.length>0)&&(c.username=a),(!M||b.length>0)&&(c.password=b);try{let a=await fetch("/api/settings/proxies",{method:M?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),b=await a.json().catch(()=>({}));if(!a.ok)return void l(b?.error?.message||"Failed to save proxy");n(!1),r(k),await P()}catch(a){l(a?.message||"Failed to save proxy")}finally{p(!1)}},S=async a=>{try{let b=await fetch(`/api/settings/proxies?id=${encodeURIComponent(a)}`,{method:"DELETE"});if(b.ok)return void await P();let c=await b.json().catch(()=>({}));if(409===b.status){if(!window.confirm("This proxy is still assigned. Force delete and remove all assignments?"))return;let b=await fetch(`/api/settings/proxies?id=${encodeURIComponent(a)}&force=1`,{method:"DELETE"});if(!b.ok){let a=await b.json().catch(()=>({}));l(a?.error?.message||"Failed to force delete proxy");return}await P();return}l(c?.error?.message||"Failed to delete proxy")}catch(a){l(a?.message||"Failed to delete proxy")}},T=async()=>{B(!0),l(null);try{let a=await fetch("/api/settings/proxies/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:!1})}),b=await a.json().catch(()=>({}));if(!a.ok)return void l(b?.error?.message||"Failed to migrate legacy proxy config");await P()}catch(a){l(a?.message||"Failed to migrate legacy proxy config")}finally{B(!1)}},U=async()=>{F(!0),l(null);try{let a="global"===G?[]:I.split(/[\n,]/g).map(a=>a.trim()).filter(Boolean),b=await fetch("/api/settings/proxies/bulk-assign",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:G,scopeIds:a,proxyId:K||null})}),c=await b.json().catch(()=>({}));if(!b.ok)return void l(c?.error?.message||"Failed to run bulk assignment");D(!1),J(""),await P()}catch(a){l(a?.message||"Failed to run bulk assignment")}finally{F(!1)}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(h.Card,{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:"Proxy Registry"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Store reusable proxies and track assignments."})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(g.Button,{size:"sm",variant:"secondary",icon:"upgrade",onClick:T,loading:A,"data-testid":"proxy-registry-import-legacy",children:"Import Legacy"}),(0,d.jsx)(g.Button,{size:"sm",variant:"secondary",icon:"account_tree",onClick:()=>D(!0),"data-testid":"proxy-registry-open-bulk",children:"Bulk Assign"}),(0,d.jsx)(g.Button,{size:"sm",icon:"add",onClick:()=>{r(k),n(!0)},"data-testid":"proxy-registry-open-create",children:"Add Proxy"})]})]}),j&&(0,d.jsx)("div",{className:"mb-3 px-3 py-2 rounded border border-red-500/30 bg-red-500/10 text-sm text-red-400",children:j}),c?(0,d.jsx)("div",{className:"text-sm text-text-muted",children:"Loading proxies..."}):0===a.length?(0,d.jsx)("div",{className:"text-sm text-text-muted",children:"No saved proxies yet."}):(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full text-sm",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{className:"text-left text-text-muted border-b border-border",children:[(0,d.jsx)("th",{className:"py-2 pr-3",children:"Name"}),(0,d.jsx)("th",{className:"py-2 pr-3",children:"Endpoint"}),(0,d.jsx)("th",{className:"py-2 pr-3",children:"Status"}),(0,d.jsx)("th",{className:"py-2 pr-3",children:"Health (24h)"}),(0,d.jsx)("th",{className:"py-2 pr-3",children:"Usage"}),(0,d.jsx)("th",{className:"py-2",children:"Actions"})]})}),(0,d.jsx)("tbody",{children:a.map(a=>{s[a.id];let b=u[a.id];return(0,d.jsxs)("tr",{className:"border-b border-border/60",children:[(0,d.jsxs)("td",{className:"py-2 pr-3",children:[(0,d.jsx)("div",{className:"font-medium text-text-main",children:a.name}),a.region&&(0,d.jsx)("div",{className:"text-xs text-text-muted",children:a.region})]}),(0,d.jsxs)("td",{className:"py-2 pr-3 font-mono text-xs text-text-muted",children:[a.type,"://",a.host,":",a.port]}),(0,d.jsx)("td",{className:"py-2 pr-3",children:(0,d.jsx)("span",{className:"text-xs px-2 py-1 rounded border border-border bg-bg-subtle",children:a.status||"active"})}),(0,d.jsx)("td",{className:"py-2 pr-3 text-xs text-text-muted",children:(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:w[a.id]?w[a.id].success?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"text-emerald-400",children:["✓ ",w[a.id].publicIp]}),w[a.id].latencyMs&&(0,d.jsxs)("span",{children:[w[a.id].latencyMs,"ms"]})]}):(0,d.jsxs)("span",{className:"text-red-400",children:["✗ ",w[a.id].error||"failed"]}):b?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{children:[b.successRate??0,"% success"]}),(0,d.jsxs)("span",{children:[b.avgLatencyMs??"-"," ms avg"]})]}):(0,d.jsx)("span",{children:"—"})})}),(0,d.jsx)("td",{className:"py-2 pr-3 text-xs text-text-muted",children:null!=s[a.id]?`${s[a.id].count} assignment(s)`:"—"}),(0,d.jsx)("td",{className:"py-2",children:(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(g.Button,{size:"sm",variant:"ghost",icon:"speed",onClick:()=>void Q(a),loading:y===a.id,children:"Test"}),(0,d.jsx)(g.Button,{size:"sm",variant:"ghost",icon:"edit",onClick:()=>{r({id:a.id,name:a.name||"",type:a.type||"http",host:a.host||"",port:String(a.port||8080),username:"",password:"",region:a.region||"",notes:a.notes||"",status:a.status||"active"}),n(!0)},children:"Edit"}),(0,d.jsx)(g.Button,{size:"sm",variant:"ghost",icon:"delete",onClick:()=>void S(a.id),className:"!text-red-400",children:"Delete"})]})})]},a.id)})})]})})]}),(0,d.jsx)(i.Modal,{isOpen:m,onClose:()=>{o||n(!1)},title:M?"Edit Proxy":"Create Proxy",maxWidth:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Name"}),(0,d.jsx)("input",{"data-testid":"proxy-registry-name-input",className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.name,onChange:a=>r(b=>({...b,name:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Type"}),(0,d.jsxs)("select",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.type,onChange:a=>r(b=>({...b,type:a.target.value})),children:[(0,d.jsx)("option",{value:"http",children:"HTTP"}),(0,d.jsx)("option",{value:"https",children:"HTTPS"}),(0,d.jsx)("option",{value:"socks5",children:"SOCKS5"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Host"}),(0,d.jsx)("input",{"data-testid":"proxy-registry-host-input",className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.host,onChange:a=>r(b=>({...b,host:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Port"}),(0,d.jsx)("input",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.port,onChange:a=>r(b=>({...b,port:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Username"}),(0,d.jsx)("input",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.username,placeholder:M?"Leave blank to keep current username":"",onChange:a=>r(b=>({...b,username:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Password"}),(0,d.jsx)("input",{type:"password",className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.password,placeholder:M?"Leave blank to keep current password":"",onChange:a=>r(b=>({...b,password:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Region"}),(0,d.jsx)("input",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.region,onChange:a=>r(b=>({...b,region:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Status"}),(0,d.jsxs)("select",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.status,onChange:a=>r(b=>({...b,status:a.target.value})),children:[(0,d.jsx)("option",{value:"active",children:"active"}),(0,d.jsx)("option",{value:"inactive",children:"inactive"})]})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Notes"}),(0,d.jsx)("textarea",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.notes,onChange:a=>r(b=>({...b,notes:a.target.value})),rows:3})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-border",children:[(0,d.jsx)(g.Button,{size:"sm",variant:"secondary",onClick:()=>n(!1),children:"Cancel"}),(0,d.jsx)(g.Button,{size:"sm",icon:"save",onClick:R,loading:o,children:"Save"})]})]})}),(0,d.jsx)(i.Modal,{isOpen:C,onClose:()=>{E||D(!1)},title:"Bulk Proxy Assignment",maxWidth:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Scope"}),(0,d.jsxs)("select",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:G,onChange:a=>H(a.target.value),children:[(0,d.jsx)("option",{value:"global",children:"global"}),(0,d.jsx)("option",{value:"provider",children:"provider"}),(0,d.jsx)("option",{value:"account",children:"account"}),(0,d.jsx)("option",{value:"combo",children:"combo"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Proxy"}),(0,d.jsxs)("select",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:K,onChange:a=>L(a.target.value),children:[(0,d.jsx)("option",{value:"",children:"(clear assignment)"}),a.map(a=>(0,d.jsxs)("option",{value:a.id,children:[a.name," (",a.type,"://",a.host,":",a.port,")"]},a.id))]})]})]}),"global"!==G&&(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Scope IDs (comma or newline)"}),(0,d.jsx)("textarea",{"data-testid":"proxy-registry-bulk-scopeids-input",className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",rows:5,value:I,onChange:a=>J(a.target.value),placeholder:"provider-openai,provider-anthropic"})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-border",children:[(0,d.jsx)(g.Button,{size:"sm",variant:"secondary",onClick:()=>D(!1),children:"Cancel"}),(0,d.jsx)(g.Button,{size:"sm",icon:"done_all",onClick:U,loading:E,"data-testid":"proxy-registry-bulk-apply",children:"Apply"})]})]})})]})}]),c()}catch(a){c(a)}},!1),232327,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(248172),j=a.i(709918),k=a.i(415925),l=a.i(928050),m=b([f,l]);[f,l]=m.then?(await m)():m,a.s(["default",0,function(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)(null),m=(0,e.useRef)(!0),n=(0,k.useTranslations)("settings"),o=(0,k.useTranslations)("common"),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!0),t=async()=>{try{let a=await fetch("/api/settings/proxy?level=global");if(a.ok){let b=await a.json();f(b.proxy||null)}}catch{}},u=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({debugMode:a})})).ok&&q(a)}catch(a){console.error("Failed to update debugMode:",a)}};return(0,e.useEffect)(()=>(m.current=!0,async function(){try{let a=await fetch("/api/settings/proxy?level=global");if(!m.current)return;if(a.ok){let b=await a.json();m.current&&f(b.proxy||null)}}catch{}}(),()=>{m.current=!1}),[]),(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>{if(!a.ok)throw Error(`HTTP error ${a.status}`);return a.json()}).then(a=>{q(!0===a.debugMode),s(!1)}).catch(()=>s(!1))},[]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"vpn_lock"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:n("globalProxy")})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:n("globalProxyDesc")}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsxs)("span",{className:"px-2.5 py-1 rounded text-xs font-bold uppercase bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[c.type,"://",c.host,":",c.port]})}):(0,d.jsx)("span",{className:"text-sm text-text-muted",children:n("noGlobalProxy")}),(0,d.jsx)(h.Button,{size:"sm",variant:c?"secondary":"primary",icon:"settings",onClick:()=>{t(),b(!0)},children:c?o("edit"):n("configure")})]})]})}),(0,d.jsx)(l.default,{}),(0,d.jsx)(g.Card,{className:"p-6 mt-4",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-medium",children:n("debugToggle")})}),(0,d.jsx)(j.Toggle,{checked:p,onChange:()=>u(!p),disabled:r})]})})]}),(0,d.jsx)(i.ProxyConfigModal,{isOpen:a,onClose:()=>b(!1),level:"global",levelLabel:n("globalLabel"),onSaved:t})]})}]),c()}catch(a){c(a)}},!1),220584,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(294023),h=a.i(292216),i=a.i(709918),j=a.i(893711),k=a.i(788164),l=a.i(171302),m=a.i(415925),n=a.i(753506),o=b([f,j,k]);[f,j,k]=o.then?(await o)():o,a.s(["default",0,function(){let{theme:a,setTheme:b,isDark:c}=(0,j.useTheme)(),{colorTheme:f,customColor:o,setColorTheme:p,setCustomColorTheme:q}=(0,k.default)(),r=(0,m.useTranslations)("settings"),s=(0,m.useTranslations)("sidebar"),[t,u]=(0,e.useState)({}),[v,w]=(0,e.useState)(!0),[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)(o||"#3b82f6"),B=/^#([0-9a-fA-F]{6})$/.test(z.startsWith("#")?z:`#${z}`),C=(0,n.normalizeHiddenSidebarItems)(t[n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]),D=new Set(C),E=(a,b)=>"function"==typeof r.has&&r.has(a)?r(a):b;(0,e.useEffect)(()=>k.default.subscribe(a=>{a.customColor&&a.customColor!==z&&A(a.customColor)}),[]);let F={light:r("themeLight"),dark:r("themeDark"),system:r("themeSystem")};(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>{if(!a.ok)throw Error(`HTTP error ${a.status}`);return a.json()}).then(a=>{u({...a,[n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]:(0,n.normalizeHiddenSidebarItems)(a[n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY])}),w(!1)}).catch(()=>w(!1))},[]);let G=async(a,b)=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:b})})).ok&&u(c=>({...c,[a]:a===n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY?(0,n.normalizeHiddenSidebarItems)(b):b}))}catch(b){console.error(`Failed to update ${a}:`,b)}},H=[{id:"coral",color:k.COLOR_THEMES.coral,label:r("themeCoral")},{id:"blue",color:k.COLOR_THEMES.blue,label:r("themeBlue")},{id:"red",color:k.COLOR_THEMES.red,label:r("themeRed")},{id:"green",color:k.COLOR_THEMES.green,label:r("themeGreen")},{id:"violet",color:k.COLOR_THEMES.violet,label:r("themeViolet")},{id:"orange",color:k.COLOR_THEMES.orange,label:r("themeOrange")},{id:"cyan",color:k.COLOR_THEMES.cyan,label:r("themeCyan")}],I=!0===t.debugMode,J=n.SIDEBAR_SECTIONS.filter(a=>"debug"!==a.visibility||I).map(a=>{let b,c;return{...a,title:(b=a.titleKey,c=a.titleFallback,"function"==typeof s.has&&s.has(b)?s(b):c),items:a.items.map(a=>({...a,label:s(a.i18nKey)}))}});return(0,d.jsxs)(h.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"palette"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:r("appearance")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("darkMode")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("switchThemes")})]}),(0,d.jsx)(i.Toggle,{checked:c,onChange:()=>b(c?"light":"dark")})]}),(0,d.jsx)("div",{className:"pt-4 border-t border-border",children:(0,d.jsx)("div",{role:"tablist","aria-label":r("themeSelectionAria"),className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5",children:["light","dark","system"].map(c=>(0,d.jsxs)("button",{role:"tab","aria-selected":a===c,onClick:()=>b(c),className:(0,l.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all",a===c?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"light"===c?"light_mode":"dark"===c?"dark_mode":"contrast"}),(0,d.jsx)("span",{children:F[c]||c})]},c))})}),(0,d.jsxs)("div",{className:"pt-4 border-t border-border",children:[(0,d.jsx)("p",{className:"font-medium mb-1",children:r("themeAccent")}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-3",children:r("themeAccentDesc")}),(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 mb-3",children:H.map(a=>{let b=f===a.id;return(0,d.jsx)("button",{onClick:()=>p(a.id),className:(0,l.cn)("flex items-center justify-between gap-2 p-2 rounded-lg border transition-colors",b?"border-primary bg-primary/10 text-primary":"border-border hover:bg-surface/50 text-text-main"),children:(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"size-4 rounded-full border border-black/10 dark:border-white/20",style:{backgroundColor:a.color}}),(0,d.jsx)("span",{className:"text-sm font-medium",children:a.label})]})},a.id)})}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"color",value:z,onChange:a=>A(a.target.value),className:"h-10 w-12 rounded border border-border bg-surface cursor-pointer","aria-label":r("themeCustom")}),(0,d.jsx)("input",{type:"text",value:z,onChange:a=>A(a.target.value),placeholder:"#3b82f6",maxLength:7,className:`flex-1 h-10 px-3 rounded-lg bg-surface border text-sm text-text-main focus:outline-none ${B?"border-border focus:border-primary":"border-red-400 focus:border-red-500"}`}),(0,d.jsx)(g.Button,{onClick:()=>q(z),disabled:!B,children:r("themeCreate")})]})]}),(0,d.jsxs)("div",{className:"pt-4 border-t border-border",children:[(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("p",{className:"font-medium",children:r("sidebarVisibilityToggle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:E("sidebarVisibilityDesc","Hide any sidebar navigation entry to reduce visual clutter without disabling any features")})]}),(0,d.jsx)("div",{className:"flex flex-col gap-4",children:J.map(a=>(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface/40",children:[(0,d.jsx)("div",{className:"px-4 py-3 border-b border-border/70",children:(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted/70",children:a.title})}),(0,d.jsx)("div",{className:"divide-y divide-border/70",children:a.items.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[(0,d.jsx)("p",{className:"font-medium",children:a.label}),(0,d.jsx)(i.Toggle,{checked:!D.has(a.id),onChange:()=>{var b;let c;return b=a.id,c=D.has(b)?C.filter(a=>a!==b):[...C,b],void G(n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY,c)},disabled:v})]},a.id))})]},a.id))}),(0,d.jsx)("p",{className:"mt-3 text-xs text-text-muted",children:E("sidebarVisibilityHint","Any sidebar section is hidden automatically when all of its entries are hidden")})]}),(0,d.jsx)("div",{className:"pt-4 border-t border-border",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("hideHealthLogs")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("hideHealthLogsDesc")})]}),(0,d.jsx)(i.Toggle,{checked:!0===t.hideHealthCheckLogs,onChange:()=>G("hideHealthCheckLogs",!t.hideHealthCheckLogs),disabled:v})]})}),(0,d.jsxs)("div",{className:"pt-4 border-t border-border",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"badge"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold",children:r("whitelabeling")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("whitelabelingDesc")})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("appName")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("appNameDesc")})]}),(0,d.jsx)("input",{type:"text",value:t.instanceName||"OmniRoute",onChange:a=>G("instanceName",a.target.value),placeholder:"OmniRoute",maxLength:100,className:"h-10 px-3 rounded-lg bg-surface border border-border text-sm text-text-main focus:outline-none focus:border-primary w-48"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("customLogo")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("customLogoDesc")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:t.customLogoUrl||"",onChange:a=>G("customLogoUrl",a.target.value),className:"flex-1 h-10 px-3 rounded-lg bg-surface border border-border text-sm text-text-main focus:outline-none focus:border-primary",placeholder:"https://example.com/logo.png",maxLength:2e3}),(t.customLogoUrl||t.customLogoBase64)&&(0,d.jsx)("img",{src:t.customLogoBase64||t.customLogoUrl,alt:"Logo preview",className:"h-10 w-10 rounded border border-border object-contain bg-surface",onError:a=>{a.currentTarget.style.display="none"}})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("p",{className:"font-medium",children:r("uploadLogo")}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-surface border border-border text-sm text-text-main cursor-pointer hover:bg-surface/80 transition-colors",children:[(0,d.jsx)("input",{type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/gif,image/webp",onChange:a=>{let b=a.target.files?.[0];if(b){if(b.size>512e3)return void y("Logo file must be less than 500KB");if(!["image/png","image/jpeg","image/svg+xml","image/gif","image/webp"].includes(b.type))return void y("Invalid file type. Please upload PNG, JPG, SVG, GIF, or WebP.");y(null);let a=new FileReader;a.onerror=()=>{y("Failed to read file")},a.onload=a=>{let b=a.target?.result;G("customLogoBase64",b)},a.readAsDataURL(b)}},className:"hidden"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"upload"}),(0,d.jsx)("span",{children:r("uploadLogo")})]}),(0,d.jsx)(g.Button,{variant:"secondary",onClick:()=>{G("customLogoUrl",""),G("customLogoBase64","")},children:r("resetLogo")})]}),x&&(0,d.jsx)("p",{className:"text-sm text-red-500",children:x}),(t.customLogoBase64||t.customLogoUrl)&&(0,d.jsxs)("div",{className:"mt-2 p-3 bg-black/5 dark:bg-white/5 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:r("logoPreview")}),(0,d.jsx)("img",{src:t.customLogoBase64||t.customLogoUrl,alt:"Logo preview",className:"h-12 w-auto max-w-full rounded"})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 pt-4 border-t border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("customFavicon")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("customFaviconDesc")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:t.customFaviconUrl||"",onChange:a=>G("customFaviconUrl",a.target.value),className:"flex-1 h-10 px-3 rounded-lg bg-surface border border-border text-sm text-text-main focus:outline-none focus:border-primary",placeholder:"https://example.com/favicon.ico",maxLength:2e3}),(t.customFaviconUrl||t.customFaviconBase64)&&(0,d.jsx)("img",{src:t.customFaviconBase64||t.customFaviconUrl,alt:"Favicon preview",className:"h-10 w-10 rounded border border-border object-contain bg-surface",onError:a=>{a.currentTarget.style.display="none"}})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("p",{className:"font-medium",children:r("uploadFavicon")}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-surface border border-border text-sm text-text-main cursor-pointer hover:bg-surface/80 transition-colors",children:[(0,d.jsx)("input",{type:"file",accept:"image/png,image/x-icon,image/svg+xml,image/gif,image/webp",onChange:a=>{let b=a.target.files?.[0];if(b){if(b.size>51200)return void y("Favicon file must be less than 50KB");if(!["image/png","image/x-icon","image/svg+xml","image/gif","image/webp"].includes(b.type))return void y("Invalid file type. Please upload PNG, ICO, SVG, GIF, or WebP.");y(null);let a=new FileReader;a.onerror=()=>{y("Failed to read file")},a.onload=a=>{let b=a.target?.result;G("customFaviconBase64",b)},a.readAsDataURL(b)}},className:"hidden"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"upload"}),(0,d.jsx)("span",{children:r("uploadFavicon")})]}),(0,d.jsx)(g.Button,{variant:"secondary",onClick:()=>{G("customFaviconUrl",""),G("customFaviconBase64","")},children:r("resetFavicon")})]}),x&&!x.includes("Logo")&&(0,d.jsx)("p",{className:"text-sm text-red-500",children:x}),(t.customFaviconBase64||t.customFaviconUrl)&&(0,d.jsxs)("div",{className:"mt-2 p-3 bg-black/5 dark:bg-white/5 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:r("faviconPreview")}),(0,d.jsx)("img",{src:t.customFaviconBase64||t.customFaviconUrl,alt:"Favicon preview",className:"h-8 w-8 rounded"})]})]})]})]})]})]})}]),c()}catch(a){c(a)}},!1),413316,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i;let j=[{value:"passthrough",labelKey:"passthrough",descKey:"passthroughDesc",icon:"arrow_forward"},{value:"auto",labelKey:"auto",descKey:"autoDesc",icon:"auto_awesome"},{value:"custom",labelKey:"custom",descKey:"customDesc",icon:"tune"},{value:"adaptive",labelKey:"adaptive",descKey:"adaptiveDesc",icon:"trending_up"}],k=[{value:"none",labelKey:"effortNone"},{value:"low",labelKey:"effortLow"},{value:"medium",labelKey:"effortMedium"},{value:"high",labelKey:"effortHigh"}];a.s(["default",0,function(){let[a,b]=(0,e.useState)({mode:"passthrough",customBudget:10240,effortLevel:"medium"}),[c,f]=(0,e.useState)(!0),[i,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),o=(0,h.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/thinking-budget").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let p=async c=>{let d={...a,...c};b(d),l(!0),n("");try{(await fetch("/api/settings/thinking-budget",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).ok?(n("saved"),setTimeout(()=>n(""),2e3)):n("error")}catch{n("error")}finally{l(!1)}};return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"psychology"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:o("thinkingBudgetTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:o("thinkingBudgetDesc")})]}),"saved"===m&&(0,d.jsxs)("span",{className:"ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",o("saved")]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 mb-5",children:j.map(b=>(0,d.jsxs)("button",{onClick:()=>p({mode:b.value}),disabled:c||i,className:`flex items-start gap-3 p-3 rounded-lg border text-left transition-all ${a.mode===b.value?"border-violet-500/50 bg-violet-500/5 ring-1 ring-violet-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[20px] mt-0.5 ${a.mode===b.value?"text-violet-500":"text-text-muted"}`,children:b.icon}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:`text-sm font-medium ${a.mode===b.value?"text-violet-400":""}`,children:o(b.labelKey)}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:o(b.descKey)})]})]},b.value))}),"custom"===a.mode&&(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:o("tokenBudget")}),(0,d.jsxs)("span",{className:"text-sm font-mono tabular-nums text-violet-400",children:[a.customBudget.toLocaleString()," ",o("tokens")]})]}),(0,d.jsx)("input",{type:"range",min:"0",max:"131072",step:"1024",value:a.customBudget,onChange:a=>p({customBudget:parseInt(a.target.value)}),className:"w-full accent-violet-500"}),(0,d.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mt-1",children:[(0,d.jsx)("span",{children:o("off")}),(0,d.jsx)("span",{children:"1K"}),(0,d.jsx)("span",{children:"10K"}),(0,d.jsx)("span",{children:"64K"}),(0,d.jsx)("span",{children:"128K"})]})]}),"adaptive"===a.mode&&(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30",children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-3",children:o("baseEffortLevel")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-3",children:o("adaptiveHint")}),(0,d.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:k.map(b=>(0,d.jsx)("button",{onClick:()=>p({effortLevel:b.value}),disabled:c||i,className:`px-3 py-2 rounded-lg text-xs font-medium border transition-all ${a.effortLevel===b.value?"border-violet-500/50 bg-violet-500/10 text-violet-400":"border-border/50 text-text-muted hover:border-border"}`,children:o(b.labelKey)},b.value))})]})]})}]),c()}catch(a){c(a)}},!1),769979,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=b([f]);[f]=h.then?(await h)():h,a.s(["default",0,function(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)(!0),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("");(0,e.useEffect)(()=>{fetch("/api/settings/codex-service-tier").then(a=>a.json()).then(a=>{b(!!a.enabled),f(!1)}).catch(()=>f(!1))},[]);let l=async a=>{b(a),i(!0),k("");try{(await fetch("/api/settings/codex-service-tier",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:a})})).ok?(k("saved"),setTimeout(()=>k(""),2e3)):(k("error"),b(!a))}catch{k("error"),b(!a)}finally{i(!1)}};return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-sky-500/10 text-sky-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"bolt"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:"Codex Fast Service Tier"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Inject `service_tier=fast` into Codex requests when the client leaves it unset."})]}),"saved"===j&&(0,d.jsxs)("span",{className:"text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"}),"Saved"]}),"error"===j&&(0,d.jsxs)("span",{className:"text-xs font-medium text-rose-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),"Failed to save"]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-surface/30 border border-border/30",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"Force fast tier for Codex"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"Off by default. Applies only to Codex requests and does not override an explicit tier."})]}),(0,d.jsx)("button",{onClick:()=>l(!a),disabled:c||h,className:`relative inline-flex h-6 w-11 items-center rounded-full border transition-colors ${a?"bg-sky-500 border-sky-500":"bg-black/10 border-black/10 dark:bg-white/10 dark:border-white/10"}`,children:(0,d.jsx)("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${a?"translate-x-6":"translate-x-1"}`})})]})]})}]),c()}catch(a){c(a)}},!1),847910,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(709918),i=a.i(415925),j=b([f]);[f]=j.then?(await j)():j,a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!1,prompt:""}),[c,f]=(0,e.useState)(!0),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(null),n=(0,i.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/system-prompt").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let o=async c=>{let d={...a,...c};b(d),k("");try{(await fetch("/api/settings/system-prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).ok&&(k("saved"),setTimeout(()=>k(""),2e3))}catch{k("error")}};return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"edit_note"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:n("globalSystemPrompt")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:n("systemPromptDesc")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:["saved"===j&&(0,d.jsxs)("span",{className:"text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",n("saved")]}),(0,d.jsx)(h.Toggle,{checked:a.enabled,onChange:()=>o({enabled:!a.enabled}),disabled:c})]})]}),a.enabled&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("textarea",{value:a.prompt,onChange:a=>{var c;return c=a.target.value,void(b(a=>({...a,prompt:c})),l&&clearTimeout(l),m(setTimeout(()=>{o({prompt:c})},800)))},placeholder:n("systemPromptPlaceholder"),rows:5,className:"w-full px-4 py-3 rounded-lg border border-border/50 bg-surface/30 text-sm placeholder:text-text-muted/50 resize-y min-h-[120px] focus:outline-none focus:ring-1 focus:ring-amber-500/30 focus:border-amber-500/50 transition-colors",disabled:c}),(0,d.jsx)("div",{className:"absolute bottom-2 right-3 text-xs text-text-muted/60 tabular-nums",children:n("chars",{count:a.prompt.length})})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted/70 flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),n("systemPromptHint")]})]})]})}]),c()}catch(a){c(a)}},!1),876881,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i,a.s(["default",0,function(){let[a,b]=(0,e.useState)({}),[c,f]=(0,e.useState)({}),[i,j]=(0,e.useState)(!0),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),s=(0,h.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/model-aliases").then(a=>a.json()).then(a=>{b(a.builtIn||{}),f(a.custom||{}),j(!1)}).catch(()=>j(!1))},[]);let t=async()=>{if(o.trim()&&q.trim()){l(!0);try{let a=await fetch("/api/settings/model-aliases",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:o.trim(),to:q.trim()})});if(a.ok){let b=await a.json();f(b.custom),p(""),r(""),n("saved"),setTimeout(()=>n(""),2e3)}}catch{n("error")}finally{l(!1)}}},u=async a=>{l(!0);try{let b=await fetch("/api/settings/model-aliases",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a})});if(b.ok){let a=await b.json();f(a.custom),n("saved"),setTimeout(()=>n(""),2e3)}}catch{n("error")}finally{l(!1)}},v=Object.entries(a),w=Object.entries(c);return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"swap_horiz"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("modelAliasesTitle")||"Model Aliases"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:s("modelAliasesDesc")||"Auto-forward deprecated model IDs to their replacements"})]}),"saved"===m&&(0,d.jsxs)("span",{className:"ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",s("saved")||"Saved"]})]}),(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-3",children:s("addCustomAlias")||"Add Custom Alias"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",placeholder:s("deprecatedModelId")||"Deprecated model ID",value:o,onChange:a=>p(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-amber-500/50 focus:outline-none"}),(0,d.jsx)("span",{className:"text-text-muted text-lg",children:"→"}),(0,d.jsx)("input",{type:"text",placeholder:s("newModelId")||"New model ID",value:q,onChange:a=>r(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-amber-500/50 focus:outline-none"}),(0,d.jsx)("button",{onClick:t,disabled:k||!o.trim()||!q.trim(),className:"px-4 py-2 rounded-lg text-sm font-medium bg-amber-500/10 text-amber-500 hover:bg-amber-500/20 disabled:opacity-50 transition-all",children:s("add")||"Add"})]})]}),w.length>0&&(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-text-muted uppercase tracking-wider mb-2",children:s("customAliases")||"Custom Aliases"}),(0,d.jsx)("div",{className:"rounded-lg border border-border/30 divide-y divide-border/20",children:w.map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[(0,d.jsx)("code",{className:"text-xs text-red-400/80 flex-1 truncate",children:a}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("code",{className:"text-xs text-emerald-400/80 flex-1 truncate",children:b}),(0,d.jsx)("button",{onClick:()=>u(a),disabled:k,className:"p-1 rounded hover:bg-red-500/10 text-text-muted hover:text-red-400 transition-all",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},a))})]}),(0,d.jsxs)("details",{className:"group",children:[(0,d.jsxs)("summary",{className:"text-xs font-medium text-text-muted uppercase tracking-wider cursor-pointer flex items-center gap-1 mb-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] group-open:rotate-90 transition-transform",children:"chevron_right"}),s("builtInAliases")||"Built-in Aliases"," (",v.length,")"]}),(0,d.jsx)("div",{className:"rounded-lg border border-border/30 divide-y divide-border/20 max-h-60 overflow-y-auto",children:v.map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 opacity-60",children:[(0,d.jsx)("code",{className:"text-xs text-red-400/60 flex-1 truncate",children:a}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("code",{className:"text-xs text-emerald-400/60 flex-1 truncate",children:b}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"lock"})]},a))})]})]})}]),c()}catch(a){c(a)}},!1),356962,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i,a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!1,degradationMap:{},detectionPatterns:[],stats:{detected:0,tokensSaved:0}}),[c,f]=(0,e.useState)(!0),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),s=(0,h.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/background-degradation").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let t=async c=>{let d={...a,...c};b(d),j(!0),l("");try{let{stats:a,...c}=d,e=await fetch("/api/settings/background-degradation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(e.ok){let a=await e.json();b(a),l("saved"),setTimeout(()=>l(""),2e3)}else l("error")}catch{l("error")}finally{j(!1)}},u=Object.entries(a.degradationMap||{});return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-sky-500/10 text-sky-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"speed"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("backgroundDegradationTitle")||"Background Task Degradation"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:s("backgroundDegradationDesc")||"Auto-redirect background requests (titles, summaries) to cheaper models"})]}),"saved"===k&&(0,d.jsxs)("span",{className:"text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",s("saved")||"Saved"]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:s("enableDegradation")||"Enable Background Degradation"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:s("enableDegradationHint")||"Automatically use cheaper models for background utility tasks"})]}),(0,d.jsx)("button",{onClick:()=>t({enabled:!a.enabled}),disabled:c||i,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${a.enabled?"bg-sky-500":"bg-white/10"}`,children:(0,d.jsx)("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${a.enabled?"translate-x-6":"translate-x-1"}`})})]}),a.stats&&a.stats.detected>0&&(0,d.jsx)("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-sky-500/5 border border-sky-500/20 mb-4",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-sky-400",children:"analytics"}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:[s("tasksDetected")||"Tasks detected",":"]}),(0,d.jsx)("span",{className:"text-sm font-mono font-semibold text-sky-400",children:a.stats.detected})]})}),a.enabled&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-text-muted uppercase tracking-wider mb-2",children:s("degradationMap")||"Model Degradation Map"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("input",{type:"text",placeholder:s("premiumModel")||"Premium model",value:m,onChange:a=>n(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-sky-500/50 focus:outline-none"}),(0,d.jsx)("span",{className:"text-text-muted text-lg",children:"→"}),(0,d.jsx)("input",{type:"text",placeholder:s("cheapModel")||"Cheap model",value:o,onChange:a=>p(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-sky-500/50 focus:outline-none"}),(0,d.jsx)("button",{onClick:()=>{if(!m.trim()||!o.trim())return;let b={...a.degradationMap,[m.trim()]:o.trim()};t({degradationMap:b}),n(""),p("")},disabled:i||!m.trim()||!o.trim(),className:"px-3 py-2 rounded-lg text-sm font-medium bg-sky-500/10 text-sky-500 hover:bg-sky-500/20 disabled:opacity-50 transition-all",children:s("add")||"Add"})]}),u.length>0&&(0,d.jsx)("div",{className:"rounded-lg border border-border/30 divide-y divide-border/20 max-h-48 overflow-y-auto",children:u.map(([b,c])=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2",children:[(0,d.jsx)("code",{className:"text-xs text-orange-400/80 flex-1 truncate",children:b}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("code",{className:"text-xs text-sky-400/80 flex-1 truncate",children:c}),(0,d.jsx)("button",{onClick:()=>{let c;return c={...a.degradationMap},void(delete c[b],t({degradationMap:c}))},disabled:i,className:"p-1 rounded hover:bg-red-500/10 text-text-muted hover:text-red-400 transition-all",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},b))})]}),(0,d.jsxs)("details",{className:"group",children:[(0,d.jsxs)("summary",{className:"text-xs font-medium text-text-muted uppercase tracking-wider cursor-pointer flex items-center gap-1 mb-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] group-open:rotate-90 transition-transform",children:"chevron_right"}),s("detectionPatterns")||"Detection Patterns"," (",a.detectionPatterns?.length||0,")"]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("input",{type:"text",placeholder:s("newPattern")||'e.g. "generate a title"',value:q,onChange:a=>r(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-sky-500/50 focus:outline-none"}),(0,d.jsx)("button",{onClick:()=>{if(!q.trim())return;let b=[...a.detectionPatterns,q.trim()];t({detectionPatterns:b}),r("")},disabled:i||!q.trim(),className:"px-3 py-2 rounded-lg text-sm font-medium bg-sky-500/10 text-sky-500 hover:bg-sky-500/20 disabled:opacity-50 transition-all",children:s("add")||"Add"})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:(a.detectionPatterns||[]).map((b,c)=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs bg-sky-500/10 text-sky-400 border border-sky-500/20",children:[b,(0,d.jsx)("button",{onClick:()=>{let b;return b=a.detectionPatterns.filter((a,b)=>b!==c),void t({detectionPatterns:b})},className:"hover:text-red-400 transition-colors",disabled:i,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},c))})]})]})]})}]),c()}catch(a){c(a)}},!1),894167,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(415925),j=b([f]);[f]=j.then?(await j)():j,a.s(["default",0,function(){let a=(0,i.useTranslations)("settings"),[b,c]=(0,e.useState)({semanticCacheEnabled:!0,semanticCacheMaxSize:100,semanticCacheTTL:18e5,promptCacheEnabled:!0,promptCacheStrategy:"auto",alwaysPreserveClientCache:"auto"}),[f,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!0);(0,e.useEffect)(()=>{fetch("/api/settings/cache-config").then(a=>a.ok?a.json():null).then(a=>{a&&c(a)}).catch(()=>{}).finally(()=>l(!1))},[]);let m=async()=>{j(!0);try{await fetch("/api/settings/cache-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}finally{j(!1)}};return k?(0,d.jsx)(g.Card,{className:"p-6",children:(0,d.jsx)("p",{className:"text-sm text-text-muted",children:a("loading")})}):(0,d.jsxs)(g.Card,{className:"p-6",children:[(0,d.jsxs)("h3",{className:"text-lg font-semibold text-text-main flex items-center gap-2 mb-4",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"cached"}),a("cacheSettings")]}),(0,d.jsxs)("div",{className:"space-y-6",children:[(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("h4",{className:"text-sm font-medium text-text-main",children:a("semanticCache")}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("enabled")}),(0,d.jsx)("button",{onClick:()=>c(a=>({...a,semanticCacheEnabled:!a.semanticCacheEnabled})),className:`relative w-10 h-5 rounded-full transition-colors ${b.semanticCacheEnabled?"bg-green-500":"bg-border"}`,children:(0,d.jsx)("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${b.semanticCacheEnabled?"left-5":"left-0.5"}`})})]}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("maxEntries")}),(0,d.jsx)("input",{type:"number",min:1,max:1e3,value:b.semanticCacheMaxSize,onChange:a=>c(b=>({...b,semanticCacheMaxSize:parseInt(a.target.value)||100})),className:"w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"})]}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("ttlMinutes")}),(0,d.jsx)("input",{type:"number",min:1,max:1440,value:Math.round(b.semanticCacheTTL/6e4),onChange:a=>c(b=>({...b,semanticCacheTTL:6e4*(parseInt(a.target.value)||30)})),className:"w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"})]})]}),(0,d.jsxs)("div",{className:"space-y-3 pt-4 border-t border-border/30",children:[(0,d.jsx)("h4",{className:"text-sm font-medium text-text-main",children:a("promptCache")}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("enabled")}),(0,d.jsx)("button",{onClick:()=>c(a=>({...a,promptCacheEnabled:!a.promptCacheEnabled})),className:`relative w-10 h-5 rounded-full transition-colors ${b.promptCacheEnabled?"bg-green-500":"bg-border"}`,children:(0,d.jsx)("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${b.promptCacheEnabled?"left-5":"left-0.5"}`})})]}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("strategy")}),(0,d.jsxs)("select",{value:b.promptCacheStrategy,onChange:a=>c(b=>({...b,promptCacheStrategy:a.target.value})),className:"px-2 py-1 text-sm rounded border border-border bg-surface text-text-main",children:[(0,d.jsx)("option",{value:"auto",children:"Auto"}),(0,d.jsx)("option",{value:"system-only",children:"System Only"}),(0,d.jsx)("option",{value:"manual",children:"Manual"})]})]}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("preserveClientCache")}),(0,d.jsxs)("select",{value:b.alwaysPreserveClientCache,onChange:a=>c(b=>({...b,alwaysPreserveClientCache:a.target.value})),className:"px-2 py-1 text-sm rounded border border-border bg-surface text-text-main",children:[(0,d.jsx)("option",{value:"auto",children:"Auto"}),(0,d.jsx)("option",{value:"always",children:"Always"}),(0,d.jsx)("option",{value:"never",children:"Never"})]})]})]}),(0,d.jsx)("div",{className:"pt-4 border-t border-border/30",children:(0,d.jsx)(h.Button,{onClick:m,disabled:f,size:"sm",children:a(f?"saving":"save")})})]})]})}]),c()}catch(a){c(a)}},!1),43184,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i;let j=[{value:"recent",labelKey:"recent",descKey:"recentDesc"},{value:"semantic",labelKey:"semantic",descKey:"semanticDesc"},{value:"hybrid",labelKey:"hybrid",descKey:"hybridDesc"}];a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!0,maxTokens:2e3,retentionDays:30,strategy:"hybrid",skillsEnabled:!1}),[c,f]=(0,e.useState)(!0),[i,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(""),n=(0,h.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/memory").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let o=async c=>{let d={...a,...c};b(d),k(!0),m("");try{(await fetch("/api/settings/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).ok?(m("saved"),setTimeout(()=>m(""),2e3)):m("error")}catch{m("error")}finally{k(!1)}};return c?(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"psychology"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:n("memorySkillsTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:n("memorySkillsDesc")})]})]}),(0,d.jsxs)("div",{className:"mt-4 text-sm text-text-muted",children:[n("loading"),"..."]})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"memory"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:n("memoryTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:n("memoryDesc")})]}),"saved"===l&&(0,d.jsxs)("span",{className:"ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",n("saved")]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:n("memoryEnabled")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:n("memoryEnabledDesc")})]}),(0,d.jsx)("button",{onClick:()=>o({enabled:!a.enabled}),disabled:i,className:`relative w-11 h-6 rounded-full transition-colors ${a.enabled?"bg-violet-500":"bg-border"}`,role:"switch","aria-checked":a.enabled,children:(0,d.jsx)("span",{className:`absolute top-1 left-1 w-4 h-4 bg-white rounded-full transition-transform ${a.enabled?"translate-x-5":"translate-x-0"}`})})]}),a.enabled&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:n("maxTokens")}),(0,d.jsxs)("span",{className:"text-sm font-mono tabular-nums text-violet-400",children:[a.maxTokens.toLocaleString()," ",n("tokens")]})]}),(0,d.jsx)("input",{type:"range",min:"0",max:"16000",step:"500",value:a.maxTokens,onChange:a=>o({maxTokens:parseInt(a.target.value)}),className:"w-full accent-violet-500"}),(0,d.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mt-1",children:[(0,d.jsx)("span",{children:n("off")}),(0,d.jsx)("span",{children:"4K"}),(0,d.jsx)("span",{children:"8K"}),(0,d.jsx)("span",{children:"16K"})]})]}),(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:n("retentionDays")}),(0,d.jsxs)("span",{className:"text-sm font-mono tabular-nums text-violet-400",children:[a.retentionDays," ",n("days")]})]}),(0,d.jsx)("input",{type:"range",min:"1",max:"90",step:"1",value:a.retentionDays,onChange:a=>o({retentionDays:parseInt(a.target.value)}),className:"w-full accent-violet-500"}),(0,d.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mt-1",children:[(0,d.jsx)("span",{children:"1"}),(0,d.jsx)("span",{children:"30"}),(0,d.jsx)("span",{children:"60"}),(0,d.jsx)("span",{children:"90"})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-2",children:j.map(b=>(0,d.jsxs)("button",{onClick:()=>o({strategy:b.value}),disabled:c||i,className:`flex flex-col items-start p-3 rounded-lg border text-left transition-all ${a.strategy===b.value?"border-violet-500/50 bg-violet-500/5 ring-1 ring-violet-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsx)("p",{className:`text-sm font-medium ${a.strategy===b.value?"text-violet-400":""}`,children:n(b.labelKey)}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:n(b.descKey)})]},b.value))})]})]}),(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"handyman"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:n("skillsTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:n("skillsDesc")})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-surface/30 border border-border/30",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:n("skillsEnabled")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:n("skillsEnabledDesc")})]}),(0,d.jsx)("button",{onClick:()=>o({skillsEnabled:!a.skillsEnabled}),disabled:i,className:`relative w-11 h-6 rounded-full transition-colors ${a.skillsEnabled?"bg-amber-500":"bg-border"}`,role:"switch","aria-checked":a.skillsEnabled,children:(0,d.jsx)("span",{className:`absolute top-1 left-1 w-4 h-4 bg-white rounded-full transition-transform ${a.skillsEnabled?"translate-x-5":"translate-x-0"}`})})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-3",children:n("skillsComingSoon")})]})]})}]),c()}catch(a){c(a)}},!1),802282,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(415925),k=a.i(240246),l=b([f]);[f]=l.then?(await l)():l,a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!1,threshold:3}),[c,f]=(0,e.useState)({enabled:!1,threshold:3}),[l,m]=(0,e.useState)(!0),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),r=(0,j.useTranslations)("settings"),s=(0,j.useTranslations)("common"),t=(0,k.useNotificationStore)();(0,e.useEffect)(()=>{fetch("/api/settings/auto-disable-accounts").then(a=>a.json()).then(a=>{b(a),f(a),m(!1)}).catch(()=>m(!1))},[]);let u=async()=>{o(!0);try{let a=await fetch("/api/settings/auto-disable-accounts",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!a.ok)throw Error("Failed to save auto-disable config");let d=await a.json();b(d),q(!1),t.success(r("savedSuccessfully")||"Saved successfully")}catch(a){t.error(a instanceof Error?a.message:"Error saving")}finally{o(!1)}};return l?null:(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"block"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:r("autoDisableBannedAccounts")})]}),p?(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",onClick:()=>{f(a),q(!1)},children:s("cancel")}),(0,d.jsx)(h.Button,{size:"sm",variant:"primary",icon:"save",onClick:u,disabled:n,children:s("save")})]}):(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>q(!0),children:s("edit")})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:r("autoDisableDescription")}),(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,d.jsx)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4 flex flex-col justify-center",children:(0,d.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:p?c.enabled:a.enabled,onChange:a=>f(b=>({...b,enabled:a.target.checked})),disabled:!p,className:"w-4 h-4 text-primary bg-surface/50 border-white/20 rounded focus:ring-primary/50"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:r("autoDisableBannedAccounts")})]})}),(0,d.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4",children:[(0,d.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider mb-2 flex items-center gap-2",children:r("autoDisableThreshold")}),p?(0,d.jsx)(i.Input,{type:"number",min:"1",max:"10",value:c.threshold,onChange:a=>f(b=>({...b,threshold:parseInt(a.target.value)||1})),disabled:!c.enabled}):(0,d.jsxs)("span",{className:`text-sm font-mono ${!a.enabled&&"opacity-50"}`,children:[a.threshold," ",r("failures",{count:a.threshold})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-2",children:r("autoDisableThresholdDesc")})]})]})]})})}]),c()}catch(a){c(a)}},!1),986820,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(240246),j=a.i(32886),k=a.i(415925),l=a.i(802282),m=b([f,l]);[f,l]=m.then?(await m)():m;let u={CLOSED:{bg:"bg-emerald-500/15",text:"text-emerald-400",border:"border-emerald-500/30",icon:"check_circle"},OPEN:{bg:"bg-red-500/15",text:"text-red-400",border:"border-red-500/30",icon:"error"},HALF_OPEN:{bg:"bg-amber-500/15",text:"text-amber-400",border:"border-amber-500/30",icon:"warning"}},v={closed:{icon:"check_circle",color:"#22c55e"},"half-open":{icon:"pending",color:"#f59e0b"},open:{icon:"error",color:"#ef4444"}};function n(a,b){let c=String(a||"closed").toLowerCase().replaceAll("_","-");return b("open"===c?"breakerStateOpen":"half-open"===c?"breakerStateHalfOpen":"breakerStateClosed")}function o(a){return!a||a<=0?"—":a<1e3?`${a}ms`:a<6e4?`${(a/1e3).toFixed(1)}s`:`${(a/6e4).toFixed(1)}m`}function p(a,b){return a instanceof Error&&a.message?a.message:b}function q({profiles:a,onSave:b,saving:c}){let[f,i]=(0,e.useState)(!1),[j,l]=(0,e.useState)(a),m=(0,k.useTranslations)("settings"),n=(0,k.useTranslations)("common");(0,e.useEffect)(()=>{l(a)},[a]);let o=a=>null==a?"—":`${a}${m("ms")}`,p=[{key:"transientCooldown",label:m("transientCooldown"),format:o},{key:"rateLimitCooldown",label:m("rateLimitCooldown"),format:o},{key:"maxBackoffLevel",label:m("maxBackoffLevel")},{key:"circuitBreakerThreshold",label:m("cbThreshold"),format:a=>null==a?"—":m("failures",{count:a})},{key:"circuitBreakerReset",label:m("cbResetTime"),format:o}];return(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"tune"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:m("providerProfiles")})]}),f?(0,d.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",onClick:()=>i(!1),children:n("cancel")}),(0,d.jsx)(h.Button,{size:"sm",variant:"primary",icon:"save",onClick:()=>{b(j),i(!1)},disabled:c,children:n("save")})]}):(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>i(!0),children:n("edit")})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:m("providerProfilesDesc")}),(0,d.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:["oauth","apikey"].map(b=>(0,d.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4",children:[(0,d.jsxs)("h3",{className:"text-sm font-bold uppercase tracking-wider mb-3 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base","aria-hidden":"true",children:"oauth"===b?"lock":"key"}),"oauth"===b?m("oauthProviders"):m("apiKeyProviders")]}),(0,d.jsx)("div",{className:"space-y-2",children:p.map(({key:c,label:e,format:g})=>(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:e}),f?(0,d.jsx)("input",{type:"number",min:"0",value:j?.[b]?.[c]??0,onChange:a=>l({...j,[b]:{...j[b],[c]:Number(a.target.value)}}),className:"w-24 px-2 py-1 text-xs rounded bg-white/10 border border-white/20 text-right"}):(0,d.jsx)("span",{className:"text-sm font-mono",children:g?g(a?.[b]?.[c]):a?.[b]?.[c]??"—"})]},c))})]},b))})]})})}function r({rateLimitStatus:a,defaults:b,onSaveDefaults:c,saving:f}){let[i,j]=(0,e.useState)(!1),[l,m]=(0,e.useState)(b||{}),n=(0,k.useTranslations)("settings"),p=(0,k.useTranslations)("common");return(0,e.useEffect)(()=>{b&&m(b)},[b]),(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"speed"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:n("rateLimiting")})]}),i?(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",onClick:()=>j(!1),children:p("cancel")}),(0,d.jsx)(h.Button,{size:"sm",variant:"primary",icon:"save",onClick:()=>{c(l),j(!1)},disabled:f,children:p("save")})]}):(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>j(!0),children:p("edit")})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:n("rateLimitingDesc")}),(0,d.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4 mb-4",children:[(0,d.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider mb-3 text-text-muted",children:n("defaultSafetyNet")}),(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[{key:"requestsPerMinute",label:n("rpm")},{key:"minTimeBetweenRequests",label:n("minGap"),format:o},{key:"concurrentRequests",label:n("maxConcurrent")}].map(({key:a,label:c,format:e})=>(0,d.jsxs)("div",{children:[i?(0,d.jsx)("input",{type:"number",min:"1",value:l[a]??0,onChange:b=>m(c=>({...c,[a]:parseInt(b.target.value)||0})),className:"w-full px-2 py-1 text-lg font-bold rounded bg-white/10 border border-white/20"}):(0,d.jsx)("div",{className:"text-lg font-bold",children:e?e(b?.[a]):b?.[a]??"—"}),(0,d.jsx)("div",{className:"text-xs text-text-muted",children:c})]},a))})]}),a&&a.length>0?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:n("activeLimiters")}),a.map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-black/5 dark:bg-white/5",children:[(0,d.jsx)("span",{className:"text-sm font-medium",children:a.provider||a.key}),(0,d.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[null!=a.reservoir&&(0,d.jsxs)("span",{children:[n("reservoir"),": ",a.reservoir]}),null!=a.running&&(0,d.jsxs)("span",{children:[n("running"),": ",a.running]}),null!=a.queued&&(0,d.jsxs)("span",{children:[n("queued"),": ",a.queued]})]})]},b))]}):(0,d.jsx)("p",{className:"text-xs text-text-muted",children:n("noActiveLimiters")})]})})}function s({breakers:a,onReset:b,loading:c}){let e=a.filter(a=>"CLOSED"!==a.state),f=a.length,i=(0,k.useTranslations)("settings");return(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"electrical_services"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:i("circuitBreakers")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:e.length>0?i("tripped",{count:e.length}):i("healthy",{count:f})}),e.length>0&&(0,d.jsx)(h.Button,{size:"sm",variant:"danger",icon:"restart_alt",onClick:b,disabled:c,children:i("resetAll")})]})]}),0===a.length?(0,d.jsx)("p",{className:"text-sm text-text-muted",children:i("noCircuitBreakers")}):(0,d.jsx)("div",{className:"space-y-2",children:a.map(a=>{let b=u[a.state]||u.CLOSED;return(0,d.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-black/5 dark:bg-white/5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-base ${b.text}`,"aria-hidden":"true",children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:a.name.replace("combo:","")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[a.failureCount>0&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:i("failures",{count:a.failureCount})}),(0,d.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-bold uppercase ${b.bg} ${b.text} border ${b.border}`,children:n(a.state,i)})]})]},a.name)})})]})})}function t(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!0),[l,m]=(0,e.useState)(null),o=(0,i.useNotificationStore)(),p=(0,j.useLocale)(),q=(0,k.useTranslations)("settings"),r=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/policies");if(a.ok){let c=await a.json();b(c)}}catch{}finally{f(!1)}},[]);(0,e.useEffect)(()=>{r();let a=setInterval(r,15e3);return()=>clearInterval(a)},[r]);let s=async a=>{m(a);try{(await fetch("/api/policies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"unlock",identifier:a})})).ok?(o.success(q("unlockedIdentifier",{identifier:a})),await r()):o.error(q("failedUnlock"))}catch{o.error(q("failedUnlock"))}finally{m(null)}},t=a?.circuitBreakers||[],u=a?.lockedIdentifiers||[],w=t.some(a=>"closed"!==a.state)||u.length>0;return c?(0,d.jsx)(g.Card,{className:"p-6",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"policy"}),q("loadingPolicies")]})}):(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"policy"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:q("policiesLocked")})]}),w&&(0,d.jsx)(h.Button,{size:"sm",variant:"ghost",onClick:r,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"refresh"})})]}),w?(0,d.jsxs)(d.Fragment,{children:[t.filter(a=>"closed"!==a.state).length>0&&(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-text-muted mb-2",children:q("circuitBreakers")}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:t.filter(a=>"closed"!==a.state).map((a,b)=>{let c=v[a.state]||v.open;return(0,d.jsx)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:c.color},children:c.icon}),(0,d.jsx)("span",{className:"text-sm text-text-main font-medium",children:a.name||a.provider||q("unknown")}),(0,d.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${c.color}15`,color:c.color},children:n(a.state,q)}),a.failures>0&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:q("failures",{count:a.failures})})]})},a.name||b)})})]}),u.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-text-muted mb-2",children:q("lockedIdentifiers")}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:u.map((a,b)=>{let c="string"==typeof a?a:a.identifier||a.id;return(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-red-400",children:"lock"}),(0,d.jsx)("span",{className:"font-mono text-sm text-text-main",children:c}),"object"==typeof a&&a.lockedAt&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:q("sinceDate",{date:new Date(a.lockedAt).toLocaleString(p)})})]}),(0,d.jsx)(h.Button,{size:"sm",variant:"ghost",onClick:()=>s(c),disabled:l===c,className:"text-xs",children:l===c?q("unlocking"):q("forceUnlock")})]},c||b)})})]})]}):(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"verified_user"})}),(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"text-sm text-text-muted",children:q("allOperational")})})]})]})})}a.s(["default",0,function(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!0),[i,j]=(0,e.useState)(!1),[m,n]=(0,e.useState)(null),o=(0,k.useTranslations)("settings"),u=(0,e.useCallback)(async()=>{try{f(!0);let a=await fetch("/api/resilience");if(!a.ok)throw Error(o("failedLoadWithStatus",{status:a.status}));let c=await a.json();b(c),n(null)}catch(a){n(p(a,o("failedLoadResilience")))}finally{f(!1)}},[o]);(0,e.useEffect)(()=>{u();let a=setInterval(u,1e4);return()=>clearInterval(a)},[u]);let v=async()=>{try{if(f(!0),!(await fetch("/api/resilience/reset",{method:"POST"})).ok)throw Error(o("resetFailed"));await u()}catch(a){n(p(a,o("resetFailed")))}finally{f(!1)}},w=async a=>{try{if(j(!0),!(await fetch("/api/resilience",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({profiles:a})})).ok)throw Error(o("saveFailed"));await u()}catch(a){n(p(a,o("saveFailed")))}finally{j(!1)}},x=async a=>{try{if(j(!0),!(await fetch("/api/resilience",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaults:a})})).ok)throw Error(o("saveFailed"));await u()}catch(a){n(p(a,o("saveFailed")))}finally{j(!1)}};return c&&!a?(0,d.jsxs)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"hourglass_empty"}),o("loadingResilience")]}):m&&!a?(0,d.jsxs)(g.Card,{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-red-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined",children:"error"}),(0,d.jsx)("span",{className:"text-sm",children:m})]}),(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",icon:"refresh",onClick:u,className:"mt-3",children:o("retry")})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(q,{profiles:a?.profiles||{},onSave:w,saving:i}),(0,d.jsx)(l.default,{}),(0,d.jsx)(r,{rateLimitStatus:a?.rateLimitStatus||[],defaults:a?.defaults||{},onSaveDefaults:x,saving:i}),(0,d.jsx)(s,{breakers:a?.circuitBreakers||[],onReset:v,loading:c}),(0,d.jsx)(t,{})]})}]),c()}catch(a){c(a)}},!1),891657,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(489108),i=a.i(709918),j=b([f]);[f]=j.then?(await j)():j,a.s(["default",0,function(){let[a,b]=(0,e.useState)({}),[c,f]=(0,e.useState)(!0),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(null);(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>{if(!a.ok)throw Error(`Settings API returned ${a.status}`);return a.json()}).then(a=>{b(a),f(!1)}).catch(a=>{console.error("Failed to load settings:",a),f(!1)}),fetch("/api/version-manager/status").then(a=>{if(!a.ok)throw Error(`Version manager API returned ${a.status}`);return a.json()}).then(a=>{let b=Array.isArray(a)?a.find(a=>"cliproxyapi"===a.tool):null;o(b??null),q(null)}).catch(a=>{console.error("Failed to load version manager status:",a),q("Unable to reach version manager service"),o(null)})},[]);let r=(0,e.useCallback)(async(a,c)=>{if("cliproxyapi_url"===a&&"string"==typeof c&&""!==c.trim()&&!function(a){try{let b=new URL(a);return"http:"===b.protocol||"https:"===b.protocol}catch{return!1}}(c))return void m({type:"error",text:"Invalid URL format. Use http:// or https://"});k(!0),m(null);try{let d=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:c})});if(!d.ok)throw Error(`Server returned ${d.status}`);await d.json(),b(b=>({...b,[a]:c})),m({type:"success",text:"Setting saved"})}catch{m({type:"error",text:"Failed to save setting"})}finally{k(!1)}},[]),s=!0===a.cliproxyapi_fallback_enabled,t=a.cliproxyapi_url||"http://127.0.0.1:8317",u=a.cliproxyapi_fallback_codes||"502,401,403,429,503",v=n?.status==="running"?"text-green-600 dark:text-green-400":n?.status==="error"?"text-red-600 dark:text-red-400":"text-text-muted",w=n?.status==="running"?"check_circle":n?.status==="error"?"error":"help";return(0,d.jsxs)("div",{className:"space-y-4",children:[l&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs ${"success"===l.type?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-red-500/10 text-red-600 dark:text-red-400"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===l.type?"check_circle":"error"}),l.text]}),(0,d.jsxs)(g.Card,{padding:"md",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center bg-indigo-500/10",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-indigo-500 text-xl",children:"swap_horiz"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:"CLIProxyAPI Fallback"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"When enabled, failed requests are retried through CLIProxyAPI (localhost:8317)"})]})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("label",{className:"text-sm text-text-main",children:"Enable CLIProxyAPI Fallback"}),(0,d.jsx)(i.Toggle,{checked:s,onChange:a=>r("cliproxyapi_fallback_enabled",a)})]}),s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1.5 block",children:"CLIProxyAPI URL"}),(0,d.jsx)(h.Input,{value:t,onChange:a=>r("cliproxyapi_url",a.target.value),placeholder:"http://127.0.0.1:8317",className:"w-full"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1.5 block",children:"Fallback Status Codes (comma-separated)"}),(0,d.jsx)(h.Input,{value:u,onChange:a=>r("cliproxyapi_fallback_codes",a.target.value),placeholder:"502,401,403,429,503",className:"w-full"})]})]})]})]}),(0,d.jsxs)(g.Card,{padding:"md",children:[(0,d.jsx)("h3",{className:"font-medium text-sm mb-4",children:"CLIProxyAPI Status"}),c?(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),"Loading..."]}):p?(0,d.jsx)("p",{className:"text-sm text-text-muted",children:p}):n?(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg-secondary",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Status"}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-sm ${v}`,children:w}),(0,d.jsx)("p",{className:`text-sm font-medium capitalize ${v}`,children:n.status?.replace("_"," ")||"Unknown"})]})]}),(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg-secondary",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Version"}),(0,d.jsx)("p",{className:"text-sm font-medium",children:n.installedVersion?`v${n.installedVersion}`:"Not installed"})]}),(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg-secondary",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Health"}),(0,d.jsx)("p",{className:`text-sm font-medium ${"healthy"===n.healthStatus?"text-green-600 dark:text-green-400":"unhealthy"===n.healthStatus?"text-red-600 dark:text-red-400":"text-text-muted"}`,children:"healthy"===n.healthStatus?"Healthy":"unhealthy"===n.healthStatus?"Unhealthy":"Unknown"})]}),(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg-secondary",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Port"}),(0,d.jsx)("p",{className:"text-sm font-mono",children:n.port||8317})]})]}):(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"CLIProxyAPI not detected"})]})]})}]),c()}catch(a){c(a)}},!1),415242,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(50944),g=a.i(171302),h=a.i(817648),i=a.i(415925),j=a.i(296248),k=a.i(547655),l=a.i(72926),m=a.i(589980),n=a.i(232327),o=a.i(220584),p=a.i(413316),q=a.i(769979),r=a.i(847910),s=a.i(876881),t=a.i(356962),u=a.i(976066),v=a.i(894167),w=a.i(43184),x=a.i(986820),y=a.i(891657),z=b([h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y]);[h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y]=z.then?(await z)():z;let A=[{id:"general",labelKey:"general",icon:"settings"},{id:"appearance",labelKey:"appearance",icon:"palette"},{id:"ai",labelKey:"ai",icon:"smart_toy"},{id:"security",labelKey:"security",icon:"shield"},{id:"routing",labelKey:"routing",icon:"route"},{id:"resilience",labelKey:"resilience",icon:"electrical_services"},{id:"advanced",labelKey:"advanced",icon:"tune"}];a.s(["default",0,function(){let a=(0,i.useTranslations)("settings"),b=(0,f.useSearchParams)().get("tab"),[c,z]=(0,e.useState)(null),B=c||A.find(a=>a.id===b)?.id||"general";return(0,d.jsx)("div",{className:"max-w-6xl mx-auto min-w-0",children:(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)("div",{className:"w-full overflow-x-auto pb-1",children:(0,d.jsx)("div",{role:"tablist","aria-label":a("settingsSectionsAria"),className:"inline-flex items-center p-1 rounded-lg bg-black/5 dark:bg-white/5 min-w-max",children:A.map(b=>(0,d.jsxs)("button",{role:"tab","aria-selected":B===b.id,tabIndex:B===b.id?0:-1,onClick:()=>z(b.id),className:(0,g.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all text-sm",B===b.id?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:b.icon}),(0,d.jsx)("span",{className:"hidden sm:inline whitespace-nowrap",children:a(b.labelKey)})]},b.id))})}),(0,d.jsxs)("div",{role:"tabpanel","aria-label":a(A.find(a=>a.id===B)?.labelKey||"general"),children:["general"===B&&(0,d.jsx)("div",{className:"flex flex-col gap-6",children:(0,d.jsx)(j.default,{})}),"appearance"===B&&(0,d.jsx)("div",{className:"flex flex-col gap-6",children:(0,d.jsx)(o.default,{})}),"ai"===B&&(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(p.default,{}),(0,d.jsx)(q.default,{}),(0,d.jsx)(r.default,{}),(0,d.jsx)(u.default,{}),(0,d.jsx)(v.default,{}),(0,d.jsx)(w.default,{})]}),"security"===B&&(0,d.jsx)(k.default,{}),"routing"===B&&(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(l.default,{}),(0,d.jsx)(m.default,{}),(0,d.jsx)(s.default,{}),(0,d.jsx)(t.default,{})]}),"resilience"===B&&(0,d.jsx)(x.default,{}),"advanced"===B&&(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(n.default,{}),(0,d.jsx)(y.default,{})]})]}),(0,d.jsxs)("div",{className:"text-center text-sm text-text-muted py-4",children:[(0,d.jsxs)("p",{children:[h.APP_CONFIG.name," v",h.APP_CONFIG.version]}),(0,d.jsx)("p",{className:"mt-1",children:a("localMode")})]})]})})}]),c()}catch(a){c(a)}},!1)];
|
|
1
|
+
module.exports=[296248,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(818465),j=a.i(32886),k=a.i(415925),l=b([f]);[f]=l.then?(await l)():l,a.s(["default",0,function(){let[a,b]=(0,e.useState)([]),[c,f]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)({type:"",message:""}),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)({type:"",message:""}),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)({type:"",message:""}),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(null),H=(0,e.useRef)(null),I=(0,j.useLocale)(),J=(0,k.useTranslations)("settings"),K=(0,k.useTranslations)("common"),[L,M]=(0,e.useState)({driver:"sqlite",dbPath:"~/.omniroute/storage.sqlite",sizeBytes:0,retentionDays:{app:7,call:7},lastBackupAt:null}),N=async()=>{f(!0);try{let a=await fetch("/api/db-backups"),c=await a.json();b(c.backups||[])}catch(a){console.error("Failed to fetch backups:",a)}finally{f(!1)}},O=async()=>{try{let a=await fetch("/api/storage/health");if(!a.ok)return;let b=await a.json();M(a=>({...a,...b}))}catch(a){console.error("Failed to fetch storage health:",a)}},P=async()=>{u(!0),w({type:"",message:""});try{let a=await fetch("/api/db-backups",{method:"PUT"}),b=await a.json();a.ok?(b.filename?w({type:"success",message:J("backupCreated",{file:b.filename})}):w({type:"info",message:b.message||J("noChangesSinceBackup")}),await O(),l&&await N()):w({type:"error",message:b.error||J("backupFailed")})}catch{w({type:"error",message:J("errorOccurred")})}finally{u(!1)}},Q=async a=>{q(a),o({type:"",message:""});try{let b=await fetch("/api/db-backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({backupId:a})}),c=await b.json();b.ok?(o({type:"success",message:J("restoreSuccess",{connections:c.connectionCount,nodes:c.nodeCount,combos:c.comboCount,apiKeys:c.apiKeyCount})}),await N(),await O()):o({type:"error",message:c.error||J("restoreFailed")})}catch{o({type:"error",message:J("errorDuringRestore")})}finally{q(null),s(null)}};(0,e.useEffect)(()=>{O()},[]);let R=async()=>{y(!0);try{let a=await fetch("/api/db-backups/export");if(!a.ok){let b=await a.json();throw Error(b.error||J("exportFailed"))}let b=await a.blob(),c=URL.createObjectURL(b),d=(a.headers.get("Content-Disposition")||"").match(/filename="(.+)"/),e=d?d[1]:`omniroute-backup-${new Date().toISOString().replace(/[:.]/g,"-")}.sqlite`,f=document.createElement("a");f.href=c,f.download=e,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(c)}catch(a){console.error("Export failed:",a),C({type:"error",message:J("exportFailedWithError",{error:a.message})})}finally{y(!1)}},S=async()=>{if(F){A(!0),C({type:"",message:""}),E(!1);try{let a=await F.arrayBuffer(),b=await fetch(`/api/db-backups/import?filename=${encodeURIComponent(F.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:a}),c=await b.json();b.ok?(C({type:"success",message:J("importSuccess",{connections:c.connectionCount,nodes:c.nodeCount,combos:c.comboCount,apiKeys:c.apiKeyCount})}),await O(),l&&await N()):C({type:"error",message:c.error||J("importFailed")})}catch{C({type:"error",message:J("errorDuringImport")})}finally{A(!1),G(null)}}},T=a=>a&&0!==a?a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`:"0 B";return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"database"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:J("systemStorage")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:J("allDataLocal")})]}),(0,d.jsx)(i.Badge,{variant:"success",size:"sm",children:L.driver||"json"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-4",children:[(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg border border-border",children:[(0,d.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wide mb-1",children:J("databasePath")}),(0,d.jsx)("p",{className:"text-sm font-mono text-text-main break-all",children:L.dbPath||"~/.omniroute/storage.sqlite"})]}),(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg border border-border",children:[(0,d.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wide mb-1",children:J("databaseSize")}),(0,d.jsx)("p",{className:"text-sm font-mono text-text-main",children:T(L.sizeBytes)})]})]}),(0,d.jsx)("div",{className:"p-3 rounded-lg bg-bg border border-border mb-4",children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-text-main",children:"Log retention policy"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Request logs follow ",(0,d.jsx)("code",{children:"CALL_LOG_RETENTION_DAYS"}),". Application and audit logs follow ",(0,d.jsx)("code",{children:"APP_LOG_RETENTION_DAYS"}),"."]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(i.Badge,{variant:"default",size:"sm",children:["Call ",L.retentionDays.call,"d"]}),(0,d.jsxs)(i.Badge,{variant:"default",size:"sm",children:["App ",L.retentionDays.app,"d"]})]})]})}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:R,loading:x,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"download"}),J("exportDatabase")]}),(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:async()=>{y(!0);try{let a=await fetch("/api/db-backups/exportAll");if(!a.ok)throw Error(J("exportFailed"));let b=await a.blob(),c=(a.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),d=c?.[1]||"omniroute-full-backup.tar.gz",e=URL.createObjectURL(b),f=document.createElement("a");f.href=e,f.download=d,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(e)}catch(a){C({type:"error",message:J("fullExportFailedWithError",{error:a.message})})}finally{y(!1)}},loading:x,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"folder_zip"}),J("exportAll")]}),(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>{H.current?.click()},loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"upload"}),J("importDatabase")]}),(0,d.jsx)("input",{ref:H,type:"file",accept:".sqlite",className:"hidden",onChange:a=>{let b=a.target.files?.[0];if(b){if(!b.name.endsWith(".sqlite"))return void C({type:"error",message:J("invalidFileType")});G(b),E(!0),H.current&&(H.current.value="")}}})]}),D&&F&&(0,d.jsx)("div",{className:"p-4 rounded-lg mb-4 bg-amber-500/10 border border-amber-500/30",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px] text-amber-500 mt-0.5","aria-hidden":"true",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-amber-500 mb-1",children:J("confirmDbImport")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:J("confirmDbImportDesc",{file:F.name})}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(h.Button,{variant:"primary",size:"sm",onClick:S,className:"!bg-amber-500 hover:!bg-amber-600",children:J("yesImport")}),(0,d.jsx)(h.Button,{variant:"outline",size:"sm",onClick:()=>{E(!1),G(null)},children:K("cancel")})]})]})]})}),B.message&&(0,d.jsx)("div",{className:`p-3 rounded-lg mb-4 text-sm ${"success"===B.type?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===B.type?"check_circle":"error"}),B.message]})}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-bg border border-border mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-500","aria-hidden":"true",children:"schedule"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:J("lastBackup")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:L.lastBackupAt?`${new Date(L.lastBackupAt).toLocaleString(I)} (${(a=>{if(!a)return null;let b=new Date,c=new Date(a),d=Math.floor((b-c)/6e4);if(d<1)return J("justNow");if(d<60)return J("minutesAgo",{count:d});let e=Math.floor(d/60);if(e<24)return J("hoursAgo",{count:e});let f=Math.floor(e/24);return J("daysAgo",{count:f})})(L.lastBackupAt)})`:J("noBackupYet")})]})]}),(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:P,loading:t,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"backup"}),J("backupNow")]})]}),v.message&&(0,d.jsx)("div",{className:`p-3 rounded-lg mb-4 text-sm ${"success"===v.type?"bg-green-500/10 text-green-500 border border-green-500/20":"info"===v.type?"bg-blue-500/10 text-blue-500 border border-blue-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===v.type?"check_circle":"info"===v.type?"info":"error"}),v.message]})}),(0,d.jsxs)("div",{className:"pt-3 border-t border-border/50",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-amber-500","aria-hidden":"true",children:"restore"}),(0,d.jsx)("p",{className:"font-medium",children:J("backupRestore")})]}),(0,d.jsx)(h.Button,{variant:"outline",size:"sm",onClick:()=>{m(!l),l||0!==a.length||N()},children:l?J("hide"):J("viewBackups")})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-3",children:J("backupRetentionDesc")}),n.message&&(0,d.jsx)("div",{className:`p-3 rounded-lg mb-3 text-sm ${"success"===n.type?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===n.type?"check_circle":"error"}),n.message]})}),l&&(0,d.jsx)("div",{className:"flex flex-col gap-2",children:c?(0,d.jsxs)("div",{className:"flex items-center justify-center py-6 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px] mr-2","aria-hidden":"true",children:"progress_activity"}),J("loadingBackups")]}):0===a.length?(0,d.jsxs)("div",{className:"text-center py-6 text-text-muted text-sm",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px] mb-2 block opacity-40","aria-hidden":"true",children:"folder_off"}),J("noBackupsYet")]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:J("backupsAvailable",{count:a.length})}),(0,d.jsxs)("button",{onClick:N,className:"text-xs text-primary hover:underline flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"refresh"}),J("refresh")]})]}),a.map(a=>{var b;return(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-black/[0.02] dark:bg-white/[0.02] border border-border/50 hover:border-border transition-colors",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-500","aria-hidden":"true",children:"description"}),(0,d.jsx)("span",{className:"text-sm font-medium truncate",children:new Date(a.createdAt).toLocaleString(I)}),(0,d.jsx)(i.Badge,{variant:"pre-restore"===a.reason?"warning":"manual"===a.reason?"success":"default",size:"sm",children:(b=a.reason,"manual"===b?J("backupReasonManual"):"pre-restore"===b?J("backupReasonPreRestore"):b)})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted ml-6",children:[(0,d.jsx)("span",{children:J("connectionsCount",{count:a.connectionCount})}),(0,d.jsx)("span",{children:"•"}),(0,d.jsx)("span",{children:T(a.size)})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 ml-3",children:r===a.id?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-xs text-amber-500 font-medium",children:J("confirm")}),(0,d.jsx)(h.Button,{variant:"primary",size:"sm",onClick:()=>Q(a.id),loading:p===a.id,className:"!bg-amber-500 hover:!bg-amber-600",children:J("yes")}),(0,d.jsx)(h.Button,{variant:"outline",size:"sm",onClick:()=>s(null),children:J("no")})]}):(0,d.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>s(a.id),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"restore"}),J("restore")]})})]},a.id)})]})})]})]})}]),c()}catch(a){c(a)}},!1),130361,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(415925),k=b([f]);[f]=k.then?(await k)():k;let l=[{value:"disabled",labelKey:"ipModeDisabled",icon:"block"},{value:"blacklist",labelKey:"ipModeBlacklist",icon:"do_not_disturb"},{value:"whitelist",labelKey:"ipModeWhitelist",icon:"verified_user"},{value:"whitelist-priority",labelKey:"ipModeWhitelistPriority",icon:"priority_high"}];a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!1,mode:"blacklist",blacklist:[],whitelist:[],tempBans:[]}),[c,f]=(0,e.useState)(!0),[k,m]=(0,e.useState)(""),[n,o]=(0,e.useState)("blacklist"),p=(0,j.useTranslations)("settings");(0,e.useEffect)(()=>{q()},[]);let q=async()=>{try{let a=await fetch("/api/settings/ip-filter");a.ok&&b(await a.json())}catch{}finally{f(!1)}},r=async a=>{try{let c=await fetch("/api/settings/ip-filter",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});c.ok&&b(await c.json())}catch{}},s=()=>{k.trim()&&(r({["blacklist"===n?"addBlacklist":"addWhitelist"]:k.trim()}),m(""))},t=(a,b)=>{r({["blacklist"===b?"removeBlacklist":"removeWhitelist"]:a})},u=a.enabled?a.mode:"disabled";return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-red-500/10 text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"security"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:p("ipAccessControl")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:p("ipAccessControlDesc")})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 mb-5",children:l.map(a=>(0,d.jsxs)("button",{onClick:()=>{var b;return b=a.value,void("disabled"===b?r({enabled:!1}):r({enabled:!0,mode:b}))},disabled:c,className:`flex flex-col items-center gap-1.5 p-3 rounded-lg border text-center transition-all ${u===a.value?"border-red-500/50 bg-red-500/5 ring-1 ring-red-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[20px] ${u===a.value?"text-red-400":"text-text-muted"}`,children:a.icon}),(0,d.jsx)("span",{className:`text-xs font-medium ${u===a.value?"text-red-400":"text-text-muted"}`,children:p(a.labelKey)})]},a.value))}),a.enabled&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 items-stretch sm:items-end",children:[(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)(i.Input,{label:p("addIpAddress"),placeholder:p("ipAddressPlaceholder"),value:k,onChange:a=>m(a.target.value),onKeyDown:a=>"Enter"===a.key&&s()})}),(0,d.jsxs)("div",{className:"flex gap-1 pb-[2px]",children:[(0,d.jsx)(h.Button,{size:"sm",variant:"blacklist"===n?"danger":"secondary",onClick:()=>{o("blacklist"),k.trim()&&s()},children:p("block")}),(0,d.jsx)(h.Button,{size:"sm",variant:"whitelist"===n?"primary":"secondary",onClick:()=>{o("whitelist"),k.trim()&&s()},children:p("allow")})]})]}),a.blacklist.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:p("blocked",{count:a.blacklist.length})}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.blacklist.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-mono bg-red-500/10 text-red-400 border border-red-500/20",children:[a,(0,d.jsx)("button",{onClick:()=>t(a,"blacklist"),className:"hover:text-red-300",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},a))})]}),a.whitelist.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:p("allowed",{count:a.whitelist.length})}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.whitelist.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-mono bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[a,(0,d.jsx)("button",{onClick:()=>t(a,"whitelist"),className:"hover:text-emerald-300",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},a))})]}),a.tempBans.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:p("temporaryBans",{count:a.tempBans.length})}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.tempBans.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 rounded-lg bg-orange-500/5 border border-orange-500/20 text-sm",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("span",{className:"font-mono text-xs text-orange-400 shrink-0",children:a.ip}),(0,d.jsxs)("span",{className:"text-xs text-text-muted truncate",children:["— ",a.reason]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted tabular-nums",children:p("minLeft",{min:Math.ceil(a.remainingMs/6e4)})}),(0,d.jsx)("button",{onClick:()=>{let b;return b=a.ip,r({removeBan:b})},className:"text-text-muted hover:text-orange-400",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]},a.ip))})]})]})]})}]),c()}catch(a){c(a)}},!1),860500,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(415925),j=b([f]);[f]=j.then?(await j)():j,a.s(["default",0,function(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!0),j=(0,i.useTranslations)("settings");(0,e.useEffect)(()=>{let a=!1;return async function(){let c=sessionStorage.getItem("omniroute_login_time"),d=Date.now(),e=j("unknown");if(c){let a=d-parseInt(c,10),b=Math.floor(a/36e5),f=Math.floor(a%36e5/6e4);e=b>0?`${b}h ${f}m`:`${f}m`}let g=!1;try{let a=await fetch("/api/auth/status",{method:"GET",cache:"no-store"});if(a.ok){let b=await a.json();g=!0===b.authenticated}}catch{}a||(b({authenticated:g,loginTime:c?new Date(parseInt(c,10)).toLocaleString():null,sessionAge:e,ipAddress:"—",userAgent:navigator.userAgent.split(" ").slice(-2).join(" ")||j("unknown")}),f(!1))}(),()=>{a=!0}},[]);let k=async()=>{try{await fetch("/api/auth/logout",{method:"POST"}),sessionStorage.removeItem("omniroute_login_time"),window.location.href="/"}catch{window.location.href="/"}};return c?(0,d.jsx)(g.Card,{children:(0,d.jsx)("div",{className:"animate-pulse h-32 bg-black/5 dark:bg-white/5 rounded-lg"})}):(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"person"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:j("session")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",role:"list","aria-label":j("sessionDetailsAria"),children:[(0,d.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,d.jsx)("span",{className:"text-text-muted",children:j("status")}),(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full ${a?.authenticated?"bg-green-500":"bg-yellow-500"}`,"aria-hidden":"true"}),a?.authenticated?j("authenticated"):j("guest")]})]}),a?.loginTime&&(0,d.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,d.jsx)("span",{className:"text-text-muted",children:j("loginTime")}),(0,d.jsx)("span",{className:"font-mono text-xs",children:a.loginTime})]}),(0,d.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,d.jsx)("span",{className:"text-text-muted",children:j("sessionAge")}),(0,d.jsx)("span",{className:"font-mono text-xs",children:a?.sessionAge})]}),(0,d.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,d.jsx)("span",{className:"text-text-muted",children:j("browser")}),(0,d.jsx)("span",{className:"font-mono text-xs truncate max-w-[200px]",children:a?.userAgent})]})]}),(0,d.jsxs)("div",{className:"flex gap-3 mt-4 pt-4 border-t border-border/50",children:[(0,d.jsx)(h.Button,{variant:"secondary",onClick:()=>{confirm(j("clearLocalDataConfirm"))&&(localStorage.clear(),sessionStorage.clear(),window.location.reload())},children:j("clearLocalData")}),a?.authenticated&&(0,d.jsx)(h.Button,{variant:"danger",onClick:k,children:j("logout")})]})]})}]),c()}catch(a){c(a)}},!1),547655,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(709918),k=a.i(662073),l=a.i(130361),m=a.i(860500),n=a.i(415925),o=b([f,k,l,m]);[f,k,l,m]=o.then?(await o)():o,a.s(["default",0,function(){let[a,b]=(0,e.useState)({requireLogin:!1,hasPassword:!1}),[c,f]=(0,e.useState)(!0),[o,p]=(0,e.useState)({current:"",new:"",confirm:""}),[q,r]=(0,e.useState)({type:"",message:""}),[s,t]=(0,e.useState)(!1),u=(0,n.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let v=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:a})})).ok&&b(b=>({...b,requireLogin:a}))}catch(a){console.error("Failed to update require login:",a)}},w=async(a,c)=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:c})})).ok&&b(b=>({...b,[a]:c}))}catch(b){console.error(`Failed to update ${a}:`,b)}},x=async a=>{if(a.preventDefault(),o.new!==o.confirm)return void r({type:"error",message:u("passwordsNoMatch")});t(!0),r({type:"",message:""});try{let a=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:o.current,newPassword:o.new})}),b=await a.json();a.ok?(r({type:"success",message:u("passwordUpdated")}),p({current:"",new:"",confirm:""})):r({type:"error",message:b.error||u("failedUpdatePassword")})}catch{r({type:"error",message:u("errorOccurred")})}finally{t(!1)}},y=a.blockedProviders||[];return(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"shield"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:u("security")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:u("requireLogin")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:u("requireLoginDesc")})]}),(0,d.jsx)(j.Toggle,{checked:!0===a.requireLogin,onChange:()=>v(!a.requireLogin),disabled:c})]}),!0===a.requireLogin&&(0,d.jsxs)("form",{onSubmit:x,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[a.hasPassword&&(0,d.jsx)(i.Input,{label:u("currentPassword"),type:"password",placeholder:u("enterCurrentPassword"),value:o.current,onChange:a=>p({...o,current:a.target.value}),required:!0}),(0,d.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,d.jsx)(i.Input,{label:u("newPassword"),type:"password",placeholder:u("enterNewPassword"),value:o.new,onChange:a=>p({...o,new:a.target.value}),required:!0}),(0,d.jsx)(i.Input,{label:u("confirmPassword"),type:"password",placeholder:u("confirmPasswordPlaceholder"),value:o.confirm,onChange:a=>p({...o,confirm:a.target.value}),required:!0})]}),q.message&&(0,d.jsx)("p",{className:`text-sm ${"error"===q.type?"text-red-500":"text-green-500"}`,children:q.message}),(0,d.jsx)("div",{className:"pt-2",children:(0,d.jsx)(h.Button,{type:"submit",variant:"primary",loading:s,children:a.hasPassword?u("updatePassword"):u("setPassword")})})]})]})]}),(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-600 dark:text-amber-400",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"api"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:u("apiEndpointProtection")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:u("requireAuthModels")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:u("requireAuthModelsDesc")})]}),(0,d.jsx)(j.Toggle,{checked:!0===a.requireAuthForModels,onChange:()=>w("requireAuthForModels",!a.requireAuthForModels),disabled:c})]}),(0,d.jsxs)("div",{className:"pt-4 border-t border-border/50",children:[(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("p",{className:"font-medium",children:u("blockedProviders")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:u("blockedProvidersDesc")})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.values(k.AI_PROVIDERS).map(b=>{let e=y.includes(b.id);return(0,d.jsxs)("button",{onClick:()=>{var c;let d,e;return c=b.id,e=(d=a.blockedProviders||[]).includes(c)?d.filter(a=>a!==c):[...d,c],void w("blockedProviders",e)},disabled:c,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all border ${e?"bg-red-500/10 border-red-500/30 text-red-600 dark:text-red-400":"bg-black/[0.02] dark:bg-white/[0.02] border-transparent text-text-muted hover:bg-black/[0.05] dark:hover:bg-white/[0.05]"}`,title:e?u("unblockProviderTitle",{provider:b.name}):u("blockProviderTitle",{provider:b.name}),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:{color:e?void 0:b.color},children:e?"block":b.icon}),b.name,e&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px] text-red-500",children:"close"})]},b.id)})}),y.length>0&&(0,d.jsxs)("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-2 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),u("providersBlocked",{count:y.length})]})]})]})]}),(0,d.jsx)(m.default,{}),(0,d.jsx)(l.default,{})]})}]),c()}catch(a){c(a)}},!1),754828,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(609754),k=a.i(240246),l=a.i(415925),m=b([f]);[f]=m.then?(await m)():m;let n=["#6366f1","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899","#14b8a6"];a.s(["default",0,function(){let[a,b]=(0,e.useState)({}),[c,f]=(0,e.useState)(!0),[m,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(!1),v=(0,k.useNotificationStore)(),w=(0,l.useTranslations)("settings"),x=(0,l.useTranslations)("common"),y=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/fallback/chains");if(a.ok){let c=await a.json();b(c.chains||c||{})}}catch{}finally{f(!1)}},[]);(0,e.useEffect)(()=>{y()},[y]);let z=async()=>{if(!p.trim()||!r.trim())return void v.warning(w("fillModelAndProviders"));let a=r.split(",").map(a=>a.trim()).filter(Boolean).map((a,b)=>({provider:a,priority:b+1,enabled:!0}));if(0===a.length)return void v.warning(w("addAtLeastOneProvider"));u(!0);try{(await fetch("/api/fallback/chains",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:p.trim(),chain:a})})).ok?(v.success(w("chainCreated",{model:p.trim()})),q(""),s(""),o(!1),await y()):v.error(w("failedCreateChain"))}catch{v.error(w("failedCreateChain"))}finally{u(!1)}},A=async a=>{if(confirm(w("deleteChainConfirm",{model:a})))try{(await fetch("/api/fallback/chains",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a})})).ok?(v.success(w("chainDeleted",{model:a})),await y()):v.error(w("failedDeleteChain"))}catch{v.error(w("failedDeleteChain"))}};if(c)return(0,d.jsx)(g.Card,{className:"p-6 mt-6",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"timeline"}),w("loadingFallbackChains")]})});let B=Object.entries(a);return(0,d.jsxs)(g.Card,{className:"mt-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4 p-6 pb-0",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"timeline"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:w("fallbackChainsTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:w("fallbackChainsDesc")})]}),(0,d.jsx)(h.Button,{size:"sm",variant:"primary",onClick:()=>o(!m),children:m?x("cancel"):w("addChain")})]}),m&&(0,d.jsxs)("div",{className:"mx-6 p-4 rounded-lg border border-border/30 bg-surface/20 mb-4",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 mb-3",children:[(0,d.jsx)(i.Input,{label:w("modelName"),placeholder:w("modelNamePlaceholder"),value:p,onChange:a=>q(a.target.value)}),(0,d.jsx)(i.Input,{label:w("providersCommaSeparated"),placeholder:w("providersCommaSeparatedPlaceholder"),value:r,onChange:a=>s(a.target.value)})]}),(0,d.jsx)(h.Button,{variant:"primary",size:"sm",onClick:z,loading:t,children:w("createChain")})]}),(0,d.jsx)("div",{className:"px-6 pb-6",children:0===B.length?(0,d.jsx)(j.EmptyState,{icon:"timeline",title:w("noFallbackChains"),description:w("noFallbackChainsDesc")}):(0,d.jsx)("div",{className:"flex flex-col gap-2",children:B.map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 rounded-lg border border-border/20 bg-surface/20 hover:bg-surface/40 transition-colors",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"font-mono text-sm text-text-main truncate max-w-[200px]",children:a}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("div",{className:"flex gap-1.5 flex-wrap",children:(Array.isArray(b)?b:[]).map((a,b)=>(0,d.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:`${n[b%n.length]}20`,color:n[b%n.length],border:`1px solid ${n[b%n.length]}40`},children:[b+1,". ",a.provider]},`${a.provider}-${b}`))})]}),(0,d.jsx)("button",{onClick:()=>A(a),className:"text-text-muted hover:text-red-400 transition-colors ml-2",title:w("deleteChain"),children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},a))})})]})}]),c()}catch(a){c(a)}},!1),72926,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(489108),i=a.i(294023),j=a.i(754828),k=a.i(669805),l=a.i(415925),m=b([f,j]);[f,j]=m.then?(await m)():m;let n=k.ROUTING_STRATEGIES.filter(a=>k.SETTINGS_FALLBACK_STRATEGY_VALUES.includes(a.value)).map(a=>({value:a.value,labelKey:a.labelKey,descKey:a.settingsDescKey,icon:a.icon}));a.s(["default",0,function(){let[a,b]=(0,e.useState)({fallbackStrategy:"fill-first",alwaysPreserveClientCache:"auto"}),[c,f]=(0,e.useState)(!0),[k,m]=(0,e.useState)([]),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),s=(0,l.useTranslations)("settings"),t=n.reduce((a,b)=>(a[b.value]=b.descKey,a),{});(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>a.json()).then(a=>{b(a),m(a.wildcardAliases||[]),f(!1)}).catch(()=>f(!1))},[]);let u=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&b(b=>({...b,...a}))}catch(a){console.error("Failed to update settings:",a)}},v=async()=>{if(!o.trim()||!q.trim())return;let a=[...k,{pattern:o.trim(),target:q.trim()}];await u({wildcardAliases:a}),m(a),p(""),r("")},w=async a=>{let b=k.filter((b,c)=>c!==a);await u({wildcardAliases:b}),m(b)};return(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"route"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("routingStrategy")})]}),(0,d.jsxs)("div",{className:"mb-4 rounded-lg border border-blue-500/20 bg-blue-500/5 p-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-blue-700 dark:text-blue-300",children:s("routingAdvancedGuideTitle")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s("routingAdvancedGuideHint1")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:s("routingAdvancedGuideHint2")})]}),(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-2 mb-4",style:{gridAutoRows:"1fr"},children:n.map(b=>(0,d.jsxs)("button",{onClick:()=>u({fallbackStrategy:b.value}),disabled:c,className:`flex flex-col items-center gap-2 p-4 rounded-lg border text-center transition-all ${a.fallbackStrategy===b.value?"border-blue-500/50 bg-blue-500/5 ring-1 ring-blue-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[24px] ${a.fallbackStrategy===b.value?"text-blue-400":"text-text-muted"}`,children:b.icon}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:`text-sm font-medium ${a.fallbackStrategy===b.value?"text-blue-400":""}`,children:s(b.labelKey)}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:s(b.descKey)})]})]},b.value))}),"round-robin"===a.fallbackStrategy&&(0,d.jsxs)("div",{className:"flex items-center justify-between pt-3 border-t border-border/30",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:s("stickyLimit")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:s("stickyLimitDesc")})]}),(0,d.jsx)(h.Input,{type:"number",min:"1",max:"10",value:a.stickyRoundRobinLimit||3,onChange:a=>u({stickyRoundRobinLimit:parseInt(a.target.value)}),disabled:c,className:"w-20 text-center"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted italic pt-3 border-t border-border/30 mt-3",children:s(t[a.fallbackStrategy]||"fillFirstDesc")})]}),(0,d.jsx)(g.Card,{children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500 h-fit",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"network_ping"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("adaptiveVolumeRouting")||"Adaptive Volume Routing"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-1",children:s("adaptiveVolumeRoutingDesc")||"Automatically adjusts traffic volume between providers based on real-time latency and error rates."})]})]}),(0,d.jsx)("div",{className:"pt-1",children:(0,d.jsxs)("label",{className:"relative inline-flex items-center cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",className:"sr-only peer",checked:!!a.adaptiveVolumeRouting,onChange:a=>u({adaptiveVolumeRouting:a.target.checked}),disabled:c}),(0,d.jsx)("div",{className:"w-11 h-6 bg-border peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary"})]})})]})}),(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"alt_route"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("modelAliases")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:s("modelAliasesDesc")})]})]}),k.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-1.5 mb-4",children:k.map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm",children:[(0,d.jsx)("span",{className:"font-mono text-purple-400 break-all",children:a.pattern}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("span",{className:"font-mono text-text-main break-all",children:a.target})]}),(0,d.jsx)("button",{onClick:()=>w(b),className:"shrink-0 text-text-muted hover:text-red-400 transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},b))}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 items-stretch sm:items-end",children:[(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)(h.Input,{label:s("pattern"),placeholder:s("aliasPatternPlaceholder"),value:o,onChange:a=>p(a.target.value)})}),(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)(h.Input,{label:s("targetModel"),placeholder:s("aliasTargetPlaceholder"),value:q,onChange:a=>r(a.target.value)})}),(0,d.jsx)(i.Button,{size:"sm",variant:"primary",onClick:v,className:"mb-[2px] sm:w-auto w-full",children:s("add")})]})]}),(0,d.jsx)(j.default,{}),(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"cached"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:"Client Cache Control"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Configure how client-side cache_control headers are handled"})]})]}),(0,d.jsx)("div",{className:"space-y-3",children:[{value:"auto",label:"Auto (Recommended)",desc:"Preserve cache_control only for caching-aware clients (Claude Code) with deterministic routing"},{value:"always",label:"Always Preserve",desc:"Always forward client cache_control headers to upstream providers"},{value:"never",label:"Never Preserve",desc:"Always remove client cache_control headers, let OmniRoute manage caching"}].map(b=>(0,d.jsxs)("button",{onClick:()=>u({alwaysPreserveClientCache:b.value}),disabled:c,className:`w-full flex flex-col items-start gap-1 p-3 rounded-lg border text-left transition-all ${a.alwaysPreserveClientCache===b.value?"border-green-500/50 bg-green-500/5 ring-1 ring-green-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[16px] ${a.alwaysPreserveClientCache===b.value?"text-green-400":"text-text-muted"}`,children:a.alwaysPreserveClientCache===b.value?"check_circle":"radio_button_unchecked"}),(0,d.jsx)("span",{className:`text-sm font-medium ${a.alwaysPreserveClientCache===b.value?"text-green-400":""}`,children:b.label})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted ml-7",children:b.desc})]},b.value))})]})]})}]),c()}catch(a){c(a)}},!1),589980,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(709918),k=a.i(171302),l=a.i(669805),m=a.i(415925),n=b([f]);[f]=n.then?(await n)():n,a.s(["default",0,function(){let[a,b]=(0,e.useState)({strategy:"priority",maxRetries:1,retryDelayMs:2e3,timeoutMs:12e4,healthCheckEnabled:!0,healthCheckTimeoutMs:3e3,maxComboDepth:3,trackMetrics:!0}),[c,f]=(0,e.useState)({}),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(!1),r=(0,m.useTranslations)("settings"),s=(0,m.useTranslations)("common"),t=l.ROUTING_STRATEGIES.map(a=>({value:a.value,label:r(a.labelKey),icon:a.icon})),u=[{key:"maxRetries",label:r("maxRetriesLabel"),min:0,max:5},{key:"retryDelayMs",label:r("retryDelayLabel"),min:500,max:1e4,step:500},{key:"timeoutMs",label:r("timeoutLabel"),min:5e3,max:3e5,step:5e3},{key:"maxComboDepth",label:r("maxNestingDepth"),min:1,max:10}];(0,e.useEffect)(()=>{fetch("/api/settings/combo-defaults").then(a=>a.json()).then(a=>{a.comboDefaults&&b(a.comboDefaults),a.providerOverrides&&f(a.providerOverrides)}).catch(a=>console.error("Failed to fetch combo defaults:",a))},[]);let v=async()=>{q(!0);try{await fetch("/api/settings/combo-defaults",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboDefaults:a,providerOverrides:c})})}catch(a){console.error("Failed to save combo defaults:",a)}finally{q(!1)}},w=()=>{let a=n.trim().toLowerCase();a&&!c[a]&&(f(b=>({...b,[a]:{maxRetries:1,timeoutMs:12e4}})),o(""))};return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"tune"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:r("comboDefaultsTitle")}),(0,d.jsx)("span",{className:"text-xs text-text-muted ml-auto",children:r("globalComboConfig")})]}),(0,d.jsxs)("div",{className:"mb-4 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:r("comboDefaultsGuideTitle")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:r("comboDefaultsGuideHint1")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:r("comboDefaultsGuideHint2")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium text-sm",children:r("defaultStrategy")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:r("defaultStrategyDesc")})]}),(0,d.jsx)("div",{role:"tablist","aria-label":r("comboStrategyAria"),className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-1 p-0.5 rounded-md bg-black/5 dark:bg-white/5",children:t.map(c=>(0,d.jsxs)("button",{role:"tab","aria-selected":a.strategy===c.value,onClick:()=>b(a=>({...a,strategy:c.value})),className:(0,k.cn)("px-2 py-1 rounded text-xs font-medium transition-all flex items-center justify-center gap-0.5",a.strategy===c.value?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:c.icon}),c.label]},c.value))})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border/50",children:u.map(({key:c,label:e,min:f,max:g,step:h})=>(0,d.jsx)(i.Input,{label:e,type:"number",min:f,max:g,step:h||1,value:a[c]??"",onChange:a=>b(b=>({...b,[c]:parseInt(a.target.value)||0})),className:"text-sm"},c))}),"round-robin"===a.strategy&&(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border/50",children:[(0,d.jsx)(i.Input,{label:r("concurrencyPerModel"),type:"number",min:1,max:20,value:a.concurrencyPerModel??"",placeholder:"3",onChange:a=>b(b=>({...b,concurrencyPerModel:parseInt(a.target.value)||0})),className:"text-sm"}),(0,d.jsx)(i.Input,{label:r("queueTimeout"),type:"number",min:1e3,max:12e4,step:1e3,value:a.queueTimeoutMs??"",placeholder:"30000",onChange:a=>b(b=>({...b,queueTimeoutMs:parseInt(a.target.value)||0})),className:"text-sm"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 pt-3 border-t border-border/50",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium text-sm",children:r("healthCheck")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:r("healthCheckDesc")})]}),(0,d.jsx)(j.Toggle,{checked:!1!==a.healthCheckEnabled,onChange:()=>b(a=>({...a,healthCheckEnabled:!a.healthCheckEnabled}))})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium text-sm",children:r("trackMetrics")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:r("trackMetricsDesc")})]}),(0,d.jsx)(j.Toggle,{checked:!1!==a.trackMetrics,onChange:()=>b(a=>({...a,trackMetrics:!a.trackMetrics}))})]})]}),(0,d.jsxs)("div",{className:"pt-3 border-t border-border/50",children:[(0,d.jsx)("p",{className:"font-medium text-sm mb-2",children:r("providerOverrides")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-3",children:r("providerOverridesDesc")}),Object.entries(c).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-2 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,d.jsx)("span",{className:"text-xs font-mono font-medium min-w-[80px]",children:a}),(0,d.jsx)(i.Input,{type:"number",min:"0",max:"5",value:b.maxRetries??1,onChange:b=>f(c=>({...c,[a]:{...c[a],maxRetries:parseInt(b.target.value)||0}})),className:"text-xs w-16","aria-label":r("providerMaxRetriesAria",{provider:a})}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:r("retries")}),(0,d.jsx)(i.Input,{type:"number",min:"5000",max:"300000",step:"5000",value:b.timeoutMs??12e4,onChange:b=>f(c=>({...c,[a]:{...c[a],timeoutMs:parseInt(b.target.value)||12e4}})),className:"text-xs w-24","aria-label":r("providerTimeoutAria",{provider:a})}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:r("ms")}),(0,d.jsx)("button",{onClick:()=>{f(b=>{let c={...b};return delete c[a],c})},className:"ml-auto text-red-400 hover:text-red-500 transition-colors","aria-label":r("removeProviderOverrideAria",{provider:a}),children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]},a)),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,d.jsx)(i.Input,{type:"text",placeholder:r("newProviderNamePlaceholder"),value:n,onChange:a=>o(a.target.value),onKeyDown:a=>"Enter"===a.key&&w(),className:"text-xs flex-1","aria-label":r("newProviderNameAria")}),(0,d.jsx)(h.Button,{variant:"outline",size:"sm",onClick:w,disabled:!n.trim(),children:s("add")})]})]}),(0,d.jsx)("div",{className:"pt-3 border-t border-border/50",children:(0,d.jsx)(h.Button,{variant:"primary",size:"sm",onClick:v,loading:p,children:r("saveComboDefaults")})})]})]})}]),c()}catch(a){c(a)}},!1),928050,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(294023),h=a.i(292216),i=a.i(563203),j=b([f]);[f]=j.then?(await j)():j;let k={id:"",name:"",type:"http",host:"",port:"8080",username:"",password:"",region:"",notes:"",status:"active"};a.s(["default",0,function(){let[a,b]=(0,e.useState)([]),[c,f]=(0,e.useState)(!1),[j,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(k),[s,t]=(0,e.useState)({}),[u,v]=(0,e.useState)({}),[w,x]=(0,e.useState)({}),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)("provider"),[I,J]=(0,e.useState)(""),[K,L]=(0,e.useState)(""),M=(0,e.useMemo)(()=>q.id||"",[q.id]),N=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/settings/proxies/health?hours=24"),b=await a.json().catch(()=>({}));if(!a.ok)return;let c=Array.isArray(b?.items)?b.items:[],d=Object.fromEntries(c.map(a=>[a.proxyId,a]));v(d)}catch{}},[]),O=(0,e.useCallback)(async a=>{if(a.length)try{let b=await Promise.all(a.map(a=>fetch(`/api/settings/proxies/assignments?proxyId=${encodeURIComponent(a)}`).then(a=>a.ok?a.json():null).then(b=>{let c=Array.isArray(b?.items)?b.items:[],d=new Set,e=c.filter(a=>{let b=`${a.scope}:${a.scopeId??""}`;return!d.has(b)&&(d.add(b),!0)});return[a,{count:e.length,assignments:e}]}).catch(()=>[a,{count:0,assignments:[]}])));t(Object.fromEntries(b))}catch{}},[]),P=(0,e.useCallback)(async()=>{f(!0),l(null);try{let a=await fetch("/api/settings/proxies"),c=await a.json().catch(()=>({}));if(!a.ok){l(c?.error?.message||"Failed to load proxy registry"),b([]);return}let d=Array.isArray(c?.items)?c.items:[];b(d);let e=d.map(a=>a.id).filter(Boolean);N(),O(e)}catch(a){l(a?.message||"Failed to load proxy registry"),b([])}finally{f(!1)}},[N,O]);(0,e.useEffect)(()=>{P()},[P]),(0,e.useEffect)(()=>{a.length>0&&!K&&L(a[0].id)},[a,K]);let Q=async a=>{if(!y){z(a.id),x(b=>({...b,[a.id]:null}));try{let b=await fetch("/api/settings/proxy/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyId:a.id,proxy:{type:a.type||"http",host:a.host,port:String(a.port||8080)}})}),c=await b.json().catch(()=>({}));if(!b.ok)return void x(b=>({...b,[a.id]:{success:!1,error:c?.error?.message||"Test failed"}}));x(b=>({...b,[a.id]:{success:!0,...c}}))}catch(b){x(c=>({...c,[a.id]:{success:!1,error:b?.message}}))}finally{z(null)}}},R=async()=>{if(!q.name.trim()||!q.host.trim())return void l("Name and host are required");p(!0),l(null);let a=q.username.trim(),b=q.password.trim(),c={...M?{id:M}:{},name:q.name.trim(),type:q.type,host:q.host.trim(),port:Number(q.port||8080),region:q.region.trim()||null,notes:q.notes.trim()||null,status:q.status};(!M||a.length>0)&&(c.username=a),(!M||b.length>0)&&(c.password=b);try{let a=await fetch("/api/settings/proxies",{method:M?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),b=await a.json().catch(()=>({}));if(!a.ok)return void l(b?.error?.message||"Failed to save proxy");n(!1),r(k),await P()}catch(a){l(a?.message||"Failed to save proxy")}finally{p(!1)}},S=async a=>{try{let b=await fetch(`/api/settings/proxies?id=${encodeURIComponent(a)}`,{method:"DELETE"});if(b.ok)return void await P();let c=await b.json().catch(()=>({}));if(409===b.status){if(!window.confirm("This proxy is still assigned. Force delete and remove all assignments?"))return;let b=await fetch(`/api/settings/proxies?id=${encodeURIComponent(a)}&force=1`,{method:"DELETE"});if(!b.ok){let a=await b.json().catch(()=>({}));l(a?.error?.message||"Failed to force delete proxy");return}await P();return}l(c?.error?.message||"Failed to delete proxy")}catch(a){l(a?.message||"Failed to delete proxy")}},T=async()=>{B(!0),l(null);try{let a=await fetch("/api/settings/proxies/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:!1})}),b=await a.json().catch(()=>({}));if(!a.ok)return void l(b?.error?.message||"Failed to migrate legacy proxy config");await P()}catch(a){l(a?.message||"Failed to migrate legacy proxy config")}finally{B(!1)}},U=async()=>{F(!0),l(null);try{let a="global"===G?[]:I.split(/[\n,]/g).map(a=>a.trim()).filter(Boolean),b=await fetch("/api/settings/proxies/bulk-assign",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:G,scopeIds:a,proxyId:K||null})}),c=await b.json().catch(()=>({}));if(!b.ok)return void l(c?.error?.message||"Failed to run bulk assignment");D(!1),J(""),await P()}catch(a){l(a?.message||"Failed to run bulk assignment")}finally{F(!1)}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(h.Card,{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:"Proxy Registry"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Store reusable proxies and track assignments."})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(g.Button,{size:"sm",variant:"secondary",icon:"upgrade",onClick:T,loading:A,"data-testid":"proxy-registry-import-legacy",children:"Import Legacy"}),(0,d.jsx)(g.Button,{size:"sm",variant:"secondary",icon:"account_tree",onClick:()=>D(!0),"data-testid":"proxy-registry-open-bulk",children:"Bulk Assign"}),(0,d.jsx)(g.Button,{size:"sm",icon:"add",onClick:()=>{r(k),n(!0)},"data-testid":"proxy-registry-open-create",children:"Add Proxy"})]})]}),j&&(0,d.jsx)("div",{className:"mb-3 px-3 py-2 rounded border border-red-500/30 bg-red-500/10 text-sm text-red-400",children:j}),c?(0,d.jsx)("div",{className:"text-sm text-text-muted",children:"Loading proxies..."}):0===a.length?(0,d.jsx)("div",{className:"text-sm text-text-muted",children:"No saved proxies yet."}):(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full text-sm",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{className:"text-left text-text-muted border-b border-border",children:[(0,d.jsx)("th",{className:"py-2 pr-3",children:"Name"}),(0,d.jsx)("th",{className:"py-2 pr-3",children:"Endpoint"}),(0,d.jsx)("th",{className:"py-2 pr-3",children:"Status"}),(0,d.jsx)("th",{className:"py-2 pr-3",children:"Health (24h)"}),(0,d.jsx)("th",{className:"py-2 pr-3",children:"Usage"}),(0,d.jsx)("th",{className:"py-2",children:"Actions"})]})}),(0,d.jsx)("tbody",{children:a.map(a=>{s[a.id];let b=u[a.id];return(0,d.jsxs)("tr",{className:"border-b border-border/60",children:[(0,d.jsxs)("td",{className:"py-2 pr-3",children:[(0,d.jsx)("div",{className:"font-medium text-text-main",children:a.name}),a.region&&(0,d.jsx)("div",{className:"text-xs text-text-muted",children:a.region})]}),(0,d.jsxs)("td",{className:"py-2 pr-3 font-mono text-xs text-text-muted",children:[a.type,"://",a.host,":",a.port]}),(0,d.jsx)("td",{className:"py-2 pr-3",children:(0,d.jsx)("span",{className:"text-xs px-2 py-1 rounded border border-border bg-bg-subtle",children:a.status||"active"})}),(0,d.jsx)("td",{className:"py-2 pr-3 text-xs text-text-muted",children:(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:w[a.id]?w[a.id].success?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"text-emerald-400",children:["✓ ",w[a.id].publicIp]}),w[a.id].latencyMs&&(0,d.jsxs)("span",{children:[w[a.id].latencyMs,"ms"]})]}):(0,d.jsxs)("span",{className:"text-red-400",children:["✗ ",w[a.id].error||"failed"]}):b?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{children:[b.successRate??0,"% success"]}),(0,d.jsxs)("span",{children:[b.avgLatencyMs??"-"," ms avg"]})]}):(0,d.jsx)("span",{children:"—"})})}),(0,d.jsx)("td",{className:"py-2 pr-3 text-xs text-text-muted",children:null!=s[a.id]?`${s[a.id].count} assignment(s)`:"—"}),(0,d.jsx)("td",{className:"py-2",children:(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(g.Button,{size:"sm",variant:"ghost",icon:"speed",onClick:()=>void Q(a),loading:y===a.id,children:"Test"}),(0,d.jsx)(g.Button,{size:"sm",variant:"ghost",icon:"edit",onClick:()=>{r({id:a.id,name:a.name||"",type:a.type||"http",host:a.host||"",port:String(a.port||8080),username:"",password:"",region:a.region||"",notes:a.notes||"",status:a.status||"active"}),n(!0)},children:"Edit"}),(0,d.jsx)(g.Button,{size:"sm",variant:"ghost",icon:"delete",onClick:()=>void S(a.id),className:"!text-red-400",children:"Delete"})]})})]},a.id)})})]})})]}),(0,d.jsx)(i.Modal,{isOpen:m,onClose:()=>{o||n(!1)},title:M?"Edit Proxy":"Create Proxy",maxWidth:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Name"}),(0,d.jsx)("input",{"data-testid":"proxy-registry-name-input",className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.name,onChange:a=>r(b=>({...b,name:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Type"}),(0,d.jsxs)("select",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.type,onChange:a=>r(b=>({...b,type:a.target.value})),children:[(0,d.jsx)("option",{value:"http",children:"HTTP"}),(0,d.jsx)("option",{value:"https",children:"HTTPS"}),(0,d.jsx)("option",{value:"socks5",children:"SOCKS5"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Host"}),(0,d.jsx)("input",{"data-testid":"proxy-registry-host-input",className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.host,onChange:a=>r(b=>({...b,host:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Port"}),(0,d.jsx)("input",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.port,onChange:a=>r(b=>({...b,port:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Username"}),(0,d.jsx)("input",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.username,placeholder:M?"Leave blank to keep current username":"",onChange:a=>r(b=>({...b,username:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Password"}),(0,d.jsx)("input",{type:"password",className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.password,placeholder:M?"Leave blank to keep current password":"",onChange:a=>r(b=>({...b,password:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Region"}),(0,d.jsx)("input",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.region,onChange:a=>r(b=>({...b,region:a.target.value}))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Status"}),(0,d.jsxs)("select",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.status,onChange:a=>r(b=>({...b,status:a.target.value})),children:[(0,d.jsx)("option",{value:"active",children:"active"}),(0,d.jsx)("option",{value:"inactive",children:"inactive"})]})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Notes"}),(0,d.jsx)("textarea",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:q.notes,onChange:a=>r(b=>({...b,notes:a.target.value})),rows:3})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-border",children:[(0,d.jsx)(g.Button,{size:"sm",variant:"secondary",onClick:()=>n(!1),children:"Cancel"}),(0,d.jsx)(g.Button,{size:"sm",icon:"save",onClick:R,loading:o,children:"Save"})]})]})}),(0,d.jsx)(i.Modal,{isOpen:C,onClose:()=>{E||D(!1)},title:"Bulk Proxy Assignment",maxWidth:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Scope"}),(0,d.jsxs)("select",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:G,onChange:a=>H(a.target.value),children:[(0,d.jsx)("option",{value:"global",children:"global"}),(0,d.jsx)("option",{value:"provider",children:"provider"}),(0,d.jsx)("option",{value:"account",children:"account"}),(0,d.jsx)("option",{value:"combo",children:"combo"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Proxy"}),(0,d.jsxs)("select",{className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",value:K,onChange:a=>L(a.target.value),children:[(0,d.jsx)("option",{value:"",children:"(clear assignment)"}),a.map(a=>(0,d.jsxs)("option",{value:a.id,children:[a.name," (",a.type,"://",a.host,":",a.port,")"]},a.id))]})]})]}),"global"!==G&&(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Scope IDs (comma or newline)"}),(0,d.jsx)("textarea",{"data-testid":"proxy-registry-bulk-scopeids-input",className:"w-full px-3 py-2 rounded bg-bg-subtle border border-border",rows:5,value:I,onChange:a=>J(a.target.value),placeholder:"provider-openai,provider-anthropic"})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-border",children:[(0,d.jsx)(g.Button,{size:"sm",variant:"secondary",onClick:()=>D(!1),children:"Cancel"}),(0,d.jsx)(g.Button,{size:"sm",icon:"done_all",onClick:U,loading:E,"data-testid":"proxy-registry-bulk-apply",children:"Apply"})]})]})})]})}]),c()}catch(a){c(a)}},!1),232327,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(248172),j=a.i(709918),k=a.i(415925),l=a.i(928050),m=b([f,l]);[f,l]=m.then?(await m)():m,a.s(["default",0,function(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)(null),m=(0,e.useRef)(!0),n=(0,k.useTranslations)("settings"),o=(0,k.useTranslations)("common"),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!0),t=async()=>{try{let a=await fetch("/api/settings/proxy?level=global");if(a.ok){let b=await a.json();f(b.proxy||null)}}catch{}},u=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({debugMode:a})})).ok&&q(a)}catch(a){console.error("Failed to update debugMode:",a)}};return(0,e.useEffect)(()=>(m.current=!0,async function(){try{let a=await fetch("/api/settings/proxy?level=global");if(!m.current)return;if(a.ok){let b=await a.json();m.current&&f(b.proxy||null)}}catch{}}(),()=>{m.current=!1}),[]),(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>{if(!a.ok)throw Error(`HTTP error ${a.status}`);return a.json()}).then(a=>{q(!0===a.debugMode),s(!1)}).catch(()=>s(!1))},[]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"vpn_lock"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:n("globalProxy")})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:n("globalProxyDesc")}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsxs)("span",{className:"px-2.5 py-1 rounded text-xs font-bold uppercase bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[c.type,"://",c.host,":",c.port]})}):(0,d.jsx)("span",{className:"text-sm text-text-muted",children:n("noGlobalProxy")}),(0,d.jsx)(h.Button,{size:"sm",variant:c?"secondary":"primary",icon:"settings",onClick:()=>{t(),b(!0)},children:c?o("edit"):n("configure")})]})]})}),(0,d.jsx)(l.default,{}),(0,d.jsx)(g.Card,{className:"p-6 mt-4",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-medium",children:n("debugToggle")})}),(0,d.jsx)(j.Toggle,{checked:p,onChange:()=>u(!p),disabled:r})]})})]}),(0,d.jsx)(i.ProxyConfigModal,{isOpen:a,onClose:()=>b(!1),level:"global",levelLabel:n("globalLabel"),onSaved:t})]})}]),c()}catch(a){c(a)}},!1),220584,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(294023),h=a.i(292216),i=a.i(709918),j=a.i(893711),k=a.i(788164),l=a.i(171302),m=a.i(415925),n=a.i(753506),o=b([f,j,k]);[f,j,k]=o.then?(await o)():o,a.s(["default",0,function(){let{theme:a,setTheme:b,isDark:c}=(0,j.useTheme)(),{colorTheme:f,customColor:o,setColorTheme:p,setCustomColorTheme:q}=(0,k.default)(),r=(0,m.useTranslations)("settings"),s=(0,m.useTranslations)("sidebar"),[t,u]=(0,e.useState)({}),[v,w]=(0,e.useState)(!0),[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)(o||"#3b82f6"),B=/^#([0-9a-fA-F]{6})$/.test(z.startsWith("#")?z:`#${z}`),C=(0,n.normalizeHiddenSidebarItems)(t[n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]),D=new Set(C),E=(a,b)=>"function"==typeof r.has&&r.has(a)?r(a):b;(0,e.useEffect)(()=>k.default.subscribe(a=>{a.customColor&&a.customColor!==z&&A(a.customColor)}),[]);let F={light:r("themeLight"),dark:r("themeDark"),system:r("themeSystem")};(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>{if(!a.ok)throw Error(`HTTP error ${a.status}`);return a.json()}).then(a=>{u({...a,[n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]:(0,n.normalizeHiddenSidebarItems)(a[n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY])}),w(!1)}).catch(()=>w(!1))},[]);let G=async(a,b)=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:b})})).ok&&u(c=>({...c,[a]:a===n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY?(0,n.normalizeHiddenSidebarItems)(b):b}))}catch(b){console.error(`Failed to update ${a}:`,b)}},H=[{id:"coral",color:k.COLOR_THEMES.coral,label:r("themeCoral")},{id:"blue",color:k.COLOR_THEMES.blue,label:r("themeBlue")},{id:"red",color:k.COLOR_THEMES.red,label:r("themeRed")},{id:"green",color:k.COLOR_THEMES.green,label:r("themeGreen")},{id:"violet",color:k.COLOR_THEMES.violet,label:r("themeViolet")},{id:"orange",color:k.COLOR_THEMES.orange,label:r("themeOrange")},{id:"cyan",color:k.COLOR_THEMES.cyan,label:r("themeCyan")}],I=!0===t.debugMode,J=n.SIDEBAR_SECTIONS.filter(a=>"debug"!==a.visibility||I).map(a=>{let b,c;return{...a,title:(b=a.titleKey,c=a.titleFallback,"function"==typeof s.has&&s.has(b)?s(b):c),items:a.items.map(a=>({...a,label:s(a.i18nKey)}))}});return(0,d.jsxs)(h.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"palette"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:r("appearance")})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("darkMode")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("switchThemes")})]}),(0,d.jsx)(i.Toggle,{checked:c,onChange:()=>b(c?"light":"dark")})]}),(0,d.jsx)("div",{className:"pt-4 border-t border-border",children:(0,d.jsx)("div",{role:"tablist","aria-label":r("themeSelectionAria"),className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5",children:["light","dark","system"].map(c=>(0,d.jsxs)("button",{role:"tab","aria-selected":a===c,onClick:()=>b(c),className:(0,l.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all",a===c?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"light"===c?"light_mode":"dark"===c?"dark_mode":"contrast"}),(0,d.jsx)("span",{children:F[c]||c})]},c))})}),(0,d.jsxs)("div",{className:"pt-4 border-t border-border",children:[(0,d.jsx)("p",{className:"font-medium mb-1",children:r("themeAccent")}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-3",children:r("themeAccentDesc")}),(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 mb-3",children:H.map(a=>{let b=f===a.id;return(0,d.jsx)("button",{onClick:()=>p(a.id),className:(0,l.cn)("flex items-center justify-between gap-2 p-2 rounded-lg border transition-colors",b?"border-primary bg-primary/10 text-primary":"border-border hover:bg-surface/50 text-text-main"),children:(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"size-4 rounded-full border border-black/10 dark:border-white/20",style:{backgroundColor:a.color}}),(0,d.jsx)("span",{className:"text-sm font-medium",children:a.label})]})},a.id)})}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"color",value:z,onChange:a=>A(a.target.value),className:"h-10 w-12 rounded border border-border bg-surface cursor-pointer","aria-label":r("themeCustom")}),(0,d.jsx)("input",{type:"text",value:z,onChange:a=>A(a.target.value),placeholder:"#3b82f6",maxLength:7,className:`flex-1 h-10 px-3 rounded-lg bg-surface border text-sm text-text-main focus:outline-none ${B?"border-border focus:border-primary":"border-red-400 focus:border-red-500"}`}),(0,d.jsx)(g.Button,{onClick:()=>q(z),disabled:!B,children:r("themeCreate")})]})]}),(0,d.jsxs)("div",{className:"pt-4 border-t border-border",children:[(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("p",{className:"font-medium",children:r("sidebarVisibilityToggle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:E("sidebarVisibilityDesc","Hide any sidebar navigation entry to reduce visual clutter without disabling any features")})]}),(0,d.jsx)("div",{className:"flex flex-col gap-4",children:J.map(a=>(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface/40",children:[(0,d.jsx)("div",{className:"px-4 py-3 border-b border-border/70",children:(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted/70",children:a.title})}),(0,d.jsx)("div",{className:"divide-y divide-border/70",children:a.items.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[(0,d.jsx)("p",{className:"font-medium",children:a.label}),(0,d.jsx)(i.Toggle,{checked:!D.has(a.id),onChange:()=>{var b;let c;return b=a.id,c=D.has(b)?C.filter(a=>a!==b):[...C,b],void G(n.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY,c)},disabled:v})]},a.id))})]},a.id))}),(0,d.jsx)("p",{className:"mt-3 text-xs text-text-muted",children:E("sidebarVisibilityHint","Any sidebar section is hidden automatically when all of its entries are hidden")})]}),(0,d.jsx)("div",{className:"pt-4 border-t border-border",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("hideHealthLogs")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("hideHealthLogsDesc")})]}),(0,d.jsx)(i.Toggle,{checked:!0===t.hideHealthCheckLogs,onChange:()=>G("hideHealthCheckLogs",!t.hideHealthCheckLogs),disabled:v})]})}),(0,d.jsxs)("div",{className:"pt-4 border-t border-border",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"badge"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold",children:r("whitelabeling")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("whitelabelingDesc")})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("appName")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("appNameDesc")})]}),(0,d.jsx)("input",{type:"text",value:t.instanceName||"OmniRoute",onChange:a=>G("instanceName",a.target.value),placeholder:"OmniRoute",maxLength:100,className:"h-10 px-3 rounded-lg bg-surface border border-border text-sm text-text-main focus:outline-none focus:border-primary w-48"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("customLogo")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("customLogoDesc")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:t.customLogoUrl||"",onChange:a=>G("customLogoUrl",a.target.value),className:"flex-1 h-10 px-3 rounded-lg bg-surface border border-border text-sm text-text-main focus:outline-none focus:border-primary",placeholder:"https://example.com/logo.png",maxLength:2e3}),(t.customLogoUrl||t.customLogoBase64)&&(0,d.jsx)("img",{src:t.customLogoBase64||t.customLogoUrl,alt:"Logo preview",className:"h-10 w-10 rounded border border-border object-contain bg-surface",onError:a=>{a.currentTarget.style.display="none"}})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("p",{className:"font-medium",children:r("uploadLogo")}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-surface border border-border text-sm text-text-main cursor-pointer hover:bg-surface/80 transition-colors",children:[(0,d.jsx)("input",{type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/gif,image/webp",onChange:a=>{let b=a.target.files?.[0];if(b){if(b.size>512e3)return void y("Logo file must be less than 500KB");if(!["image/png","image/jpeg","image/svg+xml","image/gif","image/webp"].includes(b.type))return void y("Invalid file type. Please upload PNG, JPG, SVG, GIF, or WebP.");y(null);let a=new FileReader;a.onerror=()=>{y("Failed to read file")},a.onload=a=>{let b=a.target?.result;G("customLogoBase64",b)},a.readAsDataURL(b)}},className:"hidden"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"upload"}),(0,d.jsx)("span",{children:r("uploadLogo")})]}),(0,d.jsx)(g.Button,{variant:"secondary",onClick:()=>{G("customLogoUrl",""),G("customLogoBase64","")},children:r("resetLogo")})]}),x&&(0,d.jsx)("p",{className:"text-sm text-red-500",children:x}),(t.customLogoBase64||t.customLogoUrl)&&(0,d.jsxs)("div",{className:"mt-2 p-3 bg-black/5 dark:bg-white/5 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:r("logoPreview")}),(0,d.jsx)("img",{src:t.customLogoBase64||t.customLogoUrl,alt:"Logo preview",className:"h-12 w-auto max-w-full rounded"})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 pt-4 border-t border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:r("customFavicon")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:r("customFaviconDesc")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:t.customFaviconUrl||"",onChange:a=>G("customFaviconUrl",a.target.value),className:"flex-1 h-10 px-3 rounded-lg bg-surface border border-border text-sm text-text-main focus:outline-none focus:border-primary",placeholder:"https://example.com/favicon.ico",maxLength:2e3}),(t.customFaviconUrl||t.customFaviconBase64)&&(0,d.jsx)("img",{src:t.customFaviconBase64||t.customFaviconUrl,alt:"Favicon preview",className:"h-10 w-10 rounded border border-border object-contain bg-surface",onError:a=>{a.currentTarget.style.display="none"}})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("p",{className:"font-medium",children:r("uploadFavicon")}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-surface border border-border text-sm text-text-main cursor-pointer hover:bg-surface/80 transition-colors",children:[(0,d.jsx)("input",{type:"file",accept:"image/png,image/x-icon,image/svg+xml,image/gif,image/webp",onChange:a=>{let b=a.target.files?.[0];if(b){if(b.size>51200)return void y("Favicon file must be less than 50KB");if(!["image/png","image/x-icon","image/svg+xml","image/gif","image/webp"].includes(b.type))return void y("Invalid file type. Please upload PNG, ICO, SVG, GIF, or WebP.");y(null);let a=new FileReader;a.onerror=()=>{y("Failed to read file")},a.onload=a=>{let b=a.target?.result;G("customFaviconBase64",b)},a.readAsDataURL(b)}},className:"hidden"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"upload"}),(0,d.jsx)("span",{children:r("uploadFavicon")})]}),(0,d.jsx)(g.Button,{variant:"secondary",onClick:()=>{G("customFaviconUrl",""),G("customFaviconBase64","")},children:r("resetFavicon")})]}),x&&!x.includes("Logo")&&(0,d.jsx)("p",{className:"text-sm text-red-500",children:x}),(t.customFaviconBase64||t.customFaviconUrl)&&(0,d.jsxs)("div",{className:"mt-2 p-3 bg-black/5 dark:bg-white/5 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:r("faviconPreview")}),(0,d.jsx)("img",{src:t.customFaviconBase64||t.customFaviconUrl,alt:"Favicon preview",className:"h-8 w-8 rounded"})]})]})]})]})]})]})}]),c()}catch(a){c(a)}},!1),413316,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i;let j=[{value:"passthrough",labelKey:"passthrough",descKey:"passthroughDesc",icon:"arrow_forward"},{value:"auto",labelKey:"auto",descKey:"autoDesc",icon:"auto_awesome"},{value:"custom",labelKey:"custom",descKey:"customDesc",icon:"tune"},{value:"adaptive",labelKey:"adaptive",descKey:"adaptiveDesc",icon:"trending_up"}],k=[{value:"none",labelKey:"effortNone"},{value:"low",labelKey:"effortLow"},{value:"medium",labelKey:"effortMedium"},{value:"high",labelKey:"effortHigh"}];a.s(["default",0,function(){let[a,b]=(0,e.useState)({mode:"passthrough",customBudget:10240,effortLevel:"medium"}),[c,f]=(0,e.useState)(!0),[i,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),o=(0,h.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/thinking-budget").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let p=async c=>{let d={...a,...c};b(d),l(!0),n("");try{(await fetch("/api/settings/thinking-budget",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).ok?(n("saved"),setTimeout(()=>n(""),2e3)):n("error")}catch{n("error")}finally{l(!1)}};return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"psychology"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:o("thinkingBudgetTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:o("thinkingBudgetDesc")})]}),"saved"===m&&(0,d.jsxs)("span",{className:"ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",o("saved")]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 mb-5",children:j.map(b=>(0,d.jsxs)("button",{onClick:()=>p({mode:b.value}),disabled:c||i,className:`flex items-start gap-3 p-3 rounded-lg border text-left transition-all ${a.mode===b.value?"border-violet-500/50 bg-violet-500/5 ring-1 ring-violet-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[20px] mt-0.5 ${a.mode===b.value?"text-violet-500":"text-text-muted"}`,children:b.icon}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:`text-sm font-medium ${a.mode===b.value?"text-violet-400":""}`,children:o(b.labelKey)}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:o(b.descKey)})]})]},b.value))}),"custom"===a.mode&&(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:o("tokenBudget")}),(0,d.jsxs)("span",{className:"text-sm font-mono tabular-nums text-violet-400",children:[a.customBudget.toLocaleString()," ",o("tokens")]})]}),(0,d.jsx)("input",{type:"range",min:"0",max:"131072",step:"1024",value:a.customBudget,onChange:a=>p({customBudget:parseInt(a.target.value)}),className:"w-full accent-violet-500"}),(0,d.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mt-1",children:[(0,d.jsx)("span",{children:o("off")}),(0,d.jsx)("span",{children:"1K"}),(0,d.jsx)("span",{children:"10K"}),(0,d.jsx)("span",{children:"64K"}),(0,d.jsx)("span",{children:"128K"})]})]}),"adaptive"===a.mode&&(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30",children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-3",children:o("baseEffortLevel")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-3",children:o("adaptiveHint")}),(0,d.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:k.map(b=>(0,d.jsx)("button",{onClick:()=>p({effortLevel:b.value}),disabled:c||i,className:`px-3 py-2 rounded-lg text-xs font-medium border transition-all ${a.effortLevel===b.value?"border-violet-500/50 bg-violet-500/10 text-violet-400":"border-border/50 text-text-muted hover:border-border"}`,children:o(b.labelKey)},b.value))})]})]})}]),c()}catch(a){c(a)}},!1),769979,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=b([f]);[f]=h.then?(await h)():h,a.s(["default",0,function(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)(!0),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("");(0,e.useEffect)(()=>{fetch("/api/settings/codex-service-tier").then(a=>a.json()).then(a=>{b(!!a.enabled),f(!1)}).catch(()=>f(!1))},[]);let l=async a=>{b(a),i(!0),k("");try{(await fetch("/api/settings/codex-service-tier",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:a})})).ok?(k("saved"),setTimeout(()=>k(""),2e3)):(k("error"),b(!a))}catch{k("error"),b(!a)}finally{i(!1)}};return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-sky-500/10 text-sky-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"bolt"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:"Codex Fast Service Tier"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Inject `service_tier=fast` into Codex requests when the client leaves it unset."})]}),"saved"===j&&(0,d.jsxs)("span",{className:"text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"}),"Saved"]}),"error"===j&&(0,d.jsxs)("span",{className:"text-xs font-medium text-rose-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),"Failed to save"]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-surface/30 border border-border/30",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"Force fast tier for Codex"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"Off by default. Applies only to Codex requests and does not override an explicit tier."})]}),(0,d.jsx)("button",{onClick:()=>l(!a),disabled:c||h,className:`relative inline-flex h-6 w-11 items-center rounded-full border transition-colors ${a?"bg-sky-500 border-sky-500":"bg-black/10 border-black/10 dark:bg-white/10 dark:border-white/10"}`,children:(0,d.jsx)("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${a?"translate-x-6":"translate-x-1"}`})})]})]})}]),c()}catch(a){c(a)}},!1),847910,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(709918),i=a.i(415925),j=b([f]);[f]=j.then?(await j)():j,a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!1,prompt:""}),[c,f]=(0,e.useState)(!0),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(null),n=(0,i.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/system-prompt").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let o=async c=>{let d={...a,...c};b(d),k("");try{(await fetch("/api/settings/system-prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).ok&&(k("saved"),setTimeout(()=>k(""),2e3))}catch{k("error")}};return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"edit_note"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:n("globalSystemPrompt")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:n("systemPromptDesc")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:["saved"===j&&(0,d.jsxs)("span",{className:"text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",n("saved")]}),(0,d.jsx)(h.Toggle,{checked:a.enabled,onChange:()=>o({enabled:!a.enabled}),disabled:c})]})]}),a.enabled&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("textarea",{value:a.prompt,onChange:a=>{var c;return c=a.target.value,void(b(a=>({...a,prompt:c})),l&&clearTimeout(l),m(setTimeout(()=>{o({prompt:c})},800)))},placeholder:n("systemPromptPlaceholder"),rows:5,className:"w-full px-4 py-3 rounded-lg border border-border/50 bg-surface/30 text-sm placeholder:text-text-muted/50 resize-y min-h-[120px] focus:outline-none focus:ring-1 focus:ring-amber-500/30 focus:border-amber-500/50 transition-colors",disabled:c}),(0,d.jsx)("div",{className:"absolute bottom-2 right-3 text-xs text-text-muted/60 tabular-nums",children:n("chars",{count:a.prompt.length})})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted/70 flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),n("systemPromptHint")]})]})]})}]),c()}catch(a){c(a)}},!1),876881,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i,a.s(["default",0,function(){let[a,b]=(0,e.useState)({}),[c,f]=(0,e.useState)({}),[i,j]=(0,e.useState)(!0),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),s=(0,h.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/model-aliases").then(a=>a.json()).then(a=>{b(a.builtIn||{}),f(a.custom||{}),j(!1)}).catch(()=>j(!1))},[]);let t=async()=>{if(o.trim()&&q.trim()){l(!0);try{let a=await fetch("/api/settings/model-aliases",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:o.trim(),to:q.trim()})});if(a.ok){let b=await a.json();f(b.custom),p(""),r(""),n("saved"),setTimeout(()=>n(""),2e3)}}catch{n("error")}finally{l(!1)}}},u=async a=>{l(!0);try{let b=await fetch("/api/settings/model-aliases",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a})});if(b.ok){let a=await b.json();f(a.custom),n("saved"),setTimeout(()=>n(""),2e3)}}catch{n("error")}finally{l(!1)}},v=Object.entries(a),w=Object.entries(c);return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"swap_horiz"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("modelAliasesTitle")||"Model Aliases"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:s("modelAliasesDesc")||"Auto-forward deprecated model IDs to their replacements"})]}),"saved"===m&&(0,d.jsxs)("span",{className:"ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",s("saved")||"Saved"]})]}),(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-3",children:s("addCustomAlias")||"Add Custom Alias"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",placeholder:s("deprecatedModelId")||"Deprecated model ID",value:o,onChange:a=>p(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-amber-500/50 focus:outline-none"}),(0,d.jsx)("span",{className:"text-text-muted text-lg",children:"→"}),(0,d.jsx)("input",{type:"text",placeholder:s("newModelId")||"New model ID",value:q,onChange:a=>r(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-amber-500/50 focus:outline-none"}),(0,d.jsx)("button",{onClick:t,disabled:k||!o.trim()||!q.trim(),className:"px-4 py-2 rounded-lg text-sm font-medium bg-amber-500/10 text-amber-500 hover:bg-amber-500/20 disabled:opacity-50 transition-all",children:s("add")||"Add"})]})]}),w.length>0&&(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-text-muted uppercase tracking-wider mb-2",children:s("customAliases")||"Custom Aliases"}),(0,d.jsx)("div",{className:"rounded-lg border border-border/30 divide-y divide-border/20",children:w.map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[(0,d.jsx)("code",{className:"text-xs text-red-400/80 flex-1 truncate",children:a}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("code",{className:"text-xs text-emerald-400/80 flex-1 truncate",children:b}),(0,d.jsx)("button",{onClick:()=>u(a),disabled:k,className:"p-1 rounded hover:bg-red-500/10 text-text-muted hover:text-red-400 transition-all",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},a))})]}),(0,d.jsxs)("details",{className:"group",children:[(0,d.jsxs)("summary",{className:"text-xs font-medium text-text-muted uppercase tracking-wider cursor-pointer flex items-center gap-1 mb-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] group-open:rotate-90 transition-transform",children:"chevron_right"}),s("builtInAliases")||"Built-in Aliases"," (",v.length,")"]}),(0,d.jsx)("div",{className:"rounded-lg border border-border/30 divide-y divide-border/20 max-h-60 overflow-y-auto",children:v.map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 opacity-60",children:[(0,d.jsx)("code",{className:"text-xs text-red-400/60 flex-1 truncate",children:a}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("code",{className:"text-xs text-emerald-400/60 flex-1 truncate",children:b}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"lock"})]},a))})]})]})}]),c()}catch(a){c(a)}},!1),356962,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i,a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!1,degradationMap:{},detectionPatterns:[],stats:{detected:0,tokensSaved:0}}),[c,f]=(0,e.useState)(!0),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),s=(0,h.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/background-degradation").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let t=async c=>{let d={...a,...c};b(d),j(!0),l("");try{let{stats:a,...c}=d,e=await fetch("/api/settings/background-degradation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(e.ok){let a=await e.json();b(a),l("saved"),setTimeout(()=>l(""),2e3)}else l("error")}catch{l("error")}finally{j(!1)}},u=Object.entries(a.degradationMap||{});return(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-sky-500/10 text-sky-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"speed"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:s("backgroundDegradationTitle")||"Background Task Degradation"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:s("backgroundDegradationDesc")||"Auto-redirect background requests (titles, summaries) to cheaper models"})]}),"saved"===k&&(0,d.jsxs)("span",{className:"text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",s("saved")||"Saved"]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:s("enableDegradation")||"Enable Background Degradation"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:s("enableDegradationHint")||"Automatically use cheaper models for background utility tasks"})]}),(0,d.jsx)("button",{onClick:()=>t({enabled:!a.enabled}),disabled:c||i,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${a.enabled?"bg-sky-500":"bg-white/10"}`,children:(0,d.jsx)("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${a.enabled?"translate-x-6":"translate-x-1"}`})})]}),a.stats&&a.stats.detected>0&&(0,d.jsx)("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-sky-500/5 border border-sky-500/20 mb-4",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-sky-400",children:"analytics"}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:[s("tasksDetected")||"Tasks detected",":"]}),(0,d.jsx)("span",{className:"text-sm font-mono font-semibold text-sky-400",children:a.stats.detected})]})}),a.enabled&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-text-muted uppercase tracking-wider mb-2",children:s("degradationMap")||"Model Degradation Map"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("input",{type:"text",placeholder:s("premiumModel")||"Premium model",value:m,onChange:a=>n(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-sky-500/50 focus:outline-none"}),(0,d.jsx)("span",{className:"text-text-muted text-lg",children:"→"}),(0,d.jsx)("input",{type:"text",placeholder:s("cheapModel")||"Cheap model",value:o,onChange:a=>p(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-sky-500/50 focus:outline-none"}),(0,d.jsx)("button",{onClick:()=>{if(!m.trim()||!o.trim())return;let b={...a.degradationMap,[m.trim()]:o.trim()};t({degradationMap:b}),n(""),p("")},disabled:i||!m.trim()||!o.trim(),className:"px-3 py-2 rounded-lg text-sm font-medium bg-sky-500/10 text-sky-500 hover:bg-sky-500/20 disabled:opacity-50 transition-all",children:s("add")||"Add"})]}),u.length>0&&(0,d.jsx)("div",{className:"rounded-lg border border-border/30 divide-y divide-border/20 max-h-48 overflow-y-auto",children:u.map(([b,c])=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2",children:[(0,d.jsx)("code",{className:"text-xs text-orange-400/80 flex-1 truncate",children:b}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,d.jsx)("code",{className:"text-xs text-sky-400/80 flex-1 truncate",children:c}),(0,d.jsx)("button",{onClick:()=>{let c;return c={...a.degradationMap},void(delete c[b],t({degradationMap:c}))},disabled:i,className:"p-1 rounded hover:bg-red-500/10 text-text-muted hover:text-red-400 transition-all",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},b))})]}),(0,d.jsxs)("details",{className:"group",children:[(0,d.jsxs)("summary",{className:"text-xs font-medium text-text-muted uppercase tracking-wider cursor-pointer flex items-center gap-1 mb-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] group-open:rotate-90 transition-transform",children:"chevron_right"}),s("detectionPatterns")||"Detection Patterns"," (",a.detectionPatterns?.length||0,")"]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("input",{type:"text",placeholder:s("newPattern")||'e.g. "generate a title"',value:q,onChange:a=>r(a.target.value),className:"flex-1 px-3 py-2 rounded-lg text-sm bg-surface border border-border/50 focus:border-sky-500/50 focus:outline-none"}),(0,d.jsx)("button",{onClick:()=>{if(!q.trim())return;let b=[...a.detectionPatterns,q.trim()];t({detectionPatterns:b}),r("")},disabled:i||!q.trim(),className:"px-3 py-2 rounded-lg text-sm font-medium bg-sky-500/10 text-sky-500 hover:bg-sky-500/20 disabled:opacity-50 transition-all",children:s("add")||"Add"})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:(a.detectionPatterns||[]).map((b,c)=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs bg-sky-500/10 text-sky-400 border border-sky-500/20",children:[b,(0,d.jsx)("button",{onClick:()=>{let b;return b=a.detectionPatterns.filter((a,b)=>b!==c),void t({detectionPatterns:b})},className:"hover:text-red-400 transition-colors",disabled:i,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},c))})]})]})]})}]),c()}catch(a){c(a)}},!1),976066,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i;a.s(["default",0,function(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!1),i=(0,h.useTranslations)("cache"),j=(0,e.useCallback)(()=>{fetch("/api/settings/cache-metrics").then(a=>a.json()).then(b).catch(()=>{})},[]);(0,e.useEffect)(()=>{j();let a=setInterval(()=>void j(),1e4);return()=>clearInterval(a)},[j]);let k=async()=>{f(!0);try{await fetch("/api/settings/cache-metrics",{method:"DELETE"}),j()}finally{f(!1)}},l=a&&a.totalInputTokens>0?a.totalCachedTokens/a.totalInputTokens*100:0;return(0,d.jsx)(g.Card,{children:(0,d.jsxs)("div",{className:"p-5 flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted","aria-hidden":"true",children:"insights"}),(0,d.jsx)("h2",{className:"font-medium text-sm",children:i("cacheMetrics")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:i("autoRefresh",{seconds:10})}),(0,d.jsx)("button",{onClick:k,disabled:c,className:"px-3 py-1.5 text-xs rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:c?i("resetting"):i("resetMetrics")})]})]}),a?(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted",children:i("totalRequests")}),(0,d.jsx)("p",{className:"font-mono text-lg text-text-main",children:a.totalRequests})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted",children:i("withCacheControl")}),(0,d.jsx)("p",{className:"font-mono text-lg text-text-main",children:a.requestsWithCacheControl})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted",children:i("inputTokens")}),(0,d.jsx)("p",{className:"font-mono text-lg text-text-main",children:a.totalInputTokens.toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted",children:i("cachedTokensRead")}),(0,d.jsx)("p",{className:"font-mono text-lg text-green-400",children:a.totalCachedTokens.toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted",children:i("cacheCreationWrite")}),(0,d.jsx)("p",{className:"font-mono text-lg text-blue-400",children:a.totalCacheCreationTokens.toLocaleString()})]})]}),(0,d.jsxs)("div",{className:"rounded-lg bg-surface/50 border border-border/30 p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-text-main",children:i("cacheReuseRatio")}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:i("cacheReuseRatioDesc")})]}),(0,d.jsxs)("p",{className:"font-mono text-xl text-green-400",children:[l.toFixed(1),"%"]})]}),(0,d.jsx)("div",{className:"mt-2 h-2 rounded-full bg-border/30 overflow-hidden",children:(0,d.jsx)("div",{className:"h-full bg-green-500 transition-all duration-300",style:{width:`${Math.min(l,100)}%`}})})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted",children:i("tokensSaved")}),(0,d.jsx)("p",{className:"font-mono text-lg text-green-400",children:a.tokensSaved.toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted",children:i("estCostSaved")}),(0,d.jsxs)("p",{className:"font-mono text-lg text-green-400",children:["$",a.estimatedCostSaved.toFixed(4)]})]})]}),Object.keys(a.byProvider).length>0&&(0,d.jsxs)("div",{className:"pt-3 border-t border-border/30",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-text-muted mb-2",children:i("byProvider")}),(0,d.jsx)("div",{className:"space-y-2",children:Object.entries(a.byProvider).map(([a,b])=>{let c=b.inputTokens>0?b.cachedTokens/b.inputTokens*100:0;return(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded bg-surface/30 text-xs",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"text-text-main capitalize w-24",children:a}),(0,d.jsxs)("span",{className:"text-text-muted",children:[b.requests," ",i("requestsShort")]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-4 font-mono",children:[(0,d.jsxs)("span",{className:"text-text-muted",title:i("inputTokens"),children:[i("inputShort"),": ",b.inputTokens.toLocaleString()]}),(0,d.jsxs)("span",{className:"text-green-400",title:i("cachedTokensRead"),children:[i("cachedShort"),": ",b.cachedTokens.toLocaleString()]}),(0,d.jsxs)("span",{className:"text-blue-400",title:i("cacheCreationWrite"),children:[i("writeShort"),": ",b.cacheCreationTokens.toLocaleString()]}),(0,d.jsxs)("span",{className:"text-green-400 w-12 text-right",children:[c.toFixed(0),"%"]})]})]},a)})})]})]}):(0,d.jsx)("p",{className:"text-sm text-text-muted",children:i("loading")})]})})}]),c()}catch(a){c(a)}},!1),894167,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(415925),j=b([f]);[f]=j.then?(await j)():j,a.s(["default",0,function(){let a=(0,i.useTranslations)("settings"),[b,c]=(0,e.useState)({semanticCacheEnabled:!0,semanticCacheMaxSize:100,semanticCacheTTL:18e5,promptCacheEnabled:!0,promptCacheStrategy:"auto",alwaysPreserveClientCache:"auto"}),[f,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!0);(0,e.useEffect)(()=>{fetch("/api/settings/cache-config").then(a=>a.ok?a.json():null).then(a=>{a&&c(a)}).catch(()=>{}).finally(()=>l(!1))},[]);let m=async()=>{j(!0);try{await fetch("/api/settings/cache-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}finally{j(!1)}};return k?(0,d.jsx)(g.Card,{className:"p-6",children:(0,d.jsx)("p",{className:"text-sm text-text-muted",children:a("loading")})}):(0,d.jsxs)(g.Card,{className:"p-6",children:[(0,d.jsxs)("h3",{className:"text-lg font-semibold text-text-main flex items-center gap-2 mb-4",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"cached"}),a("cacheSettings")]}),(0,d.jsxs)("div",{className:"space-y-6",children:[(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("h4",{className:"text-sm font-medium text-text-main",children:a("semanticCache")}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("enabled")}),(0,d.jsx)("button",{onClick:()=>c(a=>({...a,semanticCacheEnabled:!a.semanticCacheEnabled})),className:`relative w-10 h-5 rounded-full transition-colors ${b.semanticCacheEnabled?"bg-green-500":"bg-border"}`,children:(0,d.jsx)("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${b.semanticCacheEnabled?"left-5":"left-0.5"}`})})]}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("maxEntries")}),(0,d.jsx)("input",{type:"number",min:1,max:1e3,value:b.semanticCacheMaxSize,onChange:a=>c(b=>({...b,semanticCacheMaxSize:parseInt(a.target.value)||100})),className:"w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"})]}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("ttlMinutes")}),(0,d.jsx)("input",{type:"number",min:1,max:1440,value:Math.round(b.semanticCacheTTL/6e4),onChange:a=>c(b=>({...b,semanticCacheTTL:6e4*(parseInt(a.target.value)||30)})),className:"w-24 px-2 py-1 text-sm rounded border border-border bg-surface text-text-main"})]})]}),(0,d.jsxs)("div",{className:"space-y-3 pt-4 border-t border-border/30",children:[(0,d.jsx)("h4",{className:"text-sm font-medium text-text-main",children:a("promptCache")}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("enabled")}),(0,d.jsx)("button",{onClick:()=>c(a=>({...a,promptCacheEnabled:!a.promptCacheEnabled})),className:`relative w-10 h-5 rounded-full transition-colors ${b.promptCacheEnabled?"bg-green-500":"bg-border"}`,children:(0,d.jsx)("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${b.promptCacheEnabled?"left-5":"left-0.5"}`})})]}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("strategy")}),(0,d.jsxs)("select",{value:b.promptCacheStrategy,onChange:a=>c(b=>({...b,promptCacheStrategy:a.target.value})),className:"px-2 py-1 text-sm rounded border border-border bg-surface text-text-main",children:[(0,d.jsx)("option",{value:"auto",children:"Auto"}),(0,d.jsx)("option",{value:"system-only",children:"System Only"}),(0,d.jsx)("option",{value:"manual",children:"Manual"})]})]}),(0,d.jsxs)("label",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:a("preserveClientCache")}),(0,d.jsxs)("select",{value:b.alwaysPreserveClientCache,onChange:a=>c(b=>({...b,alwaysPreserveClientCache:a.target.value})),className:"px-2 py-1 text-sm rounded border border-border bg-surface text-text-main",children:[(0,d.jsx)("option",{value:"auto",children:"Auto"}),(0,d.jsx)("option",{value:"always",children:"Always"}),(0,d.jsx)("option",{value:"never",children:"Never"})]})]})]}),(0,d.jsx)("div",{className:"pt-4 border-t border-border/30",children:(0,d.jsx)(h.Button,{onClick:m,disabled:f,size:"sm",children:a(f?"saving":"save")})})]})]})}]),c()}catch(a){c(a)}},!1),43184,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(415925),i=b([f]);[f]=i.then?(await i)():i;let j=[{value:"recent",labelKey:"recent",descKey:"recentDesc"},{value:"semantic",labelKey:"semantic",descKey:"semanticDesc"},{value:"hybrid",labelKey:"hybrid",descKey:"hybridDesc"}];a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!0,maxTokens:2e3,retentionDays:30,strategy:"hybrid",skillsEnabled:!1}),[c,f]=(0,e.useState)(!0),[i,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(""),n=(0,h.useTranslations)("settings");(0,e.useEffect)(()=>{fetch("/api/settings/memory").then(a=>a.json()).then(a=>{b(a),f(!1)}).catch(()=>f(!1))},[]);let o=async c=>{let d={...a,...c};b(d),k(!0),m("");try{(await fetch("/api/settings/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).ok?(m("saved"),setTimeout(()=>m(""),2e3)):m("error")}catch{m("error")}finally{k(!1)}};return c?(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"psychology"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:n("memorySkillsTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:n("memorySkillsDesc")})]})]}),(0,d.jsxs)("div",{className:"mt-4 text-sm text-text-muted",children:[n("loading"),"..."]})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"memory"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:n("memoryTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:n("memoryDesc")})]}),"saved"===l&&(0,d.jsxs)("span",{className:"ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",n("saved")]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:n("memoryEnabled")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:n("memoryEnabledDesc")})]}),(0,d.jsx)("button",{onClick:()=>o({enabled:!a.enabled}),disabled:i,className:`relative w-11 h-6 rounded-full transition-colors ${a.enabled?"bg-violet-500":"bg-border"}`,role:"switch","aria-checked":a.enabled,children:(0,d.jsx)("span",{className:`absolute top-1 left-1 w-4 h-4 bg-white rounded-full transition-transform ${a.enabled?"translate-x-5":"translate-x-0"}`})})]}),a.enabled&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:n("maxTokens")}),(0,d.jsxs)("span",{className:"text-sm font-mono tabular-nums text-violet-400",children:[a.maxTokens.toLocaleString()," ",n("tokens")]})]}),(0,d.jsx)("input",{type:"range",min:"0",max:"16000",step:"500",value:a.maxTokens,onChange:a=>o({maxTokens:parseInt(a.target.value)}),className:"w-full accent-violet-500"}),(0,d.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mt-1",children:[(0,d.jsx)("span",{children:n("off")}),(0,d.jsx)("span",{children:"4K"}),(0,d.jsx)("span",{children:"8K"}),(0,d.jsx)("span",{children:"16K"})]})]}),(0,d.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:n("retentionDays")}),(0,d.jsxs)("span",{className:"text-sm font-mono tabular-nums text-violet-400",children:[a.retentionDays," ",n("days")]})]}),(0,d.jsx)("input",{type:"range",min:"1",max:"90",step:"1",value:a.retentionDays,onChange:a=>o({retentionDays:parseInt(a.target.value)}),className:"w-full accent-violet-500"}),(0,d.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mt-1",children:[(0,d.jsx)("span",{children:"1"}),(0,d.jsx)("span",{children:"30"}),(0,d.jsx)("span",{children:"60"}),(0,d.jsx)("span",{children:"90"})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-2",children:j.map(b=>(0,d.jsxs)("button",{onClick:()=>o({strategy:b.value}),disabled:c||i,className:`flex flex-col items-start p-3 rounded-lg border text-left transition-all ${a.strategy===b.value?"border-violet-500/50 bg-violet-500/5 ring-1 ring-violet-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,d.jsx)("p",{className:`text-sm font-medium ${a.strategy===b.value?"text-violet-400":""}`,children:n(b.labelKey)}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:n(b.descKey)})]},b.value))})]})]}),(0,d.jsxs)(g.Card,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"handyman"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold",children:n("skillsTitle")}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:n("skillsDesc")})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-surface/30 border border-border/30",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:n("skillsEnabled")}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:n("skillsEnabledDesc")})]}),(0,d.jsx)("button",{onClick:()=>o({skillsEnabled:!a.skillsEnabled}),disabled:i,className:`relative w-11 h-6 rounded-full transition-colors ${a.skillsEnabled?"bg-amber-500":"bg-border"}`,role:"switch","aria-checked":a.skillsEnabled,children:(0,d.jsx)("span",{className:`absolute top-1 left-1 w-4 h-4 bg-white rounded-full transition-transform ${a.skillsEnabled?"translate-x-5":"translate-x-0"}`})})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-3",children:n("skillsComingSoon")})]})]})}]),c()}catch(a){c(a)}},!1),802282,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(489108),j=a.i(415925),k=a.i(240246),l=b([f]);[f]=l.then?(await l)():l,a.s(["default",0,function(){let[a,b]=(0,e.useState)({enabled:!1,threshold:3}),[c,f]=(0,e.useState)({enabled:!1,threshold:3}),[l,m]=(0,e.useState)(!0),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),r=(0,j.useTranslations)("settings"),s=(0,j.useTranslations)("common"),t=(0,k.useNotificationStore)();(0,e.useEffect)(()=>{fetch("/api/settings/auto-disable-accounts").then(a=>a.json()).then(a=>{b(a),f(a),m(!1)}).catch(()=>m(!1))},[]);let u=async()=>{o(!0);try{let a=await fetch("/api/settings/auto-disable-accounts",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!a.ok)throw Error("Failed to save auto-disable config");let d=await a.json();b(d),q(!1),t.success(r("savedSuccessfully")||"Saved successfully")}catch(a){t.error(a instanceof Error?a.message:"Error saving")}finally{o(!1)}};return l?null:(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"block"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:r("autoDisableBannedAccounts")})]}),p?(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",onClick:()=>{f(a),q(!1)},children:s("cancel")}),(0,d.jsx)(h.Button,{size:"sm",variant:"primary",icon:"save",onClick:u,disabled:n,children:s("save")})]}):(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>q(!0),children:s("edit")})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:r("autoDisableDescription")}),(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,d.jsx)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4 flex flex-col justify-center",children:(0,d.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:p?c.enabled:a.enabled,onChange:a=>f(b=>({...b,enabled:a.target.checked})),disabled:!p,className:"w-4 h-4 text-primary bg-surface/50 border-white/20 rounded focus:ring-primary/50"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:r("autoDisableBannedAccounts")})]})}),(0,d.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4",children:[(0,d.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider mb-2 flex items-center gap-2",children:r("autoDisableThreshold")}),p?(0,d.jsx)(i.Input,{type:"number",min:"1",max:"10",value:c.threshold,onChange:a=>f(b=>({...b,threshold:parseInt(a.target.value)||1})),disabled:!c.enabled}):(0,d.jsxs)("span",{className:`text-sm font-mono ${!a.enabled&&"opacity-50"}`,children:[a.threshold," ",r("failures",{count:a.threshold})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-2",children:r("autoDisableThresholdDesc")})]})]})]})})}]),c()}catch(a){c(a)}},!1),986820,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(294023),i=a.i(240246),j=a.i(32886),k=a.i(415925),l=a.i(802282),m=b([f,l]);[f,l]=m.then?(await m)():m;let u={CLOSED:{bg:"bg-emerald-500/15",text:"text-emerald-400",border:"border-emerald-500/30",icon:"check_circle"},OPEN:{bg:"bg-red-500/15",text:"text-red-400",border:"border-red-500/30",icon:"error"},HALF_OPEN:{bg:"bg-amber-500/15",text:"text-amber-400",border:"border-amber-500/30",icon:"warning"}},v={closed:{icon:"check_circle",color:"#22c55e"},"half-open":{icon:"pending",color:"#f59e0b"},open:{icon:"error",color:"#ef4444"}};function n(a,b){let c=String(a||"closed").toLowerCase().replaceAll("_","-");return b("open"===c?"breakerStateOpen":"half-open"===c?"breakerStateHalfOpen":"breakerStateClosed")}function o(a){return!a||a<=0?"—":a<1e3?`${a}ms`:a<6e4?`${(a/1e3).toFixed(1)}s`:`${(a/6e4).toFixed(1)}m`}function p(a,b){return a instanceof Error&&a.message?a.message:b}function q({profiles:a,onSave:b,saving:c}){let[f,i]=(0,e.useState)(!1),[j,l]=(0,e.useState)(a),m=(0,k.useTranslations)("settings"),n=(0,k.useTranslations)("common");(0,e.useEffect)(()=>{l(a)},[a]);let o=a=>null==a?"—":`${a}${m("ms")}`,p=[{key:"transientCooldown",label:m("transientCooldown"),format:o},{key:"rateLimitCooldown",label:m("rateLimitCooldown"),format:o},{key:"maxBackoffLevel",label:m("maxBackoffLevel")},{key:"circuitBreakerThreshold",label:m("cbThreshold"),format:a=>null==a?"—":m("failures",{count:a})},{key:"circuitBreakerReset",label:m("cbResetTime"),format:o}];return(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"tune"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:m("providerProfiles")})]}),f?(0,d.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",onClick:()=>i(!1),children:n("cancel")}),(0,d.jsx)(h.Button,{size:"sm",variant:"primary",icon:"save",onClick:()=>{b(j),i(!1)},disabled:c,children:n("save")})]}):(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>i(!0),children:n("edit")})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:m("providerProfilesDesc")}),(0,d.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:["oauth","apikey"].map(b=>(0,d.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4",children:[(0,d.jsxs)("h3",{className:"text-sm font-bold uppercase tracking-wider mb-3 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base","aria-hidden":"true",children:"oauth"===b?"lock":"key"}),"oauth"===b?m("oauthProviders"):m("apiKeyProviders")]}),(0,d.jsx)("div",{className:"space-y-2",children:p.map(({key:c,label:e,format:g})=>(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:e}),f?(0,d.jsx)("input",{type:"number",min:"0",value:j?.[b]?.[c]??0,onChange:a=>l({...j,[b]:{...j[b],[c]:Number(a.target.value)}}),className:"w-24 px-2 py-1 text-xs rounded bg-white/10 border border-white/20 text-right"}):(0,d.jsx)("span",{className:"text-sm font-mono",children:g?g(a?.[b]?.[c]):a?.[b]?.[c]??"—"})]},c))})]},b))})]})})}function r({rateLimitStatus:a,defaults:b,onSaveDefaults:c,saving:f}){let[i,j]=(0,e.useState)(!1),[l,m]=(0,e.useState)(b||{}),n=(0,k.useTranslations)("settings"),p=(0,k.useTranslations)("common");return(0,e.useEffect)(()=>{b&&m(b)},[b]),(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"speed"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:n("rateLimiting")})]}),i?(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",onClick:()=>j(!1),children:p("cancel")}),(0,d.jsx)(h.Button,{size:"sm",variant:"primary",icon:"save",onClick:()=>{c(l),j(!1)},disabled:f,children:p("save")})]}):(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>j(!0),children:p("edit")})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:n("rateLimitingDesc")}),(0,d.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4 mb-4",children:[(0,d.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider mb-3 text-text-muted",children:n("defaultSafetyNet")}),(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[{key:"requestsPerMinute",label:n("rpm")},{key:"minTimeBetweenRequests",label:n("minGap"),format:o},{key:"concurrentRequests",label:n("maxConcurrent")}].map(({key:a,label:c,format:e})=>(0,d.jsxs)("div",{children:[i?(0,d.jsx)("input",{type:"number",min:"1",value:l[a]??0,onChange:b=>m(c=>({...c,[a]:parseInt(b.target.value)||0})),className:"w-full px-2 py-1 text-lg font-bold rounded bg-white/10 border border-white/20"}):(0,d.jsx)("div",{className:"text-lg font-bold",children:e?e(b?.[a]):b?.[a]??"—"}),(0,d.jsx)("div",{className:"text-xs text-text-muted",children:c})]},a))})]}),a&&a.length>0?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:n("activeLimiters")}),a.map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-black/5 dark:bg-white/5",children:[(0,d.jsx)("span",{className:"text-sm font-medium",children:a.provider||a.key}),(0,d.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[null!=a.reservoir&&(0,d.jsxs)("span",{children:[n("reservoir"),": ",a.reservoir]}),null!=a.running&&(0,d.jsxs)("span",{children:[n("running"),": ",a.running]}),null!=a.queued&&(0,d.jsxs)("span",{children:[n("queued"),": ",a.queued]})]})]},b))]}):(0,d.jsx)("p",{className:"text-xs text-text-muted",children:n("noActiveLimiters")})]})})}function s({breakers:a,onReset:b,loading:c}){let e=a.filter(a=>"CLOSED"!==a.state),f=a.length,i=(0,k.useTranslations)("settings");return(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"electrical_services"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:i("circuitBreakers")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:e.length>0?i("tripped",{count:e.length}):i("healthy",{count:f})}),e.length>0&&(0,d.jsx)(h.Button,{size:"sm",variant:"danger",icon:"restart_alt",onClick:b,disabled:c,children:i("resetAll")})]})]}),0===a.length?(0,d.jsx)("p",{className:"text-sm text-text-muted",children:i("noCircuitBreakers")}):(0,d.jsx)("div",{className:"space-y-2",children:a.map(a=>{let b=u[a.state]||u.CLOSED;return(0,d.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-black/5 dark:bg-white/5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-base ${b.text}`,"aria-hidden":"true",children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:a.name.replace("combo:","")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[a.failureCount>0&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:i("failures",{count:a.failureCount})}),(0,d.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-bold uppercase ${b.bg} ${b.text} border ${b.border}`,children:n(a.state,i)})]})]},a.name)})})]})})}function t(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!0),[l,m]=(0,e.useState)(null),o=(0,i.useNotificationStore)(),p=(0,j.useLocale)(),q=(0,k.useTranslations)("settings"),r=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/policies");if(a.ok){let c=await a.json();b(c)}}catch{}finally{f(!1)}},[]);(0,e.useEffect)(()=>{r();let a=setInterval(r,15e3);return()=>clearInterval(a)},[r]);let s=async a=>{m(a);try{(await fetch("/api/policies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"unlock",identifier:a})})).ok?(o.success(q("unlockedIdentifier",{identifier:a})),await r()):o.error(q("failedUnlock"))}catch{o.error(q("failedUnlock"))}finally{m(null)}},t=a?.circuitBreakers||[],u=a?.lockedIdentifiers||[],w=t.some(a=>"closed"!==a.state)||u.length>0;return c?(0,d.jsx)(g.Card,{className:"p-6",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"policy"}),q("loadingPolicies")]})}):(0,d.jsx)(g.Card,{className:"p-0 overflow-hidden",children:(0,d.jsxs)("div",{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"policy"}),(0,d.jsx)("h2",{className:"text-lg font-bold",children:q("policiesLocked")})]}),w&&(0,d.jsx)(h.Button,{size:"sm",variant:"ghost",onClick:r,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"refresh"})})]}),w?(0,d.jsxs)(d.Fragment,{children:[t.filter(a=>"closed"!==a.state).length>0&&(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-text-muted mb-2",children:q("circuitBreakers")}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:t.filter(a=>"closed"!==a.state).map((a,b)=>{let c=v[a.state]||v.open;return(0,d.jsx)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:c.color},children:c.icon}),(0,d.jsx)("span",{className:"text-sm text-text-main font-medium",children:a.name||a.provider||q("unknown")}),(0,d.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${c.color}15`,color:c.color},children:n(a.state,q)}),a.failures>0&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:q("failures",{count:a.failures})})]})},a.name||b)})})]}),u.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-text-muted mb-2",children:q("lockedIdentifiers")}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:u.map((a,b)=>{let c="string"==typeof a?a:a.identifier||a.id;return(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-red-400",children:"lock"}),(0,d.jsx)("span",{className:"font-mono text-sm text-text-main",children:c}),"object"==typeof a&&a.lockedAt&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:q("sinceDate",{date:new Date(a.lockedAt).toLocaleString(p)})})]}),(0,d.jsx)(h.Button,{size:"sm",variant:"ghost",onClick:()=>s(c),disabled:l===c,className:"text-xs",children:l===c?q("unlocking"):q("forceUnlock")})]},c||b)})})]})]}):(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"verified_user"})}),(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"text-sm text-text-muted",children:q("allOperational")})})]})]})})}a.s(["default",0,function(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!0),[i,j]=(0,e.useState)(!1),[m,n]=(0,e.useState)(null),o=(0,k.useTranslations)("settings"),u=(0,e.useCallback)(async()=>{try{f(!0);let a=await fetch("/api/resilience");if(!a.ok)throw Error(o("failedLoadWithStatus",{status:a.status}));let c=await a.json();b(c),n(null)}catch(a){n(p(a,o("failedLoadResilience")))}finally{f(!1)}},[o]);(0,e.useEffect)(()=>{u();let a=setInterval(u,1e4);return()=>clearInterval(a)},[u]);let v=async()=>{try{if(f(!0),!(await fetch("/api/resilience/reset",{method:"POST"})).ok)throw Error(o("resetFailed"));await u()}catch(a){n(p(a,o("resetFailed")))}finally{f(!1)}},w=async a=>{try{if(j(!0),!(await fetch("/api/resilience",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({profiles:a})})).ok)throw Error(o("saveFailed"));await u()}catch(a){n(p(a,o("saveFailed")))}finally{j(!1)}},x=async a=>{try{if(j(!0),!(await fetch("/api/resilience",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaults:a})})).ok)throw Error(o("saveFailed"));await u()}catch(a){n(p(a,o("saveFailed")))}finally{j(!1)}};return c&&!a?(0,d.jsxs)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"hourglass_empty"}),o("loadingResilience")]}):m&&!a?(0,d.jsxs)(g.Card,{className:"p-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-red-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined",children:"error"}),(0,d.jsx)("span",{className:"text-sm",children:m})]}),(0,d.jsx)(h.Button,{size:"sm",variant:"secondary",icon:"refresh",onClick:u,className:"mt-3",children:o("retry")})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(q,{profiles:a?.profiles||{},onSave:w,saving:i}),(0,d.jsx)(l.default,{}),(0,d.jsx)(r,{rateLimitStatus:a?.rateLimitStatus||[],defaults:a?.defaults||{},onSaveDefaults:x,saving:i}),(0,d.jsx)(s,{breakers:a?.circuitBreakers||[],onReset:v,loading:c}),(0,d.jsx)(t,{})]})}]),c()}catch(a){c(a)}},!1),891657,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(442308),g=a.i(292216),h=a.i(489108),i=a.i(709918),j=b([f]);[f]=j.then?(await j)():j,a.s(["default",0,function(){let[a,b]=(0,e.useState)({}),[c,f]=(0,e.useState)(!0),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(null);(0,e.useEffect)(()=>{fetch("/api/settings").then(a=>{if(!a.ok)throw Error(`Settings API returned ${a.status}`);return a.json()}).then(a=>{b(a),f(!1)}).catch(a=>{console.error("Failed to load settings:",a),f(!1)}),fetch("/api/version-manager/status").then(a=>{if(!a.ok)throw Error(`Version manager API returned ${a.status}`);return a.json()}).then(a=>{let b=Array.isArray(a)?a.find(a=>"cliproxyapi"===a.tool):null;o(b??null),q(null)}).catch(a=>{console.error("Failed to load version manager status:",a),q("Unable to reach version manager service"),o(null)})},[]);let r=(0,e.useCallback)(async(a,c)=>{if("cliproxyapi_url"===a&&"string"==typeof c&&""!==c.trim()&&!function(a){try{let b=new URL(a);return"http:"===b.protocol||"https:"===b.protocol}catch{return!1}}(c))return void m({type:"error",text:"Invalid URL format. Use http:// or https://"});k(!0),m(null);try{let d=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:c})});if(!d.ok)throw Error(`Server returned ${d.status}`);await d.json(),b(b=>({...b,[a]:c})),m({type:"success",text:"Setting saved"})}catch{m({type:"error",text:"Failed to save setting"})}finally{k(!1)}},[]),s=!0===a.cliproxyapi_fallback_enabled,t=a.cliproxyapi_url||"http://127.0.0.1:8317",u=a.cliproxyapi_fallback_codes||"502,401,403,429,503",v=n?.status==="running"?"text-green-600 dark:text-green-400":n?.status==="error"?"text-red-600 dark:text-red-400":"text-text-muted",w=n?.status==="running"?"check_circle":n?.status==="error"?"error":"help";return(0,d.jsxs)("div",{className:"space-y-4",children:[l&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs ${"success"===l.type?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-red-500/10 text-red-600 dark:text-red-400"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===l.type?"check_circle":"error"}),l.text]}),(0,d.jsxs)(g.Card,{padding:"md",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center bg-indigo-500/10",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-indigo-500 text-xl",children:"swap_horiz"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:"CLIProxyAPI Fallback"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"When enabled, failed requests are retried through CLIProxyAPI (localhost:8317)"})]})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("label",{className:"text-sm text-text-main",children:"Enable CLIProxyAPI Fallback"}),(0,d.jsx)(i.Toggle,{checked:s,onChange:a=>r("cliproxyapi_fallback_enabled",a)})]}),s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1.5 block",children:"CLIProxyAPI URL"}),(0,d.jsx)(h.Input,{value:t,onChange:a=>r("cliproxyapi_url",a.target.value),placeholder:"http://127.0.0.1:8317",className:"w-full"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-text-muted mb-1.5 block",children:"Fallback Status Codes (comma-separated)"}),(0,d.jsx)(h.Input,{value:u,onChange:a=>r("cliproxyapi_fallback_codes",a.target.value),placeholder:"502,401,403,429,503",className:"w-full"})]})]})]})]}),(0,d.jsxs)(g.Card,{padding:"md",children:[(0,d.jsx)("h3",{className:"font-medium text-sm mb-4",children:"CLIProxyAPI Status"}),c?(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),"Loading..."]}):p?(0,d.jsx)("p",{className:"text-sm text-text-muted",children:p}):n?(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg-secondary",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Status"}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-sm ${v}`,children:w}),(0,d.jsx)("p",{className:`text-sm font-medium capitalize ${v}`,children:n.status?.replace("_"," ")||"Unknown"})]})]}),(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg-secondary",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Version"}),(0,d.jsx)("p",{className:"text-sm font-medium",children:n.installedVersion?`v${n.installedVersion}`:"Not installed"})]}),(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg-secondary",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Health"}),(0,d.jsx)("p",{className:`text-sm font-medium ${"healthy"===n.healthStatus?"text-green-600 dark:text-green-400":"unhealthy"===n.healthStatus?"text-red-600 dark:text-red-400":"text-text-muted"}`,children:"healthy"===n.healthStatus?"Healthy":"unhealthy"===n.healthStatus?"Unhealthy":"Unknown"})]}),(0,d.jsxs)("div",{className:"p-3 rounded-lg bg-bg-secondary",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Port"}),(0,d.jsx)("p",{className:"text-sm font-mono",children:n.port||8317})]})]}):(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"CLIProxyAPI not detected"})]})]})}]),c()}catch(a){c(a)}},!1),415242,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(572131),f=a.i(50944),g=a.i(171302),h=a.i(817648),i=a.i(415925),j=a.i(296248),k=a.i(547655),l=a.i(72926),m=a.i(589980),n=a.i(232327),o=a.i(220584),p=a.i(413316),q=a.i(769979),r=a.i(847910),s=a.i(876881),t=a.i(356962),u=a.i(976066),v=a.i(894167),w=a.i(43184),x=a.i(986820),y=a.i(891657),z=b([h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y]);[h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y]=z.then?(await z)():z;let A=[{id:"general",labelKey:"general",icon:"settings"},{id:"appearance",labelKey:"appearance",icon:"palette"},{id:"ai",labelKey:"ai",icon:"smart_toy"},{id:"security",labelKey:"security",icon:"shield"},{id:"routing",labelKey:"routing",icon:"route"},{id:"resilience",labelKey:"resilience",icon:"electrical_services"},{id:"advanced",labelKey:"advanced",icon:"tune"}];a.s(["default",0,function(){let a=(0,i.useTranslations)("settings"),b=(0,f.useSearchParams)().get("tab"),[c,z]=(0,e.useState)(null),B=c||A.find(a=>a.id===b)?.id||"general";return(0,d.jsx)("div",{className:"max-w-6xl mx-auto min-w-0",children:(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)("div",{className:"w-full overflow-x-auto pb-1",children:(0,d.jsx)("div",{role:"tablist","aria-label":a("settingsSectionsAria"),className:"inline-flex items-center p-1 rounded-lg bg-black/5 dark:bg-white/5 min-w-max",children:A.map(b=>(0,d.jsxs)("button",{role:"tab","aria-selected":B===b.id,tabIndex:B===b.id?0:-1,onClick:()=>z(b.id),className:(0,g.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all text-sm",B===b.id?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:b.icon}),(0,d.jsx)("span",{className:"hidden sm:inline whitespace-nowrap",children:a(b.labelKey)})]},b.id))})}),(0,d.jsxs)("div",{role:"tabpanel","aria-label":a(A.find(a=>a.id===B)?.labelKey||"general"),children:["general"===B&&(0,d.jsx)("div",{className:"flex flex-col gap-6",children:(0,d.jsx)(j.default,{})}),"appearance"===B&&(0,d.jsx)("div",{className:"flex flex-col gap-6",children:(0,d.jsx)(o.default,{})}),"ai"===B&&(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(p.default,{}),(0,d.jsx)(q.default,{}),(0,d.jsx)(r.default,{}),(0,d.jsx)(u.default,{}),(0,d.jsx)(v.default,{}),(0,d.jsx)(w.default,{})]}),"security"===B&&(0,d.jsx)(k.default,{}),"routing"===B&&(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(l.default,{}),(0,d.jsx)(m.default,{}),(0,d.jsx)(s.default,{}),(0,d.jsx)(t.default,{})]}),"resilience"===B&&(0,d.jsx)(x.default,{}),"advanced"===B&&(0,d.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,d.jsx)(n.default,{}),(0,d.jsx)(y.default,{})]})]}),(0,d.jsxs)("div",{className:"text-center text-sm text-text-muted py-4",children:[(0,d.jsxs)("p",{children:[h.APP_CONFIG.name," v",h.APP_CONFIG.version]}),(0,d.jsx)("p",{className:"mt-1",children:a("localMode")})]})]})})}]),c()}catch(a){c(a)}},!1)];
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=src_app_%28dashboard%
|
|
3
|
+
//# sourceMappingURL=src_app_%28dashboard%29_dashboard_settings_09gq48u._.js.map
|