@chenpu17/cc-gw 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +3 -3
  2. package/package.json +5 -5
  3. package/src/web/dist/assets/About-CTbbI3Xf.js +1 -0
  4. package/src/web/dist/assets/ApiKeys-Dca6MyO2.js +1 -0
  5. package/src/web/dist/assets/ConfirmDialog-DW7jBfm1.js +1 -0
  6. package/src/web/dist/assets/{Dashboard-BizLDn_V.js → Dashboard-DMo-YHgS.js} +1 -1
  7. package/src/web/dist/assets/{DialogShell-CiIvBp8J.js → DialogShell-BqzUE3vU.js} +1 -1
  8. package/src/web/dist/assets/{Events-DpPg8dt0.js → Events-19qjsHJf.js} +1 -1
  9. package/src/web/dist/assets/{Help-B9ewdIkl.js → Help-FrXAXPhx.js} +1 -1
  10. package/src/web/dist/assets/{Login-5O2Xtr5G.js → Login-BYpsX-S8.js} +1 -1
  11. package/src/web/dist/assets/{Logs-D29vlNyO.js → Logs-ynLMNHgv.js} +1 -1
  12. package/src/web/dist/assets/ModelManagement-DrE_4kky.js +1 -0
  13. package/src/web/dist/assets/{PageHeader-CSF0BWul.js → PageHeader-DDxjKW4B.js} +1 -1
  14. package/src/web/dist/assets/{PageSection-Bp_SuEp0.js → PageSection-DRyQEnmK.js} +1 -1
  15. package/src/web/dist/assets/{PageState-BeXrzVEe.js → PageState-DA98vXl7.js} +1 -1
  16. package/src/web/dist/assets/{Profiler-Cwuq3cjV.js → Profiler-D5P7FF0I.js} +1 -1
  17. package/src/web/dist/assets/Settings-D8Xgk7cH.js +1 -0
  18. package/src/web/dist/assets/{Skeleton-8j6Dxod1.js → Skeleton-D_opZxQ7.js} +1 -1
  19. package/src/web/dist/assets/{badge-BvMdmUqJ.js → badge-B-TfGxGB.js} +1 -1
  20. package/src/web/dist/assets/{card-CjhYPqKk.js → card-I07afQF2.js} +1 -1
  21. package/src/web/dist/assets/{gateway-B0gBBN92.js → gateway-CkqHb_VE.js} +1 -1
  22. package/src/web/dist/assets/index-CYeQpt9d.js +61 -0
  23. package/src/web/dist/assets/{input-BnFZKjRM.js → input-DZMeIHxj.js} +1 -1
  24. package/src/web/dist/assets/{label-i5-Lf72z.js → label-DZr7itdg.js} +1 -1
  25. package/src/web/dist/assets/{popover-EFz6sQ7C.js → popover-_LyL4tgU.js} +1 -1
  26. package/src/web/dist/assets/{select-KdDvaKo4.js → select-BUvJR07s.js} +1 -1
  27. package/src/web/dist/assets/{switch-BVWWsjy3.js → switch-BpfcwR9i.js} +1 -1
  28. package/src/web/dist/assets/{useApiQuery-fBWRSgFK.js → useApiQuery-BzbOtl4s.js} +1 -1
  29. package/src/web/dist/assets/useAppMutation-D8Mjcv9t.js +1 -0
  30. package/src/web/dist/index.html +1 -1
  31. package/src/web/dist/assets/About-BCHV3wbt.js +0 -1
  32. package/src/web/dist/assets/ApiKeys-Do48QVpZ.js +0 -1
  33. package/src/web/dist/assets/ModelManagement-CrmNhCAh.js +0 -1
  34. package/src/web/dist/assets/Settings-Q6TBItFQ.js +0 -1
  35. package/src/web/dist/assets/index-BzuBtvAC.js +0 -61
  36. package/src/web/dist/assets/useAppMutation-Cd6HN12q.js +0 -1
