@chenpu17/cc-gw 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +6 -6
- package/src/web/dist/assets/{About-BlnDjxRZ.js → About-BJbSQIDc.js} +1 -1
- package/src/web/dist/assets/{ApiKeys-Bx2Y7hWv.js → ApiKeys-C8I9ti-a.js} +1 -1
- package/src/web/dist/assets/{ConfirmDialog-BzQnNT7J.js → ConfirmDialog-BOe5HI56.js} +1 -1
- package/src/web/dist/assets/{Dashboard-DQ63EzZw.js → Dashboard-C7n9KzBy.js} +1 -1
- package/src/web/dist/assets/{DialogShell-iCyqEFRA.js → DialogShell-BbpG8sot.js} +1 -1
- package/src/web/dist/assets/{Events-DnzSzb94.js → Events-BGfmA69d.js} +1 -1
- package/src/web/dist/assets/{Help-B2NLJW2z.js → Help-DUrs56_n.js} +1 -1
- package/src/web/dist/assets/{Login-eevgp5s_.js → Login-Dxeq-BfV.js} +1 -1
- package/src/web/dist/assets/{Logs-BY5T_RIf.js → Logs-VRdCNMkl.js} +1 -1
- package/src/web/dist/assets/{PageSection-BE4JZURK.js → PageSection-Bv6dZZwN.js} +1 -1
- package/src/web/dist/assets/{PageState-BzdQq00f.js → PageState-U6DpaNu4.js} +1 -1
- package/src/web/dist/assets/{PageToolbar-xVyzEX46.js → PageToolbar-BnDacS2l.js} +1 -1
- package/src/web/dist/assets/ProvidersWorkbench-DOGrU9Xl.js +1 -0
- package/src/web/dist/assets/{Settings-KI4lKsOz.js → Settings-CGxWfI_h.js} +1 -1
- package/src/web/dist/assets/{Setup-BgMY-gpn.js → Setup-yKUdrXJQ.js} +1 -1
- package/src/web/dist/assets/{apiKeys-3Wl4kRDv.js → apiKeys-B-WRyKci.js} +1 -1
- package/src/web/dist/assets/{app-PTY3WlMQ.js → app-BnQl39hq.js} +4 -4
- package/src/web/dist/assets/{badge-DMgopDMC.js → badge-RZTsODn-.js} +1 -1
- package/src/web/dist/assets/{card-kh1_vqEo.js → card-DhuLMeO9.js} +1 -1
- package/src/web/dist/assets/{charts-core-BTTtAoo-.js → charts-core-DlIzYcw_.js} +1 -1
- package/src/web/dist/assets/{charts-engine-CFhx8nba.js → charts-engine-C14rMTiz.js} +1 -1
- package/src/web/dist/assets/{charts-react-BQP6-BFp.js → charts-react-Bz6GVFr3.js} +1 -1
- package/src/web/dist/assets/{disclosure-Dpus5Sms.js → disclosure-CJdf1-ap.js} +1 -1
- package/src/web/dist/assets/{gateway-CRzzn31H.js → gateway-DxCj_uok.js} +1 -1
- package/src/web/dist/assets/{global-D5dyWHqO.js → global-CJOj9WGx.js} +1 -1
- package/src/web/dist/assets/global-CWlBZlIY.css +1 -0
- package/src/web/dist/assets/{i18n-PeX9kBVO.js → i18n-Dp-o1LhZ.js} +1 -1
- package/src/web/dist/assets/{label-Dg8bOG83.js → label-Da-JMxO2.js} +1 -1
- package/src/web/dist/assets/{landing-DDnYbDDs.js → landing-BuuM1jg8.js} +1 -1
- package/src/web/dist/assets/{metric-card-DMOLvKiC.js → metric-card-B_6litu2.js} +1 -1
- package/src/web/dist/assets/package-CKkVmaOi.js +1 -0
- package/src/web/dist/assets/{popover-BPqySDlA.js → popover-JpUYyIhi.js} +1 -1
- package/src/web/dist/assets/{query-DZF7K6hv.js → query-DVc6ZTRQ.js} +1 -1
- package/src/web/dist/assets/{radix-Bux_1C5J.js → radix-B9EIjzyN.js} +1 -1
- package/src/web/dist/assets/{router-BoBrmro7.js → router-CUBM_FND.js} +1 -1
- package/src/web/dist/assets/{segmented-control-C1wXb26c.js → segmented-control-D80bc13p.js} +1 -1
- package/src/web/dist/assets/{select-BMTHg2Ox.js → select-BTwqvh0l.js} +1 -1
- package/src/web/dist/assets/{shared-DciW3SvI.js → shared-DHBfRHZV.js} +1 -1
- package/src/web/dist/assets/{switch-BjJJ5nhB.js → switch-CeKtgMDT.js} +1 -1
- package/src/web/dist/assets/{table-Cmf9Rq18.js → table-rPjqxS-f.js} +1 -1
- package/src/web/dist/assets/{tabs-kDNBpHZ8.js → tabs-DYNHHISl.js} +1 -1
- package/src/web/dist/assets/{useAppMutation-CSLeLocH.js → useAppMutation-Cix9n50u.js} +1 -1
- package/src/web/dist/assets/{useEventStream-BYg6oKvQ.js → useEventStream-CQTreYBE.js} +1 -1
- package/src/web/dist/assets/useProviderForm-CsPV2Cqr.js +1 -0
- package/src/web/dist/assets/{utils-C0ba36BP.js → utils-HY2ZFw0f.js} +1 -1
- package/src/web/dist/assets/{vendor-CITafuNQ.js → vendor-D2wC0h2o.js} +1 -1
- package/src/web/dist/index.html +8 -8
- package/src/web/dist/landing.html +5 -5
- package/src/web/dist/assets/ProvidersWorkbench-CSdS6Fhh.js +0 -1
- package/src/web/dist/assets/global-CjRN4Kqi.css +0 -1
- package/src/web/dist/assets/package-98UM-D4s.js +0 -1
- package/src/web/dist/assets/useProviderForm-ZwPM_4sh.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e,aZ as S,a_ as E}from"./vendor-
|
|
1
|
+
import{r as n,j as e,aZ as S,a_ as E}from"./vendor-D2wC0h2o.js";import{j as k,L as F,B as L}from"./app-BnQl39hq.js";import{C as j,a as N,b as P,d as T,e as A,f as B}from"./card-DhuLMeO9.js";import{L as b,I as y}from"./label-Da-JMxO2.js";import{u as D}from"./i18n-Dp-o1LhZ.js";import{u as G,a as I}from"./router-CUBM_FND.js";import"./global-CJOj9WGx.js";import"./query-DVc6ZTRQ.js";import"./radix-B9EIjzyN.js";function J(){const{t:s}=D(),a=G(),l=I(),{authEnabled:o,isAuthenticated:u,loading:d,login:v,error:x}=k(),[i,p]=n.useState({username:"",password:""}),[h,m]=n.useState(null),[f,g]=n.useState(!1),c=n.useMemo(()=>{var r;const t=l.state;return((r=t==null?void 0:t.from)==null?void 0:r.pathname)??"/"},[l.state]);n.useEffect(()=>{if(!o&&!d){a(c,{replace:!0});return}o&&u&&!d&&a(c,{replace:!0})},[o,c,u,d,a]);const C=async t=>{if(t.preventDefault(),m(null),!i.username.trim()||!i.password){m(s("login.validation.required"));return}g(!0);try{await v(i.username.trim(),i.password),a(c,{replace:!0})}catch(r){m(r instanceof Error?r.message:s("login.validation.failed"))}finally{g(!1)}};return d?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:e.jsx(j,{className:"w-full max-w-md",children:e.jsx(N,{className:"flex min-h-[320px] items-center justify-center",children:e.jsx(F,{})})})}):o?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4 py-10",children:e.jsxs("div",{className:"mx-auto grid w-full max-w-5xl items-center gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(400px,0.8fr)]",children:[e.jsx("div",{className:"hidden lg:block",children:e.jsxs("div",{className:"max-w-lg space-y-6",children:[e.jsx("div",{className:"inline-flex items-center gap-1.5 rounded-lg bg-primary/10 px-3 py-1 text-xs font-semibold text-primary",children:"Secure Gateway Control"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h1",{className:"text-4xl font-semibold tracking-tight text-foreground",children:s("login.title")}),e.jsx("p",{className:"max-w-md text-base leading-7 text-muted-foreground",children:s("login.description")})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(w,{icon:e.jsx(S,{className:"h-5 w-5","aria-hidden":"true"}),title:s("login.hint"),description:s("about.support.tip")}),e.jsx(w,{icon:e.jsx(E,{className:"h-5 w-5","aria-hidden":"true"}),title:"Session protected",description:s("help.note")})]})]})}),e.jsxs(j,{className:"w-full",children:[e.jsxs(P,{className:"pb-4 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-primary text-sm font-bold text-primary-foreground",children:"GW"}),e.jsx(T,{className:"text-xl",children:s("login.title")}),e.jsx(A,{children:s("login.description")})]}),e.jsx(N,{children:e.jsxs("form",{className:"space-y-4",onSubmit:C,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"username",children:s("login.fields.username")}),e.jsx(y,{id:"username",value:i.username,autoComplete:"username",autoFocus:!0,onChange:t=>p(r=>({...r,username:t.target.value})),placeholder:s("login.fields.usernamePlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"password",children:s("login.fields.password")}),e.jsx(y,{id:"password",type:"password",value:i.password,autoComplete:"current-password",onChange:t=>p(r=>({...r,password:t.target.value})),placeholder:s("login.fields.passwordPlaceholder")})]}),h||x?e.jsx("div",{className:"rounded-lg bg-destructive/10 px-4 py-3 text-sm text-destructive",children:h||x}):null,e.jsx(L,{type:"submit",className:"w-full",disabled:f,children:s(f?"common.actions.loading":"login.actions.submit")})]})}),e.jsx(B,{className:"justify-center pt-2",children:e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:s("login.hint")})})]})]})}):null}function w({description:s,icon:a,title:l}){return e.jsxs("div",{className:"rounded-lg bg-card px-4 py-4 shadow-[var(--surface-shadow)]",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a}),e.jsx("p",{className:"mt-3 text-sm font-semibold text-foreground",children:l}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s})]})}export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e,o as cs,ar as us,aj as ms,as as ps,ak as De,at as Te,aq as xs,au as gs,Z as fs,T as hs,P as ys}from"./vendor-CITafuNQ.js";import{P as bs}from"./PageToolbar-xVyzEX46.js";import{c as E}from"./global-D5dyWHqO.js";import{B as R,d as js,a as fe,c as G,q as H,s as P,t as vs,b as A}from"./app-PTY3WlMQ.js";import{B as V}from"./badge-DMgopDMC.js";import{C as Fe,a as Ke}from"./card-kh1_vqEo.js";import{L as B,I as xe}from"./label-Dg8bOG83.js";import{S as te,a as le,b as ae,c as re,d as $}from"./select-BMTHg2Ox.js";import{u as I}from"./i18n-PeX9kBVO.js";import{D as ws,A as Ns,a as ks,b as Ss,c as Cs,d as Ls}from"./DialogShell-iCyqEFRA.js";import{P as _s,a as Y}from"./PageState-BzdQq00f.js";import{T as Es,a as Rs,b as Ds,c as Ts}from"./tabs-kDNBpHZ8.js";import{c as Fs}from"./clipboard-BnAnBk_-.js";import{a as Ks,g as he,b as Me,f as O,c as ye,d as Ms,e as q,h as Pe,i as qe,j as Ps,T as qs}from"./utils-C0ba36BP.js";import{P as zs,a as As,b as Os}from"./popover-BPqySDlA.js";import{S as Is}from"./segmented-control-C1wXb26c.js";import{S as $s}from"./switch-BjJJ5nhB.js";import{L as ze}from"./router-BoBrmro7.js";import{a as Qs}from"./query-DZF7K6hv.js";import{g as _e}from"./gateway-CRzzn31H.js";import"./radix-Bux_1C5J.js";function Us({apiKeys:s,selected:l,onChange:p,disabled:a,className:o}){const{t}=I(),i=x.useId(),[b,h]=x.useState(!1),[d,v]=x.useState(null),y=x.useRef(null),w=x.useRef(null),m=x.useRef(null),N=()=>{const f=w.current;if(!f)return;const j=f.getBoundingClientRect(),S=Math.max(j.width,256),n=window.innerWidth-12;v({left:Math.min(j.left,n-S),top:j.bottom+8,width:S})};x.useEffect(()=>{if(!b)return;const f=S=>{var C,D;const n=S.target;!((C=y.current)!=null&&C.contains(n))&&!((D=m.current)!=null&&D.contains(n))&&h(!1)},j=S=>{var n;S.key==="Escape"&&(h(!1),(n=w.current)==null||n.focus())};return window.addEventListener("mousedown",f),window.addEventListener("keydown",j),()=>{window.removeEventListener("mousedown",f),window.removeEventListener("keydown",j)}},[b]),x.useEffect(()=>{if(b)return N(),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[b]);const r=x.useMemo(()=>{if(l.length===0)return[];const f=new Map;for(const j of s)f.set(j.id,j);return l.map(j=>{const S=f.get(j);return S?S.isWildcard?t("apiKeys.wildcard"):S.name:null}).filter(j=>!!j)},[s,l,t]),g=l.length===0?t("logs.filters.apiKeyAll"):t("logs.filters.apiKeySelected",{count:l.length}),L=f=>{l.includes(f)?p(l.filter(j=>j!==f)):p([...l,f])};return e.jsxs("div",{className:E("relative space-y-2",o),ref:y,children:[e.jsx(B,{htmlFor:i,children:t("logs.filters.apiKey")}),e.jsxs("button",{ref:w,id:i,type:"button",onClick:()=>{N(),h(f=>!f)},disabled:a||s.length===0,title:t("logs.filters.apiKeyHint"),className:E("flex h-10 w-full items-center justify-between rounded-lg border border-input bg-background px-3 text-sm ring-offset-background transition-all focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",l.length>0&&"border-primary",b&&"ring-2 ring-ring ring-offset-2"),children:[e.jsxs("span",{className:"truncate",children:[g,r.length>0&&e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:r.join(", ")})]}),e.jsx("svg",{className:E("h-4 w-4 opacity-50 transition-transform",b&&"rotate-180"),viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.25a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z",clipRule:"evenodd"})})]}),b&&d&&cs.createPortal(e.jsxs("div",{ref:m,className:"fixed z-50 rounded-lg border bg-popover p-2 shadow-[var(--surface-shadow-lg)]",style:d,children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-secondary px-3 py-2 text-xs",children:[e.jsx("span",{children:g}),e.jsx("button",{type:"button",onClick:()=>p([]),disabled:l.length===0,className:"text-primary hover:underline disabled:opacity-40",children:t("common.actions.reset")})]}),e.jsxs("div",{className:"max-h-56 overflow-y-auto py-2",children:[s.map(f=>{const j=f.isWildcard?t("apiKeys.wildcard"):f.name,S=l.includes(f.id);return e.jsxs("label",{className:E("flex cursor-pointer items-center gap-3 rounded-xl px-3 py-2 text-sm transition hover:bg-primary/5",S&&"bg-primary/10 text-primary"),children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-border",checked:S,onChange:()=>L(f.id)}),e.jsx("span",{className:"truncate",children:j})]},f.id)}),s.length===0&&e.jsx("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:t("logs.filters.apiKeyAll")})]})]}),document.body)]})}function Vs(s){const{t:l}=I(),{activeFilters:p,filtersExpanded:a,setFiltersExpanded:o,handleResetFilters:t,activeQuickView:i,applyQuickView:b,providerFilter:h,setProviderFilter:d,endpointFilter:v,setEndpointFilter:y,selectedApiKeys:w,setSelectedApiKeys:m,modelFilter:N,setModelFilter:r,statusFilter:g,setStatusFilter:L,fromDate:f,setFromDate:j,toDate:S,setToDate:n,providerOptions:C,apiKeys:D,apiKeysLoading:F,customEndpoints:T}=s;return e.jsx(Fe,{"data-testid":"logs-filters-card",className:"overflow-hidden",children:e.jsxs(Ke,{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:l("logs.filtersTitle")}),p.length>0&&e.jsx(V,{variant:"outline",className:"rounded-full border-transparent bg-primary/10 px-2.5 py-0.5 text-[11px] font-semibold text-primary",children:l("common.filters.activeCount",{count:p.length})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l("logs.filtersDescription")})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[p.length>0&&e.jsx(R,{variant:"ghost",size:"sm",onClick:t,className:"h-8 rounded-full px-3 text-xs",children:l("common.actions.reset")}),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>o(c=>!c),className:"h-8 rounded-full px-3 text-xs",children:a?e.jsxs(e.Fragment,{children:[l("common.filters.collapse"),e.jsx(us,{className:"ml-1 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[l("common.filters.expand"),e.jsx(ms,{className:"ml-1 h-4 w-4"})]})})]})]}),e.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsx("div",{className:"flex min-h-10 items-center rounded-lg bg-secondary px-3 py-2",children:p.length>0?e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:p.map(c=>e.jsxs(V,{variant:"outline",role:"button",tabIndex:0,className:"flex cursor-pointer items-center gap-1 rounded-full border border-border bg-card px-2.5 py-1 text-[11px] font-semibold text-foreground/90 transition hover:bg-secondary",onClick:c.onRemove,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c.onRemove())},children:[c.label,e.jsx(ps,{className:"h-3 w-3","aria-hidden":"true"})]},c.key))}):e.jsx("span",{className:"text-xs text-muted-foreground",children:l("common.filters.allRequests")})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 lg:justify-end",children:[e.jsx(ge,{label:l("logs.filters.apiKey"),value:w.length.toString()}),e.jsx(ge,{label:l("logs.filters.provider"),value:h==="all"?"0":"1"}),e.jsx(ge,{label:l("logs.filters.endpoint"),value:v==="all"?"0":"1"})]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-secondary px-2 py-1.5",children:["all","errors","today","anthropic","openai"].map(c=>e.jsx(R,{variant:"ghost",size:"sm",className:E("h-7 rounded-full px-3 text-[11px] font-semibold transition-colors",i===c?"bg-card text-foreground shadow-[var(--surface-shadow)]":"text-muted-foreground"),onClick:()=>b(c),children:l(`logs.quickViews.${c}`)},c))})]}),a&&e.jsxs("div",{className:"mt-3 grid gap-3 rounded-xl bg-secondary p-3 md:grid-cols-2 xl:grid-cols-4 animate-in fade-in slide-in-from-top-2 duration-200",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.provider")}),e.jsxs(te,{value:h,onValueChange:d,children:[e.jsx(le,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx($,{value:"all",children:l("logs.filters.providerAll")}),C.map(c=>e.jsx($,{value:c.id,children:c.label??c.id},c.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.endpoint")}),e.jsxs(te,{value:v,onValueChange:y,children:[e.jsx(le,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx($,{value:"all",children:l("logs.filters.endpointAll")}),e.jsx($,{value:"anthropic",children:l("logs.filters.endpointAnthropic")}),e.jsx($,{value:"openai",children:l("logs.filters.endpointOpenAI")}),T==null?void 0:T.map(c=>e.jsx($,{value:c.id,children:c.label||c.id},c.id))]})]})]}),e.jsx(Us,{className:"md:col-span-2",apiKeys:D,selected:w,disabled:F,onChange:m}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.modelId")}),e.jsx(xe,{value:N,onChange:c=>r(c.target.value),placeholder:l("logs.filters.modelPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.status")}),e.jsxs(te,{value:g,onValueChange:c=>L(c),children:[e.jsx(le,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx($,{value:"all",children:l("logs.filters.statusAll")}),e.jsx($,{value:"success",children:l("logs.filters.statusSuccess")}),e.jsx($,{value:"error",children:l("logs.filters.statusError")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.startDate")}),e.jsx(xe,{type:"date",value:f,onChange:c=>j(c.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.endDate")}),e.jsx(xe,{type:"date",value:S,onChange:c=>n(c.target.value)})]})]})]})})}function ge({label:s,value:l}){return e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-border/60 bg-card px-2.5 py-1 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:s}),e.jsx("span",{className:"metric-number font-semibold text-foreground",children:l})]})}const be={listRequest(s){return{url:"/api/logs",method:"GET",params:s}},detailRequest(s){return{url:s===null?"":`/api/logs/${s}`,method:"GET"}},async exportArchive(s,l){const p=await js.post("/api/logs/export",s,{responseType:"blob",timeout:l});return new Blob([p.data],{type:"application/zip"})}};function Ae({apiKeyMap:s,logId:l,open:p,providerLabelMap:a}){var N;const{t:o}=I(),{pushToast:t}=fe(),i=G(H.logs.detail(l),be.detailRequest(l),{enabled:p&&l!==null,staleTime:3e4,gcTime:15e3,placeholderData:void 0});x.useEffect(()=>{!i.isError||!i.error||t({title:o("logs.detail.loadError"),description:i.error.message,variant:"error"})},[i.error,i.isError,t,o]);const b=x.useCallback(async(r,g,L)=>{if(!g){t({title:o("logs.detail.copy.empty",{label:r}),variant:"info"});return}try{await Fs(g),t({title:o(L),variant:"success"})}catch(f){t({title:o("logs.detail.copy.failure"),description:f instanceof Error?f.message:o("logs.detail.copy.failureFallback"),variant:"error"})}},[t,o]),h=x.useCallback((r,g)=>{if(!g){t({title:o("logs.detail.copy.empty",{label:r}),variant:"info"});return}const L=new Blob([g],{type:"application/json;charset=utf-8"}),f=URL.createObjectURL(L),j=document.createElement("a"),S=new Date().toISOString().replace(/[:.]/g,"-"),n=r.trim().toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/gi,"-").replace(/^-+|-+$/g,"")||"payload";j.href=f,j.download=`cc-gw-log-${l??"payload"}-${n}-${S}.json`,document.body.appendChild(j),j.click(),document.body.removeChild(j),URL.revokeObjectURL(f)},[l,t,o]),d=i.data,v=d?a.get(d.provider)??d.provider:"",y=d&&d.api_key_id!=null?s.get(d.api_key_id):void 0,w=d?Ks(d,o):null,m=d?he(d,o):null;return{apiKeyMeta:y,errorSourceMeta:w,errorMessage:i.isError?((N=i.error)==null?void 0:N.message)??null:null,handleCopy:b,handleDownloadPayload:h,isError:i.isError,isPending:i.isPending,providerLabel:v,refetch:i.refetch,record:d,statusMeta:m}}function Hs({open:s,logId:l,onClose:p,providerLabelMap:a,apiKeyMap:o}){var f,j,S;const{t}=I(),{apiKeyMeta:i,errorSourceMeta:b,errorMessage:h,handleCopy:d,handleDownloadPayload:v,isError:y,isPending:w,providerLabel:m,refetch:N,record:r,statusMeta:g}=Ae({apiKeyMap:o,logId:l,open:s,providerLabelMap:a}),L=x.useMemo(()=>{var C,D,F,T;return r?[{key:"client-request",title:t("logs.detail.payload.clientRequest"),value:((C=r.payload)==null?void 0:C.client_request)??null,emptyLabel:t("logs.detail.payload.emptyRequest"),copyToast:"logs.detail.copy.requestSuccess"},...(D=r.payload)!=null&&D.upstream_request?[{key:"upstream-request",title:t("logs.detail.payload.upstreamRequest"),value:r.payload.upstream_request,emptyLabel:t("logs.detail.payload.emptyRequest"),copyToast:"logs.detail.copy.requestSuccess"}]:[],...(F=r.payload)!=null&&F.upstream_response?[{key:"upstream-response",title:t("logs.detail.payload.upstreamResponse"),value:r.payload.upstream_response,emptyLabel:t("logs.detail.payload.emptyResponse"),copyToast:"logs.detail.copy.responseSuccess"}]:[],{key:"client-response",title:t("logs.detail.payload.clientResponse"),value:((T=r.payload)==null?void 0:T.client_response)??null,emptyLabel:t("logs.detail.payload.emptyResponse"),copyToast:"logs.detail.copy.responseSuccess"}].map(c=>({...c,display:Me(c.value,c.emptyLabel)})):[]},[r,t]);return e.jsx(ws,{open:s,onOpenChange:n=>{n||p()},children:e.jsxs(Ns,{className:"w-[min(96vw,1200px)] max-w-[1200px]",children:[e.jsxs(ks,{className:"pr-14",children:[e.jsx(Ss,{children:t("logs.detail.title")}),e.jsx(Cs,{children:r?t("logs.detail.id",{id:r.id}):t("logs.detail.loadError")})]}),e.jsx(Ls,{className:"max-h-[78vh]",children:w?e.jsx(_s,{compact:!0,className:"min-h-[240px]",label:t("common.loading")}):y?e.jsx(Y,{compact:!0,className:"min-h-[240px]",tone:"danger",title:t("logs.detail.loadError"),description:h??t("common.unknownError"),action:e.jsx(R,{variant:"outline",onClick:()=>void N(),children:t("common.actions.refresh")})}):r?e.jsxs("div",{className:"space-y-6 text-sm",children:[e.jsxs("section",{className:"space-y-4 rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t("logs.detail.infoSection")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border bg-secondary p-3 text-xs",children:[e.jsx("span",{className:"font-medium",children:t("logs.detail.summary.route",{from:r.client_model??t("logs.detail.info.noRequestedModel"),to:r.model})}),e.jsx("span",{className:"text-muted-foreground",children:t("logs.detail.summary.latency",{value:O(r.latency_ms,t("common.units.ms"))})}),r.ttft_ms!==null?e.jsxs("span",{className:"text-muted-foreground",children:["TTFT: ",O(r.ttft_ms,t("common.units.ms"))]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(V,{variant:g==null?void 0:g.variant,children:(g==null?void 0:g.label)??"-"}),e.jsx(V,{variant:"outline",children:r.stream?t("logs.stream.streaming"):t("logs.stream.single")})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-5",children:[e.jsx(U,{label:t("logs.detail.info.latency"),value:O(r.latency_ms,t("common.units.ms"))}),e.jsx(U,{label:t("logs.detail.info.ttft"),value:O(r.ttft_ms,t("common.units.ms"))}),e.jsx(U,{label:t("logs.detail.info.tpot"),value:O(r.tpot_ms,t("common.units.msPerToken"))}),e.jsx(U,{label:t("logs.detail.info.status"),value:(g==null?void 0:g.label)??"-"}),e.jsx(U,{label:t("logs.detail.info.errorSource"),value:(b==null?void 0:b.label)??"-"})]}),e.jsxs("dl",{className:"grid gap-x-4 gap-y-3 md:grid-cols-2 xl:grid-cols-4",children:[e.jsx(M,{label:t("logs.detail.info.time"),value:ye(r.timestamp)}),e.jsx(M,{label:t("logs.detail.info.sessionId"),value:r.session_id??"-"}),e.jsx(M,{label:t("logs.detail.info.endpoint"),value:r.endpoint||"-"}),e.jsx(M,{label:t("logs.detail.info.provider"),value:m}),e.jsx(M,{label:t("logs.detail.info.requestedModel"),value:r.client_model??t("logs.detail.info.noRequestedModel")}),e.jsx(M,{label:t("logs.detail.info.model"),value:r.model}),e.jsx(M,{label:t("logs.detail.info.stream"),value:Ms(r.stream)}),e.jsx(M,{label:t("logs.detail.info.status"),value:(g==null?void 0:g.label)??"-"}),e.jsx(M,{label:t("logs.detail.info.errorSource"),value:(b==null?void 0:b.label)??"-"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(U,{label:t("logs.detail.info.inputTokens"),value:q(r.input_tokens)}),e.jsx(U,{label:t("logs.detail.info.cacheReadTokens"),value:q(r.cache_read_tokens)}),e.jsx(U,{label:t("logs.detail.info.cacheCreationTokens"),value:q(r.cache_creation_tokens)}),e.jsx(U,{label:t("logs.detail.info.outputTokens"),value:q(r.output_tokens)})]}),r.error?e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t("logs.detail.info.error")}),e.jsx("p",{className:"rounded-xl border border-destructive/50 bg-destructive/10 p-3 text-xs text-destructive",children:r.error})]}):null]}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[e.jsxs("section",{className:"space-y-3 rounded-lg border bg-card p-4",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t("logs.detail.apiKey.title")}),e.jsxs("dl",{className:"grid gap-x-4 gap-y-3 sm:grid-cols-2",children:[e.jsx(M,{label:t("logs.detail.apiKey.name"),value:r.api_key_id==null&&!r.api_key_name?t("logs.detail.apiKey.missing"):i!=null&&i.isWildcard?t("apiKeys.wildcard"):(i==null?void 0:i.name)??r.api_key_name??t("logs.detail.apiKey.missing")}),e.jsx(M,{label:t("logs.detail.apiKey.identifier"),value:r.api_key_id??t("common.noData")}),e.jsx(M,{label:t("logs.detail.apiKey.masked"),value:i!=null&&i.isWildcard?t("apiKeys.wildcard"):(i==null?void 0:i.maskedKey)??r.api_key_name??t("logs.detail.apiKey.maskedUnavailable")}),e.jsx(M,{label:t("logs.detail.apiKey.lastUsed"),value:i!=null&&i.lastUsedAt?new Date(i.lastUsedAt).toLocaleString():t("common.noData")})]}),e.jsxs("div",{className:"rounded-lg border bg-secondary p-3 text-xs",children:[e.jsx("p",{className:"font-medium",children:t("logs.detail.apiKey.rawMasked")}),e.jsx("p",{className:"mt-1 break-all font-mono",children:r.api_key_value_available?r.api_key_value_masked??t("logs.detail.apiKey.rawUnavailable"):t("logs.detail.apiKey.rawUnavailable")}),e.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:t("logs.detail.apiKey.rawMaskedHint")})]})]}),e.jsxs("section",{className:"space-y-4 rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t("logs.detail.payload.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(f=r.payload)!=null&&f.upstream_request||(j=r.payload)!=null&&j.upstream_response?t("logs.detail.payload.helperWithUpstream"):t("logs.detail.payload.helperClientOnly")})]}),e.jsxs(Es,{defaultValue:(S=L[0])==null?void 0:S.key,children:[e.jsx(Rs,{className:"w-full justify-start overflow-x-auto",children:L.map(n=>e.jsx(Ds,{value:n.key,children:n.title},n.key))}),L.map(n=>e.jsx(Ts,{value:n.key,children:e.jsx(Bs,{title:n.title,display:n.display,onCopy:()=>d(n.title,n.value,n.copyToast),onDownload:()=>v(n.title,n.value),panelKey:n.key,t})},n.key))]})]})]})]}):e.jsx(Y,{compact:!0,className:"min-h-[240px]",title:t("logs.detail.loadError"),description:t("common.noData")})})]})})}function U({label:s,value:l}){return e.jsxs("div",{className:"min-w-0 rounded-lg border bg-secondary px-3 py-3",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:s}),e.jsx("p",{className:"mt-2 break-all text-sm font-semibold leading-6",children:l})]})}function M({label:s,value:l}){return e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:s}),e.jsx("dd",{className:"min-w-0 break-all whitespace-pre-wrap text-sm font-medium leading-6 text-foreground",children:l??"-"})]})}function Bs({display:s,onCopy:l,onDownload:p,panelKey:a,title:o,t}){return e.jsxs("div",{className:"space-y-3 rounded-lg border bg-secondary/40 p-4","data-testid":`log-payload-${a}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:o}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(R,{variant:"outline",size:"sm",onClick:l,children:[e.jsx(De,{className:"mr-2 h-3.5 w-3.5"}),t("common.actions.copy")]}),e.jsxs(R,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(Te,{className:"mr-2 h-3.5 w-3.5"}),t("common.actions.download")]})]})]}),s.isTruncated?e.jsx("p",{className:"rounded-lg border border-warning/30 bg-warning-bg px-3 py-2 text-xs text-warning",children:t("logs.detail.payload.truncated",{shown:s.displayedLength.toLocaleString(),total:s.originalLength.toLocaleString()})}):null,e.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre rounded-lg border bg-secondary p-3 text-xs",children:s.text})]})}const X=[20,50,100],J=["endpoint","provider","requestedModel","routedModel","apiKey","tokens","duration","status","error"],oe=["endpoint","provider","requestedModel","routedModel","apiKey","tokens","duration","status","error"];function Ws(){return typeof window>"u"?"comfortable":window.localStorage.getItem(P.logs.density)==="compact"?"compact":"comfortable"}function Gs(){if(typeof window>"u")return X[0];const s=window.localStorage.getItem(P.logs.pageSize),l=Number(s);return X.includes(l)?l:X[0]}function Ee(s,l=!1){if(!s)return;const p=l?`${s}T23:59:59.999`:`${s}T00:00:00.000`,a=Date.parse(p);return Number.isFinite(a)?a:void 0}function Js(s,l,p){return s===p&&l===p}function Xs({autoRefresh:s,columnOptions:l,exporting:p,onExport:a,onRefresh:o,onResetColumns:t,onSetDensity:i,onToggleAutoRefresh:b,onToggleColumn:h,refreshing:d,rowDensity:v,visibleColumns:y,visibleColumnSet:w}){const{t:m}=I(),N=JSON.stringify(y)===JSON.stringify(J);return e.jsxs("div",{className:"flex w-full flex-col gap-3 xl:w-auto xl:flex-row xl:items-center",children:[e.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center xl:w-auto xl:flex-nowrap",children:[e.jsx(Is,{block:!0,className:"w-full overflow-x-auto sm:w-auto",value:v,onChange:i,options:[{value:"comfortable",label:m("logs.table.density.comfortable")},{value:"compact",label:m("logs.table.density.compact")}]}),e.jsxs(zs,{children:[e.jsx(As,{asChild:!0,children:e.jsx(R,{variant:"outline",size:"sm",className:"w-full sm:w-auto",children:m("logs.actions.columns")})}),e.jsxs(Os,{align:"end",className:"w-64 p-3",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold",children:m("logs.actions.columns")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m("logs.actions.visibleCount",{count:y.length})})]}),e.jsx(R,{variant:"ghost",size:"sm",onClick:t,disabled:N,children:m("common.actions.reset")})]}),e.jsx("div",{className:"grid gap-1.5",children:l.map(r=>{const g=w.has(r.id);return e.jsxs("label",{className:E("flex cursor-pointer items-center gap-3 rounded-xl px-3 py-2 text-sm transition hover:bg-accent",g&&"bg-primary/10 text-primary"),children:[e.jsx("input",{type:"checkbox",checked:g,onChange:()=>h(r.id),className:"h-4 w-4 rounded border-border"}),e.jsx("span",{children:r.label})]},r.id)})})]})]}),e.jsxs(R,{onClick:a,disabled:p,className:"w-full sm:w-auto",children:[e.jsx(Te,{className:"mr-2 h-4 w-4"}),m(p?"logs.actions.exporting":"logs.actions.export")]})]}),e.jsxs("div",{className:"flex w-full items-center gap-3 xl:w-auto",children:[e.jsxs("label",{className:"flex shrink-0 cursor-pointer items-center gap-2 text-sm text-muted-foreground",children:[e.jsx($s,{checked:s,onCheckedChange:b,"aria-label":m("logs.actions.autoRefresh")}),m("logs.actions.autoRefresh")]}),e.jsxs(R,{variant:"outline",size:"sm",onClick:o,disabled:d,className:"shrink-0",children:[e.jsx(xs,{className:E("mr-2 h-4 w-4",d&&"animate-spin")}),m(d?"common.actions.refreshing":"logs.actions.manualRefresh")]})]})]})}function Ys({record:s,providerLabelMap:l,onSelect:p}){const{t:a}=I(),o=he(s,a),t=l.get(s.provider)??s.provider,i=Pe(s.session_id),b=i==null?void 0:i.accentStyle;return e.jsxs("button",{type:"button","data-session-id":i==null?void 0:i.sessionId,"data-session-color":i==null?void 0:i.colorKey,style:b,onClick:()=>p(s.id),className:"w-full space-y-2 border-b border-border/50 px-4 py-3 text-left transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:ye(s.timestamp)}),e.jsx(V,{variant:o.variant,className:"text-xs",children:o.label})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsx("span",{className:"min-w-0 truncate font-medium",title:t,children:t}),e.jsx("span",{className:"min-w-0 truncate text-muted-foreground",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs tabular-nums text-muted-foreground",children:[e.jsx("span",{children:O(s.latency_ms,a("common.units.ms"))}),s.ttft_ms!=null?e.jsxs("span",{children:[a("logs.table.columns.latencyTtft")," ",q(s.ttft_ms)]}):null]})]})}const Re={accent:"bg-primary",ok:"bg-success",warn:"bg-warning",error:"bg-destructive"};function Zs({logId:s,providerLabelMap:l,apiKeyMap:p}){const{t:a}=I(),{record:o,isPending:t,isError:i,errorMessage:b,statusMeta:h,providerLabel:d,handleCopy:v,refetch:y}=Ae({apiKeyMap:p,logId:s,open:!0,providerLabelMap:l}),w=x.useMemo(()=>{var C,D,F,T;if(!o)return[];const n=[{key:"client-request",title:a("logs.detail.payload.clientRequest"),value:((C=o.payload)==null?void 0:C.client_request)??null,emptyLabel:a("logs.detail.payload.emptyRequest"),copyToast:"logs.detail.copy.requestSuccess"}];return(D=o.payload)!=null&&D.upstream_request&&n.push({key:"upstream-request",title:a("logs.detail.payload.upstreamRequest"),value:o.payload.upstream_request,emptyLabel:a("logs.detail.payload.emptyRequest"),copyToast:"logs.detail.copy.requestSuccess"}),(F=o.payload)!=null&&F.upstream_response&&n.push({key:"upstream-response",title:a("logs.detail.payload.upstreamResponse"),value:o.payload.upstream_response,emptyLabel:a("logs.detail.payload.emptyResponse"),copyToast:"logs.detail.copy.responseSuccess"}),n.push({key:"client-response",title:a("logs.detail.payload.clientResponse"),value:((T=o.payload)==null?void 0:T.client_response)??null,emptyLabel:a("logs.detail.payload.emptyResponse"),copyToast:"logs.detail.copy.responseSuccess"}),n.map(c=>({...c,display:Me(c.value,c.emptyLabel)}))},[o,a]),[m,N]=x.useState("client-request"),r=w.find(n=>n.key===m)??w[0];if(t)return e.jsx("div",{className:"py-3",children:e.jsx(qe,{className:"h-28 w-full"})});if(i)return e.jsx(Y,{compact:!0,tone:"danger",title:a("logs.detail.loadError"),description:b??a("common.unknownError"),action:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>void y(),children:a("common.actions.refresh")})});if(!o)return e.jsx(Y,{compact:!0,title:a("logs.detail.loadError"),description:a("common.noData")});const g=Ps(o,d,a),L=a("common.units.ms"),f=[{label:a("logs.detail.info.status"),value:(h==null?void 0:h.label)??"-"},{label:a("logs.detail.info.latency"),value:O(o.latency_ms,L)},{label:a("logs.detail.info.ttft"),value:O(o.ttft_ms,L)},{label:a("logs.detail.info.inputTokens"),value:q(o.input_tokens)},{label:a("logs.detail.info.outputTokens"),value:q(o.output_tokens)},{label:a("logs.detail.info.cacheReadTokens"),value:q(o.cache_read_tokens)}],j=o.ttft_ms!=null,S=o.session_id;return e.jsxs("div",{"data-testid":"log-row-expanded",className:"grid gap-5 py-1 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"mb-3 text-[10.5px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:a("logs.detail.trace.title")}),e.jsx("ol",{"data-testid":"log-trace-timeline",className:"flex flex-col",children:g.map((n,C)=>e.jsxs("li",{className:"grid grid-cols-[14px_1fr] gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center","aria-hidden":"true",children:[e.jsx("span",{className:E("mt-1 h-[9px] w-[9px] rounded-full",Re[n.tone])}),C<g.length-1?e.jsx("span",{className:"mt-[3px] w-px flex-1 bg-border"}):null]}),e.jsxs("div",{className:"pb-3.5",children:[e.jsxs("div",{className:"flex items-baseline gap-2.5",children:[e.jsx("span",{className:"text-xs font-semibold",children:n.title}),n.atLabel?e.jsx("span",{className:"text-[10.5px] tabular-nums text-muted-foreground",children:n.atLabel}):null,n.durLabel?e.jsx("span",{className:"ml-auto text-[10.5px] tabular-nums text-muted-foreground",children:n.durLabel}):null]}),n.detail?e.jsx("div",{className:"mt-1 text-[11px] leading-[1.55] text-muted-foreground",children:n.detail}):null,e.jsx("div",{className:"mt-1.5 h-1 w-full max-w-[220px] bg-secondary",children:e.jsx("div",{className:E("h-full",Re[n.tone]),style:{width:`${n.barPct}%`}})})]})]},n.id))}),j?null:e.jsx("p",{className:"mt-1 text-[10.5px] text-muted-foreground/70",children:a("logs.detail.trace.degraded")})]}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-3 gap-2",children:f.map(n=>e.jsxs("div",{className:"border border-border bg-card px-2.5 py-2",children:[e.jsx("div",{className:"text-[10.5px] text-muted-foreground",children:n.label}),e.jsx("div",{className:"mt-0.5 text-[13px] font-semibold tabular-nums",children:n.value})]},n.label))}),e.jsxs("div",{className:"border border-border bg-card",children:[e.jsx("div",{className:"flex gap-0.5 border-b border-border bg-secondary/50 p-1.5",role:"tablist",children:w.map(n=>{const C=n.key===(r==null?void 0:r.key);return e.jsx("button",{type:"button",role:"tab","aria-selected":C,onClick:()=>N(n.key),className:E("px-2.5 py-1 text-[10.5px] font-medium transition-colors",C?"bg-card text-foreground":"text-muted-foreground hover:text-foreground"),children:n.title},n.key)})}),e.jsx("pre",{"data-testid":`log-payload-${(r==null?void 0:r.key)??"none"}`,className:"m-0 max-h-[172px] overflow-auto whitespace-pre-wrap p-3 font-mono text-[10.5px] leading-[1.65] text-muted-foreground",children:(r==null?void 0:r.display.text)||a("logs.detail.payload.emptyRequest")})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(R,{variant:"outline",size:"sm",className:"h-[30px] flex-1",onClick:()=>{r&&v(r.title,r.value,r.copyToast)},children:[e.jsx(De,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":"true"}),a("logs.detail.inline.copyRequest")]}),S?e.jsx(R,{variant:"outline",size:"sm",className:"h-[30px] flex-1",onClick:()=>v(a("logs.detail.inline.copySession"),S,"logs.detail.inline.sessionCopied"),children:a("logs.detail.inline.copySession")}):null,e.jsx(R,{asChild:!0,variant:"outline",size:"sm",className:"h-[30px] flex-1",children:e.jsxs(ze,{to:"/providers?tab=routing",children:[a("logs.detail.inline.viewRule"),e.jsx(gs,{className:"ml-1.5 h-3.5 w-3.5","aria-hidden":"true"})]})})]})]})]})}function et({record:s,providerLabelMap:l,apiKeyMap:p,onSelect:a,isExpanded:o,onToggleExpand:t,isEven:i,density:b,visibleColumnSet:h}){const{t:d}=I(),v=l.get(s.provider)??s.provider,y=s.endpoint||"-",w=he(s,d),m=s.client_model??d("logs.table.requestedModelFallback"),N=s.api_key_id!=null?p.get(s.api_key_id):void 0,r=s.api_key_id==null?d("logs.table.apiKeyUnknown"):N!=null&&N.isWildcard?d("apiKeys.wildcard"):N!=null&&N.name?N.name:s.api_key_name?s.api_key_name:d("logs.table.apiKeyUnknown"),g=b==="compact"?"px-3 py-1.5":"px-3 py-2",L=i?"bg-muted/30":"bg-background",f=Pe(s.session_id),j=f==null?void 0:f.accentStyle,S=h.size+2,n=d(o?"logs.detail.inline.collapse":"logs.detail.inline.expand");return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{"data-log-id":s.id,"data-session-id":f==null?void 0:f.sessionId,"data-session-color":f==null?void 0:f.colorKey,className:E("transition-colors duration-160 ease-surface",i?"bg-muted/30":"",o?"bg-muted/50":"hover:bg-muted/50"),children:[e.jsx("td",{className:E("sticky left-0 z-10 text-xs",g,L),style:j,children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button","aria-expanded":o,"aria-label":n,onClick:()=>t(s.id),className:"-ml-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(fs,{className:E("h-3.5 w-3.5 transition-transform duration-160 ease-surface",o&&"rotate-90"),"aria-hidden":"true"})}),e.jsx("span",{className:"metric-number",children:ye(s.timestamp)})]})}),h.has("endpoint")&&e.jsx("td",{className:E(g,"text-xs"),children:y}),h.has("provider")&&e.jsx("td",{className:E(g,"text-xs"),children:e.jsx("div",{className:"max-w-[100px] truncate",title:v,children:v})}),h.has("requestedModel")&&e.jsx("td",{className:E(g,"text-xs text-muted-foreground"),children:e.jsx("div",{className:"max-w-[120px] truncate",title:m,children:m})}),h.has("routedModel")&&e.jsx("td",{className:E(g,"text-xs"),children:e.jsx("div",{className:"max-w-[120px] truncate",title:s.model,children:s.model})}),h.has("apiKey")&&e.jsx("td",{className:E(g,"text-xs text-muted-foreground"),children:e.jsx("div",{className:"max-w-[90px] truncate",title:r,children:r})}),h.has("tokens")&&e.jsx("td",{className:E(g,"text-right text-xs tabular-nums align-top"),children:e.jsxs("span",{className:"inline-flex flex-col items-end gap-0.5",children:[e.jsxs("span",{className:"whitespace-nowrap",children:[d("logs.table.columns.tokenIn")," ",q(s.input_tokens),e.jsx("span",{className:"mx-1 text-muted-foreground/50",children:"·"}),d("logs.table.columns.tokenOut")," ",q(s.output_tokens)]}),(()=>{const C=(s.cache_read_tokens??0)+(s.cache_creation_tokens??0);return C>0?e.jsxs("span",{className:"whitespace-nowrap text-[11px] text-muted-foreground/70",children:[d("logs.table.columns.tokenCache")," ",q(C)]}):null})()]})}),h.has("duration")&&e.jsx("td",{className:E(g,"text-right text-xs tabular-nums align-top"),children:e.jsxs("span",{className:"inline-flex flex-col items-end gap-0.5",children:[e.jsx("span",{className:"whitespace-nowrap",children:O(s.latency_ms,"ms")}),(s.ttft_ms!=null||s.tpot_ms!=null)&&e.jsxs("span",{className:"whitespace-nowrap text-[11px] text-muted-foreground/70",title:`${d("logs.table.columns.latencyTtft")} ${O(s.ttft_ms,"ms")} · ${d("logs.table.columns.latencyTpot")} ${O(s.tpot_ms,"ms/tk")}`,children:[d("logs.table.columns.latencyTtft")," ",q(s.ttft_ms),e.jsx("span",{className:"mx-1 text-muted-foreground/50",children:"·"}),d("logs.table.columns.latencyTpot")," ",q(s.tpot_ms)]})]})}),h.has("status")&&e.jsx("td",{className:E(g,"text-center"),children:e.jsx(V,{variant:w.variant,className:"text-xs",children:w.label})}),h.has("error")&&e.jsx("td",{className:E(g,"text-xs text-muted-foreground"),children:e.jsx("div",{className:"max-w-[100px] truncate",title:s.error??"",children:s.error?s.error:"-"})}),e.jsx("td",{className:E("sticky right-0 z-10 text-center",g,L),children:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>a(s.id),children:d("logs.actions.detail")})})]}),o?e.jsx("tr",{"data-testid":`log-row-expanded-wrapper-${s.id}`,children:e.jsx("td",{colSpan:S,className:"border-t border-border bg-secondary/30 p-0",children:e.jsx("div",{className:"px-5 pb-5 pt-3",children:e.jsx(Zs,{logId:s.id,providerLabelMap:l,apiKeyMap:p})})})}):null]})}function st(s){const{t:l}=I(),{tableScrollRef:p,visibleColumnSet:a,visibleColumnCount:o,logsError:t,logsPending:i,items:b,activeFiltersCount:h,total:d,handleResetFilters:v,handleRetry:y,providerLabelMap:w,apiKeyMap:m,handleOpenDetail:N,expandedLogId:r,onToggleExpand:g,rowDensity:L,showScrollHint:f,pageSize:j,setPageSize:S,page:n,totalPages:C,setPage:D}=s,F=e.jsx(Y,{compact:!0,tone:"danger",icon:e.jsx(hs,{className:"h-5 w-5","aria-hidden":"true"}),title:l("logs.toast.listError.title"),description:t,action:e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[e.jsx(R,{variant:"outline",size:"sm",onClick:y,children:l("common.actions.refresh")}),h>0?e.jsx(R,{variant:"ghost",size:"sm",onClick:v,children:l("common.actions.reset")}):null]})}),T=e.jsx(Y,{compact:!0,tone:"primary",icon:e.jsx(ys,{className:"h-5 w-5","aria-hidden":"true"}),title:h>0?l("logs.empty.filteredTitle"):l("logs.empty.title"),description:h>0?l("logs.empty.filteredSubtitle"):l("logs.empty.subtitle"),action:e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[h>0?e.jsx(R,{variant:"outline",size:"sm",onClick:v,children:l("logs.empty.actions.reset")}):null,e.jsx(R,{asChild:!0,variant:"ghost",size:"sm",children:e.jsx(ze,{to:"/api-keys",children:l("logs.empty.actions.apiKeys")})})]})});return e.jsx(Fe,{className:"overflow-hidden bg-card shadow-[var(--surface-shadow)]",children:e.jsxs(Ke,{className:"p-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 bg-secondary/50 px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold",children:l("logs.title")}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"metric-number",children:l("logs.summary.total",{value:d.toLocaleString()})}),e.jsx("span",{className:"mx-1.5 text-muted-foreground/50",children:"·"}),l("logs.actions.visibleCount",{count:o-2})]})]}),e.jsxs("div",{className:"hidden md:flex flex-wrap items-center gap-2",children:[e.jsx(V,{variant:"secondary",children:"Wide Table"}),e.jsx(V,{variant:"outline",className:"bg-background",children:l(L==="compact"?"logs.table.density.compact":"logs.table.density.comfortable")}),f?e.jsx(V,{variant:"warning",children:"Scroll for more"}):null]})]}),e.jsxs("div",{className:"relative hidden md:block",children:[e.jsx("div",{ref:p,className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[1180px] text-sm",children:[e.jsx("thead",{className:"border-b border-border/50 bg-secondary/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"sticky left-0 z-20 bg-secondary px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.time")}),a.has("endpoint")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.endpoint")}),a.has("provider")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.provider")}),a.has("requestedModel")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.requestedModel")}),a.has("routedModel")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.routedModel")}),a.has("apiKey")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.apiKey")}),a.has("tokens")&&e.jsx("th",{className:"px-3 py-2.5 text-right text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.tokens")}),a.has("duration")&&e.jsx("th",{className:"px-3 py-2.5 text-right text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.duration")}),a.has("status")&&e.jsx("th",{className:"px-3 py-2.5 text-center text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.status")}),a.has("error")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.error")}),e.jsx("th",{className:"sticky right-0 z-20 bg-secondary px-3 py-2.5 text-center text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.actions")})]})}),e.jsx("tbody",{className:"divide-y divide-border/50",children:i?Array.from({length:8}).map((c,_)=>e.jsx(qs,{columns:o},_)):t&&b.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:o,className:"px-3 py-6",children:F})}):b.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:o,className:"px-3 py-8 text-center text-sm text-muted-foreground",children:T})}):b.map((c,_)=>e.jsx(et,{record:c,providerLabelMap:w,apiKeyMap:m,onSelect:N,isExpanded:c.id===r,onToggleExpand:g,isEven:_%2===0,density:L,visibleColumnSet:a},c.id))})]})}),f&&e.jsx("div",{className:"table-scroll-hint"})]}),e.jsx("div",{className:"md:hidden",children:i?e.jsx("div",{className:"space-y-3 p-4",children:Array.from({length:5}).map((c,_)=>e.jsx(qe,{className:"h-20 w-full"},_))}):t&&b.length===0?e.jsx("div",{className:"px-3 py-6",children:F}):b.length===0?e.jsx("div",{className:"px-3 py-8",children:T}):b.map(c=>e.jsx(Ys,{record:c,providerLabelMap:w,onSelect:N},c.id))}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 bg-secondary/50 p-4 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-secondary px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:l("logs.table.pagination.perPage")}),e.jsxs(te,{value:j.toString(),onValueChange:c=>S(Number(c)),children:[e.jsx(le,{className:"h-8 w-[80px] bg-background",children:e.jsx(ae,{})}),e.jsx(re,{children:X.map(c=>e.jsx($,{value:c.toString(),children:c},c))})]})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-secondary px-2 py-2",children:[e.jsx(R,{variant:"outline",size:"sm",onClick:()=>D(c=>Math.max(c-1,1)),disabled:n<=1,children:l("logs.table.pagination.previous")}),e.jsx("span",{className:"metric-number px-1 text-sm text-muted-foreground",children:l("logs.table.pagination.pageLabel",{page:C===0?0:n,total:C})}),e.jsx(R,{variant:"outline",size:"sm",onClick:()=>D(c=>C===0?c:Math.min(c+1,C)),disabled:C===0||n>=C,children:l("logs.table.pagination.next")})]})]})]})})}function tt({exportTimeoutMs:s,queryParams:l,total:p}){const{t:a}=I(),{pushToast:o}=fe(),[t,i]=x.useState(!1),b=x.useCallback(async()=>{if(!t){i(!0);try{const h=p>0?Math.min(p,5e3):1e3,d={...l,limit:h,offset:0},v=await be.exportArchive(d,s),y=new Date().toISOString().replace(/[:.]/g,"-"),w=URL.createObjectURL(v),m=document.createElement("a");m.href=w,m.download=`cc-gw-logs-${y}.zip`,document.body.appendChild(m),m.click(),m.remove(),URL.revokeObjectURL(w),o({title:a("logs.toast.exportSuccess.title"),description:a("logs.toast.exportSuccess.desc"),variant:"success"})}catch(h){const d=vs(h);o({title:a("logs.toast.exportError.title"),description:a("logs.toast.exportError.desc",{message:d.message}),variant:"error"})}finally{i(!1)}}},[s,t,o,l,a,p]);return{exporting:t,handleExport:b}}function lt(){const s=x.useRef(null),[l,p]=x.useState(!1),a=x.useCallback(()=>{const o=s.current;if(!o)return;const t=o.scrollWidth-o.scrollLeft-o.clientWidth>1;p(t)},[]);return x.useEffect(()=>{const o=s.current;if(!o)return;a(),o.addEventListener("scroll",a,{passive:!0});const t=new ResizeObserver(a);return t.observe(o),()=>{o.removeEventListener("scroll",a),t.disconnect()}},[a]),{scrollRef:s,showScrollHint:l,updateScrollHint:a}}function at(){const[s,l]=A(P.logs.density,Ws,{serialize:v=>v,deserialize:v=>v==="compact"?"compact":"comfortable"}),[p,a]=A(P.logs.visibleColumns,J,{serialize:JSON.stringify,deserialize:v=>{try{const y=JSON.parse(v);if(!Array.isArray(y))return J;const w=y.filter(m=>oe.includes(m));return w.length>0?w:J}catch{return J}}}),{scrollRef:o,showScrollHint:t}=lt(),i=x.useMemo(()=>new Set(p),[p]),b=p.length+2,h=x.useCallback(v=>{a(y=>{if(y.includes(v))return y.length===1?y:y.filter(m=>m!==v);const w=[...y,v];return w.sort((m,N)=>oe.indexOf(m)-oe.indexOf(N)),w})},[]);return{resetVisibleColumns:x.useCallback(()=>{a(J)},[]),rowDensity:s,setRowDensity:l,showScrollHint:t,tableScrollRef:o,toggleColumn:h,visibleColumnCount:b,visibleColumns:p,visibleColumnSet:i}}const rt=3e3,ot=200;function nt(){var Ne,ke,Se,Ce,Le;const{t:s}=I(),{pushToast:l}=fe(),p=Qs(),[a,o]=A(P.logs.providerFilter,"all"),[t,i]=A(P.logs.endpointFilter,"all"),[b,h]=A(P.logs.modelFilter,""),[d,v]=A(P.logs.statusFilter,"all"),[y,w]=A(P.logs.fromDate,""),[m,N]=A(P.logs.toDate,""),[r,g]=x.useState(1),[L,f]=A(P.logs.autoRefresh,!0),[j,S]=A(P.logs.pageSize,Gs,{serialize:u=>String(u),deserialize:u=>{const k=Number(u);return X.includes(k)?k:X[0]}}),[n,C]=x.useState(null),[D,F]=x.useState(!1),[T,c]=x.useState(null),[_,ne]=A(P.logs.selectedApiKeys,[],{serialize:JSON.stringify,deserialize:u=>{try{const k=JSON.parse(u);return Array.isArray(k)?k.map(z=>Number(z)).filter(z=>Number.isInteger(z)&&z>0):[]}catch{return[]}}}),[Oe,Ie]=x.useState(!0),{resetVisibleColumns:$e,rowDensity:Qe,setRowDensity:Ue,showScrollHint:Ve,tableScrollRef:He,toggleColumn:Be,visibleColumnCount:We,visibleColumns:Ge,visibleColumnSet:Je}=at(),Xe=x.useDeferredValue(b),K=b===""?"":Xe;x.useEffect(()=>{g(1),c(null)},[a,t,K,d,y,m,j,_]);const ie=x.useMemo(()=>{const u={limit:j,offset:(r-1)*j};a!=="all"&&(u.provider=a),t!=="all"&&(u.endpoint=t),K.trim().length>0&&(u.model=K.trim()),d!=="all"&&(u.status=d);const k=Ee(y),z=Ee(m,!0);return k!==void 0&&(u.from=k),z!==void 0&&(u.to=z),_.length>0&&(u.apiKeys=_.join(",")),u},[K,t,y,r,j,a,_,d,m]),Q=G(H.logs.list(ie),be.listRequest(ie),{gcTime:6e4,refetchInterval:L&&r===1?rt:!1}),W=G(H.providers.all(),_e.providersRequest()),je=G(H.apiKeys.all(),{url:"/api/keys",method:"GET"}),de=G(H.customEndpoints.all(),{url:"/api/custom-endpoints",method:"GET"}),ve=G(H.config.exportTimeout(),_e.configRequest());x.useEffect(()=>{!Q.isError||!Q.error||l({title:s("logs.toast.listError.title"),description:s("logs.toast.listError.desc",{message:Q.error.message}),variant:"error"})},[Q.error,Q.isError,l,s]),x.useEffect(()=>{!L||r!==1||typeof window>"u"||window.scrollY>=ot||window.scrollTo({top:0,behavior:"smooth"})},[L,r,Q.dataUpdatedAt]),x.useEffect(()=>{!W.isError||!W.error||l({title:s("logs.toast.providerError.title"),description:s("logs.toast.providerError.desc",{message:W.error.message}),variant:"error"})},[W.error,W.isError,l,s]);const se=((Ne=Q.data)==null?void 0:Ne.total)??0,Z=se>0?Math.ceil(se/j):0,Ye=((ke=Q.data)==null?void 0:ke.items)??[],Ze=x.useMemo(()=>{var k;const u=(k=ve.data)==null?void 0:k.logExportTimeoutSeconds;return typeof u=="number"&&Number.isFinite(u)?Math.min(Math.max(Math.round(u),5),600)*1e3:6e4},[(Se=ve.data)==null?void 0:Se.logExportTimeoutSeconds]);x.useEffect(()=>{Z>0&&r>Z&&g(Z)},[r,Z]);const ce=W.data??[],ue=x.useMemo(()=>{const u=new Map;for(const k of ce)k.id&&u.set(k.id,k.label??k.id);return u},[ce]),we=x.useMemo(()=>{var k;const u=new Map;u.set("anthropic",s("logs.filters.endpointAnthropic")),u.set("openai",s("logs.filters.endpointOpenAI"));for(const z of((k=de.data)==null?void 0:k.endpoints)??[])u.set(z.id,z.label||z.id);return u},[(Ce=de.data)==null?void 0:Ce.endpoints,s]),es=x.useMemo(()=>{const u=[];if(a!=="all"){const k=ue.get(a)??a;u.push({key:"provider",label:`${s("logs.filters.provider")}: ${k}`,onRemove:()=>o("all")})}if(t!=="all"){const k=we.get(t)??t;u.push({key:"endpoint",label:`${s("logs.filters.endpoint")}: ${k}`,onRemove:()=>i("all")})}if(K.trim()&&u.push({key:"model",label:`${s("logs.filters.modelId")}: ${K.trim()}`,onRemove:()=>h("")}),d!=="all"){const k=s(d==="success"?"logs.filters.statusSuccess":"logs.filters.statusError");u.push({key:"status",label:`${s("logs.filters.status")}: ${k}`,onRemove:()=>v("all")})}return y&&u.push({key:"from",label:`${s("logs.filters.startDate")}: ${y}`,onRemove:()=>w("")}),m&&u.push({key:"to",label:`${s("logs.filters.endDate")}: ${m}`,onRemove:()=>N("")}),_.length>0&&u.push({key:"apiKeys",label:s("logs.filters.apiKeySelected",{count:_.length}),onRemove:()=>ne([])}),u},[K,t,we,y,a,ue,_.length,d,s,m]),me=je.data??[],ss=x.useMemo(()=>{const u=new Map;for(const k of me)u.set(k.id,k);return u},[me]),ts=x.useMemo(()=>oe.map(u=>({id:u,label:s(`logs.table.columns.${u}`)})),[s]),ee=x.useMemo(()=>{const u=new Date;return`${u.getFullYear()}-${String(u.getMonth()+1).padStart(2,"0")}-${String(u.getDate()).padStart(2,"0")}`},[]),ls=x.useMemo(()=>a==="all"&&t==="all"&&K.trim()===""&&d==="all"&&y===""&&m===""&&_.length===0?"all":d==="error"&&t==="all"&&a==="all"&&K.trim()===""&&y===""&&m===""&&_.length===0?"errors":Js(y,m,ee)&&t==="all"&&a==="all"&&K.trim()===""&&d==="all"&&_.length===0?"today":t==="anthropic"&&a==="all"&&K.trim()===""&&d==="all"&&y===""&&m===""&&_.length===0?"anthropic":t==="openai"&&a==="all"&&K.trim()===""&&d==="all"&&y===""&&m===""&&_.length===0?"openai":null,[K,t,y,a,_.length,d,m,ee]),pe=x.useCallback(()=>{o("all"),h(""),i("all"),v("all"),w(""),N(""),ne([])},[]),as=x.useCallback(u=>{if(g(1),pe(),u!=="all"){if(u==="errors"){v("error");return}if(u==="today"){w(ee),N(ee);return}if(u==="anthropic"){i("anthropic");return}u==="openai"&&i("openai")}},[pe,ee]),{exporting:rs,handleExport:os}=tt({exportTimeoutMs:Ze,queryParams:ie,total:se}),ns=x.useCallback(u=>{p.removeQueries({queryKey:["logs","detail"],type:"inactive"}),C(u),F(!0)},[p]),is=x.useCallback(()=>{F(!1)},[]),ds=x.useCallback(u=>{c(k=>k===u?null:u)},[]);return x.useEffect(()=>{D||n===null||(p.removeQueries({queryKey:H.logs.detail(n),exact:!0}),C(null))},[D,p,n]),{activeFilters:es,activeQuickView:ls,apiKeyMap:ss,apiKeys:me,apiKeysQuery:je,applyQuickView:as,autoRefresh:L,columnOptions:ts,customEndpoints:(Le=de.data)==null?void 0:Le.endpoints,endpointFilter:t,exporting:rs,expandedLogId:T,filtersExpanded:Oe,fromDate:y,handleCloseDetail:is,handleExport:os,handleOpenDetail:ns,handleResetFilters:pe,handleToggleExpand:ds,isDetailOpen:D,items:Ye,logsQuery:Q,modelFilter:b,page:r,pageSize:j,providerFilter:a,providerLabelMap:ue,providerOptions:ce,rowDensity:Qe,resetVisibleColumns:$e,selectedApiKeys:_,selectedLogId:n,setAutoRefresh:f,setEndpointFilter:i,setFiltersExpanded:Ie,setFromDate:w,setModelFilter:h,setPage:g,setPageSize:S,setProviderFilter:o,setRowDensity:Ue,setSelectedApiKeys:ne,setStatusFilter:v,setToDate:N,showScrollHint:Ve,statusFilter:d,tableScrollRef:He,toDate:m,toggleColumn:Be,total:se,totalPages:Z,visibleColumnCount:We,visibleColumns:Ge,visibleColumnSet:Je}}function Et(){var l;const s=nt();return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(bs,{actions:e.jsx(Xs,{autoRefresh:s.autoRefresh,columnOptions:s.columnOptions,exporting:s.exporting,onExport:()=>void s.handleExport(),onRefresh:()=>void s.logsQuery.refetch(),onResetColumns:s.resetVisibleColumns,onSetDensity:s.setRowDensity,onToggleAutoRefresh:s.setAutoRefresh,onToggleColumn:s.toggleColumn,refreshing:s.logsQuery.isFetching,rowDensity:s.rowDensity,visibleColumns:s.visibleColumns,visibleColumnSet:s.visibleColumnSet})}),e.jsx(Vs,{activeFilters:s.activeFilters,filtersExpanded:s.filtersExpanded,setFiltersExpanded:s.setFiltersExpanded,handleResetFilters:s.handleResetFilters,activeQuickView:s.activeQuickView,applyQuickView:s.applyQuickView,providerFilter:s.providerFilter,setProviderFilter:s.setProviderFilter,endpointFilter:s.endpointFilter,setEndpointFilter:s.setEndpointFilter,selectedApiKeys:s.selectedApiKeys,setSelectedApiKeys:s.setSelectedApiKeys,modelFilter:s.modelFilter,setModelFilter:s.setModelFilter,statusFilter:s.statusFilter,setStatusFilter:s.setStatusFilter,fromDate:s.fromDate,setFromDate:s.setFromDate,toDate:s.toDate,setToDate:s.setToDate,providerOptions:s.providerOptions,apiKeys:s.apiKeys,apiKeysLoading:s.apiKeysQuery.isLoading,customEndpoints:s.customEndpoints}),e.jsx(st,{tableScrollRef:s.tableScrollRef,visibleColumnSet:s.visibleColumnSet,visibleColumnCount:s.visibleColumnCount,logsError:s.logsQuery.isError?((l=s.logsQuery.error)==null?void 0:l.message)??null:null,logsPending:s.logsQuery.isPending,items:s.items,activeFiltersCount:s.activeFilters.length,total:s.total,handleResetFilters:s.handleResetFilters,handleRetry:()=>void s.logsQuery.refetch(),providerLabelMap:s.providerLabelMap,apiKeyMap:s.apiKeyMap,handleOpenDetail:s.handleOpenDetail,expandedLogId:s.expandedLogId,onToggleExpand:s.handleToggleExpand,rowDensity:s.rowDensity,showScrollHint:s.showScrollHint,pageSize:s.pageSize,setPageSize:s.setPageSize,page:s.page,totalPages:s.totalPages,setPage:s.setPage}),e.jsx(Hs,{open:s.isDetailOpen,logId:s.selectedLogId,onClose:s.handleCloseDetail,providerLabelMap:s.providerLabelMap,apiKeyMap:s.apiKeyMap})]})}export{Et as default};
|
|
1
|
+
import{r as x,j as e,o as cs,ar as us,aj as ms,as as ps,ak as De,at as Te,aq as xs,au as gs,Z as fs,T as hs,P as ys}from"./vendor-D2wC0h2o.js";import{P as bs}from"./PageToolbar-BnDacS2l.js";import{c as E}from"./global-CJOj9WGx.js";import{B as R,d as js,a as fe,c as G,q as H,s as P,t as vs,b as A}from"./app-BnQl39hq.js";import{B as V}from"./badge-RZTsODn-.js";import{C as Fe,a as Ke}from"./card-DhuLMeO9.js";import{L as B,I as xe}from"./label-Da-JMxO2.js";import{S as te,a as le,b as ae,c as re,d as $}from"./select-BTwqvh0l.js";import{u as I}from"./i18n-Dp-o1LhZ.js";import{D as ws,A as Ns,a as ks,b as Ss,c as Cs,d as Ls}from"./DialogShell-BbpG8sot.js";import{P as _s,a as Y}from"./PageState-U6DpaNu4.js";import{T as Es,a as Rs,b as Ds,c as Ts}from"./tabs-DYNHHISl.js";import{c as Fs}from"./clipboard-BnAnBk_-.js";import{a as Ks,g as he,b as Me,f as O,c as ye,d as Ms,e as q,h as Pe,i as qe,j as Ps,T as qs}from"./utils-HY2ZFw0f.js";import{P as zs,a as As,b as Os}from"./popover-JpUYyIhi.js";import{S as Is}from"./segmented-control-D80bc13p.js";import{S as $s}from"./switch-CeKtgMDT.js";import{L as ze}from"./router-CUBM_FND.js";import{a as Qs}from"./query-DVc6ZTRQ.js";import{g as _e}from"./gateway-DxCj_uok.js";import"./radix-B9EIjzyN.js";function Us({apiKeys:s,selected:l,onChange:p,disabled:a,className:o}){const{t}=I(),i=x.useId(),[b,h]=x.useState(!1),[d,v]=x.useState(null),y=x.useRef(null),w=x.useRef(null),m=x.useRef(null),N=()=>{const f=w.current;if(!f)return;const j=f.getBoundingClientRect(),S=Math.max(j.width,256),n=window.innerWidth-12;v({left:Math.min(j.left,n-S),top:j.bottom+8,width:S})};x.useEffect(()=>{if(!b)return;const f=S=>{var C,D;const n=S.target;!((C=y.current)!=null&&C.contains(n))&&!((D=m.current)!=null&&D.contains(n))&&h(!1)},j=S=>{var n;S.key==="Escape"&&(h(!1),(n=w.current)==null||n.focus())};return window.addEventListener("mousedown",f),window.addEventListener("keydown",j),()=>{window.removeEventListener("mousedown",f),window.removeEventListener("keydown",j)}},[b]),x.useEffect(()=>{if(b)return N(),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[b]);const r=x.useMemo(()=>{if(l.length===0)return[];const f=new Map;for(const j of s)f.set(j.id,j);return l.map(j=>{const S=f.get(j);return S?S.isWildcard?t("apiKeys.wildcard"):S.name:null}).filter(j=>!!j)},[s,l,t]),g=l.length===0?t("logs.filters.apiKeyAll"):t("logs.filters.apiKeySelected",{count:l.length}),L=f=>{l.includes(f)?p(l.filter(j=>j!==f)):p([...l,f])};return e.jsxs("div",{className:E("relative space-y-2",o),ref:y,children:[e.jsx(B,{htmlFor:i,children:t("logs.filters.apiKey")}),e.jsxs("button",{ref:w,id:i,type:"button",onClick:()=>{N(),h(f=>!f)},disabled:a||s.length===0,title:t("logs.filters.apiKeyHint"),className:E("flex h-10 w-full items-center justify-between rounded-lg border border-input bg-background px-3 text-sm ring-offset-background transition-all focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",l.length>0&&"border-primary",b&&"ring-2 ring-ring ring-offset-2"),children:[e.jsxs("span",{className:"truncate",children:[g,r.length>0&&e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:r.join(", ")})]}),e.jsx("svg",{className:E("h-4 w-4 opacity-50 transition-transform",b&&"rotate-180"),viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.25a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z",clipRule:"evenodd"})})]}),b&&d&&cs.createPortal(e.jsxs("div",{ref:m,className:"fixed z-50 rounded-lg border bg-popover p-2 shadow-[var(--surface-shadow-lg)]",style:d,children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-secondary px-3 py-2 text-xs",children:[e.jsx("span",{children:g}),e.jsx("button",{type:"button",onClick:()=>p([]),disabled:l.length===0,className:"text-primary hover:underline disabled:opacity-40",children:t("common.actions.reset")})]}),e.jsxs("div",{className:"max-h-56 overflow-y-auto py-2",children:[s.map(f=>{const j=f.isWildcard?t("apiKeys.wildcard"):f.name,S=l.includes(f.id);return e.jsxs("label",{className:E("flex cursor-pointer items-center gap-3 rounded-xl px-3 py-2 text-sm transition hover:bg-primary/5",S&&"bg-primary/10 text-primary"),children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-border",checked:S,onChange:()=>L(f.id)}),e.jsx("span",{className:"truncate",children:j})]},f.id)}),s.length===0&&e.jsx("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:t("logs.filters.apiKeyAll")})]})]}),document.body)]})}function Vs(s){const{t:l}=I(),{activeFilters:p,filtersExpanded:a,setFiltersExpanded:o,handleResetFilters:t,activeQuickView:i,applyQuickView:b,providerFilter:h,setProviderFilter:d,endpointFilter:v,setEndpointFilter:y,selectedApiKeys:w,setSelectedApiKeys:m,modelFilter:N,setModelFilter:r,statusFilter:g,setStatusFilter:L,fromDate:f,setFromDate:j,toDate:S,setToDate:n,providerOptions:C,apiKeys:D,apiKeysLoading:F,customEndpoints:T}=s;return e.jsx(Fe,{"data-testid":"logs-filters-card",className:"overflow-hidden",children:e.jsxs(Ke,{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:l("logs.filtersTitle")}),p.length>0&&e.jsx(V,{variant:"outline",className:"rounded-full border-transparent bg-primary/10 px-2.5 py-0.5 text-[11px] font-semibold text-primary",children:l("common.filters.activeCount",{count:p.length})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l("logs.filtersDescription")})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[p.length>0&&e.jsx(R,{variant:"ghost",size:"sm",onClick:t,className:"h-8 rounded-full px-3 text-xs",children:l("common.actions.reset")}),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>o(c=>!c),className:"h-8 rounded-full px-3 text-xs",children:a?e.jsxs(e.Fragment,{children:[l("common.filters.collapse"),e.jsx(us,{className:"ml-1 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[l("common.filters.expand"),e.jsx(ms,{className:"ml-1 h-4 w-4"})]})})]})]}),e.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsx("div",{className:"flex min-h-10 items-center rounded-lg bg-secondary px-3 py-2",children:p.length>0?e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:p.map(c=>e.jsxs(V,{variant:"outline",role:"button",tabIndex:0,className:"flex cursor-pointer items-center gap-1 rounded-full border border-border bg-card px-2.5 py-1 text-[11px] font-semibold text-foreground/90 transition hover:bg-secondary",onClick:c.onRemove,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c.onRemove())},children:[c.label,e.jsx(ps,{className:"h-3 w-3","aria-hidden":"true"})]},c.key))}):e.jsx("span",{className:"text-xs text-muted-foreground",children:l("common.filters.allRequests")})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 lg:justify-end",children:[e.jsx(ge,{label:l("logs.filters.apiKey"),value:w.length.toString()}),e.jsx(ge,{label:l("logs.filters.provider"),value:h==="all"?"0":"1"}),e.jsx(ge,{label:l("logs.filters.endpoint"),value:v==="all"?"0":"1"})]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-secondary px-2 py-1.5",children:["all","errors","today","anthropic","openai"].map(c=>e.jsx(R,{variant:"ghost",size:"sm",className:E("h-7 rounded-full px-3 text-[11px] font-semibold transition-colors",i===c?"bg-card text-foreground shadow-[var(--surface-shadow)]":"text-muted-foreground"),onClick:()=>b(c),children:l(`logs.quickViews.${c}`)},c))})]}),a&&e.jsxs("div",{className:"mt-3 grid gap-3 rounded-xl bg-secondary p-3 md:grid-cols-2 xl:grid-cols-4 animate-in fade-in slide-in-from-top-2 duration-200",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.provider")}),e.jsxs(te,{value:h,onValueChange:d,children:[e.jsx(le,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx($,{value:"all",children:l("logs.filters.providerAll")}),C.map(c=>e.jsx($,{value:c.id,children:c.label??c.id},c.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.endpoint")}),e.jsxs(te,{value:v,onValueChange:y,children:[e.jsx(le,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx($,{value:"all",children:l("logs.filters.endpointAll")}),e.jsx($,{value:"anthropic",children:l("logs.filters.endpointAnthropic")}),e.jsx($,{value:"openai",children:l("logs.filters.endpointOpenAI")}),T==null?void 0:T.map(c=>e.jsx($,{value:c.id,children:c.label||c.id},c.id))]})]})]}),e.jsx(Us,{className:"md:col-span-2",apiKeys:D,selected:w,disabled:F,onChange:m}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.modelId")}),e.jsx(xe,{value:N,onChange:c=>r(c.target.value),placeholder:l("logs.filters.modelPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.status")}),e.jsxs(te,{value:g,onValueChange:c=>L(c),children:[e.jsx(le,{children:e.jsx(ae,{})}),e.jsxs(re,{children:[e.jsx($,{value:"all",children:l("logs.filters.statusAll")}),e.jsx($,{value:"success",children:l("logs.filters.statusSuccess")}),e.jsx($,{value:"error",children:l("logs.filters.statusError")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.startDate")}),e.jsx(xe,{type:"date",value:f,onChange:c=>j(c.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:l("logs.filters.endDate")}),e.jsx(xe,{type:"date",value:S,onChange:c=>n(c.target.value)})]})]})]})})}function ge({label:s,value:l}){return e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-border/60 bg-card px-2.5 py-1 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:s}),e.jsx("span",{className:"metric-number font-semibold text-foreground",children:l})]})}const be={listRequest(s){return{url:"/api/logs",method:"GET",params:s}},detailRequest(s){return{url:s===null?"":`/api/logs/${s}`,method:"GET"}},async exportArchive(s,l){const p=await js.post("/api/logs/export",s,{responseType:"blob",timeout:l});return new Blob([p.data],{type:"application/zip"})}};function Ae({apiKeyMap:s,logId:l,open:p,providerLabelMap:a}){var N;const{t:o}=I(),{pushToast:t}=fe(),i=G(H.logs.detail(l),be.detailRequest(l),{enabled:p&&l!==null,staleTime:3e4,gcTime:15e3,placeholderData:void 0});x.useEffect(()=>{!i.isError||!i.error||t({title:o("logs.detail.loadError"),description:i.error.message,variant:"error"})},[i.error,i.isError,t,o]);const b=x.useCallback(async(r,g,L)=>{if(!g){t({title:o("logs.detail.copy.empty",{label:r}),variant:"info"});return}try{await Fs(g),t({title:o(L),variant:"success"})}catch(f){t({title:o("logs.detail.copy.failure"),description:f instanceof Error?f.message:o("logs.detail.copy.failureFallback"),variant:"error"})}},[t,o]),h=x.useCallback((r,g)=>{if(!g){t({title:o("logs.detail.copy.empty",{label:r}),variant:"info"});return}const L=new Blob([g],{type:"application/json;charset=utf-8"}),f=URL.createObjectURL(L),j=document.createElement("a"),S=new Date().toISOString().replace(/[:.]/g,"-"),n=r.trim().toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/gi,"-").replace(/^-+|-+$/g,"")||"payload";j.href=f,j.download=`cc-gw-log-${l??"payload"}-${n}-${S}.json`,document.body.appendChild(j),j.click(),document.body.removeChild(j),URL.revokeObjectURL(f)},[l,t,o]),d=i.data,v=d?a.get(d.provider)??d.provider:"",y=d&&d.api_key_id!=null?s.get(d.api_key_id):void 0,w=d?Ks(d,o):null,m=d?he(d,o):null;return{apiKeyMeta:y,errorSourceMeta:w,errorMessage:i.isError?((N=i.error)==null?void 0:N.message)??null:null,handleCopy:b,handleDownloadPayload:h,isError:i.isError,isPending:i.isPending,providerLabel:v,refetch:i.refetch,record:d,statusMeta:m}}function Hs({open:s,logId:l,onClose:p,providerLabelMap:a,apiKeyMap:o}){var f,j,S;const{t}=I(),{apiKeyMeta:i,errorSourceMeta:b,errorMessage:h,handleCopy:d,handleDownloadPayload:v,isError:y,isPending:w,providerLabel:m,refetch:N,record:r,statusMeta:g}=Ae({apiKeyMap:o,logId:l,open:s,providerLabelMap:a}),L=x.useMemo(()=>{var C,D,F,T;return r?[{key:"client-request",title:t("logs.detail.payload.clientRequest"),value:((C=r.payload)==null?void 0:C.client_request)??null,emptyLabel:t("logs.detail.payload.emptyRequest"),copyToast:"logs.detail.copy.requestSuccess"},...(D=r.payload)!=null&&D.upstream_request?[{key:"upstream-request",title:t("logs.detail.payload.upstreamRequest"),value:r.payload.upstream_request,emptyLabel:t("logs.detail.payload.emptyRequest"),copyToast:"logs.detail.copy.requestSuccess"}]:[],...(F=r.payload)!=null&&F.upstream_response?[{key:"upstream-response",title:t("logs.detail.payload.upstreamResponse"),value:r.payload.upstream_response,emptyLabel:t("logs.detail.payload.emptyResponse"),copyToast:"logs.detail.copy.responseSuccess"}]:[],{key:"client-response",title:t("logs.detail.payload.clientResponse"),value:((T=r.payload)==null?void 0:T.client_response)??null,emptyLabel:t("logs.detail.payload.emptyResponse"),copyToast:"logs.detail.copy.responseSuccess"}].map(c=>({...c,display:Me(c.value,c.emptyLabel)})):[]},[r,t]);return e.jsx(ws,{open:s,onOpenChange:n=>{n||p()},children:e.jsxs(Ns,{className:"w-[min(96vw,1200px)] max-w-[1200px]",children:[e.jsxs(ks,{className:"pr-14",children:[e.jsx(Ss,{children:t("logs.detail.title")}),e.jsx(Cs,{children:r?t("logs.detail.id",{id:r.id}):t("logs.detail.loadError")})]}),e.jsx(Ls,{className:"max-h-[78vh]",children:w?e.jsx(_s,{compact:!0,className:"min-h-[240px]",label:t("common.loading")}):y?e.jsx(Y,{compact:!0,className:"min-h-[240px]",tone:"danger",title:t("logs.detail.loadError"),description:h??t("common.unknownError"),action:e.jsx(R,{variant:"outline",onClick:()=>void N(),children:t("common.actions.refresh")})}):r?e.jsxs("div",{className:"space-y-6 text-sm",children:[e.jsxs("section",{className:"space-y-4 rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t("logs.detail.infoSection")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border bg-secondary p-3 text-xs",children:[e.jsx("span",{className:"font-medium",children:t("logs.detail.summary.route",{from:r.client_model??t("logs.detail.info.noRequestedModel"),to:r.model})}),e.jsx("span",{className:"text-muted-foreground",children:t("logs.detail.summary.latency",{value:O(r.latency_ms,t("common.units.ms"))})}),r.ttft_ms!==null?e.jsxs("span",{className:"text-muted-foreground",children:["TTFT: ",O(r.ttft_ms,t("common.units.ms"))]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(V,{variant:g==null?void 0:g.variant,children:(g==null?void 0:g.label)??"-"}),e.jsx(V,{variant:"outline",children:r.stream?t("logs.stream.streaming"):t("logs.stream.single")})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-5",children:[e.jsx(U,{label:t("logs.detail.info.latency"),value:O(r.latency_ms,t("common.units.ms"))}),e.jsx(U,{label:t("logs.detail.info.ttft"),value:O(r.ttft_ms,t("common.units.ms"))}),e.jsx(U,{label:t("logs.detail.info.tpot"),value:O(r.tpot_ms,t("common.units.msPerToken"))}),e.jsx(U,{label:t("logs.detail.info.status"),value:(g==null?void 0:g.label)??"-"}),e.jsx(U,{label:t("logs.detail.info.errorSource"),value:(b==null?void 0:b.label)??"-"})]}),e.jsxs("dl",{className:"grid gap-x-4 gap-y-3 md:grid-cols-2 xl:grid-cols-4",children:[e.jsx(M,{label:t("logs.detail.info.time"),value:ye(r.timestamp)}),e.jsx(M,{label:t("logs.detail.info.sessionId"),value:r.session_id??"-"}),e.jsx(M,{label:t("logs.detail.info.endpoint"),value:r.endpoint||"-"}),e.jsx(M,{label:t("logs.detail.info.provider"),value:m}),e.jsx(M,{label:t("logs.detail.info.requestedModel"),value:r.client_model??t("logs.detail.info.noRequestedModel")}),e.jsx(M,{label:t("logs.detail.info.model"),value:r.model}),e.jsx(M,{label:t("logs.detail.info.stream"),value:Ms(r.stream)}),e.jsx(M,{label:t("logs.detail.info.status"),value:(g==null?void 0:g.label)??"-"}),e.jsx(M,{label:t("logs.detail.info.errorSource"),value:(b==null?void 0:b.label)??"-"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(U,{label:t("logs.detail.info.inputTokens"),value:q(r.input_tokens)}),e.jsx(U,{label:t("logs.detail.info.cacheReadTokens"),value:q(r.cache_read_tokens)}),e.jsx(U,{label:t("logs.detail.info.cacheCreationTokens"),value:q(r.cache_creation_tokens)}),e.jsx(U,{label:t("logs.detail.info.outputTokens"),value:q(r.output_tokens)})]}),r.error?e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t("logs.detail.info.error")}),e.jsx("p",{className:"rounded-xl border border-destructive/50 bg-destructive/10 p-3 text-xs text-destructive",children:r.error})]}):null]}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[e.jsxs("section",{className:"space-y-3 rounded-lg border bg-card p-4",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t("logs.detail.apiKey.title")}),e.jsxs("dl",{className:"grid gap-x-4 gap-y-3 sm:grid-cols-2",children:[e.jsx(M,{label:t("logs.detail.apiKey.name"),value:r.api_key_id==null&&!r.api_key_name?t("logs.detail.apiKey.missing"):i!=null&&i.isWildcard?t("apiKeys.wildcard"):(i==null?void 0:i.name)??r.api_key_name??t("logs.detail.apiKey.missing")}),e.jsx(M,{label:t("logs.detail.apiKey.identifier"),value:r.api_key_id??t("common.noData")}),e.jsx(M,{label:t("logs.detail.apiKey.masked"),value:i!=null&&i.isWildcard?t("apiKeys.wildcard"):(i==null?void 0:i.maskedKey)??r.api_key_name??t("logs.detail.apiKey.maskedUnavailable")}),e.jsx(M,{label:t("logs.detail.apiKey.lastUsed"),value:i!=null&&i.lastUsedAt?new Date(i.lastUsedAt).toLocaleString():t("common.noData")})]}),e.jsxs("div",{className:"rounded-lg border bg-secondary p-3 text-xs",children:[e.jsx("p",{className:"font-medium",children:t("logs.detail.apiKey.rawMasked")}),e.jsx("p",{className:"mt-1 break-all font-mono",children:r.api_key_value_available?r.api_key_value_masked??t("logs.detail.apiKey.rawUnavailable"):t("logs.detail.apiKey.rawUnavailable")}),e.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:t("logs.detail.apiKey.rawMaskedHint")})]})]}),e.jsxs("section",{className:"space-y-4 rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t("logs.detail.payload.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(f=r.payload)!=null&&f.upstream_request||(j=r.payload)!=null&&j.upstream_response?t("logs.detail.payload.helperWithUpstream"):t("logs.detail.payload.helperClientOnly")})]}),e.jsxs(Es,{defaultValue:(S=L[0])==null?void 0:S.key,children:[e.jsx(Rs,{className:"w-full justify-start overflow-x-auto",children:L.map(n=>e.jsx(Ds,{value:n.key,children:n.title},n.key))}),L.map(n=>e.jsx(Ts,{value:n.key,children:e.jsx(Bs,{title:n.title,display:n.display,onCopy:()=>d(n.title,n.value,n.copyToast),onDownload:()=>v(n.title,n.value),panelKey:n.key,t})},n.key))]})]})]})]}):e.jsx(Y,{compact:!0,className:"min-h-[240px]",title:t("logs.detail.loadError"),description:t("common.noData")})})]})})}function U({label:s,value:l}){return e.jsxs("div",{className:"min-w-0 rounded-lg border bg-secondary px-3 py-3",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:s}),e.jsx("p",{className:"mt-2 break-all text-sm font-semibold leading-6",children:l})]})}function M({label:s,value:l}){return e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:s}),e.jsx("dd",{className:"min-w-0 break-all whitespace-pre-wrap text-sm font-medium leading-6 text-foreground",children:l??"-"})]})}function Bs({display:s,onCopy:l,onDownload:p,panelKey:a,title:o,t}){return e.jsxs("div",{className:"space-y-3 rounded-lg border bg-secondary/40 p-4","data-testid":`log-payload-${a}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:o}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(R,{variant:"outline",size:"sm",onClick:l,children:[e.jsx(De,{className:"mr-2 h-3.5 w-3.5"}),t("common.actions.copy")]}),e.jsxs(R,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(Te,{className:"mr-2 h-3.5 w-3.5"}),t("common.actions.download")]})]})]}),s.isTruncated?e.jsx("p",{className:"rounded-lg border border-warning/30 bg-warning-bg px-3 py-2 text-xs text-warning",children:t("logs.detail.payload.truncated",{shown:s.displayedLength.toLocaleString(),total:s.originalLength.toLocaleString()})}):null,e.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre rounded-lg border bg-secondary p-3 text-xs",children:s.text})]})}const X=[20,50,100],J=["endpoint","provider","requestedModel","routedModel","apiKey","tokens","duration","status","error"],oe=["endpoint","provider","requestedModel","routedModel","apiKey","tokens","duration","status","error"];function Ws(){return typeof window>"u"?"comfortable":window.localStorage.getItem(P.logs.density)==="compact"?"compact":"comfortable"}function Gs(){if(typeof window>"u")return X[0];const s=window.localStorage.getItem(P.logs.pageSize),l=Number(s);return X.includes(l)?l:X[0]}function Ee(s,l=!1){if(!s)return;const p=l?`${s}T23:59:59.999`:`${s}T00:00:00.000`,a=Date.parse(p);return Number.isFinite(a)?a:void 0}function Js(s,l,p){return s===p&&l===p}function Xs({autoRefresh:s,columnOptions:l,exporting:p,onExport:a,onRefresh:o,onResetColumns:t,onSetDensity:i,onToggleAutoRefresh:b,onToggleColumn:h,refreshing:d,rowDensity:v,visibleColumns:y,visibleColumnSet:w}){const{t:m}=I(),N=JSON.stringify(y)===JSON.stringify(J);return e.jsxs("div",{className:"flex w-full flex-col gap-3 xl:w-auto xl:flex-row xl:items-center",children:[e.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center xl:w-auto xl:flex-nowrap",children:[e.jsx(Is,{block:!0,className:"w-full overflow-x-auto sm:w-auto",value:v,onChange:i,options:[{value:"comfortable",label:m("logs.table.density.comfortable")},{value:"compact",label:m("logs.table.density.compact")}]}),e.jsxs(zs,{children:[e.jsx(As,{asChild:!0,children:e.jsx(R,{variant:"outline",size:"sm",className:"w-full sm:w-auto",children:m("logs.actions.columns")})}),e.jsxs(Os,{align:"end",className:"w-64 p-3",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold",children:m("logs.actions.columns")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m("logs.actions.visibleCount",{count:y.length})})]}),e.jsx(R,{variant:"ghost",size:"sm",onClick:t,disabled:N,children:m("common.actions.reset")})]}),e.jsx("div",{className:"grid gap-1.5",children:l.map(r=>{const g=w.has(r.id);return e.jsxs("label",{className:E("flex cursor-pointer items-center gap-3 rounded-xl px-3 py-2 text-sm transition hover:bg-accent",g&&"bg-primary/10 text-primary"),children:[e.jsx("input",{type:"checkbox",checked:g,onChange:()=>h(r.id),className:"h-4 w-4 rounded border-border"}),e.jsx("span",{children:r.label})]},r.id)})})]})]}),e.jsxs(R,{onClick:a,disabled:p,className:"w-full sm:w-auto",children:[e.jsx(Te,{className:"mr-2 h-4 w-4"}),m(p?"logs.actions.exporting":"logs.actions.export")]})]}),e.jsxs("div",{className:"flex w-full items-center gap-3 xl:w-auto",children:[e.jsxs("label",{className:"flex shrink-0 cursor-pointer items-center gap-2 text-sm text-muted-foreground",children:[e.jsx($s,{checked:s,onCheckedChange:b,"aria-label":m("logs.actions.autoRefresh")}),m("logs.actions.autoRefresh")]}),e.jsxs(R,{variant:"outline",size:"sm",onClick:o,disabled:d,className:"shrink-0",children:[e.jsx(xs,{className:E("mr-2 h-4 w-4",d&&"animate-spin")}),m(d?"common.actions.refreshing":"logs.actions.manualRefresh")]})]})]})}function Ys({record:s,providerLabelMap:l,onSelect:p}){const{t:a}=I(),o=he(s,a),t=l.get(s.provider)??s.provider,i=Pe(s.session_id),b=i==null?void 0:i.accentStyle;return e.jsxs("button",{type:"button","data-session-id":i==null?void 0:i.sessionId,"data-session-color":i==null?void 0:i.colorKey,style:b,onClick:()=>p(s.id),className:"w-full space-y-2 border-b border-border/50 px-4 py-3 text-left transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:ye(s.timestamp)}),e.jsx(V,{variant:o.variant,className:"text-xs",children:o.label})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsx("span",{className:"min-w-0 truncate font-medium",title:t,children:t}),e.jsx("span",{className:"min-w-0 truncate text-muted-foreground",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs tabular-nums text-muted-foreground",children:[e.jsx("span",{children:O(s.latency_ms,a("common.units.ms"))}),s.ttft_ms!=null?e.jsxs("span",{children:[a("logs.table.columns.latencyTtft")," ",q(s.ttft_ms)]}):null]})]})}const Re={accent:"bg-primary",ok:"bg-success",warn:"bg-warning",error:"bg-destructive"};function Zs({logId:s,providerLabelMap:l,apiKeyMap:p}){const{t:a}=I(),{record:o,isPending:t,isError:i,errorMessage:b,statusMeta:h,providerLabel:d,handleCopy:v,refetch:y}=Ae({apiKeyMap:p,logId:s,open:!0,providerLabelMap:l}),w=x.useMemo(()=>{var C,D,F,T;if(!o)return[];const n=[{key:"client-request",title:a("logs.detail.payload.clientRequest"),value:((C=o.payload)==null?void 0:C.client_request)??null,emptyLabel:a("logs.detail.payload.emptyRequest"),copyToast:"logs.detail.copy.requestSuccess"}];return(D=o.payload)!=null&&D.upstream_request&&n.push({key:"upstream-request",title:a("logs.detail.payload.upstreamRequest"),value:o.payload.upstream_request,emptyLabel:a("logs.detail.payload.emptyRequest"),copyToast:"logs.detail.copy.requestSuccess"}),(F=o.payload)!=null&&F.upstream_response&&n.push({key:"upstream-response",title:a("logs.detail.payload.upstreamResponse"),value:o.payload.upstream_response,emptyLabel:a("logs.detail.payload.emptyResponse"),copyToast:"logs.detail.copy.responseSuccess"}),n.push({key:"client-response",title:a("logs.detail.payload.clientResponse"),value:((T=o.payload)==null?void 0:T.client_response)??null,emptyLabel:a("logs.detail.payload.emptyResponse"),copyToast:"logs.detail.copy.responseSuccess"}),n.map(c=>({...c,display:Me(c.value,c.emptyLabel)}))},[o,a]),[m,N]=x.useState("client-request"),r=w.find(n=>n.key===m)??w[0];if(t)return e.jsx("div",{className:"py-3",children:e.jsx(qe,{className:"h-28 w-full"})});if(i)return e.jsx(Y,{compact:!0,tone:"danger",title:a("logs.detail.loadError"),description:b??a("common.unknownError"),action:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>void y(),children:a("common.actions.refresh")})});if(!o)return e.jsx(Y,{compact:!0,title:a("logs.detail.loadError"),description:a("common.noData")});const g=Ps(o,d,a),L=a("common.units.ms"),f=[{label:a("logs.detail.info.status"),value:(h==null?void 0:h.label)??"-"},{label:a("logs.detail.info.latency"),value:O(o.latency_ms,L)},{label:a("logs.detail.info.ttft"),value:O(o.ttft_ms,L)},{label:a("logs.detail.info.inputTokens"),value:q(o.input_tokens)},{label:a("logs.detail.info.outputTokens"),value:q(o.output_tokens)},{label:a("logs.detail.info.cacheReadTokens"),value:q(o.cache_read_tokens)}],j=o.ttft_ms!=null,S=o.session_id;return e.jsxs("div",{"data-testid":"log-row-expanded",className:"grid gap-5 py-1 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"mb-3 text-[10.5px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:a("logs.detail.trace.title")}),e.jsx("ol",{"data-testid":"log-trace-timeline",className:"flex flex-col",children:g.map((n,C)=>e.jsxs("li",{className:"grid grid-cols-[14px_1fr] gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center","aria-hidden":"true",children:[e.jsx("span",{className:E("mt-1 h-[9px] w-[9px] rounded-full",Re[n.tone])}),C<g.length-1?e.jsx("span",{className:"mt-[3px] w-px flex-1 bg-border"}):null]}),e.jsxs("div",{className:"pb-3.5",children:[e.jsxs("div",{className:"flex items-baseline gap-2.5",children:[e.jsx("span",{className:"text-xs font-semibold",children:n.title}),n.atLabel?e.jsx("span",{className:"text-[10.5px] tabular-nums text-muted-foreground",children:n.atLabel}):null,n.durLabel?e.jsx("span",{className:"ml-auto text-[10.5px] tabular-nums text-muted-foreground",children:n.durLabel}):null]}),n.detail?e.jsx("div",{className:"mt-1 text-[11px] leading-[1.55] text-muted-foreground",children:n.detail}):null,e.jsx("div",{className:"mt-1.5 h-1 w-full max-w-[220px] bg-secondary",children:e.jsx("div",{className:E("h-full",Re[n.tone]),style:{width:`${n.barPct}%`}})})]})]},n.id))}),j?null:e.jsx("p",{className:"mt-1 text-[10.5px] text-muted-foreground/70",children:a("logs.detail.trace.degraded")})]}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-3 gap-2",children:f.map(n=>e.jsxs("div",{className:"border border-border bg-card px-2.5 py-2",children:[e.jsx("div",{className:"text-[10.5px] text-muted-foreground",children:n.label}),e.jsx("div",{className:"mt-0.5 text-[13px] font-semibold tabular-nums",children:n.value})]},n.label))}),e.jsxs("div",{className:"border border-border bg-card",children:[e.jsx("div",{className:"flex gap-0.5 border-b border-border bg-secondary/50 p-1.5",role:"tablist",children:w.map(n=>{const C=n.key===(r==null?void 0:r.key);return e.jsx("button",{type:"button",role:"tab","aria-selected":C,onClick:()=>N(n.key),className:E("px-2.5 py-1 text-[10.5px] font-medium transition-colors",C?"bg-card text-foreground":"text-muted-foreground hover:text-foreground"),children:n.title},n.key)})}),e.jsx("pre",{"data-testid":`log-payload-${(r==null?void 0:r.key)??"none"}`,className:"m-0 max-h-[172px] overflow-auto whitespace-pre-wrap p-3 font-mono text-[10.5px] leading-[1.65] text-muted-foreground",children:(r==null?void 0:r.display.text)||a("logs.detail.payload.emptyRequest")})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(R,{variant:"outline",size:"sm",className:"h-[30px] flex-1",onClick:()=>{r&&v(r.title,r.value,r.copyToast)},children:[e.jsx(De,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":"true"}),a("logs.detail.inline.copyRequest")]}),S?e.jsx(R,{variant:"outline",size:"sm",className:"h-[30px] flex-1",onClick:()=>v(a("logs.detail.inline.copySession"),S,"logs.detail.inline.sessionCopied"),children:a("logs.detail.inline.copySession")}):null,e.jsx(R,{asChild:!0,variant:"outline",size:"sm",className:"h-[30px] flex-1",children:e.jsxs(ze,{to:"/providers?tab=routing",children:[a("logs.detail.inline.viewRule"),e.jsx(gs,{className:"ml-1.5 h-3.5 w-3.5","aria-hidden":"true"})]})})]})]})]})}function et({record:s,providerLabelMap:l,apiKeyMap:p,onSelect:a,isExpanded:o,onToggleExpand:t,isEven:i,density:b,visibleColumnSet:h}){const{t:d}=I(),v=l.get(s.provider)??s.provider,y=s.endpoint||"-",w=he(s,d),m=s.client_model??d("logs.table.requestedModelFallback"),N=s.api_key_id!=null?p.get(s.api_key_id):void 0,r=s.api_key_id==null?d("logs.table.apiKeyUnknown"):N!=null&&N.isWildcard?d("apiKeys.wildcard"):N!=null&&N.name?N.name:s.api_key_name?s.api_key_name:d("logs.table.apiKeyUnknown"),g=b==="compact"?"px-3 py-1.5":"px-3 py-2",L=i?"bg-muted/30":"bg-background",f=Pe(s.session_id),j=f==null?void 0:f.accentStyle,S=h.size+2,n=d(o?"logs.detail.inline.collapse":"logs.detail.inline.expand");return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{"data-log-id":s.id,"data-session-id":f==null?void 0:f.sessionId,"data-session-color":f==null?void 0:f.colorKey,className:E("transition-colors duration-160 ease-surface",i?"bg-muted/30":"",o?"bg-muted/50":"hover:bg-muted/50"),children:[e.jsx("td",{className:E("sticky left-0 z-10 text-xs",g,L),style:j,children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button","aria-expanded":o,"aria-label":n,onClick:()=>t(s.id),className:"-ml-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(fs,{className:E("h-3.5 w-3.5 transition-transform duration-160 ease-surface",o&&"rotate-90"),"aria-hidden":"true"})}),e.jsx("span",{className:"metric-number",children:ye(s.timestamp)})]})}),h.has("endpoint")&&e.jsx("td",{className:E(g,"text-xs"),children:y}),h.has("provider")&&e.jsx("td",{className:E(g,"text-xs"),children:e.jsx("div",{className:"max-w-[100px] truncate",title:v,children:v})}),h.has("requestedModel")&&e.jsx("td",{className:E(g,"text-xs text-muted-foreground"),children:e.jsx("div",{className:"max-w-[120px] truncate",title:m,children:m})}),h.has("routedModel")&&e.jsx("td",{className:E(g,"text-xs"),children:e.jsx("div",{className:"max-w-[120px] truncate",title:s.model,children:s.model})}),h.has("apiKey")&&e.jsx("td",{className:E(g,"text-xs text-muted-foreground"),children:e.jsx("div",{className:"max-w-[90px] truncate",title:r,children:r})}),h.has("tokens")&&e.jsx("td",{className:E(g,"text-right text-xs tabular-nums align-top"),children:e.jsxs("span",{className:"inline-flex flex-col items-end gap-0.5",children:[e.jsxs("span",{className:"whitespace-nowrap",children:[d("logs.table.columns.tokenIn")," ",q(s.input_tokens),e.jsx("span",{className:"mx-1 text-muted-foreground/50",children:"·"}),d("logs.table.columns.tokenOut")," ",q(s.output_tokens)]}),(()=>{const C=(s.cache_read_tokens??0)+(s.cache_creation_tokens??0);return C>0?e.jsxs("span",{className:"whitespace-nowrap text-[11px] text-muted-foreground/70",children:[d("logs.table.columns.tokenCache")," ",q(C)]}):null})()]})}),h.has("duration")&&e.jsx("td",{className:E(g,"text-right text-xs tabular-nums align-top"),children:e.jsxs("span",{className:"inline-flex flex-col items-end gap-0.5",children:[e.jsx("span",{className:"whitespace-nowrap",children:O(s.latency_ms,"ms")}),(s.ttft_ms!=null||s.tpot_ms!=null)&&e.jsxs("span",{className:"whitespace-nowrap text-[11px] text-muted-foreground/70",title:`${d("logs.table.columns.latencyTtft")} ${O(s.ttft_ms,"ms")} · ${d("logs.table.columns.latencyTpot")} ${O(s.tpot_ms,"ms/tk")}`,children:[d("logs.table.columns.latencyTtft")," ",q(s.ttft_ms),e.jsx("span",{className:"mx-1 text-muted-foreground/50",children:"·"}),d("logs.table.columns.latencyTpot")," ",q(s.tpot_ms)]})]})}),h.has("status")&&e.jsx("td",{className:E(g,"text-center"),children:e.jsx(V,{variant:w.variant,className:"text-xs",children:w.label})}),h.has("error")&&e.jsx("td",{className:E(g,"text-xs text-muted-foreground"),children:e.jsx("div",{className:"max-w-[100px] truncate",title:s.error??"",children:s.error?s.error:"-"})}),e.jsx("td",{className:E("sticky right-0 z-10 text-center",g,L),children:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>a(s.id),children:d("logs.actions.detail")})})]}),o?e.jsx("tr",{"data-testid":`log-row-expanded-wrapper-${s.id}`,children:e.jsx("td",{colSpan:S,className:"border-t border-border bg-secondary/30 p-0",children:e.jsx("div",{className:"px-5 pb-5 pt-3",children:e.jsx(Zs,{logId:s.id,providerLabelMap:l,apiKeyMap:p})})})}):null]})}function st(s){const{t:l}=I(),{tableScrollRef:p,visibleColumnSet:a,visibleColumnCount:o,logsError:t,logsPending:i,items:b,activeFiltersCount:h,total:d,handleResetFilters:v,handleRetry:y,providerLabelMap:w,apiKeyMap:m,handleOpenDetail:N,expandedLogId:r,onToggleExpand:g,rowDensity:L,showScrollHint:f,pageSize:j,setPageSize:S,page:n,totalPages:C,setPage:D}=s,F=e.jsx(Y,{compact:!0,tone:"danger",icon:e.jsx(hs,{className:"h-5 w-5","aria-hidden":"true"}),title:l("logs.toast.listError.title"),description:t,action:e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[e.jsx(R,{variant:"outline",size:"sm",onClick:y,children:l("common.actions.refresh")}),h>0?e.jsx(R,{variant:"ghost",size:"sm",onClick:v,children:l("common.actions.reset")}):null]})}),T=e.jsx(Y,{compact:!0,tone:"primary",icon:e.jsx(ys,{className:"h-5 w-5","aria-hidden":"true"}),title:h>0?l("logs.empty.filteredTitle"):l("logs.empty.title"),description:h>0?l("logs.empty.filteredSubtitle"):l("logs.empty.subtitle"),action:e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[h>0?e.jsx(R,{variant:"outline",size:"sm",onClick:v,children:l("logs.empty.actions.reset")}):null,e.jsx(R,{asChild:!0,variant:"ghost",size:"sm",children:e.jsx(ze,{to:"/api-keys",children:l("logs.empty.actions.apiKeys")})})]})});return e.jsx(Fe,{className:"overflow-hidden bg-card shadow-[var(--surface-shadow)]",children:e.jsxs(Ke,{className:"p-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 bg-secondary/50 px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold",children:l("logs.title")}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"metric-number",children:l("logs.summary.total",{value:d.toLocaleString()})}),e.jsx("span",{className:"mx-1.5 text-muted-foreground/50",children:"·"}),l("logs.actions.visibleCount",{count:o-2})]})]}),e.jsxs("div",{className:"hidden md:flex flex-wrap items-center gap-2",children:[e.jsx(V,{variant:"secondary",children:"Wide Table"}),e.jsx(V,{variant:"outline",className:"bg-background",children:l(L==="compact"?"logs.table.density.compact":"logs.table.density.comfortable")}),f?e.jsx(V,{variant:"warning",children:"Scroll for more"}):null]})]}),e.jsxs("div",{className:"relative hidden md:block",children:[e.jsx("div",{ref:p,className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[1180px] text-sm",children:[e.jsx("thead",{className:"border-b border-border/50 bg-secondary/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"sticky left-0 z-20 bg-secondary px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.time")}),a.has("endpoint")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.endpoint")}),a.has("provider")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.provider")}),a.has("requestedModel")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.requestedModel")}),a.has("routedModel")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.routedModel")}),a.has("apiKey")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.apiKey")}),a.has("tokens")&&e.jsx("th",{className:"px-3 py-2.5 text-right text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.tokens")}),a.has("duration")&&e.jsx("th",{className:"px-3 py-2.5 text-right text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.duration")}),a.has("status")&&e.jsx("th",{className:"px-3 py-2.5 text-center text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.status")}),a.has("error")&&e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.error")}),e.jsx("th",{className:"sticky right-0 z-20 bg-secondary px-3 py-2.5 text-center text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("logs.table.columns.actions")})]})}),e.jsx("tbody",{className:"divide-y divide-border/50",children:i?Array.from({length:8}).map((c,_)=>e.jsx(qs,{columns:o},_)):t&&b.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:o,className:"px-3 py-6",children:F})}):b.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:o,className:"px-3 py-8 text-center text-sm text-muted-foreground",children:T})}):b.map((c,_)=>e.jsx(et,{record:c,providerLabelMap:w,apiKeyMap:m,onSelect:N,isExpanded:c.id===r,onToggleExpand:g,isEven:_%2===0,density:L,visibleColumnSet:a},c.id))})]})}),f&&e.jsx("div",{className:"table-scroll-hint"})]}),e.jsx("div",{className:"md:hidden",children:i?e.jsx("div",{className:"space-y-3 p-4",children:Array.from({length:5}).map((c,_)=>e.jsx(qe,{className:"h-20 w-full"},_))}):t&&b.length===0?e.jsx("div",{className:"px-3 py-6",children:F}):b.length===0?e.jsx("div",{className:"px-3 py-8",children:T}):b.map(c=>e.jsx(Ys,{record:c,providerLabelMap:w,onSelect:N},c.id))}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 bg-secondary/50 p-4 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-secondary px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:l("logs.table.pagination.perPage")}),e.jsxs(te,{value:j.toString(),onValueChange:c=>S(Number(c)),children:[e.jsx(le,{className:"h-8 w-[80px] bg-background",children:e.jsx(ae,{})}),e.jsx(re,{children:X.map(c=>e.jsx($,{value:c.toString(),children:c},c))})]})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-secondary px-2 py-2",children:[e.jsx(R,{variant:"outline",size:"sm",onClick:()=>D(c=>Math.max(c-1,1)),disabled:n<=1,children:l("logs.table.pagination.previous")}),e.jsx("span",{className:"metric-number px-1 text-sm text-muted-foreground",children:l("logs.table.pagination.pageLabel",{page:C===0?0:n,total:C})}),e.jsx(R,{variant:"outline",size:"sm",onClick:()=>D(c=>C===0?c:Math.min(c+1,C)),disabled:C===0||n>=C,children:l("logs.table.pagination.next")})]})]})]})})}function tt({exportTimeoutMs:s,queryParams:l,total:p}){const{t:a}=I(),{pushToast:o}=fe(),[t,i]=x.useState(!1),b=x.useCallback(async()=>{if(!t){i(!0);try{const h=p>0?Math.min(p,5e3):1e3,d={...l,limit:h,offset:0},v=await be.exportArchive(d,s),y=new Date().toISOString().replace(/[:.]/g,"-"),w=URL.createObjectURL(v),m=document.createElement("a");m.href=w,m.download=`cc-gw-logs-${y}.zip`,document.body.appendChild(m),m.click(),m.remove(),URL.revokeObjectURL(w),o({title:a("logs.toast.exportSuccess.title"),description:a("logs.toast.exportSuccess.desc"),variant:"success"})}catch(h){const d=vs(h);o({title:a("logs.toast.exportError.title"),description:a("logs.toast.exportError.desc",{message:d.message}),variant:"error"})}finally{i(!1)}}},[s,t,o,l,a,p]);return{exporting:t,handleExport:b}}function lt(){const s=x.useRef(null),[l,p]=x.useState(!1),a=x.useCallback(()=>{const o=s.current;if(!o)return;const t=o.scrollWidth-o.scrollLeft-o.clientWidth>1;p(t)},[]);return x.useEffect(()=>{const o=s.current;if(!o)return;a(),o.addEventListener("scroll",a,{passive:!0});const t=new ResizeObserver(a);return t.observe(o),()=>{o.removeEventListener("scroll",a),t.disconnect()}},[a]),{scrollRef:s,showScrollHint:l,updateScrollHint:a}}function at(){const[s,l]=A(P.logs.density,Ws,{serialize:v=>v,deserialize:v=>v==="compact"?"compact":"comfortable"}),[p,a]=A(P.logs.visibleColumns,J,{serialize:JSON.stringify,deserialize:v=>{try{const y=JSON.parse(v);if(!Array.isArray(y))return J;const w=y.filter(m=>oe.includes(m));return w.length>0?w:J}catch{return J}}}),{scrollRef:o,showScrollHint:t}=lt(),i=x.useMemo(()=>new Set(p),[p]),b=p.length+2,h=x.useCallback(v=>{a(y=>{if(y.includes(v))return y.length===1?y:y.filter(m=>m!==v);const w=[...y,v];return w.sort((m,N)=>oe.indexOf(m)-oe.indexOf(N)),w})},[]);return{resetVisibleColumns:x.useCallback(()=>{a(J)},[]),rowDensity:s,setRowDensity:l,showScrollHint:t,tableScrollRef:o,toggleColumn:h,visibleColumnCount:b,visibleColumns:p,visibleColumnSet:i}}const rt=3e3,ot=200;function nt(){var Ne,ke,Se,Ce,Le;const{t:s}=I(),{pushToast:l}=fe(),p=Qs(),[a,o]=A(P.logs.providerFilter,"all"),[t,i]=A(P.logs.endpointFilter,"all"),[b,h]=A(P.logs.modelFilter,""),[d,v]=A(P.logs.statusFilter,"all"),[y,w]=A(P.logs.fromDate,""),[m,N]=A(P.logs.toDate,""),[r,g]=x.useState(1),[L,f]=A(P.logs.autoRefresh,!0),[j,S]=A(P.logs.pageSize,Gs,{serialize:u=>String(u),deserialize:u=>{const k=Number(u);return X.includes(k)?k:X[0]}}),[n,C]=x.useState(null),[D,F]=x.useState(!1),[T,c]=x.useState(null),[_,ne]=A(P.logs.selectedApiKeys,[],{serialize:JSON.stringify,deserialize:u=>{try{const k=JSON.parse(u);return Array.isArray(k)?k.map(z=>Number(z)).filter(z=>Number.isInteger(z)&&z>0):[]}catch{return[]}}}),[Oe,Ie]=x.useState(!0),{resetVisibleColumns:$e,rowDensity:Qe,setRowDensity:Ue,showScrollHint:Ve,tableScrollRef:He,toggleColumn:Be,visibleColumnCount:We,visibleColumns:Ge,visibleColumnSet:Je}=at(),Xe=x.useDeferredValue(b),K=b===""?"":Xe;x.useEffect(()=>{g(1),c(null)},[a,t,K,d,y,m,j,_]);const ie=x.useMemo(()=>{const u={limit:j,offset:(r-1)*j};a!=="all"&&(u.provider=a),t!=="all"&&(u.endpoint=t),K.trim().length>0&&(u.model=K.trim()),d!=="all"&&(u.status=d);const k=Ee(y),z=Ee(m,!0);return k!==void 0&&(u.from=k),z!==void 0&&(u.to=z),_.length>0&&(u.apiKeys=_.join(",")),u},[K,t,y,r,j,a,_,d,m]),Q=G(H.logs.list(ie),be.listRequest(ie),{gcTime:6e4,refetchInterval:L&&r===1?rt:!1}),W=G(H.providers.all(),_e.providersRequest()),je=G(H.apiKeys.all(),{url:"/api/keys",method:"GET"}),de=G(H.customEndpoints.all(),{url:"/api/custom-endpoints",method:"GET"}),ve=G(H.config.exportTimeout(),_e.configRequest());x.useEffect(()=>{!Q.isError||!Q.error||l({title:s("logs.toast.listError.title"),description:s("logs.toast.listError.desc",{message:Q.error.message}),variant:"error"})},[Q.error,Q.isError,l,s]),x.useEffect(()=>{!L||r!==1||typeof window>"u"||window.scrollY>=ot||window.scrollTo({top:0,behavior:"smooth"})},[L,r,Q.dataUpdatedAt]),x.useEffect(()=>{!W.isError||!W.error||l({title:s("logs.toast.providerError.title"),description:s("logs.toast.providerError.desc",{message:W.error.message}),variant:"error"})},[W.error,W.isError,l,s]);const se=((Ne=Q.data)==null?void 0:Ne.total)??0,Z=se>0?Math.ceil(se/j):0,Ye=((ke=Q.data)==null?void 0:ke.items)??[],Ze=x.useMemo(()=>{var k;const u=(k=ve.data)==null?void 0:k.logExportTimeoutSeconds;return typeof u=="number"&&Number.isFinite(u)?Math.min(Math.max(Math.round(u),5),600)*1e3:6e4},[(Se=ve.data)==null?void 0:Se.logExportTimeoutSeconds]);x.useEffect(()=>{Z>0&&r>Z&&g(Z)},[r,Z]);const ce=W.data??[],ue=x.useMemo(()=>{const u=new Map;for(const k of ce)k.id&&u.set(k.id,k.label??k.id);return u},[ce]),we=x.useMemo(()=>{var k;const u=new Map;u.set("anthropic",s("logs.filters.endpointAnthropic")),u.set("openai",s("logs.filters.endpointOpenAI"));for(const z of((k=de.data)==null?void 0:k.endpoints)??[])u.set(z.id,z.label||z.id);return u},[(Ce=de.data)==null?void 0:Ce.endpoints,s]),es=x.useMemo(()=>{const u=[];if(a!=="all"){const k=ue.get(a)??a;u.push({key:"provider",label:`${s("logs.filters.provider")}: ${k}`,onRemove:()=>o("all")})}if(t!=="all"){const k=we.get(t)??t;u.push({key:"endpoint",label:`${s("logs.filters.endpoint")}: ${k}`,onRemove:()=>i("all")})}if(K.trim()&&u.push({key:"model",label:`${s("logs.filters.modelId")}: ${K.trim()}`,onRemove:()=>h("")}),d!=="all"){const k=s(d==="success"?"logs.filters.statusSuccess":"logs.filters.statusError");u.push({key:"status",label:`${s("logs.filters.status")}: ${k}`,onRemove:()=>v("all")})}return y&&u.push({key:"from",label:`${s("logs.filters.startDate")}: ${y}`,onRemove:()=>w("")}),m&&u.push({key:"to",label:`${s("logs.filters.endDate")}: ${m}`,onRemove:()=>N("")}),_.length>0&&u.push({key:"apiKeys",label:s("logs.filters.apiKeySelected",{count:_.length}),onRemove:()=>ne([])}),u},[K,t,we,y,a,ue,_.length,d,s,m]),me=je.data??[],ss=x.useMemo(()=>{const u=new Map;for(const k of me)u.set(k.id,k);return u},[me]),ts=x.useMemo(()=>oe.map(u=>({id:u,label:s(`logs.table.columns.${u}`)})),[s]),ee=x.useMemo(()=>{const u=new Date;return`${u.getFullYear()}-${String(u.getMonth()+1).padStart(2,"0")}-${String(u.getDate()).padStart(2,"0")}`},[]),ls=x.useMemo(()=>a==="all"&&t==="all"&&K.trim()===""&&d==="all"&&y===""&&m===""&&_.length===0?"all":d==="error"&&t==="all"&&a==="all"&&K.trim()===""&&y===""&&m===""&&_.length===0?"errors":Js(y,m,ee)&&t==="all"&&a==="all"&&K.trim()===""&&d==="all"&&_.length===0?"today":t==="anthropic"&&a==="all"&&K.trim()===""&&d==="all"&&y===""&&m===""&&_.length===0?"anthropic":t==="openai"&&a==="all"&&K.trim()===""&&d==="all"&&y===""&&m===""&&_.length===0?"openai":null,[K,t,y,a,_.length,d,m,ee]),pe=x.useCallback(()=>{o("all"),h(""),i("all"),v("all"),w(""),N(""),ne([])},[]),as=x.useCallback(u=>{if(g(1),pe(),u!=="all"){if(u==="errors"){v("error");return}if(u==="today"){w(ee),N(ee);return}if(u==="anthropic"){i("anthropic");return}u==="openai"&&i("openai")}},[pe,ee]),{exporting:rs,handleExport:os}=tt({exportTimeoutMs:Ze,queryParams:ie,total:se}),ns=x.useCallback(u=>{p.removeQueries({queryKey:["logs","detail"],type:"inactive"}),C(u),F(!0)},[p]),is=x.useCallback(()=>{F(!1)},[]),ds=x.useCallback(u=>{c(k=>k===u?null:u)},[]);return x.useEffect(()=>{D||n===null||(p.removeQueries({queryKey:H.logs.detail(n),exact:!0}),C(null))},[D,p,n]),{activeFilters:es,activeQuickView:ls,apiKeyMap:ss,apiKeys:me,apiKeysQuery:je,applyQuickView:as,autoRefresh:L,columnOptions:ts,customEndpoints:(Le=de.data)==null?void 0:Le.endpoints,endpointFilter:t,exporting:rs,expandedLogId:T,filtersExpanded:Oe,fromDate:y,handleCloseDetail:is,handleExport:os,handleOpenDetail:ns,handleResetFilters:pe,handleToggleExpand:ds,isDetailOpen:D,items:Ye,logsQuery:Q,modelFilter:b,page:r,pageSize:j,providerFilter:a,providerLabelMap:ue,providerOptions:ce,rowDensity:Qe,resetVisibleColumns:$e,selectedApiKeys:_,selectedLogId:n,setAutoRefresh:f,setEndpointFilter:i,setFiltersExpanded:Ie,setFromDate:w,setModelFilter:h,setPage:g,setPageSize:S,setProviderFilter:o,setRowDensity:Ue,setSelectedApiKeys:ne,setStatusFilter:v,setToDate:N,showScrollHint:Ve,statusFilter:d,tableScrollRef:He,toDate:m,toggleColumn:Be,total:se,totalPages:Z,visibleColumnCount:We,visibleColumns:Ge,visibleColumnSet:Je}}function Et(){var l;const s=nt();return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(bs,{actions:e.jsx(Xs,{autoRefresh:s.autoRefresh,columnOptions:s.columnOptions,exporting:s.exporting,onExport:()=>void s.handleExport(),onRefresh:()=>void s.logsQuery.refetch(),onResetColumns:s.resetVisibleColumns,onSetDensity:s.setRowDensity,onToggleAutoRefresh:s.setAutoRefresh,onToggleColumn:s.toggleColumn,refreshing:s.logsQuery.isFetching,rowDensity:s.rowDensity,visibleColumns:s.visibleColumns,visibleColumnSet:s.visibleColumnSet})}),e.jsx(Vs,{activeFilters:s.activeFilters,filtersExpanded:s.filtersExpanded,setFiltersExpanded:s.setFiltersExpanded,handleResetFilters:s.handleResetFilters,activeQuickView:s.activeQuickView,applyQuickView:s.applyQuickView,providerFilter:s.providerFilter,setProviderFilter:s.setProviderFilter,endpointFilter:s.endpointFilter,setEndpointFilter:s.setEndpointFilter,selectedApiKeys:s.selectedApiKeys,setSelectedApiKeys:s.setSelectedApiKeys,modelFilter:s.modelFilter,setModelFilter:s.setModelFilter,statusFilter:s.statusFilter,setStatusFilter:s.setStatusFilter,fromDate:s.fromDate,setFromDate:s.setFromDate,toDate:s.toDate,setToDate:s.setToDate,providerOptions:s.providerOptions,apiKeys:s.apiKeys,apiKeysLoading:s.apiKeysQuery.isLoading,customEndpoints:s.customEndpoints}),e.jsx(st,{tableScrollRef:s.tableScrollRef,visibleColumnSet:s.visibleColumnSet,visibleColumnCount:s.visibleColumnCount,logsError:s.logsQuery.isError?((l=s.logsQuery.error)==null?void 0:l.message)??null:null,logsPending:s.logsQuery.isPending,items:s.items,activeFiltersCount:s.activeFilters.length,total:s.total,handleResetFilters:s.handleResetFilters,handleRetry:()=>void s.logsQuery.refetch(),providerLabelMap:s.providerLabelMap,apiKeyMap:s.apiKeyMap,handleOpenDetail:s.handleOpenDetail,expandedLogId:s.expandedLogId,onToggleExpand:s.handleToggleExpand,rowDensity:s.rowDensity,showScrollHint:s.showScrollHint,pageSize:s.pageSize,setPageSize:s.setPageSize,page:s.page,totalPages:s.totalPages,setPage:s.setPage}),e.jsx(Hs,{open:s.isDetailOpen,logId:s.selectedLogId,onClose:s.handleCloseDetail,providerLabelMap:s.providerLabelMap,apiKeyMap:s.apiKeyMap})]})}export{Et as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./vendor-
|
|
1
|
+
import{j as s}from"./vendor-D2wC0h2o.js";import{c as d}from"./card-DhuLMeO9.js";import{c as l}from"./global-CJOj9WGx.js";function p({title:a,description:e,eyebrow:t,actions:r,className:x,contentClassName:n,children:c}){const m=a||e||t||r;return s.jsxs("div",{className:l(d({variant:"default"}),x),children:[m&&s.jsxs("div",{className:"flex flex-col gap-4 p-6 pb-0 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[t?s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-primary/80",children:t}):null,typeof a=="string"?s.jsx("h2",{className:"text-base font-semibold text-foreground",children:a}):a,e&&(typeof e=="string"?s.jsx("p",{className:"text-sm text-muted-foreground/70",children:e}):s.jsx("div",{className:"text-sm text-muted-foreground/70",children:e}))]}),r&&s.jsx("div",{className:"w-full shrink-0 sm:w-auto",children:r})]}),s.jsx("div",{className:l("p-6",!m&&"pt-6",n),children:c})]})}export{p as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,N as c}from"./vendor-
|
|
1
|
+
import{j as e,N as c}from"./vendor-D2wC0h2o.js";import{c as i}from"./global-CJOj9WGx.js";const m={default:"border-border/30 bg-card",primary:"border-primary/10 bg-card",danger:"border-destructive/15 bg-card"},x={default:"bg-secondary text-primary",primary:"bg-primary/10 text-primary",danger:"bg-destructive/10 text-destructive"};function o({icon:r,title:a,description:t,action:s,className:n,compact:l=!1,tone:d="default"}){return e.jsxs("div",{className:i("flex flex-col items-center justify-center rounded-xl border-2 border-dashed px-6 text-center",l?"min-h-[180px] py-8":"min-h-[260px] py-12",m[d],n),children:[r?e.jsx("div",{className:i("mb-4 flex h-12 w-12 items-center justify-center rounded-2xl",x[d]),children:r}):null,e.jsxs("div",{className:"max-w-xl space-y-1.5",children:[e.jsx("div",{className:"text-base font-semibold tracking-[-0.01em]",children:a}),t?e.jsx("div",{className:"text-sm text-muted-foreground",children:t}):null]}),s?e.jsx("div",{className:"mt-5 flex flex-wrap items-center justify-center gap-2",children:s}):null]})}function p({label:r,className:a,compact:t=!1}){return e.jsx(o,{className:a,compact:t,tone:"primary",icon:e.jsx(c,{className:"h-5 w-5 animate-spin","aria-hidden":"true"}),title:r})}export{p as P,o as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./vendor-
|
|
1
|
+
import{j as r}from"./vendor-D2wC0h2o.js";import{c as m}from"./global-CJOj9WGx.js";function a({info:s,status:l,actions:e,className:t}){return!s&&!l&&!e?null:r.jsxs("div",{className:m("flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",t),children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[l,s]}),e?r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e}):null]})}export{a as P};
|