@kaitranntt/ccs 7.54.0-dev.1 → 7.54.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cursor/cursor-anthropic-response.d.ts +6 -0
- package/dist/cursor/cursor-anthropic-response.d.ts.map +1 -0
- package/dist/cursor/cursor-anthropic-response.js +190 -0
- package/dist/cursor/cursor-anthropic-response.js.map +1 -0
- package/dist/cursor/cursor-anthropic-translator.d.ts +11 -0
- package/dist/cursor/cursor-anthropic-translator.d.ts.map +1 -0
- package/dist/cursor/cursor-anthropic-translator.js +167 -0
- package/dist/cursor/cursor-anthropic-translator.js.map +1 -0
- package/dist/cursor/cursor-anthropic-types.d.ts +46 -0
- package/dist/cursor/cursor-anthropic-types.d.ts.map +1 -0
- package/dist/cursor/cursor-anthropic-types.js +3 -0
- package/dist/cursor/cursor-anthropic-types.js.map +1 -0
- package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon-entry.js +53 -24
- package/dist/cursor/cursor-daemon-entry.js.map +1 -1
- package/dist/cursor/cursor-models.d.ts.map +1 -1
- package/dist/cursor/cursor-models.js +36 -2
- package/dist/cursor/cursor-models.js.map +1 -1
- package/dist/glmt/sse-parser.d.ts +2 -0
- package/dist/glmt/sse-parser.d.ts.map +1 -1
- package/dist/glmt/sse-parser.js +4 -0
- package/dist/glmt/sse-parser.js.map +1 -1
- package/dist/shared/provider-preset-catalog.d.ts +1 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +15 -0
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/ui/assets/{accounts-CZEg1_PX.js → accounts-CrNRfOOP.js} +1 -1
- package/dist/ui/assets/{alert-dialog-DhwS38kc.js → alert-dialog-0GYXcDLu.js} +1 -1
- package/dist/ui/assets/{api-sWNND4wP.js → api-Du9rjWhx.js} +1 -1
- package/dist/ui/assets/{auth-section-nJIpOcnm.js → auth-section-DMcsqZyo.js} +1 -1
- package/dist/ui/assets/{backups-section-D3A6hmrU.js → backups-section-Bu4mUdGV.js} +1 -1
- package/dist/ui/assets/{checkbox-CZrxD1iS.js → checkbox-DiyJL_k4.js} +1 -1
- package/dist/ui/assets/{claude-extension-BjInaILv.js → claude-extension-CUlLIos9.js} +1 -1
- package/dist/ui/assets/{cliproxy-BGiSCGkl.js → cliproxy-DS95Joc9.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-CKO2Sn9B.js → cliproxy-control-panel-BNUMUGIt.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-DTKxwrat.js → confirm-dialog-DTWvVQlx.js} +1 -1
- package/dist/ui/assets/{copilot-CuRngdBg.js → copilot-p2K9Y5LR.js} +1 -1
- package/dist/ui/assets/{cursor-Dxo0uIiU.js → cursor-5SbcR5sW.js} +1 -1
- package/dist/ui/assets/{droid-Cl8QsJJL.js → droid-DxdiLHHD.js} +1 -1
- package/dist/ui/assets/{globalenv-section-C3dxxoD9.js → globalenv-section-B9l_4XUg.js} +1 -1
- package/dist/ui/assets/{health-BUifaDU7.js → health-DDs2IlMm.js} +1 -1
- package/dist/ui/assets/{index-CYo-E5rU.js → index-Cy76XBS9.js} +1 -1
- package/dist/ui/assets/{index-xayyyR26.js → index-D3yHEBlf.js} +1 -1
- package/dist/ui/assets/{index-Cw9Urr0S.js → index-JgHDFSHt.js} +3 -3
- package/dist/ui/assets/{index-CPdceT1C.js → index-X7b7NDPo.js} +1 -1
- package/dist/ui/assets/{index-BOsbrhaa.js → index-awSrtRcI.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-D94htBPb.js → proxy-status-widget-DEkHz7X-.js} +1 -1
- package/dist/ui/assets/{separator-3fBbTn-V.js → separator-BFr5KvfF.js} +1 -1
- package/dist/ui/assets/{shared-q_FNNbjD.js → shared-BwP9MOQi.js} +1 -1
- package/dist/ui/assets/{switch-5N8qBdBr.js → switch-w7IoOY5x.js} +1 -1
- package/dist/ui/assets/{updates-CubQ54J0.js → updates--SN_PZnJ.js} +1 -1
- package/dist/ui/icons/novita.svg +9 -0
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as n}from"./react-vendor-CNOkPC89.js";import{bk as Oe,bl as Ve,Y as L,a as ae,I as B,r as He,s as Ue,t as ze,v as We,w as ue,d as H,bm as Ye,bn as Ge,bo as Xe,b5 as se,b7 as te,n as qe}from"./index-Cw9Urr0S.js";import{S as D}from"./switch-5N8qBdBr.js";import{C as U}from"./default-ports-1QQSffYX.js";import{aU as he,R as re,g as Je,v as fe,W as Qe,x as Ze,aV as es,aW as ss,T as ye,at as ts,o as rs,aX as as}from"./icons-DrEfTmfX.js";import{R as V,P as os}from"./proxy-status-widget-D94htBPb.js";import{t as T}from"./notifications-B2HqRBj7.js";import"./tanstack-e99Cjjy2.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DhwS38kc.js";function ns(){const{state:s}=Oe(),t=Ve(),[g,o]=n.useState(null),[u,b]=n.useState(null),[y,j]=n.useState(null),[p,C]=n.useState(null),[S,P]=n.useState(null),w=n.useCallback(async()=>{try{t.setProxyLoading(!0),t.setProxyError(null);const d=await L.cliproxyServer.get();t.setProxyConfig(d)}catch(d){t.setProxyError(d.message)}finally{t.setProxyLoading(!1)}},[t]),A=n.useCallback(async d=>{const x=s.proxyConfig;if(!x)return;const h={remote:{...x.remote,...d.remote},fallback:{...x.fallback,...d.fallback},local:{...x.local,...d.local}};t.setProxyConfig(h),t.setProxyTestResult(null);try{t.setProxySaving(!0),t.setProxyError(null);const a=await L.cliproxyServer.update(d);t.setProxyConfig(a),t.setProxySuccess(!0),setTimeout(()=>t.setProxySuccess(!1),1500)}catch(a){t.setProxyConfig(x),t.setProxyError(a.message)}finally{t.setProxySaving(!1)}},[s.proxyConfig,t]),E=n.useCallback(async d=>{const{host:x,port:h,protocol:a,authToken:c}=d;if(!x){t.setProxyError("Host is required");return}try{t.setProxyTesting(!0),t.setProxyError(null),t.setProxyTestResult(null);const k=h?parseInt(h,10):void 0,l=await L.cliproxyServer.test({host:x,port:k||void 0,protocol:a,authToken:c||void 0});t.setProxyTestResult(l)}catch(k){t.setProxyError(k.message)}finally{t.setProxyTesting(!1)}},[t]);return{config:s.proxyConfig,loading:s.proxyLoading,saving:s.proxySaving,error:s.proxyError,success:s.proxySuccess,testResult:s.proxyTestResult,testing:s.proxyTesting,editedHost:g,setEditedHost:o,editedPort:u,setEditedPort:b,editedAuthToken:y,setEditedAuthToken:j,editedManagementKey:p,setEditedManagementKey:C,editedLocalPort:S,setEditedLocalPort:P,fetchConfig:w,saveConfig:A,testConnection:E}}function is({config:s,saving:t,displayLocalPort:g,setEditedLocalPort:o,onSaveLocalPort:u,onSaveConfig:b}){const{t:y}=ae(),j=s.local;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:y("settingsProxy.localProxy")}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:y("settingsProxy.port")}),e.jsx(B,{type:"text",inputMode:"numeric",value:g,onChange:p=>o(p.target.value.replace(/\D/g,"")),onBlur:u,placeholder:`${U}`,className:"font-mono max-w-32",disabled:t})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:y("settingsProxy.autoStart")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y("settingsProxy.localAutoStartDesc")})]}),e.jsx(D,{checked:j.auto_start??!0,onCheckedChange:p=>b({local:{...j,auto_start:p}}),disabled:t})]})]})]})}function ls({config:s,saving:t,testing:g,testResult:o,displayHost:u,displayPort:b,displayAuthToken:y,displayManagementKey:j,setEditedHost:p,setEditedPort:C,setEditedAuthToken:S,setEditedManagementKey:P,onSaveHost:w,onSavePort:A,onSaveAuthToken:E,onSaveManagementKey:d,onSaveConfig:x,onTestConnection:h}){const{t:a}=ae(),c=s.remote,k=l=>l==="https"?443:U;return e.jsxs("div",{className:"space-y-4 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("h4",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4"}),a("settingsProxy.remoteConfigTitle")]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.host")}),e.jsx(B,{value:u,onChange:l=>p(l.target.value),onBlur:w,placeholder:a("settingsProxy.hostPlaceholder"),className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm text-muted-foreground",children:[a("settingsProxy.port")," ",e.jsxs("span",{className:"text-xs opacity-70",children:["(",a("settingsProxy.defaultPort",{value:k(s.remote.protocol||"http")}),")"]})]}),e.jsx(B,{type:"text",inputMode:"numeric",value:b,onChange:l=>C(l.target.value.replace(/\D/g,"")),onBlur:A,placeholder:a("settingsProxy.portPlaceholder",{value:k(s.remote.protocol||"http")}),className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.protocol")}),e.jsxs(He,{value:s.remote.protocol||"http",onValueChange:l=>x({remote:{...c,protocol:l}}),disabled:t,children:[e.jsx(Ue,{children:e.jsx(ze,{})}),e.jsxs(We,{children:[e.jsx(ue,{value:"http",children:a("settingsProxy.http")}),e.jsx(ue,{value:"https",children:a("settingsProxy.https")})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.apiKeyOptional")}),e.jsx(B,{type:"password",value:y,onChange:l=>S(l.target.value),onBlur:E,placeholder:a("settingsProxy.apiKeyPlaceholder"),className:"font-mono",disabled:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settingsProxy.apiKeyDesc")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.managementKeyOptional")}),e.jsx(B,{type:"password",value:j,onChange:l=>P(l.target.value),onBlur:d,placeholder:a("settingsProxy.managementKeyPlaceholder"),className:"font-mono",disabled:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settingsProxy.managementKeyDesc")})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(H,{onClick:h,disabled:g||!u,variant:"outline",className:"w-full",children:g?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-2 animate-spin"}),a("settingsProxy.testing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),a("settingsProxy.testConnection")]})}),o&&e.jsx("div",{className:`p-3 rounded-md ${o.reachable?"bg-green-50 border border-green-200 dark:bg-green-900/20 dark:border-green-900/50":"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50"}`,children:e.jsx("div",{className:"flex items-center gap-2",children:o.reachable?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:a("settingsProxy.connectedLatency",{value:o.latencyMs})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Qe,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:o.error||a("settingsProxy.connectionFailed")})]})})})]})]})}const pe="ccs_debug_mode",cs=["kiro","ghcp"];function ds(s){return s.trim().replace(/\s+/g," ").toUpperCase()}function Cs(){const{t:s}=ae(),{config:t,loading:g,saving:o,error:u,success:b,testResult:y,testing:j,editedHost:p,setEditedHost:C,editedPort:S,setEditedPort:P,editedAuthToken:w,setEditedAuthToken:A,editedManagementKey:E,setEditedManagementKey:d,editedLocalPort:x,setEditedLocalPort:h,fetchConfig:a,saveConfig:c,testConnection:k}=ns(),{fetchRawConfig:l}=Ye(),[_,be]=n.useState(()=>{try{return localStorage.getItem(pe)==="true"}catch{return!1}}),[je,z]=n.useState(!1),[Pe,oe]=n.useState(!0),[f,ne]=n.useState(!1),[ke,R]=n.useState(!1),[ie,I]=n.useState(""),K=n.useRef(!1),W=ds(ie)===V,ve=r=>{be(r);try{localStorage.setItem(pe,String(r))}catch{}},Y=n.useCallback(async()=>{try{oe(!0);const r=await fetch("/api/settings/auth/antigravity-risk");if(!r.ok)throw new Error(s("settingsProxy.failedLoadAgyMode"));const i=await r.json();z(i.antigravityAckBypass===!0)}catch(r){T.error(r instanceof Error?r.message:s("settingsProxy.failedLoadAgyMode")),z(!1)}finally{oe(!1)}},[s]),$=n.useCallback(async r=>{if(!(K.current||f||o))try{K.current=!0,ne(!0);const i=await fetch("/api/settings/auth/antigravity-risk",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({antigravityAckBypass:r})}),O=await i.json();if(!i.ok)throw new Error(O.error||s("settingsProxy.failedUpdateAgyMode"));const Fe=O.antigravityAckBypass===!0,me=await fetch("/api/settings/auth/antigravity-risk",{cache:"no-store"});if(!me.ok)throw new Error(s("settingsProxy.failedVerifyAgyMode"));const ge=(await me.json()).antigravityAckBypass===!0;if(ge!==r)throw new Error(s("settingsProxy.notPersistedAgyMode"));z(ge&&Fe),R(!1),I(""),T.success(s(r?"settingsProxy.agyModeEnabled":"settingsProxy.agyModeDisabled")),await l()}catch(i){T.error(i instanceof Error?i.message:s("settingsProxy.failedUpdateAgyMode"))}finally{K.current=!1,ne(!1)}},[f,l,o,s]),Ne=n.useCallback(r=>{if(!(K.current||f||o)){if(r){R(!0);return}R(!1),I(""),$(!1)}},[f,$,o]),Ce=n.useCallback(()=>{if(!W){T.error(s("settingsProxy.typePhraseToContinue",{value:V}));return}$(!0)},[W,$,s]),[v,G]=n.useState("plus"),[Se,we]=n.useState(!1),X=Ge(),{data:Ae}=Xe(),le=Ae?.running??!1,q=n.useCallback(async()=>{try{const r=await L.cliproxyServer.getBackend();G(r.backend)}catch(r){console.error("[Proxy] Failed to fetch backend:",r)}},[]),J=n.useCallback(async()=>{try{const i=(await L.cliproxy.list()).variants.some(O=>cs.includes(O.provider));we(i)}catch(r){console.error("[Proxy] Failed to check variants:",r)}},[]),ce=r=>{const i=v;G(r),X.mutate({backend:r},{onError:()=>{G(i)}})};if(n.useEffect(()=>{if(_&&t){const r={...t,remote:{...t.remote,auth_token:t.remote.auth_token?"[REDACTED]":void 0,management_key:t.remote.management_key?"[REDACTED]":void 0}};console.log("[CCS Debug] Debug mode enabled - proxy config:",r)}},[_,t]),n.useEffect(()=>{a(),Y(),l(),q(),J()},[a,Y,l,q,J]),g||!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(re,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})});const m=t.remote.enabled??!1,F=!m&&le,N=t.remote,M=t.fallback,Ee=t.remote.host??"",Te=t.remote.port!==void 0?t.remote.port.toString():"",Be=t.remote.auth_token??"",Me=t.remote.management_key??"",De=(t.local.port??U).toString(),Q=p??Ee,Z=S??Te,ee=w??Be,de=E??Me,xe=x??De,Le=()=>{const r=p??Q;r!==t.remote.host&&c({remote:{...N,host:r}}),C(null)},_e=()=>{const r=(S??Z).trim();if(r===""){t.remote.port!==void 0&&c({remote:{...N,port:void 0}}),P(null);return}const i=Number(r);if(!Number.isInteger(i)||i<1||i>65535){T.error(s("settingsProxy.invalidPortOrEmpty")),P(null);return}i!==t.remote.port&&c({remote:{...N,port:i}}),P(null)},Re=()=>{const r=w??ee;r!==t.remote.auth_token&&c({remote:{...N,auth_token:r}}),A(null)},Ie=()=>{const r=E??de;r!==t.remote.management_key&&c({remote:{...N,management_key:r||void 0}}),d(null)},Ke=()=>{const r=(x??xe).trim(),i=r===""?U:Number(r);if(!Number.isInteger(i)||i<1||i>65535){T.error(s("settingsProxy.invalidLocalPort")),h(null);return}i!==t.local.port&&c({local:{...t.local,port:i}}),h(null)},$e=()=>{k({host:Q,port:Z,protocol:t.remote.protocol||"http",authToken:ee})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${u||b?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[u&&e.jsxs(se,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(Ze,{className:"h-4 w-4"}),e.jsx(te,{children:u})]}),b&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(fe,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(qe,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsProxy.description",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})}),!m&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.instanceStatus")}),e.jsx(os,{})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.connectionMode")}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>c({remote:{...N,enabled:!1}}),disabled:o,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(es,{className:`w-5 h-5 ${m?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:s("settingsProxy.local")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.localDesc",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})})]}),e.jsxs("button",{onClick:()=>c({remote:{...N,enabled:!0}}),disabled:o,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(he,{className:`w-5 h-5 ${m?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:s("settingsProxy.remote")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.remoteDesc",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(ss,{className:"w-4 h-4"}),s("settingsProxy.backendBinary")]}),!m&&le&&e.jsxs(se,{className:"py-2 border-amber-200 bg-amber-50 dark:border-amber-900/50 dark:bg-amber-900/20 [&>svg]:top-2.5",children:[e.jsx(ye,{className:"h-4 w-4 text-amber-600"}),e.jsx(te,{className:"text-amber-700 dark:text-amber-400",children:s("settingsProxy.stopProxyToSwitch")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>ce("plus"),disabled:X.isPending||F,className:`p-4 rounded-lg border-2 text-left transition-all ${v==="plus"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${F?"opacity-60 cursor-not-allowed":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"font-medium",children:s("settingsProxy.backendPlusApi")}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400",children:s("settingsProxy.default")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.plusDesc")})]}),e.jsxs("button",{onClick:()=>ce("original"),disabled:X.isPending||F,className:`p-4 rounded-lg border-2 text-left transition-all ${v==="original"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${F?"opacity-60 cursor-not-allowed":""}`,children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("span",{className:"font-medium",children:s("settingsProxy.backendApi")})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.originalDesc")})]})]}),v==="original"&&Se&&e.jsxs(se,{variant:"destructive",className:"py-2",children:[e.jsx(ye,{className:"h-4 w-4"}),e.jsx(te,{children:s("settingsProxy.variantsIncompatible")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(ts,{className:"w-4 h-4 text-amber-700 dark:text-amber-300"}),s("settingsProxy.safety")]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-amber-400/35 bg-amber-50/70 p-4 dark:border-amber-800/60 dark:bg-amber-950/25",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.agyModeTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.agyModeDesc")})]}),e.jsx(D,{"aria-labelledby":"agy-power-user-mode-label","aria-describedby":"agy-power-user-mode-description",checked:je,disabled:Pe||f||o,onCheckedChange:Ne})]}),e.jsx("p",{id:"agy-power-user-mode-description",className:"text-xs text-amber-800/90 dark:text-amber-200/90",children:s("settingsProxy.agyWarning")}),ke&&e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/40 bg-rose-500/[0.08] p-3.5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-semibold tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.finalConfirm")}),e.jsx("p",{className:"text-xs leading-relaxed text-rose-800/95 dark:text-rose-200/90",children:s("settingsProxy.finalConfirmDesc")})]}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border border-rose-400/30 bg-rose-500/10 p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.step1")}),e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex items-center gap-1.5 text-xs font-medium text-rose-800 underline decoration-rose-500/60 underline-offset-2 transition-colors hover:text-rose-700 dark:text-rose-200",children:[s("settingsProxy.readIssue"),e.jsx(rs,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"rounded-md border border-rose-400/30 bg-rose-500/10 p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.step2")}),e.jsxs("p",{className:"mt-1 text-xs text-rose-800/95 dark:text-rose-200/90",children:[s("settingsProxy.typePrefix")," ",e.jsx("code",{className:"rounded bg-background/80 px-1 py-0.5 font-mono",children:V})," ",s("settingsProxy.typeSuffix")]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{value:ie,onChange:r=>I(r.target.value),placeholder:V,disabled:f||o,className:"font-mono text-xs","aria-label":s("settingsProxy.typePhraseAria")}),e.jsx("p",{className:"text-[11px] text-rose-800/90 dark:text-rose-200/80",children:s("settingsProxy.exactPhrase")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(H,{variant:"outline",size:"sm",onClick:()=>{R(!1),I("")},disabled:f||o,children:s("settingsBackups.cancel")}),e.jsx(H,{size:"sm",variant:"destructive",onClick:Ce,disabled:!W||f||o,children:s("settingsProxy.enableAgyMode")})]})]}),e.jsx("span",{id:"agy-power-user-mode-label",className:"sr-only",children:s("settingsProxy.toggleAgyMode")})]})]}),m&&e.jsx(ls,{config:t,saving:o,testing:j,testResult:y,displayHost:Q,displayPort:Z,displayAuthToken:ee,displayManagementKey:de,setEditedHost:C,setEditedPort:P,setEditedAuthToken:A,setEditedManagementKey:d,onSaveHost:Le,onSavePort:_e,onSaveAuthToken:Re,onSaveManagementKey:Ie,onSaveConfig:c,onTestConnection:$e}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.fallbackSettings")}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.enableFallback")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.enableFallbackDesc")})]}),e.jsx(D,{checked:M.enabled??!0,onCheckedChange:r=>c({fallback:{...M,enabled:r}}),disabled:o||!m})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.autoStartLocal")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.autoStartLocalDesc")})]}),e.jsx(D,{checked:M.auto_start??!1,onCheckedChange:r=>c({fallback:{...M,auto_start:r}}),disabled:o||!m||!M.enabled})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(as,{className:"w-4 h-4"}),s("settingsProxy.advanced")]}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.debugMode")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.debugModeDesc")})]}),e.jsx(D,{checked:_,onCheckedChange:ve,disabled:o})]}),_&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 pl-0.5",children:s("settingsProxy.debugModeEnabled")})]})]}),!m&&e.jsx(is,{config:t,saving:o,displayLocalPort:xe,setEditedLocalPort:h,onSaveLocalPort:Ke,onSaveConfig:c})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(H,{variant:"outline",size:"sm",onClick:()=>{a(),Y(),l(),q(),J()},disabled:g||o||f,className:"w-full",children:[e.jsx(re,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{Cs as default};
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as n}from"./react-vendor-CNOkPC89.js";import{bk as Oe,bl as Ve,Y as L,a as ae,I as B,r as He,s as Ue,t as ze,v as We,w as ue,d as H,bm as Ye,bn as Ge,bo as Xe,b5 as se,b7 as te,n as qe}from"./index-JgHDFSHt.js";import{S as D}from"./switch-w7IoOY5x.js";import{C as U}from"./default-ports-1QQSffYX.js";import{aU as he,R as re,g as Je,v as fe,W as Qe,x as Ze,aV as es,aW as ss,T as ye,at as ts,o as rs,aX as as}from"./icons-DrEfTmfX.js";import{R as V,P as os}from"./proxy-status-widget-DEkHz7X-.js";import{t as T}from"./notifications-B2HqRBj7.js";import"./tanstack-e99Cjjy2.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-0GYXcDLu.js";function ns(){const{state:s}=Oe(),t=Ve(),[g,o]=n.useState(null),[u,b]=n.useState(null),[y,j]=n.useState(null),[p,C]=n.useState(null),[S,P]=n.useState(null),w=n.useCallback(async()=>{try{t.setProxyLoading(!0),t.setProxyError(null);const d=await L.cliproxyServer.get();t.setProxyConfig(d)}catch(d){t.setProxyError(d.message)}finally{t.setProxyLoading(!1)}},[t]),A=n.useCallback(async d=>{const x=s.proxyConfig;if(!x)return;const h={remote:{...x.remote,...d.remote},fallback:{...x.fallback,...d.fallback},local:{...x.local,...d.local}};t.setProxyConfig(h),t.setProxyTestResult(null);try{t.setProxySaving(!0),t.setProxyError(null);const a=await L.cliproxyServer.update(d);t.setProxyConfig(a),t.setProxySuccess(!0),setTimeout(()=>t.setProxySuccess(!1),1500)}catch(a){t.setProxyConfig(x),t.setProxyError(a.message)}finally{t.setProxySaving(!1)}},[s.proxyConfig,t]),E=n.useCallback(async d=>{const{host:x,port:h,protocol:a,authToken:c}=d;if(!x){t.setProxyError("Host is required");return}try{t.setProxyTesting(!0),t.setProxyError(null),t.setProxyTestResult(null);const k=h?parseInt(h,10):void 0,l=await L.cliproxyServer.test({host:x,port:k||void 0,protocol:a,authToken:c||void 0});t.setProxyTestResult(l)}catch(k){t.setProxyError(k.message)}finally{t.setProxyTesting(!1)}},[t]);return{config:s.proxyConfig,loading:s.proxyLoading,saving:s.proxySaving,error:s.proxyError,success:s.proxySuccess,testResult:s.proxyTestResult,testing:s.proxyTesting,editedHost:g,setEditedHost:o,editedPort:u,setEditedPort:b,editedAuthToken:y,setEditedAuthToken:j,editedManagementKey:p,setEditedManagementKey:C,editedLocalPort:S,setEditedLocalPort:P,fetchConfig:w,saveConfig:A,testConnection:E}}function is({config:s,saving:t,displayLocalPort:g,setEditedLocalPort:o,onSaveLocalPort:u,onSaveConfig:b}){const{t:y}=ae(),j=s.local;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:y("settingsProxy.localProxy")}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:y("settingsProxy.port")}),e.jsx(B,{type:"text",inputMode:"numeric",value:g,onChange:p=>o(p.target.value.replace(/\D/g,"")),onBlur:u,placeholder:`${U}`,className:"font-mono max-w-32",disabled:t})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:y("settingsProxy.autoStart")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y("settingsProxy.localAutoStartDesc")})]}),e.jsx(D,{checked:j.auto_start??!0,onCheckedChange:p=>b({local:{...j,auto_start:p}}),disabled:t})]})]})]})}function ls({config:s,saving:t,testing:g,testResult:o,displayHost:u,displayPort:b,displayAuthToken:y,displayManagementKey:j,setEditedHost:p,setEditedPort:C,setEditedAuthToken:S,setEditedManagementKey:P,onSaveHost:w,onSavePort:A,onSaveAuthToken:E,onSaveManagementKey:d,onSaveConfig:x,onTestConnection:h}){const{t:a}=ae(),c=s.remote,k=l=>l==="https"?443:U;return e.jsxs("div",{className:"space-y-4 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("h4",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4"}),a("settingsProxy.remoteConfigTitle")]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.host")}),e.jsx(B,{value:u,onChange:l=>p(l.target.value),onBlur:w,placeholder:a("settingsProxy.hostPlaceholder"),className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm text-muted-foreground",children:[a("settingsProxy.port")," ",e.jsxs("span",{className:"text-xs opacity-70",children:["(",a("settingsProxy.defaultPort",{value:k(s.remote.protocol||"http")}),")"]})]}),e.jsx(B,{type:"text",inputMode:"numeric",value:b,onChange:l=>C(l.target.value.replace(/\D/g,"")),onBlur:A,placeholder:a("settingsProxy.portPlaceholder",{value:k(s.remote.protocol||"http")}),className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.protocol")}),e.jsxs(He,{value:s.remote.protocol||"http",onValueChange:l=>x({remote:{...c,protocol:l}}),disabled:t,children:[e.jsx(Ue,{children:e.jsx(ze,{})}),e.jsxs(We,{children:[e.jsx(ue,{value:"http",children:a("settingsProxy.http")}),e.jsx(ue,{value:"https",children:a("settingsProxy.https")})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.apiKeyOptional")}),e.jsx(B,{type:"password",value:y,onChange:l=>S(l.target.value),onBlur:E,placeholder:a("settingsProxy.apiKeyPlaceholder"),className:"font-mono",disabled:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settingsProxy.apiKeyDesc")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.managementKeyOptional")}),e.jsx(B,{type:"password",value:j,onChange:l=>P(l.target.value),onBlur:d,placeholder:a("settingsProxy.managementKeyPlaceholder"),className:"font-mono",disabled:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settingsProxy.managementKeyDesc")})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(H,{onClick:h,disabled:g||!u,variant:"outline",className:"w-full",children:g?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-2 animate-spin"}),a("settingsProxy.testing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),a("settingsProxy.testConnection")]})}),o&&e.jsx("div",{className:`p-3 rounded-md ${o.reachable?"bg-green-50 border border-green-200 dark:bg-green-900/20 dark:border-green-900/50":"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50"}`,children:e.jsx("div",{className:"flex items-center gap-2",children:o.reachable?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:a("settingsProxy.connectedLatency",{value:o.latencyMs})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Qe,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:o.error||a("settingsProxy.connectionFailed")})]})})})]})]})}const pe="ccs_debug_mode",cs=["kiro","ghcp"];function ds(s){return s.trim().replace(/\s+/g," ").toUpperCase()}function Cs(){const{t:s}=ae(),{config:t,loading:g,saving:o,error:u,success:b,testResult:y,testing:j,editedHost:p,setEditedHost:C,editedPort:S,setEditedPort:P,editedAuthToken:w,setEditedAuthToken:A,editedManagementKey:E,setEditedManagementKey:d,editedLocalPort:x,setEditedLocalPort:h,fetchConfig:a,saveConfig:c,testConnection:k}=ns(),{fetchRawConfig:l}=Ye(),[_,be]=n.useState(()=>{try{return localStorage.getItem(pe)==="true"}catch{return!1}}),[je,z]=n.useState(!1),[Pe,oe]=n.useState(!0),[f,ne]=n.useState(!1),[ke,R]=n.useState(!1),[ie,I]=n.useState(""),K=n.useRef(!1),W=ds(ie)===V,ve=r=>{be(r);try{localStorage.setItem(pe,String(r))}catch{}},Y=n.useCallback(async()=>{try{oe(!0);const r=await fetch("/api/settings/auth/antigravity-risk");if(!r.ok)throw new Error(s("settingsProxy.failedLoadAgyMode"));const i=await r.json();z(i.antigravityAckBypass===!0)}catch(r){T.error(r instanceof Error?r.message:s("settingsProxy.failedLoadAgyMode")),z(!1)}finally{oe(!1)}},[s]),$=n.useCallback(async r=>{if(!(K.current||f||o))try{K.current=!0,ne(!0);const i=await fetch("/api/settings/auth/antigravity-risk",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({antigravityAckBypass:r})}),O=await i.json();if(!i.ok)throw new Error(O.error||s("settingsProxy.failedUpdateAgyMode"));const Fe=O.antigravityAckBypass===!0,me=await fetch("/api/settings/auth/antigravity-risk",{cache:"no-store"});if(!me.ok)throw new Error(s("settingsProxy.failedVerifyAgyMode"));const ge=(await me.json()).antigravityAckBypass===!0;if(ge!==r)throw new Error(s("settingsProxy.notPersistedAgyMode"));z(ge&&Fe),R(!1),I(""),T.success(s(r?"settingsProxy.agyModeEnabled":"settingsProxy.agyModeDisabled")),await l()}catch(i){T.error(i instanceof Error?i.message:s("settingsProxy.failedUpdateAgyMode"))}finally{K.current=!1,ne(!1)}},[f,l,o,s]),Ne=n.useCallback(r=>{if(!(K.current||f||o)){if(r){R(!0);return}R(!1),I(""),$(!1)}},[f,$,o]),Ce=n.useCallback(()=>{if(!W){T.error(s("settingsProxy.typePhraseToContinue",{value:V}));return}$(!0)},[W,$,s]),[v,G]=n.useState("plus"),[Se,we]=n.useState(!1),X=Ge(),{data:Ae}=Xe(),le=Ae?.running??!1,q=n.useCallback(async()=>{try{const r=await L.cliproxyServer.getBackend();G(r.backend)}catch(r){console.error("[Proxy] Failed to fetch backend:",r)}},[]),J=n.useCallback(async()=>{try{const i=(await L.cliproxy.list()).variants.some(O=>cs.includes(O.provider));we(i)}catch(r){console.error("[Proxy] Failed to check variants:",r)}},[]),ce=r=>{const i=v;G(r),X.mutate({backend:r},{onError:()=>{G(i)}})};if(n.useEffect(()=>{if(_&&t){const r={...t,remote:{...t.remote,auth_token:t.remote.auth_token?"[REDACTED]":void 0,management_key:t.remote.management_key?"[REDACTED]":void 0}};console.log("[CCS Debug] Debug mode enabled - proxy config:",r)}},[_,t]),n.useEffect(()=>{a(),Y(),l(),q(),J()},[a,Y,l,q,J]),g||!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(re,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})});const m=t.remote.enabled??!1,F=!m&&le,N=t.remote,M=t.fallback,Ee=t.remote.host??"",Te=t.remote.port!==void 0?t.remote.port.toString():"",Be=t.remote.auth_token??"",Me=t.remote.management_key??"",De=(t.local.port??U).toString(),Q=p??Ee,Z=S??Te,ee=w??Be,de=E??Me,xe=x??De,Le=()=>{const r=p??Q;r!==t.remote.host&&c({remote:{...N,host:r}}),C(null)},_e=()=>{const r=(S??Z).trim();if(r===""){t.remote.port!==void 0&&c({remote:{...N,port:void 0}}),P(null);return}const i=Number(r);if(!Number.isInteger(i)||i<1||i>65535){T.error(s("settingsProxy.invalidPortOrEmpty")),P(null);return}i!==t.remote.port&&c({remote:{...N,port:i}}),P(null)},Re=()=>{const r=w??ee;r!==t.remote.auth_token&&c({remote:{...N,auth_token:r}}),A(null)},Ie=()=>{const r=E??de;r!==t.remote.management_key&&c({remote:{...N,management_key:r||void 0}}),d(null)},Ke=()=>{const r=(x??xe).trim(),i=r===""?U:Number(r);if(!Number.isInteger(i)||i<1||i>65535){T.error(s("settingsProxy.invalidLocalPort")),h(null);return}i!==t.local.port&&c({local:{...t.local,port:i}}),h(null)},$e=()=>{k({host:Q,port:Z,protocol:t.remote.protocol||"http",authToken:ee})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${u||b?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[u&&e.jsxs(se,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(Ze,{className:"h-4 w-4"}),e.jsx(te,{children:u})]}),b&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(fe,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(qe,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsProxy.description",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})}),!m&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.instanceStatus")}),e.jsx(os,{})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.connectionMode")}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>c({remote:{...N,enabled:!1}}),disabled:o,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(es,{className:`w-5 h-5 ${m?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:s("settingsProxy.local")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.localDesc",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})})]}),e.jsxs("button",{onClick:()=>c({remote:{...N,enabled:!0}}),disabled:o,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(he,{className:`w-5 h-5 ${m?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:s("settingsProxy.remote")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.remoteDesc",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(ss,{className:"w-4 h-4"}),s("settingsProxy.backendBinary")]}),!m&&le&&e.jsxs(se,{className:"py-2 border-amber-200 bg-amber-50 dark:border-amber-900/50 dark:bg-amber-900/20 [&>svg]:top-2.5",children:[e.jsx(ye,{className:"h-4 w-4 text-amber-600"}),e.jsx(te,{className:"text-amber-700 dark:text-amber-400",children:s("settingsProxy.stopProxyToSwitch")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>ce("plus"),disabled:X.isPending||F,className:`p-4 rounded-lg border-2 text-left transition-all ${v==="plus"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${F?"opacity-60 cursor-not-allowed":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"font-medium",children:s("settingsProxy.backendPlusApi")}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400",children:s("settingsProxy.default")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.plusDesc")})]}),e.jsxs("button",{onClick:()=>ce("original"),disabled:X.isPending||F,className:`p-4 rounded-lg border-2 text-left transition-all ${v==="original"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${F?"opacity-60 cursor-not-allowed":""}`,children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("span",{className:"font-medium",children:s("settingsProxy.backendApi")})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.originalDesc")})]})]}),v==="original"&&Se&&e.jsxs(se,{variant:"destructive",className:"py-2",children:[e.jsx(ye,{className:"h-4 w-4"}),e.jsx(te,{children:s("settingsProxy.variantsIncompatible")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(ts,{className:"w-4 h-4 text-amber-700 dark:text-amber-300"}),s("settingsProxy.safety")]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-amber-400/35 bg-amber-50/70 p-4 dark:border-amber-800/60 dark:bg-amber-950/25",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.agyModeTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.agyModeDesc")})]}),e.jsx(D,{"aria-labelledby":"agy-power-user-mode-label","aria-describedby":"agy-power-user-mode-description",checked:je,disabled:Pe||f||o,onCheckedChange:Ne})]}),e.jsx("p",{id:"agy-power-user-mode-description",className:"text-xs text-amber-800/90 dark:text-amber-200/90",children:s("settingsProxy.agyWarning")}),ke&&e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/40 bg-rose-500/[0.08] p-3.5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-semibold tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.finalConfirm")}),e.jsx("p",{className:"text-xs leading-relaxed text-rose-800/95 dark:text-rose-200/90",children:s("settingsProxy.finalConfirmDesc")})]}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border border-rose-400/30 bg-rose-500/10 p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.step1")}),e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex items-center gap-1.5 text-xs font-medium text-rose-800 underline decoration-rose-500/60 underline-offset-2 transition-colors hover:text-rose-700 dark:text-rose-200",children:[s("settingsProxy.readIssue"),e.jsx(rs,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"rounded-md border border-rose-400/30 bg-rose-500/10 p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.step2")}),e.jsxs("p",{className:"mt-1 text-xs text-rose-800/95 dark:text-rose-200/90",children:[s("settingsProxy.typePrefix")," ",e.jsx("code",{className:"rounded bg-background/80 px-1 py-0.5 font-mono",children:V})," ",s("settingsProxy.typeSuffix")]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{value:ie,onChange:r=>I(r.target.value),placeholder:V,disabled:f||o,className:"font-mono text-xs","aria-label":s("settingsProxy.typePhraseAria")}),e.jsx("p",{className:"text-[11px] text-rose-800/90 dark:text-rose-200/80",children:s("settingsProxy.exactPhrase")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(H,{variant:"outline",size:"sm",onClick:()=>{R(!1),I("")},disabled:f||o,children:s("settingsBackups.cancel")}),e.jsx(H,{size:"sm",variant:"destructive",onClick:Ce,disabled:!W||f||o,children:s("settingsProxy.enableAgyMode")})]})]}),e.jsx("span",{id:"agy-power-user-mode-label",className:"sr-only",children:s("settingsProxy.toggleAgyMode")})]})]}),m&&e.jsx(ls,{config:t,saving:o,testing:j,testResult:y,displayHost:Q,displayPort:Z,displayAuthToken:ee,displayManagementKey:de,setEditedHost:C,setEditedPort:P,setEditedAuthToken:A,setEditedManagementKey:d,onSaveHost:Le,onSavePort:_e,onSaveAuthToken:Re,onSaveManagementKey:Ie,onSaveConfig:c,onTestConnection:$e}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.fallbackSettings")}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.enableFallback")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.enableFallbackDesc")})]}),e.jsx(D,{checked:M.enabled??!0,onCheckedChange:r=>c({fallback:{...M,enabled:r}}),disabled:o||!m})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.autoStartLocal")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.autoStartLocalDesc")})]}),e.jsx(D,{checked:M.auto_start??!1,onCheckedChange:r=>c({fallback:{...M,auto_start:r}}),disabled:o||!m||!M.enabled})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(as,{className:"w-4 h-4"}),s("settingsProxy.advanced")]}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.debugMode")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.debugModeDesc")})]}),e.jsx(D,{checked:_,onCheckedChange:ve,disabled:o})]}),_&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 pl-0.5",children:s("settingsProxy.debugModeEnabled")})]})]}),!m&&e.jsx(is,{config:t,saving:o,displayLocalPort:xe,setEditedLocalPort:h,onSaveLocalPort:Ke,onSaveConfig:c})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(H,{variant:"outline",size:"sm",onClick:()=>{a(),Y(),l(),q(),J()},disabled:g||o||f,className:"w-full",children:[e.jsx(re,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{Cs as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{bk as F,bl as U,a as A,I as K,bm as _,b5 as z,b7 as B,n as D,d as L}from"./index-Cw9Urr0S.js";import{S as q}from"./switch-5N8qBdBr.js";import{Q as Y,l as J,s as Q,r as X,o as Z,R as y,x as V,v as ee,aT as se}from"./icons-DrEfTmfX.js";import"./tanstack-e99Cjjy2.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function te(){const{state:s}=F(),t=U(),[o,g]=c.useState(""),[n,d]=c.useState(""),[x,p]=c.useState(!1),[j,f]=c.useState(!1),S=c.useCallback(async()=>{try{t.setWebSearchLoading(!0),t.setWebSearchError(null);const a=await fetch("/api/websearch");if(!a.ok)throw new Error("Failed to load WebSearch config");const r=await a.json();t.setWebSearchConfig(r)}catch(a){t.setWebSearchError(a.message)}finally{t.setWebSearchLoading(!1)}},[t]),v=c.useCallback(async()=>{try{t.setWebSearchStatusLoading(!0);const a=await fetch("/api/websearch/status");if(!a.ok)throw new Error("Failed to load status");const r=await a.json();t.setWebSearchStatus(r)}catch{}finally{t.setWebSearchStatusLoading(!1)}},[t]),b=c.useCallback(async a=>{const r=s.webSearchConfig;if(!r)return;const w={...r,...a};t.setWebSearchConfig(w);try{t.setWebSearchSaving(!0),t.setWebSearchError(null);const l=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!l.ok){const k=await l.json();throw new Error(k.error||"Failed to save")}const i=await l.json();t.setWebSearchConfig(i.websearch),t.setWebSearchSuccess(!0),setTimeout(()=>t.setWebSearchSuccess(!1),1500)}catch(l){t.setWebSearchConfig(r),t.setWebSearchError(l.message)}finally{t.setWebSearchSaving(!1)}},[s.webSearchConfig,t]);c.useEffect(()=>{s.webSearchConfig&&(g(s.webSearchConfig.providers?.gemini?.model??"gemini-2.5-flash"),d(s.webSearchConfig.providers?.opencode?.model??"opencode/grok-code"))},[s.webSearchConfig]);const C=c.useCallback(async()=>{const a=s.webSearchConfig?.providers?.gemini?.model??"gemini-2.5-flash";if(o!==a){const r=s.webSearchConfig?.providers||{};await b({providers:{...r,gemini:{...r.gemini,model:o}}}),p(!0),setTimeout(()=>p(!1),2e3)}},[o,s.webSearchConfig,b]),h=c.useCallback(async()=>{const a=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(n!==a){const r=s.webSearchConfig?.providers||{};await b({providers:{...r,opencode:{...r.opencode,model:n}}}),f(!0),setTimeout(()=>f(!1),2e3)}},[n,s.webSearchConfig,b]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,geminiModelInput:o,setGeminiModelInput:g,opencodeModelInput:n,setOpencodeModelInput:d,geminiModelSaved:x,opencodeModelSaved:j,fetchConfig:S,fetchStatus:v,saveConfig:b,saveGeminiModel:C,saveOpencodeModel:h}}function H({name:s,label:t,badge:o,badgeColor:g,enabled:n,installed:d,statusLoading:x,saving:p,onToggle:j,modelInput:f,setModelInput:S,onModelBlur:v,modelSaved:b,modelPlaceholder:C,showHint:h,setShowHint:a,installCmd:r,docsUrl:w,hintColor:l}){const{t:i}=A(),k=g==="green"?"bg-green-500/10 text-green-600":g==="blue"?"bg-blue-500/10 text-blue-600":"bg-purple-500/10 text-purple-600",W=l==="amber"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300":l==="blue"?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",E=l==="amber"?"bg-amber-100 dark:bg-amber-900/40":l==="blue"?"bg-blue-100 dark:bg-blue-900/40":"bg-purple-100 dark:bg-purple-900/40",M=l==="amber"?"text-amber-600 dark:text-amber-400":l==="blue"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400",G=s==="opencode"?"OpenCode":s.charAt(0).toUpperCase()+s.slice(1);return e.jsxs("div",{className:`rounded-lg border transition-colors ${n?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:`w-5 h-5 ${n?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:s}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${k}`,children:o}),d?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:i("settingsWebsearch.installed")}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:i("settingsWebsearch.notInstalled")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t})]})]}),e.jsx(q,{checked:n,onCheckedChange:j,disabled:p||!d})]}),n&&f!==void 0&&S&&v&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:i("settingsWebsearch.model")}),e.jsx(K,{value:f,onChange:I=>S(I.target.value),onBlur:v,placeholder:C,className:"h-8 text-sm font-mono",disabled:p}),b&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400 text-xs animate-in fade-in duration-200",children:[e.jsx(J,{className:"w-3.5 h-3.5"}),i("settings.saved")]})]})}),!d&&!x&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>a(!h),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${M}`,children:[h?e.jsx(Q,{className:"w-4 h-4"}):e.jsx(X,{className:"w-4 h-4"}),i("settingsWebsearch.howInstall",{name:G})]}),h&&e.jsxs("div",{className:`mt-2 p-3 rounded-md text-sm ${W}`,children:[e.jsxs("p",{className:"mb-2",children:[i("settingsWebsearch.installGlobally")," ",i(o==="GROK_API_KEY"?"settingsWebsearch.requiresKey":"settingsWebsearch.freeTier"),":"]}),e.jsx("code",{className:`text-sm px-2 py-1 rounded font-mono block mb-2 ${E}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(Z,{className:"w-3 h-3"}),i("settingsWebsearch.viewDocs")]})]})]})]})}function be(){const{t:s}=A(),{config:t,status:o,loading:g,statusLoading:n,saving:d,error:x,success:p,geminiModelInput:j,setGeminiModelInput:f,opencodeModelInput:S,setOpencodeModelInput:v,geminiModelSaved:b,opencodeModelSaved:C,fetchConfig:h,fetchStatus:a,saveConfig:r,saveGeminiModel:w,saveOpencodeModel:l}=te(),{fetchRawConfig:i}=_(),[k,W]=c.useState(!1),[E,M]=c.useState(!1),[G,I]=c.useState(!1);c.useEffect(()=>{h(),a(),i()},[h,a,i]);const N=t?.providers?.gemini?.enabled??!1,O=t?.providers?.grok?.enabled??!1,T=t?.providers?.opencode?.enabled??!1,R=()=>{const m=t?.providers||{},u=m.gemini?.enabled??!1;r({enabled:!u||O||T,providers:{...m,gemini:{...m.gemini,enabled:!u}}})},$=()=>{const m=t?.providers||{},u=m.grok?.enabled??!1;r({enabled:N||!u||T,providers:{...m,grok:{...m.grok,enabled:!u}}})},P=()=>{const m=t?.providers||{},u=m.opencode?.enabled??!1;r({enabled:N||O||!u,providers:{...m,opencode:{...m.opencode,enabled:!u}}})};return g?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(y,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${x||p?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[x&&e.jsxs(z,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx(B,{children:x})]}),p&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(D,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsWebsearch.description")}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s(N?"settingsWebsearch.enabled":"settingsWebsearch.disabled")}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsWebsearch.checking")}):o?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:o.readiness.message}):null]}),e.jsx(L,{variant:"ghost",size:"sm",onClick:a,disabled:n,children:e.jsx(y,{className:`w-4 h-4 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsWebsearch.providers")}),!o?.geminiCli&&!o?.opencodeCli&&!o?.grokCli&&!n&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed rounded-lg text-center bg-muted/30",children:[e.jsx(se,{className:"w-12 h-12 text-muted-foreground mb-3 opacity-30"}),e.jsx("p",{className:"font-medium text-foreground mb-1",children:s("settingsWebsearch.noneConfigured")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s("settingsWebsearch.noneConfiguredHint")}),e.jsxs(L,{variant:"outline",size:"sm",onClick:a,children:[e.jsx(y,{className:"w-4 h-4 mr-2"}),s("settingsWebsearch.checkProviders")]})]}),e.jsx(H,{name:"gemini",label:"Google Gemini CLI (1000 req/day free)",badge:"FREE",badgeColor:"green",enabled:N,installed:o?.geminiCli?.installed??!1,statusLoading:n,saving:d,onToggle:R,modelInput:j,setModelInput:f,onModelBlur:w,modelSaved:b,modelPlaceholder:"gemini-2.5-flash",showHint:k,setShowHint:W,installCmd:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli",hintColor:"amber"}),e.jsx(H,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:T,installed:o?.opencodeCli?.installed??!1,statusLoading:n,saving:d,onToggle:P,modelInput:S,setModelInput:v,onModelBlur:l,modelSaved:C,modelPlaceholder:"opencode/grok-code",showHint:E,setShowHint:M,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(H,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:O,installed:o?.grokCli?.installed??!1,statusLoading:n,saving:d,onToggle:$,showHint:G,setShowHint:I,installCmd:"npm install -g @vibe-kit/grok-cli",docsUrl:"https://github.com/superagent-ai/grok-cli",hintColor:"blue"})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>{h(),i()},disabled:g||d,className:"w-full",children:[e.jsx(y,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{be as default};
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{bk as F,bl as U,a as A,I as K,bm as _,b5 as z,b7 as B,n as D,d as L}from"./index-JgHDFSHt.js";import{S as q}from"./switch-w7IoOY5x.js";import{Q as Y,l as J,s as Q,r as X,o as Z,R as y,x as V,v as ee,aT as se}from"./icons-DrEfTmfX.js";import"./tanstack-e99Cjjy2.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function te(){const{state:s}=F(),t=U(),[o,g]=c.useState(""),[n,d]=c.useState(""),[x,p]=c.useState(!1),[j,f]=c.useState(!1),S=c.useCallback(async()=>{try{t.setWebSearchLoading(!0),t.setWebSearchError(null);const a=await fetch("/api/websearch");if(!a.ok)throw new Error("Failed to load WebSearch config");const r=await a.json();t.setWebSearchConfig(r)}catch(a){t.setWebSearchError(a.message)}finally{t.setWebSearchLoading(!1)}},[t]),v=c.useCallback(async()=>{try{t.setWebSearchStatusLoading(!0);const a=await fetch("/api/websearch/status");if(!a.ok)throw new Error("Failed to load status");const r=await a.json();t.setWebSearchStatus(r)}catch{}finally{t.setWebSearchStatusLoading(!1)}},[t]),b=c.useCallback(async a=>{const r=s.webSearchConfig;if(!r)return;const w={...r,...a};t.setWebSearchConfig(w);try{t.setWebSearchSaving(!0),t.setWebSearchError(null);const l=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!l.ok){const k=await l.json();throw new Error(k.error||"Failed to save")}const i=await l.json();t.setWebSearchConfig(i.websearch),t.setWebSearchSuccess(!0),setTimeout(()=>t.setWebSearchSuccess(!1),1500)}catch(l){t.setWebSearchConfig(r),t.setWebSearchError(l.message)}finally{t.setWebSearchSaving(!1)}},[s.webSearchConfig,t]);c.useEffect(()=>{s.webSearchConfig&&(g(s.webSearchConfig.providers?.gemini?.model??"gemini-2.5-flash"),d(s.webSearchConfig.providers?.opencode?.model??"opencode/grok-code"))},[s.webSearchConfig]);const C=c.useCallback(async()=>{const a=s.webSearchConfig?.providers?.gemini?.model??"gemini-2.5-flash";if(o!==a){const r=s.webSearchConfig?.providers||{};await b({providers:{...r,gemini:{...r.gemini,model:o}}}),p(!0),setTimeout(()=>p(!1),2e3)}},[o,s.webSearchConfig,b]),h=c.useCallback(async()=>{const a=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(n!==a){const r=s.webSearchConfig?.providers||{};await b({providers:{...r,opencode:{...r.opencode,model:n}}}),f(!0),setTimeout(()=>f(!1),2e3)}},[n,s.webSearchConfig,b]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,geminiModelInput:o,setGeminiModelInput:g,opencodeModelInput:n,setOpencodeModelInput:d,geminiModelSaved:x,opencodeModelSaved:j,fetchConfig:S,fetchStatus:v,saveConfig:b,saveGeminiModel:C,saveOpencodeModel:h}}function H({name:s,label:t,badge:o,badgeColor:g,enabled:n,installed:d,statusLoading:x,saving:p,onToggle:j,modelInput:f,setModelInput:S,onModelBlur:v,modelSaved:b,modelPlaceholder:C,showHint:h,setShowHint:a,installCmd:r,docsUrl:w,hintColor:l}){const{t:i}=A(),k=g==="green"?"bg-green-500/10 text-green-600":g==="blue"?"bg-blue-500/10 text-blue-600":"bg-purple-500/10 text-purple-600",W=l==="amber"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300":l==="blue"?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",E=l==="amber"?"bg-amber-100 dark:bg-amber-900/40":l==="blue"?"bg-blue-100 dark:bg-blue-900/40":"bg-purple-100 dark:bg-purple-900/40",M=l==="amber"?"text-amber-600 dark:text-amber-400":l==="blue"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400",G=s==="opencode"?"OpenCode":s.charAt(0).toUpperCase()+s.slice(1);return e.jsxs("div",{className:`rounded-lg border transition-colors ${n?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:`w-5 h-5 ${n?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:s}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${k}`,children:o}),d?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:i("settingsWebsearch.installed")}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:i("settingsWebsearch.notInstalled")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t})]})]}),e.jsx(q,{checked:n,onCheckedChange:j,disabled:p||!d})]}),n&&f!==void 0&&S&&v&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:i("settingsWebsearch.model")}),e.jsx(K,{value:f,onChange:I=>S(I.target.value),onBlur:v,placeholder:C,className:"h-8 text-sm font-mono",disabled:p}),b&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400 text-xs animate-in fade-in duration-200",children:[e.jsx(J,{className:"w-3.5 h-3.5"}),i("settings.saved")]})]})}),!d&&!x&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>a(!h),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${M}`,children:[h?e.jsx(Q,{className:"w-4 h-4"}):e.jsx(X,{className:"w-4 h-4"}),i("settingsWebsearch.howInstall",{name:G})]}),h&&e.jsxs("div",{className:`mt-2 p-3 rounded-md text-sm ${W}`,children:[e.jsxs("p",{className:"mb-2",children:[i("settingsWebsearch.installGlobally")," ",i(o==="GROK_API_KEY"?"settingsWebsearch.requiresKey":"settingsWebsearch.freeTier"),":"]}),e.jsx("code",{className:`text-sm px-2 py-1 rounded font-mono block mb-2 ${E}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(Z,{className:"w-3 h-3"}),i("settingsWebsearch.viewDocs")]})]})]})]})}function be(){const{t:s}=A(),{config:t,status:o,loading:g,statusLoading:n,saving:d,error:x,success:p,geminiModelInput:j,setGeminiModelInput:f,opencodeModelInput:S,setOpencodeModelInput:v,geminiModelSaved:b,opencodeModelSaved:C,fetchConfig:h,fetchStatus:a,saveConfig:r,saveGeminiModel:w,saveOpencodeModel:l}=te(),{fetchRawConfig:i}=_(),[k,W]=c.useState(!1),[E,M]=c.useState(!1),[G,I]=c.useState(!1);c.useEffect(()=>{h(),a(),i()},[h,a,i]);const N=t?.providers?.gemini?.enabled??!1,O=t?.providers?.grok?.enabled??!1,T=t?.providers?.opencode?.enabled??!1,R=()=>{const m=t?.providers||{},u=m.gemini?.enabled??!1;r({enabled:!u||O||T,providers:{...m,gemini:{...m.gemini,enabled:!u}}})},$=()=>{const m=t?.providers||{},u=m.grok?.enabled??!1;r({enabled:N||!u||T,providers:{...m,grok:{...m.grok,enabled:!u}}})},P=()=>{const m=t?.providers||{},u=m.opencode?.enabled??!1;r({enabled:N||O||!u,providers:{...m,opencode:{...m.opencode,enabled:!u}}})};return g?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(y,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${x||p?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[x&&e.jsxs(z,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx(B,{children:x})]}),p&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(D,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsWebsearch.description")}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s(N?"settingsWebsearch.enabled":"settingsWebsearch.disabled")}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsWebsearch.checking")}):o?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:o.readiness.message}):null]}),e.jsx(L,{variant:"ghost",size:"sm",onClick:a,disabled:n,children:e.jsx(y,{className:`w-4 h-4 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsWebsearch.providers")}),!o?.geminiCli&&!o?.opencodeCli&&!o?.grokCli&&!n&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed rounded-lg text-center bg-muted/30",children:[e.jsx(se,{className:"w-12 h-12 text-muted-foreground mb-3 opacity-30"}),e.jsx("p",{className:"font-medium text-foreground mb-1",children:s("settingsWebsearch.noneConfigured")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s("settingsWebsearch.noneConfiguredHint")}),e.jsxs(L,{variant:"outline",size:"sm",onClick:a,children:[e.jsx(y,{className:"w-4 h-4 mr-2"}),s("settingsWebsearch.checkProviders")]})]}),e.jsx(H,{name:"gemini",label:"Google Gemini CLI (1000 req/day free)",badge:"FREE",badgeColor:"green",enabled:N,installed:o?.geminiCli?.installed??!1,statusLoading:n,saving:d,onToggle:R,modelInput:j,setModelInput:f,onModelBlur:w,modelSaved:b,modelPlaceholder:"gemini-2.5-flash",showHint:k,setShowHint:W,installCmd:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli",hintColor:"amber"}),e.jsx(H,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:T,installed:o?.opencodeCli?.installed??!1,statusLoading:n,saving:d,onToggle:P,modelInput:S,setModelInput:v,onModelBlur:l,modelSaved:C,modelPlaceholder:"opencode/grok-code",showHint:E,setShowHint:M,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(H,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:O,installed:o?.grokCli?.installed??!1,statusLoading:n,saving:d,onToggle:$,showHint:G,setShowHint:I,installCmd:"npm install -g @vibe-kit/grok-cli",docsUrl:"https://github.com/superagent-ai/grok-cli",hintColor:"blue"})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>{h(),i()},disabled:g||d,className:"w-full",children:[e.jsx(y,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./radix-ui-BR1vy4kf.js";import{g as ve,r as j}from"./react-vendor-CNOkPC89.js";import{bp as pe,bq as me,br as xe,bs as Ce,bt as B,bu as Q,bv as L,bw as Ae,bx as we,a as Ee,bo as ke,aU as Te,by as Ve,bz as Ie,bA as Pe,bB as $e,bC as Re,c as U,B as oe,aG as We,M as De,O as Oe,r as Fe,s as _e,t as Le,v as Ue,w as qe,d as ne,T as Be,p as Me,q as Ke,Y as ze}from"./index-Cw9Urr0S.js";import{A as He,a as Ye,b as Ze,c as Ge,d as Qe,e as Xe,f as Je,g as et}from"./alert-dialog-DhwS38kc.js";import{u as fe,a as tt,b as st,e as nt}from"./tanstack-e99Cjjy2.js";import{t as X}from"./notifications-B2HqRBj7.js";import{t as rt,A as at,R as K,aY as it,aZ as ot,a_ as lt,X as ct,d as ut,a$ as dt,b0 as pt,U as mt,u as xt,l as ft,x as gt,ar as ht,T as J,aA as yt}from"./icons-DrEfTmfX.js";var ee,le;function bt(){return le||(le=1,ee={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}),ee}var jt=bt();const St=ve(jt);var Nt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ce(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(St[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Nt),i=null;(i=a.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),t.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var vt=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Ct=/^\s*$/,At=Object.create(null);function ge(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(ge,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var wt={parse:function(e,t){t||(t={}),t.components||(t.components=At);var n,r=[],a=[],i=-1,o=!1;if(e.indexOf("<")!==0){var c=e.indexOf("<");r.push({type:"text",content:c===-1?e:e.substring(0,c)})}return e.replace(vt,function(d,u){if(o){if(d!=="</"+n.name+">")return;o=!1}var f,E=d.charAt(1)!=="/",T=d.startsWith("<!--"),m=u+d.length,p=e.charAt(m);if(T){var S=ce(d);return i<0?(r.push(S),r):((f=a[i]).children.push(S),r)}if(E&&(i++,(n=ce(d)).type==="tag"&&t.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!p||p==="<"||n.children.push({type:"text",content:e.slice(m,e.indexOf("<",m))}),i===0&&r.push(n),(f=a[i-1])&&f.children.push(n),a[i]=n),(!E||n.voidElement)&&(i>-1&&(n.voidElement||n.name===d.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&p!=="<"&&p)){f=i===-1?r:a[i].children;var b=e.indexOf("<",m),I=e.slice(m,b===-1?void 0:b);Ct.test(I)&&(I=" "),(b>-1&&i+f.length>=0||I!==" ")&&f.push({type:"text",content:I})}}),r},stringify:function(e){return e.reduce(function(t,n){return t+ge("",n)},"")}};const H=(e,t)=>{if(!e)return!1;const n=e.props?.children??e.children;return t?n.length>0:!!n},Y=e=>{if(!e)return[];const t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?q(t):t},Et=e=>Array.isArray(e)&&e.every(j.isValidElement),q=e=>Array.isArray(e)?e:[e],kt=(e,t)=>{const n={...t};return n.props={...t.props,...e.props},n},Tt=e=>{const t={};if(!e)return t;const n=r=>{q(r).forEach(i=>{B(i)||(H(i)?n(Y(i)):L(i)&&!j.isValidElement(i)&&Object.assign(t,i))})};return n(e),t},he=(e,t,n,r)=>{if(!e)return"";let a="";const i=q(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,d)=>{if(B(c)){a+=`${c}`;return}if(j.isValidElement(c)){const{props:u,type:f}=c,E=Object.keys(u).length,T=o.indexOf(f)>-1,m=u.children;if(!m&&T&&!E){a+=`<${f}/>`;return}if(!m&&(!T||E)||u.i18nIsDynamicList){a+=`<${d}></${d}>`;return}if(T&&E===1&&B(m)){a+=`<${f}>${m}</${f}>`;return}const p=he(m,t,n,r);a+=`<${d}>${p}</${d}>`;return}if(c===null){Q(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:u,...f}=c,E=Object.keys(f);if(E.length===1){const T=u?`${E[0]}, ${u}`:E[0];a+=`{{${T}}}`;return}Q(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}Q(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Vt=(e,t=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...t,...r];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let c=!1;const d=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(d){const u=d[1];(/^\d+$/.test(u)||a.includes(u))&&(c=!0,i+=d[0],o+=d[0].length)}if(!c){const u=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(u){const f=u[1];(/^\d+$/.test(f)||a.includes(f))&&(c=!0,i+=u[0],o+=u[0].length)}}c||(i+="<",o+=1)}else i+=e[o],o+=1;return i},It=(e,t,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],d=n&&new RegExp(c.map(x=>`<${x}`).join("|")).test(n);if(!e&&!t&&!d&&!o)return[n];const u=t??{},f=x=>{q(x).forEach(g=>{B(g)||(H(g)?f(Y(g)):L(g)&&!j.isValidElement(g)&&Object.assign(u,g))})};f(e);const E=Vt(n,c,u),T=wt.parse(`<0>${E}</0>`),m={...u,...i},p=(x,k,g)=>{const C=Y(x),R=b(C,k.children,g);return Et(C)&&R.length===0||x.props?.i18nIsDynamicList?C:R},S=(x,k,g,C,R)=>{x.dummy?(x.children=k,g.push(j.cloneElement(x,{key:C},R?void 0:k))):g.push(...j.Children.map([x],h=>{const l="data-i18n-is-dynamic-list",A={key:C,[l]:void 0};return h&&h.props&&Object.keys(h.props).forEach(V=>{V==="ref"||V==="children"||V==="i18nIsDynamicList"||V===l||(A[V]=h.props[V])}),j.cloneElement(h,A,R?null:k)}))},b=(x,k,g)=>{const C=q(x);return q(k).reduce((h,l,A)=>{const V=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,m,r.language);if(l.type==="tag"){let N=C[parseInt(l.name,10)];!N&&t&&(N=t[l.name]),g.length===1&&!N&&(N=g[0][l.name]),N||(N={});const $={...l.attrs};o&&Object.keys($).forEach(y=>{const F=$[y];B(F)&&($[y]=Ae(F))});const v=Object.keys($).length!==0?kt({props:$},N):N,P=j.isValidElement(v),O=P&&H(l,!0)&&!l.voidElement,W=d&&L(v)&&v.dummy&&!P,M=L(t)&&Object.hasOwnProperty.call(t,l.name);if(B(v)){const y=r.services.interpolator.interpolate(v,m,r.language);h.push(y)}else if(H(v)||O){const y=p(v,l,g);S(v,y,h,A)}else if(W){const y=b(C,l.children,g);S(v,y,h,A)}else if(Number.isNaN(parseFloat(l.name)))if(M){const y=p(v,l,g);S(v,y,h,A,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)h.push(j.createElement(l.name,{key:`${l.name}-${A}`}));else{const y=b(C,l.children,g);h.push(j.createElement(l.name,{key:`${l.name}-${A}`},y))}else if(l.voidElement)h.push(`<${l.name} />`);else{const y=b(C,l.children,g);h.push(`<${l.name}>${y}</${l.name}>`)}else if(L(v)&&!P){const y=l.children[0]?V:null;y&&h.push(y)}else S(v,V,h,A,l.children.length!==1||!V)}else if(l.type==="text"){const N=a.transWrapTextNodes,$=typeof a.unescape=="function"?a.unescape:xe().unescape,v=o?$(r.services.interpolator.interpolate(l.content,m,r.language)):r.services.interpolator.interpolate(l.content,m,r.language);N?h.push(j.createElement(N,{key:`${l.name}-${A}`},v)):h.push(v)}return h},[])},I=b([{dummy:!0,children:e||[]}],T,q(e||[]));return Y(I[0])},ye=(e,t,n)=>{const r=e.key||t,a=j.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return a;function i(){return j.createElement(j.Fragment,null,a)}return j.createElement(i,{key:r})},Pt=(e,t)=>e.map((n,r)=>ye(n,r,t)),$t=(e,t)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:ye(e[r],r,t)})}),n},Rt=(e,t,n,r)=>e?Array.isArray(e)?Pt(e,t):L(e)?$t(e,t):(pe(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Wt=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((t,n)=>t&&Number.isNaN(Number.parseFloat(n)),!0);function Dt({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:T,...m}){const p=f||me();if(!p)return pe(p,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const S=E||p.t.bind(p)||(_=>_),b={...xe(),...p.options?.react};let I=u||S.ns||p.options?.defaultNS;I=B(I)?[I]:I||["translation"];const{transDefaultProps:x}=b,k=x?.tOptions?{...x.tOptions,...i}:i,g=T??x?.shouldUnescape,C=x?.values?{...x.values,...o}:o,R=x?.components?{...x.components,...d}:d,h=he(e,b,p,r),l=c||k?.defaultValue||h||b.transEmptyNodeValue||(typeof r=="function"?Ce(r):r),{hashTransKey:A}=b,V=r||(A?A(h||l):h||l);p.options?.interpolation?.defaultVariables?o=C&&Object.keys(C).length>0?{...C,...p.options.interpolation.defaultVariables}:{...p.options.interpolation.defaultVariables}:o=C;const N=Tt(e);N&&typeof N.count=="number"&&t===void 0&&(t=N.count);const $=o||t!==void 0&&!p.options?.interpolation?.alwaysFormat||!e?k.interpolation:{interpolation:{...k.interpolation,prefix:"#$?",suffix:"?$#"}},v={...k,context:a||k.context,count:t,...o,...$,defaultValue:l,ns:I};let P=V?S(V,v):l;P===V&&l&&(P=l);const O=Rt(R,P,p,r);let W=O||e,M=null;Wt(O)&&(M=O,W=e);const y=It(W,M,P,p,b,v,g),F=n??b.defaultTransParent;return F?j.createElement(F,m,y):y}function ue({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:T,...m}){const{i18n:p,defaultNS:S}=j.useContext(we)||{},b=f||p||me(),I=E||b?.t.bind(b);return Dt({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:d,ns:u||I?.ns||S||b?.options?.defaultNS,i18n:b,t:E,shouldUnescape:T,...m})}const Xt="2026-02-24-antigravity-oauth-v2",Ot="I ACCEPT RISK",Ft=Ot,Jt={reviewedIssue509:!1,understandsBanRisk:!1,acceptsFullResponsibility:!1,typedPhrase:""};function es(e){return e.reviewedIssue509&&e.understandsBanRisk&&e.acceptsFullResponsibility&&e.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===Ft}async function _t(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let t="Failed to fetch sync status";try{const n=await e.json();t=n.error||n.message||t}catch{}throw new Error(t)}return e.json()}async function Lt(){const e=new AbortController,t=setTimeout(()=>e.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.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(t)}}function Ut(){return fe({queryKey:["cliproxy-sync-status"],queryFn:_t,refetchInterval:3e4,retry:1,staleTime:1e4})}function qt(){const e=tt();return st({mutationFn:Lt,onSuccess:t=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),t.syncedCount===0?X.info("No profiles to sync"):X.success(`Synced ${t.syncedCount} profile${t.syncedCount===1?"":"s"} to CLIProxy`)},onError:t=>{X.error(`Sync failed: ${t.message}`)}})}function de(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function re(e,t){const n=de(e),r=de(t);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 te(e,t){return re(e,t)>0}function se(e,t,n){return re(e,t)>=0&&re(e,n)<=0}function Bt(e){if(!e)return"";const t=new Date(e).getTime(),r=Date.now()-t,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 Mt(e,t){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?t("proxyStatusWidget.justNow"):r<60?t("proxyStatusWidget.minutesAgo",{count:r}):t("proxyStatusWidget.hoursAgo",{count:a})}function z({icon:e,tooltip:t,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return s.jsxs(Be,{children:[s.jsx(Me,{asChild:!0,children:s.jsx(ne,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:U("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?s.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(e,{className:"w-3.5 h-3.5"})})}),s.jsx(Ke,{side:"bottom",className:"text-xs",children:t})]})}function ts(){const{t:e}=Ee(),{data:t,isLoading:n}=ke(),{data:r}=Te(),{data:a,isLoading:i}=Ve(),o=Ie(),c=Pe(),d=$e(),u=Re(),{data:f}=Ut(),{mutate:E,isPending:T}=qt(),[m,p]=j.useState(!1),[S,b]=j.useState(""),[I,x]=j.useState(!1),[k,g]=j.useState(null),[C,R]=j.useState(null),{data:h}=fe({queryKey:["cliproxy-server-config"],queryFn:()=>ze.cliproxyServer.get(),staleTime:3e4}),l=nt({mutationKey:["update-backend"]})>0,A=h?.remote,V=A?.enabled&&A?.host,N=t?.running??!1,$=o.isPending||c.isPending||d.isPending||u.isPending||l||T,v=r?.hasUpdate??!1,P=r?.isStable===!1,O=r?.currentVersion,W=f?.configured??!1,M=e(W?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),y=P?r?.maxStableVersion||a?.latestStable:r?.latestVersion,F=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",_=a?.faultyRange,be=_&&`${_.min.replace(/-\d+$/,"")}-${_.max.replace(/-\d+$/,"")}`,Z=(w,D)=>{g(w),R(D),x(!0)},ae=async w=>{if(!w)return;const D=te(w,F);if(_!==void 0&&se(w,_.min,_.max)){Z(w,"faulty");return}if(D){Z(w,"experimental");return}try{const ie=await u.mutateAsync({version:w});ie.requiresConfirmation&&Z(w,ie.isFaulty?"faulty":"experimental")}catch{}},je=()=>{k&&u.mutate({version:k,force:!0}),x(!1),g(null),R(null)},Se=()=>{x(!1),g(null),R(null)},Ne=V?(()=>{const w=A.protocol||"http",D=A.port||(w==="https"?443:80);return w==="https"&&D===443||w==="http"&&D===80?A.host:`${A.host}:${D}`})():null;return V?s.jsxs("div",{className:U("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(rt,{className:"w-4 h-4 text-blue-500"}),s.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),s.jsx(oe,{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:e("proxyStatusWidget.active")})]}),s.jsx(at,{className:"w-3 h-3 text-blue-600"})]}),s.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex items-center gap-1 mb-1",children:s.jsx("span",{className:"font-mono",children:Ne})}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]})]}):s.jsx(We,{delayDuration:300,children:s.jsxs("div",{className:U("rounded-lg border p-3 transition-colors",N?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:U("w-2 h-2 rounded-full",N?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),s.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[n?s.jsx(K,{className:"w-3 h-3 animate-spin text-muted-foreground"}):N?s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:T?K:it,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>E(),disabled:!W||$,isPending:T}),s.jsx(z,{icon:ot,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>d.mutate(),disabled:$,isPending:d.isPending}),s.jsx(z,{icon:lt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>c.mutate(),disabled:$,isPending:c.isPending,variant:"destructive-ghost"})]}):null,s.jsx(z,{icon:m?ct:ut,tooltip:e(m?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>p(!m),className:m?"bg-muted":void 0})]})]}),O&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsxs("span",{className:U("text-xs font-mono text-muted-foreground",P&&"text-amber-600 dark:text-amber-400"),children:["v",O]}),(v||P)&&y&&s.jsxs(oe,{variant:"secondary",className:U("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",P?"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 ae(y),title:e(P?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[P?s.jsx(dt,{className:"w-2.5 h-2.5"}):s.jsx(pt,{className:"w-2.5 h-2.5"}),y]})]}),N&&t&&s.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[s.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:t.port})}),t.sessionCount!==void 0&&t.sessionCount>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(mt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:t.sessionCount})]}),t.startedAt&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(xt,{className:"w-3 h-3"}),Bt(t.startedAt)]})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[W?s.jsx(ft,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):s.jsx(gt,{className:"w-3 h-3 text-muted-foreground"}),s.jsx("span",{className:U("text-xs",W?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:M})]}),s.jsx(De,{open:m,onOpenChange:p,children:s.jsxs(Oe,{className:"mt-3 pt-3 border-t border-muted",children:[s.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Fe,{value:S,onValueChange:b,disabled:i,children:[s.jsx(_e,{className:"h-8 text-xs flex-1",children:s.jsx(Le,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),s.jsx(Ue,{children:a?.versions.slice(0,20).map(w=>{const D=a?.maxStableVersion&&te(w,a.maxStableVersion),G=a?.faultyRange&&se(w,a.faultyRange.min,a.faultyRange.max);return s.jsx(qe,{value:w,className:"text-xs",children:s.jsxs("span",{className:"flex items-center gap-2",children:["v",w,w===a.latestStable&&s.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(G||D)&&s.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},w)})})]}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void ae(S),disabled:u.isPending||!S,children:[u.isPending?s.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(ht,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),S&&a?.maxStableVersion&&te(S,a.maxStableVersion)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(J,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),S&&a?.faultyRange&&se(S,a.faultyRange.min,a.faultyRange.max)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(J,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:S})})]}),r?.checkedAt&&s.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Mt(r.checkedAt,e)})})]})}),!N&&s.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>o.mutate(),disabled:o.isPending,children:[o.isPending?s.jsx(K,{className:"w-3 h-3 animate-spin"}):s.jsx(yt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),s.jsx(He,{open:I,onOpenChange:x,children:s.jsxs(Ye,{children:[s.jsxs(Ze,{children:[s.jsxs(Ge,{className:"flex items-center gap-2",children:[s.jsx(J,{className:"w-5 h-5 text-amber-500"}),e(C==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),s.jsxs(Qe,{className:"space-y-2",children:[C==="faulty"?s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:k??"",range:be||""},components:{strong:s.jsx("strong",{})}})}):s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:k??"",maxStable:F},components:{strong:s.jsx("strong",{})}})}),s.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(C==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),s.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),s.jsxs(Xe,{children:[s.jsx(Je,{onClick:Se,children:e("proxyStatusWidget.cancel")}),s.jsx(et,{onClick:je,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{Ft as A,Jt as D,ts as P,Ot as R,Xt as a,es as i};
|
|
1
|
+
import{j as s}from"./radix-ui-BR1vy4kf.js";import{g as ve,r as j}from"./react-vendor-CNOkPC89.js";import{bp as pe,bq as me,br as xe,bs as Ce,bt as B,bu as Q,bv as L,bw as Ae,bx as we,a as Ee,bo as ke,aU as Te,by as Ve,bz as Ie,bA as Pe,bB as $e,bC as Re,c as U,B as oe,aG as We,M as De,O as Oe,r as Fe,s as _e,t as Le,v as Ue,w as qe,d as ne,T as Be,p as Me,q as Ke,Y as ze}from"./index-JgHDFSHt.js";import{A as He,a as Ye,b as Ze,c as Ge,d as Qe,e as Xe,f as Je,g as et}from"./alert-dialog-0GYXcDLu.js";import{u as fe,a as tt,b as st,e as nt}from"./tanstack-e99Cjjy2.js";import{t as X}from"./notifications-B2HqRBj7.js";import{t as rt,A as at,R as K,aY as it,aZ as ot,a_ as lt,X as ct,d as ut,a$ as dt,b0 as pt,U as mt,u as xt,l as ft,x as gt,ar as ht,T as J,aA as yt}from"./icons-DrEfTmfX.js";var ee,le;function bt(){return le||(le=1,ee={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}),ee}var jt=bt();const St=ve(jt);var Nt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ce(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(St[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Nt),i=null;(i=a.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),t.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var vt=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Ct=/^\s*$/,At=Object.create(null);function ge(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(ge,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var wt={parse:function(e,t){t||(t={}),t.components||(t.components=At);var n,r=[],a=[],i=-1,o=!1;if(e.indexOf("<")!==0){var c=e.indexOf("<");r.push({type:"text",content:c===-1?e:e.substring(0,c)})}return e.replace(vt,function(d,u){if(o){if(d!=="</"+n.name+">")return;o=!1}var f,E=d.charAt(1)!=="/",T=d.startsWith("<!--"),m=u+d.length,p=e.charAt(m);if(T){var S=ce(d);return i<0?(r.push(S),r):((f=a[i]).children.push(S),r)}if(E&&(i++,(n=ce(d)).type==="tag"&&t.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!p||p==="<"||n.children.push({type:"text",content:e.slice(m,e.indexOf("<",m))}),i===0&&r.push(n),(f=a[i-1])&&f.children.push(n),a[i]=n),(!E||n.voidElement)&&(i>-1&&(n.voidElement||n.name===d.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&p!=="<"&&p)){f=i===-1?r:a[i].children;var b=e.indexOf("<",m),I=e.slice(m,b===-1?void 0:b);Ct.test(I)&&(I=" "),(b>-1&&i+f.length>=0||I!==" ")&&f.push({type:"text",content:I})}}),r},stringify:function(e){return e.reduce(function(t,n){return t+ge("",n)},"")}};const H=(e,t)=>{if(!e)return!1;const n=e.props?.children??e.children;return t?n.length>0:!!n},Y=e=>{if(!e)return[];const t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?q(t):t},Et=e=>Array.isArray(e)&&e.every(j.isValidElement),q=e=>Array.isArray(e)?e:[e],kt=(e,t)=>{const n={...t};return n.props={...t.props,...e.props},n},Tt=e=>{const t={};if(!e)return t;const n=r=>{q(r).forEach(i=>{B(i)||(H(i)?n(Y(i)):L(i)&&!j.isValidElement(i)&&Object.assign(t,i))})};return n(e),t},he=(e,t,n,r)=>{if(!e)return"";let a="";const i=q(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,d)=>{if(B(c)){a+=`${c}`;return}if(j.isValidElement(c)){const{props:u,type:f}=c,E=Object.keys(u).length,T=o.indexOf(f)>-1,m=u.children;if(!m&&T&&!E){a+=`<${f}/>`;return}if(!m&&(!T||E)||u.i18nIsDynamicList){a+=`<${d}></${d}>`;return}if(T&&E===1&&B(m)){a+=`<${f}>${m}</${f}>`;return}const p=he(m,t,n,r);a+=`<${d}>${p}</${d}>`;return}if(c===null){Q(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:u,...f}=c,E=Object.keys(f);if(E.length===1){const T=u?`${E[0]}, ${u}`:E[0];a+=`{{${T}}}`;return}Q(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}Q(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Vt=(e,t=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...t,...r];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let c=!1;const d=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(d){const u=d[1];(/^\d+$/.test(u)||a.includes(u))&&(c=!0,i+=d[0],o+=d[0].length)}if(!c){const u=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(u){const f=u[1];(/^\d+$/.test(f)||a.includes(f))&&(c=!0,i+=u[0],o+=u[0].length)}}c||(i+="<",o+=1)}else i+=e[o],o+=1;return i},It=(e,t,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],d=n&&new RegExp(c.map(x=>`<${x}`).join("|")).test(n);if(!e&&!t&&!d&&!o)return[n];const u=t??{},f=x=>{q(x).forEach(g=>{B(g)||(H(g)?f(Y(g)):L(g)&&!j.isValidElement(g)&&Object.assign(u,g))})};f(e);const E=Vt(n,c,u),T=wt.parse(`<0>${E}</0>`),m={...u,...i},p=(x,k,g)=>{const C=Y(x),R=b(C,k.children,g);return Et(C)&&R.length===0||x.props?.i18nIsDynamicList?C:R},S=(x,k,g,C,R)=>{x.dummy?(x.children=k,g.push(j.cloneElement(x,{key:C},R?void 0:k))):g.push(...j.Children.map([x],h=>{const l="data-i18n-is-dynamic-list",A={key:C,[l]:void 0};return h&&h.props&&Object.keys(h.props).forEach(V=>{V==="ref"||V==="children"||V==="i18nIsDynamicList"||V===l||(A[V]=h.props[V])}),j.cloneElement(h,A,R?null:k)}))},b=(x,k,g)=>{const C=q(x);return q(k).reduce((h,l,A)=>{const V=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,m,r.language);if(l.type==="tag"){let N=C[parseInt(l.name,10)];!N&&t&&(N=t[l.name]),g.length===1&&!N&&(N=g[0][l.name]),N||(N={});const $={...l.attrs};o&&Object.keys($).forEach(y=>{const F=$[y];B(F)&&($[y]=Ae(F))});const v=Object.keys($).length!==0?kt({props:$},N):N,P=j.isValidElement(v),O=P&&H(l,!0)&&!l.voidElement,W=d&&L(v)&&v.dummy&&!P,M=L(t)&&Object.hasOwnProperty.call(t,l.name);if(B(v)){const y=r.services.interpolator.interpolate(v,m,r.language);h.push(y)}else if(H(v)||O){const y=p(v,l,g);S(v,y,h,A)}else if(W){const y=b(C,l.children,g);S(v,y,h,A)}else if(Number.isNaN(parseFloat(l.name)))if(M){const y=p(v,l,g);S(v,y,h,A,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)h.push(j.createElement(l.name,{key:`${l.name}-${A}`}));else{const y=b(C,l.children,g);h.push(j.createElement(l.name,{key:`${l.name}-${A}`},y))}else if(l.voidElement)h.push(`<${l.name} />`);else{const y=b(C,l.children,g);h.push(`<${l.name}>${y}</${l.name}>`)}else if(L(v)&&!P){const y=l.children[0]?V:null;y&&h.push(y)}else S(v,V,h,A,l.children.length!==1||!V)}else if(l.type==="text"){const N=a.transWrapTextNodes,$=typeof a.unescape=="function"?a.unescape:xe().unescape,v=o?$(r.services.interpolator.interpolate(l.content,m,r.language)):r.services.interpolator.interpolate(l.content,m,r.language);N?h.push(j.createElement(N,{key:`${l.name}-${A}`},v)):h.push(v)}return h},[])},I=b([{dummy:!0,children:e||[]}],T,q(e||[]));return Y(I[0])},ye=(e,t,n)=>{const r=e.key||t,a=j.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return a;function i(){return j.createElement(j.Fragment,null,a)}return j.createElement(i,{key:r})},Pt=(e,t)=>e.map((n,r)=>ye(n,r,t)),$t=(e,t)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:ye(e[r],r,t)})}),n},Rt=(e,t,n,r)=>e?Array.isArray(e)?Pt(e,t):L(e)?$t(e,t):(pe(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Wt=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((t,n)=>t&&Number.isNaN(Number.parseFloat(n)),!0);function Dt({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:T,...m}){const p=f||me();if(!p)return pe(p,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const S=E||p.t.bind(p)||(_=>_),b={...xe(),...p.options?.react};let I=u||S.ns||p.options?.defaultNS;I=B(I)?[I]:I||["translation"];const{transDefaultProps:x}=b,k=x?.tOptions?{...x.tOptions,...i}:i,g=T??x?.shouldUnescape,C=x?.values?{...x.values,...o}:o,R=x?.components?{...x.components,...d}:d,h=he(e,b,p,r),l=c||k?.defaultValue||h||b.transEmptyNodeValue||(typeof r=="function"?Ce(r):r),{hashTransKey:A}=b,V=r||(A?A(h||l):h||l);p.options?.interpolation?.defaultVariables?o=C&&Object.keys(C).length>0?{...C,...p.options.interpolation.defaultVariables}:{...p.options.interpolation.defaultVariables}:o=C;const N=Tt(e);N&&typeof N.count=="number"&&t===void 0&&(t=N.count);const $=o||t!==void 0&&!p.options?.interpolation?.alwaysFormat||!e?k.interpolation:{interpolation:{...k.interpolation,prefix:"#$?",suffix:"?$#"}},v={...k,context:a||k.context,count:t,...o,...$,defaultValue:l,ns:I};let P=V?S(V,v):l;P===V&&l&&(P=l);const O=Rt(R,P,p,r);let W=O||e,M=null;Wt(O)&&(M=O,W=e);const y=It(W,M,P,p,b,v,g),F=n??b.defaultTransParent;return F?j.createElement(F,m,y):y}function ue({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:T,...m}){const{i18n:p,defaultNS:S}=j.useContext(we)||{},b=f||p||me(),I=E||b?.t.bind(b);return Dt({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:d,ns:u||I?.ns||S||b?.options?.defaultNS,i18n:b,t:E,shouldUnescape:T,...m})}const Xt="2026-02-24-antigravity-oauth-v2",Ot="I ACCEPT RISK",Ft=Ot,Jt={reviewedIssue509:!1,understandsBanRisk:!1,acceptsFullResponsibility:!1,typedPhrase:""};function es(e){return e.reviewedIssue509&&e.understandsBanRisk&&e.acceptsFullResponsibility&&e.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===Ft}async function _t(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let t="Failed to fetch sync status";try{const n=await e.json();t=n.error||n.message||t}catch{}throw new Error(t)}return e.json()}async function Lt(){const e=new AbortController,t=setTimeout(()=>e.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.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(t)}}function Ut(){return fe({queryKey:["cliproxy-sync-status"],queryFn:_t,refetchInterval:3e4,retry:1,staleTime:1e4})}function qt(){const e=tt();return st({mutationFn:Lt,onSuccess:t=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),t.syncedCount===0?X.info("No profiles to sync"):X.success(`Synced ${t.syncedCount} profile${t.syncedCount===1?"":"s"} to CLIProxy`)},onError:t=>{X.error(`Sync failed: ${t.message}`)}})}function de(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function re(e,t){const n=de(e),r=de(t);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 te(e,t){return re(e,t)>0}function se(e,t,n){return re(e,t)>=0&&re(e,n)<=0}function Bt(e){if(!e)return"";const t=new Date(e).getTime(),r=Date.now()-t,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 Mt(e,t){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?t("proxyStatusWidget.justNow"):r<60?t("proxyStatusWidget.minutesAgo",{count:r}):t("proxyStatusWidget.hoursAgo",{count:a})}function z({icon:e,tooltip:t,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return s.jsxs(Be,{children:[s.jsx(Me,{asChild:!0,children:s.jsx(ne,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:U("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?s.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(e,{className:"w-3.5 h-3.5"})})}),s.jsx(Ke,{side:"bottom",className:"text-xs",children:t})]})}function ts(){const{t:e}=Ee(),{data:t,isLoading:n}=ke(),{data:r}=Te(),{data:a,isLoading:i}=Ve(),o=Ie(),c=Pe(),d=$e(),u=Re(),{data:f}=Ut(),{mutate:E,isPending:T}=qt(),[m,p]=j.useState(!1),[S,b]=j.useState(""),[I,x]=j.useState(!1),[k,g]=j.useState(null),[C,R]=j.useState(null),{data:h}=fe({queryKey:["cliproxy-server-config"],queryFn:()=>ze.cliproxyServer.get(),staleTime:3e4}),l=nt({mutationKey:["update-backend"]})>0,A=h?.remote,V=A?.enabled&&A?.host,N=t?.running??!1,$=o.isPending||c.isPending||d.isPending||u.isPending||l||T,v=r?.hasUpdate??!1,P=r?.isStable===!1,O=r?.currentVersion,W=f?.configured??!1,M=e(W?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),y=P?r?.maxStableVersion||a?.latestStable:r?.latestVersion,F=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",_=a?.faultyRange,be=_&&`${_.min.replace(/-\d+$/,"")}-${_.max.replace(/-\d+$/,"")}`,Z=(w,D)=>{g(w),R(D),x(!0)},ae=async w=>{if(!w)return;const D=te(w,F);if(_!==void 0&&se(w,_.min,_.max)){Z(w,"faulty");return}if(D){Z(w,"experimental");return}try{const ie=await u.mutateAsync({version:w});ie.requiresConfirmation&&Z(w,ie.isFaulty?"faulty":"experimental")}catch{}},je=()=>{k&&u.mutate({version:k,force:!0}),x(!1),g(null),R(null)},Se=()=>{x(!1),g(null),R(null)},Ne=V?(()=>{const w=A.protocol||"http",D=A.port||(w==="https"?443:80);return w==="https"&&D===443||w==="http"&&D===80?A.host:`${A.host}:${D}`})():null;return V?s.jsxs("div",{className:U("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(rt,{className:"w-4 h-4 text-blue-500"}),s.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),s.jsx(oe,{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:e("proxyStatusWidget.active")})]}),s.jsx(at,{className:"w-3 h-3 text-blue-600"})]}),s.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex items-center gap-1 mb-1",children:s.jsx("span",{className:"font-mono",children:Ne})}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]})]}):s.jsx(We,{delayDuration:300,children:s.jsxs("div",{className:U("rounded-lg border p-3 transition-colors",N?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:U("w-2 h-2 rounded-full",N?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),s.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[n?s.jsx(K,{className:"w-3 h-3 animate-spin text-muted-foreground"}):N?s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:T?K:it,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>E(),disabled:!W||$,isPending:T}),s.jsx(z,{icon:ot,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>d.mutate(),disabled:$,isPending:d.isPending}),s.jsx(z,{icon:lt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>c.mutate(),disabled:$,isPending:c.isPending,variant:"destructive-ghost"})]}):null,s.jsx(z,{icon:m?ct:ut,tooltip:e(m?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>p(!m),className:m?"bg-muted":void 0})]})]}),O&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsxs("span",{className:U("text-xs font-mono text-muted-foreground",P&&"text-amber-600 dark:text-amber-400"),children:["v",O]}),(v||P)&&y&&s.jsxs(oe,{variant:"secondary",className:U("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",P?"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 ae(y),title:e(P?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[P?s.jsx(dt,{className:"w-2.5 h-2.5"}):s.jsx(pt,{className:"w-2.5 h-2.5"}),y]})]}),N&&t&&s.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[s.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:t.port})}),t.sessionCount!==void 0&&t.sessionCount>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(mt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:t.sessionCount})]}),t.startedAt&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(xt,{className:"w-3 h-3"}),Bt(t.startedAt)]})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[W?s.jsx(ft,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):s.jsx(gt,{className:"w-3 h-3 text-muted-foreground"}),s.jsx("span",{className:U("text-xs",W?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:M})]}),s.jsx(De,{open:m,onOpenChange:p,children:s.jsxs(Oe,{className:"mt-3 pt-3 border-t border-muted",children:[s.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Fe,{value:S,onValueChange:b,disabled:i,children:[s.jsx(_e,{className:"h-8 text-xs flex-1",children:s.jsx(Le,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),s.jsx(Ue,{children:a?.versions.slice(0,20).map(w=>{const D=a?.maxStableVersion&&te(w,a.maxStableVersion),G=a?.faultyRange&&se(w,a.faultyRange.min,a.faultyRange.max);return s.jsx(qe,{value:w,className:"text-xs",children:s.jsxs("span",{className:"flex items-center gap-2",children:["v",w,w===a.latestStable&&s.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(G||D)&&s.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},w)})})]}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void ae(S),disabled:u.isPending||!S,children:[u.isPending?s.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(ht,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),S&&a?.maxStableVersion&&te(S,a.maxStableVersion)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(J,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),S&&a?.faultyRange&&se(S,a.faultyRange.min,a.faultyRange.max)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(J,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:S})})]}),r?.checkedAt&&s.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Mt(r.checkedAt,e)})})]})}),!N&&s.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>o.mutate(),disabled:o.isPending,children:[o.isPending?s.jsx(K,{className:"w-3 h-3 animate-spin"}):s.jsx(yt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),s.jsx(He,{open:I,onOpenChange:x,children:s.jsxs(Ye,{children:[s.jsxs(Ze,{children:[s.jsxs(Ge,{className:"flex items-center gap-2",children:[s.jsx(J,{className:"w-5 h-5 text-amber-500"}),e(C==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),s.jsxs(Qe,{className:"space-y-2",children:[C==="faulty"?s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:k??"",range:be||""},components:{strong:s.jsx("strong",{})}})}):s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:k??"",maxStable:F},components:{strong:s.jsx("strong",{})}})}),s.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(C==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),s.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),s.jsxs(Xe,{children:[s.jsx(Je,{onClick:Se,children:e("proxyStatusWidget.cancel")}),s.jsx(et,{onClick:je,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{Ft as A,Jt as D,ts as P,Ot as R,Xt as a,es as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,$ as n}from"./radix-ui-BR1vy4kf.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as i,$ as n}from"./radix-ui-BR1vy4kf.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-JgHDFSHt.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-BR1vy4kf.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as R,bd as ee,be as se,bf as te,Q as ae,R as re,U as ne,B as $,b5 as S,b6 as M,b7 as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-Cw9Urr0S.js";import{$ as ce,a4 as oe,aQ as me,T as E,R as T,F as he,ak as ue,x as xe}from"./icons-DrEfTmfX.js";import"./tanstack-e99Cjjy2.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=R(),[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(Q,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(Q,{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 Q({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}=R(),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-BR1vy4kf.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as R,bd as ee,be as se,bf as te,Q as ae,R as re,U as ne,B as $,b5 as S,b6 as M,b7 as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-JgHDFSHt.js";import{$ as ce,a4 as oe,aQ as me,T as E,R as T,F as he,ak as ue,x as xe}from"./icons-DrEfTmfX.js";import"./tanstack-e99Cjjy2.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=R(),[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(Q,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(Q,{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 Q({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}=R(),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 a,a2 as s,a3 as n}from"./radix-ui-BR1vy4kf.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as a,a2 as s,a3 as n}from"./radix-ui-BR1vy4kf.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-JgHDFSHt.js";function c({className:t,...r}){return a.jsx(s,{"data-slot":"switch",className:e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:a.jsx(n,{"data-slot":"switch-thumb",className:e("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{c as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-BR1vy4kf.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bg as M,C as g,j,k as N,_ as w,b as v,n as b,bh as U,bi as z,I as B,bj as L}from"./index-Cw9Urr0S.js";import{Y as $,Q,aR as Y,v as q,E as G,I as J,a4 as V,C as F,aS as H,ak as K}from"./icons-DrEfTmfX.js";import"./tanstack-e99Cjjy2.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={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 X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("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:t("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:t("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:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();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(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx($,{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(Q,{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(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();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:[a&&e.jsx(R,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("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(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{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(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>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:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.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:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{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(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):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:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"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(F,{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:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...z].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex 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(H,{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:O})]}),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(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:l,onChange:r=>n(r.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(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.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(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?L(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bg as M,C as g,j,k as N,_ as w,b as v,n as b,bh as U,bi as z,I as B,bj as L}from"./index-JgHDFSHt.js";import{Y as $,Q,aR as Y,v as q,E as G,I as J,a4 as V,C as F,aS as H,ak as K}from"./icons-DrEfTmfX.js";import"./tanstack-e99Cjjy2.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={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 X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("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:t("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:t("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:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();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(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx($,{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(Q,{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(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();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:[a&&e.jsx(R,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("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(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{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(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>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:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.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:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{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(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):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:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"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(F,{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:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...z].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex 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(H,{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:O})]}),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(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:l,onChange:r=>n(r.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(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.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(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?L(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<title>Novita AI</title>
|
|
3
|
+
<path
|
|
4
|
+
clip-rule="evenodd"
|
|
5
|
+
d="M9.167 4.17v5.665L0 19.003h9.167v-5.666l5.666 5.666H24L9.167 4.17z"
|
|
6
|
+
fill="#23D57C"
|
|
7
|
+
fill-rule="evenodd"
|
|
8
|
+
/>
|
|
9
|
+
</svg>
|
package/dist/ui/index.html
CHANGED
|
@@ -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-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-JgHDFSHt.js"></script>
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-CNOkPC89.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-BR1vy4kf.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-e99Cjjy2.js">
|