@kaitranntt/ccs 7.69.1-dev.4 → 7.69.1-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/commands/tokens-command.d.ts.map +1 -1
  2. package/dist/commands/tokens-command.js +26 -37
  3. package/dist/commands/tokens-command.js.map +1 -1
  4. package/dist/ui/assets/accounts-DamxGxu1.js +1 -0
  5. package/dist/ui/assets/{alert-dialog-CuN8HTEx.js → alert-dialog-sars2LJq.js} +1 -1
  6. package/dist/ui/assets/{api-CI8RoZ-m.js → api-DHF10LeP.js} +1 -1
  7. package/dist/ui/assets/{auth-section-C49fRTna.js → auth-section-BNmbrWhd.js} +1 -1
  8. package/dist/ui/assets/{backups-section-DeJGo6Co.js → backups-section-DGURGm2o.js} +1 -1
  9. package/dist/ui/assets/channels-B0j9pbpo.js +1 -0
  10. package/dist/ui/assets/{checkbox-DVHcE1RO.js → checkbox-DQIFU7Wu.js} +1 -1
  11. package/dist/ui/assets/claude-extension-qxiVTjYL.js +1 -0
  12. package/dist/ui/assets/{cliproxy-BQuYNZ_b.js → cliproxy-CdvU0y2i.js} +1 -1
  13. package/dist/ui/assets/{cliproxy-ai-providers-Bjx7XtY6.js → cliproxy-ai-providers-zgUBcUcJ.js} +1 -1
  14. package/dist/ui/assets/{cliproxy-control-panel-DoLho1iE.js → cliproxy-control-panel-S6FdJjgh.js} +1 -1
  15. package/dist/ui/assets/codex-B79sHpGl.js +27 -0
  16. package/dist/ui/assets/{confirm-dialog-D_5v8muu.js → confirm-dialog-DwrX5gr_.js} +1 -1
  17. package/dist/ui/assets/{copilot-B4waN1q6.js → copilot-CgE4vyvS.js} +1 -1
  18. package/dist/ui/assets/{cursor-DHHZs05u.js → cursor-rYsOav5G.js} +1 -1
  19. package/dist/ui/assets/{droid-CZePX0Pf.js → droid-CQlRU59Q.js} +1 -1
  20. package/dist/ui/assets/{globalenv-section-nQDFHMda.js → globalenv-section-DSQ3m4Ei.js} +1 -1
  21. package/dist/ui/assets/{health-BfS7V7RZ.js → health-DE-wdzdl.js} +1 -1
  22. package/dist/ui/assets/{index-EboJtDBz.js → index-BcJqrfhu.js} +1 -1
  23. package/dist/ui/assets/{index-C5CFzca_.js → index-BwtPYSbP.js} +1 -1
  24. package/dist/ui/assets/{index-CRiWOwLR.js → index-C5VFMOG4.js} +1 -1
  25. package/dist/ui/assets/index-CqJW-L_1.js +1 -0
  26. package/dist/ui/assets/{index-B9VMppQ3.js → index-D1jFmelj.js} +1 -1
  27. package/dist/ui/assets/index-g2g1k0QS.js +72 -0
  28. package/dist/ui/assets/{logs-GW0Oy6XF.js → logs-CDpci_AI.js} +1 -1
  29. package/dist/ui/assets/{masked-input-D1Ilmeh7.js → masked-input-DXzbXJrE.js} +1 -1
  30. package/dist/ui/assets/{proxy-status-widget-Bdh67BxQ.js → proxy-status-widget-DCQBVSBP.js} +1 -1
  31. package/dist/ui/assets/{raw-json-settings-editor-panel-DwzGE_kH.js → raw-json-settings-editor-panel-Db_WTo0f.js} +1 -1
  32. package/dist/ui/assets/{searchable-select-DbhlbNK0.js → searchable-select-CHzzY0Km.js} +1 -1
  33. package/dist/ui/assets/{separator-DziIoy6O.js → separator-Bd4OFZm5.js} +1 -1
  34. package/dist/ui/assets/{shared-XJ2EhJPB.js → shared-B8K097LC.js} +1 -1
  35. package/dist/ui/assets/{table-D5bWyv-8.js → table-7IypCMku.js} +1 -1
  36. package/dist/ui/assets/updates-4X5hHhUg.js +1 -0
  37. package/dist/ui/index.html +1 -1
  38. package/package.json +1 -1
  39. package/dist/ui/assets/accounts-D7sfwYrK.js +0 -1
  40. package/dist/ui/assets/channels-CEHW5H6N.js +0 -1
  41. package/dist/ui/assets/claude-extension-CLmICnx_.js +0 -1
  42. package/dist/ui/assets/codex-BDfvFO8E.js +0 -27
  43. package/dist/ui/assets/index-BDfXfBTa.js +0 -72
  44. package/dist/ui/assets/index-yt8jgaSK.js +0 -1
  45. package/dist/ui/assets/updates-ClhhaqwU.js +0 -1
  46. package/scripts/github/build-ai-review-packet.mjs +0 -242
  47. package/scripts/github/normalize-ai-review-output.mjs +0 -934
  48. package/scripts/github/prepare-ai-review-scope.mjs +0 -324
  49. package/scripts/github/run-ai-review-direct.mjs +0 -349
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as c,L as de}from"./react-vendor-CNOkPC89.js";import{c as n,L as f,aF as P,r as oe,s as ce,t as me,v as xe,w as S,I as R,d as v,a as k,n as E,Q as J,R as $,U as I,V as Q,Y as _,C as w,j as C,S as u,b as D,bl as ue}from"./index-BDfXfBTa.js";import{a7 as pe,aG as ge,at as he,Q as be,A as O,$ as z,am as A,_ as fe,aD as ve,aY as je,Y as Ne,ah as ye,L as we,aZ as ke,a6 as Z,Z as M,au as Se,a_ as Ce,i as Le,R as X,d as q,a$ as _e,ag as ee,C as re}from"./icons-KVCk4_U8.js";import{u as F,a as Ee,b as Ie,k as Qe}from"./tanstack-CrmUhA7Z.js";import{t as W}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function K(r,s){const t=Number.parseInt(r,10);return Number.isNaN(t)?s:Math.max(0,t)}function V({config:r,onSave:s,isPending:t}){const[d,o]=c.useState(r);c.useEffect(()=>{o(r)},[r]);const x=c.useMemo(()=>JSON.stringify(d)!==JSON.stringify(r),[r,d]);return e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl border-2 border-border/60 bg-card/40 p-1 shadow-lg transition-all hover:border-border",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border bg-muted/30 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-primary/5 border border-primary/20",children:e.jsx(pe,{className:"h-3.5 w-3.5 text-primary"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground",children:"Logging Policy"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.1em] text-foreground/45",children:"Retention and privacy"})]})]}),e.jsx("div",{className:n("h-1.5 w-1.5 rounded-full",r.enabled?"bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]":"bg-zinc-500")})]}),e.jsxs("div",{className:"space-y-6 p-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/50 p-3 flex flex-col gap-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70",children:"Active Status"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:n("text-[11px] font-semibold uppercase tracking-[0.1em]",r.enabled?"text-emerald-500":"text-zinc-500"),children:r.enabled?"Live":"Off"})})]}),e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/50 p-3 flex flex-col gap-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70",children:"Redaction"}),e.jsx("span",{className:n("text-[11px] font-semibold uppercase tracking-[0.1em]",r.redact?"text-primary":"text-muted-foreground/40"),children:r.redact?"Enforced":"Plain"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl border border-border/40 bg-background/20 px-4 py-3 transition-colors hover:bg-background/40",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"logs-enabled",className:"text-[12px] font-semibold uppercase tracking-[0.12em]",children:"Pipeline"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground/55",children:"Enable structured logging"})]}),e.jsx(P,{id:"logs-enabled",checked:d.enabled,onCheckedChange:i=>o(a=>({...a,enabled:i})),className:"data-[state=checked]:bg-primary"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl border border-border/40 bg-background/20 px-4 py-3 transition-colors hover:bg-background/40",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"logs-redact",className:"text-[12px] font-semibold uppercase tracking-[0.12em]",children:"Masking"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground/55",children:"Sanitize payload data"})]}),e.jsx(P,{id:"logs-redact",checked:d.redact,onCheckedChange:i=>o(a=>({...a,redact:i})),className:"data-[state=checked]:bg-primary"})]})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(ge,{className:"h-3 w-3 text-primary/40"}),e.jsx(f,{htmlFor:"logs-config-level",className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-foreground/70",children:"Minimum Operational Threshold"})]}),e.jsxs(oe,{value:d.level,onValueChange:i=>o(a=>({...a,level:i})),children:[e.jsx(ce,{id:"logs-config-level",className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 text-[12px] font-semibold uppercase tracking-[0.1em] focus:ring-0",children:e.jsx(me,{})}),e.jsxs(xe,{className:"border-2 border-border bg-card",children:[e.jsx(S,{value:"error",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Error Only"}),e.jsx(S,{value:"warn",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Warn + Above"}),e.jsx(S,{value:"info",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Info + Above"}),e.jsx(S,{value:"debug",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Full Debug"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"logs-rotate-mb",className:"px-1 text-[10px] font-semibold uppercase tracking-[0.1em] text-foreground/50",children:"Rotation (MB)"}),e.jsx(R,{id:"logs-rotate-mb",type:"number",min:1,className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 font-mono text-[12px] font-medium focus-visible:ring-0",value:d.rotate_mb,onChange:i=>o(a=>({...a,rotate_mb:K(i.target.value,a.rotate_mb)}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"logs-retain-days",className:"px-1 text-[10px] font-semibold uppercase tracking-[0.1em] text-foreground/50",children:"Retain (Days)"}),e.jsx(R,{id:"logs-retain-days",type:"number",min:1,className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 font-mono text-[12px] font-medium focus-visible:ring-0",value:d.retain_days,onChange:i=>o(a=>({...a,retain_days:K(i.target.value,a.retain_days)}))})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border",children:[e.jsxs(v,{onClick:()=>s(d),disabled:!x||t,className:"h-10 w-full gap-2 rounded-xl bg-primary text-[11px] font-semibold uppercase tracking-[0.14em] shadow-lg shadow-primary/20 transition-all hover:scale-[1.02] active:scale-[0.98]",children:[e.jsx(he,{className:"h-3.5 w-3.5"}),"Commit Changes"]}),e.jsxs(v,{variant:"ghost",onClick:()=>o(r),disabled:!x||t,className:"h-9 gap-2 text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/45 hover:text-foreground",children:[e.jsx(be,{className:"h-3 w-3"}),"Rollback Draft"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between bg-muted/20 px-5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{className:"h-2.5 w-2.5 text-primary/40"}),e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-foreground/30",children:"Operational Logic v3.4"})]}),x&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"h-1 w-1 rounded-full bg-amber-500 animate-pulse"}),e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-amber-500/70",children:"Pending"})]})]})]})}function Fe(r){if(r==null)return"{}";try{return JSON.stringify(r,null,2)}catch{return String(r)}}function Te(r){switch(r){case"error":return"Error";case"warn":return"Warn";case"info":return"Info";case"debug":return"Debug"}}const Re={error:"border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300",warn:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",info:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",debug:"border-zinc-500/30 bg-zinc-500/10 text-zinc-700 dark:text-zinc-300"};function se({level:r,className:s}){return e.jsx("span",{className:n("inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em]",Re[r],s),children:Te(r)})}function L({label:r,value:s,icon:t}){return e.jsxs("div",{className:"group relative flex flex-col gap-1.5 rounded-xl border border-border/40 bg-background/40 p-3 transition-all hover:bg-background/80 hover:shadow-lg hover:shadow-black/5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsx(t,{className:"h-3 w-3 text-primary/40 group-hover:text-primary transition-colors"}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70 transition-colors group-hover:text-primary/60",children:r})]}),e.jsx("div",{className:"h-1 w-1 rounded-full bg-border/40 group-hover:bg-primary/40 transition-colors"})]}),e.jsx("p",{className:"truncate font-mono text-[13px] font-medium tracking-tight text-foreground/85 transition-colors group-hover:text-foreground",children:s})]})}function Y({entry:r,sourceLabel:s}){const{t}=k();return r?e.jsxs("div",{className:"flex h-full flex-col bg-card/30 backdrop-blur-sm animate-in fade-in slide-in-from-right-4 duration-500",children:[e.jsxs("div",{className:"relative shrink-0 border-b border-border bg-card/60 p-6 shadow-sm overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none [background-image:radial-gradient(circle_at_center,var(--primary)_1px,transparent_0)] [background-size:16px_16px]"}),e.jsxs("div",{className:"relative space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{level:r.level,className:"h-5 px-3 shadow-lg shadow-black/5"}),e.jsx("div",{className:"h-4 w-px bg-border/60"}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border bg-background/50 px-3 py-1 shadow-inner",children:[e.jsx(A,{className:"h-3 w-3 text-primary/60"}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/75",children:s??r.source})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-3 w-3 animate-pulse text-emerald-500"}),e.jsx("span",{className:"font-mono text-[11px] font-medium uppercase tracking-[0.12em] text-muted-foreground/45",children:new Date(r.timestamp).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1 w-4 rounded-full bg-primary/40"}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary/65",children:"Event"})]}),e.jsx("h2",{className:"text-[24px] font-semibold tracking-tight text-foreground leading-tight break-words",children:r.event}),e.jsx("div",{className:"rounded-xl border-l-4 border-primary/20 bg-muted/20 p-4 shadow-inner",children:e.jsx("p",{className:"text-[14px] font-medium leading-relaxed text-foreground/85 selection:bg-primary/20",children:r.message})})]})]})]}),e.jsx(E,{className:"flex-1",children:e.jsx("div",{className:"p-6",children:e.jsxs(J,{defaultValue:"details",className:"space-y-8",children:[e.jsxs($,{className:"grid h-auto w-full grid-cols-2 gap-1 rounded-xl border border-border/60 bg-muted/40 p-1",children:[e.jsxs(I,{value:"details",className:"min-w-0 gap-2 rounded-lg px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.1em] transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-sm",children:[e.jsx(fe,{className:"h-3.5 w-3.5"}),t("logsDetailPanel.details")]}),e.jsxs(I,{value:"raw",className:"min-w-0 gap-2 rounded-lg px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.1em] transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-sm",children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),"Raw Context"]})]}),e.jsxs(Q,{value:"details",className:"mt-0 space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsx(L,{label:"Entry Signature",value:r.id.slice(0,16)+"...",icon:je}),e.jsx(L,{label:"Telemetry Origin",value:r.source,icon:A}),e.jsx(L,{label:"Process ID",value:r.processId??"NA",icon:Ne}),e.jsx(L,{label:"Operational Run",value:r.runId?.slice(0,8)??"NA",icon:ye})]}),e.jsxs("div",{className:"relative overflow-hidden rounded-[2rem] border border-border bg-muted/10 p-1 shadow-inner group",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-primary/[0.03] to-transparent h-[200%] -top-full animate-[scan_8s_linear_infinite] pointer-events-none"}),e.jsxs("div",{className:"rounded-[calc(2rem-4px)] border border-dashed border-border/40 bg-background/50 p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/5 border border-primary/20 text-primary shadow-inner",children:e.jsx(z,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary",children:"Automated Summary"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.1em] text-muted-foreground/55",children:"Quick interpretation"})]})]}),e.jsxs("p",{className:"text-[13px] leading-relaxed text-muted-foreground/80 font-medium",children:["This telemetry node was captured from"," ",e.jsx("span",{className:"rounded bg-muted/40 px-1.5 py-0.5 font-semibold text-foreground",children:s??r.source}),"operating at the"," ",e.jsx("span",{className:n("rounded px-1.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.08em]",r.level==="error"?"bg-red-500/10 text-red-500":r.level==="warn"?"bg-amber-500/10 text-amber-500":r.level==="info"?"bg-sky-500/10 text-sky-500":"bg-zinc-500/10 text-zinc-500"),children:r.level})," ","threshold. The operational payload indicates an event state of"," ",e.jsx("span",{className:"font-semibold text-foreground",children:r.event}),"."]})]})]})]}),e.jsx(Q,{value:"raw",className:"mt-0 animate-in fade-in slide-in-from-bottom-2 duration-500",children:e.jsxs("div",{className:"group relative rounded-2xl border-2 border-border bg-zinc-950 p-1 shadow-2xl transition-all hover:border-primary/20",children:[e.jsx("div",{className:"absolute right-4 top-4 z-10 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"rounded-md border border-white/10 bg-white/5 px-2 py-1 text-[9px] font-medium uppercase tracking-[0.12em] text-white/45 backdrop-blur-md",children:"JSON.RAW.MODE"})}),e.jsx(E,{className:"h-[30rem] w-full rounded-xl p-6",children:e.jsx("pre",{className:"font-mono text-[12px] leading-relaxed tracking-tight text-zinc-400 selection:bg-primary/40 selection:text-primary-foreground",children:Fe({id:r.id,timestamp:r.timestamp,level:r.level,source:r.source,event:r.event,message:r.message,processId:r.processId,runId:r.runId,context:r.context??{}})})})]})})]})})}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border bg-muted/5 px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]"}),e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Node Verified"})]}),e.jsx("div",{className:"h-3 w-px bg-border/40"}),e.jsx("span",{className:"text-[10px] font-medium tabular-nums uppercase tracking-[0.12em] text-foreground/35",children:r.id.slice(0,8)})]}),e.jsx("div",{className:"rounded-full bg-primary/5 px-2 py-0.5 border border-primary/10",children:e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-primary/65",children:"CCS-TEC-v3"})})]})]}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center animate-in fade-in duration-1000",children:[e.jsxs("div",{className:"relative mb-8",children:[e.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-primary/5 p-12"}),e.jsx("div",{className:"relative rounded-full border-2 border-dashed border-border/40 p-10 bg-muted/5",children:e.jsx(z,{className:"h-10 w-10 text-muted-foreground/20"})})]}),e.jsxs("div",{className:"max-w-xs space-y-3",children:[e.jsx("h3",{className:"text-[15px] font-semibold uppercase tracking-[0.14em] text-foreground/65",children:"Inspector Standby"}),e.jsx("p",{className:"text-[13px] leading-relaxed text-muted-foreground/55 font-medium",children:"Select a telemetry node from the active data queue to perform deep analysis of its operational context."})]})]})}function H({entries:r,selectedEntryId:s,onSelect:t,sourceLabels:d,isLoading:o,isFetching:x}){const{t:i}=k();return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-background/50 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-card/40 px-6 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-primary shadow-[0_0_12px_rgba(var(--primary),0.6)]"}),e.jsx("h2",{className:"text-[12px] font-semibold uppercase tracking-[0.14em] text-foreground",children:"Live Entry Stream"})]}),e.jsx("div",{className:"h-4 w-px bg-border/60"}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2 py-0.5",children:[e.jsx(O,{className:"h-3 w-3 text-emerald-500"}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-emerald-600",children:"Live telemetry"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[x&&e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1",children:[e.jsx(we,{className:"h-3 w-3 animate-spin text-primary"}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary",children:"Syncing"})]}),e.jsx("span",{className:"font-mono text-[10px] font-medium uppercase tracking-[0.16em] text-foreground/35",children:"NODE.01"})]})]}),e.jsxs("div",{className:"flex items-center gap-0 border-b border-border bg-muted/30 px-0 py-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-foreground/45",children:[e.jsx("div",{className:"w-[6.5rem] shrink-0 px-6",children:i("logsConfig.time")}),e.jsx("div",{className:"w-14 shrink-0 border-l border-border/10 px-2 text-center",children:i("logsConfig.level")}),e.jsx("div",{className:"w-[15rem] shrink-0 border-l border-border/10 px-4",children:i("logsConfig.source")}),e.jsx("div",{className:"flex-1 border-l border-border/10 px-4",children:i("logsConfig.message")}),e.jsx("div",{className:"w-[5.5rem] shrink-0 border-l border-border/10 px-2 text-center",children:i("logsConfig.proc")}),e.jsx("div",{className:"w-[5.5rem] shrink-0 border-l border-border/10 px-3 text-center",children:i("logsConfig.run")}),e.jsx("div",{className:"w-11 shrink-0 border-l border-border/10 px-2 text-center",children:i("logsConfig.open")})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o?e.jsx("div",{className:"space-y-1 p-2",children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15].map(a=>e.jsx("div",{className:"h-10 w-full animate-pulse rounded-lg border border-border/5 bg-muted/20"},a))}):r.length===0?e.jsxs("div",{className:"flex h-full animate-in fade-in duration-1000 flex-col items-center justify-center gap-6 px-8 text-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-muted/5 p-12"}),e.jsx("div",{className:"relative rounded-full border border-dashed border-border/40 bg-muted/5 p-10",children:e.jsx(ke,{className:"h-10 w-10 text-muted-foreground/20"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[13px] font-semibold uppercase tracking-[0.14em] text-foreground/55",children:"No matching entries"}),e.jsx("p",{className:"max-w-[18rem] text-[12px] font-medium leading-relaxed text-muted-foreground/60",children:"Your current source, level, or search filters are hiding the stream. Adjust them to bring entries back into view."})]})]}):e.jsx(E,{className:"h-full",children:e.jsx("div",{className:"flex flex-col",children:r.map(a=>{const m=a.id===s;return e.jsxs("button",{type:"button",onClick:()=>t(a.id),className:n("group relative flex w-full items-center border-b border-border/5 px-0 py-2.5 text-left transition-all duration-150",m?"z-10 bg-primary/[0.08] shadow-[inset_4px_0_0_rgba(var(--primary),1)]":"bg-transparent hover:bg-muted/30"),children:[e.jsx("div",{className:"absolute inset-y-0 left-0 w-1 origin-center scale-y-0 bg-primary transition-transform duration-300 group-hover:scale-y-100"}),e.jsxs("div",{className:"flex w-full items-center gap-0",children:[e.jsx("div",{className:"flex w-[6.5rem] shrink-0 items-center",children:e.jsx("p",{className:n("px-6 font-mono text-[11px] font-semibold tabular-nums transition-colors",m?"text-primary":"text-foreground/60 group-hover:text-foreground"),children:new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})})}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-0",children:[e.jsx("div",{className:"flex w-14 shrink-0 items-center justify-center opacity-80 transition-opacity group-hover:opacity-100",children:e.jsx(se,{level:a.level,className:"origin-center scale-[0.85]"})}),e.jsxs("div",{className:"flex w-[15rem] shrink-0 flex-col gap-0.5 overflow-hidden px-4",children:[e.jsx("span",{className:n("truncate text-[11px] font-semibold uppercase tracking-[0.12em] transition-colors",m?"text-foreground":"text-foreground/50 group-hover:text-foreground/80"),children:d[a.source]??a.source}),e.jsx("span",{className:"truncate text-[10px] font-medium uppercase tracking-[0.1em] text-muted-foreground/55",children:a.event})]}),e.jsx("div",{className:"min-w-0 flex-1 px-4",children:e.jsx("p",{className:n("truncate text-[13px] font-medium leading-5 transition-colors",m?"text-foreground":"text-foreground/70 group-hover:text-foreground"),children:a.message})}),e.jsx("div",{className:"flex w-[5.5rem] shrink-0 items-center justify-center px-2 font-mono text-[10px] font-semibold tabular-nums tracking-[0.12em] text-foreground/30 transition-colors group-hover:text-primary/45",children:a.processId??"????"}),e.jsx("div",{className:"flex w-[5.5rem] shrink-0 items-center justify-center px-3 font-mono text-[10px] font-semibold tabular-nums tracking-[0.12em] text-foreground/30 transition-colors group-hover:text-primary/45",children:a.runId?.slice(0,4).toUpperCase()??"NONE"}),e.jsx("div",{className:"flex w-11 shrink-0 items-center justify-center px-2",children:e.jsx("div",{className:n("flex h-7 w-7 items-center justify-center rounded-full border transition-all",m?"animate-in zoom-in duration-300 border-primary/20 bg-primary/10 text-primary":"border-transparent text-foreground/20 group-hover:border-border/40 group-hover:bg-background/80 group-hover:text-foreground/55"),children:e.jsx(Z,{className:"h-3.5 w-3.5"})})})]})]})]},a.id)})})})}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border bg-muted/5 px-6 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Node: CCS-CORE"}),e.jsx("div",{className:"h-1 w-1 rounded-full bg-border/40"}),e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Status: Operational"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:["Entries: ",r.length]})})]})]})}const ae=["logs","config"],te=["logs","sources"],De=150;function Oe(){const[r,s]=c.useState("all"),[t,d]=c.useState("all"),[o,x]=c.useState(""),[i,a]=c.useState(De),[m,p]=c.useState(null),g=c.useDeferredValue(o.trim()),h=F({queryKey:ae,queryFn:async()=>(await _.logs.getConfig()).logging,refetchInterval:3e4}),j=F({queryKey:te,queryFn:async()=>(await _.logs.getSources()).sources,refetchInterval:15e3}),b=F({queryKey:["logs","entries",r,t,g,i],queryFn:async()=>(await _.logs.getEntries({source:r==="all"?void 0:r,level:t==="all"?void 0:t,search:g||void 0,limit:i})).entries,placeholderData:Qe,refetchInterval:1e4}),l=c.useMemo(()=>{const y=b.data??[];return y.length===0?null:m&&y.some(N=>N.id===m)?m:y[0]?.id??null},[b.data,m]),ie=c.useMemo(()=>(b.data??[]).find(y=>y.id===l)??null,[l,b.data]),le=c.useMemo(()=>(j.data??[]).map(N=>N.lastTimestamp).filter(N=>!!N).sort((N,ne)=>ne.localeCompare(N))[0]??null,[j.data]);return{configQuery:h,sourcesQuery:j,entriesQuery:b,selectedSource:r,setSelectedSource:s,selectedLevel:t,setSelectedLevel:d,search:o,setSearch:x,limit:i,setLimit:a,selectedEntryId:l,setSelectedEntryId:p,selectedEntry:ie,latestTimestamp:le,isInitialLoading:!h.data&&h.isLoading||!j.data&&j.isLoading||!b.data&&b.isLoading}}function Pe(){const r=Ee(),{t:s}=k();return Ie({mutationFn:t=>_.logs.updateConfig(t),onSuccess:async()=>{await Promise.all([r.invalidateQueries({queryKey:ae}),r.invalidateQueries({queryKey:te}),r.invalidateQueries({queryKey:["logs","entries"]})]),W.success(s("toasts.loggingConfigSaved"))},onError:t=>{W.error(t.message||s("toasts.loggingConfigSaveFailed"))}})}function ze(){return[{value:"all",label:"All levels"},{value:"error",label:"Errors"},{value:"warn",label:"Warnings"},{value:"info",label:"Info"},{value:"debug",label:"Debug"}]}function Ae(r){return Object.fromEntries(r.map(s=>[s.source,s.label]))}function U({sources:r,selectedSource:s,onSourceChange:t,selectedLevel:d,onLevelChange:o,search:x,onSearchChange:i,limit:a,onLimitChange:m,onRefresh:p,isRefreshing:g}){const{t:h}=k(),j=ze(),b=[50,100,150,250];return e.jsxs("div",{className:"flex flex-col gap-6 animate-in fade-in slide-in-from-left-2 duration-700",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.5)]"}),e.jsx(f,{htmlFor:"logs-search",className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Payload Search"})]}),e.jsx(M,{className:"h-3 w-3 text-primary/20"})]}),e.jsxs("div",{className:"group relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-3.5 flex items-center transition-all group-focus-within:translate-x-1",children:e.jsx(Se,{className:"h-3.5 w-3.5 text-foreground/20 group-focus-within:text-primary transition-colors"})}),e.jsx(R,{id:"logs-search","aria-label":"Search",value:x,onChange:l=>i(l.target.value),placeholder:"Scan for patterns...",className:"h-11 rounded-xl border-2 border-border/40 bg-background/50 pl-10 text-[13px] font-medium text-foreground placeholder:text-foreground/35 focus-visible:border-primary/40 focus-visible:ring-0 transition-all shadow-inner"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(Ce,{className:"h-3 w-3 text-primary/40"}),e.jsx(f,{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Source Matrix"})]}),e.jsxs("div",{className:"flex flex-col gap-1","aria-label":"Source filter",children:[e.jsxs("button",{type:"button",onClick:()=>t("all"),className:n("group relative flex items-center justify-between rounded-lg border px-3 py-2 transition-all active:scale-[0.98]",s==="all"?"border-primary/50 bg-primary/10 text-primary shadow-[0_0_15px_rgba(var(--primary),0.1)]":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.12em]",children:"Global Stream"}),s==="all"&&e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.8)]"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1 mt-1",children:r.map(l=>e.jsx("button",{type:"button",onClick:()=>t(l.source),className:n("rounded-lg border px-2.5 py-1.5 text-[10px] font-semibold uppercase tracking-[0.1em] transition-all active:scale-[0.97]",s===l.source?"border-primary/50 bg-primary/10 text-primary shadow-sm":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:l.label},l.source))})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(Le,{className:"h-3 w-3 text-primary/40"}),e.jsx(f,{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Sensitivity"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5","aria-label":"Level filter",children:j.map(l=>e.jsxs("button",{type:"button",onClick:()=>o(l.value),className:n("flex flex-col items-center gap-1 rounded-lg border px-2 py-2 text-[10px] font-semibold uppercase tracking-[0.1em] transition-all active:scale-[0.97]",d===l.value?"border-primary/50 bg-primary/10 text-primary shadow-[0_0_15px_rgba(var(--primary),0.1)]":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:[e.jsx("span",{children:l.label}),e.jsx("div",{className:n("h-0.5 w-4 rounded-full transition-colors",d===l.value?"bg-primary":"bg-foreground/10")})]},l.value))})]}),e.jsx("div",{className:"mt-4 rounded-2xl border-2 border-border bg-card/40 p-1.5 shadow-xl shadow-black/5",children:e.jsxs("div",{className:"rounded-[calc(1rem-2px)] border border-dashed border-border bg-background/60 p-4 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-primary",children:"Operational Window"}),e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.1em] text-foreground/45",children:"Tail Capacity"})]}),e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary/5 border border-primary/10 flex items-center justify-center",children:e.jsx(M,{className:"h-4 w-4 text-primary/40"})})]}),e.jsx("div",{className:"grid grid-cols-4 gap-1.5","aria-label":"Visible entries",children:b.map(l=>e.jsx("button",{type:"button",onClick:()=>m(l),className:n("rounded-md border py-1.5 text-[11px] font-semibold tabular-nums transition-all active:scale-[0.95]",a===l?"border-foreground bg-foreground text-background":"border-border/60 bg-muted/40 text-foreground/40 hover:bg-muted hover:text-foreground"),children:l},l))}),e.jsxs(v,{variant:"ghost",size:"sm",className:"group relative h-10 w-full overflow-hidden rounded-xl border-none bg-primary text-[11px] font-semibold uppercase tracking-[0.14em] text-primary-foreground transition-all hover:scale-[1.02] hover:shadow-lg hover:shadow-primary/20 active:scale-[0.98]",onClick:p,children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-1000"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{className:n("h-3.5 w-3.5",g&&"animate-spin")}),e.jsx("span",{children:h("logsConfig.refreshEntries")})]})]})]})})]})}function Me(){const{t:r}=k();return e.jsxs("div",{className:"space-y-6","aria-label":r("logsPageSkeleton.loadingLogs"),children:[e.jsx(w,{className:"gap-4",children:e.jsxs(C,{className:"space-y-3",children:[e.jsx(u,{className:"h-4 w-28"}),e.jsx(u,{className:"h-8 w-72"}),e.jsx(u,{className:"h-4 w-[30rem]"})]})}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[1,2,3,4].map(s=>e.jsx(w,{className:"gap-3",children:e.jsxs(C,{className:"space-y-2",children:[e.jsx(u,{className:"h-4 w-20"}),e.jsx(u,{className:"h-7 w-24"})]})},s))}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1.45fr)_22rem]",children:[e.jsxs(w,{className:"gap-4",children:[e.jsxs(C,{className:"space-y-3",children:[e.jsx(u,{className:"h-4 w-52"}),e.jsx("div",{className:"grid gap-3 md:grid-cols-4",children:[1,2,3,4].map(s=>e.jsx(u,{className:"h-10 w-full"},s))})]}),e.jsxs(D,{className:"grid gap-4 xl:grid-cols-[22rem_minmax(0,1fr)]",children:[e.jsx(u,{className:"h-[26rem] w-full"}),e.jsx(u,{className:"h-[26rem] w-full"})]})]}),e.jsxs(w,{className:"gap-4",children:[e.jsxs(C,{className:"space-y-3",children:[e.jsx(u,{className:"h-5 w-44"}),e.jsx(u,{className:"h-4 w-full"})]}),e.jsx(D,{className:"space-y-4",children:[1,2,3,4].map(s=>e.jsx(u,{className:"h-10 w-full"},s))})]})]})]})}const T=1200,qe=336,We=368,B=52;function G({side:r,label:s,onExpand:t}){return e.jsxs("div",{className:n("flex h-full w-full flex-col items-center justify-center gap-4 bg-muted/5",r==="left"?"border-r border-border":"border-l border-border"),children:[e.jsx(v,{variant:"ghost",size:"icon",onClick:t,"aria-label":`Show ${s.toLowerCase()}`,className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:r==="left"?e.jsx(re,{className:"h-4 w-4"}):e.jsx(ee,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-foreground/45",style:{writingMode:"vertical-rl"},children:s})]})}function Ze(){const r=Oe(),s=Pe(),t=Ae(r.sourcesQuery.data??[]),[d,o]=c.useState(()=>typeof window<"u"?window.innerWidth>=T:!1),[x,i]=c.useState(!1),[a,m]=c.useState(!1);if(c.useEffect(()=>{const g=window.matchMedia(`(min-width: ${T}px)`),h=()=>{o(window.innerWidth>=T)};return h(),g.addEventListener("change",h),()=>g.removeEventListener("change",h)},[]),r.isInitialLoading)return e.jsx(Me,{});const p=r.configQuery.data;return p?e.jsxs("div",{className:"relative flex h-full min-h-full flex-col overflow-hidden border-t border-border/40 bg-background font-sans text-foreground antialiased selection:bg-primary/30 selection:text-primary",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 z-0 opacity-40 [background-image:radial-gradient(circle_at_1px_1px,rgba(38,38,36,0.08)_1px,transparent_0)] [background-size:14px_14px]"}),e.jsxs("div",{className:"relative z-10 flex shrink-0 items-center justify-between border-b border-border/80 bg-card/95 px-6 py-2 backdrop-blur-xl shadow-md transition-all xl:px-8",children:[e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"group flex h-9 w-9 items-center justify-center rounded-xl border-2 border-primary/20 bg-primary/5 text-primary shadow-inner transition-all hover:scale-110 active:scale-90",children:e.jsx(q,{className:"h-4.5 w-4.5 transition-transform group-hover:rotate-6"})}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"rounded-full bg-primary px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-primary-foreground shadow-lg shadow-primary/20",children:"Operational"}),e.jsx("h1",{className:"text-[17px] font-semibold tracking-tight text-foreground",children:"Log Operations Center"})]}),e.jsx("p",{className:"font-mono text-[10px] font-medium uppercase tracking-[0.16em] text-foreground/45",children:"CCS.TOC.LOGS.STREAM.v3"})]})]}),e.jsx("div",{className:"hidden h-8 w-px bg-border/80 md:block"}),e.jsxs("div",{className:"hidden items-center gap-10 md:flex",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:n("h-2 w-2 rounded-full ring-4 transition-all duration-700",p.redact?"bg-emerald-500 shadow-[0_0_20px_rgba(16,185,129,0.6)] ring-emerald-500/30":"bg-zinc-600 ring-transparent")}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/90",children:"Redaction"}),e.jsx("span",{className:"text-[11px] font-medium text-foreground/50",children:p.redact?"Enforced":"Standby"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg border-2 border-border bg-muted shadow-inner",children:e.jsx(_e,{className:"h-3.5 w-3.5 text-foreground"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/90",children:"Retention"}),e.jsxs("span",{className:"text-[11px] font-medium text-foreground/50",children:[p.retain_days,"D / ",p.rotate_mb,"MB"]})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(v,{variant:"ghost",size:"sm",className:"group h-9 gap-3 rounded-xl border-2 border-border bg-muted px-5 text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground transition-all hover:bg-foreground hover:text-background active:scale-95 shadow-lg shadow-black/5",onClick:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),children:[e.jsxs("div",{className:"relative",children:[e.jsx(X,{className:n("h-3.5 w-3.5 transition-transform duration-500",(r.entriesQuery.isFetching||r.sourcesQuery.isFetching)&&"animate-spin")}),!r.entriesQuery.isFetching&&!r.sourcesQuery.isFetching&&e.jsx("div",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full border border-muted bg-primary animate-pulse"})]}),r.entriesQuery.isFetching||r.sourcesQuery.isFetching?"Syncing":"Refresh"]}),e.jsx("div",{className:"h-7 w-px bg-border/80"}),e.jsx(v,{asChild:!0,variant:"ghost",size:"sm",className:"h-9 w-9 rounded-xl border-2 border-border bg-muted p-0 text-foreground transition-all hover:bg-foreground hover:text-background active:scale-95 shadow-lg shadow-black/5",children:e.jsx(de,{to:"/health",children:e.jsx(Z,{className:"h-4 w-4"})})})]})]}),e.jsx("div",{className:"relative z-10 flex min-h-0 flex-1 overflow-hidden",children:e.jsxs(J,{defaultValue:"stream",className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/80 bg-card/80 px-6 py-2 backdrop-blur-xl shadow-inner xl:px-8",children:[e.jsxs($,{className:"h-10 w-auto gap-1.5 rounded-xl border border-border/60 bg-muted/40 p-1",children:[e.jsx(I,{value:"stream",className:"rounded-lg px-5 text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/60 transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-md",children:"Telemetry Stream"}),e.jsx(I,{value:"errors",className:"rounded-lg px-5 text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/60 transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-md",children:"Legacy Errors"})]}),e.jsxs("div",{className:"hidden items-center gap-3 lg:flex",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border bg-muted px-3 py-1 shadow-inner",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.6)]"})]}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-foreground/80",children:"Connected"})]}),e.jsxs("span",{className:"pr-4 text-[11px] font-medium tabular-nums text-foreground/45",children:[r.entriesQuery.data?.length??0," captured"]})]})]}),e.jsx(Q,{value:"stream",className:"m-0 flex min-h-0 flex-1 overflow-y-auto lg:overflow-hidden focus-visible:outline-none",children:d?e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsx("div",{"data-logs-pane":"filters",style:{width:x?B:qe},className:"flex min-h-0 shrink-0 bg-muted/5",children:x?e.jsx(G,{side:"left",label:"Filters",onExpand:()=>i(!1)}):e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col border-r border-border p-5 2xl:p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Filters"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Search, source, and retention controls"})]}),e.jsx(v,{variant:"ghost",size:"icon",onClick:()=>i(!0),"aria-label":"Hide filters",className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:e.jsx(ee,{className:"h-4 w-4"})})]}),e.jsx(E,{className:"min-h-0 flex-1","data-logs-scroll-region":"filters",children:e.jsxs("div",{className:"space-y-5 pr-4",children:[e.jsx(U,{sources:r.sourcesQuery.data??[],selectedSource:r.selectedSource,onSourceChange:r.setSelectedSource,selectedLevel:r.selectedLevel,onLevelChange:r.setSelectedLevel,search:r.search,onSearchChange:r.setSearch,limit:r.limit,onLimitChange:r.setLimit,onRefresh:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),isRefreshing:r.entriesQuery.isFetching||r.sourcesQuery.isFetching}),e.jsx("div",{className:"border-t border-border/20 pt-5",children:e.jsx(V,{config:p,onSave:g=>s.mutate(g),isPending:s.isPending})})]})})]})}),e.jsx("div",{"data-logs-pane":"entries",className:"flex min-h-0 min-w-0 flex-1 overflow-hidden border-l border-r border-border bg-background/95",children:e.jsx(H,{entries:r.entriesQuery.data??[],selectedEntryId:r.selectedEntryId,onSelect:r.setSelectedEntryId,sourceLabels:t,isLoading:r.entriesQuery.isLoading,isFetching:r.entriesQuery.isFetching})}),e.jsx("div",{"data-logs-pane":"details",style:{width:a?B:We},className:"flex min-h-0 shrink-0 bg-muted/5 shadow-inner",children:a?e.jsx(G,{side:"right",label:"Details",onExpand:()=>m(!1)}):e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 bg-background/60 px-3 py-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Details"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Selected entry context and raw payload"})]}),e.jsx(v,{variant:"ghost",size:"icon",onClick:()=>m(!0),"aria-label":"Hide details",className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:e.jsx(re,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{entry:r.selectedEntry,sourceLabel:r.selectedEntry?t[r.selectedEntry.source]:void 0})})]})})]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-border bg-muted/5 p-5",children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(U,{sources:r.sourcesQuery.data??[],selectedSource:r.selectedSource,onSourceChange:r.setSelectedSource,selectedLevel:r.selectedLevel,onLevelChange:r.setSelectedLevel,search:r.search,onSearchChange:r.setSearch,limit:r.limit,onLimitChange:r.setLimit,onRefresh:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),isRefreshing:r.entriesQuery.isFetching||r.sourcesQuery.isFetching}),e.jsx(V,{config:p,onSave:g=>s.mutate(g),isPending:s.isPending})]})}),e.jsx("div",{className:"flex min-h-[32rem] flex-col overflow-hidden border-b border-border bg-background/95",children:e.jsx(H,{entries:r.entriesQuery.data??[],selectedEntryId:r.selectedEntryId,onSelect:r.setSelectedEntryId,sourceLabels:t,isLoading:r.entriesQuery.isLoading,isFetching:r.entriesQuery.isFetching})}),e.jsx("div",{className:"flex min-h-[30rem] flex-col overflow-hidden bg-muted/5 shadow-inner",children:e.jsx(Y,{entry:r.selectedEntry,sourceLabel:r.selectedEntry?t[r.selectedEntry.source]:void 0})})]})}),e.jsx(Q,{value:"errors",className:"m-0 flex-1 overflow-y-auto bg-background/20 p-6 focus-visible:outline-none xl:p-8",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-[2.5rem] border-2 border-border bg-card/40 p-1.5 shadow-2xl shadow-black/10",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none [background-image:radial-gradient(circle_at_center,var(--primary)_1px,transparent_0)] [background-size:24px_24px]"}),e.jsx(w,{className:"rounded-[calc(2.5rem-0.375rem)] border-none bg-background/60 shadow-none overflow-hidden backdrop-blur-md",children:e.jsxs(D,{className:"flex flex-col gap-6 p-10",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl border-2 border-primary/20 bg-primary/10 text-primary shadow-inner",children:e.jsx(q,{className:"h-5 w-5"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-[0.4em] text-primary",children:"Legacy Diagnostic Node"}),e.jsx("p",{className:"text-[9px] font-bold uppercase tracking-widest text-muted-foreground/40",children:"CCS-MATRIX-FAILURE-MONITOR"})]})]}),e.jsx("div",{className:"rounded-full border border-border bg-background/50 px-3 py-1 text-[9px] font-black uppercase tracking-widest text-foreground/40 shadow-inner",children:"Mode: Historical"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-3xl font-black uppercase tracking-tighter text-foreground",children:"CLIProxy Failure Analysis"}),e.jsx("p",{className:"max-w-3xl text-[15px] font-medium leading-relaxed text-muted-foreground/60",children:"Maintain oversight of legacy request failures while the unified stream consolidates system-wide telemetry. This view provides direct access to the historical failure matrix for deep-field debugging."})]}),e.jsx("div",{className:"h-px w-full bg-gradient-to-r from-transparent via-border to-transparent opacity-40"})]})})]}),e.jsxs("div",{className:"rounded-[2.5rem] border-2 border-border bg-muted/5 p-8 shadow-inner backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.5)]"}),e.jsx("span",{className:"text-[10px] font-black uppercase tracking-[0.3em] text-foreground/40",children:"Realtime Monitoring Deck"})]}),e.jsx(ue,{})]})]})})]})})]}):null}export{Ze as LogsPage};
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as c,L as de}from"./react-vendor-CNOkPC89.js";import{c as n,L as f,aF as P,r as oe,s as ce,t as me,v as xe,w as S,I as R,d as v,a as k,n as E,Q as J,R as $,U as I,V as Q,Y as _,C as w,j as C,S as u,b as D,bl as ue}from"./index-g2g1k0QS.js";import{a7 as pe,aG as ge,at as he,Q as be,A as O,$ as z,am as A,_ as fe,aD as ve,aY as je,Y as Ne,ah as ye,L as we,aZ as ke,a6 as Z,Z as M,au as Se,a_ as Ce,i as Le,R as X,d as q,a$ as _e,ag as ee,C as re}from"./icons-KVCk4_U8.js";import{u as F,a as Ee,b as Ie,k as Qe}from"./tanstack-CrmUhA7Z.js";import{t as W}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function K(r,s){const t=Number.parseInt(r,10);return Number.isNaN(t)?s:Math.max(0,t)}function V({config:r,onSave:s,isPending:t}){const[d,o]=c.useState(r);c.useEffect(()=>{o(r)},[r]);const x=c.useMemo(()=>JSON.stringify(d)!==JSON.stringify(r),[r,d]);return e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl border-2 border-border/60 bg-card/40 p-1 shadow-lg transition-all hover:border-border",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border bg-muted/30 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-primary/5 border border-primary/20",children:e.jsx(pe,{className:"h-3.5 w-3.5 text-primary"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground",children:"Logging Policy"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.1em] text-foreground/45",children:"Retention and privacy"})]})]}),e.jsx("div",{className:n("h-1.5 w-1.5 rounded-full",r.enabled?"bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]":"bg-zinc-500")})]}),e.jsxs("div",{className:"space-y-6 p-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/50 p-3 flex flex-col gap-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70",children:"Active Status"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:n("text-[11px] font-semibold uppercase tracking-[0.1em]",r.enabled?"text-emerald-500":"text-zinc-500"),children:r.enabled?"Live":"Off"})})]}),e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/50 p-3 flex flex-col gap-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70",children:"Redaction"}),e.jsx("span",{className:n("text-[11px] font-semibold uppercase tracking-[0.1em]",r.redact?"text-primary":"text-muted-foreground/40"),children:r.redact?"Enforced":"Plain"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl border border-border/40 bg-background/20 px-4 py-3 transition-colors hover:bg-background/40",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"logs-enabled",className:"text-[12px] font-semibold uppercase tracking-[0.12em]",children:"Pipeline"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground/55",children:"Enable structured logging"})]}),e.jsx(P,{id:"logs-enabled",checked:d.enabled,onCheckedChange:i=>o(a=>({...a,enabled:i})),className:"data-[state=checked]:bg-primary"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl border border-border/40 bg-background/20 px-4 py-3 transition-colors hover:bg-background/40",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"logs-redact",className:"text-[12px] font-semibold uppercase tracking-[0.12em]",children:"Masking"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground/55",children:"Sanitize payload data"})]}),e.jsx(P,{id:"logs-redact",checked:d.redact,onCheckedChange:i=>o(a=>({...a,redact:i})),className:"data-[state=checked]:bg-primary"})]})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(ge,{className:"h-3 w-3 text-primary/40"}),e.jsx(f,{htmlFor:"logs-config-level",className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-foreground/70",children:"Minimum Operational Threshold"})]}),e.jsxs(oe,{value:d.level,onValueChange:i=>o(a=>({...a,level:i})),children:[e.jsx(ce,{id:"logs-config-level",className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 text-[12px] font-semibold uppercase tracking-[0.1em] focus:ring-0",children:e.jsx(me,{})}),e.jsxs(xe,{className:"border-2 border-border bg-card",children:[e.jsx(S,{value:"error",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Error Only"}),e.jsx(S,{value:"warn",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Warn + Above"}),e.jsx(S,{value:"info",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Info + Above"}),e.jsx(S,{value:"debug",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Full Debug"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"logs-rotate-mb",className:"px-1 text-[10px] font-semibold uppercase tracking-[0.1em] text-foreground/50",children:"Rotation (MB)"}),e.jsx(R,{id:"logs-rotate-mb",type:"number",min:1,className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 font-mono text-[12px] font-medium focus-visible:ring-0",value:d.rotate_mb,onChange:i=>o(a=>({...a,rotate_mb:K(i.target.value,a.rotate_mb)}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"logs-retain-days",className:"px-1 text-[10px] font-semibold uppercase tracking-[0.1em] text-foreground/50",children:"Retain (Days)"}),e.jsx(R,{id:"logs-retain-days",type:"number",min:1,className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 font-mono text-[12px] font-medium focus-visible:ring-0",value:d.retain_days,onChange:i=>o(a=>({...a,retain_days:K(i.target.value,a.retain_days)}))})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border",children:[e.jsxs(v,{onClick:()=>s(d),disabled:!x||t,className:"h-10 w-full gap-2 rounded-xl bg-primary text-[11px] font-semibold uppercase tracking-[0.14em] shadow-lg shadow-primary/20 transition-all hover:scale-[1.02] active:scale-[0.98]",children:[e.jsx(he,{className:"h-3.5 w-3.5"}),"Commit Changes"]}),e.jsxs(v,{variant:"ghost",onClick:()=>o(r),disabled:!x||t,className:"h-9 gap-2 text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/45 hover:text-foreground",children:[e.jsx(be,{className:"h-3 w-3"}),"Rollback Draft"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between bg-muted/20 px-5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{className:"h-2.5 w-2.5 text-primary/40"}),e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-foreground/30",children:"Operational Logic v3.4"})]}),x&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"h-1 w-1 rounded-full bg-amber-500 animate-pulse"}),e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-amber-500/70",children:"Pending"})]})]})]})}function Fe(r){if(r==null)return"{}";try{return JSON.stringify(r,null,2)}catch{return String(r)}}function Te(r){switch(r){case"error":return"Error";case"warn":return"Warn";case"info":return"Info";case"debug":return"Debug"}}const Re={error:"border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300",warn:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",info:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",debug:"border-zinc-500/30 bg-zinc-500/10 text-zinc-700 dark:text-zinc-300"};function se({level:r,className:s}){return e.jsx("span",{className:n("inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em]",Re[r],s),children:Te(r)})}function L({label:r,value:s,icon:t}){return e.jsxs("div",{className:"group relative flex flex-col gap-1.5 rounded-xl border border-border/40 bg-background/40 p-3 transition-all hover:bg-background/80 hover:shadow-lg hover:shadow-black/5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsx(t,{className:"h-3 w-3 text-primary/40 group-hover:text-primary transition-colors"}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70 transition-colors group-hover:text-primary/60",children:r})]}),e.jsx("div",{className:"h-1 w-1 rounded-full bg-border/40 group-hover:bg-primary/40 transition-colors"})]}),e.jsx("p",{className:"truncate font-mono text-[13px] font-medium tracking-tight text-foreground/85 transition-colors group-hover:text-foreground",children:s})]})}function Y({entry:r,sourceLabel:s}){const{t}=k();return r?e.jsxs("div",{className:"flex h-full flex-col bg-card/30 backdrop-blur-sm animate-in fade-in slide-in-from-right-4 duration-500",children:[e.jsxs("div",{className:"relative shrink-0 border-b border-border bg-card/60 p-6 shadow-sm overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none [background-image:radial-gradient(circle_at_center,var(--primary)_1px,transparent_0)] [background-size:16px_16px]"}),e.jsxs("div",{className:"relative space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{level:r.level,className:"h-5 px-3 shadow-lg shadow-black/5"}),e.jsx("div",{className:"h-4 w-px bg-border/60"}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border bg-background/50 px-3 py-1 shadow-inner",children:[e.jsx(A,{className:"h-3 w-3 text-primary/60"}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/75",children:s??r.source})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-3 w-3 animate-pulse text-emerald-500"}),e.jsx("span",{className:"font-mono text-[11px] font-medium uppercase tracking-[0.12em] text-muted-foreground/45",children:new Date(r.timestamp).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1 w-4 rounded-full bg-primary/40"}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary/65",children:"Event"})]}),e.jsx("h2",{className:"text-[24px] font-semibold tracking-tight text-foreground leading-tight break-words",children:r.event}),e.jsx("div",{className:"rounded-xl border-l-4 border-primary/20 bg-muted/20 p-4 shadow-inner",children:e.jsx("p",{className:"text-[14px] font-medium leading-relaxed text-foreground/85 selection:bg-primary/20",children:r.message})})]})]})]}),e.jsx(E,{className:"flex-1",children:e.jsx("div",{className:"p-6",children:e.jsxs(J,{defaultValue:"details",className:"space-y-8",children:[e.jsxs($,{className:"grid h-auto w-full grid-cols-2 gap-1 rounded-xl border border-border/60 bg-muted/40 p-1",children:[e.jsxs(I,{value:"details",className:"min-w-0 gap-2 rounded-lg px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.1em] transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-sm",children:[e.jsx(fe,{className:"h-3.5 w-3.5"}),t("logsDetailPanel.details")]}),e.jsxs(I,{value:"raw",className:"min-w-0 gap-2 rounded-lg px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.1em] transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-sm",children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),"Raw Context"]})]}),e.jsxs(Q,{value:"details",className:"mt-0 space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsx(L,{label:"Entry Signature",value:r.id.slice(0,16)+"...",icon:je}),e.jsx(L,{label:"Telemetry Origin",value:r.source,icon:A}),e.jsx(L,{label:"Process ID",value:r.processId??"NA",icon:Ne}),e.jsx(L,{label:"Operational Run",value:r.runId?.slice(0,8)??"NA",icon:ye})]}),e.jsxs("div",{className:"relative overflow-hidden rounded-[2rem] border border-border bg-muted/10 p-1 shadow-inner group",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-primary/[0.03] to-transparent h-[200%] -top-full animate-[scan_8s_linear_infinite] pointer-events-none"}),e.jsxs("div",{className:"rounded-[calc(2rem-4px)] border border-dashed border-border/40 bg-background/50 p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/5 border border-primary/20 text-primary shadow-inner",children:e.jsx(z,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary",children:"Automated Summary"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.1em] text-muted-foreground/55",children:"Quick interpretation"})]})]}),e.jsxs("p",{className:"text-[13px] leading-relaxed text-muted-foreground/80 font-medium",children:["This telemetry node was captured from"," ",e.jsx("span",{className:"rounded bg-muted/40 px-1.5 py-0.5 font-semibold text-foreground",children:s??r.source}),"operating at the"," ",e.jsx("span",{className:n("rounded px-1.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.08em]",r.level==="error"?"bg-red-500/10 text-red-500":r.level==="warn"?"bg-amber-500/10 text-amber-500":r.level==="info"?"bg-sky-500/10 text-sky-500":"bg-zinc-500/10 text-zinc-500"),children:r.level})," ","threshold. The operational payload indicates an event state of"," ",e.jsx("span",{className:"font-semibold text-foreground",children:r.event}),"."]})]})]})]}),e.jsx(Q,{value:"raw",className:"mt-0 animate-in fade-in slide-in-from-bottom-2 duration-500",children:e.jsxs("div",{className:"group relative rounded-2xl border-2 border-border bg-zinc-950 p-1 shadow-2xl transition-all hover:border-primary/20",children:[e.jsx("div",{className:"absolute right-4 top-4 z-10 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"rounded-md border border-white/10 bg-white/5 px-2 py-1 text-[9px] font-medium uppercase tracking-[0.12em] text-white/45 backdrop-blur-md",children:"JSON.RAW.MODE"})}),e.jsx(E,{className:"h-[30rem] w-full rounded-xl p-6",children:e.jsx("pre",{className:"font-mono text-[12px] leading-relaxed tracking-tight text-zinc-400 selection:bg-primary/40 selection:text-primary-foreground",children:Fe({id:r.id,timestamp:r.timestamp,level:r.level,source:r.source,event:r.event,message:r.message,processId:r.processId,runId:r.runId,context:r.context??{}})})})]})})]})})}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border bg-muted/5 px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]"}),e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Node Verified"})]}),e.jsx("div",{className:"h-3 w-px bg-border/40"}),e.jsx("span",{className:"text-[10px] font-medium tabular-nums uppercase tracking-[0.12em] text-foreground/35",children:r.id.slice(0,8)})]}),e.jsx("div",{className:"rounded-full bg-primary/5 px-2 py-0.5 border border-primary/10",children:e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-primary/65",children:"CCS-TEC-v3"})})]})]}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center animate-in fade-in duration-1000",children:[e.jsxs("div",{className:"relative mb-8",children:[e.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-primary/5 p-12"}),e.jsx("div",{className:"relative rounded-full border-2 border-dashed border-border/40 p-10 bg-muted/5",children:e.jsx(z,{className:"h-10 w-10 text-muted-foreground/20"})})]}),e.jsxs("div",{className:"max-w-xs space-y-3",children:[e.jsx("h3",{className:"text-[15px] font-semibold uppercase tracking-[0.14em] text-foreground/65",children:"Inspector Standby"}),e.jsx("p",{className:"text-[13px] leading-relaxed text-muted-foreground/55 font-medium",children:"Select a telemetry node from the active data queue to perform deep analysis of its operational context."})]})]})}function H({entries:r,selectedEntryId:s,onSelect:t,sourceLabels:d,isLoading:o,isFetching:x}){const{t:i}=k();return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-background/50 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-card/40 px-6 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-primary shadow-[0_0_12px_rgba(var(--primary),0.6)]"}),e.jsx("h2",{className:"text-[12px] font-semibold uppercase tracking-[0.14em] text-foreground",children:"Live Entry Stream"})]}),e.jsx("div",{className:"h-4 w-px bg-border/60"}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2 py-0.5",children:[e.jsx(O,{className:"h-3 w-3 text-emerald-500"}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-emerald-600",children:"Live telemetry"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[x&&e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1",children:[e.jsx(we,{className:"h-3 w-3 animate-spin text-primary"}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary",children:"Syncing"})]}),e.jsx("span",{className:"font-mono text-[10px] font-medium uppercase tracking-[0.16em] text-foreground/35",children:"NODE.01"})]})]}),e.jsxs("div",{className:"flex items-center gap-0 border-b border-border bg-muted/30 px-0 py-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-foreground/45",children:[e.jsx("div",{className:"w-[6.5rem] shrink-0 px-6",children:i("logsConfig.time")}),e.jsx("div",{className:"w-14 shrink-0 border-l border-border/10 px-2 text-center",children:i("logsConfig.level")}),e.jsx("div",{className:"w-[15rem] shrink-0 border-l border-border/10 px-4",children:i("logsConfig.source")}),e.jsx("div",{className:"flex-1 border-l border-border/10 px-4",children:i("logsConfig.message")}),e.jsx("div",{className:"w-[5.5rem] shrink-0 border-l border-border/10 px-2 text-center",children:i("logsConfig.proc")}),e.jsx("div",{className:"w-[5.5rem] shrink-0 border-l border-border/10 px-3 text-center",children:i("logsConfig.run")}),e.jsx("div",{className:"w-11 shrink-0 border-l border-border/10 px-2 text-center",children:i("logsConfig.open")})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o?e.jsx("div",{className:"space-y-1 p-2",children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15].map(a=>e.jsx("div",{className:"h-10 w-full animate-pulse rounded-lg border border-border/5 bg-muted/20"},a))}):r.length===0?e.jsxs("div",{className:"flex h-full animate-in fade-in duration-1000 flex-col items-center justify-center gap-6 px-8 text-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-muted/5 p-12"}),e.jsx("div",{className:"relative rounded-full border border-dashed border-border/40 bg-muted/5 p-10",children:e.jsx(ke,{className:"h-10 w-10 text-muted-foreground/20"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[13px] font-semibold uppercase tracking-[0.14em] text-foreground/55",children:"No matching entries"}),e.jsx("p",{className:"max-w-[18rem] text-[12px] font-medium leading-relaxed text-muted-foreground/60",children:"Your current source, level, or search filters are hiding the stream. Adjust them to bring entries back into view."})]})]}):e.jsx(E,{className:"h-full",children:e.jsx("div",{className:"flex flex-col",children:r.map(a=>{const m=a.id===s;return e.jsxs("button",{type:"button",onClick:()=>t(a.id),className:n("group relative flex w-full items-center border-b border-border/5 px-0 py-2.5 text-left transition-all duration-150",m?"z-10 bg-primary/[0.08] shadow-[inset_4px_0_0_rgba(var(--primary),1)]":"bg-transparent hover:bg-muted/30"),children:[e.jsx("div",{className:"absolute inset-y-0 left-0 w-1 origin-center scale-y-0 bg-primary transition-transform duration-300 group-hover:scale-y-100"}),e.jsxs("div",{className:"flex w-full items-center gap-0",children:[e.jsx("div",{className:"flex w-[6.5rem] shrink-0 items-center",children:e.jsx("p",{className:n("px-6 font-mono text-[11px] font-semibold tabular-nums transition-colors",m?"text-primary":"text-foreground/60 group-hover:text-foreground"),children:new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})})}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-0",children:[e.jsx("div",{className:"flex w-14 shrink-0 items-center justify-center opacity-80 transition-opacity group-hover:opacity-100",children:e.jsx(se,{level:a.level,className:"origin-center scale-[0.85]"})}),e.jsxs("div",{className:"flex w-[15rem] shrink-0 flex-col gap-0.5 overflow-hidden px-4",children:[e.jsx("span",{className:n("truncate text-[11px] font-semibold uppercase tracking-[0.12em] transition-colors",m?"text-foreground":"text-foreground/50 group-hover:text-foreground/80"),children:d[a.source]??a.source}),e.jsx("span",{className:"truncate text-[10px] font-medium uppercase tracking-[0.1em] text-muted-foreground/55",children:a.event})]}),e.jsx("div",{className:"min-w-0 flex-1 px-4",children:e.jsx("p",{className:n("truncate text-[13px] font-medium leading-5 transition-colors",m?"text-foreground":"text-foreground/70 group-hover:text-foreground"),children:a.message})}),e.jsx("div",{className:"flex w-[5.5rem] shrink-0 items-center justify-center px-2 font-mono text-[10px] font-semibold tabular-nums tracking-[0.12em] text-foreground/30 transition-colors group-hover:text-primary/45",children:a.processId??"????"}),e.jsx("div",{className:"flex w-[5.5rem] shrink-0 items-center justify-center px-3 font-mono text-[10px] font-semibold tabular-nums tracking-[0.12em] text-foreground/30 transition-colors group-hover:text-primary/45",children:a.runId?.slice(0,4).toUpperCase()??"NONE"}),e.jsx("div",{className:"flex w-11 shrink-0 items-center justify-center px-2",children:e.jsx("div",{className:n("flex h-7 w-7 items-center justify-center rounded-full border transition-all",m?"animate-in zoom-in duration-300 border-primary/20 bg-primary/10 text-primary":"border-transparent text-foreground/20 group-hover:border-border/40 group-hover:bg-background/80 group-hover:text-foreground/55"),children:e.jsx(Z,{className:"h-3.5 w-3.5"})})})]})]})]},a.id)})})})}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border bg-muted/5 px-6 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Node: CCS-CORE"}),e.jsx("div",{className:"h-1 w-1 rounded-full bg-border/40"}),e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Status: Operational"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:["Entries: ",r.length]})})]})]})}const ae=["logs","config"],te=["logs","sources"],De=150;function Oe(){const[r,s]=c.useState("all"),[t,d]=c.useState("all"),[o,x]=c.useState(""),[i,a]=c.useState(De),[m,p]=c.useState(null),g=c.useDeferredValue(o.trim()),h=F({queryKey:ae,queryFn:async()=>(await _.logs.getConfig()).logging,refetchInterval:3e4}),j=F({queryKey:te,queryFn:async()=>(await _.logs.getSources()).sources,refetchInterval:15e3}),b=F({queryKey:["logs","entries",r,t,g,i],queryFn:async()=>(await _.logs.getEntries({source:r==="all"?void 0:r,level:t==="all"?void 0:t,search:g||void 0,limit:i})).entries,placeholderData:Qe,refetchInterval:1e4}),l=c.useMemo(()=>{const y=b.data??[];return y.length===0?null:m&&y.some(N=>N.id===m)?m:y[0]?.id??null},[b.data,m]),ie=c.useMemo(()=>(b.data??[]).find(y=>y.id===l)??null,[l,b.data]),le=c.useMemo(()=>(j.data??[]).map(N=>N.lastTimestamp).filter(N=>!!N).sort((N,ne)=>ne.localeCompare(N))[0]??null,[j.data]);return{configQuery:h,sourcesQuery:j,entriesQuery:b,selectedSource:r,setSelectedSource:s,selectedLevel:t,setSelectedLevel:d,search:o,setSearch:x,limit:i,setLimit:a,selectedEntryId:l,setSelectedEntryId:p,selectedEntry:ie,latestTimestamp:le,isInitialLoading:!h.data&&h.isLoading||!j.data&&j.isLoading||!b.data&&b.isLoading}}function Pe(){const r=Ee(),{t:s}=k();return Ie({mutationFn:t=>_.logs.updateConfig(t),onSuccess:async()=>{await Promise.all([r.invalidateQueries({queryKey:ae}),r.invalidateQueries({queryKey:te}),r.invalidateQueries({queryKey:["logs","entries"]})]),W.success(s("toasts.loggingConfigSaved"))},onError:t=>{W.error(t.message||s("toasts.loggingConfigSaveFailed"))}})}function ze(){return[{value:"all",label:"All levels"},{value:"error",label:"Errors"},{value:"warn",label:"Warnings"},{value:"info",label:"Info"},{value:"debug",label:"Debug"}]}function Ae(r){return Object.fromEntries(r.map(s=>[s.source,s.label]))}function U({sources:r,selectedSource:s,onSourceChange:t,selectedLevel:d,onLevelChange:o,search:x,onSearchChange:i,limit:a,onLimitChange:m,onRefresh:p,isRefreshing:g}){const{t:h}=k(),j=ze(),b=[50,100,150,250];return e.jsxs("div",{className:"flex flex-col gap-6 animate-in fade-in slide-in-from-left-2 duration-700",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.5)]"}),e.jsx(f,{htmlFor:"logs-search",className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Payload Search"})]}),e.jsx(M,{className:"h-3 w-3 text-primary/20"})]}),e.jsxs("div",{className:"group relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-3.5 flex items-center transition-all group-focus-within:translate-x-1",children:e.jsx(Se,{className:"h-3.5 w-3.5 text-foreground/20 group-focus-within:text-primary transition-colors"})}),e.jsx(R,{id:"logs-search","aria-label":"Search",value:x,onChange:l=>i(l.target.value),placeholder:"Scan for patterns...",className:"h-11 rounded-xl border-2 border-border/40 bg-background/50 pl-10 text-[13px] font-medium text-foreground placeholder:text-foreground/35 focus-visible:border-primary/40 focus-visible:ring-0 transition-all shadow-inner"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(Ce,{className:"h-3 w-3 text-primary/40"}),e.jsx(f,{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Source Matrix"})]}),e.jsxs("div",{className:"flex flex-col gap-1","aria-label":"Source filter",children:[e.jsxs("button",{type:"button",onClick:()=>t("all"),className:n("group relative flex items-center justify-between rounded-lg border px-3 py-2 transition-all active:scale-[0.98]",s==="all"?"border-primary/50 bg-primary/10 text-primary shadow-[0_0_15px_rgba(var(--primary),0.1)]":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.12em]",children:"Global Stream"}),s==="all"&&e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.8)]"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1 mt-1",children:r.map(l=>e.jsx("button",{type:"button",onClick:()=>t(l.source),className:n("rounded-lg border px-2.5 py-1.5 text-[10px] font-semibold uppercase tracking-[0.1em] transition-all active:scale-[0.97]",s===l.source?"border-primary/50 bg-primary/10 text-primary shadow-sm":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:l.label},l.source))})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(Le,{className:"h-3 w-3 text-primary/40"}),e.jsx(f,{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Sensitivity"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5","aria-label":"Level filter",children:j.map(l=>e.jsxs("button",{type:"button",onClick:()=>o(l.value),className:n("flex flex-col items-center gap-1 rounded-lg border px-2 py-2 text-[10px] font-semibold uppercase tracking-[0.1em] transition-all active:scale-[0.97]",d===l.value?"border-primary/50 bg-primary/10 text-primary shadow-[0_0_15px_rgba(var(--primary),0.1)]":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:[e.jsx("span",{children:l.label}),e.jsx("div",{className:n("h-0.5 w-4 rounded-full transition-colors",d===l.value?"bg-primary":"bg-foreground/10")})]},l.value))})]}),e.jsx("div",{className:"mt-4 rounded-2xl border-2 border-border bg-card/40 p-1.5 shadow-xl shadow-black/5",children:e.jsxs("div",{className:"rounded-[calc(1rem-2px)] border border-dashed border-border bg-background/60 p-4 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-primary",children:"Operational Window"}),e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.1em] text-foreground/45",children:"Tail Capacity"})]}),e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary/5 border border-primary/10 flex items-center justify-center",children:e.jsx(M,{className:"h-4 w-4 text-primary/40"})})]}),e.jsx("div",{className:"grid grid-cols-4 gap-1.5","aria-label":"Visible entries",children:b.map(l=>e.jsx("button",{type:"button",onClick:()=>m(l),className:n("rounded-md border py-1.5 text-[11px] font-semibold tabular-nums transition-all active:scale-[0.95]",a===l?"border-foreground bg-foreground text-background":"border-border/60 bg-muted/40 text-foreground/40 hover:bg-muted hover:text-foreground"),children:l},l))}),e.jsxs(v,{variant:"ghost",size:"sm",className:"group relative h-10 w-full overflow-hidden rounded-xl border-none bg-primary text-[11px] font-semibold uppercase tracking-[0.14em] text-primary-foreground transition-all hover:scale-[1.02] hover:shadow-lg hover:shadow-primary/20 active:scale-[0.98]",onClick:p,children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-1000"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{className:n("h-3.5 w-3.5",g&&"animate-spin")}),e.jsx("span",{children:h("logsConfig.refreshEntries")})]})]})]})})]})}function Me(){const{t:r}=k();return e.jsxs("div",{className:"space-y-6","aria-label":r("logsPageSkeleton.loadingLogs"),children:[e.jsx(w,{className:"gap-4",children:e.jsxs(C,{className:"space-y-3",children:[e.jsx(u,{className:"h-4 w-28"}),e.jsx(u,{className:"h-8 w-72"}),e.jsx(u,{className:"h-4 w-[30rem]"})]})}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[1,2,3,4].map(s=>e.jsx(w,{className:"gap-3",children:e.jsxs(C,{className:"space-y-2",children:[e.jsx(u,{className:"h-4 w-20"}),e.jsx(u,{className:"h-7 w-24"})]})},s))}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1.45fr)_22rem]",children:[e.jsxs(w,{className:"gap-4",children:[e.jsxs(C,{className:"space-y-3",children:[e.jsx(u,{className:"h-4 w-52"}),e.jsx("div",{className:"grid gap-3 md:grid-cols-4",children:[1,2,3,4].map(s=>e.jsx(u,{className:"h-10 w-full"},s))})]}),e.jsxs(D,{className:"grid gap-4 xl:grid-cols-[22rem_minmax(0,1fr)]",children:[e.jsx(u,{className:"h-[26rem] w-full"}),e.jsx(u,{className:"h-[26rem] w-full"})]})]}),e.jsxs(w,{className:"gap-4",children:[e.jsxs(C,{className:"space-y-3",children:[e.jsx(u,{className:"h-5 w-44"}),e.jsx(u,{className:"h-4 w-full"})]}),e.jsx(D,{className:"space-y-4",children:[1,2,3,4].map(s=>e.jsx(u,{className:"h-10 w-full"},s))})]})]})]})}const T=1200,qe=336,We=368,B=52;function G({side:r,label:s,onExpand:t}){return e.jsxs("div",{className:n("flex h-full w-full flex-col items-center justify-center gap-4 bg-muted/5",r==="left"?"border-r border-border":"border-l border-border"),children:[e.jsx(v,{variant:"ghost",size:"icon",onClick:t,"aria-label":`Show ${s.toLowerCase()}`,className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:r==="left"?e.jsx(re,{className:"h-4 w-4"}):e.jsx(ee,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-foreground/45",style:{writingMode:"vertical-rl"},children:s})]})}function Ze(){const r=Oe(),s=Pe(),t=Ae(r.sourcesQuery.data??[]),[d,o]=c.useState(()=>typeof window<"u"?window.innerWidth>=T:!1),[x,i]=c.useState(!1),[a,m]=c.useState(!1);if(c.useEffect(()=>{const g=window.matchMedia(`(min-width: ${T}px)`),h=()=>{o(window.innerWidth>=T)};return h(),g.addEventListener("change",h),()=>g.removeEventListener("change",h)},[]),r.isInitialLoading)return e.jsx(Me,{});const p=r.configQuery.data;return p?e.jsxs("div",{className:"relative flex h-full min-h-full flex-col overflow-hidden border-t border-border/40 bg-background font-sans text-foreground antialiased selection:bg-primary/30 selection:text-primary",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 z-0 opacity-40 [background-image:radial-gradient(circle_at_1px_1px,rgba(38,38,36,0.08)_1px,transparent_0)] [background-size:14px_14px]"}),e.jsxs("div",{className:"relative z-10 flex shrink-0 items-center justify-between border-b border-border/80 bg-card/95 px-6 py-2 backdrop-blur-xl shadow-md transition-all xl:px-8",children:[e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"group flex h-9 w-9 items-center justify-center rounded-xl border-2 border-primary/20 bg-primary/5 text-primary shadow-inner transition-all hover:scale-110 active:scale-90",children:e.jsx(q,{className:"h-4.5 w-4.5 transition-transform group-hover:rotate-6"})}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"rounded-full bg-primary px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-primary-foreground shadow-lg shadow-primary/20",children:"Operational"}),e.jsx("h1",{className:"text-[17px] font-semibold tracking-tight text-foreground",children:"Log Operations Center"})]}),e.jsx("p",{className:"font-mono text-[10px] font-medium uppercase tracking-[0.16em] text-foreground/45",children:"CCS.TOC.LOGS.STREAM.v3"})]})]}),e.jsx("div",{className:"hidden h-8 w-px bg-border/80 md:block"}),e.jsxs("div",{className:"hidden items-center gap-10 md:flex",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:n("h-2 w-2 rounded-full ring-4 transition-all duration-700",p.redact?"bg-emerald-500 shadow-[0_0_20px_rgba(16,185,129,0.6)] ring-emerald-500/30":"bg-zinc-600 ring-transparent")}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/90",children:"Redaction"}),e.jsx("span",{className:"text-[11px] font-medium text-foreground/50",children:p.redact?"Enforced":"Standby"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg border-2 border-border bg-muted shadow-inner",children:e.jsx(_e,{className:"h-3.5 w-3.5 text-foreground"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/90",children:"Retention"}),e.jsxs("span",{className:"text-[11px] font-medium text-foreground/50",children:[p.retain_days,"D / ",p.rotate_mb,"MB"]})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(v,{variant:"ghost",size:"sm",className:"group h-9 gap-3 rounded-xl border-2 border-border bg-muted px-5 text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground transition-all hover:bg-foreground hover:text-background active:scale-95 shadow-lg shadow-black/5",onClick:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),children:[e.jsxs("div",{className:"relative",children:[e.jsx(X,{className:n("h-3.5 w-3.5 transition-transform duration-500",(r.entriesQuery.isFetching||r.sourcesQuery.isFetching)&&"animate-spin")}),!r.entriesQuery.isFetching&&!r.sourcesQuery.isFetching&&e.jsx("div",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full border border-muted bg-primary animate-pulse"})]}),r.entriesQuery.isFetching||r.sourcesQuery.isFetching?"Syncing":"Refresh"]}),e.jsx("div",{className:"h-7 w-px bg-border/80"}),e.jsx(v,{asChild:!0,variant:"ghost",size:"sm",className:"h-9 w-9 rounded-xl border-2 border-border bg-muted p-0 text-foreground transition-all hover:bg-foreground hover:text-background active:scale-95 shadow-lg shadow-black/5",children:e.jsx(de,{to:"/health",children:e.jsx(Z,{className:"h-4 w-4"})})})]})]}),e.jsx("div",{className:"relative z-10 flex min-h-0 flex-1 overflow-hidden",children:e.jsxs(J,{defaultValue:"stream",className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/80 bg-card/80 px-6 py-2 backdrop-blur-xl shadow-inner xl:px-8",children:[e.jsxs($,{className:"h-10 w-auto gap-1.5 rounded-xl border border-border/60 bg-muted/40 p-1",children:[e.jsx(I,{value:"stream",className:"rounded-lg px-5 text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/60 transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-md",children:"Telemetry Stream"}),e.jsx(I,{value:"errors",className:"rounded-lg px-5 text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/60 transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-md",children:"Legacy Errors"})]}),e.jsxs("div",{className:"hidden items-center gap-3 lg:flex",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border bg-muted px-3 py-1 shadow-inner",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.6)]"})]}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-foreground/80",children:"Connected"})]}),e.jsxs("span",{className:"pr-4 text-[11px] font-medium tabular-nums text-foreground/45",children:[r.entriesQuery.data?.length??0," captured"]})]})]}),e.jsx(Q,{value:"stream",className:"m-0 flex min-h-0 flex-1 overflow-y-auto lg:overflow-hidden focus-visible:outline-none",children:d?e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsx("div",{"data-logs-pane":"filters",style:{width:x?B:qe},className:"flex min-h-0 shrink-0 bg-muted/5",children:x?e.jsx(G,{side:"left",label:"Filters",onExpand:()=>i(!1)}):e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col border-r border-border p-5 2xl:p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Filters"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Search, source, and retention controls"})]}),e.jsx(v,{variant:"ghost",size:"icon",onClick:()=>i(!0),"aria-label":"Hide filters",className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:e.jsx(ee,{className:"h-4 w-4"})})]}),e.jsx(E,{className:"min-h-0 flex-1","data-logs-scroll-region":"filters",children:e.jsxs("div",{className:"space-y-5 pr-4",children:[e.jsx(U,{sources:r.sourcesQuery.data??[],selectedSource:r.selectedSource,onSourceChange:r.setSelectedSource,selectedLevel:r.selectedLevel,onLevelChange:r.setSelectedLevel,search:r.search,onSearchChange:r.setSearch,limit:r.limit,onLimitChange:r.setLimit,onRefresh:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),isRefreshing:r.entriesQuery.isFetching||r.sourcesQuery.isFetching}),e.jsx("div",{className:"border-t border-border/20 pt-5",children:e.jsx(V,{config:p,onSave:g=>s.mutate(g),isPending:s.isPending})})]})})]})}),e.jsx("div",{"data-logs-pane":"entries",className:"flex min-h-0 min-w-0 flex-1 overflow-hidden border-l border-r border-border bg-background/95",children:e.jsx(H,{entries:r.entriesQuery.data??[],selectedEntryId:r.selectedEntryId,onSelect:r.setSelectedEntryId,sourceLabels:t,isLoading:r.entriesQuery.isLoading,isFetching:r.entriesQuery.isFetching})}),e.jsx("div",{"data-logs-pane":"details",style:{width:a?B:We},className:"flex min-h-0 shrink-0 bg-muted/5 shadow-inner",children:a?e.jsx(G,{side:"right",label:"Details",onExpand:()=>m(!1)}):e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 bg-background/60 px-3 py-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Details"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Selected entry context and raw payload"})]}),e.jsx(v,{variant:"ghost",size:"icon",onClick:()=>m(!0),"aria-label":"Hide details",className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:e.jsx(re,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{entry:r.selectedEntry,sourceLabel:r.selectedEntry?t[r.selectedEntry.source]:void 0})})]})})]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-border bg-muted/5 p-5",children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(U,{sources:r.sourcesQuery.data??[],selectedSource:r.selectedSource,onSourceChange:r.setSelectedSource,selectedLevel:r.selectedLevel,onLevelChange:r.setSelectedLevel,search:r.search,onSearchChange:r.setSearch,limit:r.limit,onLimitChange:r.setLimit,onRefresh:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),isRefreshing:r.entriesQuery.isFetching||r.sourcesQuery.isFetching}),e.jsx(V,{config:p,onSave:g=>s.mutate(g),isPending:s.isPending})]})}),e.jsx("div",{className:"flex min-h-[32rem] flex-col overflow-hidden border-b border-border bg-background/95",children:e.jsx(H,{entries:r.entriesQuery.data??[],selectedEntryId:r.selectedEntryId,onSelect:r.setSelectedEntryId,sourceLabels:t,isLoading:r.entriesQuery.isLoading,isFetching:r.entriesQuery.isFetching})}),e.jsx("div",{className:"flex min-h-[30rem] flex-col overflow-hidden bg-muted/5 shadow-inner",children:e.jsx(Y,{entry:r.selectedEntry,sourceLabel:r.selectedEntry?t[r.selectedEntry.source]:void 0})})]})}),e.jsx(Q,{value:"errors",className:"m-0 flex-1 overflow-y-auto bg-background/20 p-6 focus-visible:outline-none xl:p-8",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-[2.5rem] border-2 border-border bg-card/40 p-1.5 shadow-2xl shadow-black/10",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none [background-image:radial-gradient(circle_at_center,var(--primary)_1px,transparent_0)] [background-size:24px_24px]"}),e.jsx(w,{className:"rounded-[calc(2.5rem-0.375rem)] border-none bg-background/60 shadow-none overflow-hidden backdrop-blur-md",children:e.jsxs(D,{className:"flex flex-col gap-6 p-10",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl border-2 border-primary/20 bg-primary/10 text-primary shadow-inner",children:e.jsx(q,{className:"h-5 w-5"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-[0.4em] text-primary",children:"Legacy Diagnostic Node"}),e.jsx("p",{className:"text-[9px] font-bold uppercase tracking-widest text-muted-foreground/40",children:"CCS-MATRIX-FAILURE-MONITOR"})]})]}),e.jsx("div",{className:"rounded-full border border-border bg-background/50 px-3 py-1 text-[9px] font-black uppercase tracking-widest text-foreground/40 shadow-inner",children:"Mode: Historical"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-3xl font-black uppercase tracking-tighter text-foreground",children:"CLIProxy Failure Analysis"}),e.jsx("p",{className:"max-w-3xl text-[15px] font-medium leading-relaxed text-muted-foreground/60",children:"Maintain oversight of legacy request failures while the unified stream consolidates system-wide telemetry. This view provides direct access to the historical failure matrix for deep-field debugging."})]}),e.jsx("div",{className:"h-px w-full bg-gradient-to-r from-transparent via-border to-transparent opacity-40"})]})})]}),e.jsxs("div",{className:"rounded-[2.5rem] border-2 border-border bg-muted/5 p-8 shadow-inner backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.5)]"}),e.jsx("span",{className:"text-[10px] font-black uppercase tracking-[0.3em] text-foreground/40",children:"Realtime Monitoring Deck"})]}),e.jsx(ue,{})]})]})})]})})]}):null}export{Ze as LogsPage};
@@ -1 +1 @@
1
- import{j as s}from"./radix-ui-Zb8sVEtn.js";import{r}from"./react-vendor-CNOkPC89.js";import{I as i,d as m}from"./index-BDfXfBTa.js";import{E as l,g as n}from"./icons-KVCk4_U8.js";function f({label:e,...a}){const[t,o]=r.useState(!1);return s.jsxs("div",{className:"space-y-1",children:[e&&s.jsx("label",{className:"text-sm font-medium",children:e}),s.jsxs("div",{className:"relative",children:[s.jsx(i,{type:t?"text":"password",className:"pr-10 font-mono",...a}),s.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>o(!t),tabIndex:-1,children:t?s.jsx(l,{className:"w-4 h-4"}):s.jsx(n,{className:"w-4 h-4"})})]})]})}export{f as M};
1
+ import{j as s}from"./radix-ui-Zb8sVEtn.js";import{r}from"./react-vendor-CNOkPC89.js";import{I as i,d as m}from"./index-g2g1k0QS.js";import{E as l,g as n}from"./icons-KVCk4_U8.js";function f({label:e,...a}){const[t,o]=r.useState(!1);return s.jsxs("div",{className:"space-y-1",children:[e&&s.jsx("label",{className:"text-sm font-medium",children:e}),s.jsxs("div",{className:"relative",children:[s.jsx(i,{type:t?"text":"password",className:"pr-10 font-mono",...a}),s.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>o(!t),tabIndex:-1,children:t?s.jsx(l,{className:"w-4 h-4"}):s.jsx(n,{className:"w-4 h-4"})})]})]})}export{f as M};
@@ -1 +1 @@
1
- import{j as t}from"./radix-ui-Zb8sVEtn.js";import{g as Pe,r as w}from"./react-vendor-CNOkPC89.js";import{by as be,bz as je,bA as ve,bB as $e,bC as z,bD as te,bE as L,bF as We,bG as Oe,a as ce,c as W,B as H,d as K,bx as _e,aW as De,bH as Ie,bI as Re,bJ as Fe,bK as Le,bL as Ue,bM as ze,bN as qe,aJ as Me,M as Be,O as He,r as Ge,s as Ke,t as Ye,v as Ze,w as Je,T as Qe,p as Xe,q as et,Y as tt}from"./index-BDfXfBTa.js";import{A as st,a as nt,b as rt,c as at,d as it,e as ot,f as lt,g as ct}from"./alert-dialog-CuN8HTEx.js";import{u as Ne,a as ut,b as dt,h as mt}from"./tanstack-CrmUhA7Z.js";import{t as se}from"./notifications-B2HqRBj7.js";import{bd as xe,R as G,t as xt,s as pt,u as gt,A as ft,be as ht,bf as yt,bg as bt,X as jt,e as vt,bh as Nt,bi as St,U as wt,v as Ct,m as kt,w as At,aE as Et,T as ne,aO as Tt}from"./icons-KVCk4_U8.js";var re,pe;function Vt(){return pe||(pe=1,re={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),re}var Pt=Vt();const $t=Pe(Pt);var Wt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ge(e){var s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(s.name=n[1],($t[n[1]]||e.charAt(e.length-2)==="/")&&(s.voidElement=!0),s.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Wt),i=null;(i=a.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),s.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}var Ot=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,_t=/^\s*$/,Dt=Object.create(null);function Se(e,s){switch(s.type){case"text":return e+s.content;case"tag":return e+="<"+s.name+(s.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(s.attrs):"")+(s.voidElement?"/>":">"),s.voidElement?e:e+s.children.reduce(Se,"")+"</"+s.name+">";case"comment":return e+"<!--"+s.comment+"-->"}}var It={parse:function(e,s){s||(s={}),s.components||(s.components=Dt);var n,r=[],a=[],i=-1,o=!1;if(e.indexOf("<")!==0){var c=e.indexOf("<");r.push({type:"text",content:c===-1?e:e.substring(0,c)})}return e.replace(Ot,function(u,d){if(o){if(u!=="</"+n.name+">")return;o=!1}var p,v=u.charAt(1)!=="/",k=u.startsWith("<!--"),h=d+u.length,f=e.charAt(h);if(k){var P=ge(u);return i<0?(r.push(P),r):((p=a[i]).children.push(P),r)}if(v&&(i++,(n=ge(u)).type==="tag"&&s.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!f||f==="<"||n.children.push({type:"text",content:e.slice(h,e.indexOf("<",h))}),i===0&&r.push(n),(p=a[i-1])&&p.children.push(n),a[i]=n),(!v||n.voidElement)&&(i>-1&&(n.voidElement||n.name===u.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&f!=="<"&&f)){p=i===-1?r:a[i].children;var m=e.indexOf("<",h),x=e.slice(h,m===-1?void 0:m);_t.test(x)&&(x=" "),(m>-1&&i+p.length>=0||x!==" ")&&p.push({type:"text",content:x})}}),r},stringify:function(e){return e.reduce(function(s,n){return s+Se("",n)},"")}};const Z=(e,s)=>{if(!e)return!1;const n=e.props?.children??e.children;return s?n.length>0:!!n},J=e=>{if(!e)return[];const s=e.props?.children??e.children;return e.props?.i18nIsDynamicList?U(s):s},Rt=e=>Array.isArray(e)&&e.every(w.isValidElement),U=e=>Array.isArray(e)?e:[e],Ft=(e,s)=>{const n={...s};return n.props={...s.props,...e.props},n},Lt=e=>{const s={};if(!e)return s;const n=r=>{U(r).forEach(i=>{z(i)||(Z(i)?n(J(i)):L(i)&&!w.isValidElement(i)&&Object.assign(s,i))})};return n(e),s},we=(e,s,n,r)=>{if(!e)return"";let a="";const i=U(e),o=s?.transSupportBasicHtmlNodes?s.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,u)=>{if(z(c)){a+=`${c}`;return}if(w.isValidElement(c)){const{props:d,type:p}=c,v=Object.keys(d).length,k=o.indexOf(p)>-1,h=d.children;if(!h&&k&&!v){a+=`<${p}/>`;return}if(!h&&(!k||v)||d.i18nIsDynamicList){a+=`<${u}></${u}>`;return}if(k&&v===1&&z(h)){a+=`<${p}>${h}</${p}>`;return}const f=we(h,s,n,r);a+=`<${u}>${f}</${u}>`;return}if(c===null){te(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:d,...p}=c,v=Object.keys(p);if(v.length===1){const k=d?`${v[0]}, ${d}`:v[0];a+=`{{${k}}}`;return}te(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}te(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Ut=(e,s=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...s,...r];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let c=!1;const u=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(u){const d=u[1];(/^\d+$/.test(d)||a.includes(d))&&(c=!0,i+=u[0],o+=u[0].length)}if(!c){const d=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(d){const p=d[1];(/^\d+$/.test(p)||a.includes(p))&&(c=!0,i+=d[0],o+=d[0].length)}}c||(i+="&lt;",o+=1)}else i+=e[o],o+=1;return i},zt=(e,s,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(c.map(g=>`<${g}`).join("|")).test(n);if(!e&&!s&&!u&&!o)return[n];const d=s??{},p=g=>{U(g).forEach(C=>{z(C)||(Z(C)?p(J(C)):L(C)&&!w.isValidElement(C)&&Object.assign(d,C))})};p(e);const v=Ut(n,c,d),k=It.parse(`<0>${v}</0>`),h={...d,...i},f=(g,N,C)=>{const A=J(g),$=m(A,N.children,C);return Rt(A)&&$.length===0||g.props?.i18nIsDynamicList?A:$},P=(g,N,C,A,$)=>{g.dummy?(g.children=N,C.push(w.cloneElement(g,{key:A},$?void 0:N))):C.push(...w.Children.map([g],y=>{const l="data-i18n-is-dynamic-list",T={key:A,[l]:void 0};return y&&y.props&&Object.keys(y.props).forEach(E=>{E==="ref"||E==="children"||E==="i18nIsDynamicList"||E===l||(T[E]=y.props[E])}),w.cloneElement(y,T,$?null:N)}))},m=(g,N,C)=>{const A=U(g);return U(N).reduce((y,l,T)=>{const E=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,h,r.language);if(l.type==="tag"){let V=A[parseInt(l.name,10)];!V&&s&&(V=s[l.name]),C.length===1&&!V&&(V=C[0][l.name]),V||(V={});const O={...l.attrs};o&&Object.keys(O).forEach(b=>{const F=O[b];z(F)&&(O[b]=We(F))});const j=Object.keys(O).length!==0?Ft({props:O},V):V,_=w.isValidElement(j),D=_&&Z(l,!0)&&!l.voidElement,R=u&&L(j)&&j.dummy&&!_,q=L(s)&&Object.hasOwnProperty.call(s,l.name);if(z(j)){const b=r.services.interpolator.interpolate(j,h,r.language);y.push(b)}else if(Z(j)||D){const b=f(j,l,C);P(j,b,y,T)}else if(R){const b=m(A,l.children,C);P(j,b,y,T)}else if(Number.isNaN(parseFloat(l.name)))if(q){const b=f(j,l,C);P(j,b,y,T,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)y.push(w.createElement(l.name,{key:`${l.name}-${T}`}));else{const b=m(A,l.children,C);y.push(w.createElement(l.name,{key:`${l.name}-${T}`},b))}else if(l.voidElement)y.push(`<${l.name} />`);else{const b=m(A,l.children,C);y.push(`<${l.name}>${b}</${l.name}>`)}else if(L(j)&&!_){const b=l.children[0]?E:null;b&&y.push(b)}else P(j,E,y,T,l.children.length!==1||!E)}else if(l.type==="text"){const V=a.transWrapTextNodes,O=typeof a.unescape=="function"?a.unescape:ve().unescape,j=o?O(r.services.interpolator.interpolate(l.content,h,r.language)):r.services.interpolator.interpolate(l.content,h,r.language);V?y.push(w.createElement(V,{key:`${l.name}-${T}`},j)):y.push(j)}return y},[])},x=m([{dummy:!0,children:e||[]}],k,U(e||[]));return J(x[0])},Ce=(e,s,n)=>{const r=e.key||s,a=w.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${s}/>`)<0&&n.indexOf(`${s} />`)<0)return a;function i(){return w.createElement(w.Fragment,null,a)}return w.createElement(i,{key:r})},qt=(e,s)=>e.map((n,r)=>Ce(n,r,s)),Mt=(e,s)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Ce(e[r],r,s)})}),n},Bt=(e,s,n,r)=>e?Array.isArray(e)?qt(e,s):L(e)?Mt(e,s):(be(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Ht=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((s,n)=>s&&Number.isNaN(Number.parseFloat(n)),!0);function Gt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:u,ns:d,i18n:p,t:v,shouldUnescape:k,...h}){const f=p||je();if(!f)return be(f,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const P=v||f.t.bind(f)||(M=>M),m={...ve(),...f.options?.react};let x=d||P.ns||f.options?.defaultNS;x=z(x)?[x]:x||["translation"];const{transDefaultProps:g}=m,N=g?.tOptions?{...g.tOptions,...i}:i,C=k??g?.shouldUnescape,A=g?.values?{...g.values,...o}:o,$=g?.components?{...g.components,...u}:u,y=we(e,m,f,r),l=c||N?.defaultValue||y||m.transEmptyNodeValue||(typeof r=="function"?$e(r):r),{hashTransKey:T}=m,E=r||(T?T(y||l):y||l);f.options?.interpolation?.defaultVariables?o=A&&Object.keys(A).length>0?{...A,...f.options.interpolation.defaultVariables}:{...f.options.interpolation.defaultVariables}:o=A;const V=Lt(e);V&&typeof V.count=="number"&&s===void 0&&(s=V.count);const O=o||s!==void 0&&!f.options?.interpolation?.alwaysFormat||!e?N.interpolation:{interpolation:{...N.interpolation,prefix:"#$?",suffix:"?$#"}},j={...N,context:a||N.context,count:s,...o,...O,defaultValue:l,ns:x};let _=E?P(E,j):l;_===E&&l&&(_=l);const D=Bt($,_,f,r);let R=D||e,q=null;Ht(D)&&(q=D,R=e);const b=zt(R,q,_,f,m,j,C),F=n??m.defaultTransParent;return F?w.createElement(F,h,b):b}function fe({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:u,ns:d,i18n:p,t:v,shouldUnescape:k,...h}){const{i18n:f,defaultNS:P}=w.useContext(Oe)||{},m=p||f||je(),x=v||m?.t.bind(m);return Gt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:u,ns:d||x?.ns||P||m?.options?.defaultNS,i18n:m,t:v,shouldUnescape:k,...h})}async function Kt(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let s="Failed to fetch sync status";try{const n=await e.json();s=n.error||n.message||s}catch{}throw new Error(s)}return e.json()}async function Yt(){const e=new AbortController,s=setTimeout(()=>e.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.signal});if(!n.ok){let r="Sync failed";try{const a=await n.json();r=a.error||a.message||r}catch{}throw new Error(r)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(s)}}function Zt(){return Ne({queryKey:["cliproxy-sync-status"],queryFn:Kt,refetchInterval:3e4,retry:1,staleTime:1e4})}function Jt(){const e=ut(),{t:s}=ce();return dt({mutationFn:Yt,onSuccess:n=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?se.info(s("toasts.noProfilesToSync")):se.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{se.error(s("toasts.syncFailed",{error:n.message}))}})}function he(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function le(e,s){const n=he(e),r=he(s);for(let a=0;a<3;a+=1){const i=n[a]||0,o=r[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}function ae(e,s){return le(e,s)>0}function ie(e,s,n){return le(e,s)>=0&&le(e,n)<=0}const oe={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function ye({className:e,compact:s=!1,state:n,isLoading:r,isSaving:a,error:i,onApply:o}){const{t:c}=ce(),u=n?.strategy??"round-robin",[d,p]=w.useState(u),[v,k]=w.useState(!1),h=n?.source==="live"?"Live CLIProxy":"Saved startup default",f=r||a||!n||d===u,P=v?"Hide details":"Show details";if(s){const m=x=>{p(x),x!==u&&o(x)};return t.jsxs("div",{className:W("group/routing flex items-center justify-between mt-1 p-1 -mx-1 rounded-lg transition-colors hover:bg-primary/5",e),children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:[t.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[t.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),t.jsx(xe,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),t.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),a&&t.jsx(G,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),t.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[t.jsx("div",{className:W("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",d==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(oe).map(([x,g])=>{const N=d===x;return t.jsx("button",{type:"button",className:W("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",N?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>m(x),disabled:r||a||!!i,title:g.description,children:g.title},x)})]})]})}return t.jsx("section",{className:W("rounded-xl border border-border/70 bg-background",e),children:t.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[t.jsxs("div",{className:"min-w-0 space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:t.jsx(xe,{className:"h-4 w-4"})}),t.jsx("div",{className:"text-sm font-medium",children:c("routingGuidance.routingStrategy")}),t.jsx(H,{variant:"secondary",children:u}),n?t.jsx(H,{variant:"outline",children:h}):null,n?t.jsx(H,{variant:"outline",children:n.target}):null]}),t.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."})]}),t.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[t.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(oe).map(([m,x])=>{const g=d===m;return t.jsx("button",{type:"button",className:W("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",g?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>p(m),disabled:r||a||!!i,children:x.title},m)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(K,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>k(m=>!m),children:[v?t.jsx(xt,{className:"mr-1 h-3.5 w-3.5"}):t.jsx(pt,{className:"mr-1 h-3.5 w-3.5"}),P]}),t.jsx(K,{size:"sm",onClick:()=>o(d),disabled:f||!!i,children:a?"Saving...":`Use ${d}`})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[t.jsx("span",{children:c("routingGuidance.roundRobin")}),t.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),t.jsx("span",{children:c("routingGuidance.fillFirst")})]}),i?t.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:i.message}):null,!i&&n?.message?t.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:n.message}):null,v?t.jsx("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:Object.entries(oe).map(([m,x])=>{const g=u===m;return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"text-sm font-medium",children:x.title}),g?t.jsx(H,{variant:"secondary",children:"Current"}):null]}),t.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:x.description})]},m)})}):null]})})}function Qt(e){if(!e)return"";const s=new Date(e).getTime(),r=Date.now()-s,a=Math.floor(r/(1e3*60*60)),i=Math.floor(r%(1e3*60*60)/(1e3*60));return a>0?`${a}h ${i}m`:`${i}m`}function Xt(e,s){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?s("proxyStatusWidget.justNow"):r<60?s("proxyStatusWidget.minutesAgo",{count:r}):s("proxyStatusWidget.hoursAgo",{count:a})}function Y({icon:e,tooltip:s,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return t.jsxs(Qe,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(K,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:W("h-7 w-7 p-0",o==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:n,disabled:r,children:a?t.jsx(G,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(e,{className:"w-3.5 h-3.5"})})}),t.jsx(et,{side:"bottom",className:"text-xs",children:s})]})}function os(){const{t:e}=ce(),{data:s,isLoading:n}=_e(),{data:r}=De(),{data:a,isLoading:i}=Ie(),{data:o,isLoading:c,error:u}=Re(),d=Fe(),p=Le(),v=Ue(),k=ze(),h=qe(),{data:f}=Zt(),{mutate:P,isPending:m}=Jt(),[x,g]=w.useState(!1),[N,C]=w.useState(""),[A,$]=w.useState(!1),[y,l]=w.useState(null),[T,E]=w.useState(null),{data:V}=Ne({queryKey:["cliproxy-server-config"],queryFn:()=>tt.cliproxyServer.get(),staleTime:3e4}),O=mt({mutationKey:["update-backend"]})>0,j=V?.remote,_=j?.enabled&&j?.host,D=s?.running??!1,R=p.isPending||v.isPending||k.isPending||h.isPending||O||m,q=r?.hasUpdate??!1,b=r?.isStable===!1,F=r?.currentVersion,M=f?.configured??!1,ke=e(M?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),Q=b?r?.maxStableVersion||a?.latestStable:r?.latestVersion,ue=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",B=a?.faultyRange,Ae=B&&`${B.min.replace(/-\d+$/,"")}-${B.max.replace(/-\d+$/,"")}`,X=(S,I)=>{l(S),E(I),$(!0)},de=async S=>{if(!S)return;const I=ae(S,ue);if(B!==void 0&&ie(S,B.min,B.max)){X(S,"faulty");return}if(I){X(S,"experimental");return}try{const me=await h.mutateAsync({version:S});me.requiresConfirmation&&X(S,me.isFaulty?"faulty":"experimental")}catch{}},Ee=()=>{y&&h.mutate({version:y,force:!0}),$(!1),l(null),E(null)},Te=()=>{$(!1),l(null),E(null)},Ve=_?(()=>{const S=j.protocol||"http",I=j.port||(S==="https"?443:80);return S==="https"&&I===443||S==="http"&&I===80?j.host:`${j.host}:${I}`})():null;return _?t.jsxs("div",{className:W("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4 text-blue-500"}),t.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),t.jsx(H,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:e("proxyStatusWidget.active")})]}),t.jsx(ft,{className:"w-3 h-3 text-blue-600"})]}),t.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[t.jsx("div",{className:"flex items-center gap-1 mb-1",children:t.jsx("span",{className:"font-mono",children:Ve})}),t.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]}),t.jsx(ye,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:d.isPending,error:u instanceof Error?u:null,onApply:S=>d.mutate(S)},`remote:${o?.strategy??"round-robin"}`)]}):t.jsx(Me,{delayDuration:300,children:t.jsxs("div",{className:W("rounded-lg border p-3 transition-colors",D?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:W("w-2 h-2 rounded-full",D?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),t.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[n?t.jsx(G,{className:"w-3 h-3 animate-spin text-muted-foreground"}):D?t.jsxs(t.Fragment,{children:[t.jsx(Y,{icon:m?G:ht,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>P(),disabled:!M||R,isPending:m}),t.jsx(Y,{icon:yt,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>k.mutate(),disabled:R,isPending:k.isPending}),t.jsx(Y,{icon:bt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>v.mutate(),disabled:R,isPending:v.isPending,variant:"destructive-ghost"})]}):null,t.jsx(Y,{icon:x?jt:vt,tooltip:e(x?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>g(!x),className:x?"bg-muted":void 0})]})]}),F&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[t.jsxs("span",{className:W("text-xs font-mono text-muted-foreground",b&&"text-amber-600 dark:text-amber-400"),children:["v",F]}),(q||b)&&Q&&t.jsxs(H,{variant:"secondary",className:W("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",b?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void de(Q),title:e(b?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[b?t.jsx(Nt,{className:"w-2.5 h-2.5"}):t.jsx(St,{className:"w-2.5 h-2.5"}),Q]})]}),D&&s&&t.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[t.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:s.port})}),s.sessionCount!==void 0&&s.sessionCount>0&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(wt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:s.sessionCount})]}),s.startedAt&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ct,{className:"w-3 h-3"}),Qt(s.startedAt)]})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[M?t.jsx(kt,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):t.jsx(At,{className:"w-3 h-3 text-muted-foreground"}),t.jsx("span",{className:W("text-xs",M?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ke})]}),t.jsx(ye,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:d.isPending,error:u instanceof Error?u:null,onApply:S=>d.mutate(S)},`local:${o?.strategy??"round-robin"}`),t.jsx(Be,{open:x,onOpenChange:g,children:t.jsxs(He,{className:"mt-3 pt-3 border-t border-muted",children:[t.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(Ge,{value:N,onValueChange:C,disabled:i,children:[t.jsx(Ke,{className:"h-8 text-xs flex-1",children:t.jsx(Ye,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),t.jsx(Ze,{children:a?.versions.slice(0,20).map(S=>{const I=a?.maxStableVersion&&ae(S,a.maxStableVersion),ee=a?.faultyRange&&ie(S,a.faultyRange.min,a.faultyRange.max);return t.jsx(Je,{value:S,className:"text-xs",children:t.jsxs("span",{className:"flex items-center gap-2",children:["v",S,S===a.latestStable&&t.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(ee||I)&&t.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},S)})})]}),t.jsxs(K,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void de(N),disabled:h.isPending||!N,children:[h.isPending?t.jsx(G,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(Et,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),N&&a?.maxStableVersion&&ae(N,a.maxStableVersion)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),N&&a?.faultyRange&&ie(N,a.faultyRange.min,a.faultyRange.max)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:N})})]}),r?.checkedAt&&t.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Xt(r.checkedAt,e)})})]})}),!D&&t.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),t.jsxs(K,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>p.mutate(),disabled:p.isPending,children:[p.isPending?t.jsx(G,{className:"w-3 h-3 animate-spin"}):t.jsx(Tt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),t.jsx(st,{open:A,onOpenChange:$,children:t.jsxs(nt,{children:[t.jsxs(rt,{children:[t.jsxs(at,{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-5 h-5 text-amber-500"}),e(T==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),t.jsxs(it,{className:"space-y-2",children:[T==="faulty"?t.jsx("p",{children:t.jsx(fe,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:y??"",range:Ae||""},components:{strong:t.jsx("strong",{})}})}):t.jsx("p",{children:t.jsx(fe,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:y??"",maxStable:ue},components:{strong:t.jsx("strong",{})}})}),t.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(T==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),t.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),t.jsxs(ot,{children:[t.jsx(lt,{onClick:Te,children:e("proxyStatusWidget.cancel")}),t.jsx(ct,{onClick:Ee,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{os as P};
1
+ import{j as t}from"./radix-ui-Zb8sVEtn.js";import{g as Pe,r as w}from"./react-vendor-CNOkPC89.js";import{bu as be,bv as je,bw as ve,bx as $e,by as z,bz as te,bA as L,bB as We,bC as Oe,a as ce,c as W,B as H,d as K,bt as _e,aW as De,bD as Ie,bE as Re,bF as Fe,bG as Le,bH as Ue,bI as ze,bJ as qe,aJ as Me,M as Be,O as He,r as Ge,s as Ke,t as Ye,v as Ze,w as Je,T as Qe,p as Xe,q as et,Y as tt}from"./index-g2g1k0QS.js";import{A as st,a as nt,b as rt,c as at,d as it,e as ot,f as lt,g as ct}from"./alert-dialog-sars2LJq.js";import{u as Ne,a as ut,b as dt,h as mt}from"./tanstack-CrmUhA7Z.js";import{t as se}from"./notifications-B2HqRBj7.js";import{bd as xe,R as G,t as xt,s as pt,u as gt,A as ft,be as ht,bf as yt,bg as bt,X as jt,e as vt,bh as Nt,bi as St,U as wt,v as Ct,m as kt,w as At,aE as Et,T as ne,aO as Tt}from"./icons-KVCk4_U8.js";var re,pe;function Vt(){return pe||(pe=1,re={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),re}var Pt=Vt();const $t=Pe(Pt);var Wt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ge(e){var s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(s.name=n[1],($t[n[1]]||e.charAt(e.length-2)==="/")&&(s.voidElement=!0),s.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Wt),i=null;(i=a.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),s.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}var Ot=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,_t=/^\s*$/,Dt=Object.create(null);function Se(e,s){switch(s.type){case"text":return e+s.content;case"tag":return e+="<"+s.name+(s.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(s.attrs):"")+(s.voidElement?"/>":">"),s.voidElement?e:e+s.children.reduce(Se,"")+"</"+s.name+">";case"comment":return e+"<!--"+s.comment+"-->"}}var It={parse:function(e,s){s||(s={}),s.components||(s.components=Dt);var n,r=[],a=[],i=-1,o=!1;if(e.indexOf("<")!==0){var c=e.indexOf("<");r.push({type:"text",content:c===-1?e:e.substring(0,c)})}return e.replace(Ot,function(u,d){if(o){if(u!=="</"+n.name+">")return;o=!1}var p,v=u.charAt(1)!=="/",k=u.startsWith("<!--"),h=d+u.length,f=e.charAt(h);if(k){var P=ge(u);return i<0?(r.push(P),r):((p=a[i]).children.push(P),r)}if(v&&(i++,(n=ge(u)).type==="tag"&&s.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!f||f==="<"||n.children.push({type:"text",content:e.slice(h,e.indexOf("<",h))}),i===0&&r.push(n),(p=a[i-1])&&p.children.push(n),a[i]=n),(!v||n.voidElement)&&(i>-1&&(n.voidElement||n.name===u.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&f!=="<"&&f)){p=i===-1?r:a[i].children;var m=e.indexOf("<",h),x=e.slice(h,m===-1?void 0:m);_t.test(x)&&(x=" "),(m>-1&&i+p.length>=0||x!==" ")&&p.push({type:"text",content:x})}}),r},stringify:function(e){return e.reduce(function(s,n){return s+Se("",n)},"")}};const Z=(e,s)=>{if(!e)return!1;const n=e.props?.children??e.children;return s?n.length>0:!!n},J=e=>{if(!e)return[];const s=e.props?.children??e.children;return e.props?.i18nIsDynamicList?U(s):s},Rt=e=>Array.isArray(e)&&e.every(w.isValidElement),U=e=>Array.isArray(e)?e:[e],Ft=(e,s)=>{const n={...s};return n.props={...s.props,...e.props},n},Lt=e=>{const s={};if(!e)return s;const n=r=>{U(r).forEach(i=>{z(i)||(Z(i)?n(J(i)):L(i)&&!w.isValidElement(i)&&Object.assign(s,i))})};return n(e),s},we=(e,s,n,r)=>{if(!e)return"";let a="";const i=U(e),o=s?.transSupportBasicHtmlNodes?s.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,u)=>{if(z(c)){a+=`${c}`;return}if(w.isValidElement(c)){const{props:d,type:p}=c,v=Object.keys(d).length,k=o.indexOf(p)>-1,h=d.children;if(!h&&k&&!v){a+=`<${p}/>`;return}if(!h&&(!k||v)||d.i18nIsDynamicList){a+=`<${u}></${u}>`;return}if(k&&v===1&&z(h)){a+=`<${p}>${h}</${p}>`;return}const f=we(h,s,n,r);a+=`<${u}>${f}</${u}>`;return}if(c===null){te(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:d,...p}=c,v=Object.keys(p);if(v.length===1){const k=d?`${v[0]}, ${d}`:v[0];a+=`{{${k}}}`;return}te(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}te(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Ut=(e,s=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...s,...r];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let c=!1;const u=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(u){const d=u[1];(/^\d+$/.test(d)||a.includes(d))&&(c=!0,i+=u[0],o+=u[0].length)}if(!c){const d=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(d){const p=d[1];(/^\d+$/.test(p)||a.includes(p))&&(c=!0,i+=d[0],o+=d[0].length)}}c||(i+="&lt;",o+=1)}else i+=e[o],o+=1;return i},zt=(e,s,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(c.map(g=>`<${g}`).join("|")).test(n);if(!e&&!s&&!u&&!o)return[n];const d=s??{},p=g=>{U(g).forEach(C=>{z(C)||(Z(C)?p(J(C)):L(C)&&!w.isValidElement(C)&&Object.assign(d,C))})};p(e);const v=Ut(n,c,d),k=It.parse(`<0>${v}</0>`),h={...d,...i},f=(g,N,C)=>{const A=J(g),$=m(A,N.children,C);return Rt(A)&&$.length===0||g.props?.i18nIsDynamicList?A:$},P=(g,N,C,A,$)=>{g.dummy?(g.children=N,C.push(w.cloneElement(g,{key:A},$?void 0:N))):C.push(...w.Children.map([g],y=>{const l="data-i18n-is-dynamic-list",T={key:A,[l]:void 0};return y&&y.props&&Object.keys(y.props).forEach(E=>{E==="ref"||E==="children"||E==="i18nIsDynamicList"||E===l||(T[E]=y.props[E])}),w.cloneElement(y,T,$?null:N)}))},m=(g,N,C)=>{const A=U(g);return U(N).reduce((y,l,T)=>{const E=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,h,r.language);if(l.type==="tag"){let V=A[parseInt(l.name,10)];!V&&s&&(V=s[l.name]),C.length===1&&!V&&(V=C[0][l.name]),V||(V={});const O={...l.attrs};o&&Object.keys(O).forEach(b=>{const F=O[b];z(F)&&(O[b]=We(F))});const j=Object.keys(O).length!==0?Ft({props:O},V):V,_=w.isValidElement(j),D=_&&Z(l,!0)&&!l.voidElement,R=u&&L(j)&&j.dummy&&!_,q=L(s)&&Object.hasOwnProperty.call(s,l.name);if(z(j)){const b=r.services.interpolator.interpolate(j,h,r.language);y.push(b)}else if(Z(j)||D){const b=f(j,l,C);P(j,b,y,T)}else if(R){const b=m(A,l.children,C);P(j,b,y,T)}else if(Number.isNaN(parseFloat(l.name)))if(q){const b=f(j,l,C);P(j,b,y,T,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)y.push(w.createElement(l.name,{key:`${l.name}-${T}`}));else{const b=m(A,l.children,C);y.push(w.createElement(l.name,{key:`${l.name}-${T}`},b))}else if(l.voidElement)y.push(`<${l.name} />`);else{const b=m(A,l.children,C);y.push(`<${l.name}>${b}</${l.name}>`)}else if(L(j)&&!_){const b=l.children[0]?E:null;b&&y.push(b)}else P(j,E,y,T,l.children.length!==1||!E)}else if(l.type==="text"){const V=a.transWrapTextNodes,O=typeof a.unescape=="function"?a.unescape:ve().unescape,j=o?O(r.services.interpolator.interpolate(l.content,h,r.language)):r.services.interpolator.interpolate(l.content,h,r.language);V?y.push(w.createElement(V,{key:`${l.name}-${T}`},j)):y.push(j)}return y},[])},x=m([{dummy:!0,children:e||[]}],k,U(e||[]));return J(x[0])},Ce=(e,s,n)=>{const r=e.key||s,a=w.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${s}/>`)<0&&n.indexOf(`${s} />`)<0)return a;function i(){return w.createElement(w.Fragment,null,a)}return w.createElement(i,{key:r})},qt=(e,s)=>e.map((n,r)=>Ce(n,r,s)),Mt=(e,s)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Ce(e[r],r,s)})}),n},Bt=(e,s,n,r)=>e?Array.isArray(e)?qt(e,s):L(e)?Mt(e,s):(be(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Ht=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((s,n)=>s&&Number.isNaN(Number.parseFloat(n)),!0);function Gt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:u,ns:d,i18n:p,t:v,shouldUnescape:k,...h}){const f=p||je();if(!f)return be(f,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const P=v||f.t.bind(f)||(M=>M),m={...ve(),...f.options?.react};let x=d||P.ns||f.options?.defaultNS;x=z(x)?[x]:x||["translation"];const{transDefaultProps:g}=m,N=g?.tOptions?{...g.tOptions,...i}:i,C=k??g?.shouldUnescape,A=g?.values?{...g.values,...o}:o,$=g?.components?{...g.components,...u}:u,y=we(e,m,f,r),l=c||N?.defaultValue||y||m.transEmptyNodeValue||(typeof r=="function"?$e(r):r),{hashTransKey:T}=m,E=r||(T?T(y||l):y||l);f.options?.interpolation?.defaultVariables?o=A&&Object.keys(A).length>0?{...A,...f.options.interpolation.defaultVariables}:{...f.options.interpolation.defaultVariables}:o=A;const V=Lt(e);V&&typeof V.count=="number"&&s===void 0&&(s=V.count);const O=o||s!==void 0&&!f.options?.interpolation?.alwaysFormat||!e?N.interpolation:{interpolation:{...N.interpolation,prefix:"#$?",suffix:"?$#"}},j={...N,context:a||N.context,count:s,...o,...O,defaultValue:l,ns:x};let _=E?P(E,j):l;_===E&&l&&(_=l);const D=Bt($,_,f,r);let R=D||e,q=null;Ht(D)&&(q=D,R=e);const b=zt(R,q,_,f,m,j,C),F=n??m.defaultTransParent;return F?w.createElement(F,h,b):b}function fe({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:u,ns:d,i18n:p,t:v,shouldUnescape:k,...h}){const{i18n:f,defaultNS:P}=w.useContext(Oe)||{},m=p||f||je(),x=v||m?.t.bind(m);return Gt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:u,ns:d||x?.ns||P||m?.options?.defaultNS,i18n:m,t:v,shouldUnescape:k,...h})}async function Kt(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let s="Failed to fetch sync status";try{const n=await e.json();s=n.error||n.message||s}catch{}throw new Error(s)}return e.json()}async function Yt(){const e=new AbortController,s=setTimeout(()=>e.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.signal});if(!n.ok){let r="Sync failed";try{const a=await n.json();r=a.error||a.message||r}catch{}throw new Error(r)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(s)}}function Zt(){return Ne({queryKey:["cliproxy-sync-status"],queryFn:Kt,refetchInterval:3e4,retry:1,staleTime:1e4})}function Jt(){const e=ut(),{t:s}=ce();return dt({mutationFn:Yt,onSuccess:n=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?se.info(s("toasts.noProfilesToSync")):se.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{se.error(s("toasts.syncFailed",{error:n.message}))}})}function he(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function le(e,s){const n=he(e),r=he(s);for(let a=0;a<3;a+=1){const i=n[a]||0,o=r[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}function ae(e,s){return le(e,s)>0}function ie(e,s,n){return le(e,s)>=0&&le(e,n)<=0}const oe={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function ye({className:e,compact:s=!1,state:n,isLoading:r,isSaving:a,error:i,onApply:o}){const{t:c}=ce(),u=n?.strategy??"round-robin",[d,p]=w.useState(u),[v,k]=w.useState(!1),h=n?.source==="live"?"Live CLIProxy":"Saved startup default",f=r||a||!n||d===u,P=v?"Hide details":"Show details";if(s){const m=x=>{p(x),x!==u&&o(x)};return t.jsxs("div",{className:W("group/routing flex items-center justify-between mt-1 p-1 -mx-1 rounded-lg transition-colors hover:bg-primary/5",e),children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:[t.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[t.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),t.jsx(xe,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),t.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),a&&t.jsx(G,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),t.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[t.jsx("div",{className:W("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",d==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(oe).map(([x,g])=>{const N=d===x;return t.jsx("button",{type:"button",className:W("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",N?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>m(x),disabled:r||a||!!i,title:g.description,children:g.title},x)})]})]})}return t.jsx("section",{className:W("rounded-xl border border-border/70 bg-background",e),children:t.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[t.jsxs("div",{className:"min-w-0 space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:t.jsx(xe,{className:"h-4 w-4"})}),t.jsx("div",{className:"text-sm font-medium",children:c("routingGuidance.routingStrategy")}),t.jsx(H,{variant:"secondary",children:u}),n?t.jsx(H,{variant:"outline",children:h}):null,n?t.jsx(H,{variant:"outline",children:n.target}):null]}),t.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."})]}),t.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[t.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(oe).map(([m,x])=>{const g=d===m;return t.jsx("button",{type:"button",className:W("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",g?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>p(m),disabled:r||a||!!i,children:x.title},m)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(K,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>k(m=>!m),children:[v?t.jsx(xt,{className:"mr-1 h-3.5 w-3.5"}):t.jsx(pt,{className:"mr-1 h-3.5 w-3.5"}),P]}),t.jsx(K,{size:"sm",onClick:()=>o(d),disabled:f||!!i,children:a?"Saving...":`Use ${d}`})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[t.jsx("span",{children:c("routingGuidance.roundRobin")}),t.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),t.jsx("span",{children:c("routingGuidance.fillFirst")})]}),i?t.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:i.message}):null,!i&&n?.message?t.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:n.message}):null,v?t.jsx("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:Object.entries(oe).map(([m,x])=>{const g=u===m;return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"text-sm font-medium",children:x.title}),g?t.jsx(H,{variant:"secondary",children:"Current"}):null]}),t.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:x.description})]},m)})}):null]})})}function Qt(e){if(!e)return"";const s=new Date(e).getTime(),r=Date.now()-s,a=Math.floor(r/(1e3*60*60)),i=Math.floor(r%(1e3*60*60)/(1e3*60));return a>0?`${a}h ${i}m`:`${i}m`}function Xt(e,s){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?s("proxyStatusWidget.justNow"):r<60?s("proxyStatusWidget.minutesAgo",{count:r}):s("proxyStatusWidget.hoursAgo",{count:a})}function Y({icon:e,tooltip:s,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return t.jsxs(Qe,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(K,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:W("h-7 w-7 p-0",o==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:n,disabled:r,children:a?t.jsx(G,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(e,{className:"w-3.5 h-3.5"})})}),t.jsx(et,{side:"bottom",className:"text-xs",children:s})]})}function os(){const{t:e}=ce(),{data:s,isLoading:n}=_e(),{data:r}=De(),{data:a,isLoading:i}=Ie(),{data:o,isLoading:c,error:u}=Re(),d=Fe(),p=Le(),v=Ue(),k=ze(),h=qe(),{data:f}=Zt(),{mutate:P,isPending:m}=Jt(),[x,g]=w.useState(!1),[N,C]=w.useState(""),[A,$]=w.useState(!1),[y,l]=w.useState(null),[T,E]=w.useState(null),{data:V}=Ne({queryKey:["cliproxy-server-config"],queryFn:()=>tt.cliproxyServer.get(),staleTime:3e4}),O=mt({mutationKey:["update-backend"]})>0,j=V?.remote,_=j?.enabled&&j?.host,D=s?.running??!1,R=p.isPending||v.isPending||k.isPending||h.isPending||O||m,q=r?.hasUpdate??!1,b=r?.isStable===!1,F=r?.currentVersion,M=f?.configured??!1,ke=e(M?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),Q=b?r?.maxStableVersion||a?.latestStable:r?.latestVersion,ue=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",B=a?.faultyRange,Ae=B&&`${B.min.replace(/-\d+$/,"")}-${B.max.replace(/-\d+$/,"")}`,X=(S,I)=>{l(S),E(I),$(!0)},de=async S=>{if(!S)return;const I=ae(S,ue);if(B!==void 0&&ie(S,B.min,B.max)){X(S,"faulty");return}if(I){X(S,"experimental");return}try{const me=await h.mutateAsync({version:S});me.requiresConfirmation&&X(S,me.isFaulty?"faulty":"experimental")}catch{}},Ee=()=>{y&&h.mutate({version:y,force:!0}),$(!1),l(null),E(null)},Te=()=>{$(!1),l(null),E(null)},Ve=_?(()=>{const S=j.protocol||"http",I=j.port||(S==="https"?443:80);return S==="https"&&I===443||S==="http"&&I===80?j.host:`${j.host}:${I}`})():null;return _?t.jsxs("div",{className:W("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4 text-blue-500"}),t.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),t.jsx(H,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:e("proxyStatusWidget.active")})]}),t.jsx(ft,{className:"w-3 h-3 text-blue-600"})]}),t.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[t.jsx("div",{className:"flex items-center gap-1 mb-1",children:t.jsx("span",{className:"font-mono",children:Ve})}),t.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]}),t.jsx(ye,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:d.isPending,error:u instanceof Error?u:null,onApply:S=>d.mutate(S)},`remote:${o?.strategy??"round-robin"}`)]}):t.jsx(Me,{delayDuration:300,children:t.jsxs("div",{className:W("rounded-lg border p-3 transition-colors",D?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:W("w-2 h-2 rounded-full",D?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),t.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[n?t.jsx(G,{className:"w-3 h-3 animate-spin text-muted-foreground"}):D?t.jsxs(t.Fragment,{children:[t.jsx(Y,{icon:m?G:ht,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>P(),disabled:!M||R,isPending:m}),t.jsx(Y,{icon:yt,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>k.mutate(),disabled:R,isPending:k.isPending}),t.jsx(Y,{icon:bt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>v.mutate(),disabled:R,isPending:v.isPending,variant:"destructive-ghost"})]}):null,t.jsx(Y,{icon:x?jt:vt,tooltip:e(x?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>g(!x),className:x?"bg-muted":void 0})]})]}),F&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[t.jsxs("span",{className:W("text-xs font-mono text-muted-foreground",b&&"text-amber-600 dark:text-amber-400"),children:["v",F]}),(q||b)&&Q&&t.jsxs(H,{variant:"secondary",className:W("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",b?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void de(Q),title:e(b?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[b?t.jsx(Nt,{className:"w-2.5 h-2.5"}):t.jsx(St,{className:"w-2.5 h-2.5"}),Q]})]}),D&&s&&t.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[t.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:s.port})}),s.sessionCount!==void 0&&s.sessionCount>0&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(wt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:s.sessionCount})]}),s.startedAt&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ct,{className:"w-3 h-3"}),Qt(s.startedAt)]})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[M?t.jsx(kt,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):t.jsx(At,{className:"w-3 h-3 text-muted-foreground"}),t.jsx("span",{className:W("text-xs",M?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ke})]}),t.jsx(ye,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:d.isPending,error:u instanceof Error?u:null,onApply:S=>d.mutate(S)},`local:${o?.strategy??"round-robin"}`),t.jsx(Be,{open:x,onOpenChange:g,children:t.jsxs(He,{className:"mt-3 pt-3 border-t border-muted",children:[t.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(Ge,{value:N,onValueChange:C,disabled:i,children:[t.jsx(Ke,{className:"h-8 text-xs flex-1",children:t.jsx(Ye,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),t.jsx(Ze,{children:a?.versions.slice(0,20).map(S=>{const I=a?.maxStableVersion&&ae(S,a.maxStableVersion),ee=a?.faultyRange&&ie(S,a.faultyRange.min,a.faultyRange.max);return t.jsx(Je,{value:S,className:"text-xs",children:t.jsxs("span",{className:"flex items-center gap-2",children:["v",S,S===a.latestStable&&t.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(ee||I)&&t.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},S)})})]}),t.jsxs(K,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void de(N),disabled:h.isPending||!N,children:[h.isPending?t.jsx(G,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(Et,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),N&&a?.maxStableVersion&&ae(N,a.maxStableVersion)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),N&&a?.faultyRange&&ie(N,a.faultyRange.min,a.faultyRange.max)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:N})})]}),r?.checkedAt&&t.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Xt(r.checkedAt,e)})})]})}),!D&&t.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),t.jsxs(K,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>p.mutate(),disabled:p.isPending,children:[p.isPending?t.jsx(G,{className:"w-3 h-3 animate-spin"}):t.jsx(Tt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),t.jsx(st,{open:A,onOpenChange:$,children:t.jsxs(nt,{children:[t.jsxs(rt,{children:[t.jsxs(at,{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-5 h-5 text-amber-500"}),e(T==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),t.jsxs(it,{className:"space-y-2",children:[T==="faulty"?t.jsx("p",{children:t.jsx(fe,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:y??"",range:Ae||""},components:{strong:t.jsx("strong",{})}})}):t.jsx("p",{children:t.jsx(fe,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:y??"",maxStable:ue},components:{strong:t.jsx("strong",{})}})}),t.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(T==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),t.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),t.jsxs(ot,{children:[t.jsx(lt,{onClick:Te,children:e("proxyStatusWidget.cancel")}),t.jsx(ct,{onClick:Ee,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{os as P};
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{t as k}from"./notifications-B2HqRBj7.js";import{B as R,d as a,c as E,b8 as z,W as S}from"./index-BDfXfBTa.js";import{aW as B,L as m,at as L,o as P,R as T}from"./icons-KVCk4_U8.js";function F({title:c,pathLabel:x,loading:t,parseWarning:r,readWarning:i,value:s,dirty:n,readOnly:h=!1,saving:f,saveDisabled:j,onChange:p,onSave:u,onRefresh:b,onDiscard:l,language:v="json",loadingLabel:N="Loading settings.json...",parseWarningLabel:g="Parse warning",ownershipNotice:d}){const[w,o]=y.useState(!1),C=async()=>{s&&(await navigator.clipboard.writeText(s),o(!0),k.success(S.t("commonToast.settingsCopied")),window.setTimeout(()=>o(!1),1500))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4 text-primary"}),c,n&&e.jsx(R,{variant:"secondary",className:"text-[10px]",children:"Unsaved"})]}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate",children:x})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",onClick:u,disabled:j,children:[f?e.jsx(m,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(L,{className:"h-4 w-4 mr-1"}),"Save"]}),l?e.jsx(a,{variant:"outline",size:"sm",onClick:l,disabled:!n||t,children:"Discard"}):null,e.jsxs(a,{variant:"outline",size:"sm",onClick:C,disabled:!s,children:[e.jsx(P,{className:"h-4 w-4 mr-1"}),w?"Copied":"Copy"]}),e.jsx(a,{variant:"outline",size:"sm",onClick:b,"aria-label":"Refresh raw config",children:e.jsx(T,{className:E("h-4 w-4",t?"animate-spin":"")})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:t?e.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[e.jsx(m,{className:"h-5 w-5 animate-spin mr-2"}),N]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d&&e.jsx("div",{className:"mx-4 mt-4",children:d}),r&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-300",children:[g,": ",r]}),i&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Read-only: ",i]}),e.jsx("div",{className:"min-h-0 flex-1 p-4 pt-3",children:e.jsx("div",{className:"h-full rounded-md border overflow-hidden bg-background",children:e.jsx(z,{value:s,onChange:p,language:v,readonly:h,minHeight:"100%",heightMode:"fill-parent"})})})]})})]})}const A=F;export{F as R,A as a};
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{t as k}from"./notifications-B2HqRBj7.js";import{B as R,d as a,c as E,b8 as z,W as S}from"./index-g2g1k0QS.js";import{aW as B,L as m,at as L,o as P,R as T}from"./icons-KVCk4_U8.js";function F({title:c,pathLabel:x,loading:t,parseWarning:r,readWarning:i,value:s,dirty:n,readOnly:h=!1,saving:f,saveDisabled:j,onChange:p,onSave:u,onRefresh:b,onDiscard:l,language:v="json",loadingLabel:N="Loading settings.json...",parseWarningLabel:g="Parse warning",ownershipNotice:d}){const[w,o]=y.useState(!1),C=async()=>{s&&(await navigator.clipboard.writeText(s),o(!0),k.success(S.t("commonToast.settingsCopied")),window.setTimeout(()=>o(!1),1500))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4 text-primary"}),c,n&&e.jsx(R,{variant:"secondary",className:"text-[10px]",children:"Unsaved"})]}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate",children:x})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",onClick:u,disabled:j,children:[f?e.jsx(m,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(L,{className:"h-4 w-4 mr-1"}),"Save"]}),l?e.jsx(a,{variant:"outline",size:"sm",onClick:l,disabled:!n||t,children:"Discard"}):null,e.jsxs(a,{variant:"outline",size:"sm",onClick:C,disabled:!s,children:[e.jsx(P,{className:"h-4 w-4 mr-1"}),w?"Copied":"Copy"]}),e.jsx(a,{variant:"outline",size:"sm",onClick:b,"aria-label":"Refresh raw config",children:e.jsx(T,{className:E("h-4 w-4",t?"animate-spin":"")})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:t?e.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[e.jsx(m,{className:"h-5 w-5 animate-spin mr-2"}),N]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d&&e.jsx("div",{className:"mx-4 mt-4",children:d}),r&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-300",children:[g,": ",r]}),i&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Read-only: ",i]}),e.jsx("div",{className:"min-h-0 flex-1 p-4 pt-3",children:e.jsx("div",{className:"h-full rounded-md border overflow-hidden bg-background",children:e.jsx(z,{value:s,onChange:p,language:v,readonly:h,minHeight:"100%",heightMode:"fill-parent"})})})]})})]})}const A=F;export{F as R,A as a};
@@ -1 +1 @@
1
- import{j as n}from"./radix-ui-Zb8sVEtn.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as _,f as P,d as $,c as w,g as B,I as G}from"./index-BDfXfBTa.js";import{aQ as H,au as L,m as V}from"./icons-KVCk4_U8.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function Z({value:o,onChange:h,options:f,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:q,triggerClassName:K,contentClassName:R}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,c]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>f.find(e=>e.value===o),[f,o]),d=a.useMemo(()=>{const e=S(y);return e?f.filter(t=>[t.searchText,...t.keywords??[]].some(u=>S(u).includes(e))):f},[f,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=d.filter(r=>!r.groupKey||!e.has(r.groupKey)),u=(g??[]).map(r=>({...r,options:d.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?u:[{key:"__default",options:t},...u]},[d,g]),s=a.useMemo(()=>d.filter(e=>!e.disabled),[d]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),c(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){c(void 0);return}c(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){c(s[0]?.value);return}if(e==="last"){c(s.at(-1)?.value);return}const t=s.findIndex(U=>U.value===i),u=e==="next"?-1:s.length,r=t>=0?t:u,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);c(s[x]?.value)},C=e=>{h(e),v(!1)},Q=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(_,{open:l,onOpenChange:v,children:[n.jsx(P,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",q,K,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(H,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",R),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),Q();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx("div",{"data-slot":"searchable-select-scroll-container","data-testid":"searchable-select-scroll-container",className:"max-h-72 overflow-y-auto overscroll-contain",children:d.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const u=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||c(t.value)},onFocus:()=>{t.disabled||c(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",u&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{Z as S};
1
+ import{j as n}from"./radix-ui-Zb8sVEtn.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as _,f as P,d as $,c as w,g as B,I as G}from"./index-g2g1k0QS.js";import{aQ as H,au as L,m as V}from"./icons-KVCk4_U8.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function Z({value:o,onChange:h,options:f,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:q,triggerClassName:K,contentClassName:R}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,c]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>f.find(e=>e.value===o),[f,o]),d=a.useMemo(()=>{const e=S(y);return e?f.filter(t=>[t.searchText,...t.keywords??[]].some(u=>S(u).includes(e))):f},[f,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=d.filter(r=>!r.groupKey||!e.has(r.groupKey)),u=(g??[]).map(r=>({...r,options:d.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?u:[{key:"__default",options:t},...u]},[d,g]),s=a.useMemo(()=>d.filter(e=>!e.disabled),[d]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),c(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){c(void 0);return}c(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){c(s[0]?.value);return}if(e==="last"){c(s.at(-1)?.value);return}const t=s.findIndex(U=>U.value===i),u=e==="next"?-1:s.length,r=t>=0?t:u,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);c(s[x]?.value)},C=e=>{h(e),v(!1)},Q=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(_,{open:l,onOpenChange:v,children:[n.jsx(P,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",q,K,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(H,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",R),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),Q();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx("div",{"data-slot":"searchable-select-scroll-container","data-testid":"searchable-select-scroll-container",className:"max-h-72 overflow-y-auto overscroll-contain",children:d.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const u=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||c(t.value)},onFocus:()=>{t.disabled||c(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",u&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{Z as S};
@@ -1 +1 @@
1
- import{j as i,a0 as n}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-BDfXfBTa.js";function m({className:t,orientation:a="horizontal",decorative:o=!0,...r}){return i.jsx(n,{"data-slot":"separator",decorative:o,orientation:a,className:e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}export{m as S};
1
+ import{j as i,a0 as n}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-g2g1k0QS.js";function m({className:t,orientation:a="horizontal",decorative:o=!0,...r}){return i.jsx(n,{"data-slot":"separator",decorative:o,orientation:a,className:e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}export{m as S};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bm as ee,bn as se,bo as te,Q as ae,R as re,U as ne,B as $,be as S,bf as M,bg as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-BDfXfBTa.js";import{a3 as ce,aa as oe,b7 as me,T as E,R as T,F as he,au as ue,w as xe}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bm as ee,bn as se,bo as te,Q as ae,R as re,U as ne,B as $,be as S,bf as M,bg as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-g2g1k0QS.js";import{a3 as ce,aa as oe,b7 as me,T as E,R as T,F as he,au as ue,w as xe}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
2
2
  `).trim();if(!a)return{blocks:[],frontmatter:[]};let l=a;const t=[];if(l.startsWith(`---
3
3
  `)){const r=l.indexOf(`
4
4
  ---
@@ -1 +1 @@
1
- import{j as t}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as l}from"./index-BDfXfBTa.js";function n({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function c({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function b({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",a),...e})}function i({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}function m({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}export{n as T,c as a,b,i as c,d,m as e};
1
+ import{j as t}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as l}from"./index-g2g1k0QS.js";function n({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function c({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function b({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",a),...e})}function i({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}function m({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}export{n as T,c as a,b,i as c,d,m as e};