@kaitranntt/ccs 7.67.0-dev.7 → 7.67.0-dev.8
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/dist/commands/api-command/create-command.d.ts +3 -0
- package/dist/commands/api-command/create-command.d.ts.map +1 -1
- package/dist/commands/api-command/create-command.js +20 -6
- package/dist/commands/api-command/create-command.js.map +1 -1
- package/dist/commands/api-command/help.d.ts.map +1 -1
- package/dist/commands/api-command/help.js +1 -0
- package/dist/commands/api-command/help.js.map +1 -1
- package/dist/shared/provider-preset-catalog.d.ts +3 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +16 -0
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/ui/assets/{accounts-CD6xqLf4.js → accounts-CuZSmwoY.js} +1 -1
- package/dist/ui/assets/{alert-dialog-Cq0uMwyf.js → alert-dialog-CwZd7q-U.js} +1 -1
- package/dist/ui/assets/{api-DYb7nMX1.js → api-P8GrkzAd.js} +1 -1
- package/dist/ui/assets/{auth-section-B8ptHr9t.js → auth-section-C6AxJpFM.js} +1 -1
- package/dist/ui/assets/{backups-section-m6vX118k.js → backups-section-DQYzN9nM.js} +1 -1
- package/dist/ui/assets/{channels-CXmV9gwU.js → channels-CvkF3ixl.js} +1 -1
- package/dist/ui/assets/{checkbox-dGCgZTKA.js → checkbox-ChRPYz6o.js} +1 -1
- package/dist/ui/assets/{claude-extension-TiOTnDTd.js → claude-extension-B2yI8coF.js} +1 -1
- package/dist/ui/assets/{cliproxy-EF7iEy5S.js → cliproxy-Dwoxts2F.js} +1 -1
- package/dist/ui/assets/{cliproxy-ai-providers-BK0savIX.js → cliproxy-ai-providers-Dz085Bac.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-DAoeSaoD.js → cliproxy-control-panel-mClVmxpM.js} +1 -1
- package/dist/ui/assets/{codex-B1reJvsl.js → codex-CJrMN9io.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-C-kGSty5.js → confirm-dialog-BMJQu6Hu.js} +1 -1
- package/dist/ui/assets/{copilot-CA9P3Gsd.js → copilot-BX0hVo59.js} +1 -1
- package/dist/ui/assets/{cursor-BaX25jJK.js → cursor-DAJcvPdv.js} +1 -1
- package/dist/ui/assets/{droid-zythBAEB.js → droid-CA_2Peaq.js} +1 -1
- package/dist/ui/assets/{globalenv-section-Cwav5LU1.js → globalenv-section-mQ8oT-0M.js} +1 -1
- package/dist/ui/assets/{health-B_CZll49.js → health-lx89H6Rl.js} +1 -1
- package/dist/ui/assets/{index-BwpceYga.js → index-CKq4TwgW.js} +1 -1
- package/dist/ui/assets/{index-BsbzlZcs.js → index-Dn69laT4.js} +1 -1
- package/dist/ui/assets/{index-ChCDerjX.js → index-Dpuz53pn.js} +1 -1
- package/dist/ui/assets/{index-BDlLr4t5.js → index-H4svmUfJ.js} +3 -3
- package/dist/ui/assets/{index-D6eRghE-.js → index-QCr5xkSP.js} +1 -1
- package/dist/ui/assets/{index-COgxkmyB.js → index-cOly4ImO.js} +1 -1
- package/dist/ui/assets/{logs-Bn5qH5av.js → logs-BErGEMlx.js} +1 -1
- package/dist/ui/assets/{masked-input-BAcMJrej.js → masked-input-B0AstfgK.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-BzhhtHaF.js → proxy-status-widget-CkqQfqJb.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-q7Z0GFci.js → raw-json-settings-editor-panel-BNm6M6JZ.js} +1 -1
- package/dist/ui/assets/{searchable-select-D2J-XoN0.js → searchable-select-DYPxGmT4.js} +1 -1
- package/dist/ui/assets/{separator-4bzMuArh.js → separator-D7w-Kq8L.js} +1 -1
- package/dist/ui/assets/{shared-DMT_Fh95.js → shared-BxYo83z7.js} +1 -1
- package/dist/ui/assets/{table-CyRavMCY.js → table-CLJkW20o.js} +1 -1
- package/dist/ui/assets/{updates-D6XV9cJj.js → updates-CFHqIfIV.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dpuz53pn.js","assets/radix-ui-Zb8sVEtn.js","assets/react-vendor-CNOkPC89.js","assets/masked-input-B0AstfgK.js","assets/icons-KVCk4_U8.js","assets/tanstack-CrmUhA7Z.js","assets/notifications-B2HqRBj7.js","assets/utils-CzKF5WmX.js","assets/form-utils-Bcoyqxpq.js","assets/code-highlight-BRUf_pqB.js","assets/index-cOly4ImO.js","assets/channels-CvkF3ixl.js","assets/globalenv-section-mQ8oT-0M.js","assets/index-CKq4TwgW.js","assets/index-QCr5xkSP.js","assets/default-ports-1QQSffYX.js","assets/proxy-status-widget-CkqQfqJb.js","assets/alert-dialog-CwZd7q-U.js","assets/antigravity-responsibility-constants-Bvh4Ybz0.js","assets/auth-section-C6AxJpFM.js","assets/backups-section-DQYzN9nM.js","assets/index-Dn69laT4.js","assets/charts-BBPXh0Ar.js","assets/api-P8GrkzAd.js","assets/confirm-dialog-BMJQu6Hu.js","assets/cliproxy-Dwoxts2F.js","assets/checkbox-ChRPYz6o.js","assets/separator-D7w-Kq8L.js","assets/searchable-select-DYPxGmT4.js","assets/cliproxy-ai-providers-Dz085Bac.js","assets/cliproxy-control-panel-mClVmxpM.js","assets/copilot-BX0hVo59.js","assets/cursor-DAJcvPdv.js","assets/claude-extension-B2yI8coF.js","assets/codex-CJrMN9io.js","assets/table-CLJkW20o.js","assets/raw-json-settings-editor-panel-BNm6M6JZ.js","assets/droid-CA_2Peaq.js","assets/logs-BErGEMlx.js","assets/accounts-CuZSmwoY.js","assets/health-lx89H6Rl.js","assets/shared-BxYo83z7.js","assets/updates-CFHqIfIV.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{j as l,S as Ml,R as fx,C as hx,a as mx,T as px,D as gx,P as yx,O as xx,b as UC,c as HC,d as BC,e as KC,f as qC,A as FC,g as GC,h as VC,i as YC,k as $C,l as WC,m as QC,n as XC,I as ZC,o as bx,p as JC,q as vx,r as Cx,s as eS,t as Sx,V as tS,L as wx,u as Nx,v as nS,w as aS,x as kx,y as iS,z as oS,B as Ax,E as sS,F as rS,G as Dx,H as lS,J as Tx,K as jx,M as Mx,N as cS,Q as uS,U as dS,W as fS,X as hS,Y as Ex,Z as mS,_ as pS,$ as gS}from"./radix-ui-Zb8sVEtn.js";import{e as Zd,f as yS,r as C,u as El,O as Od,N as xS,h as Jd,L as Cl,R as bS,g as Ox,d as zg,i as vS,c as ce,B as CS,j as SS,k as Nt}from"./react-vendor-CNOkPC89.js";import{Q as wS,u as kt,a as rt,b as st,c as NS,d as kS}from"./tanstack-CrmUhA7Z.js";import{t as le,T as AS}from"./notifications-B2HqRBj7.js";import{L as kn,X as Ao,P as DS,C as Ol,H as TS,a as jS,K as Pd,G as MS,Z as Px,b as Lx,F as Rx,U as _x,c as ES,S as OS,A as Us,d as zx,e as PS,f as Ix,M as Ux,E as Vs,g as Ys,B as LS,R as Hs,W as RS,h as _S,i as zS,j as IS,k as Ig,l as Ug,m as wo,n as ef,o as Sl,p as Hx,q as Bx,r as US,s as Pl,t as tf,u as Kx,v as No,T as Gn,w as Bs,x as $s,y as Hg,z as HS,D as qx,I as nf,J as BS,N as Ll,O as KS,Q as qS,V as FS,Y as GS,_ as Rl,$ as VS,a0 as YS,a1 as Fx,a2 as $S,a3 as WS,a4 as QS,a5 as XS,a6 as ZS,a7 as af,a8 as Gx,a9 as Bg,aa as JS,ab as ew,ac as tw,ad as nw,ae as aw,af as Kg,ag as iw,ah as dl,ai as qg,aj as Fg,ak as ow}from"./icons-KVCk4_U8.js";import{t as sw,c as rw,a as _l,e as ws,f as Ds,b as lw,d as cw,g as uw,h as dw,i as fw,j as hw,k as mw,l as pw,m as gw,n as yw,o as xw,p as bw,q as vw,r as Cw,s as Sw,u as ww,v as Nw,w as kw,x as Aw,y as Dw,z as Tw,A as jw,B as Mw,C as Ew,D as Ow,E as Pw,F as Lw,G as Rw,H as _w,I as zw,J as Iw}from"./utils-CzKF5WmX.js";import{o as Gg,s as Vg,p as Uw,a as Hw,$ as Bw,b as Vx,c as Za,d as Kw,_ as qw,u as Fw,e as Yg}from"./form-utils-Bcoyqxpq.js";import{H as Gw,t as $g}from"./code-highlight-BRUf_pqB.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();var ld={exports:{}},Ns={},cd={exports:{}},ud={};var Wg;function Vw(){return Wg||(Wg=1,(function(n){function a(U,Z){var ne=U.length;U.push(Z);e:for(;0<ne;){var $=ne-1>>>1,oe=U[$];if(0<c(oe,Z))U[$]=Z,U[ne]=oe,ne=$;else break e}}function o(U){return U.length===0?null:U[0]}function r(U){if(U.length===0)return null;var Z=U[0],ne=U.pop();if(ne!==Z){U[0]=ne;e:for(var $=0,oe=U.length,ue=oe>>>1;$<ue;){var he=2*($+1)-1,X=U[he],ae=he+1,de=U[ae];if(0>c(X,ne))ae<oe&&0>c(de,X)?(U[$]=de,U[ae]=ne,$=ae):(U[$]=X,U[he]=ne,$=he);else if(ae<oe&&0>c(de,ne))U[$]=de,U[ae]=ne,$=ae;else break e}}return Z}function c(U,Z){var ne=U.sortIndex-Z.sortIndex;return ne!==0?ne:U.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var f=Date,m=f.now();n.unstable_now=function(){return f.now()-m}}var p=[],y=[],S=1,x=null,b=3,j=!1,N=!1,E=!1,L=!1,O=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function k(U){for(var Z=o(y);Z!==null;){if(Z.callback===null)r(y);else if(Z.startTime<=U)r(y),Z.sortIndex=Z.expirationTime,a(p,Z);else break;Z=o(y)}}function T(U){if(E=!1,k(U),!N)if(o(p)!==null)N=!0,w||(w=!0,Q());else{var Z=o(y);Z!==null&&ve(T,Z.startTime-U)}}var w=!1,R=-1,I=5,z=-1;function F(){return L?!0:!(n.unstable_now()-z<I)}function ee(){if(L=!1,w){var U=n.unstable_now();z=U;var Z=!0;try{e:{N=!1,E&&(E=!1,D(R),R=-1),j=!0;var ne=b;try{t:{for(k(U),x=o(p);x!==null&&!(x.expirationTime>U&&F());){var $=x.callback;if(typeof $=="function"){x.callback=null,b=x.priorityLevel;var oe=$(x.expirationTime<=U);if(U=n.unstable_now(),typeof oe=="function"){x.callback=oe,k(U),Z=!0;break t}x===o(p)&&r(p),k(U)}else r(p);x=o(p)}if(x!==null)Z=!0;else{var ue=o(y);ue!==null&&ve(T,ue.startTime-U),Z=!1}}break e}finally{x=null,b=ne,j=!1}Z=void 0}}finally{Z?Q():w=!1}}}var Q;if(typeof A=="function")Q=function(){A(ee)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,te=ge.port2;ge.port1.onmessage=ee,Q=function(){te.postMessage(null)}}else Q=function(){O(ee,0)};function ve(U,Z){R=O(function(){U(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(U){U.callback=null},n.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<U?Math.floor(1e3/U):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(U){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var ne=b;b=Z;try{return U()}finally{b=ne}},n.unstable_requestPaint=function(){L=!0},n.unstable_runWithPriority=function(U,Z){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var ne=b;b=U;try{return Z()}finally{b=ne}},n.unstable_scheduleCallback=function(U,Z,ne){var $=n.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?$+ne:$):ne=$,U){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=ne+oe,U={id:S++,callback:Z,priorityLevel:U,startTime:ne,expirationTime:oe,sortIndex:-1},ne>$?(U.sortIndex=ne,a(y,U),o(p)===null&&U===o(y)&&(E?(D(R),R=-1):E=!0,ve(T,ne-$))):(U.sortIndex=oe,a(p,U),N||j||(N=!0,w||(w=!0,Q()))),U},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(U){var Z=b;return function(){var ne=b;b=Z;try{return U.apply(this,arguments)}finally{b=ne}}}})(ud)),ud}var Qg;function Yw(){return Qg||(Qg=1,cd.exports=Vw()),cd.exports}var Xg;function $w(){if(Xg)return Ns;Xg=1;var n=Yw(),a=Zd(),o=yS();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(d(e)!==e)throw Error(r(188))}function y(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(r(188));return t!==e?null:e}for(var i=e,s=t;;){var u=i.return;if(u===null)break;var h=u.alternate;if(h===null){if(s=u.return,s!==null){i=s;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===i)return p(u),e;if(h===s)return p(u),t;h=h.sibling}throw Error(r(188))}if(i.return!==s.return)i=u,s=h;else{for(var g=!1,v=u.child;v;){if(v===i){g=!0,i=u,s=h;break}if(v===s){g=!0,s=u,i=h;break}v=v.sibling}if(!g){for(v=h.child;v;){if(v===i){g=!0,i=h,s=u;break}if(v===s){g=!0,s=h,i=u;break}v=v.sibling}if(!g)throw Error(r(189))}}if(i.alternate!==s)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,b=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),A=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=ee&&e[ee]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Symbol.for("react.client.reference");function te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case O:return"Profiler";case L:return"StrictMode";case T:return"Suspense";case w:return"SuspenseList";case z:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case A:return e.displayName||"Context";case D:return(e._context.displayName||"Context")+".Consumer";case k:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case R:return t=e.displayName||null,t!==null?t:te(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ve=Array.isArray,U=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},$=[],oe=-1;function ue(e){return{current:e}}function he(e){0>oe||(e.current=$[oe],$[oe]=null,oe--)}function X(e,t){oe++,$[oe]=e.current,e.current=t}var ae=ue(null),de=ue(null),ie=ue(null),re=ue(null);function ye(e,t){switch(X(ie,t),X(de,e),X(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?sg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=sg(t),e=rg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}he(ae),X(ae,e)}function De(){he(ae),he(de),he(ie)}function ze(e){e.memoizedState!==null&&X(re,e);var t=ae.current,i=rg(t,e.type);t!==i&&(X(de,e),X(ae,i))}function Xe(e){de.current===e&&(he(ae),he(de)),re.current===e&&(he(re),bs._currentValue=ne)}var ke,Oe;function Ge(e){if(ke===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);ke=t&&t[1]||"",Oe=-1<i.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+ke+e+Oe}var Dt=!1;function Ot(e,t){if(!e||Dt)return"";Dt=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(G){var q=G}Reflect.construct(e,[],W)}else{try{W.call()}catch(G){q=G}e.call(W.prototype)}}else{try{throw Error()}catch(G){q=G}(W=e())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(G){if(G&&q&&typeof G.stack=="string")return[G.stack,q.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=s.DetermineComponentFrameRoot(),g=h[0],v=h[1];if(g&&v){var M=g.split(`
|
|
@@ -11,7 +11,7 @@ Error generating stack: `+s.message+`
|
|
|
11
11
|
`);for(const r of o){const[c,...d]=r.split(":"),f=d.join(":").trim();switch(c?.trim()?.toLowerCase()){case"version":a.version=f;break;case"url":a.url=f;break;case"method":a.method=f;break;case"timestamp":a.timestamp=f;break}}}function JD(n){const a={},o=n.split(`
|
|
12
12
|
`);for(const r of o){const c=r.indexOf(":");if(c>0){const d=r.slice(0,c).trim(),f=r.slice(c+1).trim();d&&(a[d]=f)}}return a}function eT(n,a){const o=n.split(`
|
|
13
13
|
`);let r=!1;const c=[];for(const d of o){if(d.startsWith("Status:")){const m=d.replace("Status:","").trim().split(/\s+/);a.statusCode=parseInt(m[0],10)||0,a.statusText=m.slice(1).join(" ")||iT(a.statusCode);continue}if(d.trim()===""&&!r){r=!0;continue}if(r)c.push(d);else{const f=d.indexOf(":");if(f>0){const m=d.slice(0,f).trim(),p=d.slice(f+1).trim();m&&(a.responseHeaders[m]=p)}}}a.responseBody=c.join(`
|
|
14
|
-
`).trim()}function tT(n){const a=n.url.match(/\/api\/provider\/([^/]+)/);a&&(n.provider=a[1]);const o=n.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);o&&(n.endpoint=o[1]),n.isClientError=n.statusCode>=400&&n.statusCode<500,n.isServerError=n.statusCode>=500,n.statusCode===429?n.errorType="rate_limit":n.statusCode===401||n.statusCode===403?n.errorType="auth":n.statusCode===404?n.errorType="not_found":n.statusCode>=500?n.errorType="server":(n.statusCode===408||n.statusCode===504)&&(n.errorType="timeout"),nT(n),n.statusCode===429&&aT(n)}function nT(n){if(n.requestBody)try{const a=JSON.parse(n.requestBody);typeof a.model=="string"&&(n.model=a.model)}catch{}}function aT(n){if(n.responseBody)try{const a=JSON.parse(n.responseBody),o=Gd(a);o!==null&&(n.quotaResetDelay=o);const r=Vd(a);r&&(n.quotaResetTimestamp=r)}catch{}}function Gd(n){if(typeof n!="object"||n===null)return null;const a=n;if("quotaResetDelay"in a){const o=a.quotaResetDelay;if(typeof o=="number")return o;if(typeof o=="string"){const r=o.match(/^(\d+)s?$/);if(r)return parseInt(r[1],10)}}if("error"in a&&typeof a.error=="object"){const o=Gd(a.error);if(o!==null)return o}if("details"in a&&Array.isArray(a.details))for(const o of a.details){const r=Gd(o);if(r!==null)return r}return null}function Vd(n){if(typeof n!="object"||n===null)return null;const a=n;for(const o of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(o in a&&typeof a[o]=="string")return a[o];if("error"in a&&typeof a.error=="object"){const o=Vd(a.error);if(o)return o}if("details"in a&&Array.isArray(a.details))for(const o of a.details){const r=Vd(o);if(r)return r}return null}function iT(n){return{400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",408:"Request Timeout",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[n]||""}function oT(n,a){const o=of(),r=o==="zh-CN",c=o==="vi",d=Date.now(),f=n*1e3,m=d-f,p=Math.floor(m/1e3),y=Math.floor(p/60),S=Math.floor(y/60),x=Math.floor(S/24);return p<60?r?"刚刚":c?"vừa xong":"just now":y<60?r?`${y} 分钟前`:c?`${y} phút trước`:`${y}m ago`:S<24?r?`${S} 小时前`:c?`${S} giờ trước`:`${S}h ago`:x<7?r?`${x} 天前`:c?`${x} ngày trước`:`${x}d ago`:new Date(f).toLocaleDateString(o,{month:"short",day:"numeric"})}function sT(n){return n>=500?"text-red-500":n===429?"text-orange-500":n>=400?"text-yellow-500":"text-gray-500"}function rT(n,a){const o=of();return o==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[n]||"错误":o==="vi"?{rate_limit:"Quá giới hạn",auth:"Lỗi xác thực",not_found:"Không tìm thấy",server:"Lỗi máy chủ",timeout:"Hết thời gian chờ",unknown:"Lỗi"}[n]||"Lỗi":{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[n]||"Error"}function lT(n){if(n===null||n<=0)return null;if(n<60)return`${n}s`;if(n<3600)return`${Math.floor(n/60)}m`;const a=Math.floor(n/3600),o=Math.floor(n%3600/60);return o>0?`${a}h ${o}m`:`${a}h`}function cT(n,a){if(!n)return null;const o=of(),r=o==="zh-CN",c=o==="vi";try{const d=new Date(n),f=new Date,m=d.getTime()-f.getTime();if(m<=0)return r?"现在":c?"bây giờ":"now";const p=Math.floor(m/1e3);if(p<60)return r?`${p}秒`:c?`${p} giây`:`${p}s`;if(p<3600){const x=Math.floor(p/60);return r?`${x}分钟`:c?`${x} phút`:`${x}m`}const y=Math.floor(p/3600),S=Math.floor(p%3600/60);return r?S>0?`${y}小时 ${S}分钟`:`${y}小时`:c?S>0?`${y} giờ ${S} phút`:`${y} giờ`:S>0?`${y}h ${S}m`:`${y}h`}catch{return null}}function uT(n){return n?n===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":n>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":n>=400?"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":"bg-gray-100 text-gray-600":"bg-gray-100 text-gray-600"}function dT(n){return n||""}function fT({name:n,size:a,modified:o,isSelected:r,onClick:c,statusCode:d,model:f}){const m=C.useMemo(()=>QD(n),[n]),p=C.useMemo(()=>dT(f),[f]);return l.jsxs("button",{onClick:c,className:K("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",r?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[l.jsx("span",{className:K("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",uT(d)),children:d||"???"}),l.jsx(Df,{provider:m.provider,size:18,withBackground:!0,className:"shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:m.endpoint||"unknown"}),p&&l.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:p,children:p}),l.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[l.jsx(No,{className:"w-2.5 h-2.5"}),l.jsx("span",{children:oT(o)})]})]})]})}function Uy({value:n,className:a,variant:o="outline",size:r="icon",label:c="Copy to clipboard"}){const[d,f]=C.useState(!1),m=()=>{navigator.clipboard.writeText(n),f(!0),setTimeout(()=>f(!1),2e3)};return l.jsx(ji,{children:l.jsxs(Sa,{children:[l.jsx(wa,{asChild:!0,children:l.jsxs(ot,{size:r,variant:o,className:K("relative z-10 text-muted-foreground hover:text-foreground",a),onClick:p=>{p.stopPropagation(),m()},children:[d?l.jsx(wo,{className:"h-3.5 w-3.5 text-green-500"}):l.jsx(Sl,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:c})]})}),l.jsx(Na,{children:l.jsx("p",{children:d?"Copied!":c})})]})})}function As({active:n,onClick:a,children:o,icon:r}){return l.jsxs("button",{onClick:a,className:K("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",n?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[r&&l.jsx(r,{className:"w-3.5 h-3.5"}),o]})}function Kb({code:n}){const a=sT(n);return l.jsx("span",{className:K("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",a),children:n})}function hT({parsed:n}){const{t:a}=Et(),o=lT(n.quotaResetDelay)||cT(n.quotaResetTimestamp),r=a("errorLogs.na");return l.jsx(Do,{className:"h-full",children:l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Kb,{code:n.statusCode}),l.jsx("span",{className:"text-sm font-medium",children:n.statusText}),l.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:rT(n.errorType)})]}),n.model&&l.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[l.jsx(GS,{className:"w-4 h-4 text-violet-500 shrink-0"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.modelLabel")}),l.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:n.model})]})]}),n.errorType==="rate_limit"&&o&&l.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[l.jsx(No,{className:"w-4 h-4 text-amber-500 shrink-0"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.quotaResetsIn")}),l.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:o})]})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.method")}),l.jsx("div",{className:"font-medium",children:n.method||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.provider")}),l.jsx("div",{className:"font-medium",children:n.provider||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.version")}),l.jsx("div",{className:"font-medium",children:n.version||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.endpoint")}),l.jsx("div",{className:"font-medium truncate",title:n.endpoint,children:n.endpoint||r})]})]}),l.jsxs("div",{className:"text-xs",children:[l.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.url")}),l.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:n.url||r})]}),l.jsxs("div",{className:"text-xs",children:[l.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.timestamp")}),l.jsx("div",{className:"font-mono",children:n.timestamp||r})]}),n.errorType!=="unknown"&&l.jsxs("div",{className:K("flex items-start gap-3 p-3 rounded text-xs",n.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":n.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[n.errorType==="rate_limit"?l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):n.errorType==="auth"?l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):l.jsx(Rl,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),l.jsxs("div",{className:K("leading-relaxed",n.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":n.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[n.errorType==="rate_limit"&&(n.model?a("errorLogs.rateLimitedMsg",{model:n.model}):a("errorLogs.rateLimitedMsgNoModel")),n.errorType==="auth"&&a("errorLogs.authFailedMsg"),n.errorType==="not_found"&&a("errorLogs.notFoundMsg"),n.errorType==="server"&&a("errorLogs.serverErrorMsg"),n.errorType==="timeout"&&a("errorLogs.timeoutMsg")]})]})]})})}function mT({headers:n}){const a=Object.entries(n);return a.length===0?l.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):l.jsx(Do,{className:"h-full",children:l.jsx("div",{className:"p-4 space-y-1",children:a.map(([o,r])=>l.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[l.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[o,":"]}),l.jsx("span",{className:"break-all",children:r})]},o))})})}function Hy({content:n,label:a}){const{t:o}=Et();if(!n||n.trim()===""){const d=a==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return l.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:o(d)})}let r=n,c=!1;try{const d=JSON.parse(n);r=JSON.stringify(d,null,2),c=!0}catch{}return l.jsx(Do,{className:"h-full",children:l.jsx("pre",{className:K("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",c?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:r})})}function pT({content:n}){return l.jsx(Do,{className:"h-full",children:l.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:n})})}function gT({name:n,absolutePath:a}){const{t:o}=Et(),[r,c]=C.useState("overview"),{data:d,isLoading:f,error:m}=F1(n),p=C.useMemo(()=>d?XD(d):null,[d]);return n?f?l.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[l.jsx(We,{className:"h-5 w-full"}),l.jsx(We,{className:"h-5 w-3/4"}),l.jsx(We,{className:"h-5 w-5/6"}),l.jsx(We,{className:"h-5 w-2/3"})]}):m||!d||!p?l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsx("p",{className:"text-sm",children:o("errorLogs.failedLoadContent")})}):l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l.jsx(Kb,{code:p.statusCode}),l.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[p.provider,"/",p.endpoint||"unknown"]}),n&&l.jsx(Uy,{value:a||n,label:o("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&l.jsx(Uy,{value:d,label:o("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:p.method})]})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-1 bg-muted/10 shrink-0 overflow-x-auto",children:[l.jsx(As,{active:r==="overview",onClick:()=>c("overview"),icon:Rl,children:o("errorLogs.tabOverview")}),l.jsx(As,{active:r==="headers",onClick:()=>c("headers"),icon:YS,children:o("errorLogs.tabHeaders")}),l.jsx(As,{active:r==="request",onClick:()=>c("request"),icon:Fx,children:o("errorLogs.tabRequest")}),l.jsx(As,{active:r==="response",onClick:()=>c("response"),icon:$S,children:o("errorLogs.tabResponse")}),l.jsx(As,{active:r==="raw",onClick:()=>c("raw"),icon:WS,children:o("errorLogs.tabRaw")})]}),l.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[r==="overview"&&l.jsx(hT,{parsed:p}),r==="headers"&&l.jsx(mT,{headers:p.requestHeaders}),r==="request"&&l.jsx(Hy,{content:p.requestBody,label:"Request"}),r==="response"&&l.jsx(Hy,{content:p.responseBody,label:"Response"}),r==="raw"&&l.jsx(pT,{content:d})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsxs("div",{className:"text-center space-y-3",children:[l.jsx(VS,{className:"w-10 h-10 mx-auto opacity-40"}),l.jsx("p",{className:"text-sm",children:o("errorLogs.selectLog")})]})})}function yT(){const{t:n}=Et(),{data:a,isLoading:o}=U1(),{data:r,isLoading:c,error:d}=q1(a?.running??!1),[f,m]=C.useState(500),[p,y]=C.useState(!1),S=C.useRef(null),x=C.useRef(null),b=()=>{x.current&&(clearInterval(x.current),x.current=null)};C.useEffect(()=>{if(!p)return;const k=w=>{const R=S.current;if(!R)return;const z=R.getBoundingClientRect().top+window.scrollY,F=w.pageY-z;m(Math.max(300,F));const Q=window.innerHeight-w.clientY,ge=15;b(),Q<50?x.current=setInterval(()=>{window.scrollBy(0,ge)},16):w.clientY<50&&(x.current=setInterval(()=>{window.scrollBy(0,-ge)},16))},T=()=>{y(!1),b(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",k),document.addEventListener("mouseup",T),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",T),document.body.style.cursor="default",document.body.style.userSelect="auto",b()}},[p]);const j=k=>{k.preventDefault(),y(!0)},N=C.useMemo(()=>r?.[0]?.name??null,[r]),[E,L]=C.useState(null),O=E??N,D=C.useMemo(()=>!O||!r?void 0:r.find(T=>T.name===O)?.absolutePath,[O,r]);if(o||!a?.running)return null;if(c)return l.jsxs("div",{className:"rounded-xl border border-border overflow-hidden font-mono text-sm bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm h-[500px]",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[l.jsx(We,{className:"h-4 w-32"}),l.jsx(We,{className:"h-4 w-20"})]}),l.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(k=>l.jsx(We,{className:"h-12 w-full rounded-lg"},k))})]});if(!r||r.length===0)return null;const A=r.length;return l.jsxs("div",{ref:S,className:"rounded-xl border border-border overflow-hidden font-mono text-sm text-foreground bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm flex flex-col shadow-sm transition-[height] duration-0 ease-linear relative group/container",style:{height:f},children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-amber-500/10 via-transparent to-transparent dark:from-amber-500/15 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(Gn,{className:"w-4 h-4 text-amber-500"}),l.jsx("span",{className:"text-sm font-semibold tracking-tight",children:n("errorLogs.title")}),l.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:n("errorLogs.failedRequests",{count:A})})]}),l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l.jsx(QS,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:n("errorLogs.cliproxyDiagnostics")})]})]}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsxs(Ef,{direction:"horizontal",children:[l.jsx(qs,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:l.jsxs(Do,{className:"h-full",children:[l.jsx("div",{className:"divide-y divide-border/50",children:r.slice(0,50).map(k=>l.jsx(fT,{name:k.name,size:k.size,modified:k.modified,isSelected:O===k.name,onClick:()=>L(k.name),statusCode:k.statusCode,model:k.model},k.name))}),r.length>50&&l.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:n("errorLogs.showingCount",{total:r.length})})]})}),l.jsxs(Of,{className:"w-[1px] bg-border hover:bg-primary/50 transition-colors flex items-center justify-center group relative z-10 w-2 -ml-1 flex items-center justify-center outline-none",children:[l.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),l.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-4 h-8 rounded-sm flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-muted border border-border",children:l.jsx(Ll,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsx(qs,{className:"flex flex-col min-w-0 bg-background/50",children:l.jsx(gT,{name:O,absolutePath:D})})]})}),d?l.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:d.message}):l.jsx("div",{className:"h-2 bg-border/10 border-t border-border/30 hover:bg-primary/10 transition-colors cursor-row-resize flex items-center justify-center group/handle shrink-0",onMouseDown:j,children:l.jsx(XS,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const xT=_l("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",warning:"border-yellow-200 bg-yellow-50 text-yellow-900 dark:border-yellow-900/50 dark:bg-yellow-900/20 dark:text-yellow-200 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-500",info:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-200 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-500",success:"border-green-200 bg-green-50 text-green-900 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-200 [&>svg]:text-green-600 dark:[&>svg]:text-green-500"}},defaultVariants:{variant:"default"}}),zs=C.forwardRef(({className:n,variant:a,...o},r)=>l.jsx("div",{ref:r,role:"alert",className:K(xT({variant:a}),n),...o}));zs.displayName="Alert";const Tl=C.forwardRef(({className:n,...a},o)=>l.jsx("h5",{ref:o,className:K("mb-1 font-medium leading-none tracking-tight",n),...a}));Tl.displayName="AlertTitle";const Is=C.forwardRef(({className:n,...a},o)=>l.jsx("div",{ref:o,className:K("text-sm [&_p]:leading-relaxed",n),...a}));Is.displayName="AlertDescription";function bT(){return kt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function qb(n,a){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="string"?n.error:a}function Fb(n){const a=n.trim();if(!a)return null;try{return JSON.parse(a)}catch{return null}}function vT(n){const a=n.trim().toLowerCase();return a.startsWith("<!doctype html")||a.startsWith("<html")}function CT(n){if(!n||typeof n!="object")return!1;const a=n;return!(typeof a.content!="string"||"contentPath"in a&&typeof a.contentPath!="string")}async function Gb(n,a){const o=await n.text(),r=Fb(o);if(!n.ok){const c=qb(r,a);throw new Error(c)}if(r===null)throw new Error(a);return r}function ST(){return kt({queryKey:["shared","summary"],queryFn:async()=>{const n=await fetch("/api/shared/summary");return Gb(n,"Failed to fetch shared summary")}})}function WO(n){return kt({queryKey:["shared",n],queryFn:async()=>{const a=await fetch(`/api/shared/${n}`);return Gb(a,`Failed to fetch shared ${n}`)}})}function QO(n,a){return kt({queryKey:["shared",n,"content",a],enabled:typeof a=="string"&&a.length>0,queryFn:async()=>{if(!a)throw new Error("Missing shared item path");const o=new URLSearchParams({type:n,path:a}),r=await fetch(`/api/shared/content?${o.toString()}`),c=await r.text(),d=Fb(c);if(!r.ok)throw new Error(qb(d,`Failed to fetch shared ${n} content`));if(CT(d))return{content:d.content,contentPath:typeof d.contentPath=="string"&&d.contentPath.length>0?d.contentPath:a};if(c.trim().length>0){if(vT(c))throw new Error("Shared content endpoint unavailable. Restart `ccs config` and try again.");return{content:c,contentPath:a}}throw new Error(`Failed to fetch shared ${n} content`)}})}const wT={ok:"success",warning:"warning",error:"error"},NT={default:{iconBg:"bg-muted",iconColor:"text-muted-foreground"},success:{iconBg:"bg-green-600/15",iconColor:"text-green-700 dark:text-green-500"},warning:{iconBg:"bg-amber-500/15",iconColor:"text-amber-700 dark:text-amber-400"},error:{iconBg:"bg-red-600/15",iconColor:"text-red-700 dark:text-red-500"},accent:{iconBg:"bg-accent/15",iconColor:"text-accent"}};function gl({title:n,value:a,icon:o,variant:r="default",onClick:c}){const d=NT[r];return l.jsxs("button",{onClick:c,className:K("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[l.jsx("div",{className:K("flex items-center justify-center w-9 h-9 rounded-md",d.iconBg),children:l.jsx(o,{className:K("w-4 h-4",d.iconColor)})}),l.jsxs("div",{className:"text-left",children:[l.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:n}),l.jsx("p",{className:K("text-lg font-bold font-mono leading-tight",d.iconColor),children:a})]})]})}function kT(){const{t:n}=Et(),a=Jd(),{data:o,isLoading:r}=bT(),{data:c,isLoading:d}=ST();if(r||d)return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(We,{className:"h-12 w-12 rounded-lg"}),l.jsxs("div",{children:[l.jsx(We,{className:"h-7 w-[180px] mb-2"}),l.jsx(We,{className:"h-4 w-[220px]"})]})]}),l.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(m=>l.jsx(We,{className:"h-14 w-28 rounded-lg"},m))})]}),l.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[l.jsx(We,{className:"h-4 w-32"}),l.jsx(We,{className:"h-4 w-20"})]}),l.jsx("div",{className:"px-4 py-3 border-b",children:l.jsx(We,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(m=>l.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[l.jsx(We,{className:"w-2.5 h-2.5 rounded-full"}),l.jsx(We,{className:"h-4 flex-1"}),l.jsx(We,{className:"h-1.5 w-24 rounded-full"}),l.jsx(We,{className:"h-4 w-16"})]},m))]})]});const f=o?.health?wT[o.health.status]:void 0;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[l.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:l.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),l.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[l.jsx(l1,{version:o?.version}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsx(gl,{title:n("home.profiles"),value:o?.profiles??0,icon:Pd,variant:"accent",onClick:()=>a("/providers")}),l.jsx(gl,{title:n("home.cliproxy"),value:o?.cliproxy??0,icon:Px,variant:"accent",onClick:()=>a("/cliproxy")}),l.jsx(gl,{title:n("home.accounts"),value:o?.accounts??0,icon:_x,variant:"default",onClick:()=>a("/accounts")}),l.jsx(gl,{title:n("home.health"),value:o?.health?`${o.health.passed}/${o.health.total}`:"-",icon:Us,variant:f,onClick:()=>a("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&l.jsxs(zs,{variant:"warning",children:[l.jsx(Gn,{className:"h-4 w-4"}),l.jsx(Tl,{children:n("home.configurationRequired")}),l.jsx(Is,{children:c.symlinkStatus.message})]}),l.jsx(CD,{}),l.jsx("div",{className:"rounded-xl border bg-card/70 p-5",children:l.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"rounded-xl bg-muted p-2.5",children:l.jsx(zx,{className:"h-5 w-5 text-muted-foreground"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("h2",{className:"text-lg font-semibold",children:"Logs moved to a dedicated workspace"}),l.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:"Use the unified logs page for source-level filtering, structured entry inspection, and retention policy edits without crowding the home dashboard."})]})]}),l.jsxs(ot,{variant:"outline",className:"gap-2",onClick:()=>a("/logs"),children:["Open logs",l.jsx(ZS,{className:"h-4 w-4"})]})]})}),l.jsx(yT,{})]})}const Vb=cS,Pf=C.forwardRef(({className:n,...a},o)=>l.jsx(Tx,{ref:o,className:K("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...a}));Pf.displayName=Tx.displayName;const jl=C.forwardRef(({className:n,...a},o)=>l.jsx(jx,{ref:o,className:K("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...a}));jl.displayName=jx.displayName;const Yd=C.forwardRef(({className:n,...a},o)=>l.jsx(Mx,{ref:o,className:K("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...a}));Yd.displayName=Mx.displayName;function qt({className:n,...a}){return l.jsx(uS,{"data-slot":"label",className:K("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...a})}const Lf="ccs:openrouter-models",AT=1440*60*1e3,Yb="1";function $d(n){const a=parseFloat(n);return isNaN(a)||a===0?0:a*1e6}function By(n){const a=$d(n);return a===0?"Free":a<.01?"<$0.01":a<1?`$${a.toFixed(2)}`:`$${a.toFixed(a<10?2:0)}`}function DT(n){const a=By(n.prompt),o=By(n.completion);return a==="Free"&&o==="Free"?"Free":`${a}/${o}`}function TT(n){const a=n.id.toLowerCase();return a.startsWith("anthropic/")?"anthropic":a.startsWith("openai/")?"openai":a.startsWith("google/")?"google":a.startsWith("meta-llama/")||a.startsWith("meta/")?"meta":a.startsWith("mistralai/")?"mistral":a.includes(":free")||a.includes("qwen")||a.includes("deepseek")?"opensource":"other"}function jT(n){return{...n,category:TT(n),pricePerMillionPrompt:$d(n.pricing.prompt),pricePerMillionCompletion:$d(n.pricing.completion),isFree:n.pricing.prompt==="0"&&n.pricing.completion==="0",isExacto:n.id.includes(":exacto")}}function MT(n,a,o){const r=a.toLowerCase().trim();return n.filter(c=>o?.category&&c.category!==o.category||o?.freeOnly&&!c.isFree||o?.minContext&&c.context_length<o.minContext?!1:r?c.id.toLowerCase().includes(r)||c.name.toLowerCase().includes(r)||c.description?.toLowerCase().includes(r):!0)}function XO(n){return[...n].sort((a,o)=>{if(a.isFree&&!o.isFree)return-1;if(!a.isFree&&o.isFree)return 1;if(!a.isFree&&!o.isFree){if(a.isExacto&&!o.isExacto)return-1;if(!a.isExacto&&o.isExacto)return 1}return a.name.localeCompare(o.name)})}function ET(){try{const n=localStorage.getItem(Lf);if(!n)return null;const a=JSON.parse(n);return a.version!==Yb||Date.now()-a.fetchedAt>AT?null:a.models}catch{return null}}function OT(n){try{localStorage.setItem(Lf,JSON.stringify({models:n,fetchedAt:Date.now(),version:Yb}))}catch{}}function PT(){localStorage.removeItem(Lf)}function ZO(n,a){const[o]=n.split("/");if(!o)return{};const r=a.filter(f=>f.id.startsWith(`${o}/`));if(r.length===0)return{};const c=[...r].sort((f,m)=>m.pricePerMillionPrompt-f.pricePerMillionPrompt),d=Math.ceil(c.length/3);return{opus:c[0]?.id,sonnet:c[Math.min(d,c.length-1)]?.id,haiku:c[c.length-1]?.id}}function LT(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}const JO={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},RT={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function _T(n,a=2){const o=[],r=["anthropic","openai","google","meta","mistral","opensource"];for(const c of r){const d=RT[c];if(d.length===0)continue;const m=[...n.filter(p=>d.some(y=>p.id.toLowerCase().startsWith(y)))].sort((p,y)=>(y.created??0)-(p.created??0));o.push(...m.slice(0,a))}return o.sort((c,d)=>(d.created??0)-(c.created??0))}function zT(n){const o=Date.now()/1e3-n;return o<86400?"Today":o<172800?"Yesterday":o<604800?`${Math.floor(o/86400)}d ago`:o<2592e3?`${Math.floor(o/604800)}w ago`:o<31536e3?`${Math.floor(o/2592e3)}mo ago`:`${Math.floor(o/31536e3)}y ago`}const IT="https://openrouter.ai/api/v1/models",$b=["openrouter-models"],Ky=1440*60*1e3;async function UT(){const n=await fetch(IT);if(!n.ok)throw new Error(`Failed to fetch OpenRouter models: ${n.status}`);const o=(await n.json()).data;return OT(o),o}function Wb(){return kt({queryKey:$b,queryFn:UT,staleTime:Ky,gcTime:Ky,initialData:()=>ET()??void 0,refetchOnWindowFocus:!1})}function HT(){const n=Wb(),a=(n.data??[]).map(jT);return{...n,models:a}}function eP(){const n=rt();return()=>(PT(),n.invalidateQueries({queryKey:$b}))}function tP(){const{data:n,isLoading:a,isError:o}=Wb();return{isReady:!!n&&n.length>0,isLoading:a,isError:o,modelCount:n?.length??0}}function Rf({profileEnv:n={}}){const[a,o]=C.useState(null),[r,c]=C.useState(!0),[d,f]=C.useState(!1);C.useEffect(()=>{m()},[]);const m=async()=>{try{c(!0);const b=await fetch("/api/global-env");if(!b.ok)throw new Error("Failed to load");const j=await b.json();o(j)}catch{o(null)}finally{c(!1)}};if(r||!a?.enabled)return null;const p=a.env||{},y=Object.keys(p);if(y.length===0)return null;const S=y.filter(b=>!(b in n)),x=y.filter(b=>b in n);return l.jsxs("div",{className:"border-t bg-muted/20",children:[l.jsxs("button",{onClick:()=>f(!d),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[l.jsx(Rl,{className:"w-4 h-4 text-blue-500"}),l.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[l.jsx("span",{className:"font-medium text-foreground",children:S.length})," global env var",S.length!==1?"s":""," will be injected at runtime",x.length>0&&l.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",x.length," overridden by profile)"]})]}),d?l.jsx(tf,{className:"w-4 h-4 text-muted-foreground"}):l.jsx(Pl,{className:"w-4 h-4 text-muted-foreground"})]}),d&&l.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[S.length>0&&l.jsx("div",{className:"space-y-1",children:S.map(b=>l.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-green-500/10 text-green-700 dark:text-green-400 px-2 py-1 rounded",children:[l.jsx("span",{className:"text-green-500",children:"+"}),l.jsxs("span",{className:"truncate",children:[b,"=",p[b]]})]},b))}),x.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),x.map(b=>l.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-amber-500/10 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[l.jsx("span",{className:"text-amber-500",children:"~"}),l.jsx("span",{className:"truncate",children:b})]},b))]}),l.jsx("div",{className:"pt-2 border-t border-border/50",children:l.jsx(ot,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:l.jsxs(Cl,{to:"/settings?tab=globalenv",children:[l.jsx(af,{className:"w-3.5 h-3.5"}),"Configure in Settings",l.jsx(Hx,{className:"w-3 h-3 opacity-50"})]})})})]})]})}function BT({className:n,...a}){return l.jsx(dS,{"data-slot":"switch",className:K("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",n),...a,children:l.jsx(fS,{"data-slot":"switch-thumb",className:K("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}const _f={claude:"Claude Code",droid:"Factory Droid",codex:"Codex CLI"};function KT(n,a){return a==="refreshing"?"Refreshing preview":a==="invalid"?"Saved status":n==="editor"?"Live preview":"Saved status"}function qT(n,a){return n.status==="disabled"?"Disabled globally":a!=="claude"?`${_f[a]} bypasses the hook`:n.nativeReadPreference?"Native image reading":n.status==="hook-missing"?"Setup needed":n.authReadiness==="missing"?"Needs auth":n.proxyReadiness==="unavailable"?"Needs proxy":n.effectiveRuntimeMode==="native-read"?"Native fallback":"Transformer ready"}function FT(n,a){return n.status==="disabled"?{label:"Disabled",className:"border-border/80 bg-background/85 text-muted-foreground"}:a!=="claude"?{label:"Bypassed",className:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200"}:n.nativeReadPreference?{label:"Native",className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}:n.status==="hook-missing"||n.authReadiness==="missing"?{label:n.status==="hook-missing"?"Setup":"Auth",className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:n.proxyReadiness==="unavailable"?{label:"Proxy",className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:{label:"Ready",className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}}function GT(n,a){if(n.nativeReadPreference)return n.profileModel&&n.nativeImageCapable?`${n.profileModel} looks image-ready. CCS will bypass the transformer here.`:n.profileModel?`CCS will prefer native reading for ${n.profileModel}.`:"CCS will prefer native image reading for this profile.";if(!n.backendDisplayName&&a==="claude")return"This profile currently stays on native file access.";if(!n.backendDisplayName)return`Saved Claude-side image routing is inactive while ${_f[a]} is selected.`;const o=n.model?` · ${n.model}`:"";return`Transformer route: ${n.backendDisplayName}${o}.`}function VT(n,a){return n.status==="disabled"?"Image is disabled globally in CCS settings.":a!=="claude"?`Current target ${_f[a]} bypasses the Claude Read hook.`:n.nativeReadPreference?n.nativeImageCapable===!0?null:n.nativeImageReason:n.status==="hook-missing"?"Persist the profile hook before transformer routing can run here.":n.authReadiness==="missing"?n.authReason:n.proxyReadiness==="unavailable"?n.proxyReason:null}function YT({status:n,target:a="claude",source:o="saved",previewState:r="saved",nativeReadPreferenceOverride:c,onToggleNativeRead:d}){if(!n)return l.jsxs("div",{className:"rounded-2xl border bg-muted/20 px-4 py-3","aria-live":"polite",children:[l.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),l.jsx("div",{className:"mt-2 h-3 w-52 animate-pulse rounded bg-muted"})]});const f=c??n.nativeReadPreference,m={...n,nativeReadPreference:f},p=FT(m,a),y=VT(m,a),S=n.nativeImageCapable?"Verified":n.profileModel?"Unknown":null;return l.jsxs("section",{className:"rounded-2xl border bg-background/95 px-4 py-3 shadow-sm",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsx("div",{className:"min-w-0",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"inline-flex h-8 w-8 items-center justify-center rounded-xl border border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:l.jsx(Gx,{className:"h-4 w-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Image"}),l.jsx(Ut,{className:K("h-5 border px-1.5 text-[10px]",p.className),children:p.label})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[KT(o,r)," · ",qT(m,a)]})]})]})}),l.jsx(ot,{size:"sm",variant:"outline",className:"h-8 shrink-0",asChild:!0,children:l.jsxs(Cl,{to:"/settings?tab=image",children:["Open Settings",l.jsx(Fx,{className:"ml-1 h-3.5 w-3.5"})]})})]}),l.jsx("div",{className:"mt-3 rounded-xl border bg-muted/15 px-3 py-3",children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"text-sm font-medium text-foreground",children:"Use native image reading"}),S&&l.jsx(Ut,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:S})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:GT(m,a)})]}),l.jsx(BT,{checked:f,onCheckedChange:d,disabled:!d,"aria-label":"Use native image reading"})]})}),y&&l.jsx("div",{className:"mt-2 rounded-lg border border-border/70 bg-muted/20 px-3 py-2 text-xs leading-5 text-muted-foreground",children:y})]})}const $T=C.lazy(()=>at(()=>Promise.resolve().then(()=>Ql),void 0).then(n=>({default:n.CodeEditor})));function nP({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:o,settings:r,profileTarget:c="claude",imageAnalysisStatus:d,imageAnalysisStatusSource:f="saved",imageAnalysisStatusPreviewState:m="saved",nativeReadPreferenceOverride:p,onToggleNativeRead:y,onChange:S,missingRequiredFields:x=[]}){const b=x.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(kn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[l.jsx(Ao,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&b&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:x.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx($T,{value:n,onChange:S,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx(YT,{status:d,target:c,source:f,previewState:m,nativeReadPreferenceOverride:p,onToggleNativeRead:y})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Rf,{profileEnv:r?.env})})})]})})}function qy(n,a){try{var o=n()}catch(r){return a(r)}return o&&o.then?o.then(void 0,a):o}function WT(n,a){for(var o={};n.length;){var r=n[0],c=r.code,d=r.message,f=r.path.join(".");if(!o[f])if("unionErrors"in r){var m=r.unionErrors[0].errors[0];o[f]={message:m.message,type:m.code}}else o[f]={message:d,type:c};if("unionErrors"in r&&r.unionErrors.forEach(function(S){return S.errors.forEach(function(x){return n.push(x)})}),a){var p=o[f].types,y=p&&p[r.code];o[f]=Vx(f,a,o,c,y?[].concat(y,r.message):r.message)}n.shift()}return o}function QT(n,a){for(var o={};n.length;){var r=n[0],c=r.code,d=r.message,f=r.path.join(".");if(!o[f])if(r.code==="invalid_union"&&r.errors.length>0){var m=r.errors[0][0];o[f]={message:m.message,type:m.code}}else o[f]={message:d,type:c};if(r.code==="invalid_union"&&r.errors.forEach(function(S){return S.forEach(function(x){return n.push(x)})}),a){var p=o[f].types,y=p&&p[r.code];o[f]=Vx(f,a,o,c,y?[].concat(y,r.message):r.message)}n.shift()}return o}function XT(n,a,o){if(o===void 0&&(o={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(n))return function(r,c,d){try{return Promise.resolve(qy(function(){return Promise.resolve(n[o.mode==="sync"?"parse":"parseAsync"](r,a)).then(function(f){return d.shouldUseNativeValidation&&Gg({},d),{errors:{},values:o.raw?Object.assign({},r):f}})},function(f){if((function(m){return Array.isArray(m?.issues)})(f))return{values:{},errors:Vg(WT(f.errors,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw f}))}catch(f){return Promise.reject(f)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(n))return function(r,c,d){try{return Promise.resolve(qy(function(){return Promise.resolve((o.mode==="sync"?Uw:Hw)(n,r,a)).then(function(f){return d.shouldUseNativeValidation&&Gg({},d),{errors:{},values:o.raw?Object.assign({},r):f}})},function(f){if((function(m){return m instanceof Bw})(f))return{values:{},errors:Vg(QT(f.issues,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw f}))}catch(f){return Promise.reject(f)}};throw new Error("Invalid input: not a Zod schema")}const ZT={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function JT({provider:n,className:a,size:o="md"}){const r=PA(n),c=ZT[o],d=fb(n),f=RA(n);return l.jsx("div",{className:K("flex items-center justify-center rounded-md",d&&!f&&(LA(n)?"bg-gray-900 p-1":"bg-white p-1"),c.container,a),children:d?l.jsx("img",{src:d,alt:`${n} logo`,className:K(f?c.container:c.icon,"object-contain")}):l.jsx("span",{className:K("font-semibold",r.textClass,c.text),children:r.letter})})}function aP(){return kt({queryKey:["profiles"],queryFn:()=>He.profiles.list()})}function ej(){const n=rt();return st({mutationFn:a=>He.profiles.create(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Profile created successfully")},onError:a=>{le.error(a.message)}})}function iP(){const n=rt();return st({mutationFn:a=>He.profiles.delete(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Profile deleted successfully")},onError:a=>{le.error(a.message)}})}function oP(){return st({mutationFn:()=>He.profiles.discoverOrphans()})}function sP(){const n=rt();return st({mutationFn:a=>He.profiles.registerOrphans(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Orphan profiles registration complete")}})}function rP(){const n=rt();return st({mutationFn:({name:a,data:o})=>He.profiles.copy(a,o),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Profile copied successfully")}})}function lP(){return st({mutationFn:({name:n,includeSecrets:a})=>He.profiles.export(n,a??!1)})}function cP(){const n=rt();return st({mutationFn:a=>He.profiles.import(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Profile imported successfully")}})}const tj="https://openrouter.ai/api",Qb=Object.freeze({glmt:"glm",kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan"}),Xb=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:tj,defaultProfileName:"openrouter",defaultModel:"anthropic/claude-opus-4.5",apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended",requiresApiKey:!0,badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg"},{id:"alibaba-coding-plan",name:"Alibaba Coding Plan",description:"Alibaba Cloud Coding Plan via Anthropic-compatible endpoint",baseUrl:"https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",defaultProfileName:"albb",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-sp-...",apiKeyHint:"Get your Coding Plan key from Alibaba Cloud Model Studio",category:"recommended",requiresApiKey:!0,badge:"Coding Plan",featured:!0,icon:"/assets/providers/alibabacloud-color.svg"},{id:"ollama",name:"Ollama (Local)",description:"Local open-source models via Ollama (32K+ context)",baseUrl:"http://localhost:11434",defaultProfileName:"ollama",defaultModel:"qwen3-coder",apiKeyPlaceholder:"ollama",apiKeyHint:"Install Ollama from ollama.com - no API key needed for local",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/icons/ollama.svg"},{id:"llamacpp",name:"llama.cpp (Local)",description:"Local inference via llama.cpp (LLaMA models)",baseUrl:"http://127.0.0.1:8080",defaultProfileName:"llamacpp",defaultModel:"llama3-8b",apiKeyPlaceholder:"llamacpp",apiKeyHint:"Run llama.cpp server: ./server --host 0.0.0.0 --port 8080 -m model.gguf",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/assets/providers/llama-cpp.svg"},{id:"anthropic",name:"Anthropic (Direct API)",description:"Use your own Anthropic API key (sk-ant-...)",baseUrl:"",defaultProfileName:"anthropic",defaultModel:"claude-sonnet-4-5-20250929",apiKeyPlaceholder:"sk-ant-api03-...",apiKeyHint:"Get key at console.anthropic.com/settings/keys",category:"recommended",requiresApiKey:!0,badge:"Direct",featured:!0,icon:"/assets/providers/claude.svg"},{id:"glm",name:"GLM",description:"Direct Z.AI Anthropic-compatible API profile",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative",requiresApiKey:!0,badge:"Z.AI",icon:"/icons/zai.svg"},{id:"km",name:"Kimi",description:"Moonshot AI - Fast reasoning model",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-k2-thinking-turbo",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Moonshot AI",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Reasoning",icon:"/icons/kimi.svg"},{id:"foundry",name:"Azure Foundry",description:"Claude via Microsoft Azure AI Foundry",baseUrl:"https://<your-resource>.services.ai.azure.com/api/anthropic",defaultProfileName:"foundry",defaultModel:"claude-sonnet-4-5",apiKeyPlaceholder:"YOUR_AZURE_API_KEY",apiKeyHint:"Create resource at ai.azure.com, get API key from Keys tab",category:"alternative",requiresApiKey:!0,badge:"Azure",icon:"/icons/azure.svg"},{id:"mm",name:"Minimax",description:"M2.1/M2.1-lightning/M2 - multilang coding (1M context)",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M2.1",apiKeyPlaceholder:"YOUR_MINIMAX_API_KEY_HERE",apiKeyHint:"Get your API key at platform.minimax.io",category:"alternative",requiresApiKey:!0,badge:"1M context",icon:"/icons/minimax.svg"},{id:"deepseek",name:"DeepSeek",description:"V3.2 and R1 reasoning model (128K context)",baseUrl:"https://api.deepseek.com/anthropic",defaultProfileName:"deepseek",defaultModel:"deepseek-chat",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key at platform.deepseek.com",category:"alternative",requiresApiKey:!0,badge:"Reasoning",icon:"/icons/deepseek.svg"},{id:"qwen",name:"Qwen",description:"Alibaba Cloud - Qwen3 models (256K-1M context, thinking support)",baseUrl:"https://dashscope-intl.aliyuncs.com/apps/anthropic",defaultProfileName:"qwen-api",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Alibaba Cloud Model Studio",category:"alternative",requiresApiKey:!0,badge:"Alibaba",icon:"/assets/providers/qwen-color.svg"},{id:"ollama-cloud",name:"Ollama Cloud",description:"Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)",baseUrl:"https://ollama.com",defaultProfileName:"ollama-cloud",defaultModel:"glm-5:cloud",apiKeyPlaceholder:"YOUR_OLLAMA_CLOUD_API_KEY",apiKeyHint:"Get your API key at ollama.com",category:"alternative",requiresApiKey:!0,badge:"Cloud",icon:"/icons/ollama.svg"},{id:"novita",name:"Novita AI",description:"Anthropic-compatible API for Claude Code and CCS profiles",baseUrl:"https://api.novita.ai/anthropic",defaultProfileName:"novita",defaultModel:"deepseek/deepseek-v3.2",apiKeyPlaceholder:"YOUR_NOVITA_API_KEY",apiKeyHint:"Get your API key at novita.ai",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible",icon:"/icons/novita.svg"}];function Zb(n){return{...n,extraEnv:n.extraEnv?{...n.extraEnv}:void 0}}function nj(n){const a=Zb(n);return a.extraEnv&&Object.freeze(a.extraEnv),Object.freeze(a)}function aj(n,a){const o=new Set;for(const c of n){const d=c.id.trim().toLowerCase();if(c.id!==d)throw new Error(`Preset ID must be normalized: "${c.id}"`);if(o.has(c.id))throw new Error(`Duplicate preset ID detected: "${c.id}"`);o.add(c.id)}const r=new Set;for(const[c,d]of Object.entries(a)){const f=c.trim().toLowerCase();if(!f)throw new Error("Preset alias keys cannot be empty");if(c!==f)throw new Error(`Preset alias must be normalized: "${c}"`);if(r.has(f))throw new Error(`Duplicate normalized preset alias detected: "${c}"`);if(r.add(f),!o.has(d))throw new Error(`Preset alias "${c}" points to unknown target "${d}"`);if(o.has(f))throw new Error(`Preset alias "${c}" collides with canonical preset ID "${f}"`)}}aj(Xb,Qb);const ij=Object.freeze(Xb.map(nj));function oj(){return ij.map(Zb)}function sj(n){const a=n.trim().toLowerCase();return Qb[a]||a}const rj=oj(),zf=Object.freeze(rj.map(n=>({...n})));function lj(n,a){return a||(n?.requiresApiKey===!1?n.apiKeyPlaceholder||n.id:"")}function cj(n){return zf.filter(a=>a.category===n)}function wd(n){const a=sj(n);return zf.find(o=>o.id===a)}const uj=Za().refine(n=>n.trim().length===0||Za().url().safeParse(n).success,{message:"Invalid URL format"}),dj=Kw({name:Za().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:uj,apiKey:Za(),model:Za().optional(),opusModel:Za().optional(),sonnetModel:Za().optional(),haikuModel:Za().optional(),target:qw(["claude","droid","codex"])}),fj=["/chat/completions","/v1/messages","/messages","/completions"],Ni="custom",Nd="openrouter",Jb=new Set(["ollama","llamacpp"]),kd={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},ev=cj("recommended"),hj=ev.filter(n=>!Jb.has(n.id)),mj=ev.filter(n=>Jb.has(n.id)),pj=zf.filter(n=>n.category!=="recommended");function uP({open:n,onOpenChange:a,onSuccess:o,initialMode:r="openrouter"}){const{t:c}=Et(),d=ej(),[f,m]=C.useState("basic"),[p,y]=C.useState(null),[S,x]=C.useState(!1),[b,j]=C.useState(Nd),[N,E]=C.useState(""),{models:L}=HT(),{register:O,handleSubmit:D,formState:{errors:A},control:k,reset:T,setValue:w}=Fw({resolver:XT(dj),defaultValues:kd}),R=Yg({control:k,name:"baseUrl"}),I=Yg({control:k,name:"target"}),z=C.useCallback($=>{if(!$){T(kd);return}T({...kd,name:$.defaultProfileName,baseUrl:$.baseUrl,model:$.defaultModel,opusModel:$.defaultModel,sonnetModel:$.defaultModel,haikuModel:$.defaultModel})},[T]),F=C.useMemo(()=>b===Ni?null:wd(b)??null,[b]),ee=C.useMemo(()=>N.trim()?[...MT(L,N)].sort((oe,ue)=>(ue.created??0)-(oe.created??0)).slice(0,20):_T(L,2),[L,N]);C.useEffect(()=>{if(n)if(m("basic"),y(null),x(!1),E(""),r==="normal")j(Ni),z(null);else{const oe=wd(r==="openrouter"?Nd:r);if(oe){j(oe.id),z(oe);return}j(Ni),z(null)}},[n,r,z,T]);const Q=$=>{const oe=wd($);if(oe){j(oe.id),z(oe);return}j(Ni),z(null)},ge=$=>{w("model",$.id),w("opusModel",$.id),w("sonnetModel",$.id),w("haikuModel",$.id),E($.name),le.success(`Applied "${$.name}" to all model tiers`,{duration:2e3})};C.useEffect(()=>{if(R&&b===Ni){const oe=R.toLowerCase();for(const ue of fj)if(oe.endsWith(ue)){const he=R.replace(new RegExp(ue+"$","i"),"");y(`URL ends with "${ue}" - Claude appends this automatically. You likely want: ${he}`);return}}y(null)},[R,b]);const te=async $=>{if(F?.requiresApiKey!==!1&&!$.apiKey){le.error(Fe.t("commonToast.apiKeyRequired"));return}const oe={...$,apiKey:lj(F,$.apiKey)};try{await d.mutateAsync(oe),le.success(`Profile "${oe.name}" created`),o(oe.name),a(!1)}catch(ue){le.error(ue.message||"Failed to create profile")}},ve=!!A.name||!!A.baseUrl||!!A.apiKey,U=!!A.model||!!A.opusModel||!!A.sonnetModel||!!A.haikuModel,Z=d.isPending,ne=F?.id===Nd;return l.jsx(pf,{open:n,onOpenChange:a,children:l.jsxs(gf,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh] !flex !flex-col",children:[l.jsxs(yf,{className:"p-6 pb-4 border-b",children:[l.jsxs(xf,{className:"flex items-center gap-2",children:[l.jsx(Bg,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),l.jsx(bf,{children:"Choose a provider preset or configure a custom API endpoint."})]}),l.jsxs("form",{onSubmit:D(te),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[l.jsx("div",{className:"border-b bg-muted/10 px-6 py-3 space-y-3",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(qt,{className:"text-xs text-muted-foreground",children:c("profileEditor.provider")}),l.jsx("p",{className:"text-xs text-muted-foreground",children:c("profileEditor.providerChooserHint")})]}),l.jsx("span",{className:"pt-0.5 text-[11px] text-muted-foreground",children:c("profileEditor.scrollHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("profileEditor.featuredProviders")}),l.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:l.jsxs("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:[hj.map($=>l.jsx(Ad,{preset:$,isSelected:b===$.id,onClick:()=>Q($.id),density:"featured"},$.id)),l.jsx("div",{className:"mx-1 hidden w-px rounded-full bg-border/70 sm:block"}),l.jsx(gj,{isSelected:b===Ni,onClick:()=>Q(Ni)})]})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("profileEditor.morePresets")}),l.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:l.jsx("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:pj.map($=>l.jsx(Ad,{preset:$,isSelected:b===$.id,onClick:()=>Q($.id),density:"compact"},$.id))})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:"Local Runtimes"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:mj.map($=>l.jsx(Ad,{preset:$,isSelected:b===$.id,onClick:()=>Q($.id),density:"compact"},$.id))})]})]})}),l.jsxs(Vb,{value:f,onValueChange:m,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[l.jsx("div",{className:"px-6 pt-4",children:l.jsxs(Pf,{className:"grid w-full grid-cols-2",children:[l.jsxs(jl,{value:"basic",className:"relative",children:["Basic Information",ve&&l.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),l.jsxs(jl,{value:"models",className:"relative",children:["Model Configuration",U&&l.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[l.jsxs(Yd,{value:"basic",className:"p-6 space-y-4 mt-0",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"name",children:["Profile Name ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Hn,{id:"name",...O("name"),placeholder:"my-api",className:"font-mono"}),A.name?l.jsx("p",{className:"text-xs text-destructive",children:A.name.message}):l.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(qt,{htmlFor:"baseUrl",children:"API Base URL"}),l.jsx(Hn,{id:"baseUrl",...O("baseUrl"),placeholder:"https://api.example.com/v1"}),A.baseUrl?l.jsx("p",{className:"text-xs text-destructive",children:A.baseUrl.message}):p?l.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-600 bg-yellow-50 dark:bg-yellow-900/20 p-2 rounded",children:[l.jsx(Gn,{className:"w-4 h-4 shrink-0 mt-0.5"}),l.jsx("span",{children:p})]}):F?l.jsx("p",{className:"text-xs text-muted-foreground",children:F.baseUrl?`Pre-filled from ${F.name}. You can customize if needed.`:`Optional for ${F.name}. Leave blank to use native Anthropic auth.`}):l.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"apiKey",children:["API Key"," ",F?.requiresApiKey!==!1&&l.jsx("span",{className:"text-destructive",children:"*"}),F?.requiresApiKey===!1&&l.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:"(optional)"})]}),l.jsxs("div",{className:"relative",children:[l.jsx(Hn,{id:"apiKey",type:S?"text":"password",...O("apiKey"),placeholder:F?.requiresApiKey===!1?"Optional - only if auth is enabled":F?.apiKeyPlaceholder??"sk-...",className:"pr-10"}),l.jsx(ot,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>x(!S),tabIndex:-1,children:S?l.jsx(Vs,{className:"h-4 w-4"}):l.jsx(Ys,{className:"h-4 w-4"})})]}),A.apiKey?l.jsx("p",{className:"text-xs text-destructive",children:A.apiKey.message}):F?.requiresApiKey===!1?l.jsx("p",{className:"text-xs text-muted-foreground",children:"Only needed if your local endpoint has authentication enabled"}):F?.apiKeyHint&&l.jsx("p",{className:"text-xs text-muted-foreground",children:F.apiKeyHint})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(qt,{htmlFor:"target",children:"Default Target CLI"}),l.jsxs(hb,{value:I,onValueChange:$=>w("target",$),children:[l.jsx(Nf,{id:"target",children:l.jsx(mb,{})}),l.jsxs(kf,{children:[l.jsx(_s,{value:"claude",children:"Claude Code (default)"}),l.jsx(_s,{value:"droid",children:"Factory Droid"}),l.jsx(_s,{value:"codex",children:"Codex CLI"})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[I==="droid"?l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintPreferredAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-droid"}),"."]}):I==="codex"?l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintPreferredAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsx"}),"."]}):l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintClaudeDefault")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs"}),"."]}),I==="droid"?l.jsxs(l.Fragment,{children:[" ",c("profileEditor.targetHintLegacyAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsd"}),"."]}):I==="codex"?l.jsxs(l.Fragment,{children:[" ",c("profileEditor.targetHintLegacyAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-codex"}),"."]}):null," ",c("profileEditor.targetHintOverride")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),l.jsxs(Yd,{value:"models",className:"p-6 mt-0 space-y-4",children:[l.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 text-blue-800 dark:text-blue-300 rounded-md text-sm border border-blue-100 dark:border-blue-900/30",children:[l.jsx(Rl,{className:"w-5 h-5 shrink-0 mt-0.5"}),l.jsxs("div",{children:[l.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),l.jsx("p",{className:"text-xs opacity-90",children:"Map Claude Code tiers (Opus/Sonnet/Haiku) to models supported by your provider."})]})]}),ne&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{children:"Search Models"}),l.jsx(Hn,{value:N,onChange:$=>E($.target.value),placeholder:"Type to search (e.g., opus, sonnet, gpt-4o)...",onKeyDown:$=>{$.key==="Enter"&&ee.length>0&&($.preventDefault(),ge(ee[0]))}}),l.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:ee.length===0?l.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:N?`No models found for "${N}"`:"Loading models..."}):l.jsxs("div",{className:"p-1",children:[!N&&l.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[l.jsx(JS,{className:"w-3 h-3 text-accent"}),l.jsx("span",{children:"Newest Models"})]}),ee.map($=>l.jsx(yj,{model:$,onClick:()=>ge($),showAge:!N},$.id))]})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"model",children:["Default Model",l.jsx(Ut,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),l.jsx(Hn,{id:"model",...O("model"),placeholder:F?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping",l.jsx(Ut,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),l.jsx(Hn,{id:"sonnetModel",...O("sonnetModel"),placeholder:"e.g. gpt-4o, claude-sonnet-4",className:"font-mono text-sm h-9"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping",l.jsx(Ut,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),l.jsx(Hn,{id:"opusModel",...O("opusModel"),placeholder:"e.g. o1, claude-opus-4.5",className:"font-mono text-sm h-9"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping",l.jsx(Ut,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),l.jsx(Hn,{id:"haikuModel",...O("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3.5-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),l.jsxs(wA,{className:"p-6 pt-4 border-t bg-muted/10",children:[l.jsx(ot,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),l.jsx(ot,{type:"submit",disabled:Z,className:K(Z&&"opacity-80"),children:Z?l.jsxs(l.Fragment,{children:[l.jsx(kn,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Bg,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})]})]})})}function Ad({preset:n,isSelected:a,onClick:o,density:r="compact"}){const c=n.id==="anthropic",d=r==="featured";return l.jsxs("button",{type:"button",onClick:o,className:K("flex flex-none items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all",d?"h-[68px] w-[236px]":"h-[64px] w-[168px]",a?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-border/60 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[l.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background",children:c?l.jsx(JT,{provider:"claude",size:"md",className:"rounded-lg"}):n.icon?l.jsx("img",{src:n.icon,alt:"",className:"h-5 w-5 object-contain"}):l.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/70 text-xs font-semibold text-foreground/70",children:n.name.charAt(0)})}),l.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"truncate text-[13px] font-semibold leading-tight tracking-[-0.01em]",children:n.name}),n.badge&&d&&l.jsx(Ut,{variant:"secondary",className:"inline-flex bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]}),n.badge&&!d&&l.jsx(Ut,{variant:"secondary",className:"inline-flex w-fit bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]})]})}function gj({isSelected:n,onClick:a}){const{t:o}=Et();return l.jsxs("button",{type:"button",onClick:a,className:K("flex h-[68px] w-[236px] flex-none items-center gap-3 rounded-xl border border-dashed px-3 py-2.5 text-left transition-all",n?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-muted-foreground/30 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[l.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-dashed border-current/30 bg-muted/70",children:l.jsx(af,{className:"h-4 w-4 text-muted-foreground"})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsx("div",{className:"text-sm font-semibold leading-tight",children:o("profileEditor.customEndpoint")})})]})}function yj({model:n,onClick:a,showAge:o}){return l.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[l.jsx("span",{className:"flex-1 truncate",children:n.name}),l.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[o&&n.created&&l.jsx(Ut,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:zT(n.created)}),n.isFree?l.jsx(Ut,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:"Free"}):l.jsx("span",{children:DT(n.pricing)}),l.jsx("span",{children:LT(n.context_length)})]})]})}function xj({className:n,...a}){return l.jsx("div",{"data-slot":"card",className:K("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...a})}function bj({className:n,...a}){return l.jsx("div",{"data-slot":"card-header",className:K("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...a})}function vj({className:n,...a}){return l.jsx("div",{"data-slot":"card-title",className:K("leading-none font-semibold",n),...a})}function Cj({className:n,...a}){return l.jsx("div",{"data-slot":"card-description",className:K("text-muted-foreground text-sm",n),...a})}function Sj({className:n,...a}){return l.jsx("div",{"data-slot":"card-content",className:K("px-6",n),...a})}const If="[1m]",Uf=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL"],wj=new Set(Uf);function dP(n){return n.toLowerCase().startsWith("gemini-")}function Hf(n){return n.toLowerCase().endsWith(If.toLowerCase())}function Nj(n){return!n||Hf(n)?n:`${n}${If}`}function tv(n){return n&&(Hf(n)?n.slice(0,-If.length):n)}function fP(n){return wj.has(n)}function kj(n){return tv(n.trim()).replace(/\([^)]+\)$/,"")}function hP(n){return Uf.some(a=>{const o=n[a];return typeof o=="string"&&Hf(o)})}function mP(n,a,o={}){const r={...n};for(const c of Uf){const d=r[c];if(typeof d!="string"||d.trim().length===0)continue;const f=kj(d),m=o.supportsExtendedContext?.(f,c)??!0;r[c]=a&&m?Nj(d):tv(d)}return r}const Aj=["agy","claude","gemini","codex","qwen","kimi","iflow","kiro","ghcp"],pP=Aj.map(n=>({id:n,name:wf(n),description:zA(n)})),Dj=["provider","auth","variant","success"];function gP(n){return n==="account"?1:Dj.indexOf(n)}const yP=mS,xP=gS,bP=pS,Tj=C.forwardRef(({className:n,align:a="center",sideOffset:o=4,...r},c)=>l.jsx(hS,{children:l.jsx(Ex,{ref:c,align:a,sideOffset:o,className:K("z-50 w-80 max-w-[calc(100vw-2rem)] rounded-lg border border-border/70 bg-popover p-4 text-popover-foreground shadow-xl shadow-black/10 outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));Tj.displayName=Ex.displayName;const jj=C.lazy(()=>at(()=>Promise.resolve().then(()=>Ql),void 0).then(n=>({default:n.CodeEditor})));function vP({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:o,onRawJsonChange:r,profileEnv:c,missingRequiredFields:d=[]}){const f=d.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(kn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[l.jsx(Ao,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&f&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:d.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Apply a preset from Model Config tab or add these fields manually. Without them, Claude Code will fail with 404 errors."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(jj,{value:n,onChange:r,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Rf,{profileEnv:c})})})]})})}var Xt={},Fy;function Mj(){if(Fy)return Xt;Fy=1;var n=Xt&&Xt.__assign||function(){return n=Object.assign||function(T){for(var w,R=1,I=arguments.length;R<I;R++){w=arguments[R];for(var z in w)Object.prototype.hasOwnProperty.call(w,z)&&(T[z]=w[z])}return T},n.apply(this,arguments)},a=Xt&&Xt.__createBinding||(Object.create?(function(T,w,R,I){I===void 0&&(I=R);var z=Object.getOwnPropertyDescriptor(w,R);(!z||("get"in z?!w.__esModule:z.writable||z.configurable))&&(z={enumerable:!0,get:function(){return w[R]}}),Object.defineProperty(T,I,z)}):(function(T,w,R,I){I===void 0&&(I=R),T[I]=w[R]})),o=Xt&&Xt.__setModuleDefault||(Object.create?(function(T,w){Object.defineProperty(T,"default",{enumerable:!0,value:w})}):function(T,w){T.default=w}),r=Xt&&Xt.__importStar||function(T){if(T&&T.__esModule)return T;var w={};if(T!=null)for(var R in T)R!=="default"&&Object.prototype.hasOwnProperty.call(T,R)&&a(w,T,R);return o(w,T),w},c=Xt&&Xt.__rest||function(T,w){var R={};for(var I in T)Object.prototype.hasOwnProperty.call(T,I)&&w.indexOf(I)<0&&(R[I]=T[I]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function")for(var z=0,I=Object.getOwnPropertySymbols(T);z<I.length;z++)w.indexOf(I[z])<0&&Object.prototype.propertyIsEnumerable.call(T,I[z])&&(R[I[z]]=T[I[z]]);return R};Object.defineProperty(Xt,"__esModule",{value:!0});var d=r(Zd()),f=89,m=90,p=77,y=57,S=219,x=222,b=192,j=100,N=3e3,E=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),L=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),O="npm__react-simple-code-editor__textarea",D=`
|
|
14
|
+
`).trim()}function tT(n){const a=n.url.match(/\/api\/provider\/([^/]+)/);a&&(n.provider=a[1]);const o=n.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);o&&(n.endpoint=o[1]),n.isClientError=n.statusCode>=400&&n.statusCode<500,n.isServerError=n.statusCode>=500,n.statusCode===429?n.errorType="rate_limit":n.statusCode===401||n.statusCode===403?n.errorType="auth":n.statusCode===404?n.errorType="not_found":n.statusCode>=500?n.errorType="server":(n.statusCode===408||n.statusCode===504)&&(n.errorType="timeout"),nT(n),n.statusCode===429&&aT(n)}function nT(n){if(n.requestBody)try{const a=JSON.parse(n.requestBody);typeof a.model=="string"&&(n.model=a.model)}catch{}}function aT(n){if(n.responseBody)try{const a=JSON.parse(n.responseBody),o=Gd(a);o!==null&&(n.quotaResetDelay=o);const r=Vd(a);r&&(n.quotaResetTimestamp=r)}catch{}}function Gd(n){if(typeof n!="object"||n===null)return null;const a=n;if("quotaResetDelay"in a){const o=a.quotaResetDelay;if(typeof o=="number")return o;if(typeof o=="string"){const r=o.match(/^(\d+)s?$/);if(r)return parseInt(r[1],10)}}if("error"in a&&typeof a.error=="object"){const o=Gd(a.error);if(o!==null)return o}if("details"in a&&Array.isArray(a.details))for(const o of a.details){const r=Gd(o);if(r!==null)return r}return null}function Vd(n){if(typeof n!="object"||n===null)return null;const a=n;for(const o of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(o in a&&typeof a[o]=="string")return a[o];if("error"in a&&typeof a.error=="object"){const o=Vd(a.error);if(o)return o}if("details"in a&&Array.isArray(a.details))for(const o of a.details){const r=Vd(o);if(r)return r}return null}function iT(n){return{400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",408:"Request Timeout",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[n]||""}function oT(n,a){const o=of(),r=o==="zh-CN",c=o==="vi",d=Date.now(),f=n*1e3,m=d-f,p=Math.floor(m/1e3),y=Math.floor(p/60),S=Math.floor(y/60),x=Math.floor(S/24);return p<60?r?"刚刚":c?"vừa xong":"just now":y<60?r?`${y} 分钟前`:c?`${y} phút trước`:`${y}m ago`:S<24?r?`${S} 小时前`:c?`${S} giờ trước`:`${S}h ago`:x<7?r?`${x} 天前`:c?`${x} ngày trước`:`${x}d ago`:new Date(f).toLocaleDateString(o,{month:"short",day:"numeric"})}function sT(n){return n>=500?"text-red-500":n===429?"text-orange-500":n>=400?"text-yellow-500":"text-gray-500"}function rT(n,a){const o=of();return o==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[n]||"错误":o==="vi"?{rate_limit:"Quá giới hạn",auth:"Lỗi xác thực",not_found:"Không tìm thấy",server:"Lỗi máy chủ",timeout:"Hết thời gian chờ",unknown:"Lỗi"}[n]||"Lỗi":{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[n]||"Error"}function lT(n){if(n===null||n<=0)return null;if(n<60)return`${n}s`;if(n<3600)return`${Math.floor(n/60)}m`;const a=Math.floor(n/3600),o=Math.floor(n%3600/60);return o>0?`${a}h ${o}m`:`${a}h`}function cT(n,a){if(!n)return null;const o=of(),r=o==="zh-CN",c=o==="vi";try{const d=new Date(n),f=new Date,m=d.getTime()-f.getTime();if(m<=0)return r?"现在":c?"bây giờ":"now";const p=Math.floor(m/1e3);if(p<60)return r?`${p}秒`:c?`${p} giây`:`${p}s`;if(p<3600){const x=Math.floor(p/60);return r?`${x}分钟`:c?`${x} phút`:`${x}m`}const y=Math.floor(p/3600),S=Math.floor(p%3600/60);return r?S>0?`${y}小时 ${S}分钟`:`${y}小时`:c?S>0?`${y} giờ ${S} phút`:`${y} giờ`:S>0?`${y}h ${S}m`:`${y}h`}catch{return null}}function uT(n){return n?n===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":n>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":n>=400?"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":"bg-gray-100 text-gray-600":"bg-gray-100 text-gray-600"}function dT(n){return n||""}function fT({name:n,size:a,modified:o,isSelected:r,onClick:c,statusCode:d,model:f}){const m=C.useMemo(()=>QD(n),[n]),p=C.useMemo(()=>dT(f),[f]);return l.jsxs("button",{onClick:c,className:K("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",r?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[l.jsx("span",{className:K("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",uT(d)),children:d||"???"}),l.jsx(Df,{provider:m.provider,size:18,withBackground:!0,className:"shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:m.endpoint||"unknown"}),p&&l.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:p,children:p}),l.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[l.jsx(No,{className:"w-2.5 h-2.5"}),l.jsx("span",{children:oT(o)})]})]})]})}function Uy({value:n,className:a,variant:o="outline",size:r="icon",label:c="Copy to clipboard"}){const[d,f]=C.useState(!1),m=()=>{navigator.clipboard.writeText(n),f(!0),setTimeout(()=>f(!1),2e3)};return l.jsx(ji,{children:l.jsxs(Sa,{children:[l.jsx(wa,{asChild:!0,children:l.jsxs(ot,{size:r,variant:o,className:K("relative z-10 text-muted-foreground hover:text-foreground",a),onClick:p=>{p.stopPropagation(),m()},children:[d?l.jsx(wo,{className:"h-3.5 w-3.5 text-green-500"}):l.jsx(Sl,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:c})]})}),l.jsx(Na,{children:l.jsx("p",{children:d?"Copied!":c})})]})})}function As({active:n,onClick:a,children:o,icon:r}){return l.jsxs("button",{onClick:a,className:K("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",n?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[r&&l.jsx(r,{className:"w-3.5 h-3.5"}),o]})}function Kb({code:n}){const a=sT(n);return l.jsx("span",{className:K("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",a),children:n})}function hT({parsed:n}){const{t:a}=Et(),o=lT(n.quotaResetDelay)||cT(n.quotaResetTimestamp),r=a("errorLogs.na");return l.jsx(Do,{className:"h-full",children:l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Kb,{code:n.statusCode}),l.jsx("span",{className:"text-sm font-medium",children:n.statusText}),l.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:rT(n.errorType)})]}),n.model&&l.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[l.jsx(GS,{className:"w-4 h-4 text-violet-500 shrink-0"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.modelLabel")}),l.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:n.model})]})]}),n.errorType==="rate_limit"&&o&&l.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[l.jsx(No,{className:"w-4 h-4 text-amber-500 shrink-0"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.quotaResetsIn")}),l.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:o})]})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.method")}),l.jsx("div",{className:"font-medium",children:n.method||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.provider")}),l.jsx("div",{className:"font-medium",children:n.provider||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.version")}),l.jsx("div",{className:"font-medium",children:n.version||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.endpoint")}),l.jsx("div",{className:"font-medium truncate",title:n.endpoint,children:n.endpoint||r})]})]}),l.jsxs("div",{className:"text-xs",children:[l.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.url")}),l.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:n.url||r})]}),l.jsxs("div",{className:"text-xs",children:[l.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.timestamp")}),l.jsx("div",{className:"font-mono",children:n.timestamp||r})]}),n.errorType!=="unknown"&&l.jsxs("div",{className:K("flex items-start gap-3 p-3 rounded text-xs",n.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":n.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[n.errorType==="rate_limit"?l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):n.errorType==="auth"?l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):l.jsx(Rl,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),l.jsxs("div",{className:K("leading-relaxed",n.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":n.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[n.errorType==="rate_limit"&&(n.model?a("errorLogs.rateLimitedMsg",{model:n.model}):a("errorLogs.rateLimitedMsgNoModel")),n.errorType==="auth"&&a("errorLogs.authFailedMsg"),n.errorType==="not_found"&&a("errorLogs.notFoundMsg"),n.errorType==="server"&&a("errorLogs.serverErrorMsg"),n.errorType==="timeout"&&a("errorLogs.timeoutMsg")]})]})]})})}function mT({headers:n}){const a=Object.entries(n);return a.length===0?l.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):l.jsx(Do,{className:"h-full",children:l.jsx("div",{className:"p-4 space-y-1",children:a.map(([o,r])=>l.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[l.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[o,":"]}),l.jsx("span",{className:"break-all",children:r})]},o))})})}function Hy({content:n,label:a}){const{t:o}=Et();if(!n||n.trim()===""){const d=a==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return l.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:o(d)})}let r=n,c=!1;try{const d=JSON.parse(n);r=JSON.stringify(d,null,2),c=!0}catch{}return l.jsx(Do,{className:"h-full",children:l.jsx("pre",{className:K("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",c?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:r})})}function pT({content:n}){return l.jsx(Do,{className:"h-full",children:l.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:n})})}function gT({name:n,absolutePath:a}){const{t:o}=Et(),[r,c]=C.useState("overview"),{data:d,isLoading:f,error:m}=F1(n),p=C.useMemo(()=>d?XD(d):null,[d]);return n?f?l.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[l.jsx(We,{className:"h-5 w-full"}),l.jsx(We,{className:"h-5 w-3/4"}),l.jsx(We,{className:"h-5 w-5/6"}),l.jsx(We,{className:"h-5 w-2/3"})]}):m||!d||!p?l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsx("p",{className:"text-sm",children:o("errorLogs.failedLoadContent")})}):l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l.jsx(Kb,{code:p.statusCode}),l.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[p.provider,"/",p.endpoint||"unknown"]}),n&&l.jsx(Uy,{value:a||n,label:o("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&l.jsx(Uy,{value:d,label:o("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:p.method})]})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-1 bg-muted/10 shrink-0 overflow-x-auto",children:[l.jsx(As,{active:r==="overview",onClick:()=>c("overview"),icon:Rl,children:o("errorLogs.tabOverview")}),l.jsx(As,{active:r==="headers",onClick:()=>c("headers"),icon:YS,children:o("errorLogs.tabHeaders")}),l.jsx(As,{active:r==="request",onClick:()=>c("request"),icon:Fx,children:o("errorLogs.tabRequest")}),l.jsx(As,{active:r==="response",onClick:()=>c("response"),icon:$S,children:o("errorLogs.tabResponse")}),l.jsx(As,{active:r==="raw",onClick:()=>c("raw"),icon:WS,children:o("errorLogs.tabRaw")})]}),l.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[r==="overview"&&l.jsx(hT,{parsed:p}),r==="headers"&&l.jsx(mT,{headers:p.requestHeaders}),r==="request"&&l.jsx(Hy,{content:p.requestBody,label:"Request"}),r==="response"&&l.jsx(Hy,{content:p.responseBody,label:"Response"}),r==="raw"&&l.jsx(pT,{content:d})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsxs("div",{className:"text-center space-y-3",children:[l.jsx(VS,{className:"w-10 h-10 mx-auto opacity-40"}),l.jsx("p",{className:"text-sm",children:o("errorLogs.selectLog")})]})})}function yT(){const{t:n}=Et(),{data:a,isLoading:o}=U1(),{data:r,isLoading:c,error:d}=q1(a?.running??!1),[f,m]=C.useState(500),[p,y]=C.useState(!1),S=C.useRef(null),x=C.useRef(null),b=()=>{x.current&&(clearInterval(x.current),x.current=null)};C.useEffect(()=>{if(!p)return;const k=w=>{const R=S.current;if(!R)return;const z=R.getBoundingClientRect().top+window.scrollY,F=w.pageY-z;m(Math.max(300,F));const Q=window.innerHeight-w.clientY,ge=15;b(),Q<50?x.current=setInterval(()=>{window.scrollBy(0,ge)},16):w.clientY<50&&(x.current=setInterval(()=>{window.scrollBy(0,-ge)},16))},T=()=>{y(!1),b(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",k),document.addEventListener("mouseup",T),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",T),document.body.style.cursor="default",document.body.style.userSelect="auto",b()}},[p]);const j=k=>{k.preventDefault(),y(!0)},N=C.useMemo(()=>r?.[0]?.name??null,[r]),[E,L]=C.useState(null),O=E??N,D=C.useMemo(()=>!O||!r?void 0:r.find(T=>T.name===O)?.absolutePath,[O,r]);if(o||!a?.running)return null;if(c)return l.jsxs("div",{className:"rounded-xl border border-border overflow-hidden font-mono text-sm bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm h-[500px]",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[l.jsx(We,{className:"h-4 w-32"}),l.jsx(We,{className:"h-4 w-20"})]}),l.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(k=>l.jsx(We,{className:"h-12 w-full rounded-lg"},k))})]});if(!r||r.length===0)return null;const A=r.length;return l.jsxs("div",{ref:S,className:"rounded-xl border border-border overflow-hidden font-mono text-sm text-foreground bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm flex flex-col shadow-sm transition-[height] duration-0 ease-linear relative group/container",style:{height:f},children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-amber-500/10 via-transparent to-transparent dark:from-amber-500/15 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(Gn,{className:"w-4 h-4 text-amber-500"}),l.jsx("span",{className:"text-sm font-semibold tracking-tight",children:n("errorLogs.title")}),l.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:n("errorLogs.failedRequests",{count:A})})]}),l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l.jsx(QS,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:n("errorLogs.cliproxyDiagnostics")})]})]}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsxs(Ef,{direction:"horizontal",children:[l.jsx(qs,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:l.jsxs(Do,{className:"h-full",children:[l.jsx("div",{className:"divide-y divide-border/50",children:r.slice(0,50).map(k=>l.jsx(fT,{name:k.name,size:k.size,modified:k.modified,isSelected:O===k.name,onClick:()=>L(k.name),statusCode:k.statusCode,model:k.model},k.name))}),r.length>50&&l.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:n("errorLogs.showingCount",{total:r.length})})]})}),l.jsxs(Of,{className:"w-[1px] bg-border hover:bg-primary/50 transition-colors flex items-center justify-center group relative z-10 w-2 -ml-1 flex items-center justify-center outline-none",children:[l.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),l.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-4 h-8 rounded-sm flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-muted border border-border",children:l.jsx(Ll,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsx(qs,{className:"flex flex-col min-w-0 bg-background/50",children:l.jsx(gT,{name:O,absolutePath:D})})]})}),d?l.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:d.message}):l.jsx("div",{className:"h-2 bg-border/10 border-t border-border/30 hover:bg-primary/10 transition-colors cursor-row-resize flex items-center justify-center group/handle shrink-0",onMouseDown:j,children:l.jsx(XS,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const xT=_l("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",warning:"border-yellow-200 bg-yellow-50 text-yellow-900 dark:border-yellow-900/50 dark:bg-yellow-900/20 dark:text-yellow-200 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-500",info:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-200 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-500",success:"border-green-200 bg-green-50 text-green-900 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-200 [&>svg]:text-green-600 dark:[&>svg]:text-green-500"}},defaultVariants:{variant:"default"}}),zs=C.forwardRef(({className:n,variant:a,...o},r)=>l.jsx("div",{ref:r,role:"alert",className:K(xT({variant:a}),n),...o}));zs.displayName="Alert";const Tl=C.forwardRef(({className:n,...a},o)=>l.jsx("h5",{ref:o,className:K("mb-1 font-medium leading-none tracking-tight",n),...a}));Tl.displayName="AlertTitle";const Is=C.forwardRef(({className:n,...a},o)=>l.jsx("div",{ref:o,className:K("text-sm [&_p]:leading-relaxed",n),...a}));Is.displayName="AlertDescription";function bT(){return kt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function qb(n,a){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="string"?n.error:a}function Fb(n){const a=n.trim();if(!a)return null;try{return JSON.parse(a)}catch{return null}}function vT(n){const a=n.trim().toLowerCase();return a.startsWith("<!doctype html")||a.startsWith("<html")}function CT(n){if(!n||typeof n!="object")return!1;const a=n;return!(typeof a.content!="string"||"contentPath"in a&&typeof a.contentPath!="string")}async function Gb(n,a){const o=await n.text(),r=Fb(o);if(!n.ok){const c=qb(r,a);throw new Error(c)}if(r===null)throw new Error(a);return r}function ST(){return kt({queryKey:["shared","summary"],queryFn:async()=>{const n=await fetch("/api/shared/summary");return Gb(n,"Failed to fetch shared summary")}})}function WO(n){return kt({queryKey:["shared",n],queryFn:async()=>{const a=await fetch(`/api/shared/${n}`);return Gb(a,`Failed to fetch shared ${n}`)}})}function QO(n,a){return kt({queryKey:["shared",n,"content",a],enabled:typeof a=="string"&&a.length>0,queryFn:async()=>{if(!a)throw new Error("Missing shared item path");const o=new URLSearchParams({type:n,path:a}),r=await fetch(`/api/shared/content?${o.toString()}`),c=await r.text(),d=Fb(c);if(!r.ok)throw new Error(qb(d,`Failed to fetch shared ${n} content`));if(CT(d))return{content:d.content,contentPath:typeof d.contentPath=="string"&&d.contentPath.length>0?d.contentPath:a};if(c.trim().length>0){if(vT(c))throw new Error("Shared content endpoint unavailable. Restart `ccs config` and try again.");return{content:c,contentPath:a}}throw new Error(`Failed to fetch shared ${n} content`)}})}const wT={ok:"success",warning:"warning",error:"error"},NT={default:{iconBg:"bg-muted",iconColor:"text-muted-foreground"},success:{iconBg:"bg-green-600/15",iconColor:"text-green-700 dark:text-green-500"},warning:{iconBg:"bg-amber-500/15",iconColor:"text-amber-700 dark:text-amber-400"},error:{iconBg:"bg-red-600/15",iconColor:"text-red-700 dark:text-red-500"},accent:{iconBg:"bg-accent/15",iconColor:"text-accent"}};function gl({title:n,value:a,icon:o,variant:r="default",onClick:c}){const d=NT[r];return l.jsxs("button",{onClick:c,className:K("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[l.jsx("div",{className:K("flex items-center justify-center w-9 h-9 rounded-md",d.iconBg),children:l.jsx(o,{className:K("w-4 h-4",d.iconColor)})}),l.jsxs("div",{className:"text-left",children:[l.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:n}),l.jsx("p",{className:K("text-lg font-bold font-mono leading-tight",d.iconColor),children:a})]})]})}function kT(){const{t:n}=Et(),a=Jd(),{data:o,isLoading:r}=bT(),{data:c,isLoading:d}=ST();if(r||d)return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(We,{className:"h-12 w-12 rounded-lg"}),l.jsxs("div",{children:[l.jsx(We,{className:"h-7 w-[180px] mb-2"}),l.jsx(We,{className:"h-4 w-[220px]"})]})]}),l.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(m=>l.jsx(We,{className:"h-14 w-28 rounded-lg"},m))})]}),l.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[l.jsx(We,{className:"h-4 w-32"}),l.jsx(We,{className:"h-4 w-20"})]}),l.jsx("div",{className:"px-4 py-3 border-b",children:l.jsx(We,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(m=>l.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[l.jsx(We,{className:"w-2.5 h-2.5 rounded-full"}),l.jsx(We,{className:"h-4 flex-1"}),l.jsx(We,{className:"h-1.5 w-24 rounded-full"}),l.jsx(We,{className:"h-4 w-16"})]},m))]})]});const f=o?.health?wT[o.health.status]:void 0;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[l.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:l.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),l.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[l.jsx(l1,{version:o?.version}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsx(gl,{title:n("home.profiles"),value:o?.profiles??0,icon:Pd,variant:"accent",onClick:()=>a("/providers")}),l.jsx(gl,{title:n("home.cliproxy"),value:o?.cliproxy??0,icon:Px,variant:"accent",onClick:()=>a("/cliproxy")}),l.jsx(gl,{title:n("home.accounts"),value:o?.accounts??0,icon:_x,variant:"default",onClick:()=>a("/accounts")}),l.jsx(gl,{title:n("home.health"),value:o?.health?`${o.health.passed}/${o.health.total}`:"-",icon:Us,variant:f,onClick:()=>a("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&l.jsxs(zs,{variant:"warning",children:[l.jsx(Gn,{className:"h-4 w-4"}),l.jsx(Tl,{children:n("home.configurationRequired")}),l.jsx(Is,{children:c.symlinkStatus.message})]}),l.jsx(CD,{}),l.jsx("div",{className:"rounded-xl border bg-card/70 p-5",children:l.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"rounded-xl bg-muted p-2.5",children:l.jsx(zx,{className:"h-5 w-5 text-muted-foreground"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("h2",{className:"text-lg font-semibold",children:"Logs moved to a dedicated workspace"}),l.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:"Use the unified logs page for source-level filtering, structured entry inspection, and retention policy edits without crowding the home dashboard."})]})]}),l.jsxs(ot,{variant:"outline",className:"gap-2",onClick:()=>a("/logs"),children:["Open logs",l.jsx(ZS,{className:"h-4 w-4"})]})]})}),l.jsx(yT,{})]})}const Vb=cS,Pf=C.forwardRef(({className:n,...a},o)=>l.jsx(Tx,{ref:o,className:K("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...a}));Pf.displayName=Tx.displayName;const jl=C.forwardRef(({className:n,...a},o)=>l.jsx(jx,{ref:o,className:K("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...a}));jl.displayName=jx.displayName;const Yd=C.forwardRef(({className:n,...a},o)=>l.jsx(Mx,{ref:o,className:K("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...a}));Yd.displayName=Mx.displayName;function qt({className:n,...a}){return l.jsx(uS,{"data-slot":"label",className:K("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...a})}const Lf="ccs:openrouter-models",AT=1440*60*1e3,Yb="1";function $d(n){const a=parseFloat(n);return isNaN(a)||a===0?0:a*1e6}function By(n){const a=$d(n);return a===0?"Free":a<.01?"<$0.01":a<1?`$${a.toFixed(2)}`:`$${a.toFixed(a<10?2:0)}`}function DT(n){const a=By(n.prompt),o=By(n.completion);return a==="Free"&&o==="Free"?"Free":`${a}/${o}`}function TT(n){const a=n.id.toLowerCase();return a.startsWith("anthropic/")?"anthropic":a.startsWith("openai/")?"openai":a.startsWith("google/")?"google":a.startsWith("meta-llama/")||a.startsWith("meta/")?"meta":a.startsWith("mistralai/")?"mistral":a.includes(":free")||a.includes("qwen")||a.includes("deepseek")?"opensource":"other"}function jT(n){return{...n,category:TT(n),pricePerMillionPrompt:$d(n.pricing.prompt),pricePerMillionCompletion:$d(n.pricing.completion),isFree:n.pricing.prompt==="0"&&n.pricing.completion==="0",isExacto:n.id.includes(":exacto")}}function MT(n,a,o){const r=a.toLowerCase().trim();return n.filter(c=>o?.category&&c.category!==o.category||o?.freeOnly&&!c.isFree||o?.minContext&&c.context_length<o.minContext?!1:r?c.id.toLowerCase().includes(r)||c.name.toLowerCase().includes(r)||c.description?.toLowerCase().includes(r):!0)}function XO(n){return[...n].sort((a,o)=>{if(a.isFree&&!o.isFree)return-1;if(!a.isFree&&o.isFree)return 1;if(!a.isFree&&!o.isFree){if(a.isExacto&&!o.isExacto)return-1;if(!a.isExacto&&o.isExacto)return 1}return a.name.localeCompare(o.name)})}function ET(){try{const n=localStorage.getItem(Lf);if(!n)return null;const a=JSON.parse(n);return a.version!==Yb||Date.now()-a.fetchedAt>AT?null:a.models}catch{return null}}function OT(n){try{localStorage.setItem(Lf,JSON.stringify({models:n,fetchedAt:Date.now(),version:Yb}))}catch{}}function PT(){localStorage.removeItem(Lf)}function ZO(n,a){const[o]=n.split("/");if(!o)return{};const r=a.filter(f=>f.id.startsWith(`${o}/`));if(r.length===0)return{};const c=[...r].sort((f,m)=>m.pricePerMillionPrompt-f.pricePerMillionPrompt),d=Math.ceil(c.length/3);return{opus:c[0]?.id,sonnet:c[Math.min(d,c.length-1)]?.id,haiku:c[c.length-1]?.id}}function LT(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}const JO={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},RT={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function _T(n,a=2){const o=[],r=["anthropic","openai","google","meta","mistral","opensource"];for(const c of r){const d=RT[c];if(d.length===0)continue;const m=[...n.filter(p=>d.some(y=>p.id.toLowerCase().startsWith(y)))].sort((p,y)=>(y.created??0)-(p.created??0));o.push(...m.slice(0,a))}return o.sort((c,d)=>(d.created??0)-(c.created??0))}function zT(n){const o=Date.now()/1e3-n;return o<86400?"Today":o<172800?"Yesterday":o<604800?`${Math.floor(o/86400)}d ago`:o<2592e3?`${Math.floor(o/604800)}w ago`:o<31536e3?`${Math.floor(o/2592e3)}mo ago`:`${Math.floor(o/31536e3)}y ago`}const IT="https://openrouter.ai/api/v1/models",$b=["openrouter-models"],Ky=1440*60*1e3;async function UT(){const n=await fetch(IT);if(!n.ok)throw new Error(`Failed to fetch OpenRouter models: ${n.status}`);const o=(await n.json()).data;return OT(o),o}function Wb(){return kt({queryKey:$b,queryFn:UT,staleTime:Ky,gcTime:Ky,initialData:()=>ET()??void 0,refetchOnWindowFocus:!1})}function HT(){const n=Wb(),a=(n.data??[]).map(jT);return{...n,models:a}}function eP(){const n=rt();return()=>(PT(),n.invalidateQueries({queryKey:$b}))}function tP(){const{data:n,isLoading:a,isError:o}=Wb();return{isReady:!!n&&n.length>0,isLoading:a,isError:o,modelCount:n?.length??0}}function Rf({profileEnv:n={}}){const[a,o]=C.useState(null),[r,c]=C.useState(!0),[d,f]=C.useState(!1);C.useEffect(()=>{m()},[]);const m=async()=>{try{c(!0);const b=await fetch("/api/global-env");if(!b.ok)throw new Error("Failed to load");const j=await b.json();o(j)}catch{o(null)}finally{c(!1)}};if(r||!a?.enabled)return null;const p=a.env||{},y=Object.keys(p);if(y.length===0)return null;const S=y.filter(b=>!(b in n)),x=y.filter(b=>b in n);return l.jsxs("div",{className:"border-t bg-muted/20",children:[l.jsxs("button",{onClick:()=>f(!d),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[l.jsx(Rl,{className:"w-4 h-4 text-blue-500"}),l.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[l.jsx("span",{className:"font-medium text-foreground",children:S.length})," global env var",S.length!==1?"s":""," will be injected at runtime",x.length>0&&l.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",x.length," overridden by profile)"]})]}),d?l.jsx(tf,{className:"w-4 h-4 text-muted-foreground"}):l.jsx(Pl,{className:"w-4 h-4 text-muted-foreground"})]}),d&&l.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[S.length>0&&l.jsx("div",{className:"space-y-1",children:S.map(b=>l.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-green-500/10 text-green-700 dark:text-green-400 px-2 py-1 rounded",children:[l.jsx("span",{className:"text-green-500",children:"+"}),l.jsxs("span",{className:"truncate",children:[b,"=",p[b]]})]},b))}),x.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),x.map(b=>l.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-amber-500/10 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[l.jsx("span",{className:"text-amber-500",children:"~"}),l.jsx("span",{className:"truncate",children:b})]},b))]}),l.jsx("div",{className:"pt-2 border-t border-border/50",children:l.jsx(ot,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:l.jsxs(Cl,{to:"/settings?tab=globalenv",children:[l.jsx(af,{className:"w-3.5 h-3.5"}),"Configure in Settings",l.jsx(Hx,{className:"w-3 h-3 opacity-50"})]})})})]})]})}function BT({className:n,...a}){return l.jsx(dS,{"data-slot":"switch",className:K("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",n),...a,children:l.jsx(fS,{"data-slot":"switch-thumb",className:K("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}const _f={claude:"Claude Code",droid:"Factory Droid",codex:"Codex CLI"};function KT(n,a){return a==="refreshing"?"Refreshing preview":a==="invalid"?"Saved status":n==="editor"?"Live preview":"Saved status"}function qT(n,a){return n.status==="disabled"?"Disabled globally":a!=="claude"?`${_f[a]} bypasses the hook`:n.nativeReadPreference?"Native image reading":n.status==="hook-missing"?"Setup needed":n.authReadiness==="missing"?"Needs auth":n.proxyReadiness==="unavailable"?"Needs proxy":n.effectiveRuntimeMode==="native-read"?"Native fallback":"Transformer ready"}function FT(n,a){return n.status==="disabled"?{label:"Disabled",className:"border-border/80 bg-background/85 text-muted-foreground"}:a!=="claude"?{label:"Bypassed",className:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200"}:n.nativeReadPreference?{label:"Native",className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}:n.status==="hook-missing"||n.authReadiness==="missing"?{label:n.status==="hook-missing"?"Setup":"Auth",className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:n.proxyReadiness==="unavailable"?{label:"Proxy",className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:{label:"Ready",className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}}function GT(n,a){if(n.nativeReadPreference)return n.profileModel&&n.nativeImageCapable?`${n.profileModel} looks image-ready. CCS will bypass the transformer here.`:n.profileModel?`CCS will prefer native reading for ${n.profileModel}.`:"CCS will prefer native image reading for this profile.";if(!n.backendDisplayName&&a==="claude")return"This profile currently stays on native file access.";if(!n.backendDisplayName)return`Saved Claude-side image routing is inactive while ${_f[a]} is selected.`;const o=n.model?` · ${n.model}`:"";return`Transformer route: ${n.backendDisplayName}${o}.`}function VT(n,a){return n.status==="disabled"?"Image is disabled globally in CCS settings.":a!=="claude"?`Current target ${_f[a]} bypasses the Claude Read hook.`:n.nativeReadPreference?n.nativeImageCapable===!0?null:n.nativeImageReason:n.status==="hook-missing"?"Persist the profile hook before transformer routing can run here.":n.authReadiness==="missing"?n.authReason:n.proxyReadiness==="unavailable"?n.proxyReason:null}function YT({status:n,target:a="claude",source:o="saved",previewState:r="saved",nativeReadPreferenceOverride:c,onToggleNativeRead:d}){if(!n)return l.jsxs("div",{className:"rounded-2xl border bg-muted/20 px-4 py-3","aria-live":"polite",children:[l.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),l.jsx("div",{className:"mt-2 h-3 w-52 animate-pulse rounded bg-muted"})]});const f=c??n.nativeReadPreference,m={...n,nativeReadPreference:f},p=FT(m,a),y=VT(m,a),S=n.nativeImageCapable?"Verified":n.profileModel?"Unknown":null;return l.jsxs("section",{className:"rounded-2xl border bg-background/95 px-4 py-3 shadow-sm",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsx("div",{className:"min-w-0",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"inline-flex h-8 w-8 items-center justify-center rounded-xl border border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:l.jsx(Gx,{className:"h-4 w-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Image"}),l.jsx(Ut,{className:K("h-5 border px-1.5 text-[10px]",p.className),children:p.label})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[KT(o,r)," · ",qT(m,a)]})]})]})}),l.jsx(ot,{size:"sm",variant:"outline",className:"h-8 shrink-0",asChild:!0,children:l.jsxs(Cl,{to:"/settings?tab=image",children:["Open Settings",l.jsx(Fx,{className:"ml-1 h-3.5 w-3.5"})]})})]}),l.jsx("div",{className:"mt-3 rounded-xl border bg-muted/15 px-3 py-3",children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"text-sm font-medium text-foreground",children:"Use native image reading"}),S&&l.jsx(Ut,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:S})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:GT(m,a)})]}),l.jsx(BT,{checked:f,onCheckedChange:d,disabled:!d,"aria-label":"Use native image reading"})]})}),y&&l.jsx("div",{className:"mt-2 rounded-lg border border-border/70 bg-muted/20 px-3 py-2 text-xs leading-5 text-muted-foreground",children:y})]})}const $T=C.lazy(()=>at(()=>Promise.resolve().then(()=>Ql),void 0).then(n=>({default:n.CodeEditor})));function nP({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:o,settings:r,profileTarget:c="claude",imageAnalysisStatus:d,imageAnalysisStatusSource:f="saved",imageAnalysisStatusPreviewState:m="saved",nativeReadPreferenceOverride:p,onToggleNativeRead:y,onChange:S,missingRequiredFields:x=[]}){const b=x.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(kn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[l.jsx(Ao,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&b&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:x.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx($T,{value:n,onChange:S,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx(YT,{status:d,target:c,source:f,previewState:m,nativeReadPreferenceOverride:p,onToggleNativeRead:y})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Rf,{profileEnv:r?.env})})})]})})}function qy(n,a){try{var o=n()}catch(r){return a(r)}return o&&o.then?o.then(void 0,a):o}function WT(n,a){for(var o={};n.length;){var r=n[0],c=r.code,d=r.message,f=r.path.join(".");if(!o[f])if("unionErrors"in r){var m=r.unionErrors[0].errors[0];o[f]={message:m.message,type:m.code}}else o[f]={message:d,type:c};if("unionErrors"in r&&r.unionErrors.forEach(function(S){return S.errors.forEach(function(x){return n.push(x)})}),a){var p=o[f].types,y=p&&p[r.code];o[f]=Vx(f,a,o,c,y?[].concat(y,r.message):r.message)}n.shift()}return o}function QT(n,a){for(var o={};n.length;){var r=n[0],c=r.code,d=r.message,f=r.path.join(".");if(!o[f])if(r.code==="invalid_union"&&r.errors.length>0){var m=r.errors[0][0];o[f]={message:m.message,type:m.code}}else o[f]={message:d,type:c};if(r.code==="invalid_union"&&r.errors.forEach(function(S){return S.forEach(function(x){return n.push(x)})}),a){var p=o[f].types,y=p&&p[r.code];o[f]=Vx(f,a,o,c,y?[].concat(y,r.message):r.message)}n.shift()}return o}function XT(n,a,o){if(o===void 0&&(o={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(n))return function(r,c,d){try{return Promise.resolve(qy(function(){return Promise.resolve(n[o.mode==="sync"?"parse":"parseAsync"](r,a)).then(function(f){return d.shouldUseNativeValidation&&Gg({},d),{errors:{},values:o.raw?Object.assign({},r):f}})},function(f){if((function(m){return Array.isArray(m?.issues)})(f))return{values:{},errors:Vg(WT(f.errors,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw f}))}catch(f){return Promise.reject(f)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(n))return function(r,c,d){try{return Promise.resolve(qy(function(){return Promise.resolve((o.mode==="sync"?Uw:Hw)(n,r,a)).then(function(f){return d.shouldUseNativeValidation&&Gg({},d),{errors:{},values:o.raw?Object.assign({},r):f}})},function(f){if((function(m){return m instanceof Bw})(f))return{values:{},errors:Vg(QT(f.issues,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw f}))}catch(f){return Promise.reject(f)}};throw new Error("Invalid input: not a Zod schema")}const ZT={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function JT({provider:n,className:a,size:o="md"}){const r=PA(n),c=ZT[o],d=fb(n),f=RA(n);return l.jsx("div",{className:K("flex items-center justify-center rounded-md",d&&!f&&(LA(n)?"bg-gray-900 p-1":"bg-white p-1"),c.container,a),children:d?l.jsx("img",{src:d,alt:`${n} logo`,className:K(f?c.container:c.icon,"object-contain")}):l.jsx("span",{className:K("font-semibold",r.textClass,c.text),children:r.letter})})}function aP(){return kt({queryKey:["profiles"],queryFn:()=>He.profiles.list()})}function ej(){const n=rt();return st({mutationFn:a=>He.profiles.create(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Profile created successfully")},onError:a=>{le.error(a.message)}})}function iP(){const n=rt();return st({mutationFn:a=>He.profiles.delete(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Profile deleted successfully")},onError:a=>{le.error(a.message)}})}function oP(){return st({mutationFn:()=>He.profiles.discoverOrphans()})}function sP(){const n=rt();return st({mutationFn:a=>He.profiles.registerOrphans(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Orphan profiles registration complete")}})}function rP(){const n=rt();return st({mutationFn:({name:a,data:o})=>He.profiles.copy(a,o),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Profile copied successfully")}})}function lP(){return st({mutationFn:({name:n,includeSecrets:a})=>He.profiles.export(n,a??!1)})}function cP(){const n=rt();return st({mutationFn:a=>He.profiles.import(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),le.success("Profile imported successfully")}})}const tj="https://openrouter.ai/api",Qb=Object.freeze({glmt:"glm",kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan",hf:"huggingface"}),Xb=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:tj,defaultProfileName:"openrouter",defaultModel:"anthropic/claude-opus-4.5",apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended",requiresApiKey:!0,badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg"},{id:"alibaba-coding-plan",name:"Alibaba Coding Plan",description:"Alibaba Cloud Coding Plan via Anthropic-compatible endpoint",baseUrl:"https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",defaultProfileName:"albb",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-sp-...",apiKeyHint:"Get your Coding Plan key from Alibaba Cloud Model Studio",category:"recommended",requiresApiKey:!0,badge:"Coding Plan",featured:!0,icon:"/assets/providers/alibabacloud-color.svg"},{id:"ollama",name:"Ollama (Local)",description:"Local open-source models via Ollama (32K+ context)",baseUrl:"http://localhost:11434",defaultProfileName:"ollama",defaultModel:"qwen3-coder",apiKeyPlaceholder:"ollama",apiKeyHint:"Install Ollama from ollama.com - no API key needed for local",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/icons/ollama.svg"},{id:"llamacpp",name:"llama.cpp (Local)",description:"Local inference via llama.cpp (LLaMA models)",baseUrl:"http://127.0.0.1:8080",defaultProfileName:"llamacpp",defaultModel:"llama3-8b",apiKeyPlaceholder:"llamacpp",apiKeyHint:"Run llama.cpp server: ./server --host 0.0.0.0 --port 8080 -m model.gguf",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/assets/providers/llama-cpp.svg"},{id:"anthropic",name:"Anthropic (Direct API)",description:"Use your own Anthropic API key (sk-ant-...)",baseUrl:"",defaultProfileName:"anthropic",defaultModel:"claude-sonnet-4-5-20250929",apiKeyPlaceholder:"sk-ant-api03-...",apiKeyHint:"Get key at console.anthropic.com/settings/keys",category:"recommended",requiresApiKey:!0,badge:"Direct",featured:!0,icon:"/assets/providers/claude.svg"},{id:"huggingface",name:"Hugging Face",description:"Inference Providers router via OpenAI-compatible chat completions",baseUrl:"https://router.huggingface.co/v1",defaultProfileName:"hf",defaultModel:"openai/gpt-oss-120b:fastest",apiKeyPlaceholder:"hf_...",apiKeyHint:"Create a User Access Token at hf.co/settings/tokens",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Router"},{id:"glm",name:"GLM",description:"Direct Z.AI Anthropic-compatible API profile",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative",requiresApiKey:!0,badge:"Z.AI",icon:"/icons/zai.svg"},{id:"km",name:"Kimi",description:"Moonshot AI - Fast reasoning model",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-k2-thinking-turbo",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Moonshot AI",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Reasoning",icon:"/icons/kimi.svg"},{id:"foundry",name:"Azure Foundry",description:"Claude via Microsoft Azure AI Foundry",baseUrl:"https://<your-resource>.services.ai.azure.com/api/anthropic",defaultProfileName:"foundry",defaultModel:"claude-sonnet-4-5",apiKeyPlaceholder:"YOUR_AZURE_API_KEY",apiKeyHint:"Create resource at ai.azure.com, get API key from Keys tab",category:"alternative",requiresApiKey:!0,badge:"Azure",icon:"/icons/azure.svg"},{id:"mm",name:"Minimax",description:"M2.1/M2.1-lightning/M2 - multilang coding (1M context)",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M2.1",apiKeyPlaceholder:"YOUR_MINIMAX_API_KEY_HERE",apiKeyHint:"Get your API key at platform.minimax.io",category:"alternative",requiresApiKey:!0,badge:"1M context",icon:"/icons/minimax.svg"},{id:"deepseek",name:"DeepSeek",description:"V3.2 and R1 reasoning model (128K context)",baseUrl:"https://api.deepseek.com/anthropic",defaultProfileName:"deepseek",defaultModel:"deepseek-chat",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key at platform.deepseek.com",category:"alternative",requiresApiKey:!0,badge:"Reasoning",icon:"/icons/deepseek.svg"},{id:"qwen",name:"Qwen",description:"Alibaba Cloud - Qwen3 models (256K-1M context, thinking support)",baseUrl:"https://dashscope-intl.aliyuncs.com/apps/anthropic",defaultProfileName:"qwen-api",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Alibaba Cloud Model Studio",category:"alternative",requiresApiKey:!0,badge:"Alibaba",icon:"/assets/providers/qwen-color.svg"},{id:"ollama-cloud",name:"Ollama Cloud",description:"Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)",baseUrl:"https://ollama.com",defaultProfileName:"ollama-cloud",defaultModel:"glm-5:cloud",apiKeyPlaceholder:"YOUR_OLLAMA_CLOUD_API_KEY",apiKeyHint:"Get your API key at ollama.com",category:"alternative",requiresApiKey:!0,badge:"Cloud",icon:"/icons/ollama.svg"},{id:"novita",name:"Novita AI",description:"Anthropic-compatible API for Claude Code and CCS profiles",baseUrl:"https://api.novita.ai/anthropic",defaultProfileName:"novita",defaultModel:"deepseek/deepseek-v3.2",apiKeyPlaceholder:"YOUR_NOVITA_API_KEY",apiKeyHint:"Get your API key at novita.ai",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible",icon:"/icons/novita.svg"}];function Zb(n){return{...n,extraEnv:n.extraEnv?{...n.extraEnv}:void 0}}function nj(n){const a=Zb(n);return a.extraEnv&&Object.freeze(a.extraEnv),Object.freeze(a)}function aj(n,a){const o=new Set;for(const c of n){const d=c.id.trim().toLowerCase();if(c.id!==d)throw new Error(`Preset ID must be normalized: "${c.id}"`);if(o.has(c.id))throw new Error(`Duplicate preset ID detected: "${c.id}"`);o.add(c.id)}const r=new Set;for(const[c,d]of Object.entries(a)){const f=c.trim().toLowerCase();if(!f)throw new Error("Preset alias keys cannot be empty");if(c!==f)throw new Error(`Preset alias must be normalized: "${c}"`);if(r.has(f))throw new Error(`Duplicate normalized preset alias detected: "${c}"`);if(r.add(f),!o.has(d))throw new Error(`Preset alias "${c}" points to unknown target "${d}"`);if(o.has(f))throw new Error(`Preset alias "${c}" collides with canonical preset ID "${f}"`)}}aj(Xb,Qb);const ij=Object.freeze(Xb.map(nj));function oj(){return ij.map(Zb)}function sj(n){const a=n.trim().toLowerCase();return Qb[a]||a}const rj=oj(),zf=Object.freeze(rj.map(n=>({...n})));function lj(n,a){return a||(n?.requiresApiKey===!1?n.apiKeyPlaceholder||n.id:"")}function cj(n){return zf.filter(a=>a.category===n)}function wd(n){const a=sj(n);return zf.find(o=>o.id===a)}const uj=Za().refine(n=>n.trim().length===0||Za().url().safeParse(n).success,{message:"Invalid URL format"}),dj=Kw({name:Za().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:uj,apiKey:Za(),model:Za().optional(),opusModel:Za().optional(),sonnetModel:Za().optional(),haikuModel:Za().optional(),target:qw(["claude","droid","codex"])}),fj=["/chat/completions","/v1/messages","/messages","/completions"],Ni="custom",Nd="openrouter",Jb=new Set(["ollama","llamacpp"]),kd={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},ev=cj("recommended"),hj=ev.filter(n=>!Jb.has(n.id)),mj=ev.filter(n=>Jb.has(n.id)),pj=zf.filter(n=>n.category!=="recommended");function uP({open:n,onOpenChange:a,onSuccess:o,initialMode:r="openrouter"}){const{t:c}=Et(),d=ej(),[f,m]=C.useState("basic"),[p,y]=C.useState(null),[S,x]=C.useState(!1),[b,j]=C.useState(Nd),[N,E]=C.useState(""),{models:L}=HT(),{register:O,handleSubmit:D,formState:{errors:A},control:k,reset:T,setValue:w}=Fw({resolver:XT(dj),defaultValues:kd}),R=Yg({control:k,name:"baseUrl"}),I=Yg({control:k,name:"target"}),z=C.useCallback($=>{if(!$){T(kd);return}T({...kd,name:$.defaultProfileName,baseUrl:$.baseUrl,model:$.defaultModel,opusModel:$.defaultModel,sonnetModel:$.defaultModel,haikuModel:$.defaultModel,target:$.defaultTarget??"claude"})},[T]),F=C.useMemo(()=>b===Ni?null:wd(b)??null,[b]),ee=C.useMemo(()=>N.trim()?[...MT(L,N)].sort((oe,ue)=>(ue.created??0)-(oe.created??0)).slice(0,20):_T(L,2),[L,N]);C.useEffect(()=>{if(n)if(m("basic"),y(null),x(!1),E(""),r==="normal")j(Ni),z(null);else{const oe=wd(r==="openrouter"?Nd:r);if(oe){j(oe.id),z(oe);return}j(Ni),z(null)}},[n,r,z,T]);const Q=$=>{const oe=wd($);if(oe){j(oe.id),z(oe);return}j(Ni),z(null)},ge=$=>{w("model",$.id),w("opusModel",$.id),w("sonnetModel",$.id),w("haikuModel",$.id),E($.name),le.success(`Applied "${$.name}" to all model tiers`,{duration:2e3})};C.useEffect(()=>{if(R&&b===Ni){const oe=R.toLowerCase();for(const ue of fj)if(oe.endsWith(ue)){const he=R.replace(new RegExp(ue+"$","i"),"");y(`URL ends with "${ue}" - Claude appends this automatically. You likely want: ${he}`);return}}y(null)},[R,b]);const te=async $=>{if(F?.requiresApiKey!==!1&&!$.apiKey){le.error(Fe.t("commonToast.apiKeyRequired"));return}const oe={...$,apiKey:lj(F,$.apiKey)};try{await d.mutateAsync(oe),le.success(`Profile "${oe.name}" created`),o(oe.name),a(!1)}catch(ue){le.error(ue.message||"Failed to create profile")}},ve=!!A.name||!!A.baseUrl||!!A.apiKey,U=!!A.model||!!A.opusModel||!!A.sonnetModel||!!A.haikuModel,Z=d.isPending,ne=F?.id===Nd;return l.jsx(pf,{open:n,onOpenChange:a,children:l.jsxs(gf,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh] !flex !flex-col",children:[l.jsxs(yf,{className:"p-6 pb-4 border-b",children:[l.jsxs(xf,{className:"flex items-center gap-2",children:[l.jsx(Bg,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),l.jsx(bf,{children:"Choose a provider preset or configure a custom API endpoint."})]}),l.jsxs("form",{onSubmit:D(te),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[l.jsx("div",{className:"border-b bg-muted/10 px-6 py-3 space-y-3",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(qt,{className:"text-xs text-muted-foreground",children:c("profileEditor.provider")}),l.jsx("p",{className:"text-xs text-muted-foreground",children:c("profileEditor.providerChooserHint")})]}),l.jsx("span",{className:"pt-0.5 text-[11px] text-muted-foreground",children:c("profileEditor.scrollHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("profileEditor.featuredProviders")}),l.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:l.jsxs("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:[hj.map($=>l.jsx(Ad,{preset:$,isSelected:b===$.id,onClick:()=>Q($.id),density:"featured"},$.id)),l.jsx("div",{className:"mx-1 hidden w-px rounded-full bg-border/70 sm:block"}),l.jsx(gj,{isSelected:b===Ni,onClick:()=>Q(Ni)})]})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("profileEditor.morePresets")}),l.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:l.jsx("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:pj.map($=>l.jsx(Ad,{preset:$,isSelected:b===$.id,onClick:()=>Q($.id),density:"compact"},$.id))})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:"Local Runtimes"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:mj.map($=>l.jsx(Ad,{preset:$,isSelected:b===$.id,onClick:()=>Q($.id),density:"compact"},$.id))})]})]})}),l.jsxs(Vb,{value:f,onValueChange:m,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[l.jsx("div",{className:"px-6 pt-4",children:l.jsxs(Pf,{className:"grid w-full grid-cols-2",children:[l.jsxs(jl,{value:"basic",className:"relative",children:["Basic Information",ve&&l.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),l.jsxs(jl,{value:"models",className:"relative",children:["Model Configuration",U&&l.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[l.jsxs(Yd,{value:"basic",className:"p-6 space-y-4 mt-0",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"name",children:["Profile Name ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Hn,{id:"name",...O("name"),placeholder:"my-api",className:"font-mono"}),A.name?l.jsx("p",{className:"text-xs text-destructive",children:A.name.message}):l.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(qt,{htmlFor:"baseUrl",children:"API Base URL"}),l.jsx(Hn,{id:"baseUrl",...O("baseUrl"),placeholder:"https://api.example.com/v1"}),A.baseUrl?l.jsx("p",{className:"text-xs text-destructive",children:A.baseUrl.message}):p?l.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-600 bg-yellow-50 dark:bg-yellow-900/20 p-2 rounded",children:[l.jsx(Gn,{className:"w-4 h-4 shrink-0 mt-0.5"}),l.jsx("span",{children:p})]}):F?l.jsx("p",{className:"text-xs text-muted-foreground",children:F.baseUrl?`Pre-filled from ${F.name}. You can customize if needed.`:`Optional for ${F.name}. Leave blank to use native Anthropic auth.`}):l.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"apiKey",children:["API Key"," ",F?.requiresApiKey!==!1&&l.jsx("span",{className:"text-destructive",children:"*"}),F?.requiresApiKey===!1&&l.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:"(optional)"})]}),l.jsxs("div",{className:"relative",children:[l.jsx(Hn,{id:"apiKey",type:S?"text":"password",...O("apiKey"),placeholder:F?.requiresApiKey===!1?"Optional - only if auth is enabled":F?.apiKeyPlaceholder??"sk-...",className:"pr-10"}),l.jsx(ot,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>x(!S),tabIndex:-1,children:S?l.jsx(Vs,{className:"h-4 w-4"}):l.jsx(Ys,{className:"h-4 w-4"})})]}),A.apiKey?l.jsx("p",{className:"text-xs text-destructive",children:A.apiKey.message}):F?.requiresApiKey===!1?l.jsx("p",{className:"text-xs text-muted-foreground",children:"Only needed if your local endpoint has authentication enabled"}):F?.apiKeyHint&&l.jsx("p",{className:"text-xs text-muted-foreground",children:F.apiKeyHint})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(qt,{htmlFor:"target",children:"Default Target CLI"}),l.jsxs(hb,{value:I,onValueChange:$=>w("target",$),children:[l.jsx(Nf,{id:"target",children:l.jsx(mb,{})}),l.jsxs(kf,{children:[l.jsx(_s,{value:"claude",children:"Claude Code (default)"}),l.jsx(_s,{value:"droid",children:"Factory Droid"}),l.jsx(_s,{value:"codex",children:"Codex CLI"})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[I==="droid"?l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintPreferredAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-droid"}),"."]}):I==="codex"?l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintPreferredAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsx"}),"."]}):l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintClaudeDefault")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs"}),"."]}),I==="droid"?l.jsxs(l.Fragment,{children:[" ",c("profileEditor.targetHintLegacyAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsd"}),"."]}):I==="codex"?l.jsxs(l.Fragment,{children:[" ",c("profileEditor.targetHintLegacyAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-codex"}),"."]}):null," ",c("profileEditor.targetHintOverride")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),l.jsxs(Yd,{value:"models",className:"p-6 mt-0 space-y-4",children:[l.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 text-blue-800 dark:text-blue-300 rounded-md text-sm border border-blue-100 dark:border-blue-900/30",children:[l.jsx(Rl,{className:"w-5 h-5 shrink-0 mt-0.5"}),l.jsxs("div",{children:[l.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),l.jsx("p",{className:"text-xs opacity-90",children:"Map Claude Code tiers (Opus/Sonnet/Haiku) to models supported by your provider."})]})]}),ne&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{children:"Search Models"}),l.jsx(Hn,{value:N,onChange:$=>E($.target.value),placeholder:"Type to search (e.g., opus, sonnet, gpt-4o)...",onKeyDown:$=>{$.key==="Enter"&&ee.length>0&&($.preventDefault(),ge(ee[0]))}}),l.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:ee.length===0?l.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:N?`No models found for "${N}"`:"Loading models..."}):l.jsxs("div",{className:"p-1",children:[!N&&l.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[l.jsx(JS,{className:"w-3 h-3 text-accent"}),l.jsx("span",{children:"Newest Models"})]}),ee.map($=>l.jsx(yj,{model:$,onClick:()=>ge($),showAge:!N},$.id))]})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"model",children:["Default Model",l.jsx(Ut,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),l.jsx(Hn,{id:"model",...O("model"),placeholder:F?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping",l.jsx(Ut,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),l.jsx(Hn,{id:"sonnetModel",...O("sonnetModel"),placeholder:"e.g. gpt-4o, claude-sonnet-4",className:"font-mono text-sm h-9"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping",l.jsx(Ut,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),l.jsx(Hn,{id:"opusModel",...O("opusModel"),placeholder:"e.g. o1, claude-opus-4.5",className:"font-mono text-sm h-9"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping",l.jsx(Ut,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),l.jsx(Hn,{id:"haikuModel",...O("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3.5-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),l.jsxs(wA,{className:"p-6 pt-4 border-t bg-muted/10",children:[l.jsx(ot,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),l.jsx(ot,{type:"submit",disabled:Z,className:K(Z&&"opacity-80"),children:Z?l.jsxs(l.Fragment,{children:[l.jsx(kn,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Bg,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})]})]})})}function Ad({preset:n,isSelected:a,onClick:o,density:r="compact"}){const c=n.id==="anthropic",d=r==="featured";return l.jsxs("button",{type:"button",onClick:o,className:K("flex flex-none items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all",d?"h-[68px] w-[236px]":"h-[64px] w-[168px]",a?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-border/60 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[l.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background",children:c?l.jsx(JT,{provider:"claude",size:"md",className:"rounded-lg"}):n.icon?l.jsx("img",{src:n.icon,alt:"",className:"h-5 w-5 object-contain"}):l.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/70 text-xs font-semibold text-foreground/70",children:n.name.charAt(0)})}),l.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"truncate text-[13px] font-semibold leading-tight tracking-[-0.01em]",children:n.name}),n.badge&&d&&l.jsx(Ut,{variant:"secondary",className:"inline-flex bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]}),n.badge&&!d&&l.jsx(Ut,{variant:"secondary",className:"inline-flex w-fit bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]})]})}function gj({isSelected:n,onClick:a}){const{t:o}=Et();return l.jsxs("button",{type:"button",onClick:a,className:K("flex h-[68px] w-[236px] flex-none items-center gap-3 rounded-xl border border-dashed px-3 py-2.5 text-left transition-all",n?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-muted-foreground/30 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[l.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-dashed border-current/30 bg-muted/70",children:l.jsx(af,{className:"h-4 w-4 text-muted-foreground"})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsx("div",{className:"text-sm font-semibold leading-tight",children:o("profileEditor.customEndpoint")})})]})}function yj({model:n,onClick:a,showAge:o}){return l.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[l.jsx("span",{className:"flex-1 truncate",children:n.name}),l.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[o&&n.created&&l.jsx(Ut,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:zT(n.created)}),n.isFree?l.jsx(Ut,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:"Free"}):l.jsx("span",{children:DT(n.pricing)}),l.jsx("span",{children:LT(n.context_length)})]})]})}function xj({className:n,...a}){return l.jsx("div",{"data-slot":"card",className:K("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...a})}function bj({className:n,...a}){return l.jsx("div",{"data-slot":"card-header",className:K("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...a})}function vj({className:n,...a}){return l.jsx("div",{"data-slot":"card-title",className:K("leading-none font-semibold",n),...a})}function Cj({className:n,...a}){return l.jsx("div",{"data-slot":"card-description",className:K("text-muted-foreground text-sm",n),...a})}function Sj({className:n,...a}){return l.jsx("div",{"data-slot":"card-content",className:K("px-6",n),...a})}const If="[1m]",Uf=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL"],wj=new Set(Uf);function dP(n){return n.toLowerCase().startsWith("gemini-")}function Hf(n){return n.toLowerCase().endsWith(If.toLowerCase())}function Nj(n){return!n||Hf(n)?n:`${n}${If}`}function tv(n){return n&&(Hf(n)?n.slice(0,-If.length):n)}function fP(n){return wj.has(n)}function kj(n){return tv(n.trim()).replace(/\([^)]+\)$/,"")}function hP(n){return Uf.some(a=>{const o=n[a];return typeof o=="string"&&Hf(o)})}function mP(n,a,o={}){const r={...n};for(const c of Uf){const d=r[c];if(typeof d!="string"||d.trim().length===0)continue;const f=kj(d),m=o.supportsExtendedContext?.(f,c)??!0;r[c]=a&&m?Nj(d):tv(d)}return r}const Aj=["agy","claude","gemini","codex","qwen","kimi","iflow","kiro","ghcp"],pP=Aj.map(n=>({id:n,name:wf(n),description:zA(n)})),Dj=["provider","auth","variant","success"];function gP(n){return n==="account"?1:Dj.indexOf(n)}const yP=mS,xP=gS,bP=pS,Tj=C.forwardRef(({className:n,align:a="center",sideOffset:o=4,...r},c)=>l.jsx(hS,{children:l.jsx(Ex,{ref:c,align:a,sideOffset:o,className:K("z-50 w-80 max-w-[calc(100vw-2rem)] rounded-lg border border-border/70 bg-popover p-4 text-popover-foreground shadow-xl shadow-black/10 outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));Tj.displayName=Ex.displayName;const jj=C.lazy(()=>at(()=>Promise.resolve().then(()=>Ql),void 0).then(n=>({default:n.CodeEditor})));function vP({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:o,onRawJsonChange:r,profileEnv:c,missingRequiredFields:d=[]}){const f=d.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(kn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[l.jsx(Ao,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&f&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:d.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Apply a preset from Model Config tab or add these fields manually. Without them, Claude Code will fail with 404 errors."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(jj,{value:n,onChange:r,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Rf,{profileEnv:c})})})]})})}var Xt={},Fy;function Mj(){if(Fy)return Xt;Fy=1;var n=Xt&&Xt.__assign||function(){return n=Object.assign||function(T){for(var w,R=1,I=arguments.length;R<I;R++){w=arguments[R];for(var z in w)Object.prototype.hasOwnProperty.call(w,z)&&(T[z]=w[z])}return T},n.apply(this,arguments)},a=Xt&&Xt.__createBinding||(Object.create?(function(T,w,R,I){I===void 0&&(I=R);var z=Object.getOwnPropertyDescriptor(w,R);(!z||("get"in z?!w.__esModule:z.writable||z.configurable))&&(z={enumerable:!0,get:function(){return w[R]}}),Object.defineProperty(T,I,z)}):(function(T,w,R,I){I===void 0&&(I=R),T[I]=w[R]})),o=Xt&&Xt.__setModuleDefault||(Object.create?(function(T,w){Object.defineProperty(T,"default",{enumerable:!0,value:w})}):function(T,w){T.default=w}),r=Xt&&Xt.__importStar||function(T){if(T&&T.__esModule)return T;var w={};if(T!=null)for(var R in T)R!=="default"&&Object.prototype.hasOwnProperty.call(T,R)&&a(w,T,R);return o(w,T),w},c=Xt&&Xt.__rest||function(T,w){var R={};for(var I in T)Object.prototype.hasOwnProperty.call(T,I)&&w.indexOf(I)<0&&(R[I]=T[I]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function")for(var z=0,I=Object.getOwnPropertySymbols(T);z<I.length;z++)w.indexOf(I[z])<0&&Object.prototype.propertyIsEnumerable.call(T,I[z])&&(R[I[z]]=T[I[z]]);return R};Object.defineProperty(Xt,"__esModule",{value:!0});var d=r(Zd()),f=89,m=90,p=77,y=57,S=219,x=222,b=192,j=100,N=3e3,E=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),L=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),O="npm__react-simple-code-editor__textarea",D=`
|
|
15
15
|
/**
|
|
16
16
|
* Reset the text fill color so that placeholder is visible
|
|
17
17
|
*/
|
|
@@ -66,4 +66,4 @@ ${d}`,o),this.line=r,this.column=c,this.codeblock=d}}function Ij(n,a){let o=0;fo
|
|
|
66
66
|
`&&f!=="\r"){let m,p=c,y=!1,[S,x]=Qd(n,a-1);for(let N=0;N<S.length;N++){if(N&&(p=y?p[m]:p[m]={}),m=S[N],(y=Object.hasOwn(p,m))&&(typeof p[m]!="object"||d.has(p[m])))throw new Ve("trying to redefine an already defined value",{toml:n,ptr:a});!y&&m==="__proto__"&&Object.defineProperty(p,m,{enumerable:!0,configurable:!0,writable:!0})}if(y)throw new Ve("trying to redefine an already defined value",{toml:n,ptr:a});let[b,j]=Bf(n,x,"}",o-1,r);d.add(b),p[m]=b,a=j}}if(!f)throw new Ve("unfinished table encountered",{toml:n,ptr:a});return[c,a]}function Wj(n,a,o,r){let c=[],d;for(a++;(d=n[a++])!=="]"&&d;){if(d===",")throw new Ve("expected value, found comma",{toml:n,ptr:a-1});if(d==="#")a=Wl(n,a);else if(d!==" "&&d!==" "&&d!==`
|
|
67
67
|
`&&d!=="\r"){let f=Bf(n,a-1,"]",o-1,r);c.push(f[0]),a=f[1]}}if(!d)throw new Ve("unfinished array encountered",{toml:n,ptr:a});return[c,a]}function Yy(n,a,o,r){let c=a,d=o,f,m=!1,p;for(let y=0;y<n.length;y++){if(y){if(c=m?c[f]:c[f]={},d=(p=d[f]).c,r===0&&(p.t===1||p.t===2))return null;if(p.t===2){let S=c.length-1;c=c[S],d=d[S].c}}if(f=n[y],(m=Object.hasOwn(c,f))&&d[f]?.t===0&&d[f]?.d)return null;m||(f==="__proto__"&&(Object.defineProperty(c,f,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(d,f,{enumerable:!0,configurable:!0,writable:!0})),d[f]={t:y<n.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(p=d[f],p.t!==r&&!(r===1&&p.t===3)||(r===2&&(p.d||(p.d=!0,c[f]=[]),c[f].push(c={}),p.c[p.i++]=p={t:1,d:!1,i:0,c:{}}),p.d))return null;if(p.d=!0,r===1)c=m?c[f]:c[f]={};else if(r===0&&m)return null;return[f,c,p.c]}function Qj(n,{maxDepth:a=1e3,integersAsBigInt:o}={}){let r={},c={},d=r,f=c;for(let m=Ca(n,0);m<n.length;){if(n[m]==="["){let p=n[++m]==="[",y=Qd(n,m+=+p,"]");if(p){if(n[y[1]-1]!=="]")throw new Ve("expected end of table declaration",{toml:n,ptr:y[1]-1});y[1]++}let S=Yy(y[0],r,c,p?2:1);if(!S)throw new Ve("trying to redefine an already defined table or value",{toml:n,ptr:m});f=S[2],d=S[1],m=y[1]}else{let p=Qd(n,m),y=Yy(p[0],d,f,0);if(!y)throw new Ve("trying to redefine an already defined table or value",{toml:n,ptr:m});let S=Bf(n,p[1],void 0,a,o);y[1][y[0]]=S[0],m=S[1]}if(m=Ca(n,m,!0),n[m]&&n[m]!==`
|
|
68
68
|
`&&n[m]!=="\r")throw new Ve("each key-value declaration must be followed by an end-of-line",{toml:n,ptr:m});m=Ca(n,m)}return r}const Xj=[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/_SECRET$/,/_SECRET_KEY$/,/^API_KEY$/,/^AUTH_TOKEN$/,/^SECRET$/,/_PASSWORD$/,/^PASSWORD$/,/_CREDENTIAL$/,/_PRIVATE_KEY$/];function Zj(n){return Xj.some(a=>a.test(n))}function Jj(n){if(!n.trim())return{valid:!0};try{return JSON.parse(n),{valid:!0}}catch(a){const r=a.message,c=r.match(/position (\d+)/);if(c){const d=parseInt(c[1],10),f=n.substring(0,d).split(`
|
|
69
|
-
`);return{valid:!1,error:r,line:f.length}}return{valid:!1,error:r}}}function eM(n){if(!n.trim())return{valid:!0};try{return Qj(n),{valid:!0}}catch(a){const o=a.message,r=o.match(/line\s+(\d+)/i);return{valid:!1,error:o,line:r?Number.parseInt(r[1],10):void 0}}}function iv({value:n,onChange:a,language:o="json",readonly:r=!1,className:c,minHeight:d="300px",heightMode:f="content"}){const{isDark:m}=mf(),[p,y]=C.useState(!1),[S,x]=C.useState(!0),b=f==="fill-parent",j=C.useMemo(()=>o==="json"?Jj(n):o==="toml"?eM(n):{valid:!0},[n,o]),N=C.useCallback(E=>l.jsx(Gw,{prism:Rj,theme:m?$g.nightOwl:$g.github,code:E,language:o,children:({tokens:L,getLineProps:O,getTokenProps:D})=>{let A=!1;return l.jsx(l.Fragment,{children:L.map((k,T)=>l.jsx("div",{...O({line:k}),className:K(j.line===T+1&&"bg-destructive/20"),children:k.map((w,R)=>{let I=!1;if(w.types.includes("property")){const F=w.content.replace(/['"]/g,"");Zj(F)?A=!0:A=!1}else(w.types.includes("string")||w.types.includes("number")||w.types.includes("boolean"))&&A?(I=!0,A=!1):w.types.includes("punctuation")&&w.content!==":"&&w.content!=="["&&w.content!=="{"&&(A=!1);const z=D({token:w});return I&&S&&(z.className=K(z.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),l.jsx("span",{...z},R)})},T))})}}),[m,o,j.line,S]);return l.jsxs("div",{className:K("flex min-h-0 flex-col",b&&"h-full",c),style:b?{height:d==="auto"?void 0:d}:void 0,children:[l.jsxs("div",{className:K("relative rounded-md border overflow-hidden","bg-muted/30",b&&"flex min-h-0 flex-1 flex-col",p&&"ring-2 ring-ring ring-offset-2 ring-offset-background",r&&"opacity-70 cursor-not-allowed",!j.valid&&"border-destructive"),"data-slot":"code-editor-surface",children:[l.jsx("div",{className:K(b&&"scrollbar-editor min-h-0 flex-1 overflow-auto"),"data-slot":b?"code-editor-viewport":void 0,children:l.jsx(Oj,{value:n,onValueChange:r?()=>{}:a,highlight:N,padding:12,disabled:r,onFocus:()=>y(!0),onBlur:()=>y(!1),textareaClassName:K("focus:outline-none font-mono text-sm",r&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:d}},m?"dark-editor":"light-editor")}),l.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:l.jsx(ot,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>x(!S),title:S?"Reveal sensitive values":"Mask sensitive values",children:S?l.jsx(Ys,{className:"h-3 w-3"}):l.jsx(Vs,{className:"h-3 w-3"})})})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[j.valid?l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[l.jsx($s,{className:"w-3 h-3 text-green-500"}),"Valid ",o.toUpperCase()]}):l.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[l.jsx(Bs,{className:"w-3 h-3"}),j.error,j.line&&` (line ${j.line})`]}),r&&l.jsx("span",{className:"ml-auto text-muted-foreground",children:"(Read-only)"})]})]})}const Ql=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:iv},Symbol.toStringTag,{value:"Module"})),tM={webSearchConfig:null,webSearchStatus:null,webSearchLoading:!0,webSearchStatusLoading:!0,webSearchSaving:!1,webSearchError:null,webSearchSuccess:!1,globalEnvConfig:null,globalEnvLoading:!0,globalEnvSaving:!1,globalEnvError:null,globalEnvSuccess:!1,proxyConfig:null,proxyLoading:!0,proxySaving:!1,proxyError:null,proxySuccess:!1,proxyTestResult:null,proxyTesting:!1,rawConfig:null,rawConfigLoading:!1};function nM(n,a){switch(a.type){case"SET_WEBSEARCH_CONFIG":return{...n,webSearchConfig:a.payload};case"SET_WEBSEARCH_STATUS":return{...n,webSearchStatus:a.payload};case"SET_WEBSEARCH_LOADING":return{...n,webSearchLoading:a.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...n,webSearchStatusLoading:a.payload};case"SET_WEBSEARCH_SAVING":return{...n,webSearchSaving:a.payload};case"SET_WEBSEARCH_ERROR":return{...n,webSearchError:a.payload};case"SET_WEBSEARCH_SUCCESS":return{...n,webSearchSuccess:a.payload};case"SET_GLOBALENV_CONFIG":return{...n,globalEnvConfig:a.payload};case"SET_GLOBALENV_LOADING":return{...n,globalEnvLoading:a.payload};case"SET_GLOBALENV_SAVING":return{...n,globalEnvSaving:a.payload};case"SET_GLOBALENV_ERROR":return{...n,globalEnvError:a.payload};case"SET_GLOBALENV_SUCCESS":return{...n,globalEnvSuccess:a.payload};case"SET_PROXY_CONFIG":return{...n,proxyConfig:a.payload};case"SET_PROXY_LOADING":return{...n,proxyLoading:a.payload};case"SET_PROXY_SAVING":return{...n,proxySaving:a.payload};case"SET_PROXY_ERROR":return{...n,proxyError:a.payload};case"SET_PROXY_SUCCESS":return{...n,proxySuccess:a.payload};case"SET_PROXY_TEST_RESULT":return{...n,proxyTestResult:a.payload};case"SET_PROXY_TESTING":return{...n,proxyTesting:a.payload};case"SET_RAW_CONFIG":return{...n,rawConfig:a.payload};case"SET_RAW_CONFIG_LOADING":return{...n,rawConfigLoading:a.payload};default:return n}}const ov=C.createContext(null);function aM({children:n}){const[a,o]=C.useReducer(nM,tM);return l.jsx(ov.Provider,{value:{state:a,dispatch:o},children:n})}function sv(){const n=C.useContext(ov);if(!n)throw new Error("useSettingsContext must be used within a SettingsProvider");return n}function iM(){const{dispatch:n}=sv(),a=C.useCallback(w=>n({type:"SET_WEBSEARCH_CONFIG",payload:w}),[n]),o=C.useCallback(w=>n({type:"SET_WEBSEARCH_STATUS",payload:w}),[n]),r=C.useCallback(w=>n({type:"SET_WEBSEARCH_LOADING",payload:w}),[n]),c=C.useCallback(w=>n({type:"SET_WEBSEARCH_STATUS_LOADING",payload:w}),[n]),d=C.useCallback(w=>n({type:"SET_WEBSEARCH_SAVING",payload:w}),[n]),f=C.useCallback(w=>n({type:"SET_WEBSEARCH_ERROR",payload:w}),[n]),m=C.useCallback(w=>n({type:"SET_WEBSEARCH_SUCCESS",payload:w}),[n]),p=C.useCallback(w=>n({type:"SET_GLOBALENV_CONFIG",payload:w}),[n]),y=C.useCallback(w=>n({type:"SET_GLOBALENV_LOADING",payload:w}),[n]),S=C.useCallback(w=>n({type:"SET_GLOBALENV_SAVING",payload:w}),[n]),x=C.useCallback(w=>n({type:"SET_GLOBALENV_ERROR",payload:w}),[n]),b=C.useCallback(w=>n({type:"SET_GLOBALENV_SUCCESS",payload:w}),[n]),j=C.useCallback(w=>n({type:"SET_PROXY_CONFIG",payload:w}),[n]),N=C.useCallback(w=>n({type:"SET_PROXY_LOADING",payload:w}),[n]),E=C.useCallback(w=>n({type:"SET_PROXY_SAVING",payload:w}),[n]),L=C.useCallback(w=>n({type:"SET_PROXY_ERROR",payload:w}),[n]),O=C.useCallback(w=>n({type:"SET_PROXY_SUCCESS",payload:w}),[n]),D=C.useCallback(w=>n({type:"SET_PROXY_TEST_RESULT",payload:w}),[n]),A=C.useCallback(w=>n({type:"SET_PROXY_TESTING",payload:w}),[n]),k=C.useCallback(w=>n({type:"SET_RAW_CONFIG",payload:w}),[n]),T=C.useCallback(w=>n({type:"SET_RAW_CONFIG_LOADING",payload:w}),[n]);return C.useMemo(()=>({setWebSearchConfig:a,setWebSearchStatus:o,setWebSearchLoading:r,setWebSearchStatusLoading:c,setWebSearchSaving:d,setWebSearchError:f,setWebSearchSuccess:m,setGlobalEnvConfig:p,setGlobalEnvLoading:y,setGlobalEnvSaving:S,setGlobalEnvError:x,setGlobalEnvSuccess:b,setProxyConfig:j,setProxyLoading:N,setProxySaving:E,setProxyError:L,setProxySuccess:O,setProxyTestResult:D,setProxyTesting:A,setRawConfig:k,setRawConfigLoading:T}),[a,o,r,c,d,f,m,p,y,S,x,b,j,N,E,L,O,D,A,k,T])}function oM(){const[n,a]=vS(),o=n.get("tab")?.toLowerCase(),r=o==="imageanalysis"||o==="image"?"image":o==="channels"?"channels":o==="globalenv"?"globalenv":o==="proxy"?"proxy":o==="auth"?"auth":o==="thinking"?"thinking":o==="backups"?"backups":"websearch",c=C.useCallback(d=>{a({tab:d},{replace:!0})},[a]);return{activeTab:r,setActiveTab:c}}function sM(){const{state:n}=sv(),a=iM(),[o,r]=C.useState(!1),c=C.useCallback(async()=>{try{a.setRawConfigLoading(!0);const f=await fetch("/api/config/raw");if(!f.ok){a.setRawConfig(null);return}const m=await f.text();a.setRawConfig(m)}catch{a.setRawConfig(null)}finally{a.setRawConfigLoading(!1)}},[a]),d=C.useCallback(async()=>{if(n.rawConfig)try{await navigator.clipboard.writeText(n.rawConfig),r(!0),setTimeout(()=>r(!1),2e3)}catch{}},[n.rawConfig]);return{rawConfig:n.rawConfig,loading:n.rawConfigLoading,copied:o,fetchRawConfig:c,copyToClipboard:d}}function $y({activeTab:n,onTabChange:a}){const{t:o}=Et(),r=[{value:"websearch",label:o("settingsTabs.web"),icon:Kx},{value:"image",label:"Image",icon:Gx},{value:"channels",label:"Channels",icon:ew},{value:"globalenv",label:o("settingsTabs.env"),icon:af},{value:"thinking",label:o("settingsTabs.think"),icon:tw},{value:"proxy",label:o("settingsTabs.proxy"),icon:nw},{value:"auth",label:o("settingsTabs.auth"),icon:ef},{value:"backups",label:o("settingsTabs.backup"),icon:aw}];return l.jsx(Vb,{value:n,onValueChange:c=>a(c),children:l.jsx(Pf,{className:"grid w-full grid-cols-8",children:r.map(({value:c,label:d,icon:f})=>l.jsxs(jl,{value:c,className:"gap-1.5 px-2 text-xs",children:[l.jsx(f,{className:"h-3.5 w-3.5 shrink-0"}),l.jsx("span",{className:"truncate",children:d})]},c))})})}function Wy(){return l.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[l.jsx(We,{className:"h-4 w-2/3"}),l.jsx("div",{className:"p-4 rounded-lg border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{className:"h-5 w-32"}),l.jsx(We,{className:"h-4 w-48"})]}),l.jsx(We,{className:"h-6 w-10 rounded-full"})]})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(We,{className:"h-5 w-24"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{className:"h-20 w-full rounded-lg"}),l.jsx(We,{className:"h-20 w-full rounded-lg"}),l.jsx(We,{className:"h-20 w-full rounded-lg"})]})]})]})}function rv(n,a=3,o=1e3){return n().catch(r=>{if(a<=0)throw r;return new Promise(c=>setTimeout(c,o)).then(()=>rv(n,a-1,o*2))})}function ti(n){return C.lazy(()=>rv(n))}const Qy=ti(()=>at(()=>import("./index-ChCDerjX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Xy=ti(()=>at(()=>import("./index-COgxkmyB.js"),__vite__mapDeps([10,1,2,4,5,6,7,8,9]))),Zy=ti(()=>at(()=>import("./channels-CXmV9gwU.js"),__vite__mapDeps([11,1,2,4,5,6,7,8,9]))),Jy=ti(()=>at(()=>import("./globalenv-section-Cwav5LU1.js"),__vite__mapDeps([12,1,2,4,5,6,7,8,9]))),ex=ti(()=>at(()=>import("./index-BwpceYga.js"),__vite__mapDeps([13,1,2,4,5,6,7,8,9]))),tx=ti(()=>at(()=>import("./index-D6eRghE-.js"),__vite__mapDeps([14,1,2,15,4,16,17,5,6,18,7,8,9]))),nx=ti(()=>at(()=>import("./auth-section-B8ptHr9t.js"),__vite__mapDeps([19,1,2,4,5,6,7,8,9]))),ax=ti(()=>at(()=>import("./backups-section-m6vX118k.js"),__vite__mapDeps([20,1,2,17,4,5,6,7,8,9])));class ix extends C.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){return this.state.hasError?l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsxs("div",{className:"text-center p-6 max-w-md",children:[l.jsx(Bs,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),l.jsx("p",{className:"font-medium text-foreground mb-2",children:Fe.t("settings.sectionLoadFailed")}),l.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||Fe.t("settings.unknownError")}),l.jsxs(ot,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[l.jsx(Hs,{className:"w-4 h-4"}),Fe.t("settings.reloadPage")]})]})}):this.props.children}}function rM(){const{t:n}=Et(),{activeTab:a,setActiveTab:o}=oM(),{rawConfig:r,loading:c,copied:d,fetchRawConfig:f,copyToClipboard:m}=sM();C.useEffect(()=>{f()},[f]);const p=y=>{C.startTransition(()=>{o(y)})};return l.jsxs("div",{className:"h-full min-h-0",children:[l.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[l.jsx("div",{className:"border-b bg-background p-4",children:l.jsx($y,{activeTab:a,onTabChange:p})}),l.jsx(ix,{children:l.jsxs(C.Suspense,{fallback:l.jsx(Wy,{}),children:[a==="websearch"&&l.jsx(Qy,{}),a==="image"&&l.jsx(Xy,{}),a==="channels"&&l.jsx(Zy,{}),a==="globalenv"&&l.jsx(Jy,{}),a==="thinking"&&l.jsx(ex,{}),a==="proxy"&&l.jsx(tx,{}),a==="auth"&&l.jsx(nx,{}),a==="backups"&&l.jsx(ax,{})]})})]}),l.jsxs(Ef,{direction:"horizontal",className:"h-full hidden md:flex",children:[l.jsx(qs,{defaultSize:46,minSize:36,maxSize:62,children:l.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[l.jsx("div",{className:"p-5 border-b bg-background",children:l.jsx($y,{activeTab:a,onTabChange:p})}),l.jsx(ix,{children:l.jsxs(C.Suspense,{fallback:l.jsx(Wy,{}),children:[a==="websearch"&&l.jsx(Qy,{}),a==="image"&&l.jsx(Xy,{}),a==="channels"&&l.jsx(Zy,{}),a==="globalenv"&&l.jsx(Jy,{}),a==="thinking"&&l.jsx(ex,{}),a==="proxy"&&l.jsx(tx,{}),a==="auth"&&l.jsx(nx,{}),a==="backups"&&l.jsx(ax,{})]})})]})}),l.jsx(Of,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:l.jsx(Ll,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),l.jsx(qs,{defaultSize:54,minSize:35,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Kg,{className:"w-5 h-5 text-primary"}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-semibold",children:"config.yaml"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ot,{variant:"outline",size:"sm",onClick:m,disabled:!r,children:d?l.jsxs(l.Fragment,{children:[l.jsx(wo,{className:"w-4 h-4 mr-1"}),n("settings.copied")]}):l.jsxs(l.Fragment,{children:[l.jsx(Sl,{className:"w-4 h-4 mr-1"}),n("settings.copy")]})}),l.jsx(ot,{variant:"outline",size:"sm",onClick:f,disabled:c,children:l.jsx(Hs,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:r?l.jsx(iv,{value:r,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):c?l.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[l.jsx(Hs,{className:"w-5 h-5 animate-spin mr-2"}),n("settings.loading")]}):l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:l.jsxs("div",{className:"text-center",children:[l.jsx(Kg,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),l.jsx("p",{children:n("settings.configFileNotFound")}),l.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function lM(){return l.jsx(aM,{children:l.jsx(rM,{})})}const cM=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:lM},Symbol.toStringTag,{value:"Module"}));function uM(n,a,o="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:o}).format(a).split(/\s/g).slice(2).join(" ")}const dM={},Os={};function ki(n,a){try{const r=(dM[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(a).split("GMT")[1];return r in Os?Os[r]:ox(r,r.split(":"))}catch{if(n in Os)return Os[n];const o=n?.match(fM);return o?ox(n,o.slice(1)):NaN}}const fM=/([+-]\d\d):?(\d\d)?/;function ox(n,a){const o=+(a[0]||0),r=+(a[1]||0),c=+(a[2]||0)/60;return Os[n]=o*60+r>0?o*60+r+c:o*60-r-c}class qn extends Date{constructor(...a){super(),a.length>1&&typeof a[a.length-1]=="string"&&(this.timeZone=a.pop()),this.internal=new Date,isNaN(ki(this.timeZone,this))?this.setTime(NaN):a.length?typeof a[0]=="number"&&(a.length===1||a.length===2&&typeof a[1]!="number")?this.setTime(a[0]):typeof a[0]=="string"?this.setTime(+new Date(a[0])):a[0]instanceof Date?this.setTime(+a[0]):(this.setTime(+new Date(...a)),lv(this),Xd(this)):this.setTime(Date.now())}static tz(a,...o){return o.length?new qn(...o,a):new qn(Date.now(),a)}withTimeZone(a){return new qn(+this,a)}getTimezoneOffset(){const a=-ki(this.timeZone,this);return a>0?Math.floor(a):Math.ceil(a)}setTime(a){return Date.prototype.setTime.apply(this,arguments),Xd(this),+this}[Symbol.for("constructDateFrom")](a){return new qn(+new Date(a),this.timeZone)}}const sx=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!sx.test(n))return;const a=n.replace(sx,"$1UTC");qn.prototype[a]&&(n.startsWith("get")?qn.prototype[n]=function(){return this.internal[a]()}:(qn.prototype[n]=function(){return Date.prototype[a].apply(this.internal,arguments),hM(this),+this},qn.prototype[a]=function(){return Date.prototype[a].apply(this,arguments),Xd(this),+this}))});function Xd(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-ki(n.timeZone,n)*60))}function hM(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),lv(n)}function lv(n){const a=ki(n.timeZone,n),o=a>0?Math.floor(a):Math.ceil(a),r=new Date(+n);r.setUTCHours(r.getUTCHours()-1);const c=-new Date(+n).getTimezoneOffset(),d=-new Date(+r).getTimezoneOffset(),f=c-d,m=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();f&&m&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+f);const p=c-o;p&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+p);const y=new Date(+n);y.setUTCSeconds(0);const S=c>0?y.getSeconds():(y.getSeconds()-60)%60,x=Math.round(-(ki(n.timeZone,n)*60))%60;(x||S)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+x),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+x+S));const b=ki(n.timeZone,n),j=b>0?Math.floor(b):Math.ceil(b),E=-new Date(+n).getTimezoneOffset()-j,L=j!==o,O=E-p;if(L&&O){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+O);const D=ki(n.timeZone,n),A=D>0?Math.floor(D):Math.ceil(D),k=j-A;k&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+k))}}class xa extends qn{static tz(a,...o){return o.length?new xa(...o,a):new xa(Date.now(),a)}toISOString(){const[a,o,r]=this.tzComponents(),c=`${a}${o}:${r}`;return this.internal.toISOString().slice(0,-1)+c}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[a,o,r,c]=this.internal.toUTCString().split(" ");return`${a?.slice(0,-1)} ${r} ${o} ${c}`}toTimeString(){const a=this.internal.toUTCString().split(" ")[4],[o,r,c]=this.tzComponents();return`${a} GMT${o}${r}${c} (${uM(this.timeZone,this)})`}toLocaleString(a,o){return Date.prototype.toLocaleString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}toLocaleDateString(a,o){return Date.prototype.toLocaleDateString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}toLocaleTimeString(a,o){return Date.prototype.toLocaleTimeString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}tzComponents(){const a=this.getTimezoneOffset(),o=a>0?"-":"+",r=String(Math.floor(Math.abs(a)/60)).padStart(2,"0"),c=String(Math.abs(a)%60).padStart(2,"0");return[o,r,c]}withTimeZone(a){return new xa(+this,a)}[Symbol.for("constructDateFrom")](a){return new xa(+new Date(a),this.timeZone)}}const rx=5,mM=4;function pM(n,a){const o=a.startOfMonth(n),r=o.getDay()>0?o.getDay():7,c=a.addDays(n,-r+1),d=a.addDays(c,rx*7-1);return a.getMonth(n)===a.getMonth(d)?rx:mM}function cv(n,a){const o=a.startOfMonth(n),r=o.getDay();return r===1?o:r===0?a.addDays(o,-6):a.addDays(o,-1*(r-1))}function gM(n,a){const o=cv(n,a),r=pM(n,a);return a.addDays(o,r*7-1)}const uv={...ws,labels:{labelDayButton:(n,a,o,r)=>{let c;r&&typeof r.format=="function"?c=r.format.bind(r):c=(f,m)=>Ds(f,m,{locale:ws,...o});let d=c(n,"PPPP");return a.today&&(d=`Today, ${d}`),a.selected&&(d=`${d}, selected`),d},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:n=>`Week ${n}`,labelYearDropdown:"Choose the Year",labelGrid:(n,a,o)=>{let r;return o&&typeof o.format=="function"?r=o.format.bind(o):r=(c,d)=>Ds(c,d,{locale:ws,...a}),r(n,"LLLL yyyy")},labelGridcell:(n,a,o,r)=>{let c;r&&typeof r.format=="function"?c=r.format.bind(r):c=(f,m)=>Ds(f,m,{locale:ws,...o});let d=c(n,"PPPP");return a?.today&&(d=`Today, ${d}`),d},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,a,o)=>{let r;return o&&typeof o.format=="function"?r=o.format.bind(o):r=(c,d)=>Ds(c,d,{locale:ws,...a}),r(n,"cccc")}}};class hn{constructor(a,o){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?xa.tz(this.options.timeZone):new this.Date,this.newDate=(r,c,d)=>this.overrides?.newDate?this.overrides.newDate(r,c,d):this.options.timeZone?new xa(r,c,d,this.options.timeZone):new Date(r,c,d),this.addDays=(r,c)=>this.overrides?.addDays?this.overrides.addDays(r,c):lw(r,c),this.addMonths=(r,c)=>this.overrides?.addMonths?this.overrides.addMonths(r,c):cw(r,c),this.addWeeks=(r,c)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,c):uw(r,c),this.addYears=(r,c)=>this.overrides?.addYears?this.overrides.addYears(r,c):dw(r,c),this.differenceInCalendarDays=(r,c)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,c):fw(r,c),this.differenceInCalendarMonths=(r,c)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,c):hw(r,c),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):mw(r),this.eachYearOfInterval=r=>{const c=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):pw(r),d=new Set(c.map(m=>this.getYear(m)));if(d.size===c.length)return c;const f=[];return d.forEach(m=>{f.push(new Date(m,0,1))}),f},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):gM(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):gw(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):yw(r),this.endOfWeek=(r,c)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,c):xw(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):bw(r),this.format=(r,c,d)=>{const f=this.overrides?.format?this.overrides.format(r,c,this.options):Ds(r,c,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(f):f},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vw(r),this.getMonth=(r,c)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Cw(r,this.options),this.getYear=(r,c)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Sw(r,this.options),this.getWeek=(r,c)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):ww(r,this.options),this.isAfter=(r,c)=>this.overrides?.isAfter?this.overrides.isAfter(r,c):Nw(r,c),this.isBefore=(r,c)=>this.overrides?.isBefore?this.overrides.isBefore(r,c):kw(r,c),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Aw(r),this.isSameDay=(r,c)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,c):Dw(r,c),this.isSameMonth=(r,c)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,c):Tw(r,c),this.isSameYear=(r,c)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,c):jw(r,c),this.max=r=>this.overrides?.max?this.overrides.max(r):Mw(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Ew(r),this.setMonth=(r,c)=>this.overrides?.setMonth?this.overrides.setMonth(r,c):Ow(r,c),this.setYear=(r,c)=>this.overrides?.setYear?this.overrides.setYear(r,c):Pw(r,c),this.startOfBroadcastWeek=(r,c)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):cv(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Lw(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Rw(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):_w(r),this.startOfWeek=(r,c)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):zw(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):Iw(r),this.options={locale:uv,...a},this.overrides=o}getDigitMap(){const{numerals:a="latn"}=this.options,o=new Intl.NumberFormat("en-US",{numberingSystem:a}),r={};for(let c=0;c<10;c++)r[c.toString()]=o.format(c);return r}replaceDigits(a){const o=this.getDigitMap();return a.replace(/\d/g,r=>o[r]||r)}formatNumber(a){return this.replaceDigits(a.toString())}getMonthYearOrder(){const a=this.options.locale?.code;return a&&hn.yearFirstLocales.has(a)?"year-first":"month-first"}formatMonthYear(a){const{locale:o,timeZone:r,numerals:c}=this.options,d=o?.code;if(d&&hn.yearFirstLocales.has(d))try{return new Intl.DateTimeFormat(d,{month:"long",year:"numeric",timeZone:r,numberingSystem:c}).format(a)}catch{}const f=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(a,f)}}hn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Vn=new hn;class dv{constructor(a,o,r=Vn){this.date=a,this.displayMonth=o,this.outside=!!(o&&!r.isSameMonth(a,o)),this.dateLib=r,this.isoDate=r.format(a,"yyyy-MM-dd"),this.displayMonthId=r.format(o,"yyyy-MM"),this.dateMonthId=r.format(a,"yyyy-MM")}isEqualTo(a){return this.dateLib.isSameDay(a.date,this.date)&&this.dateLib.isSameMonth(a.displayMonth,this.displayMonth)}}class yM{constructor(a,o){this.date=a,this.weeks=o}}class xM{constructor(a,o){this.days=o,this.weekNumber=a}}function bM(n){return ce.createElement("button",{...n})}function vM(n){return ce.createElement("span",{...n})}function CM(n){const{size:a=24,orientation:o="left",className:r}=n;return ce.createElement("svg",{className:r,width:a,height:a,viewBox:"0 0 24 24"},o==="up"&&ce.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),o==="down"&&ce.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),o==="left"&&ce.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),o==="right"&&ce.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function SM(n){const{day:a,modifiers:o,...r}=n;return ce.createElement("td",{...r})}function wM(n){const{day:a,modifiers:o,...r}=n,c=ce.useRef(null);return ce.useEffect(()=>{o.focused&&c.current?.focus()},[o.focused]),ce.createElement("button",{ref:c,...r})}var xe;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(xe||(xe={}));var ht;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(ht||(ht={}));var En;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(En||(En={}));var fn;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(fn||(fn={}));function NM(n){const{options:a,className:o,components:r,classNames:c,...d}=n,f=[c[xe.Dropdown],o].join(" "),m=a?.find(({value:p})=>p===d.value);return ce.createElement("span",{"data-disabled":d.disabled,className:c[xe.DropdownRoot]},ce.createElement(r.Select,{className:f,...d},a?.map(({value:p,label:y,disabled:S})=>ce.createElement(r.Option,{key:p,value:p,disabled:S},y))),ce.createElement("span",{className:c[xe.CaptionLabel],"aria-hidden":!0},m?.label,ce.createElement(r.Chevron,{orientation:"down",size:18,className:c[xe.Chevron]})))}function kM(n){return ce.createElement("div",{...n})}function AM(n){return ce.createElement("div",{...n})}function DM(n){const{calendarMonth:a,displayIndex:o,...r}=n;return ce.createElement("div",{...r},n.children)}function TM(n){const{calendarMonth:a,displayIndex:o,...r}=n;return ce.createElement("div",{...r})}function jM(n){return ce.createElement("table",{...n})}function MM(n){return ce.createElement("div",{...n})}const fv=C.createContext(void 0);function Xs(){const n=C.useContext(fv);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function EM(n){const{components:a}=Xs();return ce.createElement(a.Dropdown,{...n})}function OM(n){const{onPreviousClick:a,onNextClick:o,previousMonth:r,nextMonth:c,...d}=n,{components:f,classNames:m,labels:{labelPrevious:p,labelNext:y}}=Xs(),S=C.useCallback(b=>{c&&o?.(b)},[c,o]),x=C.useCallback(b=>{r&&a?.(b)},[r,a]);return ce.createElement("nav",{...d},ce.createElement(f.PreviousMonthButton,{type:"button",className:m[xe.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":p(r),onClick:x},ce.createElement(f.Chevron,{disabled:r?void 0:!0,className:m[xe.Chevron],orientation:"left"})),ce.createElement(f.NextMonthButton,{type:"button",className:m[xe.NextMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":y(c),onClick:S},ce.createElement(f.Chevron,{disabled:c?void 0:!0,orientation:"right",className:m[xe.Chevron]})))}function PM(n){const{components:a}=Xs();return ce.createElement(a.Button,{...n})}function LM(n){return ce.createElement("option",{...n})}function RM(n){const{components:a}=Xs();return ce.createElement(a.Button,{...n})}function _M(n){const{rootRef:a,...o}=n;return ce.createElement("div",{...o,ref:a})}function zM(n){return ce.createElement("select",{...n})}function IM(n){const{week:a,...o}=n;return ce.createElement("tr",{...o})}function UM(n){return ce.createElement("th",{...n})}function HM(n){return ce.createElement("thead",{"aria-hidden":!0},ce.createElement("tr",{...n}))}function BM(n){const{week:a,...o}=n;return ce.createElement("th",{...o})}function KM(n){return ce.createElement("th",{...n})}function qM(n){return ce.createElement("tbody",{...n})}function FM(n){const{components:a}=Xs();return ce.createElement(a.Dropdown,{...n})}const GM=Object.freeze(Object.defineProperty({__proto__:null,Button:bM,CaptionLabel:vM,Chevron:CM,Day:SM,DayButton:wM,Dropdown:NM,DropdownNav:kM,Footer:AM,Month:DM,MonthCaption:TM,MonthGrid:jM,Months:MM,MonthsDropdown:EM,Nav:OM,NextMonthButton:PM,Option:LM,PreviousMonthButton:RM,Root:_M,Select:zM,Week:IM,WeekNumber:BM,WeekNumberHeader:KM,Weekday:UM,Weekdays:HM,Weeks:qM,YearsDropdown:FM},Symbol.toStringTag,{value:"Module"}));function ba(n,a,o=!1,r=Vn){let{from:c,to:d}=n;const{differenceInCalendarDays:f,isSameDay:m}=r;return c&&d?(f(d,c)<0&&([c,d]=[d,c]),f(a,c)>=(o?1:0)&&f(d,a)>=(o?1:0)):!o&&d?m(d,a):!o&&c?m(c,a):!1}function Kf(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Xl(n){return!!(n&&typeof n=="object"&&"from"in n)}function qf(n){return!!(n&&typeof n=="object"&&"after"in n)}function Ff(n){return!!(n&&typeof n=="object"&&"before"in n)}function hv(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function mv(n,a){return Array.isArray(n)&&n.every(a.isDate)}function va(n,a,o=Vn){const r=Array.isArray(a)?a:[a],{isSameDay:c,differenceInCalendarDays:d,isAfter:f}=o;return r.some(m=>{if(typeof m=="boolean")return m;if(o.isDate(m))return c(n,m);if(mv(m,o))return m.some(p=>c(n,p));if(Xl(m))return ba(m,n,!1,o);if(hv(m))return Array.isArray(m.dayOfWeek)?m.dayOfWeek.includes(n.getDay()):m.dayOfWeek===n.getDay();if(Kf(m)){const p=d(m.before,n),y=d(m.after,n),S=p>0,x=y<0;return f(m.before,m.after)?x&&S:S||x}return qf(m)?d(n,m.after)>0:Ff(m)?d(m.before,n)>0:typeof m=="function"?m(n):!1})}function VM(n,a,o,r,c){const{disabled:d,hidden:f,modifiers:m,showOutsideDays:p,broadcastCalendar:y,today:S=c.today()}=a,{isSameDay:x,isSameMonth:b,startOfMonth:j,isBefore:N,endOfMonth:E,isAfter:L}=c,O=o&&j(o),D=r&&E(r),A={[ht.focused]:[],[ht.outside]:[],[ht.disabled]:[],[ht.hidden]:[],[ht.today]:[]},k={};for(const T of n){const{date:w,displayMonth:R}=T,I=!!(R&&!b(w,R)),z=!!(O&&N(w,O)),F=!!(D&&L(w,D)),ee=!!(d&&va(w,d,c)),Q=!!(f&&va(w,f,c))||z||F||!y&&!p&&I||y&&p===!1&&I,ge=x(w,S);I&&A.outside.push(T),ee&&A.disabled.push(T),Q&&A.hidden.push(T),ge&&A.today.push(T),m&&Object.keys(m).forEach(te=>{const ve=m?.[te];ve&&va(w,ve,c)&&(k[te]?k[te].push(T):k[te]=[T])})}return T=>{const w={[ht.focused]:!1,[ht.disabled]:!1,[ht.hidden]:!1,[ht.outside]:!1,[ht.today]:!1},R={};for(const I in A){const z=A[I];w[I]=z.some(F=>F===T)}for(const I in k)R[I]=k[I].some(z=>z===T);return{...w,...R}}}function YM(n,a,o={}){return Object.entries(n).filter(([,c])=>c===!0).reduce((c,[d])=>(o[d]?c.push(o[d]):a[ht[d]]?c.push(a[ht[d]]):a[En[d]]&&c.push(a[En[d]]),c),[a[xe.Day]])}function $M(n){return{...GM,...n}}function WM(n){const a={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([o,r])=>{o.startsWith("data-")&&(a[o]=r)}),a}function QM(){const n={};for(const a in xe)n[xe[a]]=`rdp-${xe[a]}`;for(const a in ht)n[ht[a]]=`rdp-${ht[a]}`;for(const a in En)n[En[a]]=`rdp-${En[a]}`;for(const a in fn)n[fn[a]]=`rdp-${fn[a]}`;return n}function pv(n,a,o){return(o??new hn(a)).formatMonthYear(n)}const XM=pv;function ZM(n,a,o){return(o??new hn(a)).format(n,"d")}function JM(n,a=Vn){return a.format(n,"LLLL")}function eE(n,a,o){return(o??new hn(a)).format(n,"cccccc")}function tE(n,a=Vn){return n<10?a.formatNumber(`0${n.toLocaleString()}`):a.formatNumber(`${n.toLocaleString()}`)}function nE(){return""}function gv(n,a=Vn){return a.format(n,"yyyy")}const aE=gv,iE=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:pv,formatDay:ZM,formatMonthCaption:XM,formatMonthDropdown:JM,formatWeekNumber:tE,formatWeekNumberHeader:nE,formatWeekdayName:eE,formatYearCaption:aE,formatYearDropdown:gv},Symbol.toStringTag,{value:"Module"}));function oE(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...iE,...n}}function Gf(n,a,o,r){let c=(r??new hn(o)).format(n,"PPPP");return a.today&&(c=`Today, ${c}`),a.selected&&(c=`${c}, selected`),c}const sE=Gf;function Vf(n,a,o){return(o??new hn(a)).formatMonthYear(n)}const rE=Vf;function yv(n,a,o,r){let c=(r??new hn(o)).format(n,"PPPP");return a?.today&&(c=`Today, ${c}`),c}function xv(n){return"Choose the Month"}function bv(){return""}const lE="Go to the Next Month";function vv(n,a){return lE}function Cv(n){return"Go to the Previous Month"}function Sv(n,a,o){return(o??new hn(a)).format(n,"cccc")}function wv(n,a){return`Week ${n}`}function Nv(n){return"Week Number"}function kv(n){return"Choose the Year"}const cE=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:rE,labelDay:sE,labelDayButton:Gf,labelGrid:Vf,labelGridcell:yv,labelMonthDropdown:xv,labelNav:bv,labelNext:vv,labelPrevious:Cv,labelWeekNumber:wv,labelWeekNumberHeader:Nv,labelWeekday:Sv,labelYearDropdown:kv},Symbol.toStringTag,{value:"Module"})),Mn=(n,a,o)=>a||(o?typeof o=="function"?o:(...r)=>o:n);function uE(n,a){const o=a.locale?.labels??{};return{...cE,...n??{},labelDayButton:Mn(Gf,n?.labelDayButton,o.labelDayButton),labelMonthDropdown:Mn(xv,n?.labelMonthDropdown,o.labelMonthDropdown),labelNext:Mn(vv,n?.labelNext,o.labelNext),labelPrevious:Mn(Cv,n?.labelPrevious,o.labelPrevious),labelWeekNumber:Mn(wv,n?.labelWeekNumber,o.labelWeekNumber),labelYearDropdown:Mn(kv,n?.labelYearDropdown,o.labelYearDropdown),labelGrid:Mn(Vf,n?.labelGrid,o.labelGrid),labelGridcell:Mn(yv,n?.labelGridcell,o.labelGridcell),labelNav:Mn(bv,n?.labelNav,o.labelNav),labelWeekNumberHeader:Mn(Nv,n?.labelWeekNumberHeader,o.labelWeekNumberHeader),labelWeekday:Mn(Sv,n?.labelWeekday,o.labelWeekday)}}function dE(n,a,o,r,c){const{startOfMonth:d,startOfYear:f,endOfYear:m,eachMonthOfInterval:p,getMonth:y}=c;return p({start:f(n),end:m(n)}).map(b=>{const j=r.formatMonthDropdown(b,c),N=y(b),E=a&&b<d(a)||o&&b>d(o)||!1;return{value:N,label:j,disabled:E}})}function fE(n,a={},o={}){let r={...a?.[xe.Day]};return Object.entries(n).filter(([,c])=>c===!0).forEach(([c])=>{r={...r,...o?.[c]}}),r}function hE(n,a,o,r){const c=r??n.today(),d=o?n.startOfBroadcastWeek(c,n):a?n.startOfISOWeek(c):n.startOfWeek(c),f=[];for(let m=0;m<7;m++){const p=n.addDays(d,m);f.push(p)}return f}function mE(n,a,o,r,c=!1){if(!n||!a)return;const{startOfYear:d,endOfYear:f,eachYearOfInterval:m,getYear:p}=r,y=d(n),S=f(a),x=m({start:y,end:S});return c&&x.reverse(),x.map(b=>{const j=o.formatYearDropdown(b,r);return{value:p(b),label:j,disabled:!1}})}const Zs=n=>n instanceof HTMLElement?n:null,Td=n=>[...n.querySelectorAll("[data-animated-month]")??[]],pE=n=>Zs(n.querySelector("[data-animated-month]")),jd=n=>Zs(n.querySelector("[data-animated-caption]")),Md=n=>Zs(n.querySelector("[data-animated-weeks]")),gE=n=>Zs(n.querySelector("[data-animated-nav]")),yE=n=>Zs(n.querySelector("[data-animated-weekdays]"));function xE(n,a,{classNames:o,months:r,focused:c,dateLib:d}){const f=C.useRef(null),m=C.useRef(r),p=C.useRef(!1);C.useLayoutEffect(()=>{const y=m.current;if(m.current=r,!a||!n.current||!(n.current instanceof HTMLElement)||r.length===0||y.length===0||r.length!==y.length)return;const S=d.isSameMonth(r[0].date,y[0].date),x=d.isAfter(r[0].date,y[0].date),b=x?o[fn.caption_after_enter]:o[fn.caption_before_enter],j=x?o[fn.weeks_after_enter]:o[fn.weeks_before_enter],N=f.current,E=n.current.cloneNode(!0);if(E instanceof HTMLElement?(Td(E).forEach(A=>{if(!(A instanceof HTMLElement))return;const k=pE(A);k&&A.contains(k)&&A.removeChild(k);const T=jd(A);T&&T.classList.remove(b);const w=Md(A);w&&w.classList.remove(j)}),f.current=E):f.current=null,p.current||S||c)return;const L=N instanceof HTMLElement?Td(N):[],O=Td(n.current);if(O?.every(D=>D instanceof HTMLElement)&&L&&L.every(D=>D instanceof HTMLElement)){p.current=!0,n.current.style.isolation="isolate";const D=gE(n.current);D&&(D.style.zIndex="1"),O.forEach((A,k)=>{const T=L[k];if(!T)return;A.style.position="relative",A.style.overflow="hidden";const w=jd(A);w&&w.classList.add(b);const R=Md(A);R&&R.classList.add(j);const I=()=>{p.current=!1,n.current&&(n.current.style.isolation=""),D&&(D.style.zIndex=""),w&&w.classList.remove(b),R&&R.classList.remove(j),A.style.position="",A.style.overflow="",A.contains(T)&&A.removeChild(T)};T.style.pointerEvents="none",T.style.position="absolute",T.style.overflow="hidden",T.setAttribute("aria-hidden","true");const z=yE(T);z&&(z.style.opacity="0");const F=jd(T);F&&(F.classList.add(x?o[fn.caption_before_exit]:o[fn.caption_after_exit]),F.addEventListener("animationend",I));const ee=Md(T);ee&&ee.classList.add(x?o[fn.weeks_before_exit]:o[fn.weeks_after_exit]),A.insertBefore(T,A.firstChild)})}})}function bE(n,a,o,r){const c=n[0],d=n[n.length-1],{ISOWeek:f,fixedWeeks:m,broadcastCalendar:p}=o??{},{addDays:y,differenceInCalendarDays:S,differenceInCalendarMonths:x,endOfBroadcastWeek:b,endOfISOWeek:j,endOfMonth:N,endOfWeek:E,isAfter:L,startOfBroadcastWeek:O,startOfISOWeek:D,startOfWeek:A}=r,k=p?O(c,r):f?D(c):A(c),T=p?b(d):f?j(N(d)):E(N(d)),w=a&&(p?b(a):f?j(a):E(a)),R=w&&L(T,w)?w:T,I=S(R,k),z=x(d,c)+1,F=[];for(let ge=0;ge<=I;ge++){const te=y(k,ge);F.push(te)}const Q=(p?35:42)*z;if(m&&F.length<Q){const ge=Q-F.length;for(let te=0;te<ge;te++){const ve=y(F[F.length-1],1);F.push(ve)}}return F}function vE(n){const a=[];return n.reduce((o,r)=>{const c=r.weeks.reduce((d,f)=>d.concat(f.days.slice()),a.slice());return o.concat(c.slice())},a.slice())}function CE(n,a,o,r){const{numberOfMonths:c=1}=o,d=[];for(let f=0;f<c;f++){const m=r.addMonths(n,f);if(a&&m>a)break;d.push(m)}return d}function lx(n,a,o,r){const{month:c,defaultMonth:d,today:f=r.today(),numberOfMonths:m=1}=n;let p=c||d||f;const{differenceInCalendarMonths:y,addMonths:S,startOfMonth:x}=r;if(o&&y(o,p)<m-1){const b=-1*(m-1);p=S(o,b)}return a&&y(p,a)<0&&(p=a),x(p)}function SE(n,a,o,r){const{addDays:c,endOfBroadcastWeek:d,endOfISOWeek:f,endOfMonth:m,endOfWeek:p,getISOWeek:y,getWeek:S,startOfBroadcastWeek:x,startOfISOWeek:b,startOfWeek:j}=r,N=n.reduce((E,L)=>{const O=o.broadcastCalendar?x(L,r):o.ISOWeek?b(L):j(L),D=o.broadcastCalendar?d(L):o.ISOWeek?f(m(L)):p(m(L)),A=a.filter(R=>R>=O&&R<=D),k=o.broadcastCalendar?35:42;if(o.fixedWeeks&&A.length<k){const R=a.filter(I=>{const z=k-A.length;return I>D&&I<=c(D,z)});A.push(...R)}const T=A.reduce((R,I)=>{const z=o.ISOWeek?y(I):S(I),F=R.find(Q=>Q.weekNumber===z),ee=new dv(I,L,r);return F?F.days.push(ee):R.push(new xM(z,[ee])),R},[]),w=new yM(L,T);return E.push(w),E},[]);return o.reverseMonths?N.reverse():N}function wE(n,a){let{startMonth:o,endMonth:r}=n;const{startOfYear:c,startOfDay:d,startOfMonth:f,endOfMonth:m,addYears:p,endOfYear:y,newDate:S,today:x}=a,{fromYear:b,toYear:j,fromMonth:N,toMonth:E}=n;!o&&N&&(o=N),!o&&b&&(o=a.newDate(b,0,1)),!r&&E&&(r=E),!r&&j&&(r=S(j,11,31));const L=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return o?o=f(o):b?o=S(b,0,1):!o&&L&&(o=c(p(n.today??x(),-100))),r?r=m(r):j?r=S(j,11,31):!r&&L&&(r=y(n.today??x())),[o&&d(o),r&&d(r)]}function NE(n,a,o,r){if(o.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:d=1}=o,{startOfMonth:f,addMonths:m,differenceInCalendarMonths:p}=r,y=c?d:1,S=f(n);if(!a)return m(S,y);if(!(p(a,n)<d))return m(S,y)}function kE(n,a,o,r){if(o.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:d}=o,{startOfMonth:f,addMonths:m,differenceInCalendarMonths:p}=r,y=c?d??1:1,S=f(n);if(!a)return m(S,-y);if(!(p(S,a)<=0))return m(S,-y)}function AE(n){const a=[];return n.reduce((o,r)=>o.concat(r.weeks.slice()),a.slice())}function Zl(n,a){const[o,r]=C.useState(n);return[a===void 0?o:a,r]}function DE(n,a){const[o,r]=wE(n,a),{startOfMonth:c,endOfMonth:d}=a,f=lx(n,o,r,a),[m,p]=Zl(f,n.month?f:void 0);C.useEffect(()=>{const k=lx(n,o,r,a);p(k)},[n.timeZone]);const{months:y,weeks:S,days:x,previousMonth:b,nextMonth:j}=C.useMemo(()=>{const k=CE(m,r,{numberOfMonths:n.numberOfMonths},a),T=bE(k,n.endMonth?d(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},a),w=SE(k,T,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},a),R=AE(w),I=vE(w),z=kE(m,o,n,a),F=NE(m,r,n,a);return{months:w,weeks:R,days:I,previousMonth:z,nextMonth:F}},[a,m.getTime(),r?.getTime(),o?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:N,onMonthChange:E}=n,L=k=>S.some(T=>T.days.some(w=>w.isEqualTo(k))),O=k=>{if(N)return;let T=c(k);o&&T<c(o)&&(T=c(o)),r&&T>c(r)&&(T=c(r)),p(T),E?.(T)};return{months:y,weeks:S,days:x,navStart:o,navEnd:r,previousMonth:b,nextMonth:j,goToMonth:O,goToDay:k=>{L(k)||O(k.date)}}}var Bn;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(Bn||(Bn={}));function cx(n){return!n[ht.disabled]&&!n[ht.hidden]&&!n[ht.outside]}function TE(n,a,o,r){let c,d=-1;for(const f of n){const m=a(f);cx(m)&&(m[ht.focused]&&d<Bn.FocusedModifier?(c=f,d=Bn.FocusedModifier):r?.isEqualTo(f)&&d<Bn.LastFocused?(c=f,d=Bn.LastFocused):o(f.date)&&d<Bn.Selected?(c=f,d=Bn.Selected):m[ht.today]&&d<Bn.Today&&(c=f,d=Bn.Today))}return c||(c=n.find(f=>cx(a(f)))),c}function jE(n,a,o,r,c,d,f){const{ISOWeek:m,broadcastCalendar:p}=d,{addDays:y,addMonths:S,addWeeks:x,addYears:b,endOfBroadcastWeek:j,endOfISOWeek:N,endOfWeek:E,max:L,min:O,startOfBroadcastWeek:D,startOfISOWeek:A,startOfWeek:k}=f;let w={day:y,week:x,month:S,year:b,startOfWeek:R=>p?D(R,f):m?A(R):k(R),endOfWeek:R=>p?j(R):m?N(R):E(R)}[n](o,a==="after"?1:-1);return a==="before"&&r?w=L([r,w]):a==="after"&&c&&(w=O([c,w])),w}function Av(n,a,o,r,c,d,f,m=0){if(m>365)return;const p=jE(n,a,o.date,r,c,d,f),y=!!(d.disabled&&va(p,d.disabled,f)),S=!!(d.hidden&&va(p,d.hidden,f)),x=p,b=new dv(p,x,f);return!y&&!S?b:Av(n,a,b,r,c,d,f,m+1)}function ME(n,a,o,r,c){const{autoFocus:d}=n,[f,m]=C.useState(),p=TE(a.days,o,r||(()=>!1),f),[y,S]=C.useState(d?p:void 0);return{isFocusTarget:E=>!!p?.isEqualTo(E),setFocused:S,focused:y,blur:()=>{m(y),S(void 0)},moveFocus:(E,L)=>{if(!y)return;const O=Av(E,L,y,a.navStart,a.navEnd,n,c);O&&(n.disableNavigation&&!a.days.some(A=>A.isEqualTo(O))||(a.goToDay(O),S(O)))}}}function EE(n,a){const{selected:o,required:r,onSelect:c}=n,[d,f]=Zl(o,c?o:void 0),m=c?o:d,{isSameDay:p}=a,y=j=>m?.some(N=>p(N,j))??!1,{min:S,max:x}=n;return{selected:m,select:(j,N,E)=>{let L=[...m??[]];if(y(j)){if(m?.length===S||r&&m?.length===1)return;L=m?.filter(O=>!p(O,j))}else m?.length===x?L=[j]:L=[...L,j];return c||f(L),c?.(L,j,N,E),L},isSelected:y}}function OE(n,a,o=0,r=0,c=!1,d=Vn){const{from:f,to:m}=a||{},{isSameDay:p,isAfter:y,isBefore:S}=d;let x;if(!f&&!m)x={from:n,to:o>0?void 0:n};else if(f&&!m)p(f,n)?o===0?x={from:f,to:n}:c?x={from:f,to:void 0}:x=void 0:S(n,f)?x={from:n,to:f}:x={from:f,to:n};else if(f&&m)if(p(f,n)&&p(m,n))c?x={from:f,to:m}:x=void 0;else if(p(f,n))x={from:f,to:o>0?void 0:n};else if(p(m,n))x={from:n,to:o>0?void 0:n};else if(S(n,f))x={from:n,to:m};else if(y(n,f))x={from:f,to:n};else if(y(n,m))x={from:f,to:n};else throw new Error("Invalid range");if(x?.from&&x?.to){const b=d.differenceInCalendarDays(x.to,x.from);r>0&&b>r?x={from:n,to:void 0}:o>1&&b<o&&(x={from:n,to:void 0})}return x}function PE(n,a,o=Vn){const r=Array.isArray(a)?a:[a];let c=n.from;const d=o.differenceInCalendarDays(n.to,n.from),f=Math.min(d,6);for(let m=0;m<=f;m++){if(r.includes(c.getDay()))return!0;c=o.addDays(c,1)}return!1}function ux(n,a,o=Vn){return ba(n,a.from,!1,o)||ba(n,a.to,!1,o)||ba(a,n.from,!1,o)||ba(a,n.to,!1,o)}function LE(n,a,o=Vn){const r=Array.isArray(a)?a:[a];if(r.filter(m=>typeof m!="function").some(m=>typeof m=="boolean"?m:o.isDate(m)?ba(n,m,!1,o):mv(m,o)?m.some(p=>ba(n,p,!1,o)):Xl(m)?m.from&&m.to?ux(n,{from:m.from,to:m.to},o):!1:hv(m)?PE(n,m.dayOfWeek,o):Kf(m)?o.isAfter(m.before,m.after)?ux(n,{from:o.addDays(m.after,1),to:o.addDays(m.before,-1)},o):va(n.from,m,o)||va(n.to,m,o):qf(m)||Ff(m)?va(n.from,m,o)||va(n.to,m,o):!1))return!0;const f=r.filter(m=>typeof m=="function");if(f.length){let m=n.from;const p=o.differenceInCalendarDays(n.to,n.from);for(let y=0;y<=p;y++){if(f.some(S=>S(m)))return!0;m=o.addDays(m,1)}}return!1}function RE(n,a){const{disabled:o,excludeDisabled:r,selected:c,required:d,onSelect:f}=n,[m,p]=Zl(c,f?c:void 0),y=f?c:m;return{selected:y,select:(b,j,N)=>{const{min:E,max:L}=n,O=b?OE(b,y,E,L,d,a):void 0;return r&&o&&O?.from&&O.to&&LE({from:O.from,to:O.to},o,a)&&(O.from=b,O.to=void 0),f||p(O),f?.(O,b,j,N),O},isSelected:b=>y&&ba(y,b,!1,a)}}function _E(n,a){const{selected:o,required:r,onSelect:c}=n,[d,f]=Zl(o,c?o:void 0),m=c?o:d,{isSameDay:p}=a;return{selected:m,select:(x,b,j)=>{let N=x;return!r&&m&&m&&p(x,m)&&(N=void 0),c||f(N),c?.(N,x,b,j),N},isSelected:x=>m?p(m,x):!1}}function zE(n,a){const o=_E(n,a),r=EE(n,a),c=RE(n,a);switch(n.mode){case"single":return o;case"multiple":return r;case"range":return c;default:return}}function It(n,a){return n instanceof xa&&n.timeZone===a?n:new xa(n,a)}function dx(n,a){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?It(n,a):Array.isArray(n)?n.map(o=>o instanceof Date?It(o,a):o):Xl(n)?{...n,from:n.from?It(n.from,a):n.from,to:n.to?It(n.to,a):n.to}:Kf(n)?{before:It(n.before,a),after:It(n.after,a)}:qf(n)?{after:It(n.after,a)}:Ff(n)?{before:It(n.before,a)}:n}function Ed(n,a){return n&&(Array.isArray(n)?n.map(o=>dx(o,a)):dx(n,a))}function IE(n){let a=n;const o=a.timeZone;if(o&&(a={...n,timeZone:o},a.today&&(a.today=It(a.today,o)),a.month&&(a.month=It(a.month,o)),a.defaultMonth&&(a.defaultMonth=It(a.defaultMonth,o)),a.startMonth&&(a.startMonth=It(a.startMonth,o)),a.endMonth&&(a.endMonth=It(a.endMonth,o)),a.mode==="single"&&a.selected?a.selected=It(a.selected,o):a.mode==="multiple"&&a.selected?a.selected=a.selected?.map(pe=>It(pe,o)):a.mode==="range"&&a.selected&&(a.selected={from:a.selected.from?It(a.selected.from,o):a.selected.from,to:a.selected.to?It(a.selected.to,o):a.selected.to}),a.disabled!==void 0&&(a.disabled=Ed(a.disabled,o)),a.hidden!==void 0&&(a.hidden=Ed(a.hidden,o)),a.modifiers)){const pe={};Object.keys(a.modifiers).forEach(Te=>{pe[Te]=Ed(a.modifiers?.[Te],o)}),a.modifiers=pe}const{components:r,formatters:c,labels:d,dateLib:f,locale:m,classNames:p}=C.useMemo(()=>{const pe={...uv,...a.locale},Te=new hn({locale:pe,weekStartsOn:a.broadcastCalendar?1:a.weekStartsOn,firstWeekContainsDate:a.firstWeekContainsDate,useAdditionalWeekYearTokens:a.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:a.useAdditionalDayOfYearTokens,timeZone:a.timeZone,numerals:a.numerals},a.dateLib);return{dateLib:Te,components:$M(a.components),formatters:oE(a.formatters),labels:uE(a.labels,Te.options),locale:pe,classNames:{...QM(),...a.classNames}}},[a.locale,a.broadcastCalendar,a.weekStartsOn,a.firstWeekContainsDate,a.useAdditionalWeekYearTokens,a.useAdditionalDayOfYearTokens,a.timeZone,a.numerals,a.dateLib,a.components,a.formatters,a.labels,a.classNames]);a.today||(a={...a,today:f.today()});const{captionLayout:y,mode:S,navLayout:x,numberOfMonths:b=1,onDayBlur:j,onDayClick:N,onDayFocus:E,onDayKeyDown:L,onDayMouseEnter:O,onDayMouseLeave:D,onNextClick:A,onPrevClick:k,showWeekNumber:T,styles:w}=a,{formatCaption:R,formatDay:I,formatMonthDropdown:z,formatWeekNumber:F,formatWeekNumberHeader:ee,formatWeekdayName:Q,formatYearDropdown:ge}=c,te=DE(a,f),{days:ve,months:U,navStart:Z,navEnd:ne,previousMonth:$,nextMonth:oe,goToMonth:ue}=te,he=VM(ve,a,Z,ne,f),{isSelected:X,select:ae,selected:de}=zE(a,f)??{},{blur:ie,focused:re,isFocusTarget:ye,moveFocus:De,setFocused:ze}=ME(a,te,he,X??(()=>!1),f),{labelDayButton:Xe,labelGridcell:ke,labelGrid:Oe,labelMonthDropdown:Ge,labelNav:Dt,labelPrevious:Ot,labelNext:Yn,labelWeekday:je,labelWeekNumber:Jt,labelWeekNumberHeader:Pn,labelYearDropdown:en}=d,Da=C.useMemo(()=>hE(f,a.ISOWeek,a.broadcastCalendar,a.today),[f,a.ISOWeek,a.broadcastCalendar,a.today]),$n=S!==void 0||N!==void 0,yt=C.useCallback(()=>{$&&(ue($),k?.($))},[$,ue,k]),tn=C.useCallback(()=>{oe&&(ue(oe),A?.(oe))},[ue,oe,A]),Wn=C.useCallback((pe,Te)=>Se=>{Se.preventDefault(),Se.stopPropagation(),ze(pe),!Te.disabled&&(ae?.(pe.date,Te,Se),N?.(pe.date,Te,Se))},[ae,N,ze]),ni=C.useCallback((pe,Te)=>Se=>{ze(pe),E?.(pe.date,Te,Se)},[E,ze]),Ln=C.useCallback((pe,Te)=>Se=>{ie(),j?.(pe.date,Te,Se)},[ie,j]),Rn=C.useCallback((pe,Te)=>Se=>{const Re={ArrowLeft:[Se.shiftKey?"month":"day",a.dir==="rtl"?"after":"before"],ArrowRight:[Se.shiftKey?"month":"day",a.dir==="rtl"?"before":"after"],ArrowDown:[Se.shiftKey?"year":"week","after"],ArrowUp:[Se.shiftKey?"year":"week","before"],PageUp:[Se.shiftKey?"year":"month","before"],PageDown:[Se.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Re[Se.key]){Se.preventDefault(),Se.stopPropagation();const[lt,Ne]=Re[Se.key];De(lt,Ne)}L?.(pe.date,Te,Se)},[De,L,a.dir]),Ei=C.useCallback((pe,Te)=>Se=>{O?.(pe.date,Te,Se)},[O]),To=C.useCallback((pe,Te)=>Se=>{D?.(pe.date,Te,Se)},[D]),jo=C.useCallback(pe=>Te=>{const Se=Number(Te.target.value),Re=f.setMonth(f.startOfMonth(pe),Se);ue(Re)},[f,ue]),Qn=C.useCallback(pe=>Te=>{const Se=Number(Te.target.value),Re=f.setYear(f.startOfMonth(pe),Se);ue(Re)},[f,ue]),{className:J,style:Pe}=C.useMemo(()=>({className:[p[xe.Root],a.className].filter(Boolean).join(" "),style:{...w?.[xe.Root],...a.style}}),[p,a.className,a.style,w]),Ce=WM(a),Le=C.useRef(null);xE(Le,!!a.animate,{classNames:p,months:U,focused:re,dateLib:f});const dt={dayPickerProps:a,selected:de,select:ae,isSelected:X,months:U,nextMonth:oe,previousMonth:$,goToMonth:ue,getModifiers:he,components:r,classNames:p,styles:w,labels:d,formatters:c};return ce.createElement(fv.Provider,{value:dt},ce.createElement(r.Root,{rootRef:a.animate?Le:void 0,className:J,style:Pe,dir:a.dir,id:a.id,lang:a.lang,nonce:a.nonce,title:a.title,role:a.role,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],...Ce},ce.createElement(r.Months,{className:p[xe.Months],style:w?.[xe.Months]},!a.hideNavigation&&!x&&ce.createElement(r.Nav,{"data-animated-nav":a.animate?"true":void 0,className:p[xe.Nav],style:w?.[xe.Nav],"aria-label":Dt(),onPreviousClick:yt,onNextClick:tn,previousMonth:$,nextMonth:oe}),U.map((pe,Te)=>ce.createElement(r.Month,{"data-animated-month":a.animate?"true":void 0,className:p[xe.Month],style:w?.[xe.Month],key:Te,displayIndex:Te,calendarMonth:pe},x==="around"&&!a.hideNavigation&&Te===0&&ce.createElement(r.PreviousMonthButton,{type:"button",className:p[xe.PreviousMonthButton],tabIndex:$?void 0:-1,"aria-disabled":$?void 0:!0,"aria-label":Ot($),onClick:yt,"data-animated-button":a.animate?"true":void 0},ce.createElement(r.Chevron,{disabled:$?void 0:!0,className:p[xe.Chevron],orientation:a.dir==="rtl"?"right":"left"})),ce.createElement(r.MonthCaption,{"data-animated-caption":a.animate?"true":void 0,className:p[xe.MonthCaption],style:w?.[xe.MonthCaption],calendarMonth:pe,displayIndex:Te},y?.startsWith("dropdown")?ce.createElement(r.DropdownNav,{className:p[xe.Dropdowns],style:w?.[xe.Dropdowns]},(()=>{const Se=y==="dropdown"||y==="dropdown-months"?ce.createElement(r.MonthsDropdown,{key:"month",className:p[xe.MonthsDropdown],"aria-label":Ge(),classNames:p,components:r,disabled:!!a.disableNavigation,onChange:jo(pe.date),options:dE(pe.date,Z,ne,c,f),style:w?.[xe.Dropdown],value:f.getMonth(pe.date)}):ce.createElement("span",{key:"month"},z(pe.date,f)),Re=y==="dropdown"||y==="dropdown-years"?ce.createElement(r.YearsDropdown,{key:"year",className:p[xe.YearsDropdown],"aria-label":en(f.options),classNames:p,components:r,disabled:!!a.disableNavigation,onChange:Qn(pe.date),options:mE(Z,ne,c,f,!!a.reverseYears),style:w?.[xe.Dropdown],value:f.getYear(pe.date)}):ce.createElement("span",{key:"year"},ge(pe.date,f));return f.getMonthYearOrder()==="year-first"?[Re,Se]:[Se,Re]})(),ce.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},R(pe.date,f.options,f))):ce.createElement(r.CaptionLabel,{className:p[xe.CaptionLabel],role:"status","aria-live":"polite"},R(pe.date,f.options,f))),x==="around"&&!a.hideNavigation&&Te===b-1&&ce.createElement(r.NextMonthButton,{type:"button",className:p[xe.NextMonthButton],tabIndex:oe?void 0:-1,"aria-disabled":oe?void 0:!0,"aria-label":Yn(oe),onClick:tn,"data-animated-button":a.animate?"true":void 0},ce.createElement(r.Chevron,{disabled:oe?void 0:!0,className:p[xe.Chevron],orientation:a.dir==="rtl"?"left":"right"})),Te===b-1&&x==="after"&&!a.hideNavigation&&ce.createElement(r.Nav,{"data-animated-nav":a.animate?"true":void 0,className:p[xe.Nav],style:w?.[xe.Nav],"aria-label":Dt(),onPreviousClick:yt,onNextClick:tn,previousMonth:$,nextMonth:oe}),ce.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":S==="multiple"||S==="range","aria-label":Oe(pe.date,f.options,f)||void 0,className:p[xe.MonthGrid],style:w?.[xe.MonthGrid]},!a.hideWeekdays&&ce.createElement(r.Weekdays,{"data-animated-weekdays":a.animate?"true":void 0,className:p[xe.Weekdays],style:w?.[xe.Weekdays]},T&&ce.createElement(r.WeekNumberHeader,{"aria-label":Pn(f.options),className:p[xe.WeekNumberHeader],style:w?.[xe.WeekNumberHeader],scope:"col"},ee()),Da.map(Se=>ce.createElement(r.Weekday,{"aria-label":je(Se,f.options,f),className:p[xe.Weekday],key:String(Se),style:w?.[xe.Weekday],scope:"col"},Q(Se,f.options,f)))),ce.createElement(r.Weeks,{"data-animated-weeks":a.animate?"true":void 0,className:p[xe.Weeks],style:w?.[xe.Weeks]},pe.weeks.map(Se=>ce.createElement(r.Week,{className:p[xe.Week],key:Se.weekNumber,style:w?.[xe.Week],week:Se},T&&ce.createElement(r.WeekNumber,{week:Se,style:w?.[xe.WeekNumber],"aria-label":Jt(Se.weekNumber,{locale:m}),className:p[xe.WeekNumber],scope:"row",role:"rowheader"},F(Se.weekNumber,f)),Se.days.map(Re=>{const{date:lt}=Re,Ne=he(Re);if(Ne[ht.focused]=!Ne.hidden&&!!re?.isEqualTo(Re),Ne[En.selected]=X?.(lt)||Ne.selected,Xl(de)){const{from:nn,to:An}=de;Ne[En.range_start]=!!(nn&&An&&f.isSameDay(lt,nn)),Ne[En.range_end]=!!(nn&&An&&f.isSameDay(lt,An)),Ne[En.range_middle]=ba(de,lt,!0,f)}const Ht=fE(Ne,w,a.modifiersStyles),Xn=YM(Ne,p,a.modifiersClassNames),Tt=!$n&&!Ne.hidden?ke(lt,Ne,f.options,f):void 0;return ce.createElement(r.Day,{key:`${Re.isoDate}_${Re.displayMonthId}`,day:Re,modifiers:Ne,className:Xn.join(" "),style:Ht,role:"gridcell","aria-selected":Ne.selected||void 0,"aria-label":Tt,"data-day":Re.isoDate,"data-month":Re.outside?Re.dateMonthId:void 0,"data-selected":Ne.selected||void 0,"data-disabled":Ne.disabled||void 0,"data-hidden":Ne.hidden||void 0,"data-outside":Re.outside||void 0,"data-focused":Ne.focused||void 0,"data-today":Ne.today||void 0},!Ne.hidden&&$n?ce.createElement(r.DayButton,{className:p[xe.DayButton],style:w?.[xe.DayButton],type:"button",day:Re,modifiers:Ne,disabled:!Ne.focused&&Ne.disabled||void 0,"aria-disabled":Ne.focused&&Ne.disabled||void 0,tabIndex:ye(Re)?0:-1,"aria-label":Xe(lt,Ne,f.options,f),onClick:Wn(Re,Ne),onBlur:Ln(Re,Ne),onFocus:ni(Re,Ne),onKeyDown:Rn(Re,Ne),onMouseEnter:Ei(Re,Ne),onMouseLeave:To(Re,Ne)},I(lt,f.options,f)):!Ne.hidden&&I(Re.date,f.options,f))})))))))),a.footer&&ce.createElement(r.Footer,{className:p[xe.Footer],style:w?.[xe.Footer],role:"status","aria-live":"polite"},a.footer)))}function UE({className:n,classNames:a,showOutsideDays:o=!0,...r}){return l.jsx(IE,{showOutsideDays:o,className:K("p-2",n),classNames:{root:"relative",months:"flex flex-col sm:flex-row gap-2 sm:gap-4",month:"flex flex-col gap-2",month_caption:"flex justify-center pt-1 relative items-center h-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-2 flex items-center justify-between px-1 z-10",button_previous:K(yl({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:K(yl({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:K("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:K(yl({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:K("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:K("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:K("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:K("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...a},components:{Chevron:({orientation:c,className:d,...f})=>{const m=c==="left"?iw:c==="right"?Ol:c==="up"?tf:Pl;return l.jsx(m,{className:K("h-4 w-4",d),...f})}},...r})}UE.displayName="Calendar";const HE=C.lazy(()=>at(()=>Promise.resolve().then(()=>Ql),void 0).then(n=>({default:n.CodeEditor})));function CP({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:o,rawSettingsEnv:r,onChange:c,missingRequiredFields:d=[]}){const f=d.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(kn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[l.jsx(Ao,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&f&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:d.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(HE,{value:n,onChange:c,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Rf,{profileEnv:r})})})]})})}const SP={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},wP=[{id:"codex-target-runtime-support",title:"Native Codex runtime support is live",summary:"Codex now participates as a first-class runtime target through ccs-codex, ccsx, ccsxp, or --target codex.",primaryAction:"Use Codex as a runtime target for native Codex sessions and Codex-routed CLIProxy flows.",publishedAt:"2026-03-28",status:"new",scopes:["target","cliproxy","api-profiles"],entryIds:["codex-target","codex-cliproxy"],highlights:["Use ccs-codex or ccsx for native Codex runs.","Use ccsxp for the built-in CCS Codex provider shortcut on native Codex.","Built-in Codex and Codex bridge profiles can run on native Codex with --target codex.","Saved default targets for API profiles and variants can now be claude, droid, or codex."],actions:[{id:"copy-codex-alias-command",label:"Open native Codex",description:"Launch Codex through the explicit CCS runtime alias.",type:"command",command:"ccs-codex"},{id:"copy-codex-provider-command",label:"Run built-in Codex on Codex",description:"Use the built-in Codex provider shortcut on native Codex.",type:"command",command:'ccsxp "your prompt"'},{id:"copy-codex-provider-command-explicit",label:"Run built-in Codex on Codex (explicit)",description:"Use the explicit built-in Codex provider route on native Codex.",type:"command",command:'ccs codex --target codex "your prompt"'},{id:"open-codex-dashboard",label:"Open Codex dashboard",description:"Review Codex runtime support, config layers, and dashboard setup flows.",type:"route",path:"/codex"}],routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx",'ccsxp "your prompt"','ccs codex --target codex "your prompt"']},{id:"droid-target-support",title:"Factory Droid support is live",summary:"API Profiles and CLIProxy variants now support Droid as a first-class execution target.",primaryAction:"Set Droid as your default execution target for non-Claude workflows.",publishedAt:"2026-02-25",status:"new",scopes:["target","api-profiles","cliproxy"],entryIds:["droid-target","custom-api-profiles","codex-cliproxy","agy-cliproxy"],highlights:["Set default target to Droid when creating or editing API Profiles.","Set default target to Droid for CLIProxy variants, including Codex and Antigravity flows.","Use ccs-droid as the explicit alias, with ccsd kept as the legacy shortcut."],actions:[{id:"open-api-profiles",label:"Set default target in API Profiles",description:"Open API Profiles and set Default Target to Droid for profiles you run often.",type:"route",path:"/providers"},{id:"open-cliproxy",label:"Set default target in CLIProxy variants",description:"Open CLIProxy variants and set target to Droid for Codex/Antigravity or custom variants.",type:"route",path:"/cliproxy"},{id:"copy-ccs-droid-command",label:"Run once with explicit Droid alias",description:"Use ccs-droid to force the Droid target with your current profile.",type:"command",command:"ccs-droid glm"},{id:"copy-target-override",label:"Run once with --target override",description:"Keep your default profile but force Droid for a single command.",type:"command",command:'ccs codex --target droid "your prompt"'}],routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates Center is available for rollout tasks",summary:"A focused Updates Center exists for setup tasks and rollout guidance when you need it.",primaryAction:"Use this page only when needed for rollout tasks, then return to your normal workflow.",publishedAt:"2026-02-25",status:"new",scopes:["target","cliproxy","api-profiles","websearch"],entryIds:["droid-target","codex-cliproxy","custom-api-profiles","opencode-websearch"],highlights:["Single data source powers update content and integration mapping.","Notices can be tracked as new, seen, done, or dismissed.","Catalog covers target CLI, CLIProxy providers, and WebSearch integrations."],actions:[{id:"open-updates-page",label:"Open Updates Center when needed",description:"Review rollout tasks only when you want guided setup changes.",type:"route",path:"/updates"},{id:"copy-open-dashboard",label:"Open dashboard from terminal",description:"Re-open config dashboard anytime from CLI.",type:"command",command:"ccs config"}],routes:[{label:"Updates Center",path:"/updates"}],commands:["ccs config"]}],BE=[{id:"claude-target",name:"Claude Code",scope:"target",status:"stable",summary:"Default runtime target for all CCS profile types.",pillars:{baseUrl:"From profile settings (ANTHROPIC_BASE_URL)",auth:"From profile settings (ANTHROPIC_AUTH_TOKEN)",model:"From profile settings (ANTHROPIC_MODEL)"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs",'ccs glm "your prompt"']},{id:"droid-target",name:"Factory Droid",scope:"target",status:"new",summary:"First-class target for API Profiles and CLIProxy variants.",pillars:{baseUrl:"From profile or variant settings",auth:"From profile or variant settings",model:"From profile or variant settings"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccs-droid as the explicit runtime alias. Legacy ccsd still works."},{id:"codex-target",name:"Codex CLI",scope:"target",status:"new",summary:"First-class runtime target for native Codex sessions and Codex-routed CLIProxy flows.",pillars:{baseUrl:"Native ~/.codex config for default mode, transient -c overrides for CCS-backed routes",auth:"Native Codex auth for default mode, env_key injection for CCS-backed routes",model:"Native Codex config or routed Codex model mapping from CLIProxy"},routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx","ccs codex --target codex","ccs codex-api --target codex"],notes:"Saved default targets for API profiles and CLIProxy variants can now be claude, droid, or codex."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and a native Codex shortcut.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:['ccsxp "your prompt"',"ccs codex --target codex","ccs codex","ccs cliproxy create mycodex --provider codex","ccs api create codex-api --cliproxy-provider codex"],notes:"Use ccsxp when you want the built-in Codex provider on native Codex without retyping --target codex."},{id:"gemini-cliproxy",name:"Gemini via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Gemini provider with multi-account management.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs gemini","ccs cliproxy create mygem --provider gemini"]},{id:"agy-cliproxy",name:"Antigravity via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Antigravity provider with variant target controls.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs agy","ccs cliproxy create myagy --provider agy --target droid"]},{id:"custom-api-profiles",name:"Custom API Profiles",scope:"api-profiles",status:"stable",summary:"Any Anthropic-compatible endpoint with per-profile target and model mapping.",pillars:{baseUrl:"User-defined endpoint",auth:"User-defined token/key",model:"User-defined model identifier"},routes:[{label:"API Profiles",path:"/providers"}],commands:["ccs api create myprofile",'ccs myprofile "your prompt"']},{id:"opencode-websearch",name:"OpenCode WebSearch",scope:"websearch",status:"stable",summary:"WebSearch provider surfaced in Settings for third-party profile workflows.",pillars:{baseUrl:"Managed by OpenCode CLI integration",auth:"Provider-specific (managed externally)",model:"Configurable in WebSearch settings"},routes:[{label:"Settings",path:"/settings"}],commands:["ccs config",'ccs codex "your prompt"'],notes:"Enable OpenCode in Settings > WebSearch to activate fallback search."}],KE=new Map(BE.map(n=>[n.id,n]));function NP(n){return n.entryIds.map(a=>KE.get(a)).filter(a=>!!a)}function kP(n){const a=new Date(`${n}T00:00:00Z`);return Number.isNaN(a.getTime())?n:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(a)}C.lazy(()=>at(()=>Promise.resolve().then(()=>Ql),void 0).then(n=>({default:n.CodeEditor})));function qE(){const{t:n}=Et(),{isDark:a,setTheme:o}=mf(),[r,c]=C.useState(""),[d,f]=C.useState(""),[m,p]=C.useState(!1),[y,S]=C.useState(null),[x,b]=C.useState(!1),{login:j,authRequired:N,isAuthenticated:E,loading:L,accessMode:O,authEnabled:D}=Il(),A=Jd(),k=El(),T=O==="setup",w=n(T?"auth.remoteGuardLabel":"auth.protectedAccessLabel"),R=n(T?D?"auth.incompleteSetupDescription":"auth.remoteSetupDescription":"auth.loginDescription"),I=k.state?.from?.pathname||"/";if(C.useEffect(()=>{L||(E||!N)&&A(I,{replace:!0})},[E,N,L,A,I]),L)return l.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-4",children:l.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-border/80 bg-card/90 px-5 py-3 text-sm text-muted-foreground shadow-sm",children:[l.jsx(kn,{className:"h-4 w-4 animate-spin"}),n("auth.loading")]})});if(E||!N)return null;const z=async F=>{F.preventDefault(),S(null),b(!0);try{await j(r,d),A(I,{replace:!0})}catch(ee){S(ee instanceof Error?ee.message:n("auth.loginFailed"))}finally{b(!1)}};return l.jsxs("div",{className:"relative min-h-[100dvh] overflow-hidden bg-background",children:[l.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(167,85,52,0.16),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(39,39,42,0.12),transparent_48%)]"}),l.jsx("div",{className:"absolute inset-0 opacity-[0.18] [background-image:linear-gradient(rgba(127,117,107,0.14)_1px,transparent_1px),linear-gradient(90deg,rgba(127,117,107,0.14)_1px,transparent_1px)] [background-size:24px_24px]"}),l.jsx("div",{className:"relative mx-auto flex min-h-[100dvh] max-w-6xl items-center px-4 py-8 sm:px-6",children:l.jsxs("div",{className:"grid w-full items-stretch gap-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,430px)]",children:[l.jsxs("section",{className:"flex flex-col justify-between rounded-[28px] border border-border/70 bg-card/85 p-6 shadow-[0_24px_80px_-48px_rgba(68,48,34,0.55)] backdrop-blur sm:p-8",children:[l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("span",{className:"inline-flex w-fit items-center gap-2 rounded-full border border-border/70 bg-background/75 px-3 py-1 text-xs font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:[l.jsx(dl,{className:"h-3.5 w-3.5 text-accent"}),w]}),l.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border border-border/70 bg-background/75 p-1 shadow-sm backdrop-blur",children:[l.jsxs(ot,{type:"button",variant:"ghost",size:"sm",className:K("rounded-full px-3 text-xs font-semibold",!a&&"bg-card text-foreground shadow-sm"),"aria-pressed":!a,onClick:()=>o("light"),children:[l.jsx(Ix,{className:"h-3.5 w-3.5"}),n("auth.lightMode")]}),l.jsxs(ot,{type:"button",variant:"ghost",size:"sm",className:K("rounded-full px-3 text-xs font-semibold",a&&"bg-card text-foreground shadow-sm"),"aria-pressed":a,onClick:()=>o("dark"),children:[l.jsx(Ux,{className:"h-3.5 w-3.5"}),n("auth.darkMode")]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("h1",{className:"max-w-xl text-4xl font-semibold tracking-[-0.04em] text-balance text-foreground sm:text-5xl",children:n(T?"auth.remoteSetupTitle":"auth.dashboardTitle")}),l.jsx("p",{className:"max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg",children:R})]})]}),l.jsxs("div",{className:"mt-8 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3",children:[l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(qg,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:n("auth.safetyNoteRemote")})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(Fg,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:n("auth.safetyNoteLocal")})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(dl,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:n("auth.safetyNoteSession")})]})]})]}),l.jsxs(xj,{className:"justify-center rounded-[28px] border-border/70 bg-card/95 py-0 shadow-[0_24px_90px_-54px_rgba(34,24,16,0.62)]",children:[l.jsxs(bj,{className:"space-y-3 border-b border-border/70 px-6 py-6",children:[l.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-accent/20 bg-accent/10",children:T?l.jsx(qg,{className:"h-5 w-5 text-accent"}):l.jsx(Fg,{className:"h-5 w-5 text-accent"})}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(vj,{className:"text-2xl tracking-[-0.03em]",children:n(T?"auth.remoteSetupTitle":"auth.dashboardTitle")}),l.jsx(Cj,{className:"text-sm leading-6 text-muted-foreground",children:T?R:n("auth.credentialsHint")})]})]}),l.jsx(Sj,{className:"space-y-5 px-6 py-6",children:T?l.jsxs(l.Fragment,{children:[l.jsxs(zs,{variant:"warning",className:"rounded-2xl border-yellow-300/70 bg-yellow-50/80",children:[l.jsx(Bs,{className:"h-4 w-4"}),l.jsx(Tl,{children:n("auth.noDefaultCredentials")}),l.jsx(Is,{children:n("auth.credentialsHint")})]}),l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[l.jsx(ow,{className:"h-4 w-4 text-accent"}),n("auth.hostStepTitle")]}),l.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.hostStepDescription")}),l.jsx("code",{className:"mt-4 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"ccs config auth setup"})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[l.jsx(dl,{className:"h-4 w-4 text-accent"}),n("auth.localStepTitle")]}),l.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.localStepDescription")})]})]})]}):l.jsxs("form",{onSubmit:z,className:"space-y-4",children:[y&&l.jsxs(zs,{variant:"destructive",className:"rounded-2xl",children:[l.jsx(Bs,{className:"h-4 w-4"}),l.jsx(Is,{children:y})]}),l.jsxs(zs,{variant:"info",className:"rounded-2xl border-blue-200/80 bg-blue-50/80",children:[l.jsx(dl,{className:"h-4 w-4"}),l.jsx(Tl,{children:n("auth.noDefaultCredentials")}),l.jsx(Is,{children:n("auth.credentialsHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{htmlFor:"username",className:"text-sm font-semibold",children:n("auth.username")}),l.jsx(Hn,{id:"username",type:"text",value:r,onChange:F=>c(F.target.value),placeholder:n("auth.usernamePlaceholder"),autoComplete:"username",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 text-base md:text-base",disabled:x,required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{htmlFor:"password",className:"text-sm font-semibold",children:n("auth.password")}),l.jsxs("div",{className:"relative",children:[l.jsx(Hn,{id:"password",type:m?"text":"password",value:d,onChange:F=>f(F.target.value),placeholder:n("auth.passwordPlaceholder"),autoComplete:"current-password",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 pr-14 text-base md:text-base",disabled:x,required:!0}),l.jsx(ot,{type:"button",variant:"ghost",size:"sm",className:"absolute inset-y-1 right-1 h-auto rounded-xl px-3 text-muted-foreground hover:text-foreground","aria-label":n(m?"auth.hidePassword":"auth.showPassword"),"aria-pressed":m,onClick:()=>p(F=>!F),disabled:x,children:m?l.jsx(Vs,{className:"h-4 w-4"}):l.jsx(Ys,{className:"h-4 w-4"})})]})]}),l.jsx(ot,{type:"submit",className:"h-12 w-full rounded-2xl text-sm font-semibold",disabled:x,children:x?l.jsxs(l.Fragment,{children:[l.jsx(kn,{className:"mr-2 h-4 w-4 animate-spin"}),n("auth.signingIn")]}):n("auth.signIn")})]})})]})]})})]})}const FE=C.lazy(()=>at(()=>import("./index-BsbzlZcs.js"),__vite__mapDeps([21,1,2,4,5,7,22,6,8,9])).then(n=>({default:n.AnalyticsPage}))),GE=C.lazy(()=>at(()=>import("./api-DYb7nMX1.js"),__vite__mapDeps([23,1,2,5,24,17,6,4,3,7,8,9])).then(n=>({default:n.ApiPage}))),VE=C.lazy(()=>at(()=>import("./cliproxy-EF7iEy5S.js"),__vite__mapDeps([25,1,2,5,15,6,4,18,26,24,17,27,28,16,7,8,9])).then(n=>({default:n.CliproxyPage}))),YE=C.lazy(()=>at(()=>import("./cliproxy-ai-providers-BK0savIX.js"),__vite__mapDeps([29,1,2,16,17,5,6,4,24,7,8,9])).then(n=>({default:n.CliproxyAiProvidersPage}))),$E=C.lazy(()=>at(()=>import("./cliproxy-control-panel-DAoeSaoD.js"),__vite__mapDeps([30,1,2,5,15,4,6,7,8,9])).then(n=>({default:n.CliproxyControlPanelPage}))),WE=C.lazy(()=>at(()=>import("./copilot-CA9P3Gsd.js"),__vite__mapDeps([31,1,2,5,24,17,4,27,28,6,7,8,9])).then(n=>({default:n.CopilotPage}))),QE=C.lazy(()=>at(()=>import("./cursor-BaX25jJK.js"),__vite__mapDeps([32,1,2,6,5,15,27,28,4,7,8,9])).then(n=>({default:n.CursorPage}))),XE=C.lazy(()=>at(()=>import("./claude-extension-TiOTnDTd.js"),__vite__mapDeps([33,1,2,5,6,4,7,8,9])).then(n=>({default:n.ClaudeExtensionPage}))),ZE=C.lazy(()=>at(()=>import("./codex-B1reJvsl.js"),__vite__mapDeps([34,1,2,6,4,27,5,9,7,35,36,8])).then(n=>({default:n.CodexPage}))),JE=C.lazy(()=>at(()=>import("./droid-zythBAEB.js"),__vite__mapDeps([37,1,2,6,5,36,4,27,7,8,9])).then(n=>({default:n.DroidPage}))),eO=C.lazy(()=>at(()=>import("./logs-Bn5qH5av.js"),__vite__mapDeps([38,1,2,4,5,6,7,8,9])).then(n=>({default:n.LogsPage}))),tO=C.lazy(()=>at(()=>import("./accounts-CD6xqLf4.js"),__vite__mapDeps([39,1,2,5,35,17,6,4,26,7,8,9])).then(n=>({default:n.AccountsPage}))),nO=C.lazy(()=>at(()=>Promise.resolve().then(()=>cM),void 0).then(n=>({default:n.SettingsPage}))),aO=C.lazy(()=>at(()=>import("./health-B_CZll49.js"),__vite__mapDeps([40,1,2,5,6,4,7,8,9])).then(n=>({default:n.HealthPage}))),iO=C.lazy(()=>at(()=>import("./shared-DMT_Fh95.js"),__vite__mapDeps([41,1,2,4,5,6,7,8,9])).then(n=>({default:n.SharedPage}))),oO=C.lazy(()=>at(()=>import("./updates-D6XV9cJj.js"),__vite__mapDeps([42,1,2,4,5,6,7,8,9])).then(n=>({default:n.UpdatesPage})));function Bt(){return l.jsx("div",{className:"flex h-64 items-center justify-center",children:l.jsx(kn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function sO(){return l.jsx(kS,{client:Jw,children:l.jsx(YN,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx($N,{children:l.jsx(JN,{children:l.jsxs(CS,{children:[l.jsxs(SS,{children:[l.jsx(Nt,{path:"/login",element:l.jsx(qE,{})}),l.jsx(Nt,{element:l.jsx(ek,{}),children:l.jsxs(Nt,{element:l.jsx(s1,{}),children:[l.jsx(Nt,{path:"/",element:l.jsx(kT,{})}),l.jsx(Nt,{path:"/analytics",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(FE,{})})}),l.jsx(Nt,{path:"/updates",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(oO,{})})}),l.jsx(Nt,{path:"/providers",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(GE,{})})}),l.jsx(Nt,{path:"/cliproxy",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(VE,{})})}),l.jsx(Nt,{path:"/cliproxy/ai-providers",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(YE,{})})}),l.jsx(Nt,{path:"/cliproxy/control-panel",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx($E,{})})}),l.jsx(Nt,{path:"/copilot",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(WE,{})})}),l.jsx(Nt,{path:"/cursor",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(QE,{})})}),l.jsx(Nt,{path:"/claude-extension",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(XE,{})})}),l.jsx(Nt,{path:"/codex",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(ZE,{})})}),l.jsx(Nt,{path:"/droid",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(JE,{})})}),l.jsx(Nt,{path:"/accounts",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(tO,{})})}),l.jsx(Nt,{path:"/settings",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(nO,{})})}),l.jsx(Nt,{path:"/health",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(aO,{})})}),l.jsx(Nt,{path:"/logs",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(eO,{})})}),l.jsx(Nt,{path:"/shared",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(iO,{})})})]})})]}),l.jsx(AS,{position:"top-right"})]})})})})})}const Dv=document.getElementById("root");if(!Dv)throw new Error("Root element not found. Failed to mount React application.");Qw.createRoot(Dv).render(l.jsx(C.StrictMode,{children:l.jsx(sO,{})}));export{aP as $,MT as A,Ut as B,xj as C,_T as D,XO as E,JO as F,DT as G,LT as H,Hn as I,zT as J,ZO as K,qt as L,aA as M,iA as N,oA as O,ib as P,Vb as Q,Pf as R,We as S,Sa as T,jl as U,Yd as V,Fe as W,nP as X,He as Y,tP as Z,Cj as _,Et as a,DO as a$,iP as a0,oP as a1,sP as a2,rP as a3,lP as a4,cP as a5,Wb as a6,uP as a7,kj as a8,Af as a9,mP as aA,fP as aB,wA as aC,JT as aD,dP as aE,BT as aF,tv as aG,X1 as aH,fD as aI,ji as aJ,VA as aK,YA as aL,$A as aM,WA as aN,_1 as aO,xb as aP,EO as aQ,OO as aR,PO as aS,LO as aT,vP as aU,bO as aV,nA as aW,kO as aX,AO as aY,Zk as aZ,Jk as a_,gO as aa,Xk as ab,vO as ac,wO as ad,TO as ae,jO as af,pf as ag,gf as ah,yf as ai,xf as aj,bf as ak,pP as al,Dj as am,gP as an,Qs as ao,qO as ap,qd as aq,FO as ar,Hd as as,MO as at,GO as au,VO as av,$O as aw,Cy as ax,YO as ay,hP as az,Sj as b,eA as b0,tA as b1,NO as b2,wf as b3,KO as b4,iv as b5,Rf as b6,Ts as b7,yO as b8,xO as b9,NN as bA,TN as bB,LN as bC,UO as bD,CO as bE,SO as bF,_O as bG,zO as bH,BO as bI,HO as bJ,yl as bK,zs as ba,Tl as bb,Is as bc,CP as bd,Ef as be,qs as bf,Of as bg,yT as bh,ST as bi,WO as bj,QO as bk,kP as bl,SP as bm,wP as bn,NP as bo,sv as bp,iM as bq,sM as br,IO as bs,RO as bt,Xx as bu,ON as bv,MN as bw,Rd as bx,Di as by,SN as bz,K as c,ot as d,yP as e,xP as f,Tj as g,UE as h,pO as i,bj as j,vj as k,U1 as l,H1 as m,Do as n,bP as o,wa as p,Na as q,hb as r,Nf as s,mb as t,sf as u,kf as v,_s as w,Uy as x,HT as y,eP as z};
|
|
69
|
+
`);return{valid:!1,error:r,line:f.length}}return{valid:!1,error:r}}}function eM(n){if(!n.trim())return{valid:!0};try{return Qj(n),{valid:!0}}catch(a){const o=a.message,r=o.match(/line\s+(\d+)/i);return{valid:!1,error:o,line:r?Number.parseInt(r[1],10):void 0}}}function iv({value:n,onChange:a,language:o="json",readonly:r=!1,className:c,minHeight:d="300px",heightMode:f="content"}){const{isDark:m}=mf(),[p,y]=C.useState(!1),[S,x]=C.useState(!0),b=f==="fill-parent",j=C.useMemo(()=>o==="json"?Jj(n):o==="toml"?eM(n):{valid:!0},[n,o]),N=C.useCallback(E=>l.jsx(Gw,{prism:Rj,theme:m?$g.nightOwl:$g.github,code:E,language:o,children:({tokens:L,getLineProps:O,getTokenProps:D})=>{let A=!1;return l.jsx(l.Fragment,{children:L.map((k,T)=>l.jsx("div",{...O({line:k}),className:K(j.line===T+1&&"bg-destructive/20"),children:k.map((w,R)=>{let I=!1;if(w.types.includes("property")){const F=w.content.replace(/['"]/g,"");Zj(F)?A=!0:A=!1}else(w.types.includes("string")||w.types.includes("number")||w.types.includes("boolean"))&&A?(I=!0,A=!1):w.types.includes("punctuation")&&w.content!==":"&&w.content!=="["&&w.content!=="{"&&(A=!1);const z=D({token:w});return I&&S&&(z.className=K(z.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),l.jsx("span",{...z},R)})},T))})}}),[m,o,j.line,S]);return l.jsxs("div",{className:K("flex min-h-0 flex-col",b&&"h-full",c),style:b?{height:d==="auto"?void 0:d}:void 0,children:[l.jsxs("div",{className:K("relative rounded-md border overflow-hidden","bg-muted/30",b&&"flex min-h-0 flex-1 flex-col",p&&"ring-2 ring-ring ring-offset-2 ring-offset-background",r&&"opacity-70 cursor-not-allowed",!j.valid&&"border-destructive"),"data-slot":"code-editor-surface",children:[l.jsx("div",{className:K(b&&"scrollbar-editor min-h-0 flex-1 overflow-auto"),"data-slot":b?"code-editor-viewport":void 0,children:l.jsx(Oj,{value:n,onValueChange:r?()=>{}:a,highlight:N,padding:12,disabled:r,onFocus:()=>y(!0),onBlur:()=>y(!1),textareaClassName:K("focus:outline-none font-mono text-sm",r&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:d}},m?"dark-editor":"light-editor")}),l.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:l.jsx(ot,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>x(!S),title:S?"Reveal sensitive values":"Mask sensitive values",children:S?l.jsx(Ys,{className:"h-3 w-3"}):l.jsx(Vs,{className:"h-3 w-3"})})})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[j.valid?l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[l.jsx($s,{className:"w-3 h-3 text-green-500"}),"Valid ",o.toUpperCase()]}):l.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[l.jsx(Bs,{className:"w-3 h-3"}),j.error,j.line&&` (line ${j.line})`]}),r&&l.jsx("span",{className:"ml-auto text-muted-foreground",children:"(Read-only)"})]})]})}const Ql=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:iv},Symbol.toStringTag,{value:"Module"})),tM={webSearchConfig:null,webSearchStatus:null,webSearchLoading:!0,webSearchStatusLoading:!0,webSearchSaving:!1,webSearchError:null,webSearchSuccess:!1,globalEnvConfig:null,globalEnvLoading:!0,globalEnvSaving:!1,globalEnvError:null,globalEnvSuccess:!1,proxyConfig:null,proxyLoading:!0,proxySaving:!1,proxyError:null,proxySuccess:!1,proxyTestResult:null,proxyTesting:!1,rawConfig:null,rawConfigLoading:!1};function nM(n,a){switch(a.type){case"SET_WEBSEARCH_CONFIG":return{...n,webSearchConfig:a.payload};case"SET_WEBSEARCH_STATUS":return{...n,webSearchStatus:a.payload};case"SET_WEBSEARCH_LOADING":return{...n,webSearchLoading:a.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...n,webSearchStatusLoading:a.payload};case"SET_WEBSEARCH_SAVING":return{...n,webSearchSaving:a.payload};case"SET_WEBSEARCH_ERROR":return{...n,webSearchError:a.payload};case"SET_WEBSEARCH_SUCCESS":return{...n,webSearchSuccess:a.payload};case"SET_GLOBALENV_CONFIG":return{...n,globalEnvConfig:a.payload};case"SET_GLOBALENV_LOADING":return{...n,globalEnvLoading:a.payload};case"SET_GLOBALENV_SAVING":return{...n,globalEnvSaving:a.payload};case"SET_GLOBALENV_ERROR":return{...n,globalEnvError:a.payload};case"SET_GLOBALENV_SUCCESS":return{...n,globalEnvSuccess:a.payload};case"SET_PROXY_CONFIG":return{...n,proxyConfig:a.payload};case"SET_PROXY_LOADING":return{...n,proxyLoading:a.payload};case"SET_PROXY_SAVING":return{...n,proxySaving:a.payload};case"SET_PROXY_ERROR":return{...n,proxyError:a.payload};case"SET_PROXY_SUCCESS":return{...n,proxySuccess:a.payload};case"SET_PROXY_TEST_RESULT":return{...n,proxyTestResult:a.payload};case"SET_PROXY_TESTING":return{...n,proxyTesting:a.payload};case"SET_RAW_CONFIG":return{...n,rawConfig:a.payload};case"SET_RAW_CONFIG_LOADING":return{...n,rawConfigLoading:a.payload};default:return n}}const ov=C.createContext(null);function aM({children:n}){const[a,o]=C.useReducer(nM,tM);return l.jsx(ov.Provider,{value:{state:a,dispatch:o},children:n})}function sv(){const n=C.useContext(ov);if(!n)throw new Error("useSettingsContext must be used within a SettingsProvider");return n}function iM(){const{dispatch:n}=sv(),a=C.useCallback(w=>n({type:"SET_WEBSEARCH_CONFIG",payload:w}),[n]),o=C.useCallback(w=>n({type:"SET_WEBSEARCH_STATUS",payload:w}),[n]),r=C.useCallback(w=>n({type:"SET_WEBSEARCH_LOADING",payload:w}),[n]),c=C.useCallback(w=>n({type:"SET_WEBSEARCH_STATUS_LOADING",payload:w}),[n]),d=C.useCallback(w=>n({type:"SET_WEBSEARCH_SAVING",payload:w}),[n]),f=C.useCallback(w=>n({type:"SET_WEBSEARCH_ERROR",payload:w}),[n]),m=C.useCallback(w=>n({type:"SET_WEBSEARCH_SUCCESS",payload:w}),[n]),p=C.useCallback(w=>n({type:"SET_GLOBALENV_CONFIG",payload:w}),[n]),y=C.useCallback(w=>n({type:"SET_GLOBALENV_LOADING",payload:w}),[n]),S=C.useCallback(w=>n({type:"SET_GLOBALENV_SAVING",payload:w}),[n]),x=C.useCallback(w=>n({type:"SET_GLOBALENV_ERROR",payload:w}),[n]),b=C.useCallback(w=>n({type:"SET_GLOBALENV_SUCCESS",payload:w}),[n]),j=C.useCallback(w=>n({type:"SET_PROXY_CONFIG",payload:w}),[n]),N=C.useCallback(w=>n({type:"SET_PROXY_LOADING",payload:w}),[n]),E=C.useCallback(w=>n({type:"SET_PROXY_SAVING",payload:w}),[n]),L=C.useCallback(w=>n({type:"SET_PROXY_ERROR",payload:w}),[n]),O=C.useCallback(w=>n({type:"SET_PROXY_SUCCESS",payload:w}),[n]),D=C.useCallback(w=>n({type:"SET_PROXY_TEST_RESULT",payload:w}),[n]),A=C.useCallback(w=>n({type:"SET_PROXY_TESTING",payload:w}),[n]),k=C.useCallback(w=>n({type:"SET_RAW_CONFIG",payload:w}),[n]),T=C.useCallback(w=>n({type:"SET_RAW_CONFIG_LOADING",payload:w}),[n]);return C.useMemo(()=>({setWebSearchConfig:a,setWebSearchStatus:o,setWebSearchLoading:r,setWebSearchStatusLoading:c,setWebSearchSaving:d,setWebSearchError:f,setWebSearchSuccess:m,setGlobalEnvConfig:p,setGlobalEnvLoading:y,setGlobalEnvSaving:S,setGlobalEnvError:x,setGlobalEnvSuccess:b,setProxyConfig:j,setProxyLoading:N,setProxySaving:E,setProxyError:L,setProxySuccess:O,setProxyTestResult:D,setProxyTesting:A,setRawConfig:k,setRawConfigLoading:T}),[a,o,r,c,d,f,m,p,y,S,x,b,j,N,E,L,O,D,A,k,T])}function oM(){const[n,a]=vS(),o=n.get("tab")?.toLowerCase(),r=o==="imageanalysis"||o==="image"?"image":o==="channels"?"channels":o==="globalenv"?"globalenv":o==="proxy"?"proxy":o==="auth"?"auth":o==="thinking"?"thinking":o==="backups"?"backups":"websearch",c=C.useCallback(d=>{a({tab:d},{replace:!0})},[a]);return{activeTab:r,setActiveTab:c}}function sM(){const{state:n}=sv(),a=iM(),[o,r]=C.useState(!1),c=C.useCallback(async()=>{try{a.setRawConfigLoading(!0);const f=await fetch("/api/config/raw");if(!f.ok){a.setRawConfig(null);return}const m=await f.text();a.setRawConfig(m)}catch{a.setRawConfig(null)}finally{a.setRawConfigLoading(!1)}},[a]),d=C.useCallback(async()=>{if(n.rawConfig)try{await navigator.clipboard.writeText(n.rawConfig),r(!0),setTimeout(()=>r(!1),2e3)}catch{}},[n.rawConfig]);return{rawConfig:n.rawConfig,loading:n.rawConfigLoading,copied:o,fetchRawConfig:c,copyToClipboard:d}}function $y({activeTab:n,onTabChange:a}){const{t:o}=Et(),r=[{value:"websearch",label:o("settingsTabs.web"),icon:Kx},{value:"image",label:"Image",icon:Gx},{value:"channels",label:"Channels",icon:ew},{value:"globalenv",label:o("settingsTabs.env"),icon:af},{value:"thinking",label:o("settingsTabs.think"),icon:tw},{value:"proxy",label:o("settingsTabs.proxy"),icon:nw},{value:"auth",label:o("settingsTabs.auth"),icon:ef},{value:"backups",label:o("settingsTabs.backup"),icon:aw}];return l.jsx(Vb,{value:n,onValueChange:c=>a(c),children:l.jsx(Pf,{className:"grid w-full grid-cols-8",children:r.map(({value:c,label:d,icon:f})=>l.jsxs(jl,{value:c,className:"gap-1.5 px-2 text-xs",children:[l.jsx(f,{className:"h-3.5 w-3.5 shrink-0"}),l.jsx("span",{className:"truncate",children:d})]},c))})})}function Wy(){return l.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[l.jsx(We,{className:"h-4 w-2/3"}),l.jsx("div",{className:"p-4 rounded-lg border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{className:"h-5 w-32"}),l.jsx(We,{className:"h-4 w-48"})]}),l.jsx(We,{className:"h-6 w-10 rounded-full"})]})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(We,{className:"h-5 w-24"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{className:"h-20 w-full rounded-lg"}),l.jsx(We,{className:"h-20 w-full rounded-lg"}),l.jsx(We,{className:"h-20 w-full rounded-lg"})]})]})]})}function rv(n,a=3,o=1e3){return n().catch(r=>{if(a<=0)throw r;return new Promise(c=>setTimeout(c,o)).then(()=>rv(n,a-1,o*2))})}function ti(n){return C.lazy(()=>rv(n))}const Qy=ti(()=>at(()=>import("./index-Dpuz53pn.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Xy=ti(()=>at(()=>import("./index-cOly4ImO.js"),__vite__mapDeps([10,1,2,4,5,6,7,8,9]))),Zy=ti(()=>at(()=>import("./channels-CvkF3ixl.js"),__vite__mapDeps([11,1,2,4,5,6,7,8,9]))),Jy=ti(()=>at(()=>import("./globalenv-section-mQ8oT-0M.js"),__vite__mapDeps([12,1,2,4,5,6,7,8,9]))),ex=ti(()=>at(()=>import("./index-CKq4TwgW.js"),__vite__mapDeps([13,1,2,4,5,6,7,8,9]))),tx=ti(()=>at(()=>import("./index-QCr5xkSP.js"),__vite__mapDeps([14,1,2,15,4,16,17,5,6,18,7,8,9]))),nx=ti(()=>at(()=>import("./auth-section-C6AxJpFM.js"),__vite__mapDeps([19,1,2,4,5,6,7,8,9]))),ax=ti(()=>at(()=>import("./backups-section-DQYzN9nM.js"),__vite__mapDeps([20,1,2,17,4,5,6,7,8,9])));class ix extends C.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){return this.state.hasError?l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsxs("div",{className:"text-center p-6 max-w-md",children:[l.jsx(Bs,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),l.jsx("p",{className:"font-medium text-foreground mb-2",children:Fe.t("settings.sectionLoadFailed")}),l.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||Fe.t("settings.unknownError")}),l.jsxs(ot,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[l.jsx(Hs,{className:"w-4 h-4"}),Fe.t("settings.reloadPage")]})]})}):this.props.children}}function rM(){const{t:n}=Et(),{activeTab:a,setActiveTab:o}=oM(),{rawConfig:r,loading:c,copied:d,fetchRawConfig:f,copyToClipboard:m}=sM();C.useEffect(()=>{f()},[f]);const p=y=>{C.startTransition(()=>{o(y)})};return l.jsxs("div",{className:"h-full min-h-0",children:[l.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[l.jsx("div",{className:"border-b bg-background p-4",children:l.jsx($y,{activeTab:a,onTabChange:p})}),l.jsx(ix,{children:l.jsxs(C.Suspense,{fallback:l.jsx(Wy,{}),children:[a==="websearch"&&l.jsx(Qy,{}),a==="image"&&l.jsx(Xy,{}),a==="channels"&&l.jsx(Zy,{}),a==="globalenv"&&l.jsx(Jy,{}),a==="thinking"&&l.jsx(ex,{}),a==="proxy"&&l.jsx(tx,{}),a==="auth"&&l.jsx(nx,{}),a==="backups"&&l.jsx(ax,{})]})})]}),l.jsxs(Ef,{direction:"horizontal",className:"h-full hidden md:flex",children:[l.jsx(qs,{defaultSize:46,minSize:36,maxSize:62,children:l.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[l.jsx("div",{className:"p-5 border-b bg-background",children:l.jsx($y,{activeTab:a,onTabChange:p})}),l.jsx(ix,{children:l.jsxs(C.Suspense,{fallback:l.jsx(Wy,{}),children:[a==="websearch"&&l.jsx(Qy,{}),a==="image"&&l.jsx(Xy,{}),a==="channels"&&l.jsx(Zy,{}),a==="globalenv"&&l.jsx(Jy,{}),a==="thinking"&&l.jsx(ex,{}),a==="proxy"&&l.jsx(tx,{}),a==="auth"&&l.jsx(nx,{}),a==="backups"&&l.jsx(ax,{})]})})]})}),l.jsx(Of,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:l.jsx(Ll,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),l.jsx(qs,{defaultSize:54,minSize:35,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Kg,{className:"w-5 h-5 text-primary"}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-semibold",children:"config.yaml"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ot,{variant:"outline",size:"sm",onClick:m,disabled:!r,children:d?l.jsxs(l.Fragment,{children:[l.jsx(wo,{className:"w-4 h-4 mr-1"}),n("settings.copied")]}):l.jsxs(l.Fragment,{children:[l.jsx(Sl,{className:"w-4 h-4 mr-1"}),n("settings.copy")]})}),l.jsx(ot,{variant:"outline",size:"sm",onClick:f,disabled:c,children:l.jsx(Hs,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:r?l.jsx(iv,{value:r,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):c?l.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[l.jsx(Hs,{className:"w-5 h-5 animate-spin mr-2"}),n("settings.loading")]}):l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:l.jsxs("div",{className:"text-center",children:[l.jsx(Kg,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),l.jsx("p",{children:n("settings.configFileNotFound")}),l.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function lM(){return l.jsx(aM,{children:l.jsx(rM,{})})}const cM=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:lM},Symbol.toStringTag,{value:"Module"}));function uM(n,a,o="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:o}).format(a).split(/\s/g).slice(2).join(" ")}const dM={},Os={};function ki(n,a){try{const r=(dM[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(a).split("GMT")[1];return r in Os?Os[r]:ox(r,r.split(":"))}catch{if(n in Os)return Os[n];const o=n?.match(fM);return o?ox(n,o.slice(1)):NaN}}const fM=/([+-]\d\d):?(\d\d)?/;function ox(n,a){const o=+(a[0]||0),r=+(a[1]||0),c=+(a[2]||0)/60;return Os[n]=o*60+r>0?o*60+r+c:o*60-r-c}class qn extends Date{constructor(...a){super(),a.length>1&&typeof a[a.length-1]=="string"&&(this.timeZone=a.pop()),this.internal=new Date,isNaN(ki(this.timeZone,this))?this.setTime(NaN):a.length?typeof a[0]=="number"&&(a.length===1||a.length===2&&typeof a[1]!="number")?this.setTime(a[0]):typeof a[0]=="string"?this.setTime(+new Date(a[0])):a[0]instanceof Date?this.setTime(+a[0]):(this.setTime(+new Date(...a)),lv(this),Xd(this)):this.setTime(Date.now())}static tz(a,...o){return o.length?new qn(...o,a):new qn(Date.now(),a)}withTimeZone(a){return new qn(+this,a)}getTimezoneOffset(){const a=-ki(this.timeZone,this);return a>0?Math.floor(a):Math.ceil(a)}setTime(a){return Date.prototype.setTime.apply(this,arguments),Xd(this),+this}[Symbol.for("constructDateFrom")](a){return new qn(+new Date(a),this.timeZone)}}const sx=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!sx.test(n))return;const a=n.replace(sx,"$1UTC");qn.prototype[a]&&(n.startsWith("get")?qn.prototype[n]=function(){return this.internal[a]()}:(qn.prototype[n]=function(){return Date.prototype[a].apply(this.internal,arguments),hM(this),+this},qn.prototype[a]=function(){return Date.prototype[a].apply(this,arguments),Xd(this),+this}))});function Xd(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-ki(n.timeZone,n)*60))}function hM(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),lv(n)}function lv(n){const a=ki(n.timeZone,n),o=a>0?Math.floor(a):Math.ceil(a),r=new Date(+n);r.setUTCHours(r.getUTCHours()-1);const c=-new Date(+n).getTimezoneOffset(),d=-new Date(+r).getTimezoneOffset(),f=c-d,m=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();f&&m&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+f);const p=c-o;p&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+p);const y=new Date(+n);y.setUTCSeconds(0);const S=c>0?y.getSeconds():(y.getSeconds()-60)%60,x=Math.round(-(ki(n.timeZone,n)*60))%60;(x||S)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+x),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+x+S));const b=ki(n.timeZone,n),j=b>0?Math.floor(b):Math.ceil(b),E=-new Date(+n).getTimezoneOffset()-j,L=j!==o,O=E-p;if(L&&O){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+O);const D=ki(n.timeZone,n),A=D>0?Math.floor(D):Math.ceil(D),k=j-A;k&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+k))}}class xa extends qn{static tz(a,...o){return o.length?new xa(...o,a):new xa(Date.now(),a)}toISOString(){const[a,o,r]=this.tzComponents(),c=`${a}${o}:${r}`;return this.internal.toISOString().slice(0,-1)+c}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[a,o,r,c]=this.internal.toUTCString().split(" ");return`${a?.slice(0,-1)} ${r} ${o} ${c}`}toTimeString(){const a=this.internal.toUTCString().split(" ")[4],[o,r,c]=this.tzComponents();return`${a} GMT${o}${r}${c} (${uM(this.timeZone,this)})`}toLocaleString(a,o){return Date.prototype.toLocaleString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}toLocaleDateString(a,o){return Date.prototype.toLocaleDateString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}toLocaleTimeString(a,o){return Date.prototype.toLocaleTimeString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}tzComponents(){const a=this.getTimezoneOffset(),o=a>0?"-":"+",r=String(Math.floor(Math.abs(a)/60)).padStart(2,"0"),c=String(Math.abs(a)%60).padStart(2,"0");return[o,r,c]}withTimeZone(a){return new xa(+this,a)}[Symbol.for("constructDateFrom")](a){return new xa(+new Date(a),this.timeZone)}}const rx=5,mM=4;function pM(n,a){const o=a.startOfMonth(n),r=o.getDay()>0?o.getDay():7,c=a.addDays(n,-r+1),d=a.addDays(c,rx*7-1);return a.getMonth(n)===a.getMonth(d)?rx:mM}function cv(n,a){const o=a.startOfMonth(n),r=o.getDay();return r===1?o:r===0?a.addDays(o,-6):a.addDays(o,-1*(r-1))}function gM(n,a){const o=cv(n,a),r=pM(n,a);return a.addDays(o,r*7-1)}const uv={...ws,labels:{labelDayButton:(n,a,o,r)=>{let c;r&&typeof r.format=="function"?c=r.format.bind(r):c=(f,m)=>Ds(f,m,{locale:ws,...o});let d=c(n,"PPPP");return a.today&&(d=`Today, ${d}`),a.selected&&(d=`${d}, selected`),d},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:n=>`Week ${n}`,labelYearDropdown:"Choose the Year",labelGrid:(n,a,o)=>{let r;return o&&typeof o.format=="function"?r=o.format.bind(o):r=(c,d)=>Ds(c,d,{locale:ws,...a}),r(n,"LLLL yyyy")},labelGridcell:(n,a,o,r)=>{let c;r&&typeof r.format=="function"?c=r.format.bind(r):c=(f,m)=>Ds(f,m,{locale:ws,...o});let d=c(n,"PPPP");return a?.today&&(d=`Today, ${d}`),d},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,a,o)=>{let r;return o&&typeof o.format=="function"?r=o.format.bind(o):r=(c,d)=>Ds(c,d,{locale:ws,...a}),r(n,"cccc")}}};class hn{constructor(a,o){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?xa.tz(this.options.timeZone):new this.Date,this.newDate=(r,c,d)=>this.overrides?.newDate?this.overrides.newDate(r,c,d):this.options.timeZone?new xa(r,c,d,this.options.timeZone):new Date(r,c,d),this.addDays=(r,c)=>this.overrides?.addDays?this.overrides.addDays(r,c):lw(r,c),this.addMonths=(r,c)=>this.overrides?.addMonths?this.overrides.addMonths(r,c):cw(r,c),this.addWeeks=(r,c)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,c):uw(r,c),this.addYears=(r,c)=>this.overrides?.addYears?this.overrides.addYears(r,c):dw(r,c),this.differenceInCalendarDays=(r,c)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,c):fw(r,c),this.differenceInCalendarMonths=(r,c)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,c):hw(r,c),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):mw(r),this.eachYearOfInterval=r=>{const c=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):pw(r),d=new Set(c.map(m=>this.getYear(m)));if(d.size===c.length)return c;const f=[];return d.forEach(m=>{f.push(new Date(m,0,1))}),f},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):gM(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):gw(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):yw(r),this.endOfWeek=(r,c)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,c):xw(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):bw(r),this.format=(r,c,d)=>{const f=this.overrides?.format?this.overrides.format(r,c,this.options):Ds(r,c,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(f):f},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vw(r),this.getMonth=(r,c)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Cw(r,this.options),this.getYear=(r,c)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Sw(r,this.options),this.getWeek=(r,c)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):ww(r,this.options),this.isAfter=(r,c)=>this.overrides?.isAfter?this.overrides.isAfter(r,c):Nw(r,c),this.isBefore=(r,c)=>this.overrides?.isBefore?this.overrides.isBefore(r,c):kw(r,c),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Aw(r),this.isSameDay=(r,c)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,c):Dw(r,c),this.isSameMonth=(r,c)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,c):Tw(r,c),this.isSameYear=(r,c)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,c):jw(r,c),this.max=r=>this.overrides?.max?this.overrides.max(r):Mw(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Ew(r),this.setMonth=(r,c)=>this.overrides?.setMonth?this.overrides.setMonth(r,c):Ow(r,c),this.setYear=(r,c)=>this.overrides?.setYear?this.overrides.setYear(r,c):Pw(r,c),this.startOfBroadcastWeek=(r,c)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):cv(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Lw(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Rw(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):_w(r),this.startOfWeek=(r,c)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):zw(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):Iw(r),this.options={locale:uv,...a},this.overrides=o}getDigitMap(){const{numerals:a="latn"}=this.options,o=new Intl.NumberFormat("en-US",{numberingSystem:a}),r={};for(let c=0;c<10;c++)r[c.toString()]=o.format(c);return r}replaceDigits(a){const o=this.getDigitMap();return a.replace(/\d/g,r=>o[r]||r)}formatNumber(a){return this.replaceDigits(a.toString())}getMonthYearOrder(){const a=this.options.locale?.code;return a&&hn.yearFirstLocales.has(a)?"year-first":"month-first"}formatMonthYear(a){const{locale:o,timeZone:r,numerals:c}=this.options,d=o?.code;if(d&&hn.yearFirstLocales.has(d))try{return new Intl.DateTimeFormat(d,{month:"long",year:"numeric",timeZone:r,numberingSystem:c}).format(a)}catch{}const f=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(a,f)}}hn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Vn=new hn;class dv{constructor(a,o,r=Vn){this.date=a,this.displayMonth=o,this.outside=!!(o&&!r.isSameMonth(a,o)),this.dateLib=r,this.isoDate=r.format(a,"yyyy-MM-dd"),this.displayMonthId=r.format(o,"yyyy-MM"),this.dateMonthId=r.format(a,"yyyy-MM")}isEqualTo(a){return this.dateLib.isSameDay(a.date,this.date)&&this.dateLib.isSameMonth(a.displayMonth,this.displayMonth)}}class yM{constructor(a,o){this.date=a,this.weeks=o}}class xM{constructor(a,o){this.days=o,this.weekNumber=a}}function bM(n){return ce.createElement("button",{...n})}function vM(n){return ce.createElement("span",{...n})}function CM(n){const{size:a=24,orientation:o="left",className:r}=n;return ce.createElement("svg",{className:r,width:a,height:a,viewBox:"0 0 24 24"},o==="up"&&ce.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),o==="down"&&ce.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),o==="left"&&ce.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),o==="right"&&ce.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function SM(n){const{day:a,modifiers:o,...r}=n;return ce.createElement("td",{...r})}function wM(n){const{day:a,modifiers:o,...r}=n,c=ce.useRef(null);return ce.useEffect(()=>{o.focused&&c.current?.focus()},[o.focused]),ce.createElement("button",{ref:c,...r})}var xe;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(xe||(xe={}));var ht;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(ht||(ht={}));var En;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(En||(En={}));var fn;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(fn||(fn={}));function NM(n){const{options:a,className:o,components:r,classNames:c,...d}=n,f=[c[xe.Dropdown],o].join(" "),m=a?.find(({value:p})=>p===d.value);return ce.createElement("span",{"data-disabled":d.disabled,className:c[xe.DropdownRoot]},ce.createElement(r.Select,{className:f,...d},a?.map(({value:p,label:y,disabled:S})=>ce.createElement(r.Option,{key:p,value:p,disabled:S},y))),ce.createElement("span",{className:c[xe.CaptionLabel],"aria-hidden":!0},m?.label,ce.createElement(r.Chevron,{orientation:"down",size:18,className:c[xe.Chevron]})))}function kM(n){return ce.createElement("div",{...n})}function AM(n){return ce.createElement("div",{...n})}function DM(n){const{calendarMonth:a,displayIndex:o,...r}=n;return ce.createElement("div",{...r},n.children)}function TM(n){const{calendarMonth:a,displayIndex:o,...r}=n;return ce.createElement("div",{...r})}function jM(n){return ce.createElement("table",{...n})}function MM(n){return ce.createElement("div",{...n})}const fv=C.createContext(void 0);function Xs(){const n=C.useContext(fv);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function EM(n){const{components:a}=Xs();return ce.createElement(a.Dropdown,{...n})}function OM(n){const{onPreviousClick:a,onNextClick:o,previousMonth:r,nextMonth:c,...d}=n,{components:f,classNames:m,labels:{labelPrevious:p,labelNext:y}}=Xs(),S=C.useCallback(b=>{c&&o?.(b)},[c,o]),x=C.useCallback(b=>{r&&a?.(b)},[r,a]);return ce.createElement("nav",{...d},ce.createElement(f.PreviousMonthButton,{type:"button",className:m[xe.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":p(r),onClick:x},ce.createElement(f.Chevron,{disabled:r?void 0:!0,className:m[xe.Chevron],orientation:"left"})),ce.createElement(f.NextMonthButton,{type:"button",className:m[xe.NextMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":y(c),onClick:S},ce.createElement(f.Chevron,{disabled:c?void 0:!0,orientation:"right",className:m[xe.Chevron]})))}function PM(n){const{components:a}=Xs();return ce.createElement(a.Button,{...n})}function LM(n){return ce.createElement("option",{...n})}function RM(n){const{components:a}=Xs();return ce.createElement(a.Button,{...n})}function _M(n){const{rootRef:a,...o}=n;return ce.createElement("div",{...o,ref:a})}function zM(n){return ce.createElement("select",{...n})}function IM(n){const{week:a,...o}=n;return ce.createElement("tr",{...o})}function UM(n){return ce.createElement("th",{...n})}function HM(n){return ce.createElement("thead",{"aria-hidden":!0},ce.createElement("tr",{...n}))}function BM(n){const{week:a,...o}=n;return ce.createElement("th",{...o})}function KM(n){return ce.createElement("th",{...n})}function qM(n){return ce.createElement("tbody",{...n})}function FM(n){const{components:a}=Xs();return ce.createElement(a.Dropdown,{...n})}const GM=Object.freeze(Object.defineProperty({__proto__:null,Button:bM,CaptionLabel:vM,Chevron:CM,Day:SM,DayButton:wM,Dropdown:NM,DropdownNav:kM,Footer:AM,Month:DM,MonthCaption:TM,MonthGrid:jM,Months:MM,MonthsDropdown:EM,Nav:OM,NextMonthButton:PM,Option:LM,PreviousMonthButton:RM,Root:_M,Select:zM,Week:IM,WeekNumber:BM,WeekNumberHeader:KM,Weekday:UM,Weekdays:HM,Weeks:qM,YearsDropdown:FM},Symbol.toStringTag,{value:"Module"}));function ba(n,a,o=!1,r=Vn){let{from:c,to:d}=n;const{differenceInCalendarDays:f,isSameDay:m}=r;return c&&d?(f(d,c)<0&&([c,d]=[d,c]),f(a,c)>=(o?1:0)&&f(d,a)>=(o?1:0)):!o&&d?m(d,a):!o&&c?m(c,a):!1}function Kf(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Xl(n){return!!(n&&typeof n=="object"&&"from"in n)}function qf(n){return!!(n&&typeof n=="object"&&"after"in n)}function Ff(n){return!!(n&&typeof n=="object"&&"before"in n)}function hv(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function mv(n,a){return Array.isArray(n)&&n.every(a.isDate)}function va(n,a,o=Vn){const r=Array.isArray(a)?a:[a],{isSameDay:c,differenceInCalendarDays:d,isAfter:f}=o;return r.some(m=>{if(typeof m=="boolean")return m;if(o.isDate(m))return c(n,m);if(mv(m,o))return m.some(p=>c(n,p));if(Xl(m))return ba(m,n,!1,o);if(hv(m))return Array.isArray(m.dayOfWeek)?m.dayOfWeek.includes(n.getDay()):m.dayOfWeek===n.getDay();if(Kf(m)){const p=d(m.before,n),y=d(m.after,n),S=p>0,x=y<0;return f(m.before,m.after)?x&&S:S||x}return qf(m)?d(n,m.after)>0:Ff(m)?d(m.before,n)>0:typeof m=="function"?m(n):!1})}function VM(n,a,o,r,c){const{disabled:d,hidden:f,modifiers:m,showOutsideDays:p,broadcastCalendar:y,today:S=c.today()}=a,{isSameDay:x,isSameMonth:b,startOfMonth:j,isBefore:N,endOfMonth:E,isAfter:L}=c,O=o&&j(o),D=r&&E(r),A={[ht.focused]:[],[ht.outside]:[],[ht.disabled]:[],[ht.hidden]:[],[ht.today]:[]},k={};for(const T of n){const{date:w,displayMonth:R}=T,I=!!(R&&!b(w,R)),z=!!(O&&N(w,O)),F=!!(D&&L(w,D)),ee=!!(d&&va(w,d,c)),Q=!!(f&&va(w,f,c))||z||F||!y&&!p&&I||y&&p===!1&&I,ge=x(w,S);I&&A.outside.push(T),ee&&A.disabled.push(T),Q&&A.hidden.push(T),ge&&A.today.push(T),m&&Object.keys(m).forEach(te=>{const ve=m?.[te];ve&&va(w,ve,c)&&(k[te]?k[te].push(T):k[te]=[T])})}return T=>{const w={[ht.focused]:!1,[ht.disabled]:!1,[ht.hidden]:!1,[ht.outside]:!1,[ht.today]:!1},R={};for(const I in A){const z=A[I];w[I]=z.some(F=>F===T)}for(const I in k)R[I]=k[I].some(z=>z===T);return{...w,...R}}}function YM(n,a,o={}){return Object.entries(n).filter(([,c])=>c===!0).reduce((c,[d])=>(o[d]?c.push(o[d]):a[ht[d]]?c.push(a[ht[d]]):a[En[d]]&&c.push(a[En[d]]),c),[a[xe.Day]])}function $M(n){return{...GM,...n}}function WM(n){const a={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([o,r])=>{o.startsWith("data-")&&(a[o]=r)}),a}function QM(){const n={};for(const a in xe)n[xe[a]]=`rdp-${xe[a]}`;for(const a in ht)n[ht[a]]=`rdp-${ht[a]}`;for(const a in En)n[En[a]]=`rdp-${En[a]}`;for(const a in fn)n[fn[a]]=`rdp-${fn[a]}`;return n}function pv(n,a,o){return(o??new hn(a)).formatMonthYear(n)}const XM=pv;function ZM(n,a,o){return(o??new hn(a)).format(n,"d")}function JM(n,a=Vn){return a.format(n,"LLLL")}function eE(n,a,o){return(o??new hn(a)).format(n,"cccccc")}function tE(n,a=Vn){return n<10?a.formatNumber(`0${n.toLocaleString()}`):a.formatNumber(`${n.toLocaleString()}`)}function nE(){return""}function gv(n,a=Vn){return a.format(n,"yyyy")}const aE=gv,iE=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:pv,formatDay:ZM,formatMonthCaption:XM,formatMonthDropdown:JM,formatWeekNumber:tE,formatWeekNumberHeader:nE,formatWeekdayName:eE,formatYearCaption:aE,formatYearDropdown:gv},Symbol.toStringTag,{value:"Module"}));function oE(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...iE,...n}}function Gf(n,a,o,r){let c=(r??new hn(o)).format(n,"PPPP");return a.today&&(c=`Today, ${c}`),a.selected&&(c=`${c}, selected`),c}const sE=Gf;function Vf(n,a,o){return(o??new hn(a)).formatMonthYear(n)}const rE=Vf;function yv(n,a,o,r){let c=(r??new hn(o)).format(n,"PPPP");return a?.today&&(c=`Today, ${c}`),c}function xv(n){return"Choose the Month"}function bv(){return""}const lE="Go to the Next Month";function vv(n,a){return lE}function Cv(n){return"Go to the Previous Month"}function Sv(n,a,o){return(o??new hn(a)).format(n,"cccc")}function wv(n,a){return`Week ${n}`}function Nv(n){return"Week Number"}function kv(n){return"Choose the Year"}const cE=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:rE,labelDay:sE,labelDayButton:Gf,labelGrid:Vf,labelGridcell:yv,labelMonthDropdown:xv,labelNav:bv,labelNext:vv,labelPrevious:Cv,labelWeekNumber:wv,labelWeekNumberHeader:Nv,labelWeekday:Sv,labelYearDropdown:kv},Symbol.toStringTag,{value:"Module"})),Mn=(n,a,o)=>a||(o?typeof o=="function"?o:(...r)=>o:n);function uE(n,a){const o=a.locale?.labels??{};return{...cE,...n??{},labelDayButton:Mn(Gf,n?.labelDayButton,o.labelDayButton),labelMonthDropdown:Mn(xv,n?.labelMonthDropdown,o.labelMonthDropdown),labelNext:Mn(vv,n?.labelNext,o.labelNext),labelPrevious:Mn(Cv,n?.labelPrevious,o.labelPrevious),labelWeekNumber:Mn(wv,n?.labelWeekNumber,o.labelWeekNumber),labelYearDropdown:Mn(kv,n?.labelYearDropdown,o.labelYearDropdown),labelGrid:Mn(Vf,n?.labelGrid,o.labelGrid),labelGridcell:Mn(yv,n?.labelGridcell,o.labelGridcell),labelNav:Mn(bv,n?.labelNav,o.labelNav),labelWeekNumberHeader:Mn(Nv,n?.labelWeekNumberHeader,o.labelWeekNumberHeader),labelWeekday:Mn(Sv,n?.labelWeekday,o.labelWeekday)}}function dE(n,a,o,r,c){const{startOfMonth:d,startOfYear:f,endOfYear:m,eachMonthOfInterval:p,getMonth:y}=c;return p({start:f(n),end:m(n)}).map(b=>{const j=r.formatMonthDropdown(b,c),N=y(b),E=a&&b<d(a)||o&&b>d(o)||!1;return{value:N,label:j,disabled:E}})}function fE(n,a={},o={}){let r={...a?.[xe.Day]};return Object.entries(n).filter(([,c])=>c===!0).forEach(([c])=>{r={...r,...o?.[c]}}),r}function hE(n,a,o,r){const c=r??n.today(),d=o?n.startOfBroadcastWeek(c,n):a?n.startOfISOWeek(c):n.startOfWeek(c),f=[];for(let m=0;m<7;m++){const p=n.addDays(d,m);f.push(p)}return f}function mE(n,a,o,r,c=!1){if(!n||!a)return;const{startOfYear:d,endOfYear:f,eachYearOfInterval:m,getYear:p}=r,y=d(n),S=f(a),x=m({start:y,end:S});return c&&x.reverse(),x.map(b=>{const j=o.formatYearDropdown(b,r);return{value:p(b),label:j,disabled:!1}})}const Zs=n=>n instanceof HTMLElement?n:null,Td=n=>[...n.querySelectorAll("[data-animated-month]")??[]],pE=n=>Zs(n.querySelector("[data-animated-month]")),jd=n=>Zs(n.querySelector("[data-animated-caption]")),Md=n=>Zs(n.querySelector("[data-animated-weeks]")),gE=n=>Zs(n.querySelector("[data-animated-nav]")),yE=n=>Zs(n.querySelector("[data-animated-weekdays]"));function xE(n,a,{classNames:o,months:r,focused:c,dateLib:d}){const f=C.useRef(null),m=C.useRef(r),p=C.useRef(!1);C.useLayoutEffect(()=>{const y=m.current;if(m.current=r,!a||!n.current||!(n.current instanceof HTMLElement)||r.length===0||y.length===0||r.length!==y.length)return;const S=d.isSameMonth(r[0].date,y[0].date),x=d.isAfter(r[0].date,y[0].date),b=x?o[fn.caption_after_enter]:o[fn.caption_before_enter],j=x?o[fn.weeks_after_enter]:o[fn.weeks_before_enter],N=f.current,E=n.current.cloneNode(!0);if(E instanceof HTMLElement?(Td(E).forEach(A=>{if(!(A instanceof HTMLElement))return;const k=pE(A);k&&A.contains(k)&&A.removeChild(k);const T=jd(A);T&&T.classList.remove(b);const w=Md(A);w&&w.classList.remove(j)}),f.current=E):f.current=null,p.current||S||c)return;const L=N instanceof HTMLElement?Td(N):[],O=Td(n.current);if(O?.every(D=>D instanceof HTMLElement)&&L&&L.every(D=>D instanceof HTMLElement)){p.current=!0,n.current.style.isolation="isolate";const D=gE(n.current);D&&(D.style.zIndex="1"),O.forEach((A,k)=>{const T=L[k];if(!T)return;A.style.position="relative",A.style.overflow="hidden";const w=jd(A);w&&w.classList.add(b);const R=Md(A);R&&R.classList.add(j);const I=()=>{p.current=!1,n.current&&(n.current.style.isolation=""),D&&(D.style.zIndex=""),w&&w.classList.remove(b),R&&R.classList.remove(j),A.style.position="",A.style.overflow="",A.contains(T)&&A.removeChild(T)};T.style.pointerEvents="none",T.style.position="absolute",T.style.overflow="hidden",T.setAttribute("aria-hidden","true");const z=yE(T);z&&(z.style.opacity="0");const F=jd(T);F&&(F.classList.add(x?o[fn.caption_before_exit]:o[fn.caption_after_exit]),F.addEventListener("animationend",I));const ee=Md(T);ee&&ee.classList.add(x?o[fn.weeks_before_exit]:o[fn.weeks_after_exit]),A.insertBefore(T,A.firstChild)})}})}function bE(n,a,o,r){const c=n[0],d=n[n.length-1],{ISOWeek:f,fixedWeeks:m,broadcastCalendar:p}=o??{},{addDays:y,differenceInCalendarDays:S,differenceInCalendarMonths:x,endOfBroadcastWeek:b,endOfISOWeek:j,endOfMonth:N,endOfWeek:E,isAfter:L,startOfBroadcastWeek:O,startOfISOWeek:D,startOfWeek:A}=r,k=p?O(c,r):f?D(c):A(c),T=p?b(d):f?j(N(d)):E(N(d)),w=a&&(p?b(a):f?j(a):E(a)),R=w&&L(T,w)?w:T,I=S(R,k),z=x(d,c)+1,F=[];for(let ge=0;ge<=I;ge++){const te=y(k,ge);F.push(te)}const Q=(p?35:42)*z;if(m&&F.length<Q){const ge=Q-F.length;for(let te=0;te<ge;te++){const ve=y(F[F.length-1],1);F.push(ve)}}return F}function vE(n){const a=[];return n.reduce((o,r)=>{const c=r.weeks.reduce((d,f)=>d.concat(f.days.slice()),a.slice());return o.concat(c.slice())},a.slice())}function CE(n,a,o,r){const{numberOfMonths:c=1}=o,d=[];for(let f=0;f<c;f++){const m=r.addMonths(n,f);if(a&&m>a)break;d.push(m)}return d}function lx(n,a,o,r){const{month:c,defaultMonth:d,today:f=r.today(),numberOfMonths:m=1}=n;let p=c||d||f;const{differenceInCalendarMonths:y,addMonths:S,startOfMonth:x}=r;if(o&&y(o,p)<m-1){const b=-1*(m-1);p=S(o,b)}return a&&y(p,a)<0&&(p=a),x(p)}function SE(n,a,o,r){const{addDays:c,endOfBroadcastWeek:d,endOfISOWeek:f,endOfMonth:m,endOfWeek:p,getISOWeek:y,getWeek:S,startOfBroadcastWeek:x,startOfISOWeek:b,startOfWeek:j}=r,N=n.reduce((E,L)=>{const O=o.broadcastCalendar?x(L,r):o.ISOWeek?b(L):j(L),D=o.broadcastCalendar?d(L):o.ISOWeek?f(m(L)):p(m(L)),A=a.filter(R=>R>=O&&R<=D),k=o.broadcastCalendar?35:42;if(o.fixedWeeks&&A.length<k){const R=a.filter(I=>{const z=k-A.length;return I>D&&I<=c(D,z)});A.push(...R)}const T=A.reduce((R,I)=>{const z=o.ISOWeek?y(I):S(I),F=R.find(Q=>Q.weekNumber===z),ee=new dv(I,L,r);return F?F.days.push(ee):R.push(new xM(z,[ee])),R},[]),w=new yM(L,T);return E.push(w),E},[]);return o.reverseMonths?N.reverse():N}function wE(n,a){let{startMonth:o,endMonth:r}=n;const{startOfYear:c,startOfDay:d,startOfMonth:f,endOfMonth:m,addYears:p,endOfYear:y,newDate:S,today:x}=a,{fromYear:b,toYear:j,fromMonth:N,toMonth:E}=n;!o&&N&&(o=N),!o&&b&&(o=a.newDate(b,0,1)),!r&&E&&(r=E),!r&&j&&(r=S(j,11,31));const L=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return o?o=f(o):b?o=S(b,0,1):!o&&L&&(o=c(p(n.today??x(),-100))),r?r=m(r):j?r=S(j,11,31):!r&&L&&(r=y(n.today??x())),[o&&d(o),r&&d(r)]}function NE(n,a,o,r){if(o.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:d=1}=o,{startOfMonth:f,addMonths:m,differenceInCalendarMonths:p}=r,y=c?d:1,S=f(n);if(!a)return m(S,y);if(!(p(a,n)<d))return m(S,y)}function kE(n,a,o,r){if(o.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:d}=o,{startOfMonth:f,addMonths:m,differenceInCalendarMonths:p}=r,y=c?d??1:1,S=f(n);if(!a)return m(S,-y);if(!(p(S,a)<=0))return m(S,-y)}function AE(n){const a=[];return n.reduce((o,r)=>o.concat(r.weeks.slice()),a.slice())}function Zl(n,a){const[o,r]=C.useState(n);return[a===void 0?o:a,r]}function DE(n,a){const[o,r]=wE(n,a),{startOfMonth:c,endOfMonth:d}=a,f=lx(n,o,r,a),[m,p]=Zl(f,n.month?f:void 0);C.useEffect(()=>{const k=lx(n,o,r,a);p(k)},[n.timeZone]);const{months:y,weeks:S,days:x,previousMonth:b,nextMonth:j}=C.useMemo(()=>{const k=CE(m,r,{numberOfMonths:n.numberOfMonths},a),T=bE(k,n.endMonth?d(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},a),w=SE(k,T,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},a),R=AE(w),I=vE(w),z=kE(m,o,n,a),F=NE(m,r,n,a);return{months:w,weeks:R,days:I,previousMonth:z,nextMonth:F}},[a,m.getTime(),r?.getTime(),o?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:N,onMonthChange:E}=n,L=k=>S.some(T=>T.days.some(w=>w.isEqualTo(k))),O=k=>{if(N)return;let T=c(k);o&&T<c(o)&&(T=c(o)),r&&T>c(r)&&(T=c(r)),p(T),E?.(T)};return{months:y,weeks:S,days:x,navStart:o,navEnd:r,previousMonth:b,nextMonth:j,goToMonth:O,goToDay:k=>{L(k)||O(k.date)}}}var Bn;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(Bn||(Bn={}));function cx(n){return!n[ht.disabled]&&!n[ht.hidden]&&!n[ht.outside]}function TE(n,a,o,r){let c,d=-1;for(const f of n){const m=a(f);cx(m)&&(m[ht.focused]&&d<Bn.FocusedModifier?(c=f,d=Bn.FocusedModifier):r?.isEqualTo(f)&&d<Bn.LastFocused?(c=f,d=Bn.LastFocused):o(f.date)&&d<Bn.Selected?(c=f,d=Bn.Selected):m[ht.today]&&d<Bn.Today&&(c=f,d=Bn.Today))}return c||(c=n.find(f=>cx(a(f)))),c}function jE(n,a,o,r,c,d,f){const{ISOWeek:m,broadcastCalendar:p}=d,{addDays:y,addMonths:S,addWeeks:x,addYears:b,endOfBroadcastWeek:j,endOfISOWeek:N,endOfWeek:E,max:L,min:O,startOfBroadcastWeek:D,startOfISOWeek:A,startOfWeek:k}=f;let w={day:y,week:x,month:S,year:b,startOfWeek:R=>p?D(R,f):m?A(R):k(R),endOfWeek:R=>p?j(R):m?N(R):E(R)}[n](o,a==="after"?1:-1);return a==="before"&&r?w=L([r,w]):a==="after"&&c&&(w=O([c,w])),w}function Av(n,a,o,r,c,d,f,m=0){if(m>365)return;const p=jE(n,a,o.date,r,c,d,f),y=!!(d.disabled&&va(p,d.disabled,f)),S=!!(d.hidden&&va(p,d.hidden,f)),x=p,b=new dv(p,x,f);return!y&&!S?b:Av(n,a,b,r,c,d,f,m+1)}function ME(n,a,o,r,c){const{autoFocus:d}=n,[f,m]=C.useState(),p=TE(a.days,o,r||(()=>!1),f),[y,S]=C.useState(d?p:void 0);return{isFocusTarget:E=>!!p?.isEqualTo(E),setFocused:S,focused:y,blur:()=>{m(y),S(void 0)},moveFocus:(E,L)=>{if(!y)return;const O=Av(E,L,y,a.navStart,a.navEnd,n,c);O&&(n.disableNavigation&&!a.days.some(A=>A.isEqualTo(O))||(a.goToDay(O),S(O)))}}}function EE(n,a){const{selected:o,required:r,onSelect:c}=n,[d,f]=Zl(o,c?o:void 0),m=c?o:d,{isSameDay:p}=a,y=j=>m?.some(N=>p(N,j))??!1,{min:S,max:x}=n;return{selected:m,select:(j,N,E)=>{let L=[...m??[]];if(y(j)){if(m?.length===S||r&&m?.length===1)return;L=m?.filter(O=>!p(O,j))}else m?.length===x?L=[j]:L=[...L,j];return c||f(L),c?.(L,j,N,E),L},isSelected:y}}function OE(n,a,o=0,r=0,c=!1,d=Vn){const{from:f,to:m}=a||{},{isSameDay:p,isAfter:y,isBefore:S}=d;let x;if(!f&&!m)x={from:n,to:o>0?void 0:n};else if(f&&!m)p(f,n)?o===0?x={from:f,to:n}:c?x={from:f,to:void 0}:x=void 0:S(n,f)?x={from:n,to:f}:x={from:f,to:n};else if(f&&m)if(p(f,n)&&p(m,n))c?x={from:f,to:m}:x=void 0;else if(p(f,n))x={from:f,to:o>0?void 0:n};else if(p(m,n))x={from:n,to:o>0?void 0:n};else if(S(n,f))x={from:n,to:m};else if(y(n,f))x={from:f,to:n};else if(y(n,m))x={from:f,to:n};else throw new Error("Invalid range");if(x?.from&&x?.to){const b=d.differenceInCalendarDays(x.to,x.from);r>0&&b>r?x={from:n,to:void 0}:o>1&&b<o&&(x={from:n,to:void 0})}return x}function PE(n,a,o=Vn){const r=Array.isArray(a)?a:[a];let c=n.from;const d=o.differenceInCalendarDays(n.to,n.from),f=Math.min(d,6);for(let m=0;m<=f;m++){if(r.includes(c.getDay()))return!0;c=o.addDays(c,1)}return!1}function ux(n,a,o=Vn){return ba(n,a.from,!1,o)||ba(n,a.to,!1,o)||ba(a,n.from,!1,o)||ba(a,n.to,!1,o)}function LE(n,a,o=Vn){const r=Array.isArray(a)?a:[a];if(r.filter(m=>typeof m!="function").some(m=>typeof m=="boolean"?m:o.isDate(m)?ba(n,m,!1,o):mv(m,o)?m.some(p=>ba(n,p,!1,o)):Xl(m)?m.from&&m.to?ux(n,{from:m.from,to:m.to},o):!1:hv(m)?PE(n,m.dayOfWeek,o):Kf(m)?o.isAfter(m.before,m.after)?ux(n,{from:o.addDays(m.after,1),to:o.addDays(m.before,-1)},o):va(n.from,m,o)||va(n.to,m,o):qf(m)||Ff(m)?va(n.from,m,o)||va(n.to,m,o):!1))return!0;const f=r.filter(m=>typeof m=="function");if(f.length){let m=n.from;const p=o.differenceInCalendarDays(n.to,n.from);for(let y=0;y<=p;y++){if(f.some(S=>S(m)))return!0;m=o.addDays(m,1)}}return!1}function RE(n,a){const{disabled:o,excludeDisabled:r,selected:c,required:d,onSelect:f}=n,[m,p]=Zl(c,f?c:void 0),y=f?c:m;return{selected:y,select:(b,j,N)=>{const{min:E,max:L}=n,O=b?OE(b,y,E,L,d,a):void 0;return r&&o&&O?.from&&O.to&&LE({from:O.from,to:O.to},o,a)&&(O.from=b,O.to=void 0),f||p(O),f?.(O,b,j,N),O},isSelected:b=>y&&ba(y,b,!1,a)}}function _E(n,a){const{selected:o,required:r,onSelect:c}=n,[d,f]=Zl(o,c?o:void 0),m=c?o:d,{isSameDay:p}=a;return{selected:m,select:(x,b,j)=>{let N=x;return!r&&m&&m&&p(x,m)&&(N=void 0),c||f(N),c?.(N,x,b,j),N},isSelected:x=>m?p(m,x):!1}}function zE(n,a){const o=_E(n,a),r=EE(n,a),c=RE(n,a);switch(n.mode){case"single":return o;case"multiple":return r;case"range":return c;default:return}}function It(n,a){return n instanceof xa&&n.timeZone===a?n:new xa(n,a)}function dx(n,a){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?It(n,a):Array.isArray(n)?n.map(o=>o instanceof Date?It(o,a):o):Xl(n)?{...n,from:n.from?It(n.from,a):n.from,to:n.to?It(n.to,a):n.to}:Kf(n)?{before:It(n.before,a),after:It(n.after,a)}:qf(n)?{after:It(n.after,a)}:Ff(n)?{before:It(n.before,a)}:n}function Ed(n,a){return n&&(Array.isArray(n)?n.map(o=>dx(o,a)):dx(n,a))}function IE(n){let a=n;const o=a.timeZone;if(o&&(a={...n,timeZone:o},a.today&&(a.today=It(a.today,o)),a.month&&(a.month=It(a.month,o)),a.defaultMonth&&(a.defaultMonth=It(a.defaultMonth,o)),a.startMonth&&(a.startMonth=It(a.startMonth,o)),a.endMonth&&(a.endMonth=It(a.endMonth,o)),a.mode==="single"&&a.selected?a.selected=It(a.selected,o):a.mode==="multiple"&&a.selected?a.selected=a.selected?.map(pe=>It(pe,o)):a.mode==="range"&&a.selected&&(a.selected={from:a.selected.from?It(a.selected.from,o):a.selected.from,to:a.selected.to?It(a.selected.to,o):a.selected.to}),a.disabled!==void 0&&(a.disabled=Ed(a.disabled,o)),a.hidden!==void 0&&(a.hidden=Ed(a.hidden,o)),a.modifiers)){const pe={};Object.keys(a.modifiers).forEach(Te=>{pe[Te]=Ed(a.modifiers?.[Te],o)}),a.modifiers=pe}const{components:r,formatters:c,labels:d,dateLib:f,locale:m,classNames:p}=C.useMemo(()=>{const pe={...uv,...a.locale},Te=new hn({locale:pe,weekStartsOn:a.broadcastCalendar?1:a.weekStartsOn,firstWeekContainsDate:a.firstWeekContainsDate,useAdditionalWeekYearTokens:a.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:a.useAdditionalDayOfYearTokens,timeZone:a.timeZone,numerals:a.numerals},a.dateLib);return{dateLib:Te,components:$M(a.components),formatters:oE(a.formatters),labels:uE(a.labels,Te.options),locale:pe,classNames:{...QM(),...a.classNames}}},[a.locale,a.broadcastCalendar,a.weekStartsOn,a.firstWeekContainsDate,a.useAdditionalWeekYearTokens,a.useAdditionalDayOfYearTokens,a.timeZone,a.numerals,a.dateLib,a.components,a.formatters,a.labels,a.classNames]);a.today||(a={...a,today:f.today()});const{captionLayout:y,mode:S,navLayout:x,numberOfMonths:b=1,onDayBlur:j,onDayClick:N,onDayFocus:E,onDayKeyDown:L,onDayMouseEnter:O,onDayMouseLeave:D,onNextClick:A,onPrevClick:k,showWeekNumber:T,styles:w}=a,{formatCaption:R,formatDay:I,formatMonthDropdown:z,formatWeekNumber:F,formatWeekNumberHeader:ee,formatWeekdayName:Q,formatYearDropdown:ge}=c,te=DE(a,f),{days:ve,months:U,navStart:Z,navEnd:ne,previousMonth:$,nextMonth:oe,goToMonth:ue}=te,he=VM(ve,a,Z,ne,f),{isSelected:X,select:ae,selected:de}=zE(a,f)??{},{blur:ie,focused:re,isFocusTarget:ye,moveFocus:De,setFocused:ze}=ME(a,te,he,X??(()=>!1),f),{labelDayButton:Xe,labelGridcell:ke,labelGrid:Oe,labelMonthDropdown:Ge,labelNav:Dt,labelPrevious:Ot,labelNext:Yn,labelWeekday:je,labelWeekNumber:Jt,labelWeekNumberHeader:Pn,labelYearDropdown:en}=d,Da=C.useMemo(()=>hE(f,a.ISOWeek,a.broadcastCalendar,a.today),[f,a.ISOWeek,a.broadcastCalendar,a.today]),$n=S!==void 0||N!==void 0,yt=C.useCallback(()=>{$&&(ue($),k?.($))},[$,ue,k]),tn=C.useCallback(()=>{oe&&(ue(oe),A?.(oe))},[ue,oe,A]),Wn=C.useCallback((pe,Te)=>Se=>{Se.preventDefault(),Se.stopPropagation(),ze(pe),!Te.disabled&&(ae?.(pe.date,Te,Se),N?.(pe.date,Te,Se))},[ae,N,ze]),ni=C.useCallback((pe,Te)=>Se=>{ze(pe),E?.(pe.date,Te,Se)},[E,ze]),Ln=C.useCallback((pe,Te)=>Se=>{ie(),j?.(pe.date,Te,Se)},[ie,j]),Rn=C.useCallback((pe,Te)=>Se=>{const Re={ArrowLeft:[Se.shiftKey?"month":"day",a.dir==="rtl"?"after":"before"],ArrowRight:[Se.shiftKey?"month":"day",a.dir==="rtl"?"before":"after"],ArrowDown:[Se.shiftKey?"year":"week","after"],ArrowUp:[Se.shiftKey?"year":"week","before"],PageUp:[Se.shiftKey?"year":"month","before"],PageDown:[Se.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Re[Se.key]){Se.preventDefault(),Se.stopPropagation();const[lt,Ne]=Re[Se.key];De(lt,Ne)}L?.(pe.date,Te,Se)},[De,L,a.dir]),Ei=C.useCallback((pe,Te)=>Se=>{O?.(pe.date,Te,Se)},[O]),To=C.useCallback((pe,Te)=>Se=>{D?.(pe.date,Te,Se)},[D]),jo=C.useCallback(pe=>Te=>{const Se=Number(Te.target.value),Re=f.setMonth(f.startOfMonth(pe),Se);ue(Re)},[f,ue]),Qn=C.useCallback(pe=>Te=>{const Se=Number(Te.target.value),Re=f.setYear(f.startOfMonth(pe),Se);ue(Re)},[f,ue]),{className:J,style:Pe}=C.useMemo(()=>({className:[p[xe.Root],a.className].filter(Boolean).join(" "),style:{...w?.[xe.Root],...a.style}}),[p,a.className,a.style,w]),Ce=WM(a),Le=C.useRef(null);xE(Le,!!a.animate,{classNames:p,months:U,focused:re,dateLib:f});const dt={dayPickerProps:a,selected:de,select:ae,isSelected:X,months:U,nextMonth:oe,previousMonth:$,goToMonth:ue,getModifiers:he,components:r,classNames:p,styles:w,labels:d,formatters:c};return ce.createElement(fv.Provider,{value:dt},ce.createElement(r.Root,{rootRef:a.animate?Le:void 0,className:J,style:Pe,dir:a.dir,id:a.id,lang:a.lang,nonce:a.nonce,title:a.title,role:a.role,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],...Ce},ce.createElement(r.Months,{className:p[xe.Months],style:w?.[xe.Months]},!a.hideNavigation&&!x&&ce.createElement(r.Nav,{"data-animated-nav":a.animate?"true":void 0,className:p[xe.Nav],style:w?.[xe.Nav],"aria-label":Dt(),onPreviousClick:yt,onNextClick:tn,previousMonth:$,nextMonth:oe}),U.map((pe,Te)=>ce.createElement(r.Month,{"data-animated-month":a.animate?"true":void 0,className:p[xe.Month],style:w?.[xe.Month],key:Te,displayIndex:Te,calendarMonth:pe},x==="around"&&!a.hideNavigation&&Te===0&&ce.createElement(r.PreviousMonthButton,{type:"button",className:p[xe.PreviousMonthButton],tabIndex:$?void 0:-1,"aria-disabled":$?void 0:!0,"aria-label":Ot($),onClick:yt,"data-animated-button":a.animate?"true":void 0},ce.createElement(r.Chevron,{disabled:$?void 0:!0,className:p[xe.Chevron],orientation:a.dir==="rtl"?"right":"left"})),ce.createElement(r.MonthCaption,{"data-animated-caption":a.animate?"true":void 0,className:p[xe.MonthCaption],style:w?.[xe.MonthCaption],calendarMonth:pe,displayIndex:Te},y?.startsWith("dropdown")?ce.createElement(r.DropdownNav,{className:p[xe.Dropdowns],style:w?.[xe.Dropdowns]},(()=>{const Se=y==="dropdown"||y==="dropdown-months"?ce.createElement(r.MonthsDropdown,{key:"month",className:p[xe.MonthsDropdown],"aria-label":Ge(),classNames:p,components:r,disabled:!!a.disableNavigation,onChange:jo(pe.date),options:dE(pe.date,Z,ne,c,f),style:w?.[xe.Dropdown],value:f.getMonth(pe.date)}):ce.createElement("span",{key:"month"},z(pe.date,f)),Re=y==="dropdown"||y==="dropdown-years"?ce.createElement(r.YearsDropdown,{key:"year",className:p[xe.YearsDropdown],"aria-label":en(f.options),classNames:p,components:r,disabled:!!a.disableNavigation,onChange:Qn(pe.date),options:mE(Z,ne,c,f,!!a.reverseYears),style:w?.[xe.Dropdown],value:f.getYear(pe.date)}):ce.createElement("span",{key:"year"},ge(pe.date,f));return f.getMonthYearOrder()==="year-first"?[Re,Se]:[Se,Re]})(),ce.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},R(pe.date,f.options,f))):ce.createElement(r.CaptionLabel,{className:p[xe.CaptionLabel],role:"status","aria-live":"polite"},R(pe.date,f.options,f))),x==="around"&&!a.hideNavigation&&Te===b-1&&ce.createElement(r.NextMonthButton,{type:"button",className:p[xe.NextMonthButton],tabIndex:oe?void 0:-1,"aria-disabled":oe?void 0:!0,"aria-label":Yn(oe),onClick:tn,"data-animated-button":a.animate?"true":void 0},ce.createElement(r.Chevron,{disabled:oe?void 0:!0,className:p[xe.Chevron],orientation:a.dir==="rtl"?"left":"right"})),Te===b-1&&x==="after"&&!a.hideNavigation&&ce.createElement(r.Nav,{"data-animated-nav":a.animate?"true":void 0,className:p[xe.Nav],style:w?.[xe.Nav],"aria-label":Dt(),onPreviousClick:yt,onNextClick:tn,previousMonth:$,nextMonth:oe}),ce.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":S==="multiple"||S==="range","aria-label":Oe(pe.date,f.options,f)||void 0,className:p[xe.MonthGrid],style:w?.[xe.MonthGrid]},!a.hideWeekdays&&ce.createElement(r.Weekdays,{"data-animated-weekdays":a.animate?"true":void 0,className:p[xe.Weekdays],style:w?.[xe.Weekdays]},T&&ce.createElement(r.WeekNumberHeader,{"aria-label":Pn(f.options),className:p[xe.WeekNumberHeader],style:w?.[xe.WeekNumberHeader],scope:"col"},ee()),Da.map(Se=>ce.createElement(r.Weekday,{"aria-label":je(Se,f.options,f),className:p[xe.Weekday],key:String(Se),style:w?.[xe.Weekday],scope:"col"},Q(Se,f.options,f)))),ce.createElement(r.Weeks,{"data-animated-weeks":a.animate?"true":void 0,className:p[xe.Weeks],style:w?.[xe.Weeks]},pe.weeks.map(Se=>ce.createElement(r.Week,{className:p[xe.Week],key:Se.weekNumber,style:w?.[xe.Week],week:Se},T&&ce.createElement(r.WeekNumber,{week:Se,style:w?.[xe.WeekNumber],"aria-label":Jt(Se.weekNumber,{locale:m}),className:p[xe.WeekNumber],scope:"row",role:"rowheader"},F(Se.weekNumber,f)),Se.days.map(Re=>{const{date:lt}=Re,Ne=he(Re);if(Ne[ht.focused]=!Ne.hidden&&!!re?.isEqualTo(Re),Ne[En.selected]=X?.(lt)||Ne.selected,Xl(de)){const{from:nn,to:An}=de;Ne[En.range_start]=!!(nn&&An&&f.isSameDay(lt,nn)),Ne[En.range_end]=!!(nn&&An&&f.isSameDay(lt,An)),Ne[En.range_middle]=ba(de,lt,!0,f)}const Ht=fE(Ne,w,a.modifiersStyles),Xn=YM(Ne,p,a.modifiersClassNames),Tt=!$n&&!Ne.hidden?ke(lt,Ne,f.options,f):void 0;return ce.createElement(r.Day,{key:`${Re.isoDate}_${Re.displayMonthId}`,day:Re,modifiers:Ne,className:Xn.join(" "),style:Ht,role:"gridcell","aria-selected":Ne.selected||void 0,"aria-label":Tt,"data-day":Re.isoDate,"data-month":Re.outside?Re.dateMonthId:void 0,"data-selected":Ne.selected||void 0,"data-disabled":Ne.disabled||void 0,"data-hidden":Ne.hidden||void 0,"data-outside":Re.outside||void 0,"data-focused":Ne.focused||void 0,"data-today":Ne.today||void 0},!Ne.hidden&&$n?ce.createElement(r.DayButton,{className:p[xe.DayButton],style:w?.[xe.DayButton],type:"button",day:Re,modifiers:Ne,disabled:!Ne.focused&&Ne.disabled||void 0,"aria-disabled":Ne.focused&&Ne.disabled||void 0,tabIndex:ye(Re)?0:-1,"aria-label":Xe(lt,Ne,f.options,f),onClick:Wn(Re,Ne),onBlur:Ln(Re,Ne),onFocus:ni(Re,Ne),onKeyDown:Rn(Re,Ne),onMouseEnter:Ei(Re,Ne),onMouseLeave:To(Re,Ne)},I(lt,f.options,f)):!Ne.hidden&&I(Re.date,f.options,f))})))))))),a.footer&&ce.createElement(r.Footer,{className:p[xe.Footer],style:w?.[xe.Footer],role:"status","aria-live":"polite"},a.footer)))}function UE({className:n,classNames:a,showOutsideDays:o=!0,...r}){return l.jsx(IE,{showOutsideDays:o,className:K("p-2",n),classNames:{root:"relative",months:"flex flex-col sm:flex-row gap-2 sm:gap-4",month:"flex flex-col gap-2",month_caption:"flex justify-center pt-1 relative items-center h-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-2 flex items-center justify-between px-1 z-10",button_previous:K(yl({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:K(yl({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:K("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:K(yl({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:K("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:K("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:K("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:K("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...a},components:{Chevron:({orientation:c,className:d,...f})=>{const m=c==="left"?iw:c==="right"?Ol:c==="up"?tf:Pl;return l.jsx(m,{className:K("h-4 w-4",d),...f})}},...r})}UE.displayName="Calendar";const HE=C.lazy(()=>at(()=>Promise.resolve().then(()=>Ql),void 0).then(n=>({default:n.CodeEditor})));function CP({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:o,rawSettingsEnv:r,onChange:c,missingRequiredFields:d=[]}){const f=d.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(kn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[l.jsx(Ao,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&f&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Gn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:d.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(HE,{value:n,onChange:c,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Rf,{profileEnv:r})})})]})})}const SP={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},wP=[{id:"codex-target-runtime-support",title:"Native Codex runtime support is live",summary:"Codex now participates as a first-class runtime target through ccs-codex, ccsx, ccsxp, or --target codex.",primaryAction:"Use Codex as a runtime target for native Codex sessions and Codex-routed CLIProxy flows.",publishedAt:"2026-03-28",status:"new",scopes:["target","cliproxy","api-profiles"],entryIds:["codex-target","codex-cliproxy"],highlights:["Use ccs-codex or ccsx for native Codex runs.","Use ccsxp for the built-in CCS Codex provider shortcut on native Codex.","Built-in Codex and Codex bridge profiles can run on native Codex with --target codex.","Saved default targets for API profiles and variants can now be claude, droid, or codex."],actions:[{id:"copy-codex-alias-command",label:"Open native Codex",description:"Launch Codex through the explicit CCS runtime alias.",type:"command",command:"ccs-codex"},{id:"copy-codex-provider-command",label:"Run built-in Codex on Codex",description:"Use the built-in Codex provider shortcut on native Codex.",type:"command",command:'ccsxp "your prompt"'},{id:"copy-codex-provider-command-explicit",label:"Run built-in Codex on Codex (explicit)",description:"Use the explicit built-in Codex provider route on native Codex.",type:"command",command:'ccs codex --target codex "your prompt"'},{id:"open-codex-dashboard",label:"Open Codex dashboard",description:"Review Codex runtime support, config layers, and dashboard setup flows.",type:"route",path:"/codex"}],routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx",'ccsxp "your prompt"','ccs codex --target codex "your prompt"']},{id:"droid-target-support",title:"Factory Droid support is live",summary:"API Profiles and CLIProxy variants now support Droid as a first-class execution target.",primaryAction:"Set Droid as your default execution target for non-Claude workflows.",publishedAt:"2026-02-25",status:"new",scopes:["target","api-profiles","cliproxy"],entryIds:["droid-target","custom-api-profiles","codex-cliproxy","agy-cliproxy"],highlights:["Set default target to Droid when creating or editing API Profiles.","Set default target to Droid for CLIProxy variants, including Codex and Antigravity flows.","Use ccs-droid as the explicit alias, with ccsd kept as the legacy shortcut."],actions:[{id:"open-api-profiles",label:"Set default target in API Profiles",description:"Open API Profiles and set Default Target to Droid for profiles you run often.",type:"route",path:"/providers"},{id:"open-cliproxy",label:"Set default target in CLIProxy variants",description:"Open CLIProxy variants and set target to Droid for Codex/Antigravity or custom variants.",type:"route",path:"/cliproxy"},{id:"copy-ccs-droid-command",label:"Run once with explicit Droid alias",description:"Use ccs-droid to force the Droid target with your current profile.",type:"command",command:"ccs-droid glm"},{id:"copy-target-override",label:"Run once with --target override",description:"Keep your default profile but force Droid for a single command.",type:"command",command:'ccs codex --target droid "your prompt"'}],routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates Center is available for rollout tasks",summary:"A focused Updates Center exists for setup tasks and rollout guidance when you need it.",primaryAction:"Use this page only when needed for rollout tasks, then return to your normal workflow.",publishedAt:"2026-02-25",status:"new",scopes:["target","cliproxy","api-profiles","websearch"],entryIds:["droid-target","codex-cliproxy","custom-api-profiles","opencode-websearch"],highlights:["Single data source powers update content and integration mapping.","Notices can be tracked as new, seen, done, or dismissed.","Catalog covers target CLI, CLIProxy providers, and WebSearch integrations."],actions:[{id:"open-updates-page",label:"Open Updates Center when needed",description:"Review rollout tasks only when you want guided setup changes.",type:"route",path:"/updates"},{id:"copy-open-dashboard",label:"Open dashboard from terminal",description:"Re-open config dashboard anytime from CLI.",type:"command",command:"ccs config"}],routes:[{label:"Updates Center",path:"/updates"}],commands:["ccs config"]}],BE=[{id:"claude-target",name:"Claude Code",scope:"target",status:"stable",summary:"Default runtime target for all CCS profile types.",pillars:{baseUrl:"From profile settings (ANTHROPIC_BASE_URL)",auth:"From profile settings (ANTHROPIC_AUTH_TOKEN)",model:"From profile settings (ANTHROPIC_MODEL)"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs",'ccs glm "your prompt"']},{id:"droid-target",name:"Factory Droid",scope:"target",status:"new",summary:"First-class target for API Profiles and CLIProxy variants.",pillars:{baseUrl:"From profile or variant settings",auth:"From profile or variant settings",model:"From profile or variant settings"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccs-droid as the explicit runtime alias. Legacy ccsd still works."},{id:"codex-target",name:"Codex CLI",scope:"target",status:"new",summary:"First-class runtime target for native Codex sessions and Codex-routed CLIProxy flows.",pillars:{baseUrl:"Native ~/.codex config for default mode, transient -c overrides for CCS-backed routes",auth:"Native Codex auth for default mode, env_key injection for CCS-backed routes",model:"Native Codex config or routed Codex model mapping from CLIProxy"},routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx","ccs codex --target codex","ccs codex-api --target codex"],notes:"Saved default targets for API profiles and CLIProxy variants can now be claude, droid, or codex."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and a native Codex shortcut.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:['ccsxp "your prompt"',"ccs codex --target codex","ccs codex","ccs cliproxy create mycodex --provider codex","ccs api create codex-api --cliproxy-provider codex"],notes:"Use ccsxp when you want the built-in Codex provider on native Codex without retyping --target codex."},{id:"gemini-cliproxy",name:"Gemini via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Gemini provider with multi-account management.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs gemini","ccs cliproxy create mygem --provider gemini"]},{id:"agy-cliproxy",name:"Antigravity via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Antigravity provider with variant target controls.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs agy","ccs cliproxy create myagy --provider agy --target droid"]},{id:"custom-api-profiles",name:"Custom API Profiles",scope:"api-profiles",status:"stable",summary:"Any Anthropic-compatible endpoint with per-profile target and model mapping.",pillars:{baseUrl:"User-defined endpoint",auth:"User-defined token/key",model:"User-defined model identifier"},routes:[{label:"API Profiles",path:"/providers"}],commands:["ccs api create myprofile",'ccs myprofile "your prompt"']},{id:"opencode-websearch",name:"OpenCode WebSearch",scope:"websearch",status:"stable",summary:"WebSearch provider surfaced in Settings for third-party profile workflows.",pillars:{baseUrl:"Managed by OpenCode CLI integration",auth:"Provider-specific (managed externally)",model:"Configurable in WebSearch settings"},routes:[{label:"Settings",path:"/settings"}],commands:["ccs config",'ccs codex "your prompt"'],notes:"Enable OpenCode in Settings > WebSearch to activate fallback search."}],KE=new Map(BE.map(n=>[n.id,n]));function NP(n){return n.entryIds.map(a=>KE.get(a)).filter(a=>!!a)}function kP(n){const a=new Date(`${n}T00:00:00Z`);return Number.isNaN(a.getTime())?n:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(a)}C.lazy(()=>at(()=>Promise.resolve().then(()=>Ql),void 0).then(n=>({default:n.CodeEditor})));function qE(){const{t:n}=Et(),{isDark:a,setTheme:o}=mf(),[r,c]=C.useState(""),[d,f]=C.useState(""),[m,p]=C.useState(!1),[y,S]=C.useState(null),[x,b]=C.useState(!1),{login:j,authRequired:N,isAuthenticated:E,loading:L,accessMode:O,authEnabled:D}=Il(),A=Jd(),k=El(),T=O==="setup",w=n(T?"auth.remoteGuardLabel":"auth.protectedAccessLabel"),R=n(T?D?"auth.incompleteSetupDescription":"auth.remoteSetupDescription":"auth.loginDescription"),I=k.state?.from?.pathname||"/";if(C.useEffect(()=>{L||(E||!N)&&A(I,{replace:!0})},[E,N,L,A,I]),L)return l.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-4",children:l.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-border/80 bg-card/90 px-5 py-3 text-sm text-muted-foreground shadow-sm",children:[l.jsx(kn,{className:"h-4 w-4 animate-spin"}),n("auth.loading")]})});if(E||!N)return null;const z=async F=>{F.preventDefault(),S(null),b(!0);try{await j(r,d),A(I,{replace:!0})}catch(ee){S(ee instanceof Error?ee.message:n("auth.loginFailed"))}finally{b(!1)}};return l.jsxs("div",{className:"relative min-h-[100dvh] overflow-hidden bg-background",children:[l.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(167,85,52,0.16),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(39,39,42,0.12),transparent_48%)]"}),l.jsx("div",{className:"absolute inset-0 opacity-[0.18] [background-image:linear-gradient(rgba(127,117,107,0.14)_1px,transparent_1px),linear-gradient(90deg,rgba(127,117,107,0.14)_1px,transparent_1px)] [background-size:24px_24px]"}),l.jsx("div",{className:"relative mx-auto flex min-h-[100dvh] max-w-6xl items-center px-4 py-8 sm:px-6",children:l.jsxs("div",{className:"grid w-full items-stretch gap-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,430px)]",children:[l.jsxs("section",{className:"flex flex-col justify-between rounded-[28px] border border-border/70 bg-card/85 p-6 shadow-[0_24px_80px_-48px_rgba(68,48,34,0.55)] backdrop-blur sm:p-8",children:[l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("span",{className:"inline-flex w-fit items-center gap-2 rounded-full border border-border/70 bg-background/75 px-3 py-1 text-xs font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:[l.jsx(dl,{className:"h-3.5 w-3.5 text-accent"}),w]}),l.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border border-border/70 bg-background/75 p-1 shadow-sm backdrop-blur",children:[l.jsxs(ot,{type:"button",variant:"ghost",size:"sm",className:K("rounded-full px-3 text-xs font-semibold",!a&&"bg-card text-foreground shadow-sm"),"aria-pressed":!a,onClick:()=>o("light"),children:[l.jsx(Ix,{className:"h-3.5 w-3.5"}),n("auth.lightMode")]}),l.jsxs(ot,{type:"button",variant:"ghost",size:"sm",className:K("rounded-full px-3 text-xs font-semibold",a&&"bg-card text-foreground shadow-sm"),"aria-pressed":a,onClick:()=>o("dark"),children:[l.jsx(Ux,{className:"h-3.5 w-3.5"}),n("auth.darkMode")]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("h1",{className:"max-w-xl text-4xl font-semibold tracking-[-0.04em] text-balance text-foreground sm:text-5xl",children:n(T?"auth.remoteSetupTitle":"auth.dashboardTitle")}),l.jsx("p",{className:"max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg",children:R})]})]}),l.jsxs("div",{className:"mt-8 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3",children:[l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(qg,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:n("auth.safetyNoteRemote")})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(Fg,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:n("auth.safetyNoteLocal")})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(dl,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:n("auth.safetyNoteSession")})]})]})]}),l.jsxs(xj,{className:"justify-center rounded-[28px] border-border/70 bg-card/95 py-0 shadow-[0_24px_90px_-54px_rgba(34,24,16,0.62)]",children:[l.jsxs(bj,{className:"space-y-3 border-b border-border/70 px-6 py-6",children:[l.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-accent/20 bg-accent/10",children:T?l.jsx(qg,{className:"h-5 w-5 text-accent"}):l.jsx(Fg,{className:"h-5 w-5 text-accent"})}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(vj,{className:"text-2xl tracking-[-0.03em]",children:n(T?"auth.remoteSetupTitle":"auth.dashboardTitle")}),l.jsx(Cj,{className:"text-sm leading-6 text-muted-foreground",children:T?R:n("auth.credentialsHint")})]})]}),l.jsx(Sj,{className:"space-y-5 px-6 py-6",children:T?l.jsxs(l.Fragment,{children:[l.jsxs(zs,{variant:"warning",className:"rounded-2xl border-yellow-300/70 bg-yellow-50/80",children:[l.jsx(Bs,{className:"h-4 w-4"}),l.jsx(Tl,{children:n("auth.noDefaultCredentials")}),l.jsx(Is,{children:n("auth.credentialsHint")})]}),l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[l.jsx(ow,{className:"h-4 w-4 text-accent"}),n("auth.hostStepTitle")]}),l.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.hostStepDescription")}),l.jsx("code",{className:"mt-4 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"ccs config auth setup"})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[l.jsx(dl,{className:"h-4 w-4 text-accent"}),n("auth.localStepTitle")]}),l.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.localStepDescription")})]})]})]}):l.jsxs("form",{onSubmit:z,className:"space-y-4",children:[y&&l.jsxs(zs,{variant:"destructive",className:"rounded-2xl",children:[l.jsx(Bs,{className:"h-4 w-4"}),l.jsx(Is,{children:y})]}),l.jsxs(zs,{variant:"info",className:"rounded-2xl border-blue-200/80 bg-blue-50/80",children:[l.jsx(dl,{className:"h-4 w-4"}),l.jsx(Tl,{children:n("auth.noDefaultCredentials")}),l.jsx(Is,{children:n("auth.credentialsHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{htmlFor:"username",className:"text-sm font-semibold",children:n("auth.username")}),l.jsx(Hn,{id:"username",type:"text",value:r,onChange:F=>c(F.target.value),placeholder:n("auth.usernamePlaceholder"),autoComplete:"username",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 text-base md:text-base",disabled:x,required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{htmlFor:"password",className:"text-sm font-semibold",children:n("auth.password")}),l.jsxs("div",{className:"relative",children:[l.jsx(Hn,{id:"password",type:m?"text":"password",value:d,onChange:F=>f(F.target.value),placeholder:n("auth.passwordPlaceholder"),autoComplete:"current-password",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 pr-14 text-base md:text-base",disabled:x,required:!0}),l.jsx(ot,{type:"button",variant:"ghost",size:"sm",className:"absolute inset-y-1 right-1 h-auto rounded-xl px-3 text-muted-foreground hover:text-foreground","aria-label":n(m?"auth.hidePassword":"auth.showPassword"),"aria-pressed":m,onClick:()=>p(F=>!F),disabled:x,children:m?l.jsx(Vs,{className:"h-4 w-4"}):l.jsx(Ys,{className:"h-4 w-4"})})]})]}),l.jsx(ot,{type:"submit",className:"h-12 w-full rounded-2xl text-sm font-semibold",disabled:x,children:x?l.jsxs(l.Fragment,{children:[l.jsx(kn,{className:"mr-2 h-4 w-4 animate-spin"}),n("auth.signingIn")]}):n("auth.signIn")})]})})]})]})})]})}const FE=C.lazy(()=>at(()=>import("./index-Dn69laT4.js"),__vite__mapDeps([21,1,2,4,5,7,22,6,8,9])).then(n=>({default:n.AnalyticsPage}))),GE=C.lazy(()=>at(()=>import("./api-P8GrkzAd.js"),__vite__mapDeps([23,1,2,5,24,17,6,4,3,7,8,9])).then(n=>({default:n.ApiPage}))),VE=C.lazy(()=>at(()=>import("./cliproxy-Dwoxts2F.js"),__vite__mapDeps([25,1,2,5,15,6,4,18,26,24,17,27,28,16,7,8,9])).then(n=>({default:n.CliproxyPage}))),YE=C.lazy(()=>at(()=>import("./cliproxy-ai-providers-Dz085Bac.js"),__vite__mapDeps([29,1,2,16,17,5,6,4,24,7,8,9])).then(n=>({default:n.CliproxyAiProvidersPage}))),$E=C.lazy(()=>at(()=>import("./cliproxy-control-panel-mClVmxpM.js"),__vite__mapDeps([30,1,2,5,15,4,6,7,8,9])).then(n=>({default:n.CliproxyControlPanelPage}))),WE=C.lazy(()=>at(()=>import("./copilot-BX0hVo59.js"),__vite__mapDeps([31,1,2,5,24,17,4,27,28,6,7,8,9])).then(n=>({default:n.CopilotPage}))),QE=C.lazy(()=>at(()=>import("./cursor-DAJcvPdv.js"),__vite__mapDeps([32,1,2,6,5,15,27,28,4,7,8,9])).then(n=>({default:n.CursorPage}))),XE=C.lazy(()=>at(()=>import("./claude-extension-B2yI8coF.js"),__vite__mapDeps([33,1,2,5,6,4,7,8,9])).then(n=>({default:n.ClaudeExtensionPage}))),ZE=C.lazy(()=>at(()=>import("./codex-CJrMN9io.js"),__vite__mapDeps([34,1,2,6,4,27,5,9,7,35,36,8])).then(n=>({default:n.CodexPage}))),JE=C.lazy(()=>at(()=>import("./droid-CA_2Peaq.js"),__vite__mapDeps([37,1,2,6,5,36,4,27,7,8,9])).then(n=>({default:n.DroidPage}))),eO=C.lazy(()=>at(()=>import("./logs-BErGEMlx.js"),__vite__mapDeps([38,1,2,4,5,6,7,8,9])).then(n=>({default:n.LogsPage}))),tO=C.lazy(()=>at(()=>import("./accounts-CuZSmwoY.js"),__vite__mapDeps([39,1,2,5,35,17,6,4,26,7,8,9])).then(n=>({default:n.AccountsPage}))),nO=C.lazy(()=>at(()=>Promise.resolve().then(()=>cM),void 0).then(n=>({default:n.SettingsPage}))),aO=C.lazy(()=>at(()=>import("./health-lx89H6Rl.js"),__vite__mapDeps([40,1,2,5,6,4,7,8,9])).then(n=>({default:n.HealthPage}))),iO=C.lazy(()=>at(()=>import("./shared-BxYo83z7.js"),__vite__mapDeps([41,1,2,4,5,6,7,8,9])).then(n=>({default:n.SharedPage}))),oO=C.lazy(()=>at(()=>import("./updates-CFHqIfIV.js"),__vite__mapDeps([42,1,2,4,5,6,7,8,9])).then(n=>({default:n.UpdatesPage})));function Bt(){return l.jsx("div",{className:"flex h-64 items-center justify-center",children:l.jsx(kn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function sO(){return l.jsx(kS,{client:Jw,children:l.jsx(YN,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx($N,{children:l.jsx(JN,{children:l.jsxs(CS,{children:[l.jsxs(SS,{children:[l.jsx(Nt,{path:"/login",element:l.jsx(qE,{})}),l.jsx(Nt,{element:l.jsx(ek,{}),children:l.jsxs(Nt,{element:l.jsx(s1,{}),children:[l.jsx(Nt,{path:"/",element:l.jsx(kT,{})}),l.jsx(Nt,{path:"/analytics",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(FE,{})})}),l.jsx(Nt,{path:"/updates",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(oO,{})})}),l.jsx(Nt,{path:"/providers",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(GE,{})})}),l.jsx(Nt,{path:"/cliproxy",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(VE,{})})}),l.jsx(Nt,{path:"/cliproxy/ai-providers",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(YE,{})})}),l.jsx(Nt,{path:"/cliproxy/control-panel",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx($E,{})})}),l.jsx(Nt,{path:"/copilot",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(WE,{})})}),l.jsx(Nt,{path:"/cursor",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(QE,{})})}),l.jsx(Nt,{path:"/claude-extension",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(XE,{})})}),l.jsx(Nt,{path:"/codex",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(ZE,{})})}),l.jsx(Nt,{path:"/droid",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(JE,{})})}),l.jsx(Nt,{path:"/accounts",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(tO,{})})}),l.jsx(Nt,{path:"/settings",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(nO,{})})}),l.jsx(Nt,{path:"/health",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(aO,{})})}),l.jsx(Nt,{path:"/logs",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(eO,{})})}),l.jsx(Nt,{path:"/shared",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(iO,{})})})]})})]}),l.jsx(AS,{position:"top-right"})]})})})})})}const Dv=document.getElementById("root");if(!Dv)throw new Error("Root element not found. Failed to mount React application.");Qw.createRoot(Dv).render(l.jsx(C.StrictMode,{children:l.jsx(sO,{})}));export{aP as $,MT as A,Ut as B,xj as C,_T as D,XO as E,JO as F,DT as G,LT as H,Hn as I,zT as J,ZO as K,qt as L,aA as M,iA as N,oA as O,ib as P,Vb as Q,Pf as R,We as S,Sa as T,jl as U,Yd as V,Fe as W,nP as X,He as Y,tP as Z,Cj as _,Et as a,DO as a$,iP as a0,oP as a1,sP as a2,rP as a3,lP as a4,cP as a5,Wb as a6,uP as a7,kj as a8,Af as a9,mP as aA,fP as aB,wA as aC,JT as aD,dP as aE,BT as aF,tv as aG,X1 as aH,fD as aI,ji as aJ,VA as aK,YA as aL,$A as aM,WA as aN,_1 as aO,xb as aP,EO as aQ,OO as aR,PO as aS,LO as aT,vP as aU,bO as aV,nA as aW,kO as aX,AO as aY,Zk as aZ,Jk as a_,gO as aa,Xk as ab,vO as ac,wO as ad,TO as ae,jO as af,pf as ag,gf as ah,yf as ai,xf as aj,bf as ak,pP as al,Dj as am,gP as an,Qs as ao,qO as ap,qd as aq,FO as ar,Hd as as,MO as at,GO as au,VO as av,$O as aw,Cy as ax,YO as ay,hP as az,Sj as b,eA as b0,tA as b1,NO as b2,wf as b3,KO as b4,iv as b5,Rf as b6,Ts as b7,yO as b8,xO as b9,NN as bA,TN as bB,LN as bC,UO as bD,CO as bE,SO as bF,_O as bG,zO as bH,BO as bI,HO as bJ,yl as bK,zs as ba,Tl as bb,Is as bc,CP as bd,Ef as be,qs as bf,Of as bg,yT as bh,ST as bi,WO as bj,QO as bk,kP as bl,SP as bm,wP as bn,NP as bo,sv as bp,iM as bq,sM as br,IO as bs,RO as bt,Xx as bu,ON as bv,MN as bw,Rd as bx,Di as by,SN as bz,K as c,ot as d,yP as e,xP as f,Tj as g,UE as h,pO as i,bj as j,vj as k,U1 as l,H1 as m,Do as n,bP as o,wa as p,Na as q,hb as r,Nf as s,mb as t,sf as u,kf as v,_s as w,Uy as x,HT as y,eP as z};
|