llmtap 0.1.8 → 0.1.9
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/dist/dashboard/assets/{CommandBar-CBRbPbgc.js → CommandBar-CTVjcTSb.js} +1 -1
- package/dist/dashboard/assets/{Costs-B-TMvDlI.js → Costs-CIcHpRev.js} +1 -1
- package/dist/dashboard/assets/{Dashboard-CFNAMjdc.js → Dashboard-Bxw4TSkN.js} +1 -1
- package/dist/dashboard/assets/{DataTable-p1PD-dJj.js → DataTable-NGj_eAG3.js} +1 -1
- package/dist/dashboard/assets/{EmptyState-xDl-M9Rz.js → EmptyState-B8rSQL1S.js} +1 -1
- package/dist/dashboard/assets/{Models-BpMhGVp5.js → Models-BJBIK0Bi.js} +1 -1
- package/dist/dashboard/assets/{ProviderBadge-Cs31007s.js → ProviderBadge-Qtp_Hf66.js} +1 -1
- package/dist/dashboard/assets/{Sessions-CiKyTRlP.js → Sessions-BqAJxlud.js} +1 -1
- package/dist/dashboard/assets/{Settings-7wRfCPnB.js → Settings-R7gn546k.js} +1 -1
- package/dist/dashboard/assets/{TraceDetail-CKDDbbEV.js → TraceDetail-BNzpHmos.js} +1 -1
- package/dist/dashboard/assets/{Traces-BYWwPP14.js → Traces-Bcs-oGQr.js} +1 -1
- package/dist/dashboard/assets/{accordion-CC_sxDZ8.js → accordion-BbWMmUmi.js} +1 -1
- package/dist/dashboard/assets/{content-DZmxO8bn.js → content-BV3DhCiY.js} +1 -1
- package/dist/dashboard/assets/{format-zoXqpaOb.js → format-BdzpxHjW.js} +1 -1
- package/dist/dashboard/assets/index-BCjwgtkq.js +791 -0
- package/dist/dashboard/assets/index-DBxoe0Ri.css +1 -0
- package/dist/dashboard/assets/{number-ticker-CjofSQ3s.js → number-ticker-4lK1KASk.js} +1 -1
- package/dist/dashboard/assets/{select-BJEJvQo4.js → select-Dsu3r0h-.js} +1 -1
- package/dist/dashboard/assets/{statistics-with-status-grid-tcb9SpIY.js → statistics-with-status-grid-QCEOlWCN.js} +1 -1
- package/dist/dashboard/index.html +2 -2
- package/package.json +1 -1
- package/dist/dashboard/assets/index-CtlcBMi-.css +0 -1
- package/dist/dashboard/assets/index-DG2eF3M2.js +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u,d as me,j as e}from"./query-DVWnIZNd.js";import{l as ue,L as he,D as ve,m as ge,n as be,o as je,p as fe,b as ye,t as I,r as Ne,k as ke}from"./index-DG2eF3M2.js";import{P as we,a as w,b as g}from"./format-zoXqpaOb.js";import{E as Se}from"./EmptyState-xDl-M9Rz.js";import{g as S,S as Ce}from"./content-DZmxO8bn.js";import{P as Q}from"./ProviderBadge-Cs31007s.js";import{m as Te,z as E,B as $e,F as Ie,E as Me,H as Y,y as Z,Z as Re,I as V,x as D,O as ee,J as _e,q as te,N as Oe,Q as Pe,U as Ee,W as De,w as W,Y as Le,_ as re,$ as Ae,t as He}from"./icons-BOLUIAKd.js";import{c as ae,b as qe}from"./motion-CSeNjKbZ.js";import"./ui-BFiKdTjl.js";function Be(t){const s=new Map,o=[];for(const l of t)s.set(l.spanId,{span:l,children:[]});for(const l of t){const n=s.get(l.spanId);n&&(l.parentSpanId&&s.has(l.parentSpanId)?s.get(l.parentSpanId)?.children.push(n):o.push(n))}const c=l=>{l.sort((n,r)=>n.span.startTime-r.span.startTime);for(const n of l)c(n.children)};return c(o),o}function L(t){return t.children.reduce((s,o)=>s+1+L(o),0)}function Fe(){const[t,s]=u.useState(null);function o(c,l){navigator.clipboard.writeText(c),s(l),I.success("Copied to clipboard",{description:`${l} copied successfully.`}),setTimeout(()=>s(null),2e3)}return{copied:t,copy:o}}function k({text:t,label:s,copied:o,onCopy:c}){return e.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),c(t,s)},className:"rounded-lg border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.035)] p-1.5 text-[var(--color-text-tertiary)] transition-colors hover:border-[var(--border-default)] hover:text-[var(--color-text-primary)]",title:"Copy to clipboard",children:o===s?e.jsx(E,{className:"h-3 w-3 text-[var(--color-accent)]"}):e.jsx(Ee,{className:"h-3 w-3"})})}function b({icon:t,label:s,value:o}){return e.jsxs("div",{className:"deck-card h-full rounded-[calc(var(--radius-panel)+4px)] p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:[e.jsx(t,{className:"h-3 w-3"}),s]}),e.jsx("div",{className:"text-[var(--color-text-primary)]",style:{fontFamily:"var(--font-operator)",fontSize:"28px",fontWeight:700,lineHeight:"0.92",letterSpacing:"-0.04em"},children:o})]})}function v({label:t,value:s,tone:o="default"}){const c=o==="success"?"border-[var(--color-accent)]/16 bg-[var(--color-accent)]/8 text-[var(--color-text-primary)]":o==="danger"?"border-[var(--color-text-primary)]/16 bg-[var(--color-text-primary)]/8 text-[var(--color-text-primary)]":"border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.035)] text-[var(--color-text-primary)]";return e.jsxs("div",{className:`rounded-2xl border px-3 py-2 ${c}`,children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:t}),e.jsx("div",{className:"mt-1 font-mono text-xs font-semibold",children:s})]})}function P({icon:t,title:s,count:o,collapsed:c,onToggle:l}){const n=e.jsxs(e.Fragment,{children:[l?e.jsx(He,{className:`h-3.5 w-3.5 transition-transform ${c?"-rotate-90":""}`}):null,e.jsx(t,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:s}),typeof o=="number"?e.jsx("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2 py-0.5 font-mono text-[10px] text-[var(--color-text-secondary)]",children:o}):null]});return l?e.jsx("button",{type:"button",onClick:l,className:"mb-3 flex w-full items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)] transition-colors hover:text-[var(--color-text-secondary)]",children:n}):e.jsx("div",{className:"mb-3 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:n})}function Ke({role:t,type:s}){const o={system:"bg-[var(--color-panel)]/90 text-[var(--color-text-primary)] border-[var(--color-accent-2)]/16",user:"bg-[var(--color-accent)]/10 text-[var(--color-text-primary)] border-[var(--color-accent)]/16",assistant:"bg-[var(--color-accent-2)]/10 text-[var(--color-accent)] border-[var(--color-accent-2)]/16",tool:"bg-[var(--color-text-primary)]/10 text-[var(--color-text-primary)] border-[var(--color-text-primary)]/16",function:"bg-[var(--color-text-primary)]/10 text-[var(--color-text-primary)] border-[var(--color-text-primary)]/16"},c=s==="input"?"bg-[var(--color-accent)]/10 text-[var(--color-text-primary)] border-[var(--color-accent)]/16":"bg-[var(--color-accent-2)]/10 text-[var(--color-accent)] border-[var(--color-accent-2)]/16";return e.jsx("span",{className:`rounded-full border px-2.5 py-1 text-[10px] font-bold capitalize tracking-[0.16em] ${o[t]??c}`,children:t})}function X(t){return!t||typeof t=="string"?!1:t.some(s=>s.type==="image_url"||s.type==="image")}function A(t){return t.map(s=>s.type==="image_url"&&s.image_url?.url?s.image_url.url:s.type==="image"&&s.source?.data?`data:${s.source.media_type||"image/png"};base64,${s.source.data}`:null).filter(s=>{if(!s)return!1;if(s.startsWith("data:image/"))return!0;try{const o=new URL(s);return o.protocol==="http:"||o.protocol==="https:"}catch{return!1}})}function Je(t){const s=S(t);let o=s?Math.ceil(s.length/4):0;if(t&&typeof t!="string"){const c=t.filter(l=>l.type==="image_url"||l.type==="image").length;o+=c*85}return o}function G({message:t,type:s,copied:o,onCopy:c}){const l=t.content,n=S(l),r=l&&typeof l!="string"?A(l):[],d=s==="input"?"border-[var(--border-dim)]":"border-[var(--color-accent)]/12",i=`msg-${s}-${t.role}-${n.slice(0,20)}`;return e.jsxs("div",{className:`rounded-2xl border ${d} bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.68),rgba(var(--ch-bg-base),0.9))] p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ke,{role:t.role,type:s}),t.name&&e.jsx("span",{className:"font-mono text-[10px] text-[var(--color-text-tertiary)]",children:t.name}),r.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-accent-2)]/16 bg-[var(--color-panel)]/90 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--color-text-primary)]",children:[e.jsx(Ae,{className:"h-2.5 w-2.5"}),r.length," image",r.length>1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-[10px] text-[var(--color-text-disabled)]",children:["~",Je(l)," tok"]}),n&&e.jsx(k,{text:n,label:i,copied:o,onCopy:c})]})]}),n&&e.jsx("pre",{className:"mt-2.5 whitespace-pre-wrap font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:We(n)}),r.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-2",children:r.map((x,j)=>e.jsxs("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"group relative overflow-hidden rounded-lg border border-[var(--border-dim)] bg-[rgba(var(--ch-bg-base),0.72)] transition-colors hover:border-[var(--border-default)]",children:[e.jsx("img",{src:x,alt:`Image ${j+1}`,className:"max-h-48 max-w-64 object-contain",loading:"lazy"}),e.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100",children:e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-[var(--color-text-primary)]",children:"Open"})})]},j))})]})}function Ue({span:t,copied:s,onCopy:o}){const c=t.inputMessages?.length??0,l=t.outputMessages?.length??0,[n,r]=u.useState(c>3),[d,i]=u.useState(l>3);return e.jsx(ae.div,{initial:{opacity:0,gridTemplateRows:"0fr"},animate:{opacity:1,gridTemplateRows:"1fr"},exit:{opacity:0,gridTemplateRows:"0fr"},transition:{duration:.2},style:{display:"grid"},children:e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"mx-4 mb-4 rounded-[24px] border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.92),rgba(var(--ch-bg-deep),0.97),rgba(var(--ch-bg-base),0.99))] p-5 text-sm shadow-[inset_0_1px_0_rgba(var(--ch-text-primary),0.04),0_26px_60px_rgba(0,0,0,0.22)]",children:e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid flex-1 grid-cols-2 gap-3 md:grid-cols-4",children:[e.jsx(b,{icon:De,label:"Model",value:t.responseModel??t.requestModel??"-"}),e.jsx(b,{icon:Z,label:"Tokens",value:`${t.inputTokens} in / ${t.outputTokens} out`}),e.jsx(b,{icon:V,label:"Cost",value:w(t.totalCost)}),e.jsx(b,{icon:D,label:"Duration",value:t.duration?g(t.duration):"-"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(v,{label:"Input msgs",value:String(c)}),e.jsx(v,{label:"Output msgs",value:String(l)}),e.jsx(v,{label:"Tool calls",value:String(t.toolCalls?.length??0)}),e.jsx(v,{label:"Status",value:t.status==="error"?"Error":"OK",tone:t.status==="error"?"danger":"success"})]}),t.status==="error"&&e.jsxs("div",{className:"rounded-2xl border border-[var(--color-text-primary)]/18 bg-[var(--color-text-primary)]/6 p-4",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold uppercase tracking-[0.16em] text-[var(--color-text-primary)]",children:[e.jsx(te,{className:"h-4 w-4"}),t.errorType??"error"]}),t.errorMessage&&e.jsx(k,{text:t.errorMessage,label:"error",copied:s,onCopy:o})]}),e.jsx("div",{className:"font-mono text-xs leading-relaxed text-[var(--color-text-primary)]/70",children:t.errorMessage})]}),t.inputMessages&&t.inputMessages.length>0&&e.jsxs("div",{children:[e.jsx(P,{icon:W,title:"Input messages",count:t.inputMessages.length,collapsed:n,onToggle:()=>r(x=>!x)}),!n&&e.jsx("div",{className:"space-y-2",children:t.inputMessages.map((x,j)=>e.jsx(G,{message:x,type:"input",copied:s,onCopy:o},`in-${x.role}-${j}`))})]}),t.outputMessages&&t.outputMessages.length>0&&e.jsxs("div",{children:[e.jsx(P,{icon:W,title:"Output messages",count:t.outputMessages.length,collapsed:d,onToggle:()=>i(x=>!x)}),!d&&e.jsx("div",{className:"space-y-2",children:t.outputMessages.map((x,j)=>e.jsx(G,{message:x,type:"output",copied:s,onCopy:o},`out-${x.role}-${j}`))})]}),t.toolCalls&&t.toolCalls.length>0&&e.jsxs("div",{children:[e.jsx(P,{icon:Le,title:"Tool calls",count:t.toolCalls.length}),e.jsx("div",{className:"space-y-2",children:t.toolCalls.map(x=>e.jsxs("div",{className:"rounded-2xl border border-[var(--color-accent-2)]/10 bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.7),rgba(var(--ch-bg-base),0.86))] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"rounded-full border border-[var(--color-accent-2)]/16 bg-[var(--color-accent-2)]/10 px-2.5 py-1 text-[10px] font-bold tracking-[0.16em] text-[var(--color-accent)]",children:x.name}),e.jsx(k,{text:x.arguments,label:`tool-${x.id}`,copied:s,onCopy:o})]}),e.jsx("pre",{className:"mt-2.5 overflow-x-auto font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:se(x.arguments)}),x.result&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-2 border-t border-[var(--border-dim)]"}),e.jsx("div",{className:"mb-1 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Result"}),e.jsx("pre",{className:"overflow-x-auto font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:x.result})]})]},x.id))})]})]}),e.jsxs("div",{className:"space-y-4 xl:sticky xl:top-6 xl:self-start",children:[e.jsxs("div",{className:"rounded-2xl border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.74),rgba(var(--ch-bg-base),0.9))] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),"Span identity"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Span ID"}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-[var(--color-text-secondary)]",children:t.spanId}),e.jsx(k,{text:t.spanId,label:"spanId",copied:s,onCopy:o})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Operation"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:t.operationName})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Provider"}),e.jsx("div",{className:"mt-1",children:e.jsx(Q,{provider:t.providerName})})]}),t.parentSpanId&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Parent span"}),e.jsx("div",{className:"mt-1 font-mono text-xs text-[var(--color-text-secondary)]",children:t.parentSpanId})]}),t.sessionId&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Session"}),e.jsx("div",{className:"mt-1 font-mono text-xs text-[var(--color-text-secondary)]",children:t.sessionId})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.74),rgba(var(--ch-bg-base),0.9))] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),"Request config"]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsx(v,{label:"Request model",value:t.requestModel}),e.jsx(v,{label:"Response model",value:t.responseModel??t.requestModel??"-"}),e.jsx(v,{label:"Temperature",value:t.temperature!==void 0?String(t.temperature):"-"}),e.jsx(v,{label:"Top P",value:t.topP!==void 0?String(t.topP):"-"}),e.jsx(v,{label:"Max tokens",value:t.maxTokens!==void 0?String(t.maxTokens):"-"}),e.jsx(v,{label:"Started",value:new Date(t.startTime).toLocaleTimeString()})]})]})]})]})})})})}function se(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function ze(t){const s=t.providerName?.toLowerCase()??"",o=t.requestModel??t.responseModel??"unknown",c=(t.inputMessages??[]).map(r=>({role:r.role,content:typeof r.content=="string"?r.content:r.content??""})),n=JSON.stringify({model:o,messages:c}).replace(/'/g,"'\\''");return s==="openai"?`curl https://api.openai.com/v1/chat/completions \\
|
|
1
|
+
import{r as u,d as me,j as e}from"./query-DVWnIZNd.js";import{l as ue,L as he,D as ve,m as ge,n as be,o as je,p as fe,b as ye,t as I,r as Ne,k as ke}from"./index-BCjwgtkq.js";import{P as we,a as w,b as g}from"./format-BdzpxHjW.js";import{E as Se}from"./EmptyState-B8rSQL1S.js";import{g as S,S as Ce}from"./content-BV3DhCiY.js";import{P as Q}from"./ProviderBadge-Qtp_Hf66.js";import{m as Te,z as E,B as $e,F as Ie,E as Me,H as Y,y as Z,Z as Re,I as V,x as D,O as ee,J as _e,q as te,N as Oe,Q as Pe,U as Ee,W as De,w as W,Y as Le,_ as re,$ as Ae,t as He}from"./icons-BOLUIAKd.js";import{c as ae,b as qe}from"./motion-CSeNjKbZ.js";import"./ui-BFiKdTjl.js";function Be(t){const s=new Map,o=[];for(const l of t)s.set(l.spanId,{span:l,children:[]});for(const l of t){const n=s.get(l.spanId);n&&(l.parentSpanId&&s.has(l.parentSpanId)?s.get(l.parentSpanId)?.children.push(n):o.push(n))}const c=l=>{l.sort((n,r)=>n.span.startTime-r.span.startTime);for(const n of l)c(n.children)};return c(o),o}function L(t){return t.children.reduce((s,o)=>s+1+L(o),0)}function Fe(){const[t,s]=u.useState(null);function o(c,l){navigator.clipboard.writeText(c),s(l),I.success("Copied to clipboard",{description:`${l} copied successfully.`}),setTimeout(()=>s(null),2e3)}return{copied:t,copy:o}}function k({text:t,label:s,copied:o,onCopy:c}){return e.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),c(t,s)},className:"rounded-lg border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.035)] p-1.5 text-[var(--color-text-tertiary)] transition-colors hover:border-[var(--border-default)] hover:text-[var(--color-text-primary)]",title:"Copy to clipboard",children:o===s?e.jsx(E,{className:"h-3 w-3 text-[var(--color-accent)]"}):e.jsx(Ee,{className:"h-3 w-3"})})}function b({icon:t,label:s,value:o}){return e.jsxs("div",{className:"deck-card h-full rounded-[calc(var(--radius-panel)+4px)] p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:[e.jsx(t,{className:"h-3 w-3"}),s]}),e.jsx("div",{className:"text-[var(--color-text-primary)]",style:{fontFamily:"var(--font-operator)",fontSize:"28px",fontWeight:700,lineHeight:"0.92",letterSpacing:"-0.04em"},children:o})]})}function v({label:t,value:s,tone:o="default"}){const c=o==="success"?"border-[var(--color-accent)]/16 bg-[var(--color-accent)]/8 text-[var(--color-text-primary)]":o==="danger"?"border-[var(--color-text-primary)]/16 bg-[var(--color-text-primary)]/8 text-[var(--color-text-primary)]":"border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.035)] text-[var(--color-text-primary)]";return e.jsxs("div",{className:`rounded-2xl border px-3 py-2 ${c}`,children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:t}),e.jsx("div",{className:"mt-1 font-mono text-xs font-semibold",children:s})]})}function P({icon:t,title:s,count:o,collapsed:c,onToggle:l}){const n=e.jsxs(e.Fragment,{children:[l?e.jsx(He,{className:`h-3.5 w-3.5 transition-transform ${c?"-rotate-90":""}`}):null,e.jsx(t,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:s}),typeof o=="number"?e.jsx("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2 py-0.5 font-mono text-[10px] text-[var(--color-text-secondary)]",children:o}):null]});return l?e.jsx("button",{type:"button",onClick:l,className:"mb-3 flex w-full items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)] transition-colors hover:text-[var(--color-text-secondary)]",children:n}):e.jsx("div",{className:"mb-3 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:n})}function Ke({role:t,type:s}){const o={system:"bg-[var(--color-panel)]/90 text-[var(--color-text-primary)] border-[var(--color-accent-2)]/16",user:"bg-[var(--color-accent)]/10 text-[var(--color-text-primary)] border-[var(--color-accent)]/16",assistant:"bg-[var(--color-accent-2)]/10 text-[var(--color-accent)] border-[var(--color-accent-2)]/16",tool:"bg-[var(--color-text-primary)]/10 text-[var(--color-text-primary)] border-[var(--color-text-primary)]/16",function:"bg-[var(--color-text-primary)]/10 text-[var(--color-text-primary)] border-[var(--color-text-primary)]/16"},c=s==="input"?"bg-[var(--color-accent)]/10 text-[var(--color-text-primary)] border-[var(--color-accent)]/16":"bg-[var(--color-accent-2)]/10 text-[var(--color-accent)] border-[var(--color-accent-2)]/16";return e.jsx("span",{className:`rounded-full border px-2.5 py-1 text-[10px] font-bold capitalize tracking-[0.16em] ${o[t]??c}`,children:t})}function X(t){return!t||typeof t=="string"?!1:t.some(s=>s.type==="image_url"||s.type==="image")}function A(t){return t.map(s=>s.type==="image_url"&&s.image_url?.url?s.image_url.url:s.type==="image"&&s.source?.data?`data:${s.source.media_type||"image/png"};base64,${s.source.data}`:null).filter(s=>{if(!s)return!1;if(s.startsWith("data:image/"))return!0;try{const o=new URL(s);return o.protocol==="http:"||o.protocol==="https:"}catch{return!1}})}function Je(t){const s=S(t);let o=s?Math.ceil(s.length/4):0;if(t&&typeof t!="string"){const c=t.filter(l=>l.type==="image_url"||l.type==="image").length;o+=c*85}return o}function G({message:t,type:s,copied:o,onCopy:c}){const l=t.content,n=S(l),r=l&&typeof l!="string"?A(l):[],d=s==="input"?"border-[var(--border-dim)]":"border-[var(--color-accent)]/12",i=`msg-${s}-${t.role}-${n.slice(0,20)}`;return e.jsxs("div",{className:`rounded-2xl border ${d} bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.68),rgba(var(--ch-bg-base),0.9))] p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ke,{role:t.role,type:s}),t.name&&e.jsx("span",{className:"font-mono text-[10px] text-[var(--color-text-tertiary)]",children:t.name}),r.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-accent-2)]/16 bg-[var(--color-panel)]/90 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--color-text-primary)]",children:[e.jsx(Ae,{className:"h-2.5 w-2.5"}),r.length," image",r.length>1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-[10px] text-[var(--color-text-disabled)]",children:["~",Je(l)," tok"]}),n&&e.jsx(k,{text:n,label:i,copied:o,onCopy:c})]})]}),n&&e.jsx("pre",{className:"mt-2.5 whitespace-pre-wrap font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:We(n)}),r.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-2",children:r.map((x,j)=>e.jsxs("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"group relative overflow-hidden rounded-lg border border-[var(--border-dim)] bg-[rgba(var(--ch-bg-base),0.72)] transition-colors hover:border-[var(--border-default)]",children:[e.jsx("img",{src:x,alt:`Image ${j+1}`,className:"max-h-48 max-w-64 object-contain",loading:"lazy"}),e.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100",children:e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-[var(--color-text-primary)]",children:"Open"})})]},j))})]})}function Ue({span:t,copied:s,onCopy:o}){const c=t.inputMessages?.length??0,l=t.outputMessages?.length??0,[n,r]=u.useState(c>3),[d,i]=u.useState(l>3);return e.jsx(ae.div,{initial:{opacity:0,gridTemplateRows:"0fr"},animate:{opacity:1,gridTemplateRows:"1fr"},exit:{opacity:0,gridTemplateRows:"0fr"},transition:{duration:.2},style:{display:"grid"},children:e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"mx-4 mb-4 rounded-[24px] border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.92),rgba(var(--ch-bg-deep),0.97),rgba(var(--ch-bg-base),0.99))] p-5 text-sm shadow-[inset_0_1px_0_rgba(var(--ch-text-primary),0.04),0_26px_60px_rgba(0,0,0,0.22)]",children:e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid flex-1 grid-cols-2 gap-3 md:grid-cols-4",children:[e.jsx(b,{icon:De,label:"Model",value:t.responseModel??t.requestModel??"-"}),e.jsx(b,{icon:Z,label:"Tokens",value:`${t.inputTokens} in / ${t.outputTokens} out`}),e.jsx(b,{icon:V,label:"Cost",value:w(t.totalCost)}),e.jsx(b,{icon:D,label:"Duration",value:t.duration?g(t.duration):"-"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(v,{label:"Input msgs",value:String(c)}),e.jsx(v,{label:"Output msgs",value:String(l)}),e.jsx(v,{label:"Tool calls",value:String(t.toolCalls?.length??0)}),e.jsx(v,{label:"Status",value:t.status==="error"?"Error":"OK",tone:t.status==="error"?"danger":"success"})]}),t.status==="error"&&e.jsxs("div",{className:"rounded-2xl border border-[var(--color-text-primary)]/18 bg-[var(--color-text-primary)]/6 p-4",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold uppercase tracking-[0.16em] text-[var(--color-text-primary)]",children:[e.jsx(te,{className:"h-4 w-4"}),t.errorType??"error"]}),t.errorMessage&&e.jsx(k,{text:t.errorMessage,label:"error",copied:s,onCopy:o})]}),e.jsx("div",{className:"font-mono text-xs leading-relaxed text-[var(--color-text-primary)]/70",children:t.errorMessage})]}),t.inputMessages&&t.inputMessages.length>0&&e.jsxs("div",{children:[e.jsx(P,{icon:W,title:"Input messages",count:t.inputMessages.length,collapsed:n,onToggle:()=>r(x=>!x)}),!n&&e.jsx("div",{className:"space-y-2",children:t.inputMessages.map((x,j)=>e.jsx(G,{message:x,type:"input",copied:s,onCopy:o},`in-${x.role}-${j}`))})]}),t.outputMessages&&t.outputMessages.length>0&&e.jsxs("div",{children:[e.jsx(P,{icon:W,title:"Output messages",count:t.outputMessages.length,collapsed:d,onToggle:()=>i(x=>!x)}),!d&&e.jsx("div",{className:"space-y-2",children:t.outputMessages.map((x,j)=>e.jsx(G,{message:x,type:"output",copied:s,onCopy:o},`out-${x.role}-${j}`))})]}),t.toolCalls&&t.toolCalls.length>0&&e.jsxs("div",{children:[e.jsx(P,{icon:Le,title:"Tool calls",count:t.toolCalls.length}),e.jsx("div",{className:"space-y-2",children:t.toolCalls.map(x=>e.jsxs("div",{className:"rounded-2xl border border-[var(--color-accent-2)]/10 bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.7),rgba(var(--ch-bg-base),0.86))] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"rounded-full border border-[var(--color-accent-2)]/16 bg-[var(--color-accent-2)]/10 px-2.5 py-1 text-[10px] font-bold tracking-[0.16em] text-[var(--color-accent)]",children:x.name}),e.jsx(k,{text:x.arguments,label:`tool-${x.id}`,copied:s,onCopy:o})]}),e.jsx("pre",{className:"mt-2.5 overflow-x-auto font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:se(x.arguments)}),x.result&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-2 border-t border-[var(--border-dim)]"}),e.jsx("div",{className:"mb-1 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Result"}),e.jsx("pre",{className:"overflow-x-auto font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:x.result})]})]},x.id))})]})]}),e.jsxs("div",{className:"space-y-4 xl:sticky xl:top-6 xl:self-start",children:[e.jsxs("div",{className:"rounded-2xl border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.74),rgba(var(--ch-bg-base),0.9))] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),"Span identity"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Span ID"}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-[var(--color-text-secondary)]",children:t.spanId}),e.jsx(k,{text:t.spanId,label:"spanId",copied:s,onCopy:o})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Operation"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:t.operationName})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Provider"}),e.jsx("div",{className:"mt-1",children:e.jsx(Q,{provider:t.providerName})})]}),t.parentSpanId&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Parent span"}),e.jsx("div",{className:"mt-1 font-mono text-xs text-[var(--color-text-secondary)]",children:t.parentSpanId})]}),t.sessionId&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--color-text-disabled)]",children:"Session"}),e.jsx("div",{className:"mt-1 font-mono text-xs text-[var(--color-text-secondary)]",children:t.sessionId})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.74),rgba(var(--ch-bg-base),0.9))] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-[var(--color-text-tertiary)]",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),"Request config"]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsx(v,{label:"Request model",value:t.requestModel}),e.jsx(v,{label:"Response model",value:t.responseModel??t.requestModel??"-"}),e.jsx(v,{label:"Temperature",value:t.temperature!==void 0?String(t.temperature):"-"}),e.jsx(v,{label:"Top P",value:t.topP!==void 0?String(t.topP):"-"}),e.jsx(v,{label:"Max tokens",value:t.maxTokens!==void 0?String(t.maxTokens):"-"}),e.jsx(v,{label:"Started",value:new Date(t.startTime).toLocaleTimeString()})]})]})]})]})})})})}function se(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function ze(t){const s=t.providerName?.toLowerCase()??"",o=t.requestModel??t.responseModel??"unknown",c=(t.inputMessages??[]).map(r=>({role:r.role,content:typeof r.content=="string"?r.content:r.content??""})),n=JSON.stringify({model:o,messages:c}).replace(/'/g,"'\\''");return s==="openai"?`curl https://api.openai.com/v1/chat/completions \\
|
|
2
2
|
-H "Authorization: Bearer $OPENAI_API_KEY" \\
|
|
3
3
|
-H "Content-Type: application/json" \\
|
|
4
4
|
-d '${n}'`:s==="anthropic"?`curl https://api.anthropic.com/v1/messages \\
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,d as me,j as e}from"./query-DVWnIZNd.js";import{a as pe,S as he,g as ue,h as ve,i as be,j as ge,L as je,k as J,d as fe}from"./index-DG2eF3M2.js";import{G as Ne}from"./GettingStartedPanel-Cn46fQ1w.js";import{P as ye,c as G,a as T,b as k,f as se}from"./format-zoXqpaOb.js";import{S as E,g as Se}from"./content-DZmxO8bn.js";import{S as M,a as P,b as $,c as L,d as S}from"./select-BJEJvQo4.js";import{P as Y,C as we}from"./CommandBar-CBRbPbgc.js";import{E as A}from"./EmptyState-xDl-M9Rz.js";import{b as B,c as ae}from"./motion-CSeNjKbZ.js";import{p as V,q as Ce,r as K,Z as Te,X as re,j as ee,s as ke,t as _e,u as De,m as Ie,n as le,v as Me,w as Pe,x as $e,y as Le,d as Ee,D as He}from"./icons-BOLUIAKd.js";import"./ui-BFiKdTjl.js";const te=[25,50,100,200];function qe({trace:s,onClose:a}){const h=s.totalDuration??(s.endTime?s.endTime-s.startTime:0);return e.jsx(he,{open:!0,onOpenChange:u=>!u&&a(),children:e.jsxs(ue,{side:"right",className:"flex flex-col overflow-y-auto",children:[e.jsxs(ve,{className:"border-b border-[var(--border-dim)]",children:[e.jsx("div",{className:"hud-label",children:"Quick preview"}),e.jsx(be,{className:"truncate",children:s.name}),e.jsx(ge,{className:"sr-only",children:"Trace preview panel"})]}),e.jsxs("div",{className:"flex-1 space-y-4 p-5",children:[e.jsxs("div",{className:"surface-strong rounded-[20px] p-4",children:[e.jsx("div",{className:"hud-label",children:"Trace ID"}),e.jsx("div",{className:"mt-1 break-all font-mono text-sm text-[var(--color-text-secondary)]",children:s.traceId})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"surface-strong rounded-[20px] p-4",children:[e.jsx("div",{className:"hud-label",children:"Status"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx(E,{status:s.status}),e.jsx("span",{className:`text-sm font-medium ${s.status==="error"?"text-[var(--color-text-primary)]":"text-[var(--color-accent)]"}`,children:s.status==="error"?"Error":"Healthy"})]})]}),e.jsxs("div",{className:"surface-strong rounded-[20px] p-4",children:[e.jsx("div",{className:"hud-label",children:"Duration"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx($e,{className:"h-4 w-4 text-[var(--color-accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--color-text-primary)]",children:h>0?k(h):"N/A"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"surface-strong rounded-[20px] p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Spans"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-[var(--color-text-primary)]",children:s.spanCount}),e.jsx(Le,{className:"mx-auto mt-1 h-4 w-4 text-[var(--color-accent-2)]/70"})]}),e.jsxs("div",{className:"surface-strong rounded-[20px] p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Tokens"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-[var(--color-text-primary)]",children:se(s.totalTokens)}),e.jsx(Ee,{className:"mx-auto mt-1 h-4 w-4 text-[var(--color-accent)]/70"})]}),e.jsxs("div",{className:"surface-strong rounded-[20px] p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Cost"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-[var(--color-text-primary)]",children:T(s.totalCost)}),e.jsx(He,{className:"mx-auto mt-1 h-4 w-4 text-[var(--color-text-primary)]/70"})]})]}),e.jsxs("div",{className:"surface-strong rounded-[20px] p-4",children:[e.jsx("div",{className:"hud-label",children:"Started"}),e.jsxs("div",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:[new Date(s.startTime).toLocaleString()," (",G(s.startTime),")"]}),s.endTime&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hud-label mt-3",children:"Ended"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:new Date(s.endTime).toLocaleString()})]})]}),e.jsxs(je,{to:`/trace/${s.traceId}`,className:"flex w-full items-center justify-center gap-2 rounded-2xl border border-[var(--color-accent-2)]/20 bg-[linear-gradient(135deg,rgba(var(--ch-accent-2), 0.14),rgba(var(--ch-accent), 0.08))] px-5 py-3 text-sm font-medium text-[var(--color-accent)] transition-colors hover:bg-[linear-gradient(135deg,rgba(var(--ch-accent-2), 0.24),rgba(var(--ch-accent), 0.14))]",children:["Open full trace detail",e.jsx(le,{className:"h-4 w-4"})]})]})]})})}function ze({traceA:s,traceB:a}){const[h,u]=d.useState([]),[c,n]=d.useState([]),[l,f]=d.useState(!0);if(d.useEffect(()=>{let N=!1;return f(!0),Promise.all([J(s.traceId),J(a.traceId)]).then(([i,b])=>{N||(u(i.spans),n(b.spans),f(!1))}),()=>{N=!0}},[s.traceId,a.traceId]),l)return e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-[var(--color-text-tertiary)]",children:"Loading responses..."});const o=N=>N.flatMap(i=>(i.outputMessages??[]).filter(b=>b.role==="assistant").map(b=>({spanName:i.name,model:i.responseModel??i.requestModel,content:Se(b.content)}))),v=o(h),g=o(c),r=Math.max(v.length,g.length);return r===0?e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-[var(--color-text-tertiary)]",children:"No assistant responses found in either trace."}):e.jsx("div",{className:"space-y-3",children:Array.from({length:r},(N,i)=>{const b=v[i],p=g[i];return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("div",{className:"surface-strong rounded-[20px] border-[var(--color-accent-2)]/12 p-3",children:b?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-[var(--color-accent-2)]/16 bg-[var(--color-accent-2)]/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--color-accent)]",children:"assistant"}),e.jsx("span",{className:"font-mono text-[10px] text-[var(--color-text-tertiary)]",children:b.model})]}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:b.content||e.jsx("span",{className:"text-[var(--color-text-disabled)] italic",children:"empty response"})})]}):e.jsx("div",{className:"text-xs italic text-[var(--color-text-disabled)]",children:"No response"})}),e.jsx("div",{className:"surface-strong rounded-[20px] border-[var(--color-accent)]/12 p-3",children:p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-[var(--color-accent)]/16 bg-[var(--color-accent)]/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--color-accent)]",children:"assistant"}),e.jsx("span",{className:"font-mono text-[10px] text-[var(--color-text-tertiary)]",children:p.model})]}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:p.content||e.jsx("span",{className:"text-[var(--color-text-disabled)] italic",children:"empty response"})})]}):e.jsx("div",{className:"text-xs italic text-[var(--color-text-disabled)]",children:"No response"})})]},i)})})}function Re({traceA:s,traceB:a,durA:h,durB:u}){const[c,n]=d.useState("cost"),l=d.useMemo(()=>[{id:"A",name:s.name,cost:s.totalCost,latency:h,tokens:s.totalTokens},{id:"B",name:a.name,cost:a.totalCost,latency:u,tokens:a.totalTokens}],[s,a,h,u]),f=r=>c==="tokens"?r.toLocaleString():c==="latency"?k(r):T(r),o=c==="tokens"?"Token distribution":c==="latency"?"Latency comparison":"Cost comparison",v=Math.max(...l.map(r=>r[c]),1),g=l[0][c]===l[1][c]?null:l[0][c]>l[1][c]?"A":"B";return e.jsxs("div",{className:"surface-strong mb-4 rounded-[24px] p-4",children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Signal lanes"}),e.jsx("div",{className:"text-sm font-medium text-[var(--color-text-primary)]",children:o})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2.5 py-1 text-[10px] font-mono uppercase tracking-[0.18em] text-[var(--color-text-tertiary)]",children:g?`trace ${g} leading`:"even"}),e.jsxs(M,{value:c,onValueChange:r=>n(r),children:[e.jsx(P,{className:"h-8 w-[170px] text-xs",children:e.jsx($,{placeholder:"Select metric"})}),e.jsxs(L,{children:[e.jsx(S,{value:"cost",children:"Model cost ranking"}),e.jsx(S,{value:"latency",children:"Model latency ranking"}),e.jsx(S,{value:"tokens",children:"Token distribution"})]})]})]})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:l.map(r=>{const N=Math.max(r[c]/v*100,8),i=r.id==="A";return e.jsxs("div",{className:`rounded-[22px] border px-4 py-4 ${i?"border-[var(--color-accent)]/18 bg-[var(--color-accent)]/8":"border-[var(--color-accent-2)]/18 bg-[var(--color-accent-2)]/8"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`rounded-full border px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.18em] ${i?"border-[var(--color-accent)]/22 bg-[var(--color-accent)]/12 text-[var(--color-text-primary)]":"border-[var(--color-accent-2)]/20 bg-[var(--color-accent-2)]/10 text-[var(--color-text-primary)]"}`,children:["Trace ",r.id]}),g===r.id?e.jsx("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2 py-0.5 text-[10px] uppercase tracking-[0.18em] text-[var(--color-text-secondary)]",children:"lead"}):null]}),e.jsx("div",{className:"mt-2 truncate text-sm font-semibold text-[var(--color-text-primary)]",children:r.name}),e.jsx("div",{className:"mt-1 font-mono text-[11px] text-[var(--color-text-tertiary)]",children:i?s.traceId.slice(0,14):a.traceId.slice(0,14)})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-mono text-sm text-[var(--color-text-primary)]",children:f(r[c])}),e.jsx("div",{className:"mt-1 text-[11px] text-[var(--color-text-tertiary)]",children:r.cost>0?T(r.cost):"No cost"})]})]}),e.jsx("div",{className:"mt-4 h-2.5 overflow-hidden rounded-full bg-[rgba(var(--ch-bg-base),0.82)]",children:e.jsx("div",{className:`h-full rounded-full ${i?"bg-[linear-gradient(90deg,var(--color-accent-2),var(--color-accent))]":"bg-[linear-gradient(90deg,var(--color-bg-panel),var(--color-accent-2))]"}`,style:{width:`${N}%`}})}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px] text-[var(--color-text-tertiary)]",children:[e.jsxs("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2 py-0.5",children:[r.tokens.toLocaleString()," tokens"]}),e.jsx("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2 py-0.5",children:r.latency>0?k(r.latency):"N/A"})]})]},r.id)})})]})}function Fe({traceA:s,traceB:a,onClose:h}){const[u,c]=d.useState("metrics"),n=s.totalDuration??(s.endTime?s.endTime-s.startTime:0),l=a.totalDuration??(a.endTime?a.endTime-a.startTime:0),f=[{label:"Status",a:s.status,b:a.status,better:s.status===a.status?"tie":s.status==="ok"?"a":"b"},{label:"Spans",a:String(s.spanCount),b:String(a.spanCount)},{label:"Tokens",a:s.totalTokens.toLocaleString(),b:a.totalTokens.toLocaleString(),diff:s.totalTokens!==a.totalTokens?`${a.totalTokens-s.totalTokens>0?"+":""}${(a.totalTokens-s.totalTokens).toLocaleString()}`:"same",better:s.totalTokens===a.totalTokens?"tie":s.totalTokens<a.totalTokens?"a":"b"},{label:"Cost",a:T(s.totalCost),b:T(a.totalCost),diff:s.totalCost!==a.totalCost?`${a.totalCost-s.totalCost>0?"+":""}${T(Math.abs(a.totalCost-s.totalCost))}`:"same",better:s.totalCost===a.totalCost?"tie":s.totalCost<a.totalCost?"a":"b"},{label:"Duration",a:n>0?k(n):"N/A",b:l>0?k(l):"N/A",diff:n>0&&l>0&&n!==l?`${l-n>0?"+":""}${k(Math.abs(l-n))}`:n===l?"same":void 0,better:n===l?"tie":n>0&&l>0&&n<l?"a":"b"}];return e.jsxs(ae.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},exit:{opacity:0,y:24},transition:{duration:.3,ease:[.22,1,.36,1]},className:"dashboard-shell rounded-[26px] px-5 py-5 sm:px-6",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Comparison mode"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-[var(--color-text-primary)]",children:"Side-by-side analysis"})]}),e.jsxs("button",{type:"button",onClick:h,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)]",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Close comparison"})]})]}),e.jsxs("div",{className:"mb-4 flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>c("metrics"),className:`inline-flex items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-xs font-semibold transition-colors ${u==="metrics"?"border-[var(--color-accent)]/22 bg-[var(--color-accent)]/12 text-[var(--color-text-primary)]":"border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)]"}`,children:[e.jsx(K,{className:"h-3 w-3"}),"Metrics"]}),e.jsxs("button",{type:"button",onClick:()=>c("responses"),className:`inline-flex items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-xs font-semibold transition-colors ${u==="responses"?"border-[var(--color-accent)]/22 bg-[var(--color-accent)]/12 text-[var(--color-text-primary)]":"border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)]"}`,children:[e.jsx(Pe,{className:"h-3 w-3"}),"Response diff"]})]}),u==="metrics"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[110px_1fr_1fr_96px] gap-3",children:[e.jsx("div",{}),e.jsxs("div",{className:"rounded-2xl border border-[var(--color-accent)]/18 bg-[var(--color-accent)]/8 p-3",children:[e.jsx("div",{className:"hud-label",children:"Trace A"}),e.jsx("div",{className:"mt-1 truncate text-sm font-medium text-[var(--color-text-primary)]",children:s.name}),e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--color-text-tertiary)]",children:s.traceId.slice(0,16)})]}),e.jsxs("div",{className:"rounded-2xl border border-[var(--color-accent-2)]/18 bg-[var(--color-accent-2)]/8 p-3",children:[e.jsx("div",{className:"hud-label",children:"Trace B"}),e.jsx("div",{className:"mt-1 truncate text-sm font-medium text-[var(--color-text-primary)]",children:a.name}),e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--color-text-tertiary)]",children:a.traceId.slice(0,16)})]}),e.jsx("div",{className:"flex items-center justify-center text-[11px] uppercase tracking-[0.18em] text-[var(--color-text-tertiary)]",children:"Delta"})]}),e.jsx(Re,{traceA:s,traceB:a,durA:n,durB:l}),e.jsx("div",{className:"space-y-2",children:f.map(o=>e.jsxs("div",{className:"grid grid-cols-[110px_1fr_1fr_96px] items-center gap-3 rounded-2xl border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.72),rgba(var(--ch-bg-base),0.9))] px-4 py-3",children:[e.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]",children:o.label}),e.jsx("div",{className:`text-sm font-mono ${o.better==="a"?"text-[var(--color-accent)]":(o.better==="tie","text-[var(--color-text-secondary)]")}`,children:o.label==="Status"?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(E,{status:s.status}),o.a]}):o.a}),e.jsx("div",{className:`text-sm font-mono ${o.better==="b"?"text-[var(--color-accent-2)]":(o.better==="tie","text-[var(--color-text-secondary)]")}`,children:o.label==="Status"?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(E,{status:a.status}),o.b]}):o.b}),e.jsx("div",{className:"text-center text-xs font-mono text-[var(--color-text-tertiary)]",children:o.diff??"--"})]},o.label))})]}):e.jsx(ze,{traceA:s,traceB:a})]})}function Ae(){const[s,a]=pe(),h=s.get("q")??"",u=d.useDeferredValue(h),c=s.get("status"),n=c==="ok"||c==="error"?c:"",l=Number(s.get("periodHours")??"24"),f=Number(s.get("pageSize")??"50"),o=te.includes(f)?f:50,v=Math.max(1,Number(s.get("page")??"1")||1),g=(v-1)*o,[r,N]=d.useState(null),[i,b]=d.useState("desc"),[p,H]=d.useState(new Set),[q,Q]=d.useState(null),[oe,z]=d.useState(!1),_=d.useMemo(()=>({limit:o,offset:g,q:u.trim()||void 0,status:n||void 0,periodHours:Y.some(t=>t.value===l)?l:24}),[u,o,g,l,n]),{data:U,isLoading:ce}=me({queryKey:["traces",_],queryFn:()=>fe(_)}),R=U?.traces??[],w=U?.total??0,Z=Math.max(1,Math.ceil(w/o));function ne(t){r===t?b(x=>x==="asc"?"desc":"asc"):(N(t),b("desc"))}const j=d.useMemo(()=>r?[...R].sort((t,x)=>{const m=t[r]??0,y=x[r]??0;return i==="asc"?m-y:y-m}):R,[R,r,i]),D=j.length>0&&j.every(t=>p.has(t.traceId)),ie=d.useCallback(()=>{H(t=>{const x=new Set(t);if(D)for(const m of j)x.delete(m.traceId);else for(const m of j)x.add(m.traceId);return x})},[D,j]),de=d.useCallback(t=>{H(x=>{const m=new Set(x);return m.has(t)?m.delete(t):m.add(t),m})},[]),xe=d.useCallback(()=>{H(new Set),z(!1)},[]),F=d.useMemo(()=>j.filter(t=>p.has(t.traceId)),[j,p]),I=p.size===2,W=h.length>0||n.length>0||_.periodHours!==24;function C(t,x=!0){a(m=>{const y=new URLSearchParams(m);for(const[X,O]of Object.entries(t))O===void 0||O===""?y.delete(X):y.set(X,String(O));return x&&y.delete("page"),y},{replace:!0})}return e.jsxs(e.Fragment,{children:[e.jsxs(ye,{eyebrow:"Trace Explorer",title:"Deep-dive into every trace flowing through the system.",description:"Explore, compare, and inspect individual traces with full visibility into span counts, token usage, cost, and execution timing.",aside:e.jsx("div",{className:"insight-panel",children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"deck-card deck-card--accent",children:[e.jsx("div",{className:"hud-label",children:"Total traces"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("div",{className:"text-[var(--color-text-primary)]",style:{fontFamily:"var(--font-operator)",fontSize:"30px",fontWeight:700,lineHeight:"0.92",letterSpacing:"-0.04em"},children:se(w)}),e.jsx(Me,{className:"h-4 w-4 text-[var(--color-accent)]"})]}),e.jsx("div",{className:"mt-2 text-sm text-[var(--color-text-secondary)]",children:"Matching current filters"})]}),p.size>0&&e.jsxs("div",{className:"deck-card",children:[e.jsx("div",{className:"hud-label",children:"Selected"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsxs("div",{className:"text-lg font-medium text-[var(--color-text-primary)]",children:[p.size," trace",p.size!==1&&"s"]}),e.jsx(K,{className:"h-4 w-4 text-[var(--color-accent)]"})]}),e.jsx("div",{className:"mt-2 text-sm text-[var(--color-text-secondary)]",children:I?"Ready to compare":"Select exactly 2 to compare"})]})]})}),children:[e.jsxs("div",{className:"pill-strip w-fit max-w-full overflow-x-auto",children:[e.jsxs("span",{className:"pill-item",children:["window ",e.jsxs("strong",{children:[_.periodHours,"h"]})]}),e.jsxs("span",{className:"pill-item",children:["selected ",e.jsx("strong",{children:p.size})]}),e.jsxs("span",{className:"pill-item",children:["compare ",e.jsx("strong",{children:I?"ready":"idle"})]}),e.jsxs("span",{className:"pill-item",children:["matches ",e.jsx("strong",{children:w})]})]}),e.jsx(B,{children:p.size>0&&e.jsx(ae.div,{initial:{opacity:0,gridTemplateRows:"0fr"},animate:{opacity:1,gridTemplateRows:"1fr"},exit:{opacity:0,gridTemplateRows:"0fr"},transition:{duration:.25,ease:"easeOut"},style:{display:"grid"},children:e.jsx("div",{className:"overflow-hidden",children:e.jsxs("div",{className:"dashboard-shell flex items-center justify-between gap-4 rounded-[24px] px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"status-chip",children:[e.jsx(V,{className:"h-3.5 w-3.5 text-[var(--color-accent)]"}),e.jsxs("span",{children:[p.size," selected"]})]}),e.jsxs("button",{type:"button",onClick:xe,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)]",children:[e.jsx(Ce,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Clear"})]})]}),e.jsxs("button",{type:"button",disabled:!I,onClick:()=>z(!0),className:`inline-flex items-center gap-2 rounded-[var(--radius-panel)] border px-4 py-2 text-sm font-medium transition-all ${I?"border-[var(--color-accent-2)]/20 bg-[linear-gradient(135deg,rgba(var(--ch-accent-2), 0.14),rgba(var(--ch-accent), 0.08))] text-[var(--color-accent)] hover:bg-[linear-gradient(135deg,rgba(var(--ch-accent-2), 0.24),rgba(var(--ch-accent), 0.14))]":"cursor-not-allowed border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.03)] text-[var(--color-text-tertiary)]"}`,children:[e.jsx(K,{className:"h-4 w-4"}),"Compare traces"]})]})})})}),e.jsx(B,{children:oe&&F.length===2&&e.jsx(Fe,{traceA:F[0],traceB:F[1],onClose:()=>z(!1)})}),e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-4 py-4 sm:px-5 sm:py-5",children:[e.jsxs("div",{className:"surface-strong mb-4 rounded-[24px] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Search console"}),e.jsx("h2",{className:"page-section-title mt-1",children:"Trace explorer"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"status-chip",children:[e.jsx(Te,{className:"h-3.5 w-3.5 text-[var(--color-text-primary)]"}),e.jsxs("span",{children:[w," traces"]})]}),e.jsxs("button",{type:"button",onClick:()=>C({q:void 0,status:void 0,periodHours:void 0}),disabled:!W,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)] disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Clear"})]})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,1.8fr)_minmax(0,0.6fr)_minmax(0,0.6fr)]",children:[e.jsx(we,{value:h,onChange:t=>C({q:t||void 0}),placeholder:"Search by trace name, ID, or keyword..."}),e.jsxs(M,{value:n||"__all__",onValueChange:t=>C({status:t==="__all__"?void 0:t}),children:[e.jsx(P,{className:"w-full rounded-2xl py-3",children:e.jsx($,{placeholder:"All states"})}),e.jsxs(L,{children:[e.jsx(S,{value:"__all__",children:"All states"}),e.jsx(S,{value:"ok",children:"Healthy only"}),e.jsx(S,{value:"error",children:"Errors only"})]})]}),e.jsxs(M,{value:String(_.periodHours??24),onValueChange:t=>C({periodHours:Number(t)===24?void 0:Number(t)}),children:[e.jsx(P,{className:"w-full rounded-2xl py-3",children:e.jsx($,{})}),e.jsx(L,{children:Y.map(t=>e.jsx(S,{value:String(t.value),children:t.label},t.value))})]})]})]}),ce?e.jsx(A,{title:"Loading traces",description:"LLMTap is assembling the explorer feed for the current filter window.",className:"min-h-[400px]"}):j.length===0?W?e.jsx(A,{title:"No traces match these filters",description:"Try adjusting the search term or time window to widen the explorer surface.",className:"min-h-[400px]"}):e.jsx(Ne,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-hidden rounded-[22px] border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.9),rgba(var(--ch-bg-deep),0.96),rgba(var(--ch-bg-base),0.99))] shadow-[inset_0_1px_0_rgba(var(--ch-text-primary),0.04),0_24px_56px_rgba(0,0,0,0.3)]",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[980px] border-collapse text-sm",children:[e.jsx("thead",{className:"sticky top-0 z-10 bg-[rgba(var(--ch-bg-base),0.94)] backdrop-blur-xl",children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-[var(--color-text-tertiary)]",children:[e.jsx("th",{className:"px-4 py-3 text-center",children:e.jsx("button",{type:"button",onClick:ie,"aria-label":D?"Deselect all traces on page":"Select all traces on page",className:"inline-flex items-center justify-center transition-colors hover:text-[var(--color-text-secondary)]",title:D?"Deselect all":"Select all",children:D?e.jsx(V,{className:"h-4 w-4 text-[var(--color-accent)]"}):e.jsx(ee,{className:"h-4 w-4"})})}),e.jsx("th",{className:"w-10 px-4 py-3",children:"State"}),e.jsx("th",{className:"px-4 py-3",children:"Trace"}),e.jsx("th",{className:"px-4 py-3",children:"ID"}),[["spanCount","Spans"],["totalTokens","Tokens"],["totalCost","Cost"],["startTime","When"]].map(([t,x])=>e.jsx("th",{className:"px-4 py-3 text-right",children:e.jsxs("button",{type:"button",onClick:()=>ne(t),className:"inline-flex items-center gap-1 transition-colors hover:text-[var(--color-text-secondary)]",children:[x,r===t?i==="asc"?e.jsx(ke,{className:"h-3 w-3"}):e.jsx(_e,{className:"h-3 w-3"}):e.jsx(De,{className:"h-3 w-3 opacity-30"})]})},t)),e.jsx("th",{className:"px-4 py-3 text-right",children:"Duration"})]})}),e.jsx("tbody",{children:j.map(t=>{const x=p.has(t.traceId),m=t.totalDuration??(t.endTime?t.endTime-t.startTime:0);return e.jsxs("tr",{onClick:()=>Q(t),className:`cursor-pointer border-t border-[var(--border-dim)] transition-colors ${x?"bg-[var(--color-accent)]/8":"hover:bg-[rgba(var(--ch-text-primary),0.03)]"}`,children:[e.jsx("td",{className:"px-4 py-3.5 text-center",onClick:y=>y.stopPropagation(),children:e.jsx("button",{type:"button",onClick:()=>de(t.traceId),"aria-label":`Select trace ${t.name}`,className:"inline-flex items-center justify-center transition-colors hover:text-[var(--color-accent)]",children:x?e.jsx(V,{className:"h-4 w-4 text-[var(--color-accent)]"}):e.jsx(ee,{className:"h-4 w-4 text-[var(--color-text-tertiary)]"})})}),e.jsx("td",{className:"px-4 py-3.5",children:e.jsx(E,{status:t.status})}),e.jsx("td",{className:"px-4 py-3.5",children:e.jsxs("div",{className:"max-w-[320px]",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--color-text-primary)]",children:t.name}),e.jsxs("div",{className:"mt-1 text-[11px] text-[var(--color-text-tertiary)]",children:[G(t.startTime)," started"]})]})}),e.jsx("td",{className:"px-4 py-3.5",children:e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]",children:t.traceId.slice(0,12)})}),e.jsx("td",{className:"px-4 py-3.5 text-right font-mono text-xs text-[var(--color-text-secondary)]",children:t.spanCount}),e.jsx("td",{className:"px-4 py-3.5 text-right font-mono text-xs text-[var(--color-text-secondary)]",children:t.totalTokens.toLocaleString()}),e.jsx("td",{className:"px-4 py-3.5 text-right font-mono text-xs text-[var(--color-text-secondary)]",children:T(t.totalCost)}),e.jsx("td",{className:"px-4 py-3.5 text-right text-xs text-[var(--color-text-tertiary)]",children:G(t.startTime)}),e.jsx("td",{className:"px-4 py-3.5 text-right font-mono text-xs text-[var(--color-text-secondary)]",children:m>0?k(m):"--"})]},t.traceId)})})]})})}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-xs text-[var(--color-text-tertiary)]",children:w>0?`Showing ${g+1}-${Math.min(g+j.length,w)} of ${w}`:"Awaiting traces"}),e.jsxs(M,{value:String(o),onValueChange:t=>C({pageSize:Number(t)===50?void 0:Number(t)}),children:[e.jsx(P,{className:"w-auto rounded-xl px-2 py-1.5 text-xs",children:e.jsx($,{})}),e.jsx(L,{children:te.map(t=>e.jsxs(S,{value:String(t),children:[t," / page"]},t))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>C({page:v>2?v-1:void 0},!1),disabled:v<=1,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)] disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(Ie,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Previous"})]}),e.jsxs("span",{className:"text-xs text-[var(--color-text-tertiary)]",children:[v," / ",Z]}),e.jsxs("button",{type:"button",onClick:()=>C({page:v+1},!1),disabled:v>=Z,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)] disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("span",{children:"Next"}),e.jsx(le,{className:"h-3.5 w-3.5"})]})]})]})]})]})]}),q&&e.jsx(qe,{trace:q,onClose:()=>Q(null)},q.traceId)]})}export{Ae as default};
|
|
1
|
+
import{r as d,d as me,j as e}from"./query-DVWnIZNd.js";import{a as pe,S as he,g as ue,h as ve,i as be,j as ge,L as je,k as J,d as fe}from"./index-BCjwgtkq.js";import{G as Ne}from"./GettingStartedPanel-Cn46fQ1w.js";import{P as ye,c as G,a as T,b as k,f as se}from"./format-BdzpxHjW.js";import{S as E,g as Se}from"./content-BV3DhCiY.js";import{S as M,a as P,b as $,c as L,d as S}from"./select-Dsu3r0h-.js";import{P as Y,C as we}from"./CommandBar-CTVjcTSb.js";import{E as A}from"./EmptyState-B8rSQL1S.js";import{b as B,c as ae}from"./motion-CSeNjKbZ.js";import{p as V,q as Ce,r as K,Z as Te,X as re,j as ee,s as ke,t as _e,u as De,m as Ie,n as le,v as Me,w as Pe,x as $e,y as Le,d as Ee,D as He}from"./icons-BOLUIAKd.js";import"./ui-BFiKdTjl.js";const te=[25,50,100,200];function qe({trace:s,onClose:a}){const h=s.totalDuration??(s.endTime?s.endTime-s.startTime:0);return e.jsx(he,{open:!0,onOpenChange:u=>!u&&a(),children:e.jsxs(ue,{side:"right",className:"flex flex-col overflow-y-auto",children:[e.jsxs(ve,{className:"border-b border-[var(--border-dim)]",children:[e.jsx("div",{className:"hud-label",children:"Quick preview"}),e.jsx(be,{className:"truncate",children:s.name}),e.jsx(ge,{className:"sr-only",children:"Trace preview panel"})]}),e.jsxs("div",{className:"flex-1 space-y-4 p-5",children:[e.jsxs("div",{className:"surface-strong rounded-[20px] p-4",children:[e.jsx("div",{className:"hud-label",children:"Trace ID"}),e.jsx("div",{className:"mt-1 break-all font-mono text-sm text-[var(--color-text-secondary)]",children:s.traceId})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"surface-strong rounded-[20px] p-4",children:[e.jsx("div",{className:"hud-label",children:"Status"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx(E,{status:s.status}),e.jsx("span",{className:`text-sm font-medium ${s.status==="error"?"text-[var(--color-text-primary)]":"text-[var(--color-accent)]"}`,children:s.status==="error"?"Error":"Healthy"})]})]}),e.jsxs("div",{className:"surface-strong rounded-[20px] p-4",children:[e.jsx("div",{className:"hud-label",children:"Duration"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx($e,{className:"h-4 w-4 text-[var(--color-accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--color-text-primary)]",children:h>0?k(h):"N/A"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"surface-strong rounded-[20px] p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Spans"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-[var(--color-text-primary)]",children:s.spanCount}),e.jsx(Le,{className:"mx-auto mt-1 h-4 w-4 text-[var(--color-accent-2)]/70"})]}),e.jsxs("div",{className:"surface-strong rounded-[20px] p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Tokens"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-[var(--color-text-primary)]",children:se(s.totalTokens)}),e.jsx(Ee,{className:"mx-auto mt-1 h-4 w-4 text-[var(--color-accent)]/70"})]}),e.jsxs("div",{className:"surface-strong rounded-[20px] p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Cost"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-[var(--color-text-primary)]",children:T(s.totalCost)}),e.jsx(He,{className:"mx-auto mt-1 h-4 w-4 text-[var(--color-text-primary)]/70"})]})]}),e.jsxs("div",{className:"surface-strong rounded-[20px] p-4",children:[e.jsx("div",{className:"hud-label",children:"Started"}),e.jsxs("div",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:[new Date(s.startTime).toLocaleString()," (",G(s.startTime),")"]}),s.endTime&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hud-label mt-3",children:"Ended"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:new Date(s.endTime).toLocaleString()})]})]}),e.jsxs(je,{to:`/trace/${s.traceId}`,className:"flex w-full items-center justify-center gap-2 rounded-2xl border border-[var(--color-accent-2)]/20 bg-[linear-gradient(135deg,rgba(var(--ch-accent-2), 0.14),rgba(var(--ch-accent), 0.08))] px-5 py-3 text-sm font-medium text-[var(--color-accent)] transition-colors hover:bg-[linear-gradient(135deg,rgba(var(--ch-accent-2), 0.24),rgba(var(--ch-accent), 0.14))]",children:["Open full trace detail",e.jsx(le,{className:"h-4 w-4"})]})]})]})})}function ze({traceA:s,traceB:a}){const[h,u]=d.useState([]),[c,n]=d.useState([]),[l,f]=d.useState(!0);if(d.useEffect(()=>{let N=!1;return f(!0),Promise.all([J(s.traceId),J(a.traceId)]).then(([i,b])=>{N||(u(i.spans),n(b.spans),f(!1))}),()=>{N=!0}},[s.traceId,a.traceId]),l)return e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-[var(--color-text-tertiary)]",children:"Loading responses..."});const o=N=>N.flatMap(i=>(i.outputMessages??[]).filter(b=>b.role==="assistant").map(b=>({spanName:i.name,model:i.responseModel??i.requestModel,content:Se(b.content)}))),v=o(h),g=o(c),r=Math.max(v.length,g.length);return r===0?e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-[var(--color-text-tertiary)]",children:"No assistant responses found in either trace."}):e.jsx("div",{className:"space-y-3",children:Array.from({length:r},(N,i)=>{const b=v[i],p=g[i];return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("div",{className:"surface-strong rounded-[20px] border-[var(--color-accent-2)]/12 p-3",children:b?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-[var(--color-accent-2)]/16 bg-[var(--color-accent-2)]/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--color-accent)]",children:"assistant"}),e.jsx("span",{className:"font-mono text-[10px] text-[var(--color-text-tertiary)]",children:b.model})]}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:b.content||e.jsx("span",{className:"text-[var(--color-text-disabled)] italic",children:"empty response"})})]}):e.jsx("div",{className:"text-xs italic text-[var(--color-text-disabled)]",children:"No response"})}),e.jsx("div",{className:"surface-strong rounded-[20px] border-[var(--color-accent)]/12 p-3",children:p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-[var(--color-accent)]/16 bg-[var(--color-accent)]/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--color-accent)]",children:"assistant"}),e.jsx("span",{className:"font-mono text-[10px] text-[var(--color-text-tertiary)]",children:p.model})]}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs leading-relaxed text-[var(--color-text-secondary)]",children:p.content||e.jsx("span",{className:"text-[var(--color-text-disabled)] italic",children:"empty response"})})]}):e.jsx("div",{className:"text-xs italic text-[var(--color-text-disabled)]",children:"No response"})})]},i)})})}function Re({traceA:s,traceB:a,durA:h,durB:u}){const[c,n]=d.useState("cost"),l=d.useMemo(()=>[{id:"A",name:s.name,cost:s.totalCost,latency:h,tokens:s.totalTokens},{id:"B",name:a.name,cost:a.totalCost,latency:u,tokens:a.totalTokens}],[s,a,h,u]),f=r=>c==="tokens"?r.toLocaleString():c==="latency"?k(r):T(r),o=c==="tokens"?"Token distribution":c==="latency"?"Latency comparison":"Cost comparison",v=Math.max(...l.map(r=>r[c]),1),g=l[0][c]===l[1][c]?null:l[0][c]>l[1][c]?"A":"B";return e.jsxs("div",{className:"surface-strong mb-4 rounded-[24px] p-4",children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Signal lanes"}),e.jsx("div",{className:"text-sm font-medium text-[var(--color-text-primary)]",children:o})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2.5 py-1 text-[10px] font-mono uppercase tracking-[0.18em] text-[var(--color-text-tertiary)]",children:g?`trace ${g} leading`:"even"}),e.jsxs(M,{value:c,onValueChange:r=>n(r),children:[e.jsx(P,{className:"h-8 w-[170px] text-xs",children:e.jsx($,{placeholder:"Select metric"})}),e.jsxs(L,{children:[e.jsx(S,{value:"cost",children:"Model cost ranking"}),e.jsx(S,{value:"latency",children:"Model latency ranking"}),e.jsx(S,{value:"tokens",children:"Token distribution"})]})]})]})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:l.map(r=>{const N=Math.max(r[c]/v*100,8),i=r.id==="A";return e.jsxs("div",{className:`rounded-[22px] border px-4 py-4 ${i?"border-[var(--color-accent)]/18 bg-[var(--color-accent)]/8":"border-[var(--color-accent-2)]/18 bg-[var(--color-accent-2)]/8"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`rounded-full border px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.18em] ${i?"border-[var(--color-accent)]/22 bg-[var(--color-accent)]/12 text-[var(--color-text-primary)]":"border-[var(--color-accent-2)]/20 bg-[var(--color-accent-2)]/10 text-[var(--color-text-primary)]"}`,children:["Trace ",r.id]}),g===r.id?e.jsx("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2 py-0.5 text-[10px] uppercase tracking-[0.18em] text-[var(--color-text-secondary)]",children:"lead"}):null]}),e.jsx("div",{className:"mt-2 truncate text-sm font-semibold text-[var(--color-text-primary)]",children:r.name}),e.jsx("div",{className:"mt-1 font-mono text-[11px] text-[var(--color-text-tertiary)]",children:i?s.traceId.slice(0,14):a.traceId.slice(0,14)})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-mono text-sm text-[var(--color-text-primary)]",children:f(r[c])}),e.jsx("div",{className:"mt-1 text-[11px] text-[var(--color-text-tertiary)]",children:r.cost>0?T(r.cost):"No cost"})]})]}),e.jsx("div",{className:"mt-4 h-2.5 overflow-hidden rounded-full bg-[rgba(var(--ch-bg-base),0.82)]",children:e.jsx("div",{className:`h-full rounded-full ${i?"bg-[linear-gradient(90deg,var(--color-accent-2),var(--color-accent))]":"bg-[linear-gradient(90deg,var(--color-bg-panel),var(--color-accent-2))]"}`,style:{width:`${N}%`}})}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px] text-[var(--color-text-tertiary)]",children:[e.jsxs("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2 py-0.5",children:[r.tokens.toLocaleString()," tokens"]}),e.jsx("span",{className:"rounded-full border border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] px-2 py-0.5",children:r.latency>0?k(r.latency):"N/A"})]})]},r.id)})})]})}function Fe({traceA:s,traceB:a,onClose:h}){const[u,c]=d.useState("metrics"),n=s.totalDuration??(s.endTime?s.endTime-s.startTime:0),l=a.totalDuration??(a.endTime?a.endTime-a.startTime:0),f=[{label:"Status",a:s.status,b:a.status,better:s.status===a.status?"tie":s.status==="ok"?"a":"b"},{label:"Spans",a:String(s.spanCount),b:String(a.spanCount)},{label:"Tokens",a:s.totalTokens.toLocaleString(),b:a.totalTokens.toLocaleString(),diff:s.totalTokens!==a.totalTokens?`${a.totalTokens-s.totalTokens>0?"+":""}${(a.totalTokens-s.totalTokens).toLocaleString()}`:"same",better:s.totalTokens===a.totalTokens?"tie":s.totalTokens<a.totalTokens?"a":"b"},{label:"Cost",a:T(s.totalCost),b:T(a.totalCost),diff:s.totalCost!==a.totalCost?`${a.totalCost-s.totalCost>0?"+":""}${T(Math.abs(a.totalCost-s.totalCost))}`:"same",better:s.totalCost===a.totalCost?"tie":s.totalCost<a.totalCost?"a":"b"},{label:"Duration",a:n>0?k(n):"N/A",b:l>0?k(l):"N/A",diff:n>0&&l>0&&n!==l?`${l-n>0?"+":""}${k(Math.abs(l-n))}`:n===l?"same":void 0,better:n===l?"tie":n>0&&l>0&&n<l?"a":"b"}];return e.jsxs(ae.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},exit:{opacity:0,y:24},transition:{duration:.3,ease:[.22,1,.36,1]},className:"dashboard-shell rounded-[26px] px-5 py-5 sm:px-6",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Comparison mode"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-[var(--color-text-primary)]",children:"Side-by-side analysis"})]}),e.jsxs("button",{type:"button",onClick:h,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)]",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Close comparison"})]})]}),e.jsxs("div",{className:"mb-4 flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>c("metrics"),className:`inline-flex items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-xs font-semibold transition-colors ${u==="metrics"?"border-[var(--color-accent)]/22 bg-[var(--color-accent)]/12 text-[var(--color-text-primary)]":"border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)]"}`,children:[e.jsx(K,{className:"h-3 w-3"}),"Metrics"]}),e.jsxs("button",{type:"button",onClick:()=>c("responses"),className:`inline-flex items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-xs font-semibold transition-colors ${u==="responses"?"border-[var(--color-accent)]/22 bg-[var(--color-accent)]/12 text-[var(--color-text-primary)]":"border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.04)] text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)]"}`,children:[e.jsx(Pe,{className:"h-3 w-3"}),"Response diff"]})]}),u==="metrics"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[110px_1fr_1fr_96px] gap-3",children:[e.jsx("div",{}),e.jsxs("div",{className:"rounded-2xl border border-[var(--color-accent)]/18 bg-[var(--color-accent)]/8 p-3",children:[e.jsx("div",{className:"hud-label",children:"Trace A"}),e.jsx("div",{className:"mt-1 truncate text-sm font-medium text-[var(--color-text-primary)]",children:s.name}),e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--color-text-tertiary)]",children:s.traceId.slice(0,16)})]}),e.jsxs("div",{className:"rounded-2xl border border-[var(--color-accent-2)]/18 bg-[var(--color-accent-2)]/8 p-3",children:[e.jsx("div",{className:"hud-label",children:"Trace B"}),e.jsx("div",{className:"mt-1 truncate text-sm font-medium text-[var(--color-text-primary)]",children:a.name}),e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--color-text-tertiary)]",children:a.traceId.slice(0,16)})]}),e.jsx("div",{className:"flex items-center justify-center text-[11px] uppercase tracking-[0.18em] text-[var(--color-text-tertiary)]",children:"Delta"})]}),e.jsx(Re,{traceA:s,traceB:a,durA:n,durB:l}),e.jsx("div",{className:"space-y-2",children:f.map(o=>e.jsxs("div",{className:"grid grid-cols-[110px_1fr_1fr_96px] items-center gap-3 rounded-2xl border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.72),rgba(var(--ch-bg-base),0.9))] px-4 py-3",children:[e.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]",children:o.label}),e.jsx("div",{className:`text-sm font-mono ${o.better==="a"?"text-[var(--color-accent)]":(o.better==="tie","text-[var(--color-text-secondary)]")}`,children:o.label==="Status"?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(E,{status:s.status}),o.a]}):o.a}),e.jsx("div",{className:`text-sm font-mono ${o.better==="b"?"text-[var(--color-accent-2)]":(o.better==="tie","text-[var(--color-text-secondary)]")}`,children:o.label==="Status"?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(E,{status:a.status}),o.b]}):o.b}),e.jsx("div",{className:"text-center text-xs font-mono text-[var(--color-text-tertiary)]",children:o.diff??"--"})]},o.label))})]}):e.jsx(ze,{traceA:s,traceB:a})]})}function Ae(){const[s,a]=pe(),h=s.get("q")??"",u=d.useDeferredValue(h),c=s.get("status"),n=c==="ok"||c==="error"?c:"",l=Number(s.get("periodHours")??"24"),f=Number(s.get("pageSize")??"50"),o=te.includes(f)?f:50,v=Math.max(1,Number(s.get("page")??"1")||1),g=(v-1)*o,[r,N]=d.useState(null),[i,b]=d.useState("desc"),[p,H]=d.useState(new Set),[q,Q]=d.useState(null),[oe,z]=d.useState(!1),_=d.useMemo(()=>({limit:o,offset:g,q:u.trim()||void 0,status:n||void 0,periodHours:Y.some(t=>t.value===l)?l:24}),[u,o,g,l,n]),{data:U,isLoading:ce}=me({queryKey:["traces",_],queryFn:()=>fe(_)}),R=U?.traces??[],w=U?.total??0,Z=Math.max(1,Math.ceil(w/o));function ne(t){r===t?b(x=>x==="asc"?"desc":"asc"):(N(t),b("desc"))}const j=d.useMemo(()=>r?[...R].sort((t,x)=>{const m=t[r]??0,y=x[r]??0;return i==="asc"?m-y:y-m}):R,[R,r,i]),D=j.length>0&&j.every(t=>p.has(t.traceId)),ie=d.useCallback(()=>{H(t=>{const x=new Set(t);if(D)for(const m of j)x.delete(m.traceId);else for(const m of j)x.add(m.traceId);return x})},[D,j]),de=d.useCallback(t=>{H(x=>{const m=new Set(x);return m.has(t)?m.delete(t):m.add(t),m})},[]),xe=d.useCallback(()=>{H(new Set),z(!1)},[]),F=d.useMemo(()=>j.filter(t=>p.has(t.traceId)),[j,p]),I=p.size===2,W=h.length>0||n.length>0||_.periodHours!==24;function C(t,x=!0){a(m=>{const y=new URLSearchParams(m);for(const[X,O]of Object.entries(t))O===void 0||O===""?y.delete(X):y.set(X,String(O));return x&&y.delete("page"),y},{replace:!0})}return e.jsxs(e.Fragment,{children:[e.jsxs(ye,{eyebrow:"Trace Explorer",title:"Deep-dive into every trace flowing through the system.",description:"Explore, compare, and inspect individual traces with full visibility into span counts, token usage, cost, and execution timing.",aside:e.jsx("div",{className:"insight-panel",children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"deck-card deck-card--accent",children:[e.jsx("div",{className:"hud-label",children:"Total traces"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("div",{className:"text-[var(--color-text-primary)]",style:{fontFamily:"var(--font-operator)",fontSize:"30px",fontWeight:700,lineHeight:"0.92",letterSpacing:"-0.04em"},children:se(w)}),e.jsx(Me,{className:"h-4 w-4 text-[var(--color-accent)]"})]}),e.jsx("div",{className:"mt-2 text-sm text-[var(--color-text-secondary)]",children:"Matching current filters"})]}),p.size>0&&e.jsxs("div",{className:"deck-card",children:[e.jsx("div",{className:"hud-label",children:"Selected"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsxs("div",{className:"text-lg font-medium text-[var(--color-text-primary)]",children:[p.size," trace",p.size!==1&&"s"]}),e.jsx(K,{className:"h-4 w-4 text-[var(--color-accent)]"})]}),e.jsx("div",{className:"mt-2 text-sm text-[var(--color-text-secondary)]",children:I?"Ready to compare":"Select exactly 2 to compare"})]})]})}),children:[e.jsxs("div",{className:"pill-strip w-fit max-w-full overflow-x-auto",children:[e.jsxs("span",{className:"pill-item",children:["window ",e.jsxs("strong",{children:[_.periodHours,"h"]})]}),e.jsxs("span",{className:"pill-item",children:["selected ",e.jsx("strong",{children:p.size})]}),e.jsxs("span",{className:"pill-item",children:["compare ",e.jsx("strong",{children:I?"ready":"idle"})]}),e.jsxs("span",{className:"pill-item",children:["matches ",e.jsx("strong",{children:w})]})]}),e.jsx(B,{children:p.size>0&&e.jsx(ae.div,{initial:{opacity:0,gridTemplateRows:"0fr"},animate:{opacity:1,gridTemplateRows:"1fr"},exit:{opacity:0,gridTemplateRows:"0fr"},transition:{duration:.25,ease:"easeOut"},style:{display:"grid"},children:e.jsx("div",{className:"overflow-hidden",children:e.jsxs("div",{className:"dashboard-shell flex items-center justify-between gap-4 rounded-[24px] px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"status-chip",children:[e.jsx(V,{className:"h-3.5 w-3.5 text-[var(--color-accent)]"}),e.jsxs("span",{children:[p.size," selected"]})]}),e.jsxs("button",{type:"button",onClick:xe,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)]",children:[e.jsx(Ce,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Clear"})]})]}),e.jsxs("button",{type:"button",disabled:!I,onClick:()=>z(!0),className:`inline-flex items-center gap-2 rounded-[var(--radius-panel)] border px-4 py-2 text-sm font-medium transition-all ${I?"border-[var(--color-accent-2)]/20 bg-[linear-gradient(135deg,rgba(var(--ch-accent-2), 0.14),rgba(var(--ch-accent), 0.08))] text-[var(--color-accent)] hover:bg-[linear-gradient(135deg,rgba(var(--ch-accent-2), 0.24),rgba(var(--ch-accent), 0.14))]":"cursor-not-allowed border-[var(--border-dim)] bg-[rgba(var(--ch-text-primary),0.03)] text-[var(--color-text-tertiary)]"}`,children:[e.jsx(K,{className:"h-4 w-4"}),"Compare traces"]})]})})})}),e.jsx(B,{children:oe&&F.length===2&&e.jsx(Fe,{traceA:F[0],traceB:F[1],onClose:()=>z(!1)})}),e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-4 py-4 sm:px-5 sm:py-5",children:[e.jsxs("div",{className:"surface-strong mb-4 rounded-[24px] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Search console"}),e.jsx("h2",{className:"page-section-title mt-1",children:"Trace explorer"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"status-chip",children:[e.jsx(Te,{className:"h-3.5 w-3.5 text-[var(--color-text-primary)]"}),e.jsxs("span",{children:[w," traces"]})]}),e.jsxs("button",{type:"button",onClick:()=>C({q:void 0,status:void 0,periodHours:void 0}),disabled:!W,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)] disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Clear"})]})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,1.8fr)_minmax(0,0.6fr)_minmax(0,0.6fr)]",children:[e.jsx(we,{value:h,onChange:t=>C({q:t||void 0}),placeholder:"Search by trace name, ID, or keyword..."}),e.jsxs(M,{value:n||"__all__",onValueChange:t=>C({status:t==="__all__"?void 0:t}),children:[e.jsx(P,{className:"w-full rounded-2xl py-3",children:e.jsx($,{placeholder:"All states"})}),e.jsxs(L,{children:[e.jsx(S,{value:"__all__",children:"All states"}),e.jsx(S,{value:"ok",children:"Healthy only"}),e.jsx(S,{value:"error",children:"Errors only"})]})]}),e.jsxs(M,{value:String(_.periodHours??24),onValueChange:t=>C({periodHours:Number(t)===24?void 0:Number(t)}),children:[e.jsx(P,{className:"w-full rounded-2xl py-3",children:e.jsx($,{})}),e.jsx(L,{children:Y.map(t=>e.jsx(S,{value:String(t.value),children:t.label},t.value))})]})]})]}),ce?e.jsx(A,{title:"Loading traces",description:"LLMTap is assembling the explorer feed for the current filter window.",className:"min-h-[400px]"}):j.length===0?W?e.jsx(A,{title:"No traces match these filters",description:"Try adjusting the search term or time window to widen the explorer surface.",className:"min-h-[400px]"}):e.jsx(Ne,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-hidden rounded-[22px] border border-[var(--border-dim)] bg-[linear-gradient(180deg,rgba(var(--ch-bg-panel),0.9),rgba(var(--ch-bg-deep),0.96),rgba(var(--ch-bg-base),0.99))] shadow-[inset_0_1px_0_rgba(var(--ch-text-primary),0.04),0_24px_56px_rgba(0,0,0,0.3)]",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[980px] border-collapse text-sm",children:[e.jsx("thead",{className:"sticky top-0 z-10 bg-[rgba(var(--ch-bg-base),0.94)] backdrop-blur-xl",children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-[var(--color-text-tertiary)]",children:[e.jsx("th",{className:"px-4 py-3 text-center",children:e.jsx("button",{type:"button",onClick:ie,"aria-label":D?"Deselect all traces on page":"Select all traces on page",className:"inline-flex items-center justify-center transition-colors hover:text-[var(--color-text-secondary)]",title:D?"Deselect all":"Select all",children:D?e.jsx(V,{className:"h-4 w-4 text-[var(--color-accent)]"}):e.jsx(ee,{className:"h-4 w-4"})})}),e.jsx("th",{className:"w-10 px-4 py-3",children:"State"}),e.jsx("th",{className:"px-4 py-3",children:"Trace"}),e.jsx("th",{className:"px-4 py-3",children:"ID"}),[["spanCount","Spans"],["totalTokens","Tokens"],["totalCost","Cost"],["startTime","When"]].map(([t,x])=>e.jsx("th",{className:"px-4 py-3 text-right",children:e.jsxs("button",{type:"button",onClick:()=>ne(t),className:"inline-flex items-center gap-1 transition-colors hover:text-[var(--color-text-secondary)]",children:[x,r===t?i==="asc"?e.jsx(ke,{className:"h-3 w-3"}):e.jsx(_e,{className:"h-3 w-3"}):e.jsx(De,{className:"h-3 w-3 opacity-30"})]})},t)),e.jsx("th",{className:"px-4 py-3 text-right",children:"Duration"})]})}),e.jsx("tbody",{children:j.map(t=>{const x=p.has(t.traceId),m=t.totalDuration??(t.endTime?t.endTime-t.startTime:0);return e.jsxs("tr",{onClick:()=>Q(t),className:`cursor-pointer border-t border-[var(--border-dim)] transition-colors ${x?"bg-[var(--color-accent)]/8":"hover:bg-[rgba(var(--ch-text-primary),0.03)]"}`,children:[e.jsx("td",{className:"px-4 py-3.5 text-center",onClick:y=>y.stopPropagation(),children:e.jsx("button",{type:"button",onClick:()=>de(t.traceId),"aria-label":`Select trace ${t.name}`,className:"inline-flex items-center justify-center transition-colors hover:text-[var(--color-accent)]",children:x?e.jsx(V,{className:"h-4 w-4 text-[var(--color-accent)]"}):e.jsx(ee,{className:"h-4 w-4 text-[var(--color-text-tertiary)]"})})}),e.jsx("td",{className:"px-4 py-3.5",children:e.jsx(E,{status:t.status})}),e.jsx("td",{className:"px-4 py-3.5",children:e.jsxs("div",{className:"max-w-[320px]",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--color-text-primary)]",children:t.name}),e.jsxs("div",{className:"mt-1 text-[11px] text-[var(--color-text-tertiary)]",children:[G(t.startTime)," started"]})]})}),e.jsx("td",{className:"px-4 py-3.5",children:e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]",children:t.traceId.slice(0,12)})}),e.jsx("td",{className:"px-4 py-3.5 text-right font-mono text-xs text-[var(--color-text-secondary)]",children:t.spanCount}),e.jsx("td",{className:"px-4 py-3.5 text-right font-mono text-xs text-[var(--color-text-secondary)]",children:t.totalTokens.toLocaleString()}),e.jsx("td",{className:"px-4 py-3.5 text-right font-mono text-xs text-[var(--color-text-secondary)]",children:T(t.totalCost)}),e.jsx("td",{className:"px-4 py-3.5 text-right text-xs text-[var(--color-text-tertiary)]",children:G(t.startTime)}),e.jsx("td",{className:"px-4 py-3.5 text-right font-mono text-xs text-[var(--color-text-secondary)]",children:m>0?k(m):"--"})]},t.traceId)})})]})})}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-xs text-[var(--color-text-tertiary)]",children:w>0?`Showing ${g+1}-${Math.min(g+j.length,w)} of ${w}`:"Awaiting traces"}),e.jsxs(M,{value:String(o),onValueChange:t=>C({pageSize:Number(t)===50?void 0:Number(t)}),children:[e.jsx(P,{className:"w-auto rounded-xl px-2 py-1.5 text-xs",children:e.jsx($,{})}),e.jsx(L,{children:te.map(t=>e.jsxs(S,{value:String(t),children:[t," / page"]},t))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>C({page:v>2?v-1:void 0},!1),disabled:v<=1,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)] disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(Ie,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Previous"})]}),e.jsxs("span",{className:"text-xs text-[var(--color-text-tertiary)]",children:[v," / ",Z]}),e.jsxs("button",{type:"button",onClick:()=>C({page:v+1},!1),disabled:v>=Z,className:"status-chip transition-colors hover:border-[var(--border-default)] hover:bg-[rgba(var(--ch-accent),0.06)] disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("span",{children:"Next"}),e.jsx(le,{className:"h-3.5 w-3.5"})]})]})]})]})]})]}),q&&e.jsx(qe,{trace:q,onClose:()=>Q(null)},q.traceId)]})}export{Ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,R as Ie,j as P}from"./query-DVWnIZNd.js";import{A as We,m as he}from"./motion-CSeNjKbZ.js";import{a as X,q as $e}from"./ui-BFiKdTjl.js";import{c as oe}from"./index-DG2eF3M2.js";import{t as Ke}from"./icons-BOLUIAKd.js";function Re({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=i.useRef(e!==void 0),[s,c]=i.useState(t),u=o?e:s,h=i.useCallback(p=>{o||c(p)},[]);return[u,h]}const me={};function H(e,t){const n=i.useRef(me);return n.current===me&&(n.current=e(t)),n}const Q=Ie[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],qe=Q&&Q!==i.useLayoutEffect?Q:e=>e();function U(e){const t=H(Be).current;return t.next=e,qe(t.effect),t.trampoline}function Be(){const e={next:void 0,callback:ze,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function ze(){}const Ge=()=>{},D=typeof document<"u"?i.useLayoutEffect:Ge,Se=i.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Ye(){return i.useContext(Se)}function Ze(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=U(o),c=i.useRef(0),u=H(Qe).current,h=H(Je).current,[p,g]=i.useState(0),m=i.useRef(p),y=U((f,I)=>{h.set(f,I??null),m.current+=1,g(m.current)}),d=U(f=>{h.delete(f),m.current+=1,g(m.current)}),C=i.useMemo(()=>{const f=new Map;return Array.from(h.keys()).filter(v=>v.isConnected).sort(Xe).forEach((v,l)=>{const b=h.get(v)??{};f.set(v,{...b,index:l})}),f},[h,p]);D(()=>{if(typeof MutationObserver!="function"||C.size===0)return;const f=new MutationObserver(I=>{const v=new Set,l=b=>v.has(b)?v.delete(b):v.add(b);I.forEach(b=>{b.removedNodes.forEach(l),b.addedNodes.forEach(l)}),v.size===0&&(m.current+=1,g(m.current))});return C.forEach((I,v)=>{v.parentElement&&f.observe(v.parentElement,{childList:!0})}),()=>{f.disconnect()}},[C]),D(()=>{m.current===p&&(n.current.length!==C.size&&(n.current.length=C.size),r&&r.current.length!==C.size&&(r.current.length=C.size),c.current=C.size),s(C)},[s,C,n,r,p]),D(()=>()=>{n.current=[]},[n]),D(()=>()=>{r&&(r.current=[])},[r]);const k=U(f=>(u.add(f),()=>{u.delete(f)}));D(()=>{u.forEach(f=>f(C))},[u,C]);const A=i.useMemo(()=>({register:y,unregister:d,subscribeMapChange:k,elementsRef:n,labelsRef:r,nextIndexRef:c}),[y,d,k,n,r,c]);return P.jsx(Se.Provider,{value:A,children:t})}function Je(){return new Map}function Qe(){return new Set}function Xe(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const et=i.createContext(void 0);function tt(){return i.useContext(et)?.direction??"ltr"}function K(e,...t){const n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${n} for the full message.`}const ke=i.createContext(void 0);function se(){const e=i.useContext(ke);if(e===void 0)throw new Error(K(10));return e}function Z(e,t,n,r){const o=H(Ee).current;return rt(o,e,t,n,r)&&Oe(o,[e,t,n,r]),o.callback}function nt(e){const t=H(Ee).current;return ot(t,e)&&Oe(t,e),t.callback}function Ee(){return{callback:null,cleanup:null,refs:[]}}function rt(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function ot(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function Oe(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const c=s(n);typeof c=="function"&&(r[o]=c);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const c=r[o];typeof c=="function"?c():s(null);break}case"object":{s.current=null;break}}}}}}}const st=parseInt(i.version,10);function it(e){return st>=e}function ge(e){if(!i.isValidElement(e))return null;const t=e,n=t.props;return(it(19)?n?.ref:t.ref)??null}function ee(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function at(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function ct(e,t){return typeof e=="function"?e(t):e}function ut(e,t){return typeof e=="function"?e(t):e}const W={};function Pe(e,t,n,r,o){let s={...te(e,W)};return t&&(s=Y(s,t)),n&&(s=Y(s,n)),r&&(s=Y(s,r)),s}function lt(e){if(e.length===0)return W;if(e.length===1)return te(e[0],W);let t={...te(e[0],W)};for(let n=1;n<e.length;n+=1)t=Y(t,e[n]);return t}function Y(e,t){return Ae(t)?t(e):dt(e,t)}function dt(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=ee(e.style,r);break}case"className":{e[n]=Me(e.className,r);break}default:ft(n,r)?e[n]=pt(e[n],r):e[n]=r}}return e}function ft(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function Ae(e){return typeof e=="function"}function te(e,t){return Ae(e)?e(t):e??W}function pt(e,t){return t?e?n=>{if(ht(n)){const o=n;ne(o);const s=t(o);return o.baseUIHandlerPrevented||e?.(o),s}const r=t(n);return e?.(n),r}:t:e}function ne(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Me(e,t){return t?e?t+" "+e:t:e}function ht(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}const _=Object.freeze({});function q(e,t,n={}){const r=t.render,o=mt(t,n);if(n.enabled===!1)return null;const s=n.state??_;return gt(e,r,o,s)}function mt(e,t={}){const{className:n,style:r,render:o}=e,{state:s=_,ref:c,props:u,stateAttributesMapping:h,enabled:p=!0}=t,g=p?ct(n,s):void 0,m=p?ut(r,s):void 0,y=p?at(s,h):_,d=p?ee(y,Array.isArray(u)?lt(u):u)??_:_;return typeof document<"u"&&(p?Array.isArray(c)?d.ref=nt([d.ref,ge(o),...c]):d.ref=Z(d.ref,ge(o),c):Z(null,null)),p?(g!==void 0&&(d.className=Me(d.className,g)),m!==void 0&&(d.style=ee(d.style,m)),d):_}function gt(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=Pe(n,t.props);return o.ref=n.ref,i.cloneElement(t,o)}if(e&&typeof e=="string")return bt(e,n);throw new Error(K(8))}function bt(e,t){return e==="button"?i.createElement("button",{type:"button",...t,key:t.key}):e==="img"?i.createElement("img",{alt:"",...t,key:t.key}):i.createElement(e,t)}const we="none",xt="trigger-press";function ie(e,t,n,r){let o=!1,s=!1;const c=_;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...c}}const yt={value:()=>null},Ct=i.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,hiddenUntilFound:c,keepMounted:u,loopFocus:h=!0,onValueChange:p,multiple:g=!1,orientation:m="vertical",value:y,defaultValue:d,...C}=t,k=tt(),A=i.useMemo(()=>{if(y===void 0)return d??[]},[y,d]),f=U(p),I=i.useRef([]),[v,l]=Re({controlled:y,default:A,name:"Accordion",state:"value"}),b=U((O,L)=>{const M=ie(we);if(g)if(L){const a=v.slice();if(a.push(O),f(a,M),M.isCanceled)return;l(a)}else{const a=v.filter(S=>S!==O);if(f(a,M),M.isCanceled)return;l(a)}else{const a=v[0]===O?[]:[O];if(f(a,M),M.isCanceled)return;l(a)}}),w=i.useMemo(()=>({value:v,disabled:s,orientation:m}),[v,s,m]),T=i.useMemo(()=>({accordionItemRefs:I,direction:k,disabled:s,handleValueChange:b,hiddenUntilFound:c??!1,keepMounted:u??!1,loopFocus:h,orientation:m,state:w,value:v}),[k,s,b,c,u,h,m,w,v]),j=q("div",t,{state:w,ref:n,props:[{dir:k,role:"region"},C],stateAttributesMapping:yt});return P.jsx(ke.Provider,{value:T,children:P.jsx(Ze,{elementsRef:I,children:j})})}),vt={...Ie};let be=0;function It(e,t="mui"){const[n,r]=i.useState(e),o=e||n;return i.useEffect(()=>{n==null&&(be+=1,r(`${t}-${be}`))},[n,t]),o}const xe=vt.useId;function Rt(e,t){if(xe!==void 0){const n=xe();return`${t}-${n}`}return It(e,t)}function re(e){return Rt(e,"base-ui")}const St=[];function Ne(e){i.useEffect(e,St)}const z=null;class kt{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const G=new kt;class N{static create(){return new N}static request(t){return G.request(t)}static cancel(t){return G.cancel(t)}currentId=z;request(t){this.cancel(),this.currentId=G.request(()=>{this.currentId=z,t()})}cancel=()=>{this.currentId!==z&&(G.cancel(this.currentId),this.currentId=z)};disposeEffect=()=>this.cancel}function De(){const e=H(N.create).current;return Ne(e.disposeEffect),e}function Et(e){return e==null?e:"current"in e?e.current:e}function Te(e,t=!1,n=!0){const r=De();return U((o,s=null)=>{r.cancel();const c=Et(e);c!=null&&(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?o():r.request(()=>{function u(){c&&Promise.all(c.getAnimations().map(h=>h.finished)).then(()=>{s!=null&&s.aborted||X.flushSync(o)}).catch(()=>{if(n){if(s!=null&&s.aborted)return;X.flushSync(o)}else c.getAnimations().length>0&&c.getAnimations().some(h=>h.pending||h.playState!=="finished")&&u()})}t?r.request(u):u()}))})}function Ot(e,t=!1,n=!1){const[r,o]=i.useState(e&&t?"idle":void 0),[s,c]=i.useState(e);return e&&!s&&(c(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),D(()=>{if(!e&&s&&r!=="ending"&&n){const u=N.request(()=>{o("ending")});return()=>{N.cancel(u)}}},[e,s,r,n]),D(()=>{if(!e||t)return;const u=N.request(()=>{X.flushSync(()=>{o(void 0)})});return()=>{N.cancel(u)}},[t,e]),D(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const u=N.request(()=>{o("idle")});return()=>{N.cancel(u)}},[t,e,s,o,r]),i.useMemo(()=>({mounted:s,setMounted:c,transitionStatus:r}),[s,r])}function Pt(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:o}=e,s=t!==void 0,[c,u]=Re({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:h,setMounted:p,transitionStatus:g}=Ot(c,!0,!0),[m,y]=i.useState(c),[{height:d,width:C},k]=i.useState({height:void 0,width:void 0}),A=re(),[f,I]=i.useState(),v=f??A,[l,b]=i.useState(!1),[w,T]=i.useState(!1),j=i.useRef(null),O=i.useRef(null),L=i.useRef(null),M=i.useRef(null),a=Te(M,!1),S=U(R=>{const x=!c,E=ie(xt,R.nativeEvent);if(r(x,E),E.isCanceled)return;const F=M.current;O.current==="css-animation"&&F!=null&&F.style.removeProperty("animation-name"),!l&&!w&&(O.current!=null&&O.current!=="css-animation"&&!h&&x&&p(!0),O.current==="css-animation"&&(!m&&x&&y(!0),!h&&x&&p(!0))),u(x),O.current==="none"&&h&&!x&&p(!1)});return D(()=>{s&&O.current==="none"&&!w&&!c&&p(!1)},[s,w,c,t,p]),i.useMemo(()=>({abortControllerRef:j,animationTypeRef:O,disabled:o,handleTrigger:S,height:d,mounted:h,open:c,panelId:v,panelRef:M,runOnceAnimationsFinish:a,setDimensions:k,setHiddenUntilFound:b,setKeepMounted:T,setMounted:p,setOpen:u,setPanelIdState:I,setVisible:y,transitionDimensionRef:L,transitionStatus:g,visible:m,width:C}),[j,O,o,S,d,h,c,v,M,a,k,b,T,p,u,y,L,g,m,C])}const je=i.createContext(void 0);function Fe(){const e=i.useContext(je);if(e===void 0)throw new Error(K(15));return e}let At=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Mt(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:c,unregister:u,subscribeMapChange:h,elementsRef:p,labelsRef:g,nextIndexRef:m}=Ye(),y=i.useRef(-1),[d,C]=i.useState(s??(o===At.GuessFromOrder?()=>{if(y.current===-1){const f=m.current;m.current+=1,y.current=f}return y.current}:-1)),k=i.useRef(null),A=i.useCallback(f=>{if(k.current=f,d!==-1&&f!==null&&(p.current[d]=f,g)){const I=t!==void 0;g.current[d]=I?t:r?.current?.textContent??f.textContent}},[d,p,g,t,r]);return D(()=>{if(s!=null)return;const f=k.current;if(f)return c(f,n),()=>{u(f)}},[s,c,u,n]),D(()=>{if(s==null)return h(f=>{const I=k.current?f.get(k.current)?.index:null;I!=null&&C(I)})},[s,h,C]),i.useMemo(()=>({ref:A,index:d}),[d,A])}const Ue=i.createContext(void 0);function ae(){const e=i.useContext(Ue);if(e===void 0)throw new Error(K(9));return e}let J=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const wt={[J.startingStyle]:""},Nt={[J.endingStyle]:""},Dt={transitionStatus(e){return e==="starting"?wt:e==="ending"?Nt:null}};let $=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=J.startingStyle]="startingStyle",e[e.endingStyle=J.endingStyle]="endingStyle",e})({}),Tt=(function(e){return e.panelOpen="data-panel-open",e})({});const jt={[$.open]:""},Ft={[$.closed]:""},Ut={open(e){return e?{[Tt.panelOpen]:""}:null}},Lt={open(e){return e?jt:Ft}};let Vt=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const ce={...Lt,index:e=>Number.isInteger(e)?{[Vt.index]:String(e)}:null,...Dt,value:()=>null},_t=i.forwardRef(function(t,n){const{className:r,disabled:o=!1,onOpenChange:s,render:c,value:u,...h}=t,{ref:p,index:g}=Mt(),m=Z(n,p),{disabled:y,handleValueChange:d,state:C,value:k}=se(),A=re(),f=u??A,I=o||y,v=i.useMemo(()=>{if(!k)return!1;for(let S=0;S<k.length;S+=1)if(k[S]===f)return!0;return!1},[k,f]),l=U((S,R)=>{s?.(S,R),!R.isCanceled&&d(f,S)}),b=Pt({open:v,onOpenChange:l,disabled:I}),w=i.useMemo(()=>({open:b.open,disabled:b.disabled,hidden:!b.mounted,transitionStatus:b.transitionStatus}),[b.open,b.disabled,b.mounted,b.transitionStatus]),T=i.useMemo(()=>({...b,onOpenChange:l,state:w}),[b,w,l]),j=i.useMemo(()=>({...C,index:g,disabled:I,open:v}),[I,g,v,C]),[O,L]=i.useState(re()),M=i.useMemo(()=>({open:v,state:j,setTriggerId:L,triggerId:O}),[v,j,L,O]),a=q("div",t,{state:j,ref:m,props:h,stateAttributesMapping:ce});return P.jsx(je.Provider,{value:T,children:P.jsx(Ue.Provider,{value:M,children:a})})}),Ht=i.forwardRef(function(t,n){const{render:r,className:o,...s}=t,{state:c}=ae();return q("h3",t,{state:c,ref:n,props:s,stateAttributesMapping:ce})});function ye(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const Wt=i.createContext(void 0);function $t(e=!1){const t=i.useContext(Wt);if(t===void 0&&!e)throw new Error(K(16));return t}function Kt(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,c=r&&t!==!1,u=r&&t===!1;return{props:i.useMemo(()=>{const p={onKeyDown(g){n&&t&&g.key!=="Tab"&&g.preventDefault()}};return r||(p.tabIndex=o,!s&&n&&(p.tabIndex=t?o:-1)),(s&&(t||c)||!s&&n)&&(p["aria-disabled"]=n),s&&(!t||u)&&(p.disabled=n),p},[r,n,t,c,u,s,o])}}function qt(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=e,s=i.useRef(null),c=$t(!0)!==void 0,u=U(()=>{const y=s.current;return!!(y?.tagName==="A"&&y?.href)}),{props:h}=Kt({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:o}),p=i.useCallback(()=>{const y=s.current;Bt(y)&&c&&t&&h.disabled===void 0&&y.disabled&&(y.disabled=!1)},[t,h.disabled,c]);D(p,[p]);const g=i.useCallback((y={})=>{const{onClick:d,onMouseDown:C,onKeyUp:k,onKeyDown:A,onPointerDown:f,...I}=y;return Pe({type:o?"button":void 0,onClick(l){if(t){l.preventDefault();return}d?.(l)},onMouseDown(l){t||C?.(l)},onKeyDown(l){if(t||(ne(l),A?.(l)),l.baseUIHandlerPrevented)return;const b=l.target===l.currentTarget&&!o&&!u()&&!t,w=l.key==="Enter",T=l.key===" ";b&&((T||w)&&l.preventDefault(),w&&d?.(l))},onKeyUp(l){t||(ne(l),k?.(l)),!l.baseUIHandlerPrevented&&l.target===l.currentTarget&&!o&&!t&&l.key===" "&&d?.(l)},onPointerDown(l){if(t){l.preventDefault();return}f?.(l)}},o?void 0:{role:"button"},h,I)},[t,h,o,u]),m=U(y=>{s.current=y,p()});return{getButtonProps:g,buttonRef:m}}function Bt(e){return $e(e)&&e.tagName==="BUTTON"}function zt(e){e.preventDefault(),e.stopPropagation()}const ue="ArrowUp",le="ArrowDown",de="ArrowLeft",fe="ArrowRight",Le="Home",Ve="End",Gt=new Set([de,fe]),Yt=new Set([ue,le]),Zt=new Set([...Gt,...Yt]);[...Zt];const Jt=new Set([le,ue,fe,de,Le,Ve]);function Qt(e){const{current:t}=e,n=[];for(let r=0;r<t.length;r+=1){const o=t[r];if(!ye(o)){const s=o?.querySelector('[type="button"]');ye(s)||n.push(s)}}return n}const Xt=i.forwardRef(function(t,n){const{disabled:r,className:o,id:s,render:c,nativeButton:u=!0,...h}=t,{panelId:p,open:g,handleTrigger:m,disabled:y}=Fe(),d=r??y,{getButtonProps:C,buttonRef:k}=qt({disabled:d,focusableWhenDisabled:!0,native:u}),{accordionItemRefs:A,direction:f,loopFocus:I,orientation:v}=se(),l=f==="rtl",b=v==="horizontal",{state:w,setTriggerId:T,triggerId:j}=ae();D(()=>(s&&T(s),()=>{T(void 0)}),[s,T]);const O=i.useMemo(()=>({"aria-controls":g?p:void 0,"aria-expanded":g,disabled:d,id:j,onClick:m,onKeyDown(M){if(!Jt.has(M.key))return;zt(M);const a=Qt(A),R=a.length-1;let x=-1;const E=a.indexOf(M.target);function F(){I?x=E+1>R?0:E+1:x=Math.min(E+1,R)}function V(){I?x=E===0?R:E-1:x=E-1}switch(M.key){case le:b||F();break;case ue:b||V();break;case fe:b&&(l?V():F());break;case de:b&&(l?F():V());break;case"Home":x=0;break;case"End":x=R;break}x>-1&&a[x].focus()}}),[A,d,m,j,b,l,I,g,p]);return q("button",t,{state:w,ref:[n,k],props:[O,h,C],stateAttributesMapping:Ut})});let en=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function tn(e){const{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:o,hiddenUntilFound:s,keepMounted:c,id:u,mounted:h,onOpenChange:p,open:g,panelRef:m,runOnceAnimationsFinish:y,setDimensions:d,setMounted:C,setOpen:k,setVisible:A,transitionDimensionRef:f,visible:I,width:v}=e,l=i.useRef(!1),b=i.useRef(null),w=i.useRef(g),T=i.useRef(g),j=De(),O=i.useMemo(()=>n.current==="css-animation"?!I:!g&&!h,[g,h,I,n]),L=U(a=>{if(!a)return;if(n.current==null||f.current==null){const x=getComputedStyle(a),E=x.animationName!=="none"&&x.animationName!=="",F=x.transitionDuration!=="0s"&&x.transitionDuration!=="";E&&F||(x.animationName==="none"&&x.transitionDuration!=="0s"?n.current="css-transition":x.animationName!=="none"&&x.transitionDuration==="0s"?n.current="css-animation":n.current="none"),a.getAttribute(en.orientation)==="horizontal"||x.transitionProperty.indexOf("width")>-1?f.current="width":f.current="height"}if(n.current!=="css-transition")return;(o===void 0||v===void 0)&&(d({height:a.scrollHeight,width:a.scrollWidth}),T.current&&a.style.setProperty("transition-duration","0s"));let S=-1,R=-1;return S=N.request(()=>{T.current=!1,R=N.request(()=>{setTimeout(()=>{a.style.removeProperty("transition-duration")})})}),()=>{N.cancel(S),N.cancel(R)}}),M=Z(r,m,L);return D(()=>{if(n.current!=="css-transition")return;const a=m.current;if(!a)return;let S=-1;if(t.current!=null&&(t.current.abort(),t.current=null),g){const R={"justify-content":a.style.justifyContent,"align-items":a.style.alignItems,"align-content":a.style.alignContent,"justify-items":a.style.justifyItems};Object.keys(R).forEach(x=>{a.style.setProperty(x,"initial","important")}),!T.current&&!c&&a.setAttribute($.startingStyle,""),d({height:a.scrollHeight,width:a.scrollWidth}),S=N.request(()=>{Object.entries(R).forEach(([x,E])=>{E===""?a.style.removeProperty(x):a.style.setProperty(x,E)})})}else{if(a.scrollHeight===0&&a.scrollWidth===0)return;d({height:a.scrollHeight,width:a.scrollWidth});const R=new AbortController;t.current=R;const x=R.signal;let E=null;const F=$.endingStyle;return E=new MutationObserver(V=>{V.some(B=>B.type==="attributes"&&B.attributeName===F)&&(E?.disconnect(),E=null,y(()=>{d({height:0,width:0}),a.style.removeProperty("content-visibility"),C(!1),t.current===R&&(t.current=null)},x))}),E.observe(a,{attributes:!0,attributeFilter:[F]}),()=>{E?.disconnect(),j.cancel(),t.current===R&&(R.abort(),t.current=null)}}return()=>{N.cancel(S)}},[t,n,j,s,c,h,g,m,y,d,C]),D(()=>{if(n.current!=="css-animation")return;const a=m.current;a&&(b.current=a.style.animationName||b.current,a.style.setProperty("animation-name","none"),d({height:a.scrollHeight,width:a.scrollWidth}),!w.current&&!l.current&&a.style.removeProperty("animation-name"),g?(t.current!=null&&(t.current.abort(),t.current=null),C(!0),A(!0)):(t.current=new AbortController,y(()=>{C(!1),A(!1),t.current=null},t.current.signal)))},[t,n,g,m,y,d,C,A,I]),Ne(()=>{const a=N.request(()=>{w.current=!1});return()=>N.cancel(a)}),D(()=>{if(!s)return;const a=m.current;if(!a)return;let S=-1,R=-1;return g&&l.current&&(a.style.transitionDuration="0s",d({height:a.scrollHeight,width:a.scrollWidth}),S=N.request(()=>{l.current=!1,R=N.request(()=>{setTimeout(()=>{a.style.removeProperty("transition-duration")})})})),()=>{N.cancel(S),N.cancel(R)}},[s,g,m,d]),D(()=>{const a=m.current;a&&s&&O&&(a.setAttribute("hidden","until-found"),n.current==="css-transition"&&a.setAttribute($.startingStyle,""))},[s,O,n,m]),i.useEffect(function(){const S=m.current;if(!S)return;function R(x){l.current=!0,k(!0),p(!0,ie(we,x))}return S.addEventListener("beforematch",R),()=>{S.removeEventListener("beforematch",R)}},[p,m,k]),i.useMemo(()=>({props:{hidden:O,id:u,ref:M}}),[O,u,M])}let Ce=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});function nn(e){const t=H(rn,e).current;return t.next=e,D(t.effect),t}function rn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function on(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=nn(n),c=U(o),u=Te(r,n);i.useEffect(()=>{t&&u(()=>{n===s.current&&c()})},[t,n,c,u,s])}const ve=i.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,id:c,render:u,...h}=t,{hiddenUntilFound:p,keepMounted:g}=se(),{abortControllerRef:m,animationTypeRef:y,height:d,mounted:C,onOpenChange:k,open:A,panelId:f,panelRef:I,runOnceAnimationsFinish:v,setDimensions:l,setHiddenUntilFound:b,setKeepMounted:w,setMounted:T,setOpen:j,setVisible:O,transitionDimensionRef:L,visible:M,width:a,setPanelIdState:S,transitionStatus:R}=Fe(),x=o??p,E=s??g;D(()=>{if(c)return S(c),()=>{S(void 0)}},[c,S]),D(()=>{b(x)},[b,x]),D(()=>{w(E)},[w,E]),on({open:A&&R==="idle",ref:I,onComplete(){A&&l({width:void 0,height:void 0})}});const{props:F}=tn({abortControllerRef:m,animationTypeRef:y,externalRef:n,height:d,hiddenUntilFound:x,id:c??f,keepMounted:E,mounted:C,onOpenChange:k,open:A,panelRef:I,runOnceAnimationsFinish:v,setDimensions:l,setMounted:T,setOpen:j,setVisible:O,transitionDimensionRef:L,visible:M,width:a}),{state:V,triggerId:pe}=ae(),B=i.useMemo(()=>({...V,transitionStatus:R}),[V,R]),He=q("div",t,{state:B,ref:[n,I],props:[F,{"aria-labelledby":pe,role:"region",style:{[Ce.accordionPanelHeight]:d===void 0?"auto":`${d}px`,[Ce.accordionPanelWidth]:a===void 0?"auto":`${a}px`}},h],stateAttributesMapping:ce});return E||x||!E&&C?He:null});function _e(e){const t=i.createContext(void 0);return[({value:o,children:s})=>P.jsx(t.Provider,{value:o,children:s}),()=>{const o=i.useContext(t);if(o===void 0)throw new Error(`useContext must be used within ${e??"a Provider"}`);return o}]}function sn(e){const{value:t,defaultValue:n,onChange:r}=e,[o,s]=i.useState(t!==void 0?t:n);i.useEffect(()=>{t!==void 0&&s(t)},[t]);const c=i.useCallback((u,...h)=>{s(u),r?.(u,...h)},[r]);return[o,c]}const[an,cn]=_e("AccordionContext"),[un,ln]=_e("AccordionItemContext");function dn(e){const[t,n]=sn({value:e?.value,defaultValue:e?.defaultValue,onChange:e?.onValueChange});return P.jsx(an,{value:{value:t,setValue:n},children:P.jsx(Ct,{"data-slot":"accordion",...e,onValueChange:n})})}function fn(e){const{value:t}=cn(),[n,r]=i.useState(t?.includes(e?.value)??!1);return i.useEffect(()=>{r(t?.includes(e?.value)??!1)},[t,e?.value]),P.jsx(un,{value:{isOpen:n,setIsOpen:r},children:P.jsx(_t,{"data-slot":"accordion-item",...e})})}function pn(e){return P.jsx(Ht,{"data-slot":"accordion-header",...e})}function hn(e){return P.jsx(Xt,{"data-slot":"accordion-trigger",...e})}function mn({transition:e={duration:.35,ease:"easeInOut"},hiddenUntilFound:t,keepRendered:n=!1,...r}){const{isOpen:o}=ln();return P.jsx(We,{children:n?P.jsx(ve,{hidden:!1,hiddenUntilFound:t,keepMounted:!0,render:P.jsx(he.div,{"data-slot":"accordion-panel",initial:{height:0,opacity:0,"--mask-stop":"0%",y:20},animate:o?{height:"auto",opacity:1,"--mask-stop":"100%",y:0}:{height:0,opacity:0,"--mask-stop":"0%",y:20},transition:e,style:{maskImage:"linear-gradient(black var(--mask-stop), transparent var(--mask-stop))",WebkitMaskImage:"linear-gradient(black var(--mask-stop), transparent var(--mask-stop))",overflow:"hidden"},...r},"accordion-panel")}):o&&P.jsx(ve,{hidden:!1,hiddenUntilFound:t,keepMounted:!0,render:P.jsx(he.div,{"data-slot":"accordion-panel",initial:{height:0,opacity:0,"--mask-stop":"0%",y:20},animate:{height:"auto",opacity:1,"--mask-stop":"100%",y:0},exit:{height:0,opacity:0,"--mask-stop":"0%",y:20},transition:e,style:{maskImage:"linear-gradient(black var(--mask-stop), transparent var(--mask-stop))",WebkitMaskImage:"linear-gradient(black var(--mask-stop), transparent var(--mask-stop))",overflow:"hidden"},...r},"accordion-panel")})})}function In(e){return P.jsx(dn,{...e})}function Rn({className:e,...t}){return P.jsx(fn,{className:oe("border-b last:border-b-0",e),...t})}function Sn({className:e,children:t,showArrow:n=!0,...r}){return P.jsx(pn,{className:"flex",children:P.jsxs(hn,{className:oe("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-panel-open]>svg]:rotate-180",e),...r,children:[t,n&&P.jsx(Ke,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function kn({className:e,children:t,...n}){return P.jsx(mn,{...n,children:P.jsx("div",{className:oe("text-sm pt-0 pb-4",e),children:t})})}export{In as A,Rn as a,Sn as b,kn as c};
|
|
1
|
+
import{r as i,R as Ie,j as P}from"./query-DVWnIZNd.js";import{A as We,m as he}from"./motion-CSeNjKbZ.js";import{a as X,q as $e}from"./ui-BFiKdTjl.js";import{c as oe}from"./index-BCjwgtkq.js";import{t as Ke}from"./icons-BOLUIAKd.js";function Re({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=i.useRef(e!==void 0),[s,c]=i.useState(t),u=o?e:s,h=i.useCallback(p=>{o||c(p)},[]);return[u,h]}const me={};function H(e,t){const n=i.useRef(me);return n.current===me&&(n.current=e(t)),n}const Q=Ie[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],qe=Q&&Q!==i.useLayoutEffect?Q:e=>e();function U(e){const t=H(Be).current;return t.next=e,qe(t.effect),t.trampoline}function Be(){const e={next:void 0,callback:ze,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function ze(){}const Ge=()=>{},D=typeof document<"u"?i.useLayoutEffect:Ge,Se=i.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Ye(){return i.useContext(Se)}function Ze(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=U(o),c=i.useRef(0),u=H(Qe).current,h=H(Je).current,[p,g]=i.useState(0),m=i.useRef(p),y=U((f,I)=>{h.set(f,I??null),m.current+=1,g(m.current)}),d=U(f=>{h.delete(f),m.current+=1,g(m.current)}),C=i.useMemo(()=>{const f=new Map;return Array.from(h.keys()).filter(v=>v.isConnected).sort(Xe).forEach((v,l)=>{const b=h.get(v)??{};f.set(v,{...b,index:l})}),f},[h,p]);D(()=>{if(typeof MutationObserver!="function"||C.size===0)return;const f=new MutationObserver(I=>{const v=new Set,l=b=>v.has(b)?v.delete(b):v.add(b);I.forEach(b=>{b.removedNodes.forEach(l),b.addedNodes.forEach(l)}),v.size===0&&(m.current+=1,g(m.current))});return C.forEach((I,v)=>{v.parentElement&&f.observe(v.parentElement,{childList:!0})}),()=>{f.disconnect()}},[C]),D(()=>{m.current===p&&(n.current.length!==C.size&&(n.current.length=C.size),r&&r.current.length!==C.size&&(r.current.length=C.size),c.current=C.size),s(C)},[s,C,n,r,p]),D(()=>()=>{n.current=[]},[n]),D(()=>()=>{r&&(r.current=[])},[r]);const k=U(f=>(u.add(f),()=>{u.delete(f)}));D(()=>{u.forEach(f=>f(C))},[u,C]);const A=i.useMemo(()=>({register:y,unregister:d,subscribeMapChange:k,elementsRef:n,labelsRef:r,nextIndexRef:c}),[y,d,k,n,r,c]);return P.jsx(Se.Provider,{value:A,children:t})}function Je(){return new Map}function Qe(){return new Set}function Xe(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const et=i.createContext(void 0);function tt(){return i.useContext(et)?.direction??"ltr"}function K(e,...t){const n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${n} for the full message.`}const ke=i.createContext(void 0);function se(){const e=i.useContext(ke);if(e===void 0)throw new Error(K(10));return e}function Z(e,t,n,r){const o=H(Ee).current;return rt(o,e,t,n,r)&&Oe(o,[e,t,n,r]),o.callback}function nt(e){const t=H(Ee).current;return ot(t,e)&&Oe(t,e),t.callback}function Ee(){return{callback:null,cleanup:null,refs:[]}}function rt(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function ot(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function Oe(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const c=s(n);typeof c=="function"&&(r[o]=c);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const c=r[o];typeof c=="function"?c():s(null);break}case"object":{s.current=null;break}}}}}}}const st=parseInt(i.version,10);function it(e){return st>=e}function ge(e){if(!i.isValidElement(e))return null;const t=e,n=t.props;return(it(19)?n?.ref:t.ref)??null}function ee(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function at(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function ct(e,t){return typeof e=="function"?e(t):e}function ut(e,t){return typeof e=="function"?e(t):e}const W={};function Pe(e,t,n,r,o){let s={...te(e,W)};return t&&(s=Y(s,t)),n&&(s=Y(s,n)),r&&(s=Y(s,r)),s}function lt(e){if(e.length===0)return W;if(e.length===1)return te(e[0],W);let t={...te(e[0],W)};for(let n=1;n<e.length;n+=1)t=Y(t,e[n]);return t}function Y(e,t){return Ae(t)?t(e):dt(e,t)}function dt(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=ee(e.style,r);break}case"className":{e[n]=Me(e.className,r);break}default:ft(n,r)?e[n]=pt(e[n],r):e[n]=r}}return e}function ft(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function Ae(e){return typeof e=="function"}function te(e,t){return Ae(e)?e(t):e??W}function pt(e,t){return t?e?n=>{if(ht(n)){const o=n;ne(o);const s=t(o);return o.baseUIHandlerPrevented||e?.(o),s}const r=t(n);return e?.(n),r}:t:e}function ne(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Me(e,t){return t?e?t+" "+e:t:e}function ht(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}const _=Object.freeze({});function q(e,t,n={}){const r=t.render,o=mt(t,n);if(n.enabled===!1)return null;const s=n.state??_;return gt(e,r,o,s)}function mt(e,t={}){const{className:n,style:r,render:o}=e,{state:s=_,ref:c,props:u,stateAttributesMapping:h,enabled:p=!0}=t,g=p?ct(n,s):void 0,m=p?ut(r,s):void 0,y=p?at(s,h):_,d=p?ee(y,Array.isArray(u)?lt(u):u)??_:_;return typeof document<"u"&&(p?Array.isArray(c)?d.ref=nt([d.ref,ge(o),...c]):d.ref=Z(d.ref,ge(o),c):Z(null,null)),p?(g!==void 0&&(d.className=Me(d.className,g)),m!==void 0&&(d.style=ee(d.style,m)),d):_}function gt(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=Pe(n,t.props);return o.ref=n.ref,i.cloneElement(t,o)}if(e&&typeof e=="string")return bt(e,n);throw new Error(K(8))}function bt(e,t){return e==="button"?i.createElement("button",{type:"button",...t,key:t.key}):e==="img"?i.createElement("img",{alt:"",...t,key:t.key}):i.createElement(e,t)}const we="none",xt="trigger-press";function ie(e,t,n,r){let o=!1,s=!1;const c=_;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...c}}const yt={value:()=>null},Ct=i.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,hiddenUntilFound:c,keepMounted:u,loopFocus:h=!0,onValueChange:p,multiple:g=!1,orientation:m="vertical",value:y,defaultValue:d,...C}=t,k=tt(),A=i.useMemo(()=>{if(y===void 0)return d??[]},[y,d]),f=U(p),I=i.useRef([]),[v,l]=Re({controlled:y,default:A,name:"Accordion",state:"value"}),b=U((O,L)=>{const M=ie(we);if(g)if(L){const a=v.slice();if(a.push(O),f(a,M),M.isCanceled)return;l(a)}else{const a=v.filter(S=>S!==O);if(f(a,M),M.isCanceled)return;l(a)}else{const a=v[0]===O?[]:[O];if(f(a,M),M.isCanceled)return;l(a)}}),w=i.useMemo(()=>({value:v,disabled:s,orientation:m}),[v,s,m]),T=i.useMemo(()=>({accordionItemRefs:I,direction:k,disabled:s,handleValueChange:b,hiddenUntilFound:c??!1,keepMounted:u??!1,loopFocus:h,orientation:m,state:w,value:v}),[k,s,b,c,u,h,m,w,v]),j=q("div",t,{state:w,ref:n,props:[{dir:k,role:"region"},C],stateAttributesMapping:yt});return P.jsx(ke.Provider,{value:T,children:P.jsx(Ze,{elementsRef:I,children:j})})}),vt={...Ie};let be=0;function It(e,t="mui"){const[n,r]=i.useState(e),o=e||n;return i.useEffect(()=>{n==null&&(be+=1,r(`${t}-${be}`))},[n,t]),o}const xe=vt.useId;function Rt(e,t){if(xe!==void 0){const n=xe();return`${t}-${n}`}return It(e,t)}function re(e){return Rt(e,"base-ui")}const St=[];function Ne(e){i.useEffect(e,St)}const z=null;class kt{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const G=new kt;class N{static create(){return new N}static request(t){return G.request(t)}static cancel(t){return G.cancel(t)}currentId=z;request(t){this.cancel(),this.currentId=G.request(()=>{this.currentId=z,t()})}cancel=()=>{this.currentId!==z&&(G.cancel(this.currentId),this.currentId=z)};disposeEffect=()=>this.cancel}function De(){const e=H(N.create).current;return Ne(e.disposeEffect),e}function Et(e){return e==null?e:"current"in e?e.current:e}function Te(e,t=!1,n=!0){const r=De();return U((o,s=null)=>{r.cancel();const c=Et(e);c!=null&&(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?o():r.request(()=>{function u(){c&&Promise.all(c.getAnimations().map(h=>h.finished)).then(()=>{s!=null&&s.aborted||X.flushSync(o)}).catch(()=>{if(n){if(s!=null&&s.aborted)return;X.flushSync(o)}else c.getAnimations().length>0&&c.getAnimations().some(h=>h.pending||h.playState!=="finished")&&u()})}t?r.request(u):u()}))})}function Ot(e,t=!1,n=!1){const[r,o]=i.useState(e&&t?"idle":void 0),[s,c]=i.useState(e);return e&&!s&&(c(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),D(()=>{if(!e&&s&&r!=="ending"&&n){const u=N.request(()=>{o("ending")});return()=>{N.cancel(u)}}},[e,s,r,n]),D(()=>{if(!e||t)return;const u=N.request(()=>{X.flushSync(()=>{o(void 0)})});return()=>{N.cancel(u)}},[t,e]),D(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const u=N.request(()=>{o("idle")});return()=>{N.cancel(u)}},[t,e,s,o,r]),i.useMemo(()=>({mounted:s,setMounted:c,transitionStatus:r}),[s,r])}function Pt(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:o}=e,s=t!==void 0,[c,u]=Re({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:h,setMounted:p,transitionStatus:g}=Ot(c,!0,!0),[m,y]=i.useState(c),[{height:d,width:C},k]=i.useState({height:void 0,width:void 0}),A=re(),[f,I]=i.useState(),v=f??A,[l,b]=i.useState(!1),[w,T]=i.useState(!1),j=i.useRef(null),O=i.useRef(null),L=i.useRef(null),M=i.useRef(null),a=Te(M,!1),S=U(R=>{const x=!c,E=ie(xt,R.nativeEvent);if(r(x,E),E.isCanceled)return;const F=M.current;O.current==="css-animation"&&F!=null&&F.style.removeProperty("animation-name"),!l&&!w&&(O.current!=null&&O.current!=="css-animation"&&!h&&x&&p(!0),O.current==="css-animation"&&(!m&&x&&y(!0),!h&&x&&p(!0))),u(x),O.current==="none"&&h&&!x&&p(!1)});return D(()=>{s&&O.current==="none"&&!w&&!c&&p(!1)},[s,w,c,t,p]),i.useMemo(()=>({abortControllerRef:j,animationTypeRef:O,disabled:o,handleTrigger:S,height:d,mounted:h,open:c,panelId:v,panelRef:M,runOnceAnimationsFinish:a,setDimensions:k,setHiddenUntilFound:b,setKeepMounted:T,setMounted:p,setOpen:u,setPanelIdState:I,setVisible:y,transitionDimensionRef:L,transitionStatus:g,visible:m,width:C}),[j,O,o,S,d,h,c,v,M,a,k,b,T,p,u,y,L,g,m,C])}const je=i.createContext(void 0);function Fe(){const e=i.useContext(je);if(e===void 0)throw new Error(K(15));return e}let At=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Mt(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:c,unregister:u,subscribeMapChange:h,elementsRef:p,labelsRef:g,nextIndexRef:m}=Ye(),y=i.useRef(-1),[d,C]=i.useState(s??(o===At.GuessFromOrder?()=>{if(y.current===-1){const f=m.current;m.current+=1,y.current=f}return y.current}:-1)),k=i.useRef(null),A=i.useCallback(f=>{if(k.current=f,d!==-1&&f!==null&&(p.current[d]=f,g)){const I=t!==void 0;g.current[d]=I?t:r?.current?.textContent??f.textContent}},[d,p,g,t,r]);return D(()=>{if(s!=null)return;const f=k.current;if(f)return c(f,n),()=>{u(f)}},[s,c,u,n]),D(()=>{if(s==null)return h(f=>{const I=k.current?f.get(k.current)?.index:null;I!=null&&C(I)})},[s,h,C]),i.useMemo(()=>({ref:A,index:d}),[d,A])}const Ue=i.createContext(void 0);function ae(){const e=i.useContext(Ue);if(e===void 0)throw new Error(K(9));return e}let J=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const wt={[J.startingStyle]:""},Nt={[J.endingStyle]:""},Dt={transitionStatus(e){return e==="starting"?wt:e==="ending"?Nt:null}};let $=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=J.startingStyle]="startingStyle",e[e.endingStyle=J.endingStyle]="endingStyle",e})({}),Tt=(function(e){return e.panelOpen="data-panel-open",e})({});const jt={[$.open]:""},Ft={[$.closed]:""},Ut={open(e){return e?{[Tt.panelOpen]:""}:null}},Lt={open(e){return e?jt:Ft}};let Vt=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const ce={...Lt,index:e=>Number.isInteger(e)?{[Vt.index]:String(e)}:null,...Dt,value:()=>null},_t=i.forwardRef(function(t,n){const{className:r,disabled:o=!1,onOpenChange:s,render:c,value:u,...h}=t,{ref:p,index:g}=Mt(),m=Z(n,p),{disabled:y,handleValueChange:d,state:C,value:k}=se(),A=re(),f=u??A,I=o||y,v=i.useMemo(()=>{if(!k)return!1;for(let S=0;S<k.length;S+=1)if(k[S]===f)return!0;return!1},[k,f]),l=U((S,R)=>{s?.(S,R),!R.isCanceled&&d(f,S)}),b=Pt({open:v,onOpenChange:l,disabled:I}),w=i.useMemo(()=>({open:b.open,disabled:b.disabled,hidden:!b.mounted,transitionStatus:b.transitionStatus}),[b.open,b.disabled,b.mounted,b.transitionStatus]),T=i.useMemo(()=>({...b,onOpenChange:l,state:w}),[b,w,l]),j=i.useMemo(()=>({...C,index:g,disabled:I,open:v}),[I,g,v,C]),[O,L]=i.useState(re()),M=i.useMemo(()=>({open:v,state:j,setTriggerId:L,triggerId:O}),[v,j,L,O]),a=q("div",t,{state:j,ref:m,props:h,stateAttributesMapping:ce});return P.jsx(je.Provider,{value:T,children:P.jsx(Ue.Provider,{value:M,children:a})})}),Ht=i.forwardRef(function(t,n){const{render:r,className:o,...s}=t,{state:c}=ae();return q("h3",t,{state:c,ref:n,props:s,stateAttributesMapping:ce})});function ye(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const Wt=i.createContext(void 0);function $t(e=!1){const t=i.useContext(Wt);if(t===void 0&&!e)throw new Error(K(16));return t}function Kt(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,c=r&&t!==!1,u=r&&t===!1;return{props:i.useMemo(()=>{const p={onKeyDown(g){n&&t&&g.key!=="Tab"&&g.preventDefault()}};return r||(p.tabIndex=o,!s&&n&&(p.tabIndex=t?o:-1)),(s&&(t||c)||!s&&n)&&(p["aria-disabled"]=n),s&&(!t||u)&&(p.disabled=n),p},[r,n,t,c,u,s,o])}}function qt(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=e,s=i.useRef(null),c=$t(!0)!==void 0,u=U(()=>{const y=s.current;return!!(y?.tagName==="A"&&y?.href)}),{props:h}=Kt({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:o}),p=i.useCallback(()=>{const y=s.current;Bt(y)&&c&&t&&h.disabled===void 0&&y.disabled&&(y.disabled=!1)},[t,h.disabled,c]);D(p,[p]);const g=i.useCallback((y={})=>{const{onClick:d,onMouseDown:C,onKeyUp:k,onKeyDown:A,onPointerDown:f,...I}=y;return Pe({type:o?"button":void 0,onClick(l){if(t){l.preventDefault();return}d?.(l)},onMouseDown(l){t||C?.(l)},onKeyDown(l){if(t||(ne(l),A?.(l)),l.baseUIHandlerPrevented)return;const b=l.target===l.currentTarget&&!o&&!u()&&!t,w=l.key==="Enter",T=l.key===" ";b&&((T||w)&&l.preventDefault(),w&&d?.(l))},onKeyUp(l){t||(ne(l),k?.(l)),!l.baseUIHandlerPrevented&&l.target===l.currentTarget&&!o&&!t&&l.key===" "&&d?.(l)},onPointerDown(l){if(t){l.preventDefault();return}f?.(l)}},o?void 0:{role:"button"},h,I)},[t,h,o,u]),m=U(y=>{s.current=y,p()});return{getButtonProps:g,buttonRef:m}}function Bt(e){return $e(e)&&e.tagName==="BUTTON"}function zt(e){e.preventDefault(),e.stopPropagation()}const ue="ArrowUp",le="ArrowDown",de="ArrowLeft",fe="ArrowRight",Le="Home",Ve="End",Gt=new Set([de,fe]),Yt=new Set([ue,le]),Zt=new Set([...Gt,...Yt]);[...Zt];const Jt=new Set([le,ue,fe,de,Le,Ve]);function Qt(e){const{current:t}=e,n=[];for(let r=0;r<t.length;r+=1){const o=t[r];if(!ye(o)){const s=o?.querySelector('[type="button"]');ye(s)||n.push(s)}}return n}const Xt=i.forwardRef(function(t,n){const{disabled:r,className:o,id:s,render:c,nativeButton:u=!0,...h}=t,{panelId:p,open:g,handleTrigger:m,disabled:y}=Fe(),d=r??y,{getButtonProps:C,buttonRef:k}=qt({disabled:d,focusableWhenDisabled:!0,native:u}),{accordionItemRefs:A,direction:f,loopFocus:I,orientation:v}=se(),l=f==="rtl",b=v==="horizontal",{state:w,setTriggerId:T,triggerId:j}=ae();D(()=>(s&&T(s),()=>{T(void 0)}),[s,T]);const O=i.useMemo(()=>({"aria-controls":g?p:void 0,"aria-expanded":g,disabled:d,id:j,onClick:m,onKeyDown(M){if(!Jt.has(M.key))return;zt(M);const a=Qt(A),R=a.length-1;let x=-1;const E=a.indexOf(M.target);function F(){I?x=E+1>R?0:E+1:x=Math.min(E+1,R)}function V(){I?x=E===0?R:E-1:x=E-1}switch(M.key){case le:b||F();break;case ue:b||V();break;case fe:b&&(l?V():F());break;case de:b&&(l?F():V());break;case"Home":x=0;break;case"End":x=R;break}x>-1&&a[x].focus()}}),[A,d,m,j,b,l,I,g,p]);return q("button",t,{state:w,ref:[n,k],props:[O,h,C],stateAttributesMapping:Ut})});let en=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function tn(e){const{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:o,hiddenUntilFound:s,keepMounted:c,id:u,mounted:h,onOpenChange:p,open:g,panelRef:m,runOnceAnimationsFinish:y,setDimensions:d,setMounted:C,setOpen:k,setVisible:A,transitionDimensionRef:f,visible:I,width:v}=e,l=i.useRef(!1),b=i.useRef(null),w=i.useRef(g),T=i.useRef(g),j=De(),O=i.useMemo(()=>n.current==="css-animation"?!I:!g&&!h,[g,h,I,n]),L=U(a=>{if(!a)return;if(n.current==null||f.current==null){const x=getComputedStyle(a),E=x.animationName!=="none"&&x.animationName!=="",F=x.transitionDuration!=="0s"&&x.transitionDuration!=="";E&&F||(x.animationName==="none"&&x.transitionDuration!=="0s"?n.current="css-transition":x.animationName!=="none"&&x.transitionDuration==="0s"?n.current="css-animation":n.current="none"),a.getAttribute(en.orientation)==="horizontal"||x.transitionProperty.indexOf("width")>-1?f.current="width":f.current="height"}if(n.current!=="css-transition")return;(o===void 0||v===void 0)&&(d({height:a.scrollHeight,width:a.scrollWidth}),T.current&&a.style.setProperty("transition-duration","0s"));let S=-1,R=-1;return S=N.request(()=>{T.current=!1,R=N.request(()=>{setTimeout(()=>{a.style.removeProperty("transition-duration")})})}),()=>{N.cancel(S),N.cancel(R)}}),M=Z(r,m,L);return D(()=>{if(n.current!=="css-transition")return;const a=m.current;if(!a)return;let S=-1;if(t.current!=null&&(t.current.abort(),t.current=null),g){const R={"justify-content":a.style.justifyContent,"align-items":a.style.alignItems,"align-content":a.style.alignContent,"justify-items":a.style.justifyItems};Object.keys(R).forEach(x=>{a.style.setProperty(x,"initial","important")}),!T.current&&!c&&a.setAttribute($.startingStyle,""),d({height:a.scrollHeight,width:a.scrollWidth}),S=N.request(()=>{Object.entries(R).forEach(([x,E])=>{E===""?a.style.removeProperty(x):a.style.setProperty(x,E)})})}else{if(a.scrollHeight===0&&a.scrollWidth===0)return;d({height:a.scrollHeight,width:a.scrollWidth});const R=new AbortController;t.current=R;const x=R.signal;let E=null;const F=$.endingStyle;return E=new MutationObserver(V=>{V.some(B=>B.type==="attributes"&&B.attributeName===F)&&(E?.disconnect(),E=null,y(()=>{d({height:0,width:0}),a.style.removeProperty("content-visibility"),C(!1),t.current===R&&(t.current=null)},x))}),E.observe(a,{attributes:!0,attributeFilter:[F]}),()=>{E?.disconnect(),j.cancel(),t.current===R&&(R.abort(),t.current=null)}}return()=>{N.cancel(S)}},[t,n,j,s,c,h,g,m,y,d,C]),D(()=>{if(n.current!=="css-animation")return;const a=m.current;a&&(b.current=a.style.animationName||b.current,a.style.setProperty("animation-name","none"),d({height:a.scrollHeight,width:a.scrollWidth}),!w.current&&!l.current&&a.style.removeProperty("animation-name"),g?(t.current!=null&&(t.current.abort(),t.current=null),C(!0),A(!0)):(t.current=new AbortController,y(()=>{C(!1),A(!1),t.current=null},t.current.signal)))},[t,n,g,m,y,d,C,A,I]),Ne(()=>{const a=N.request(()=>{w.current=!1});return()=>N.cancel(a)}),D(()=>{if(!s)return;const a=m.current;if(!a)return;let S=-1,R=-1;return g&&l.current&&(a.style.transitionDuration="0s",d({height:a.scrollHeight,width:a.scrollWidth}),S=N.request(()=>{l.current=!1,R=N.request(()=>{setTimeout(()=>{a.style.removeProperty("transition-duration")})})})),()=>{N.cancel(S),N.cancel(R)}},[s,g,m,d]),D(()=>{const a=m.current;a&&s&&O&&(a.setAttribute("hidden","until-found"),n.current==="css-transition"&&a.setAttribute($.startingStyle,""))},[s,O,n,m]),i.useEffect(function(){const S=m.current;if(!S)return;function R(x){l.current=!0,k(!0),p(!0,ie(we,x))}return S.addEventListener("beforematch",R),()=>{S.removeEventListener("beforematch",R)}},[p,m,k]),i.useMemo(()=>({props:{hidden:O,id:u,ref:M}}),[O,u,M])}let Ce=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});function nn(e){const t=H(rn,e).current;return t.next=e,D(t.effect),t}function rn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function on(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=nn(n),c=U(o),u=Te(r,n);i.useEffect(()=>{t&&u(()=>{n===s.current&&c()})},[t,n,c,u,s])}const ve=i.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,id:c,render:u,...h}=t,{hiddenUntilFound:p,keepMounted:g}=se(),{abortControllerRef:m,animationTypeRef:y,height:d,mounted:C,onOpenChange:k,open:A,panelId:f,panelRef:I,runOnceAnimationsFinish:v,setDimensions:l,setHiddenUntilFound:b,setKeepMounted:w,setMounted:T,setOpen:j,setVisible:O,transitionDimensionRef:L,visible:M,width:a,setPanelIdState:S,transitionStatus:R}=Fe(),x=o??p,E=s??g;D(()=>{if(c)return S(c),()=>{S(void 0)}},[c,S]),D(()=>{b(x)},[b,x]),D(()=>{w(E)},[w,E]),on({open:A&&R==="idle",ref:I,onComplete(){A&&l({width:void 0,height:void 0})}});const{props:F}=tn({abortControllerRef:m,animationTypeRef:y,externalRef:n,height:d,hiddenUntilFound:x,id:c??f,keepMounted:E,mounted:C,onOpenChange:k,open:A,panelRef:I,runOnceAnimationsFinish:v,setDimensions:l,setMounted:T,setOpen:j,setVisible:O,transitionDimensionRef:L,visible:M,width:a}),{state:V,triggerId:pe}=ae(),B=i.useMemo(()=>({...V,transitionStatus:R}),[V,R]),He=q("div",t,{state:B,ref:[n,I],props:[F,{"aria-labelledby":pe,role:"region",style:{[Ce.accordionPanelHeight]:d===void 0?"auto":`${d}px`,[Ce.accordionPanelWidth]:a===void 0?"auto":`${a}px`}},h],stateAttributesMapping:ce});return E||x||!E&&C?He:null});function _e(e){const t=i.createContext(void 0);return[({value:o,children:s})=>P.jsx(t.Provider,{value:o,children:s}),()=>{const o=i.useContext(t);if(o===void 0)throw new Error(`useContext must be used within ${e??"a Provider"}`);return o}]}function sn(e){const{value:t,defaultValue:n,onChange:r}=e,[o,s]=i.useState(t!==void 0?t:n);i.useEffect(()=>{t!==void 0&&s(t)},[t]);const c=i.useCallback((u,...h)=>{s(u),r?.(u,...h)},[r]);return[o,c]}const[an,cn]=_e("AccordionContext"),[un,ln]=_e("AccordionItemContext");function dn(e){const[t,n]=sn({value:e?.value,defaultValue:e?.defaultValue,onChange:e?.onValueChange});return P.jsx(an,{value:{value:t,setValue:n},children:P.jsx(Ct,{"data-slot":"accordion",...e,onValueChange:n})})}function fn(e){const{value:t}=cn(),[n,r]=i.useState(t?.includes(e?.value)??!1);return i.useEffect(()=>{r(t?.includes(e?.value)??!1)},[t,e?.value]),P.jsx(un,{value:{isOpen:n,setIsOpen:r},children:P.jsx(_t,{"data-slot":"accordion-item",...e})})}function pn(e){return P.jsx(Ht,{"data-slot":"accordion-header",...e})}function hn(e){return P.jsx(Xt,{"data-slot":"accordion-trigger",...e})}function mn({transition:e={duration:.35,ease:"easeInOut"},hiddenUntilFound:t,keepRendered:n=!1,...r}){const{isOpen:o}=ln();return P.jsx(We,{children:n?P.jsx(ve,{hidden:!1,hiddenUntilFound:t,keepMounted:!0,render:P.jsx(he.div,{"data-slot":"accordion-panel",initial:{height:0,opacity:0,"--mask-stop":"0%",y:20},animate:o?{height:"auto",opacity:1,"--mask-stop":"100%",y:0}:{height:0,opacity:0,"--mask-stop":"0%",y:20},transition:e,style:{maskImage:"linear-gradient(black var(--mask-stop), transparent var(--mask-stop))",WebkitMaskImage:"linear-gradient(black var(--mask-stop), transparent var(--mask-stop))",overflow:"hidden"},...r},"accordion-panel")}):o&&P.jsx(ve,{hidden:!1,hiddenUntilFound:t,keepMounted:!0,render:P.jsx(he.div,{"data-slot":"accordion-panel",initial:{height:0,opacity:0,"--mask-stop":"0%",y:20},animate:{height:"auto",opacity:1,"--mask-stop":"100%",y:0},exit:{height:0,opacity:0,"--mask-stop":"0%",y:20},transition:e,style:{maskImage:"linear-gradient(black var(--mask-stop), transparent var(--mask-stop))",WebkitMaskImage:"linear-gradient(black var(--mask-stop), transparent var(--mask-stop))",overflow:"hidden"},...r},"accordion-panel")})})}function In(e){return P.jsx(dn,{...e})}function Rn({className:e,...t}){return P.jsx(fn,{className:oe("border-b last:border-b-0",e),...t})}function Sn({className:e,children:t,showArrow:n=!0,...r}){return P.jsx(pn,{className:"flex",children:P.jsxs(hn,{className:oe("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-panel-open]>svg]:rotate-180",e),...r,children:[t,n&&P.jsx(Ke,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function kn({className:e,children:t,...n}){return P.jsx(mn,{...n,children:P.jsx("div",{className:oe("text-sm pt-0 pb-4",e),children:t})})}export{In as A,Rn as a,Sn as b,kn as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as o}from"./query-DVWnIZNd.js";import{c as l}from"./index-
|
|
1
|
+
import{j as o}from"./query-DVWnIZNd.js";import{c as l}from"./index-BCjwgtkq.js";function c({status:r,className:a}){const e=r==="error"?{halo:"rgba(var(--ch-error), 0.16)",fill:"var(--color-error)",shadow:"0 0 8px rgba(var(--ch-error), 0.38)"}:r==="warning"?{halo:"rgba(var(--ch-warning), 0.16)",fill:"var(--color-warning)",shadow:"0 0 8px rgba(var(--ch-warning), 0.34)"}:r==="active"?{halo:"rgba(var(--ch-accent), 0.18)",fill:"var(--color-accent)",shadow:"var(--glow-dot)"}:{halo:"rgba(var(--ch-accent-2), 0.16)",fill:"var(--color-accent-2)",shadow:"0 0 8px rgba(var(--ch-accent-2), 0.28)"};return o.jsxs("span",{className:l("relative flex h-3.5 w-3.5 items-center justify-center",a),children:[o.jsx("span",{className:"absolute inset-0 rounded-full",style:{background:e.halo}}),o.jsx("span",{className:"relative h-2 w-2 rounded-full",style:{background:e.fill,boxShadow:e.shadow}})]})}function s(r){return typeof r=="string"?r:Array.isArray(r)?r.filter(a=>a.type==="text").map(a=>a.text??"").join(`
|
|
2
2
|
`):""}export{c as S,s as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./query-DVWnIZNd.js";import{E as c,c as o}from"./index-
|
|
1
|
+
import{j as e}from"./query-DVWnIZNd.js";import{E as c,c as o}from"./index-BCjwgtkq.js";function d({context:a,title:t,description:r,tags:n=[],rightSlot:s,className:l}){return e.jsxs("section",{className:o("hero-panel relative overflow-hidden rounded-[calc(var(--radius-panel)+10px)] border px-6 py-6 sm:px-8 sm:py-7",l),style:{borderColor:"var(--border-dim)"},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04] [background-image:linear-gradient(rgba(var(--ch-accent),0.8)_1px,transparent_1px),linear-gradient(90deg,rgba(var(--ch-accent),0.8)_1px,transparent_1px)] [background-size:84px_84px]"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.92] [mask-image:radial-gradient(circle_at_center,black,transparent_84%)]",children:e.jsx(c,{className:"h-full w-full",speed:110,factor:.008,starColor:"rgba(var(--rgb-text-frost), 0.2)",pointerEvents:!1,transparent:!0,blendMode:"normal",fieldOpacity:.82,layers:[{count:240,size:1,durationMultiplier:1},{count:92,size:2,durationMultiplier:1.8},{count:36,size:3,durationMultiplier:2.6}]})}),e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0 w-[46%]",style:{background:"radial-gradient(circle at 0% 40%, rgba(var(--ch-accent), 0.12), transparent 72%)"}}),e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute -right-12 top-[-20px] h-44 w-44 rounded-full",style:{background:"var(--bloom-purple)"}}),e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute bottom-0 left-10 right-10 h-px",style:{background:"linear-gradient(90deg, transparent, var(--border-bright), transparent)"}}),e.jsxs("div",{className:o("relative min-h-[248px]",s&&"grid gap-6 lg:min-h-[360px] lg:grid-cols-[minmax(0,1.1fr)_minmax(400px,430px)] lg:items-start lg:gap-8"),children:[e.jsxs("div",{className:"flex max-w-5xl flex-col justify-between gap-8",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"inline-flex items-center gap-3 rounded-[var(--radius-badge)] border border-[var(--border-default)] bg-[rgba(var(--ch-accent),0.04)] px-4 py-2",children:[e.jsx("span",{"aria-hidden":"true",className:"h-px w-7",style:{background:"var(--color-accent)",boxShadow:"0 0 12px rgba(var(--ch-accent), 0.35)"}}),e.jsx("span",{className:"mono-label text-[var(--color-accent-max)]",children:a}),e.jsx("span",{className:"live-dot",style:{display:"inline-block"}})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h1",{className:"max-w-[9ch] text-[var(--color-text-primary)]",style:{fontFamily:"var(--font-operator)",fontSize:"clamp(42px, 5.2vw, 84px)",fontWeight:700,lineHeight:"0.88",letterSpacing:"-0.065em",textShadow:"0 18px 60px rgba(0, 0, 0, 0.42)"},children:t}),e.jsx("p",{className:"page-section-copy",children:r})]})]}),n.length>0?e.jsx("div",{className:"pill-strip",children:n.map(i=>e.jsx("span",{className:"pill-item",children:i},i))}):null]}),s?e.jsx("div",{className:"min-w-0 lg:w-full lg:max-w-[430px] lg:justify-self-end",children:s}):null]}),e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute bottom-5 right-6 select-none text-right uppercase leading-none",style:{fontFamily:"var(--font-operator)",fontSize:"clamp(52px, 9vw, 116px)",color:"rgba(var(--ch-text-primary), 0.034)",fontWeight:700,letterSpacing:"-0.06em"},children:a})]})}function x({eyebrow:a,title:t,description:r,aside:n,children:s}){return e.jsxs("div",{className:"mx-auto flex w-full max-w-[1760px] flex-col gap-6",children:[e.jsx(d,{context:a,title:t,description:r,tags:["Local-first telemetry","Streaming traces","Cost intelligence"],rightSlot:n}),s]})}function u(a){const t=Math.abs(a),r=a<0?"-":"";return t<.01?`${r}$${t.toFixed(4)}`:`${r}$${t.toFixed(2)}`}function g(a){return a<1e3?`${Math.round(a)}ms`:`${(a/1e3).toFixed(1)}s`}function f(a){return new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:a>=1e3?1:0}).format(a)}function h(a){const t=Date.now()-a,r=Math.floor(t/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}export{x as P,u as a,g as b,h as c,f};
|