@kaitranntt/ccs 7.53.0 → 7.54.0-dev.2
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 +61 -1
- package/config/base-codex.settings.json +4 -4
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +3 -1
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/ccs.d.ts +1 -1
- package/dist/ccs.d.ts.map +1 -1
- package/dist/ccs.js +1 -0
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/binary/downloader.d.ts +1 -14
- package/dist/cliproxy/binary/downloader.d.ts.map +1 -1
- package/dist/cliproxy/binary/downloader.js +5 -43
- package/dist/cliproxy/binary/downloader.js.map +1 -1
- package/dist/cliproxy/codex-plan-compatibility.d.ts +10 -0
- package/dist/cliproxy/codex-plan-compatibility.d.ts.map +1 -0
- package/dist/cliproxy/codex-plan-compatibility.js +69 -0
- package/dist/cliproxy/codex-plan-compatibility.js.map +1 -0
- package/dist/cliproxy/config/thinking-config.d.ts.map +1 -1
- package/dist/cliproxy/config/thinking-config.js +9 -0
- package/dist/cliproxy/config/thinking-config.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +8 -0
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/index.d.ts +1 -0
- package/dist/cliproxy/index.d.ts.map +1 -1
- package/dist/cliproxy/index.js +6 -2
- package/dist/cliproxy/index.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +81 -12
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/model-config.d.ts.map +1 -1
- package/dist/cliproxy/model-config.js +2 -2
- package/dist/cliproxy/model-config.js.map +1 -1
- package/dist/cliproxy/services/variant-settings.d.ts +3 -1
- package/dist/cliproxy/services/variant-settings.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-settings.js +5 -2
- package/dist/cliproxy/services/variant-settings.js.map +1 -1
- package/dist/cliproxy/thinking-validator.js +20 -0
- package/dist/cliproxy/thinking-validator.js.map +1 -1
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/config-command.js +7 -0
- package/dist/commands/config-command.js.map +1 -1
- package/dist/commands/copilot-command.d.ts.map +1 -1
- package/dist/commands/copilot-command.js +19 -8
- package/dist/commands/copilot-command.js.map +1 -1
- package/dist/commands/env-command.d.ts.map +1 -1
- package/dist/commands/env-command.js +31 -76
- package/dist/commands/env-command.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +10 -2
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/persist-command.d.ts +4 -4
- package/dist/commands/persist-command.d.ts.map +1 -1
- package/dist/commands/persist-command.js +76 -83
- package/dist/commands/persist-command.js.map +1 -1
- package/dist/copilot/copilot-executor.d.ts.map +1 -1
- package/dist/copilot/copilot-executor.js +23 -14
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/copilot/copilot-model-normalizer.d.ts +30 -0
- package/dist/copilot/copilot-model-normalizer.d.ts.map +1 -0
- package/dist/copilot/copilot-model-normalizer.js +159 -0
- package/dist/copilot/copilot-model-normalizer.js.map +1 -0
- package/dist/copilot/copilot-models.d.ts.map +1 -1
- package/dist/copilot/copilot-models.js +0 -9
- package/dist/copilot/copilot-models.js.map +1 -1
- package/dist/copilot/index.d.ts +1 -0
- package/dist/copilot/index.d.ts.map +1 -1
- package/dist/copilot/index.js +9 -1
- package/dist/copilot/index.js.map +1 -1
- 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/claude-extension-hosts.d.ts +12 -0
- package/dist/shared/claude-extension-hosts.d.ts.map +1 -0
- package/dist/shared/claude-extension-hosts.js +33 -0
- package/dist/shared/claude-extension-hosts.js.map +1 -0
- package/dist/shared/claude-extension-setup.d.ts +30 -0
- package/dist/shared/claude-extension-setup.d.ts.map +1 -0
- package/dist/shared/claude-extension-setup.js +232 -0
- package/dist/shared/claude-extension-setup.js.map +1 -0
- package/dist/ui/assets/{accounts-BGeV6RYc.js → accounts-CZEg1_PX.js} +1 -1
- package/dist/ui/assets/{alert-dialog-BGgi27Hi.js → alert-dialog-DhwS38kc.js} +1 -1
- package/dist/ui/assets/{api-NqhAOtK1.js → api-sWNND4wP.js} +1 -1
- package/dist/ui/assets/{auth-section-B5dLDT5c.js → auth-section-nJIpOcnm.js} +1 -1
- package/dist/ui/assets/{backups-section-COPmsPIk.js → backups-section-D3A6hmrU.js} +1 -1
- package/dist/ui/assets/{checkbox-DYHfVVrN.js → checkbox-CZrxD1iS.js} +1 -1
- package/dist/ui/assets/claude-extension-BjInaILv.js +1 -0
- package/dist/ui/assets/{cliproxy-BSKey7Yk.js → cliproxy-BGiSCGkl.js} +2 -2
- package/dist/ui/assets/{cliproxy-control-panel-C-Yyhlim.js → cliproxy-control-panel-CKO2Sn9B.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-B7Lzqyum.js → confirm-dialog-DTKxwrat.js} +1 -1
- package/dist/ui/assets/copilot-CuRngdBg.js +3 -0
- package/dist/ui/assets/{cursor-BH8co9su.js → cursor-Dxo0uIiU.js} +1 -1
- package/dist/ui/assets/{droid-C4lLcCII.js → droid-Cl8QsJJL.js} +1 -1
- package/dist/ui/assets/{globalenv-section-D0TAPAVS.js → globalenv-section-C3dxxoD9.js} +1 -1
- package/dist/ui/assets/{health-BzfCtqqG.js → health-BUifaDU7.js} +1 -1
- package/dist/ui/assets/icons-DrEfTmfX.js +1 -0
- package/dist/ui/assets/{index-DI8j_aYa.js → index-BOsbrhaa.js} +1 -1
- package/dist/ui/assets/index-Btf_ow2V.css +1 -0
- package/dist/ui/assets/{index-B3R5r7pg.js → index-CPdceT1C.js} +1 -1
- package/dist/ui/assets/index-CYo-E5rU.js +1 -0
- package/dist/ui/assets/index-Cw9Urr0S.js +47 -0
- package/dist/ui/assets/{index-BoCctuVm.js → index-xayyyR26.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-C3kt_0Qn.js → proxy-status-widget-D94htBPb.js} +1 -1
- package/dist/ui/assets/{separator-DJb9h9_B.js → separator-3fBbTn-V.js} +1 -1
- package/dist/ui/assets/{shared-CKcd4Q-6.js → shared-q_FNNbjD.js} +1 -1
- package/dist/ui/assets/{switch-BVx3z2gz.js → switch-5N8qBdBr.js} +1 -1
- package/dist/ui/assets/updates-CubQ54J0.js +1 -0
- package/dist/ui/index.html +3 -3
- package/dist/utils/fetch-proxy-setup.d.ts +13 -0
- package/dist/utils/fetch-proxy-setup.d.ts.map +1 -0
- package/dist/utils/fetch-proxy-setup.js +112 -0
- package/dist/utils/fetch-proxy-setup.js.map +1 -0
- package/dist/utils/proxy-env.d.ts +15 -0
- package/dist/utils/proxy-env.d.ts.map +1 -0
- package/dist/utils/proxy-env.js +126 -0
- package/dist/utils/proxy-env.js.map +1 -0
- package/dist/web-server/routes/claude-extension-routes.d.ts +3 -0
- package/dist/web-server/routes/claude-extension-routes.d.ts.map +1 -0
- package/dist/web-server/routes/claude-extension-routes.js +161 -0
- package/dist/web-server/routes/claude-extension-routes.js.map +1 -0
- package/dist/web-server/routes/copilot-routes.d.ts.map +1 -1
- package/dist/web-server/routes/copilot-routes.js +53 -45
- package/dist/web-server/routes/copilot-routes.js.map +1 -1
- package/dist/web-server/routes/copilot-settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/copilot-settings-routes.js +77 -36
- package/dist/web-server/routes/copilot-settings-routes.js.map +1 -1
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +2 -0
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/services/claude-extension-binding-service.d.ts +30 -0
- package/dist/web-server/services/claude-extension-binding-service.d.ts.map +1 -0
- package/dist/web-server/services/claude-extension-binding-service.js +240 -0
- package/dist/web-server/services/claude-extension-binding-service.js.map +1 -0
- package/dist/web-server/services/claude-extension-settings-service.d.ts +23 -0
- package/dist/web-server/services/claude-extension-settings-service.d.ts.map +1 -0
- package/dist/web-server/services/claude-extension-settings-service.js +493 -0
- package/dist/web-server/services/claude-extension-settings-service.js.map +1 -0
- package/package.json +2 -1
- package/scripts/completion/ccs.bash +11 -4
- package/dist/ui/assets/copilot-D-MitpPb.js +0 -3
- package/dist/ui/assets/icons-D2eEmpHv.js +0 -1
- package/dist/ui/assets/index-Br6LTYDi.js +0 -1
- package/dist/ui/assets/index-BusjPRWX.css +0 -1
- package/dist/ui/assets/index-C2HpWmQl.js +0 -47
- package/dist/ui/assets/updates-D-X3ZIXa.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as o}from"./react-vendor-CNOkPC89.js";import{a as q,bd as J,bf as X,d as I,n as Y,L as A,r as R,s as M,t as K,v as B,w as E,I as F}from"./index-C2HpWmQl.js";import{S as Q}from"./switch-BVx3z2gz.js";import{R as $,w as Z,u as ee,a4 as se,N as te,q as re}from"./icons-D2eEmpHv.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 z={mode:"auto",tier_defaults:{opus:"high",sonnet:"medium",haiku:"low"},show_warnings:!0},U=1e4;function ie(){const[t,i]=o.useState(null),[b,d]=o.useState(!0),[_,N]=o.useState(!1),[p,g]=o.useState(null),[P,y]=o.useState(!1),f=o.useRef(void 0),w=o.useRef(!1),k=o.useCallback(async()=>{const r=new AbortController,c=setTimeout(()=>r.abort(),U);try{d(!0),g(null);const n=await fetch("/api/thinking",{signal:r.signal});if(clearTimeout(c),!n.ok)throw n.headers.get("content-type")?.includes("text/html")?new Error(`Server error (${n.status})`):new Error("Failed to load Thinking config");const m=await n.json();i(m.config||z),f.current=m.lastModified,w.current=!0}catch(n){clearTimeout(c),n.name==="AbortError"?g("Request timeout - please try again"):g(n.message)}finally{d(!1)}return()=>r.abort()},[]),l=o.useCallback(async r=>{if(!w.current||t===null){g("Cannot save settings before they load. Click Refresh and try again.");return}const c=t,n={...c,...r.mode!==void 0?{mode:r.mode}:{},...r.tier_defaults!==void 0?{tier_defaults:r.tier_defaults}:{},...r.show_warnings!==void 0?{show_warnings:r.show_warnings}:{}};r.clear_override||r.override===null?delete n.override:r.override!==void 0&&(n.override=r.override),r.clear_provider_overrides||r.provider_overrides===null?delete n.provider_overrides:r.provider_overrides!==void 0&&(n.provider_overrides=r.provider_overrides),i(n);const m=new AbortController,h=setTimeout(()=>m.abort(),U);try{N(!0),g(null);const x={...n,lastModified:f.current},u=await fetch("/api/thinking",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(clearTimeout(h),!u.ok){if(u.headers.get("content-type")?.includes("text/html"))throw new Error(`Server error (${u.status})`);const s=await u.json();throw u.status===409?new Error("Config changed by another session. Refreshing..."):new Error(s.error||"Failed to save")}const v=await u.json();i(v.config),f.current=v.lastModified,y(!0),setTimeout(()=>y(!1),1500)}catch(x){clearTimeout(h),i(c),x.name==="AbortError"?g("Request timeout - please try again"):(g(x.message),x.message.includes("another session")&&setTimeout(()=>k(),1e3))}finally{N(!1)}},[t,k]),T=o.useCallback(r=>{l({mode:r})},[l]),C=o.useCallback((r,c)=>{const n=t?.tier_defaults||z.tier_defaults;l({tier_defaults:{...n,[r]:c}})},[t,l]),S=o.useCallback(r=>{l({show_warnings:r})},[l]),D=o.useCallback(r=>{if(r===void 0){l({override:null,clear_override:!0});return}l({override:r,clear_override:!1})},[l]),L=o.useCallback((r,c,n)=>{const m=t?.provider_overrides||{},h=m[r]||{};if(n===void 0){const{[c]:x,...u}=h,v=Object.keys(u).length>0?u:void 0,{[r]:O,...s}=m,a=v?{...s,[r]:v}:s;l({provider_overrides:Object.keys(a).length>0?a:null,clear_provider_overrides:Object.keys(a).length===0})}else l({provider_overrides:{...m,[r]:{...h,[c]:n}},clear_provider_overrides:!1})},[t,l]);return{config:t||z,loading:b,saving:_,error:p,success:P,fetchConfig:k,saveConfig:l,setMode:T,setTierDefault:C,setShowWarnings:S,setOverride:D,setProviderOverride:L}}const H=[{value:"minimal",label:"Minimal (512 tokens)"},{value:"low",label:"Low (1K tokens)"},{value:"medium",label:"Medium (8K tokens)"},{value:"high",label:"High (24K tokens)"},{value:"xhigh",label:"Extra High (32K tokens)"},{value:"auto",label:"Auto (dynamic)"}],ne=[{value:"__none__",label:"None (use CLI flags only)"},...H,{value:"__custom__",label:"Custom budget (number)"},{value:"off",label:"Off (disable thinking)"}],ae=["agy","gemini","codex"],G=0,V=1e5;function ve(){const{t}=q(),{config:i,loading:b,saving:d,error:_,success:N,fetchConfig:p,setMode:g,setTierDefault:P,setShowWarnings:y,setOverride:f,setProviderOverride:w}=ie(),[k,l]=o.useState(null),[T,C]=o.useState(""),[S,D]=o.useState([]),[L,r]=o.useState(null),c=o.useMemo(()=>Array.from(new Set([...ae,...Object.keys(i.provider_overrides??{}),...S])),[S,i.provider_overrides]),n=i.override===void 0?"__none__":typeof i.override=="number"||/^\d+$/.test(String(i.override))?"__custom__":String(i.override),m=typeof i.override=="number"||/^\d+$/.test(String(i.override??""))?String(i.override):"",h=L??m,x=Object.keys(i.provider_overrides??{}).length>0,u=k??x;o.useEffect(()=>{p()},[p]);const v=()=>{const s=T.trim().toLowerCase();s&&(c.includes(s)||D(a=>[...a,s]),C(""),l(!0))},O=()=>{const s=h.trim();if(!s){f(void 0);return}const a=Number.parseInt(s,10);Number.isNaN(a)||a<G||a>V||!/^\d+$/.test(s)||f(a)};return b?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($,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:t("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 ${_||N?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[_&&e.jsx(J,{variant:"destructive",className:"py-2 shadow-lg",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(X,{children:_})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:p,className:"h-7 px-2 text-xs border-destructive/50 hover:bg-destructive/10",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),t("sharedPage.retry")]})]})}),N&&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:t("settings.saved")})]})]}),e.jsx(Y,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"w-5 h-5 text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.description")})]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(te,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.supportedProviders")}),e.jsxs("ul",{className:"mt-1 space-y-0.5 text-blue-600 dark:text-blue-400",children:[e.jsxs("li",{children:[t("settingsThinking.supportLine1Prefix")," ",e.jsx("strong",{children:"agy"}),","," ",e.jsx("strong",{children:"gemini"})," ",t("settingsThinking.supportLine1Suffix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine2Prefix")," ",e.jsx("strong",{children:"codex"})," ",t("settingsThinking.supportLine2SuffixPrefix"),e.jsx("code",{children:"--effort"}),t("settingsThinking.supportLine2SuffixPostfix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine3Prefix")," ",e.jsx("code",{children:"-high"}),t("settingsThinking.supportLine3Suffix")]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.modeTitle")}),e.jsx("div",{className:"space-y-2",children:["auto","off","manual"].map(s=>e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg cursor-pointer transition-colors ${i.mode===s?"bg-primary/10 border border-primary/30":"bg-muted/50 hover:bg-muted/80"} ${d?"opacity-70 pointer-events-none":""}`,onClick:()=>{d||g(s)},children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium capitalize",children:s}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="auto"&&t("settingsThinking.modeAutoDesc"),s==="off"&&t("settingsThinking.modeOffDesc"),s==="manual"&&t("settingsThinking.modeManualDesc")]})]}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${i.mode===s?"bg-primary border-primary":"border-muted-foreground/50"}`})]},s))})]}),i.mode==="auto"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.tierDefaults")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.tierDefaultsDesc")}),e.jsx("div",{className:"space-y-3",children:["opus","sonnet","haiku"].map(s=>e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"w-20 capitalize font-medium",children:s}),e.jsxs(R,{value:i.tier_defaults[s],onValueChange:a=>P(s,a),disabled:d,children:[e.jsx(M,{className:"flex-1",children:e.jsx(K,{})}),e.jsx(B,{children:H.map(a=>e.jsx(E,{value:a.value,children:a.label},a.value))})]})]},s))})]}),i.mode==="manual"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.persistentOverride")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.persistentOverrideDesc")}),e.jsxs(R,{value:n,onValueChange:s=>{if(s==="__none__"){f(void 0);return}if(s==="__custom__"){h||r("8192");return}r(null),f(s)},disabled:d,children:[e.jsx(M,{children:e.jsx(K,{})}),e.jsx(B,{children:ne.map(s=>e.jsx(E,{value:s.value,children:s.label},s.value))})]}),n==="__custom__"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{type:"number",min:G,max:V,value:h,onChange:s=>r(s.target.value),onBlur:O,disabled:d,placeholder:t("settingsThinking.enterCustomBudget")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:O,disabled:d,children:t("settingsThinking.apply")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Range: ",G," to ",V]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 text-base font-medium w-full text-left",onClick:()=>l(s=>!(s??x)),disabled:d,children:[e.jsx(re,{className:`w-4 h-4 transition-transform ${u?"rotate-0":"-rotate-90"}`}),t("settingsThinking.providerOverrides",{count:Object.keys(i.provider_overrides??{}).length})]}),u&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.providerOverridesDesc")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{value:T,onChange:s=>C(s.target.value),disabled:d,placeholder:t("settingsThinking.addProviderPlaceholder")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:v,disabled:d,children:t("settingsGlobalEnv.add")})]}),c.map(s=>e.jsxs("div",{className:"space-y-2 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"capitalize font-medium text-sm",children:s}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:["opus","sonnet","haiku"].map(a=>{const W=i.provider_overrides?.[s]?.[a]||"__default__";return e.jsxs("div",{className:"space-y-1",children:[e.jsx(A,{className:"text-xs text-muted-foreground capitalize",children:a}),e.jsxs(R,{value:W,onValueChange:j=>w(s,a,j==="__default__"?void 0:j),disabled:d,children:[e.jsx(M,{className:"h-8 text-xs",children:e.jsx(K,{})}),e.jsxs(B,{children:[e.jsx(E,{value:"__default__",children:t("cursorPage.default")}),H.map(j=>e.jsx(E,{value:j.value,children:j.label},j.value))]})]})]},a)})})]},s))]})]}),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:t("settingsThinking.showWarnings")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.showWarningsDesc")})]}),e.jsx(Q,{checked:i.show_warnings??!0,onCheckedChange:y,disabled:d})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:t("settingsThinking.cliEnvOverride")}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Override per session with flags or"," ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted",children:"CCS_THINKING"})," env var. Priority: flag > env > config."]}),e.jsxs("div",{className:"space-y-1 text-sm font-mono text-muted-foreground",children:[e.jsx("p",{children:"ccs gemini --thinking high"}),e.jsx("p",{children:"ccs codex --effort xhigh"}),e.jsx("p",{children:'CCS_THINKING=high ccs codex "debug this"'}),e.jsx("p",{children:"ccs config thinking --mode auto"})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(I,{variant:"outline",size:"sm",onClick:p,disabled:b||d,className:"w-full",children:[e.jsx($,{className:`w-4 h-4 mr-2 ${b?"animate-spin":""}`}),t("settings.refresh")]})})]})}export{ve as default};
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as o}from"./react-vendor-CNOkPC89.js";import{a as q,b5 as J,b7 as X,d as I,n as Y,L as A,r as R,s as M,t as K,v as B,w as E,I as F}from"./index-Cw9Urr0S.js";import{S as Q}from"./switch-5N8qBdBr.js";import{R as $,x as Z,v as ee,a5 as se,O as te,r as re}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 z={mode:"auto",tier_defaults:{opus:"high",sonnet:"medium",haiku:"low"},show_warnings:!0},U=1e4;function ie(){const[t,i]=o.useState(null),[b,d]=o.useState(!0),[_,N]=o.useState(!1),[p,g]=o.useState(null),[P,y]=o.useState(!1),f=o.useRef(void 0),w=o.useRef(!1),k=o.useCallback(async()=>{const r=new AbortController,c=setTimeout(()=>r.abort(),U);try{d(!0),g(null);const n=await fetch("/api/thinking",{signal:r.signal});if(clearTimeout(c),!n.ok)throw n.headers.get("content-type")?.includes("text/html")?new Error(`Server error (${n.status})`):new Error("Failed to load Thinking config");const m=await n.json();i(m.config||z),f.current=m.lastModified,w.current=!0}catch(n){clearTimeout(c),n.name==="AbortError"?g("Request timeout - please try again"):g(n.message)}finally{d(!1)}return()=>r.abort()},[]),l=o.useCallback(async r=>{if(!w.current||t===null){g("Cannot save settings before they load. Click Refresh and try again.");return}const c=t,n={...c,...r.mode!==void 0?{mode:r.mode}:{},...r.tier_defaults!==void 0?{tier_defaults:r.tier_defaults}:{},...r.show_warnings!==void 0?{show_warnings:r.show_warnings}:{}};r.clear_override||r.override===null?delete n.override:r.override!==void 0&&(n.override=r.override),r.clear_provider_overrides||r.provider_overrides===null?delete n.provider_overrides:r.provider_overrides!==void 0&&(n.provider_overrides=r.provider_overrides),i(n);const m=new AbortController,h=setTimeout(()=>m.abort(),U);try{N(!0),g(null);const x={...n,lastModified:f.current},u=await fetch("/api/thinking",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(clearTimeout(h),!u.ok){if(u.headers.get("content-type")?.includes("text/html"))throw new Error(`Server error (${u.status})`);const s=await u.json();throw u.status===409?new Error("Config changed by another session. Refreshing..."):new Error(s.error||"Failed to save")}const v=await u.json();i(v.config),f.current=v.lastModified,y(!0),setTimeout(()=>y(!1),1500)}catch(x){clearTimeout(h),i(c),x.name==="AbortError"?g("Request timeout - please try again"):(g(x.message),x.message.includes("another session")&&setTimeout(()=>k(),1e3))}finally{N(!1)}},[t,k]),T=o.useCallback(r=>{l({mode:r})},[l]),C=o.useCallback((r,c)=>{const n=t?.tier_defaults||z.tier_defaults;l({tier_defaults:{...n,[r]:c}})},[t,l]),O=o.useCallback(r=>{l({show_warnings:r})},[l]),D=o.useCallback(r=>{if(r===void 0){l({override:null,clear_override:!0});return}l({override:r,clear_override:!1})},[l]),L=o.useCallback((r,c,n)=>{const m=t?.provider_overrides||{},h=m[r]||{};if(n===void 0){const{[c]:x,...u}=h,v=Object.keys(u).length>0?u:void 0,{[r]:S,...s}=m,a=v?{...s,[r]:v}:s;l({provider_overrides:Object.keys(a).length>0?a:null,clear_provider_overrides:Object.keys(a).length===0})}else l({provider_overrides:{...m,[r]:{...h,[c]:n}},clear_provider_overrides:!1})},[t,l]);return{config:t||z,loading:b,saving:_,error:p,success:P,fetchConfig:k,saveConfig:l,setMode:T,setTierDefault:C,setShowWarnings:O,setOverride:D,setProviderOverride:L}}const H=[{value:"minimal",label:"Minimal (512 tokens)"},{value:"low",label:"Low (1K tokens)"},{value:"medium",label:"Medium (8K tokens)"},{value:"high",label:"High (24K tokens)"},{value:"xhigh",label:"Extra High (32K tokens)"},{value:"auto",label:"Auto (dynamic)"}],ne=[{value:"__none__",label:"None (use CLI flags only)"},...H,{value:"__custom__",label:"Custom budget (number)"},{value:"off",label:"Off (disable thinking)"}],ae=["agy","gemini","codex"],G=0,V=1e5;function ve(){const{t}=q(),{config:i,loading:b,saving:d,error:_,success:N,fetchConfig:p,setMode:g,setTierDefault:P,setShowWarnings:y,setOverride:f,setProviderOverride:w}=ie(),[k,l]=o.useState(null),[T,C]=o.useState(""),[O,D]=o.useState([]),[L,r]=o.useState(null),c=o.useMemo(()=>Array.from(new Set([...ae,...Object.keys(i.provider_overrides??{}),...O])),[O,i.provider_overrides]),n=i.override===void 0?"__none__":typeof i.override=="number"||/^\d+$/.test(String(i.override))?"__custom__":String(i.override),m=typeof i.override=="number"||/^\d+$/.test(String(i.override??""))?String(i.override):"",h=L??m,x=Object.keys(i.provider_overrides??{}).length>0,u=k??x;o.useEffect(()=>{p()},[p]);const v=()=>{const s=T.trim().toLowerCase();s&&(c.includes(s)||D(a=>[...a,s]),C(""),l(!0))},S=()=>{const s=h.trim();if(!s){f(void 0);return}const a=Number.parseInt(s,10);Number.isNaN(a)||a<G||a>V||!/^\d+$/.test(s)||f(a)};return b?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($,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:t("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 ${_||N?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[_&&e.jsx(J,{variant:"destructive",className:"py-2 shadow-lg",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(X,{children:_})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:p,className:"h-7 px-2 text-xs border-destructive/50 hover:bg-destructive/10",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),t("sharedPage.retry")]})]})}),N&&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:t("settings.saved")})]})]}),e.jsx(Y,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"w-5 h-5 text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.description")})]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(te,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.supportedProviders")}),e.jsxs("ul",{className:"mt-1 space-y-0.5 text-blue-600 dark:text-blue-400",children:[e.jsxs("li",{children:[t("settingsThinking.supportLine1Prefix")," ",e.jsx("strong",{children:"agy"}),","," ",e.jsx("strong",{children:"gemini"})," ",t("settingsThinking.supportLine1Suffix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine2Prefix")," ",e.jsx("strong",{children:"codex"})," ",t("settingsThinking.supportLine2SuffixPrefix"),e.jsx("code",{children:"--effort"}),t("settingsThinking.supportLine2SuffixPostfix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine3Prefix")," ",e.jsx("code",{children:"-high"}),t("settingsThinking.supportLine3Suffix")]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.modeTitle")}),e.jsx("div",{className:"space-y-2",children:["auto","off","manual"].map(s=>e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg cursor-pointer transition-colors ${i.mode===s?"bg-primary/10 border border-primary/30":"bg-muted/50 hover:bg-muted/80"} ${d?"opacity-70 pointer-events-none":""}`,onClick:()=>{d||g(s)},children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium capitalize",children:s}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="auto"&&t("settingsThinking.modeAutoDesc"),s==="off"&&t("settingsThinking.modeOffDesc"),s==="manual"&&t("settingsThinking.modeManualDesc")]})]}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${i.mode===s?"bg-primary border-primary":"border-muted-foreground/50"}`})]},s))})]}),i.mode==="auto"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.tierDefaults")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.tierDefaultsDesc")}),e.jsx("div",{className:"space-y-3",children:["opus","sonnet","haiku"].map(s=>e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"w-20 capitalize font-medium",children:s}),e.jsxs(R,{value:i.tier_defaults[s],onValueChange:a=>P(s,a),disabled:d,children:[e.jsx(M,{className:"flex-1",children:e.jsx(K,{})}),e.jsx(B,{children:H.map(a=>e.jsx(E,{value:a.value,children:a.label},a.value))})]})]},s))})]}),i.mode==="manual"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.persistentOverride")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.persistentOverrideDesc")}),e.jsxs(R,{value:n,onValueChange:s=>{if(s==="__none__"){f(void 0);return}if(s==="__custom__"){h||r("8192");return}r(null),f(s)},disabled:d,children:[e.jsx(M,{children:e.jsx(K,{})}),e.jsx(B,{children:ne.map(s=>e.jsx(E,{value:s.value,children:s.label},s.value))})]}),n==="__custom__"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{type:"number",min:G,max:V,value:h,onChange:s=>r(s.target.value),onBlur:S,disabled:d,placeholder:t("settingsThinking.enterCustomBudget")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:S,disabled:d,children:t("settingsThinking.apply")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Range: ",G," to ",V]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 text-base font-medium w-full text-left",onClick:()=>l(s=>!(s??x)),disabled:d,children:[e.jsx(re,{className:`w-4 h-4 transition-transform ${u?"rotate-0":"-rotate-90"}`}),t("settingsThinking.providerOverrides",{count:Object.keys(i.provider_overrides??{}).length})]}),u&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.providerOverridesDesc")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{value:T,onChange:s=>C(s.target.value),disabled:d,placeholder:t("settingsThinking.addProviderPlaceholder")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:v,disabled:d,children:t("settingsGlobalEnv.add")})]}),c.map(s=>e.jsxs("div",{className:"space-y-2 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"capitalize font-medium text-sm",children:s}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:["opus","sonnet","haiku"].map(a=>{const W=i.provider_overrides?.[s]?.[a]||"__default__";return e.jsxs("div",{className:"space-y-1",children:[e.jsx(A,{className:"text-xs text-muted-foreground capitalize",children:a}),e.jsxs(R,{value:W,onValueChange:j=>w(s,a,j==="__default__"?void 0:j),disabled:d,children:[e.jsx(M,{className:"h-8 text-xs",children:e.jsx(K,{})}),e.jsxs(B,{children:[e.jsx(E,{value:"__default__",children:t("cursorPage.default")}),H.map(j=>e.jsx(E,{value:j.value,children:j.label},j.value))]})]})]},a)})})]},s))]})]}),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:t("settingsThinking.showWarnings")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.showWarningsDesc")})]}),e.jsx(Q,{checked:i.show_warnings??!0,onCheckedChange:y,disabled:d})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:t("settingsThinking.cliEnvOverride")}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Override per session with flags or"," ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted",children:"CCS_THINKING"})," env var. Priority: flag > env > config."]}),e.jsxs("div",{className:"space-y-1 text-sm font-mono text-muted-foreground",children:[e.jsx("p",{children:"ccs gemini --thinking high"}),e.jsx("p",{children:"ccs codex --effort xhigh"}),e.jsx("p",{children:'CCS_THINKING=high ccs codex "debug this"'}),e.jsx("p",{children:"ccs config thinking --mode auto"})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(I,{variant:"outline",size:"sm",onClick:p,disabled:b||d,className:"w-full",children:[e.jsx($,{className:`w-4 h-4 mr-2 ${b?"animate-spin":""}`}),t("settings.refresh")]})})]})}export{ve 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-C2HpWmQl.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-BGgi27Hi.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{s as rt,A as at,R as K,aX as it,aY as ot,aZ as lt,X as ct,c as ut,a_ as dt,a$ as pt,U as mt,t as xt,k as ft,w as gt,aq as ht,T as J,az as yt}from"./icons-D2eEmpHv.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-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 +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-Cw9Urr0S.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 Q,ba as ee,bb as se,bc as te,Q as ae,R as re,U as ne,B as $,bd as S,be as M,bf as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-C2HpWmQl.js";import{_ as ce,a3 as oe,aP as me,T as E,R as T,F as he,aj as ue,w as xe}from"./icons-D2eEmpHv.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}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:_,refetch:q}=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:D,isError:O,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(_,`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:()=>{q()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:D?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):O?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
|
|
1
|
+
import{j as e}from"./radix-ui-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,`
|
|
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-Cw9Urr0S.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};
|
|
@@ -0,0 +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};
|
package/dist/ui/index.html
CHANGED
|
@@ -24,16 +24,16 @@
|
|
|
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-Cw9Urr0S.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">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/notifications-B2HqRBj7.js">
|
|
32
|
-
<link rel="modulepreload" crossorigin href="/assets/icons-
|
|
32
|
+
<link rel="modulepreload" crossorigin href="/assets/icons-DrEfTmfX.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/utils-CzKF5WmX.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/form-utils-Bcoyqxpq.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/code-highlight-BRUf_pqB.js">
|
|
36
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
36
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Btf_ow2V.css">
|
|
37
37
|
</head>
|
|
38
38
|
<body>
|
|
39
39
|
<div id="root"></div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global Fetch Proxy Setup
|
|
3
|
+
*
|
|
4
|
+
* Configures undici's global dispatcher to respect standard proxy environment
|
|
5
|
+
* variables without routing CCS loopback traffic back through the proxy.
|
|
6
|
+
*/
|
|
7
|
+
import { Dispatcher } from 'undici';
|
|
8
|
+
export declare function createGlobalFetchProxyDispatcher(): Dispatcher | null;
|
|
9
|
+
export declare function applyGlobalFetchProxy(): {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
error?: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=fetch-proxy-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-proxy-setup.d.ts","sourceRoot":"","sources":["../../src/utils/fetch-proxy-setup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,UAAU,EAAyD,MAAM,QAAQ,CAAC;AA2GlG,wBAAgB,gCAAgC,IAAI,UAAU,GAAG,IAAI,CAQpE;AAED,wBAAgB,qBAAqB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAmB5E"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Global Fetch Proxy Setup
|
|
4
|
+
*
|
|
5
|
+
* Configures undici's global dispatcher to respect standard proxy environment
|
|
6
|
+
* variables without routing CCS loopback traffic back through the proxy.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.applyGlobalFetchProxy = exports.createGlobalFetchProxyDispatcher = void 0;
|
|
10
|
+
const undici_1 = require("undici");
|
|
11
|
+
const proxy_env_1 = require("./proxy-env");
|
|
12
|
+
const FETCH_PROXY_PROTOCOLS = ['http:', 'https:'];
|
|
13
|
+
class RoutingProxyDispatcher extends undici_1.Dispatcher {
|
|
14
|
+
constructor(httpProxyUrl, httpsProxyUrl) {
|
|
15
|
+
super();
|
|
16
|
+
this.directDispatcher = new undici_1.Agent();
|
|
17
|
+
this.httpProxyDispatcher = httpProxyUrl ? new undici_1.ProxyAgent(httpProxyUrl) : null;
|
|
18
|
+
this.httpsProxyDispatcher = httpsProxyUrl ? new undici_1.ProxyAgent(httpsProxyUrl) : null;
|
|
19
|
+
}
|
|
20
|
+
dispatch(options, handler) {
|
|
21
|
+
return this.resolveDispatcher(options.origin).dispatch(options, handler);
|
|
22
|
+
}
|
|
23
|
+
close(callback) {
|
|
24
|
+
const promise = Promise.all(this.getDispatchers().map((dispatcher) => dispatcher.close())).then(() => undefined);
|
|
25
|
+
if (callback) {
|
|
26
|
+
promise.then(() => callback(), () => callback());
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
return promise;
|
|
30
|
+
}
|
|
31
|
+
destroy(errOrCallback, callback) {
|
|
32
|
+
const error = typeof errOrCallback === 'function' ? null : errOrCallback;
|
|
33
|
+
const done = typeof errOrCallback === 'function' ? errOrCallback : callback;
|
|
34
|
+
const promise = Promise.all(this.getDispatchers().map((dispatcher) => dispatcher.destroy(error ?? null))).then(() => undefined);
|
|
35
|
+
if (done) {
|
|
36
|
+
promise.then(() => done(), () => done());
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
return promise;
|
|
40
|
+
}
|
|
41
|
+
resolveDispatcher(origin) {
|
|
42
|
+
if (!origin) {
|
|
43
|
+
return this.directDispatcher;
|
|
44
|
+
}
|
|
45
|
+
let url;
|
|
46
|
+
try {
|
|
47
|
+
url = origin instanceof URL ? origin : new URL(origin);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return this.directDispatcher;
|
|
51
|
+
}
|
|
52
|
+
if ((0, proxy_env_1.shouldBypassProxy)(url.hostname)) {
|
|
53
|
+
return this.directDispatcher;
|
|
54
|
+
}
|
|
55
|
+
if (url.protocol === 'https:' && this.httpsProxyDispatcher) {
|
|
56
|
+
return this.httpsProxyDispatcher;
|
|
57
|
+
}
|
|
58
|
+
if (url.protocol === 'http:' && this.httpProxyDispatcher) {
|
|
59
|
+
return this.httpProxyDispatcher;
|
|
60
|
+
}
|
|
61
|
+
return this.directDispatcher;
|
|
62
|
+
}
|
|
63
|
+
getDispatchers() {
|
|
64
|
+
return Array.from(new Set([this.directDispatcher, this.httpProxyDispatcher, this.httpsProxyDispatcher].filter((dispatcher) => dispatcher !== null)));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function createGlobalFetchProxyDispatcher() {
|
|
68
|
+
const { httpProxyUrl, httpsProxyUrl } = resolveGlobalFetchProxyConfig();
|
|
69
|
+
if (!httpProxyUrl && !httpsProxyUrl) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return new RoutingProxyDispatcher(httpProxyUrl, httpsProxyUrl);
|
|
73
|
+
}
|
|
74
|
+
exports.createGlobalFetchProxyDispatcher = createGlobalFetchProxyDispatcher;
|
|
75
|
+
function applyGlobalFetchProxy() {
|
|
76
|
+
try {
|
|
77
|
+
const config = resolveGlobalFetchProxyConfig();
|
|
78
|
+
if (!config.httpProxyUrl && !config.httpsProxyUrl) {
|
|
79
|
+
return config.error ? { enabled: false, error: config.error } : { enabled: false };
|
|
80
|
+
}
|
|
81
|
+
const dispatcher = createGlobalFetchProxyDispatcher();
|
|
82
|
+
if (!dispatcher) {
|
|
83
|
+
return { enabled: false };
|
|
84
|
+
}
|
|
85
|
+
(0, undici_1.setGlobalDispatcher)(dispatcher);
|
|
86
|
+
globalThis.fetch = undici_1.fetch;
|
|
87
|
+
return { enabled: true };
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const message = error instanceof Error ? error.message : 'Unknown proxy configuration error';
|
|
91
|
+
return { enabled: false, error: message };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.applyGlobalFetchProxy = applyGlobalFetchProxy;
|
|
95
|
+
const setupResult = applyGlobalFetchProxy();
|
|
96
|
+
if (setupResult.error) {
|
|
97
|
+
console.error(`[!] Skipping global fetch proxy setup: ${setupResult.error}`);
|
|
98
|
+
}
|
|
99
|
+
function resolveGlobalFetchProxyConfig() {
|
|
100
|
+
const httpProxy = (0, proxy_env_1.getProxyResolution)(false, process.env, {
|
|
101
|
+
allowedProtocols: FETCH_PROXY_PROTOCOLS,
|
|
102
|
+
});
|
|
103
|
+
const httpsProxy = (0, proxy_env_1.getProxyResolution)(true, process.env, {
|
|
104
|
+
allowedProtocols: FETCH_PROXY_PROTOCOLS,
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
httpProxyUrl: httpProxy.url,
|
|
108
|
+
httpsProxyUrl: httpsProxy.url,
|
|
109
|
+
error: httpProxy.error ?? httpsProxy.error,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=fetch-proxy-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-proxy-setup.js","sourceRoot":"","sources":["../../src/utils/fetch-proxy-setup.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,mCAAkG;AAClG,2CAAoE;AAEpE,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAQlD,MAAM,sBAAuB,SAAQ,mBAAU;IAK7C,YAAY,YAAgC,EAAE,aAAiC;QAC7E,KAAK,EAAE,CAAC;QALO,qBAAgB,GAAG,IAAI,cAAK,EAAE,CAAC;QAM9C,IAAI,CAAC,mBAAmB,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,mBAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9E,IAAI,CAAC,oBAAoB,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,mBAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnF,CAAC;IAED,QAAQ,CAAC,OAAmC,EAAE,OAAoC;QAChF,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAID,KAAK,CAAC,QAAqB;QACzB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAC7F,GAAG,EAAE,CAAC,SAAS,CAChB,CAAC;QAEF,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CACV,GAAG,EAAE,CAAC,QAAQ,EAAE,EAChB,GAAG,EAAE,CAAC,QAAQ,EAAE,CACjB,CAAC;YACF,OAAO;QACT,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAMD,OAAO,CACL,aAA2C,EAC3C,QAAqB;QAErB,MAAM,KAAK,GAAG,OAAO,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC;QACzE,MAAM,IAAI,GAAG,OAAO,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC5E,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CACzB,IAAI,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAC7E,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAExB,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,CAAC,IAAI,CACV,GAAG,EAAE,CAAC,IAAI,EAAE,EACZ,GAAG,EAAE,CAAC,IAAI,EAAE,CACb,CAAC;YACF,OAAO;QACT,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,iBAAiB,CAAC,MAAgC;QACxD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,gBAAgB,CAAC;QAC/B,CAAC;QAED,IAAI,GAAQ,CAAC;QACb,IAAI,CAAC;YACH,GAAG,GAAG,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC,gBAAgB,CAAC;QAC/B,CAAC;QAED,IAAI,IAAA,6BAAiB,EAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,gBAAgB,CAAC;QAC/B,CAAC;QAED,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC3D,OAAO,IAAI,CAAC,oBAAoB,CAAC;QACnC,CAAC;QAED,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzD,OAAO,IAAI,CAAC,mBAAmB,CAAC;QAClC,CAAC;QAED,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAEO,cAAc;QACpB,OAAO,KAAK,CAAC,IAAI,CACf,IAAI,GAAG,CACL,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,CACjF,CAAC,UAAU,EAA4B,EAAE,CAAC,UAAU,KAAK,IAAI,CAC9D,CACF,CACF,CAAC;IACJ,CAAC;CACF;AAED,SAAgB,gCAAgC;IAC9C,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,6BAA6B,EAAE,CAAC;IAExE,IAAI,CAAC,YAAY,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAI,sBAAsB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AACjE,CAAC;AARD,4EAQC;AAED,SAAgB,qBAAqB;IACnC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,6BAA6B,EAAE,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YAClD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACrF,CAAC;QAED,MAAM,UAAU,GAAG,gCAAgC,EAAE,CAAC;QACtD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;QAED,IAAA,4BAAmB,EAAC,UAAU,CAAC,CAAC;QAChC,UAAU,CAAC,KAAK,GAAG,cAAsC,CAAC;QAC1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,mCAAmC,CAAC;QAC7F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC;AACH,CAAC;AAnBD,sDAmBC;AAED,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;AAC5C,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;IACtB,OAAO,CAAC,KAAK,CAAC,0CAA0C,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,6BAA6B;IACpC,MAAM,SAAS,GAAG,IAAA,8BAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE;QACvD,gBAAgB,EAAE,qBAAqB;KACxC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,IAAA,8BAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE;QACvD,gBAAgB,EAAE,qBAAqB;KACxC,CAAC,CAAC;IAEH,OAAO;QACL,YAAY,EAAE,SAAS,CAAC,GAAG;QAC3B,aAAa,EAAE,UAAU,CAAC,GAAG;QAC7B,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ProxyEnv = Record<string, string | undefined>;
|
|
2
|
+
type ProxyResolution = {
|
|
3
|
+
url?: string;
|
|
4
|
+
error?: string;
|
|
5
|
+
};
|
|
6
|
+
type ProxyResolutionOptions = {
|
|
7
|
+
allowedProtocols?: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function getProxyResolution(isHttps: boolean, env?: ProxyEnv, options?: ProxyResolutionOptions): ProxyResolution;
|
|
10
|
+
export declare function getProxyUrl(isHttps: boolean, env?: ProxyEnv): string | undefined;
|
|
11
|
+
export declare function isLoopbackHost(hostname: string): boolean;
|
|
12
|
+
export declare function getNoProxyValue(env?: ProxyEnv): string | undefined;
|
|
13
|
+
export declare function shouldBypassProxy(hostname: string, env?: ProxyEnv): boolean;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=proxy-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-env.d.ts","sourceRoot":"","sources":["../../src/utils/proxy-env.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AACnD,KAAK,eAAe,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACxD,KAAK,sBAAsB,GAAG;IAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAmD9D,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,GAAG,GAAE,QAAsB,EAC3B,OAAO,GAAE,sBAA2B,GACnC,eAAe,CAmBjB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,GAAE,QAAsB,GAAG,MAAM,GAAG,SAAS,CAG7F;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAoBxD;AAED,wBAAgB,eAAe,CAAC,GAAG,GAAE,QAAsB,GAAG,MAAM,GAAG,SAAS,CAE/E;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,QAAsB,GAAG,OAAO,CA2CxF"}
|