@kaitranntt/ccs 7.49.1 → 7.50.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 +48 -0
- package/dist/api/services/index.d.ts +2 -2
- package/dist/api/services/index.d.ts.map +1 -1
- package/dist/api/services/index.js +2 -1
- package/dist/api/services/index.js.map +1 -1
- package/dist/api/services/profile-reader.d.ts.map +1 -1
- package/dist/api/services/profile-reader.js +13 -0
- package/dist/api/services/profile-reader.js.map +1 -1
- package/dist/api/services/profile-types.d.ts +9 -0
- package/dist/api/services/profile-types.d.ts.map +1 -1
- package/dist/api/services/profile-writer.d.ts +8 -2
- package/dist/api/services/profile-writer.d.ts.map +1 -1
- package/dist/api/services/profile-writer.js +83 -8
- package/dist/api/services/profile-writer.js.map +1 -1
- package/dist/auth/account-context.d.ts +54 -0
- package/dist/auth/account-context.d.ts.map +1 -0
- package/dist/auth/account-context.js +124 -0
- package/dist/auth/account-context.js.map +1 -0
- package/dist/auth/auth-commands.d.ts.map +1 -1
- package/dist/auth/auth-commands.js +9 -0
- package/dist/auth/auth-commands.js.map +1 -1
- package/dist/auth/commands/create-command.d.ts.map +1 -1
- package/dist/auth/commands/create-command.js +28 -5
- package/dist/auth/commands/create-command.js.map +1 -1
- package/dist/auth/commands/list-command.d.ts.map +1 -1
- package/dist/auth/commands/list-command.js +8 -2
- package/dist/auth/commands/list-command.js.map +1 -1
- package/dist/auth/commands/show-command.d.ts.map +1 -1
- package/dist/auth/commands/show-command.js +5 -0
- package/dist/auth/commands/show-command.js.map +1 -1
- package/dist/auth/commands/types.d.ts +4 -0
- package/dist/auth/commands/types.d.ts.map +1 -1
- package/dist/auth/commands/types.js +27 -1
- package/dist/auth/commands/types.js.map +1 -1
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +9 -0
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/auth/profile-registry.d.ts +11 -5
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +48 -7
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/ccs.js +121 -3
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +67 -11
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/generator.d.ts.map +1 -1
- package/dist/cliproxy/config/generator.js +2 -0
- package/dist/cliproxy/config/generator.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +18 -0
- 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 +3 -2
- package/dist/cliproxy/model-config.js.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.d.ts +4 -35
- package/dist/cliproxy/services/variant-config-adapter.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.js +11 -34
- package/dist/cliproxy/services/variant-config-adapter.js.map +1 -1
- package/dist/cliproxy/services/variant-service.d.ts +5 -1
- package/dist/cliproxy/services/variant-service.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-service.js +19 -9
- package/dist/cliproxy/services/variant-service.js.map +1 -1
- package/dist/cliproxy/sync/profile-mapper.d.ts.map +1 -1
- package/dist/cliproxy/sync/profile-mapper.js +14 -2
- package/dist/cliproxy/sync/profile-mapper.js.map +1 -1
- package/dist/commands/api-command.d.ts +2 -0
- package/dist/commands/api-command.d.ts.map +1 -1
- package/dist/commands/api-command.js +45 -10
- package/dist/commands/api-command.js.map +1 -1
- package/dist/commands/cliproxy/auth-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/auth-subcommand.js +5 -2
- package/dist/commands/cliproxy/auth-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +1 -0
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.d.ts +15 -0
- package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.js +144 -15
- package/dist/commands/cliproxy/variant-subcommand.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/config/unified-config-types.d.ts +4 -0
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/management/instance-manager.d.ts +2 -1
- package/dist/management/instance-manager.d.ts.map +1 -1
- package/dist/management/instance-manager.js +4 -3
- package/dist/management/instance-manager.js.map +1 -1
- package/dist/management/shared-manager.d.ts +21 -0
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +136 -0
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/targets/droid-adapter.d.ts +2 -4
- package/dist/targets/droid-adapter.d.ts.map +1 -1
- package/dist/targets/droid-adapter.js +19 -10
- package/dist/targets/droid-adapter.js.map +1 -1
- package/dist/targets/droid-config-manager.d.ts +8 -1
- package/dist/targets/droid-config-manager.d.ts.map +1 -1
- package/dist/targets/droid-config-manager.js +28 -3
- package/dist/targets/droid-config-manager.js.map +1 -1
- package/dist/targets/droid-provider.d.ts +40 -0
- package/dist/targets/droid-provider.d.ts.map +1 -0
- package/dist/targets/droid-provider.js +140 -0
- package/dist/targets/droid-provider.js.map +1 -0
- package/dist/targets/index.d.ts +2 -0
- package/dist/targets/index.d.ts.map +1 -1
- package/dist/targets/index.js +4 -1
- package/dist/targets/index.js.map +1 -1
- package/dist/targets/target-resolver.d.ts.map +1 -1
- package/dist/targets/target-resolver.js +6 -3
- package/dist/targets/target-resolver.js.map +1 -1
- package/dist/types/config.d.ts +9 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js.map +1 -1
- package/dist/ui/assets/accounts-BKK-Lc16.js +1 -0
- package/dist/ui/assets/{alert-dialog-CFpc3HGP.js → alert-dialog-DmrIcJav.js} +1 -1
- package/dist/ui/assets/api-DzTwRtww.js +1 -0
- package/dist/ui/assets/{auth-section-856y9ZpH.js → auth-section-CP_2r8oJ.js} +1 -1
- package/dist/ui/assets/{backups-section-Bjxv4_pg.js → backups-section-jwtuA5Ay.js} +1 -1
- package/dist/ui/assets/checkbox-CNqHZx7Z.js +1 -0
- package/dist/ui/assets/cliproxy-CtO9BwgG.js +3 -0
- package/dist/ui/assets/cliproxy-control-panel--WUVyBIk.js +1 -0
- package/dist/ui/assets/{confirm-dialog-DxtbIbqy.js → confirm-dialog-CQNxkz9X.js} +1 -1
- package/dist/ui/assets/{copilot-DdeJ4TJs.js → copilot-DLxxmnsW.js} +2 -2
- package/dist/ui/assets/{cursor-CevrJcAp.js → cursor-YRIza7sP.js} +1 -1
- package/dist/ui/assets/{form-utils-C-pVd1--.js → form-utils-Cn_Uld6y.js} +1 -1
- package/dist/ui/assets/{globalenv-section-BqZQzUQ1.js → globalenv-section-vUSIK5rf.js} +1 -1
- package/dist/ui/assets/{health-D-7zneJI.js → health-BWPd6F4h.js} +1 -1
- package/dist/ui/assets/icons-Dk2sL3Mr.js +1 -0
- package/dist/ui/assets/index-B9dJZNls.js +1 -0
- package/dist/ui/assets/index-BZdHAol5.js +1 -0
- package/dist/ui/assets/{index-zwg9LfSN.js → index-BlldLmNl.js} +1 -1
- package/dist/ui/assets/{index-CcVqwkjG.js → index-D244tv89.js} +1 -1
- package/dist/ui/assets/index-DEDy1J8t.css +1 -0
- package/dist/ui/assets/index-PWMOllOf.js +47 -0
- package/dist/ui/assets/proxy-status-widget-MlyNgoPh.js +1 -0
- package/dist/ui/assets/{radix-ui-CwcVwplj.js → radix-ui-DIWAxjEp.js} +1 -1
- package/dist/ui/assets/separator-OcJLDgYQ.js +1 -0
- package/dist/ui/assets/{shared-VSWE7ipr.js → shared-LxAdbm4g.js} +1 -1
- package/dist/ui/assets/{switch-B1VCWktQ.js → switch-s8pp-m8L.js} +1 -1
- package/dist/ui/assets/{tanstack-matWclUm.js → tanstack-Hn82hibe.js} +1 -1
- package/dist/ui/assets/updates-BQRhDVbP.js +1 -0
- package/dist/ui/index.html +6 -6
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.d.ts.map +1 -1
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.js +2 -1
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.js.map +1 -1
- package/dist/utils/websearch/profile-hook-injector.d.ts.map +1 -1
- package/dist/utils/websearch/profile-hook-injector.js +2 -1
- package/dist/utils/websearch/profile-hook-injector.js.map +1 -1
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +4 -0
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/profile-routes.d.ts +2 -0
- package/dist/web-server/routes/profile-routes.d.ts.map +1 -1
- package/dist/web-server/routes/profile-routes.js +86 -6
- package/dist/web-server/routes/profile-routes.js.map +1 -1
- package/dist/web-server/routes/route-helpers.d.ts +2 -1
- package/dist/web-server/routes/route-helpers.d.ts.map +1 -1
- package/dist/web-server/routes/route-helpers.js +20 -1
- package/dist/web-server/routes/route-helpers.js.map +1 -1
- package/dist/web-server/routes/variant-routes.d.ts +2 -0
- package/dist/web-server/routes/variant-routes.d.ts.map +1 -1
- package/dist/web-server/routes/variant-routes.js +50 -6
- package/dist/web-server/routes/variant-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/accounts-BKNcAuvp.js +0 -1
- package/dist/ui/assets/api-CcrDOIR7.js +0 -1
- package/dist/ui/assets/cliproxy-CgqwQWL0.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-fVNMCVo2.js +0 -1
- package/dist/ui/assets/icons-DGASzt3M.js +0 -1
- package/dist/ui/assets/index-5pyU75fR.js +0 -1
- package/dist/ui/assets/index-Bqt9Obz8.css +0 -1
- package/dist/ui/assets/index-DiWdJxAN.js +0 -47
- package/dist/ui/assets/index-euQBQnD4.js +0 -1
- package/dist/ui/assets/proxy-status-widget-nDPpIwJt.js +0 -1
- package/dist/ui/assets/separator-CrJ4MtV5.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-CwcVwplj.js";import{r as p}from"./react-vendor-CNOkPC89.js";import{t as o}from"./notifications-B2HqRBj7.js";import{aU as v,aV as Ze,B as D,b as f,c as ie,m as E,H as $e,J as Ye,K as W,M as ee,L as P,I as se,aX as We,a4 as es,a5 as ss,a6 as ts,a7 as as,a8 as ns,am as rs,X as is,Y as os,Z as ls,_ as cs,ak as ds,al as us,$ as be,aW as ms}from"./index-DiWdJxAN.js";import{a as hs,u as q,b as _}from"./tanstack-matWclUm.js";import{D as Ae}from"./default-ports-1QQSffYX.js";import{S as Ce}from"./switch-B1VCWktQ.js";import{S as xs}from"./separator-CrJ4MtV5.js";import{R as Se,T as fs,ax as ps,K as G,a4 as gs,aw as ke,av as js,L as M,s as ws,ah as vs,a0 as ys,Z as te,ak as Ns,q as bs,r as Cs}from"./icons-DGASzt3M.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";async function Ss(){const s=await fetch(v("/cursor/status"));if(!s.ok)throw new Error("Failed to fetch cursor status");return s.json()}async function ks(){const s=await fetch(v("/cursor/settings"));if(!s.ok)throw new Error("Failed to fetch cursor config");return s.json()}async function As(){const s=await fetch(v("/cursor/models"));if(!s.ok)throw new Error("Failed to fetch cursor models");return s.json()}async function Ds(){const s=await fetch(v("/cursor/settings/raw"));if(!s.ok)throw new Error("Failed to fetch cursor raw settings");return s.json()}async function _s(s){const a=await fetch(v("/cursor/settings"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok)throw new Error("Failed to update cursor config");return a.json()}async function Ms(s){const a=await fetch(v("/cursor/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(a.status===409)throw new Ze("Cursor raw settings changed externally");if(!a.ok)throw new Error("Failed to save cursor raw settings");return a.json()}async function Ps(){const s=await fetch(v("/cursor/auth/auto-detect"),{method:"POST"});if(!s.ok){const a=await s.json().catch(()=>({error:"Auto-detect failed"}));throw new Error(a.error||"Auto-detect failed")}return s.json()}async function Ts(s){const a=await fetch(v("/cursor/auth/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok){const d=await a.json().catch(()=>({error:"Manual import failed"}));throw new Error(d.error||"Manual import failed")}return a.json()}async function Fs(){const s=await fetch(v("/cursor/daemon/start"),{method:"POST"});if(!s.ok)throw new Error("Failed to start cursor daemon");return s.json()}async function Rs(){const s=await fetch(v("/cursor/daemon/stop"),{method:"POST"});if(!s.ok)throw new Error("Failed to stop cursor daemon");return s.json()}function Os(){const s=hs(),a=q({queryKey:["cursor-status"],queryFn:Ss,refetchInterval:5e3}),d=q({queryKey:["cursor-config"],queryFn:ks}),u=q({queryKey:["cursor-models"],queryFn:As}),m=q({queryKey:["cursor-raw-settings"],queryFn:Ds}),l=()=>{s.invalidateQueries({queryKey:["cursor-status"]}),s.invalidateQueries({queryKey:["cursor-config"]}),s.invalidateQueries({queryKey:["cursor-models"]}),s.invalidateQueries({queryKey:["cursor-raw-settings"]})},n=_({mutationFn:_s,onSuccess:l}),c=_({mutationFn:Ms,onSuccess:l}),h=_({mutationFn:Ps,onSuccess:l}),i=_({mutationFn:Ts,onSuccess:l}),y=_({mutationFn:Fs,onSuccess:l}),C=_({mutationFn:Rs,onSuccess:l});return p.useMemo(()=>({status:a.data,statusLoading:a.isLoading,statusError:a.error,refetchStatus:a.refetch,config:d.data,configLoading:d.isLoading,models:u.data?.models??[],currentModel:u.data?.current??null,modelsLoading:u.isLoading,rawSettings:m.data,rawSettingsLoading:m.isLoading,refetchRawSettings:m.refetch,updateConfig:n.mutate,updateConfigAsync:n.mutateAsync,isUpdatingConfig:n.isPending,saveRawSettings:c.mutate,saveRawSettingsAsync:c.mutateAsync,isSavingRawSettings:c.isPending,autoDetectAuth:h.mutate,autoDetectAuthAsync:h.mutateAsync,isAutoDetectingAuth:h.isPending,autoDetectAuthResult:h.data,importManualAuth:i.mutate,importManualAuthAsync:i.mutateAsync,isImportingManualAuth:i.isPending,manualAuthResult:i.data,startDaemon:y.mutate,startDaemonAsync:y.mutateAsync,isStartingDaemon:y.isPending,stopDaemon:C.mutate,stopDaemonAsync:C.mutateAsync,isStoppingDaemon:C.isPending}),[a.data,a.isLoading,a.error,a.refetch,d.data,d.isLoading,u.data,u.isLoading,m.data,m.isLoading,m.refetch,n.mutate,n.mutateAsync,n.isPending,c.mutate,c.mutateAsync,c.isPending,h.mutate,h.mutateAsync,h.isPending,h.data,i.mutate,i.mutateAsync,i.isPending,i.data,y.mutate,y.mutateAsync,y.isPending,C.mutate,C.mutateAsync,C.isPending])}function ae(s){return{port:String(s?.port??Ae),auto_start:s?.auto_start??!1,ghost_mode:s?.ghost_mode??!0,model:s?.model?.trim()||"gpt-5.3-codex",opus_model:s?.opus_model?.trim()||"",sonnet_model:s?.sonnet_model?.trim()||"",haiku_model:s?.haiku_model?.trim()||""}}function N(s,a,d){return s.find(m=>a.some(l=>l.test(m.id)))?.id??d}function ne(s){return s.toLowerCase().replace(/[^a-z0-9]/g,"")}function b(s,a,d){const u=new Set(a.map(ne)),m=s.find(n=>u.has(ne(n.id)));if(m)return m.id;const l=s.find(n=>u.has(ne(n.name)));return l?l.id:d}function Is(s){try{const a=JSON.parse(s||"{}");return!a||typeof a!="object"||Array.isArray(a)?{isValid:!1,error:"Raw settings must be a JSON object"}:{isValid:!0,settings:a}}catch(a){return{isValid:!1,error:a.message||"Invalid JSON"}}}function U({label:s,description:a,value:d,models:u,disabled:m,allowDefaultFallback:l=!1,onChange:n}){const c=d||(l?"__default":""),h=u.find(i=>i.id===d);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-xs font-medium",children:s}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]}),e.jsxs(is,{value:c,onValueChange:i=>{if(l&&i==="__default"){n("");return}n(i)},disabled:m,children:[e.jsx(os,{className:"h-9",children:e.jsx(ls,{placeholder:"Select model",children:c&&e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:l&&c==="__default"?"Use Default Model":h?.name||c}),h?.provider&&e.jsx(D,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:h.provider})]})})}),e.jsx(cs,{className:"max-h-[300px]",children:e.jsxs(ds,{children:[e.jsxs(us,{className:"text-xs text-muted-foreground",children:["Available Models (",u.length,")"]}),l&&e.jsx(be,{value:"__default",children:"Use Default Model"}),u.map(i=>e.jsx(be,{value:i.id,children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"truncate text-xs font-mono",children:i.name||i.id}),e.jsx(D,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:i.provider})]})},i.id))]})})]})]})}function re({icon:s,label:a,ok:d,detail:u}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-lg bg-muted/50 px-3 py-2",children:[e.jsx(s,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-sm",children:a})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[d?e.jsx(bs,{className:"h-4 w-4 text-green-500"}):e.jsx(Cs,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:ie("text-xs",d?"text-green-500":"text-muted-foreground"),title:u,children:u})]})]})}function Xs(){const{status:s,statusLoading:a,refetchStatus:d,config:u,updateConfigAsync:m,isUpdatingConfig:l,models:n,modelsLoading:c,currentModel:h,rawSettings:i,rawSettingsLoading:y,refetchRawSettings:C,saveRawSettingsAsync:De,isSavingRawSettings:oe,autoDetectAuthAsync:_e,isAutoDetectingAuth:le,importManualAuthAsync:Me,isImportingManualAuth:ce,startDaemonAsync:Pe,isStartingDaemon:Te,stopDaemonAsync:Fe,isStoppingDaemon:de}=Os(),[A,ue]=p.useState(()=>ae()),[g,me]=p.useState(!1),[he,Re]=p.useState("{}"),[T,z]=p.useState(!1),[Oe,O]=p.useState(!1),[B,xe]=p.useState(""),[J,fe]=p.useState(""),S=ae(u),pe=g?A.port:S.port,K=g?A.auto_start:S.auto_start,H=g?A.ghost_mode:S.ghost_mode,j=g?A.model:S.model,Q=g?A.opus_model:S.opus_model,V=g?A.sonnet_model:S.sonnet_model,X=g?A.haiku_model:S.haiku_model,Z=T?he:JSON.stringify(i?.settings??{},null,2),ge=!!i,F=p.useMemo(()=>Is(Z),[Z]),je=F.isValid,we=g||T,Ie=!T||ge&&je,I=p.useMemo(()=>{const t=new Set,r=[...n].sort((k,Y)=>k.name.localeCompare(Y.name)),x=r.filter(k=>t.has(k.id)?!1:(t.add(k.id),!0));return j&&!r.some(k=>k.id===j)?[{id:j,name:j,provider:"custom"},...x]:x},[n,j]),w=t=>{ue(r=>t(g?r:S)),me(!0)},Le=!!(s?.enabled&&s?.authenticated&&!s?.token_expired),Ee=p.useMemo(()=>s?.enabled?e.jsx(D,{children:"Enabled"}):e.jsx(D,{variant:"secondary",children:"Disabled"}),[s?.enabled]),qe=async({suppressSuccessToast:t=!1}={})=>{const r=Number(pe);if(!Number.isInteger(r)||r<1||r>65535)return o.error("Port must be an integer between 1 and 65535"),!1;if(!j.trim())return o.error("Default model is required"),!1;try{return await m({port:r,auto_start:K,ghost_mode:H,model:j,opus_model:Q||void 0,sonnet_model:V||void 0,haiku_model:X||void 0}),me(!1),ue(ae({port:r,auto_start:K,ghost_mode:H,model:j,opus_model:Q||void 0,sonnet_model:V||void 0,haiku_model:X||void 0})),t||o.success("Cursor config and model mapping saved"),!0}catch(x){return o.error(x.message||"Failed to save config"),!1}},$=t=>{if(c){o.error("Models are still loading. Please wait before applying a preset.");return}if(n.length===0){o.error("No models available yet. Start the daemon and refresh first.");return}const r=j||h||n[0]?.id||"gpt-5.3-codex",x=b(n,["gpt-5.3-codex","gpt53codex","GPT-5.3 Codex"],N(n,[/gpt[-.]?5.*codex/i],r)),k=b(n,["gpt-5.1-codex-max","gpt51codexmax","GPT-5.1 Codex Max"],N(n,[/gpt[-.]?5.*codex.*max/i],x)),Y=b(n,["gpt-5-fast","gpt5fast","GPT-5 Fast"],N(n,[/gpt[-.]?5.*fast/i],x)),Qe=b(n,["gpt-5-mini","gpt5mini","GPT-5 Mini"],N(n,[/gpt[-.]?5.*mini/i],Y)),ye=b(n,["claude-4.6-opus","claude46opus","Claude 4.6 Opus"],N(n,[/claude[-.]?4\.?6.*opus/i,/claude.*opus/i],x)),Ne=b(n,["claude-4.5-sonnet","claude45sonnet","Claude 4.5 Sonnet"],N(n,[/claude[-.]?4\.?5.*sonnet/i,/claude.*sonnet/i],x)),Ve=b(n,["claude-4.5-haiku","claude45haiku","Claude 4.5 Haiku"],N(n,[/claude[-.]?4\.?5.*haiku/i,/haiku/i],Ne)),L=b(n,["gemini-3-pro","gemini3pro","Gemini 3 Pro"],N(n,[/gemini[-.]?3.*pro/i],x)),Xe=b(n,["gemini-3-flash","gemini3flash","Gemini 3 Flash"],N(n,[/gemini[-.]?3.*flash/i,/gemini[-.]?2\.?5.*flash/i],L));if(t==="codex53"){w(R=>({...R,model:x,opus_model:k,sonnet_model:x,haiku_model:Qe})),o.success("Applied GPT-5.3 Codex preset");return}if(t==="claude46"){w(R=>({...R,model:ye,opus_model:ye,sonnet_model:Ne,haiku_model:Ve})),o.success("Applied Claude 4.6 preset");return}w(R=>({...R,model:L,opus_model:L,sonnet_model:L,haiku_model:Xe})),o.success("Applied Gemini 3 preset")},ve=async t=>{try{await m({enabled:t}),o.success(t?"Cursor integration enabled":"Cursor integration disabled")}catch(r){o.error(r.message||"Failed to update integration state")}},Ge=async()=>{try{await _e(),o.success("Cursor credentials imported")}catch(t){o.error(t.message||"Auto-detect failed")}},Ue=async()=>{if(!B.trim()||!J.trim()){o.error("Token and machine ID are required");return}try{await Me({accessToken:B.trim(),machineId:J.trim()}),o.success("Cursor credentials imported"),O(!1),xe(""),fe("")}catch(t){o.error(t.message||"Manual import failed")}},ze=async()=>{try{const t=await Pe();if(!t.success){o.error(t.error||"Failed to start daemon");return}o.success(`Daemon started${t.pid?` (PID: ${t.pid})`:""}`)}catch(t){o.error(t.message||"Failed to start daemon")}},Be=async()=>{try{const t=await Fe();if(!t.success){o.error(t.error||"Failed to stop daemon");return}o.success("Daemon stopped")}catch(t){o.error(t.message||"Failed to stop daemon")}},Je=async({suppressSuccessToast:t=!1}={})=>{if(!ge)return o.error("Raw settings are still loading. Please wait and try again."),!1;if(!F.isValid||!F.settings)return o.error(F.error||"Invalid JSON"),!1;try{return await De({settings:F.settings,expectedMtime:i?.mtime}),z(!1),t||o.success("Raw settings saved"),!0}catch(r){return ms(r)?o.error("Raw settings changed externally. Refresh and retry."):o.error(r.message||"Failed to save raw settings"),!1}},Ke=async()=>{if(!we)return;const t=g,r=T;t&&!await qe({suppressSuccessToast:r})||r&&!await Je({suppressSuccessToast:t})||t&&r&&o.success("Cursor configuration saved")},He=()=>{z(!1),d(),C()};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:"/assets/sidebar/cursor.svg",alt:"",className:"w-5 h-5 object-contain shrink-0"}),e.jsx("h1",{className:"font-semibold",children:"Cursor"}),e.jsx(D,{variant:"outline",className:"h-5 border-amber-500/60 bg-amber-500/10 px-1.5 text-[10px] font-semibold uppercase tracking-wide text-amber-800 dark:text-amber-300",children:"Beta"}),Ee]}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>d(),disabled:a,children:e.jsx(Se,{className:ie("w-4 h-4",a&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Dedicated Cursor integration controls"})]}),e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:"Unofficial API - Use at Your Own Risk"})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:"Reverse-engineered integration may break anytime"}),e.jsx("li",{children:"Abuse or excessive usage may risk account restrictions"}),e.jsx("li",{children:"No warranty, no responsibility from CCS"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(re,{icon:ps,label:"Integration",ok:!!s?.enabled,detail:s?.enabled?"Enabled":"Disabled"}),e.jsx(re,{icon:G,label:"Authentication",ok:!!(s?.authenticated&&!s?.token_expired),detail:s?.authenticated?s?.token_expired?"Expired":s.auth_method??"Connected":"Not connected"}),e.jsx(re,{icon:gs,label:"Daemon",ok:!!s?.daemon_running,detail:s?.daemon_running?"Running":"Stopped"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Actions"}),s?.enabled?e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:()=>ve(!1),disabled:l,children:[e.jsx(ke,{className:"w-3.5 h-3.5 mr-1.5"}),"Disable Integration"]}):e.jsxs(f,{size:"sm",className:"w-full",onClick:()=>ve(!0),disabled:l,children:[e.jsx(js,{className:"w-3.5 h-3.5 mr-1.5"}),"Enable Integration"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:Ge,disabled:le,children:[le?e.jsx(M,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(G,{className:"w-3.5 h-3.5 mr-1.5"}),"Auto-detect Auth"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:()=>O(!0),children:[e.jsx(G,{className:"w-3.5 h-3.5 mr-1.5"}),"Manual Auth Import"]}),s?.daemon_running?e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:Be,disabled:de,children:[de?e.jsx(M,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(ke,{className:"w-3.5 h-3.5 mr-1.5"}),"Stop Daemon"]}):e.jsxs(f,{size:"sm",className:"w-full",onClick:ze,disabled:!Le,children:[Te?e.jsx(M,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(ws,{className:"w-3.5 h-3.5 mr-1.5"}),"Start Daemon"]})]})]})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Port"}),e.jsx("span",{children:s?.port??u?.port??Ae})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Cursor Configuration"}),i&&e.jsx(D,{variant:"outline",className:"text-xs",children:"cursor.settings.json"})]}),i&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",i.exists?new Date(i.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:He,disabled:a||y,children:e.jsx(Se,{className:ie("w-4 h-4",(a||y)&&"animate-spin")})}),e.jsx(f,{size:"sm",onClick:Ke,disabled:l||oe||!we||!Ie,children:l||oe?e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(vs,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col min-h-0 overflow-hidden bg-muted/5",children:e.jsxs($e,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Ye,{className:"w-full",children:[e.jsx(W,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(W,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(W,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[e.jsx(ee,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(ys,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>$("codex53"),disabled:c||n.length===0,title:"OpenAI-only mapping: GPT-5.3 Codex / Codex Max / GPT-5 Mini",children:[e.jsx(te,{className:"w-3 h-3"}),"GPT-5.3 Codex"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>$("claude46"),disabled:c||n.length===0,title:"Claude-first mapping: Opus 4.6 / Sonnet 4.5 / Haiku 4.5",children:[e.jsx(te,{className:"w-3 h-3"}),"Claude 4.6"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>$("gemini3"),disabled:c||n.length===0,title:"Gemini-first mapping: Gemini 3 Pro + Gemini 3 Flash",children:[e.jsx(te,{className:"w-3 h-3"}),"Gemini 3 Pro"]})]})]}),e.jsx(xs,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(U,{label:"Default Model",description:"Used when no specific tier is requested.",value:j,models:I,disabled:c,onChange:t=>{w(r=>({...r,model:t}))}}),e.jsx(U,{label:"Opus (Most capable)",description:"Complex reasoning and highest quality responses.",value:Q,models:I,disabled:c,allowDefaultFallback:!0,onChange:t=>{w(r=>({...r,opus_model:t}))}}),e.jsx(U,{label:"Sonnet (Balanced)",description:"General coding and day-to-day chat workloads.",value:V,models:I,disabled:c,allowDefaultFallback:!0,onChange:t=>{w(r=>({...r,sonnet_model:t}))}}),e.jsx(U,{label:"Haiku (Fast)",description:"Low-latency and lightweight request paths.",value:X,models:I,disabled:c,allowDefaultFallback:!0,onChange:t=>{w(r=>({...r,haiku_model:t}))}})]})]})]})})}),e.jsx(ee,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Runtime Settings"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"cursor-port",className:"text-xs",children:"Port"}),e.jsx(se,{id:"cursor-port",type:"number",min:1,max:65535,className:"max-w-[150px] h-8",value:pe,onChange:t=>{w(r=>({...r,port:t.target.value}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(P,{htmlFor:"cursor-auto-start",className:"text-xs",children:"Auto-start Daemon"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Start Cursor daemon automatically when integration is used."})]}),e.jsx(Ce,{id:"cursor-auto-start",checked:K,onCheckedChange:t=>{w(r=>({...r,auto_start:t}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(P,{htmlFor:"cursor-ghost-mode",className:"text-xs",children:"Ghost Mode"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Request `x-ghost-mode` to reduce telemetry."})]}),e.jsx(Ce,{id:"cursor-ghost-mode",checked:H,onCheckedChange:t=>{w(r=>({...r,ghost_mode:t}))}})]})]})})})}),e.jsx(ee,{value:"info",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:"Cursor IDE"})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:i?.path??"~/.ccs/cursor.settings.json"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Model mapping writes `ANTHROPIC_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL` in `cursor.settings.json`."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Available Models"}),c?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(M,{className:"w-4 h-4 animate-spin"}),"Loading models..."]}):n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No model metadata available yet. Start daemon and refresh."}):e.jsx("div",{className:"space-y-2",children:n.map(t=>e.jsxs("div",{className:"rounded-lg border px-3 py-2 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:t.id}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.name," • ",t.provider]})]}),t.id===h&&e.jsx(D,{children:"Default"})]},t.id))})]})]})})})]})]})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Ns,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(We,{rawJsonContent:Z,isRawJsonValid:je,rawJsonEdits:T?he:null,rawSettingsEnv:i?.settings?.env,onChange:t=>{z(!0),Re(t)}})]})]})]})})]}),e.jsx(es,{open:Oe,onOpenChange:O,children:e.jsxs(ss,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"Manual Cursor Auth Import"}),e.jsx(ns,{children:"Provide Cursor access token and machine ID if auto-detect is unavailable."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"cursor-manual-token",children:"Access Token"}),e.jsx(se,{id:"cursor-manual-token",value:B,onChange:t=>xe(t.target.value),placeholder:"Paste Cursor access token"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"cursor-manual-machine-id",children:"Machine ID"}),e.jsx(se,{id:"cursor-manual-machine-id",value:J,onChange:t=>fe(t.target.value),placeholder:"32-char hex (UUID without hyphens)"})]})]}),e.jsxs(rs,{children:[e.jsx(f,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),e.jsxs(f,{onClick:Ue,disabled:ce,children:[ce?e.jsx(M,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(G,{className:"w-4 h-4 mr-2"}),"Import"]})]})]})})]})}export{Xs as CursorPage};
|
|
1
|
+
import{j as e}from"./radix-ui-DIWAxjEp.js";import{r as p}from"./react-vendor-CNOkPC89.js";import{t as o}from"./notifications-B2HqRBj7.js";import{aU as v,aV as Ze,B as D,b as f,c as ie,m as E,O as $e,Q as We,R as Y,U as ee,L as P,I as se,aX as Ye,a5 as es,a6 as ss,a7 as ts,a8 as as,a9 as ns,am as rs,q as is,r as os,s as ls,t as cs,ak as ds,al as us,v as be,aW as ms}from"./index-PWMOllOf.js";import{a as hs,u as q,b as _}from"./tanstack-Hn82hibe.js";import{D as Ae}from"./default-ports-1QQSffYX.js";import{S as Ce}from"./switch-s8pp-m8L.js";import{S as xs}from"./separator-OcJLDgYQ.js";import{R as Se,T as fs,ax as ps,K as U,a4 as gs,aw as ke,av as js,L as M,s as ws,ah as vs,a0 as ys,Z as te,ak as Ns,q as bs,r as Cs}from"./icons-Dk2sL3Mr.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";async function Ss(){const s=await fetch(v("/cursor/status"));if(!s.ok)throw new Error("Failed to fetch cursor status");return s.json()}async function ks(){const s=await fetch(v("/cursor/settings"));if(!s.ok)throw new Error("Failed to fetch cursor config");return s.json()}async function As(){const s=await fetch(v("/cursor/models"));if(!s.ok)throw new Error("Failed to fetch cursor models");return s.json()}async function Ds(){const s=await fetch(v("/cursor/settings/raw"));if(!s.ok)throw new Error("Failed to fetch cursor raw settings");return s.json()}async function _s(s){const a=await fetch(v("/cursor/settings"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok)throw new Error("Failed to update cursor config");return a.json()}async function Ms(s){const a=await fetch(v("/cursor/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(a.status===409)throw new Ze("Cursor raw settings changed externally");if(!a.ok)throw new Error("Failed to save cursor raw settings");return a.json()}async function Ps(){const s=await fetch(v("/cursor/auth/auto-detect"),{method:"POST"});if(!s.ok){const a=await s.json().catch(()=>({error:"Auto-detect failed"}));throw new Error(a.error||"Auto-detect failed")}return s.json()}async function Ts(s){const a=await fetch(v("/cursor/auth/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok){const d=await a.json().catch(()=>({error:"Manual import failed"}));throw new Error(d.error||"Manual import failed")}return a.json()}async function Fs(){const s=await fetch(v("/cursor/daemon/start"),{method:"POST"});if(!s.ok)throw new Error("Failed to start cursor daemon");return s.json()}async function Rs(){const s=await fetch(v("/cursor/daemon/stop"),{method:"POST"});if(!s.ok)throw new Error("Failed to stop cursor daemon");return s.json()}function Os(){const s=hs(),a=q({queryKey:["cursor-status"],queryFn:Ss,refetchInterval:5e3}),d=q({queryKey:["cursor-config"],queryFn:ks}),u=q({queryKey:["cursor-models"],queryFn:As}),m=q({queryKey:["cursor-raw-settings"],queryFn:Ds}),l=()=>{s.invalidateQueries({queryKey:["cursor-status"]}),s.invalidateQueries({queryKey:["cursor-config"]}),s.invalidateQueries({queryKey:["cursor-models"]}),s.invalidateQueries({queryKey:["cursor-raw-settings"]})},n=_({mutationFn:_s,onSuccess:l}),c=_({mutationFn:Ms,onSuccess:l}),h=_({mutationFn:Ps,onSuccess:l}),i=_({mutationFn:Ts,onSuccess:l}),y=_({mutationFn:Fs,onSuccess:l}),C=_({mutationFn:Rs,onSuccess:l});return p.useMemo(()=>({status:a.data,statusLoading:a.isLoading,statusError:a.error,refetchStatus:a.refetch,config:d.data,configLoading:d.isLoading,models:u.data?.models??[],currentModel:u.data?.current??null,modelsLoading:u.isLoading,rawSettings:m.data,rawSettingsLoading:m.isLoading,refetchRawSettings:m.refetch,updateConfig:n.mutate,updateConfigAsync:n.mutateAsync,isUpdatingConfig:n.isPending,saveRawSettings:c.mutate,saveRawSettingsAsync:c.mutateAsync,isSavingRawSettings:c.isPending,autoDetectAuth:h.mutate,autoDetectAuthAsync:h.mutateAsync,isAutoDetectingAuth:h.isPending,autoDetectAuthResult:h.data,importManualAuth:i.mutate,importManualAuthAsync:i.mutateAsync,isImportingManualAuth:i.isPending,manualAuthResult:i.data,startDaemon:y.mutate,startDaemonAsync:y.mutateAsync,isStartingDaemon:y.isPending,stopDaemon:C.mutate,stopDaemonAsync:C.mutateAsync,isStoppingDaemon:C.isPending}),[a.data,a.isLoading,a.error,a.refetch,d.data,d.isLoading,u.data,u.isLoading,m.data,m.isLoading,m.refetch,n.mutate,n.mutateAsync,n.isPending,c.mutate,c.mutateAsync,c.isPending,h.mutate,h.mutateAsync,h.isPending,h.data,i.mutate,i.mutateAsync,i.isPending,i.data,y.mutate,y.mutateAsync,y.isPending,C.mutate,C.mutateAsync,C.isPending])}function ae(s){return{port:String(s?.port??Ae),auto_start:s?.auto_start??!1,ghost_mode:s?.ghost_mode??!0,model:s?.model?.trim()||"gpt-5.3-codex",opus_model:s?.opus_model?.trim()||"",sonnet_model:s?.sonnet_model?.trim()||"",haiku_model:s?.haiku_model?.trim()||""}}function N(s,a,d){return s.find(m=>a.some(l=>l.test(m.id)))?.id??d}function ne(s){return s.toLowerCase().replace(/[^a-z0-9]/g,"")}function b(s,a,d){const u=new Set(a.map(ne)),m=s.find(n=>u.has(ne(n.id)));if(m)return m.id;const l=s.find(n=>u.has(ne(n.name)));return l?l.id:d}function Is(s){try{const a=JSON.parse(s||"{}");return!a||typeof a!="object"||Array.isArray(a)?{isValid:!1,error:"Raw settings must be a JSON object"}:{isValid:!0,settings:a}}catch(a){return{isValid:!1,error:a.message||"Invalid JSON"}}}function G({label:s,description:a,value:d,models:u,disabled:m,allowDefaultFallback:l=!1,onChange:n}){const c=d||(l?"__default":""),h=u.find(i=>i.id===d);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-xs font-medium",children:s}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]}),e.jsxs(is,{value:c,onValueChange:i=>{if(l&&i==="__default"){n("");return}n(i)},disabled:m,children:[e.jsx(os,{className:"h-9",children:e.jsx(ls,{placeholder:"Select model",children:c&&e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:l&&c==="__default"?"Use Default Model":h?.name||c}),h?.provider&&e.jsx(D,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:h.provider})]})})}),e.jsx(cs,{className:"max-h-[300px]",children:e.jsxs(ds,{children:[e.jsxs(us,{className:"text-xs text-muted-foreground",children:["Available Models (",u.length,")"]}),l&&e.jsx(be,{value:"__default",children:"Use Default Model"}),u.map(i=>e.jsx(be,{value:i.id,children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"truncate text-xs font-mono",children:i.name||i.id}),e.jsx(D,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:i.provider})]})},i.id))]})})]})]})}function re({icon:s,label:a,ok:d,detail:u}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-lg bg-muted/50 px-3 py-2",children:[e.jsx(s,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-sm",children:a})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[d?e.jsx(bs,{className:"h-4 w-4 text-green-500"}):e.jsx(Cs,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:ie("text-xs",d?"text-green-500":"text-muted-foreground"),title:u,children:u})]})]})}function Xs(){const{status:s,statusLoading:a,refetchStatus:d,config:u,updateConfigAsync:m,isUpdatingConfig:l,models:n,modelsLoading:c,currentModel:h,rawSettings:i,rawSettingsLoading:y,refetchRawSettings:C,saveRawSettingsAsync:De,isSavingRawSettings:oe,autoDetectAuthAsync:_e,isAutoDetectingAuth:le,importManualAuthAsync:Me,isImportingManualAuth:ce,startDaemonAsync:Pe,isStartingDaemon:Te,stopDaemonAsync:Fe,isStoppingDaemon:de}=Os(),[A,ue]=p.useState(()=>ae()),[g,me]=p.useState(!1),[he,Re]=p.useState("{}"),[T,z]=p.useState(!1),[Oe,O]=p.useState(!1),[B,xe]=p.useState(""),[J,fe]=p.useState(""),S=ae(u),pe=g?A.port:S.port,K=g?A.auto_start:S.auto_start,Q=g?A.ghost_mode:S.ghost_mode,j=g?A.model:S.model,H=g?A.opus_model:S.opus_model,V=g?A.sonnet_model:S.sonnet_model,X=g?A.haiku_model:S.haiku_model,Z=T?he:JSON.stringify(i?.settings??{},null,2),ge=!!i,F=p.useMemo(()=>Is(Z),[Z]),je=F.isValid,we=g||T,Ie=!T||ge&&je,I=p.useMemo(()=>{const t=new Set,r=[...n].sort((k,W)=>k.name.localeCompare(W.name)),x=r.filter(k=>t.has(k.id)?!1:(t.add(k.id),!0));return j&&!r.some(k=>k.id===j)?[{id:j,name:j,provider:"custom"},...x]:x},[n,j]),w=t=>{ue(r=>t(g?r:S)),me(!0)},Le=!!(s?.enabled&&s?.authenticated&&!s?.token_expired),Ee=p.useMemo(()=>s?.enabled?e.jsx(D,{children:"Enabled"}):e.jsx(D,{variant:"secondary",children:"Disabled"}),[s?.enabled]),qe=async({suppressSuccessToast:t=!1}={})=>{const r=Number(pe);if(!Number.isInteger(r)||r<1||r>65535)return o.error("Port must be an integer between 1 and 65535"),!1;if(!j.trim())return o.error("Default model is required"),!1;try{return await m({port:r,auto_start:K,ghost_mode:Q,model:j,opus_model:H||void 0,sonnet_model:V||void 0,haiku_model:X||void 0}),me(!1),ue(ae({port:r,auto_start:K,ghost_mode:Q,model:j,opus_model:H||void 0,sonnet_model:V||void 0,haiku_model:X||void 0})),t||o.success("Cursor config and model mapping saved"),!0}catch(x){return o.error(x.message||"Failed to save config"),!1}},$=t=>{if(c){o.error("Models are still loading. Please wait before applying a preset.");return}if(n.length===0){o.error("No models available yet. Start the daemon and refresh first.");return}const r=j||h||n[0]?.id||"gpt-5.3-codex",x=b(n,["gpt-5.3-codex","gpt53codex","GPT-5.3 Codex"],N(n,[/gpt[-.]?5.*codex/i],r)),k=b(n,["gpt-5.1-codex-max","gpt51codexmax","GPT-5.1 Codex Max"],N(n,[/gpt[-.]?5.*codex.*max/i],x)),W=b(n,["gpt-5-fast","gpt5fast","GPT-5 Fast"],N(n,[/gpt[-.]?5.*fast/i],x)),He=b(n,["gpt-5-mini","gpt5mini","GPT-5 Mini"],N(n,[/gpt[-.]?5.*mini/i],W)),ye=b(n,["claude-4.6-opus","claude46opus","Claude 4.6 Opus"],N(n,[/claude[-.]?4\.?6.*opus/i,/claude.*opus/i],x)),Ne=b(n,["claude-4.5-sonnet","claude45sonnet","Claude 4.5 Sonnet"],N(n,[/claude[-.]?4\.?5.*sonnet/i,/claude.*sonnet/i],x)),Ve=b(n,["claude-4.5-haiku","claude45haiku","Claude 4.5 Haiku"],N(n,[/claude[-.]?4\.?5.*haiku/i,/haiku/i],Ne)),L=b(n,["gemini-3-pro","gemini3pro","Gemini 3 Pro"],N(n,[/gemini[-.]?3.*pro/i],x)),Xe=b(n,["gemini-3-flash","gemini3flash","Gemini 3 Flash"],N(n,[/gemini[-.]?3.*flash/i,/gemini[-.]?2\.?5.*flash/i],L));if(t==="codex53"){w(R=>({...R,model:x,opus_model:k,sonnet_model:x,haiku_model:He})),o.success("Applied GPT-5.3 Codex preset");return}if(t==="claude46"){w(R=>({...R,model:ye,opus_model:ye,sonnet_model:Ne,haiku_model:Ve})),o.success("Applied Claude 4.6 preset");return}w(R=>({...R,model:L,opus_model:L,sonnet_model:L,haiku_model:Xe})),o.success("Applied Gemini 3 preset")},ve=async t=>{try{await m({enabled:t}),o.success(t?"Cursor integration enabled":"Cursor integration disabled")}catch(r){o.error(r.message||"Failed to update integration state")}},Ue=async()=>{try{await _e(),o.success("Cursor credentials imported")}catch(t){o.error(t.message||"Auto-detect failed")}},Ge=async()=>{if(!B.trim()||!J.trim()){o.error("Token and machine ID are required");return}try{await Me({accessToken:B.trim(),machineId:J.trim()}),o.success("Cursor credentials imported"),O(!1),xe(""),fe("")}catch(t){o.error(t.message||"Manual import failed")}},ze=async()=>{try{const t=await Pe();if(!t.success){o.error(t.error||"Failed to start daemon");return}o.success(`Daemon started${t.pid?` (PID: ${t.pid})`:""}`)}catch(t){o.error(t.message||"Failed to start daemon")}},Be=async()=>{try{const t=await Fe();if(!t.success){o.error(t.error||"Failed to stop daemon");return}o.success("Daemon stopped")}catch(t){o.error(t.message||"Failed to stop daemon")}},Je=async({suppressSuccessToast:t=!1}={})=>{if(!ge)return o.error("Raw settings are still loading. Please wait and try again."),!1;if(!F.isValid||!F.settings)return o.error(F.error||"Invalid JSON"),!1;try{return await De({settings:F.settings,expectedMtime:i?.mtime}),z(!1),t||o.success("Raw settings saved"),!0}catch(r){return ms(r)?o.error("Raw settings changed externally. Refresh and retry."):o.error(r.message||"Failed to save raw settings"),!1}},Ke=async()=>{if(!we)return;const t=g,r=T;t&&!await qe({suppressSuccessToast:r})||r&&!await Je({suppressSuccessToast:t})||t&&r&&o.success("Cursor configuration saved")},Qe=()=>{z(!1),d(),C()};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:"/assets/sidebar/cursor.svg",alt:"",className:"w-5 h-5 object-contain shrink-0"}),e.jsx("h1",{className:"font-semibold",children:"Cursor"}),e.jsx(D,{variant:"outline",className:"h-5 border-amber-500/60 bg-amber-500/10 px-1.5 text-[10px] font-semibold uppercase tracking-wide text-amber-800 dark:text-amber-300",children:"Beta"}),Ee]}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>d(),disabled:a,children:e.jsx(Se,{className:ie("w-4 h-4",a&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Dedicated Cursor integration controls"})]}),e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:"Unofficial API - Use at Your Own Risk"})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:"Reverse-engineered integration may break anytime"}),e.jsx("li",{children:"Abuse or excessive usage may risk account restrictions"}),e.jsx("li",{children:"No warranty, no responsibility from CCS"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(re,{icon:ps,label:"Integration",ok:!!s?.enabled,detail:s?.enabled?"Enabled":"Disabled"}),e.jsx(re,{icon:U,label:"Authentication",ok:!!(s?.authenticated&&!s?.token_expired),detail:s?.authenticated?s?.token_expired?"Expired":s.auth_method??"Connected":"Not connected"}),e.jsx(re,{icon:gs,label:"Daemon",ok:!!s?.daemon_running,detail:s?.daemon_running?"Running":"Stopped"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Actions"}),s?.enabled?e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:()=>ve(!1),disabled:l,children:[e.jsx(ke,{className:"w-3.5 h-3.5 mr-1.5"}),"Disable Integration"]}):e.jsxs(f,{size:"sm",className:"w-full",onClick:()=>ve(!0),disabled:l,children:[e.jsx(js,{className:"w-3.5 h-3.5 mr-1.5"}),"Enable Integration"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:Ue,disabled:le,children:[le?e.jsx(M,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(U,{className:"w-3.5 h-3.5 mr-1.5"}),"Auto-detect Auth"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:()=>O(!0),children:[e.jsx(U,{className:"w-3.5 h-3.5 mr-1.5"}),"Manual Auth Import"]}),s?.daemon_running?e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:Be,disabled:de,children:[de?e.jsx(M,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(ke,{className:"w-3.5 h-3.5 mr-1.5"}),"Stop Daemon"]}):e.jsxs(f,{size:"sm",className:"w-full",onClick:ze,disabled:!Le,children:[Te?e.jsx(M,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(ws,{className:"w-3.5 h-3.5 mr-1.5"}),"Start Daemon"]})]})]})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Port"}),e.jsx("span",{children:s?.port??u?.port??Ae})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Cursor Configuration"}),i&&e.jsx(D,{variant:"outline",className:"text-xs",children:"cursor.settings.json"})]}),i&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",i.exists?new Date(i.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:Qe,disabled:a||y,children:e.jsx(Se,{className:ie("w-4 h-4",(a||y)&&"animate-spin")})}),e.jsx(f,{size:"sm",onClick:Ke,disabled:l||oe||!we||!Ie,children:l||oe?e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(vs,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col min-h-0 overflow-hidden bg-muted/5",children:e.jsxs($e,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(We,{className:"w-full",children:[e.jsx(Y,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(Y,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(Y,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[e.jsx(ee,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(ys,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>$("codex53"),disabled:c||n.length===0,title:"OpenAI-only mapping: GPT-5.3 Codex / Codex Max / GPT-5 Mini",children:[e.jsx(te,{className:"w-3 h-3"}),"GPT-5.3 Codex"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>$("claude46"),disabled:c||n.length===0,title:"Claude-first mapping: Opus 4.6 / Sonnet 4.5 / Haiku 4.5",children:[e.jsx(te,{className:"w-3 h-3"}),"Claude 4.6"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>$("gemini3"),disabled:c||n.length===0,title:"Gemini-first mapping: Gemini 3 Pro + Gemini 3 Flash",children:[e.jsx(te,{className:"w-3 h-3"}),"Gemini 3 Pro"]})]})]}),e.jsx(xs,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(G,{label:"Default Model",description:"Used when no specific tier is requested.",value:j,models:I,disabled:c,onChange:t=>{w(r=>({...r,model:t}))}}),e.jsx(G,{label:"Opus (Most capable)",description:"Complex reasoning and highest quality responses.",value:H,models:I,disabled:c,allowDefaultFallback:!0,onChange:t=>{w(r=>({...r,opus_model:t}))}}),e.jsx(G,{label:"Sonnet (Balanced)",description:"General coding and day-to-day chat workloads.",value:V,models:I,disabled:c,allowDefaultFallback:!0,onChange:t=>{w(r=>({...r,sonnet_model:t}))}}),e.jsx(G,{label:"Haiku (Fast)",description:"Low-latency and lightweight request paths.",value:X,models:I,disabled:c,allowDefaultFallback:!0,onChange:t=>{w(r=>({...r,haiku_model:t}))}})]})]})]})})}),e.jsx(ee,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Runtime Settings"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"cursor-port",className:"text-xs",children:"Port"}),e.jsx(se,{id:"cursor-port",type:"number",min:1,max:65535,className:"max-w-[150px] h-8",value:pe,onChange:t=>{w(r=>({...r,port:t.target.value}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(P,{htmlFor:"cursor-auto-start",className:"text-xs",children:"Auto-start Daemon"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Start Cursor daemon automatically when integration is used."})]}),e.jsx(Ce,{id:"cursor-auto-start",checked:K,onCheckedChange:t=>{w(r=>({...r,auto_start:t}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(P,{htmlFor:"cursor-ghost-mode",className:"text-xs",children:"Ghost Mode"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Request `x-ghost-mode` to reduce telemetry."})]}),e.jsx(Ce,{id:"cursor-ghost-mode",checked:Q,onCheckedChange:t=>{w(r=>({...r,ghost_mode:t}))}})]})]})})})}),e.jsx(ee,{value:"info",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:"Cursor IDE"})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:i?.path??"~/.ccs/cursor.settings.json"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Model mapping writes `ANTHROPIC_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL` in `cursor.settings.json`."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Available Models"}),c?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(M,{className:"w-4 h-4 animate-spin"}),"Loading models..."]}):n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No model metadata available yet. Start daemon and refresh."}):e.jsx("div",{className:"space-y-2",children:n.map(t=>e.jsxs("div",{className:"rounded-lg border px-3 py-2 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:t.id}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.name," • ",t.provider]})]}),t.id===h&&e.jsx(D,{children:"Default"})]},t.id))})]})]})})})]})]})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Ns,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(Ye,{rawJsonContent:Z,isRawJsonValid:je,rawJsonEdits:T?he:null,rawSettingsEnv:i?.settings?.env,onChange:t=>{z(!0),Re(t)}})]})]})]})})]}),e.jsx(es,{open:Oe,onOpenChange:O,children:e.jsxs(ss,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"Manual Cursor Auth Import"}),e.jsx(ns,{children:"Provide Cursor access token and machine ID if auto-detect is unavailable."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"cursor-manual-token",children:"Access Token"}),e.jsx(se,{id:"cursor-manual-token",value:B,onChange:t=>xe(t.target.value),placeholder:"Paste Cursor access token"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"cursor-manual-machine-id",children:"Machine ID"}),e.jsx(se,{id:"cursor-manual-machine-id",value:J,onChange:t=>fe(t.target.value),placeholder:"32-char hex (UUID without hyphens)"})]})]}),e.jsxs(rs,{children:[e.jsx(f,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),e.jsxs(f,{onClick:Ge,disabled:ce,children:[ce?e.jsx(M,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(U,{className:"w-4 h-4 mr-2"}),"Import"]})]})]})})]})}export{Xs as CursorPage};
|
|
@@ -17,4 +17,4 @@ import{c as P}from"./react-vendor-CNOkPC89.js";var xe=e=>e.type==="checkbox",_e=
|
|
|
17
17
|
newResult[${$}] = ${Z}.value;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
`)}O.write("payload.value = newResult;"),O.write("return payload;");const z=O.compile();return(R,Z)=>z(m,R,Z)};let s;const i=Le,a=!yr.jitless,_=a&&vn.value,y=t.catchall;let k;e._zod.parse=(m,O)=>{k??(k=n.value);const I=m.value;return i(I)?a&&_&&O?.async===!1&&O.jitless!==!0?(s||(s=o(t.shape)),m=s(m,O),y?Or([],I,m,O,k,e):m):r(m,O):(m.issues.push({expected:"object",code:"invalid_type",input:I,inst:e}),m)}});function Ht(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!ze(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>me(i,n,ge())))}),t)}const Yo=f("$ZodUnion",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),S(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),S(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),S(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>vt(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const p of t.options){const _=p._zod.run({value:o.value,issues:[]},s);if(_ instanceof Promise)a.push(_),i=!0;else{if(_.issues.length===0)return _;a.push(_)}}return i?Promise.all(a).then(p=>Ht(p,o,e,s)):Ht(a,o,e,s)}}),Qo=f("$ZodIntersection",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([p,_])=>Gt(r,p,_)):Gt(r,s,i)}});function at(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Oe(e)&&Oe(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=at(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=at(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Gt(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),ze(e))return e;const n=at(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const es=f("$ZodEnum",(e,t)=>{M.init(e,t);const r=gn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>yn.has(typeof o)).map(o=>typeof o=="string"?We(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),ts=f("$ZodTransform",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Ze;return r.value=o,r}});function Xt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const rs=f("$ZodOptional",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.optout="optional",S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${vt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Xt(s,r.value)):Xt(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ns=f("$ZodNullable",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${vt(r.source)}|null)$`):void 0}),S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),os=f("$ZodDefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Yt(s,t)):Yt(o,t)}});function Yt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ss=f("$ZodPrefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),is=f("$ZodNonOptional",(e,t)=>{M.init(e,t),S(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Qt(s,e)):Qt(o,e)}});function Qt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const us=f("$ZodCatch",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>me(i,n,ge()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>me(s,n,ge()))},input:r.value}),r.issues=[]),r)}}),cs=f("$ZodPipe",(e,t)=>{M.init(e,t),S(e._zod,"values",()=>t.in._zod.values),S(e._zod,"optin",()=>t.in._zod.optin),S(e._zod,"optout",()=>t.out._zod.optout),S(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Te(i,t.in,n)):Te(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Te(s,t.out,n)):Te(o,t.out,n)}});function Te(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const as=f("$ZodReadonly",(e,t)=>{M.init(e,t),S(e._zod,"propValues",()=>t.innerType._zod.propValues),S(e._zod,"values",()=>t.innerType._zod.values),S(e._zod,"optin",()=>t.innerType?._zod?.optin),S(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(er):er(o)}});function er(e){return e.value=Object.freeze(e.value),e}const ls=f("$ZodCustom",(e,t)=>{ue.init(e,t),M.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>tr(s,r,n,e));tr(o,r,n,e)}});function tr(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ve(o))}}var rr;class fs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ds(){return new fs}(rr=globalThis).__zod_globalRegistry??(rr.__zod_globalRegistry=ds());const Ce=globalThis.__zod_globalRegistry;function hs(e,t){return new e({type:"string",...b(t)})}function ps(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(t)})}function nr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(t)})}function _s(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(t)})}function gs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(t)})}function ms(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(t)})}function vs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(t)})}function ys(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(t)})}function ws(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(t)})}function bs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(t)})}function ks(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(t)})}function zs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(t)})}function Zs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(t)})}function $s(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(t)})}function As(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(t)})}function Es(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(t)})}function Fs(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(t)})}function Ds(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(t)})}function Os(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(t)})}function Vs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(t)})}function xs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(t)})}function Ss(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(t)})}function Is(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(t)})}function Ps(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(t)})}function Ts(e,t){return new e({type:"string",format:"date",check:"string_format",...b(t)})}function Cs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(t)})}function Rs(e,t){return new e({type:"string",format:"duration",check:"string_format",...b(t)})}function Us(e){return new e({type:"unknown"})}function js(e,t){return new e({type:"never",...b(t)})}function Vr(e,t){return new ao({check:"max_length",...b(t),maximum:e})}function Me(e,t){return new lo({check:"min_length",...b(t),minimum:e})}function xr(e,t){return new fo({check:"length_equals",...b(t),length:e})}function Ls(e,t){return new ho({check:"string_format",format:"regex",...b(t),pattern:e})}function Ns(e){return new po({check:"string_format",format:"lowercase",...b(e)})}function Ms(e){return new _o({check:"string_format",format:"uppercase",...b(e)})}function Bs(e,t){return new go({check:"string_format",format:"includes",...b(t),includes:e})}function Ws(e,t){return new mo({check:"string_format",format:"starts_with",...b(t),prefix:e})}function qs(e,t){return new vo({check:"string_format",format:"ends_with",...b(t),suffix:e})}function $e(e){return new yo({check:"overwrite",tx:e})}function Js(e){return $e(t=>t.normalize(e))}function Ks(){return $e(e=>e.trim())}function Hs(){return $e(e=>e.toLowerCase())}function Gs(){return $e(e=>e.toUpperCase())}function Xs(){return $e(e=>mn(e))}function Ys(e,t,r){return new e({type:"array",element:t,...b(r)})}function Qs(e,t,r){return new e({type:"custom",check:"custom",fn:t,...b(r)})}function ei(e){const t=ti(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ve(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ve(o))}},e(r.value,r)));return t}function ti(e,t){const r=new ue({check:"custom",...b(t)});return r._zod.check=e,r}const ri=f("ZodISODateTime",(e,t)=>{So.init(e,t),C.init(e,t)});function ni(e){return Ps(ri,e)}const oi=f("ZodISODate",(e,t)=>{Io.init(e,t),C.init(e,t)});function si(e){return Ts(oi,e)}const ii=f("ZodISOTime",(e,t)=>{Po.init(e,t),C.init(e,t)});function ui(e){return Cs(ii,e)}const ci=f("ZodISODuration",(e,t)=>{To.init(e,t),C.init(e,t)});function ai(e){return Rs(ci,e)}const li=(e,t)=>{Zr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Dn(e,r)},flatten:{value:r=>Fn(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ct,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ct,2)}},isEmpty:{get(){return e.issues.length===0}}})},Q=f("ZodError",li,{Parent:Error}),fi=Je(Q),di=Ke(Q),hi=He(Q),pi=Ge(Q),_i=xn(Q),gi=Sn(Q),mi=In(Q),vi=Pn(Q),yi=Tn(Q),wi=Cn(Q),bi=Rn(Q),ki=Un(Q),W=f("ZodType",(e,t)=>(M.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ye(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>he(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>fi(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>hi(e,r,n),e.parseAsync=async(r,n)=>di(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>pi(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>_i(e,r,n),e.decode=(r,n)=>gi(e,r,n),e.encodeAsync=async(r,n)=>mi(e,r,n),e.decodeAsync=async(r,n)=>vi(e,r,n),e.safeEncode=(r,n)=>yi(e,r,n),e.safeDecode=(r,n)=>wi(e,r,n),e.safeEncodeAsync=async(r,n)=>bi(e,r,n),e.safeDecodeAsync=async(r,n)=>ki(e,r,n),e.refine=(r,n)=>e.check(du(r,n)),e.superRefine=r=>e.check(hu(r)),e.overwrite=r=>e.check($e(r)),e.optional=()=>ir(e),e.nullable=()=>ur(e),e.nullish=()=>ir(ur(e)),e.nonoptional=r=>su(e,r),e.array=()=>Wi(e),e.or=r=>Ki([e,r]),e.and=r=>Gi(e,r),e.transform=r=>cr(e,Qi(r)),e.default=r=>ru(e,r),e.prefault=r=>ou(e,r),e.catch=r=>uu(e,r),e.pipe=r=>cr(e,r),e.readonly=()=>lu(e),e.describe=r=>{const n=e.clone();return Ce.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ce.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ce.get(e);const n=e.clone();return Ce.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Sr=f("_ZodString",(e,t)=>{wt.init(e,t),W.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Ls(...n)),e.includes=(...n)=>e.check(Bs(...n)),e.startsWith=(...n)=>e.check(Ws(...n)),e.endsWith=(...n)=>e.check(qs(...n)),e.min=(...n)=>e.check(Me(...n)),e.max=(...n)=>e.check(Vr(...n)),e.length=(...n)=>e.check(xr(...n)),e.nonempty=(...n)=>e.check(Me(1,...n)),e.lowercase=n=>e.check(Ns(n)),e.uppercase=n=>e.check(Ms(n)),e.trim=()=>e.check(Ks()),e.normalize=(...n)=>e.check(Js(...n)),e.toLowerCase=()=>e.check(Hs()),e.toUpperCase=()=>e.check(Gs()),e.slugify=()=>e.check(Xs())}),zi=f("ZodString",(e,t)=>{wt.init(e,t),Sr.init(e,t),e.email=r=>e.check(ps(Zi,r)),e.url=r=>e.check(ys($i,r)),e.jwt=r=>e.check(Is(ji,r)),e.emoji=r=>e.check(ws(Ai,r)),e.guid=r=>e.check(nr(or,r)),e.uuid=r=>e.check(_s(Re,r)),e.uuidv4=r=>e.check(gs(Re,r)),e.uuidv6=r=>e.check(ms(Re,r)),e.uuidv7=r=>e.check(vs(Re,r)),e.nanoid=r=>e.check(bs(Ei,r)),e.guid=r=>e.check(nr(or,r)),e.cuid=r=>e.check(ks(Fi,r)),e.cuid2=r=>e.check(zs(Di,r)),e.ulid=r=>e.check(Zs(Oi,r)),e.base64=r=>e.check(Vs(Ci,r)),e.base64url=r=>e.check(xs(Ri,r)),e.xid=r=>e.check($s(Vi,r)),e.ksuid=r=>e.check(As(xi,r)),e.ipv4=r=>e.check(Es(Si,r)),e.ipv6=r=>e.check(Fs(Ii,r)),e.cidrv4=r=>e.check(Ds(Pi,r)),e.cidrv6=r=>e.check(Os(Ti,r)),e.e164=r=>e.check(Ss(Ui,r)),e.datetime=r=>e.check(ni(r)),e.date=r=>e.check(si(r)),e.time=r=>e.check(ui(r)),e.duration=r=>e.check(ai(r))});function bu(e){return hs(zi,e)}const C=f("ZodStringFormat",(e,t)=>{T.init(e,t),Sr.init(e,t)}),Zi=f("ZodEmail",(e,t)=>{Zo.init(e,t),C.init(e,t)}),or=f("ZodGUID",(e,t)=>{ko.init(e,t),C.init(e,t)}),Re=f("ZodUUID",(e,t)=>{zo.init(e,t),C.init(e,t)}),$i=f("ZodURL",(e,t)=>{$o.init(e,t),C.init(e,t)}),Ai=f("ZodEmoji",(e,t)=>{Ao.init(e,t),C.init(e,t)}),Ei=f("ZodNanoID",(e,t)=>{Eo.init(e,t),C.init(e,t)}),Fi=f("ZodCUID",(e,t)=>{Fo.init(e,t),C.init(e,t)}),Di=f("ZodCUID2",(e,t)=>{Do.init(e,t),C.init(e,t)}),Oi=f("ZodULID",(e,t)=>{Oo.init(e,t),C.init(e,t)}),Vi=f("ZodXID",(e,t)=>{Vo.init(e,t),C.init(e,t)}),xi=f("ZodKSUID",(e,t)=>{xo.init(e,t),C.init(e,t)}),Si=f("ZodIPv4",(e,t)=>{Co.init(e,t),C.init(e,t)}),Ii=f("ZodIPv6",(e,t)=>{Ro.init(e,t),C.init(e,t)}),Pi=f("ZodCIDRv4",(e,t)=>{Uo.init(e,t),C.init(e,t)}),Ti=f("ZodCIDRv6",(e,t)=>{jo.init(e,t),C.init(e,t)}),Ci=f("ZodBase64",(e,t)=>{Lo.init(e,t),C.init(e,t)}),Ri=f("ZodBase64URL",(e,t)=>{Mo.init(e,t),C.init(e,t)}),Ui=f("ZodE164",(e,t)=>{Bo.init(e,t),C.init(e,t)}),ji=f("ZodJWT",(e,t)=>{qo.init(e,t),C.init(e,t)}),Li=f("ZodUnknown",(e,t)=>{Jo.init(e,t),W.init(e,t)});function sr(){return Us(Li)}const Ni=f("ZodNever",(e,t)=>{Ko.init(e,t),W.init(e,t)});function Mi(e){return js(Ni,e)}const Bi=f("ZodArray",(e,t)=>{Ho.init(e,t),W.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Me(r,n)),e.nonempty=r=>e.check(Me(1,r)),e.max=(r,n)=>e.check(Vr(r,n)),e.length=(r,n)=>e.check(xr(r,n)),e.unwrap=()=>e.element});function Wi(e,t){return Ys(Bi,e,t)}const qi=f("ZodObject",(e,t)=>{Xo.init(e,t),W.init(e,t),S(e,"shape",()=>t.shape),e.keyof=()=>Xi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sr()}),e.loose=()=>e.clone({...e._zod.def,catchall:sr()}),e.strict=()=>e.clone({...e._zod.def,catchall:Mi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>zn(e,r),e.safeExtend=r=>Zn(e,r),e.merge=r=>$n(e,r),e.pick=r=>bn(e,r),e.omit=r=>kn(e,r),e.partial=(...r)=>An(Ir,e,r[0]),e.required=(...r)=>En(Pr,e,r[0])});function ku(e,t){const r={type:"object",shape:e??{},...b(t)};return new qi(r)}const Ji=f("ZodUnion",(e,t)=>{Yo.init(e,t),W.init(e,t),e.options=t.options});function Ki(e,t){return new Ji({type:"union",options:e,...b(t)})}const Hi=f("ZodIntersection",(e,t)=>{Qo.init(e,t),W.init(e,t)});function Gi(e,t){return new Hi({type:"intersection",left:e,right:t})}const lt=f("ZodEnum",(e,t)=>{es.init(e,t),W.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new lt({...t,checks:[],...b(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new lt({...t,checks:[],...b(o),entries:s})}});function Xi(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new lt({type:"enum",entries:r,...b(t)})}const Yi=f("ZodTransform",(e,t)=>{ts.init(e,t),W.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Ve(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Ve(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Qi(e){return new Yi({type:"transform",transform:e})}const Ir=f("ZodOptional",(e,t)=>{rs.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ir(e){return new Ir({type:"optional",innerType:e})}const eu=f("ZodNullable",(e,t)=>{ns.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ur(e){return new eu({type:"nullable",innerType:e})}const tu=f("ZodDefault",(e,t)=>{os.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ru(e,t){return new tu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():br(t)}})}const nu=f("ZodPrefault",(e,t)=>{ss.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ou(e,t){return new nu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():br(t)}})}const Pr=f("ZodNonOptional",(e,t)=>{is.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function su(e,t){return new Pr({type:"nonoptional",innerType:e,...b(t)})}const iu=f("ZodCatch",(e,t)=>{us.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function uu(e,t){return new iu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const cu=f("ZodPipe",(e,t)=>{cs.init(e,t),W.init(e,t),e.in=t.in,e.out=t.out});function cr(e,t){return new cu({type:"pipe",in:e,out:t})}const au=f("ZodReadonly",(e,t)=>{as.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lu(e){return new au({type:"readonly",innerType:e})}const fu=f("ZodCustom",(e,t)=>{ls.init(e,t),W.init(e,t)});function du(e,t={}){return Qs(fu,e,t)}function hu(e){return ei(e)}export{Zr as $,wu as a,Yr as b,ku as c,bu as d,gu as e,pn as o,yu as p,vu as s,mu as u};
|
|
20
|
+
`)}O.write("payload.value = newResult;"),O.write("return payload;");const z=O.compile();return(R,Z)=>z(m,R,Z)};let s;const i=Le,a=!yr.jitless,_=a&&vn.value,y=t.catchall;let k;e._zod.parse=(m,O)=>{k??(k=n.value);const I=m.value;return i(I)?a&&_&&O?.async===!1&&O.jitless!==!0?(s||(s=o(t.shape)),m=s(m,O),y?Or([],I,m,O,k,e):m):r(m,O):(m.issues.push({expected:"object",code:"invalid_type",input:I,inst:e}),m)}});function Ht(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!ze(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>me(i,n,ge())))}),t)}const Yo=f("$ZodUnion",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),S(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),S(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),S(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>vt(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const p of t.options){const _=p._zod.run({value:o.value,issues:[]},s);if(_ instanceof Promise)a.push(_),i=!0;else{if(_.issues.length===0)return _;a.push(_)}}return i?Promise.all(a).then(p=>Ht(p,o,e,s)):Ht(a,o,e,s)}}),Qo=f("$ZodIntersection",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([p,_])=>Gt(r,p,_)):Gt(r,s,i)}});function at(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Oe(e)&&Oe(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=at(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=at(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Gt(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),ze(e))return e;const n=at(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const es=f("$ZodEnum",(e,t)=>{M.init(e,t);const r=gn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>yn.has(typeof o)).map(o=>typeof o=="string"?We(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),ts=f("$ZodTransform",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Ze;return r.value=o,r}});function Xt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const rs=f("$ZodOptional",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.optout="optional",S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${vt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Xt(s,r.value)):Xt(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ns=f("$ZodNullable",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${vt(r.source)}|null)$`):void 0}),S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),os=f("$ZodDefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Yt(s,t)):Yt(o,t)}});function Yt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ss=f("$ZodPrefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),is=f("$ZodNonOptional",(e,t)=>{M.init(e,t),S(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Qt(s,e)):Qt(o,e)}});function Qt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const us=f("$ZodCatch",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>me(i,n,ge()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>me(s,n,ge()))},input:r.value}),r.issues=[]),r)}}),cs=f("$ZodPipe",(e,t)=>{M.init(e,t),S(e._zod,"values",()=>t.in._zod.values),S(e._zod,"optin",()=>t.in._zod.optin),S(e._zod,"optout",()=>t.out._zod.optout),S(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Te(i,t.in,n)):Te(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Te(s,t.out,n)):Te(o,t.out,n)}});function Te(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const as=f("$ZodReadonly",(e,t)=>{M.init(e,t),S(e._zod,"propValues",()=>t.innerType._zod.propValues),S(e._zod,"values",()=>t.innerType._zod.values),S(e._zod,"optin",()=>t.innerType?._zod?.optin),S(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(er):er(o)}});function er(e){return e.value=Object.freeze(e.value),e}const ls=f("$ZodCustom",(e,t)=>{ue.init(e,t),M.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>tr(s,r,n,e));tr(o,r,n,e)}});function tr(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ve(o))}}var rr;class fs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ds(){return new fs}(rr=globalThis).__zod_globalRegistry??(rr.__zod_globalRegistry=ds());const Ce=globalThis.__zod_globalRegistry;function hs(e,t){return new e({type:"string",...b(t)})}function ps(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(t)})}function nr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(t)})}function _s(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(t)})}function gs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(t)})}function ms(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(t)})}function vs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(t)})}function ys(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(t)})}function ws(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(t)})}function bs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(t)})}function ks(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(t)})}function zs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(t)})}function Zs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(t)})}function $s(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(t)})}function As(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(t)})}function Es(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(t)})}function Fs(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(t)})}function Ds(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(t)})}function Os(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(t)})}function Vs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(t)})}function xs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(t)})}function Ss(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(t)})}function Is(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(t)})}function Ps(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(t)})}function Ts(e,t){return new e({type:"string",format:"date",check:"string_format",...b(t)})}function Cs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(t)})}function Rs(e,t){return new e({type:"string",format:"duration",check:"string_format",...b(t)})}function Us(e){return new e({type:"unknown"})}function js(e,t){return new e({type:"never",...b(t)})}function Vr(e,t){return new ao({check:"max_length",...b(t),maximum:e})}function Me(e,t){return new lo({check:"min_length",...b(t),minimum:e})}function xr(e,t){return new fo({check:"length_equals",...b(t),length:e})}function Ls(e,t){return new ho({check:"string_format",format:"regex",...b(t),pattern:e})}function Ns(e){return new po({check:"string_format",format:"lowercase",...b(e)})}function Ms(e){return new _o({check:"string_format",format:"uppercase",...b(e)})}function Bs(e,t){return new go({check:"string_format",format:"includes",...b(t),includes:e})}function Ws(e,t){return new mo({check:"string_format",format:"starts_with",...b(t),prefix:e})}function qs(e,t){return new vo({check:"string_format",format:"ends_with",...b(t),suffix:e})}function $e(e){return new yo({check:"overwrite",tx:e})}function Js(e){return $e(t=>t.normalize(e))}function Ks(){return $e(e=>e.trim())}function Hs(){return $e(e=>e.toLowerCase())}function Gs(){return $e(e=>e.toUpperCase())}function Xs(){return $e(e=>mn(e))}function Ys(e,t,r){return new e({type:"array",element:t,...b(r)})}function Qs(e,t,r){return new e({type:"custom",check:"custom",fn:t,...b(r)})}function ei(e){const t=ti(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ve(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ve(o))}},e(r.value,r)));return t}function ti(e,t){const r=new ue({check:"custom",...b(t)});return r._zod.check=e,r}const ri=f("ZodISODateTime",(e,t)=>{So.init(e,t),C.init(e,t)});function ni(e){return Ps(ri,e)}const oi=f("ZodISODate",(e,t)=>{Io.init(e,t),C.init(e,t)});function si(e){return Ts(oi,e)}const ii=f("ZodISOTime",(e,t)=>{Po.init(e,t),C.init(e,t)});function ui(e){return Cs(ii,e)}const ci=f("ZodISODuration",(e,t)=>{To.init(e,t),C.init(e,t)});function ai(e){return Rs(ci,e)}const li=(e,t)=>{Zr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Dn(e,r)},flatten:{value:r=>Fn(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ct,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ct,2)}},isEmpty:{get(){return e.issues.length===0}}})},Q=f("ZodError",li,{Parent:Error}),fi=Je(Q),di=Ke(Q),hi=He(Q),pi=Ge(Q),_i=xn(Q),gi=Sn(Q),mi=In(Q),vi=Pn(Q),yi=Tn(Q),wi=Cn(Q),bi=Rn(Q),ki=Un(Q),W=f("ZodType",(e,t)=>(M.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ye(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>he(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>fi(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>hi(e,r,n),e.parseAsync=async(r,n)=>di(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>pi(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>_i(e,r,n),e.decode=(r,n)=>gi(e,r,n),e.encodeAsync=async(r,n)=>mi(e,r,n),e.decodeAsync=async(r,n)=>vi(e,r,n),e.safeEncode=(r,n)=>yi(e,r,n),e.safeDecode=(r,n)=>wi(e,r,n),e.safeEncodeAsync=async(r,n)=>bi(e,r,n),e.safeDecodeAsync=async(r,n)=>ki(e,r,n),e.refine=(r,n)=>e.check(du(r,n)),e.superRefine=r=>e.check(hu(r)),e.overwrite=r=>e.check($e(r)),e.optional=()=>ir(e),e.nullable=()=>ur(e),e.nullish=()=>ir(ur(e)),e.nonoptional=r=>su(e,r),e.array=()=>Wi(e),e.or=r=>Ki([e,r]),e.and=r=>Gi(e,r),e.transform=r=>cr(e,Qi(r)),e.default=r=>ru(e,r),e.prefault=r=>ou(e,r),e.catch=r=>uu(e,r),e.pipe=r=>cr(e,r),e.readonly=()=>lu(e),e.describe=r=>{const n=e.clone();return Ce.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ce.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ce.get(e);const n=e.clone();return Ce.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Sr=f("_ZodString",(e,t)=>{wt.init(e,t),W.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Ls(...n)),e.includes=(...n)=>e.check(Bs(...n)),e.startsWith=(...n)=>e.check(Ws(...n)),e.endsWith=(...n)=>e.check(qs(...n)),e.min=(...n)=>e.check(Me(...n)),e.max=(...n)=>e.check(Vr(...n)),e.length=(...n)=>e.check(xr(...n)),e.nonempty=(...n)=>e.check(Me(1,...n)),e.lowercase=n=>e.check(Ns(n)),e.uppercase=n=>e.check(Ms(n)),e.trim=()=>e.check(Ks()),e.normalize=(...n)=>e.check(Js(...n)),e.toLowerCase=()=>e.check(Hs()),e.toUpperCase=()=>e.check(Gs()),e.slugify=()=>e.check(Xs())}),zi=f("ZodString",(e,t)=>{wt.init(e,t),Sr.init(e,t),e.email=r=>e.check(ps(Zi,r)),e.url=r=>e.check(ys($i,r)),e.jwt=r=>e.check(Is(ji,r)),e.emoji=r=>e.check(ws(Ai,r)),e.guid=r=>e.check(nr(or,r)),e.uuid=r=>e.check(_s(Re,r)),e.uuidv4=r=>e.check(gs(Re,r)),e.uuidv6=r=>e.check(ms(Re,r)),e.uuidv7=r=>e.check(vs(Re,r)),e.nanoid=r=>e.check(bs(Ei,r)),e.guid=r=>e.check(nr(or,r)),e.cuid=r=>e.check(ks(Fi,r)),e.cuid2=r=>e.check(zs(Di,r)),e.ulid=r=>e.check(Zs(Oi,r)),e.base64=r=>e.check(Vs(Ci,r)),e.base64url=r=>e.check(xs(Ri,r)),e.xid=r=>e.check($s(Vi,r)),e.ksuid=r=>e.check(As(xi,r)),e.ipv4=r=>e.check(Es(Si,r)),e.ipv6=r=>e.check(Fs(Ii,r)),e.cidrv4=r=>e.check(Ds(Pi,r)),e.cidrv6=r=>e.check(Os(Ti,r)),e.e164=r=>e.check(Ss(Ui,r)),e.datetime=r=>e.check(ni(r)),e.date=r=>e.check(si(r)),e.time=r=>e.check(ui(r)),e.duration=r=>e.check(ai(r))});function bu(e){return hs(zi,e)}const C=f("ZodStringFormat",(e,t)=>{T.init(e,t),Sr.init(e,t)}),Zi=f("ZodEmail",(e,t)=>{Zo.init(e,t),C.init(e,t)}),or=f("ZodGUID",(e,t)=>{ko.init(e,t),C.init(e,t)}),Re=f("ZodUUID",(e,t)=>{zo.init(e,t),C.init(e,t)}),$i=f("ZodURL",(e,t)=>{$o.init(e,t),C.init(e,t)}),Ai=f("ZodEmoji",(e,t)=>{Ao.init(e,t),C.init(e,t)}),Ei=f("ZodNanoID",(e,t)=>{Eo.init(e,t),C.init(e,t)}),Fi=f("ZodCUID",(e,t)=>{Fo.init(e,t),C.init(e,t)}),Di=f("ZodCUID2",(e,t)=>{Do.init(e,t),C.init(e,t)}),Oi=f("ZodULID",(e,t)=>{Oo.init(e,t),C.init(e,t)}),Vi=f("ZodXID",(e,t)=>{Vo.init(e,t),C.init(e,t)}),xi=f("ZodKSUID",(e,t)=>{xo.init(e,t),C.init(e,t)}),Si=f("ZodIPv4",(e,t)=>{Co.init(e,t),C.init(e,t)}),Ii=f("ZodIPv6",(e,t)=>{Ro.init(e,t),C.init(e,t)}),Pi=f("ZodCIDRv4",(e,t)=>{Uo.init(e,t),C.init(e,t)}),Ti=f("ZodCIDRv6",(e,t)=>{jo.init(e,t),C.init(e,t)}),Ci=f("ZodBase64",(e,t)=>{Lo.init(e,t),C.init(e,t)}),Ri=f("ZodBase64URL",(e,t)=>{Mo.init(e,t),C.init(e,t)}),Ui=f("ZodE164",(e,t)=>{Bo.init(e,t),C.init(e,t)}),ji=f("ZodJWT",(e,t)=>{qo.init(e,t),C.init(e,t)}),Li=f("ZodUnknown",(e,t)=>{Jo.init(e,t),W.init(e,t)});function sr(){return Us(Li)}const Ni=f("ZodNever",(e,t)=>{Ko.init(e,t),W.init(e,t)});function Mi(e){return js(Ni,e)}const Bi=f("ZodArray",(e,t)=>{Ho.init(e,t),W.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Me(r,n)),e.nonempty=r=>e.check(Me(1,r)),e.max=(r,n)=>e.check(Vr(r,n)),e.length=(r,n)=>e.check(xr(r,n)),e.unwrap=()=>e.element});function Wi(e,t){return Ys(Bi,e,t)}const qi=f("ZodObject",(e,t)=>{Xo.init(e,t),W.init(e,t),S(e,"shape",()=>t.shape),e.keyof=()=>Xi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sr()}),e.loose=()=>e.clone({...e._zod.def,catchall:sr()}),e.strict=()=>e.clone({...e._zod.def,catchall:Mi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>zn(e,r),e.safeExtend=r=>Zn(e,r),e.merge=r=>$n(e,r),e.pick=r=>bn(e,r),e.omit=r=>kn(e,r),e.partial=(...r)=>An(Ir,e,r[0]),e.required=(...r)=>En(Pr,e,r[0])});function ku(e,t){const r={type:"object",shape:e??{},...b(t)};return new qi(r)}const Ji=f("ZodUnion",(e,t)=>{Yo.init(e,t),W.init(e,t),e.options=t.options});function Ki(e,t){return new Ji({type:"union",options:e,...b(t)})}const Hi=f("ZodIntersection",(e,t)=>{Qo.init(e,t),W.init(e,t)});function Gi(e,t){return new Hi({type:"intersection",left:e,right:t})}const lt=f("ZodEnum",(e,t)=>{es.init(e,t),W.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new lt({...t,checks:[],...b(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new lt({...t,checks:[],...b(o),entries:s})}});function Xi(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new lt({type:"enum",entries:r,...b(t)})}const Yi=f("ZodTransform",(e,t)=>{ts.init(e,t),W.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Ve(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Ve(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Qi(e){return new Yi({type:"transform",transform:e})}const Ir=f("ZodOptional",(e,t)=>{rs.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ir(e){return new Ir({type:"optional",innerType:e})}const eu=f("ZodNullable",(e,t)=>{ns.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ur(e){return new eu({type:"nullable",innerType:e})}const tu=f("ZodDefault",(e,t)=>{os.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ru(e,t){return new tu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():br(t)}})}const nu=f("ZodPrefault",(e,t)=>{ss.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ou(e,t){return new nu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():br(t)}})}const Pr=f("ZodNonOptional",(e,t)=>{is.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function su(e,t){return new Pr({type:"nonoptional",innerType:e,...b(t)})}const iu=f("ZodCatch",(e,t)=>{us.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function uu(e,t){return new iu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const cu=f("ZodPipe",(e,t)=>{cs.init(e,t),W.init(e,t),e.in=t.in,e.out=t.out});function cr(e,t){return new cu({type:"pipe",in:e,out:t})}const au=f("ZodReadonly",(e,t)=>{as.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lu(e){return new au({type:"readonly",innerType:e})}const fu=f("ZodCustom",(e,t)=>{ls.init(e,t),W.init(e,t)});function du(e,t={}){return Qs(fu,e,t)}function hu(e){return ei(e)}export{Zr as $,Xi as _,wu as a,Yr as b,ku as c,bu as d,gu as e,pn as o,yu as p,vu as s,mu as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-
|
|
1
|
+
import{j as e}from"./radix-ui-DIWAxjEp.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{b5 as N,b6 as C,b7 as w,a_ as y,b0 as G,m as S,b,I as p}from"./index-PWMOllOf.js";import{S as k}from"./switch-s8pp-m8L.js";import{R as j,a1 as A,q as R,ag as L,$ as _}from"./icons-Dk2sL3Mr.js";import"./tanstack-Hn82hibe.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";function V(){const{state:s}=N(),a=C(),[l,d]=c.useState(""),[m,v]=c.useState(""),u=c.useCallback(async()=>{try{a.setGlobalEnvLoading(!0),a.setGlobalEnvError(null);const t=await fetch("/api/global-env");if(!t.ok)throw new Error("Failed to load Global Env config");const o=await t.json();a.setGlobalEnvConfig(o)}catch(t){a.setGlobalEnvError(t.message)}finally{a.setGlobalEnvLoading(!1)}},[a]),i=c.useCallback(async t=>{const o=s.globalEnvConfig;if(!o)return;const x={...o,...t};a.setGlobalEnvConfig(x);try{a.setGlobalEnvSaving(!0),a.setGlobalEnvError(null);const r=await fetch("/api/global-env",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!r.ok){const n=await r.json();throw new Error(n.error||"Failed to save")}const h=await r.json();a.setGlobalEnvConfig(h.config),a.setGlobalEnvSuccess(!0),setTimeout(()=>a.setGlobalEnvSuccess(!1),1500)}catch(r){a.setGlobalEnvConfig(o),a.setGlobalEnvError(r.message)}finally{a.setGlobalEnvSaving(!1)}},[s.globalEnvConfig,a]),f=c.useCallback(()=>{if(!l.trim()||!s.globalEnvConfig)return;const t={...s.globalEnvConfig.env,[l.trim()]:m};i({env:t}),d(""),v("")},[l,m,s.globalEnvConfig,i]),g=c.useCallback(t=>{if(!s.globalEnvConfig)return;const o={...s.globalEnvConfig.env};delete o[t],i({env:o})},[s.globalEnvConfig,i]);return{config:s.globalEnvConfig,loading:s.globalEnvLoading,saving:s.globalEnvSaving,error:s.globalEnvError,success:s.globalEnvSuccess,newEnvKey:l,setNewEnvKey:d,newEnvValue:m,setNewEnvValue:v,fetchConfig:u,saveConfig:i,addEnvVar:f,removeEnvVar:g}}function F(){const{config:s,loading:a,saving:l,error:d,success:m,newEnvKey:v,setNewEnvKey:u,newEnvValue:i,setNewEnvValue:f,fetchConfig:g,saveConfig:t,addEnvVar:o,removeEnvVar:x}=V(),{fetchRawConfig:r}=w();c.useEffect(()=>{g(),r()},[g,r]);const h=()=>{t({enabled:!s?.enabled})};return a?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(j,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"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 ${d||m?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[d&&e.jsxs(y,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(A,{className:"h-4 w-4"}),e.jsx(G,{children:d})]}),m&&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(R,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(S,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Environment variables injected into all non-Claude subscription profiles (gemini, codex, agy, ghcp, etc.)"}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s?.enabled?"Global Env enabled":"Global Env disabled"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?.enabled?"Env vars will be injected into third-party profiles":"Env vars will not be injected"})]}),e.jsx(k,{checked:s?.enabled??!0,onCheckedChange:h})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Environment Variables"}),s?.env&&Object.keys(s.env).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(s.env).map(([n,E])=>e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border bg-background",children:[e.jsx("code",{className:"flex-1 font-mono text-sm truncate",children:n}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("code",{className:"font-mono text-sm px-2 py-1 bg-muted rounded",children:E}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>x(n),disabled:l,className:"h-8 w-8 p-0 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(L,{className:"w-4 h-4"})})]},n))}):e.jsx("div",{className:"p-4 rounded-lg border border-dashed text-center text-muted-foreground",children:e.jsx("p",{children:"No environment variables configured"})}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Add New Variable"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{value:v,onChange:n=>u(n.target.value.toUpperCase()),placeholder:"KEY_NAME",className:"flex-1 font-mono text-sm h-9",disabled:l}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:"="}),e.jsx(p,{value:i,onChange:n=>f(n.target.value),placeholder:"value",className:"flex-1 font-mono text-sm h-9",disabled:l}),e.jsxs(b,{size:"sm",onClick:o,disabled:l||!v.trim(),className:"h-9",children:[e.jsx(_,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Quick Add Common Variables"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[[{key:"DISABLE_BUG_COMMAND",value:"1"},{key:"DISABLE_ERROR_REPORTING",value:"1"},{key:"DISABLE_TELEMETRY",value:"1"}].map(({key:n,value:E})=>!s?.env?.[n]&&e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{u(n),f(E)},className:"text-xs font-mono",children:["+ ",n]},n)),s?.env&&["DISABLE_BUG_COMMAND","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY"].every(n=>s.env[n])&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"All common variables are configured"})]})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{g(),r()},disabled:a||l,className:"w-full",children:[e.jsx(j,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"Refresh"]})})]})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-CwcVwplj.js";import{c as l,b as p,E as w,F as y,G as k,B as z,S as h}from"./index-DiWdJxAN.js";import{u as R,a as E,b as M}from"./tanstack-matWclUm.js";import{t as g}from"./notifications-B2HqRBj7.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{ay as v,b as W,y as C,l as S,Z as P,f as O,U as $,S as F,az as I,Y as H,x as T,R as A}from"./icons-DGASzt3M.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";const B={sm:{dimension:80,strokeWidth:6,fontSize:"text-lg",labelSize:"text-[10px]"},md:{dimension:120,strokeWidth:8,fontSize:"text-3xl",labelSize:"text-xs"},lg:{dimension:160,strokeWidth:10,fontSize:"text-4xl",labelSize:"text-sm"}},D={ok:{stroke:"#22C55E",glow:"rgba(34, 197, 94, 0.4)"},warning:{stroke:"#EAB308",glow:"rgba(234, 179, 8, 0.4)"},error:{stroke:"#EF4444",glow:"rgba(239, 68, 68, 0.4)"}};function G({passed:s,total:t,status:r,size:o="md"}){const n=B[o],d=D[r],i=t>0?Math.round(s/t*100):0,a=(n.dimension-n.strokeWidth)/2,c=2*Math.PI*a,f=c-i/100*c,x=n.dimension/2;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[e.jsxs("svg",{width:n.dimension,height:n.dimension,className:"transform -rotate-90",style:{filter:`drop-shadow(0 0 8px ${d.glow})`},children:[e.jsx("circle",{cx:x,cy:x,r:a,fill:"none",stroke:"currentColor",strokeWidth:n.strokeWidth,className:"text-muted/30"}),e.jsx("circle",{cx:x,cy:x,r:a,fill:"none",stroke:d.stroke,strokeWidth:n.strokeWidth,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f,className:"transition-all duration-1000 ease-out"}),i>0&&e.jsx("circle",{cx:x+a*Math.cos(i/100*2*Math.PI-Math.PI/2),cy:x+a*Math.sin(i/100*2*Math.PI-Math.PI/2),r:n.strokeWidth/2,fill:d.stroke,className:"animate-pulse",style:{filter:`drop-shadow(0 0 4px ${d.glow})`}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:l("font-mono font-bold tracking-tight",n.fontSize),children:i}),e.jsx("span",{className:l("font-mono uppercase tracking-widest text-muted-foreground",n.labelSize),children:"health"})]})]})}function b({label:s,value:t,color:r,bgColor:o}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full animate-pulse",o)}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:s}),e.jsx("span",{className:l("font-mono font-bold text-sm",r),children:t})]})}function L({total:s,passed:t,warnings:r,errors:o,info:n}){const d=t/s*100,i=r/s*100,a=o/s*100,c=n/s*100;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"h-2 rounded-full overflow-hidden bg-muted/50 flex",children:[a>0&&e.jsx("div",{className:"h-full bg-red-500 transition-all duration-500",style:{width:`${a}%`}}),i>0&&e.jsx("div",{className:"h-full bg-yellow-500 transition-all duration-500",style:{width:`${i}%`}}),c>0&&e.jsx("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:`${c}%`}}),d>0&&e.jsx("div",{className:"h-full bg-green-500 transition-all duration-500",style:{width:`${d}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Checks"}),e.jsx("span",{className:"font-mono font-bold text-lg",children:s})]}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsx(b,{label:"OK",value:t,color:"text-green-500",bgColor:"bg-green-500"}),e.jsx(b,{label:"WARN",value:r,color:"text-yellow-500",bgColor:"bg-yellow-500"}),e.jsx(b,{label:"ERR",value:o,color:"text-red-500",bgColor:"bg-red-500"}),e.jsx(b,{label:"INFO",value:n,color:"text-blue-500",bgColor:"bg-blue-500"})]})]})]})}function q(){return R({queryKey:["health"],queryFn:async()=>(await fetch("/api/health")).json(),refetchInterval:3e4})}function K(){const s=E();return M({mutationFn:async t=>{const r=await fetch(`/api/health/fix/${t}`,{method:"POST"}),o=await r.json();if(!r.ok)throw new Error(o.message);return o},onSuccess:t=>{s.invalidateQueries({queryKey:["health"]}),g.success(t.message)},onError:t=>{g.error(t.message)}})}const Q={ok:{dot:"bg-green-500",label:"OK",labelColor:"text-green-500"},warning:{dot:"bg-yellow-500",label:"WARN",labelColor:"text-yellow-500"},error:{dot:"bg-red-500",label:"ERR",labelColor:"text-red-500"},info:{dot:"bg-blue-500",label:"INFO",labelColor:"text-blue-500"}};function U({check:s}){const t=K(),r=Q[s.status],[o,n]=j.useState(!1),d=s.details||s.fix,i=a=>{navigator.clipboard.writeText(a),g.success("Copied to clipboard")};return d?e.jsx(w,{open:o,onOpenChange:n,children:e.jsxs("div",{className:l("group rounded-lg border transition-all duration-150",o?"border-border bg-muted/30":"border-transparent hover:border-border/50 hover:bg-muted/50"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-3 px-3 py-2 text-left",children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),e.jsx(W,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",o&&"rotate-90")})]})}),e.jsx(k,{children:e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 ml-7",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.message}),s.details&&e.jsx("pre",{className:"text-xs font-mono text-muted-foreground bg-background/50 rounded p-2 overflow-x-auto border border-border/50",children:s.details}),s.fix&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-background/50 rounded px-2 py-1.5 border border-border/50",children:[e.jsx(C,{className:"w-3 h-3 text-muted-foreground shrink-0"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>s.fix&&i(s.fix),className:"h-5 w-5 p-0",children:e.jsx(S,{className:"w-3 h-3"})})]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-7 px-3 text-xs",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Apply Fix"]})]})]})})]})}):e.jsxs("div",{className:l("group flex items-center gap-3 px-3 py-2 rounded-lg","hover:bg-muted/50 transition-colors duration-150","border border-transparent hover:border-border/50"),children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",variant:"ghost",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-6 px-2 text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Fix"]})]})}const Z={Monitor:I,Settings:F,Users:$,Shield:O,Zap:P};function V({group:s,defaultOpen:t=!0}){const[r,o]=j.useState(t),n=Z[s.icon]||I,d=s.checks.filter(m=>m.status==="ok").length,i=s.checks.length,a=s.checks.some(m=>m.status==="error"),c=s.checks.some(m=>m.status==="warning"),f=Math.round(d/i*100),x=a?"text-red-500":c?"text-yellow-500":"text-green-500",u=a?"bg-red-500":c?"bg-yellow-500":"bg-green-500";return e.jsx(w,{open:r,onOpenChange:o,children:e.jsxs("div",{className:l("rounded-lg border transition-all duration-200",a?"border-red-500/30":c?"border-yellow-500/30":"border-border"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:l("w-full flex items-center gap-3 p-3 text-left rounded-lg","hover:bg-muted/50 transition-colors duration-150",r&&"rounded-b-none border-b border-border/50"),children:[e.jsx("div",{className:l("p-1.5 rounded-md",a?"bg-red-500/10 text-red-500":c?"bg-yellow-500/10 text-yellow-500":"bg-muted text-muted-foreground"),children:e.jsx(n,{className:"w-4 h-4"})}),e.jsx("span",{className:"flex-1 text-sm font-semibold",children:s.name}),!r&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("div",{className:"w-16 h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:l("h-full transition-all duration-500",u),style:{width:`${f}%`}})})}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",x),children:[d,"/",i]}),e.jsx(H,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",r&&"rotate-180")})]})}),e.jsx(k,{children:e.jsx("div",{className:"p-2 space-y-0.5",children:s.checks.map(m=>e.jsx(U,{check:m},m.id))})})]})})}function Y(s){return s.errors>0?"error":s.warnings>0?"warning":"ok"}function J(s){const t=Math.floor((Date.now()-s)/1e3);if(t<5)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function X(s){return[...s].sort((t,r)=>{const o=t.checks.filter(a=>a.status==="error").length,n=r.checks.filter(a=>a.status==="error").length,d=t.checks.filter(a=>a.status==="warning").length,i=r.checks.filter(a=>a.status==="warning").length;return o!==n?n-o:i-d})}function _(){return e.jsxs("div",{className:"font-mono text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"$"}),e.jsx("span",{children:"ccs doctor"})]})}function ee(){return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsx("div",{className:"rounded-xl border bg-gradient-to-br from-background to-muted/20 p-6",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(h,{className:"w-[120px] h-[120px] rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(h,{className:"h-5 w-48"}),e.jsx(h,{className:"h-8 w-64"}),e.jsx(h,{className:"h-4 w-32"})]})]})}),e.jsx(h,{className:"h-16 w-full rounded-lg"}),e.jsx("div",{className:"space-y-3",children:[1,2,3,4].map(s=>e.jsx(h,{className:"h-20 rounded-lg"},s))})]})}function ce(){const{data:s,isLoading:t,refetch:r,dataUpdatedAt:o}=q(),n=o,[d,i]=j.useState(0);j.useEffect(()=>{const u=setInterval(()=>i(m=>m+1),1e3);return()=>clearInterval(u)},[]);const a=()=>{navigator.clipboard.writeText("ccs doctor"),g.success("Copied to clipboard")},c=()=>{r(),g.info("Refreshing health checks...")};if(t&&!s)return e.jsx(ee,{});const f=s?Y(s.summary):"ok",x=s?.groups?X(s.groups):[];return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsxs("div",{className:l("relative overflow-hidden rounded-xl border p-6","bg-gradient-to-br from-background via-background to-muted/30"),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, currentColor 2px, currentColor 3px)"}}),e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-start md:items-center gap-6",children:[s&&e.jsx("div",{className:"shrink-0",children:e.jsx(G,{passed:s.summary.passed,total:s.summary.total-s.summary.info,status:f,size:"md"})}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(_,{}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"text-2xl font-bold font-mono tracking-tight",children:"System Health"}),s?.version&&e.jsxs(z,{variant:"outline",className:"font-mono text-xs bg-muted/50",children:["build ",s.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(T,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Last scan:"}),e.jsx("span",{className:"font-mono",children:n?J(n):"--"}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsx("span",{className:"text-muted-foreground",children:"Auto-refresh:"}),e.jsx("span",{className:"font-mono text-green-500",children:"30s"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(p,{variant:"outline",size:"sm",onClick:a,className:"gap-2 font-mono text-xs",children:[e.jsx(C,{className:"w-3 h-3"}),"ccs doctor",e.jsx(S,{className:"w-3 h-3 opacity-50"})]}),e.jsxs(p,{variant:"outline",size:"sm",onClick:c,disabled:t,className:"gap-2",children:[e.jsx(A,{className:l("w-4 h-4",t&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"}),e.jsx("kbd",{className:"hidden md:inline-flex h-5 items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"R"})]})]})]})]}),s&&e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsx(L,{total:s.summary.total,passed:s.summary.passed,warnings:s.summary.warnings,errors:s.summary.errors,info:s.summary.info})}),x.length>0&&e.jsx("div",{className:"space-y-3",children:x.map((u,m)=>e.jsx(V,{group:u,defaultOpen:m<2||u.checks.some(N=>N.status==="error"||N.status==="warning")},u.id))}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground border-t pt-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{children:["Version ",e.jsx("span",{className:"font-mono",children:s?.version??"--"})]}),e.jsxs("span",{children:["Platform"," ",e.jsx("span",{className:"font-mono",children:typeof navigator<"u"?navigator.platform:"linux"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),e.jsx("span",{children:"Live monitoring active"})]})]})]})}export{ce as HealthPage};
|
|
1
|
+
import{j as e}from"./radix-ui-DIWAxjEp.js";import{c as l,b as p,K as w,M as y,N as k,B as z,S as h}from"./index-PWMOllOf.js";import{u as M,a as R,b as W}from"./tanstack-Hn82hibe.js";import{t as g}from"./notifications-B2HqRBj7.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{ay as v,b as E,y as C,l as S,Z as P,f as O,U as $,S as H,az as I,V as T,x as F,R as A}from"./icons-Dk2sL3Mr.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";const B={sm:{dimension:80,strokeWidth:6,fontSize:"text-lg",labelSize:"text-[10px]"},md:{dimension:120,strokeWidth:8,fontSize:"text-3xl",labelSize:"text-xs"},lg:{dimension:160,strokeWidth:10,fontSize:"text-4xl",labelSize:"text-sm"}},D={ok:{stroke:"#22C55E",glow:"rgba(34, 197, 94, 0.4)"},warning:{stroke:"#EAB308",glow:"rgba(234, 179, 8, 0.4)"},error:{stroke:"#EF4444",glow:"rgba(239, 68, 68, 0.4)"}};function K({passed:s,total:t,status:r,size:o="md"}){const n=B[o],d=D[r],i=t>0?Math.round(s/t*100):0,a=(n.dimension-n.strokeWidth)/2,c=2*Math.PI*a,f=c-i/100*c,x=n.dimension/2;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[e.jsxs("svg",{width:n.dimension,height:n.dimension,className:"transform -rotate-90",style:{filter:`drop-shadow(0 0 8px ${d.glow})`},children:[e.jsx("circle",{cx:x,cy:x,r:a,fill:"none",stroke:"currentColor",strokeWidth:n.strokeWidth,className:"text-muted/30"}),e.jsx("circle",{cx:x,cy:x,r:a,fill:"none",stroke:d.stroke,strokeWidth:n.strokeWidth,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f,className:"transition-all duration-1000 ease-out"}),i>0&&e.jsx("circle",{cx:x+a*Math.cos(i/100*2*Math.PI-Math.PI/2),cy:x+a*Math.sin(i/100*2*Math.PI-Math.PI/2),r:n.strokeWidth/2,fill:d.stroke,className:"animate-pulse",style:{filter:`drop-shadow(0 0 4px ${d.glow})`}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:l("font-mono font-bold tracking-tight",n.fontSize),children:i}),e.jsx("span",{className:l("font-mono uppercase tracking-widest text-muted-foreground",n.labelSize),children:"health"})]})]})}function b({label:s,value:t,color:r,bgColor:o}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full animate-pulse",o)}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:s}),e.jsx("span",{className:l("font-mono font-bold text-sm",r),children:t})]})}function L({total:s,passed:t,warnings:r,errors:o,info:n}){const d=t/s*100,i=r/s*100,a=o/s*100,c=n/s*100;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"h-2 rounded-full overflow-hidden bg-muted/50 flex",children:[a>0&&e.jsx("div",{className:"h-full bg-red-500 transition-all duration-500",style:{width:`${a}%`}}),i>0&&e.jsx("div",{className:"h-full bg-yellow-500 transition-all duration-500",style:{width:`${i}%`}}),c>0&&e.jsx("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:`${c}%`}}),d>0&&e.jsx("div",{className:"h-full bg-green-500 transition-all duration-500",style:{width:`${d}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Checks"}),e.jsx("span",{className:"font-mono font-bold text-lg",children:s})]}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsx(b,{label:"OK",value:t,color:"text-green-500",bgColor:"bg-green-500"}),e.jsx(b,{label:"WARN",value:r,color:"text-yellow-500",bgColor:"bg-yellow-500"}),e.jsx(b,{label:"ERR",value:o,color:"text-red-500",bgColor:"bg-red-500"}),e.jsx(b,{label:"INFO",value:n,color:"text-blue-500",bgColor:"bg-blue-500"})]})]})]})}function q(){return M({queryKey:["health"],queryFn:async()=>(await fetch("/api/health")).json(),refetchInterval:3e4})}function G(){const s=R();return W({mutationFn:async t=>{const r=await fetch(`/api/health/fix/${t}`,{method:"POST"}),o=await r.json();if(!r.ok)throw new Error(o.message);return o},onSuccess:t=>{s.invalidateQueries({queryKey:["health"]}),g.success(t.message)},onError:t=>{g.error(t.message)}})}const Q={ok:{dot:"bg-green-500",label:"OK",labelColor:"text-green-500"},warning:{dot:"bg-yellow-500",label:"WARN",labelColor:"text-yellow-500"},error:{dot:"bg-red-500",label:"ERR",labelColor:"text-red-500"},info:{dot:"bg-blue-500",label:"INFO",labelColor:"text-blue-500"}};function U({check:s}){const t=G(),r=Q[s.status],[o,n]=j.useState(!1),d=s.details||s.fix,i=a=>{navigator.clipboard.writeText(a),g.success("Copied to clipboard")};return d?e.jsx(w,{open:o,onOpenChange:n,children:e.jsxs("div",{className:l("group rounded-lg border transition-all duration-150",o?"border-border bg-muted/30":"border-transparent hover:border-border/50 hover:bg-muted/50"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-3 px-3 py-2 text-left",children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),e.jsx(E,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",o&&"rotate-90")})]})}),e.jsx(k,{children:e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 ml-7",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.message}),s.details&&e.jsx("pre",{className:"text-xs font-mono text-muted-foreground bg-background/50 rounded p-2 overflow-x-auto border border-border/50",children:s.details}),s.fix&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-background/50 rounded px-2 py-1.5 border border-border/50",children:[e.jsx(C,{className:"w-3 h-3 text-muted-foreground shrink-0"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>s.fix&&i(s.fix),className:"h-5 w-5 p-0",children:e.jsx(S,{className:"w-3 h-3"})})]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-7 px-3 text-xs",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Apply Fix"]})]})]})})]})}):e.jsxs("div",{className:l("group flex items-center gap-3 px-3 py-2 rounded-lg","hover:bg-muted/50 transition-colors duration-150","border border-transparent hover:border-border/50"),children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",variant:"ghost",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-6 px-2 text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Fix"]})]})}const V={Monitor:I,Settings:H,Users:$,Shield:O,Zap:P};function Z({group:s,defaultOpen:t=!0}){const[r,o]=j.useState(t),n=V[s.icon]||I,d=s.checks.filter(m=>m.status==="ok").length,i=s.checks.length,a=s.checks.some(m=>m.status==="error"),c=s.checks.some(m=>m.status==="warning"),f=Math.round(d/i*100),x=a?"text-red-500":c?"text-yellow-500":"text-green-500",u=a?"bg-red-500":c?"bg-yellow-500":"bg-green-500";return e.jsx(w,{open:r,onOpenChange:o,children:e.jsxs("div",{className:l("rounded-lg border transition-all duration-200",a?"border-red-500/30":c?"border-yellow-500/30":"border-border"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:l("w-full flex items-center gap-3 p-3 text-left rounded-lg","hover:bg-muted/50 transition-colors duration-150",r&&"rounded-b-none border-b border-border/50"),children:[e.jsx("div",{className:l("p-1.5 rounded-md",a?"bg-red-500/10 text-red-500":c?"bg-yellow-500/10 text-yellow-500":"bg-muted text-muted-foreground"),children:e.jsx(n,{className:"w-4 h-4"})}),e.jsx("span",{className:"flex-1 text-sm font-semibold",children:s.name}),!r&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("div",{className:"w-16 h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:l("h-full transition-all duration-500",u),style:{width:`${f}%`}})})}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",x),children:[d,"/",i]}),e.jsx(T,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",r&&"rotate-180")})]})}),e.jsx(k,{children:e.jsx("div",{className:"p-2 space-y-0.5",children:s.checks.map(m=>e.jsx(U,{check:m},m.id))})})]})})}function J(s){return s.errors>0?"error":s.warnings>0?"warning":"ok"}function X(s){const t=Math.floor((Date.now()-s)/1e3);if(t<5)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function Y(s){return[...s].sort((t,r)=>{const o=t.checks.filter(a=>a.status==="error").length,n=r.checks.filter(a=>a.status==="error").length,d=t.checks.filter(a=>a.status==="warning").length,i=r.checks.filter(a=>a.status==="warning").length;return o!==n?n-o:i-d})}function _(){return e.jsxs("div",{className:"font-mono text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"$"}),e.jsx("span",{children:"ccs doctor"})]})}function ee(){return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsx("div",{className:"rounded-xl border bg-gradient-to-br from-background to-muted/20 p-6",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(h,{className:"w-[120px] h-[120px] rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(h,{className:"h-5 w-48"}),e.jsx(h,{className:"h-8 w-64"}),e.jsx(h,{className:"h-4 w-32"})]})]})}),e.jsx(h,{className:"h-16 w-full rounded-lg"}),e.jsx("div",{className:"space-y-3",children:[1,2,3,4].map(s=>e.jsx(h,{className:"h-20 rounded-lg"},s))})]})}function ce(){const{data:s,isLoading:t,refetch:r,dataUpdatedAt:o}=q(),n=o,[d,i]=j.useState(0);j.useEffect(()=>{const u=setInterval(()=>i(m=>m+1),1e3);return()=>clearInterval(u)},[]);const a=()=>{navigator.clipboard.writeText("ccs doctor"),g.success("Copied to clipboard")},c=()=>{r(),g.info("Refreshing health checks...")};if(t&&!s)return e.jsx(ee,{});const f=s?J(s.summary):"ok",x=s?.groups?Y(s.groups):[];return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsxs("div",{className:l("relative overflow-hidden rounded-xl border p-6","bg-gradient-to-br from-background via-background to-muted/30"),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, currentColor 2px, currentColor 3px)"}}),e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-start md:items-center gap-6",children:[s&&e.jsx("div",{className:"shrink-0",children:e.jsx(K,{passed:s.summary.passed,total:s.summary.total-s.summary.info,status:f,size:"md"})}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(_,{}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"text-2xl font-bold font-mono tracking-tight",children:"System Health"}),s?.version&&e.jsxs(z,{variant:"outline",className:"font-mono text-xs bg-muted/50",children:["build ",s.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Last scan:"}),e.jsx("span",{className:"font-mono",children:n?X(n):"--"}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsx("span",{className:"text-muted-foreground",children:"Auto-refresh:"}),e.jsx("span",{className:"font-mono text-green-500",children:"30s"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(p,{variant:"outline",size:"sm",onClick:a,className:"gap-2 font-mono text-xs",children:[e.jsx(C,{className:"w-3 h-3"}),"ccs doctor",e.jsx(S,{className:"w-3 h-3 opacity-50"})]}),e.jsxs(p,{variant:"outline",size:"sm",onClick:c,disabled:t,className:"gap-2",children:[e.jsx(A,{className:l("w-4 h-4",t&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"}),e.jsx("kbd",{className:"hidden md:inline-flex h-5 items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"R"})]})]})]})]}),s&&e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsx(L,{total:s.summary.total,passed:s.summary.passed,warnings:s.summary.warnings,errors:s.summary.errors,info:s.summary.info})}),x.length>0&&e.jsx("div",{className:"space-y-3",children:x.map((u,m)=>e.jsx(Z,{group:u,defaultOpen:m<2||u.checks.some(N=>N.status==="error"||N.status==="warning")},u.id))}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground border-t pt-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{children:["Version ",e.jsx("span",{className:"font-mono",children:s?.version??"--"})]}),e.jsxs("span",{children:["Platform"," ",e.jsx("span",{className:"font-mono",children:typeof navigator<"u"?navigator.platform:"linux"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),e.jsx("span",{children:"Live monitoring active"})]})]})]})}export{ce as HealthPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as h}from"./react-vendor-CNOkPC89.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),s=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),v=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var x={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const m=h.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:d="",children:n,iconNode:r,...y},p)=>h.createElement("svg",{ref:p,...x,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",d),...!n&&!v(y)&&{"aria-hidden":"true"},...y},[...r.map(([i,l])=>h.createElement(i,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=h.forwardRef(({className:o,...d},n)=>h.createElement(m,{ref:n,iconNode:a,className:k(`lucide-${_(s(t))}`,`lucide-${t}`,o),...d}));return c.displayName=s(t),c};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],M2=e("activity",g);const f=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],v2=e("archive",f);const w=[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]],x2=e("arrow-down-left",w);const $=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],m2=e("arrow-down-right",$);const N=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],g2=e("arrow-down",N);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],f2=e("arrow-left",u);const z=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],w2=e("arrow-right",z);const b=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],$2=e("arrow-up-right",b);const q=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],N2=e("arrow-up",q);const C=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],u2=e("book-open",C);const A=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],z2=e("bot",A);const j=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],b2=e("box",j);const H=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],q2=e("brain",H);const V=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],C2=e("bug",V);const L=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],A2=e("calendar-clock",L);const S=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],j2=e("calendar",S);const B=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],H2=e("chart-column",B);const P=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],V2=e("chart-pie",P);const R=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],L2=e("check",R);const E=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],S2=e("chevron-down",E);const D=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],B2=e("chevron-left",D);const F=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],P2=e("chevron-right",F);const U=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],R2=e("chevron-up",U);const G=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],E2=e("circle-alert",G);const O=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],D2=e("circle-check-big",O);const W=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],F2=e("circle-check",W);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],U2=e("circle-question-mark",T);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],G2=e("circle-x",Z);const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],O2=e("circle",I);const K=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],W2=e("clock",K);const X=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],T2=e("cloud",X);const J=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Z2=e("code-xml",J);const Q=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],I2=e("code",Q);const Y=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],K2=e("coins",Y);const e1=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],X2=e("copy",e1);const a1=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],J2=e("cpu",a1);const t1=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Q2=e("database",t1);const c1=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Y2=e("dollar-sign",c1);const o1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],e0=e("download",o1);const n1=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],a0=e("ellipsis",n1);const h1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],t0=e("external-link",h1);const d1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],c0=e("eye-off",d1);const y1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],o0=e("eye",y1);const s1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],n0=e("file-braces",s1);const k1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],h0=e("file-code",k1);const r1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],d0=e("file-down",r1);const p1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],y0=e("file-exclamation-point",p1);const i1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],s0=e("file-text",i1);const l1=[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]],k0=e("folder-code",l1);const _1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],r0=e("folder-open",_1);const M1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],p0=e("gauge",M1);const v1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],i0=e("git-branch",v1);const x1=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],l0=e("github",x1);const m1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],_0=e("globe",m1);const g1=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],M0=e("grip-horizontal",g1);const f1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],v0=e("grip-vertical",f1);const w1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],x0=e("heart",w1);const $1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],m0=e("house",$1);const N1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],g0=e("info",N1);const u1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],f0=e("key-round",u1);const z1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],w0=e("key",z1);const b1=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],$0=e("laptop",b1);const q1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],N0=e("loader-circle",q1);const C1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],u0=e("lock",C1);const A1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],z0=e("log-out",A1);const j1=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],b0=e("megaphone",j1);const H1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],q0=e("monitor",H1);const V1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],C0=e("moon",V1);const L1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],A0=e("network",L1);const S1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],j0=e("package",S1);const B1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],H0=e("panel-left",B1);const P1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],V0=e("pause",P1);const R1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],L0=e("play",R1);const E1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],S0=e("plus",E1);const D1=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],B0=e("power-off",D1);const F1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],P0=e("power",F1);const U1=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],R0=e("radio",U1);const G1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],E0=e("refresh-cw",G1);const O1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],D0=e("rotate-ccw",O1);const W1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],F0=e("rotate-cw",W1);const T1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],U0=e("save",T1);const Z1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],G0=e("search",Z1);const I1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],O0=e("server",I1);const K1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],W0=e("settings-2",K1);const X1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],T0=e("settings",X1);const J1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Z0=e("shield-check",J1);const Q1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],I0=e("shield",Q1);const Y1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],K0=e("sparkles",Y1);const e2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],X0=e("square",e2);const a2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],J0=e("star",a2);const t2=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Q0=e("sun",t2);const c2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Y0=e("terminal",c2);const o2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ee=e("trash-2",o2);const n2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],ae=e("trending-up",n2);const h2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],te=e("triangle-alert",h2);const d2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ce=e("user",d2);const y2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],oe=e("users",y2);const s2=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],ne=e("wand-sparkles",s2);const k2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],he=e("wifi-off",k2);const r2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],de=e("wifi",r2);const p2=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],ye=e("wrench",p2);const i2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],se=e("x",i2);const l2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ke=e("zap",l2);export{S0 as $,M2 as A,u2 as B,H2 as C,$2 as D,c0 as E,r0 as F,p0 as G,m0 as H,g0 as I,x2 as J,w0 as K,N0 as L,C0 as M,s0 as N,y0 as O,H0 as P,M0 as Q,E0 as R,T0 as S,te as T,oe as U,S2 as V,he as W,se as X,R2 as Y,ke as Z,W0 as _,l0 as a,K0 as a0,E2 as a1,_0 as a2,q2 as a3,O0 as a4,v2 as a5,h0 as a6,B2 as a7,u0 as a8,Y2 as a9,z2 as aA,A2 as aB,b0 as aC,j0 as aD,T2 as aE,$0 as aF,b2 as aG,C2 as aH,d0 as aI,F0 as aJ,X0 as aK,g2 as aL,N2 as aM,Q2 as aa,m2 as ab,j2 as ac,K2 as ad,ae,V2 as af,ee as ag,U0 as ah,G0 as ai,ne as aj,Z2 as ak,w2 as al,n0 as am,f2 as an,e0 as ao,J0 as ap,A0 as aq,k0 as ar,a0 as as,U2 as at,i0 as au,P0 as av,B0 as aw,Z0 as ax,ye as ay,q0 as az,P2 as b,Q0 as c,o0 as d,de as e,I0 as f,x0 as g,D2 as h,O2 as i,L2 as j,f0 as k,X2 as l,t0 as m,ce as n,z0 as o,W2 as p,F2 as q,G2 as r,L0 as s,V0 as t,v0 as u,D0 as v,R0 as w,J2 as x,Y0 as y,I2 as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-DIWAxjEp.js";import{r as i}from"./react-vendor-CNOkPC89.js";import{b5 as P,b6 as $,I as F,b7 as U,a_ as _,b0 as z,m as B,b as O}from"./index-PWMOllOf.js";import{S as K}from"./switch-s8pp-m8L.js";import{y as q,j as D,Y,V,m as J,R as y,a1 as X,q as Z,aD as Q}from"./icons-Dk2sL3Mr.js";import"./tanstack-Hn82hibe.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";function ee(){const{state:s}=P(),a=$(),[d,l]=i.useState(""),[o,m]=i.useState(""),[f,h]=i.useState(!1),[j,u]=i.useState(!1),S=i.useCallback(async()=>{try{a.setWebSearchLoading(!0),a.setWebSearchError(null);const t=await fetch("/api/websearch");if(!t.ok)throw new Error("Failed to load WebSearch config");const r=await t.json();a.setWebSearchConfig(r)}catch(t){a.setWebSearchError(t.message)}finally{a.setWebSearchLoading(!1)}},[a]),v=i.useCallback(async()=>{try{a.setWebSearchStatusLoading(!0);const t=await fetch("/api/websearch/status");if(!t.ok)throw new Error("Failed to load status");const r=await t.json();a.setWebSearchStatus(r)}catch{}finally{a.setWebSearchStatusLoading(!1)}},[a]),g=i.useCallback(async t=>{const r=s.webSearchConfig;if(!r)return;const w={...r,...t};a.setWebSearchConfig(w);try{a.setWebSearchSaving(!0),a.setWebSearchError(null);const n=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!n.ok){const k=await n.json();throw new Error(k.error||"Failed to save")}const C=await n.json();a.setWebSearchConfig(C.websearch),a.setWebSearchSuccess(!0),setTimeout(()=>a.setWebSearchSuccess(!1),1500)}catch(n){a.setWebSearchConfig(r),a.setWebSearchError(n.message)}finally{a.setWebSearchSaving(!1)}},[s.webSearchConfig,a]);i.useEffect(()=>{s.webSearchConfig&&(l(s.webSearchConfig.providers?.gemini?.model??"gemini-2.5-flash"),m(s.webSearchConfig.providers?.opencode?.model??"opencode/grok-code"))},[s.webSearchConfig]);const x=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.gemini?.model??"gemini-2.5-flash";if(d!==t){const r=s.webSearchConfig?.providers||{};await g({providers:{...r,gemini:{...r.gemini,model:d}}}),h(!0),setTimeout(()=>h(!1),2e3)}},[d,s.webSearchConfig,g]),p=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(o!==t){const r=s.webSearchConfig?.providers||{};await g({providers:{...r,opencode:{...r.opencode,model:o}}}),u(!0),setTimeout(()=>u(!1),2e3)}},[o,s.webSearchConfig,g]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,geminiModelInput:d,setGeminiModelInput:l,opencodeModelInput:o,setOpencodeModelInput:m,geminiModelSaved:f,opencodeModelSaved:j,fetchConfig:S,fetchStatus:v,saveConfig:g,saveGeminiModel:x,saveOpencodeModel:p}}function A({name:s,label:a,badge:d,badgeColor:l,enabled:o,installed:m,statusLoading:f,saving:h,onToggle:j,modelInput:u,setModelInput:S,onModelBlur:v,modelSaved:g,modelPlaceholder:x,showHint:p,setShowHint:t,installCmd:r,docsUrl:w,hintColor:n}){const C=l==="green"?"bg-green-500/10 text-green-600":l==="blue"?"bg-blue-500/10 text-blue-600":"bg-purple-500/10 text-purple-600",k=n==="amber"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300":n==="blue"?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",E=n==="amber"?"bg-amber-100 dark:bg-amber-900/40":n==="blue"?"bg-blue-100 dark:bg-blue-900/40":"bg-purple-100 dark:bg-purple-900/40",I=n==="amber"?"text-amber-600 dark:text-amber-400":n==="blue"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400",M=s==="opencode"?"OpenCode":s.charAt(0).toUpperCase()+s.slice(1);return e.jsxs("div",{className:`rounded-lg border transition-colors ${o?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:`w-5 h-5 ${o?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:s}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${C}`,children:d}),m?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"installed"}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:"not installed"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})]}),e.jsx(K,{checked:o,onCheckedChange:j,disabled:h||!m})]}),o&&u!==void 0&&S&&v&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Model:"}),e.jsx(F,{value:u,onChange:W=>S(W.target.value),onBlur:v,placeholder:x,className:"h-8 text-sm font-mono",disabled:h}),g&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400 text-xs animate-in fade-in duration-200",children:[e.jsx(D,{className:"w-3.5 h-3.5"}),"Saved"]})]})}),!m&&!f&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>t(!p),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${I}`,children:[p?e.jsx(Y,{className:"w-4 h-4"}):e.jsx(V,{className:"w-4 h-4"}),"How to install ",M," CLI"]}),p&&e.jsxs("div",{className:`mt-2 p-3 rounded-md text-sm ${k}`,children:[e.jsxs("p",{className:"mb-2",children:["Install globally"," ",d==="GROK_API_KEY"?"(requires xAI API key)":"(FREE tier available)",":"]}),e.jsx("code",{className:`text-sm px-2 py-1 rounded font-mono block mb-2 ${E}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(J,{className:"w-3 h-3"}),"View documentation"]})]})]})]})}function me(){const{config:s,status:a,loading:d,statusLoading:l,saving:o,error:m,success:f,geminiModelInput:h,setGeminiModelInput:j,opencodeModelInput:u,setOpencodeModelInput:S,geminiModelSaved:v,opencodeModelSaved:g,fetchConfig:x,fetchStatus:p,saveConfig:t,saveGeminiModel:r,saveOpencodeModel:w}=ee(),{fetchRawConfig:n}=U(),[C,k]=i.useState(!1),[E,I]=i.useState(!1),[M,W]=i.useState(!1);i.useEffect(()=>{x(),p(),n()},[x,p,n]);const N=s?.providers?.gemini?.enabled??!1,G=s?.providers?.grok?.enabled??!1,L=s?.providers?.opencode?.enabled??!1,H=()=>{const c=s?.providers||{},b=c.gemini?.enabled??!1;t({enabled:!b||G||L,providers:{...c,gemini:{...c.gemini,enabled:!b}}})},R=()=>{const c=s?.providers||{},b=c.grok?.enabled??!1;t({enabled:N||!b||L,providers:{...c,grok:{...c.grok,enabled:!b}}})},T=()=>{const c=s?.providers||{},b=c.opencode?.enabled??!1;t({enabled:N||G||!b,providers:{...c,opencode:{...c.opencode,enabled:!b}}})};return d?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(y,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"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 ${m||f?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[m&&e.jsxs(_,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx(z,{children:m})]}),f&&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(Z,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(B,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"CLI-based web search for third-party profiles (gemini, codex, agy, etc.)"}),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:N?"WebSearch enabled":"WebSearch disabled"}),l?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking status..."}):a?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:a.readiness.message}):null]}),e.jsx(O,{variant:"ghost",size:"sm",onClick:p,disabled:l,children:e.jsx(y,{className:`w-4 h-4 ${l?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Providers"}),!a?.geminiCli&&!a?.opencodeCli&&!a?.grokCli&&!l&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed rounded-lg text-center bg-muted/30",children:[e.jsx(Q,{className:"w-12 h-12 text-muted-foreground mb-3 opacity-30"}),e.jsx("p",{className:"font-medium text-foreground mb-1",children:"No providers configured"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Install CLI tools to enable web search providers"}),e.jsxs(O,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"w-4 h-4 mr-2"}),"Check for providers"]})]}),e.jsx(A,{name:"gemini",label:"Google Gemini CLI (1000 req/day free)",badge:"FREE",badgeColor:"green",enabled:N,installed:a?.geminiCli?.installed??!1,statusLoading:l,saving:o,onToggle:H,modelInput:h,setModelInput:j,onModelBlur:r,modelSaved:v,modelPlaceholder:"gemini-2.5-flash",showHint:C,setShowHint:k,installCmd:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli",hintColor:"amber"}),e.jsx(A,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:L,installed:a?.opencodeCli?.installed??!1,statusLoading:l,saving:o,onToggle:T,modelInput:u,setModelInput:S,onModelBlur:w,modelSaved:g,modelPlaceholder:"opencode/grok-code",showHint:E,setShowHint:I,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(A,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:G,installed:a?.grokCli?.installed??!1,statusLoading:l,saving:o,onToggle:R,showHint:M,setShowHint:W,installCmd:"npm install -g @vibe-kit/grok-cli",docsUrl:"https://github.com/superagent-ai/grok-cli",hintColor:"blue"})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(O,{variant:"outline",size:"sm",onClick:()=>{x(),n()},disabled:d||o,className:"w-full",children:[e.jsx(y,{className:`w-4 h-4 mr-2 ${d?"animate-spin":""}`}),"Refresh"]})})]})}export{me as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-DIWAxjEp.js";import{r as d}from"./react-vendor-CNOkPC89.js";import{b5 as ye,b6 as je,W as L,I as T,q as ve,r as Ne,s as ke,t as Ce,v as Y,b as Z,b7 as Pe,b8 as Se,b9 as we,a_ as O,b0 as U,m as Ie}from"./index-PWMOllOf.js";import{S as _}from"./switch-s8pp-m8L.js";import{C as R}from"./default-ports-1QQSffYX.js";import{aE as ee,R as V,e as Ee,q as te,W as Te,a1 as Le,aF as Ae,aG as _e,T as X,aH as Re}from"./icons-Dk2sL3Mr.js";import{P as Be}from"./proxy-status-widget-MlyNgoPh.js";import{t as J}from"./notifications-B2HqRBj7.js";import"./tanstack-Hn82hibe.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DmrIcJav.js";function De(){const{state:t}=ye(),s=je(),[n,m]=d.useState(null),[h,b]=d.useState(null),[g,u]=d.useState(null),[v,N]=d.useState(null),[f,k]=d.useState(null),C=d.useCallback(async()=>{try{s.setProxyLoading(!0),s.setProxyError(null);const l=await L.cliproxyServer.get();s.setProxyConfig(l)}catch(l){s.setProxyError(l.message)}finally{s.setProxyLoading(!1)}},[s]),P=d.useCallback(async l=>{const i=t.proxyConfig;if(!i)return;const p={remote:{...i.remote,...l.remote},fallback:{...i.fallback,...l.fallback},local:{...i.local,...l.local}};s.setProxyConfig(p),s.setProxyTestResult(null);try{s.setProxySaving(!0),s.setProxyError(null);const a=await L.cliproxyServer.update(l);s.setProxyConfig(a),s.setProxySuccess(!0),setTimeout(()=>s.setProxySuccess(!1),1500)}catch(a){s.setProxyConfig(i),s.setProxyError(a.message)}finally{s.setProxySaving(!1)}},[t.proxyConfig,s]),S=d.useCallback(async l=>{const{host:i,port:p,protocol:a,authToken:w}=l;if(!i){s.setProxyError("Host is required");return}try{s.setProxyTesting(!0),s.setProxyError(null),s.setProxyTestResult(null);const o=p?parseInt(p,10):void 0,I=await L.cliproxyServer.test({host:i,port:o||void 0,protocol:a,authToken:w||void 0});s.setProxyTestResult(I)}catch(o){s.setProxyError(o.message)}finally{s.setProxyTesting(!1)}},[s]);return{config:t.proxyConfig,loading:t.proxyLoading,saving:t.proxySaving,error:t.proxyError,success:t.proxySuccess,testResult:t.proxyTestResult,testing:t.proxyTesting,editedHost:n,setEditedHost:m,editedPort:h,setEditedPort:b,editedAuthToken:g,setEditedAuthToken:u,editedManagementKey:v,setEditedManagementKey:N,editedLocalPort:f,setEditedLocalPort:k,fetchConfig:C,saveConfig:P,testConnection:S}}function Me({config:t,saving:s,displayLocalPort:n,setEditedLocalPort:m,onSaveLocalPort:h,onSaveConfig:b}){const g=t.local;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Local Proxy"}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Port"}),e.jsx(T,{type:"text",inputMode:"numeric",value:n,onChange:u=>m(u.target.value.replace(/\D/g,"")),onBlur:h,placeholder:`${R}`,className:"font-mono max-w-32",disabled:s})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Auto-start"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Start local proxy automatically when needed"})]}),e.jsx(_,{checked:g.auto_start??!0,onCheckedChange:u=>b({local:{...g,auto_start:u}}),disabled:s})]})]})]})}function Ke({config:t,saving:s,testing:n,testResult:m,displayHost:h,displayPort:b,displayAuthToken:g,displayManagementKey:u,setEditedHost:v,setEditedPort:N,setEditedAuthToken:f,setEditedManagementKey:k,onSaveHost:C,onSavePort:P,onSaveAuthToken:S,onSaveManagementKey:l,onSaveConfig:i,onTestConnection:p}){const a=t.remote,w=o=>o==="https"?443:R;return e.jsxs("div",{className:"space-y-4 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("h4",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ee,{className:"w-4 h-4"}),"Remote Server Configuration"]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Host"}),e.jsx(T,{value:h,onChange:o=>v(o.target.value),onBlur:C,placeholder:"192.168.1.100 or proxy.example.com",className:"font-mono",disabled:s})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm text-muted-foreground",children:["Port"," ",e.jsxs("span",{className:"text-xs opacity-70",children:["(default: ",w(t.remote.protocol||"http"),")"]})]}),e.jsx(T,{type:"text",inputMode:"numeric",value:b,onChange:o=>N(o.target.value.replace(/\D/g,"")),onBlur:P,placeholder:`Leave empty for ${w(t.remote.protocol||"http")}`,className:"font-mono",disabled:s})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Protocol"}),e.jsxs(ve,{value:t.remote.protocol||"http",onValueChange:o=>i({remote:{...a,protocol:o}}),disabled:s,children:[e.jsx(Ne,{children:e.jsx(ke,{})}),e.jsxs(Ce,{children:[e.jsx(Y,{value:"http",children:"HTTP"}),e.jsx(Y,{value:"https",children:"HTTPS"})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"API Key (optional)"}),e.jsx(T,{type:"password",value:g,onChange:o=>f(o.target.value),onBlur:S,placeholder:"For /v1/* API endpoints",className:"font-mono",disabled:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for API requests to /v1/chat/completions"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Management Key (optional)"}),e.jsx(T,{type:"password",value:u,onChange:o=>k(o.target.value),onBlur:l,placeholder:"For /v0/management/* endpoints",className:"font-mono",disabled:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for dashboard management APIs. Falls back to API Key if not set."})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(Z,{onClick:p,disabled:n||!h,variant:"outline",className:"w-full",children:n?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"w-4 h-4 mr-2"}),"Test Connection"]})}),m&&e.jsx("div",{className:`p-3 rounded-md ${m.reachable?"bg-green-50 border border-green-200 dark:bg-green-900/20 dark:border-green-900/50":"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50"}`,children:e.jsx("div",{className:"flex items-center gap-2",children:m.reachable?e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsxs("span",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:["Connected (",m.latencyMs,"ms)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Te,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:m.error||"Connection failed"})]})})})]})]})}const Q="ccs_debug_mode",Fe=["kiro","ghcp"];function Ze(){const{config:t,loading:s,saving:n,error:m,success:h,testResult:b,testing:g,editedHost:u,setEditedHost:v,editedPort:N,setEditedPort:f,editedAuthToken:k,setEditedAuthToken:C,editedManagementKey:P,setEditedManagementKey:S,editedLocalPort:l,setEditedLocalPort:i,fetchConfig:p,saveConfig:a,testConnection:w}=De(),{fetchRawConfig:o}=Pe(),[I,se]=d.useState(()=>{try{return localStorage.getItem(Q)==="true"}catch{return!1}}),re=r=>{se(r);try{localStorage.setItem(Q,String(r))}catch{}},[y,B]=d.useState("plus"),[ae,oe]=d.useState(!1),D=Se(),{data:ne}=we(),G=ne?.running??!1,M=d.useCallback(async()=>{try{const r=await L.cliproxyServer.getBackend();B(r.backend)}catch(r){console.error("[Proxy] Failed to fetch backend:",r)}},[]),K=d.useCallback(async()=>{try{const c=(await L.cliproxy.list()).variants.some(be=>Fe.includes(be.provider));oe(c)}catch(r){console.error("[Proxy] Failed to check variants:",r)}},[]),W=r=>{const c=y;B(r),D.mutate({backend:r},{onError:()=>{B(c)}})};if(d.useEffect(()=>{if(I&&t){const r={...t,remote:{...t.remote,auth_token:t.remote.auth_token?"[REDACTED]":void 0,management_key:t.remote.management_key?"[REDACTED]":void 0}};console.log("[CCS Debug] Debug mode enabled - proxy config:",r)}},[I,t]),d.useEffect(()=>{p(),o(),M(),K()},[p,o,M,K]),s||!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(V,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})});const x=t.remote.enabled??!1,A=!x&&G,j=t.remote,E=t.fallback,le=t.remote.host??"",ce=t.remote.port!==void 0?t.remote.port.toString():"",de=t.remote.auth_token??"",ie=t.remote.management_key??"",me=(t.local.port??R).toString(),F=u??le,H=N??ce,$=k??de,q=P??ie,z=l??me,xe=()=>{const r=u??F;r!==t.remote.host&&a({remote:{...j,host:r}}),v(null)},ue=()=>{const r=(N??H).trim();if(r===""){t.remote.port!==void 0&&a({remote:{...j,port:void 0}}),f(null);return}const c=Number(r);if(!Number.isInteger(c)||c<1||c>65535){J.error("Port must be an integer between 1 and 65535, or empty for default"),f(null);return}c!==t.remote.port&&a({remote:{...j,port:c}}),f(null)},pe=()=>{const r=k??$;r!==t.remote.auth_token&&a({remote:{...j,auth_token:r}}),C(null)},he=()=>{const r=P??q;r!==t.remote.management_key&&a({remote:{...j,management_key:r||void 0}}),S(null)},ge=()=>{const r=(l??z).trim(),c=r===""?R:Number(r);if(!Number.isInteger(c)||c<1||c>65535){J.error("Local port must be an integer between 1 and 65535"),i(null);return}c!==t.local.port&&a({local:{...t.local,port:c}}),i(null)},fe=()=>{w({host:F,port:H,protocol:t.remote.protocol||"http",authToken:$})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${m||h?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[m&&e.jsxs(O,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(Le,{className:"h-4 w-4"}),e.jsx(U,{children:m})]}),h&&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(te,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(Ie,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Configure local or remote ",y==="plus"?"CLIProxy Plus":"CLIProxy"," connection for proxy-based profiles"]}),!x&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Instance Status"}),e.jsx(Be,{})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Connection Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>a({remote:{...j,enabled:!1}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${x?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(Ae,{className:`w-5 h-5 ${x?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:"Local"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run ",y==="plus"?"CLIProxy Plus":"CLIProxy"," binary on this machine"]})]}),e.jsxs("button",{onClick:()=>a({remote:{...j,enabled:!0}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${x?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(ee,{className:`w-5 h-5 ${x?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:"Remote"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connect to a remote ",y==="plus"?"CLIProxy Plus":"CLIProxy"," server"]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(_e,{className:"w-4 h-4"}),"Backend Binary"]}),!x&&G&&e.jsxs(O,{className:"py-2 border-amber-200 bg-amber-50 dark:border-amber-900/50 dark:bg-amber-900/20 [&>svg]:top-2.5",children:[e.jsx(X,{className:"h-4 w-4 text-amber-600"}),e.jsx(U,{className:"text-amber-700 dark:text-amber-400",children:"Stop the running proxy in Instance Status to switch backend."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>W("plus"),disabled:D.isPending||A,className:`p-4 rounded-lg border-2 text-left transition-all ${y==="plus"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${A?"opacity-60 cursor-not-allowed":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"font-medium",children:"CLIProxyAPIPlus"}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400",children:"Default"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Full provider support including Kiro and GitHub Copilot"})]}),e.jsxs("button",{onClick:()=>W("original"),disabled:D.isPending||A,className:`p-4 rounded-lg border-2 text-left transition-all ${y==="original"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${A?"opacity-60 cursor-not-allowed":""}`,children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("span",{className:"font-medium",children:"CLIProxyAPI"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Original binary (Gemini, Codex, Antigravity only)"})]})]}),y==="original"&&ae&&e.jsxs(O,{variant:"destructive",className:"py-2",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx(U,{children:"Existing Kiro/Copilot variants will not work with CLIProxyAPI. Switch to CLIProxyAPIPlus or remove those variants."})]})]}),x&&e.jsx(Ke,{config:t,saving:n,testing:g,testResult:b,displayHost:F,displayPort:H,displayAuthToken:$,displayManagementKey:q,setEditedHost:v,setEditedPort:f,setEditedAuthToken:C,setEditedManagementKey:S,onSaveHost:xe,onSavePort:ue,onSaveAuthToken:pe,onSaveManagementKey:he,onSaveConfig:a,onTestConnection:fe}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Fallback Settings"}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Enable fallback to local"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use local proxy if remote is unreachable"})]}),e.jsx(_,{checked:E.enabled??!0,onCheckedChange:r=>a({fallback:{...E,enabled:r}}),disabled:n||!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Auto-start local proxy"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically start local proxy on fallback"})]}),e.jsx(_,{checked:E.auto_start??!1,onCheckedChange:r=>a({fallback:{...E,auto_start:r}}),disabled:n||!x||!E.enabled})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Re,{className:"w-4 h-4"}),"Advanced"]}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Debug Mode"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable developer diagnostics in browser console"})]}),e.jsx(_,{checked:I,onCheckedChange:re,disabled:n})]}),I&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 pl-0.5",children:"Debug mode enabled. Check browser console for detailed logs."})]})]}),!x&&e.jsx(Me,{config:t,saving:n,displayLocalPort:z,setEditedLocalPort:i,onSaveLocalPort:ge,onSaveConfig:a})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{p(),o(),M(),K()},disabled:s||n,className:"w-full",children:[e.jsx(V,{className:`w-4 h-4 mr-2 ${s?"animate-spin":""}`}),"Refresh"]})})]})}export{Ze as default};
|