@kaitranntt/ccs 7.54.0-dev.2 → 7.54.0-dev.3
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/README.md +1 -0
- package/dist/shared/provider-preset-catalog.d.ts +1 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +15 -0
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/ui/assets/{accounts-CZEg1_PX.js → accounts-CrNRfOOP.js} +1 -1
- package/dist/ui/assets/{alert-dialog-DhwS38kc.js → alert-dialog-0GYXcDLu.js} +1 -1
- package/dist/ui/assets/{api-sWNND4wP.js → api-Du9rjWhx.js} +1 -1
- package/dist/ui/assets/{auth-section-nJIpOcnm.js → auth-section-DMcsqZyo.js} +1 -1
- package/dist/ui/assets/{backups-section-D3A6hmrU.js → backups-section-Bu4mUdGV.js} +1 -1
- package/dist/ui/assets/{checkbox-CZrxD1iS.js → checkbox-DiyJL_k4.js} +1 -1
- package/dist/ui/assets/{claude-extension-BjInaILv.js → claude-extension-CUlLIos9.js} +1 -1
- package/dist/ui/assets/{cliproxy-BGiSCGkl.js → cliproxy-DS95Joc9.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-CKO2Sn9B.js → cliproxy-control-panel-BNUMUGIt.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-DTKxwrat.js → confirm-dialog-DTWvVQlx.js} +1 -1
- package/dist/ui/assets/{copilot-CuRngdBg.js → copilot-p2K9Y5LR.js} +1 -1
- package/dist/ui/assets/{cursor-Dxo0uIiU.js → cursor-5SbcR5sW.js} +1 -1
- package/dist/ui/assets/{droid-Cl8QsJJL.js → droid-DxdiLHHD.js} +1 -1
- package/dist/ui/assets/{globalenv-section-C3dxxoD9.js → globalenv-section-B9l_4XUg.js} +1 -1
- package/dist/ui/assets/{health-BUifaDU7.js → health-DDs2IlMm.js} +1 -1
- package/dist/ui/assets/{index-CYo-E5rU.js → index-Cy76XBS9.js} +1 -1
- package/dist/ui/assets/{index-xayyyR26.js → index-D3yHEBlf.js} +1 -1
- package/dist/ui/assets/{index-Cw9Urr0S.js → index-JgHDFSHt.js} +3 -3
- package/dist/ui/assets/{index-CPdceT1C.js → index-X7b7NDPo.js} +1 -1
- package/dist/ui/assets/{index-BOsbrhaa.js → index-awSrtRcI.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-D94htBPb.js → proxy-status-widget-DEkHz7X-.js} +1 -1
- package/dist/ui/assets/{separator-3fBbTn-V.js → separator-BFr5KvfF.js} +1 -1
- package/dist/ui/assets/{shared-q_FNNbjD.js → shared-BwP9MOQi.js} +1 -1
- package/dist/ui/assets/{switch-5N8qBdBr.js → switch-w7IoOY5x.js} +1 -1
- package/dist/ui/assets/{updates-CubQ54J0.js → updates--SN_PZnJ.js} +1 -1
- package/dist/ui/icons/novita.svg +9 -0
- 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-awSrtRcI.js","assets/radix-ui-BR1vy4kf.js","assets/react-vendor-CNOkPC89.js","assets/switch-w7IoOY5x.js","assets/icons-DrEfTmfX.js","assets/tanstack-e99Cjjy2.js","assets/notifications-B2HqRBj7.js","assets/utils-CzKF5WmX.js","assets/form-utils-Bcoyqxpq.js","assets/code-highlight-BRUf_pqB.js","assets/globalenv-section-B9l_4XUg.js","assets/index-D3yHEBlf.js","assets/index-X7b7NDPo.js","assets/default-ports-1QQSffYX.js","assets/proxy-status-widget-DEkHz7X-.js","assets/alert-dialog-0GYXcDLu.js","assets/auth-section-DMcsqZyo.js","assets/backups-section-Bu4mUdGV.js","assets/index-Cy76XBS9.js","assets/charts-BBPXh0Ar.js","assets/api-Du9rjWhx.js","assets/confirm-dialog-DTWvVQlx.js","assets/separator-BFr5KvfF.js","assets/cliproxy-DS95Joc9.js","assets/checkbox-DiyJL_k4.js","assets/cliproxy-control-panel-BNUMUGIt.js","assets/copilot-p2K9Y5LR.js","assets/cursor-5SbcR5sW.js","assets/claude-extension-CUlLIos9.js","assets/droid-DxdiLHHD.js","assets/accounts-CrNRfOOP.js","assets/health-DDs2IlMm.js","assets/shared-BwP9MOQi.js","assets/updates--SN_PZnJ.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{j as r,S as mr,R as Ay,C as ky,a as Ty,T as Dy,D as My,P as jy,O as Oy,b as U0,c as H0,d as B0,e as K0,f as q0,A as G0,g as Y0,h as F0,i as V0,k as Q0,l as W0,m as $0,n as X0,I as Z0,o as Ey,p as J0,q as Py,r as Ry,s as eS,t as Ly,V as tS,L as _y,u as zy,v as nS,w as aS,x as Iy,y as iS,z as oS,G as sS,B as Uy,E as lS,F as rS,H as Hy,J as cS,K as By,M as Ky,N as qy,Q as uS,U as dS,W as fS,X as Gy,Y as hS,Z as pS,_ as mS}from"./radix-ui-BR1vy4kf.js";import{e as Md,f as gS,r as S,u as gr,O as md,N as yS,h as jd,L as gd,R as bS,g as xS,i as vS,c as oe,B as SS,j as CS,k as Pt}from"./react-vendor-CNOkPC89.js";import{Q as wS,u as Tt,a as it,b as et,c as NS}from"./tanstack-e99Cjjy2.js";import{t as re,T as AS}from"./notifications-B2HqRBj7.js";import{L as jn,X as vo,P as kS,C as yr,H as TS,a as DS,K as Yy,G as MS,Z as Fy,b as Vy,F as Qy,U as Wy,c as jS,S as OS,A as js,d as ES,e as PS,M as RS,E as br,f as xr,B as LS,R as Os,W as _S,g as zS,h as IS,i as US,j as cg,k as ug,l as bo,m as Od,n as lr,o as $y,p as HS,q as BS,r as vr,s as Ed,t as Xy,u as Es,v as Sr,w as Pd,T as qn,x as Cr,y as KS,z as qS,D as wr,I as GS,J as YS,N as FS,O as Nr,Q as VS,V as QS,Y as WS,_ as $S,$ as XS,a0 as ZS,a1 as JS,a2 as Rd,a3 as dg,a4 as eC,a5 as tC,a6 as nC,a7 as aC,a8 as fg,a9 as iC,aa as oC}from"./icons-DrEfTmfX.js";import{t as sC,c as lC,a as Ar,e as bs,f as Cs,b as rC,d as cC,g as uC,h as dC,i as fC,j as hC,k as pC,l as mC,m as gC,n as yC,o as bC,p as xC,q as vC,r as SC,s as CC,u as wC,v as NC,w as AC,x as kC,y as TC,z as DC,A as MC,B as jC,C as OC,D as EC,E as PC,F as RC,G as LC,H as _C,I as zC,J as IC}from"./utils-CzKF5WmX.js";import{o as hg,s as pg,p as UC,a as HC,$ as BC,b as Zy,c as Fa,d as KC,_ as qC,u as GC,e as mg}from"./form-utils-Bcoyqxpq.js";import{H as YC,t as gg}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"]'))l(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function s(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function l(c){if(c.ep)return;c.ep=!0;const f=s(c);fetch(c.href,f)}})();var Vu={exports:{}},xs={},Qu={exports:{}},Wu={};var yg;function FC(){return yg||(yg=1,(function(n){function a(P,F){var ie=P.length;P.push(F);e:for(;0<ie;){var $=ie-1>>>1,se=P[$];if(0<c(se,F))P[$]=F,P[ie]=se,ie=$;else break e}}function s(P){return P.length===0?null:P[0]}function l(P){if(P.length===0)return null;var F=P[0],ie=P.pop();if(ie!==F){P[0]=ie;e:for(var $=0,se=P.length,ne=se>>>1;$<ne;){var Ne=2*($+1)-1,V=P[Ne],J=Ne+1,ce=P[J];if(0>c(V,ie))J<se&&0>c(ce,V)?(P[$]=ce,P[J]=ie,$=J):(P[$]=V,P[Ne]=ie,$=Ne);else if(J<se&&0>c(ce,ie))P[$]=ce,P[J]=ie,$=J;else break e}}return F}function c(P,F){var ie=P.sortIndex-F.sortIndex;return ie!==0?ie:P.id-F.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,p=h.now();n.unstable_now=function(){return h.now()-p}}var m=[],y=[],C=1,b=null,v=3,N=!1,w=!1,M=!1,O=!1,D=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function I(P){for(var F=s(y);F!==null;){if(F.callback===null)l(y);else if(F.startTime<=P)l(y),F.sortIndex=F.expirationTime,a(m,F);else break;F=s(y)}}function E(P){if(M=!1,I(P),!w)if(s(m)!==null)w=!0,A||(A=!0,ee());else{var F=s(y);F!==null&&Ce(E,F.startTime-P)}}var A=!1,z=-1,X=5,W=-1;function Q(){return O?!0:!(n.unstable_now()-W<X)}function ae(){if(O=!1,A){var P=n.unstable_now();W=P;var F=!0;try{e:{w=!1,M&&(M=!1,H(z),z=-1),N=!0;var ie=v;try{t:{for(I(P),b=s(m);b!==null&&!(b.expirationTime>P&&Q());){var $=b.callback;if(typeof $=="function"){b.callback=null,v=b.priorityLevel;var se=$(b.expirationTime<=P);if(P=n.unstable_now(),typeof se=="function"){b.callback=se,I(P),F=!0;break t}b===s(m)&&l(m),I(P)}else l(m);b=s(m)}if(b!==null)F=!0;else{var ne=s(y);ne!==null&&Ce(E,ne.startTime-P),F=!1}}break e}finally{b=null,v=ie,N=!1}F=void 0}}finally{F?ee():A=!1}}}var ee;if(typeof B=="function")ee=function(){B(ae)};else if(typeof MessageChannel<"u"){var ye=new MessageChannel,fe=ye.port2;ye.port1.onmessage=ae,ee=function(){fe.postMessage(null)}}else ee=function(){D(ae,0)};function Ce(P,F){z=D(function(){P(n.unstable_now())},F)}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(P){P.callback=null},n.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<P?Math.floor(1e3/P):5},n.unstable_getCurrentPriorityLevel=function(){return v},n.unstable_next=function(P){switch(v){case 1:case 2:case 3:var F=3;break;default:F=v}var ie=v;v=F;try{return P()}finally{v=ie}},n.unstable_requestPaint=function(){O=!0},n.unstable_runWithPriority=function(P,F){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var ie=v;v=P;try{return F()}finally{v=ie}},n.unstable_scheduleCallback=function(P,F,ie){var $=n.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?$+ie:$):ie=$,P){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=ie+se,P={id:C++,callback:F,priorityLevel:P,startTime:ie,expirationTime:se,sortIndex:-1},ie>$?(P.sortIndex=ie,a(y,P),s(m)===null&&P===s(y)&&(M?(H(z),z=-1):M=!0,Ce(E,ie-$))):(P.sortIndex=se,a(m,P),w||N||(w=!0,A||(A=!0,ee()))),P},n.unstable_shouldYield=Q,n.unstable_wrapCallback=function(P){var F=v;return function(){var ie=v;v=F;try{return P.apply(this,arguments)}finally{v=ie}}}})(Wu)),Wu}var bg;function VC(){return bg||(bg=1,Qu.exports=FC()),Qu.exports}var xg;function QC(){if(xg)return xs;xg=1;var n=VC(),a=Md(),s=gS();function l(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 f(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 h(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 p(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 m(e){if(f(e)!==e)throw Error(l(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(l(188));return t!==e?null:e}for(var i=e,o=t;;){var u=i.return;if(u===null)break;var d=u.alternate;if(d===null){if(o=u.return,o!==null){i=o;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===i)return m(u),e;if(d===o)return m(u),t;d=d.sibling}throw Error(l(188))}if(i.return!==o.return)i=u,o=d;else{for(var g=!1,x=u.child;x;){if(x===i){g=!0,i=u,o=d;break}if(x===o){g=!0,o=u,i=d;break}x=x.sibling}if(!g){for(x=d.child;x;){if(x===i){g=!0,i=d,o=u;break}if(x===o){g=!0,o=d,i=u;break}x=x.sibling}if(!g)throw Error(l(189))}}if(i.alternate!==o)throw Error(l(190))}if(i.tag!==3)throw Error(l(188));return i.stateNode.current===i?e:t}function C(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=C(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),B=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function ee(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var ye=Symbol.for("react.client.reference");function fe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ye?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case D:return"Profiler";case O:return"StrictMode";case E:return"Suspense";case A:return"SuspenseList";case W:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case B:return e.displayName||"Context";case H:return(e._context.displayName||"Context")+".Consumer";case I:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return t=e.displayName||null,t!==null?t:fe(e.type)||"Memo";case X:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var Ce=Array.isArray,P=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},$=[],se=-1;function ne(e){return{current:e}}function Ne(e){0>se||(e.current=$[se],$[se]=null,se--)}function V(e,t){se++,$[se]=e.current,e.current=t}var J=ne(null),ce=ne(null),te=ne(null),le=ne(null);function be(e,t){switch(V(te,t),V(ce,e),V(J,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Em(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Em(t),e=Pm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ne(J),V(J,e)}function Re(){Ne(J),Ne(ce),Ne(te)}function Ye(e){e.memoizedState!==null&&V(le,e);var t=J.current,i=Pm(t,e.type);t!==i&&(V(ce,e),V(J,i))}function St(e){ce.current===e&&(Ne(J),Ne(ce)),le.current===e&&(Ne(le),ps._currentValue=ie)}var Ct,Ve;function ot(e){if(Ct===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ct=t&&t[1]||"",Ve=-1<i.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+Ct+e+Ve}var It=!1;function Qt(e,t){if(!e||It)return"";It=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(t){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(U){var _=U}Reflect.construct(e,[],Y)}else{try{Y.call()}catch(U){_=U}e.call(Y.prototype)}}else{try{throw Error()}catch(U){_=U}(Y=e())&&typeof Y.catch=="function"&&Y.catch(function(){})}}catch(U){if(U&&_&&typeof U.stack=="string")return[U.stack,_.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=o.DetermineComponentFrameRoot(),g=d[0],x=d[1];if(g&&x){var k=g.split(`
|
|
@@ -11,7 +11,7 @@ Error generating stack: `+o.message+`
|
|
|
11
11
|
`);for(const l of s){const[c,...f]=l.split(":"),h=f.join(":").trim();switch(c?.trim()?.toLowerCase()){case"version":a.version=h;break;case"url":a.url=h;break;case"method":a.method=h;break;case"timestamp":a.timestamp=h;break}}}function Ak(n){const a={},s=n.split(`
|
|
12
12
|
`);for(const l of s){const c=l.indexOf(":");if(c>0){const f=l.slice(0,c).trim(),h=l.slice(c+1).trim();f&&(a[f]=h)}}return a}function kk(n,a){const s=n.split(`
|
|
13
13
|
`);let l=!1;const c=[];for(const f of s){if(f.startsWith("Status:")){const p=f.replace("Status:","").trim().split(/\s+/);a.statusCode=parseInt(p[0],10)||0,a.statusText=p.slice(1).join(" ")||jk(a.statusCode);continue}if(f.trim()===""&&!l){l=!0;continue}if(l)c.push(f);else{const h=f.indexOf(":");if(h>0){const p=f.slice(0,h).trim(),m=f.slice(h+1).trim();p&&(a.responseHeaders[p]=m)}}}a.responseBody=c.join(`
|
|
14
|
-
`).trim()}function Tk(n){const a=n.url.match(/\/api\/provider\/([^/]+)/);a&&(n.provider=a[1]);const s=n.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);s&&(n.endpoint=s[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"),Dk(n),n.statusCode===429&&Mk(n)}function Dk(n){if(n.requestBody)try{const a=JSON.parse(n.requestBody);typeof a.model=="string"&&(n.model=a.model)}catch{}}function Mk(n){if(n.responseBody)try{const a=JSON.parse(n.responseBody),s=Nd(a);s!==null&&(n.quotaResetDelay=s);const l=Ad(a);l&&(n.quotaResetTimestamp=l)}catch{}}function Nd(n){if(typeof n!="object"||n===null)return null;const a=n;if("quotaResetDelay"in a){const s=a.quotaResetDelay;if(typeof s=="number")return s;if(typeof s=="string"){const l=s.match(/^(\d+)s?$/);if(l)return parseInt(l[1],10)}}if("error"in a&&typeof a.error=="object"){const s=Nd(a.error);if(s!==null)return s}if("details"in a&&Array.isArray(a.details))for(const s of a.details){const l=Nd(s);if(l!==null)return l}return null}function Ad(n){if(typeof n!="object"||n===null)return null;const a=n;for(const s of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(s in a&&typeof a[s]=="string")return a[s];if("error"in a&&typeof a.error=="object"){const s=Ad(a.error);if(s)return s}if("details"in a&&Array.isArray(a.details))for(const s of a.details){const l=Ad(s);if(l)return l}return null}function jk(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 Ok(n,a){const s=Ld(),l=s==="zh-CN",c=s==="vi",f=Date.now(),h=n*1e3,p=f-h,m=Math.floor(p/1e3),y=Math.floor(m/60),C=Math.floor(y/60),b=Math.floor(C/24);return m<60?l?"刚刚":c?"vừa xong":"just now":y<60?l?`${y} 分钟前`:c?`${y} phút trước`:`${y}m ago`:C<24?l?`${C} 小时前`:c?`${C} giờ trước`:`${C}h ago`:b<7?l?`${b} 天前`:c?`${b} ngày trước`:`${b}d ago`:new Date(h).toLocaleDateString(s,{month:"short",day:"numeric"})}function Ek(n){return n>=500?"text-red-500":n===429?"text-orange-500":n>=400?"text-yellow-500":"text-gray-500"}function Pk(n,a){const s=Ld();return s==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[n]||"错误":s==="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 Rk(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),s=Math.floor(n%3600/60);return s>0?`${a}h ${s}m`:`${a}h`}function Lk(n,a){if(!n)return null;const s=Ld(),l=s==="zh-CN",c=s==="vi";try{const f=new Date(n),h=new Date,p=f.getTime()-h.getTime();if(p<=0)return l?"现在":c?"bây giờ":"now";const m=Math.floor(p/1e3);if(m<60)return l?`${m}秒`:c?`${m} giây`:`${m}s`;if(m<3600){const b=Math.floor(m/60);return l?`${b}分钟`:c?`${b} phút`:`${b}m`}const y=Math.floor(m/3600),C=Math.floor(m%3600/60);return l?C>0?`${y}小时 ${C}分钟`:`${y}小时`:c?C>0?`${y} giờ ${C} phút`:`${y} giờ`:C>0?`${y}h ${C}m`:`${y}h`}catch{return null}}function _k(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 zk(n){return n||""}function Ik({name:n,size:a,modified:s,isSelected:l,onClick:c,statusCode:f,model:h}){const p=S.useMemo(()=>Ck(n),[n]),m=S.useMemo(()=>zk(h),[h]);return r.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]",l?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[r.jsx("span",{className:K("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",_k(f)),children:f||"???"}),r.jsx(ef,{provider:p.provider,size:18,withBackground:!0,className:"shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:p.endpoint||"unknown"}),m&&r.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:m,children:m}),r.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[r.jsx(Es,{className:"w-2.5 h-2.5"}),r.jsx("span",{children:Ok(s)})]})]})]})}function ny({value:n,className:a,variant:s="outline",size:l="icon",label:c="Copy to clipboard"}){const[f,h]=S.useState(!1),p=()=>{navigator.clipboard.writeText(n),h(!0),setTimeout(()=>h(!1),2e3)};return r.jsx(Ci,{children:r.jsxs($a,{children:[r.jsx(Xa,{asChild:!0,children:r.jsxs(ft,{size:l,variant:s,className:K("relative z-10 text-muted-foreground hover:text-foreground",a),onClick:m=>{m.stopPropagation(),p()},children:[f?r.jsx(bo,{className:"h-3.5 w-3.5 text-green-500"}):r.jsx(lr,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"sr-only",children:c})]})}),r.jsx(Za,{children:r.jsx("p",{children:f?"Copied!":c})})]})})}function Ss({active:n,onClick:a,children:s,icon:l}){return r.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:[l&&r.jsx(l,{className:"w-3.5 h-3.5"}),s]})}function Yb({code:n}){const a=Ek(n);return r.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 Uk({parsed:n}){const{t:a}=_t(),s=Rk(n.quotaResetDelay)||Lk(n.quotaResetTimestamp),l=a("errorLogs.na");return r.jsx(So,{className:"h-full",children:r.jsxs("div",{className:"p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Yb,{code:n.statusCode}),r.jsx("span",{className:"text-sm font-medium",children:n.statusText}),r.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:Pk(n.errorType)})]}),n.model&&r.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[r.jsx(FS,{className:"w-4 h-4 text-violet-500 shrink-0"}),r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.modelLabel")}),r.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:n.model})]})]}),n.errorType==="rate_limit"&&s&&r.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[r.jsx(Es,{className:"w-4 h-4 text-amber-500 shrink-0"}),r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.quotaResetsIn")}),r.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:s})]})]}),r.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[r.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[r.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.method")}),r.jsx("div",{className:"font-medium",children:n.method||l})]}),r.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[r.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.provider")}),r.jsx("div",{className:"font-medium",children:n.provider||l})]}),r.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[r.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.version")}),r.jsx("div",{className:"font-medium",children:n.version||l})]}),r.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[r.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.endpoint")}),r.jsx("div",{className:"font-medium truncate",title:n.endpoint,children:n.endpoint||l})]})]}),r.jsxs("div",{className:"text-xs",children:[r.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.url")}),r.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:n.url||l})]}),r.jsxs("div",{className:"text-xs",children:[r.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.timestamp")}),r.jsx("div",{className:"font-mono",children:n.timestamp||l})]}),n.errorType!=="unknown"&&r.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"?r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):n.errorType==="auth"?r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):r.jsx(Nr,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),r.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 Hk({headers:n}){const a=Object.entries(n);return a.length===0?r.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):r.jsx(So,{className:"h-full",children:r.jsx("div",{className:"p-4 space-y-1",children:a.map(([s,l])=>r.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[r.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[s,":"]}),r.jsx("span",{className:"break-all",children:l})]},s))})})}function ay({content:n,label:a}){const{t:s}=_t();if(!n||n.trim()===""){const f=a==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return r.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:s(f)})}let l=n,c=!1;try{const f=JSON.parse(n);l=JSON.stringify(f,null,2),c=!0}catch{}return r.jsx(So,{className:"h-full",children:r.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:l})})}function Bk({content:n}){return r.jsx(So,{className:"h-full",children:r.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 Kk({name:n,absolutePath:a}){const{t:s}=_t(),[l,c]=S.useState("overview"),{data:f,isLoading:h,error:p}=v1(n),m=S.useMemo(()=>f?wk(f):null,[f]);return n?h?r.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[r.jsx(Ge,{className:"h-5 w-full"}),r.jsx(Ge,{className:"h-5 w-3/4"}),r.jsx(Ge,{className:"h-5 w-5/6"}),r.jsx(Ge,{className:"h-5 w-2/3"})]}):p||!f||!m?r.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:r.jsx("p",{className:"text-sm",children:s("errorLogs.failedLoadContent")})}):r.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[r.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[r.jsx(Yb,{code:m.statusCode}),r.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[m.provider,"/",m.endpoint||"unknown"]}),n&&r.jsx(ny,{value:a||n,label:s("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[f&&r.jsx(ny,{value:f,label:s("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),r.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:m.method})]})]}),r.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:[r.jsx(Ss,{active:l==="overview",onClick:()=>c("overview"),icon:Nr,children:s("errorLogs.tabOverview")}),r.jsx(Ss,{active:l==="headers",onClick:()=>c("headers"),icon:QS,children:s("errorLogs.tabHeaders")}),r.jsx(Ss,{active:l==="request",onClick:()=>c("request"),icon:WS,children:s("errorLogs.tabRequest")}),r.jsx(Ss,{active:l==="response",onClick:()=>c("response"),icon:$S,children:s("errorLogs.tabResponse")}),r.jsx(Ss,{active:l==="raw",onClick:()=>c("raw"),icon:XS,children:s("errorLogs.tabRaw")})]}),r.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[l==="overview"&&r.jsx(Uk,{parsed:m}),l==="headers"&&r.jsx(Hk,{headers:m.requestHeaders}),l==="request"&&r.jsx(ay,{content:m.requestBody,label:"Request"}),l==="response"&&r.jsx(ay,{content:m.responseBody,label:"Response"}),l==="raw"&&r.jsx(Bk,{content:f})]})]}):r.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:r.jsxs("div",{className:"text-center space-y-3",children:[r.jsx(VS,{className:"w-10 h-10 mx-auto opacity-40"}),r.jsx("p",{className:"text-sm",children:s("errorLogs.selectLog")})]})})}function qk(){const{t:n}=_t(),{data:a,isLoading:s}=m1(),{data:l,isLoading:c,error:f}=x1(a?.running??!1),[h,p]=S.useState(500),[m,y]=S.useState(!1),C=S.useRef(null),b=S.useRef(null),v=()=>{b.current&&(clearInterval(b.current),b.current=null)};S.useEffect(()=>{if(!m)return;const I=A=>{const z=C.current;if(!z)return;const W=z.getBoundingClientRect().top+window.scrollY,Q=A.pageY-W;p(Math.max(300,Q));const ee=window.innerHeight-A.clientY,ye=15;v(),ee<50?b.current=setInterval(()=>{window.scrollBy(0,ye)},16):A.clientY<50&&(b.current=setInterval(()=>{window.scrollBy(0,-ye)},16))},E=()=>{y(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",I),document.addEventListener("mouseup",E),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",E),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[m]);const N=I=>{I.preventDefault(),y(!0)},w=S.useMemo(()=>l?.[0]?.name??null,[l]),[M,O]=S.useState(null),D=M??w,H=S.useMemo(()=>!D||!l?void 0:l.find(E=>E.name===D)?.absolutePath,[D,l]);if(s||!a?.running)return null;if(c)return r.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:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[r.jsx(Ge,{className:"h-4 w-32"}),r.jsx(Ge,{className:"h-4 w-20"})]}),r.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(I=>r.jsx(Ge,{className:"h-12 w-full rounded-lg"},I))})]});if(!l||l.length===0)return null;const B=l.length;return r.jsxs("div",{ref:C,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:h},children:[r.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:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx(qn,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-semibold tracking-tight",children:n("errorLogs.title")}),r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:n("errorLogs.failedRequests",{count:B})})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ZS,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:n("errorLogs.cliproxyDiagnostics")})]})]}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsxs(of,{direction:"horizontal",children:[r.jsx(Rs,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:r.jsxs(So,{className:"h-full",children:[r.jsx("div",{className:"divide-y divide-border/50",children:l.slice(0,50).map(I=>r.jsx(Ik,{name:I.name,size:I.size,modified:I.modified,isSelected:D===I.name,onClick:()=>O(I.name),statusCode:I.statusCode,model:I.model},I.name))}),l.length>50&&r.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:n("errorLogs.showingCount",{total:l.length})})]})}),r.jsxs(sf,{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:[r.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),r.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:r.jsx(wr,{className:"h-4 w-4 text-muted-foreground"})})]}),r.jsx(Rs,{className:"flex flex-col min-w-0 bg-background/50",children:r.jsx(Kk,{name:D,absolutePath:H})})]})}),f?r.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:f.message}):r.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:N,children:r.jsx(JS,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const Gk=Ar("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"}}),lf=S.forwardRef(({className:n,variant:a,...s},l)=>r.jsx("div",{ref:l,role:"alert",className:K(Gk({variant:a}),n),...s}));lf.displayName="Alert";const Fb=S.forwardRef(({className:n,...a},s)=>r.jsx("h5",{ref:s,className:K("mb-1 font-medium leading-none tracking-tight",n),...a}));Fb.displayName="AlertTitle";const rf=S.forwardRef(({className:n,...a},s)=>r.jsx("div",{ref:s,className:K("text-sm [&_p]:leading-relaxed",n),...a}));rf.displayName="AlertDescription";function Yk(){return Tt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function Vb(n,a){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="string"?n.error:a}function Qb(n){const a=n.trim();if(!a)return null;try{return JSON.parse(a)}catch{return null}}function Fk(n){const a=n.trim().toLowerCase();return a.startsWith("<!doctype html")||a.startsWith("<html")}function Vk(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 Wb(n,a){const s=await n.text(),l=Qb(s);if(!n.ok){const c=Vb(l,a);throw new Error(c)}if(l===null)throw new Error(a);return l}function Qk(){return Tt({queryKey:["shared","summary"],queryFn:async()=>{const n=await fetch("/api/shared/summary");return Wb(n,"Failed to fetch shared summary")}})}function Uj(n){return Tt({queryKey:["shared",n],queryFn:async()=>{const a=await fetch(`/api/shared/${n}`);return Wb(a,`Failed to fetch shared ${n}`)}})}function Hj(n,a){return Tt({queryKey:["shared",n,"content",a],enabled:typeof a=="string"&&a.length>0,queryFn:async()=>{if(!a)throw new Error("Missing shared item path");const s=new URLSearchParams({type:n,path:a}),l=await fetch(`/api/shared/content?${s.toString()}`),c=await l.text(),f=Qb(c);if(!l.ok)throw new Error(Vb(f,`Failed to fetch shared ${n} content`));if(Vk(f))return{content:f.content,contentPath:typeof f.contentPath=="string"&&f.contentPath.length>0?f.contentPath:a};if(c.trim().length>0){if(Fk(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 Wk={ok:"success",warning:"warning",error:"error"},$k={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 nr({title:n,value:a,icon:s,variant:l="default",onClick:c}){const f=$k[l];return r.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:[r.jsx("div",{className:K("flex items-center justify-center w-9 h-9 rounded-md",f.iconBg),children:r.jsx(s,{className:K("w-4 h-4",f.iconColor)})}),r.jsxs("div",{className:"text-left",children:[r.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:n}),r.jsx("p",{className:K("text-lg font-bold font-mono leading-tight",f.iconColor),children:a})]})]})}function Xk(){const{t:n}=_t(),a=jd(),{data:s,isLoading:l}=Yk(),{data:c,isLoading:f}=Qk();if(l||f)return r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Ge,{className:"h-12 w-12 rounded-lg"}),r.jsxs("div",{children:[r.jsx(Ge,{className:"h-7 w-[180px] mb-2"}),r.jsx(Ge,{className:"h-4 w-[220px]"})]})]}),r.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(p=>r.jsx(Ge,{className:"h-14 w-28 rounded-lg"},p))})]}),r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[r.jsx(Ge,{className:"h-4 w-32"}),r.jsx(Ge,{className:"h-4 w-20"})]}),r.jsx("div",{className:"px-4 py-3 border-b",children:r.jsx(Ge,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(p=>r.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[r.jsx(Ge,{className:"w-2.5 h-2.5 rounded-full"}),r.jsx(Ge,{className:"h-4 flex-1"}),r.jsx(Ge,{className:"h-1.5 w-24 rounded-full"}),r.jsx(Ge,{className:"h-4 w-16"})]},p))]})]});const h=s?.health?Wk[s.health.status]:void 0;return r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[r.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:r.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),r.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[r.jsx(t1,{version:s?.version}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(nr,{title:n("home.profiles"),value:s?.profiles??0,icon:Yy,variant:"accent",onClick:()=>a("/providers")}),r.jsx(nr,{title:n("home.cliproxy"),value:s?.cliproxy??0,icon:Fy,variant:"accent",onClick:()=>a("/cliproxy")}),r.jsx(nr,{title:n("home.accounts"),value:s?.accounts??0,icon:Wy,variant:"default",onClick:()=>a("/accounts")}),r.jsx(nr,{title:n("home.health"),value:s?.health?`${s.health.passed}/${s.health.total}`:"-",icon:js,variant:h,onClick:()=>a("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&r.jsxs(lf,{variant:"warning",children:[r.jsx(qn,{className:"h-4 w-4"}),r.jsx(Fb,{children:n("home.configurationRequired")}),r.jsx(rf,{children:c.symlinkStatus.message})]}),r.jsx(V1,{}),r.jsx(qk,{})]})}const $b=uS,cf=S.forwardRef(({className:n,...a},s)=>r.jsx(By,{ref:s,className:K("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...a}));cf.displayName=By.displayName;const pr=S.forwardRef(({className:n,...a},s)=>r.jsx(Ky,{ref:s,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}));pr.displayName=Ky.displayName;const kd=S.forwardRef(({className:n,...a},s)=>r.jsx(qy,{ref:s,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}));kd.displayName=qy.displayName;function rn({className:n,...a}){return r.jsx(dS,{"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 uf="ccs:openrouter-models",Zk=1440*60*1e3,Xb="1";function Td(n){const a=parseFloat(n);return isNaN(a)||a===0?0:a*1e6}function iy(n){const a=Td(n);return a===0?"Free":a<.01?"<$0.01":a<1?`$${a.toFixed(2)}`:`$${a.toFixed(a<10?2:0)}`}function Jk(n){const a=iy(n.prompt),s=iy(n.completion);return a==="Free"&&s==="Free"?"Free":`${a}/${s}`}function eT(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 tT(n){return{...n,category:eT(n),pricePerMillionPrompt:Td(n.pricing.prompt),pricePerMillionCompletion:Td(n.pricing.completion),isFree:n.pricing.prompt==="0"&&n.pricing.completion==="0",isExacto:n.id.includes(":exacto")}}function nT(n,a,s){const l=a.toLowerCase().trim();return n.filter(c=>s?.category&&c.category!==s.category||s?.freeOnly&&!c.isFree||s?.minContext&&c.context_length<s.minContext?!1:l?c.id.toLowerCase().includes(l)||c.name.toLowerCase().includes(l)||c.description?.toLowerCase().includes(l):!0)}function Bj(n){return[...n].sort((a,s)=>{if(a.isFree&&!s.isFree)return-1;if(!a.isFree&&s.isFree)return 1;if(!a.isFree&&!s.isFree){if(a.isExacto&&!s.isExacto)return-1;if(!a.isExacto&&s.isExacto)return 1}return a.name.localeCompare(s.name)})}function aT(){try{const n=localStorage.getItem(uf);if(!n)return null;const a=JSON.parse(n);return a.version!==Xb||Date.now()-a.fetchedAt>Zk?null:a.models}catch{return null}}function iT(n){try{localStorage.setItem(uf,JSON.stringify({models:n,fetchedAt:Date.now(),version:Xb}))}catch{}}function oT(){localStorage.removeItem(uf)}function Kj(n,a){const[s]=n.split("/");if(!s)return{};const l=a.filter(h=>h.id.startsWith(`${s}/`));if(l.length===0)return{};const c=[...l].sort((h,p)=>p.pricePerMillionPrompt-h.pricePerMillionPrompt),f=Math.ceil(c.length/3);return{opus:c[0]?.id,sonnet:c[Math.min(f,c.length-1)]?.id,haiku:c[c.length-1]?.id}}function sT(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}const qj={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},lT={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function rT(n,a=2){const s=[],l=["anthropic","openai","google","meta","mistral","opensource"];for(const c of l){const f=lT[c];if(f.length===0)continue;const p=[...n.filter(m=>f.some(y=>m.id.toLowerCase().startsWith(y)))].sort((m,y)=>(y.created??0)-(m.created??0));s.push(...p.slice(0,a))}return s.sort((c,f)=>(f.created??0)-(c.created??0))}function cT(n){const s=Date.now()/1e3-n;return s<86400?"Today":s<172800?"Yesterday":s<604800?`${Math.floor(s/86400)}d ago`:s<2592e3?`${Math.floor(s/604800)}w ago`:s<31536e3?`${Math.floor(s/2592e3)}mo ago`:`${Math.floor(s/31536e3)}y ago`}const uT="https://openrouter.ai/api/v1/models",Zb=["openrouter-models"],oy=1440*60*1e3;async function dT(){const n=await fetch(uT);if(!n.ok)throw new Error(`Failed to fetch OpenRouter models: ${n.status}`);const s=(await n.json()).data;return iT(s),s}function Jb(){return Tt({queryKey:Zb,queryFn:dT,staleTime:oy,gcTime:oy,initialData:()=>aT()??void 0,refetchOnWindowFocus:!1})}function fT(){const n=Jb(),a=(n.data??[]).map(tT);return{...n,models:a}}function Gj(){const n=it();return()=>(oT(),n.invalidateQueries({queryKey:Zb}))}function Yj(){const{data:n,isLoading:a,isError:s}=Jb();return{isReady:!!n&&n.length>0,isLoading:a,isError:s,modelCount:n?.length??0}}function df({profileEnv:n={}}){const[a,s]=S.useState(null),[l,c]=S.useState(!0),[f,h]=S.useState(!1);S.useEffect(()=>{p()},[]);const p=async()=>{try{c(!0);const v=await fetch("/api/global-env");if(!v.ok)throw new Error("Failed to load");const N=await v.json();s(N)}catch{s(null)}finally{c(!1)}};if(l||!a?.enabled)return null;const m=a.env||{},y=Object.keys(m);if(y.length===0)return null;const C=y.filter(v=>!(v in n)),b=y.filter(v=>v in n);return r.jsxs("div",{className:"border-t bg-muted/20",children:[r.jsxs("button",{onClick:()=>h(!f),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[r.jsx(Nr,{className:"w-4 h-4 text-blue-500"}),r.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[r.jsx("span",{className:"font-medium text-foreground",children:C.length})," global env var",C.length!==1?"s":""," will be injected at runtime",b.length>0&&r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",b.length," overridden by profile)"]})]}),f?r.jsx(Ed,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(vr,{className:"w-4 h-4 text-muted-foreground"})]}),f&&r.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[C.length>0&&r.jsx("div",{className:"space-y-1",children:C.map(v=>r.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:[r.jsx("span",{className:"text-green-500",children:"+"}),r.jsxs("span",{className:"truncate",children:[v,"=",m[v]]})]},v))}),b.length>0&&r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),b.map(v=>r.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:[r.jsx("span",{className:"text-amber-500",children:"~"}),r.jsx("span",{className:"truncate",children:v})]},v))]}),r.jsx("div",{className:"pt-2 border-t border-border/50",children:r.jsx(ft,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:r.jsxs(gd,{to:"/settings?tab=globalenv",children:[r.jsx(Rd,{className:"w-3.5 h-3.5"}),"Configure in Settings",r.jsx($y,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const hT=S.lazy(()=>ht(()=>Promise.resolve().then(()=>hf),void 0).then(n=>({default:n.CodeEditor})));function Fj({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:s,settings:l,onChange:c,missingRequiredFields:f=[]}){const h=f.length>0;return r.jsx(S.Suspense,{fallback:r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx(jn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:r.jsxs("div",{className:"h-full flex flex-col",children:[!a&&s!==null&&r.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:[r.jsx(vo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&h&&r.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:[r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",r.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:r.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:r.jsx(hT,{value:n,onChange:c,language:"json",minHeight:"100%"})})}),r.jsx("div",{className:"mx-6 mb-4",children:r.jsx("div",{className:"border rounded-md overflow-hidden",children:r.jsx(df,{profileEnv:l?.env})})})]})})}function sy(n,a){try{var s=n()}catch(l){return a(l)}return s&&s.then?s.then(void 0,a):s}function pT(n,a){for(var s={};n.length;){var l=n[0],c=l.code,f=l.message,h=l.path.join(".");if(!s[h])if("unionErrors"in l){var p=l.unionErrors[0].errors[0];s[h]={message:p.message,type:p.code}}else s[h]={message:f,type:c};if("unionErrors"in l&&l.unionErrors.forEach(function(C){return C.errors.forEach(function(b){return n.push(b)})}),a){var m=s[h].types,y=m&&m[l.code];s[h]=Zy(h,a,s,c,y?[].concat(y,l.message):l.message)}n.shift()}return s}function mT(n,a){for(var s={};n.length;){var l=n[0],c=l.code,f=l.message,h=l.path.join(".");if(!s[h])if(l.code==="invalid_union"&&l.errors.length>0){var p=l.errors[0][0];s[h]={message:p.message,type:p.code}}else s[h]={message:f,type:c};if(l.code==="invalid_union"&&l.errors.forEach(function(C){return C.forEach(function(b){return n.push(b)})}),a){var m=s[h].types,y=m&&m[l.code];s[h]=Zy(h,a,s,c,y?[].concat(y,l.message):l.message)}n.shift()}return s}function gT(n,a,s){if(s===void 0&&(s={}),(function(l){return"_def"in l&&typeof l._def=="object"&&"typeName"in l._def})(n))return function(l,c,f){try{return Promise.resolve(sy(function(){return Promise.resolve(n[s.mode==="sync"?"parse":"parseAsync"](l,a)).then(function(h){return f.shouldUseNativeValidation&&hg({},f),{errors:{},values:s.raw?Object.assign({},l):h}})},function(h){if((function(p){return Array.isArray(p?.issues)})(h))return{values:{},errors:pg(pT(h.errors,!f.shouldUseNativeValidation&&f.criteriaMode==="all"),f)};throw h}))}catch(h){return Promise.reject(h)}};if((function(l){return"_zod"in l&&typeof l._zod=="object"})(n))return function(l,c,f){try{return Promise.resolve(sy(function(){return Promise.resolve((s.mode==="sync"?UC:HC)(n,l,a)).then(function(h){return f.shouldUseNativeValidation&&hg({},f),{errors:{},values:s.raw?Object.assign({},l):h}})},function(h){if((function(p){return p instanceof BC})(h))return{values:{},errors:pg(mT(h.issues,!f.shouldUseNativeValidation&&f.criteriaMode==="all"),f)};throw h}))}catch(h){return Promise.reject(h)}};throw new Error("Invalid input: not a Zod schema")}function Vj(){return Tt({queryKey:["profiles"],queryFn:()=>Be.profiles.list()})}function yT(){const n=it();return et({mutationFn:a=>Be.profiles.create(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Profile created successfully")},onError:a=>{re.error(a.message)}})}function Qj(){const n=it();return et({mutationFn:a=>Be.profiles.delete(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Profile deleted successfully")},onError:a=>{re.error(a.message)}})}function Wj(){return et({mutationFn:()=>Be.profiles.discoverOrphans()})}function $j(){const n=it();return et({mutationFn:a=>Be.profiles.registerOrphans(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Orphan profiles registration complete")}})}function Xj(){const n=it();return et({mutationFn:({name:a,data:s})=>Be.profiles.copy(a,s),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Profile copied successfully")}})}function Zj(){return et({mutationFn:({name:n,includeSecrets:a})=>Be.profiles.export(n,a??!1)})}function Jj(){const n=it();return et({mutationFn:a=>Be.profiles.import(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Profile imported successfully")}})}const bT="https://openrouter.ai/api",ex=Object.freeze({kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan"}),tx=[{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},{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:bT,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},{id:"glm",name:"GLM",description:"Claude via Z.AI",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:"glmt",name:"GLMT",description:"GLM with Thinking mode support",baseUrl:"https://api.z.ai/api/coding/paas/v4/chat/completions",defaultProfileName:"glmt",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Same API key as GLM",category:"alternative",requiresApiKey:!0,extraEnv:{ANTHROPIC_TEMPERATURE:"0.2",ANTHROPIC_MAX_TOKENS:"65536",MAX_THINKING_TOKENS:"32768",ENABLE_STREAMING:"true",ANTHROPIC_SAFE_MODE:"false",API_TIMEOUT_MS:"3000000"},alwaysThinkingEnabled:!0,badge:"Thinking",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"}];function nx(n){return{...n,extraEnv:n.extraEnv?{...n.extraEnv}:void 0}}function xT(n){const a=nx(n);return a.extraEnv&&Object.freeze(a.extraEnv),Object.freeze(a)}function vT(n,a){const s=new Set;for(const c of n){const f=c.id.trim().toLowerCase();if(c.id!==f)throw new Error(`Preset ID must be normalized: "${c.id}"`);if(s.has(c.id))throw new Error(`Duplicate preset ID detected: "${c.id}"`);s.add(c.id)}const l=new Set;for(const[c,f]of Object.entries(a)){const h=c.trim().toLowerCase();if(!h)throw new Error("Preset alias keys cannot be empty");if(c!==h)throw new Error(`Preset alias must be normalized: "${c}"`);if(l.has(h))throw new Error(`Duplicate normalized preset alias detected: "${c}"`);if(l.add(h),!s.has(f))throw new Error(`Preset alias "${c}" points to unknown target "${f}"`);if(s.has(h))throw new Error(`Preset alias "${c}" collides with canonical preset ID "${h}"`)}}vT(tx,ex);const ST=Object.freeze(tx.map(xT));function CT(){return ST.map(nx)}function wT(n){const a=n.trim().toLowerCase();return ex[a]||a}const NT=CT(),ff=Object.freeze(NT.map(n=>({...n})));function AT(n,a){return a||(n?.requiresApiKey===!1?n.apiKeyPlaceholder||n.id:"")}function kT(n){return ff.filter(a=>a.category===n)}function rd(n){const a=wT(n);return ff.find(s=>s.id===a)}const TT=Fa().refine(n=>n.trim().length===0||Fa().url().safeParse(n).success,{message:"Invalid URL format"}),DT=KC({name:Fa().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:TT,apiKey:Fa(),model:Fa().optional(),opusModel:Fa().optional(),sonnetModel:Fa().optional(),haikuModel:Fa().optional(),target:qC(["claude","droid"])}),MT=["/chat/completions","/v1/messages","/messages","/completions"],ma="custom",cd="openrouter",ud={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},jT=kT("recommended"),ax=ff.filter(n=>n.category!=="recommended"),OT=new Set(ax.map(n=>n.id));function eO({open:n,onOpenChange:a,onSuccess:s,initialMode:l="openrouter"}){const{t:c}=_t(),f=yT(),[h,p]=S.useState("basic"),[m,y]=S.useState(null),[C,b]=S.useState(!1),[v,N]=S.useState(cd),[w,M]=S.useState(""),{models:O}=fT(),{register:D,handleSubmit:H,formState:{errors:B},control:I,reset:E,setValue:A}=GC({resolver:gT(DT),defaultValues:ud}),z=mg({control:I,name:"baseUrl"}),X=mg({control:I,name:"target"}),W=S.useCallback($=>{if(!$){E(ud);return}E({...ud,name:$.defaultProfileName,baseUrl:$.baseUrl,model:$.defaultModel,opusModel:$.defaultModel,sonnetModel:$.defaultModel,haikuModel:$.defaultModel})},[E]),Q=S.useMemo(()=>v===ma?null:rd(v)??null,[v]),ae=S.useMemo(()=>w.trim()?[...nT(O,w)].sort((se,ne)=>(ne.created??0)-(se.created??0)).slice(0,20):rT(O,2),[O,w]);S.useEffect(()=>{if(n)if(p("basic"),y(null),b(!1),M(""),l==="normal")N(ma),W(null);else{const se=rd(l==="openrouter"?cd:l);if(se){N(se.id),W(se);return}N(ma),W(null)}},[n,l,W]);const ee=$=>{const se=rd($);if(se){N(se.id),W(se);return}N(ma),W(null)},ye=$=>{A("model",$.id),A("opusModel",$.id),A("sonnetModel",$.id),A("haikuModel",$.id),M($.name),re.success(`Applied "${$.name}" to all model tiers`,{duration:2e3})};S.useEffect(()=>{if(z&&v===ma){const se=z.toLowerCase();for(const ne of MT)if(se.endsWith(ne)){const Ne=z.replace(new RegExp(ne+"$","i"),"");y(`URL ends with "${ne}" - Claude appends this automatically. You likely want: ${Ne}`);return}}y(null)},[z,v]);const fe=async $=>{if(Q?.requiresApiKey!==!1&&!$.apiKey){re.error(He.t("commonToast.apiKeyRequired"));return}const se={...$,apiKey:AT(Q,$.apiKey)};try{await f.mutateAsync(se),re.success(`Profile "${se.name}" created`),s(se.name),a(!1)}catch(ne){re.error(ne.message||"Failed to create profile")}},Ce=!!B.name||!!B.baseUrl||!!B.apiKey,P=!!B.model||!!B.opusModel||!!B.sonnetModel||!!B.haikuModel,F=v!==ma&&OT.has(v),ie=Q?.id===cd;return r.jsx(qd,{open:n,onOpenChange:a,children:r.jsxs(Gd,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh] !flex !flex-col",children:[r.jsxs(Yd,{className:"p-6 pb-4 border-b",children:[r.jsxs(Fd,{className:"flex items-center gap-2",children:[r.jsx(dg,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),r.jsx(Vd,{children:"Choose a provider or configure a custom API endpoint."})]}),r.jsxs("form",{onSubmit:H(fe),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[r.jsxs("div",{className:"px-6 py-3 border-b bg-muted/30 space-y-2",children:[r.jsxs("div",{children:[r.jsx(rn,{className:"text-xs text-muted-foreground mb-1.5 block",children:c("profileEditor.provider")}),r.jsxs("div",{className:"flex gap-2",children:[jT.map($=>r.jsx(ly,{preset:$,isSelected:v===$.id,onClick:()=>ee($.id)},$.id)),r.jsxs("button",{type:"button",onClick:()=>ee(ma),className:K("flex items-center gap-2 px-4 py-2 rounded-md border-2 transition-all text-sm font-medium",v===ma||F?"border-primary bg-primary/10 text-primary dark:bg-primary/20":"border-dashed border-muted-foreground/40 hover:border-primary/50 hover:bg-muted/50 text-muted-foreground hover:text-foreground"),children:[r.jsx(Rd,{className:"w-4 h-4"}),r.jsx("span",{children:c("profileEditor.custom")})]})]})]}),(v===ma||F)&&r.jsxs("div",{className:"pt-3 mt-2 border-t border-dashed border-muted-foreground/30",children:[r.jsx(rn,{className:"text-xs font-medium text-foreground/70 mb-2 block",children:"Quick Templates"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:ax.map($=>r.jsx(ly,{preset:$,isSelected:v===$.id,onClick:()=>ee($.id)},$.id))})]})]}),r.jsxs($b,{value:h,onValueChange:p,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[r.jsx("div",{className:"px-6 pt-4",children:r.jsxs(cf,{className:"grid w-full grid-cols-2",children:[r.jsxs(pr,{value:"basic",className:"relative",children:["Basic Information",Ce&&r.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),r.jsxs(pr,{value:"models",className:"relative",children:["Model Configuration",P&&r.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[r.jsxs(kd,{value:"basic",className:"p-6 space-y-4 mt-0",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"name",children:["Profile Name ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(In,{id:"name",...D("name"),placeholder:"my-api",className:"font-mono"}),B.name?r.jsx("p",{className:"text-xs text-destructive",children:B.name.message}):r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",r.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(rn,{htmlFor:"baseUrl",children:"API Base URL"}),r.jsx(In,{id:"baseUrl",...D("baseUrl"),placeholder:"https://api.example.com/v1"}),B.baseUrl?r.jsx("p",{className:"text-xs text-destructive",children:B.baseUrl.message}):m?r.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:[r.jsx(qn,{className:"w-4 h-4 shrink-0 mt-0.5"}),r.jsx("span",{children:m})]}):Q?r.jsx("p",{className:"text-xs text-muted-foreground",children:Q.baseUrl?`Pre-filled from ${Q.name}. You can customize if needed.`:`Optional for ${Q.name}. Leave blank to use native Anthropic auth.`}):r.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"apiKey",children:["API Key"," ",Q?.requiresApiKey!==!1&&r.jsx("span",{className:"text-destructive",children:"*"}),Q?.requiresApiKey===!1&&r.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:"(optional)"})]}),r.jsxs("div",{className:"relative",children:[r.jsx(In,{id:"apiKey",type:C?"text":"password",...D("apiKey"),placeholder:Q?.requiresApiKey===!1?"Optional - only if auth is enabled":Q?.apiKeyPlaceholder??"sk-...",className:"pr-10"}),r.jsx(ft,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>b(!C),tabIndex:-1,children:C?r.jsx(br,{className:"h-4 w-4"}):r.jsx(xr,{className:"h-4 w-4"})})]}),B.apiKey?r.jsx("p",{className:"text-xs text-destructive",children:B.apiKey.message}):Q?.requiresApiKey===!1?r.jsx("p",{className:"text-xs text-muted-foreground",children:"Only needed if your local endpoint has authentication enabled"}):Q?.apiKeyHint&&r.jsx("p",{className:"text-xs text-muted-foreground",children:Q.apiKeyHint})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(rn,{htmlFor:"target",children:"Default Target CLI"}),r.jsxs(xb,{value:X,onValueChange:$=>A("target",$),children:[r.jsx(Zd,{id:"target",children:r.jsx(vb,{})}),r.jsxs(Jd,{children:[r.jsx(dr,{value:"claude",children:"Claude Code (default)"}),r.jsx(dr,{value:"droid",children:"Factory Droid"})]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run with"," ",r.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:X==="droid"?"ccsd":"ccs"})," ","by default. You can still override each run with"," ",r.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),r.jsxs(kd,{value:"models",className:"p-6 mt-0 space-y-4",children:[r.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:[r.jsx(Nr,{className:"w-5 h-5 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),r.jsx("p",{className:"text-xs opacity-90",children:"Map Claude Code tiers (Opus/Sonnet/Haiku) to models supported by your provider."})]})]}),ie&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(rn,{children:"Search Models"}),r.jsx(In,{value:w,onChange:$=>M($.target.value),placeholder:"Type to search (e.g., opus, sonnet, gpt-4o)...",onKeyDown:$=>{$.key==="Enter"&&ae.length>0&&($.preventDefault(),ye(ae[0]))}}),r.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:ae.length===0?r.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:w?`No models found for "${w}"`:"Loading models..."}):r.jsxs("div",{className:"p-1",children:[!w&&r.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[r.jsx(eC,{className:"w-3 h-3 text-accent"}),r.jsx("span",{children:"Newest Models"})]}),ae.map($=>r.jsx(ET,{model:$,onClick:()=>ye($),showAge:!w},$.id))]})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"model",children:["Default Model",r.jsx(Wa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),r.jsx(In,{id:"model",...D("model"),placeholder:Q?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping",r.jsx(Wa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),r.jsx(In,{id:"sonnetModel",...D("sonnetModel"),placeholder:"e.g. gpt-4o, claude-sonnet-4",className:"font-mono text-sm h-9"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping",r.jsx(Wa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),r.jsx(In,{id:"opusModel",...D("opusModel"),placeholder:"e.g. o1, claude-opus-4.5",className:"font-mono text-sm h-9"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping",r.jsx(Wa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),r.jsx(In,{id:"haikuModel",...D("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3.5-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),r.jsxs(CA,{className:"p-6 pt-4 border-t bg-muted/10",children:[r.jsx(ft,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ft,{type:"submit",disabled:f.isPending,className:K(f.isPending&&"opacity-80"),children:f.isPending?r.jsxs(r.Fragment,{children:[r.jsx(jn,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(dg,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})]})]})})}function ly({preset:n,isSelected:a,onClick:s}){return r.jsxs("button",{type:"button",onClick:s,className:K("flex items-center gap-2 px-3 py-2 rounded-md border transition-all text-sm",a?n.featured?"border-accent bg-accent/10 dark:bg-accent/20 font-medium":"border-primary bg-primary/10 dark:bg-primary/20 font-medium":"border-muted-foreground/20 hover:border-muted-foreground/40 hover:bg-muted/50"),children:[n.icon?r.jsx("img",{src:n.icon,alt:"",className:"w-4 h-4"}):r.jsx("div",{className:"w-4 h-4 rounded-full bg-muted-foreground/20 flex items-center justify-center text-[9px] font-bold text-foreground/70",children:n.name.charAt(0)}),r.jsx("span",{className:"font-medium",children:n.name}),n.badge&&r.jsx(Wa,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-0.5 bg-muted-foreground/10 text-muted-foreground",children:n.badge})]})}function ET({model:n,onClick:a,showAge:s}){return r.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:[r.jsx("span",{className:"flex-1 truncate",children:n.name}),r.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[s&&n.created&&r.jsx(Wa,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:cT(n.created)}),n.isFree?r.jsx(Wa,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:"Free"}):r.jsx("span",{children:Jk(n.pricing)}),r.jsx("span",{children:sT(n.context_length)})]})]})}function PT({className:n,...a}){return r.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 RT({className:n,...a}){return r.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 LT({className:n,...a}){return r.jsx("div",{"data-slot":"card-title",className:K("leading-none font-semibold",n),...a})}function _T({className:n,...a}){return r.jsx("div",{"data-slot":"card-description",className:K("text-muted-foreground text-sm",n),...a})}function zT({className:n,...a}){return r.jsx("div",{"data-slot":"card-content",className:K("px-6",n),...a})}const IT=["agy","claude","gemini","codex","qwen","kimi","iflow","kiro","ghcp"],tO=IT.map(n=>({id:n,name:Xd(n),description:EA(n)})),UT=["provider","auth","variant","success"];function nO(n){return n==="account"?1:UT.indexOf(n)}const HT=S.forwardRef(({className:n,value:a=0,max:s=100,indicatorClassName:l,...c},f)=>{const h=Math.min(Math.max(a/s*100,0),100);return r.jsx("div",{ref:f,role:"progressbar","aria-valuemin":0,"aria-valuemax":s,"aria-valuenow":a,className:K("relative h-2 w-full overflow-hidden rounded-full bg-secondary",n),...c,children:r.jsx("div",{className:K("h-full transition-all",l||"bg-primary"),style:{width:`${h}%`}})})});HT.displayName="Progress";const BT=S.lazy(()=>ht(()=>Promise.resolve().then(()=>hf),void 0).then(n=>({default:n.CodeEditor})));function aO({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:s,onRawJsonChange:l,profileEnv:c,missingRequiredFields:f=[]}){const h=f.length>0;return r.jsx(S.Suspense,{fallback:r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx(jn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:r.jsxs("div",{className:"h-full flex flex-col",children:[!a&&s!==null&&r.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:[r.jsx(vo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&h&&r.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:[r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",r.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),r.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."})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:r.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:r.jsx(BT,{value:n,onChange:l,language:"json",minHeight:"100%"})})}),r.jsx("div",{className:"mx-6 mb-4",children:r.jsx("div",{className:"border rounded-md overflow-hidden",children:r.jsx(df,{profileEnv:c})})})]})})}var Ft={},ry;function KT(){if(ry)return Ft;ry=1;var n=Ft&&Ft.__assign||function(){return n=Object.assign||function(E){for(var A,z=1,X=arguments.length;z<X;z++){A=arguments[z];for(var W in A)Object.prototype.hasOwnProperty.call(A,W)&&(E[W]=A[W])}return E},n.apply(this,arguments)},a=Ft&&Ft.__createBinding||(Object.create?(function(E,A,z,X){X===void 0&&(X=z);var W=Object.getOwnPropertyDescriptor(A,z);(!W||("get"in W?!A.__esModule:W.writable||W.configurable))&&(W={enumerable:!0,get:function(){return A[z]}}),Object.defineProperty(E,X,W)}):(function(E,A,z,X){X===void 0&&(X=z),E[X]=A[z]})),s=Ft&&Ft.__setModuleDefault||(Object.create?(function(E,A){Object.defineProperty(E,"default",{enumerable:!0,value:A})}):function(E,A){E.default=A}),l=Ft&&Ft.__importStar||function(E){if(E&&E.__esModule)return E;var A={};if(E!=null)for(var z in E)z!=="default"&&Object.prototype.hasOwnProperty.call(E,z)&&a(A,E,z);return s(A,E),A},c=Ft&&Ft.__rest||function(E,A){var z={};for(var X in E)Object.prototype.hasOwnProperty.call(E,X)&&A.indexOf(X)<0&&(z[X]=E[X]);if(E!=null&&typeof Object.getOwnPropertySymbols=="function")for(var W=0,X=Object.getOwnPropertySymbols(E);W<X.length;W++)A.indexOf(X[W])<0&&Object.prototype.propertyIsEnumerable.call(E,X[W])&&(z[X[W]]=E[X[W]]);return z};Object.defineProperty(Ft,"__esModule",{value:!0});var f=l(Md()),h=89,p=90,m=77,y=57,C=219,b=222,v=192,N=100,w=3e3,M=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),O=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),D="npm__react-simple-code-editor__textarea",H=`
|
|
14
|
+
`).trim()}function Tk(n){const a=n.url.match(/\/api\/provider\/([^/]+)/);a&&(n.provider=a[1]);const s=n.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);s&&(n.endpoint=s[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"),Dk(n),n.statusCode===429&&Mk(n)}function Dk(n){if(n.requestBody)try{const a=JSON.parse(n.requestBody);typeof a.model=="string"&&(n.model=a.model)}catch{}}function Mk(n){if(n.responseBody)try{const a=JSON.parse(n.responseBody),s=Nd(a);s!==null&&(n.quotaResetDelay=s);const l=Ad(a);l&&(n.quotaResetTimestamp=l)}catch{}}function Nd(n){if(typeof n!="object"||n===null)return null;const a=n;if("quotaResetDelay"in a){const s=a.quotaResetDelay;if(typeof s=="number")return s;if(typeof s=="string"){const l=s.match(/^(\d+)s?$/);if(l)return parseInt(l[1],10)}}if("error"in a&&typeof a.error=="object"){const s=Nd(a.error);if(s!==null)return s}if("details"in a&&Array.isArray(a.details))for(const s of a.details){const l=Nd(s);if(l!==null)return l}return null}function Ad(n){if(typeof n!="object"||n===null)return null;const a=n;for(const s of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(s in a&&typeof a[s]=="string")return a[s];if("error"in a&&typeof a.error=="object"){const s=Ad(a.error);if(s)return s}if("details"in a&&Array.isArray(a.details))for(const s of a.details){const l=Ad(s);if(l)return l}return null}function jk(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 Ok(n,a){const s=Ld(),l=s==="zh-CN",c=s==="vi",f=Date.now(),h=n*1e3,p=f-h,m=Math.floor(p/1e3),y=Math.floor(m/60),C=Math.floor(y/60),b=Math.floor(C/24);return m<60?l?"刚刚":c?"vừa xong":"just now":y<60?l?`${y} 分钟前`:c?`${y} phút trước`:`${y}m ago`:C<24?l?`${C} 小时前`:c?`${C} giờ trước`:`${C}h ago`:b<7?l?`${b} 天前`:c?`${b} ngày trước`:`${b}d ago`:new Date(h).toLocaleDateString(s,{month:"short",day:"numeric"})}function Ek(n){return n>=500?"text-red-500":n===429?"text-orange-500":n>=400?"text-yellow-500":"text-gray-500"}function Pk(n,a){const s=Ld();return s==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[n]||"错误":s==="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 Rk(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),s=Math.floor(n%3600/60);return s>0?`${a}h ${s}m`:`${a}h`}function Lk(n,a){if(!n)return null;const s=Ld(),l=s==="zh-CN",c=s==="vi";try{const f=new Date(n),h=new Date,p=f.getTime()-h.getTime();if(p<=0)return l?"现在":c?"bây giờ":"now";const m=Math.floor(p/1e3);if(m<60)return l?`${m}秒`:c?`${m} giây`:`${m}s`;if(m<3600){const b=Math.floor(m/60);return l?`${b}分钟`:c?`${b} phút`:`${b}m`}const y=Math.floor(m/3600),C=Math.floor(m%3600/60);return l?C>0?`${y}小时 ${C}分钟`:`${y}小时`:c?C>0?`${y} giờ ${C} phút`:`${y} giờ`:C>0?`${y}h ${C}m`:`${y}h`}catch{return null}}function _k(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 zk(n){return n||""}function Ik({name:n,size:a,modified:s,isSelected:l,onClick:c,statusCode:f,model:h}){const p=S.useMemo(()=>Ck(n),[n]),m=S.useMemo(()=>zk(h),[h]);return r.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]",l?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[r.jsx("span",{className:K("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",_k(f)),children:f||"???"}),r.jsx(ef,{provider:p.provider,size:18,withBackground:!0,className:"shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:p.endpoint||"unknown"}),m&&r.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:m,children:m}),r.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[r.jsx(Es,{className:"w-2.5 h-2.5"}),r.jsx("span",{children:Ok(s)})]})]})]})}function ny({value:n,className:a,variant:s="outline",size:l="icon",label:c="Copy to clipboard"}){const[f,h]=S.useState(!1),p=()=>{navigator.clipboard.writeText(n),h(!0),setTimeout(()=>h(!1),2e3)};return r.jsx(Ci,{children:r.jsxs($a,{children:[r.jsx(Xa,{asChild:!0,children:r.jsxs(ft,{size:l,variant:s,className:K("relative z-10 text-muted-foreground hover:text-foreground",a),onClick:m=>{m.stopPropagation(),p()},children:[f?r.jsx(bo,{className:"h-3.5 w-3.5 text-green-500"}):r.jsx(lr,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"sr-only",children:c})]})}),r.jsx(Za,{children:r.jsx("p",{children:f?"Copied!":c})})]})})}function Ss({active:n,onClick:a,children:s,icon:l}){return r.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:[l&&r.jsx(l,{className:"w-3.5 h-3.5"}),s]})}function Yb({code:n}){const a=Ek(n);return r.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 Uk({parsed:n}){const{t:a}=_t(),s=Rk(n.quotaResetDelay)||Lk(n.quotaResetTimestamp),l=a("errorLogs.na");return r.jsx(So,{className:"h-full",children:r.jsxs("div",{className:"p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Yb,{code:n.statusCode}),r.jsx("span",{className:"text-sm font-medium",children:n.statusText}),r.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:Pk(n.errorType)})]}),n.model&&r.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[r.jsx(FS,{className:"w-4 h-4 text-violet-500 shrink-0"}),r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.modelLabel")}),r.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:n.model})]})]}),n.errorType==="rate_limit"&&s&&r.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[r.jsx(Es,{className:"w-4 h-4 text-amber-500 shrink-0"}),r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.quotaResetsIn")}),r.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:s})]})]}),r.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[r.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[r.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.method")}),r.jsx("div",{className:"font-medium",children:n.method||l})]}),r.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[r.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.provider")}),r.jsx("div",{className:"font-medium",children:n.provider||l})]}),r.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[r.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.version")}),r.jsx("div",{className:"font-medium",children:n.version||l})]}),r.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[r.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.endpoint")}),r.jsx("div",{className:"font-medium truncate",title:n.endpoint,children:n.endpoint||l})]})]}),r.jsxs("div",{className:"text-xs",children:[r.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.url")}),r.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:n.url||l})]}),r.jsxs("div",{className:"text-xs",children:[r.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.timestamp")}),r.jsx("div",{className:"font-mono",children:n.timestamp||l})]}),n.errorType!=="unknown"&&r.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"?r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):n.errorType==="auth"?r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):r.jsx(Nr,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),r.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 Hk({headers:n}){const a=Object.entries(n);return a.length===0?r.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):r.jsx(So,{className:"h-full",children:r.jsx("div",{className:"p-4 space-y-1",children:a.map(([s,l])=>r.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[r.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[s,":"]}),r.jsx("span",{className:"break-all",children:l})]},s))})})}function ay({content:n,label:a}){const{t:s}=_t();if(!n||n.trim()===""){const f=a==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return r.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:s(f)})}let l=n,c=!1;try{const f=JSON.parse(n);l=JSON.stringify(f,null,2),c=!0}catch{}return r.jsx(So,{className:"h-full",children:r.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:l})})}function Bk({content:n}){return r.jsx(So,{className:"h-full",children:r.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 Kk({name:n,absolutePath:a}){const{t:s}=_t(),[l,c]=S.useState("overview"),{data:f,isLoading:h,error:p}=v1(n),m=S.useMemo(()=>f?wk(f):null,[f]);return n?h?r.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[r.jsx(Ge,{className:"h-5 w-full"}),r.jsx(Ge,{className:"h-5 w-3/4"}),r.jsx(Ge,{className:"h-5 w-5/6"}),r.jsx(Ge,{className:"h-5 w-2/3"})]}):p||!f||!m?r.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:r.jsx("p",{className:"text-sm",children:s("errorLogs.failedLoadContent")})}):r.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[r.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[r.jsx(Yb,{code:m.statusCode}),r.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[m.provider,"/",m.endpoint||"unknown"]}),n&&r.jsx(ny,{value:a||n,label:s("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[f&&r.jsx(ny,{value:f,label:s("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),r.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:m.method})]})]}),r.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:[r.jsx(Ss,{active:l==="overview",onClick:()=>c("overview"),icon:Nr,children:s("errorLogs.tabOverview")}),r.jsx(Ss,{active:l==="headers",onClick:()=>c("headers"),icon:QS,children:s("errorLogs.tabHeaders")}),r.jsx(Ss,{active:l==="request",onClick:()=>c("request"),icon:WS,children:s("errorLogs.tabRequest")}),r.jsx(Ss,{active:l==="response",onClick:()=>c("response"),icon:$S,children:s("errorLogs.tabResponse")}),r.jsx(Ss,{active:l==="raw",onClick:()=>c("raw"),icon:XS,children:s("errorLogs.tabRaw")})]}),r.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[l==="overview"&&r.jsx(Uk,{parsed:m}),l==="headers"&&r.jsx(Hk,{headers:m.requestHeaders}),l==="request"&&r.jsx(ay,{content:m.requestBody,label:"Request"}),l==="response"&&r.jsx(ay,{content:m.responseBody,label:"Response"}),l==="raw"&&r.jsx(Bk,{content:f})]})]}):r.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:r.jsxs("div",{className:"text-center space-y-3",children:[r.jsx(VS,{className:"w-10 h-10 mx-auto opacity-40"}),r.jsx("p",{className:"text-sm",children:s("errorLogs.selectLog")})]})})}function qk(){const{t:n}=_t(),{data:a,isLoading:s}=m1(),{data:l,isLoading:c,error:f}=x1(a?.running??!1),[h,p]=S.useState(500),[m,y]=S.useState(!1),C=S.useRef(null),b=S.useRef(null),v=()=>{b.current&&(clearInterval(b.current),b.current=null)};S.useEffect(()=>{if(!m)return;const I=A=>{const z=C.current;if(!z)return;const W=z.getBoundingClientRect().top+window.scrollY,Q=A.pageY-W;p(Math.max(300,Q));const ee=window.innerHeight-A.clientY,ye=15;v(),ee<50?b.current=setInterval(()=>{window.scrollBy(0,ye)},16):A.clientY<50&&(b.current=setInterval(()=>{window.scrollBy(0,-ye)},16))},E=()=>{y(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",I),document.addEventListener("mouseup",E),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",E),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[m]);const N=I=>{I.preventDefault(),y(!0)},w=S.useMemo(()=>l?.[0]?.name??null,[l]),[M,O]=S.useState(null),D=M??w,H=S.useMemo(()=>!D||!l?void 0:l.find(E=>E.name===D)?.absolutePath,[D,l]);if(s||!a?.running)return null;if(c)return r.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:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[r.jsx(Ge,{className:"h-4 w-32"}),r.jsx(Ge,{className:"h-4 w-20"})]}),r.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(I=>r.jsx(Ge,{className:"h-12 w-full rounded-lg"},I))})]});if(!l||l.length===0)return null;const B=l.length;return r.jsxs("div",{ref:C,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:h},children:[r.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:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx(qn,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-semibold tracking-tight",children:n("errorLogs.title")}),r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:n("errorLogs.failedRequests",{count:B})})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ZS,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:n("errorLogs.cliproxyDiagnostics")})]})]}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsxs(of,{direction:"horizontal",children:[r.jsx(Rs,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:r.jsxs(So,{className:"h-full",children:[r.jsx("div",{className:"divide-y divide-border/50",children:l.slice(0,50).map(I=>r.jsx(Ik,{name:I.name,size:I.size,modified:I.modified,isSelected:D===I.name,onClick:()=>O(I.name),statusCode:I.statusCode,model:I.model},I.name))}),l.length>50&&r.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:n("errorLogs.showingCount",{total:l.length})})]})}),r.jsxs(sf,{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:[r.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),r.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:r.jsx(wr,{className:"h-4 w-4 text-muted-foreground"})})]}),r.jsx(Rs,{className:"flex flex-col min-w-0 bg-background/50",children:r.jsx(Kk,{name:D,absolutePath:H})})]})}),f?r.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:f.message}):r.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:N,children:r.jsx(JS,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const Gk=Ar("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"}}),lf=S.forwardRef(({className:n,variant:a,...s},l)=>r.jsx("div",{ref:l,role:"alert",className:K(Gk({variant:a}),n),...s}));lf.displayName="Alert";const Fb=S.forwardRef(({className:n,...a},s)=>r.jsx("h5",{ref:s,className:K("mb-1 font-medium leading-none tracking-tight",n),...a}));Fb.displayName="AlertTitle";const rf=S.forwardRef(({className:n,...a},s)=>r.jsx("div",{ref:s,className:K("text-sm [&_p]:leading-relaxed",n),...a}));rf.displayName="AlertDescription";function Yk(){return Tt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function Vb(n,a){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="string"?n.error:a}function Qb(n){const a=n.trim();if(!a)return null;try{return JSON.parse(a)}catch{return null}}function Fk(n){const a=n.trim().toLowerCase();return a.startsWith("<!doctype html")||a.startsWith("<html")}function Vk(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 Wb(n,a){const s=await n.text(),l=Qb(s);if(!n.ok){const c=Vb(l,a);throw new Error(c)}if(l===null)throw new Error(a);return l}function Qk(){return Tt({queryKey:["shared","summary"],queryFn:async()=>{const n=await fetch("/api/shared/summary");return Wb(n,"Failed to fetch shared summary")}})}function Uj(n){return Tt({queryKey:["shared",n],queryFn:async()=>{const a=await fetch(`/api/shared/${n}`);return Wb(a,`Failed to fetch shared ${n}`)}})}function Hj(n,a){return Tt({queryKey:["shared",n,"content",a],enabled:typeof a=="string"&&a.length>0,queryFn:async()=>{if(!a)throw new Error("Missing shared item path");const s=new URLSearchParams({type:n,path:a}),l=await fetch(`/api/shared/content?${s.toString()}`),c=await l.text(),f=Qb(c);if(!l.ok)throw new Error(Vb(f,`Failed to fetch shared ${n} content`));if(Vk(f))return{content:f.content,contentPath:typeof f.contentPath=="string"&&f.contentPath.length>0?f.contentPath:a};if(c.trim().length>0){if(Fk(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 Wk={ok:"success",warning:"warning",error:"error"},$k={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 nr({title:n,value:a,icon:s,variant:l="default",onClick:c}){const f=$k[l];return r.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:[r.jsx("div",{className:K("flex items-center justify-center w-9 h-9 rounded-md",f.iconBg),children:r.jsx(s,{className:K("w-4 h-4",f.iconColor)})}),r.jsxs("div",{className:"text-left",children:[r.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:n}),r.jsx("p",{className:K("text-lg font-bold font-mono leading-tight",f.iconColor),children:a})]})]})}function Xk(){const{t:n}=_t(),a=jd(),{data:s,isLoading:l}=Yk(),{data:c,isLoading:f}=Qk();if(l||f)return r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Ge,{className:"h-12 w-12 rounded-lg"}),r.jsxs("div",{children:[r.jsx(Ge,{className:"h-7 w-[180px] mb-2"}),r.jsx(Ge,{className:"h-4 w-[220px]"})]})]}),r.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(p=>r.jsx(Ge,{className:"h-14 w-28 rounded-lg"},p))})]}),r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[r.jsx(Ge,{className:"h-4 w-32"}),r.jsx(Ge,{className:"h-4 w-20"})]}),r.jsx("div",{className:"px-4 py-3 border-b",children:r.jsx(Ge,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(p=>r.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[r.jsx(Ge,{className:"w-2.5 h-2.5 rounded-full"}),r.jsx(Ge,{className:"h-4 flex-1"}),r.jsx(Ge,{className:"h-1.5 w-24 rounded-full"}),r.jsx(Ge,{className:"h-4 w-16"})]},p))]})]});const h=s?.health?Wk[s.health.status]:void 0;return r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[r.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:r.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),r.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[r.jsx(t1,{version:s?.version}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(nr,{title:n("home.profiles"),value:s?.profiles??0,icon:Yy,variant:"accent",onClick:()=>a("/providers")}),r.jsx(nr,{title:n("home.cliproxy"),value:s?.cliproxy??0,icon:Fy,variant:"accent",onClick:()=>a("/cliproxy")}),r.jsx(nr,{title:n("home.accounts"),value:s?.accounts??0,icon:Wy,variant:"default",onClick:()=>a("/accounts")}),r.jsx(nr,{title:n("home.health"),value:s?.health?`${s.health.passed}/${s.health.total}`:"-",icon:js,variant:h,onClick:()=>a("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&r.jsxs(lf,{variant:"warning",children:[r.jsx(qn,{className:"h-4 w-4"}),r.jsx(Fb,{children:n("home.configurationRequired")}),r.jsx(rf,{children:c.symlinkStatus.message})]}),r.jsx(V1,{}),r.jsx(qk,{})]})}const $b=uS,cf=S.forwardRef(({className:n,...a},s)=>r.jsx(By,{ref:s,className:K("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...a}));cf.displayName=By.displayName;const pr=S.forwardRef(({className:n,...a},s)=>r.jsx(Ky,{ref:s,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}));pr.displayName=Ky.displayName;const kd=S.forwardRef(({className:n,...a},s)=>r.jsx(qy,{ref:s,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}));kd.displayName=qy.displayName;function rn({className:n,...a}){return r.jsx(dS,{"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 uf="ccs:openrouter-models",Zk=1440*60*1e3,Xb="1";function Td(n){const a=parseFloat(n);return isNaN(a)||a===0?0:a*1e6}function iy(n){const a=Td(n);return a===0?"Free":a<.01?"<$0.01":a<1?`$${a.toFixed(2)}`:`$${a.toFixed(a<10?2:0)}`}function Jk(n){const a=iy(n.prompt),s=iy(n.completion);return a==="Free"&&s==="Free"?"Free":`${a}/${s}`}function eT(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 tT(n){return{...n,category:eT(n),pricePerMillionPrompt:Td(n.pricing.prompt),pricePerMillionCompletion:Td(n.pricing.completion),isFree:n.pricing.prompt==="0"&&n.pricing.completion==="0",isExacto:n.id.includes(":exacto")}}function nT(n,a,s){const l=a.toLowerCase().trim();return n.filter(c=>s?.category&&c.category!==s.category||s?.freeOnly&&!c.isFree||s?.minContext&&c.context_length<s.minContext?!1:l?c.id.toLowerCase().includes(l)||c.name.toLowerCase().includes(l)||c.description?.toLowerCase().includes(l):!0)}function Bj(n){return[...n].sort((a,s)=>{if(a.isFree&&!s.isFree)return-1;if(!a.isFree&&s.isFree)return 1;if(!a.isFree&&!s.isFree){if(a.isExacto&&!s.isExacto)return-1;if(!a.isExacto&&s.isExacto)return 1}return a.name.localeCompare(s.name)})}function aT(){try{const n=localStorage.getItem(uf);if(!n)return null;const a=JSON.parse(n);return a.version!==Xb||Date.now()-a.fetchedAt>Zk?null:a.models}catch{return null}}function iT(n){try{localStorage.setItem(uf,JSON.stringify({models:n,fetchedAt:Date.now(),version:Xb}))}catch{}}function oT(){localStorage.removeItem(uf)}function Kj(n,a){const[s]=n.split("/");if(!s)return{};const l=a.filter(h=>h.id.startsWith(`${s}/`));if(l.length===0)return{};const c=[...l].sort((h,p)=>p.pricePerMillionPrompt-h.pricePerMillionPrompt),f=Math.ceil(c.length/3);return{opus:c[0]?.id,sonnet:c[Math.min(f,c.length-1)]?.id,haiku:c[c.length-1]?.id}}function sT(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}const qj={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},lT={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function rT(n,a=2){const s=[],l=["anthropic","openai","google","meta","mistral","opensource"];for(const c of l){const f=lT[c];if(f.length===0)continue;const p=[...n.filter(m=>f.some(y=>m.id.toLowerCase().startsWith(y)))].sort((m,y)=>(y.created??0)-(m.created??0));s.push(...p.slice(0,a))}return s.sort((c,f)=>(f.created??0)-(c.created??0))}function cT(n){const s=Date.now()/1e3-n;return s<86400?"Today":s<172800?"Yesterday":s<604800?`${Math.floor(s/86400)}d ago`:s<2592e3?`${Math.floor(s/604800)}w ago`:s<31536e3?`${Math.floor(s/2592e3)}mo ago`:`${Math.floor(s/31536e3)}y ago`}const uT="https://openrouter.ai/api/v1/models",Zb=["openrouter-models"],oy=1440*60*1e3;async function dT(){const n=await fetch(uT);if(!n.ok)throw new Error(`Failed to fetch OpenRouter models: ${n.status}`);const s=(await n.json()).data;return iT(s),s}function Jb(){return Tt({queryKey:Zb,queryFn:dT,staleTime:oy,gcTime:oy,initialData:()=>aT()??void 0,refetchOnWindowFocus:!1})}function fT(){const n=Jb(),a=(n.data??[]).map(tT);return{...n,models:a}}function Gj(){const n=it();return()=>(oT(),n.invalidateQueries({queryKey:Zb}))}function Yj(){const{data:n,isLoading:a,isError:s}=Jb();return{isReady:!!n&&n.length>0,isLoading:a,isError:s,modelCount:n?.length??0}}function df({profileEnv:n={}}){const[a,s]=S.useState(null),[l,c]=S.useState(!0),[f,h]=S.useState(!1);S.useEffect(()=>{p()},[]);const p=async()=>{try{c(!0);const v=await fetch("/api/global-env");if(!v.ok)throw new Error("Failed to load");const N=await v.json();s(N)}catch{s(null)}finally{c(!1)}};if(l||!a?.enabled)return null;const m=a.env||{},y=Object.keys(m);if(y.length===0)return null;const C=y.filter(v=>!(v in n)),b=y.filter(v=>v in n);return r.jsxs("div",{className:"border-t bg-muted/20",children:[r.jsxs("button",{onClick:()=>h(!f),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[r.jsx(Nr,{className:"w-4 h-4 text-blue-500"}),r.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[r.jsx("span",{className:"font-medium text-foreground",children:C.length})," global env var",C.length!==1?"s":""," will be injected at runtime",b.length>0&&r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",b.length," overridden by profile)"]})]}),f?r.jsx(Ed,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(vr,{className:"w-4 h-4 text-muted-foreground"})]}),f&&r.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[C.length>0&&r.jsx("div",{className:"space-y-1",children:C.map(v=>r.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:[r.jsx("span",{className:"text-green-500",children:"+"}),r.jsxs("span",{className:"truncate",children:[v,"=",m[v]]})]},v))}),b.length>0&&r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),b.map(v=>r.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:[r.jsx("span",{className:"text-amber-500",children:"~"}),r.jsx("span",{className:"truncate",children:v})]},v))]}),r.jsx("div",{className:"pt-2 border-t border-border/50",children:r.jsx(ft,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:r.jsxs(gd,{to:"/settings?tab=globalenv",children:[r.jsx(Rd,{className:"w-3.5 h-3.5"}),"Configure in Settings",r.jsx($y,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const hT=S.lazy(()=>ht(()=>Promise.resolve().then(()=>hf),void 0).then(n=>({default:n.CodeEditor})));function Fj({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:s,settings:l,onChange:c,missingRequiredFields:f=[]}){const h=f.length>0;return r.jsx(S.Suspense,{fallback:r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx(jn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:r.jsxs("div",{className:"h-full flex flex-col",children:[!a&&s!==null&&r.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:[r.jsx(vo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&h&&r.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:[r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",r.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:r.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:r.jsx(hT,{value:n,onChange:c,language:"json",minHeight:"100%"})})}),r.jsx("div",{className:"mx-6 mb-4",children:r.jsx("div",{className:"border rounded-md overflow-hidden",children:r.jsx(df,{profileEnv:l?.env})})})]})})}function sy(n,a){try{var s=n()}catch(l){return a(l)}return s&&s.then?s.then(void 0,a):s}function pT(n,a){for(var s={};n.length;){var l=n[0],c=l.code,f=l.message,h=l.path.join(".");if(!s[h])if("unionErrors"in l){var p=l.unionErrors[0].errors[0];s[h]={message:p.message,type:p.code}}else s[h]={message:f,type:c};if("unionErrors"in l&&l.unionErrors.forEach(function(C){return C.errors.forEach(function(b){return n.push(b)})}),a){var m=s[h].types,y=m&&m[l.code];s[h]=Zy(h,a,s,c,y?[].concat(y,l.message):l.message)}n.shift()}return s}function mT(n,a){for(var s={};n.length;){var l=n[0],c=l.code,f=l.message,h=l.path.join(".");if(!s[h])if(l.code==="invalid_union"&&l.errors.length>0){var p=l.errors[0][0];s[h]={message:p.message,type:p.code}}else s[h]={message:f,type:c};if(l.code==="invalid_union"&&l.errors.forEach(function(C){return C.forEach(function(b){return n.push(b)})}),a){var m=s[h].types,y=m&&m[l.code];s[h]=Zy(h,a,s,c,y?[].concat(y,l.message):l.message)}n.shift()}return s}function gT(n,a,s){if(s===void 0&&(s={}),(function(l){return"_def"in l&&typeof l._def=="object"&&"typeName"in l._def})(n))return function(l,c,f){try{return Promise.resolve(sy(function(){return Promise.resolve(n[s.mode==="sync"?"parse":"parseAsync"](l,a)).then(function(h){return f.shouldUseNativeValidation&&hg({},f),{errors:{},values:s.raw?Object.assign({},l):h}})},function(h){if((function(p){return Array.isArray(p?.issues)})(h))return{values:{},errors:pg(pT(h.errors,!f.shouldUseNativeValidation&&f.criteriaMode==="all"),f)};throw h}))}catch(h){return Promise.reject(h)}};if((function(l){return"_zod"in l&&typeof l._zod=="object"})(n))return function(l,c,f){try{return Promise.resolve(sy(function(){return Promise.resolve((s.mode==="sync"?UC:HC)(n,l,a)).then(function(h){return f.shouldUseNativeValidation&&hg({},f),{errors:{},values:s.raw?Object.assign({},l):h}})},function(h){if((function(p){return p instanceof BC})(h))return{values:{},errors:pg(mT(h.issues,!f.shouldUseNativeValidation&&f.criteriaMode==="all"),f)};throw h}))}catch(h){return Promise.reject(h)}};throw new Error("Invalid input: not a Zod schema")}function Vj(){return Tt({queryKey:["profiles"],queryFn:()=>Be.profiles.list()})}function yT(){const n=it();return et({mutationFn:a=>Be.profiles.create(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Profile created successfully")},onError:a=>{re.error(a.message)}})}function Qj(){const n=it();return et({mutationFn:a=>Be.profiles.delete(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Profile deleted successfully")},onError:a=>{re.error(a.message)}})}function Wj(){return et({mutationFn:()=>Be.profiles.discoverOrphans()})}function $j(){const n=it();return et({mutationFn:a=>Be.profiles.registerOrphans(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Orphan profiles registration complete")}})}function Xj(){const n=it();return et({mutationFn:({name:a,data:s})=>Be.profiles.copy(a,s),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Profile copied successfully")}})}function Zj(){return et({mutationFn:({name:n,includeSecrets:a})=>Be.profiles.export(n,a??!1)})}function Jj(){const n=it();return et({mutationFn:a=>Be.profiles.import(a),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),re.success("Profile imported successfully")}})}const bT="https://openrouter.ai/api",ex=Object.freeze({kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan"}),tx=[{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},{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:bT,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},{id:"glm",name:"GLM",description:"Claude via Z.AI",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:"glmt",name:"GLMT",description:"GLM with Thinking mode support",baseUrl:"https://api.z.ai/api/coding/paas/v4/chat/completions",defaultProfileName:"glmt",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Same API key as GLM",category:"alternative",requiresApiKey:!0,extraEnv:{ANTHROPIC_TEMPERATURE:"0.2",ANTHROPIC_MAX_TOKENS:"65536",MAX_THINKING_TOKENS:"32768",ENABLE_STREAMING:"true",ANTHROPIC_SAFE_MODE:"false",API_TIMEOUT_MS:"3000000"},alwaysThinkingEnabled:!0,badge:"Thinking",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 nx(n){return{...n,extraEnv:n.extraEnv?{...n.extraEnv}:void 0}}function xT(n){const a=nx(n);return a.extraEnv&&Object.freeze(a.extraEnv),Object.freeze(a)}function vT(n,a){const s=new Set;for(const c of n){const f=c.id.trim().toLowerCase();if(c.id!==f)throw new Error(`Preset ID must be normalized: "${c.id}"`);if(s.has(c.id))throw new Error(`Duplicate preset ID detected: "${c.id}"`);s.add(c.id)}const l=new Set;for(const[c,f]of Object.entries(a)){const h=c.trim().toLowerCase();if(!h)throw new Error("Preset alias keys cannot be empty");if(c!==h)throw new Error(`Preset alias must be normalized: "${c}"`);if(l.has(h))throw new Error(`Duplicate normalized preset alias detected: "${c}"`);if(l.add(h),!s.has(f))throw new Error(`Preset alias "${c}" points to unknown target "${f}"`);if(s.has(h))throw new Error(`Preset alias "${c}" collides with canonical preset ID "${h}"`)}}vT(tx,ex);const ST=Object.freeze(tx.map(xT));function CT(){return ST.map(nx)}function wT(n){const a=n.trim().toLowerCase();return ex[a]||a}const NT=CT(),ff=Object.freeze(NT.map(n=>({...n})));function AT(n,a){return a||(n?.requiresApiKey===!1?n.apiKeyPlaceholder||n.id:"")}function kT(n){return ff.filter(a=>a.category===n)}function rd(n){const a=wT(n);return ff.find(s=>s.id===a)}const TT=Fa().refine(n=>n.trim().length===0||Fa().url().safeParse(n).success,{message:"Invalid URL format"}),DT=KC({name:Fa().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:TT,apiKey:Fa(),model:Fa().optional(),opusModel:Fa().optional(),sonnetModel:Fa().optional(),haikuModel:Fa().optional(),target:qC(["claude","droid"])}),MT=["/chat/completions","/v1/messages","/messages","/completions"],ma="custom",cd="openrouter",ud={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},jT=kT("recommended"),ax=ff.filter(n=>n.category!=="recommended"),OT=new Set(ax.map(n=>n.id));function eO({open:n,onOpenChange:a,onSuccess:s,initialMode:l="openrouter"}){const{t:c}=_t(),f=yT(),[h,p]=S.useState("basic"),[m,y]=S.useState(null),[C,b]=S.useState(!1),[v,N]=S.useState(cd),[w,M]=S.useState(""),{models:O}=fT(),{register:D,handleSubmit:H,formState:{errors:B},control:I,reset:E,setValue:A}=GC({resolver:gT(DT),defaultValues:ud}),z=mg({control:I,name:"baseUrl"}),X=mg({control:I,name:"target"}),W=S.useCallback($=>{if(!$){E(ud);return}E({...ud,name:$.defaultProfileName,baseUrl:$.baseUrl,model:$.defaultModel,opusModel:$.defaultModel,sonnetModel:$.defaultModel,haikuModel:$.defaultModel})},[E]),Q=S.useMemo(()=>v===ma?null:rd(v)??null,[v]),ae=S.useMemo(()=>w.trim()?[...nT(O,w)].sort((se,ne)=>(ne.created??0)-(se.created??0)).slice(0,20):rT(O,2),[O,w]);S.useEffect(()=>{if(n)if(p("basic"),y(null),b(!1),M(""),l==="normal")N(ma),W(null);else{const se=rd(l==="openrouter"?cd:l);if(se){N(se.id),W(se);return}N(ma),W(null)}},[n,l,W]);const ee=$=>{const se=rd($);if(se){N(se.id),W(se);return}N(ma),W(null)},ye=$=>{A("model",$.id),A("opusModel",$.id),A("sonnetModel",$.id),A("haikuModel",$.id),M($.name),re.success(`Applied "${$.name}" to all model tiers`,{duration:2e3})};S.useEffect(()=>{if(z&&v===ma){const se=z.toLowerCase();for(const ne of MT)if(se.endsWith(ne)){const Ne=z.replace(new RegExp(ne+"$","i"),"");y(`URL ends with "${ne}" - Claude appends this automatically. You likely want: ${Ne}`);return}}y(null)},[z,v]);const fe=async $=>{if(Q?.requiresApiKey!==!1&&!$.apiKey){re.error(He.t("commonToast.apiKeyRequired"));return}const se={...$,apiKey:AT(Q,$.apiKey)};try{await f.mutateAsync(se),re.success(`Profile "${se.name}" created`),s(se.name),a(!1)}catch(ne){re.error(ne.message||"Failed to create profile")}},Ce=!!B.name||!!B.baseUrl||!!B.apiKey,P=!!B.model||!!B.opusModel||!!B.sonnetModel||!!B.haikuModel,F=v!==ma&&OT.has(v),ie=Q?.id===cd;return r.jsx(qd,{open:n,onOpenChange:a,children:r.jsxs(Gd,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh] !flex !flex-col",children:[r.jsxs(Yd,{className:"p-6 pb-4 border-b",children:[r.jsxs(Fd,{className:"flex items-center gap-2",children:[r.jsx(dg,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),r.jsx(Vd,{children:"Choose a provider or configure a custom API endpoint."})]}),r.jsxs("form",{onSubmit:H(fe),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[r.jsxs("div",{className:"px-6 py-3 border-b bg-muted/30 space-y-2",children:[r.jsxs("div",{children:[r.jsx(rn,{className:"text-xs text-muted-foreground mb-1.5 block",children:c("profileEditor.provider")}),r.jsxs("div",{className:"flex gap-2",children:[jT.map($=>r.jsx(ly,{preset:$,isSelected:v===$.id,onClick:()=>ee($.id)},$.id)),r.jsxs("button",{type:"button",onClick:()=>ee(ma),className:K("flex items-center gap-2 px-4 py-2 rounded-md border-2 transition-all text-sm font-medium",v===ma||F?"border-primary bg-primary/10 text-primary dark:bg-primary/20":"border-dashed border-muted-foreground/40 hover:border-primary/50 hover:bg-muted/50 text-muted-foreground hover:text-foreground"),children:[r.jsx(Rd,{className:"w-4 h-4"}),r.jsx("span",{children:c("profileEditor.custom")})]})]})]}),(v===ma||F)&&r.jsxs("div",{className:"pt-3 mt-2 border-t border-dashed border-muted-foreground/30",children:[r.jsx(rn,{className:"text-xs font-medium text-foreground/70 mb-2 block",children:"Quick Templates"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:ax.map($=>r.jsx(ly,{preset:$,isSelected:v===$.id,onClick:()=>ee($.id)},$.id))})]})]}),r.jsxs($b,{value:h,onValueChange:p,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[r.jsx("div",{className:"px-6 pt-4",children:r.jsxs(cf,{className:"grid w-full grid-cols-2",children:[r.jsxs(pr,{value:"basic",className:"relative",children:["Basic Information",Ce&&r.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),r.jsxs(pr,{value:"models",className:"relative",children:["Model Configuration",P&&r.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[r.jsxs(kd,{value:"basic",className:"p-6 space-y-4 mt-0",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"name",children:["Profile Name ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(In,{id:"name",...D("name"),placeholder:"my-api",className:"font-mono"}),B.name?r.jsx("p",{className:"text-xs text-destructive",children:B.name.message}):r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",r.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(rn,{htmlFor:"baseUrl",children:"API Base URL"}),r.jsx(In,{id:"baseUrl",...D("baseUrl"),placeholder:"https://api.example.com/v1"}),B.baseUrl?r.jsx("p",{className:"text-xs text-destructive",children:B.baseUrl.message}):m?r.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:[r.jsx(qn,{className:"w-4 h-4 shrink-0 mt-0.5"}),r.jsx("span",{children:m})]}):Q?r.jsx("p",{className:"text-xs text-muted-foreground",children:Q.baseUrl?`Pre-filled from ${Q.name}. You can customize if needed.`:`Optional for ${Q.name}. Leave blank to use native Anthropic auth.`}):r.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"apiKey",children:["API Key"," ",Q?.requiresApiKey!==!1&&r.jsx("span",{className:"text-destructive",children:"*"}),Q?.requiresApiKey===!1&&r.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:"(optional)"})]}),r.jsxs("div",{className:"relative",children:[r.jsx(In,{id:"apiKey",type:C?"text":"password",...D("apiKey"),placeholder:Q?.requiresApiKey===!1?"Optional - only if auth is enabled":Q?.apiKeyPlaceholder??"sk-...",className:"pr-10"}),r.jsx(ft,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>b(!C),tabIndex:-1,children:C?r.jsx(br,{className:"h-4 w-4"}):r.jsx(xr,{className:"h-4 w-4"})})]}),B.apiKey?r.jsx("p",{className:"text-xs text-destructive",children:B.apiKey.message}):Q?.requiresApiKey===!1?r.jsx("p",{className:"text-xs text-muted-foreground",children:"Only needed if your local endpoint has authentication enabled"}):Q?.apiKeyHint&&r.jsx("p",{className:"text-xs text-muted-foreground",children:Q.apiKeyHint})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(rn,{htmlFor:"target",children:"Default Target CLI"}),r.jsxs(xb,{value:X,onValueChange:$=>A("target",$),children:[r.jsx(Zd,{id:"target",children:r.jsx(vb,{})}),r.jsxs(Jd,{children:[r.jsx(dr,{value:"claude",children:"Claude Code (default)"}),r.jsx(dr,{value:"droid",children:"Factory Droid"})]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run with"," ",r.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:X==="droid"?"ccsd":"ccs"})," ","by default. You can still override each run with"," ",r.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),r.jsxs(kd,{value:"models",className:"p-6 mt-0 space-y-4",children:[r.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:[r.jsx(Nr,{className:"w-5 h-5 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),r.jsx("p",{className:"text-xs opacity-90",children:"Map Claude Code tiers (Opus/Sonnet/Haiku) to models supported by your provider."})]})]}),ie&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(rn,{children:"Search Models"}),r.jsx(In,{value:w,onChange:$=>M($.target.value),placeholder:"Type to search (e.g., opus, sonnet, gpt-4o)...",onKeyDown:$=>{$.key==="Enter"&&ae.length>0&&($.preventDefault(),ye(ae[0]))}}),r.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:ae.length===0?r.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:w?`No models found for "${w}"`:"Loading models..."}):r.jsxs("div",{className:"p-1",children:[!w&&r.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[r.jsx(eC,{className:"w-3 h-3 text-accent"}),r.jsx("span",{children:"Newest Models"})]}),ae.map($=>r.jsx(ET,{model:$,onClick:()=>ye($),showAge:!w},$.id))]})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"model",children:["Default Model",r.jsx(Wa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),r.jsx(In,{id:"model",...D("model"),placeholder:Q?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping",r.jsx(Wa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),r.jsx(In,{id:"sonnetModel",...D("sonnetModel"),placeholder:"e.g. gpt-4o, claude-sonnet-4",className:"font-mono text-sm h-9"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping",r.jsx(Wa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),r.jsx(In,{id:"opusModel",...D("opusModel"),placeholder:"e.g. o1, claude-opus-4.5",className:"font-mono text-sm h-9"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(rn,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping",r.jsx(Wa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),r.jsx(In,{id:"haikuModel",...D("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3.5-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),r.jsxs(CA,{className:"p-6 pt-4 border-t bg-muted/10",children:[r.jsx(ft,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ft,{type:"submit",disabled:f.isPending,className:K(f.isPending&&"opacity-80"),children:f.isPending?r.jsxs(r.Fragment,{children:[r.jsx(jn,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(dg,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})]})]})})}function ly({preset:n,isSelected:a,onClick:s}){return r.jsxs("button",{type:"button",onClick:s,className:K("flex items-center gap-2 px-3 py-2 rounded-md border transition-all text-sm",a?n.featured?"border-accent bg-accent/10 dark:bg-accent/20 font-medium":"border-primary bg-primary/10 dark:bg-primary/20 font-medium":"border-muted-foreground/20 hover:border-muted-foreground/40 hover:bg-muted/50"),children:[n.icon?r.jsx("img",{src:n.icon,alt:"",className:"w-4 h-4"}):r.jsx("div",{className:"w-4 h-4 rounded-full bg-muted-foreground/20 flex items-center justify-center text-[9px] font-bold text-foreground/70",children:n.name.charAt(0)}),r.jsx("span",{className:"font-medium",children:n.name}),n.badge&&r.jsx(Wa,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-0.5 bg-muted-foreground/10 text-muted-foreground",children:n.badge})]})}function ET({model:n,onClick:a,showAge:s}){return r.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:[r.jsx("span",{className:"flex-1 truncate",children:n.name}),r.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[s&&n.created&&r.jsx(Wa,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:cT(n.created)}),n.isFree?r.jsx(Wa,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:"Free"}):r.jsx("span",{children:Jk(n.pricing)}),r.jsx("span",{children:sT(n.context_length)})]})]})}function PT({className:n,...a}){return r.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 RT({className:n,...a}){return r.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 LT({className:n,...a}){return r.jsx("div",{"data-slot":"card-title",className:K("leading-none font-semibold",n),...a})}function _T({className:n,...a}){return r.jsx("div",{"data-slot":"card-description",className:K("text-muted-foreground text-sm",n),...a})}function zT({className:n,...a}){return r.jsx("div",{"data-slot":"card-content",className:K("px-6",n),...a})}const IT=["agy","claude","gemini","codex","qwen","kimi","iflow","kiro","ghcp"],tO=IT.map(n=>({id:n,name:Xd(n),description:EA(n)})),UT=["provider","auth","variant","success"];function nO(n){return n==="account"?1:UT.indexOf(n)}const HT=S.forwardRef(({className:n,value:a=0,max:s=100,indicatorClassName:l,...c},f)=>{const h=Math.min(Math.max(a/s*100,0),100);return r.jsx("div",{ref:f,role:"progressbar","aria-valuemin":0,"aria-valuemax":s,"aria-valuenow":a,className:K("relative h-2 w-full overflow-hidden rounded-full bg-secondary",n),...c,children:r.jsx("div",{className:K("h-full transition-all",l||"bg-primary"),style:{width:`${h}%`}})})});HT.displayName="Progress";const BT=S.lazy(()=>ht(()=>Promise.resolve().then(()=>hf),void 0).then(n=>({default:n.CodeEditor})));function aO({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:s,onRawJsonChange:l,profileEnv:c,missingRequiredFields:f=[]}){const h=f.length>0;return r.jsx(S.Suspense,{fallback:r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx(jn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:r.jsxs("div",{className:"h-full flex flex-col",children:[!a&&s!==null&&r.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:[r.jsx(vo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&h&&r.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:[r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",r.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),r.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."})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:r.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:r.jsx(BT,{value:n,onChange:l,language:"json",minHeight:"100%"})})}),r.jsx("div",{className:"mx-6 mb-4",children:r.jsx("div",{className:"border rounded-md overflow-hidden",children:r.jsx(df,{profileEnv:c})})})]})})}var Ft={},ry;function KT(){if(ry)return Ft;ry=1;var n=Ft&&Ft.__assign||function(){return n=Object.assign||function(E){for(var A,z=1,X=arguments.length;z<X;z++){A=arguments[z];for(var W in A)Object.prototype.hasOwnProperty.call(A,W)&&(E[W]=A[W])}return E},n.apply(this,arguments)},a=Ft&&Ft.__createBinding||(Object.create?(function(E,A,z,X){X===void 0&&(X=z);var W=Object.getOwnPropertyDescriptor(A,z);(!W||("get"in W?!A.__esModule:W.writable||W.configurable))&&(W={enumerable:!0,get:function(){return A[z]}}),Object.defineProperty(E,X,W)}):(function(E,A,z,X){X===void 0&&(X=z),E[X]=A[z]})),s=Ft&&Ft.__setModuleDefault||(Object.create?(function(E,A){Object.defineProperty(E,"default",{enumerable:!0,value:A})}):function(E,A){E.default=A}),l=Ft&&Ft.__importStar||function(E){if(E&&E.__esModule)return E;var A={};if(E!=null)for(var z in E)z!=="default"&&Object.prototype.hasOwnProperty.call(E,z)&&a(A,E,z);return s(A,E),A},c=Ft&&Ft.__rest||function(E,A){var z={};for(var X in E)Object.prototype.hasOwnProperty.call(E,X)&&A.indexOf(X)<0&&(z[X]=E[X]);if(E!=null&&typeof Object.getOwnPropertySymbols=="function")for(var W=0,X=Object.getOwnPropertySymbols(E);W<X.length;W++)A.indexOf(X[W])<0&&Object.prototype.propertyIsEnumerable.call(E,X[W])&&(z[X[W]]=E[X[W]]);return z};Object.defineProperty(Ft,"__esModule",{value:!0});var f=l(Md()),h=89,p=90,m=77,y=57,C=219,b=222,v=192,N=100,w=3e3,M=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),O=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),D="npm__react-simple-code-editor__textarea",H=`
|
|
15
15
|
/**
|
|
16
16
|
* Reset the text fill color so that placeholder is visible
|
|
17
17
|
*/
|
|
@@ -44,4 +44,4 @@ Error generating stack: `+o.message+`
|
|
|
44
44
|
`).map(function(To,Do){return Do>=Lt&&Do<=Wn?pe+To:To}).join(`
|
|
45
45
|
`),selectionStart:we&&/\S/.test(we)?Oe+pe.length:Oe,selectionEnd:st+pe.length*(Wn-Lt+1)})}else{var Nt=Oe+pe.length;Pn({value:xe.substring(0,Oe)+pe+xe.substring(st),selectionStart:Nt,selectionEnd:Nt})}else if(Z.key==="Backspace"){var Zt=Oe!==st,wn=xe.substring(0,Oe);if(wn.endsWith(pe)&&!Zt){Z.preventDefault();var Nt=Oe-pe.length;Pn({value:xe.substring(0,Oe-pe.length)+xe.substring(st),selectionStart:Nt,selectionEnd:Nt})}}else if(Z.key==="Enter"){if(Oe===st){var Ao=Xt(xe,Oe).pop(),ti=Ao?.match(/^\s+/);if(ti?.[0]){Z.preventDefault();var ko=`
|
|
46
46
|
`+ti[0],Nt=Oe+ko.length;Pn({value:xe.substring(0,Oe)+ko+xe.substring(st),selectionStart:Nt,selectionEnd:Nt})}}}else if(Z.keyCode===y||Z.keyCode===C||Z.keyCode===b||Z.keyCode===v){var fn=void 0;Z.keyCode===y&&Z.shiftKey?fn=["(",")"]:Z.keyCode===C?Z.shiftKey?fn=["{","}"]:fn=["[","]"]:Z.keyCode===b?Z.shiftKey?fn=['"','"']:fn=["'","'"]:Z.keyCode===v&&!Z.shiftKey&&(fn=["`","`"]),Oe!==st&&fn&&(Z.preventDefault(),Pn({value:xe.substring(0,Oe)+fn[0]+xe.substring(Oe,st)+fn[1]+xe.substring(st),selectionStart:Oe,selectionEnd:st+2}))}else(O?Z.metaKey&&Z.keyCode===p:Z.ctrlKey&&Z.keyCode===p)&&!Z.shiftKey&&!Z.altKey?(Z.preventDefault(),Ti()):(O?Z.metaKey&&Z.keyCode===p&&Z.shiftKey:M?Z.ctrlKey&&Z.keyCode===h:Z.ctrlKey&&Z.keyCode===p&&Z.shiftKey)&&!Z.altKey?(Z.preventDefault(),wo()):Z.keyCode===m&&Z.ctrlKey&&(!O||Z.shiftKey)&&(Z.preventDefault(),Sa(function($n){return!$n}))}},Qn=function(Z){var je=Z.currentTarget,xe=je.value,Oe=je.selectionStart,st=je.selectionEnd;Vn({value:xe,selectionStart:Oe,selectionEnd:st},!0),J(xe)};return f.useEffect(function(){ei()},[ei]),f.useImperativeHandle(z,function(){return{get session(){return{history:Te.current}},set session(Z){Te.current=Z.history}}},[]),f.createElement("div",n({},Yn,{style:n(n({},I.container),St)}),f.createElement("pre",n({className:be,"aria-hidden":"true",style:n(n(n({},I.editor),I.highlight),Fn)},typeof pt=="string"?{dangerouslySetInnerHTML:{__html:pt+"<br />"}}:{children:pt})),f.createElement("textarea",{ref:function(Z){return Wt.current=Z},style:n(n(n({},I.editor),I.textarea),Fn),className:D+(ot?" ".concat(ot):""),id:It,value:Qt,onChange:Qn,onKeyDown:No,onClick:se,onKeyUp:V,onFocus:ne,onBlur:$,disabled:W,form:Q,maxLength:P,minLength:F,name:ie,placeholder:le,readOnly:Re,required:Ye,autoFocus:X,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),f.createElement("style",{dangerouslySetInnerHTML:{__html:H}}))}),I={container:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden"},textarea:{position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",WebkitTextFillColor:"transparent"},highlight:{position:"relative",pointerEvents:"none"},editor:{margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"}};return Ft.default=B,Ft}var qT=KT();const GT=xS(qT),YT=[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/_SECRET$/,/_SECRET_KEY$/,/^API_KEY$/,/^AUTH_TOKEN$/,/^SECRET$/,/_PASSWORD$/,/^PASSWORD$/,/_CREDENTIAL$/,/_PRIVATE_KEY$/];function FT(n){return YT.some(a=>a.test(n))}function VT(n){if(!n.trim())return{valid:!0};try{return JSON.parse(n),{valid:!0}}catch(a){const l=a.message,c=l.match(/position (\d+)/);if(c){const f=parseInt(c[1],10),h=n.substring(0,f).split(`
|
|
47
|
-
`);return{valid:!1,error:l,line:h.length}}return{valid:!1,error:l}}}function ix({value:n,onChange:a,language:s="json",readonly:l=!1,className:c,minHeight:f="300px"}){const{isDark:h}=yb(),[p,m]=S.useState(!1),[y,C]=S.useState(!0),b=S.useMemo(()=>s==="json"?VT(n):{valid:!0},[n,s]),v=S.useCallback(N=>r.jsx(YC,{theme:h?gg.nightOwl:gg.github,code:N,language:s,children:({tokens:w,getLineProps:M,getTokenProps:O})=>{let D=!1;return r.jsx(r.Fragment,{children:w.map((H,B)=>r.jsx("div",{...M({line:H}),className:K(b.line===B+1&&"bg-destructive/20"),children:H.map((I,E)=>{let A=!1;if(I.types.includes("property")){const X=I.content.replace(/['"]/g,"");FT(X)?D=!0:D=!1}else(I.types.includes("string")||I.types.includes("number")||I.types.includes("boolean"))&&D?(A=!0,D=!1):I.types.includes("punctuation")&&I.content!==":"&&I.content!=="["&&I.content!=="{"&&(D=!1);const z=O({token:I});return A&&y&&(z.className=K(z.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),r.jsx("span",{...z},E)})},B))})}}),[h,s,b.line,y]);return r.jsxs("div",{className:K("flex flex-col",c),children:[r.jsxs("div",{className:K("relative rounded-md border overflow-hidden","bg-muted/30",p&&"ring-2 ring-ring ring-offset-2 ring-offset-background",l&&"opacity-70 cursor-not-allowed",!b.valid&&"border-destructive"),style:{minHeight:f},children:[r.jsx(GT,{value:n,onValueChange:l?()=>{}:a,highlight:v,padding:12,disabled:l,onFocus:()=>m(!0),onBlur:()=>m(!1),textareaClassName:K("focus:outline-none font-mono text-sm",l&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:f}},h?"dark-editor":"light-editor"),r.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:r.jsx(ft,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>C(!y),title:y?"Reveal sensitive values":"Mask sensitive values",children:y?r.jsx(xr,{className:"h-3 w-3"}):r.jsx(br,{className:"h-3 w-3"})})})]}),r.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[b.valid?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Sr,{className:"w-3 h-3 text-green-500"}),"Valid ",s.toUpperCase()]}):r.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[r.jsx(Cr,{className:"w-3 h-3"}),b.error,b.line&&` (line ${b.line})`]}),l&&r.jsx("span",{className:"ml-auto text-muted-foreground",children:"(Read-only)"})]})]})}const hf=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:ix},Symbol.toStringTag,{value:"Module"})),QT={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 WT(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 ox=S.createContext(null);function $T({children:n}){const[a,s]=S.useReducer(WT,QT);return r.jsx(ox.Provider,{value:{state:a,dispatch:s},children:n})}function sx(){const n=S.useContext(ox);if(!n)throw new Error("useSettingsContext must be used within a SettingsProvider");return n}function XT(){const{dispatch:n}=sx(),a=S.useCallback(A=>n({type:"SET_WEBSEARCH_CONFIG",payload:A}),[n]),s=S.useCallback(A=>n({type:"SET_WEBSEARCH_STATUS",payload:A}),[n]),l=S.useCallback(A=>n({type:"SET_WEBSEARCH_LOADING",payload:A}),[n]),c=S.useCallback(A=>n({type:"SET_WEBSEARCH_STATUS_LOADING",payload:A}),[n]),f=S.useCallback(A=>n({type:"SET_WEBSEARCH_SAVING",payload:A}),[n]),h=S.useCallback(A=>n({type:"SET_WEBSEARCH_ERROR",payload:A}),[n]),p=S.useCallback(A=>n({type:"SET_WEBSEARCH_SUCCESS",payload:A}),[n]),m=S.useCallback(A=>n({type:"SET_GLOBALENV_CONFIG",payload:A}),[n]),y=S.useCallback(A=>n({type:"SET_GLOBALENV_LOADING",payload:A}),[n]),C=S.useCallback(A=>n({type:"SET_GLOBALENV_SAVING",payload:A}),[n]),b=S.useCallback(A=>n({type:"SET_GLOBALENV_ERROR",payload:A}),[n]),v=S.useCallback(A=>n({type:"SET_GLOBALENV_SUCCESS",payload:A}),[n]),N=S.useCallback(A=>n({type:"SET_PROXY_CONFIG",payload:A}),[n]),w=S.useCallback(A=>n({type:"SET_PROXY_LOADING",payload:A}),[n]),M=S.useCallback(A=>n({type:"SET_PROXY_SAVING",payload:A}),[n]),O=S.useCallback(A=>n({type:"SET_PROXY_ERROR",payload:A}),[n]),D=S.useCallback(A=>n({type:"SET_PROXY_SUCCESS",payload:A}),[n]),H=S.useCallback(A=>n({type:"SET_PROXY_TEST_RESULT",payload:A}),[n]),B=S.useCallback(A=>n({type:"SET_PROXY_TESTING",payload:A}),[n]),I=S.useCallback(A=>n({type:"SET_RAW_CONFIG",payload:A}),[n]),E=S.useCallback(A=>n({type:"SET_RAW_CONFIG_LOADING",payload:A}),[n]);return S.useMemo(()=>({setWebSearchConfig:a,setWebSearchStatus:s,setWebSearchLoading:l,setWebSearchStatusLoading:c,setWebSearchSaving:f,setWebSearchError:h,setWebSearchSuccess:p,setGlobalEnvConfig:m,setGlobalEnvLoading:y,setGlobalEnvSaving:C,setGlobalEnvError:b,setGlobalEnvSuccess:v,setProxyConfig:N,setProxyLoading:w,setProxySaving:M,setProxyError:O,setProxySuccess:D,setProxyTestResult:H,setProxyTesting:B,setRawConfig:I,setRawConfigLoading:E}),[a,s,l,c,f,h,p,m,y,C,b,v,N,w,M,O,D,H,B,I,E])}function ZT(){const[n,a]=vS(),s=n.get("tab")?.toLowerCase(),l=s==="globalenv"?"globalenv":s==="proxy"?"proxy":s==="auth"?"auth":s==="thinking"?"thinking":s==="backups"?"backups":"websearch",c=S.useCallback(f=>{a({tab:f},{replace:!0})},[a]);return{activeTab:l,setActiveTab:c}}function JT(){const{state:n}=sx(),a=XT(),[s,l]=S.useState(!1),c=S.useCallback(async()=>{try{a.setRawConfigLoading(!0);const h=await fetch("/api/config/raw");if(!h.ok){a.setRawConfig(null);return}const p=await h.text();a.setRawConfig(p)}catch{a.setRawConfig(null)}finally{a.setRawConfigLoading(!1)}},[a]),f=S.useCallback(async()=>{if(n.rawConfig)try{await navigator.clipboard.writeText(n.rawConfig),l(!0),setTimeout(()=>l(!1),2e3)}catch{}},[n.rawConfig]);return{rawConfig:n.rawConfig,loading:n.rawConfigLoading,copied:s,fetchRawConfig:c,copyToClipboard:f}}function cy({activeTab:n,onTabChange:a}){const{t:s}=_t(),l=[{value:"websearch",label:s("settingsTabs.web"),icon:Xy},{value:"globalenv",label:s("settingsTabs.env"),icon:Rd},{value:"thinking",label:s("settingsTabs.think"),icon:tC},{value:"proxy",label:s("settingsTabs.proxy"),icon:nC},{value:"auth",label:s("settingsTabs.auth"),icon:Od},{value:"backups",label:s("settingsTabs.backup"),icon:aC}];return r.jsx($b,{value:n,onValueChange:c=>a(c),children:r.jsx(cf,{className:"grid w-full grid-cols-6",children:l.map(({value:c,label:f,icon:h})=>r.jsxs(pr,{value:c,className:"gap-1.5 px-1 text-xs",children:[r.jsx(h,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:f})]},c))})})}function uy(){return r.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[r.jsx(Ge,{className:"h-4 w-2/3"}),r.jsx("div",{className:"p-4 rounded-lg border",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ge,{className:"h-5 w-32"}),r.jsx(Ge,{className:"h-4 w-48"})]}),r.jsx(Ge,{className:"h-6 w-10 rounded-full"})]})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ge,{className:"h-5 w-24"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ge,{className:"h-20 w-full rounded-lg"}),r.jsx(Ge,{className:"h-20 w-full rounded-lg"}),r.jsx(Ge,{className:"h-20 w-full rounded-lg"})]})]})]})}function lx(n,a=3,s=1e3){return n().catch(l=>{if(a<=0)throw l;return new Promise(c=>setTimeout(c,s)).then(()=>lx(n,a-1,s*2))})}function Co(n){return S.lazy(()=>lx(n))}const dy=Co(()=>ht(()=>import("./index-BOsbrhaa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),fy=Co(()=>ht(()=>import("./globalenv-section-C3dxxoD9.js"),__vite__mapDeps([10,1,2,3,4,5,6,7,8,9]))),hy=Co(()=>ht(()=>import("./index-xayyyR26.js"),__vite__mapDeps([11,1,2,3,4,5,6,7,8,9]))),py=Co(()=>ht(()=>import("./index-CPdceT1C.js"),__vite__mapDeps([12,1,2,3,13,4,14,15,5,6,7,8,9]))),my=Co(()=>ht(()=>import("./auth-section-nJIpOcnm.js"),__vite__mapDeps([16,1,2,4,5,6,7,8,9]))),gy=Co(()=>ht(()=>import("./backups-section-D3A6hmrU.js"),__vite__mapDeps([17,1,2,15,4,5,6,7,8,9])));class yy extends S.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){return this.state.hasError?r.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:r.jsxs("div",{className:"text-center p-6 max-w-md",children:[r.jsx(Cr,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),r.jsx("p",{className:"font-medium text-foreground mb-2",children:He.t("settings.sectionLoadFailed")}),r.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||He.t("settings.unknownError")}),r.jsxs(ft,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[r.jsx(Os,{className:"w-4 h-4"}),He.t("settings.reloadPage")]})]})}):this.props.children}}function eD(){const{t:n}=_t(),{activeTab:a,setActiveTab:s}=ZT(),{rawConfig:l,loading:c,copied:f,fetchRawConfig:h,copyToClipboard:p}=JT();S.useEffect(()=>{h()},[h]);const m=y=>{S.startTransition(()=>{s(y)})};return r.jsxs("div",{className:"h-[calc(100vh-100px)]",children:[r.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[r.jsx("div",{className:"border-b bg-background p-4",children:r.jsx(cy,{activeTab:a,onTabChange:m})}),r.jsx(yy,{children:r.jsxs(S.Suspense,{fallback:r.jsx(uy,{}),children:[a==="websearch"&&r.jsx(dy,{}),a==="globalenv"&&r.jsx(fy,{}),a==="thinking"&&r.jsx(hy,{}),a==="proxy"&&r.jsx(py,{}),a==="auth"&&r.jsx(my,{}),a==="backups"&&r.jsx(gy,{})]})})]}),r.jsxs(of,{direction:"horizontal",className:"h-full hidden md:flex",children:[r.jsx(Rs,{defaultSize:40,minSize:30,maxSize:55,children:r.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[r.jsx("div",{className:"p-5 border-b bg-background",children:r.jsx(cy,{activeTab:a,onTabChange:m})}),r.jsx(yy,{children:r.jsxs(S.Suspense,{fallback:r.jsx(uy,{}),children:[a==="websearch"&&r.jsx(dy,{}),a==="globalenv"&&r.jsx(fy,{}),a==="thinking"&&r.jsx(hy,{}),a==="proxy"&&r.jsx(py,{}),a==="auth"&&r.jsx(my,{}),a==="backups"&&r.jsx(gy,{})]})})]})}),r.jsx(sf,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:r.jsx(wr,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),r.jsx(Rs,{defaultSize:60,minSize:35,children:r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(fg,{className:"w-5 h-5 text-primary"}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold",children:"config.yaml"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ft,{variant:"outline",size:"sm",onClick:p,disabled:!l,children:f?r.jsxs(r.Fragment,{children:[r.jsx(bo,{className:"w-4 h-4 mr-1"}),n("settings.copied")]}):r.jsxs(r.Fragment,{children:[r.jsx(lr,{className:"w-4 h-4 mr-1"}),n("settings.copy")]})}),r.jsx(ft,{variant:"outline",size:"sm",onClick:h,disabled:c,children:r.jsx(Os,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto",children:c?r.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[r.jsx(Os,{className:"w-5 h-5 animate-spin mr-2"}),n("settings.loading")]}):l?r.jsx(ix,{value:l,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:r.jsxs("div",{className:"text-center",children:[r.jsx(fg,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:n("settings.configFileNotFound")}),r.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function tD(){return r.jsx($T,{children:r.jsx(eD,{})})}const nD=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:tD},Symbol.toStringTag,{value:"Module"})),iO=hS,oO=mS,sO=pS,aD=S.forwardRef(({className:n,align:a="center",sideOffset:s=4,...l},c)=>r.jsx(fS,{children:r.jsx(Gy,{ref:c,align:a,sideOffset:s,className:K("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md 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),...l})}));aD.displayName=Gy.displayName;function iD(n,a,s="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:s}).format(a).split(/\s/g).slice(2).join(" ")}const oD={},ks={};function Si(n,a){try{const l=(oD[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(a).split("GMT")[1];return l in ks?ks[l]:by(l,l.split(":"))}catch{if(n in ks)return ks[n];const s=n?.match(sD);return s?by(n,s.slice(1)):NaN}}const sD=/([+-]\d\d):?(\d\d)?/;function by(n,a){const s=+(a[0]||0),l=+(a[1]||0),c=+(a[2]||0)/60;return ks[n]=s*60+l>0?s*60+l+c:s*60-l-c}class Bn extends Date{constructor(...a){super(),a.length>1&&typeof a[a.length-1]=="string"&&(this.timeZone=a.pop()),this.internal=new Date,isNaN(Si(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)),rx(this),Dd(this)):this.setTime(Date.now())}static tz(a,...s){return s.length?new Bn(...s,a):new Bn(Date.now(),a)}withTimeZone(a){return new Bn(+this,a)}getTimezoneOffset(){const a=-Si(this.timeZone,this);return a>0?Math.floor(a):Math.ceil(a)}setTime(a){return Date.prototype.setTime.apply(this,arguments),Dd(this),+this}[Symbol.for("constructDateFrom")](a){return new Bn(+new Date(a),this.timeZone)}}const xy=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!xy.test(n))return;const a=n.replace(xy,"$1UTC");Bn.prototype[a]&&(n.startsWith("get")?Bn.prototype[n]=function(){return this.internal[a]()}:(Bn.prototype[n]=function(){return Date.prototype[a].apply(this.internal,arguments),lD(this),+this},Bn.prototype[a]=function(){return Date.prototype[a].apply(this,arguments),Dd(this),+this}))});function Dd(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-Si(n.timeZone,n)*60))}function lD(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()),rx(n)}function rx(n){const a=Si(n.timeZone,n),s=a>0?Math.floor(a):Math.ceil(a),l=new Date(+n);l.setUTCHours(l.getUTCHours()-1);const c=-new Date(+n).getTimezoneOffset(),f=-new Date(+l).getTimezoneOffset(),h=c-f,p=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();h&&p&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+h);const m=c-s;m&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+m);const y=new Date(+n);y.setUTCSeconds(0);const C=c>0?y.getSeconds():(y.getSeconds()-60)%60,b=Math.round(-(Si(n.timeZone,n)*60))%60;(b||C)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+b+C));const v=Si(n.timeZone,n),N=v>0?Math.floor(v):Math.ceil(v),M=-new Date(+n).getTimezoneOffset()-N,O=N!==s,D=M-m;if(O&&D){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+D);const H=Si(n.timeZone,n),B=H>0?Math.floor(H):Math.ceil(H),I=N-B;I&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+I),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+I))}}class ya extends Bn{static tz(a,...s){return s.length?new ya(...s,a):new ya(Date.now(),a)}toISOString(){const[a,s,l]=this.tzComponents(),c=`${a}${s}:${l}`;return this.internal.toISOString().slice(0,-1)+c}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[a,s,l,c]=this.internal.toUTCString().split(" ");return`${a?.slice(0,-1)} ${l} ${s} ${c}`}toTimeString(){const a=this.internal.toUTCString().split(" ")[4],[s,l,c]=this.tzComponents();return`${a} GMT${s}${l}${c} (${iD(this.timeZone,this)})`}toLocaleString(a,s){return Date.prototype.toLocaleString.call(this,a,{...s,timeZone:s?.timeZone||this.timeZone})}toLocaleDateString(a,s){return Date.prototype.toLocaleDateString.call(this,a,{...s,timeZone:s?.timeZone||this.timeZone})}toLocaleTimeString(a,s){return Date.prototype.toLocaleTimeString.call(this,a,{...s,timeZone:s?.timeZone||this.timeZone})}tzComponents(){const a=this.getTimezoneOffset(),s=a>0?"-":"+",l=String(Math.floor(Math.abs(a)/60)).padStart(2,"0"),c=String(Math.abs(a)%60).padStart(2,"0");return[s,l,c]}withTimeZone(a){return new ya(+this,a)}[Symbol.for("constructDateFrom")](a){return new ya(+new Date(a),this.timeZone)}}const vy=5,rD=4;function cD(n,a){const s=a.startOfMonth(n),l=s.getDay()>0?s.getDay():7,c=a.addDays(n,-l+1),f=a.addDays(c,vy*7-1);return a.getMonth(n)===a.getMonth(f)?vy:rD}function cx(n,a){const s=a.startOfMonth(n),l=s.getDay();return l===1?s:l===0?a.addDays(s,-6):a.addDays(s,-1*(l-1))}function uD(n,a){const s=cx(n,a),l=cD(n,a);return a.addDays(s,l*7-1)}const ux={...bs,labels:{labelDayButton:(n,a,s,l)=>{let c;l&&typeof l.format=="function"?c=l.format.bind(l):c=(h,p)=>Cs(h,p,{locale:bs,...s});let f=c(n,"PPPP");return a.today&&(f=`Today, ${f}`),a.selected&&(f=`${f}, selected`),f},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,s)=>{let l;return s&&typeof s.format=="function"?l=s.format.bind(s):l=(c,f)=>Cs(c,f,{locale:bs,...a}),l(n,"LLLL yyyy")},labelGridcell:(n,a,s,l)=>{let c;l&&typeof l.format=="function"?c=l.format.bind(l):c=(h,p)=>Cs(h,p,{locale:bs,...s});let f=c(n,"PPPP");return a?.today&&(f=`Today, ${f}`),f},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,a,s)=>{let l;return s&&typeof s.format=="function"?l=s.format.bind(s):l=(c,f)=>Cs(c,f,{locale:bs,...a}),l(n,"cccc")}}};class dn{constructor(a,s){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ya.tz(this.options.timeZone):new this.Date,this.newDate=(l,c,f)=>this.overrides?.newDate?this.overrides.newDate(l,c,f):this.options.timeZone?new ya(l,c,f,this.options.timeZone):new Date(l,c,f),this.addDays=(l,c)=>this.overrides?.addDays?this.overrides.addDays(l,c):rC(l,c),this.addMonths=(l,c)=>this.overrides?.addMonths?this.overrides.addMonths(l,c):cC(l,c),this.addWeeks=(l,c)=>this.overrides?.addWeeks?this.overrides.addWeeks(l,c):uC(l,c),this.addYears=(l,c)=>this.overrides?.addYears?this.overrides.addYears(l,c):dC(l,c),this.differenceInCalendarDays=(l,c)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(l,c):fC(l,c),this.differenceInCalendarMonths=(l,c)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(l,c):hC(l,c),this.eachMonthOfInterval=l=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(l):pC(l),this.eachYearOfInterval=l=>{const c=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(l):mC(l),f=new Set(c.map(p=>this.getYear(p)));if(f.size===c.length)return c;const h=[];return f.forEach(p=>{h.push(new Date(p,0,1))}),h},this.endOfBroadcastWeek=l=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(l):uD(l,this),this.endOfISOWeek=l=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(l):gC(l),this.endOfMonth=l=>this.overrides?.endOfMonth?this.overrides.endOfMonth(l):yC(l),this.endOfWeek=(l,c)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(l,c):bC(l,this.options),this.endOfYear=l=>this.overrides?.endOfYear?this.overrides.endOfYear(l):xC(l),this.format=(l,c,f)=>{const h=this.overrides?.format?this.overrides.format(l,c,this.options):Cs(l,c,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(h):h},this.getISOWeek=l=>this.overrides?.getISOWeek?this.overrides.getISOWeek(l):vC(l),this.getMonth=(l,c)=>this.overrides?.getMonth?this.overrides.getMonth(l,this.options):SC(l,this.options),this.getYear=(l,c)=>this.overrides?.getYear?this.overrides.getYear(l,this.options):CC(l,this.options),this.getWeek=(l,c)=>this.overrides?.getWeek?this.overrides.getWeek(l,this.options):wC(l,this.options),this.isAfter=(l,c)=>this.overrides?.isAfter?this.overrides.isAfter(l,c):NC(l,c),this.isBefore=(l,c)=>this.overrides?.isBefore?this.overrides.isBefore(l,c):AC(l,c),this.isDate=l=>this.overrides?.isDate?this.overrides.isDate(l):kC(l),this.isSameDay=(l,c)=>this.overrides?.isSameDay?this.overrides.isSameDay(l,c):TC(l,c),this.isSameMonth=(l,c)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(l,c):DC(l,c),this.isSameYear=(l,c)=>this.overrides?.isSameYear?this.overrides.isSameYear(l,c):MC(l,c),this.max=l=>this.overrides?.max?this.overrides.max(l):jC(l),this.min=l=>this.overrides?.min?this.overrides.min(l):OC(l),this.setMonth=(l,c)=>this.overrides?.setMonth?this.overrides.setMonth(l,c):EC(l,c),this.setYear=(l,c)=>this.overrides?.setYear?this.overrides.setYear(l,c):PC(l,c),this.startOfBroadcastWeek=(l,c)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(l,this):cx(l,this),this.startOfDay=l=>this.overrides?.startOfDay?this.overrides.startOfDay(l):RC(l),this.startOfISOWeek=l=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(l):LC(l),this.startOfMonth=l=>this.overrides?.startOfMonth?this.overrides.startOfMonth(l):_C(l),this.startOfWeek=(l,c)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(l,this.options):zC(l,this.options),this.startOfYear=l=>this.overrides?.startOfYear?this.overrides.startOfYear(l):IC(l),this.options={locale:ux,...a},this.overrides=s}getDigitMap(){const{numerals:a="latn"}=this.options,s=new Intl.NumberFormat("en-US",{numberingSystem:a}),l={};for(let c=0;c<10;c++)l[c.toString()]=s.format(c);return l}replaceDigits(a){const s=this.getDigitMap();return a.replace(/\d/g,l=>s[l]||l)}formatNumber(a){return this.replaceDigits(a.toString())}getMonthYearOrder(){const a=this.options.locale?.code;return a&&dn.yearFirstLocales.has(a)?"year-first":"month-first"}formatMonthYear(a){const{locale:s,timeZone:l,numerals:c}=this.options,f=s?.code;if(f&&dn.yearFirstLocales.has(f))try{return new Intl.DateTimeFormat(f,{month:"long",year:"numeric",timeZone:l,numberingSystem:c}).format(a)}catch{}const h=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(a,h)}}dn.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 Gn=new dn;class dx{constructor(a,s,l=Gn){this.date=a,this.displayMonth=s,this.outside=!!(s&&!l.isSameMonth(a,s)),this.dateLib=l,this.isoDate=l.format(a,"yyyy-MM-dd"),this.displayMonthId=l.format(s,"yyyy-MM"),this.dateMonthId=l.format(a,"yyyy-MM")}isEqualTo(a){return this.dateLib.isSameDay(a.date,this.date)&&this.dateLib.isSameMonth(a.displayMonth,this.displayMonth)}}class dD{constructor(a,s){this.date=a,this.weeks=s}}class fD{constructor(a,s){this.days=s,this.weekNumber=a}}function hD(n){return oe.createElement("button",{...n})}function pD(n){return oe.createElement("span",{...n})}function mD(n){const{size:a=24,orientation:s="left",className:l}=n;return oe.createElement("svg",{className:l,width:a,height:a,viewBox:"0 0 24 24"},s==="up"&&oe.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),s==="down"&&oe.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),s==="left"&&oe.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),s==="right"&&oe.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function gD(n){const{day:a,modifiers:s,...l}=n;return oe.createElement("td",{...l})}function yD(n){const{day:a,modifiers:s,...l}=n,c=oe.useRef(null);return oe.useEffect(()=>{s.focused&&c.current?.focus()},[s.focused]),oe.createElement("button",{ref:c,...l})}var me;(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"})(me||(me={}));var rt;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(rt||(rt={}));var Dn;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(Dn||(Dn={}));var un;(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"})(un||(un={}));function bD(n){const{options:a,className:s,components:l,classNames:c,...f}=n,h=[c[me.Dropdown],s].join(" "),p=a?.find(({value:m})=>m===f.value);return oe.createElement("span",{"data-disabled":f.disabled,className:c[me.DropdownRoot]},oe.createElement(l.Select,{className:h,...f},a?.map(({value:m,label:y,disabled:C})=>oe.createElement(l.Option,{key:m,value:m,disabled:C},y))),oe.createElement("span",{className:c[me.CaptionLabel],"aria-hidden":!0},p?.label,oe.createElement(l.Chevron,{orientation:"down",size:18,className:c[me.Chevron]})))}function xD(n){return oe.createElement("div",{...n})}function vD(n){return oe.createElement("div",{...n})}function SD(n){const{calendarMonth:a,displayIndex:s,...l}=n;return oe.createElement("div",{...l},n.children)}function CD(n){const{calendarMonth:a,displayIndex:s,...l}=n;return oe.createElement("div",{...l})}function wD(n){return oe.createElement("table",{...n})}function ND(n){return oe.createElement("div",{...n})}const fx=S.createContext(void 0);function Is(){const n=S.useContext(fx);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function AD(n){const{components:a}=Is();return oe.createElement(a.Dropdown,{...n})}function kD(n){const{onPreviousClick:a,onNextClick:s,previousMonth:l,nextMonth:c,...f}=n,{components:h,classNames:p,labels:{labelPrevious:m,labelNext:y}}=Is(),C=S.useCallback(v=>{c&&s?.(v)},[c,s]),b=S.useCallback(v=>{l&&a?.(v)},[l,a]);return oe.createElement("nav",{...f},oe.createElement(h.PreviousMonthButton,{type:"button",className:p[me.PreviousMonthButton],tabIndex:l?void 0:-1,"aria-disabled":l?void 0:!0,"aria-label":m(l),onClick:b},oe.createElement(h.Chevron,{disabled:l?void 0:!0,className:p[me.Chevron],orientation:"left"})),oe.createElement(h.NextMonthButton,{type:"button",className:p[me.NextMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":y(c),onClick:C},oe.createElement(h.Chevron,{disabled:c?void 0:!0,orientation:"right",className:p[me.Chevron]})))}function TD(n){const{components:a}=Is();return oe.createElement(a.Button,{...n})}function DD(n){return oe.createElement("option",{...n})}function MD(n){const{components:a}=Is();return oe.createElement(a.Button,{...n})}function jD(n){const{rootRef:a,...s}=n;return oe.createElement("div",{...s,ref:a})}function OD(n){return oe.createElement("select",{...n})}function ED(n){const{week:a,...s}=n;return oe.createElement("tr",{...s})}function PD(n){return oe.createElement("th",{...n})}function RD(n){return oe.createElement("thead",{"aria-hidden":!0},oe.createElement("tr",{...n}))}function LD(n){const{week:a,...s}=n;return oe.createElement("th",{...s})}function _D(n){return oe.createElement("th",{...n})}function zD(n){return oe.createElement("tbody",{...n})}function ID(n){const{components:a}=Is();return oe.createElement(a.Dropdown,{...n})}const UD=Object.freeze(Object.defineProperty({__proto__:null,Button:hD,CaptionLabel:pD,Chevron:mD,Day:gD,DayButton:yD,Dropdown:bD,DropdownNav:xD,Footer:vD,Month:SD,MonthCaption:CD,MonthGrid:wD,Months:ND,MonthsDropdown:AD,Nav:kD,NextMonthButton:TD,Option:DD,PreviousMonthButton:MD,Root:jD,Select:OD,Week:ED,WeekNumber:LD,WeekNumberHeader:_D,Weekday:PD,Weekdays:RD,Weeks:zD,YearsDropdown:ID},Symbol.toStringTag,{value:"Module"}));function ba(n,a,s=!1,l=Gn){let{from:c,to:f}=n;const{differenceInCalendarDays:h,isSameDay:p}=l;return c&&f?(h(f,c)<0&&([c,f]=[f,c]),h(a,c)>=(s?1:0)&&h(f,a)>=(s?1:0)):!s&&f?p(f,a):!s&&c?p(c,a):!1}function pf(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function _r(n){return!!(n&&typeof n=="object"&&"from"in n)}function mf(n){return!!(n&&typeof n=="object"&&"after"in n)}function gf(n){return!!(n&&typeof n=="object"&&"before"in n)}function hx(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function px(n,a){return Array.isArray(n)&&n.every(a.isDate)}function xa(n,a,s=Gn){const l=Array.isArray(a)?a:[a],{isSameDay:c,differenceInCalendarDays:f,isAfter:h}=s;return l.some(p=>{if(typeof p=="boolean")return p;if(s.isDate(p))return c(n,p);if(px(p,s))return p.some(m=>c(n,m));if(_r(p))return ba(p,n,!1,s);if(hx(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(n.getDay()):p.dayOfWeek===n.getDay();if(pf(p)){const m=f(p.before,n),y=f(p.after,n),C=m>0,b=y<0;return h(p.before,p.after)?b&&C:C||b}return mf(p)?f(n,p.after)>0:gf(p)?f(p.before,n)>0:typeof p=="function"?p(n):!1})}function HD(n,a,s,l,c){const{disabled:f,hidden:h,modifiers:p,showOutsideDays:m,broadcastCalendar:y,today:C=c.today()}=a,{isSameDay:b,isSameMonth:v,startOfMonth:N,isBefore:w,endOfMonth:M,isAfter:O}=c,D=s&&N(s),H=l&&M(l),B={[rt.focused]:[],[rt.outside]:[],[rt.disabled]:[],[rt.hidden]:[],[rt.today]:[]},I={};for(const E of n){const{date:A,displayMonth:z}=E,X=!!(z&&!v(A,z)),W=!!(D&&w(A,D)),Q=!!(H&&O(A,H)),ae=!!(f&&xa(A,f,c)),ee=!!(h&&xa(A,h,c))||W||Q||!y&&!m&&X||y&&m===!1&&X,ye=b(A,C);X&&B.outside.push(E),ae&&B.disabled.push(E),ee&&B.hidden.push(E),ye&&B.today.push(E),p&&Object.keys(p).forEach(fe=>{const Ce=p?.[fe];Ce&&xa(A,Ce,c)&&(I[fe]?I[fe].push(E):I[fe]=[E])})}return E=>{const A={[rt.focused]:!1,[rt.disabled]:!1,[rt.hidden]:!1,[rt.outside]:!1,[rt.today]:!1},z={};for(const X in B){const W=B[X];A[X]=W.some(Q=>Q===E)}for(const X in I)z[X]=I[X].some(W=>W===E);return{...A,...z}}}function BD(n,a,s={}){return Object.entries(n).filter(([,c])=>c===!0).reduce((c,[f])=>(s[f]?c.push(s[f]):a[rt[f]]?c.push(a[rt[f]]):a[Dn[f]]&&c.push(a[Dn[f]]),c),[a[me.Day]])}function KD(n){return{...UD,...n}}function qD(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(([s,l])=>{s.startsWith("data-")&&(a[s]=l)}),a}function GD(){const n={};for(const a in me)n[me[a]]=`rdp-${me[a]}`;for(const a in rt)n[rt[a]]=`rdp-${rt[a]}`;for(const a in Dn)n[Dn[a]]=`rdp-${Dn[a]}`;for(const a in un)n[un[a]]=`rdp-${un[a]}`;return n}function mx(n,a,s){return(s??new dn(a)).formatMonthYear(n)}const YD=mx;function FD(n,a,s){return(s??new dn(a)).format(n,"d")}function VD(n,a=Gn){return a.format(n,"LLLL")}function QD(n,a,s){return(s??new dn(a)).format(n,"cccccc")}function WD(n,a=Gn){return n<10?a.formatNumber(`0${n.toLocaleString()}`):a.formatNumber(`${n.toLocaleString()}`)}function $D(){return""}function gx(n,a=Gn){return a.format(n,"yyyy")}const XD=gx,ZD=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:mx,formatDay:FD,formatMonthCaption:YD,formatMonthDropdown:VD,formatWeekNumber:WD,formatWeekNumberHeader:$D,formatWeekdayName:QD,formatYearCaption:XD,formatYearDropdown:gx},Symbol.toStringTag,{value:"Module"}));function JD(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...ZD,...n}}function yf(n,a,s,l){let c=(l??new dn(s)).format(n,"PPPP");return a.today&&(c=`Today, ${c}`),a.selected&&(c=`${c}, selected`),c}const eM=yf;function bf(n,a,s){return(s??new dn(a)).formatMonthYear(n)}const tM=bf;function yx(n,a,s,l){let c=(l??new dn(s)).format(n,"PPPP");return a?.today&&(c=`Today, ${c}`),c}function bx(n){return"Choose the Month"}function xx(){return""}const nM="Go to the Next Month";function vx(n,a){return nM}function Sx(n){return"Go to the Previous Month"}function Cx(n,a,s){return(s??new dn(a)).format(n,"cccc")}function wx(n,a){return`Week ${n}`}function Nx(n){return"Week Number"}function Ax(n){return"Choose the Year"}const aM=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:tM,labelDay:eM,labelDayButton:yf,labelGrid:bf,labelGridcell:yx,labelMonthDropdown:bx,labelNav:xx,labelNext:vx,labelPrevious:Sx,labelWeekNumber:wx,labelWeekNumberHeader:Nx,labelWeekday:Cx,labelYearDropdown:Ax},Symbol.toStringTag,{value:"Module"})),Tn=(n,a,s)=>a||(s?typeof s=="function"?s:(...l)=>s:n);function iM(n,a){const s=a.locale?.labels??{};return{...aM,...n??{},labelDayButton:Tn(yf,n?.labelDayButton,s.labelDayButton),labelMonthDropdown:Tn(bx,n?.labelMonthDropdown,s.labelMonthDropdown),labelNext:Tn(vx,n?.labelNext,s.labelNext),labelPrevious:Tn(Sx,n?.labelPrevious,s.labelPrevious),labelWeekNumber:Tn(wx,n?.labelWeekNumber,s.labelWeekNumber),labelYearDropdown:Tn(Ax,n?.labelYearDropdown,s.labelYearDropdown),labelGrid:Tn(bf,n?.labelGrid,s.labelGrid),labelGridcell:Tn(yx,n?.labelGridcell,s.labelGridcell),labelNav:Tn(xx,n?.labelNav,s.labelNav),labelWeekNumberHeader:Tn(Nx,n?.labelWeekNumberHeader,s.labelWeekNumberHeader),labelWeekday:Tn(Cx,n?.labelWeekday,s.labelWeekday)}}function oM(n,a,s,l,c){const{startOfMonth:f,startOfYear:h,endOfYear:p,eachMonthOfInterval:m,getMonth:y}=c;return m({start:h(n),end:p(n)}).map(v=>{const N=l.formatMonthDropdown(v,c),w=y(v),M=a&&v<f(a)||s&&v>f(s)||!1;return{value:w,label:N,disabled:M}})}function sM(n,a={},s={}){let l={...a?.[me.Day]};return Object.entries(n).filter(([,c])=>c===!0).forEach(([c])=>{l={...l,...s?.[c]}}),l}function lM(n,a,s,l){const c=l??n.today(),f=s?n.startOfBroadcastWeek(c,n):a?n.startOfISOWeek(c):n.startOfWeek(c),h=[];for(let p=0;p<7;p++){const m=n.addDays(f,p);h.push(m)}return h}function rM(n,a,s,l,c=!1){if(!n||!a)return;const{startOfYear:f,endOfYear:h,eachYearOfInterval:p,getYear:m}=l,y=f(n),C=h(a),b=p({start:y,end:C});return c&&b.reverse(),b.map(v=>{const N=s.formatYearDropdown(v,l);return{value:m(v),label:N,disabled:!1}})}const Us=n=>n instanceof HTMLElement?n:null,dd=n=>[...n.querySelectorAll("[data-animated-month]")??[]],cM=n=>Us(n.querySelector("[data-animated-month]")),fd=n=>Us(n.querySelector("[data-animated-caption]")),hd=n=>Us(n.querySelector("[data-animated-weeks]")),uM=n=>Us(n.querySelector("[data-animated-nav]")),dM=n=>Us(n.querySelector("[data-animated-weekdays]"));function fM(n,a,{classNames:s,months:l,focused:c,dateLib:f}){const h=S.useRef(null),p=S.useRef(l),m=S.useRef(!1);S.useLayoutEffect(()=>{const y=p.current;if(p.current=l,!a||!n.current||!(n.current instanceof HTMLElement)||l.length===0||y.length===0||l.length!==y.length)return;const C=f.isSameMonth(l[0].date,y[0].date),b=f.isAfter(l[0].date,y[0].date),v=b?s[un.caption_after_enter]:s[un.caption_before_enter],N=b?s[un.weeks_after_enter]:s[un.weeks_before_enter],w=h.current,M=n.current.cloneNode(!0);if(M instanceof HTMLElement?(dd(M).forEach(B=>{if(!(B instanceof HTMLElement))return;const I=cM(B);I&&B.contains(I)&&B.removeChild(I);const E=fd(B);E&&E.classList.remove(v);const A=hd(B);A&&A.classList.remove(N)}),h.current=M):h.current=null,m.current||C||c)return;const O=w instanceof HTMLElement?dd(w):[],D=dd(n.current);if(D?.every(H=>H instanceof HTMLElement)&&O&&O.every(H=>H instanceof HTMLElement)){m.current=!0,n.current.style.isolation="isolate";const H=uM(n.current);H&&(H.style.zIndex="1"),D.forEach((B,I)=>{const E=O[I];if(!E)return;B.style.position="relative",B.style.overflow="hidden";const A=fd(B);A&&A.classList.add(v);const z=hd(B);z&&z.classList.add(N);const X=()=>{m.current=!1,n.current&&(n.current.style.isolation=""),H&&(H.style.zIndex=""),A&&A.classList.remove(v),z&&z.classList.remove(N),B.style.position="",B.style.overflow="",B.contains(E)&&B.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const W=dM(E);W&&(W.style.opacity="0");const Q=fd(E);Q&&(Q.classList.add(b?s[un.caption_before_exit]:s[un.caption_after_exit]),Q.addEventListener("animationend",X));const ae=hd(E);ae&&ae.classList.add(b?s[un.weeks_before_exit]:s[un.weeks_after_exit]),B.insertBefore(E,B.firstChild)})}})}function hM(n,a,s,l){const c=n[0],f=n[n.length-1],{ISOWeek:h,fixedWeeks:p,broadcastCalendar:m}=s??{},{addDays:y,differenceInCalendarDays:C,differenceInCalendarMonths:b,endOfBroadcastWeek:v,endOfISOWeek:N,endOfMonth:w,endOfWeek:M,isAfter:O,startOfBroadcastWeek:D,startOfISOWeek:H,startOfWeek:B}=l,I=m?D(c,l):h?H(c):B(c),E=m?v(f):h?N(w(f)):M(w(f)),A=a&&(m?v(a):h?N(a):M(a)),z=A&&O(E,A)?A:E,X=C(z,I),W=b(f,c)+1,Q=[];for(let ye=0;ye<=X;ye++){const fe=y(I,ye);Q.push(fe)}const ee=(m?35:42)*W;if(p&&Q.length<ee){const ye=ee-Q.length;for(let fe=0;fe<ye;fe++){const Ce=y(Q[Q.length-1],1);Q.push(Ce)}}return Q}function pM(n){const a=[];return n.reduce((s,l)=>{const c=l.weeks.reduce((f,h)=>f.concat(h.days.slice()),a.slice());return s.concat(c.slice())},a.slice())}function mM(n,a,s,l){const{numberOfMonths:c=1}=s,f=[];for(let h=0;h<c;h++){const p=l.addMonths(n,h);if(a&&p>a)break;f.push(p)}return f}function Sy(n,a,s,l){const{month:c,defaultMonth:f,today:h=l.today(),numberOfMonths:p=1}=n;let m=c||f||h;const{differenceInCalendarMonths:y,addMonths:C,startOfMonth:b}=l;if(s&&y(s,m)<p-1){const v=-1*(p-1);m=C(s,v)}return a&&y(m,a)<0&&(m=a),b(m)}function gM(n,a,s,l){const{addDays:c,endOfBroadcastWeek:f,endOfISOWeek:h,endOfMonth:p,endOfWeek:m,getISOWeek:y,getWeek:C,startOfBroadcastWeek:b,startOfISOWeek:v,startOfWeek:N}=l,w=n.reduce((M,O)=>{const D=s.broadcastCalendar?b(O,l):s.ISOWeek?v(O):N(O),H=s.broadcastCalendar?f(O):s.ISOWeek?h(p(O)):m(p(O)),B=a.filter(z=>z>=D&&z<=H),I=s.broadcastCalendar?35:42;if(s.fixedWeeks&&B.length<I){const z=a.filter(X=>{const W=I-B.length;return X>H&&X<=c(H,W)});B.push(...z)}const E=B.reduce((z,X)=>{const W=s.ISOWeek?y(X):C(X),Q=z.find(ee=>ee.weekNumber===W),ae=new dx(X,O,l);return Q?Q.days.push(ae):z.push(new fD(W,[ae])),z},[]),A=new dD(O,E);return M.push(A),M},[]);return s.reverseMonths?w.reverse():w}function yM(n,a){let{startMonth:s,endMonth:l}=n;const{startOfYear:c,startOfDay:f,startOfMonth:h,endOfMonth:p,addYears:m,endOfYear:y,newDate:C,today:b}=a,{fromYear:v,toYear:N,fromMonth:w,toMonth:M}=n;!s&&w&&(s=w),!s&&v&&(s=a.newDate(v,0,1)),!l&&M&&(l=M),!l&&N&&(l=C(N,11,31));const O=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return s?s=h(s):v?s=C(v,0,1):!s&&O&&(s=c(m(n.today??b(),-100))),l?l=p(l):N?l=C(N,11,31):!l&&O&&(l=y(n.today??b())),[s&&f(s),l&&f(l)]}function bM(n,a,s,l){if(s.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:f=1}=s,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:m}=l,y=c?f:1,C=h(n);if(!a)return p(C,y);if(!(m(a,n)<f))return p(C,y)}function xM(n,a,s,l){if(s.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:f}=s,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:m}=l,y=c?f??1:1,C=h(n);if(!a)return p(C,-y);if(!(m(C,a)<=0))return p(C,-y)}function vM(n){const a=[];return n.reduce((s,l)=>s.concat(l.weeks.slice()),a.slice())}function zr(n,a){const[s,l]=S.useState(n);return[a===void 0?s:a,l]}function SM(n,a){const[s,l]=yM(n,a),{startOfMonth:c,endOfMonth:f}=a,h=Sy(n,s,l,a),[p,m]=zr(h,n.month?h:void 0);S.useEffect(()=>{const I=Sy(n,s,l,a);m(I)},[n.timeZone]);const{months:y,weeks:C,days:b,previousMonth:v,nextMonth:N}=S.useMemo(()=>{const I=mM(p,l,{numberOfMonths:n.numberOfMonths},a),E=hM(I,n.endMonth?f(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},a),A=gM(I,E,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},a),z=vM(A),X=pM(A),W=xM(p,s,n,a),Q=bM(p,l,n,a);return{months:A,weeks:z,days:X,previousMonth:W,nextMonth:Q}},[a,p.getTime(),l?.getTime(),s?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:w,onMonthChange:M}=n,O=I=>C.some(E=>E.days.some(A=>A.isEqualTo(I))),D=I=>{if(w)return;let E=c(I);s&&E<c(s)&&(E=c(s)),l&&E>c(l)&&(E=c(l)),m(E),M?.(E)};return{months:y,weeks:C,days:b,navStart:s,navEnd:l,previousMonth:v,nextMonth:N,goToMonth:D,goToDay:I=>{O(I)||D(I.date)}}}var Un;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(Un||(Un={}));function Cy(n){return!n[rt.disabled]&&!n[rt.hidden]&&!n[rt.outside]}function CM(n,a,s,l){let c,f=-1;for(const h of n){const p=a(h);Cy(p)&&(p[rt.focused]&&f<Un.FocusedModifier?(c=h,f=Un.FocusedModifier):l?.isEqualTo(h)&&f<Un.LastFocused?(c=h,f=Un.LastFocused):s(h.date)&&f<Un.Selected?(c=h,f=Un.Selected):p[rt.today]&&f<Un.Today&&(c=h,f=Un.Today))}return c||(c=n.find(h=>Cy(a(h)))),c}function wM(n,a,s,l,c,f,h){const{ISOWeek:p,broadcastCalendar:m}=f,{addDays:y,addMonths:C,addWeeks:b,addYears:v,endOfBroadcastWeek:N,endOfISOWeek:w,endOfWeek:M,max:O,min:D,startOfBroadcastWeek:H,startOfISOWeek:B,startOfWeek:I}=h;let A={day:y,week:b,month:C,year:v,startOfWeek:z=>m?H(z,h):p?B(z):I(z),endOfWeek:z=>m?N(z):p?w(z):M(z)}[n](s,a==="after"?1:-1);return a==="before"&&l?A=O([l,A]):a==="after"&&c&&(A=D([c,A])),A}function kx(n,a,s,l,c,f,h,p=0){if(p>365)return;const m=wM(n,a,s.date,l,c,f,h),y=!!(f.disabled&&xa(m,f.disabled,h)),C=!!(f.hidden&&xa(m,f.hidden,h)),b=m,v=new dx(m,b,h);return!y&&!C?v:kx(n,a,v,l,c,f,h,p+1)}function NM(n,a,s,l,c){const{autoFocus:f}=n,[h,p]=S.useState(),m=CM(a.days,s,l||(()=>!1),h),[y,C]=S.useState(f?m:void 0);return{isFocusTarget:M=>!!m?.isEqualTo(M),setFocused:C,focused:y,blur:()=>{p(y),C(void 0)},moveFocus:(M,O)=>{if(!y)return;const D=kx(M,O,y,a.navStart,a.navEnd,n,c);D&&(n.disableNavigation&&!a.days.some(B=>B.isEqualTo(D))||(a.goToDay(D),C(D)))}}}function AM(n,a){const{selected:s,required:l,onSelect:c}=n,[f,h]=zr(s,c?s:void 0),p=c?s:f,{isSameDay:m}=a,y=N=>p?.some(w=>m(w,N))??!1,{min:C,max:b}=n;return{selected:p,select:(N,w,M)=>{let O=[...p??[]];if(y(N)){if(p?.length===C||l&&p?.length===1)return;O=p?.filter(D=>!m(D,N))}else p?.length===b?O=[N]:O=[...O,N];return c||h(O),c?.(O,N,w,M),O},isSelected:y}}function kM(n,a,s=0,l=0,c=!1,f=Gn){const{from:h,to:p}=a||{},{isSameDay:m,isAfter:y,isBefore:C}=f;let b;if(!h&&!p)b={from:n,to:s>0?void 0:n};else if(h&&!p)m(h,n)?s===0?b={from:h,to:n}:c?b={from:h,to:void 0}:b=void 0:C(n,h)?b={from:n,to:h}:b={from:h,to:n};else if(h&&p)if(m(h,n)&&m(p,n))c?b={from:h,to:p}:b=void 0;else if(m(h,n))b={from:h,to:s>0?void 0:n};else if(m(p,n))b={from:n,to:s>0?void 0:n};else if(C(n,h))b={from:n,to:p};else if(y(n,h))b={from:h,to:n};else if(y(n,p))b={from:h,to:n};else throw new Error("Invalid range");if(b?.from&&b?.to){const v=f.differenceInCalendarDays(b.to,b.from);l>0&&v>l?b={from:n,to:void 0}:s>1&&v<s&&(b={from:n,to:void 0})}return b}function TM(n,a,s=Gn){const l=Array.isArray(a)?a:[a];let c=n.from;const f=s.differenceInCalendarDays(n.to,n.from),h=Math.min(f,6);for(let p=0;p<=h;p++){if(l.includes(c.getDay()))return!0;c=s.addDays(c,1)}return!1}function wy(n,a,s=Gn){return ba(n,a.from,!1,s)||ba(n,a.to,!1,s)||ba(a,n.from,!1,s)||ba(a,n.to,!1,s)}function DM(n,a,s=Gn){const l=Array.isArray(a)?a:[a];if(l.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:s.isDate(p)?ba(n,p,!1,s):px(p,s)?p.some(m=>ba(n,m,!1,s)):_r(p)?p.from&&p.to?wy(n,{from:p.from,to:p.to},s):!1:hx(p)?TM(n,p.dayOfWeek,s):pf(p)?s.isAfter(p.before,p.after)?wy(n,{from:s.addDays(p.after,1),to:s.addDays(p.before,-1)},s):xa(n.from,p,s)||xa(n.to,p,s):mf(p)||gf(p)?xa(n.from,p,s)||xa(n.to,p,s):!1))return!0;const h=l.filter(p=>typeof p=="function");if(h.length){let p=n.from;const m=s.differenceInCalendarDays(n.to,n.from);for(let y=0;y<=m;y++){if(h.some(C=>C(p)))return!0;p=s.addDays(p,1)}}return!1}function MM(n,a){const{disabled:s,excludeDisabled:l,selected:c,required:f,onSelect:h}=n,[p,m]=zr(c,h?c:void 0),y=h?c:p;return{selected:y,select:(v,N,w)=>{const{min:M,max:O}=n,D=v?kM(v,y,M,O,f,a):void 0;return l&&s&&D?.from&&D.to&&DM({from:D.from,to:D.to},s,a)&&(D.from=v,D.to=void 0),h||m(D),h?.(D,v,N,w),D},isSelected:v=>y&&ba(y,v,!1,a)}}function jM(n,a){const{selected:s,required:l,onSelect:c}=n,[f,h]=zr(s,c?s:void 0),p=c?s:f,{isSameDay:m}=a;return{selected:p,select:(b,v,N)=>{let w=b;return!l&&p&&p&&m(b,p)&&(w=void 0),c||h(w),c?.(w,b,v,N),w},isSelected:b=>p?m(p,b):!1}}function OM(n,a){const s=jM(n,a),l=AM(n,a),c=MM(n,a);switch(n.mode){case"single":return s;case"multiple":return l;case"range":return c;default:return}}function Rt(n,a){return n instanceof ya&&n.timeZone===a?n:new ya(n,a)}function Ny(n,a){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?Rt(n,a):Array.isArray(n)?n.map(s=>s instanceof Date?Rt(s,a):s):_r(n)?{...n,from:n.from?Rt(n.from,a):n.from,to:n.to?Rt(n.to,a):n.to}:pf(n)?{before:Rt(n.before,a),after:Rt(n.after,a)}:mf(n)?{after:Rt(n.after,a)}:gf(n)?{before:Rt(n.before,a)}:n}function pd(n,a){return n&&(Array.isArray(n)?n.map(s=>Ny(s,a)):Ny(n,a))}function EM(n){let a=n;const s=a.timeZone;if(s&&(a={...n,timeZone:s},a.today&&(a.today=Rt(a.today,s)),a.month&&(a.month=Rt(a.month,s)),a.defaultMonth&&(a.defaultMonth=Rt(a.defaultMonth,s)),a.startMonth&&(a.startMonth=Rt(a.startMonth,s)),a.endMonth&&(a.endMonth=Rt(a.endMonth,s)),a.mode==="single"&&a.selected?a.selected=Rt(a.selected,s):a.mode==="multiple"&&a.selected?a.selected=a.selected?.map(pe=>Rt(pe,s)):a.mode==="range"&&a.selected&&(a.selected={from:a.selected.from?Rt(a.selected.from,s):a.selected.from,to:a.selected.to?Rt(a.selected.to,s):a.selected.to}),a.disabled!==void 0&&(a.disabled=pd(a.disabled,s)),a.hidden!==void 0&&(a.hidden=pd(a.hidden,s)),a.modifiers)){const pe={};Object.keys(a.modifiers).forEach(ke=>{pe[ke]=pd(a.modifiers?.[ke],s)}),a.modifiers=pe}const{components:l,formatters:c,labels:f,dateLib:h,locale:p,classNames:m}=S.useMemo(()=>{const pe={...ux,...a.locale},ke=new dn({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:ke,components:KD(a.components),formatters:JD(a.formatters),labels:iM(a.labels,ke.options),locale:pe,classNames:{...GD(),...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:h.today()});const{captionLayout:y,mode:C,navLayout:b,numberOfMonths:v=1,onDayBlur:N,onDayClick:w,onDayFocus:M,onDayKeyDown:O,onDayMouseEnter:D,onDayMouseLeave:H,onNextClick:B,onPrevClick:I,showWeekNumber:E,styles:A}=a,{formatCaption:z,formatDay:X,formatMonthDropdown:W,formatWeekNumber:Q,formatWeekNumberHeader:ae,formatWeekdayName:ee,formatYearDropdown:ye}=c,fe=SM(a,h),{days:Ce,months:P,navStart:F,navEnd:ie,previousMonth:$,nextMonth:se,goToMonth:ne}=fe,Ne=HD(Ce,a,F,ie,h),{isSelected:V,select:J,selected:ce}=OM(a,h)??{},{blur:te,focused:le,isFocusTarget:be,moveFocus:Re,setFocused:Ye}=NM(a,fe,Ne,V??(()=>!1),h),{labelDayButton:St,labelGridcell:Ct,labelGrid:Ve,labelMonthDropdown:ot,labelNav:It,labelPrevious:Qt,labelNext:Yn,labelWeekday:Te,labelWeekNumber:Wt,labelWeekNumberHeader:On,labelYearDropdown:$t}=f,Sa=S.useMemo(()=>lM(h,a.ISOWeek,a.broadcastCalendar,a.today),[h,a.ISOWeek,a.broadcastCalendar,a.today]),Fn=C!==void 0||w!==void 0,pt=S.useCallback(()=>{$&&(ne($),I?.($))},[$,ne,I]),Xt=S.useCallback(()=>{se&&(ne(se),B?.(se))},[ne,se,B]),Vn=S.useCallback((pe,ke)=>ve=>{ve.preventDefault(),ve.stopPropagation(),Ye(pe),!ke.disabled&&(J?.(pe.date,ke,ve),w?.(pe.date,ke,ve))},[J,w,Ye]),ei=S.useCallback((pe,ke)=>ve=>{Ye(pe),M?.(pe.date,ke,ve)},[M,Ye]),En=S.useCallback((pe,ke)=>ve=>{te(),N?.(pe.date,ke,ve)},[te,N]),Pn=S.useCallback((pe,ke)=>ve=>{const Ee={ArrowLeft:[ve.shiftKey?"month":"day",a.dir==="rtl"?"after":"before"],ArrowRight:[ve.shiftKey?"month":"day",a.dir==="rtl"?"before":"after"],ArrowDown:[ve.shiftKey?"year":"week","after"],ArrowUp:[ve.shiftKey?"year":"week","before"],PageUp:[ve.shiftKey?"year":"month","before"],PageDown:[ve.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ee[ve.key]){ve.preventDefault(),ve.stopPropagation();const[tt,we]=Ee[ve.key];Re(tt,we)}O?.(pe.date,ke,ve)},[Re,O,a.dir]),Ti=S.useCallback((pe,ke)=>ve=>{D?.(pe.date,ke,ve)},[D]),wo=S.useCallback((pe,ke)=>ve=>{H?.(pe.date,ke,ve)},[H]),No=S.useCallback(pe=>ke=>{const ve=Number(ke.target.value),Ee=h.setMonth(h.startOfMonth(pe),ve);ne(Ee)},[h,ne]),Qn=S.useCallback(pe=>ke=>{const ve=Number(ke.target.value),Ee=h.setYear(h.startOfMonth(pe),ve);ne(Ee)},[h,ne]),{className:Z,style:je}=S.useMemo(()=>({className:[m[me.Root],a.className].filter(Boolean).join(" "),style:{...A?.[me.Root],...a.style}}),[m,a.className,a.style,A]),xe=qD(a),Oe=S.useRef(null);fM(Oe,!!a.animate,{classNames:m,months:P,focused:le,dateLib:h});const st={dayPickerProps:a,selected:ce,select:J,isSelected:V,months:P,nextMonth:se,previousMonth:$,goToMonth:ne,getModifiers:Ne,components:l,classNames:m,styles:A,labels:f,formatters:c};return oe.createElement(fx.Provider,{value:st},oe.createElement(l.Root,{rootRef:a.animate?Oe:void 0,className:Z,style:je,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"],...xe},oe.createElement(l.Months,{className:m[me.Months],style:A?.[me.Months]},!a.hideNavigation&&!b&&oe.createElement(l.Nav,{"data-animated-nav":a.animate?"true":void 0,className:m[me.Nav],style:A?.[me.Nav],"aria-label":It(),onPreviousClick:pt,onNextClick:Xt,previousMonth:$,nextMonth:se}),P.map((pe,ke)=>oe.createElement(l.Month,{"data-animated-month":a.animate?"true":void 0,className:m[me.Month],style:A?.[me.Month],key:ke,displayIndex:ke,calendarMonth:pe},b==="around"&&!a.hideNavigation&&ke===0&&oe.createElement(l.PreviousMonthButton,{type:"button",className:m[me.PreviousMonthButton],tabIndex:$?void 0:-1,"aria-disabled":$?void 0:!0,"aria-label":Qt($),onClick:pt,"data-animated-button":a.animate?"true":void 0},oe.createElement(l.Chevron,{disabled:$?void 0:!0,className:m[me.Chevron],orientation:a.dir==="rtl"?"right":"left"})),oe.createElement(l.MonthCaption,{"data-animated-caption":a.animate?"true":void 0,className:m[me.MonthCaption],style:A?.[me.MonthCaption],calendarMonth:pe,displayIndex:ke},y?.startsWith("dropdown")?oe.createElement(l.DropdownNav,{className:m[me.Dropdowns],style:A?.[me.Dropdowns]},(()=>{const ve=y==="dropdown"||y==="dropdown-months"?oe.createElement(l.MonthsDropdown,{key:"month",className:m[me.MonthsDropdown],"aria-label":ot(),classNames:m,components:l,disabled:!!a.disableNavigation,onChange:No(pe.date),options:oM(pe.date,F,ie,c,h),style:A?.[me.Dropdown],value:h.getMonth(pe.date)}):oe.createElement("span",{key:"month"},W(pe.date,h)),Ee=y==="dropdown"||y==="dropdown-years"?oe.createElement(l.YearsDropdown,{key:"year",className:m[me.YearsDropdown],"aria-label":$t(h.options),classNames:m,components:l,disabled:!!a.disableNavigation,onChange:Qn(pe.date),options:rM(F,ie,c,h,!!a.reverseYears),style:A?.[me.Dropdown],value:h.getYear(pe.date)}):oe.createElement("span",{key:"year"},ye(pe.date,h));return h.getMonthYearOrder()==="year-first"?[Ee,ve]:[ve,Ee]})(),oe.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"}},z(pe.date,h.options,h))):oe.createElement(l.CaptionLabel,{className:m[me.CaptionLabel],role:"status","aria-live":"polite"},z(pe.date,h.options,h))),b==="around"&&!a.hideNavigation&&ke===v-1&&oe.createElement(l.NextMonthButton,{type:"button",className:m[me.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":Yn(se),onClick:Xt,"data-animated-button":a.animate?"true":void 0},oe.createElement(l.Chevron,{disabled:se?void 0:!0,className:m[me.Chevron],orientation:a.dir==="rtl"?"left":"right"})),ke===v-1&&b==="after"&&!a.hideNavigation&&oe.createElement(l.Nav,{"data-animated-nav":a.animate?"true":void 0,className:m[me.Nav],style:A?.[me.Nav],"aria-label":It(),onPreviousClick:pt,onNextClick:Xt,previousMonth:$,nextMonth:se}),oe.createElement(l.MonthGrid,{role:"grid","aria-multiselectable":C==="multiple"||C==="range","aria-label":Ve(pe.date,h.options,h)||void 0,className:m[me.MonthGrid],style:A?.[me.MonthGrid]},!a.hideWeekdays&&oe.createElement(l.Weekdays,{"data-animated-weekdays":a.animate?"true":void 0,className:m[me.Weekdays],style:A?.[me.Weekdays]},E&&oe.createElement(l.WeekNumberHeader,{"aria-label":On(h.options),className:m[me.WeekNumberHeader],style:A?.[me.WeekNumberHeader],scope:"col"},ae()),Sa.map(ve=>oe.createElement(l.Weekday,{"aria-label":Te(ve,h.options,h),className:m[me.Weekday],key:String(ve),style:A?.[me.Weekday],scope:"col"},ee(ve,h.options,h)))),oe.createElement(l.Weeks,{"data-animated-weeks":a.animate?"true":void 0,className:m[me.Weeks],style:A?.[me.Weeks]},pe.weeks.map(ve=>oe.createElement(l.Week,{className:m[me.Week],key:ve.weekNumber,style:A?.[me.Week],week:ve},E&&oe.createElement(l.WeekNumber,{week:ve,style:A?.[me.WeekNumber],"aria-label":Wt(ve.weekNumber,{locale:p}),className:m[me.WeekNumber],scope:"row",role:"rowheader"},Q(ve.weekNumber,h)),ve.days.map(Ee=>{const{date:tt}=Ee,we=Ne(Ee);if(we[rt.focused]=!we.hidden&&!!le?.isEqualTo(Ee),we[Dn.selected]=V?.(tt)||we.selected,_r(ce)){const{from:Zt,to:wn}=ce;we[Dn.range_start]=!!(Zt&&wn&&h.isSameDay(tt,Zt)),we[Dn.range_end]=!!(Zt&&wn&&h.isSameDay(tt,wn)),we[Dn.range_middle]=ba(ce,tt,!0,h)}const Lt=sM(we,A,a.modifiersStyles),Wn=BD(we,m,a.modifiersClassNames),Nt=!Fn&&!we.hidden?Ct(tt,we,h.options,h):void 0;return oe.createElement(l.Day,{key:`${Ee.isoDate}_${Ee.displayMonthId}`,day:Ee,modifiers:we,className:Wn.join(" "),style:Lt,role:"gridcell","aria-selected":we.selected||void 0,"aria-label":Nt,"data-day":Ee.isoDate,"data-month":Ee.outside?Ee.dateMonthId:void 0,"data-selected":we.selected||void 0,"data-disabled":we.disabled||void 0,"data-hidden":we.hidden||void 0,"data-outside":Ee.outside||void 0,"data-focused":we.focused||void 0,"data-today":we.today||void 0},!we.hidden&&Fn?oe.createElement(l.DayButton,{className:m[me.DayButton],style:A?.[me.DayButton],type:"button",day:Ee,modifiers:we,disabled:!we.focused&&we.disabled||void 0,"aria-disabled":we.focused&&we.disabled||void 0,tabIndex:be(Ee)?0:-1,"aria-label":St(tt,we,h.options,h),onClick:Vn(Ee,we),onBlur:En(Ee,we),onFocus:ei(Ee,we),onKeyDown:Pn(Ee,we),onMouseEnter:Ti(Ee,we),onMouseLeave:wo(Ee,we)},X(tt,h.options,h)):!we.hidden&&X(Ee.date,h.options,h))})))))))),a.footer&&oe.createElement(l.Footer,{className:m[me.Footer],style:A?.[me.Footer],role:"status","aria-live":"polite"},a.footer)))}function PM({className:n,classNames:a,showOutsideDays:s=!0,...l}){return r.jsx(EM,{showOutsideDays:s,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(ar({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:K(ar({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(ar({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:f,...h})=>{const p=c==="left"?iC:c==="right"?yr:c==="up"?Ed:vr;return r.jsx(p,{className:K("h-4 w-4",f),...h})}},...l})}PM.displayName="Calendar";const RM=S.lazy(()=>ht(()=>Promise.resolve().then(()=>hf),void 0).then(n=>({default:n.CodeEditor})));function lO({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:s,rawSettingsEnv:l,onChange:c,missingRequiredFields:f=[]}){const h=f.length>0;return r.jsx(S.Suspense,{fallback:r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx(jn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:r.jsxs("div",{className:"h-full flex flex-col",children:[!a&&s!==null&&r.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:[r.jsx(vo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&h&&r.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:[r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",r.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:r.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:r.jsx(RM,{value:n,onChange:c,language:"json",minHeight:"100%"})})}),r.jsx("div",{className:"mx-6 mb-4",children:r.jsx("div",{className:"border rounded-md overflow-hidden",children:r.jsx(df,{profileEnv:l})})})]})})}const rO={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},cO=[{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 ccsd alias or --target droid for one-off target overrides."],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-ccsd-command",label:"Run once with Droid alias",description:"Use ccsd to force Droid target with your current profile.",type:"command",command:"ccsd 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:["ccsd glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates inbox is available for rollout tasks",summary:"A focused updates inbox 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 inbox 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 Inbox",path:"/updates"}],commands:["ccs config"]}],LM=[{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:["ccsd glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccsd alias for automatic Droid target selection."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and target.",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 codex","ccs cliproxy create mycodex --provider 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."}],_M=new Map(LM.map(n=>[n.id,n]));function uO(n){return n.entryIds.map(a=>_M.get(a)).filter(a=>!!a)}function dO(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)}function zM(){const{t:n}=_t(),[a,s]=S.useState(""),[l,c]=S.useState(""),[f,h]=S.useState(null),[p,m]=S.useState(!1),{login:y,authRequired:C,isAuthenticated:b}=Id(),v=jd(),w=gr().state?.from?.pathname||"/";if(S.useEffect(()=>{(b||!C)&&v(w,{replace:!0})},[b,C,v,w]),b||!C)return null;const M=async O=>{O.preventDefault(),h(null),m(!0);try{await y(a,l),v(w,{replace:!0})}catch(D){h(D instanceof Error?D.message:n("auth.loginFailed"))}finally{m(!1)}};return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(PT,{className:"w-full max-w-sm",children:[r.jsxs(RT,{className:"space-y-1 text-center",children:[r.jsx("div",{className:"mx-auto mb-2 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:r.jsx(oC,{className:"h-6 w-6 text-primary"})}),r.jsx(LT,{className:"text-2xl",children:n("auth.dashboardTitle")}),r.jsx(_T,{children:n("auth.loginDescription")})]}),r.jsx(zT,{children:r.jsxs("form",{onSubmit:M,className:"space-y-4",children:[f&&r.jsxs(lf,{variant:"destructive",children:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsx(rf,{children:f})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(rn,{htmlFor:"username",children:n("auth.username")}),r.jsx(In,{id:"username",type:"text",value:a,onChange:O=>s(O.target.value),placeholder:n("auth.usernamePlaceholder"),autoComplete:"username",disabled:p,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(rn,{htmlFor:"password",children:n("auth.password")}),r.jsx(In,{id:"password",type:"password",value:l,onChange:O=>c(O.target.value),placeholder:n("auth.passwordPlaceholder"),autoComplete:"current-password",disabled:p,required:!0})]}),r.jsx(ft,{type:"submit",className:"w-full",disabled:p,children:p?r.jsxs(r.Fragment,{children:[r.jsx(jn,{className:"mr-2 h-4 w-4 animate-spin"}),n("auth.signingIn")]}):n("auth.signIn")})]})})]})})}const IM=S.lazy(()=>ht(()=>import("./index-CYo-E5rU.js"),__vite__mapDeps([18,1,2,4,5,7,19,6,8,9])).then(n=>({default:n.AnalyticsPage}))),UM=S.lazy(()=>ht(()=>import("./api-sWNND4wP.js"),__vite__mapDeps([20,1,2,5,21,15,6,4,22,7,8,9])).then(n=>({default:n.ApiPage}))),HM=S.lazy(()=>ht(()=>import("./cliproxy-BGiSCGkl.js"),__vite__mapDeps([23,1,2,5,13,6,4,14,15,24,21,22,3,7,8,9])).then(n=>({default:n.CliproxyPage}))),BM=S.lazy(()=>ht(()=>import("./cliproxy-control-panel-CKO2Sn9B.js"),__vite__mapDeps([25,1,2,5,13,4,6,7,8,9])).then(n=>({default:n.CliproxyControlPanelPage}))),KM=S.lazy(()=>ht(()=>import("./copilot-CuRngdBg.js"),__vite__mapDeps([26,1,2,5,21,15,4,22,3,6,7,8,9])).then(n=>({default:n.CopilotPage}))),qM=S.lazy(()=>ht(()=>import("./cursor-Dxo0uIiU.js"),__vite__mapDeps([27,1,2,6,5,13,3,22,4,7,8,9])).then(n=>({default:n.CursorPage}))),GM=S.lazy(()=>ht(()=>import("./claude-extension-BjInaILv.js"),__vite__mapDeps([28,1,2,5,6,4,7,8,9])).then(n=>({default:n.ClaudeExtensionPage}))),YM=S.lazy(()=>ht(()=>import("./droid-Cl8QsJJL.js"),__vite__mapDeps([29,1,2,6,5,4,22,7,8,9])).then(n=>({default:n.DroidPage}))),FM=S.lazy(()=>ht(()=>import("./accounts-CZEg1_PX.js"),__vite__mapDeps([30,1,2,5,15,6,4,24,7,8,9])).then(n=>({default:n.AccountsPage}))),VM=S.lazy(()=>ht(()=>Promise.resolve().then(()=>nD),void 0).then(n=>({default:n.SettingsPage}))),QM=S.lazy(()=>ht(()=>import("./health-BUifaDU7.js"),__vite__mapDeps([31,1,2,5,6,4,7,8,9])).then(n=>({default:n.HealthPage}))),WM=S.lazy(()=>ht(()=>import("./shared-q_FNNbjD.js"),__vite__mapDeps([32,1,2,4,5,6,7,8,9])).then(n=>({default:n.SharedPage}))),$M=S.lazy(()=>ht(()=>import("./updates-CubQ54J0.js"),__vite__mapDeps([33,1,2,4,5,6,7,8,9])).then(n=>({default:n.UpdatesPage})));function ln(){return r.jsx("div",{className:"flex h-64 items-center justify-center",children:r.jsx(jn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function XM(){return r.jsx(NS,{client:JC,children:r.jsx(Vw,{defaultTheme:"system",storageKey:"vite-ui-theme",children:r.jsx(Qw,{children:r.jsx(Jw,{children:r.jsxs(SS,{children:[r.jsxs(CS,{children:[r.jsx(Pt,{path:"/login",element:r.jsx(zM,{})}),r.jsx(Pt,{element:r.jsx(eN,{}),children:r.jsxs(Pt,{element:r.jsx(JA,{}),children:[r.jsx(Pt,{path:"/",element:r.jsx(Xk,{})}),r.jsx(Pt,{path:"/analytics",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(IM,{})})}),r.jsx(Pt,{path:"/updates",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx($M,{})})}),r.jsx(Pt,{path:"/providers",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(UM,{})})}),r.jsx(Pt,{path:"/cliproxy",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(HM,{})})}),r.jsx(Pt,{path:"/cliproxy/control-panel",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(BM,{})})}),r.jsx(Pt,{path:"/copilot",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(KM,{})})}),r.jsx(Pt,{path:"/cursor",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(qM,{})})}),r.jsx(Pt,{path:"/claude-extension",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(GM,{})})}),r.jsx(Pt,{path:"/droid",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(YM,{})})}),r.jsx(Pt,{path:"/accounts",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(FM,{})})}),r.jsx(Pt,{path:"/settings",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(VM,{})})}),r.jsx(Pt,{path:"/health",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(QM,{})})}),r.jsx(Pt,{path:"/shared",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(WM,{})})})]})})]}),r.jsx(AS,{position:"top-right"})]})})})})})}const Tx=document.getElementById("root");if(!Tx)throw new Error("Root element not found. Failed to mount React application.");$C.createRoot(Tx).render(r.jsx(S.StrictMode,{children:r.jsx(XM,{})}));export{Vj as $,nT as A,Wa as B,PT as C,rT as D,Bj as E,qj as F,Jk as G,sT as H,In as I,cT as J,Kj as K,rn as L,nA as M,aA as N,iA as O,ub as P,$b as Q,cf as R,Ge as S,$a as T,pr as U,kd as V,He as W,Fj as X,Be as Y,Yj as Z,_T as _,_t as a,yj as a$,Qj as a0,Wj as a1,$j as a2,Xj as a3,Zj as a4,Jj as a5,Jb as a6,eO as a7,lj as a8,ZN as a9,vN as aA,SN as aB,Mr as aC,Dr as aD,jr as aE,pb as aF,Ci as aG,UA as aH,HA as aI,BA as aJ,KA as aK,hb as aL,j1 as aM,Nb as aN,Sj as aO,Cj as aP,wj as aQ,Nj as aR,aO as aS,uj as aT,tA as aU,hj as aV,pj as aW,JN as aX,eA as aY,mj as aZ,gj as a_,dj as aa,bj as ab,xj as ac,qd as ad,Gd as ae,Yd as af,Fd as ag,Vd as ah,tO as ai,UT as aj,nO as ak,Ja as al,Rj as am,HT as an,_j as ao,vj as ap,Lj as aq,zj as ar,qg as as,Ij as at,GA as au,CA as av,Ej as aw,jA as ax,Pj as ay,T1 as az,zT as b,fj as b0,Xd as b1,ws as b2,rj as b3,cj as b4,lf as b5,Fb as b6,rf as b7,lO as b8,ix as b9,Tj as bA,Oj as bB,jj as bC,ar as bD,of as ba,Rs as bb,sf as bc,Qk as bd,Uj as be,Hj as bf,dO as bg,rO as bh,cO as bi,uO as bj,sx as bk,XT as bl,JT as bm,Dj as bn,Aj as bo,ab as bp,Ew as bq,jw as br,bd as bs,Ni as bt,Cw as bu,Nw as bv,Dw as bw,Rw as bx,Mj as by,kj as bz,K as c,ft as d,iO as e,oO as f,aD as g,PM as h,sj as i,RT as j,LT as k,m1 as l,g1 as m,So as n,sO as o,Xa as p,Za as q,xb as r,Zd as s,vb as t,_d as u,Jd as v,dr as w,ny as x,fT as y,Gj as z};
|
|
47
|
+
`);return{valid:!1,error:l,line:h.length}}return{valid:!1,error:l}}}function ix({value:n,onChange:a,language:s="json",readonly:l=!1,className:c,minHeight:f="300px"}){const{isDark:h}=yb(),[p,m]=S.useState(!1),[y,C]=S.useState(!0),b=S.useMemo(()=>s==="json"?VT(n):{valid:!0},[n,s]),v=S.useCallback(N=>r.jsx(YC,{theme:h?gg.nightOwl:gg.github,code:N,language:s,children:({tokens:w,getLineProps:M,getTokenProps:O})=>{let D=!1;return r.jsx(r.Fragment,{children:w.map((H,B)=>r.jsx("div",{...M({line:H}),className:K(b.line===B+1&&"bg-destructive/20"),children:H.map((I,E)=>{let A=!1;if(I.types.includes("property")){const X=I.content.replace(/['"]/g,"");FT(X)?D=!0:D=!1}else(I.types.includes("string")||I.types.includes("number")||I.types.includes("boolean"))&&D?(A=!0,D=!1):I.types.includes("punctuation")&&I.content!==":"&&I.content!=="["&&I.content!=="{"&&(D=!1);const z=O({token:I});return A&&y&&(z.className=K(z.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),r.jsx("span",{...z},E)})},B))})}}),[h,s,b.line,y]);return r.jsxs("div",{className:K("flex flex-col",c),children:[r.jsxs("div",{className:K("relative rounded-md border overflow-hidden","bg-muted/30",p&&"ring-2 ring-ring ring-offset-2 ring-offset-background",l&&"opacity-70 cursor-not-allowed",!b.valid&&"border-destructive"),style:{minHeight:f},children:[r.jsx(GT,{value:n,onValueChange:l?()=>{}:a,highlight:v,padding:12,disabled:l,onFocus:()=>m(!0),onBlur:()=>m(!1),textareaClassName:K("focus:outline-none font-mono text-sm",l&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:f}},h?"dark-editor":"light-editor"),r.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:r.jsx(ft,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>C(!y),title:y?"Reveal sensitive values":"Mask sensitive values",children:y?r.jsx(xr,{className:"h-3 w-3"}):r.jsx(br,{className:"h-3 w-3"})})})]}),r.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[b.valid?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Sr,{className:"w-3 h-3 text-green-500"}),"Valid ",s.toUpperCase()]}):r.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[r.jsx(Cr,{className:"w-3 h-3"}),b.error,b.line&&` (line ${b.line})`]}),l&&r.jsx("span",{className:"ml-auto text-muted-foreground",children:"(Read-only)"})]})]})}const hf=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:ix},Symbol.toStringTag,{value:"Module"})),QT={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 WT(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 ox=S.createContext(null);function $T({children:n}){const[a,s]=S.useReducer(WT,QT);return r.jsx(ox.Provider,{value:{state:a,dispatch:s},children:n})}function sx(){const n=S.useContext(ox);if(!n)throw new Error("useSettingsContext must be used within a SettingsProvider");return n}function XT(){const{dispatch:n}=sx(),a=S.useCallback(A=>n({type:"SET_WEBSEARCH_CONFIG",payload:A}),[n]),s=S.useCallback(A=>n({type:"SET_WEBSEARCH_STATUS",payload:A}),[n]),l=S.useCallback(A=>n({type:"SET_WEBSEARCH_LOADING",payload:A}),[n]),c=S.useCallback(A=>n({type:"SET_WEBSEARCH_STATUS_LOADING",payload:A}),[n]),f=S.useCallback(A=>n({type:"SET_WEBSEARCH_SAVING",payload:A}),[n]),h=S.useCallback(A=>n({type:"SET_WEBSEARCH_ERROR",payload:A}),[n]),p=S.useCallback(A=>n({type:"SET_WEBSEARCH_SUCCESS",payload:A}),[n]),m=S.useCallback(A=>n({type:"SET_GLOBALENV_CONFIG",payload:A}),[n]),y=S.useCallback(A=>n({type:"SET_GLOBALENV_LOADING",payload:A}),[n]),C=S.useCallback(A=>n({type:"SET_GLOBALENV_SAVING",payload:A}),[n]),b=S.useCallback(A=>n({type:"SET_GLOBALENV_ERROR",payload:A}),[n]),v=S.useCallback(A=>n({type:"SET_GLOBALENV_SUCCESS",payload:A}),[n]),N=S.useCallback(A=>n({type:"SET_PROXY_CONFIG",payload:A}),[n]),w=S.useCallback(A=>n({type:"SET_PROXY_LOADING",payload:A}),[n]),M=S.useCallback(A=>n({type:"SET_PROXY_SAVING",payload:A}),[n]),O=S.useCallback(A=>n({type:"SET_PROXY_ERROR",payload:A}),[n]),D=S.useCallback(A=>n({type:"SET_PROXY_SUCCESS",payload:A}),[n]),H=S.useCallback(A=>n({type:"SET_PROXY_TEST_RESULT",payload:A}),[n]),B=S.useCallback(A=>n({type:"SET_PROXY_TESTING",payload:A}),[n]),I=S.useCallback(A=>n({type:"SET_RAW_CONFIG",payload:A}),[n]),E=S.useCallback(A=>n({type:"SET_RAW_CONFIG_LOADING",payload:A}),[n]);return S.useMemo(()=>({setWebSearchConfig:a,setWebSearchStatus:s,setWebSearchLoading:l,setWebSearchStatusLoading:c,setWebSearchSaving:f,setWebSearchError:h,setWebSearchSuccess:p,setGlobalEnvConfig:m,setGlobalEnvLoading:y,setGlobalEnvSaving:C,setGlobalEnvError:b,setGlobalEnvSuccess:v,setProxyConfig:N,setProxyLoading:w,setProxySaving:M,setProxyError:O,setProxySuccess:D,setProxyTestResult:H,setProxyTesting:B,setRawConfig:I,setRawConfigLoading:E}),[a,s,l,c,f,h,p,m,y,C,b,v,N,w,M,O,D,H,B,I,E])}function ZT(){const[n,a]=vS(),s=n.get("tab")?.toLowerCase(),l=s==="globalenv"?"globalenv":s==="proxy"?"proxy":s==="auth"?"auth":s==="thinking"?"thinking":s==="backups"?"backups":"websearch",c=S.useCallback(f=>{a({tab:f},{replace:!0})},[a]);return{activeTab:l,setActiveTab:c}}function JT(){const{state:n}=sx(),a=XT(),[s,l]=S.useState(!1),c=S.useCallback(async()=>{try{a.setRawConfigLoading(!0);const h=await fetch("/api/config/raw");if(!h.ok){a.setRawConfig(null);return}const p=await h.text();a.setRawConfig(p)}catch{a.setRawConfig(null)}finally{a.setRawConfigLoading(!1)}},[a]),f=S.useCallback(async()=>{if(n.rawConfig)try{await navigator.clipboard.writeText(n.rawConfig),l(!0),setTimeout(()=>l(!1),2e3)}catch{}},[n.rawConfig]);return{rawConfig:n.rawConfig,loading:n.rawConfigLoading,copied:s,fetchRawConfig:c,copyToClipboard:f}}function cy({activeTab:n,onTabChange:a}){const{t:s}=_t(),l=[{value:"websearch",label:s("settingsTabs.web"),icon:Xy},{value:"globalenv",label:s("settingsTabs.env"),icon:Rd},{value:"thinking",label:s("settingsTabs.think"),icon:tC},{value:"proxy",label:s("settingsTabs.proxy"),icon:nC},{value:"auth",label:s("settingsTabs.auth"),icon:Od},{value:"backups",label:s("settingsTabs.backup"),icon:aC}];return r.jsx($b,{value:n,onValueChange:c=>a(c),children:r.jsx(cf,{className:"grid w-full grid-cols-6",children:l.map(({value:c,label:f,icon:h})=>r.jsxs(pr,{value:c,className:"gap-1.5 px-1 text-xs",children:[r.jsx(h,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:f})]},c))})})}function uy(){return r.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[r.jsx(Ge,{className:"h-4 w-2/3"}),r.jsx("div",{className:"p-4 rounded-lg border",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ge,{className:"h-5 w-32"}),r.jsx(Ge,{className:"h-4 w-48"})]}),r.jsx(Ge,{className:"h-6 w-10 rounded-full"})]})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ge,{className:"h-5 w-24"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ge,{className:"h-20 w-full rounded-lg"}),r.jsx(Ge,{className:"h-20 w-full rounded-lg"}),r.jsx(Ge,{className:"h-20 w-full rounded-lg"})]})]})]})}function lx(n,a=3,s=1e3){return n().catch(l=>{if(a<=0)throw l;return new Promise(c=>setTimeout(c,s)).then(()=>lx(n,a-1,s*2))})}function Co(n){return S.lazy(()=>lx(n))}const dy=Co(()=>ht(()=>import("./index-awSrtRcI.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),fy=Co(()=>ht(()=>import("./globalenv-section-B9l_4XUg.js"),__vite__mapDeps([10,1,2,3,4,5,6,7,8,9]))),hy=Co(()=>ht(()=>import("./index-D3yHEBlf.js"),__vite__mapDeps([11,1,2,3,4,5,6,7,8,9]))),py=Co(()=>ht(()=>import("./index-X7b7NDPo.js"),__vite__mapDeps([12,1,2,3,13,4,14,15,5,6,7,8,9]))),my=Co(()=>ht(()=>import("./auth-section-DMcsqZyo.js"),__vite__mapDeps([16,1,2,4,5,6,7,8,9]))),gy=Co(()=>ht(()=>import("./backups-section-Bu4mUdGV.js"),__vite__mapDeps([17,1,2,15,4,5,6,7,8,9])));class yy extends S.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){return this.state.hasError?r.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:r.jsxs("div",{className:"text-center p-6 max-w-md",children:[r.jsx(Cr,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),r.jsx("p",{className:"font-medium text-foreground mb-2",children:He.t("settings.sectionLoadFailed")}),r.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||He.t("settings.unknownError")}),r.jsxs(ft,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[r.jsx(Os,{className:"w-4 h-4"}),He.t("settings.reloadPage")]})]})}):this.props.children}}function eD(){const{t:n}=_t(),{activeTab:a,setActiveTab:s}=ZT(),{rawConfig:l,loading:c,copied:f,fetchRawConfig:h,copyToClipboard:p}=JT();S.useEffect(()=>{h()},[h]);const m=y=>{S.startTransition(()=>{s(y)})};return r.jsxs("div",{className:"h-[calc(100vh-100px)]",children:[r.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[r.jsx("div",{className:"border-b bg-background p-4",children:r.jsx(cy,{activeTab:a,onTabChange:m})}),r.jsx(yy,{children:r.jsxs(S.Suspense,{fallback:r.jsx(uy,{}),children:[a==="websearch"&&r.jsx(dy,{}),a==="globalenv"&&r.jsx(fy,{}),a==="thinking"&&r.jsx(hy,{}),a==="proxy"&&r.jsx(py,{}),a==="auth"&&r.jsx(my,{}),a==="backups"&&r.jsx(gy,{})]})})]}),r.jsxs(of,{direction:"horizontal",className:"h-full hidden md:flex",children:[r.jsx(Rs,{defaultSize:40,minSize:30,maxSize:55,children:r.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[r.jsx("div",{className:"p-5 border-b bg-background",children:r.jsx(cy,{activeTab:a,onTabChange:m})}),r.jsx(yy,{children:r.jsxs(S.Suspense,{fallback:r.jsx(uy,{}),children:[a==="websearch"&&r.jsx(dy,{}),a==="globalenv"&&r.jsx(fy,{}),a==="thinking"&&r.jsx(hy,{}),a==="proxy"&&r.jsx(py,{}),a==="auth"&&r.jsx(my,{}),a==="backups"&&r.jsx(gy,{})]})})]})}),r.jsx(sf,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:r.jsx(wr,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),r.jsx(Rs,{defaultSize:60,minSize:35,children:r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(fg,{className:"w-5 h-5 text-primary"}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold",children:"config.yaml"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ft,{variant:"outline",size:"sm",onClick:p,disabled:!l,children:f?r.jsxs(r.Fragment,{children:[r.jsx(bo,{className:"w-4 h-4 mr-1"}),n("settings.copied")]}):r.jsxs(r.Fragment,{children:[r.jsx(lr,{className:"w-4 h-4 mr-1"}),n("settings.copy")]})}),r.jsx(ft,{variant:"outline",size:"sm",onClick:h,disabled:c,children:r.jsx(Os,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto",children:c?r.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[r.jsx(Os,{className:"w-5 h-5 animate-spin mr-2"}),n("settings.loading")]}):l?r.jsx(ix,{value:l,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:r.jsxs("div",{className:"text-center",children:[r.jsx(fg,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:n("settings.configFileNotFound")}),r.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function tD(){return r.jsx($T,{children:r.jsx(eD,{})})}const nD=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:tD},Symbol.toStringTag,{value:"Module"})),iO=hS,oO=mS,sO=pS,aD=S.forwardRef(({className:n,align:a="center",sideOffset:s=4,...l},c)=>r.jsx(fS,{children:r.jsx(Gy,{ref:c,align:a,sideOffset:s,className:K("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md 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),...l})}));aD.displayName=Gy.displayName;function iD(n,a,s="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:s}).format(a).split(/\s/g).slice(2).join(" ")}const oD={},ks={};function Si(n,a){try{const l=(oD[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(a).split("GMT")[1];return l in ks?ks[l]:by(l,l.split(":"))}catch{if(n in ks)return ks[n];const s=n?.match(sD);return s?by(n,s.slice(1)):NaN}}const sD=/([+-]\d\d):?(\d\d)?/;function by(n,a){const s=+(a[0]||0),l=+(a[1]||0),c=+(a[2]||0)/60;return ks[n]=s*60+l>0?s*60+l+c:s*60-l-c}class Bn extends Date{constructor(...a){super(),a.length>1&&typeof a[a.length-1]=="string"&&(this.timeZone=a.pop()),this.internal=new Date,isNaN(Si(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)),rx(this),Dd(this)):this.setTime(Date.now())}static tz(a,...s){return s.length?new Bn(...s,a):new Bn(Date.now(),a)}withTimeZone(a){return new Bn(+this,a)}getTimezoneOffset(){const a=-Si(this.timeZone,this);return a>0?Math.floor(a):Math.ceil(a)}setTime(a){return Date.prototype.setTime.apply(this,arguments),Dd(this),+this}[Symbol.for("constructDateFrom")](a){return new Bn(+new Date(a),this.timeZone)}}const xy=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!xy.test(n))return;const a=n.replace(xy,"$1UTC");Bn.prototype[a]&&(n.startsWith("get")?Bn.prototype[n]=function(){return this.internal[a]()}:(Bn.prototype[n]=function(){return Date.prototype[a].apply(this.internal,arguments),lD(this),+this},Bn.prototype[a]=function(){return Date.prototype[a].apply(this,arguments),Dd(this),+this}))});function Dd(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-Si(n.timeZone,n)*60))}function lD(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()),rx(n)}function rx(n){const a=Si(n.timeZone,n),s=a>0?Math.floor(a):Math.ceil(a),l=new Date(+n);l.setUTCHours(l.getUTCHours()-1);const c=-new Date(+n).getTimezoneOffset(),f=-new Date(+l).getTimezoneOffset(),h=c-f,p=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();h&&p&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+h);const m=c-s;m&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+m);const y=new Date(+n);y.setUTCSeconds(0);const C=c>0?y.getSeconds():(y.getSeconds()-60)%60,b=Math.round(-(Si(n.timeZone,n)*60))%60;(b||C)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+b+C));const v=Si(n.timeZone,n),N=v>0?Math.floor(v):Math.ceil(v),M=-new Date(+n).getTimezoneOffset()-N,O=N!==s,D=M-m;if(O&&D){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+D);const H=Si(n.timeZone,n),B=H>0?Math.floor(H):Math.ceil(H),I=N-B;I&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+I),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+I))}}class ya extends Bn{static tz(a,...s){return s.length?new ya(...s,a):new ya(Date.now(),a)}toISOString(){const[a,s,l]=this.tzComponents(),c=`${a}${s}:${l}`;return this.internal.toISOString().slice(0,-1)+c}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[a,s,l,c]=this.internal.toUTCString().split(" ");return`${a?.slice(0,-1)} ${l} ${s} ${c}`}toTimeString(){const a=this.internal.toUTCString().split(" ")[4],[s,l,c]=this.tzComponents();return`${a} GMT${s}${l}${c} (${iD(this.timeZone,this)})`}toLocaleString(a,s){return Date.prototype.toLocaleString.call(this,a,{...s,timeZone:s?.timeZone||this.timeZone})}toLocaleDateString(a,s){return Date.prototype.toLocaleDateString.call(this,a,{...s,timeZone:s?.timeZone||this.timeZone})}toLocaleTimeString(a,s){return Date.prototype.toLocaleTimeString.call(this,a,{...s,timeZone:s?.timeZone||this.timeZone})}tzComponents(){const a=this.getTimezoneOffset(),s=a>0?"-":"+",l=String(Math.floor(Math.abs(a)/60)).padStart(2,"0"),c=String(Math.abs(a)%60).padStart(2,"0");return[s,l,c]}withTimeZone(a){return new ya(+this,a)}[Symbol.for("constructDateFrom")](a){return new ya(+new Date(a),this.timeZone)}}const vy=5,rD=4;function cD(n,a){const s=a.startOfMonth(n),l=s.getDay()>0?s.getDay():7,c=a.addDays(n,-l+1),f=a.addDays(c,vy*7-1);return a.getMonth(n)===a.getMonth(f)?vy:rD}function cx(n,a){const s=a.startOfMonth(n),l=s.getDay();return l===1?s:l===0?a.addDays(s,-6):a.addDays(s,-1*(l-1))}function uD(n,a){const s=cx(n,a),l=cD(n,a);return a.addDays(s,l*7-1)}const ux={...bs,labels:{labelDayButton:(n,a,s,l)=>{let c;l&&typeof l.format=="function"?c=l.format.bind(l):c=(h,p)=>Cs(h,p,{locale:bs,...s});let f=c(n,"PPPP");return a.today&&(f=`Today, ${f}`),a.selected&&(f=`${f}, selected`),f},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,s)=>{let l;return s&&typeof s.format=="function"?l=s.format.bind(s):l=(c,f)=>Cs(c,f,{locale:bs,...a}),l(n,"LLLL yyyy")},labelGridcell:(n,a,s,l)=>{let c;l&&typeof l.format=="function"?c=l.format.bind(l):c=(h,p)=>Cs(h,p,{locale:bs,...s});let f=c(n,"PPPP");return a?.today&&(f=`Today, ${f}`),f},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,a,s)=>{let l;return s&&typeof s.format=="function"?l=s.format.bind(s):l=(c,f)=>Cs(c,f,{locale:bs,...a}),l(n,"cccc")}}};class dn{constructor(a,s){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ya.tz(this.options.timeZone):new this.Date,this.newDate=(l,c,f)=>this.overrides?.newDate?this.overrides.newDate(l,c,f):this.options.timeZone?new ya(l,c,f,this.options.timeZone):new Date(l,c,f),this.addDays=(l,c)=>this.overrides?.addDays?this.overrides.addDays(l,c):rC(l,c),this.addMonths=(l,c)=>this.overrides?.addMonths?this.overrides.addMonths(l,c):cC(l,c),this.addWeeks=(l,c)=>this.overrides?.addWeeks?this.overrides.addWeeks(l,c):uC(l,c),this.addYears=(l,c)=>this.overrides?.addYears?this.overrides.addYears(l,c):dC(l,c),this.differenceInCalendarDays=(l,c)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(l,c):fC(l,c),this.differenceInCalendarMonths=(l,c)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(l,c):hC(l,c),this.eachMonthOfInterval=l=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(l):pC(l),this.eachYearOfInterval=l=>{const c=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(l):mC(l),f=new Set(c.map(p=>this.getYear(p)));if(f.size===c.length)return c;const h=[];return f.forEach(p=>{h.push(new Date(p,0,1))}),h},this.endOfBroadcastWeek=l=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(l):uD(l,this),this.endOfISOWeek=l=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(l):gC(l),this.endOfMonth=l=>this.overrides?.endOfMonth?this.overrides.endOfMonth(l):yC(l),this.endOfWeek=(l,c)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(l,c):bC(l,this.options),this.endOfYear=l=>this.overrides?.endOfYear?this.overrides.endOfYear(l):xC(l),this.format=(l,c,f)=>{const h=this.overrides?.format?this.overrides.format(l,c,this.options):Cs(l,c,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(h):h},this.getISOWeek=l=>this.overrides?.getISOWeek?this.overrides.getISOWeek(l):vC(l),this.getMonth=(l,c)=>this.overrides?.getMonth?this.overrides.getMonth(l,this.options):SC(l,this.options),this.getYear=(l,c)=>this.overrides?.getYear?this.overrides.getYear(l,this.options):CC(l,this.options),this.getWeek=(l,c)=>this.overrides?.getWeek?this.overrides.getWeek(l,this.options):wC(l,this.options),this.isAfter=(l,c)=>this.overrides?.isAfter?this.overrides.isAfter(l,c):NC(l,c),this.isBefore=(l,c)=>this.overrides?.isBefore?this.overrides.isBefore(l,c):AC(l,c),this.isDate=l=>this.overrides?.isDate?this.overrides.isDate(l):kC(l),this.isSameDay=(l,c)=>this.overrides?.isSameDay?this.overrides.isSameDay(l,c):TC(l,c),this.isSameMonth=(l,c)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(l,c):DC(l,c),this.isSameYear=(l,c)=>this.overrides?.isSameYear?this.overrides.isSameYear(l,c):MC(l,c),this.max=l=>this.overrides?.max?this.overrides.max(l):jC(l),this.min=l=>this.overrides?.min?this.overrides.min(l):OC(l),this.setMonth=(l,c)=>this.overrides?.setMonth?this.overrides.setMonth(l,c):EC(l,c),this.setYear=(l,c)=>this.overrides?.setYear?this.overrides.setYear(l,c):PC(l,c),this.startOfBroadcastWeek=(l,c)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(l,this):cx(l,this),this.startOfDay=l=>this.overrides?.startOfDay?this.overrides.startOfDay(l):RC(l),this.startOfISOWeek=l=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(l):LC(l),this.startOfMonth=l=>this.overrides?.startOfMonth?this.overrides.startOfMonth(l):_C(l),this.startOfWeek=(l,c)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(l,this.options):zC(l,this.options),this.startOfYear=l=>this.overrides?.startOfYear?this.overrides.startOfYear(l):IC(l),this.options={locale:ux,...a},this.overrides=s}getDigitMap(){const{numerals:a="latn"}=this.options,s=new Intl.NumberFormat("en-US",{numberingSystem:a}),l={};for(let c=0;c<10;c++)l[c.toString()]=s.format(c);return l}replaceDigits(a){const s=this.getDigitMap();return a.replace(/\d/g,l=>s[l]||l)}formatNumber(a){return this.replaceDigits(a.toString())}getMonthYearOrder(){const a=this.options.locale?.code;return a&&dn.yearFirstLocales.has(a)?"year-first":"month-first"}formatMonthYear(a){const{locale:s,timeZone:l,numerals:c}=this.options,f=s?.code;if(f&&dn.yearFirstLocales.has(f))try{return new Intl.DateTimeFormat(f,{month:"long",year:"numeric",timeZone:l,numberingSystem:c}).format(a)}catch{}const h=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(a,h)}}dn.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 Gn=new dn;class dx{constructor(a,s,l=Gn){this.date=a,this.displayMonth=s,this.outside=!!(s&&!l.isSameMonth(a,s)),this.dateLib=l,this.isoDate=l.format(a,"yyyy-MM-dd"),this.displayMonthId=l.format(s,"yyyy-MM"),this.dateMonthId=l.format(a,"yyyy-MM")}isEqualTo(a){return this.dateLib.isSameDay(a.date,this.date)&&this.dateLib.isSameMonth(a.displayMonth,this.displayMonth)}}class dD{constructor(a,s){this.date=a,this.weeks=s}}class fD{constructor(a,s){this.days=s,this.weekNumber=a}}function hD(n){return oe.createElement("button",{...n})}function pD(n){return oe.createElement("span",{...n})}function mD(n){const{size:a=24,orientation:s="left",className:l}=n;return oe.createElement("svg",{className:l,width:a,height:a,viewBox:"0 0 24 24"},s==="up"&&oe.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),s==="down"&&oe.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),s==="left"&&oe.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),s==="right"&&oe.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function gD(n){const{day:a,modifiers:s,...l}=n;return oe.createElement("td",{...l})}function yD(n){const{day:a,modifiers:s,...l}=n,c=oe.useRef(null);return oe.useEffect(()=>{s.focused&&c.current?.focus()},[s.focused]),oe.createElement("button",{ref:c,...l})}var me;(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"})(me||(me={}));var rt;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(rt||(rt={}));var Dn;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(Dn||(Dn={}));var un;(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"})(un||(un={}));function bD(n){const{options:a,className:s,components:l,classNames:c,...f}=n,h=[c[me.Dropdown],s].join(" "),p=a?.find(({value:m})=>m===f.value);return oe.createElement("span",{"data-disabled":f.disabled,className:c[me.DropdownRoot]},oe.createElement(l.Select,{className:h,...f},a?.map(({value:m,label:y,disabled:C})=>oe.createElement(l.Option,{key:m,value:m,disabled:C},y))),oe.createElement("span",{className:c[me.CaptionLabel],"aria-hidden":!0},p?.label,oe.createElement(l.Chevron,{orientation:"down",size:18,className:c[me.Chevron]})))}function xD(n){return oe.createElement("div",{...n})}function vD(n){return oe.createElement("div",{...n})}function SD(n){const{calendarMonth:a,displayIndex:s,...l}=n;return oe.createElement("div",{...l},n.children)}function CD(n){const{calendarMonth:a,displayIndex:s,...l}=n;return oe.createElement("div",{...l})}function wD(n){return oe.createElement("table",{...n})}function ND(n){return oe.createElement("div",{...n})}const fx=S.createContext(void 0);function Is(){const n=S.useContext(fx);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function AD(n){const{components:a}=Is();return oe.createElement(a.Dropdown,{...n})}function kD(n){const{onPreviousClick:a,onNextClick:s,previousMonth:l,nextMonth:c,...f}=n,{components:h,classNames:p,labels:{labelPrevious:m,labelNext:y}}=Is(),C=S.useCallback(v=>{c&&s?.(v)},[c,s]),b=S.useCallback(v=>{l&&a?.(v)},[l,a]);return oe.createElement("nav",{...f},oe.createElement(h.PreviousMonthButton,{type:"button",className:p[me.PreviousMonthButton],tabIndex:l?void 0:-1,"aria-disabled":l?void 0:!0,"aria-label":m(l),onClick:b},oe.createElement(h.Chevron,{disabled:l?void 0:!0,className:p[me.Chevron],orientation:"left"})),oe.createElement(h.NextMonthButton,{type:"button",className:p[me.NextMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":y(c),onClick:C},oe.createElement(h.Chevron,{disabled:c?void 0:!0,orientation:"right",className:p[me.Chevron]})))}function TD(n){const{components:a}=Is();return oe.createElement(a.Button,{...n})}function DD(n){return oe.createElement("option",{...n})}function MD(n){const{components:a}=Is();return oe.createElement(a.Button,{...n})}function jD(n){const{rootRef:a,...s}=n;return oe.createElement("div",{...s,ref:a})}function OD(n){return oe.createElement("select",{...n})}function ED(n){const{week:a,...s}=n;return oe.createElement("tr",{...s})}function PD(n){return oe.createElement("th",{...n})}function RD(n){return oe.createElement("thead",{"aria-hidden":!0},oe.createElement("tr",{...n}))}function LD(n){const{week:a,...s}=n;return oe.createElement("th",{...s})}function _D(n){return oe.createElement("th",{...n})}function zD(n){return oe.createElement("tbody",{...n})}function ID(n){const{components:a}=Is();return oe.createElement(a.Dropdown,{...n})}const UD=Object.freeze(Object.defineProperty({__proto__:null,Button:hD,CaptionLabel:pD,Chevron:mD,Day:gD,DayButton:yD,Dropdown:bD,DropdownNav:xD,Footer:vD,Month:SD,MonthCaption:CD,MonthGrid:wD,Months:ND,MonthsDropdown:AD,Nav:kD,NextMonthButton:TD,Option:DD,PreviousMonthButton:MD,Root:jD,Select:OD,Week:ED,WeekNumber:LD,WeekNumberHeader:_D,Weekday:PD,Weekdays:RD,Weeks:zD,YearsDropdown:ID},Symbol.toStringTag,{value:"Module"}));function ba(n,a,s=!1,l=Gn){let{from:c,to:f}=n;const{differenceInCalendarDays:h,isSameDay:p}=l;return c&&f?(h(f,c)<0&&([c,f]=[f,c]),h(a,c)>=(s?1:0)&&h(f,a)>=(s?1:0)):!s&&f?p(f,a):!s&&c?p(c,a):!1}function pf(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function _r(n){return!!(n&&typeof n=="object"&&"from"in n)}function mf(n){return!!(n&&typeof n=="object"&&"after"in n)}function gf(n){return!!(n&&typeof n=="object"&&"before"in n)}function hx(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function px(n,a){return Array.isArray(n)&&n.every(a.isDate)}function xa(n,a,s=Gn){const l=Array.isArray(a)?a:[a],{isSameDay:c,differenceInCalendarDays:f,isAfter:h}=s;return l.some(p=>{if(typeof p=="boolean")return p;if(s.isDate(p))return c(n,p);if(px(p,s))return p.some(m=>c(n,m));if(_r(p))return ba(p,n,!1,s);if(hx(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(n.getDay()):p.dayOfWeek===n.getDay();if(pf(p)){const m=f(p.before,n),y=f(p.after,n),C=m>0,b=y<0;return h(p.before,p.after)?b&&C:C||b}return mf(p)?f(n,p.after)>0:gf(p)?f(p.before,n)>0:typeof p=="function"?p(n):!1})}function HD(n,a,s,l,c){const{disabled:f,hidden:h,modifiers:p,showOutsideDays:m,broadcastCalendar:y,today:C=c.today()}=a,{isSameDay:b,isSameMonth:v,startOfMonth:N,isBefore:w,endOfMonth:M,isAfter:O}=c,D=s&&N(s),H=l&&M(l),B={[rt.focused]:[],[rt.outside]:[],[rt.disabled]:[],[rt.hidden]:[],[rt.today]:[]},I={};for(const E of n){const{date:A,displayMonth:z}=E,X=!!(z&&!v(A,z)),W=!!(D&&w(A,D)),Q=!!(H&&O(A,H)),ae=!!(f&&xa(A,f,c)),ee=!!(h&&xa(A,h,c))||W||Q||!y&&!m&&X||y&&m===!1&&X,ye=b(A,C);X&&B.outside.push(E),ae&&B.disabled.push(E),ee&&B.hidden.push(E),ye&&B.today.push(E),p&&Object.keys(p).forEach(fe=>{const Ce=p?.[fe];Ce&&xa(A,Ce,c)&&(I[fe]?I[fe].push(E):I[fe]=[E])})}return E=>{const A={[rt.focused]:!1,[rt.disabled]:!1,[rt.hidden]:!1,[rt.outside]:!1,[rt.today]:!1},z={};for(const X in B){const W=B[X];A[X]=W.some(Q=>Q===E)}for(const X in I)z[X]=I[X].some(W=>W===E);return{...A,...z}}}function BD(n,a,s={}){return Object.entries(n).filter(([,c])=>c===!0).reduce((c,[f])=>(s[f]?c.push(s[f]):a[rt[f]]?c.push(a[rt[f]]):a[Dn[f]]&&c.push(a[Dn[f]]),c),[a[me.Day]])}function KD(n){return{...UD,...n}}function qD(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(([s,l])=>{s.startsWith("data-")&&(a[s]=l)}),a}function GD(){const n={};for(const a in me)n[me[a]]=`rdp-${me[a]}`;for(const a in rt)n[rt[a]]=`rdp-${rt[a]}`;for(const a in Dn)n[Dn[a]]=`rdp-${Dn[a]}`;for(const a in un)n[un[a]]=`rdp-${un[a]}`;return n}function mx(n,a,s){return(s??new dn(a)).formatMonthYear(n)}const YD=mx;function FD(n,a,s){return(s??new dn(a)).format(n,"d")}function VD(n,a=Gn){return a.format(n,"LLLL")}function QD(n,a,s){return(s??new dn(a)).format(n,"cccccc")}function WD(n,a=Gn){return n<10?a.formatNumber(`0${n.toLocaleString()}`):a.formatNumber(`${n.toLocaleString()}`)}function $D(){return""}function gx(n,a=Gn){return a.format(n,"yyyy")}const XD=gx,ZD=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:mx,formatDay:FD,formatMonthCaption:YD,formatMonthDropdown:VD,formatWeekNumber:WD,formatWeekNumberHeader:$D,formatWeekdayName:QD,formatYearCaption:XD,formatYearDropdown:gx},Symbol.toStringTag,{value:"Module"}));function JD(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...ZD,...n}}function yf(n,a,s,l){let c=(l??new dn(s)).format(n,"PPPP");return a.today&&(c=`Today, ${c}`),a.selected&&(c=`${c}, selected`),c}const eM=yf;function bf(n,a,s){return(s??new dn(a)).formatMonthYear(n)}const tM=bf;function yx(n,a,s,l){let c=(l??new dn(s)).format(n,"PPPP");return a?.today&&(c=`Today, ${c}`),c}function bx(n){return"Choose the Month"}function xx(){return""}const nM="Go to the Next Month";function vx(n,a){return nM}function Sx(n){return"Go to the Previous Month"}function Cx(n,a,s){return(s??new dn(a)).format(n,"cccc")}function wx(n,a){return`Week ${n}`}function Nx(n){return"Week Number"}function Ax(n){return"Choose the Year"}const aM=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:tM,labelDay:eM,labelDayButton:yf,labelGrid:bf,labelGridcell:yx,labelMonthDropdown:bx,labelNav:xx,labelNext:vx,labelPrevious:Sx,labelWeekNumber:wx,labelWeekNumberHeader:Nx,labelWeekday:Cx,labelYearDropdown:Ax},Symbol.toStringTag,{value:"Module"})),Tn=(n,a,s)=>a||(s?typeof s=="function"?s:(...l)=>s:n);function iM(n,a){const s=a.locale?.labels??{};return{...aM,...n??{},labelDayButton:Tn(yf,n?.labelDayButton,s.labelDayButton),labelMonthDropdown:Tn(bx,n?.labelMonthDropdown,s.labelMonthDropdown),labelNext:Tn(vx,n?.labelNext,s.labelNext),labelPrevious:Tn(Sx,n?.labelPrevious,s.labelPrevious),labelWeekNumber:Tn(wx,n?.labelWeekNumber,s.labelWeekNumber),labelYearDropdown:Tn(Ax,n?.labelYearDropdown,s.labelYearDropdown),labelGrid:Tn(bf,n?.labelGrid,s.labelGrid),labelGridcell:Tn(yx,n?.labelGridcell,s.labelGridcell),labelNav:Tn(xx,n?.labelNav,s.labelNav),labelWeekNumberHeader:Tn(Nx,n?.labelWeekNumberHeader,s.labelWeekNumberHeader),labelWeekday:Tn(Cx,n?.labelWeekday,s.labelWeekday)}}function oM(n,a,s,l,c){const{startOfMonth:f,startOfYear:h,endOfYear:p,eachMonthOfInterval:m,getMonth:y}=c;return m({start:h(n),end:p(n)}).map(v=>{const N=l.formatMonthDropdown(v,c),w=y(v),M=a&&v<f(a)||s&&v>f(s)||!1;return{value:w,label:N,disabled:M}})}function sM(n,a={},s={}){let l={...a?.[me.Day]};return Object.entries(n).filter(([,c])=>c===!0).forEach(([c])=>{l={...l,...s?.[c]}}),l}function lM(n,a,s,l){const c=l??n.today(),f=s?n.startOfBroadcastWeek(c,n):a?n.startOfISOWeek(c):n.startOfWeek(c),h=[];for(let p=0;p<7;p++){const m=n.addDays(f,p);h.push(m)}return h}function rM(n,a,s,l,c=!1){if(!n||!a)return;const{startOfYear:f,endOfYear:h,eachYearOfInterval:p,getYear:m}=l,y=f(n),C=h(a),b=p({start:y,end:C});return c&&b.reverse(),b.map(v=>{const N=s.formatYearDropdown(v,l);return{value:m(v),label:N,disabled:!1}})}const Us=n=>n instanceof HTMLElement?n:null,dd=n=>[...n.querySelectorAll("[data-animated-month]")??[]],cM=n=>Us(n.querySelector("[data-animated-month]")),fd=n=>Us(n.querySelector("[data-animated-caption]")),hd=n=>Us(n.querySelector("[data-animated-weeks]")),uM=n=>Us(n.querySelector("[data-animated-nav]")),dM=n=>Us(n.querySelector("[data-animated-weekdays]"));function fM(n,a,{classNames:s,months:l,focused:c,dateLib:f}){const h=S.useRef(null),p=S.useRef(l),m=S.useRef(!1);S.useLayoutEffect(()=>{const y=p.current;if(p.current=l,!a||!n.current||!(n.current instanceof HTMLElement)||l.length===0||y.length===0||l.length!==y.length)return;const C=f.isSameMonth(l[0].date,y[0].date),b=f.isAfter(l[0].date,y[0].date),v=b?s[un.caption_after_enter]:s[un.caption_before_enter],N=b?s[un.weeks_after_enter]:s[un.weeks_before_enter],w=h.current,M=n.current.cloneNode(!0);if(M instanceof HTMLElement?(dd(M).forEach(B=>{if(!(B instanceof HTMLElement))return;const I=cM(B);I&&B.contains(I)&&B.removeChild(I);const E=fd(B);E&&E.classList.remove(v);const A=hd(B);A&&A.classList.remove(N)}),h.current=M):h.current=null,m.current||C||c)return;const O=w instanceof HTMLElement?dd(w):[],D=dd(n.current);if(D?.every(H=>H instanceof HTMLElement)&&O&&O.every(H=>H instanceof HTMLElement)){m.current=!0,n.current.style.isolation="isolate";const H=uM(n.current);H&&(H.style.zIndex="1"),D.forEach((B,I)=>{const E=O[I];if(!E)return;B.style.position="relative",B.style.overflow="hidden";const A=fd(B);A&&A.classList.add(v);const z=hd(B);z&&z.classList.add(N);const X=()=>{m.current=!1,n.current&&(n.current.style.isolation=""),H&&(H.style.zIndex=""),A&&A.classList.remove(v),z&&z.classList.remove(N),B.style.position="",B.style.overflow="",B.contains(E)&&B.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const W=dM(E);W&&(W.style.opacity="0");const Q=fd(E);Q&&(Q.classList.add(b?s[un.caption_before_exit]:s[un.caption_after_exit]),Q.addEventListener("animationend",X));const ae=hd(E);ae&&ae.classList.add(b?s[un.weeks_before_exit]:s[un.weeks_after_exit]),B.insertBefore(E,B.firstChild)})}})}function hM(n,a,s,l){const c=n[0],f=n[n.length-1],{ISOWeek:h,fixedWeeks:p,broadcastCalendar:m}=s??{},{addDays:y,differenceInCalendarDays:C,differenceInCalendarMonths:b,endOfBroadcastWeek:v,endOfISOWeek:N,endOfMonth:w,endOfWeek:M,isAfter:O,startOfBroadcastWeek:D,startOfISOWeek:H,startOfWeek:B}=l,I=m?D(c,l):h?H(c):B(c),E=m?v(f):h?N(w(f)):M(w(f)),A=a&&(m?v(a):h?N(a):M(a)),z=A&&O(E,A)?A:E,X=C(z,I),W=b(f,c)+1,Q=[];for(let ye=0;ye<=X;ye++){const fe=y(I,ye);Q.push(fe)}const ee=(m?35:42)*W;if(p&&Q.length<ee){const ye=ee-Q.length;for(let fe=0;fe<ye;fe++){const Ce=y(Q[Q.length-1],1);Q.push(Ce)}}return Q}function pM(n){const a=[];return n.reduce((s,l)=>{const c=l.weeks.reduce((f,h)=>f.concat(h.days.slice()),a.slice());return s.concat(c.slice())},a.slice())}function mM(n,a,s,l){const{numberOfMonths:c=1}=s,f=[];for(let h=0;h<c;h++){const p=l.addMonths(n,h);if(a&&p>a)break;f.push(p)}return f}function Sy(n,a,s,l){const{month:c,defaultMonth:f,today:h=l.today(),numberOfMonths:p=1}=n;let m=c||f||h;const{differenceInCalendarMonths:y,addMonths:C,startOfMonth:b}=l;if(s&&y(s,m)<p-1){const v=-1*(p-1);m=C(s,v)}return a&&y(m,a)<0&&(m=a),b(m)}function gM(n,a,s,l){const{addDays:c,endOfBroadcastWeek:f,endOfISOWeek:h,endOfMonth:p,endOfWeek:m,getISOWeek:y,getWeek:C,startOfBroadcastWeek:b,startOfISOWeek:v,startOfWeek:N}=l,w=n.reduce((M,O)=>{const D=s.broadcastCalendar?b(O,l):s.ISOWeek?v(O):N(O),H=s.broadcastCalendar?f(O):s.ISOWeek?h(p(O)):m(p(O)),B=a.filter(z=>z>=D&&z<=H),I=s.broadcastCalendar?35:42;if(s.fixedWeeks&&B.length<I){const z=a.filter(X=>{const W=I-B.length;return X>H&&X<=c(H,W)});B.push(...z)}const E=B.reduce((z,X)=>{const W=s.ISOWeek?y(X):C(X),Q=z.find(ee=>ee.weekNumber===W),ae=new dx(X,O,l);return Q?Q.days.push(ae):z.push(new fD(W,[ae])),z},[]),A=new dD(O,E);return M.push(A),M},[]);return s.reverseMonths?w.reverse():w}function yM(n,a){let{startMonth:s,endMonth:l}=n;const{startOfYear:c,startOfDay:f,startOfMonth:h,endOfMonth:p,addYears:m,endOfYear:y,newDate:C,today:b}=a,{fromYear:v,toYear:N,fromMonth:w,toMonth:M}=n;!s&&w&&(s=w),!s&&v&&(s=a.newDate(v,0,1)),!l&&M&&(l=M),!l&&N&&(l=C(N,11,31));const O=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return s?s=h(s):v?s=C(v,0,1):!s&&O&&(s=c(m(n.today??b(),-100))),l?l=p(l):N?l=C(N,11,31):!l&&O&&(l=y(n.today??b())),[s&&f(s),l&&f(l)]}function bM(n,a,s,l){if(s.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:f=1}=s,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:m}=l,y=c?f:1,C=h(n);if(!a)return p(C,y);if(!(m(a,n)<f))return p(C,y)}function xM(n,a,s,l){if(s.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:f}=s,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:m}=l,y=c?f??1:1,C=h(n);if(!a)return p(C,-y);if(!(m(C,a)<=0))return p(C,-y)}function vM(n){const a=[];return n.reduce((s,l)=>s.concat(l.weeks.slice()),a.slice())}function zr(n,a){const[s,l]=S.useState(n);return[a===void 0?s:a,l]}function SM(n,a){const[s,l]=yM(n,a),{startOfMonth:c,endOfMonth:f}=a,h=Sy(n,s,l,a),[p,m]=zr(h,n.month?h:void 0);S.useEffect(()=>{const I=Sy(n,s,l,a);m(I)},[n.timeZone]);const{months:y,weeks:C,days:b,previousMonth:v,nextMonth:N}=S.useMemo(()=>{const I=mM(p,l,{numberOfMonths:n.numberOfMonths},a),E=hM(I,n.endMonth?f(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},a),A=gM(I,E,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},a),z=vM(A),X=pM(A),W=xM(p,s,n,a),Q=bM(p,l,n,a);return{months:A,weeks:z,days:X,previousMonth:W,nextMonth:Q}},[a,p.getTime(),l?.getTime(),s?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:w,onMonthChange:M}=n,O=I=>C.some(E=>E.days.some(A=>A.isEqualTo(I))),D=I=>{if(w)return;let E=c(I);s&&E<c(s)&&(E=c(s)),l&&E>c(l)&&(E=c(l)),m(E),M?.(E)};return{months:y,weeks:C,days:b,navStart:s,navEnd:l,previousMonth:v,nextMonth:N,goToMonth:D,goToDay:I=>{O(I)||D(I.date)}}}var Un;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(Un||(Un={}));function Cy(n){return!n[rt.disabled]&&!n[rt.hidden]&&!n[rt.outside]}function CM(n,a,s,l){let c,f=-1;for(const h of n){const p=a(h);Cy(p)&&(p[rt.focused]&&f<Un.FocusedModifier?(c=h,f=Un.FocusedModifier):l?.isEqualTo(h)&&f<Un.LastFocused?(c=h,f=Un.LastFocused):s(h.date)&&f<Un.Selected?(c=h,f=Un.Selected):p[rt.today]&&f<Un.Today&&(c=h,f=Un.Today))}return c||(c=n.find(h=>Cy(a(h)))),c}function wM(n,a,s,l,c,f,h){const{ISOWeek:p,broadcastCalendar:m}=f,{addDays:y,addMonths:C,addWeeks:b,addYears:v,endOfBroadcastWeek:N,endOfISOWeek:w,endOfWeek:M,max:O,min:D,startOfBroadcastWeek:H,startOfISOWeek:B,startOfWeek:I}=h;let A={day:y,week:b,month:C,year:v,startOfWeek:z=>m?H(z,h):p?B(z):I(z),endOfWeek:z=>m?N(z):p?w(z):M(z)}[n](s,a==="after"?1:-1);return a==="before"&&l?A=O([l,A]):a==="after"&&c&&(A=D([c,A])),A}function kx(n,a,s,l,c,f,h,p=0){if(p>365)return;const m=wM(n,a,s.date,l,c,f,h),y=!!(f.disabled&&xa(m,f.disabled,h)),C=!!(f.hidden&&xa(m,f.hidden,h)),b=m,v=new dx(m,b,h);return!y&&!C?v:kx(n,a,v,l,c,f,h,p+1)}function NM(n,a,s,l,c){const{autoFocus:f}=n,[h,p]=S.useState(),m=CM(a.days,s,l||(()=>!1),h),[y,C]=S.useState(f?m:void 0);return{isFocusTarget:M=>!!m?.isEqualTo(M),setFocused:C,focused:y,blur:()=>{p(y),C(void 0)},moveFocus:(M,O)=>{if(!y)return;const D=kx(M,O,y,a.navStart,a.navEnd,n,c);D&&(n.disableNavigation&&!a.days.some(B=>B.isEqualTo(D))||(a.goToDay(D),C(D)))}}}function AM(n,a){const{selected:s,required:l,onSelect:c}=n,[f,h]=zr(s,c?s:void 0),p=c?s:f,{isSameDay:m}=a,y=N=>p?.some(w=>m(w,N))??!1,{min:C,max:b}=n;return{selected:p,select:(N,w,M)=>{let O=[...p??[]];if(y(N)){if(p?.length===C||l&&p?.length===1)return;O=p?.filter(D=>!m(D,N))}else p?.length===b?O=[N]:O=[...O,N];return c||h(O),c?.(O,N,w,M),O},isSelected:y}}function kM(n,a,s=0,l=0,c=!1,f=Gn){const{from:h,to:p}=a||{},{isSameDay:m,isAfter:y,isBefore:C}=f;let b;if(!h&&!p)b={from:n,to:s>0?void 0:n};else if(h&&!p)m(h,n)?s===0?b={from:h,to:n}:c?b={from:h,to:void 0}:b=void 0:C(n,h)?b={from:n,to:h}:b={from:h,to:n};else if(h&&p)if(m(h,n)&&m(p,n))c?b={from:h,to:p}:b=void 0;else if(m(h,n))b={from:h,to:s>0?void 0:n};else if(m(p,n))b={from:n,to:s>0?void 0:n};else if(C(n,h))b={from:n,to:p};else if(y(n,h))b={from:h,to:n};else if(y(n,p))b={from:h,to:n};else throw new Error("Invalid range");if(b?.from&&b?.to){const v=f.differenceInCalendarDays(b.to,b.from);l>0&&v>l?b={from:n,to:void 0}:s>1&&v<s&&(b={from:n,to:void 0})}return b}function TM(n,a,s=Gn){const l=Array.isArray(a)?a:[a];let c=n.from;const f=s.differenceInCalendarDays(n.to,n.from),h=Math.min(f,6);for(let p=0;p<=h;p++){if(l.includes(c.getDay()))return!0;c=s.addDays(c,1)}return!1}function wy(n,a,s=Gn){return ba(n,a.from,!1,s)||ba(n,a.to,!1,s)||ba(a,n.from,!1,s)||ba(a,n.to,!1,s)}function DM(n,a,s=Gn){const l=Array.isArray(a)?a:[a];if(l.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:s.isDate(p)?ba(n,p,!1,s):px(p,s)?p.some(m=>ba(n,m,!1,s)):_r(p)?p.from&&p.to?wy(n,{from:p.from,to:p.to},s):!1:hx(p)?TM(n,p.dayOfWeek,s):pf(p)?s.isAfter(p.before,p.after)?wy(n,{from:s.addDays(p.after,1),to:s.addDays(p.before,-1)},s):xa(n.from,p,s)||xa(n.to,p,s):mf(p)||gf(p)?xa(n.from,p,s)||xa(n.to,p,s):!1))return!0;const h=l.filter(p=>typeof p=="function");if(h.length){let p=n.from;const m=s.differenceInCalendarDays(n.to,n.from);for(let y=0;y<=m;y++){if(h.some(C=>C(p)))return!0;p=s.addDays(p,1)}}return!1}function MM(n,a){const{disabled:s,excludeDisabled:l,selected:c,required:f,onSelect:h}=n,[p,m]=zr(c,h?c:void 0),y=h?c:p;return{selected:y,select:(v,N,w)=>{const{min:M,max:O}=n,D=v?kM(v,y,M,O,f,a):void 0;return l&&s&&D?.from&&D.to&&DM({from:D.from,to:D.to},s,a)&&(D.from=v,D.to=void 0),h||m(D),h?.(D,v,N,w),D},isSelected:v=>y&&ba(y,v,!1,a)}}function jM(n,a){const{selected:s,required:l,onSelect:c}=n,[f,h]=zr(s,c?s:void 0),p=c?s:f,{isSameDay:m}=a;return{selected:p,select:(b,v,N)=>{let w=b;return!l&&p&&p&&m(b,p)&&(w=void 0),c||h(w),c?.(w,b,v,N),w},isSelected:b=>p?m(p,b):!1}}function OM(n,a){const s=jM(n,a),l=AM(n,a),c=MM(n,a);switch(n.mode){case"single":return s;case"multiple":return l;case"range":return c;default:return}}function Rt(n,a){return n instanceof ya&&n.timeZone===a?n:new ya(n,a)}function Ny(n,a){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?Rt(n,a):Array.isArray(n)?n.map(s=>s instanceof Date?Rt(s,a):s):_r(n)?{...n,from:n.from?Rt(n.from,a):n.from,to:n.to?Rt(n.to,a):n.to}:pf(n)?{before:Rt(n.before,a),after:Rt(n.after,a)}:mf(n)?{after:Rt(n.after,a)}:gf(n)?{before:Rt(n.before,a)}:n}function pd(n,a){return n&&(Array.isArray(n)?n.map(s=>Ny(s,a)):Ny(n,a))}function EM(n){let a=n;const s=a.timeZone;if(s&&(a={...n,timeZone:s},a.today&&(a.today=Rt(a.today,s)),a.month&&(a.month=Rt(a.month,s)),a.defaultMonth&&(a.defaultMonth=Rt(a.defaultMonth,s)),a.startMonth&&(a.startMonth=Rt(a.startMonth,s)),a.endMonth&&(a.endMonth=Rt(a.endMonth,s)),a.mode==="single"&&a.selected?a.selected=Rt(a.selected,s):a.mode==="multiple"&&a.selected?a.selected=a.selected?.map(pe=>Rt(pe,s)):a.mode==="range"&&a.selected&&(a.selected={from:a.selected.from?Rt(a.selected.from,s):a.selected.from,to:a.selected.to?Rt(a.selected.to,s):a.selected.to}),a.disabled!==void 0&&(a.disabled=pd(a.disabled,s)),a.hidden!==void 0&&(a.hidden=pd(a.hidden,s)),a.modifiers)){const pe={};Object.keys(a.modifiers).forEach(ke=>{pe[ke]=pd(a.modifiers?.[ke],s)}),a.modifiers=pe}const{components:l,formatters:c,labels:f,dateLib:h,locale:p,classNames:m}=S.useMemo(()=>{const pe={...ux,...a.locale},ke=new dn({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:ke,components:KD(a.components),formatters:JD(a.formatters),labels:iM(a.labels,ke.options),locale:pe,classNames:{...GD(),...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:h.today()});const{captionLayout:y,mode:C,navLayout:b,numberOfMonths:v=1,onDayBlur:N,onDayClick:w,onDayFocus:M,onDayKeyDown:O,onDayMouseEnter:D,onDayMouseLeave:H,onNextClick:B,onPrevClick:I,showWeekNumber:E,styles:A}=a,{formatCaption:z,formatDay:X,formatMonthDropdown:W,formatWeekNumber:Q,formatWeekNumberHeader:ae,formatWeekdayName:ee,formatYearDropdown:ye}=c,fe=SM(a,h),{days:Ce,months:P,navStart:F,navEnd:ie,previousMonth:$,nextMonth:se,goToMonth:ne}=fe,Ne=HD(Ce,a,F,ie,h),{isSelected:V,select:J,selected:ce}=OM(a,h)??{},{blur:te,focused:le,isFocusTarget:be,moveFocus:Re,setFocused:Ye}=NM(a,fe,Ne,V??(()=>!1),h),{labelDayButton:St,labelGridcell:Ct,labelGrid:Ve,labelMonthDropdown:ot,labelNav:It,labelPrevious:Qt,labelNext:Yn,labelWeekday:Te,labelWeekNumber:Wt,labelWeekNumberHeader:On,labelYearDropdown:$t}=f,Sa=S.useMemo(()=>lM(h,a.ISOWeek,a.broadcastCalendar,a.today),[h,a.ISOWeek,a.broadcastCalendar,a.today]),Fn=C!==void 0||w!==void 0,pt=S.useCallback(()=>{$&&(ne($),I?.($))},[$,ne,I]),Xt=S.useCallback(()=>{se&&(ne(se),B?.(se))},[ne,se,B]),Vn=S.useCallback((pe,ke)=>ve=>{ve.preventDefault(),ve.stopPropagation(),Ye(pe),!ke.disabled&&(J?.(pe.date,ke,ve),w?.(pe.date,ke,ve))},[J,w,Ye]),ei=S.useCallback((pe,ke)=>ve=>{Ye(pe),M?.(pe.date,ke,ve)},[M,Ye]),En=S.useCallback((pe,ke)=>ve=>{te(),N?.(pe.date,ke,ve)},[te,N]),Pn=S.useCallback((pe,ke)=>ve=>{const Ee={ArrowLeft:[ve.shiftKey?"month":"day",a.dir==="rtl"?"after":"before"],ArrowRight:[ve.shiftKey?"month":"day",a.dir==="rtl"?"before":"after"],ArrowDown:[ve.shiftKey?"year":"week","after"],ArrowUp:[ve.shiftKey?"year":"week","before"],PageUp:[ve.shiftKey?"year":"month","before"],PageDown:[ve.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ee[ve.key]){ve.preventDefault(),ve.stopPropagation();const[tt,we]=Ee[ve.key];Re(tt,we)}O?.(pe.date,ke,ve)},[Re,O,a.dir]),Ti=S.useCallback((pe,ke)=>ve=>{D?.(pe.date,ke,ve)},[D]),wo=S.useCallback((pe,ke)=>ve=>{H?.(pe.date,ke,ve)},[H]),No=S.useCallback(pe=>ke=>{const ve=Number(ke.target.value),Ee=h.setMonth(h.startOfMonth(pe),ve);ne(Ee)},[h,ne]),Qn=S.useCallback(pe=>ke=>{const ve=Number(ke.target.value),Ee=h.setYear(h.startOfMonth(pe),ve);ne(Ee)},[h,ne]),{className:Z,style:je}=S.useMemo(()=>({className:[m[me.Root],a.className].filter(Boolean).join(" "),style:{...A?.[me.Root],...a.style}}),[m,a.className,a.style,A]),xe=qD(a),Oe=S.useRef(null);fM(Oe,!!a.animate,{classNames:m,months:P,focused:le,dateLib:h});const st={dayPickerProps:a,selected:ce,select:J,isSelected:V,months:P,nextMonth:se,previousMonth:$,goToMonth:ne,getModifiers:Ne,components:l,classNames:m,styles:A,labels:f,formatters:c};return oe.createElement(fx.Provider,{value:st},oe.createElement(l.Root,{rootRef:a.animate?Oe:void 0,className:Z,style:je,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"],...xe},oe.createElement(l.Months,{className:m[me.Months],style:A?.[me.Months]},!a.hideNavigation&&!b&&oe.createElement(l.Nav,{"data-animated-nav":a.animate?"true":void 0,className:m[me.Nav],style:A?.[me.Nav],"aria-label":It(),onPreviousClick:pt,onNextClick:Xt,previousMonth:$,nextMonth:se}),P.map((pe,ke)=>oe.createElement(l.Month,{"data-animated-month":a.animate?"true":void 0,className:m[me.Month],style:A?.[me.Month],key:ke,displayIndex:ke,calendarMonth:pe},b==="around"&&!a.hideNavigation&&ke===0&&oe.createElement(l.PreviousMonthButton,{type:"button",className:m[me.PreviousMonthButton],tabIndex:$?void 0:-1,"aria-disabled":$?void 0:!0,"aria-label":Qt($),onClick:pt,"data-animated-button":a.animate?"true":void 0},oe.createElement(l.Chevron,{disabled:$?void 0:!0,className:m[me.Chevron],orientation:a.dir==="rtl"?"right":"left"})),oe.createElement(l.MonthCaption,{"data-animated-caption":a.animate?"true":void 0,className:m[me.MonthCaption],style:A?.[me.MonthCaption],calendarMonth:pe,displayIndex:ke},y?.startsWith("dropdown")?oe.createElement(l.DropdownNav,{className:m[me.Dropdowns],style:A?.[me.Dropdowns]},(()=>{const ve=y==="dropdown"||y==="dropdown-months"?oe.createElement(l.MonthsDropdown,{key:"month",className:m[me.MonthsDropdown],"aria-label":ot(),classNames:m,components:l,disabled:!!a.disableNavigation,onChange:No(pe.date),options:oM(pe.date,F,ie,c,h),style:A?.[me.Dropdown],value:h.getMonth(pe.date)}):oe.createElement("span",{key:"month"},W(pe.date,h)),Ee=y==="dropdown"||y==="dropdown-years"?oe.createElement(l.YearsDropdown,{key:"year",className:m[me.YearsDropdown],"aria-label":$t(h.options),classNames:m,components:l,disabled:!!a.disableNavigation,onChange:Qn(pe.date),options:rM(F,ie,c,h,!!a.reverseYears),style:A?.[me.Dropdown],value:h.getYear(pe.date)}):oe.createElement("span",{key:"year"},ye(pe.date,h));return h.getMonthYearOrder()==="year-first"?[Ee,ve]:[ve,Ee]})(),oe.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"}},z(pe.date,h.options,h))):oe.createElement(l.CaptionLabel,{className:m[me.CaptionLabel],role:"status","aria-live":"polite"},z(pe.date,h.options,h))),b==="around"&&!a.hideNavigation&&ke===v-1&&oe.createElement(l.NextMonthButton,{type:"button",className:m[me.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":Yn(se),onClick:Xt,"data-animated-button":a.animate?"true":void 0},oe.createElement(l.Chevron,{disabled:se?void 0:!0,className:m[me.Chevron],orientation:a.dir==="rtl"?"left":"right"})),ke===v-1&&b==="after"&&!a.hideNavigation&&oe.createElement(l.Nav,{"data-animated-nav":a.animate?"true":void 0,className:m[me.Nav],style:A?.[me.Nav],"aria-label":It(),onPreviousClick:pt,onNextClick:Xt,previousMonth:$,nextMonth:se}),oe.createElement(l.MonthGrid,{role:"grid","aria-multiselectable":C==="multiple"||C==="range","aria-label":Ve(pe.date,h.options,h)||void 0,className:m[me.MonthGrid],style:A?.[me.MonthGrid]},!a.hideWeekdays&&oe.createElement(l.Weekdays,{"data-animated-weekdays":a.animate?"true":void 0,className:m[me.Weekdays],style:A?.[me.Weekdays]},E&&oe.createElement(l.WeekNumberHeader,{"aria-label":On(h.options),className:m[me.WeekNumberHeader],style:A?.[me.WeekNumberHeader],scope:"col"},ae()),Sa.map(ve=>oe.createElement(l.Weekday,{"aria-label":Te(ve,h.options,h),className:m[me.Weekday],key:String(ve),style:A?.[me.Weekday],scope:"col"},ee(ve,h.options,h)))),oe.createElement(l.Weeks,{"data-animated-weeks":a.animate?"true":void 0,className:m[me.Weeks],style:A?.[me.Weeks]},pe.weeks.map(ve=>oe.createElement(l.Week,{className:m[me.Week],key:ve.weekNumber,style:A?.[me.Week],week:ve},E&&oe.createElement(l.WeekNumber,{week:ve,style:A?.[me.WeekNumber],"aria-label":Wt(ve.weekNumber,{locale:p}),className:m[me.WeekNumber],scope:"row",role:"rowheader"},Q(ve.weekNumber,h)),ve.days.map(Ee=>{const{date:tt}=Ee,we=Ne(Ee);if(we[rt.focused]=!we.hidden&&!!le?.isEqualTo(Ee),we[Dn.selected]=V?.(tt)||we.selected,_r(ce)){const{from:Zt,to:wn}=ce;we[Dn.range_start]=!!(Zt&&wn&&h.isSameDay(tt,Zt)),we[Dn.range_end]=!!(Zt&&wn&&h.isSameDay(tt,wn)),we[Dn.range_middle]=ba(ce,tt,!0,h)}const Lt=sM(we,A,a.modifiersStyles),Wn=BD(we,m,a.modifiersClassNames),Nt=!Fn&&!we.hidden?Ct(tt,we,h.options,h):void 0;return oe.createElement(l.Day,{key:`${Ee.isoDate}_${Ee.displayMonthId}`,day:Ee,modifiers:we,className:Wn.join(" "),style:Lt,role:"gridcell","aria-selected":we.selected||void 0,"aria-label":Nt,"data-day":Ee.isoDate,"data-month":Ee.outside?Ee.dateMonthId:void 0,"data-selected":we.selected||void 0,"data-disabled":we.disabled||void 0,"data-hidden":we.hidden||void 0,"data-outside":Ee.outside||void 0,"data-focused":we.focused||void 0,"data-today":we.today||void 0},!we.hidden&&Fn?oe.createElement(l.DayButton,{className:m[me.DayButton],style:A?.[me.DayButton],type:"button",day:Ee,modifiers:we,disabled:!we.focused&&we.disabled||void 0,"aria-disabled":we.focused&&we.disabled||void 0,tabIndex:be(Ee)?0:-1,"aria-label":St(tt,we,h.options,h),onClick:Vn(Ee,we),onBlur:En(Ee,we),onFocus:ei(Ee,we),onKeyDown:Pn(Ee,we),onMouseEnter:Ti(Ee,we),onMouseLeave:wo(Ee,we)},X(tt,h.options,h)):!we.hidden&&X(Ee.date,h.options,h))})))))))),a.footer&&oe.createElement(l.Footer,{className:m[me.Footer],style:A?.[me.Footer],role:"status","aria-live":"polite"},a.footer)))}function PM({className:n,classNames:a,showOutsideDays:s=!0,...l}){return r.jsx(EM,{showOutsideDays:s,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(ar({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:K(ar({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(ar({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:f,...h})=>{const p=c==="left"?iC:c==="right"?yr:c==="up"?Ed:vr;return r.jsx(p,{className:K("h-4 w-4",f),...h})}},...l})}PM.displayName="Calendar";const RM=S.lazy(()=>ht(()=>Promise.resolve().then(()=>hf),void 0).then(n=>({default:n.CodeEditor})));function lO({rawJsonContent:n,isRawJsonValid:a,rawJsonEdits:s,rawSettingsEnv:l,onChange:c,missingRequiredFields:f=[]}){const h=f.length>0;return r.jsx(S.Suspense,{fallback:r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx(jn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:r.jsxs("div",{className:"h-full flex flex-col",children:[!a&&s!==null&&r.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:[r.jsx(vo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&h&&r.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:[r.jsx(qn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",r.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:r.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:r.jsx(RM,{value:n,onChange:c,language:"json",minHeight:"100%"})})}),r.jsx("div",{className:"mx-6 mb-4",children:r.jsx("div",{className:"border rounded-md overflow-hidden",children:r.jsx(df,{profileEnv:l})})})]})})}const rO={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},cO=[{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 ccsd alias or --target droid for one-off target overrides."],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-ccsd-command",label:"Run once with Droid alias",description:"Use ccsd to force Droid target with your current profile.",type:"command",command:"ccsd 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:["ccsd glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates inbox is available for rollout tasks",summary:"A focused updates inbox 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 inbox 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 Inbox",path:"/updates"}],commands:["ccs config"]}],LM=[{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:["ccsd glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccsd alias for automatic Droid target selection."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and target.",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 codex","ccs cliproxy create mycodex --provider 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."}],_M=new Map(LM.map(n=>[n.id,n]));function uO(n){return n.entryIds.map(a=>_M.get(a)).filter(a=>!!a)}function dO(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)}function zM(){const{t:n}=_t(),[a,s]=S.useState(""),[l,c]=S.useState(""),[f,h]=S.useState(null),[p,m]=S.useState(!1),{login:y,authRequired:C,isAuthenticated:b}=Id(),v=jd(),w=gr().state?.from?.pathname||"/";if(S.useEffect(()=>{(b||!C)&&v(w,{replace:!0})},[b,C,v,w]),b||!C)return null;const M=async O=>{O.preventDefault(),h(null),m(!0);try{await y(a,l),v(w,{replace:!0})}catch(D){h(D instanceof Error?D.message:n("auth.loginFailed"))}finally{m(!1)}};return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(PT,{className:"w-full max-w-sm",children:[r.jsxs(RT,{className:"space-y-1 text-center",children:[r.jsx("div",{className:"mx-auto mb-2 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:r.jsx(oC,{className:"h-6 w-6 text-primary"})}),r.jsx(LT,{className:"text-2xl",children:n("auth.dashboardTitle")}),r.jsx(_T,{children:n("auth.loginDescription")})]}),r.jsx(zT,{children:r.jsxs("form",{onSubmit:M,className:"space-y-4",children:[f&&r.jsxs(lf,{variant:"destructive",children:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsx(rf,{children:f})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(rn,{htmlFor:"username",children:n("auth.username")}),r.jsx(In,{id:"username",type:"text",value:a,onChange:O=>s(O.target.value),placeholder:n("auth.usernamePlaceholder"),autoComplete:"username",disabled:p,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(rn,{htmlFor:"password",children:n("auth.password")}),r.jsx(In,{id:"password",type:"password",value:l,onChange:O=>c(O.target.value),placeholder:n("auth.passwordPlaceholder"),autoComplete:"current-password",disabled:p,required:!0})]}),r.jsx(ft,{type:"submit",className:"w-full",disabled:p,children:p?r.jsxs(r.Fragment,{children:[r.jsx(jn,{className:"mr-2 h-4 w-4 animate-spin"}),n("auth.signingIn")]}):n("auth.signIn")})]})})]})})}const IM=S.lazy(()=>ht(()=>import("./index-Cy76XBS9.js"),__vite__mapDeps([18,1,2,4,5,7,19,6,8,9])).then(n=>({default:n.AnalyticsPage}))),UM=S.lazy(()=>ht(()=>import("./api-Du9rjWhx.js"),__vite__mapDeps([20,1,2,5,21,15,6,4,22,7,8,9])).then(n=>({default:n.ApiPage}))),HM=S.lazy(()=>ht(()=>import("./cliproxy-DS95Joc9.js"),__vite__mapDeps([23,1,2,5,13,6,4,14,15,24,21,22,3,7,8,9])).then(n=>({default:n.CliproxyPage}))),BM=S.lazy(()=>ht(()=>import("./cliproxy-control-panel-BNUMUGIt.js"),__vite__mapDeps([25,1,2,5,13,4,6,7,8,9])).then(n=>({default:n.CliproxyControlPanelPage}))),KM=S.lazy(()=>ht(()=>import("./copilot-p2K9Y5LR.js"),__vite__mapDeps([26,1,2,5,21,15,4,22,3,6,7,8,9])).then(n=>({default:n.CopilotPage}))),qM=S.lazy(()=>ht(()=>import("./cursor-5SbcR5sW.js"),__vite__mapDeps([27,1,2,6,5,13,3,22,4,7,8,9])).then(n=>({default:n.CursorPage}))),GM=S.lazy(()=>ht(()=>import("./claude-extension-CUlLIos9.js"),__vite__mapDeps([28,1,2,5,6,4,7,8,9])).then(n=>({default:n.ClaudeExtensionPage}))),YM=S.lazy(()=>ht(()=>import("./droid-DxdiLHHD.js"),__vite__mapDeps([29,1,2,6,5,4,22,7,8,9])).then(n=>({default:n.DroidPage}))),FM=S.lazy(()=>ht(()=>import("./accounts-CrNRfOOP.js"),__vite__mapDeps([30,1,2,5,15,6,4,24,7,8,9])).then(n=>({default:n.AccountsPage}))),VM=S.lazy(()=>ht(()=>Promise.resolve().then(()=>nD),void 0).then(n=>({default:n.SettingsPage}))),QM=S.lazy(()=>ht(()=>import("./health-DDs2IlMm.js"),__vite__mapDeps([31,1,2,5,6,4,7,8,9])).then(n=>({default:n.HealthPage}))),WM=S.lazy(()=>ht(()=>import("./shared-BwP9MOQi.js"),__vite__mapDeps([32,1,2,4,5,6,7,8,9])).then(n=>({default:n.SharedPage}))),$M=S.lazy(()=>ht(()=>import("./updates--SN_PZnJ.js"),__vite__mapDeps([33,1,2,4,5,6,7,8,9])).then(n=>({default:n.UpdatesPage})));function ln(){return r.jsx("div",{className:"flex h-64 items-center justify-center",children:r.jsx(jn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function XM(){return r.jsx(NS,{client:JC,children:r.jsx(Vw,{defaultTheme:"system",storageKey:"vite-ui-theme",children:r.jsx(Qw,{children:r.jsx(Jw,{children:r.jsxs(SS,{children:[r.jsxs(CS,{children:[r.jsx(Pt,{path:"/login",element:r.jsx(zM,{})}),r.jsx(Pt,{element:r.jsx(eN,{}),children:r.jsxs(Pt,{element:r.jsx(JA,{}),children:[r.jsx(Pt,{path:"/",element:r.jsx(Xk,{})}),r.jsx(Pt,{path:"/analytics",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(IM,{})})}),r.jsx(Pt,{path:"/updates",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx($M,{})})}),r.jsx(Pt,{path:"/providers",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(UM,{})})}),r.jsx(Pt,{path:"/cliproxy",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(HM,{})})}),r.jsx(Pt,{path:"/cliproxy/control-panel",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(BM,{})})}),r.jsx(Pt,{path:"/copilot",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(KM,{})})}),r.jsx(Pt,{path:"/cursor",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(qM,{})})}),r.jsx(Pt,{path:"/claude-extension",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(GM,{})})}),r.jsx(Pt,{path:"/droid",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(YM,{})})}),r.jsx(Pt,{path:"/accounts",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(FM,{})})}),r.jsx(Pt,{path:"/settings",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(VM,{})})}),r.jsx(Pt,{path:"/health",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(QM,{})})}),r.jsx(Pt,{path:"/shared",element:r.jsx(S.Suspense,{fallback:r.jsx(ln,{}),children:r.jsx(WM,{})})})]})})]}),r.jsx(AS,{position:"top-right"})]})})})})})}const Tx=document.getElementById("root");if(!Tx)throw new Error("Root element not found. Failed to mount React application.");$C.createRoot(Tx).render(r.jsx(S.StrictMode,{children:r.jsx(XM,{})}));export{Vj as $,nT as A,Wa as B,PT as C,rT as D,Bj as E,qj as F,Jk as G,sT as H,In as I,cT as J,Kj as K,rn as L,nA as M,aA as N,iA as O,ub as P,$b as Q,cf as R,Ge as S,$a as T,pr as U,kd as V,He as W,Fj as X,Be as Y,Yj as Z,_T as _,_t as a,yj as a$,Qj as a0,Wj as a1,$j as a2,Xj as a3,Zj as a4,Jj as a5,Jb as a6,eO as a7,lj as a8,ZN as a9,vN as aA,SN as aB,Mr as aC,Dr as aD,jr as aE,pb as aF,Ci as aG,UA as aH,HA as aI,BA as aJ,KA as aK,hb as aL,j1 as aM,Nb as aN,Sj as aO,Cj as aP,wj as aQ,Nj as aR,aO as aS,uj as aT,tA as aU,hj as aV,pj as aW,JN as aX,eA as aY,mj as aZ,gj as a_,dj as aa,bj as ab,xj as ac,qd as ad,Gd as ae,Yd as af,Fd as ag,Vd as ah,tO as ai,UT as aj,nO as ak,Ja as al,Rj as am,HT as an,_j as ao,vj as ap,Lj as aq,zj as ar,qg as as,Ij as at,GA as au,CA as av,Ej as aw,jA as ax,Pj as ay,T1 as az,zT as b,fj as b0,Xd as b1,ws as b2,rj as b3,cj as b4,lf as b5,Fb as b6,rf as b7,lO as b8,ix as b9,Tj as bA,Oj as bB,jj as bC,ar as bD,of as ba,Rs as bb,sf as bc,Qk as bd,Uj as be,Hj as bf,dO as bg,rO as bh,cO as bi,uO as bj,sx as bk,XT as bl,JT as bm,Dj as bn,Aj as bo,ab as bp,Ew as bq,jw as br,bd as bs,Ni as bt,Cw as bu,Nw as bv,Dw as bw,Rw as bx,Mj as by,kj as bz,K as c,ft as d,iO as e,oO as f,aD as g,PM as h,sj as i,RT as j,LT as k,m1 as l,g1 as m,So as n,sO as o,Xa as p,Za as q,xb as r,Zd as s,vb as t,_d as u,Jd as v,dr as w,ny as x,fT as y,Gj as z};
|