@@ -1 +1 @@
1
- import{r as f,j as e,X as Y,am as ie,ay as Z,aH as oe,aI as de,S as ce,ar as xe,a1 as me,al as ue}from"./vendor-5iCEqDpV.js";import{u as pe,a as A,b as S}from"./query-DxhDvnDC.js";import{P as ee,a as M}from"./PageState-BeXrzVEe.js";import{B as se}from"./badge-BvMdmUqJ.js";import{h as F,b as q,r as O,c as m,B as $}from"./index-BzuBtvAC.js";import{d as he}from"./utils-DQfq7gRo.js";import{q as b}from"./queryKeys-BMvyDTQS.js";import"./i18n-C7VVFIdN.js";import"./router-D8u_RlVh.js";import"./radix-CmyU-WBH.js";const v={getStatus:()=>O({url:"/api/profiler/status",method:"GET"}),start:()=>F(q.post("/api/profiler/start")),stop:()=>F(q.post("/api/profiler/stop")),listSessions:s=>O({url:"/api/profiler/sessions",method:"GET",params:s}),getSession:s=>O({url:`/api/profiler/sessions/${s}`,method:"GET"}),deleteSession:s=>F(q.delete(`/api/profiler/sessions/${s}`)),clearAll:()=>F(q.post("/api/profiler/sessions/clear"))};function g(s){return s==null?"-":s>=1e3?`${(s/1e3).toFixed(2)}s`:`${Math.round(s)}ms`}function I(s){return s==null?"-":s>=1e3?`${(s/1e3).toFixed(1)}s`:`${Math.round(s)}ms`}function k(s){return s==null?"-":s.toLocaleString()}function K(s){return s==null?"-":s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function L(s){return s.endedAt==null||s.turnCount===0?s.totalLatencyMs??0:s.endedAt-s.startedAt}function fe(s){const t=s.sessionId;return t.length>18?`${t.slice(0,8)}…${t.slice(-6)}`:t}function be(s){const t=Math.max(0,Date.now()-s),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n} min ago`;const l=Math.floor(n/60);if(l<24)return`${l} hr ago`;const r=Math.floor(l/24);return`${r} day${r===1?"":"s"} ago`}function ge(s){if(!s)return null;try{return JSON.parse(s)}catch{return null}}function _(s,t){if(Array.isArray(s)){for(const n of s)_(n,t);return}if(s&&typeof s=="object"){const n=s,l=n.tool_calls;Array.isArray(l)&&t.push(...l);const r=n.content;if(Array.isArray(r)){for(const i of r)if(i&&typeof i=="object"){const a=i;a.type==="tool_use"&&t.push(a)}}for(const i of Object.values(n))_(i,t)}}function R(s){const t=[];return _(ge(s.clientResponse),t),t}function le(s,t){const n=s.timestamp-t,l=n+(s.latencyMs??0);return`${(n/1e3).toFixed(3)}s → ${(l/1e3).toFixed(3)}s`}function Q(s,t){return he(s??null,t)}function je(s,t){const n=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),l=URL.createObjectURL(n),r=document.createElement("a");r.href=l,r.download=s,r.click(),URL.revokeObjectURL(l)}function B({tone:s="default",children:t}){return e.jsx("span",{className:m("inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium",s==="accent"?"bg-indigo-100 text-indigo-700":"bg-slate-100 text-slate-600"),children:t})}function Ne({session:s,selected:t,index:n,onClick:l}){const r=["bg-indigo-500","bg-emerald-500","bg-amber-500"],i=t?"bg-indigo-500":r[n%r.length],a=(s.totalInputTokens??0)+(s.totalOutputTokens??0);return e.jsxs("button",{type:"button",onClick:l,className:m("w-full border-b border-border px-4 py-3 text-left transition-colors",t?"bg-indigo-50/70":"hover:bg-slate-50"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:m("h-2 w-2 flex-shrink-0 rounded-full",i)}),e.jsx("span",{className:m("truncate text-sm font-semibold",t?"text-indigo-700":"text-slate-800"),children:fe(s)})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:be(s.startedAt)})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 pl-4",children:[e.jsxs(B,{tone:t?"accent":"default",children:[s.turnCount," turns"]}),e.jsx(B,{children:I(L(s))}),e.jsxs(B,{children:[K(a)," tok"]})]})]})}function te({active:s,icon:t,label:n,onClick:l}){return e.jsxs("button",{type:"button",onClick:l,className:m("inline-flex h-7 items-center gap-1.5 rounded-full border px-3 text-xs font-medium transition-colors",s?"border-indigo-200 bg-indigo-50 text-indigo-700":"border-transparent bg-slate-50 text-slate-500 hover:bg-slate-100 hover:text-slate-700"),children:[e.jsx(t,{className:"h-3.5 w-3.5"}),n]})}function D({active:s,label:t,count:n,onClick:l}){return e.jsxs("button",{type:"button",onClick:l,className:m("inline-flex h-6 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-medium transition-colors",s?"border-indigo-200 bg-indigo-50 text-indigo-700":"border-transparent bg-transparent text-slate-500 hover:bg-slate-100 hover:text-slate-700"),children:[e.jsx("span",{children:t}),typeof n=="number"&&e.jsx("span",{className:"rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold text-amber-800",children:n})]})}function ve({detail:s,selectedTurn:t,onSelectTurn:n}){const l=s.records;if(l.length===0)return e.jsx(M,{compact:!0,className:"min-h-[220px]",title:"No turns recorded"});const r=L(s),i=Math.max(1,...l.map(a=>Math.max(a.latencyMs??0,a.ttftMs??0,1)));return Math.max(1,...l.map(a=>R(a).length)),e.jsxs("div",{className:"border-b border-border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 px-5 py-3",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Compressed overview · idle gaps folded · wraps as turns grow"}),e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-slate-500",children:"Mode:"}),e.jsx("span",{className:"rounded border border-slate-200 bg-slate-100 px-2 py-0.5 font-medium text-slate-700",children:"Compressed"}),e.jsxs("span",{className:"rounded border border-slate-200 bg-white px-2 py-0.5 font-medium text-slate-700",children:["Session ",I(r)]})]})]}),e.jsxs("div",{className:"px-5 pb-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between text-[10px] text-slate-400",children:[e.jsx("span",{children:"start"}),e.jsxs("span",{children:[(r/1e3).toFixed(1),"s"]})]}),e.jsx("div",{className:"grid gap-x-2 gap-y-5",style:{gridTemplateColumns:"repeat(10, minmax(0, 1fr))"},children:l.map((a,u)=>{const p=u===t,y=Math.max(a.latencyMs??0,1),o=`${Math.max(28,Math.min(100,y/i*100))}%`,x=a.ttftMs!=null?`${Math.max(0,Math.min(100,Math.min(a.ttftMs,i)/i*100))}%`:null,C=Math.max(0,a.timestamp-s.startedAt),w=R(a);return e.jsxs("button",{type:"button",onClick:()=>n(u),className:m("border border-transparent px-1.5 py-1 text-left transition-colors",p?"rounded-md border-rose-300":"hover:bg-slate-50/40"),title:`Turn ${a.turnIndex+1}`,children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:m("inline-flex h-5 min-w-5 items-center justify-center rounded-full border px-1.5 text-[11px] font-semibold",p?"border-indigo-300 bg-indigo-100 text-indigo-700":"border-slate-200 bg-white text-slate-700"),children:a.turnIndex+1}),e.jsx("span",{className:"truncate text-[15px] font-semibold text-slate-800",children:I(a.latencyMs)})]})}),e.jsxs("p",{className:"mt-1 text-[10px] text-slate-500",children:["start ",(C/1e3).toFixed(1),"s"]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center justify-between text-[10px] text-slate-500",children:e.jsxs("span",{children:[g(a.ttftMs)," TTFT"]})}),e.jsxs("div",{className:"relative mt-1 h-4 rounded-sm bg-slate-100",children:[e.jsx("div",{className:"h-4 rounded-sm bg-blue-200",style:{width:o}}),x!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"absolute top-[-3px] h-5 w-[3px] -translate-x-1/2 rounded-full bg-violet-500 shadow-[0_0_0_1px_rgba(255,255,255,0.9)]",style:{left:x}}),e.jsx("span",{className:"absolute top-[-6px] h-2.5 w-2.5 -translate-x-1/2 rounded-full border border-white bg-violet-500",style:{left:x}})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-[10px] text-slate-500",children:[e.jsx("span",{children:"Tools"}),e.jsx("span",{children:w.length})]}),e.jsx("div",{className:"flex h-5 items-center gap-1",children:e.jsx("span",{className:m("inline-flex h-5 min-w-5 items-center justify-center rounded-md border text-[10px] font-semibold",w.length>0?"border-amber-400 bg-amber-200 text-amber-900":"border-slate-300 bg-white text-slate-500"),children:w.length})})]})]},a.id)})}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4 text-[11px] text-slate-500",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm bg-blue-200"}),"Total latency"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"relative inline-block h-2.5 w-2.5 rounded-full border border-white bg-violet-500 shadow-[0_0_0_1px_rgba(139,92,246,0.35)]"}),"First token (TTFT)"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-amber-400 bg-amber-200"}),"Tool executing"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-rose-300 bg-rose-50"}),"Selected turn"]})]})]})]})}function ye({detail:s,selectedTurn:t,detailTab:n,onDetailTabChange:l,onSelectTurn:r}){const i=s.records[t];if(!i)return null;const a=R(i),u=(i.inputTokens??0)+(i.outputTokens??0),p=n==="request"?Q(i.clientRequest,"(empty request)"):n==="response"?Q(i.clientResponse,"(empty response)"):a.length>0?JSON.stringify(a,null,2):"(no tool calls)";return e.jsxs("div",{"data-testid":"profiler-turn-detail",className:"shrink-0 bg-slate-50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-slate-200 bg-white px-5 py-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs",children:[e.jsxs("span",{className:"rounded-full px-2 py-1 font-semibold text-white",style:{background:"linear-gradient(135deg, #6E63FF, #4E8DFF)"},children:["Turn ",i.turnIndex+1]}),e.jsx("span",{className:"text-slate-500",children:le(i,s.startedAt)}),e.jsxs("span",{className:"rounded-full bg-violet-100 px-2 py-1 font-semibold text-violet-700",children:["TTFT ",g(i.ttftMs)]}),e.jsxs("span",{className:"rounded-full bg-blue-100 px-2 py-1 font-semibold text-blue-700",children:[K(u)," tokens"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[e.jsx("button",{type:"button",onClick:()=>r(Math.max(0,t-1)),disabled:t===0,className:"rounded p-1 hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Previous turn",children:e.jsx(xe,{className:"h-4 w-4"})}),e.jsxs("span",{className:"min-w-10 text-center font-medium text-slate-600",children:[t+1," / ",s.records.length]}),e.jsx("button",{type:"button",onClick:()=>r(Math.min(s.records.length-1,t+1)),disabled:t===s.records.length-1,className:"rounded p-1 hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Next turn",children:e.jsx(me,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"border-b border-slate-200 bg-white px-5 py-2",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(D,{active:n==="request",label:"Request",onClick:()=>l("request")}),e.jsx(D,{active:n==="response",label:"Response",onClick:()=>l("response")}),e.jsx(D,{active:n==="tools",label:"Tool Calls",count:a.length,onClick:()=>l("tools")})]})}),e.jsxs("div",{className:"p-5",children:[e.jsx("pre",{className:"max-h-[420px] overflow-auto rounded-xl bg-[#1E1E2E] p-4 text-xs leading-5 text-slate-200",children:p}),i.error&&e.jsx("p",{className:"mt-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:i.error})]})]})}function we({detail:s,selectedTurn:t,detailTab:n,onSelectTurn:l,onDetailTabChange:r}){return e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(ve,{detail:s,selectedTurn:t,onSelectTurn:l}),e.jsx(ye,{detail:s,selectedTurn:t,detailTab:n,onDetailTabChange:r,onSelectTurn:l})]})}function ne({title:s,payload:t,accentClass:n}){return e.jsxs("div",{className:"rounded-xl border border-border bg-white p-3",children:[e.jsx("p",{className:m("mb-2 text-[11px] font-semibold uppercase tracking-[0.16em]",n),children:s}),e.jsx("pre",{className:"max-h-64 overflow-auto rounded-lg bg-slate-950/95 p-3 text-xs leading-5 text-slate-200",children:Q(t,"(empty)")})]})}function T({label:s,value:t,sub:n,accentClass:l}){return e.jsxs("div",{className:"rounded-2xl border border-border bg-white p-4",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:s}),e.jsx("p",{className:m("mt-2 text-2xl font-semibold text-slate-900",l),children:t}),n&&e.jsx("p",{className:"mt-1 text-xs text-slate-500",children:n})]})}function Te({record:s,sessionStart:t,expanded:n,onToggle:l}){const r=R(s);return e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border bg-white",children:[e.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-4 px-4 py-3 text-left hover:bg-slate-50",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsxs("span",{className:"rounded-full px-2 py-0.5 text-[11px] font-semibold text-white",style:{background:"linear-gradient(135deg, #6E63FF, #4E8DFF)"},children:["T",s.turnIndex+1]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-slate-900",children:le(s,t)}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-slate-500",children:[e.jsxs("span",{children:["Total ",g(s.latencyMs)]}),e.jsxs("span",{children:["TTFT ",g(s.ttftMs)]}),e.jsxs("span",{children:["TPOT ",s.tpotMs!=null?`${s.tpotMs.toFixed(1)} ms/tok`:"-"]}),e.jsxs("span",{children:["↑ ",k(s.inputTokens)]}),e.jsxs("span",{children:["↓ ",k(s.outputTokens)]}),e.jsxs("span",{children:[r.length," tool calls"]}),s.error&&e.jsx("span",{className:"rounded-full bg-red-50 px-2 py-0.5 font-medium text-red-600",children:"Error"})]})]})]}),e.jsx(ue,{className:m("h-4 w-4 flex-shrink-0 text-slate-400 transition-transform",n&&"rotate-180")})]}),n&&e.jsxs("div",{className:"border-t border-border bg-slate-50/70 p-4",children:[e.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[e.jsx(ne,{title:"Request",payload:s.clientRequest,accentClass:"text-blue-600"}),e.jsx(ne,{title:"Response",payload:s.clientResponse,accentClass:"text-violet-600"})]}),e.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,1fr)_280px]",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-white p-3",children:[e.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-amber-600",children:"Tool Calls"}),e.jsx("pre",{className:"max-h-64 overflow-auto rounded-lg bg-slate-950/95 p-3 text-xs leading-5 text-slate-200",children:r.length>0?JSON.stringify(r,null,2):"(no tool calls)"})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-white p-3",children:[e.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Turn Metrics"}),e.jsxs("dl",{className:"grid grid-cols-2 gap-x-3 gap-y-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"Duration"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:g(s.latencyMs)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"TTFT"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:g(s.ttftMs)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"TPOT"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:s.tpotMs!=null?`${s.tpotMs.toFixed(1)} ms/tok`:"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"Status"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:s.statusCode??"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"Input"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:k(s.inputTokens)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"Output"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:k(s.outputTokens)})]})]}),s.error&&e.jsx("p",{className:"mt-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:s.error})]})]})]})]})}function Me({detail:s,expandedTurn:t,onToggleTurn:n}){if(s.records.length===0)return e.jsx(M,{compact:!0,className:"min-h-[220px]",title:"No turns recorded"});const l=L(s),r=s.records.reduce((o,x)=>{const C=x.latencyMs??0,w=x.ttftMs??0;return o+Math.max(C-w,0)},0),i=l>0?(r/l*100).toFixed(1):"-",a=s.records.map(o=>o.ttftMs).filter(o=>o!=null),u=s.records.map(o=>o.tpotMs).filter(o=>o!=null),p=a.length>0?a.reduce((o,x)=>o+x,0)/a.length:null,y=u.length>0?u.reduce((o,x)=>o+x,0)/u.length:null;return e.jsxs("div",{className:"space-y-5 p-5",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-6",children:[e.jsx(T,{label:"Total Duration",value:g(l),sub:`${s.records.length} turns`}),e.jsx(T,{label:"LLM Time",value:g(r),sub:`${i}% of session`,accentClass:"text-violet-700"}),e.jsx(T,{label:"Avg TTFT",value:g(p)}),e.jsx(T,{label:"Avg TPOT",value:y!=null?`${y.toFixed(1)} ms/tok`:"-"}),e.jsx(T,{label:"Input Tokens",value:k(s.totalInputTokens)}),e.jsx(T,{label:"Output Tokens",value:k(s.totalOutputTokens)})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:"Per-Turn Breakdown"}),e.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Expand a turn to inspect request, response, tool calls, and errors."})]})}),s.records.map(o=>e.jsx(Te,{record:o,sessionStart:s.startedAt,expanded:t===o.turnIndex,onToggle:()=>n(o.turnIndex)},o.id))]})]})}function Ee(){var H,X;const s=pe(),[t,n]=f.useState(null),[l,r]=f.useState("timeline"),[i,a]=f.useState("request"),[u,p]=f.useState(0),[y,o]=f.useState(0),[x,C]=f.useState(""),h=((H=A({queryKey:b.profiler.status(),queryFn:()=>v.getStatus(),refetchInterval:3e3}).data)==null?void 0:H.active)??!1,J=A({queryKey:b.profiler.sessions({}),queryFn:()=>v.listSessions({limit:100}),refetchInterval:h?2e3:!1}),j=((X=J.data)==null?void 0:X.items)??[],P=A({queryKey:b.profiler.session(t),queryFn:()=>v.getSession(t),enabled:t!=null,refetchInterval:h&&t!=null?2e3:!1}),z=S({mutationFn:()=>v.start(),onSuccess:()=>{s.invalidateQueries({queryKey:b.profiler.status()}),s.invalidateQueries({queryKey:b.profiler.sessions({})})}}),U=S({mutationFn:()=>v.stop(),onSuccess:()=>{s.invalidateQueries({queryKey:b.profiler.status()}),s.invalidateQueries({queryKey:b.profiler.sessions({})})}}),G=S({mutationFn:d=>v.deleteSession(d),onSuccess:(d,N)=>{t===N&&n(null),s.invalidateQueries({queryKey:b.profiler.sessions({})})}}),ae=S({mutationFn:()=>v.clearAll(),onSuccess:()=>{n(null),s.invalidateQueries({queryKey:b.profiler.sessions({})})}}),V=f.useMemo(()=>{const d=x.trim().toLowerCase();return d?j.filter(N=>N.sessionId.toLowerCase().includes(d)):j},[x,j]),c=P.data,E=j.find(d=>d.id===t)??null,W=(c==null?void 0:c.records[u])??null;f.useEffect(()=>{t&&!j.some(d=>d.id===t)&&n(null)},[t,j]),f.useEffect(()=>{p(0),o(0),a("request")},[t]),f.useEffect(()=>{if(!c){p(0),o(0);return}p(d=>Math.min(d,Math.max(c.records.length-1,0))),o(d=>d==null?0:Math.min(d,Math.max(c.records.length-1,0)))},[c]);const re=()=>{c&&je(`profiler-${c.sessionId}.json`,c)};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",style:{height:"calc(100vh - 64px)"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border bg-white px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:"h-5 w-5 text-indigo-500"}),e.jsx("span",{className:"text-base font-semibold text-slate-900",children:"Profiler"}),e.jsxs(se,{variant:"outline",className:m("rounded-full border px-2.5 py-1 text-xs font-semibold",h?"border-red-200 bg-red-50 text-red-600":"border-slate-200 bg-slate-50 text-slate-500"),children:[e.jsx("span",{className:m("mr-2 inline-block h-1.5 w-1.5 rounded-full",h?"bg-red-500":"bg-slate-400")}),h?"Recording":"Not Recording"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{size:"sm",variant:h?"destructive":"default",onClick:()=>h?U.mutate():z.mutate(),disabled:z.isPending||U.isPending,children:h?"Stop Recording":"Start Recording"}),e.jsxs($,{size:"sm",variant:"outline",onClick:re,disabled:!c,children:[e.jsx(ie,{className:"mr-1.5 h-3.5 w-3.5"}),"Export"]}),e.jsxs($,{size:"sm",variant:"outline",onClick:()=>ae.mutate(),disabled:j.length===0,className:"border-red-200 bg-red-50 text-red-700 hover:bg-red-100 hover:text-red-800",children:[e.jsx(Z,{className:"mr-1.5 h-3.5 w-3.5"}),"Clear"]})]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden bg-[#F1F3F4]",children:[e.jsxs("div",{className:"flex w-80 flex-shrink-0 flex-col border-r border-border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[e.jsx("span",{className:"text-sm font-semibold text-slate-900",children:"Sessions"}),e.jsx(se,{variant:"secondary",className:"rounded-full px-2 py-0.5",children:j.length})]}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2.5",children:[e.jsx(oe,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsx("input",{className:"w-full bg-transparent text-sm outline-none placeholder:text-slate-400",placeholder:"Search sessions...",value:x,onChange:d=>C(d.target.value)})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:J.isPending?e.jsx(ee,{compact:!0,className:"min-h-[160px]",label:"Loading..."}):V.length===0?e.jsx(M,{compact:!0,className:"m-4 min-h-[160px]",title:h?"Waiting for requests…":"No sessions",description:h?"Requests with session_id will appear here.":"Start recording to capture LLM sessions."}):V.map((d,N)=>e.jsx(Ne,{session:d,selected:t===d.id,index:N,onClick:()=>n(d.id)},d.id))})]}),e.jsx("div",{className:"flex min-w-0 flex-1 flex-col bg-white",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border bg-white px-5 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 flex-shrink-0 rounded-full bg-indigo-500"}),e.jsx("span",{className:"truncate text-sm font-semibold text-slate-900",children:(c==null?void 0:c.sessionId)??(E==null?void 0:E.sessionId)??t}),e.jsx("span",{className:"text-slate-300",children:"·"}),e.jsx("span",{className:"truncate text-sm text-slate-500",children:c?`${c.turnCount} turns · ${I(L(c))} · ${K((c.totalInputTokens??0)+(c.totalOutputTokens??0))} tokens`:"Loading session…"})]}),e.jsx($,{variant:"ghost",size:"sm",onClick:()=>t&&G.mutate(t),disabled:!t||G.isPending,className:"text-slate-500 hover:text-red-700",children:e.jsx(Z,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"border-b border-border bg-white px-5 py-2",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(te,{active:l==="timeline",icon:de,label:"Timeline",onClick:()=>r("timeline")}),e.jsx(te,{active:l==="breakdown",icon:ce,label:"Breakdown",onClick:()=>r("breakdown")})]})}),e.jsx("div",{"data-testid":"profiler-session-content",className:"min-h-0 flex-1 overflow-auto bg-slate-50",children:P.isPending?e.jsx(ee,{compact:!0,className:"min-h-[240px]",label:"Loading session..."}):P.isError?e.jsx(M,{compact:!0,className:"m-5 min-h-[220px]",tone:"danger",title:"Failed to load session"}):c?l==="timeline"?e.jsx(we,{detail:c,selectedTurn:u,detailTab:i,onSelectTurn:p,onDetailTabChange:a}):e.jsx(Me,{detail:c,expandedTurn:y,onToggleTurn:d=>o(N=>N===d?null:d)}):e.jsx(M,{compact:!0,className:"m-5 min-h-[220px]",title:"Session not found"})}),W&&e.jsxs("span",{className:"sr-only",children:["Selected turn ",W.turnIndex+1]})]}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(M,{title:"Select a session",description:"Choose a session from the left to inspect its timeline, message payloads, and stats.",icon:e.jsx(Y,{className:"h-5 w-5"})})})})]})]})}export{Ee as default};
1
+ import{r as f,j as e,X as Y,am as ie,ay as Z,aH as oe,aI as de,S as ce,ar as xe,a1 as me,al as ue}from"./vendor-5iCEqDpV.js";import{u as pe,a as A,b as S}from"./query-DxhDvnDC.js";import{P as ee,a as M}from"./PageState-DA98vXl7.js";import{B as se}from"./badge-B-TfGxGB.js";import{h as F,b as q,r as O,c as m,B as $}from"./index-CYeQpt9d.js";import{d as he}from"./utils-DQfq7gRo.js";import{q as b}from"./queryKeys-BMvyDTQS.js";import"./i18n-C7VVFIdN.js";import"./router-D8u_RlVh.js";import"./radix-CmyU-WBH.js";const v={getStatus:()=>O({url:"/api/profiler/status",method:"GET"}),start:()=>F(q.post("/api/profiler/start")),stop:()=>F(q.post("/api/profiler/stop")),listSessions:s=>O({url:"/api/profiler/sessions",method:"GET",params:s}),getSession:s=>O({url:`/api/profiler/sessions/${s}`,method:"GET"}),deleteSession:s=>F(q.delete(`/api/profiler/sessions/${s}`)),clearAll:()=>F(q.post("/api/profiler/sessions/clear"))};function g(s){return s==null?"-":s>=1e3?`${(s/1e3).toFixed(2)}s`:`${Math.round(s)}ms`}function I(s){return s==null?"-":s>=1e3?`${(s/1e3).toFixed(1)}s`:`${Math.round(s)}ms`}function k(s){return s==null?"-":s.toLocaleString()}function K(s){return s==null?"-":s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function L(s){return s.endedAt==null||s.turnCount===0?s.totalLatencyMs??0:s.endedAt-s.startedAt}function fe(s){const t=s.sessionId;return t.length>18?`${t.slice(0,8)}…${t.slice(-6)}`:t}function be(s){const t=Math.max(0,Date.now()-s),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n} min ago`;const l=Math.floor(n/60);if(l<24)return`${l} hr ago`;const r=Math.floor(l/24);return`${r} day${r===1?"":"s"} ago`}function ge(s){if(!s)return null;try{return JSON.parse(s)}catch{return null}}function _(s,t){if(Array.isArray(s)){for(const n of s)_(n,t);return}if(s&&typeof s=="object"){const n=s,l=n.tool_calls;Array.isArray(l)&&t.push(...l);const r=n.content;if(Array.isArray(r)){for(const i of r)if(i&&typeof i=="object"){const a=i;a.type==="tool_use"&&t.push(a)}}for(const i of Object.values(n))_(i,t)}}function R(s){const t=[];return _(ge(s.clientResponse),t),t}function le(s,t){const n=s.timestamp-t,l=n+(s.latencyMs??0);return`${(n/1e3).toFixed(3)}s → ${(l/1e3).toFixed(3)}s`}function Q(s,t){return he(s??null,t)}function je(s,t){const n=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),l=URL.createObjectURL(n),r=document.createElement("a");r.href=l,r.download=s,r.click(),URL.revokeObjectURL(l)}function B({tone:s="default",children:t}){return e.jsx("span",{className:m("inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium",s==="accent"?"bg-indigo-100 text-indigo-700":"bg-slate-100 text-slate-600"),children:t})}function Ne({session:s,selected:t,index:n,onClick:l}){const r=["bg-indigo-500","bg-emerald-500","bg-amber-500"],i=t?"bg-indigo-500":r[n%r.length],a=(s.totalInputTokens??0)+(s.totalOutputTokens??0);return e.jsxs("button",{type:"button",onClick:l,className:m("w-full border-b border-border px-4 py-3 text-left transition-colors",t?"bg-indigo-50/70":"hover:bg-slate-50"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:m("h-2 w-2 flex-shrink-0 rounded-full",i)}),e.jsx("span",{className:m("truncate text-sm font-semibold",t?"text-indigo-700":"text-slate-800"),children:fe(s)})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:be(s.startedAt)})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 pl-4",children:[e.jsxs(B,{tone:t?"accent":"default",children:[s.turnCount," turns"]}),e.jsx(B,{children:I(L(s))}),e.jsxs(B,{children:[K(a)," tok"]})]})]})}function te({active:s,icon:t,label:n,onClick:l}){return e.jsxs("button",{type:"button",onClick:l,className:m("inline-flex h-7 items-center gap-1.5 rounded-full border px-3 text-xs font-medium transition-colors",s?"border-indigo-200 bg-indigo-50 text-indigo-700":"border-transparent bg-slate-50 text-slate-500 hover:bg-slate-100 hover:text-slate-700"),children:[e.jsx(t,{className:"h-3.5 w-3.5"}),n]})}function D({active:s,label:t,count:n,onClick:l}){return e.jsxs("button",{type:"button",onClick:l,className:m("inline-flex h-6 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-medium transition-colors",s?"border-indigo-200 bg-indigo-50 text-indigo-700":"border-transparent bg-transparent text-slate-500 hover:bg-slate-100 hover:text-slate-700"),children:[e.jsx("span",{children:t}),typeof n=="number"&&e.jsx("span",{className:"rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold text-amber-800",children:n})]})}function ve({detail:s,selectedTurn:t,onSelectTurn:n}){const l=s.records;if(l.length===0)return e.jsx(M,{compact:!0,className:"min-h-[220px]",title:"No turns recorded"});const r=L(s),i=Math.max(1,...l.map(a=>Math.max(a.latencyMs??0,a.ttftMs??0,1)));return Math.max(1,...l.map(a=>R(a).length)),e.jsxs("div",{className:"border-b border-border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 px-5 py-3",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Compressed overview · idle gaps folded · wraps as turns grow"}),e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-slate-500",children:"Mode:"}),e.jsx("span",{className:"rounded border border-slate-200 bg-slate-100 px-2 py-0.5 font-medium text-slate-700",children:"Compressed"}),e.jsxs("span",{className:"rounded border border-slate-200 bg-white px-2 py-0.5 font-medium text-slate-700",children:["Session ",I(r)]})]})]}),e.jsxs("div",{className:"px-5 pb-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between text-[10px] text-slate-400",children:[e.jsx("span",{children:"start"}),e.jsxs("span",{children:[(r/1e3).toFixed(1),"s"]})]}),e.jsx("div",{className:"grid gap-x-2 gap-y-5",style:{gridTemplateColumns:"repeat(10, minmax(0, 1fr))"},children:l.map((a,u)=>{const p=u===t,y=Math.max(a.latencyMs??0,1),o=`${Math.max(28,Math.min(100,y/i*100))}%`,x=a.ttftMs!=null?`${Math.max(0,Math.min(100,Math.min(a.ttftMs,i)/i*100))}%`:null,C=Math.max(0,a.timestamp-s.startedAt),w=R(a);return e.jsxs("button",{type:"button",onClick:()=>n(u),className:m("border border-transparent px-1.5 py-1 text-left transition-colors",p?"rounded-md border-rose-300":"hover:bg-slate-50/40"),title:`Turn ${a.turnIndex+1}`,children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:m("inline-flex h-5 min-w-5 items-center justify-center rounded-full border px-1.5 text-[11px] font-semibold",p?"border-indigo-300 bg-indigo-100 text-indigo-700":"border-slate-200 bg-white text-slate-700"),children:a.turnIndex+1}),e.jsx("span",{className:"truncate text-[15px] font-semibold text-slate-800",children:I(a.latencyMs)})]})}),e.jsxs("p",{className:"mt-1 text-[10px] text-slate-500",children:["start ",(C/1e3).toFixed(1),"s"]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center justify-between text-[10px] text-slate-500",children:e.jsxs("span",{children:[g(a.ttftMs)," TTFT"]})}),e.jsxs("div",{className:"relative mt-1 h-4 rounded-sm bg-slate-100",children:[e.jsx("div",{className:"h-4 rounded-sm bg-blue-200",style:{width:o}}),x!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"absolute top-[-3px] h-5 w-[3px] -translate-x-1/2 rounded-full bg-violet-500 shadow-[0_0_0_1px_rgba(255,255,255,0.9)]",style:{left:x}}),e.jsx("span",{className:"absolute top-[-6px] h-2.5 w-2.5 -translate-x-1/2 rounded-full border border-white bg-violet-500",style:{left:x}})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-[10px] text-slate-500",children:[e.jsx("span",{children:"Tools"}),e.jsx("span",{children:w.length})]}),e.jsx("div",{className:"flex h-5 items-center gap-1",children:e.jsx("span",{className:m("inline-flex h-5 min-w-5 items-center justify-center rounded-md border text-[10px] font-semibold",w.length>0?"border-amber-400 bg-amber-200 text-amber-900":"border-slate-300 bg-white text-slate-500"),children:w.length})})]})]},a.id)})}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4 text-[11px] text-slate-500",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm bg-blue-200"}),"Total latency"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"relative inline-block h-2.5 w-2.5 rounded-full border border-white bg-violet-500 shadow-[0_0_0_1px_rgba(139,92,246,0.35)]"}),"First token (TTFT)"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-amber-400 bg-amber-200"}),"Tool executing"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-rose-300 bg-rose-50"}),"Selected turn"]})]})]})]})}function ye({detail:s,selectedTurn:t,detailTab:n,onDetailTabChange:l,onSelectTurn:r}){const i=s.records[t];if(!i)return null;const a=R(i),u=(i.inputTokens??0)+(i.outputTokens??0),p=n==="request"?Q(i.clientRequest,"(empty request)"):n==="response"?Q(i.clientResponse,"(empty response)"):a.length>0?JSON.stringify(a,null,2):"(no tool calls)";return e.jsxs("div",{"data-testid":"profiler-turn-detail",className:"shrink-0 bg-slate-50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-slate-200 bg-white px-5 py-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs",children:[e.jsxs("span",{className:"rounded-full px-2 py-1 font-semibold text-white",style:{background:"linear-gradient(135deg, #6E63FF, #4E8DFF)"},children:["Turn ",i.turnIndex+1]}),e.jsx("span",{className:"text-slate-500",children:le(i,s.startedAt)}),e.jsxs("span",{className:"rounded-full bg-violet-100 px-2 py-1 font-semibold text-violet-700",children:["TTFT ",g(i.ttftMs)]}),e.jsxs("span",{className:"rounded-full bg-blue-100 px-2 py-1 font-semibold text-blue-700",children:[K(u)," tokens"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[e.jsx("button",{type:"button",onClick:()=>r(Math.max(0,t-1)),disabled:t===0,className:"rounded p-1 hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Previous turn",children:e.jsx(xe,{className:"h-4 w-4"})}),e.jsxs("span",{className:"min-w-10 text-center font-medium text-slate-600",children:[t+1," / ",s.records.length]}),e.jsx("button",{type:"button",onClick:()=>r(Math.min(s.records.length-1,t+1)),disabled:t===s.records.length-1,className:"rounded p-1 hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Next turn",children:e.jsx(me,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"border-b border-slate-200 bg-white px-5 py-2",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(D,{active:n==="request",label:"Request",onClick:()=>l("request")}),e.jsx(D,{active:n==="response",label:"Response",onClick:()=>l("response")}),e.jsx(D,{active:n==="tools",label:"Tool Calls",count:a.length,onClick:()=>l("tools")})]})}),e.jsxs("div",{className:"p-5",children:[e.jsx("pre",{className:"max-h-[420px] overflow-auto rounded-xl bg-[#1E1E2E] p-4 text-xs leading-5 text-slate-200",children:p}),i.error&&e.jsx("p",{className:"mt-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:i.error})]})]})}function we({detail:s,selectedTurn:t,detailTab:n,onSelectTurn:l,onDetailTabChange:r}){return e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(ve,{detail:s,selectedTurn:t,onSelectTurn:l}),e.jsx(ye,{detail:s,selectedTurn:t,detailTab:n,onDetailTabChange:r,onSelectTurn:l})]})}function ne({title:s,payload:t,accentClass:n}){return e.jsxs("div",{className:"rounded-xl border border-border bg-white p-3",children:[e.jsx("p",{className:m("mb-2 text-[11px] font-semibold uppercase tracking-[0.16em]",n),children:s}),e.jsx("pre",{className:"max-h-64 overflow-auto rounded-lg bg-slate-950/95 p-3 text-xs leading-5 text-slate-200",children:Q(t,"(empty)")})]})}function T({label:s,value:t,sub:n,accentClass:l}){return e.jsxs("div",{className:"rounded-2xl border border-border bg-white p-4",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:s}),e.jsx("p",{className:m("mt-2 text-2xl font-semibold text-slate-900",l),children:t}),n&&e.jsx("p",{className:"mt-1 text-xs text-slate-500",children:n})]})}function Te({record:s,sessionStart:t,expanded:n,onToggle:l}){const r=R(s);return e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border bg-white",children:[e.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-4 px-4 py-3 text-left hover:bg-slate-50",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsxs("span",{className:"rounded-full px-2 py-0.5 text-[11px] font-semibold text-white",style:{background:"linear-gradient(135deg, #6E63FF, #4E8DFF)"},children:["T",s.turnIndex+1]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-slate-900",children:le(s,t)}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-slate-500",children:[e.jsxs("span",{children:["Total ",g(s.latencyMs)]}),e.jsxs("span",{children:["TTFT ",g(s.ttftMs)]}),e.jsxs("span",{children:["TPOT ",s.tpotMs!=null?`${s.tpotMs.toFixed(1)} ms/tok`:"-"]}),e.jsxs("span",{children:["↑ ",k(s.inputTokens)]}),e.jsxs("span",{children:["↓ ",k(s.outputTokens)]}),e.jsxs("span",{children:[r.length," tool calls"]}),s.error&&e.jsx("span",{className:"rounded-full bg-red-50 px-2 py-0.5 font-medium text-red-600",children:"Error"})]})]})]}),e.jsx(ue,{className:m("h-4 w-4 flex-shrink-0 text-slate-400 transition-transform",n&&"rotate-180")})]}),n&&e.jsxs("div",{className:"border-t border-border bg-slate-50/70 p-4",children:[e.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[e.jsx(ne,{title:"Request",payload:s.clientRequest,accentClass:"text-blue-600"}),e.jsx(ne,{title:"Response",payload:s.clientResponse,accentClass:"text-violet-600"})]}),e.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,1fr)_280px]",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-white p-3",children:[e.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-amber-600",children:"Tool Calls"}),e.jsx("pre",{className:"max-h-64 overflow-auto rounded-lg bg-slate-950/95 p-3 text-xs leading-5 text-slate-200",children:r.length>0?JSON.stringify(r,null,2):"(no tool calls)"})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-white p-3",children:[e.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Turn Metrics"}),e.jsxs("dl",{className:"grid grid-cols-2 gap-x-3 gap-y-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"Duration"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:g(s.latencyMs)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"TTFT"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:g(s.ttftMs)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"TPOT"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:s.tpotMs!=null?`${s.tpotMs.toFixed(1)} ms/tok`:"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"Status"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:s.statusCode??"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"Input"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:k(s.inputTokens)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-slate-500",children:"Output"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-900",children:k(s.outputTokens)})]})]}),s.error&&e.jsx("p",{className:"mt-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:s.error})]})]})]})]})}function Me({detail:s,expandedTurn:t,onToggleTurn:n}){if(s.records.length===0)return e.jsx(M,{compact:!0,className:"min-h-[220px]",title:"No turns recorded"});const l=L(s),r=s.records.reduce((o,x)=>{const C=x.latencyMs??0,w=x.ttftMs??0;return o+Math.max(C-w,0)},0),i=l>0?(r/l*100).toFixed(1):"-",a=s.records.map(o=>o.ttftMs).filter(o=>o!=null),u=s.records.map(o=>o.tpotMs).filter(o=>o!=null),p=a.length>0?a.reduce((o,x)=>o+x,0)/a.length:null,y=u.length>0?u.reduce((o,x)=>o+x,0)/u.length:null;return e.jsxs("div",{className:"space-y-5 p-5",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-6",children:[e.jsx(T,{label:"Total Duration",value:g(l),sub:`${s.records.length} turns`}),e.jsx(T,{label:"LLM Time",value:g(r),sub:`${i}% of session`,accentClass:"text-violet-700"}),e.jsx(T,{label:"Avg TTFT",value:g(p)}),e.jsx(T,{label:"Avg TPOT",value:y!=null?`${y.toFixed(1)} ms/tok`:"-"}),e.jsx(T,{label:"Input Tokens",value:k(s.totalInputTokens)}),e.jsx(T,{label:"Output Tokens",value:k(s.totalOutputTokens)})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:"Per-Turn Breakdown"}),e.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Expand a turn to inspect request, response, tool calls, and errors."})]})}),s.records.map(o=>e.jsx(Te,{record:o,sessionStart:s.startedAt,expanded:t===o.turnIndex,onToggle:()=>n(o.turnIndex)},o.id))]})]})}function Ee(){var H,X;const s=pe(),[t,n]=f.useState(null),[l,r]=f.useState("timeline"),[i,a]=f.useState("request"),[u,p]=f.useState(0),[y,o]=f.useState(0),[x,C]=f.useState(""),h=((H=A({queryKey:b.profiler.status(),queryFn:()=>v.getStatus(),refetchInterval:3e3}).data)==null?void 0:H.active)??!1,J=A({queryKey:b.profiler.sessions({}),queryFn:()=>v.listSessions({limit:100}),refetchInterval:h?2e3:!1}),j=((X=J.data)==null?void 0:X.items)??[],P=A({queryKey:b.profiler.session(t),queryFn:()=>v.getSession(t),enabled:t!=null,refetchInterval:h&&t!=null?2e3:!1}),z=S({mutationFn:()=>v.start(),onSuccess:()=>{s.invalidateQueries({queryKey:b.profiler.status()}),s.invalidateQueries({queryKey:b.profiler.sessions({})})}}),U=S({mutationFn:()=>v.stop(),onSuccess:()=>{s.invalidateQueries({queryKey:b.profiler.status()}),s.invalidateQueries({queryKey:b.profiler.sessions({})})}}),G=S({mutationFn:d=>v.deleteSession(d),onSuccess:(d,N)=>{t===N&&n(null),s.invalidateQueries({queryKey:b.profiler.sessions({})})}}),ae=S({mutationFn:()=>v.clearAll(),onSuccess:()=>{n(null),s.invalidateQueries({queryKey:b.profiler.sessions({})})}}),V=f.useMemo(()=>{const d=x.trim().toLowerCase();return d?j.filter(N=>N.sessionId.toLowerCase().includes(d)):j},[x,j]),c=P.data,E=j.find(d=>d.id===t)??null,W=(c==null?void 0:c.records[u])??null;f.useEffect(()=>{t&&!j.some(d=>d.id===t)&&n(null)},[t,j]),f.useEffect(()=>{p(0),o(0),a("request")},[t]),f.useEffect(()=>{if(!c){p(0),o(0);return}p(d=>Math.min(d,Math.max(c.records.length-1,0))),o(d=>d==null?0:Math.min(d,Math.max(c.records.length-1,0)))},[c]);const re=()=>{c&&je(`profiler-${c.sessionId}.json`,c)};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",style:{height:"calc(100vh - 64px)"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border bg-white px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:"h-5 w-5 text-indigo-500"}),e.jsx("span",{className:"text-base font-semibold text-slate-900",children:"Profiler"}),e.jsxs(se,{variant:"outline",className:m("rounded-full border px-2.5 py-1 text-xs font-semibold",h?"border-red-200 bg-red-50 text-red-600":"border-slate-200 bg-slate-50 text-slate-500"),children:[e.jsx("span",{className:m("mr-2 inline-block h-1.5 w-1.5 rounded-full",h?"bg-red-500":"bg-slate-400")}),h?"Recording":"Not Recording"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{size:"sm",variant:h?"destructive":"default",onClick:()=>h?U.mutate():z.mutate(),disabled:z.isPending||U.isPending,children:h?"Stop Recording":"Start Recording"}),e.jsxs($,{size:"sm",variant:"outline",onClick:re,disabled:!c,children:[e.jsx(ie,{className:"mr-1.5 h-3.5 w-3.5"}),"Export"]}),e.jsxs($,{size:"sm",variant:"outline",onClick:()=>ae.mutate(),disabled:j.length===0,className:"border-red-200 bg-red-50 text-red-700 hover:bg-red-100 hover:text-red-800",children:[e.jsx(Z,{className:"mr-1.5 h-3.5 w-3.5"}),"Clear"]})]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden bg-[#F1F3F4]",children:[e.jsxs("div",{className:"flex w-80 flex-shrink-0 flex-col border-r border-border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[e.jsx("span",{className:"text-sm font-semibold text-slate-900",children:"Sessions"}),e.jsx(se,{variant:"secondary",className:"rounded-full px-2 py-0.5",children:j.length})]}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2.5",children:[e.jsx(oe,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsx("input",{className:"w-full bg-transparent text-sm outline-none placeholder:text-slate-400",placeholder:"Search sessions...",value:x,onChange:d=>C(d.target.value)})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:J.isPending?e.jsx(ee,{compact:!0,className:"min-h-[160px]",label:"Loading..."}):V.length===0?e.jsx(M,{compact:!0,className:"m-4 min-h-[160px]",title:h?"Waiting for requests…":"No sessions",description:h?"Requests with session_id will appear here.":"Start recording to capture LLM sessions."}):V.map((d,N)=>e.jsx(Ne,{session:d,selected:t===d.id,index:N,onClick:()=>n(d.id)},d.id))})]}),e.jsx("div",{className:"flex min-w-0 flex-1 flex-col bg-white",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border bg-white px-5 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 flex-shrink-0 rounded-full bg-indigo-500"}),e.jsx("span",{className:"truncate text-sm font-semibold text-slate-900",children:(c==null?void 0:c.sessionId)??(E==null?void 0:E.sessionId)??t}),e.jsx("span",{className:"text-slate-300",children:"·"}),e.jsx("span",{className:"truncate text-sm text-slate-500",children:c?`${c.turnCount} turns · ${I(L(c))} · ${K((c.totalInputTokens??0)+(c.totalOutputTokens??0))} tokens`:"Loading session…"})]}),e.jsx($,{variant:"ghost",size:"sm",onClick:()=>t&&G.mutate(t),disabled:!t||G.isPending,className:"text-slate-500 hover:text-red-700",children:e.jsx(Z,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"border-b border-border bg-white px-5 py-2",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(te,{active:l==="timeline",icon:de,label:"Timeline",onClick:()=>r("timeline")}),e.jsx(te,{active:l==="breakdown",icon:ce,label:"Breakdown",onClick:()=>r("breakdown")})]})}),e.jsx("div",{"data-testid":"profiler-session-content",className:"min-h-0 flex-1 overflow-auto bg-slate-50",children:P.isPending?e.jsx(ee,{compact:!0,className:"min-h-[240px]",label:"Loading session..."}):P.isError?e.jsx(M,{compact:!0,className:"m-5 min-h-[220px]",tone:"danger",title:"Failed to load session"}):c?l==="timeline"?e.jsx(we,{detail:c,selectedTurn:u,detailTab:i,onSelectTurn:p,onDetailTabChange:a}):e.jsx(Me,{detail:c,expandedTurn:y,onToggleTurn:d=>o(N=>N===d?null:d)}):e.jsx(M,{compact:!0,className:"m-5 min-h-[220px]",title:"Session not found"})}),W&&e.jsxs("span",{className:"sr-only",children:["Selected turn ",W.turnIndex+1]})]}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(M,{title:"Select a session",description:"Choose a session from the left to inspect its timeline, message payloads, and stats.",icon:e.jsx(Y,{className:"h-5 w-5"})})})})]})]})}export{Ee as default};
@@ -0,0 +1 @@
1
+ import{j as e,az as J,av as gt,au as xt,r as m,Y as bt}from"./vendor-5iCEqDpV.js";import{C as Le}from"./ConfirmDialog-DW7jBfm1.js";import{c as M,L as Fe,B as k,r as Te,h as ft,b as vt,u as jt}from"./index-CYeQpt9d.js";import{P as yt}from"./PageHeader-DDxjKW4B.js";import{C as A,a as L}from"./card-I07afQF2.js";import{B as E}from"./badge-B-TfGxGB.js";import{I as w}from"./input-DZMeIHxj.js";import{L as v}from"./label-DZr7itdg.js";import{S as B}from"./switch-BpfcwR9i.js";import{S as Nt,a as wt,b as Ct,c as Pt,d as kt}from"./select-BUvJR07s.js";import{u as R}from"./i18n-C7VVFIdN.js";import{u as Me}from"./useApiQuery-BzbOtl4s.js";import{u as Q}from"./useAppMutation-D8Mjcv9t.js";import{g as Oe}from"./gateway-CkqHb_VE.js";import{c as St}from"./clipboard-CALi6bTW.js";import{q as _}from"./queryKeys-BMvyDTQS.js";import"./DialogShell-BqzUE3vU.js";import"./radix-CmyU-WBH.js";import"./query-DxhDvnDC.js";import"./router-D8u_RlVh.js";const Rt=[{value:"fatal",labelKey:"fatal"},{value:"error",labelKey:"error"},{value:"warn",labelKey:"warn"},{value:"info",labelKey:"info"},{value:"debug",labelKey:"debug"},{value:"trace",labelKey:"trace"}],te=[{id:"section-basics",labelKey:"settings.sections.basics"},{id:"section-protocol",labelKey:"settings.sections.protocol"},{id:"section-security",labelKey:"settings.sections.security"},{id:"section-config-file",labelKey:"settings.sections.configFile"},{id:"section-cleanup",labelKey:"settings.sections.cleanup"}];function z(s){var o,l,c,a,i,h,p,T,x,d,N;const t=s.storePayloads,n=C=>typeof C=="boolean"?C:typeof t=="boolean"?t:!0;return{port:String(s.port??((o=s.http)==null?void 0:o.port)??""),host:s.host??((l=s.http)==null?void 0:l.host)??"127.0.0.1",logRetentionDays:String(s.logRetentionDays??30),logExportTimeoutSeconds:String(s.logExportTimeoutSeconds??60),storeRequestPayloads:n(s.storeRequestPayloads),storeResponsePayloads:n(s.storeResponsePayloads),logLevel:s.logLevel??"info",bodyLimitMb:(()=>{const C=s.bodyLimit;return typeof C=="number"&&Number.isFinite(C)&&C>0?String(Math.max(1,Math.round(C/(1024*1024)))):"10"})(),enableRoutingFallback:s.enableRoutingFallback===!0,httpEnabled:((c=s.http)==null?void 0:c.enabled)!==!1,httpPort:String(((a=s.http)==null?void 0:a.port)??s.port??4100),httpHost:((i=s.http)==null?void 0:i.host)??s.host??"127.0.0.1",httpsEnabled:((h=s.https)==null?void 0:h.enabled)===!0,httpsPort:String(((p=s.https)==null?void 0:p.port)??4443),httpsHost:((T=s.https)==null?void 0:T.host)??s.host??"127.0.0.1",httpsKeyPath:((x=s.https)==null?void 0:x.keyPath)??"",httpsCertPath:((d=s.https)==null?void 0:d.certPath)??"",httpsCaPath:((N=s.https)==null?void 0:N.caPath)??""}}function Y(s){return{enabled:s.enabled,username:s.username??"",password:"",confirmPassword:""}}function Et({activeSection:s,onSelectSection:t}){const{t:n}=R();return e.jsxs(e.Fragment,{children:[e.jsx("nav",{className:"hidden xl:block",children:e.jsxs("div",{className:"sticky top-20 rounded-lg border border-border bg-card p-4",children:[e.jsx("p",{className:"mb-3 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:n("settings.sections.jump")}),e.jsx("div",{className:"space-y-1",children:te.map((o,l)=>e.jsxs("button",{type:"button",onClick:()=>t(o.id),className:M("flex w-full items-center gap-3 rounded-full px-3.5 py-2.5 text-left text-sm transition-all",s===o.id?"bg-accent font-medium text-primary":"text-muted-foreground hover:bg-secondary hover:text-foreground"),children:[e.jsx("span",{className:M("flex h-7 w-7 items-center justify-center rounded-full border text-[11px] font-semibold",s===o.id?"border-primary/20 bg-primary text-primary-foreground":"border-border bg-secondary text-muted-foreground"),children:l+1}),e.jsx("span",{children:n(o.labelKey)})]},o.id))})]})}),e.jsx("div",{className:"xl:hidden",children:e.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:e.jsx("div",{className:"flex w-max gap-2 px-1",children:te.map(o=>e.jsx("button",{type:"button",onClick:()=>t(o.id),className:M("rounded-full border px-3.5 py-2 text-xs font-medium transition-all",s===o.id?"border-primary bg-accent text-primary":"border-border bg-card text-muted-foreground hover:border-primary/20 hover:bg-accent hover:text-primary"),children:n(o.labelKey)},o.id))})})})]})}function At({configPath:s,defaultsSummary:t,form:n,protocolSummaryLabel:o,protocolChangesPending:l,isAuthDirty:c,isConfigDirty:a,authEnabled:i,authUsername:h}){const{t:p}=R();return e.jsx(A,{children:e.jsxs(L,{className:"space-y-4 pt-5",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:p("settings.overview.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p("settings.overview.description")})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(E,{variant:a||c?"warning":"success",children:p(a||c?"modelManagement.actions.unsaved":"common.status.success")}),l?e.jsx(E,{variant:"outline",className:"border-amber-300 text-amber-700 dark:border-amber-700 dark:text-amber-300",children:p("settings.protocol.restartWarning")}):null]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(U,{label:p("settings.overview.cards.protocols"),value:o,helper:`${n.httpHost||"127.0.0.1"}:${n.httpPort}${n.httpsEnabled?` / ${n.httpsHost||"127.0.0.1"}:${n.httpsPort}`:""}`}),e.jsx(U,{label:p("settings.overview.cards.security"),value:p(i?"settings.overview.values.authEnabled":"settings.overview.values.authDisabled"),helper:h?`${p("settings.auth.username")}: ${h}`:p("settings.auth.enableHint")}),e.jsx(U,{label:p("settings.overview.cards.configFile"),value:s||p("settings.file.unknown"),helper:t??p("settings.defaults.none"),mono:!0})]})]})})}function Lt({defaultsSummary:s,errors:t,form:n,onInputChange:o,onSetForm:l,sectionRef:c}){const{t:a}=R();return e.jsx(A,{id:"section-basics",ref:c,children:e.jsxs(L,{className:"pt-6",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:a("settings.sections.basics")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:a("settings.description")})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[e.jsx(X,{label:a("settings.fields.retention"),value:n.logRetentionDays}),e.jsx(X,{label:a("settings.fields.logExportTimeout"),value:`${n.logExportTimeoutSeconds}s`}),e.jsx(X,{label:a("settings.fields.bodyLimit"),value:`${n.bodyLimitMb} MB`})]})]}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:a("settings.fields.port")}),e.jsx(w,{type:"number",min:1,max:65535,value:n.port,onChange:i=>o("port")(i.target.value),"aria-invalid":!!t.port}),t.port?e.jsx("p",{className:"text-xs text-destructive",children:t.port}):null]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:a("settings.fields.host")}),e.jsx(w,{value:n.host,onChange:i=>o("host")(i.target.value),placeholder:a("settings.fields.hostPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:a("settings.fields.retention")}),e.jsx(w,{type:"number",min:1,max:365,value:n.logRetentionDays,onChange:i=>o("logRetentionDays")(i.target.value),"aria-invalid":!!t.logRetentionDays}),t.logRetentionDays?e.jsx("p",{className:"text-xs text-destructive",children:t.logRetentionDays}):null]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:a("settings.fields.logExportTimeout")}),e.jsx(w,{type:"number",min:5,max:600,value:n.logExportTimeoutSeconds,onChange:i=>o("logExportTimeoutSeconds")(i.target.value),"aria-invalid":!!t.logExportTimeoutSeconds}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settings.fields.logExportTimeoutHint")}),t.logExportTimeoutSeconds?e.jsx("p",{className:"text-xs text-destructive",children:t.logExportTimeoutSeconds}):null]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:a("settings.fields.bodyLimit")}),e.jsx(w,{type:"number",min:1,max:2048,value:n.bodyLimitMb,onChange:i=>o("bodyLimitMb")(i.target.value),"aria-invalid":!!t.bodyLimitMb}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settings.fields.bodyLimitHint")}),t.bodyLimitMb?e.jsx("p",{className:"text-xs text-destructive",children:t.bodyLimitMb}):null]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:a("settings.fields.logLevel")}),e.jsxs(Nt,{value:n.logLevel,onValueChange:i=>l(h=>({...h,logLevel:i})),children:[e.jsx(wt,{children:e.jsx(Ct,{})}),e.jsx(Pt,{children:Rt.map(i=>e.jsx(kt,{value:i.value,children:a(`settings.fields.logLevelOption.${i.labelKey}`)},i.value))})]})]}),e.jsxs("div",{className:"grid gap-4 md:col-span-2 sm:grid-cols-2",children:[e.jsx(Z,{label:a("settings.fields.storeRequestPayloads"),hint:a("settings.fields.storeRequestPayloadsHint"),checked:n.storeRequestPayloads,onCheckedChange:i=>l(h=>({...h,storeRequestPayloads:i}))}),e.jsx(Z,{label:a("settings.fields.storeResponsePayloads"),hint:a("settings.fields.storeResponsePayloadsHint"),checked:n.storeResponsePayloads,onCheckedChange:i=>l(h=>({...h,storeResponsePayloads:i}))}),e.jsx(Z,{label:a("settings.fields.enableRoutingFallback"),hint:a("settings.fields.enableRoutingFallbackHint"),checked:n.enableRoutingFallback,onCheckedChange:i=>l(h=>({...h,enableRoutingFallback:i}))})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-secondary p-4 md:col-span-2",children:[e.jsx(v,{className:"text-xs uppercase tracking-wide text-muted-foreground",children:a("settings.fields.defaults")}),e.jsx("p",{className:"mt-2 text-sm",children:s??a("settings.defaults.none")})]})]})]})})}function Tt({errors:s,form:t,onSetForm:n,sectionRef:o}){const{t:l}=R();return e.jsx(A,{id:"section-protocol",ref:o,children:e.jsxs(L,{className:"space-y-6 pt-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:l("settings.sections.protocol")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l("settings.protocol.description")})]}),e.jsx("div",{className:"rounded-lg border border-[hsl(var(--warning)/0.3)] bg-[hsl(var(--warning-bg))] p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(J,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-[hsl(var(--warning)/1)]"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:l("settings.protocol.restartWarning")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l("settings.protocol.restartHint")}),e.jsx("code",{className:"block rounded-lg border border-border bg-secondary px-3 py-2 text-xs font-mono text-foreground",children:"cc-gw restart --daemon"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l("settings.protocol.restartTip")})]})]})}),s.protocol?e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 p-4 text-sm text-destructive",children:[e.jsx(J,{className:"mr-2 inline h-4 w-4"}),s.protocol]}):null,e.jsxs("div",{className:"rounded-lg border border-border bg-secondary p-5",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(v,{className:"text-sm font-medium text-foreground",children:l("settings.protocol.http.enable")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l("settings.protocol.http.hint")})]}),e.jsx(B,{checked:t.httpEnabled,onCheckedChange:c=>n(a=>({...a,httpEnabled:c}))})]}),t.httpEnabled?e.jsxs("div",{className:"mt-4 grid gap-4 border-t border-border pt-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:l("settings.protocol.http.port")}),e.jsx(w,{type:"number",min:1,max:65535,value:t.httpPort,onChange:c=>n(a=>({...a,httpPort:c.target.value})),"aria-invalid":!!s.httpPort}),s.httpPort?e.jsx("p",{className:"text-xs text-destructive",children:s.httpPort}):null]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:l("settings.protocol.http.host")}),e.jsx(w,{value:t.httpHost,onChange:c=>n(a=>({...a,httpHost:c.target.value})),placeholder:"127.0.0.1"})]})]}):null]}),e.jsxs("div",{className:"rounded-lg border border-border bg-secondary p-5",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{className:"text-sm font-medium text-foreground",children:l("settings.protocol.https.enable")}),e.jsx(gt,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l("settings.protocol.https.hint")})]}),e.jsx(B,{checked:t.httpsEnabled,onCheckedChange:c=>n(a=>({...a,httpsEnabled:c}))})]}),t.httpsEnabled?e.jsxs("div",{className:"mt-4 space-y-4 border-t border-border pt-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:l("settings.protocol.https.port")}),e.jsx(w,{type:"number",min:1,max:65535,value:t.httpsPort,onChange:c=>n(a=>({...a,httpsPort:c.target.value})),"aria-invalid":!!s.httpsPort}),s.httpsPort?e.jsx("p",{className:"text-xs text-destructive",children:s.httpsPort}):null]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:l("settings.protocol.https.host")}),e.jsx(w,{value:t.httpsHost,onChange:c=>n(a=>({...a,httpsHost:c.target.value})),placeholder:"127.0.0.1"})]})]}),e.jsx(ee,{label:l("settings.protocol.https.keyPath"),value:t.httpsKeyPath,onChange:c=>n(a=>({...a,httpsKeyPath:c})),placeholder:"~/.cc-gw/certs/key.pem"}),e.jsx(ee,{label:l("settings.protocol.https.certPath"),value:t.httpsCertPath,onChange:c=>n(a=>({...a,httpsCertPath:c})),placeholder:"~/.cc-gw/certs/cert.pem"}),e.jsx(ee,{label:l("settings.protocol.https.caPath"),value:t.httpsCaPath,onChange:c=>n(a=>({...a,httpsCaPath:c})),placeholder:"留空则不使用"}),e.jsx("div",{className:"rounded-lg border border-[hsl(var(--warning)/0.3)] bg-[hsl(var(--warning-bg))] p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(J,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-[hsl(var(--warning)/1)]"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:l("settings.protocol.https.warning")}),e.jsxs("p",{className:"text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:[e.jsx("strong",{children:l("settings.protocol.https.invalidCert")}),l("settings.protocol.https.invalidCertDetail")]}),e.jsxs("p",{className:"text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:[e.jsx("strong",{children:l("settings.protocol.https.recommended")}),l("settings.protocol.https.recommendedDetail")]}),e.jsx("p",{className:"text-xs leading-relaxed text-amber-600 dark:text-amber-400",children:l("settings.protocol.https.tip")})]})]})})]}):null]})]})})}function Mt({authErrors:s,authForm:t,authLoading:n,authSettings:o,needsPassword:l,onAuthReset:c,onAuthSave:a,onSetAuthForm:i,savingAuth:h,isAuthDirty:p,sectionRef:T}){const{t:x}=R();return e.jsx(A,{id:"section-security",ref:T,children:e.jsxs(L,{className:"space-y-5 pt-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:x("settings.sections.security")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:x("settings.auth.description")})]}),n&&!o?e.jsx("div",{className:"flex min-h-[120px] items-center justify-center",children:e.jsx(Fe,{})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 rounded-lg border border-border bg-secondary p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"text-sm font-medium",children:x("settings.auth.enable")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:x("settings.auth.enableHint")}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"rounded-full border border-border bg-card px-3 py-1",children:"/ui"}),e.jsx("span",{className:"rounded-full border border-border bg-card px-3 py-1",children:"/api/*"}),e.jsx("span",{className:"rounded-full border border-border bg-card px-3 py-1",children:"Cookie Session"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 self-start sm:self-auto",children:[e.jsx(E,{variant:t.enabled?"success":"secondary",children:t.enabled?x("settings.auth.statusEnabled"):x("settings.auth.statusDisabled")}),e.jsx(B,{checked:t.enabled,onCheckedChange:d=>i(N=>({...N,enabled:d}))})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,0.85fr)]",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[e.jsx(v,{children:x("settings.auth.username")}),e.jsx(w,{value:t.username,onChange:d=>i(N=>({...N,username:d.target.value})),placeholder:x("settings.auth.usernamePlaceholder")}),s.username?e.jsx("p",{className:"text-xs text-destructive",children:s.username}):null]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:x("settings.auth.password")}),e.jsx(w,{type:"password",value:t.password,disabled:!t.enabled,onChange:d=>i(N=>({...N,password:d.target.value})),placeholder:x("settings.auth.passwordPlaceholder")}),s.password?e.jsx("p",{className:"text-xs text-destructive",children:s.password}):e.jsx("p",{className:"text-xs text-muted-foreground",children:x(l?"settings.auth.passwordHintRequired":"settings.auth.passwordHintOptional")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:x("settings.auth.confirmPassword")}),e.jsx(w,{type:"password",value:t.confirmPassword,disabled:!t.enabled,onChange:d=>i(N=>({...N,confirmPassword:d.target.value})),placeholder:x("settings.auth.confirmPasswordPlaceholder")}),s.confirmPassword?e.jsx("p",{className:"text-xs text-destructive",children:s.confirmPassword}):null]})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-secondary p-4",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:x("settings.auth.status")}),e.jsx("p",{className:"mt-2 text-base font-semibold",children:o!=null&&o.enabled?x("settings.auth.statusEnabled"):x("settings.auth.statusDisabled")}),o!=null&&o.username?e.jsxs("div",{className:"mt-3 rounded-lg bg-accent px-3 py-2 text-xs font-medium text-primary",children:[x("settings.auth.username"),": ",o.username]}):null]}),e.jsx("div",{className:"rounded-lg border border-border bg-secondary p-4 text-xs text-muted-foreground",children:x(l?"settings.auth.passwordHintRequired":"settings.auth.passwordHintOptional")})]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:flex lg:flex-wrap lg:justify-end",children:[e.jsx(k,{onClick:a,disabled:h||!p,className:"w-full lg:w-auto",children:x(h?"common.actions.saving":"settings.auth.actions.save")}),e.jsx(k,{variant:"outline",onClick:c,disabled:h||!p,className:"w-full lg:w-auto",children:x("common.actions.reset")})]})]})]})})}function Ot({configPath:s,onCopyPath:t,sectionRef:n}){const{t:o}=R();return e.jsx(A,{id:"section-config-file",ref:n,children:e.jsxs(L,{className:"space-y-3 pt-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:o("settings.sections.configFile")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o("settings.file.description")})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:t,className:"w-full sm:w-auto",children:[e.jsx(xt,{className:"mr-2 h-4 w-4"}),o("common.actions.copy")]})]}),e.jsx("code",{className:"block break-all rounded-lg border border-border bg-secondary px-4 py-3 text-xs",children:s||o("settings.file.unknown")}),e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-4 py-3 text-xs text-muted-foreground",children:o("help.note")})]})})}function Ft({cleaning:s,clearingAll:t,onOpenCleanup:n,onOpenClearAll:o,sectionRef:l}){const{t:c}=R();return e.jsx(A,{id:"section-cleanup",ref:l,children:e.jsxs(L,{className:"space-y-4 pt-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:c("settings.sections.cleanup")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:c("settings.cleanup.description")})]}),e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-4 py-3 text-xs text-muted-foreground",children:c("settings.cleanup.confirmCleanup")}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx("div",{className:"rounded-lg border border-[hsl(var(--warning)/0.3)] bg-[hsl(var(--warning-bg))] p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{variant:"warning",children:c("settings.cleanup.softLabel")}),e.jsx("p",{className:"text-sm font-medium",children:c("settings.cleanup.softTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:c("settings.cleanup.softDescription")}),e.jsx(k,{variant:"outline",onClick:n,disabled:s,className:"w-full sm:w-auto",children:c(s?"common.actions.cleaning":"common.actions.cleanup")})]})}),e.jsx("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{variant:"outline",className:"border-destructive/40 bg-destructive/10 text-destructive",children:c("settings.cleanup.hardLabel")}),e.jsx("p",{className:"text-sm font-medium",children:c("settings.cleanup.hardTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:c("settings.cleanup.clearAllWarning")}),e.jsx(k,{variant:"destructive",onClick:o,disabled:t,className:"w-full sm:w-auto",children:c(t?"settings.cleanup.clearingAll":"settings.cleanup.clearAll")})]})})]})]})})}function Ht({isAuthDirty:s,isConfigDirty:t,protocolChangesPending:n,onAuthReset:o,onAuthSave:l,onReset:c,onSave:a,saving:i,savingAuth:h}){const{t:p}=R();return!s&&!t?null:e.jsxs("div",{className:"sticky bottom-4 z-20 flex flex-col gap-3 rounded-lg border border-primary/20 bg-card p-4 shadow-lg backdrop-blur-sm md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(E,{variant:"secondary",children:p("modelManagement.actions.unsaved")}),t?e.jsx(E,{variant:"outline",children:p("settings.sections.basics")}):null,s?e.jsx(E,{variant:"outline",children:p("settings.sections.security")}):null,n?e.jsx(E,{variant:"outline",className:"border-amber-300 text-amber-700 dark:border-amber-700 dark:text-amber-300",children:p("settings.sections.protocol")}):null]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p(n?"settings.toast.protocolRestartRequired":"modelManagement.actions.footerDirtyHint")})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:flex lg:flex-wrap lg:items-center",children:[s?e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"outline",onClick:o,disabled:h,className:"w-full lg:w-auto",children:p("common.actions.reset")}),e.jsx(k,{onClick:l,disabled:h,className:"w-full lg:w-auto",children:p(h?"common.actions.saving":"settings.auth.actions.save")})]}):null,t?e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"outline",onClick:c,disabled:i,className:"w-full lg:w-auto",children:p("common.actions.reset")}),e.jsx(k,{onClick:a,disabled:i,className:"w-full lg:w-auto",children:p(i?"common.actions.saving":"common.actions.save")})]}):null]})]})}function U({label:s,value:t,helper:n,mono:o=!1}){return e.jsxs("div",{className:"rounded-lg border border-border bg-card px-4 py-3",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:s}),e.jsx("p",{className:M("mt-2 text-sm font-semibold text-foreground",o&&"break-all font-mono text-xs"),children:t}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:n})]})}function X({label:s,value:t}){return e.jsxs("div",{className:"rounded-lg border border-border bg-secondary px-3 py-2",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:s}),e.jsx("p",{className:"mt-1 text-sm font-semibold text-foreground",children:t})]})}function Z({checked:s,className:t,hint:n,hintClassName:o,label:l,labelClassName:c,onCheckedChange:a}){return e.jsxs("div",{className:M("flex flex-col gap-4 rounded-lg border border-border bg-secondary p-4 sm:flex-row sm:items-center sm:justify-between",t),children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(v,{className:M("text-sm font-medium",c),children:l}),e.jsx("p",{className:M("text-xs text-muted-foreground",o),children:n})]}),e.jsx(B,{checked:s,onCheckedChange:a,className:"self-start sm:self-auto"})]})}function ee({label:s,onChange:t,placeholder:n,value:o}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:s}),e.jsx(w,{value:o,onChange:l=>t(l.target.value),placeholder:n,className:"font-mono text-xs"})]})}const V={authStatusRequest(){return{url:"/api/auth/web",method:"GET"}},saveWebAuth:async s=>ft(vt.post("/api/auth/web",s)),cleanupLogs:async()=>Te({url:"/api/logs/cleanup",method:"POST"}),clearLogs:async()=>Te({url:"/api/logs/clear",method:"POST"})};function Dt(){const{t:s}=R(),{pushToast:t}=jt(),[n,o]=m.useState(te[0].id),l=m.useRef(new Map),c=m.useCallback(r=>{const g=l.current.get(r);g&&g.scrollIntoView({behavior:"smooth",block:"start"})},[]),a=m.useCallback(r=>g=>{g?l.current.set(r,g):l.current.delete(r)},[]),i=Me(_.config.info(),Oe.configInfoRequest()),h=Me(_.auth.web(),V.authStatusRequest()),p=Q({mutationFn:V.saveWebAuth,successToast:()=>({title:s("settings.auth.toast.success")}),errorToast:r=>({title:s("settings.auth.toast.failure",{message:r.message})}),invalidateKeys:[_.auth.web()]}),T=Q({mutationFn:V.cleanupLogs,successToast:r=>({title:r.deleted>0?s("settings.toast.cleanupSuccess",{count:r.deleted}):s("settings.toast.cleanupNone")}),errorToast:r=>({title:s("settings.toast.cleanupFailure",{message:r.message})})}),x=Q({mutationFn:V.clearLogs,successToast:r=>({title:s("settings.toast.clearAllSuccess",{logs:r.deleted,metrics:r.metricsCleared})}),errorToast:r=>({title:s("settings.toast.clearAllFailure",{message:r.message})})}),[d,N]=m.useState(null),[C,He]=m.useState(""),[u,H]=m.useState({port:"",host:"",logRetentionDays:"",logExportTimeoutSeconds:"60",storeRequestPayloads:!0,storeResponsePayloads:!0,logLevel:"info",bodyLimitMb:"10",enableRoutingFallback:!1,httpEnabled:!0,httpPort:"4100",httpHost:"127.0.0.1",httpsEnabled:!1,httpsPort:"4443",httpsHost:"127.0.0.1",httpsKeyPath:"",httpsCertPath:"",httpsCaPath:""}),[De,I]=m.useState({}),[Ke,se]=m.useState(!1),[qe,ae]=m.useState(!1),[Ve,ne]=m.useState(!1),[Be,Ie]=m.useState(!1),[$e,We]=m.useState(!1),[j,re]=m.useState(null),[b,D]=m.useState({enabled:!1,username:"",password:"",confirmPassword:""}),[Ge,K]=m.useState({}),[Je,le]=m.useState(!1),Qe=m.useMemo(()=>{if(!(d!=null&&d.defaults))return null;const r=[];return d.defaults.completion&&r.push(s("settings.defaults.completion",{model:d.defaults.completion})),d.defaults.reasoning&&r.push(s("settings.defaults.reasoning",{model:d.defaults.reasoning})),d.defaults.background&&r.push(s("settings.defaults.background",{model:d.defaults.background})),r.length>0?r.join(" | "):s("settings.defaults.none")},[d,s]),_e=m.useMemo(()=>u.httpEnabled&&u.httpsEnabled?s("settings.overview.values.httpAndHttps"):u.httpsEnabled?s("settings.overview.values.httpsOnly"):s("settings.overview.values.httpOnly"),[u.httpEnabled,u.httpsEnabled,s]),ze=m.useMemo(()=>b.enabled?j!=null&&j.hasPassword?b.username.trim()!==(j.username??""):!0:!1,[b.enabled,b.username,j]),O=m.useMemo(()=>d?z(d):null,[d]),Ye=m.useMemo(()=>O?JSON.stringify(u)!==JSON.stringify(O):!1,[u,O]),$=m.useMemo(()=>j?Y(j):null,[j]),Ue=m.useMemo(()=>$?JSON.stringify(b)!==JSON.stringify($):!1,[b,$]),Xe=m.useMemo(()=>O?["httpEnabled","httpPort","httpHost","httpsEnabled","httpsPort","httpsHost","httpsKeyPath","httpsCertPath","httpsCaPath","port","host"].some(g=>u[g]!==O[g]):!1,[u,O]);m.useEffect(()=>{i.data&&(N(i.data.config),He(i.data.path),H(z(i.data.config)))},[i.data]),m.useEffect(()=>{h.data&&(re(h.data),D(Y(h.data)),K({}))},[h.data]),m.useEffect(()=>{!i.isError||!i.error||t({title:s("settings.toast.loadFailure",{message:i.error.message}),variant:"error"})},[i.error,i.isError,t,s]),m.useEffect(()=>{!h.isError||!h.error||t({title:s("settings.toast.authLoadFailure",{message:h.error.message}),variant:"error"})},[h.error,h.isError,t,s]);const Ze=m.useCallback(r=>g=>{H(y=>({...y,[r]:g}))},[]),oe=m.useCallback(()=>{const r={};if(!u.httpEnabled&&!u.httpsEnabled&&(r.protocol=s("settings.validation.protocolRequired")),u.httpEnabled){const S=Number(u.httpPort);(!Number.isFinite(S)||S<1||S>65535)&&(r.httpPort=s("settings.validation.httpPort"))}if(u.httpsEnabled){const S=Number(u.httpsPort);(!Number.isFinite(S)||S<1||S>65535)&&(r.httpsPort=s("settings.validation.httpsPort")),(!u.httpsKeyPath||!u.httpsCertPath)&&(r.protocol=s("settings.validation.httpsCertificate"))}const g=Number(u.port);(!Number.isFinite(g)||g<1||g>65535)&&(r.port=s("settings.validation.port"));const y=Number(u.logRetentionDays);(!Number.isFinite(y)||y<1||y>365)&&(r.logRetentionDays=s("settings.validation.retention"));const P=Number(u.logExportTimeoutSeconds);(!Number.isFinite(P)||P<5||P>600)&&(r.logExportTimeoutSeconds=s("settings.validation.logExportTimeout"));const F=Number(u.bodyLimitMb);return(!Number.isFinite(F)||F<1||F>2048)&&(r.bodyLimitMb=s("settings.validation.bodyLimit")),I(r),Object.keys(r).length===0},[u,s]),ie=m.useCallback(()=>{const r={},g=b.username.trim(),y=j?g!==(j.username??""):!0,P=b.enabled&&(!(j!=null&&j.hasPassword)||y);return b.enabled&&!g&&(r.username=s("settings.auth.validation.username")),b.password&&b.password.length<6&&(r.password=s("settings.auth.validation.minLength")),P&&!b.password&&(r.password=s("settings.auth.validation.passwordRequired")),(b.password||b.confirmPassword)&&b.password!==b.confirmPassword&&(r.confirmPassword=s("settings.auth.validation.confirmMismatch")),K(r),Object.keys(r).length===0},[b,j,s]),et=m.useCallback(async()=>{var r,g,y,P,F,S,ce,de,ue,me,pe,he,ge,xe,be,fe,ve,je,ye,Ne,we,Ce,Pe,ke,Se,Re;if(!d){t({title:s("settings.toast.loadFailure",{message:s("settings.toast.missingConfig")}),variant:"error"});return}if(oe()){se(!0);try{const q=Number(u.port),ot=Number(u.logRetentionDays),it=Number(u.logExportTimeoutSeconds),ct=Number(u.bodyLimitMb),f={...d,http:{enabled:u.httpEnabled,port:Number(u.httpPort),host:u.httpHost.trim()||"127.0.0.1"},https:{enabled:u.httpsEnabled,port:Number(u.httpsPort),host:u.httpsHost.trim()||"127.0.0.1",keyPath:u.httpsKeyPath.trim(),certPath:u.httpsCertPath.trim(),caPath:u.httpsCaPath.trim()||void 0},port:q,host:u.host.trim()||void 0,logRetentionDays:ot,logExportTimeoutSeconds:Math.min(Math.max(Math.round(it),5),600),storeRequestPayloads:u.storeRequestPayloads,storeResponsePayloads:u.storeResponsePayloads,logLevel:u.logLevel,bodyLimit:Math.max(1,Math.floor(ct*1024*1024)),enableRoutingFallback:u.enableRoutingFallback};delete f.requestLogging,delete f.responseLogging;const Ee={...f};delete Ee.webAuth,await Oe.saveConfig(Ee),N({...f,webAuth:d.webAuth});const Ae=G=>(G==null?void 0:G.trim())||void 0,dt=d.port??((r=d.http)==null?void 0:r.port)??4100,ut=f.port??((g=f.http)==null?void 0:g.port)??4100,mt=((y=d.host)==null?void 0:y.trim())||((F=(P=d.http)==null?void 0:P.host)==null?void 0:F.trim())||"127.0.0.1",pt=((S=f.host)==null?void 0:S.trim())||((de=(ce=f.http)==null?void 0:ce.host)==null?void 0:de.trim())||"127.0.0.1",ht=dt!==ut||mt!==pt||((ue=d.http)==null?void 0:ue.enabled)!==((me=f.http)==null?void 0:me.enabled)||((pe=d.http)==null?void 0:pe.port)!==((he=f.http)==null?void 0:he.port)||(((ge=d.http)==null?void 0:ge.host)??d.host??"127.0.0.1")!==(((xe=f.http)==null?void 0:xe.host)??f.host??"127.0.0.1")||((be=d.https)==null?void 0:be.enabled)!==((fe=f.https)==null?void 0:fe.enabled)||((ve=d.https)==null?void 0:ve.port)!==((je=f.https)==null?void 0:je.port)||(((ye=d.https)==null?void 0:ye.host)??d.host??"127.0.0.1")!==(((Ne=f.https)==null?void 0:Ne.host)??f.host??"127.0.0.1")||((we=d.https)==null?void 0:we.keyPath)!==((Ce=f.https)==null?void 0:Ce.keyPath)||((Pe=d.https)==null?void 0:Pe.certPath)!==((ke=f.https)==null?void 0:ke.certPath)||Ae((Se=d.https)==null?void 0:Se.caPath)!==Ae((Re=f.https)==null?void 0:Re.caPath);t({title:s(ht?"settings.toast.protocolRestartRequired":"settings.toast.saveSuccess"),variant:"success"}),i.refetch()}catch(q){t({title:s("settings.toast.saveFailure",{message:q instanceof Error?q.message:"unknown"}),variant:"error"})}finally{se(!1)}}},[d,i,u,t,s,oe]),tt=m.useCallback(()=>{d&&(H(z(d)),I({}))},[d]),st=m.useCallback(async()=>{if(ie()){le(!0);try{const r={enabled:b.enabled,username:b.username.trim()||void 0};b.password&&(r.password=b.password);const g=await p.mutateAsync(r);g.auth&&(re(g.auth),D({enabled:g.auth.enabled,username:g.auth.username??"",password:"",confirmPassword:""}),K({})),h.refetch()}catch{}finally{le(!1)}}},[b,h,p,ie]),at=m.useCallback(()=>{j&&(D(Y(j)),K({}))},[j]),nt=m.useCallback(async()=>{if(!C){t({title:s("settings.toast.copyFailure",{message:s("settings.file.unknown")}),variant:"error"});return}try{await St(C),t({title:s("settings.toast.copySuccess"),variant:"success"})}catch(r){t({title:s("settings.toast.copyFailure",{message:r instanceof Error?r.message:"unknown"}),variant:"error"})}},[C,t,s]),rt=m.useCallback(async()=>{ae(!0);try{await T.mutateAsync()}catch{}finally{ae(!1)}},[T]),lt=m.useCallback(async()=>{ne(!0);try{await x.mutateAsync()}catch{}finally{ne(!1)}},[x]),W=i.isPending||!d&&i.isFetching;return m.useEffect(()=>{if(W)return;const r=Array.from(l.current.values());if(r.length===0)return;const g=new IntersectionObserver(y=>{for(const P of y)if(P.isIntersecting){o(P.target.id);break}},{rootMargin:"-80px 0px -60% 0px",threshold:0});for(const y of r)g.observe(y);return()=>g.disconnect()},[W]),{activeSection:n,authErrors:Ge,authForm:b,authQuery:h,authSettings:j,clearingAll:Ve,cleaning:qe,config:d,configPath:C,configQuery:i,confirmCleanupOpen:Be,confirmClearAllOpen:$e,defaultsSummary:Qe,errors:De,form:u,handleAuthReset:at,handleAuthSave:st,handleCleanupLogs:rt,handleClearAllLogs:lt,handleCopyPath:nt,handleInputChange:Ze,handleReset:tt,handleSave:et,handleSectionClick:c,isAuthDirty:Ue,isConfigDirty:Ye,isLoading:W,needsPassword:ze,protocolSummaryLabel:_e,protocolChangesPending:Xe,saving:Ke,savingAuth:Je,sectionRefs:l,setAuthForm:D,setConfirmCleanupOpen:Ie,setConfirmClearAllOpen:We,setErrors:I,setForm:H,setSectionRef:a,t:s}}function ns(){var l,c;const{t:s}=R(),t=Dt(),n=Number(t.isConfigDirty)+Number(t.isAuthDirty),o=t.protocolChangesPending?s("settings.protocol.restartHint"):s("settings.overview.description");return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(yt,{icon:e.jsx(bt,{className:"h-5 w-5","aria-hidden":"true"}),title:s("settings.title"),description:s("settings.description"),eyebrow:"Gateway Controls",breadcrumb:"Gateway / Settings",helper:o,badge:n>0?s("settings.overview.unsavedCount",{count:n}):void 0,actions:t.config?e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-3 py-2 text-xs text-muted-foreground",children:t.protocolChangesPending?s("settings.protocol.restartWarning"):s("common.status.success")}),e.jsx(k,{variant:"outline",onClick:t.handleReset,disabled:t.saving||!t.isConfigDirty,className:"w-full sm:w-auto",children:s("common.actions.reset")}),e.jsx(k,{onClick:()=>void t.handleSave(),disabled:t.saving||!t.isConfigDirty,className:"w-full sm:w-auto",children:t.saving?s("common.actions.saving"):s("common.actions.save")})]}):null}),t.isLoading?e.jsx(A,{children:e.jsx(L,{className:"flex min-h-[220px] items-center justify-center",children:e.jsx(Fe,{})})}):t.config?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[200px_1fr]",children:[e.jsx(Et,{activeSection:t.activeSection,onSelectSection:t.handleSectionClick}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(At,{configPath:t.configPath,defaultsSummary:t.defaultsSummary,form:t.form,protocolSummaryLabel:t.protocolSummaryLabel,protocolChangesPending:t.protocolChangesPending,isAuthDirty:t.isAuthDirty,isConfigDirty:t.isConfigDirty,authEnabled:((l=t.authSettings)==null?void 0:l.enabled)??!1,authUsername:(c=t.authSettings)==null?void 0:c.username}),e.jsx(Lt,{defaultsSummary:t.defaultsSummary,errors:t.errors,form:t.form,onInputChange:t.handleInputChange,onSetForm:t.setForm,sectionRef:t.setSectionRef("section-basics")}),e.jsx(Tt,{errors:t.errors,form:t.form,onSetForm:t.setForm,sectionRef:t.setSectionRef("section-protocol")}),e.jsx(Mt,{authErrors:t.authErrors,authForm:t.authForm,authLoading:t.authQuery.isPending||!t.authSettings&&t.authQuery.isFetching,authSettings:t.authSettings,needsPassword:t.needsPassword,onAuthReset:t.handleAuthReset,onAuthSave:()=>void t.handleAuthSave(),onSetAuthForm:t.setAuthForm,savingAuth:t.savingAuth,isAuthDirty:t.isAuthDirty,sectionRef:t.setSectionRef("section-security")}),e.jsx(Ot,{configPath:t.configPath,onCopyPath:()=>void t.handleCopyPath(),sectionRef:t.setSectionRef("section-config-file")}),e.jsx(Ft,{cleaning:t.cleaning,clearingAll:t.clearingAll,onOpenCleanup:()=>t.setConfirmCleanupOpen(!0),onOpenClearAll:()=>t.setConfirmClearAllOpen(!0),sectionRef:t.setSectionRef("section-cleanup")})]})]}),e.jsx(Ht,{isAuthDirty:t.isAuthDirty,isConfigDirty:t.isConfigDirty,protocolChangesPending:t.protocolChangesPending,onAuthReset:t.handleAuthReset,onAuthSave:()=>void t.handleAuthSave(),onReset:t.handleReset,onSave:()=>void t.handleSave(),saving:t.saving,savingAuth:t.savingAuth})]}):e.jsx(A,{children:e.jsx(L,{className:"pt-6",children:e.jsx("p",{className:"text-sm font-medium text-destructive",children:s("settings.toast.missingConfig")})})}),e.jsx(Le,{open:t.confirmCleanupOpen,onOpenChange:a=>{!a&&!t.cleaning&&t.setConfirmCleanupOpen(!1)},title:s("settings.cleanup.confirmTitle"),description:s("settings.cleanup.confirmDescription"),confirmLabel:t.cleaning?s("common.actions.cleaning"):s("common.actions.cleanup"),cancelLabel:s("common.actions.cancel"),loading:t.cleaning,onConfirm:async()=>{await t.handleCleanupLogs(),t.setConfirmCleanupOpen(!1)}}),e.jsx(Le,{open:t.confirmClearAllOpen,onOpenChange:a=>{!a&&!t.clearingAll&&t.setConfirmClearAllOpen(!1)},title:s("settings.cleanup.clearAllTitle"),description:s("settings.cleanup.clearAllWarning"),confirmLabel:t.clearingAll?s("settings.cleanup.clearingAll"):s("settings.cleanup.clearAll"),cancelLabel:s("common.actions.cancel"),loading:t.clearingAll,onConfirm:async()=>{await t.handleClearAllLogs(),t.setConfirmClearAllOpen(!1)}})]})}export{ns as default};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-5iCEqDpV.js";import{c as n}from"./index-BzuBtvAC.js";function s({className:a}){return e.jsx("div",{role:"status","aria-label":"Loading",className:n("animate-pulse rounded-xl bg-muted/70",a)})}function o(){return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(s,{className:"h-3 w-24"}),e.jsx(s,{className:"h-10 w-10 rounded-xl"})]}),e.jsx(s,{className:"h-8 w-32"})]})}function m(){return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"h-4 w-32"}),e.jsx(s,{className:"h-3 w-48"})]}),e.jsx(s,{className:"h-[320px] w-full rounded-lg"})]})}function i({columns:a=6}){const r=["w-24","w-16","w-20","w-28","w-14","w-12","w-20","w-16","w-14","w-12"];return e.jsx("tr",{className:"border-b",children:Array.from({length:a}).map((d,l)=>e.jsx("td",{className:"px-3 py-3",children:e.jsx(s,{className:n("h-4",r[l%r.length])})},l))})}export{m as C,o as S,i as T};
1
+ import{j as e}from"./vendor-5iCEqDpV.js";import{c as n}from"./index-CYeQpt9d.js";function s({className:a}){return e.jsx("div",{role:"status","aria-label":"Loading",className:n("animate-pulse rounded-xl bg-muted/70",a)})}function o(){return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(s,{className:"h-3 w-24"}),e.jsx(s,{className:"h-10 w-10 rounded-xl"})]}),e.jsx(s,{className:"h-8 w-32"})]})}function m(){return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"h-4 w-32"}),e.jsx(s,{className:"h-3 w-48"})]}),e.jsx(s,{className:"h-[320px] w-full rounded-lg"})]})}function i({columns:a=6}){const r=["w-24","w-16","w-20","w-28","w-14","w-12","w-20","w-16","w-14","w-12"];return e.jsx("tr",{className:"border-b",children:Array.from({length:a}).map((d,l)=>e.jsx("td",{className:"px-3 py-3",children:e.jsx(s,{className:n("h-4",r[l%r.length])})},l))})}export{m as C,o as S,i as T};
@@ -1 +1 @@
1
- import{j as d,a0 as t}from"./vendor-5iCEqDpV.js";import{c as o}from"./index-BzuBtvAC.js";const n=t("inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-semibold tracking-[0.02em] transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-primary/15 bg-primary/10 text-primary hover:bg-primary/15 dark:border-primary/25 dark:bg-primary/15 dark:text-primary-foreground",secondary:"border-border/70 bg-secondary/90 text-secondary-foreground hover:bg-secondary dark:border-border dark:bg-secondary/70 dark:text-secondary-foreground",destructive:"border-red-200 bg-red-50 text-red-700 hover:bg-red-100 dark:border-red-900 dark:bg-red-950/60 dark:text-red-300",outline:"border-border bg-transparent text-muted-foreground hover:bg-accent dark:border-border dark:text-muted-foreground dark:hover:bg-accent",success:"border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:border-emerald-900 dark:bg-emerald-950/60 dark:text-emerald-300",warning:"border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100 dark:border-amber-900 dark:bg-amber-950/60 dark:text-amber-300",info:"border-cyan-200 bg-cyan-50 text-cyan-700 hover:bg-cyan-100 dark:border-cyan-900 dark:bg-cyan-950/60 dark:text-cyan-300",purple:"border-violet-200 bg-violet-50 text-violet-700 hover:bg-violet-100 dark:border-violet-900 dark:bg-violet-950/60 dark:text-violet-300",pink:"border-pink-200 bg-pink-50 text-pink-700 hover:bg-pink-100 dark:border-pink-900 dark:bg-pink-950/60 dark:text-pink-300"}},defaultVariants:{variant:"default"}});function g({className:r,variant:e,...a}){return d.jsx("div",{className:o(n({variant:e}),r),...a})}export{g as B};
1
+ import{j as d,a0 as t}from"./vendor-5iCEqDpV.js";import{c as o}from"./index-CYeQpt9d.js";const n=t("inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-semibold tracking-[0.02em] transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-primary/15 bg-primary/10 text-primary hover:bg-primary/15 dark:border-primary/25 dark:bg-primary/15 dark:text-primary-foreground",secondary:"border-border/70 bg-secondary/90 text-secondary-foreground hover:bg-secondary dark:border-border dark:bg-secondary/70 dark:text-secondary-foreground",destructive:"border-red-200 bg-red-50 text-red-700 hover:bg-red-100 dark:border-red-900 dark:bg-red-950/60 dark:text-red-300",outline:"border-border bg-transparent text-muted-foreground hover:bg-accent dark:border-border dark:text-muted-foreground dark:hover:bg-accent",success:"border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:border-emerald-900 dark:bg-emerald-950/60 dark:text-emerald-300",warning:"border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100 dark:border-amber-900 dark:bg-amber-950/60 dark:text-amber-300",info:"border-cyan-200 bg-cyan-50 text-cyan-700 hover:bg-cyan-100 dark:border-cyan-900 dark:bg-cyan-950/60 dark:text-cyan-300",purple:"border-violet-200 bg-violet-50 text-violet-700 hover:bg-violet-100 dark:border-violet-900 dark:bg-violet-950/60 dark:text-violet-300",pink:"border-pink-200 bg-pink-50 text-pink-700 hover:bg-pink-100 dark:border-pink-900 dark:bg-pink-950/60 dark:text-pink-300"}},defaultVariants:{variant:"default"}});function g({className:r,variant:e,...a}){return d.jsx("div",{className:o(n({variant:e}),r),...a})}export{g as B};
@@ -1 +1 @@
1
- import{r as s,j as d,a0 as n}from"./vendor-5iCEqDpV.js";import{c as o}from"./index-BzuBtvAC.js";const i=n("rounded-lg border border-border bg-card text-card-foreground transition-all duration-200",{variants:{variant:{default:"shadow-sm",elevated:"shadow-md",outline:"border-border bg-background shadow-none",ghost:"border-transparent bg-transparent shadow-none",interactive:"cursor-pointer shadow-sm hover:-translate-y-0.5 hover:border-primary/20 hover:shadow-md"}},defaultVariants:{variant:"default"}}),l=s.forwardRef(({className:a,variant:r,...e},t)=>d.jsx("div",{ref:t,className:o(i({variant:r}),a),...e}));l.displayName="Card";const c=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("flex flex-col space-y-1.5 p-6",a),...r}));c.displayName="CardHeader";const m=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("text-lg font-semibold leading-none tracking-[-0.01em]",a),...r}));m.displayName="CardTitle";const f=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("text-sm leading-6 text-muted-foreground",a),...r}));f.displayName="CardDescription";const p=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("p-6 pt-0",a),...r}));p.displayName="CardContent";const x=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("flex items-center p-6 pt-0",a),...r}));x.displayName="CardFooter";export{l as C,p as a,c as b,m as c,f as d,x as e};
1
+ import{r as s,j as d,a0 as n}from"./vendor-5iCEqDpV.js";import{c as o}from"./index-CYeQpt9d.js";const i=n("rounded-lg border border-border bg-card text-card-foreground transition-all duration-200",{variants:{variant:{default:"shadow-sm",elevated:"shadow-md",outline:"border-border bg-background shadow-none",ghost:"border-transparent bg-transparent shadow-none",interactive:"cursor-pointer shadow-sm hover:-translate-y-0.5 hover:border-primary/20 hover:shadow-md"}},defaultVariants:{variant:"default"}}),l=s.forwardRef(({className:a,variant:r,...e},t)=>d.jsx("div",{ref:t,className:o(i({variant:r}),a),...e}));l.displayName="Card";const c=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("flex flex-col space-y-1.5 p-6",a),...r}));c.displayName="CardHeader";const m=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("text-lg font-semibold leading-none tracking-[-0.01em]",a),...r}));m.displayName="CardTitle";const f=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("text-sm leading-6 text-muted-foreground",a),...r}));f.displayName="CardDescription";const p=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("p-6 pt-0",a),...r}));p.displayName="CardContent";const x=s.forwardRef(({className:a,...r},e)=>d.jsx("div",{ref:e,className:o("flex items-center p-6 pt-0",a),...r}));x.displayName="CardFooter";export{l as C,p as a,c as b,m as c,f as d,x as e};
@@ -1 +1 @@
1
- import{h as o,b as i,r as e}from"./index-BzuBtvAC.js";const r={configRequest(){return{url:"/api/config",method:"GET"}},configInfoRequest(){return{url:"/api/config/info",method:"GET"}},providersRequest(){return{url:"/api/providers",method:"GET"}},configInfo:async()=>e(r.configInfoRequest()),providers:async()=>e(r.providersRequest()),saveConfig:async n=>{await o(i.put("/api/config",n))}};export{r as g};
1
+ import{h as o,b as i,r as e}from"./index-CYeQpt9d.js";const r={configRequest(){return{url:"/api/config",method:"GET"}},configInfoRequest(){return{url:"/api/config/info",method:"GET"}},providersRequest(){return{url:"/api/providers",method:"GET"}},configInfo:async()=>e(r.configInfoRequest()),providers:async()=>e(r.providersRequest()),saveConfig:async n=>{await o(i.put("/api/config",n))}};export{r as g};