@kaitranntt/ccs 7.77.1-dev.8 → 7.77.1-dev.9

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.
Files changed (58) hide show
  1. package/dist/cliproxy/ai-providers/codex-plan-compatibility.d.ts.map +1 -1
  2. package/dist/cliproxy/ai-providers/codex-plan-compatibility.js +2 -2
  3. package/dist/cliproxy/ai-providers/codex-plan-compatibility.js.map +1 -1
  4. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts +8 -2
  5. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts.map +1 -1
  6. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js +82 -33
  7. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js.map +1 -1
  8. package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts +1 -1
  9. package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts.map +1 -1
  10. package/dist/cliproxy/ai-providers/model-id-normalizer.js +28 -11
  11. package/dist/cliproxy/ai-providers/model-id-normalizer.js.map +1 -1
  12. package/dist/cliproxy/config/thinking-config.d.ts.map +1 -1
  13. package/dist/cliproxy/config/thinking-config.js +9 -8
  14. package/dist/cliproxy/config/thinking-config.js.map +1 -1
  15. package/dist/cliproxy/model-catalog.d.ts +2 -0
  16. package/dist/cliproxy/model-catalog.d.ts.map +1 -1
  17. package/dist/cliproxy/model-catalog.js +2 -0
  18. package/dist/cliproxy/model-catalog.js.map +1 -1
  19. package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
  20. package/dist/commands/cliproxy/variant-subcommand.js +44 -12
  21. package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
  22. package/dist/ui/assets/{accounts-lNkLHFUi.js → accounts-DkID6f81.js} +1 -1
  23. package/dist/ui/assets/{alert-dialog-BOlM9Aos.js → alert-dialog-BM9gIsRp.js} +1 -1
  24. package/dist/ui/assets/{api-BWy6e4S8.js → api-0YJdilQb.js} +1 -1
  25. package/dist/ui/assets/{auth-section-DAnXkqYR.js → auth-section-C1ljCo7W.js} +1 -1
  26. package/dist/ui/assets/{backups-section-D7XUs1JS.js → backups-section-C-iLf1kg.js} +1 -1
  27. package/dist/ui/assets/{channels-BKV3tSfv.js → channels-DDSqllsQ.js} +1 -1
  28. package/dist/ui/assets/{checkbox-D1-_INjR.js → checkbox-5R1YTubE.js} +1 -1
  29. package/dist/ui/assets/{claude-extension-BwjQl7ol.js → claude-extension-CEGefl3-.js} +1 -1
  30. package/dist/ui/assets/cliproxy-R4kPUeL-.js +3 -0
  31. package/dist/ui/assets/{cliproxy-ai-providers-DQMqXzRz.js → cliproxy-ai-providers-DVF3FnXM.js} +1 -1
  32. package/dist/ui/assets/{cliproxy-control-panel-CH75qKU4.js → cliproxy-control-panel-CIsKyGK6.js} +1 -1
  33. package/dist/ui/assets/{codex-ClRFRCla.js → codex-BiEEUC4Y.js} +1 -1
  34. package/dist/ui/assets/{confirm-dialog-DXJ0kUrp.js → confirm-dialog-BhJV4F_d.js} +1 -1
  35. package/dist/ui/assets/{copilot-CMc1hybe.js → copilot-DgRLuQfV.js} +1 -1
  36. package/dist/ui/assets/{cursor-CXlPaY62.js → cursor-BuOjfajj.js} +1 -1
  37. package/dist/ui/assets/{droid-D0o0ta28.js → droid-BPiviAW2.js} +1 -1
  38. package/dist/ui/assets/{globalenv-section-Crb3uFp7.js → globalenv-section-DAqbiNI1.js} +1 -1
  39. package/dist/ui/assets/{health-CD_qC6wG.js → health-B_CfF7J0.js} +1 -1
  40. package/dist/ui/assets/{index-CL6vCSY9.js → index-BEGD-4HR.js} +1 -1
  41. package/dist/ui/assets/{index-HwlgKSWH.js → index-BJl0cazY.js} +2 -2
  42. package/dist/ui/assets/{index-Dhaeoa8x.js → index-Bc-AbZRU.js} +1 -1
  43. package/dist/ui/assets/{index-Co9qZEzY.js → index-BqR6NZDE.js} +1 -1
  44. package/dist/ui/assets/{index-CvFZqcdh.js → index-Cj4mWFVK.js} +1 -1
  45. package/dist/ui/assets/{index-4oChbCyf.js → index-CzKdWNe5.js} +1 -1
  46. package/dist/ui/assets/{index-Dk0xIiPX.js → index-LJitUhfE.js} +1 -1
  47. package/dist/ui/assets/{logs-BnlWbg68.js → logs-Lqv-I3_T.js} +1 -1
  48. package/dist/ui/assets/{masked-input-CslqD0_2.js → masked-input-CgCDYXYf.js} +1 -1
  49. package/dist/ui/assets/{proxy-status-widget-YonTNEFL.js → proxy-status-widget-Df-4cfdm.js} +1 -1
  50. package/dist/ui/assets/{raw-json-settings-editor-panel-5LcbOkxh.js → raw-json-settings-editor-panel-BpXdUisD.js} +1 -1
  51. package/dist/ui/assets/{searchable-select-DgyFlHas.js → searchable-select-DCOfw3f0.js} +1 -1
  52. package/dist/ui/assets/{separator-cIuCN-Pq.js → separator-Ct6a34bG.js} +1 -1
  53. package/dist/ui/assets/{shared-CbYgYS7o.js → shared-D-JFc_Cw.js} +1 -1
  54. package/dist/ui/assets/{table-CtOCg1DT.js → table-DsU2UX-e.js} +1 -1
  55. package/dist/ui/assets/{updates-K_8t_A_F.js → updates-D-0gOqSU.js} +1 -1
  56. package/dist/ui/index.html +1 -1
  57. package/package.json +1 -1
  58. package/dist/ui/assets/cliproxy-Dq9zVZRT.js +0 -3
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{g as Ie,r as b}from"./react-vendor-Bjx91N7w.js";import{bG as Ce,bH as Ae,bI as ke,bJ as Le,bK as q,bL as ie,bM as M,bN as Fe,bO as Ue,a as pe,c as I,B as U,d as Z,bC as Ge,aZ as Me,bP as Be,bQ as qe,bR as ze,bS as He,bT as Ke,bU as Ze,bV as Qe,bW as Ye,bX as Xe,aM as Je,M as et,O as tt,r as st,s as nt,t as rt,v as at,w as it,T as ot,p as lt,q as ct,Y as ut}from"./index-HwlgKSWH.js";import{A as dt,a as mt,b as xt,c as pt,d as gt,e as ft,f as ht,g as bt}from"./alert-dialog-BOlM9Aos.js";import{u as Ee,a as yt,b as jt,h as vt}from"./tanstack-bhJxV1h8.js";import{t as oe}from"./notifications-B4_o8bcr.js";import{bf as ye,R as K,t as Nt,s as St,u as wt,A as Ct,bg as At,bh as kt,bi as Et,X as Tt,e as Pt,bj as Vt,bk as $t,U as Ot,v as Rt,m as Dt,w as Wt,aF as _t,T as le,aP as It}from"./icons-DIVjDO-z.js";var ce,je;function Lt(){return je||(je=1,ce={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),ce}var Ft=Lt();const Ut=Ie(Ft);var Gt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ve(t){var s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=t.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(s.name=n[1],(Ut[n[1]]||t.charAt(t.length-2)==="/")&&(s.voidElement=!0),s.name.startsWith("!--"))){var r=t.indexOf("-->");return{type:"comment",comment:r!==-1?t.slice(4,r):""}}for(var a=new RegExp(Gt),i=null;(i=a.exec(t))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),u=[o,""];o.indexOf("=")>-1&&(u=o.split("=")),s.attrs[u[0]]=u[1],a.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}var Mt=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Bt=/^\s*$/,qt=Object.create(null);function Te(t,s){switch(s.type){case"text":return t+s.content;case"tag":return t+="<"+s.name+(s.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(s.attrs):"")+(s.voidElement?"/>":">"),s.voidElement?t:t+s.children.reduce(Te,"")+"</"+s.name+">";case"comment":return t+"<!--"+s.comment+"-->"}}var zt={parse:function(t,s){s||(s={}),s.components||(s.components=qt);var n,r=[],a=[],i=-1,o=!1;if(t.indexOf("<")!==0){var u=t.indexOf("<");r.push({type:"text",content:u===-1?t:t.substring(0,u)})}return t.replace(Mt,function(f,l){if(o){if(f!=="</"+n.name+">")return;o=!1}var x,v=f.charAt(1)!=="/",A=f.startsWith("<!--"),m=l+f.length,d=t.charAt(m);if(A){var O=ve(f);return i<0?(r.push(O),r):((x=a[i]).children.push(O),r)}if(v&&(i++,(n=ve(f)).type==="tag"&&s.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!d||d==="<"||n.children.push({type:"text",content:t.slice(m,t.indexOf("<",m))}),i===0&&r.push(n),(x=a[i-1])&&x.children.push(n),a[i]=n),(!v||n.voidElement)&&(i>-1&&(n.voidElement||n.name===f.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&d!=="<"&&d)){x=i===-1?r:a[i].children;var p=t.indexOf("<",m),P=t.slice(m,p===-1?void 0:p);Bt.test(P)&&(P=" "),(p>-1&&i+x.length>=0||P!==" ")&&x.push({type:"text",content:P})}}),r},stringify:function(t){return t.reduce(function(s,n){return s+Te("",n)},"")}};const ee=(t,s)=>{if(!t)return!1;const n=t.props?.children??t.children;return s?n.length>0:!!n},te=t=>{if(!t)return[];const s=t.props?.children??t.children;return t.props?.i18nIsDynamicList?B(s):s},Ht=t=>Array.isArray(t)&&t.every(b.isValidElement),B=t=>Array.isArray(t)?t:[t],Kt=(t,s)=>{const n={...s};return n.props={...s.props,...t.props},n},Zt=t=>{const s={};if(!t)return s;const n=r=>{B(r).forEach(i=>{q(i)||(ee(i)?n(te(i)):M(i)&&!b.isValidElement(i)&&Object.assign(s,i))})};return n(t),s},Pe=(t,s,n,r)=>{if(!t)return"";let a="";const i=B(t),o=s?.transSupportBasicHtmlNodes?s.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((u,f)=>{if(q(u)){a+=`${u}`;return}if(b.isValidElement(u)){const{props:l,type:x}=u,v=Object.keys(l).length,A=o.indexOf(x)>-1,m=l.children;if(!m&&A&&!v){a+=`<${x}/>`;return}if(!m&&(!A||v)||l.i18nIsDynamicList){a+=`<${f}></${f}>`;return}if(A&&v===1&&q(m)){a+=`<${x}>${m}</${x}>`;return}const d=Pe(m,s,n,r);a+=`<${f}>${d}</${f}>`;return}if(u===null){ie(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(M(u)){const{format:l,...x}=u,v=Object.keys(x);if(v.length===1){const A=l?`${v[0]}, ${l}`:v[0];a+=`{{${A}}}`;return}ie(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:u});return}ie(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:u})}),a},Qt=(t,s=[],n={})=>{if(!t)return t;const r=Object.keys(n),a=[...s,...r];let i="",o=0;for(;o<t.length;)if(t[o]==="<"){let u=!1;const f=t.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(f){const l=f[1];(/^\d+$/.test(l)||a.includes(l))&&(u=!0,i+=f[0],o+=f[0].length)}if(!u){const l=t.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(l){const x=l[1];(/^\d+$/.test(x)||a.includes(x))&&(u=!0,i+=l[0],o+=l[0].length)}}u||(i+="&lt;",o+=1)}else i+=t[o],o+=1;return i},Yt=(t,s,n,r,a,i,o)=>{if(n==="")return[];const u=a.transKeepBasicHtmlNodesFor||[],f=n&&new RegExp(u.map(y=>`<${y}`).join("|")).test(n);if(!t&&!s&&!f&&!o)return[n];const l=s??{},x=y=>{B(y).forEach(N=>{q(N)||(ee(N)?x(te(N)):M(N)&&!b.isValidElement(N)&&Object.assign(l,N))})};x(t);const v=Qt(n,u,l),A=zt.parse(`<0>${v}</0>`),m={...l,...i},d=(y,k,N)=>{const V=te(y),W=p(V,k.children,N);return Ht(V)&&W.length===0||y.props?.i18nIsDynamicList?V:W},O=(y,k,N,V,W)=>{y.dummy?(y.children=k,N.push(b.cloneElement(y,{key:V},W?void 0:k))):N.push(...b.Children.map([y],h=>{const c="data-i18n-is-dynamic-list",S={key:V,[c]:void 0};return h&&h.props&&Object.keys(h.props).forEach($=>{$==="ref"||$==="children"||$==="i18nIsDynamicList"||$===c||(S[$]=h.props[$])}),b.cloneElement(h,S,W?null:k)}))},p=(y,k,N)=>{const V=B(y);return B(k).reduce((h,c,S)=>{const $=c.children?.[0]?.content&&r.services.interpolator.interpolate(c.children[0].content,m,r.language);if(c.type==="tag"){let T=V[parseInt(c.name,10)];!T&&s&&(T=s[c.name]),N.length===1&&!T&&(T=N[0][c.name]),T||(T={});const R={...c.attrs};o&&Object.keys(R).forEach(E=>{const L=R[E];q(L)&&(R[E]=Fe(L))});const w=Object.keys(R).length!==0?Kt({props:R},T):T,D=b.isValidElement(w),g=D&&ee(c,!0)&&!c.voidElement,C=f&&M(w)&&w.dummy&&!D,_=M(s)&&Object.hasOwnProperty.call(s,c.name);if(q(w)){const E=r.services.interpolator.interpolate(w,m,r.language);h.push(E)}else if(ee(w)||g){const E=d(w,c,N);O(w,E,h,S)}else if(C){const E=p(V,c.children,N);O(w,E,h,S)}else if(Number.isNaN(parseFloat(c.name)))if(_){const E=d(w,c,N);O(w,E,h,S,c.voidElement)}else if(a.transSupportBasicHtmlNodes&&u.indexOf(c.name)>-1)if(c.voidElement)h.push(b.createElement(c.name,{key:`${c.name}-${S}`}));else{const E=p(V,c.children,N);h.push(b.createElement(c.name,{key:`${c.name}-${S}`},E))}else if(c.voidElement)h.push(`<${c.name} />`);else{const E=p(V,c.children,N);h.push(`<${c.name}>${E}</${c.name}>`)}else if(M(w)&&!D){const E=c.children[0]?$:null;E&&h.push(E)}else O(w,$,h,S,c.children.length!==1||!$)}else if(c.type==="text"){const T=a.transWrapTextNodes,R=typeof a.unescape=="function"?a.unescape:ke().unescape,w=o?R(r.services.interpolator.interpolate(c.content,m,r.language)):r.services.interpolator.interpolate(c.content,m,r.language);T?h.push(b.createElement(T,{key:`${c.name}-${S}`},w)):h.push(w)}return h},[])},P=p([{dummy:!0,children:t||[]}],A,B(t||[]));return te(P[0])},Ve=(t,s,n)=>{const r=t.key||s,a=b.cloneElement(t,{key:r});if(!a.props||!a.props.children||n.indexOf(`${s}/>`)<0&&n.indexOf(`${s} />`)<0)return a;function i(){return b.createElement(b.Fragment,null,a)}return b.createElement(i,{key:r})},Xt=(t,s)=>t.map((n,r)=>Ve(n,r,s)),Jt=(t,s)=>{const n={};return Object.keys(t).forEach(r=>{Object.assign(n,{[r]:Ve(t[r],r,s)})}),n},es=(t,s,n,r)=>t?Array.isArray(t)?Xt(t,s):M(t)?Jt(t,s):(Ce(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,ts=t=>!M(t)||Array.isArray(t)?!1:Object.keys(t).reduce((s,n)=>s&&Number.isNaN(Number.parseFloat(n)),!0);function ss({children:t,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:u,components:f,ns:l,i18n:x,t:v,shouldUnescape:A,...m}){const d=x||Ae();if(!d)return Ce(d,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),t;const O=v||d.t.bind(d)||(Q=>Q),p={...ke(),...d.options?.react};let P=l||O.ns||d.options?.defaultNS;P=q(P)?[P]:P||["translation"];const{transDefaultProps:y}=p,k=y?.tOptions?{...y.tOptions,...i}:i,N=A??y?.shouldUnescape,V=y?.values?{...y.values,...o}:o,W=y?.components?{...y.components,...f}:f,h=Pe(t,p,d,r),c=u||k?.defaultValue||h||p.transEmptyNodeValue||(typeof r=="function"?Le(r):r),{hashTransKey:S}=p,$=r||(S?S(h||c):h||c);d.options?.interpolation?.defaultVariables?o=V&&Object.keys(V).length>0?{...V,...d.options.interpolation.defaultVariables}:{...d.options.interpolation.defaultVariables}:o=V;const T=Zt(t);T&&typeof T.count=="number"&&s===void 0&&(s=T.count);const R=o||s!==void 0&&!d.options?.interpolation?.alwaysFormat||!t?k.interpolation:{interpolation:{...k.interpolation,prefix:"#$?",suffix:"?$#"}},w={...k,context:a||k.context,count:s,...o,...R,defaultValue:c,ns:P};let D=$?O($,w):c;D===$&&c&&(D=c);const g=es(W,D,d,r);let C=g||t,_=null;ts(g)&&(_=g,C=t);const E=Yt(C,_,D,d,p,w,N),L=n??p.defaultTransParent;return L?b.createElement(L,m,E):E}function Ne({children:t,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:u,components:f,ns:l,i18n:x,t:v,shouldUnescape:A,...m}){const{i18n:d,defaultNS:O}=b.useContext(Ue)||{},p=x||d||Ae(),P=v||p?.t.bind(p);return ss({children:t,count:s,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:u,components:f,ns:l||P?.ns||O||p?.options?.defaultNS,i18n:p,t:v,shouldUnescape:A,...m})}async function ns(){const t=await fetch("/api/cliproxy/sync/status");if(!t.ok){let s="Failed to fetch sync status";try{const n=await t.json();s=n.error||n.message||s}catch{}throw new Error(s)}return t.json()}async function rs(){const t=new AbortController,s=setTimeout(()=>t.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal});if(!n.ok){let r="Sync failed";try{const a=await n.json();r=a.error||a.message||r}catch{}throw new Error(r)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(s)}}function as(){return Ee({queryKey:["cliproxy-sync-status"],queryFn:ns,refetchInterval:3e4,retry:1,staleTime:1e4})}function is(){const t=yt(),{t:s}=pe();return jt({mutationFn:rs,onSuccess:n=>{t.invalidateQueries({queryKey:["cliproxy-sync-status"]}),t.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?oe.info(s("toasts.noProfilesToSync")):oe.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{oe.error(s("toasts.syncFailed",{error:n.message}))}})}function Se(t){return t.replace(/-\d+$/,"").split(".").map(Number)}function xe(t,s){const n=Se(t),r=Se(s);for(let a=0;a<3;a+=1){const i=n[a]||0,o=r[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}function ue(t,s){return xe(t,s)>0}function de(t,s,n){return xe(t,s)>=0&&xe(t,n)<=0}const me={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function we({className:t,compact:s=!1,state:n,sessionAffinityState:r,isLoading:a,isSaving:i,error:o,onApply:u,onApplyAffinity:f}){const{t:l}=pe(),x=n?.strategy??"round-robin",v=r?.enabled??!1,A=r?.ttl??"1h",m=r?.manageable??!0,[d,O]=b.useState(x),[p,P]=b.useState(v),[y,k]=b.useState(A),[N,V]=b.useState(!1),W=n?.source==="live"?"Live CLIProxy":"Saved startup default",h=a||i||!n||d===x,c=N?"Hide details":"Show details",S=a||i||!!o||!m,$=l(m?p?"routingGuidance.disableSessionAffinity":"routingGuidance.enableSessionAffinity":"routingGuidance.sessionAffinityUnavailable"),T=b.useRef(null),R=b.useRef(!1);b.useEffect(()=>{O(x)},[x]),b.useEffect(()=>{P(v),k(A)},[v,A]),b.useEffect(()=>{if(i||!T.current)return;const g=T.current;g.enabled===v&&g.ttl===A||(P(v),k(A)),T.current=null},[i,v,A]);const w=()=>{if(!m)return;const g=!p,C=y.trim()||"1h";T.current={enabled:g,ttl:C},P(g),f({enabled:g,ttl:C})},D=()=>{if(!m||o)return;if(R.current){R.current=!1;return}const g=y.trim()||"1h";g!==A&&(T.current={enabled:p,ttl:g},f({enabled:p,ttl:g}))};if(s){const g=C=>{O(C),C!==x&&u(C)};return e.jsxs("div",{className:I("group/routing mt-1 space-y-2 -mx-1 rounded-lg p-1",t),children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg transition-colors hover:bg-primary/5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 text-xs font-medium text-foreground",children:[e.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[e.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),e.jsx(ye,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),e.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),i&&e.jsx(K,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),e.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[e.jsx("div",{className:I("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",d==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(me).map(([C,_])=>{const E=d===C;return e.jsx("button",{type:"button",className:I("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",E?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>g(C),disabled:a||i||!!o,title:_.description,children:_.title},C)})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-medium text-foreground",children:l("routingGuidance.sessionAffinity")}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:m?l("routingGuidance.ttlBadge",{ttl:A}):l("routingGuidance.localOnlySetting")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[m?e.jsx("input",{"aria-label":"Session affinity TTL",className:"h-6 w-14 rounded border border-border/70 bg-background px-2 text-[10px] text-foreground",value:y,onChange:C=>k(C.target.value),onBlur:D,disabled:S}):null,e.jsx("button",{type:"button","aria-label":$,className:I("rounded border px-2 py-1 text-[10px] font-medium transition-colors",m?"border-border/70 bg-background text-foreground hover:border-primary/40 hover:text-primary":"border-border/60 bg-muted/40 text-muted-foreground"),onMouseDown:()=>{R.current=!0},onClick:w,disabled:S,title:r?.message,children:l(m?p?"routingGuidance.sessionAffinityOn":"routingGuidance.sessionAffinityOff":"routingGuidance.sessionAffinityUnavailable")})]})]}),r?.message?e.jsx("div",{className:"rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5 text-[10px] text-muted-foreground",children:r.message}):null]})}return e.jsx("section",{className:I("rounded-xl border border-border/70 bg-background",t),children:e.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[e.jsxs("div",{className:"min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:e.jsx(ye,{className:"h-4 w-4"})}),e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.routingStrategy")}),e.jsx(U,{variant:"secondary",children:x}),n?e.jsx(U,{variant:"outline",children:W}):null,n?e.jsx(U,{variant:"outline",children:n.target}):null]}),e.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."})]}),e.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[e.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(me).map(([g,C])=>{const _=d===g;return e.jsx("button",{type:"button",className:I("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",_?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>O(g),disabled:a||i||!!o,children:C.title},g)})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>V(g=>!g),children:[N?e.jsx(Nt,{className:"mr-1 h-3.5 w-3.5"}):e.jsx(St,{className:"mr-1 h-3.5 w-3.5"}),c]}),e.jsx(Z,{size:"sm",onClick:()=>u(d),disabled:h||!!o,children:i?"Saving...":`Use ${d}`})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[e.jsx("span",{children:l("routingGuidance.roundRobin")}),e.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),e.jsx("span",{children:l("routingGuidance.fillFirst")})]}),e.jsxs("div",{className:"grid gap-3 rounded-lg border border-border/70 bg-muted/20 px-3 py-3 xl:col-span-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.sessionAffinity")}),e.jsx(U,{variant:"secondary",children:l(p?"routingGuidance.sessionAffinityOn":"routingGuidance.sessionAffinityOff")}),r?.ttl?e.jsx(U,{variant:"outline",children:l("routingGuidance.ttlBadge",{ttl:A})}):null,m?null:e.jsx(U,{variant:"outline",children:l("routingGuidance.localOnly")})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:l("routingGuidance.sessionAffinityDescription")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("input",{"aria-label":"Session affinity TTL",className:"h-9 w-24 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground",value:y,onChange:g=>k(g.target.value),onBlur:D,disabled:S}),e.jsx(Z,{type:"button",variant:"outline",onMouseDown:()=>{R.current=!0},onClick:w,disabled:S,"aria-label":$,children:$})]}),r?.message?e.jsx("div",{className:"rounded-lg border border-border/70 bg-background/70 px-3 py-2 text-xs text-muted-foreground",children:r.message}):null]}),o?e.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:o.message}):null,!o&&n?.message?e.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:n.message}):null,N?e.jsxs("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:[Object.entries(me).map(([g,C])=>{const _=x===g;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:C.title}),_?e.jsx(U,{variant:"secondary",children:"Current"}):null]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:C.description})]},g)}),e.jsxs("div",{className:"space-y-1 md:col-span-2",children:[e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.sessionRecognitionTitle")}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:l("routingGuidance.sessionRecognitionDescription")})]})]}):null]})})}function os(t){if(!t)return"";const s=new Date(t).getTime(),r=Date.now()-s,a=Math.floor(r/(1e3*60*60)),i=Math.floor(r%(1e3*60*60)/(1e3*60));return a>0?`${a}h ${i}m`:`${i}m`}function ls(t,s){if(!t)return"";const n=Date.now()-t,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?s("proxyStatusWidget.justNow"):r<60?s("proxyStatusWidget.minutesAgo",{count:r}):s("proxyStatusWidget.hoursAgo",{count:a})}function J({icon:t,tooltip:s,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return e.jsxs(ot,{children:[e.jsx(lt,{asChild:!0,children:e.jsx(Z,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:I("h-7 w-7 p-0",o==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:n,disabled:r,children:a?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(t,{className:"w-3.5 h-3.5"})})}),e.jsx(ct,{side:"bottom",className:"text-xs",children:s})]})}function fs(){const{t}=pe(),{data:s,isLoading:n}=Ge(),{data:r}=Me(),{data:a,isLoading:i}=Be(),{data:o,isLoading:u,error:f}=qe(),l=ze(),{data:x,isLoading:v,error:A}=He(),m=Ke(),d=l.isPending||m.isPending,O=f instanceof Error?f:null,p=Ze(),P=Qe(),y=Ye(),k=Xe(),{data:N}=as(),{mutate:V,isPending:W}=is(),[h,c]=b.useState(!1),[S,$]=b.useState(""),[T,R]=b.useState(!1),[w,D]=b.useState(null),[g,C]=b.useState(null),{data:_}=Ee({queryKey:["cliproxy-server-config"],queryFn:()=>ut.cliproxyServer.get(),staleTime:3e4}),E=vt({mutationKey:["update-backend"]})>0,L=_?.remote,Q=L?.enabled&&L?.host,G=x??(A instanceof Error?{source:"unsupported",target:o?.target??(Q?"remote":"local"),reachable:!1,manageable:!1,message:A.message}:void 0),Y=s?.running??!1,se=p.isPending||P.isPending||y.isPending||k.isPending||E||W,$e=r?.hasUpdate??!1,z=r?.isStable===!1,ge=r?.currentVersion,X=N?.configured??!1,Oe=t(X?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),ne=z?r?.maxStableVersion||a?.latestStable:r?.latestVersion,fe=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",H=a?.faultyRange,Re=H&&`${H.min.replace(/-\d+$/,"")}-${H.max.replace(/-\d+$/,"")}`,re=(j,F)=>{D(j),C(F),R(!0)},he=async j=>{if(!j)return;const F=ue(j,fe);if(H!==void 0&&de(j,H.min,H.max)){re(j,"faulty");return}if(F){re(j,"experimental");return}try{const be=await k.mutateAsync({version:j});be.requiresConfirmation&&re(j,be.isFaulty?"faulty":"experimental")}catch{}},De=()=>{w&&k.mutate({version:w,force:!0}),R(!1),D(null),C(null)},We=()=>{R(!1),D(null),C(null)},_e=Q?(()=>{const j=L.protocol||"http",F=L.port||(j==="https"?443:80);return j==="https"&&F===443||j==="http"&&F===80?L.host:`${L.host}:${F}`})():null;return Q?e.jsxs("div",{className:I("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:t("proxyStatusWidget.remoteProxy")}),e.jsx(U,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:t("proxyStatusWidget.active")})]}),e.jsx(Ct,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:_e})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:t("proxyStatusWidget.trafficAutoRouted")})]}),e.jsx(we,{compact:!0,className:"mt-3",state:o,sessionAffinityState:G,isLoading:u||v,isSaving:d,error:O,onApply:j=>l.mutate(j),onApplyAffinity:j=>m.mutate(j)},`remote:${o?.strategy??"round-robin"}:${G?.enabled??"na"}:${G?.ttl??"na"}:${G?.manageable??"na"}`)]}):e.jsx(Je,{delayDuration:300,children:e.jsxs("div",{className:I("rounded-lg border p-3 transition-colors",Y?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:I("w-2 h-2 rounded-full",Y?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n?e.jsx(K,{className:"w-3 h-3 animate-spin text-muted-foreground"}):Y?e.jsxs(e.Fragment,{children:[e.jsx(J,{icon:W?K:At,tooltip:t("proxyStatusWidget.tooltipSync"),onClick:()=>V(),disabled:!X||se,isPending:W}),e.jsx(J,{icon:kt,tooltip:t("proxyStatusWidget.tooltipRestart"),onClick:()=>y.mutate(),disabled:se,isPending:y.isPending}),e.jsx(J,{icon:Et,tooltip:t("proxyStatusWidget.tooltipStop"),onClick:()=>P.mutate(),disabled:se,isPending:P.isPending,variant:"destructive-ghost"})]}):null,e.jsx(J,{icon:h?Tt:Pt,tooltip:t(h?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>c(!h),className:h?"bg-muted":void 0})]})]}),ge&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.jsxs("span",{className:I("text-xs font-mono text-muted-foreground",z&&"text-amber-600 dark:text-amber-400"),children:["v",ge]}),($e||z)&&ne&&e.jsxs(U,{variant:"secondary",className:I("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",z?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void he(ne),title:t(z?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[z?e.jsx(Vt,{className:"w-2.5 h-2.5"}):e.jsx($t,{className:"w-2.5 h-2.5"}),ne]})]}),Y&&s&&e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsx("span",{className:"flex items-center gap-1",children:t("proxyStatusWidget.port",{port:s.port})}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ot,{className:"w-3 h-3"}),t("proxyStatusWidget.sessionCount",{count:s.sessionCount})]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Rt,{className:"w-3 h-3"}),os(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[X?e.jsx(Dt,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):e.jsx(Wt,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:I("text-xs",X?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:Oe})]}),e.jsx(we,{compact:!0,className:"mt-3",state:o,sessionAffinityState:G,isLoading:u||v,isSaving:d,error:O,onApply:j=>l.mutate(j),onApplyAffinity:j=>m.mutate(j)},`local:${o?.strategy??"round-robin"}:${G?.enabled??"na"}:${G?.ttl??"na"}:${G?.manageable??"na"}`),e.jsx(et,{open:h,onOpenChange:c,children:e.jsxs(tt,{className:"mt-3 pt-3 border-t border-muted",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:t("proxyStatusWidget.versionManagement")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(st,{value:S,onValueChange:$,disabled:i,children:[e.jsx(nt,{className:"h-8 text-xs flex-1",children:e.jsx(rt,{placeholder:t("proxyStatusWidget.selectVersionPlaceholder")})}),e.jsx(at,{children:a?.versions.slice(0,20).map(j=>{const F=a?.maxStableVersion&&ue(j,a.maxStableVersion),ae=a?.faultyRange&&de(j,a.faultyRange.min,a.faultyRange.max);return e.jsx(it,{value:j,className:"text-xs",children:e.jsxs("span",{className:"flex items-center gap-2",children:["v",j,j===a.latestStable&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:t("proxyStatusWidget.stable")}),(ae||F)&&e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},j)})})]}),e.jsxs(Z,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void he(S),disabled:k.isPending||!S,children:[k.isPending?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(_t,{className:"w-3.5 h-3.5"}),t("proxyStatusWidget.install")]})]}),S&&a?.maxStableVersion&&ue(S,a.maxStableVersion)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(le,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsx("span",{children:t("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),S&&a?.faultyRange&&de(S,a.faultyRange.min,a.faultyRange.max)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(le,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsx("span",{children:t("proxyStatusWidget.versionsKnownIssues",{version:S})})]}),r?.checkedAt&&e.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:t("proxyStatusWidget.lastChecked",{time:ls(r.checkedAt,t)})})]})}),!Y&&e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:t("proxyStatusWidget.notRunning")}),e.jsxs(Z,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>p.mutate(),disabled:p.isPending,children:[p.isPending?e.jsx(K,{className:"w-3 h-3 animate-spin"}):e.jsx(It,{className:"w-3 h-3"}),t("proxyStatusWidget.start")]})]}),e.jsx(dt,{open:T,onOpenChange:R,children:e.jsxs(mt,{children:[e.jsxs(xt,{children:[e.jsxs(pt,{className:"flex items-center gap-2",children:[e.jsx(le,{className:"w-5 h-5 text-amber-500"}),t(g==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),e.jsxs(gt,{className:"space-y-2",children:[g==="faulty"?e.jsx("p",{children:e.jsx(Ne,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:w??"",range:Re||""},components:{strong:e.jsx("strong",{})}})}):e.jsx("p",{children:e.jsx(Ne,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:w??"",maxStable:fe},components:{strong:e.jsx("strong",{})}})}),e.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:t(g==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),e.jsx("p",{children:t("proxyStatusWidget.installUnstableConfirm")})]})]}),e.jsxs(ft,{children:[e.jsx(ht,{onClick:We,children:t("proxyStatusWidget.cancel")}),e.jsx(bt,{onClick:De,className:"bg-amber-500 hover:bg-amber-600 text-white",children:t("proxyStatusWidget.installAnyway")})]})]})})]})})}export{fs as P};
1
+ import{j as e}from"./radix-ui-nu4wz29m.js";import{g as Ie,r as b}from"./react-vendor-Bjx91N7w.js";import{bG as Ce,bH as Ae,bI as ke,bJ as Le,bK as q,bL as ie,bM as M,bN as Fe,bO as Ue,a as pe,c as I,B as U,d as Z,bC as Ge,aZ as Me,bP as Be,bQ as qe,bR as ze,bS as He,bT as Ke,bU as Ze,bV as Qe,bW as Ye,bX as Xe,aM as Je,M as et,O as tt,r as st,s as nt,t as rt,v as at,w as it,T as ot,p as lt,q as ct,Y as ut}from"./index-BJl0cazY.js";import{A as dt,a as mt,b as xt,c as pt,d as gt,e as ft,f as ht,g as bt}from"./alert-dialog-BM9gIsRp.js";import{u as Ee,a as yt,b as jt,h as vt}from"./tanstack-bhJxV1h8.js";import{t as oe}from"./notifications-B4_o8bcr.js";import{bf as ye,R as K,t as Nt,s as St,u as wt,A as Ct,bg as At,bh as kt,bi as Et,X as Tt,e as Pt,bj as Vt,bk as $t,U as Ot,v as Rt,m as Dt,w as Wt,aF as _t,T as le,aP as It}from"./icons-DIVjDO-z.js";var ce,je;function Lt(){return je||(je=1,ce={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),ce}var Ft=Lt();const Ut=Ie(Ft);var Gt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ve(t){var s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=t.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(s.name=n[1],(Ut[n[1]]||t.charAt(t.length-2)==="/")&&(s.voidElement=!0),s.name.startsWith("!--"))){var r=t.indexOf("-->");return{type:"comment",comment:r!==-1?t.slice(4,r):""}}for(var a=new RegExp(Gt),i=null;(i=a.exec(t))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),u=[o,""];o.indexOf("=")>-1&&(u=o.split("=")),s.attrs[u[0]]=u[1],a.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}var Mt=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Bt=/^\s*$/,qt=Object.create(null);function Te(t,s){switch(s.type){case"text":return t+s.content;case"tag":return t+="<"+s.name+(s.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(s.attrs):"")+(s.voidElement?"/>":">"),s.voidElement?t:t+s.children.reduce(Te,"")+"</"+s.name+">";case"comment":return t+"<!--"+s.comment+"-->"}}var zt={parse:function(t,s){s||(s={}),s.components||(s.components=qt);var n,r=[],a=[],i=-1,o=!1;if(t.indexOf("<")!==0){var u=t.indexOf("<");r.push({type:"text",content:u===-1?t:t.substring(0,u)})}return t.replace(Mt,function(f,l){if(o){if(f!=="</"+n.name+">")return;o=!1}var x,v=f.charAt(1)!=="/",A=f.startsWith("<!--"),m=l+f.length,d=t.charAt(m);if(A){var O=ve(f);return i<0?(r.push(O),r):((x=a[i]).children.push(O),r)}if(v&&(i++,(n=ve(f)).type==="tag"&&s.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!d||d==="<"||n.children.push({type:"text",content:t.slice(m,t.indexOf("<",m))}),i===0&&r.push(n),(x=a[i-1])&&x.children.push(n),a[i]=n),(!v||n.voidElement)&&(i>-1&&(n.voidElement||n.name===f.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&d!=="<"&&d)){x=i===-1?r:a[i].children;var p=t.indexOf("<",m),P=t.slice(m,p===-1?void 0:p);Bt.test(P)&&(P=" "),(p>-1&&i+x.length>=0||P!==" ")&&x.push({type:"text",content:P})}}),r},stringify:function(t){return t.reduce(function(s,n){return s+Te("",n)},"")}};const ee=(t,s)=>{if(!t)return!1;const n=t.props?.children??t.children;return s?n.length>0:!!n},te=t=>{if(!t)return[];const s=t.props?.children??t.children;return t.props?.i18nIsDynamicList?B(s):s},Ht=t=>Array.isArray(t)&&t.every(b.isValidElement),B=t=>Array.isArray(t)?t:[t],Kt=(t,s)=>{const n={...s};return n.props={...s.props,...t.props},n},Zt=t=>{const s={};if(!t)return s;const n=r=>{B(r).forEach(i=>{q(i)||(ee(i)?n(te(i)):M(i)&&!b.isValidElement(i)&&Object.assign(s,i))})};return n(t),s},Pe=(t,s,n,r)=>{if(!t)return"";let a="";const i=B(t),o=s?.transSupportBasicHtmlNodes?s.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((u,f)=>{if(q(u)){a+=`${u}`;return}if(b.isValidElement(u)){const{props:l,type:x}=u,v=Object.keys(l).length,A=o.indexOf(x)>-1,m=l.children;if(!m&&A&&!v){a+=`<${x}/>`;return}if(!m&&(!A||v)||l.i18nIsDynamicList){a+=`<${f}></${f}>`;return}if(A&&v===1&&q(m)){a+=`<${x}>${m}</${x}>`;return}const d=Pe(m,s,n,r);a+=`<${f}>${d}</${f}>`;return}if(u===null){ie(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(M(u)){const{format:l,...x}=u,v=Object.keys(x);if(v.length===1){const A=l?`${v[0]}, ${l}`:v[0];a+=`{{${A}}}`;return}ie(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:u});return}ie(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:u})}),a},Qt=(t,s=[],n={})=>{if(!t)return t;const r=Object.keys(n),a=[...s,...r];let i="",o=0;for(;o<t.length;)if(t[o]==="<"){let u=!1;const f=t.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(f){const l=f[1];(/^\d+$/.test(l)||a.includes(l))&&(u=!0,i+=f[0],o+=f[0].length)}if(!u){const l=t.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(l){const x=l[1];(/^\d+$/.test(x)||a.includes(x))&&(u=!0,i+=l[0],o+=l[0].length)}}u||(i+="&lt;",o+=1)}else i+=t[o],o+=1;return i},Yt=(t,s,n,r,a,i,o)=>{if(n==="")return[];const u=a.transKeepBasicHtmlNodesFor||[],f=n&&new RegExp(u.map(y=>`<${y}`).join("|")).test(n);if(!t&&!s&&!f&&!o)return[n];const l=s??{},x=y=>{B(y).forEach(N=>{q(N)||(ee(N)?x(te(N)):M(N)&&!b.isValidElement(N)&&Object.assign(l,N))})};x(t);const v=Qt(n,u,l),A=zt.parse(`<0>${v}</0>`),m={...l,...i},d=(y,k,N)=>{const V=te(y),W=p(V,k.children,N);return Ht(V)&&W.length===0||y.props?.i18nIsDynamicList?V:W},O=(y,k,N,V,W)=>{y.dummy?(y.children=k,N.push(b.cloneElement(y,{key:V},W?void 0:k))):N.push(...b.Children.map([y],h=>{const c="data-i18n-is-dynamic-list",S={key:V,[c]:void 0};return h&&h.props&&Object.keys(h.props).forEach($=>{$==="ref"||$==="children"||$==="i18nIsDynamicList"||$===c||(S[$]=h.props[$])}),b.cloneElement(h,S,W?null:k)}))},p=(y,k,N)=>{const V=B(y);return B(k).reduce((h,c,S)=>{const $=c.children?.[0]?.content&&r.services.interpolator.interpolate(c.children[0].content,m,r.language);if(c.type==="tag"){let T=V[parseInt(c.name,10)];!T&&s&&(T=s[c.name]),N.length===1&&!T&&(T=N[0][c.name]),T||(T={});const R={...c.attrs};o&&Object.keys(R).forEach(E=>{const L=R[E];q(L)&&(R[E]=Fe(L))});const w=Object.keys(R).length!==0?Kt({props:R},T):T,D=b.isValidElement(w),g=D&&ee(c,!0)&&!c.voidElement,C=f&&M(w)&&w.dummy&&!D,_=M(s)&&Object.hasOwnProperty.call(s,c.name);if(q(w)){const E=r.services.interpolator.interpolate(w,m,r.language);h.push(E)}else if(ee(w)||g){const E=d(w,c,N);O(w,E,h,S)}else if(C){const E=p(V,c.children,N);O(w,E,h,S)}else if(Number.isNaN(parseFloat(c.name)))if(_){const E=d(w,c,N);O(w,E,h,S,c.voidElement)}else if(a.transSupportBasicHtmlNodes&&u.indexOf(c.name)>-1)if(c.voidElement)h.push(b.createElement(c.name,{key:`${c.name}-${S}`}));else{const E=p(V,c.children,N);h.push(b.createElement(c.name,{key:`${c.name}-${S}`},E))}else if(c.voidElement)h.push(`<${c.name} />`);else{const E=p(V,c.children,N);h.push(`<${c.name}>${E}</${c.name}>`)}else if(M(w)&&!D){const E=c.children[0]?$:null;E&&h.push(E)}else O(w,$,h,S,c.children.length!==1||!$)}else if(c.type==="text"){const T=a.transWrapTextNodes,R=typeof a.unescape=="function"?a.unescape:ke().unescape,w=o?R(r.services.interpolator.interpolate(c.content,m,r.language)):r.services.interpolator.interpolate(c.content,m,r.language);T?h.push(b.createElement(T,{key:`${c.name}-${S}`},w)):h.push(w)}return h},[])},P=p([{dummy:!0,children:t||[]}],A,B(t||[]));return te(P[0])},Ve=(t,s,n)=>{const r=t.key||s,a=b.cloneElement(t,{key:r});if(!a.props||!a.props.children||n.indexOf(`${s}/>`)<0&&n.indexOf(`${s} />`)<0)return a;function i(){return b.createElement(b.Fragment,null,a)}return b.createElement(i,{key:r})},Xt=(t,s)=>t.map((n,r)=>Ve(n,r,s)),Jt=(t,s)=>{const n={};return Object.keys(t).forEach(r=>{Object.assign(n,{[r]:Ve(t[r],r,s)})}),n},es=(t,s,n,r)=>t?Array.isArray(t)?Xt(t,s):M(t)?Jt(t,s):(Ce(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,ts=t=>!M(t)||Array.isArray(t)?!1:Object.keys(t).reduce((s,n)=>s&&Number.isNaN(Number.parseFloat(n)),!0);function ss({children:t,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:u,components:f,ns:l,i18n:x,t:v,shouldUnescape:A,...m}){const d=x||Ae();if(!d)return Ce(d,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),t;const O=v||d.t.bind(d)||(Q=>Q),p={...ke(),...d.options?.react};let P=l||O.ns||d.options?.defaultNS;P=q(P)?[P]:P||["translation"];const{transDefaultProps:y}=p,k=y?.tOptions?{...y.tOptions,...i}:i,N=A??y?.shouldUnescape,V=y?.values?{...y.values,...o}:o,W=y?.components?{...y.components,...f}:f,h=Pe(t,p,d,r),c=u||k?.defaultValue||h||p.transEmptyNodeValue||(typeof r=="function"?Le(r):r),{hashTransKey:S}=p,$=r||(S?S(h||c):h||c);d.options?.interpolation?.defaultVariables?o=V&&Object.keys(V).length>0?{...V,...d.options.interpolation.defaultVariables}:{...d.options.interpolation.defaultVariables}:o=V;const T=Zt(t);T&&typeof T.count=="number"&&s===void 0&&(s=T.count);const R=o||s!==void 0&&!d.options?.interpolation?.alwaysFormat||!t?k.interpolation:{interpolation:{...k.interpolation,prefix:"#$?",suffix:"?$#"}},w={...k,context:a||k.context,count:s,...o,...R,defaultValue:c,ns:P};let D=$?O($,w):c;D===$&&c&&(D=c);const g=es(W,D,d,r);let C=g||t,_=null;ts(g)&&(_=g,C=t);const E=Yt(C,_,D,d,p,w,N),L=n??p.defaultTransParent;return L?b.createElement(L,m,E):E}function Ne({children:t,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:u,components:f,ns:l,i18n:x,t:v,shouldUnescape:A,...m}){const{i18n:d,defaultNS:O}=b.useContext(Ue)||{},p=x||d||Ae(),P=v||p?.t.bind(p);return ss({children:t,count:s,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:u,components:f,ns:l||P?.ns||O||p?.options?.defaultNS,i18n:p,t:v,shouldUnescape:A,...m})}async function ns(){const t=await fetch("/api/cliproxy/sync/status");if(!t.ok){let s="Failed to fetch sync status";try{const n=await t.json();s=n.error||n.message||s}catch{}throw new Error(s)}return t.json()}async function rs(){const t=new AbortController,s=setTimeout(()=>t.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal});if(!n.ok){let r="Sync failed";try{const a=await n.json();r=a.error||a.message||r}catch{}throw new Error(r)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(s)}}function as(){return Ee({queryKey:["cliproxy-sync-status"],queryFn:ns,refetchInterval:3e4,retry:1,staleTime:1e4})}function is(){const t=yt(),{t:s}=pe();return jt({mutationFn:rs,onSuccess:n=>{t.invalidateQueries({queryKey:["cliproxy-sync-status"]}),t.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?oe.info(s("toasts.noProfilesToSync")):oe.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{oe.error(s("toasts.syncFailed",{error:n.message}))}})}function Se(t){return t.replace(/-\d+$/,"").split(".").map(Number)}function xe(t,s){const n=Se(t),r=Se(s);for(let a=0;a<3;a+=1){const i=n[a]||0,o=r[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}function ue(t,s){return xe(t,s)>0}function de(t,s,n){return xe(t,s)>=0&&xe(t,n)<=0}const me={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function we({className:t,compact:s=!1,state:n,sessionAffinityState:r,isLoading:a,isSaving:i,error:o,onApply:u,onApplyAffinity:f}){const{t:l}=pe(),x=n?.strategy??"round-robin",v=r?.enabled??!1,A=r?.ttl??"1h",m=r?.manageable??!0,[d,O]=b.useState(x),[p,P]=b.useState(v),[y,k]=b.useState(A),[N,V]=b.useState(!1),W=n?.source==="live"?"Live CLIProxy":"Saved startup default",h=a||i||!n||d===x,c=N?"Hide details":"Show details",S=a||i||!!o||!m,$=l(m?p?"routingGuidance.disableSessionAffinity":"routingGuidance.enableSessionAffinity":"routingGuidance.sessionAffinityUnavailable"),T=b.useRef(null),R=b.useRef(!1);b.useEffect(()=>{O(x)},[x]),b.useEffect(()=>{P(v),k(A)},[v,A]),b.useEffect(()=>{if(i||!T.current)return;const g=T.current;g.enabled===v&&g.ttl===A||(P(v),k(A)),T.current=null},[i,v,A]);const w=()=>{if(!m)return;const g=!p,C=y.trim()||"1h";T.current={enabled:g,ttl:C},P(g),f({enabled:g,ttl:C})},D=()=>{if(!m||o)return;if(R.current){R.current=!1;return}const g=y.trim()||"1h";g!==A&&(T.current={enabled:p,ttl:g},f({enabled:p,ttl:g}))};if(s){const g=C=>{O(C),C!==x&&u(C)};return e.jsxs("div",{className:I("group/routing mt-1 space-y-2 -mx-1 rounded-lg p-1",t),children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg transition-colors hover:bg-primary/5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 text-xs font-medium text-foreground",children:[e.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[e.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),e.jsx(ye,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),e.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),i&&e.jsx(K,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),e.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[e.jsx("div",{className:I("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",d==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(me).map(([C,_])=>{const E=d===C;return e.jsx("button",{type:"button",className:I("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",E?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>g(C),disabled:a||i||!!o,title:_.description,children:_.title},C)})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-medium text-foreground",children:l("routingGuidance.sessionAffinity")}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:m?l("routingGuidance.ttlBadge",{ttl:A}):l("routingGuidance.localOnlySetting")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[m?e.jsx("input",{"aria-label":"Session affinity TTL",className:"h-6 w-14 rounded border border-border/70 bg-background px-2 text-[10px] text-foreground",value:y,onChange:C=>k(C.target.value),onBlur:D,disabled:S}):null,e.jsx("button",{type:"button","aria-label":$,className:I("rounded border px-2 py-1 text-[10px] font-medium transition-colors",m?"border-border/70 bg-background text-foreground hover:border-primary/40 hover:text-primary":"border-border/60 bg-muted/40 text-muted-foreground"),onMouseDown:()=>{R.current=!0},onClick:w,disabled:S,title:r?.message,children:l(m?p?"routingGuidance.sessionAffinityOn":"routingGuidance.sessionAffinityOff":"routingGuidance.sessionAffinityUnavailable")})]})]}),r?.message?e.jsx("div",{className:"rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5 text-[10px] text-muted-foreground",children:r.message}):null]})}return e.jsx("section",{className:I("rounded-xl border border-border/70 bg-background",t),children:e.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[e.jsxs("div",{className:"min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:e.jsx(ye,{className:"h-4 w-4"})}),e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.routingStrategy")}),e.jsx(U,{variant:"secondary",children:x}),n?e.jsx(U,{variant:"outline",children:W}):null,n?e.jsx(U,{variant:"outline",children:n.target}):null]}),e.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."})]}),e.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[e.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(me).map(([g,C])=>{const _=d===g;return e.jsx("button",{type:"button",className:I("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",_?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>O(g),disabled:a||i||!!o,children:C.title},g)})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>V(g=>!g),children:[N?e.jsx(Nt,{className:"mr-1 h-3.5 w-3.5"}):e.jsx(St,{className:"mr-1 h-3.5 w-3.5"}),c]}),e.jsx(Z,{size:"sm",onClick:()=>u(d),disabled:h||!!o,children:i?"Saving...":`Use ${d}`})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[e.jsx("span",{children:l("routingGuidance.roundRobin")}),e.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),e.jsx("span",{children:l("routingGuidance.fillFirst")})]}),e.jsxs("div",{className:"grid gap-3 rounded-lg border border-border/70 bg-muted/20 px-3 py-3 xl:col-span-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.sessionAffinity")}),e.jsx(U,{variant:"secondary",children:l(p?"routingGuidance.sessionAffinityOn":"routingGuidance.sessionAffinityOff")}),r?.ttl?e.jsx(U,{variant:"outline",children:l("routingGuidance.ttlBadge",{ttl:A})}):null,m?null:e.jsx(U,{variant:"outline",children:l("routingGuidance.localOnly")})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:l("routingGuidance.sessionAffinityDescription")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("input",{"aria-label":"Session affinity TTL",className:"h-9 w-24 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground",value:y,onChange:g=>k(g.target.value),onBlur:D,disabled:S}),e.jsx(Z,{type:"button",variant:"outline",onMouseDown:()=>{R.current=!0},onClick:w,disabled:S,"aria-label":$,children:$})]}),r?.message?e.jsx("div",{className:"rounded-lg border border-border/70 bg-background/70 px-3 py-2 text-xs text-muted-foreground",children:r.message}):null]}),o?e.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:o.message}):null,!o&&n?.message?e.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:n.message}):null,N?e.jsxs("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:[Object.entries(me).map(([g,C])=>{const _=x===g;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:C.title}),_?e.jsx(U,{variant:"secondary",children:"Current"}):null]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:C.description})]},g)}),e.jsxs("div",{className:"space-y-1 md:col-span-2",children:[e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.sessionRecognitionTitle")}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:l("routingGuidance.sessionRecognitionDescription")})]})]}):null]})})}function os(t){if(!t)return"";const s=new Date(t).getTime(),r=Date.now()-s,a=Math.floor(r/(1e3*60*60)),i=Math.floor(r%(1e3*60*60)/(1e3*60));return a>0?`${a}h ${i}m`:`${i}m`}function ls(t,s){if(!t)return"";const n=Date.now()-t,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?s("proxyStatusWidget.justNow"):r<60?s("proxyStatusWidget.minutesAgo",{count:r}):s("proxyStatusWidget.hoursAgo",{count:a})}function J({icon:t,tooltip:s,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return e.jsxs(ot,{children:[e.jsx(lt,{asChild:!0,children:e.jsx(Z,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:I("h-7 w-7 p-0",o==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:n,disabled:r,children:a?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(t,{className:"w-3.5 h-3.5"})})}),e.jsx(ct,{side:"bottom",className:"text-xs",children:s})]})}function fs(){const{t}=pe(),{data:s,isLoading:n}=Ge(),{data:r}=Me(),{data:a,isLoading:i}=Be(),{data:o,isLoading:u,error:f}=qe(),l=ze(),{data:x,isLoading:v,error:A}=He(),m=Ke(),d=l.isPending||m.isPending,O=f instanceof Error?f:null,p=Ze(),P=Qe(),y=Ye(),k=Xe(),{data:N}=as(),{mutate:V,isPending:W}=is(),[h,c]=b.useState(!1),[S,$]=b.useState(""),[T,R]=b.useState(!1),[w,D]=b.useState(null),[g,C]=b.useState(null),{data:_}=Ee({queryKey:["cliproxy-server-config"],queryFn:()=>ut.cliproxyServer.get(),staleTime:3e4}),E=vt({mutationKey:["update-backend"]})>0,L=_?.remote,Q=L?.enabled&&L?.host,G=x??(A instanceof Error?{source:"unsupported",target:o?.target??(Q?"remote":"local"),reachable:!1,manageable:!1,message:A.message}:void 0),Y=s?.running??!1,se=p.isPending||P.isPending||y.isPending||k.isPending||E||W,$e=r?.hasUpdate??!1,z=r?.isStable===!1,ge=r?.currentVersion,X=N?.configured??!1,Oe=t(X?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),ne=z?r?.maxStableVersion||a?.latestStable:r?.latestVersion,fe=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",H=a?.faultyRange,Re=H&&`${H.min.replace(/-\d+$/,"")}-${H.max.replace(/-\d+$/,"")}`,re=(j,F)=>{D(j),C(F),R(!0)},he=async j=>{if(!j)return;const F=ue(j,fe);if(H!==void 0&&de(j,H.min,H.max)){re(j,"faulty");return}if(F){re(j,"experimental");return}try{const be=await k.mutateAsync({version:j});be.requiresConfirmation&&re(j,be.isFaulty?"faulty":"experimental")}catch{}},De=()=>{w&&k.mutate({version:w,force:!0}),R(!1),D(null),C(null)},We=()=>{R(!1),D(null),C(null)},_e=Q?(()=>{const j=L.protocol||"http",F=L.port||(j==="https"?443:80);return j==="https"&&F===443||j==="http"&&F===80?L.host:`${L.host}:${F}`})():null;return Q?e.jsxs("div",{className:I("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:t("proxyStatusWidget.remoteProxy")}),e.jsx(U,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:t("proxyStatusWidget.active")})]}),e.jsx(Ct,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:_e})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:t("proxyStatusWidget.trafficAutoRouted")})]}),e.jsx(we,{compact:!0,className:"mt-3",state:o,sessionAffinityState:G,isLoading:u||v,isSaving:d,error:O,onApply:j=>l.mutate(j),onApplyAffinity:j=>m.mutate(j)},`remote:${o?.strategy??"round-robin"}:${G?.enabled??"na"}:${G?.ttl??"na"}:${G?.manageable??"na"}`)]}):e.jsx(Je,{delayDuration:300,children:e.jsxs("div",{className:I("rounded-lg border p-3 transition-colors",Y?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:I("w-2 h-2 rounded-full",Y?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n?e.jsx(K,{className:"w-3 h-3 animate-spin text-muted-foreground"}):Y?e.jsxs(e.Fragment,{children:[e.jsx(J,{icon:W?K:At,tooltip:t("proxyStatusWidget.tooltipSync"),onClick:()=>V(),disabled:!X||se,isPending:W}),e.jsx(J,{icon:kt,tooltip:t("proxyStatusWidget.tooltipRestart"),onClick:()=>y.mutate(),disabled:se,isPending:y.isPending}),e.jsx(J,{icon:Et,tooltip:t("proxyStatusWidget.tooltipStop"),onClick:()=>P.mutate(),disabled:se,isPending:P.isPending,variant:"destructive-ghost"})]}):null,e.jsx(J,{icon:h?Tt:Pt,tooltip:t(h?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>c(!h),className:h?"bg-muted":void 0})]})]}),ge&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.jsxs("span",{className:I("text-xs font-mono text-muted-foreground",z&&"text-amber-600 dark:text-amber-400"),children:["v",ge]}),($e||z)&&ne&&e.jsxs(U,{variant:"secondary",className:I("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",z?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void he(ne),title:t(z?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[z?e.jsx(Vt,{className:"w-2.5 h-2.5"}):e.jsx($t,{className:"w-2.5 h-2.5"}),ne]})]}),Y&&s&&e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsx("span",{className:"flex items-center gap-1",children:t("proxyStatusWidget.port",{port:s.port})}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ot,{className:"w-3 h-3"}),t("proxyStatusWidget.sessionCount",{count:s.sessionCount})]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Rt,{className:"w-3 h-3"}),os(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[X?e.jsx(Dt,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):e.jsx(Wt,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:I("text-xs",X?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:Oe})]}),e.jsx(we,{compact:!0,className:"mt-3",state:o,sessionAffinityState:G,isLoading:u||v,isSaving:d,error:O,onApply:j=>l.mutate(j),onApplyAffinity:j=>m.mutate(j)},`local:${o?.strategy??"round-robin"}:${G?.enabled??"na"}:${G?.ttl??"na"}:${G?.manageable??"na"}`),e.jsx(et,{open:h,onOpenChange:c,children:e.jsxs(tt,{className:"mt-3 pt-3 border-t border-muted",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:t("proxyStatusWidget.versionManagement")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(st,{value:S,onValueChange:$,disabled:i,children:[e.jsx(nt,{className:"h-8 text-xs flex-1",children:e.jsx(rt,{placeholder:t("proxyStatusWidget.selectVersionPlaceholder")})}),e.jsx(at,{children:a?.versions.slice(0,20).map(j=>{const F=a?.maxStableVersion&&ue(j,a.maxStableVersion),ae=a?.faultyRange&&de(j,a.faultyRange.min,a.faultyRange.max);return e.jsx(it,{value:j,className:"text-xs",children:e.jsxs("span",{className:"flex items-center gap-2",children:["v",j,j===a.latestStable&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:t("proxyStatusWidget.stable")}),(ae||F)&&e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},j)})})]}),e.jsxs(Z,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void he(S),disabled:k.isPending||!S,children:[k.isPending?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(_t,{className:"w-3.5 h-3.5"}),t("proxyStatusWidget.install")]})]}),S&&a?.maxStableVersion&&ue(S,a.maxStableVersion)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(le,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsx("span",{children:t("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),S&&a?.faultyRange&&de(S,a.faultyRange.min,a.faultyRange.max)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(le,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsx("span",{children:t("proxyStatusWidget.versionsKnownIssues",{version:S})})]}),r?.checkedAt&&e.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:t("proxyStatusWidget.lastChecked",{time:ls(r.checkedAt,t)})})]})}),!Y&&e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:t("proxyStatusWidget.notRunning")}),e.jsxs(Z,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>p.mutate(),disabled:p.isPending,children:[p.isPending?e.jsx(K,{className:"w-3 h-3 animate-spin"}):e.jsx(It,{className:"w-3 h-3"}),t("proxyStatusWidget.start")]})]}),e.jsx(dt,{open:T,onOpenChange:R,children:e.jsxs(mt,{children:[e.jsxs(xt,{children:[e.jsxs(pt,{className:"flex items-center gap-2",children:[e.jsx(le,{className:"w-5 h-5 text-amber-500"}),t(g==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),e.jsxs(gt,{className:"space-y-2",children:[g==="faulty"?e.jsx("p",{children:e.jsx(Ne,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:w??"",range:Re||""},components:{strong:e.jsx("strong",{})}})}):e.jsx("p",{children:e.jsx(Ne,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:w??"",maxStable:fe},components:{strong:e.jsx("strong",{})}})}),e.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:t(g==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),e.jsx("p",{children:t("proxyStatusWidget.installUnstableConfirm")})]})]}),e.jsxs(ft,{children:[e.jsx(ht,{onClick:We,children:t("proxyStatusWidget.cancel")}),e.jsx(bt,{onClick:De,className:"bg-amber-500 hover:bg-amber-600 text-white",children:t("proxyStatusWidget.installAnyway")})]})]})})]})})}export{fs as P};
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as y}from"./react-vendor-Bjx91N7w.js";import{t as k}from"./notifications-B4_o8bcr.js";import{B as R,d as a,c as E,bc as z,W as S}from"./index-HwlgKSWH.js";import{aX as B,L as m,au as L,o as P,R as T}from"./icons-DIVjDO-z.js";function F({title:c,pathLabel:x,loading:t,parseWarning:r,readWarning:i,value:s,dirty:n,readOnly:h=!1,saving:f,saveDisabled:j,onChange:p,onSave:u,onRefresh:b,onDiscard:l,language:v="json",loadingLabel:N="Loading settings.json...",parseWarningLabel:g="Parse warning",ownershipNotice:d}){const[w,o]=y.useState(!1),C=async()=>{s&&(await navigator.clipboard.writeText(s),o(!0),k.success(S.t("commonToast.settingsCopied")),window.setTimeout(()=>o(!1),1500))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4 text-primary"}),c,n&&e.jsx(R,{variant:"secondary",className:"text-[10px]",children:"Unsaved"})]}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate",children:x})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",onClick:u,disabled:j,children:[f?e.jsx(m,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(L,{className:"h-4 w-4 mr-1"}),"Save"]}),l?e.jsx(a,{variant:"outline",size:"sm",onClick:l,disabled:!n||t,children:"Discard"}):null,e.jsxs(a,{variant:"outline",size:"sm",onClick:C,disabled:!s,children:[e.jsx(P,{className:"h-4 w-4 mr-1"}),w?"Copied":"Copy"]}),e.jsx(a,{variant:"outline",size:"sm",onClick:b,"aria-label":"Refresh raw config",children:e.jsx(T,{className:E("h-4 w-4",t?"animate-spin":"")})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:t?e.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[e.jsx(m,{className:"h-5 w-5 animate-spin mr-2"}),N]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d&&e.jsx("div",{className:"mx-4 mt-4",children:d}),r&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-300",children:[g,": ",r]}),i&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Read-only: ",i]}),e.jsx("div",{className:"min-h-0 flex-1 p-4 pt-3",children:e.jsx("div",{className:"h-full rounded-md border overflow-hidden bg-background",children:e.jsx(z,{value:s,onChange:p,language:v,readonly:h,minHeight:"100%",heightMode:"fill-parent"})})})]})})]})}const q=F;export{F as R,q as a};
1
+ import{j as e}from"./radix-ui-nu4wz29m.js";import{r as y}from"./react-vendor-Bjx91N7w.js";import{t as k}from"./notifications-B4_o8bcr.js";import{B as R,d as a,c as E,bc as z,W as S}from"./index-BJl0cazY.js";import{aX as B,L as m,au as L,o as P,R as T}from"./icons-DIVjDO-z.js";function F({title:c,pathLabel:x,loading:t,parseWarning:r,readWarning:i,value:s,dirty:n,readOnly:h=!1,saving:f,saveDisabled:j,onChange:p,onSave:u,onRefresh:b,onDiscard:l,language:v="json",loadingLabel:N="Loading settings.json...",parseWarningLabel:g="Parse warning",ownershipNotice:d}){const[w,o]=y.useState(!1),C=async()=>{s&&(await navigator.clipboard.writeText(s),o(!0),k.success(S.t("commonToast.settingsCopied")),window.setTimeout(()=>o(!1),1500))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4 text-primary"}),c,n&&e.jsx(R,{variant:"secondary",className:"text-[10px]",children:"Unsaved"})]}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate",children:x})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",onClick:u,disabled:j,children:[f?e.jsx(m,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(L,{className:"h-4 w-4 mr-1"}),"Save"]}),l?e.jsx(a,{variant:"outline",size:"sm",onClick:l,disabled:!n||t,children:"Discard"}):null,e.jsxs(a,{variant:"outline",size:"sm",onClick:C,disabled:!s,children:[e.jsx(P,{className:"h-4 w-4 mr-1"}),w?"Copied":"Copy"]}),e.jsx(a,{variant:"outline",size:"sm",onClick:b,"aria-label":"Refresh raw config",children:e.jsx(T,{className:E("h-4 w-4",t?"animate-spin":"")})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:t?e.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[e.jsx(m,{className:"h-5 w-5 animate-spin mr-2"}),N]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d&&e.jsx("div",{className:"mx-4 mt-4",children:d}),r&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-300",children:[g,": ",r]}),i&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Read-only: ",i]}),e.jsx("div",{className:"min-h-0 flex-1 p-4 pt-3",children:e.jsx("div",{className:"h-full rounded-md border overflow-hidden bg-background",children:e.jsx(z,{value:s,onChange:p,language:v,readonly:h,minHeight:"100%",heightMode:"fill-parent"})})})]})})]})}const q=F;export{F as R,q as a};
@@ -1 +1 @@
1
- import{j as n}from"./radix-ui-nu4wz29m.js";import{r as a}from"./react-vendor-Bjx91N7w.js";import{e as P,f as Q,d as $,c as w,g as B,I as G}from"./index-HwlgKSWH.js";import{aR as H,av as L,m as V}from"./icons-DIVjDO-z.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function Z({value:o,onChange:h,options:f,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:R,triggerClassName:q,contentClassName:K}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,c]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>f.find(e=>e.value===o),[f,o]),d=a.useMemo(()=>{const e=S(y);return e?f.filter(t=>[t.searchText,...t.keywords??[]].some(u=>S(u).includes(e))):f},[f,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=d.filter(r=>!r.groupKey||!e.has(r.groupKey)),u=(g??[]).map(r=>({...r,options:d.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?u:[{key:"__default",options:t},...u]},[d,g]),s=a.useMemo(()=>d.filter(e=>!e.disabled),[d]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),c(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){c(void 0);return}c(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){c(s[0]?.value);return}if(e==="last"){c(s.at(-1)?.value);return}const t=s.findIndex(_=>_.value===i),u=e==="next"?-1:s.length,r=t>=0?t:u,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);c(s[x]?.value)},C=e=>{h(e),v(!1)},U=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(P,{open:l,onOpenChange:v,children:[n.jsx(Q,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",R,q,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(H,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",K),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),U();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx("div",{"data-slot":"searchable-select-scroll-container","data-testid":"searchable-select-scroll-container",className:"max-h-72 overflow-y-auto overscroll-contain",children:d.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const u=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||c(t.value)},onFocus:()=>{t.disabled||c(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",u&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{Z as S};
1
+ import{j as n}from"./radix-ui-nu4wz29m.js";import{r as a}from"./react-vendor-Bjx91N7w.js";import{e as P,f as Q,d as $,c as w,g as B,I as G}from"./index-BJl0cazY.js";import{aR as H,av as L,m as V}from"./icons-DIVjDO-z.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function Z({value:o,onChange:h,options:f,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:R,triggerClassName:q,contentClassName:K}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,c]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>f.find(e=>e.value===o),[f,o]),d=a.useMemo(()=>{const e=S(y);return e?f.filter(t=>[t.searchText,...t.keywords??[]].some(u=>S(u).includes(e))):f},[f,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=d.filter(r=>!r.groupKey||!e.has(r.groupKey)),u=(g??[]).map(r=>({...r,options:d.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?u:[{key:"__default",options:t},...u]},[d,g]),s=a.useMemo(()=>d.filter(e=>!e.disabled),[d]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),c(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){c(void 0);return}c(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){c(s[0]?.value);return}if(e==="last"){c(s.at(-1)?.value);return}const t=s.findIndex(_=>_.value===i),u=e==="next"?-1:s.length,r=t>=0?t:u,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);c(s[x]?.value)},C=e=>{h(e),v(!1)},U=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(P,{open:l,onOpenChange:v,children:[n.jsx(Q,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",R,q,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(H,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",K),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),U();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx("div",{"data-slot":"searchable-select-scroll-container","data-testid":"searchable-select-scroll-container",className:"max-h-72 overflow-y-auto overscroll-contain",children:d.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const u=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||c(t.value)},onFocus:()=>{t.disabled||c(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",u&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{Z as S};
@@ -1 +1 @@
1
- import{j as i,a0 as n}from"./radix-ui-nu4wz29m.js";import"./react-vendor-Bjx91N7w.js";import{c as e}from"./index-HwlgKSWH.js";function m({className:t,orientation:a="horizontal",decorative:o=!0,...r}){return i.jsx(n,{"data-slot":"separator",decorative:o,orientation:a,className:e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}export{m as S};
1
+ import{j as i,a0 as n}from"./radix-ui-nu4wz29m.js";import"./react-vendor-Bjx91N7w.js";import{c as e}from"./index-BJl0cazY.js";function m({className:t,orientation:a="horizontal",decorative:o=!0,...r}){return i.jsx(n,{"data-slot":"separator",decorative:o,orientation:a,className:e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}export{m as S};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as j}from"./react-vendor-Bjx91N7w.js";import{a as Q,bv as ee,bw as se,bx as te,Q as ae,R as re,U as ne,B as $,bi as S,bj as M,bk as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-HwlgKSWH.js";import{a3 as ce,aa as oe,b8 as me,T as E,R as T,F as he,av as ue,w as xe}from"./icons-DIVjDO-z.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./code-highlight-D4E79GKQ.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
1
+ import{j as e}from"./radix-ui-nu4wz29m.js";import{r as j}from"./react-vendor-Bjx91N7w.js";import{a as Q,bv as ee,bw as se,bx as te,Q as ae,R as re,U as ne,B as $,bi as S,bj as M,bk as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-BJl0cazY.js";import{a3 as ce,aa as oe,b8 as me,T as E,R as T,F as he,av as ue,w as xe}from"./icons-DIVjDO-z.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./code-highlight-D4E79GKQ.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
2
2
  `).trim();if(!a)return{blocks:[],frontmatter:[]};let l=a;const t=[];if(l.startsWith(`---
3
3
  `)){const r=l.indexOf(`
4
4
  ---
@@ -1 +1 @@
1
- import{j as t}from"./radix-ui-nu4wz29m.js";import"./react-vendor-Bjx91N7w.js";import{c as l}from"./index-HwlgKSWH.js";function n({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function c({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function b({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",a),...e})}function i({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}function m({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}export{n as T,c as a,b,i as c,d,m as e};
1
+ import{j as t}from"./radix-ui-nu4wz29m.js";import"./react-vendor-Bjx91N7w.js";import{c as l}from"./index-BJl0cazY.js";function n({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function c({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function b({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",a),...e})}function i({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}function m({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}export{n as T,c as a,b,i as c,d,m as e};
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{L,r as c}from"./react-vendor-Bjx91N7w.js";import{a as x,B as P,c as S,W as M,d as u,x as U,C,j as v,k as N,_ as w,b as j,n as b,I as B}from"./index-HwlgKSWH.js";import{a1 as F,$ as z,b9 as W,x as H,E as Q,Q as G,aa as K,C as q,ba as J,av as V}from"./icons-DIVjDO-z.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./code-highlight-D4E79GKQ.js";const Y={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function Z({status:s,className:t}){const{t:r}=x(),i={new:r("updates.statusNew"),stable:r("updates.statusStable"),planned:r("updates.statusPlanned")};return e.jsx(P,{variant:"outline",className:S("font-medium",Y[s],t),children:i[s]})}const g={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},X=[{id:"codex-target-runtime-support",title:"Native Codex runtime support is live",summary:"Codex now participates as a first-class runtime target through ccs-codex, ccsx, ccsxp, or --target codex.",primaryAction:"Use Codex as a runtime target for native Codex sessions and Codex-routed CLIProxy flows.",publishedAt:"2026-03-28",status:"new",scopes:["target","cliproxy","api-profiles"],entryIds:["codex-target","codex-cliproxy"],highlights:["Use ccs-codex or ccsx for native Codex runs.","Use ccsxp for native Codex with the cliproxy provider shortcut.","Use ccs codex --target codex when you want the explicit CCS-managed Codex bridge.","Codex remains runtime-only for saved defaults; use runtime aliases or --target codex at launch time."],actions:[{id:"copy-codex-alias-command",label:"Open native Codex",description:"Launch Codex through the explicit CCS runtime alias.",type:"command",command:"ccs-codex"},{id:"copy-codex-provider-command",label:"Run native Codex with cliproxy",description:"Use the native Codex cliproxy shortcut through CCS.",type:"command",command:'ccsxp "your prompt"'},{id:"copy-codex-provider-command-explicit",label:"Run the managed Codex bridge explicitly",description:"Use the explicit CCS-managed Codex bridge on native Codex.",type:"command",command:'ccs codex --target codex "your prompt"'},{id:"open-codex-dashboard",label:"Open Codex dashboard",description:"Review Codex runtime support, config layers, and dashboard setup flows.",type:"route",path:"/codex"}],routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx",'ccsxp "your prompt"','ccs codex --target codex "your prompt"']},{id:"droid-target-support",title:"Factory Droid support is live",summary:"API Profiles and CLIProxy variants now support Droid as a first-class execution target.",primaryAction:"Set Droid as your default execution target for non-Claude workflows.",publishedAt:"2026-02-25",status:"new",scopes:["target","api-profiles","cliproxy"],entryIds:["droid-target","custom-api-profiles","codex-cliproxy","agy-cliproxy"],highlights:["Set default target to Droid when creating or editing API Profiles.","Set default target to Droid for CLIProxy variants, including Codex and Antigravity flows.","Use ccs-droid as the explicit alias, with ccsd kept as the legacy shortcut."],actions:[{id:"open-api-profiles",label:"Set default target in API Profiles",description:"Open API Profiles and set Default Target to Droid for profiles you run often.",type:"route",path:"/providers"},{id:"open-cliproxy",label:"Set default target in CLIProxy variants",description:"Open CLIProxy variants and set target to Droid for Codex/Antigravity or custom variants.",type:"route",path:"/cliproxy"},{id:"copy-ccs-droid-command",label:"Run once with explicit Droid alias",description:"Use ccs-droid to force the Droid target with your current profile.",type:"command",command:"ccs-droid glm"},{id:"copy-target-override",label:"Run once with --target override",description:"Keep your default profile but force Droid for a single command.",type:"command",command:'ccs codex --target droid "your prompt"'}],routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates Center is available for rollout tasks",summary:"A focused Updates Center exists for setup tasks and rollout guidance when you need it.",primaryAction:"Use this page only when needed for rollout tasks, then return to your normal workflow.",publishedAt:"2026-02-25",status:"new",scopes:["target","cliproxy","api-profiles","websearch"],entryIds:["droid-target","codex-cliproxy","custom-api-profiles","opencode-websearch"],highlights:["Single data source powers update content and integration mapping.","Notices can be tracked as new, seen, done, or dismissed.","Catalog covers target CLI, CLIProxy providers, and WebSearch integrations."],actions:[{id:"open-updates-page",label:"Open Updates Center when needed",description:"Review rollout tasks only when you want guided setup changes.",type:"route",path:"/updates"},{id:"copy-open-dashboard",label:"Open dashboard from terminal",description:"Re-open config dashboard anytime from CLI.",type:"command",command:"ccs config"}],routes:[{label:"Updates Center",path:"/updates"}],commands:["ccs config"]}],ee=[{id:"claude-target",name:"Claude Code",scope:"target",status:"stable",summary:"Default runtime target for all CCS profile types.",pillars:{baseUrl:"From profile settings (ANTHROPIC_BASE_URL)",auth:"From profile settings (ANTHROPIC_AUTH_TOKEN)",model:"From profile settings (ANTHROPIC_MODEL)"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs",'ccs glm "your prompt"']},{id:"droid-target",name:"Factory Droid",scope:"target",status:"new",summary:"First-class target for API Profiles and CLIProxy variants.",pillars:{baseUrl:"From profile or variant settings",auth:"From profile or variant settings",model:"From profile or variant settings"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccs-droid as the explicit runtime alias. Legacy ccsd still works."},{id:"codex-target",name:"Codex CLI",scope:"target",status:"new",summary:"First-class runtime target for native Codex sessions and Codex-routed CLIProxy flows.",pillars:{baseUrl:"Native ~/.codex config for default mode, transient -c overrides for CCS-backed routes",auth:"Native Codex auth for default mode, env_key injection for CCS-backed routes",model:"Native Codex config or routed Codex model mapping from CLIProxy"},routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx","ccs codex --target codex","ccs codex-api --target codex"],notes:"Codex is still runtime-only for saved defaults; use --target codex or the runtime aliases at launch time."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and a native Codex shortcut.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:['ccsxp "your prompt"',"ccs codex --target codex","ccs codex","ccs cliproxy create mycodex --provider codex","ccs api create codex-api --cliproxy-provider codex"],notes:"Use ccsxp when you want native Codex with the cliproxy shortcut; use ccs codex --target codex for the explicit managed bridge."},{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."}];function l(s,t,r){return M.t(s,{defaultValue:t,...r})}function se(){return{target:l("supportCatalog.scope.target",g.target),cliproxy:l("supportCatalog.scope.cliproxy",g.cliproxy),"api-profiles":l("supportCatalog.scope.apiProfiles",g["api-profiles"]),websearch:l("supportCatalog.scope.websearch",g.websearch)}}function te(s){return{...s,title:l(`supportCatalog.notice.${s.id}.title`,s.title),summary:l(`supportCatalog.notice.${s.id}.summary`,s.summary),primaryAction:l(`supportCatalog.notice.${s.id}.primaryAction`,s.primaryAction),highlights:s.highlights.map((t,r)=>l(`supportCatalog.notice.${s.id}.highlight.${r}`,t)),actions:s.actions.map(t=>({...t,label:l(`supportCatalog.notice.${s.id}.action.${t.id}.label`,t.label),description:l(`supportCatalog.notice.${s.id}.action.${t.id}.description`,t.description)})),routes:s.routes.map((t,r)=>({...t,label:l(`supportCatalog.notice.${s.id}.route.${r}.label`,t.label)}))}}function re(s){return{...s,name:l(`supportCatalog.entry.${s.id}.name`,s.name),summary:l(`supportCatalog.entry.${s.id}.summary`,s.summary),pillars:{baseUrl:l(`supportCatalog.entry.${s.id}.pillar.baseUrl`,s.pillars.baseUrl),auth:l(`supportCatalog.entry.${s.id}.pillar.auth`,s.pillars.auth),model:l(`supportCatalog.entry.${s.id}.pillar.model`,s.pillars.model)},routes:s.routes.map((t,r)=>({...t,label:l(`supportCatalog.entry.${s.id}.route.${r}.label`,t.label)})),notes:s.notes?l(`supportCatalog.entry.${s.id}.notes`,s.notes):s.notes}}function ae(){return X.map(te)}function oe(){return ee.map(re)}function ie(s){const t=new Map(oe().map(r=>[r.id,r]));return s.entryIds.map(r=>t.get(r)).filter(r=>!!r)}function O(s){const t=new Date(`${s}T00:00:00Z`);return Number.isNaN(t.getTime())?s:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(t)}const $="ccs:updates:notice-progress:v1";function de(s){return s==="new"?"new":"seen"}function m(s,t){return t[s.id]??de(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function le(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem($);if(!s)return{};const t=JSON.parse(s);if(!t||typeof t!="object"||Array.isArray(t))return{};const r={};for(const[i,d]of Object.entries(t))typeof i=="string"&&(d==="new"||d==="seen"||d==="done"||d==="dismissed")&&(r[i]=d);return r}catch{return{}}}function ne(s){typeof window>"u"||window.localStorage.setItem($,JSON.stringify(s))}function D({state:s,className:t}){const{t:r}=x(),i={new:{label:r("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:r("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:r("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:r("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(P,{variant:"outline",className:S("gap-1.5 border text-[10px] font-medium",i.className,t),children:[i.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),i.label]})}function ce({action:s}){const{t}=x();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(u,{size:"sm",asChild:!0,children:e.jsxs(L,{to:s.path,children:[t("updates.open"),e.jsx(F,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(z,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(U,{value:s.command})]})]})}function pe({notice:s,progress:t,relatedEntries:r,onUpdateProgress:i}){const{t:d}=x(),f=se();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsx(D,{state:t}),e.jsx(Z,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(W,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:d("updates.published",{date:O(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(u,{size:"sm",onClick:()=>i("done"),children:[e.jsx(H,{className:"h-4 w-4"}),d("updates.markDone")]}),e.jsxs(u,{size:"sm",variant:"outline",onClick:()=>i("dismissed"),children:[e.jsx(Q,{className:"h-4 w-4"}),d("updates.dismiss")]}),e.jsxs(u,{size:"sm",variant:"ghost",onClick:()=>i("new"),children:[e.jsx(G,{className:"h-4 w-4"}),d("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(C,{className:"h-full overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:d("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(o=>e.jsx(ce,{action:o},`${s.id}-${o.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(C,{className:"overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:d("updates.impactedIntegrations")}),e.jsx(w,{children:d("updates.impactedDesc")})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:r.map(o=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:o.name}),e.jsx(P,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:f[o.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[o.routes[0]&&e.jsx(u,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(L,{to:o.routes[0].path,children:o.routes[0].label})}),o.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:o.commands[0]}),e.jsx(U,{value:o.commands[0]})]})]})]},o.id))})})})]}),e.jsxs(C,{className:"overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:d("updates.whyMatters")}),e.jsx(w,{children:d("updates.whyMattersDesc")})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(o=>e.jsxs("li",{children:["- ",o]},`${s.id}-${o}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:d("updates.noUpdates")})})}function me({notice:s,progress:t,selected:r,onSelect:i}){return e.jsxs("button",{type:"button",onClick:i,className:S("w-full rounded-lg border px-3 py-3 text-left transition-colors",r?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(q,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:O(s.publishedAt)}),e.jsx(D,{state:t})]})]})}function ue(s,t){return t?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(i=>`${i.label} ${i.description} ${i.command||""}`),...s.routes.map(i=>i.label)].join(" ").toLowerCase().includes(t):!0}function je(){const{t:s}=x(),t=[...ae()].sort((a,n)=>n.publishedAt.localeCompare(a.publishedAt)),[r,i]=c.useState("inbox"),[d,f]=c.useState(""),[o,k]=c.useState(()=>le()),[I,E]=c.useState(null);c.useEffect(()=>{ne(o)},[o]);const h=c.useMemo(()=>{const a=d.trim().toLowerCase();return t.filter(n=>{const y=m(n,o);return ue(n,a)?r==="done"?y==="done":r==="inbox"?A(y):!0:!1})},[t,o,d,r]),p=c.useMemo(()=>{const a=r==="all"?t:h;return a.find(n=>n.id===I)??a[0]??null},[t,I,r,h]),R=a=>{E(a.id),k(n=>m(a,n)!=="new"?n:{...n,[a.id]:"seen"})},T=c.useMemo(()=>t.filter(a=>A(m(a,o))).length,[t,o]),_=c.useMemo(()=>t.filter(a=>m(a,o)==="done").length,[t,o]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:T})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(V,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:d,onChange:a=>f(a.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(a=>e.jsx(u,{size:"sm",variant:r===a.id?"default":"outline",onClick:()=>i(a.id),children:a.label},a.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(a=>e.jsx(me,{notice:a,progress:m(a,o),selected:p?.id===a.id,onSelect:()=>R(a)},a.id))})})]}),e.jsx(pe,{notice:p,progress:p?m(p,o):null,relatedEntries:p?ie(p):[],onUpdateProgress:a=>{p&&k(n=>({...n,[p.id]:a}))}})]})}export{je as UpdatesPage};
1
+ import{j as e}from"./radix-ui-nu4wz29m.js";import{L,r as c}from"./react-vendor-Bjx91N7w.js";import{a as x,B as P,c as S,W as M,d as u,x as U,C,j as v,k as N,_ as w,b as j,n as b,I as B}from"./index-BJl0cazY.js";import{a1 as F,$ as z,b9 as W,x as H,E as Q,Q as G,aa as K,C as q,ba as J,av as V}from"./icons-DIVjDO-z.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./code-highlight-D4E79GKQ.js";const Y={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function Z({status:s,className:t}){const{t:r}=x(),i={new:r("updates.statusNew"),stable:r("updates.statusStable"),planned:r("updates.statusPlanned")};return e.jsx(P,{variant:"outline",className:S("font-medium",Y[s],t),children:i[s]})}const g={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},X=[{id:"codex-target-runtime-support",title:"Native Codex runtime support is live",summary:"Codex now participates as a first-class runtime target through ccs-codex, ccsx, ccsxp, or --target codex.",primaryAction:"Use Codex as a runtime target for native Codex sessions and Codex-routed CLIProxy flows.",publishedAt:"2026-03-28",status:"new",scopes:["target","cliproxy","api-profiles"],entryIds:["codex-target","codex-cliproxy"],highlights:["Use ccs-codex or ccsx for native Codex runs.","Use ccsxp for native Codex with the cliproxy provider shortcut.","Use ccs codex --target codex when you want the explicit CCS-managed Codex bridge.","Codex remains runtime-only for saved defaults; use runtime aliases or --target codex at launch time."],actions:[{id:"copy-codex-alias-command",label:"Open native Codex",description:"Launch Codex through the explicit CCS runtime alias.",type:"command",command:"ccs-codex"},{id:"copy-codex-provider-command",label:"Run native Codex with cliproxy",description:"Use the native Codex cliproxy shortcut through CCS.",type:"command",command:'ccsxp "your prompt"'},{id:"copy-codex-provider-command-explicit",label:"Run the managed Codex bridge explicitly",description:"Use the explicit CCS-managed Codex bridge on native Codex.",type:"command",command:'ccs codex --target codex "your prompt"'},{id:"open-codex-dashboard",label:"Open Codex dashboard",description:"Review Codex runtime support, config layers, and dashboard setup flows.",type:"route",path:"/codex"}],routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx",'ccsxp "your prompt"','ccs codex --target codex "your prompt"']},{id:"droid-target-support",title:"Factory Droid support is live",summary:"API Profiles and CLIProxy variants now support Droid as a first-class execution target.",primaryAction:"Set Droid as your default execution target for non-Claude workflows.",publishedAt:"2026-02-25",status:"new",scopes:["target","api-profiles","cliproxy"],entryIds:["droid-target","custom-api-profiles","codex-cliproxy","agy-cliproxy"],highlights:["Set default target to Droid when creating or editing API Profiles.","Set default target to Droid for CLIProxy variants, including Codex and Antigravity flows.","Use ccs-droid as the explicit alias, with ccsd kept as the legacy shortcut."],actions:[{id:"open-api-profiles",label:"Set default target in API Profiles",description:"Open API Profiles and set Default Target to Droid for profiles you run often.",type:"route",path:"/providers"},{id:"open-cliproxy",label:"Set default target in CLIProxy variants",description:"Open CLIProxy variants and set target to Droid for Codex/Antigravity or custom variants.",type:"route",path:"/cliproxy"},{id:"copy-ccs-droid-command",label:"Run once with explicit Droid alias",description:"Use ccs-droid to force the Droid target with your current profile.",type:"command",command:"ccs-droid glm"},{id:"copy-target-override",label:"Run once with --target override",description:"Keep your default profile but force Droid for a single command.",type:"command",command:'ccs codex --target droid "your prompt"'}],routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates Center is available for rollout tasks",summary:"A focused Updates Center exists for setup tasks and rollout guidance when you need it.",primaryAction:"Use this page only when needed for rollout tasks, then return to your normal workflow.",publishedAt:"2026-02-25",status:"new",scopes:["target","cliproxy","api-profiles","websearch"],entryIds:["droid-target","codex-cliproxy","custom-api-profiles","opencode-websearch"],highlights:["Single data source powers update content and integration mapping.","Notices can be tracked as new, seen, done, or dismissed.","Catalog covers target CLI, CLIProxy providers, and WebSearch integrations."],actions:[{id:"open-updates-page",label:"Open Updates Center when needed",description:"Review rollout tasks only when you want guided setup changes.",type:"route",path:"/updates"},{id:"copy-open-dashboard",label:"Open dashboard from terminal",description:"Re-open config dashboard anytime from CLI.",type:"command",command:"ccs config"}],routes:[{label:"Updates Center",path:"/updates"}],commands:["ccs config"]}],ee=[{id:"claude-target",name:"Claude Code",scope:"target",status:"stable",summary:"Default runtime target for all CCS profile types.",pillars:{baseUrl:"From profile settings (ANTHROPIC_BASE_URL)",auth:"From profile settings (ANTHROPIC_AUTH_TOKEN)",model:"From profile settings (ANTHROPIC_MODEL)"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs",'ccs glm "your prompt"']},{id:"droid-target",name:"Factory Droid",scope:"target",status:"new",summary:"First-class target for API Profiles and CLIProxy variants.",pillars:{baseUrl:"From profile or variant settings",auth:"From profile or variant settings",model:"From profile or variant settings"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccs-droid as the explicit runtime alias. Legacy ccsd still works."},{id:"codex-target",name:"Codex CLI",scope:"target",status:"new",summary:"First-class runtime target for native Codex sessions and Codex-routed CLIProxy flows.",pillars:{baseUrl:"Native ~/.codex config for default mode, transient -c overrides for CCS-backed routes",auth:"Native Codex auth for default mode, env_key injection for CCS-backed routes",model:"Native Codex config or routed Codex model mapping from CLIProxy"},routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx","ccs codex --target codex","ccs codex-api --target codex"],notes:"Codex is still runtime-only for saved defaults; use --target codex or the runtime aliases at launch time."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and a native Codex shortcut.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:['ccsxp "your prompt"',"ccs codex --target codex","ccs codex","ccs cliproxy create mycodex --provider codex","ccs api create codex-api --cliproxy-provider codex"],notes:"Use ccsxp when you want native Codex with the cliproxy shortcut; use ccs codex --target codex for the explicit managed bridge."},{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."}];function l(s,t,r){return M.t(s,{defaultValue:t,...r})}function se(){return{target:l("supportCatalog.scope.target",g.target),cliproxy:l("supportCatalog.scope.cliproxy",g.cliproxy),"api-profiles":l("supportCatalog.scope.apiProfiles",g["api-profiles"]),websearch:l("supportCatalog.scope.websearch",g.websearch)}}function te(s){return{...s,title:l(`supportCatalog.notice.${s.id}.title`,s.title),summary:l(`supportCatalog.notice.${s.id}.summary`,s.summary),primaryAction:l(`supportCatalog.notice.${s.id}.primaryAction`,s.primaryAction),highlights:s.highlights.map((t,r)=>l(`supportCatalog.notice.${s.id}.highlight.${r}`,t)),actions:s.actions.map(t=>({...t,label:l(`supportCatalog.notice.${s.id}.action.${t.id}.label`,t.label),description:l(`supportCatalog.notice.${s.id}.action.${t.id}.description`,t.description)})),routes:s.routes.map((t,r)=>({...t,label:l(`supportCatalog.notice.${s.id}.route.${r}.label`,t.label)}))}}function re(s){return{...s,name:l(`supportCatalog.entry.${s.id}.name`,s.name),summary:l(`supportCatalog.entry.${s.id}.summary`,s.summary),pillars:{baseUrl:l(`supportCatalog.entry.${s.id}.pillar.baseUrl`,s.pillars.baseUrl),auth:l(`supportCatalog.entry.${s.id}.pillar.auth`,s.pillars.auth),model:l(`supportCatalog.entry.${s.id}.pillar.model`,s.pillars.model)},routes:s.routes.map((t,r)=>({...t,label:l(`supportCatalog.entry.${s.id}.route.${r}.label`,t.label)})),notes:s.notes?l(`supportCatalog.entry.${s.id}.notes`,s.notes):s.notes}}function ae(){return X.map(te)}function oe(){return ee.map(re)}function ie(s){const t=new Map(oe().map(r=>[r.id,r]));return s.entryIds.map(r=>t.get(r)).filter(r=>!!r)}function O(s){const t=new Date(`${s}T00:00:00Z`);return Number.isNaN(t.getTime())?s:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(t)}const $="ccs:updates:notice-progress:v1";function de(s){return s==="new"?"new":"seen"}function m(s,t){return t[s.id]??de(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function le(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem($);if(!s)return{};const t=JSON.parse(s);if(!t||typeof t!="object"||Array.isArray(t))return{};const r={};for(const[i,d]of Object.entries(t))typeof i=="string"&&(d==="new"||d==="seen"||d==="done"||d==="dismissed")&&(r[i]=d);return r}catch{return{}}}function ne(s){typeof window>"u"||window.localStorage.setItem($,JSON.stringify(s))}function D({state:s,className:t}){const{t:r}=x(),i={new:{label:r("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:r("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:r("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:r("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(P,{variant:"outline",className:S("gap-1.5 border text-[10px] font-medium",i.className,t),children:[i.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),i.label]})}function ce({action:s}){const{t}=x();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(u,{size:"sm",asChild:!0,children:e.jsxs(L,{to:s.path,children:[t("updates.open"),e.jsx(F,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(z,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(U,{value:s.command})]})]})}function pe({notice:s,progress:t,relatedEntries:r,onUpdateProgress:i}){const{t:d}=x(),f=se();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsx(D,{state:t}),e.jsx(Z,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(W,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:d("updates.published",{date:O(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(u,{size:"sm",onClick:()=>i("done"),children:[e.jsx(H,{className:"h-4 w-4"}),d("updates.markDone")]}),e.jsxs(u,{size:"sm",variant:"outline",onClick:()=>i("dismissed"),children:[e.jsx(Q,{className:"h-4 w-4"}),d("updates.dismiss")]}),e.jsxs(u,{size:"sm",variant:"ghost",onClick:()=>i("new"),children:[e.jsx(G,{className:"h-4 w-4"}),d("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(C,{className:"h-full overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:d("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(o=>e.jsx(ce,{action:o},`${s.id}-${o.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(C,{className:"overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:d("updates.impactedIntegrations")}),e.jsx(w,{children:d("updates.impactedDesc")})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:r.map(o=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:o.name}),e.jsx(P,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:f[o.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[o.routes[0]&&e.jsx(u,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(L,{to:o.routes[0].path,children:o.routes[0].label})}),o.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:o.commands[0]}),e.jsx(U,{value:o.commands[0]})]})]})]},o.id))})})})]}),e.jsxs(C,{className:"overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:d("updates.whyMatters")}),e.jsx(w,{children:d("updates.whyMattersDesc")})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(o=>e.jsxs("li",{children:["- ",o]},`${s.id}-${o}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:d("updates.noUpdates")})})}function me({notice:s,progress:t,selected:r,onSelect:i}){return e.jsxs("button",{type:"button",onClick:i,className:S("w-full rounded-lg border px-3 py-3 text-left transition-colors",r?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(q,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:O(s.publishedAt)}),e.jsx(D,{state:t})]})]})}function ue(s,t){return t?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(i=>`${i.label} ${i.description} ${i.command||""}`),...s.routes.map(i=>i.label)].join(" ").toLowerCase().includes(t):!0}function je(){const{t:s}=x(),t=[...ae()].sort((a,n)=>n.publishedAt.localeCompare(a.publishedAt)),[r,i]=c.useState("inbox"),[d,f]=c.useState(""),[o,k]=c.useState(()=>le()),[I,E]=c.useState(null);c.useEffect(()=>{ne(o)},[o]);const h=c.useMemo(()=>{const a=d.trim().toLowerCase();return t.filter(n=>{const y=m(n,o);return ue(n,a)?r==="done"?y==="done":r==="inbox"?A(y):!0:!1})},[t,o,d,r]),p=c.useMemo(()=>{const a=r==="all"?t:h;return a.find(n=>n.id===I)??a[0]??null},[t,I,r,h]),R=a=>{E(a.id),k(n=>m(a,n)!=="new"?n:{...n,[a.id]:"seen"})},T=c.useMemo(()=>t.filter(a=>A(m(a,o))).length,[t,o]),_=c.useMemo(()=>t.filter(a=>m(a,o)==="done").length,[t,o]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:T})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(V,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:d,onChange:a=>f(a.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(a=>e.jsx(u,{size:"sm",variant:r===a.id?"default":"outline",onClick:()=>i(a.id),children:a.label},a.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(a=>e.jsx(me,{notice:a,progress:m(a,o),selected:p?.id===a.id,onSelect:()=>R(a)},a.id))})})]}),e.jsx(pe,{notice:p,progress:p?m(p,o):null,relatedEntries:p?ie(p):[],onUpdateProgress:a=>{p&&k(n=>({...n,[p.id]:a}))}})]})}export{je as UpdatesPage};
@@ -24,7 +24,7 @@
24
24
  href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
25
25
  rel="stylesheet"
26
26
  />
27
- <script type="module" crossorigin src="/assets/index-HwlgKSWH.js"></script>
27
+ <script type="module" crossorigin src="/assets/index-BJl0cazY.js"></script>
28
28
  <link rel="modulepreload" crossorigin href="/assets/react-vendor-Bjx91N7w.js">
29
29
  <link rel="modulepreload" crossorigin href="/assets/radix-ui-nu4wz29m.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/tanstack-bhJxV1h8.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "7.77.1-dev.8",
3
+ "version": "7.77.1-dev.9",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude, GLM, Kimi, and more",
5
5
  "keywords": [
6
6
  "cli",