@linxiraos/pi-stats 1.5.13 → 1.5.14
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/CHANGELOG.md +6 -0
- package/dist/client/index.js +1 -1
- package/package.json +4 -4
package/dist/client/index.js
CHANGED
|
@@ -232,7 +232,7 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
232
232
|
<%s {...props} />
|
|
233
233
|
React keys must be passed directly to JSX without using spread:
|
|
234
234
|
let props = %s;
|
|
235
|
-
<%s key={someKey} {...props} />`,St,He,ua,He),yt[He+St]=!0)}if(He=null,It!==void 0&&(i(It),He=""+It),y(Fe)&&(i(Fe.key),He=""+Fe.key),"key"in Fe){It={};for(var da in Fe)da!=="key"&&(It[da]=Fe[da])}else It=Fe;return He&&g(It,typeof Q==="function"?Q.displayName||Q.name||"Unknown":Q),b(Q,He,It,f(),ge,Ye)}function S(Q){L(Q)?Q._store&&(Q._store.validated=1):typeof Q==="object"&&Q!==null&&Q.$$typeof===ee&&(Q._payload.status==="fulfilled"?L(Q._payload.value)&&Q._payload.value._store&&(Q._payload.value._store.validated=1):Q._store&&(Q._store.validated=1))}function L(Q){return typeof Q==="object"&&Q!==null&&Q.$$typeof===I}var I=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),Ie=qi.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe=Object.prototype.hasOwnProperty,Ne=Array.isArray,Ce=console.createTask?console.createTask:function(){return null};qi={react_stack_bottom_frame:function(Q){return Q()}};var oe,Se={},De=qi.react_stack_bottom_frame.bind(qi,v)(),Qe=Ce(c(v)),yt={};KE.Fragment=T,KE.jsxDEV=function(Q,Fe,It,St){var ge=1e4>Ie.recentlyCreatedOwnerStacks++;return h(Q,Fe,It,St,ge?Error("react-stack-top-frame"):De,ge?Ce(c(Q)):Qe)}})()});var PR=_(q1(),1);var vd=_(Ke(),1);var kh=_(Ke(),1);var O1=(r)=>r?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function B1(r,l,i=[]){if(l==null)throw Error("[lucide]: iconNode is required when icon name is used");return{name:O1(r),size:24,node:l,...i.length>0?{aliases:i}:{}}}var z1=(r)=>{let l="",i=!1;for(let c of r){if(c==="-"||c==="_"||c<=" "){i=l.length>0;continue}if(l.length===0)l+=c.toLowerCase();else l+=i?c.toUpperCase():c;i=!1}return l};var P1=(r)=>{let l=z1(r);return l.charAt(0).toUpperCase()+l.slice(1)};var Jc=_(Ke(),1);var Zc=(...r)=>r.filter((l,i,c)=>Boolean(l)&&l.trim()!==""&&c.indexOf(l)===i).join(" ").trim();var wl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function ib(r){return r!==null&&r!==void 0}function U1(r,l={}){let i=l.attributeNames??{},c=(L)=>i[L]??L,f=r.size??r.width??wl.width,v=r.size??r.height??wl.height,y=r.aliases?.filter((L)=>typeof L==="string"&&L.trim()!=="").map((L)=>`lucide-${L}`)??[],g=[...r.name?[`lucide-${r.name}`]:[],...y],m=l.className?.split(" ").filter(Boolean)??[],b=l.includeDefaultClasses===!1?Zc(...m):Zc("lucide",...g,...m),h=l.absoluteStrokeWidth?Number(l.strokeWidth??wl["stroke-width"])*Number(r.size??r.width??wl.width)/Number(l.size??l.width??wl.width):l.strokeWidth??wl["stroke-width"];return["svg",{...Object.entries(wl).reduce((L,[I,C])=>(L[c(I)]=C,L),{}),..."color"in l&&l.color&&{[c("stroke")]:l.color},..."size"in l&&ib(l.size)&&{[c("width")]:l.size,[c("height")]:l.size},..."width"in l&&ib(l.width)&&{[c("width")]:l.width},..."height"in l&&ib(l.height)&&{[c("height")]:l.height},[c("stroke-width")]:h,...b&&{[c("class")]:b},[c("viewBox")]:`0 0 ${f} ${v}`,...l.hasA11yProp===!1?{[c("aria-hidden")]:"true"}:{},..."attributes"in l&&l.attributes},r.node.map((L)=>{let[I,C,T]=L,R=l.nonScalingStroke?{[c("vector-effect")]:"non-scaling-stroke",...C}:C;return T?[I,R,T]:[I,R]})]}function _1(r,l={}){return U1(r,{...l,attributeNames:{...l.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var H1=(r)=>{for(let l in r)if(l.startsWith("aria-")||l==="role"||l==="title")return!0;return!1};var Wu=_(Ke(),1),EE=Wu.createContext({});var F1=()=>Wu.useContext(EE);var G1=Jc.forwardRef(({color:r,size:l,width:i,height:c,strokeWidth:f,absoluteStrokeWidth:v,nonScalingStroke:y,className:g="",children:m,iconNode:b=[],icon:h={node:b,aliases:[],size:24},...S},L)=>{let{size:I=24,strokeWidth:C=2,absoluteStrokeWidth:T=!1,nonScalingStroke:R=!1,color:O="currentColor",className:z=""}=F1()??{},Y=Boolean(m)||H1(S),[W,ue,Z=[]]=_1(h,{color:r??O,width:i??l??I,height:c??l??I,strokeWidth:f??C,absoluteStrokeWidth:v??T,nonScalingStroke:y??R,className:Zc(z,g),hasA11yProp:Y,attributes:S});return Jc.createElement(W,{ref:L,...ue},[...Z.map(([ce,ee])=>Jc.createElement(ce,ee)),...Array.isArray(m)?m:[m]])});function re(r,l=[],i=[]){let c=typeof r==="string"?B1(r,l,i):r,f=kh.forwardRef(({className:v,...y},g)=>kh.createElement(G1,{ref:g,icon:c,className:v,...y}));if(c.name)f.displayName=P1(c.name);return f}var V1={name:"braces",size:24,node:[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],aliases:["curly-braces"]};V1.node;var Cl=re(V1);var j1={name:"circle-exclamation-point",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle","circle-alert"]};j1.node;var Zr=re(j1);var $1={name:"cloud-download",size:24,node:[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],aliases:["download-cloud"]};$1.node;var Tl=re($1);var X1={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};X1.node;var Il=re(X1);var Y1={name:"face-slightly-frowning",size:24,node:[["path",{d:"M15 10V9",key:"4dkmfx"}],["path",{d:"M9 10V9",key:"1lazqi"}],["path",{d:"M9 16a5 5 0 016 0",key:"34mdxb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aliases:["frown"]};Y1.node;var Rl=re(Y1);var K1={name:"file-pen-line",size:24,node:[["path",{d:"M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z",key:"ukzhwg"}],["path",{d:"M14.487 7.858A1 1 0 0 1 14 7V2",key:"1klhew"}],["path",{d:"M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516",key:"rxaxab"}],["path",{d:"M8 18h1",key:"13wk12"}]],aliases:["file-signature"]};K1.node;var Al=re(K1);var Q1={name:"plug-zap",size:24,node:[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]],aliases:["plug-zap-2"]};Q1.node;var Ml=re(Q1);var W1={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};W1.node;var Un=re(W1);var Z1={name:"square-chart-gantt",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 8h7",key:"kbo1nt"}],["path",{d:"M8 12h6",key:"ikassy"}],["path",{d:"M11 16h5",key:"oq65wt"}]],aliases:["gantt-chart-square","square-gantt-chart"]};Z1.node;var Jr=re(Z1);var J1={name:"square-terminal",size:24,node:[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],aliases:["terminal-square"]};J1.node;var Dl=re(J1);var eT={name:"triangle-exclamation-point",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle","triangle-alert"]};eT.node;var Io=re(eT);var tT={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};tT.node;var ef=re(tT);var aT={name:"archive",size:24,node:[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]};aT.node;var tf=re(aT);var oT={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};oT.node;var af=re(oT);var rT={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};rT.node;var of=re(rT);var nT={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};nT.node;var rf=re(nT);var sT={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};sT.node;var nf=re(sT);var lT={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};lT.node;var sf=re(lT);var iT={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};iT.node;var lf=re(iT);var uT={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};uT.node;var Mi=re(uT);var dT={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};dT.node;var Di=re(dT);var cT={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};cT.node;var uf=re(cT);var fT={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};fT.node;var en=re(fT);var pT={name:"clipboard-list",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]};pT.node;var df=re(pT);var mT={name:"coins",size:24,node:[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]]};mT.node;var cf=re(mT);var hT={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};hT.node;var Ei=re(hT);var gT={name:"corner-down-right",size:24,node:[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]};gT.node;var ff=re(gT);var yT={name:"cpu",size:24,node:[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]};yT.node;var pf=re(yT);var vT={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};vT.node;var mf=re(vT);var xT={name:"file-search",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]};xT.node;var hf=re(xT);var bT={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};bT.node;var gf=re(bT);var ST={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]};ST.node;var yf=re(ST);var kT={name:"folder-search",size:24,node:[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]};kT.node;var vf=re(kT);var LT={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};LT.node;var xf=re(LT);var wT={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};wT.node;var bf=re(wT);var CT={name:"hourglass",size:24,node:[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]};CT.node;var Sf=re(CT);var TT={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};TT.node;var kf=re(TT);var IT={name:"languages",size:24,node:[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]};IT.node;var Lf=re(IT);var RT={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};RT.node;var wf=re(RT);var AT={name:"list-todo",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]};AT.node;var Cf=re(AT);var MT={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]};MT.node;var Tf=re(MT);var DT={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]};DT.node;var If=re(DT);var ET={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};ET.node;var Rf=re(ET);var NT={name:"network",size:24,node:[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]};NT.node;var Af=re(NT);var qT={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};qT.node;var El=re(qT);var OT={name:"repeat-2",size:24,node:[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]};OT.node;var Mf=re(OT);var BT={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};BT.node;var Df=re(BT);var zT={name:"scan-search",size:24,node:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]};zT.node;var ws=re(zT);var PT={name:"scissors",size:24,node:[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]};PT.node;var Ef=re(PT);var UT={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};UT.node;var Nf=re(UT);var _T={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};_T.node;var qf=re(_T);var HT={name:"text-search",size:24,node:[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 19H3",key:"108z41"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]};HT.node;var Of=re(HT);var FT={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};FT.node;var Ni=re(FT);var GT={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};GT.node;var Ro=re(GT);var ld=_(Ke(),1);function Lh(r){let l=r?.trim().toLowerCase()??"";if(l==="zh"||l.startsWith("zh-")||l.startsWith("zh_"))return"zh-CN";return"en"}function VT(r){for(let l of r??[]){let i=Lh(l);if(i!=="en")return i}return"en"}function NE(r,l={}){return r.replace(/\{([\w.-]+)\}/g,(i,c)=>{let f=l[c];return f===void 0?i:String(f)})}function jT(r,l,i,c={}){let f=i[r]?.[l]??i.en?.[l];if(f===void 0)return console.warn(`[stats.i18n] missing translation: ${l}`),l;return NE(f,c)}var wh={en:{"nav.usage":"Usage","nav.activity":"Activity","nav.insights":"Insights","nav.overview":"Overview","nav.models":"Models","nav.providers":"Providers","nav.costs":"Costs","nav.requests":"Requests","nav.errors":"Errors","nav.traces":"Traces","nav.tools":"Tools","nav.frustration":"Frustration","nav.projects":"Projects","nav.tracking":"Tracking","nav.gain":"Gain","nav.spotlight":"Spotlight","nav.dashboard":"zetacode stats","nav.breadcrumb-stats":"stats","nav.pages":"Pages","nav.open-navigation":"Open navigation"},"zh-CN":{"nav.usage":"用量","nav.activity":"活动","nav.insights":"洞察","nav.overview":"总览","nav.models":"模型","nav.providers":"服务商","nav.costs":"费用","nav.requests":"请求","nav.errors":"错误","nav.traces":"调用链","nav.tools":"工具","nav.frustration":"情绪压力","nav.projects":"项目","nav.tracking":"追踪","nav.gain":"收益","nav.spotlight":"亮点","nav.dashboard":"zeta 统计","nav.breadcrumb-stats":"统计","nav.pages":"导航","nav.open-navigation":"打开导航"}};var Ch={en:{"common.provider":"Provider","common.providers":"Providers","common.model":"Model","common.models":"Models","common.requests":"Requests","common.request":"Request","common.tokens":"Tokens","common.share":"Share","common.cost":"Cost","common.error-rate":"Error rate","common.tokens-per-second":"Tokens/s","common.output-tokens-per-second":"Output tokens/s","common.premium":"Premium","common.premium-requests":"Premium requests","common.duration":"Duration","common.started":"Started","common.request-id":"Request id","common.session-entry":"Session entry","common.entry-id":"Entry id","common.input":"Input","common.output":"Output","common.output-message":"Output message","common.cache-read":"Cache read","common.cache-write":"Cache write","common.project":"Project","common.pages":"Pages","common.filter":"Filter…","common.no-data-in-range":"No data in this range","common.nothing-here-yet":"Nothing here yet","common.show-more":"Show more","common.total":"Total","common.average":"Average","common.unknown":"Unknown","common.root":"(root)","common.other-n":"Other ({count})","common.time-range":"Time range","common.range-1h":"1h","common.range-24h":"24h","common.range-7d":"7d","common.range-30d":"30d","common.range-90d":"90d","common.range-all":"All","common.window-1h":"the last hour","common.window-24h":"the last 24 hours","common.window-7d":"the last 7 days","common.window-30d":"the last 30 days","common.window-90d":"the last 90 days","common.window-all":"all time","common.copy":"Copy","common.copied":"Copied","common.close":"Close","common.cancel":"Cancel","common.aborted":"Aborted","common.failed":"Failed","common.error":"Error","shell.live":"Live","shell.reconnecting":"Reconnecting","shell.syncing":"Syncing","shell.sync-failed":"Sync failed","shell.indexing":"Indexing","shell.lost-connection":"Lost the live connection to the stats server; retrying","shell.ingesting":"Ingesting session files","shell.building-rollups":"Building hourly rollups; older ranges fill in as it goes","shell.sync-now":"Click to sync session files now","shell.just-now":"just now","shell.system-theme":"System theme","shell.dark-theme":"Dark theme","shell.light-theme":"Light theme","shell.range-suffix":"range","shell.jump-hint":"then letter to jump","shell.language":"Language","shell.switch-language":"Switch dashboard language"},"zh-CN":{"common.provider":"服务商","common.providers":"服务商","common.model":"模型","common.models":"模型","common.requests":"请求","common.request":"请求","common.tokens":"Token","common.share":"占比","common.cost":"费用","common.error-rate":"错误率","common.tokens-per-second":"Token/s","common.output-tokens-per-second":"输出 Token/s","common.premium":"溢价","common.premium-requests":"溢价请求","common.duration":"耗时","common.started":"开始时间","common.request-id":"请求 ID","common.session-entry":"会话条目","common.entry-id":"条目 ID","common.input":"输入","common.output":"输出","common.output-message":"输出消息","common.cache-read":"缓存读取","common.cache-write":"缓存写入","common.project":"项目","common.pages":"页数","common.filter":"筛选…","common.no-data-in-range":"该时间范围内没有数据","common.nothing-here-yet":"暂无数据","common.show-more":"显示更多","common.total":"合计","common.average":"平均","common.unknown":"未知","common.root":"(根目录)","common.other-n":"其他({count})","common.time-range":"时间范围","common.range-1h":"1 小时","common.range-24h":"24 小时","common.range-7d":"7 天","common.range-30d":"30 天","common.range-90d":"90 天","common.range-all":"全部","common.window-1h":"最近 1 小时","common.window-24h":"最近 24 小时","common.window-7d":"最近 7 天","common.window-30d":"最近 30 天","common.window-90d":"最近 90 天","common.window-all":"全部时间","common.copy":"复制","common.copied":"已复制","common.close":"关闭","common.cancel":"取消","common.aborted":"已中止","common.failed":"失败","common.error":"错误","shell.live":"实时","shell.reconnecting":"重新连接中","shell.syncing":"同步中","shell.sync-failed":"同步失败","shell.indexing":"建立索引","shell.lost-connection":"与统计服务的实时连接已断开,正在重试","shell.ingesting":"正在导入会话文件","shell.building-rollups":"正在构建小时汇总;更早的时间范围会逐步补全","shell.sync-now":"点击立即同步会话文件","shell.just-now":"刚刚","shell.system-theme":"跟随系统","shell.dark-theme":"深色主题","shell.light-theme":"浅色主题","shell.range-suffix":"范围","shell.jump-hint":"再按字母跳转","shell.language":"语言","shell.switch-language":"切换仪表盘语言"}};var Th={en:{"overview.title":"Overview","overview.description":"Everything zeta did across your sessions in {window}.","overview.api-equivalent-cost":"API-equivalent cost","overview.api-cost-title":"What this usage would cost at public API rates","overview.unpriced-n":"{count} unpriced","overview.failed-n":"{count} failed","overview.conversation-tokens":"Conversation tokens","overview.tokens-title":"Uncached input + cache reads + cache writes + output","overview.output-n":"{count} output","overview.cache-rate":"Cache rate","overview.cache-rate-title":"Cache reads ÷ (uncached input + cache reads)","overview.cache-saved":"{value} saved","overview.succeeded-n":"{count} succeeded","overview.uncached-input":"Uncached input","overview.avg-latency":"Avg latency","overview.avg-ttft":"Avg TTFT","overview.activity":"Activity","overview.per-5m":"Per 5 minutes","overview.per-hour":"Per hour","overview.per-day":"Per day","overview.succeeded":"Succeeded","overview.api-equivalent":"API-equivalent","overview.token-mix":"Token mix","overview.token-mix-description":"Where conversation tokens went","overview.by-agent":"By agent","overview.requests-short":"{count} req","overview.main-agent":"Main agent","overview.subagents":"Subagent","overview.advisor":"Advisor","overview.latest-requests":"Latest requests","overview.latest-requests-description":"Most recent model calls across every session","overview.all-requests":"All requests","overview.when":"When","overview.status":"Status","overview.ok":"OK"},"zh-CN":{"overview.title":"概览","overview.description":"在{window}内,zeta 在你的所有会话中完成的一切。","overview.api-equivalent-cost":"API 等效费用","overview.api-cost-title":"这些用量按公开 API 费率计算所需的费用","overview.unpriced-n":"{count} 个未定价","overview.failed-n":"{count} 个失败","overview.conversation-tokens":"对话 Token","overview.tokens-title":"未缓存输入 + 缓存读取 + 缓存写入 + 输出","overview.output-n":"{count} 输出","overview.cache-rate":"缓存命中率","overview.cache-rate-title":"缓存读取 ÷(未缓存输入 + 缓存读取)","overview.cache-saved":"节省 {value}","overview.succeeded-n":"{count} 个成功","overview.uncached-input":"未缓存输入","overview.avg-latency":"平均延迟","overview.avg-ttft":"平均 TTFT","overview.activity":"活动","overview.per-5m":"每 5 分钟","overview.per-hour":"每小时","overview.per-day":"每天","overview.succeeded":"成功","overview.api-equivalent":"API 等效","overview.token-mix":"Token 构成","overview.token-mix-description":"对话 Token 的去向","overview.by-agent":"按代理","overview.requests-short":"{count} 次请求","overview.main-agent":"主代理","overview.subagents":"子代理","overview.advisor":"顾问","overview.latest-requests":"最新请求","overview.latest-requests-description":"所有会话中最近的模型调用","overview.all-requests":"全部请求","overview.when":"时间","overview.status":"状态","overview.ok":"正常"}};var Ih={en:{"models.subtitle":"Which models did the work in {window}, and how fast they answered.","models.empty-title":"No model usage in this range","models.empty-hint":"Pick a wider range in the top bar.","models.used":"Models used","models.across-providers-one":"across {count} provider","models.across-providers":"across {count} providers","models.most-used":"Most used","models.most-used-hint":"{share} of requests · {provider}","models.failed-n":"{count} failed","models.api-cost":"API-equivalent cost","models.api-cost-title":"What this usage would cost at public API rates","models.unpriced-n":"{count} unpriced","models.request-share":"Request share","models.share-desc":"Each model's share of requests per {bucket}","models.count-desc":"Requests per {bucket}, stacked by model","models.share-mode-aria":"Share chart mode","models.all-models":"All models","models.table-desc":"Click a row for latency and throughput over time","models.cost-title":"API-equivalent estimate at public rates","models.tokens-title":"Uncached input + cache reads + cache writes + output","models.cache-rate":"Cache rate","models.cache-title":"Cache reads ÷ (uncached input + cache reads)","models.errors":"Errors","models.tps-title":"Average output tokens per second","models.ttft":"TTFT","models.ttft-title":"Average time to first token","models.trend":"Trend","models.trend-title":"Requests per {bucket}","models.efficiency":"Efficiency","models.latency":"Latency","models.cache-savings":"Cache savings","models.avg-duration":"Avg duration","models.avg-ttft":"Avg TTFT","models.uncached-input":"Uncached input","models.first-last-seen":"First seen {first} · last seen {last}","models.performance-per-bucket":"Performance per active {bucket}","models.no-samples-title":"No performance samples","models.no-samples-hint":"Timing is recorded for streamed responses.","models.tok-per-second":"{value} tok/s","models.bucket-5m":"5 minutes","models.bucket-hour":"hour","models.bucket-day":"day"},"zh-CN":{"models.subtitle":"在{window}内哪些模型完成了工作,以及它们的响应速度如何。","models.empty-title":"该时间范围内没有模型用量","models.empty-hint":"请在顶部栏选择更宽的时间范围。","models.used":"使用模型数","models.across-providers-one":"覆盖 {count} 个服务商","models.across-providers":"覆盖 {count} 个服务商","models.most-used":"使用最多","models.most-used-hint":"{share} 请求占比 · {provider}","models.failed-n":"{count} 个失败","models.api-cost":"API 等价费用","models.api-cost-title":"按公开 API 价格计算这笔用量的费用","models.unpriced-n":"{count} 个未定价","models.request-share":"请求占比","models.share-desc":"每个{bucket}中各模型的请求占比","models.count-desc":"每个{bucket}的请求数,按模型堆叠","models.share-mode-aria":"占比图表模式","models.all-models":"所有模型","models.table-desc":"点击某行可查看延迟与吞吐随时间的变化","models.cost-title":"按公开价格估算的 API 等价费用","models.tokens-title":"未缓存输入 + 缓存读取 + 缓存写入 + 输出","models.cache-rate":"缓存命中率","models.cache-title":"缓存读取 ÷(未缓存输入 + 缓存读取)","models.errors":"错误","models.tps-title":"平均输出 Token/s","models.ttft":"首 Token 延迟","models.ttft-title":"平均首 Token 延迟","models.trend":"趋势","models.trend-title":"每个{bucket}的请求数","models.efficiency":"效率","models.latency":"延迟","models.cache-savings":"缓存节省","models.avg-duration":"平均耗时","models.avg-ttft":"平均首 Token 延迟","models.uncached-input":"未缓存输入","models.first-last-seen":"首次出现 {first} · 最近出现 {last}","models.performance-per-bucket":"每个活跃{bucket}的性能","models.no-samples-title":"没有性能样本","models.no-samples-hint":"只有流式响应会记录耗时。","models.tok-per-second":"{value} Token/s","models.bucket-5m":"5 分钟","models.bucket-hour":"小时","models.bucket-day":"天"}};var Rh={en:{"providers.description":"Burn, reliability and subscription headroom per provider over {window}.","providers.most-tokens":"Most tokens: {provider}","providers.failed-n":"{count} failed","providers.succeeded-n":"{count} succeeded","providers.tokens-title":"Uncached input + cache reads + cache writes + output","providers.api-equivalent-cost":"API-equivalent cost","providers.api-cost-title":"What this usage would cost at public API rates","providers.unpriced-n":"{count} unpriced","providers.totals":"Provider totals","providers.totals-description":"Cost is an API-equivalent estimate. Select a row for its token mix.","providers.totals-description-unpriced-one":"Cost is an API-equivalent estimate and excludes {count} unpriced subscription request. Select a row for its token mix.","providers.totals-description-unpriced-n":"Cost is an API-equivalent estimate and excludes {count} unpriced subscription requests. Select a row for its token mix.","providers.no-requests-in-range":"No requests in this range","providers.models-title":"Distinct models used through this provider","providers.share-title":"Fraction of all tokens in range","providers.cost-title":"API-equivalent estimate","providers.tps-title":"Average output throughput","providers.premium-title":"Premium requests (subscription multiplier units)","providers.burn":"Burn by provider","providers.burn-estimate-description":"API-equivalent estimate per {bucket}; excludes unpriced subscription requests","providers.burn-description":"Per {bucket}, top {count} providers stacked","providers.bucket-5m":"5 minutes","providers.bucket-hour":"hour","providers.bucket-day":"day","providers.no-provider-activity":"No provider activity in this range","providers.peak-burn-hours":"Peak burn hours","providers.peak-hours-description":"Tokens by local hour of day; peak at {hour}","providers.hours-description":"Tokens by local hour of day","providers.all-providers":"All providers","providers.tokens-peak-hour":"Tokens (peak hour)","providers.no-activity-in-range":"No activity in this range","providers.subscription-windows":"Subscription windows","providers.subscription-windows-description":"What one usage window buys you and how many accounts peak demand needs. Select a row to chart it.","providers.window":"Window","providers.accounts":"Accounts","providers.accounts-title":"Accounts with at least one snapshot for this window in range","providers.resets":"Resets","providers.resets-title":"Window resets observed (drops in used fraction)","providers.windows-burned":"Windows burned","providers.windows-burned-title":"Subscription-window equivalents consumed in range (sum of used-fraction increases across accounts)","providers.tokens-per-window":"Tokens / window","providers.tokens-per-window-title":"Provider tokens burned in range ÷ windows burned — what one full window is worth","providers.too-little-consumed":"Too little of the window was consumed to extrapolate","providers.peak-utilization":"Peak utilization","providers.peak-utilization-title":"Peak of summed used fraction across accounts at any sampled instant; the bar is relative to fleet capacity","providers.accounts-needed":"Accounts needed","providers.accounts-needed-title":"Accounts needed to keep peak demand under 90% of fleet capacity","providers.ideal-accounts":"{ideal} · have {have}","providers.exhaustions":"Exhaustions","providers.exhaustions-title":"Transitions into an exhausted state observed in range","providers.exhausted-n":"{count} exhausted","providers.no-snapshots-in-range":"No usage snapshots in this range","providers.snapshot-hint":"Usage snapshots accumulate whenever usage limits are fetched (TUI footer, /usage, zetacode usage).","providers.utilization":"Window utilization","providers.utilization-description":"{window} used fraction per account, {from} – {to}","providers.utilization-description-plain":"Recorded limit utilization per account","providers.no-utilization-readings":"No utilization readings for this window","providers.exhausted":"Exhausted","providers.no-reading":"No reading","providers.high":"High","providers.account":"Account","providers.latest-used":"Latest used","providers.status":"Status","providers.peak-in-range":"Peak in range","providers.snapshots":"Snapshots","providers.recorded":"Recorded"},"zh-CN":{"providers.description":"各服务商在{window}内的消耗、可靠性与订阅余量。","providers.most-tokens":"Token 最多:{provider}","providers.failed-n":"{count} 次失败","providers.succeeded-n":"{count} 次成功","providers.tokens-title":"未缓存输入 + 缓存读取 + 缓存写入 + 输出","providers.api-equivalent-cost":"API 等效费用","providers.api-cost-title":"此用量按公开 API 费率计算需要多少费用","providers.unpriced-n":"{count} 个未定价","providers.totals":"服务商汇总","providers.totals-description":"费用为 API 等效估算。选择一行可查看其 Token 构成。","providers.totals-description-unpriced-one":"费用为 API 等效估算,且未包含 {count} 个未定价的订阅请求。选择一行可查看其 Token 构成。","providers.totals-description-unpriced-n":"费用为 API 等效估算,且未包含 {count} 个未定价的订阅请求。选择一行可查看其 Token 构成。","providers.no-requests-in-range":"该时间范围内没有请求","providers.models-title":"通过该服务商使用的不同模型","providers.share-title":"该时间范围内全部 Token 中的占比","providers.cost-title":"API 等效估算","providers.tps-title":"平均输出吞吐量","providers.premium-title":"溢价请求(订阅倍率单位)","providers.burn":"按服务商的消耗","providers.burn-estimate-description":"每{bucket}的 API 等效估算;不含未定价的订阅请求","providers.burn-description":"每{bucket},堆叠显示前 {count} 个服务商","providers.bucket-5m":"5 分钟","providers.bucket-hour":"小时","providers.bucket-day":"天","providers.no-provider-activity":"该时间范围内没有服务商活动","providers.peak-burn-hours":"消耗高峰时段","providers.peak-hours-description":"按本地时段统计的 Token;高峰在 {hour}","providers.hours-description":"按本地时段统计的 Token","providers.all-providers":"全部服务商","providers.tokens-peak-hour":"Token(高峰时段)","providers.no-activity-in-range":"该时间范围内没有活动","providers.subscription-windows":"订阅窗口","providers.subscription-windows-description":"一个用量窗口能带来多少用量,以及峰值需求需要多少个账号。选择一行可将它绘制成图表。","providers.window":"窗口","providers.accounts":"账号","providers.accounts-title":"该时间范围内对此窗口至少有一个快照的账号","providers.resets":"重置次数","providers.resets-title":"观测到的窗口重置次数(已用比例下降)","providers.windows-burned":"消耗的窗口数","providers.windows-burned-title":"该时间范围内消耗的订阅窗口等效量(各账号已用比例增量之和)","providers.tokens-per-window":"Token / 窗口","providers.tokens-per-window-title":"该时间范围内消耗的服务商 Token ÷ 消耗的窗口数 —— 一个完整窗口的价值","providers.too-little-consumed":"该窗口消耗太少,无法外推","providers.peak-utilization":"峰值利用率","providers.peak-utilization-title":"任意采样时刻各账号已用比例之和的峰值;进度条相对于整体容量","providers.accounts-needed":"所需账号数","providers.accounts-needed-title":"将峰值需求控制在整体容量 90% 以下所需的账号数","providers.ideal-accounts":"{ideal} · 现有 {have}","providers.exhaustions":"耗尽次数","providers.exhaustions-title":"该时间范围内观测到的进入耗尽状态的次数","providers.exhausted-n":"{count} 次耗尽","providers.no-snapshots-in-range":"该时间范围内没有用量快照","providers.snapshot-hint":"每当获取用量限额时都会累积用量快照(TUI 底部、/usage、zetacode usage)。","providers.utilization":"窗口利用率","providers.utilization-description":"{window} 各账号的已用比例,{from} – {to}","providers.utilization-description-plain":"各账号已记录的限额利用率","providers.no-utilization-readings":"该窗口没有利用率记录","providers.exhausted":"已耗尽","providers.no-reading":"无读数","providers.high":"偏高","providers.account":"账号","providers.latest-used":"最新已用","providers.status":"状态","providers.peak-in-range":"范围内峰值","providers.snapshots":"快照数","providers.recorded":"记录时间"}};var Ah={en:{"costs.title":"Costs","costs.description":"What {window} of usage would cost at public API rates. Subscription usage without a public price is counted as unpriced, not free.","costs.no-usage-in-range":"No usage in this range","costs.empty-hint":"Pick a wider range in the top bar.","costs.daily-estimate":"Daily estimate","costs.daily-by-model":"Per day, stacked by model","costs.daily-by-component":"Per day, stacked by billing component","costs.split-by":"Split by","costs.by-model":"By model","costs.by-component":"By component","costs.no-priced-usage":"No priced usage in this range","costs.unpriced-requests":"Unpriced requests","costs.where-it-went":"Where it went","costs.estimate-by-component":"Estimate by billing component","costs.unpriced-note-one":"{count} unpriced subscription request is not included.","costs.unpriced-note-n":"{count} unpriced subscription requests are not included.","costs.by-model-description":"Estimate per model with its input, output and cache split","costs.estimate":"Estimate","costs.estimate-title":"API-equivalent estimate at public rates","costs.split":"Split","costs.split-title":"Input · output · cache read · cache write","costs.per-request":"Per request","costs.per-request-title":"Estimate ÷ priced requests","costs.unpriced":"Unpriced","costs.unpriced-column-title":"Requests with no public-equivalent price","costs.api-equivalent-estimate":"API-equivalent estimate","costs.api-estimate-title":"What this usage would cost at public API rates","costs.requests-n":"{count} requests","costs.average-per-day":"Average per day","costs.average-per-day-title":"Estimate ÷ days with any usage","costs.active-days-one":"over {count} active day","costs.active-days-n":"over {count} active days","costs.top-model":"Top model","costs.top-model-hint":"{cost} · {share} of estimate","costs.nothing-priced-yet":"Nothing priced yet","costs.per-priced-request":"Per priced request","costs.per-priced-request-title":"Estimate ÷ requests that have a public price","costs.priced-n":"{count} priced","costs.unpriced-title":"Subscription usage with no public-equivalent price; excluded from the estimate","costs.unpriced-hint":"excluded from the estimate","costs.all-priced":"all usage priced"},"zh-CN":{"costs.title":"费用","costs.description":"按公开 API 费率计算,{window}的用量需要多少费用。没有公开价格的订阅用量计为未定价,而不是免费。","costs.no-usage-in-range":"此时间范围内没有用量","costs.empty-hint":"请在顶栏选择更宽的时间范围。","costs.daily-estimate":"每日估算","costs.daily-by-model":"按本地日统计,按模型堆叠","costs.daily-by-component":"按本地日统计,按计费组件堆叠","costs.split-by":"拆分依据","costs.by-model":"按模型","costs.by-component":"按组件","costs.no-priced-usage":"此时间范围内没有已定价的用量","costs.unpriced-requests":"未定价请求","costs.where-it-went":"费用去向","costs.estimate-by-component":"按计费组件估算","costs.unpriced-note-one":"{count} 个未定价的订阅请求未计入。","costs.unpriced-note-n":"{count} 个未定价的订阅请求未计入。","costs.by-model-description":"按模型估算,并附输入、输出与缓存的拆分","costs.estimate":"估算","costs.estimate-title":"按公开费率计算的 API 等效估算","costs.split":"拆分","costs.split-title":"输入 · 输出 · 缓存读取 · 缓存写入","costs.per-request":"单次请求","costs.per-request-title":"估算值 ÷ 已定价请求数","costs.unpriced":"未定价","costs.unpriced-column-title":"没有公开等效价格的请求","costs.api-equivalent-estimate":"API 等效估算","costs.api-estimate-title":"此用量按公开 API 费率计算需要多少费用","costs.requests-n":"{count} 个请求","costs.average-per-day":"日均","costs.average-per-day-title":"估算值 ÷ 有用量的天数","costs.active-days-one":"共 {count} 个活跃日","costs.active-days-n":"共 {count} 个活跃日","costs.top-model":"费用最高的模型","costs.top-model-hint":"{cost} · 占估算值的 {share}","costs.nothing-priced-yet":"暂无已定价用量","costs.per-priced-request":"单个已定价请求","costs.per-priced-request-title":"估算值 ÷ 有公开价格的请求数","costs.priced-n":"已定价 {count} 个","costs.unpriced-title":"没有公开等效价格的订阅用量;不计入估算","costs.unpriced-hint":"不计入估算","costs.all-priced":"全部用量均已定价"}};var Mh={en:{"requests.description":"Every model call zeta made in {window}, newest first. Open a row for its full payload.","requests.loading":"Loading…","requests.load-latest":"Load latest {count}","requests.status":"Status","requests.status-all":"All","requests.none-in-window":"none in {window}","requests.since":"since {time}","requests.failed-hint":"{rate} · {count} aborted","requests.tokens-hint":"Total tokens across these requests","requests.api-equivalent-cost":"API-equivalent cost","requests.cost-hint":"What these requests would cost at public API rates","requests.unpriced-n":"{count} unpriced","requests.median-duration":"Median duration","requests.p95":"p95 {value}","requests.median-ttft":"Median TTFT","requests.ttft":"TTFT","requests.ttft-hint":"Time to first token","requests.log-title":"Request log","requests.log-loading":"Loading the latest requests…","requests.log-count-in-window":"{shown} of {total} requests in {window}","requests.log-count-latest":"{shown} of the latest {total} requests","requests.search-placeholder":"Model, provider or project","requests.footer":"Showing the latest {count} requests, back to {time}. Older requests in {window} are not loaded.","requests.empty-in-window":"No requests in {window}","requests.empty-no-match":"No requests match","requests.empty-no-match-hint":"Clear the search or status filter.","requests.when":"When","requests.uncached-input":"Uncached input tokens","requests.cache-read-title":"Cache read tokens (hover a cell for cache writes)","requests.cache-write":"Cache write: {count}","requests.cost-estimate":"API-equivalent estimate"},"zh-CN":{"requests.description":"zeta 在 {window} 内发出的每一次模型调用,最新在前。打开某一行可查看其完整载荷。","requests.loading":"加载中…","requests.load-latest":"加载最新 {count} 条","requests.status":"状态","requests.status-all":"全部","requests.none-in-window":"{window} 内没有请求","requests.since":"自 {time} 起","requests.failed-hint":"{rate} · {count} 个已中止","requests.tokens-hint":"这些请求的 Token 总量","requests.api-equivalent-cost":"API 等价费用","requests.cost-hint":"这些请求按公开 API 费率计算的费用","requests.unpriced-n":"{count} 个未定价","requests.median-duration":"耗时中位数","requests.p95":"p95 分位 {value}","requests.median-ttft":"首 Token 延迟中位数","requests.ttft":"首 Token 延迟","requests.ttft-hint":"首 Token 延迟","requests.log-title":"请求日志","requests.log-loading":"正在加载最新请求…","requests.log-count-in-window":"{window} 内共 {total} 个请求,显示 {shown} 个","requests.log-count-latest":"最新 {total} 个请求中显示 {shown} 个","requests.search-placeholder":"模型、服务商或项目","requests.footer":"显示最新 {count} 个请求,回溯至 {time}。{window} 内更早的请求未加载。","requests.empty-in-window":"{window} 内没有请求","requests.empty-no-match":"没有匹配的请求","requests.empty-no-match-hint":"清除搜索内容或状态筛选。","requests.when":"时间","requests.uncached-input":"未缓存输入 Token","requests.cache-read-title":"缓存读取 Token(将鼠标悬停在单元格上可查看缓存写入)","requests.cache-write":"缓存写入:{count}","requests.cost-estimate":"API 等价估算"}};var Dh={en:{"errors.title":"Errors","errors.description":"Failed model requests in {window}, grouped by error signature. Open a failure for its full payload.","errors.footer":"Showing the latest {count} failures in {window}; older ones are not loaded.","errors.loading":"Loading…","errors.load-latest":"Load latest {count}","errors.failures":"Failures","errors.hint-in-window":"in {window}","errors.hint-latest-loaded":"latest {count} loaded","errors.signatures":"Signatures","errors.signatures-hint":"Distinct error messages after normalizing ids and numbers","errors.signatures-top":"top: {count} failures","errors.affected-models":"Affected models","errors.last-failure":"Last failure","errors.none-in-window":"none in {window}","errors.error-signatures":"Error signatures","errors.signatures-card-description":"Same message with ids and counters normalized. Select one to filter the failures below.","errors.empty-no-failures":"No failures in {window}","errors.empty-all-succeeded":"Every request succeeded or was aborted.","errors.by-model":"By model","errors.by-model-description":"Failures per model. Select one to filter.","errors.empty-no-affected-models":"No affected models","errors.loading-failures":"Loading failures…","errors.filtered-of-total":"{shown} of {total} failures, newest first","errors.search-placeholder":"Message, model or project","errors.no-match":"No failures match","errors.no-match-hint":"Clear the search or the selected filters.","errors.signature":"Signature","errors.more-models":"+{count} more","errors.last-seen":"Last seen","errors.unknown-error":"Unknown error","errors.group-meta":"{count} failures · first {first} · last {last}","errors.open-latest":"Open latest","errors.when":"When","errors.cost-hint":"API-equivalent estimate"},"zh-CN":{"errors.title":"错误","errors.description":"在 {window} 内失败的模型请求,按错误签名分组。打开某条失败可查看完整载荷。","errors.footer":"显示 {window} 内最新的 {count} 个失败;更早的未加载。","errors.loading":"加载中…","errors.load-latest":"加载最新 {count} 条","errors.failures":"失败","errors.hint-in-window":"{window} 内","errors.hint-latest-loaded":"已加载最新 {count} 条","errors.signatures":"签名","errors.signatures-hint":"对 ID 和数字归一化后不同的错误消息","errors.signatures-top":"最多:{count} 个失败","errors.affected-models":"受影响的模型","errors.last-failure":"最近一次失败","errors.none-in-window":"{window} 内没有失败","errors.error-signatures":"错误签名","errors.signatures-card-description":"同一消息在归一化 ID 和计数后归为一组。选择一项可筛选下方的失败。","errors.empty-no-failures":"{window} 内没有失败","errors.empty-all-succeeded":"所有请求均已成功或被中止。","errors.by-model":"按模型","errors.by-model-description":"各模型的失败数。选择一项可筛选。","errors.empty-no-affected-models":"没有受影响的模型","errors.loading-failures":"正在加载失败…","errors.filtered-of-total":"共 {total} 个失败,显示 {shown} 个,最新在前","errors.search-placeholder":"消息、模型或项目","errors.no-match":"没有匹配的失败","errors.no-match-hint":"清除搜索内容或已选筛选条件。","errors.signature":"签名","errors.more-models":"另有 {count} 个","errors.last-seen":"最近出现","errors.unknown-error":"未知错误","errors.group-meta":"{count} 个失败 · 首次 {first} · 最近 {last}","errors.open-latest":"打开最新","errors.when":"时间","errors.cost-hint":"按 API 价格估算"}};var Eh={en:{"trace.title":"Traces","trace.description":"Recent sessions with subagent activity folded in. Open one to inspect its timeline.","trace.sessions":"Sessions","trace.session":"Session","trace.most-recent":"{count} most recent","trace.most-recent-filtered":"{shown} of {total} most recent","trace.filter-placeholder":"Filter by title, project, model…","trace.empty-title":"No sessions found","trace.empty-hint":"Run a sync to index recent activity.","trace.no-matching-title":"No matching sessions","trace.no-matching-hint":"Try a different filter.","trace.tool":"Tool","trace.tools":"Tools","trace.agent":"Agent","trace.agents":"Agents","trace.background":"Background","trace.bg":"Bg","trace.refresh":"Refresh trace","trace.timeline":"Timeline","trace.timeline-hint":"W/S zoom · A/D pan · drag pan · wheel zoom · 0 fit · F focus selection · dbl-click focus · Esc deselect","trace.expand-all":"Expand all","trace.collapse-all":"Collapse all","trace.axis-mode":"Axis mode","trace.mode-time-title":"Real wall-clock time","trace.mode-turns-title":"Equal width per user turn","trace.mode-calls-title":"Equal width per model/tool call boundary","trace.turns":"Turns","trace.calls":"Calls","trace.compress-idle":"Compress idle","trace.search-placeholder":"Search spans…","trace.previous-match":"Previous match","trace.next-match":"Next match","trace.transcript":"Transcript","trace.transcript-description":"Every span and marker in order; click to inspect","trace.no-matching-events":"No matching events","trace.canvas-aria":"Trace timeline. W and S zoom, A and D pan, 0 fits all, F focuses the selection.","trace.minimap-aria":"Timeline overview brush","trace.expand-track":"Expand {track}","trace.collapse-track":"Collapse {track}","trace.unterminated":"unterminated","trace.tok":"tok","trace.ttft":"TTFT","trace.wall-time":"Wall time","trace.model-time":"Model time","trace.tool-time":"Tool time","trace.idle":"Idle","trace.tool-calls-n":"{count} tool calls","trace.of-wall":"{percent} of wall","trace.tool-aggregates":"Tool aggregates","trace.tool-aggregates-desc":"{count} tools, by total time","trace.errors":"Errors","trace.failed-n":"{count} failed","trace.avg":"Avg","trace.max":"Max","trace.start":"Start","trace.track":"Track","trace.io-cached":"Input / output / cached","trace.stop-reason":"Stop reason","trace.copy-json":"Copy raw JSON","trace.error-message":"Error message","trace.task":"Task","trace.open-child-track":"Open child track","trace.args":"Args","trace.thinking":"Thinking","trace.text":"Text","trace.raw-entry":"Raw entry","trace.load-failed":"Failed to load entry: {message}"},"zh-CN":{"trace.title":"调用链","trace.description":"最近的会话,已合并子代理活动。打开其中一个即可查看其时间线。","trace.sessions":"会话","trace.session":"会话","trace.most-recent":"最近 {count} 条","trace.most-recent-filtered":"最近 {total} 条中的 {shown} 条","trace.filter-placeholder":"按标题、项目或模型筛选…","trace.empty-title":"未找到会话","trace.empty-hint":"运行一次同步以索引最近的活动。","trace.no-matching-title":"没有匹配的会话","trace.no-matching-hint":"请尝试其他筛选条件。","trace.tool":"工具","trace.tools":"工具","trace.agent":"智能体","trace.agents":"智能体","trace.background":"后台","trace.bg":"背景","trace.refresh":"刷新调用链","trace.timeline":"时间线","trace.timeline-hint":"W/S 缩放 · A/D 平移 · 拖拽平移 · 滚轮缩放 · 0 适应全部 · F 聚焦所选 · 双击聚焦 · Esc 取消选择","trace.expand-all":"全部展开","trace.collapse-all":"全部折叠","trace.axis-mode":"坐标轴模式","trace.mode-time-title":"真实墙钟时间","trace.mode-turns-title":"每个用户轮次等宽","trace.mode-calls-title":"每个模型/工具调用边界等宽","trace.turns":"轮次","trace.calls":"调用次数","trace.compress-idle":"压缩空闲时间","trace.search-placeholder":"搜索跨度…","trace.previous-match":"上一个匹配","trace.next-match":"下一个匹配","trace.transcript":"对话记录","trace.transcript-description":"按顺序列出所有跨度和标记;点击可查看详情","trace.no-matching-events":"没有匹配的事件","trace.canvas-aria":"调用链时间线。W 和 S 缩放,A 和 D 平移,0 适应全部,F 聚焦所选。","trace.minimap-aria":"时间线概览刷选","trace.expand-track":"展开 {track}","trace.collapse-track":"折叠 {track}","trace.unterminated":"未结束","trace.tok":"Token","trace.ttft":"首 Token 延迟","trace.wall-time":"墙钟时间","trace.model-time":"模型耗时","trace.tool-time":"工具耗时","trace.idle":"空闲","trace.tool-calls-n":"{count} 次工具调用","trace.of-wall":"占墙钟时间 {percent}","trace.tool-aggregates":"工具汇总","trace.tool-aggregates-desc":"{count} 个工具,按总耗时排序","trace.errors":"错误","trace.failed-n":"{count} 个失败","trace.avg":"平均","trace.max":"最大","trace.start":"开始","trace.track":"轨道","trace.io-cached":"输入 / 输出 / 缓存读取","trace.stop-reason":"停止原因","trace.copy-json":"复制原始 JSON","trace.error-message":"错误信息","trace.task":"任务","trace.open-child-track":"打开子轨道","trace.args":"参数","trace.thinking":"思考过程","trace.text":"文本","trace.raw-entry":"原始条目","trace.load-failed":"加载条目失败:{message}"}};var Nh={en:{"tools.title":"Tools","tools.description":"Which tools zeta called in {window}, how often they failed, and what they cost.","tools.tool-calls":"Tool calls","tools.failed-n":"{count} failed","tools.distinct-tools":"Distinct tools","tools.most-used":"Most used: {tool}","tools.error-rate-title":"Tool results that came back flagged as errors","tools.succeeded-n":"{count} succeeded","tools.attributed-tokens":"Attributed tokens","tools.tokens-output":"{tokens} output","tools.attributed-cost":"Attributed cost","tools.attribution-note":"Tokens and API-equivalent cost of each invoking turn, split evenly across that turn's tool calls","tools.attribution-estimate":"{note}; API-equivalent estimate","tools.unpriced-requests-n":"{count} unpriced requests","tools.api-equivalent":"API-equivalent","tools.result-text":"Result text","tools.result-chars-title":"Characters of tool-result text fed back into context","tools.chars":"{count} chars","tools.call-arguments":"Call arguments","tools.args-chars-title":"Characters of serialized tool-call arguments","tools.avg-result-per-call":"Avg result per call","tools.avg-args-per-call":"Avg arguments per call","tools.calls-over-time":"Calls over time","tools.errors-over-time":"Errors over time","tools.chart-description":"Per {bucket}, top {count} tools stacked","tools.bucket-5m":"5 minutes","tools.bucket-hour":"hour","tools.bucket-day":"day","tools.calls":"Calls","tools.errors":"Errors","tools.no-tool-errors":"No tool errors in this range","tools.by-tool":"By tool","tools.by-tool-description":"{note}. Select a tool to break it down by model.","tools.by-tool-and-model":"By tool and model","tools.by-tool-and-model-description":"Which models call which tools, and how often those calls fail","tools.filter-by-tool":"Filter by tool","tools.all-tools":"All tools","tools.clear-tool-filter":"Clear tool filter","tools.no-tool-calls":"No tool calls in this range","tools.no-calls-to-tool":"No calls to {tool} in this range","tools.tool":"Tool","tools.trend":"Trend","tools.trend-title":"Calls per bucket over the range","tools.share-of-calls":"{percent} of all tool calls","tools.errors-title":"Calls whose result came back flagged as an error","tools.args":"Args","tools.result":"Result","tools.result-per-call":"Result / call","tools.result-per-call-title":"Mean tool-result characters per call","tools.attr-tokens":"Attr. tokens","tools.share-of-tokens":"{percent} of attributed tokens","tools.attr-cost":"Attr. cost","tools.share-of-cost":"{percent} of attributed cost","tools.last-used":"Last used"},"zh-CN":{"tools.title":"工具","tools.description":"zeta 在{window}调用了哪些工具、它们的失败频率如何,以及产生了多少费用。","tools.tool-calls":"工具调用","tools.failed-n":"{count} 个失败","tools.distinct-tools":"不同工具数","tools.most-used":"使用最多:{tool}","tools.error-rate-title":"返回时被标记为错误的工具结果","tools.succeeded-n":"{count} 个成功","tools.attributed-tokens":"归属 Token","tools.tokens-output":"{tokens} 输出","tools.attributed-cost":"归属费用","tools.attribution-note":"每次调用回合的 Token 与 API 等价费用,平均分摊到该回合的各个工具调用","tools.attribution-estimate":"{note};按 API 等价估算","tools.unpriced-requests-n":"{count} 个未定价请求","tools.api-equivalent":"按 API 等价","tools.result-text":"结果文本","tools.result-chars-title":"回填到上下文中的工具结果文本字符数","tools.chars":"{count} 字符","tools.call-arguments":"调用参数","tools.args-chars-title":"序列化后的工具调用参数字符数","tools.avg-result-per-call":"每次调用平均结果","tools.avg-args-per-call":"每次调用平均参数","tools.calls-over-time":"调用次数随时间变化","tools.errors-over-time":"错误数随时间变化","tools.chart-description":"按{bucket}统计,堆叠显示前 {count} 个工具","tools.bucket-5m":"5 分钟","tools.bucket-hour":"小时","tools.bucket-day":"天","tools.calls":"调用次数","tools.errors":"错误数","tools.no-tool-errors":"该时间范围内没有工具错误","tools.by-tool":"按工具","tools.by-tool-description":"{note}。选择某个工具可按模型细分。","tools.by-tool-and-model":"按工具和模型","tools.by-tool-and-model-description":"哪些模型调用了哪些工具,以及这些调用的失败频率","tools.filter-by-tool":"按工具筛选","tools.all-tools":"全部工具","tools.clear-tool-filter":"清除工具筛选","tools.no-tool-calls":"该时间范围内没有工具调用","tools.no-calls-to-tool":"该时间范围内没有对 {tool} 的调用","tools.tool":"工具","tools.trend":"趋势","tools.trend-title":"时间范围内每个分桶的调用次数","tools.share-of-calls":"占全部工具调用的 {percent}","tools.errors-title":"结果返回时被标记为错误的调用","tools.args":"参数","tools.result":"结果","tools.result-per-call":"结果 / 次","tools.result-per-call-title":"每次调用平均工具结果字符数","tools.attr-tokens":"归属 Token","tools.share-of-tokens":"占归属 Token 的 {percent}","tools.attr-cost":"归属费用","tools.share-of-cost":"占归属费用的 {percent}","tools.last-used":"最近使用"}};var qh={en:{"frustration.estimate-note":"Identical messages share one verdict, and verdicts are cached, so later runs only pay for new messages. Nothing is spent until you proceed.","frustration.column-model-ids":"Model IDs","frustration.column-messages":"Messages","frustration.column-judged":"Judged","frustration.model-versions":"Model versions","frustration.no-model-match":"No model versions match the filters","frustration.small-models-title":"Models with fewer than {count} messages have noisy rates","frustration.hide-regex-title":"Hide models with under {share}% judged messages (rates from regex signals)","frustration.hatch-title":"Under {share}% of these messages are judged; their rates come from regex signals","frustration.regex-badge":"regex","frustration.legend-annoyed-any":"Annoyed, any target","frustration.table-description":"Rates are shares of user messages; rows follow the chart filters.","frustration.running":"Running","frustration.estimating":"Estimating cost…","frustration.failed-n":"{count} failed","frustration.cost-so-far":"cost so far","frustration.elapsed":"elapsed {time}","frustration.in-flight":"{count} in flight","frustration.messages-progress":"{done}/{total} messages","frustration.failed-suffix":", {count} failed","frustration.judge-with":" with {judge}","frustration.in-time":" in {time}","frustration.run-done-line":"Last run judged {progress}{failed}{judge}{elapsed} for {cost}.","frustration.run-cancelled-line":"Last run cancelled after {progress}{failed}; spent {cost}.","frustration.run-failed-line":"Last run failed after {progress}{failed}: {error}. Spent {cost}.","frustration.title":"Frustration","frustration.description":"How often your messages sound annoyed, per model version, in {window}.","frustration.user-messages":"User messages","frustration.user-messages-title":"User messages with prose in range","frustration.judge-coverage":"Judge coverage","frustration.judge-coverage-title":"Messages with a cached judge verdict; the rest use the regex lexicons","frustration.coverage-hint":"{judged} judged · {regex} regex","frustration.coverage-unscored":" · {count} unscored (no lexicon)","frustration.unscored-line":"Messages in a language without a lexicon: {count} — unscored, not calm.","frustration.annoyed":"Annoyed","frustration.annoyed-title":"Messages annoyed at any target","frustration.at-assistant":"At assistant","frustration.at-assistant-title":"Messages annoyed at the assistant","frustration.angry":"Angry","frustration.angry-title":"Messages angry or hostile toward the assistant","frustration.messages-n":"{count} messages","frustration.judge-panel":"Judge classification","frustration.judge-description":"Cached LLM verdicts replace the regex lexicons; unjudged messages fall back to regex signals. Messages in a language no lexicon covers are reported as unscored rather than counted as calm.","frustration.classify":"Classify with judge","frustration.proceed":"Proceed","frustration.starting":"Starting…","frustration.judge-running":"A judge run is in progress","frustration.quote-title":"Quote the cost of judging every unjudged message in range","frustration.estimated-cost":"Estimated cost","frustration.unjudged-messages":"Unjudged unique messages","frustration.prose-chars":"Prose characters","frustration.input-tokens":"Estimated input tokens","frustration.judge-model":"Judge","frustration.all-judged":"Everything in this range is already judged. There is nothing left to classify.","frustration.no-run-yet":"No judge run yet. Classify the unjudged messages to replace regex estimates with verdicts.","frustration.last-run-done":"Last run done","frustration.last-run-cancelled":"Last run cancelled","frustration.last-run-failed":"Last run failed","frustration.not-run-yet":"Not run yet","frustration.regex-only":"Regex only","frustration.cancel-run":"Cancel run","frustration.cancelling":"Cancelling…","frustration.run-judged":"Last run judged {progress}","frustration.run-cancelled-after":"Last run cancelled after {progress}","frustration.run-failed-after":"Last run failed after {progress}","frustration.by-model":"Frustration by model version","frustration.by-model-description":"Share of user messages per model version. Each bar reaches the annoyed rate; the subsets aimed at the assistant stack inside it.","frustration.all-classes":"All","frustration.every-model-class":"Every model class","frustration.model-class":"Model class","frustration.include-small":"Include < {count} messages","frustration.unclassified":"unclassified","frustration.legend-angry":"Angry at assistant","frustration.legend-assistant":"At assistant, not angry","frustration.legend-other":"Annoyed at other targets","frustration.legend-trend":"At assistant trend","frustration.legend-hatched":"Hatched: mostly regex fallback","frustration.legend-hatched-run":"Hatched: mostly regex fallback (run the judge)","frustration.legend-hue":"Hue = model family","frustration.no-messages":"No user messages in this range","frustration.try-longer-range":"Try a longer range.","frustration.mostly-regex":"Mostly regex fallback: run the judge for accurate rates","frustration.row-mostly-regex":" · mostly regex fallback","frustration.stack-relation":"annoyed ⊇ atAssistant ⊇ angry","frustration.unknown-error":"unknown error","frustration.cancelled":"Cancelled","frustration.failed":"Failed","frustration.done":"Done","frustration.model-side-title":"AI breakdown","frustration.model-side-description":"How the model's own replies read, per model version, in {window}.","frustration.model-turns":"Assistant turns","frustration.model-turns-title":"Assistant replies with text in range; tool-call-only replies and thinking blocks are not analyzed","frustration.model-breakdown":"Breakdown rate","frustration.model-breakdown-title":"Share of analyzed turns with at least one breakdown signal","frustration.model-mean":"Signals / turn","frustration.model-mean-title":"Average per-turn aggregate: text markers plus capped failed tool results","frustration.model-self-blame":"Self-blame","frustration.model-self-blame-title":"Turns containing an apology or admission","frustration.model-restatement":"Restatement","frustration.model-restatement-title":"Turns repeating earlier content, by explicit marker or near-duplicate reply","frustration.model-hedge":"Hedged","frustration.model-hedge-title":"Turns with hedged fallbacks: uncertainty or suggested alternatives","frustration.model-spiral":"Tool spirals","frustration.model-spiral-title":"Turns following three or more failed tool results","frustration.model-rambling":"Rambling","frustration.model-rambling-title":"Turns past the verbosity threshold","frustration.model-unscored-line":"Turns in a language without a lexicon: {count} — unscored, not calm.","frustration.model-by-model":"AI breakdown by model version","frustration.model-table-title":"Model breakdown detail","frustration.model-by-model-description":"Share of each model's analyzed turns carrying a breakdown signal. Hue = model family.","frustration.model-over-time":"AI breakdown over time","frustration.model-over-time-description":"Breakdown rate per bucket: turns with a signal over analyzed turns. Gaps are buckets with no turns.","frustration.model-sessions":"Sessions by breakdown","frustration.model-sessions-description":"Sessions with the most analyzed assistant turns.","frustration.model-table-description":"Rates are shares of analyzed assistant turns.","frustration.column-session":"Session","frustration.column-turns":"Turns","frustration.column-mean":"Signals/turn","frustration.column-tool-errors":"Tool errors","frustration.model-no-turns":"No assistant turns with text in this range","frustration.model-try-longer-range":"Try a longer range.","frustration.model-legend-breakdown":"Breakdown rate","frustration.turns-n":"{count} turns","frustration.model-hint-mean":"{value} signals per turn on average"},"zh-CN":{"frustration.estimate-note":"内容相同的消息共用一份结论,且结论会被缓存,因此后续运行只为新消息付费。在你开始之前不会产生任何费用。","frustration.column-model-ids":"模型 ID","frustration.column-messages":"消息数","frustration.column-judged":"已评判","frustration.model-versions":"模型版本","frustration.no-model-match":"没有符合筛选条件的模型版本","frustration.small-models-title":"消息少于 {count} 条的模型比例噪声较大","frustration.hide-regex-title":"隐藏已评判比例低于 {share}% 的模型(其比例来自正则信号)","frustration.hatch-title":"这些消息中已评判比例低于 {share}%,其比例来自正则信号","frustration.regex-badge":"正则","frustration.legend-annoyed-any":"不耐烦(任意对象)","frustration.table-description":"比例为占用户消息的百分比;行跟随图表筛选。","frustration.running":"运行中","frustration.estimating":"正在估算费用…","frustration.failed-n":"{count} 条失败","frustration.cost-so-far":"当前费用","frustration.elapsed":"已用时 {time}","frustration.in-flight":"并发 {count}","frustration.messages-progress":"{done}/{total} 条消息","frustration.failed-suffix":",{count} 条失败","frustration.judge-with":",评判模型 {judge}","frustration.in-time":",用时 {time}","frustration.run-done-line":"上次运行评判了 {progress}{failed}{judge}{elapsed},花费 {cost}。","frustration.run-cancelled-line":"上次运行在 {progress}{failed} 后取消,花费 {cost}。","frustration.run-failed-line":"上次运行在 {progress}{failed} 后失败:{error}。花费 {cost}。","frustration.title":"情绪压力","frustration.description":"按模型版本统计你的消息有多不耐烦({window})。","frustration.user-messages":"用户消息","frustration.user-messages-title":"该时间范围内的用户消息(含正文)","frustration.judge-coverage":"判据覆盖率","frustration.judge-coverage-title":"已有缓存的评判模型结论的消息;其余使用正则词典","frustration.coverage-hint":"{judged} 条已评判 · {regex} 条正则","frustration.coverage-unscored":" · {count} 条未评分(无词典)","frustration.unscored-line":"缺少对应词典的语言:{count} 条 —— 未评分,不代表平静。","frustration.annoyed":"不耐烦","frustration.annoyed-title":"对任何对象不耐烦的消息","frustration.at-assistant":"针对助手","frustration.at-assistant-title":"对助手不耐烦的消息","frustration.angry":"发怒","frustration.angry-title":"对助手发怒或带有敌意的消息","frustration.messages-n":"{count} 条消息","frustration.judge-panel":"评判模型分类","frustration.judge-description":"缓存的模型结论会取代正则词典;未评判的消息回退到正则信号。缺少词典的语言显示为未评分,而不是判定为平静。","frustration.classify":"用评判模型分类","frustration.proceed":"开始","frustration.starting":"正在开始…","frustration.judge-running":"评判任务正在进行","frustration.quote-title":"估算对该范围内所有未评判消息进行判定的成本","frustration.estimated-cost":"预估费用","frustration.unjudged-messages":"未评判的唯一消息","frustration.prose-chars":"正文字符数","frustration.input-tokens":"预估输入 Token","frustration.judge-model":"评判模型","frustration.all-judged":"该范围内已全部评判,没有需要分类的消息。","frustration.no-run-yet":"尚未运行评判。对未评判的消息分类,即可用结论取代正则估算。","frustration.last-run-done":"上次运行完成","frustration.last-run-cancelled":"上次运行已取消","frustration.last-run-failed":"上次运行失败","frustration.not-run-yet":"尚未运行","frustration.regex-only":"仅正则","frustration.cancel-run":"取消运行","frustration.cancelling":"正在取消…","frustration.run-judged":"上次运行已评判 {progress}","frustration.run-cancelled-after":"上次运行在 {progress} 后取消","frustration.run-failed-after":"上次运行在 {progress} 后失败","frustration.by-model":"按模型版本的情绪压力","frustration.by-model-description":"各模型版本中用户消息的占比。每根柱子到达不耐烦比例,其中针对助手的子集叠在其内部。","frustration.all-classes":"全部","frustration.every-model-class":"所有模型类别","frustration.model-class":"模型类别","frustration.include-small":"包含少于 {count} 条消息","frustration.unclassified":"未分类","frustration.legend-angry":"对助手发怒","frustration.legend-assistant":"针对助手但未发怒","frustration.legend-other":"对其他对象不耐烦","frustration.legend-trend":"针对助手趋势","frustration.legend-hatched":"斜线:多为正则回退","frustration.legend-hatched-run":"斜线:多为正则回退(运行评判)","frustration.legend-hue":"色相 = 模型家族","frustration.no-messages":"该时间范围内没有用户消息","frustration.try-longer-range":"试试更长的时间范围。","frustration.mostly-regex":"多为正则回退:运行评判以获得准确比例","frustration.row-mostly-regex":" · 多为正则回退","frustration.stack-relation":"不耐烦 ⊇ 针对助手 ⊇ 发怒","frustration.unknown-error":"未知错误","frustration.cancelled":"已取消","frustration.failed":"失败","frustration.done":"完成","frustration.model-side-title":"AI 崩溃度","frustration.model-side-description":"各模型版本自身回复的读感,统计窗口:{window}。","frustration.model-turns":"助手回合","frustration.model-turns-title":"时间范围内带文本的助手回复;仅含工具调用的回复与思考块不参与分析","frustration.model-breakdown":"崩溃率","frustration.model-breakdown-title":"至少带一个崩溃信号的已分析回合占比","frustration.model-mean":"信号 / 回合","frustration.model-mean-title":"每回合聚合均值:文本标记加上封顶的工具失败数","frustration.model-self-blame":"自责","frustration.model-self-blame-title":"包含道歉或认错的回合","frustration.model-restatement":"重复陈述","frustration.model-restatement-title":"以显式标记或与上一条回复高度相似的方式重复先前内容的回合","frustration.model-hedge":"含糊兜底","frustration.model-hedge-title":"带有含糊兜底的回合:不确定表述或建议替代方案","frustration.model-spiral":"工具失败螺旋","frustration.model-spiral-title":"紧随三个及以上工具失败之后的回合","frustration.model-rambling":"冗长","frustration.model-rambling-title":"超过冗长阈值的回合","frustration.model-unscored-line":"使用无词典语言的回合:{count} — 未评分,而非平静。","frustration.model-by-model":"各模型版本的 AI 崩溃度","frustration.model-table-title":"模型崩溃明细","frustration.model-by-model-description":"每个模型已分析回合中带崩溃信号的占比。色相 = 模型家族。","frustration.model-over-time":"AI 崩溃度随时间变化","frustration.model-over-time-description":"每个时间桶的崩溃率:带信号的回合除以已分析回合。空白表示该桶没有回合。","frustration.model-sessions":"按崩溃度查看会话","frustration.model-sessions-description":"已分析助手回合最多的会话。","frustration.model-table-description":"比例为已分析助手回合的占比。","frustration.column-session":"会话","frustration.column-turns":"回合数","frustration.column-mean":"信号/回合","frustration.column-tool-errors":"工具错误","frustration.model-no-turns":"该时间范围内没有带文本的助手回合","frustration.model-try-longer-range":"试试更长的时间范围。","frustration.model-legend-breakdown":"崩溃率","frustration.turns-n":"{count} 个回合","frustration.model-hint-mean":"平均每回合 {value} 个信号"}};var Oh={en:{"projects.title":"Projects","projects.description":"Usage by session folder in {window}.","projects.folders":"Folders","projects.folder":"Folder","projects.temporary-n":"{count} temporary","projects.failed-n":"{count} failed","projects.api-equivalent-cost":"API-equivalent cost","projects.api-equivalent-cost-hint":"What this usage would cost at public API rates","projects.unpriced-n":"{count} unpriced","projects.conversation-tokens":"Conversation tokens","projects.conversation-tokens-hint":"Uncached input + cache reads + cache writes + output","projects.cache-rate":"Cache rate","projects.cache-rate-hint":"Cache reads ÷ (uncached input + cache reads)","projects.cache-rate-hint-all":"Cache reads ÷ (uncached input + cache reads), across every folder","projects.top-by-cost":"Top by cost","projects.top-by-cost-description":"Share of API-equivalent cost","projects.top-by-requests":"Top by requests","projects.top-by-requests-description":"Share of all requests","projects.folders-n":"{count} folders","projects.folders-of-n":"{count} of {total} folders","projects.hide-temporary":"Hide temporary ({count})","projects.hide-temporary-hint":"Session folders under /tmp or /var/folders","projects.filter-placeholder":"Filter folders…","projects.empty-no-folders":"No project folders in this range","projects.empty-only-temporary":"Only temporary folders in this range","projects.empty-no-match":"No folders match","projects.hint-longer-range":"Try a longer range.","projects.hint-temporary-hidden":"Temporary folders are hidden.","projects.temp":"temp","projects.share-of-requests":"{share} of all requests","projects.share-of-cost":"{share} of all cost","projects.api-equivalent-cost-rates":"API-equivalent cost at public API rates","projects.cache-savings":"Cache savings","projects.cache-savings-hint":"Prompt-input cost saved versus billing the same tokens uncached","projects.errors":"Errors","projects.avg-duration":"Avg duration","projects.last-active":"Last active"},"zh-CN":{"projects.title":"项目","projects.description":"{window}内按会话文件夹统计的用量。","projects.folders":"文件夹","projects.folder":"文件夹","projects.temporary-n":"{count} 个临时","projects.failed-n":"{count} 个失败","projects.api-equivalent-cost":"API 等效费用","projects.api-equivalent-cost-hint":"这些用量按公开 API 费率计算所需的费用","projects.unpriced-n":"{count} 个未计价","projects.conversation-tokens":"对话 Token","projects.conversation-tokens-hint":"未缓存输入 + 缓存读取 + 缓存写入 + 输出","projects.cache-rate":"缓存命中率","projects.cache-rate-hint":"缓存读取 ÷(未缓存输入 + 缓存读取)","projects.cache-rate-hint-all":"缓存读取 ÷(未缓存输入 + 缓存读取),覆盖所有文件夹","projects.top-by-cost":"费用最高","projects.top-by-cost-description":"占 API 等效费用的比例","projects.top-by-requests":"请求最多","projects.top-by-requests-description":"占全部请求的比例","projects.folders-n":"{count} 个文件夹","projects.folders-of-n":"{total} 个文件夹中的 {count} 个","projects.hide-temporary":"隐藏临时文件夹({count})","projects.hide-temporary-hint":"/tmp 或 /var/folders 下的会话文件夹","projects.filter-placeholder":"筛选文件夹…","projects.empty-no-folders":"该时间范围内没有项目文件夹","projects.empty-only-temporary":"该时间范围内只有临时文件夹","projects.empty-no-match":"没有匹配的文件夹","projects.hint-longer-range":"试试更长的时间范围。","projects.hint-temporary-hidden":"临时文件夹已隐藏。","projects.temp":"临时","projects.share-of-requests":"占全部请求的 {share}","projects.share-of-cost":"占全部费用的 {share}","projects.api-equivalent-cost-rates":"按公开 API 费率计算的等效费用","projects.cache-savings":"缓存节省","projects.cache-savings-hint":"同样的 Token 按未缓存计费时,提示输入费用节省的比例","projects.errors":"错误","projects.avg-duration":"平均耗时","projects.last-active":"最近活动"}};var Bh={en:{"tracking.title":"Tracking","tracking.description":"Read-only snapshot of a project's tracking documents: process state, not learned facts.","tracking.project":"Project","tracking.select-project":"Select a project…","tracking.no-projects":"No projects in the stats registry","tracking.no-projects-hint":"Tracking is scoped to folders the stats database has seen.","tracking.read-only":"The dashboard only reads these files; it never writes tracking.","tracking.directory":"Directory","tracking.updated":"Updated","tracking.none":"None","tracking.no-documents":"No tracking documents","tracking.no-documents-hint":"Tracking is opt-in. Run /tracking on, or enable tools → Project Tracking (tracking.enabled) in /settings, then /tracking start.","tracking.status":"Status","tracking.index":"Index","tracking.actions":"Actions","tracking.sessions":"Sessions","tracking.phase":"Phase","tracking.progress":"Progress","tracking.blockers":"Blockers","tracking.decisions":"Decisions","tracking.stage":"Stage","tracking.phases":"Todo phases","tracking.last-updated":"Last updated","tracking.last-session":"Last session","tracking.missing":"Missing","tracking.partial":"Partial","tracking.corrupt":"Corrupt","tracking.error":"Error","tracking.truncated":"Truncated read","tracking.status-missing":"status.json is missing","tracking.status-corrupt":"status.json is not valid JSON","tracking.status-error":"Could not read status.json","tracking.index-missing":"INDEX.md is missing","tracking.actions-missing":"No action log yet","tracking.sessions-missing":"No sessions directory yet","tracking.sessions-empty":"No session documents","tracking.invalid-rows":"{count} malformed action rows skipped","tracking.actions-empty":"The action log has no readable rows","tracking.document-empty":"This document is empty"},"zh-CN":{"tracking.title":"追踪","tracking.description":"项目追踪文档的只读快照:这里是过程状态,不是学到的知识事实。","tracking.project":"项目","tracking.select-project":"选择项目…","tracking.no-projects":"统计注册表中没有项目","tracking.no-projects-hint":"追踪只读取统计数据库见过的项目文件夹。","tracking.read-only":"仪表盘只读取这些文件,绝不写入追踪。","tracking.directory":"目录","tracking.updated":"更新时间","tracking.none":"无","tracking.no-documents":"没有追踪文档","tracking.no-documents-hint":"追踪是可选功能。运行 /tracking on,或在 /settings → tools → Project Tracking(tracking.enabled)中启用,然后执行 /tracking start。","tracking.status":"状态","tracking.index":"索引","tracking.actions":"操作","tracking.sessions":"会话","tracking.phase":"阶段","tracking.progress":"进度","tracking.blockers":"阻塞","tracking.decisions":"决策","tracking.stage":"当前阶段","tracking.phases":"待办阶段","tracking.last-updated":"最近更新","tracking.last-session":"最近会话","tracking.missing":"缺失","tracking.partial":"不完整","tracking.corrupt":"损坏","tracking.error":"错误","tracking.truncated":"读取已截断","tracking.status-missing":"status.json 缺失","tracking.status-corrupt":"status.json 不是有效 JSON","tracking.status-error":"无法读取 status.json","tracking.index-missing":"INDEX.md 缺失","tracking.actions-missing":"还没有操作日志","tracking.sessions-missing":"还没有 sessions 目录","tracking.sessions-empty":"没有会话文档","tracking.invalid-rows":"已跳过 {count} 行格式错误的操作记录","tracking.actions-empty":"操作日志没有可读记录","tracking.document-empty":"该文档为空"}};var zh={en:{"gain.title":"Gain","gain.description":"Tokens snapcompact kept out of context in {window}.","gain.description-scoped":"Tokens snapcompact kept out of context for {project} in {window}.","gain.all-projects":"All projects","gain.empty-title":"No savings recorded in {window}","gain.empty-title-scoped":"No savings recorded for {project} in {window}","gain.empty-hint-all":"Savings appear here once snapcompact compacts tool output.","gain.empty-hint-longer-range":"Try a longer range.","gain.saved-tokens":"Saved tokens","gain.saved-bytes":"Saved bytes","gain.reduction":"Reduction","gain.reduction-title":"Saved bytes ÷ original bytes, when the original size is known","gain.reduction-unknown":"original size not recorded","gain.hits":"Hits","gain.saved-per-hit":"Saved per hit","gain.savings-over-time":"Savings over time","gain.savings-over-time-description":"Tokens saved per day, with the running total","gain.saved-per-day":"Saved per day","gain.cumulative":"Cumulative","gain.by-source":"By source","gain.by-source-description":"Savings per subsystem","gain.source":"Source"},"zh-CN":{"gain.title":"收益","gain.description":"在{window}内被 snapcompact 挡在上下文之外的 Token。","gain.description-scoped":"在{window}内被 snapcompact 为 {project} 挡在上下文之外的 Token。","gain.all-projects":"全部项目","gain.empty-title":"在{window}内没有节省记录","gain.empty-title-scoped":"在{window}内没有 {project} 的节省记录","gain.empty-hint-all":"snapcompact 压缩工具输出后,节省量会显示在这里。","gain.empty-hint-longer-range":"请尝试更长的时间范围。","gain.saved-tokens":"节省的 Token","gain.saved-bytes":"节省的字节","gain.reduction":"节省比例","gain.reduction-title":"原始大小已知时,节省字节 ÷ 原始字节","gain.reduction-unknown":"未记录原始大小","gain.hits":"命中次数","gain.saved-per-hit":"每次命中节省","gain.savings-over-time":"节省趋势","gain.savings-over-time-description":"按本地日统计节省的 Token,以及累计总量","gain.saved-per-day":"每日节省","gain.cumulative":"累计","gain.by-source":"按来源","gain.by-source-description":"各子系统节省量","gain.source":"来源"}};var Ph={en:{"ui.table-shown-of":"{shown} of {total}","ui.show-fewer":"Show fewer","ui.retry":"Retry","ui.delta-new":"new","ui.json":"JSON","ui.trace":"Trace","ui.open-trace":"Open this request's session in the trace view","ui.status-ok":"OK","ui.section-timing":"Timing","ui.time-to-first-token":"Time to first token","ui.uncached-input":"Uncached input","ui.section-cost":"API-equivalent cost","ui.section-identity":"Identity","ui.stop-reason":"Stop reason","ui.api":"API","ui.session-file":"Session file","ui.stats-row":"Stats row"},"zh-CN":{"ui.table-shown-of":"已显示 {shown} / 共 {total}","ui.show-fewer":"收起","ui.retry":"重试","ui.delta-new":"新增","ui.json":"JSON 数据","ui.trace":"调用链","ui.open-trace":"在调用链视图中打开该请求的会话","ui.status-ok":"正常","ui.section-timing":"时间","ui.time-to-first-token":"首 Token 延迟","ui.uncached-input":"未缓存输入","ui.section-cost":"API 等价费用","ui.section-identity":"标识","ui.stop-reason":"停止原因","ui.api":"接口","ui.session-file":"会话文件","ui.stats-row":"统计行"}};var Uh={en:{},"zh-CN":{}};var qE={...wh.en,...Ch.en,...Th.en,...Ih.en,...Rh.en,...Ah.en,...Mh.en,...Dh.en,...Eh.en,...Nh.en,...qh.en,...Oh.en,...Bh.en,...zh.en,...Ph.en,...Uh.en},$T={id:"en",messages:qE};var OE={...wh["zh-CN"],...Ch["zh-CN"],...Th["zh-CN"],...Ih["zh-CN"],...Rh["zh-CN"],...Ah["zh-CN"],...Mh["zh-CN"],...Dh["zh-CN"],...Eh["zh-CN"],...Nh["zh-CN"],...qh["zh-CN"],...Oh["zh-CN"],...Bh["zh-CN"],...zh["zh-CN"],...Ph["zh-CN"],...Uh["zh-CN"]},XT={id:"zh-CN",messages:OE};function BE(){return globalThis.__ZETA_STATS_LOCALE__}var zE={en:$T.messages,"zh-CN":XT.messages},YT="zeta.stats.locale",ub=new Set,Hh="en";UE();function Or(){return Hh}function KT(r){return ub.add(r),()=>{ub.delete(r)}}function _h(r){return Hh=Lh(r),Hh}function QT(r){let l=_h(r);try{globalThis.localStorage?.setItem(YT,l)}catch{}for(let i of[...ub])i();return l}function PE(){try{let r=globalThis.localStorage?.getItem(YT);if(!r)return;let l=Lh(r);return l==="en"||l==="zh-CN"?l:void 0}catch{return}}function UE(){let r=PE();if(r)return _h(r);let l=BE();if(l)return _h(l);if(typeof navigator>"u")return"en";return _h(VT(navigator.languages))}function u(r,l){return jT(Hh,r,zE,l)}var ZT=60000,Fh=60*ZT,tn=24*Fh,db={"1h":{labelKey:"common.range-1h",windowKey:"common.window-1h",spanMs:Fh,bucketMs:5*ZT},"24h":{labelKey:"common.range-24h",windowKey:"common.window-24h",spanMs:tn,bucketMs:Fh},"7d":{labelKey:"common.range-7d",windowKey:"common.window-7d",spanMs:7*tn,bucketMs:tn},"30d":{labelKey:"common.range-30d",windowKey:"common.window-30d",spanMs:30*tn,bucketMs:tn},"90d":{labelKey:"common.range-90d",windowKey:"common.window-90d",spanMs:90*tn,bucketMs:tn},all:{labelKey:"common.range-all",windowKey:"common.window-all",spanMs:null,bucketMs:tn}},_E=1500,Zu=["1h","24h","7d","30d","90d","all"];function aa(r){return db[r]}var cb={hour:"2-digit",minute:"2-digit",hourCycle:"h23"},fb={month:"short",day:"numeric"},WT=new Map;function Bf(r,l){let i=Or(),c=`${i}:${r}`,f=WT.get(c);if(!f)f=new Intl.DateTimeFormat(i,l),WT.set(c,f);return f}function Ju(r,l){if(l<Fh)return Bf("hm",cb).format(r);if(l<tn)return Bf("mdhm",{...fb,...cb}).format(r);return Bf("md",fb).format(r)}function Gh(r,l){return l<tn?Bf("hm",cb).format(r):Bf("md",fb).format(r)}function oo(r,l,i=db[r].bucketMs,c=Date.now()){let f=i===tn,v=(h)=>f?new Date(h).setHours(0,0,0,0):Math.floor(h/i)*i,y=v(c),g=db[r].spanMs,m;if(g!==null)m=v(c-g);else{m=y;for(let h of l)if(h<m)m=h;m=v(m)}m=Math.max(m,v(y-(_E-1)*i));let b=[];for(let h=m;h<=y;)if(b.push(h),f){let S=new Date(h);S.setDate(S.getDate()+1),h=S.setHours(0,0,0,0)}else h+=i;return b}var JT=_(Ke(),1);function _n(){return JT.useSyncExternalStore(KT,Or,Or)}var zf=_(Ke(),1);class pb extends Error{status;endpoint;constructor(r,l,i){super(i);this.name="ApiError",this.status=r,this.endpoint=l}}async function tI(r,l){try{let i=await r.json();if(typeof i==="object"&&i!==null&&"error"in i&&typeof i.error==="string")return i.error}catch{}return`HTTP error ${r.status} on ${l}`}var eI=new WeakMap;async function Ia(r,l,i){let c=typeof i==="object"&&i!==null?eI.get(i):void 0,f=l;if(c){let m=new Headers(l?.headers);m.set("If-None-Match",c),f={...l,headers:m}}let v=await fetch(r,f);if(v.status===304&&c)return i;if(!v.ok)throw new pb(v.status,r,await tI(v,r));let y=await v.json(),g=v.headers.get("ETag");if(g&&typeof y==="object"&&y!==null)eI.set(y,g);return y}var mb={"X-Zeta-Stats-Action":"1"};async function aI(r="24h",l){return Ia(`/api/stats/overview?range=${encodeURIComponent(r)}`,{signal:l})}async function oI(r="24h",l){return Ia(`/api/stats/model-dashboard?range=${encodeURIComponent(r)}`,{signal:l})}async function rI(r="24h",l){return Ia(`/api/stats/costs?range=${encodeURIComponent(r)}`,{signal:l})}async function Vh(r=50,l){return Ia(`/api/stats/recent?limit=${r}`,{signal:l})}async function nI(r="24h",l=50,i){return Ia(`/api/stats/errors?range=${encodeURIComponent(r)}&limit=${l}`,{signal:i})}async function sI(r,l){return Ia(`/api/request/${r}`,{signal:l})}async function lI(r){let{closable:l}=await Ia("/api/close",{signal:r});return l}async function iI(){let l=await fetch("/api/close",{method:"POST",headers:mb});if(!l.ok)throw new pb(l.status,"/api/close",await tI(l,"/api/close"))}async function uI(){return Ia("/api/sync",{method:"POST"})}async function dI(r="24h",l){return Ia(`/api/stats/frustration?range=${encodeURIComponent(r)}`,{signal:l})}async function cI(r,l){return Ia(`/api/frustration/estimate?range=${encodeURIComponent(r)}`,{signal:l})}async function fI(r){return Ia(`/api/frustration/judge?range=${encodeURIComponent(r)}`,{method:"POST",headers:mb})}async function pI(){return Ia("/api/frustration/cancel",{method:"POST",headers:mb})}async function mI(r="24h",l){return Ia(`/api/stats/folders?range=${encodeURIComponent(r)}`,{signal:l})}async function hI(r){return Ia("/api/tracking/projects",{signal:r})}async function gI(r,l){return Ia(`/api/tracking?project=${encodeURIComponent(r)}`,{signal:l})}async function yI(r="24h",l,i){let c=new URLSearchParams({range:r});if(l)c.set("project",l);return Ia(`/api/stats/gain?${c}`,{signal:i})}async function vI(r="24h",l="all",i){return Ia(`/api/stats/spotlight?range=${encodeURIComponent(r)}&agent=${encodeURIComponent(l)}`,{signal:i})}async function xI(r,l){return Ia(`/api/stats/spotlight/session?file=${encodeURIComponent(r)}`,{signal:l})}async function bI(r="24h",l){return Ia(`/api/stats/tools?range=${encodeURIComponent(r)}`,{signal:l})}async function SI(r="24h",l){return Ia(`/api/stats/providers?range=${encodeURIComponent(r)}`,{signal:l})}async function hb(r,l,i){let c=new URLSearchParams({range:r});if(l!==null)c.set("provider",l);return Ia(`/api/stats/provider-windows?${c}`,{signal:i})}async function kI(r=100,l,i){let c=new URLSearchParams({limit:String(r)});if(l)c.set("q",l);return Ia(`/api/sessions?${c}`,{signal:i})}async function LI(r,l,i){return Ia(`/api/session/trace?file=${encodeURIComponent(r)}`,{signal:l,cache:"no-store"},i)}async function wI(r,l,i){return Ia(`/api/session/entry?file=${encodeURIComponent(r)}&id=${encodeURIComponent(l)}`,{signal:i})}var FE={phase:"idle",current:0,total:0,processed:0,lastSyncedAt:null,error:null};function GE(){uI().catch(()=>{})}var CI=null,TI=0,jh=0,Nl={sync:FE,indexingHours:0,connected:!1,requestSync:GE},yb=new Set;function II(r){return yb.add(r),()=>yb.delete(r)}function RI(){for(let r of yb)r()}function VE(r,l){return r.phase===l.phase&&r.current===l.current&&r.total===l.total&&r.processed===l.processed&&r.lastSyncedAt===l.lastSyncedAt&&r.error===l.error}function jE(r){if(CI!==r.version)CI=r.version,TI++;let l=Math.max(0,TI-1),i=r.indexingHours!==Nl.indexingHours||!VE(r.sync,Nl.sync);if(!i&&l===jh)return;if(jh=l,i)Nl={...Nl,sync:r.sync,indexingHours:r.indexingHours};RI()}function gb(r){if(r===Nl.connected)return;Nl={...Nl,connected:r},RI()}var $E=()=>Nl,XE=()=>jh,YE=()=>-1;function vb(){return jh}function AI({children:r}){return zf.useEffect(()=>{let l=new EventSource("/api/events");return l.onopen=()=>gb(!0),l.onerror=()=>gb(!1),l.onmessage=(i)=>jE(JSON.parse(i.data)),()=>{l.close(),gb(!1)}},[]),r}function $h(){return zf.useSyncExternalStore(II,$E)}function MI(r=!0){return zf.useSyncExternalStore(II,r?XE:YE)}var Xh=_(te(),1);function ct({tone:r="neutral",mono:l,children:i}){return Xh.jsxDEV("span",{className:"badge","data-tone":r,"data-mono":l??!1,children:i},void 0,!1,void 0,this)}function Hn({tone:r="neutral",pulse:l}){return Xh.jsxDEV("span",{className:"dot","data-tone":r,"data-pulse":l??!1},void 0,!1,void 0,this)}function an({color:r}){return Xh.jsxDEV("span",{className:"swatch",style:{background:r}},void 0,!1,void 0,this)}function hr(r){if(r>=0.05)return"bad";if(r>=0.01)return"warn";return"ok"}var Ko=_(te(),1);function fe({title:r,description:l,actions:i,flush:c,footer:f,className:v,index:y,stale:g,children:m}){let b=r!==void 0||l!==void 0||i!==void 0;return Ko.jsxDEV("section",{className:v?`card rise ${v}`:"card rise",style:y!==void 0?{"--i":y}:void 0,children:[b&&Ko.jsxDEV("header",{className:"card-header",children:[Ko.jsxDEV("div",{className:"card-titles",children:[r!==void 0&&Ko.jsxDEV("h2",{className:"card-title",children:r},void 0,!1,void 0,this),l!==void 0&&Ko.jsxDEV("p",{className:"card-description",children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i!==void 0&&Ko.jsxDEV("div",{className:"card-actions",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ko.jsxDEV("div",{className:"card-body","data-flush":c??!1,"data-stale":g??!1,children:m},void 0,!1,void 0,this),f!==void 0&&Ko.jsxDEV("footer",{className:"card-footer",children:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function la({title:r,description:l,actions:i}){return Ko.jsxDEV("header",{className:"page-header rise",children:[Ko.jsxDEV("div",{children:[Ko.jsxDEV("h1",{className:"page-title",children:r},void 0,!1,void 0,this),l!==void 0&&Ko.jsxDEV("p",{className:"page-description",children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i!==void 0&&Ko.jsxDEV("div",{className:"page-actions",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Pf=_(Ke(),1),DI=_(Wc(),1),bo=_(te(),1);function ed({open:r,onClose:l,title:i,subtitle:c,actions:f,width:v,children:y}){let g=Pf.useRef(l);g.current=l;let m=Pf.useRef(null);if(Pf.useEffect(()=>{if(!r)return;let b=document.activeElement instanceof HTMLElement?document.activeElement:null;m.current?.focus();let h=(S)=>{if(S.key==="Escape")S.preventDefault(),g.current()};return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h),b?.focus()}},[r]),!r)return null;return DI.createPortal(bo.jsxDEV(bo.Fragment,{children:[bo.jsxDEV("div",{className:"drawer-scrim",onClick:l,role:"presentation"},void 0,!1,void 0,this),bo.jsxDEV("div",{ref:m,className:"drawer",role:"dialog","aria-modal":"true",tabIndex:-1,style:v!==void 0?{"--drawer-w":`${v}px`}:void 0,children:[bo.jsxDEV("header",{className:"drawer-header",children:[bo.jsxDEV("div",{className:"drawer-titles",children:[bo.jsxDEV("h2",{className:"drawer-title",children:i},void 0,!1,void 0,this),c!==void 0&&bo.jsxDEV("div",{className:"drawer-subtitle",children:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f,bo.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-icon":"true",onClick:l,"aria-label":"Close",children:bo.jsxDEV(Ro,{size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bo.jsxDEV("div",{className:"drawer-body",children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),document.body)}function So({items:r}){return bo.jsxDEV("dl",{className:"kv",style:{margin:0},children:r.map((l)=>bo.jsxDEV("div",{className:"kv-item",children:[bo.jsxDEV("dt",{className:"kv-key",children:l.label},void 0,!1,void 0,this),bo.jsxDEV("dd",{className:"kv-value",style:{margin:0},children:l.value},void 0,!1,void 0,this)]},l.key,!0,void 0,this))},void 0,!1,void 0,this)}var Oi=_(Ke(),1);var on=_(te(),1);function td({data:r,title:l=u("ui.json"),initialCollapsed:i=!1}){let[c,f]=Oi.useState(i),[v,y]=Oi.useState(!1),g=Oi.useRef(0),m=JSON.stringify(r,null,2);return Oi.useEffect(()=>()=>window.clearTimeout(g.current),[]),on.jsxDEV("div",{className:"stack",style:{gap:6},children:[on.jsxDEV("div",{className:"row",style:{justifyContent:"space-between"},children:[on.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-size":"sm",onClick:()=>f((h)=>!h),"aria-expanded":!c,children:[c?on.jsxDEV(en,{size:13},void 0,!1,void 0,this):on.jsxDEV(Di,{size:13},void 0,!1,void 0,this),l]},void 0,!0,void 0,this),on.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-size":"sm",onClick:async()=>{try{await navigator.clipboard.writeText(m),y(!0),window.clearTimeout(g.current),g.current=window.setTimeout(()=>y(!1),1500)}catch{}},children:[v?on.jsxDEV(Mi,{size:13},void 0,!1,void 0,this):on.jsxDEV(Ei,{size:13},void 0,!1,void 0,this),v?u("common.copied"):u("common.copy")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!c&&on.jsxDEV("pre",{className:"code-block",children:on.jsxDEV("code",{children:m},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Bi=_(Ke(),1),EI=_(Wc(),1);var rn=_(te(),1);function NI({open:r,title:l,onClose:i,primaryAction:c,cancelLabel:f=u("common.cancel"),children:v}){let y=Bi.useRef(null),g=Bi.useRef(null),m=Bi.useRef(i);m.current=i,Bi.useEffect(()=>{if(!r)return;let L=document.activeElement instanceof HTMLElement?document.activeElement:null,I=(C)=>{if(C.key==="Escape")C.preventDefault(),m.current()};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I),L?.focus()}},[r]);let b=c!==void 0,h=c?.disabled??!1;if(Bi.useEffect(()=>{if(!r)return;(b&&!h?y.current:g.current)?.focus()},[r,b,h]),!r)return null;return EI.createPortal(rn.jsxDEV("div",{className:"modal-overlay",onClick:(L)=>{if(L.target===L.currentTarget)i()},role:"presentation",children:rn.jsxDEV("div",{className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[rn.jsxDEV("div",{className:"modal-header",children:[rn.jsxDEV("h2",{id:"modal-title",className:"modal-title",children:l},void 0,!1,void 0,this),rn.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-icon":"true","data-size":"sm",onClick:i,"aria-label":u("common.close"),children:rn.jsxDEV(Ro,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),rn.jsxDEV("div",{className:"modal-body",children:v},void 0,!1,void 0,this),rn.jsxDEV("div",{className:"modal-footer",children:[rn.jsxDEV("button",{ref:g,type:"button",className:"btn",onClick:i,children:f},void 0,!1,void 0,this),c&&rn.jsxDEV("button",{ref:y,type:"button",className:"btn","data-variant":"primary",onClick:c.onClick,disabled:c.disabled,children:c.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body)}var Yh=_(te(),1);function Fn({value:r,onChange:l,placeholder:i=u("common.filter"),label:c="Filter",width:f}){return Yh.jsxDEV("label",{className:"search",children:[Yh.jsxDEV(Nf,{size:14},void 0,!1,void 0,this),Yh.jsxDEV("input",{className:"input",type:"search","aria-label":c,value:r,placeholder:i,onChange:(v)=>l(v.target.value),style:f!==void 0?{width:f}:void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ad=_(Ke(),1),Kh=_(te(),1);function Oa({options:r,value:l,onChange:i,size:c="md","aria-label":f}){let v=ad.useRef(null),[y,g]=ad.useState(null);return ad.useLayoutEffect(()=>{let m=v.current,b=m?.querySelector('[data-active="true"]');if(!m||!b){g(null);return}let h=()=>g({left:b.offsetLeft,width:b.offsetWidth});h();let S=new ResizeObserver(h);return S.observe(m),()=>S.disconnect()},[l,r]),Kh.jsxDEV("div",{ref:v,className:"segmented","data-size":c,role:"radiogroup","aria-label":f,children:[y&&Kh.jsxDEV("span",{className:"segmented-thumb",style:{left:y.left,width:y.width}},void 0,!1,void 0,this),r.map((m)=>Kh.jsxDEV("button",{type:"button",role:"radio","aria-checked":m.value===l,className:"segmented-option","data-active":m.value===l,title:m.title,onClick:()=>i(m.value),children:m.label},m.value,!1,void 0,this))]},void 0,!0,void 0,this)}var nd=_(Ke(),1);var od=_(Ke(),1);function Qh(){let r=od.useRef(null),[l,i]=od.useState(0);return od.useLayoutEffect(()=>{let c=r.current;if(!c)return;i(c.clientWidth);let f=new ResizeObserver((v)=>{let y=Math.round(v[0]?.contentRect.width??0);i((g)=>g===y?g:y)});return f.observe(c),()=>f.disconnect()},[]),[r,l]}var Uf=_(te(),1);function rd({values:r,color:l="var(--chart-primary)",height:i=28,width:c,area:f=!0}){let[v,y]=Qh(),g=c??y,m=Math.max(0,...r),b=Math.min(0,...r),h=r.length,S="";if(g>0&&h>0){let L=h>1?g/(h-1):0;for(let I=0;I<h;I++){let C=h>1?I*L:g/2,T=m>b?i-2-(r[I]-b)/(m-b)*(i-4):i-2;S+=`${I===0?"M":"L"}${C.toFixed(1)},${T.toFixed(1)}`}}return Uf.jsxDEV("div",{ref:v,className:"sparkline",style:{width:c??"100%",height:i},children:g>0&&h>0&&Uf.jsxDEV("svg",{width:g,height:i,"aria-hidden":"true",children:[f&&Uf.jsxDEV("path",{className:"area",d:`${S}L${g},${i}L0,${i}Z`,fill:l},void 0,!1,void 0,this),Uf.jsxDEV("path",{className:"chart-line",d:S,stroke:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Br=_(te(),1);function ie({label:r,value:l,hint:i,delta:c,spark:f,sparkColor:v,size:y="md",title:g}){let m=WE(typeof l==="string"||typeof l==="number"?l:null);return Br.jsxDEV("div",{className:"stat","data-size":y,title:g,children:[Br.jsxDEV("div",{className:"stat-label",children:r},void 0,!1,void 0,this),Br.jsxDEV("div",{className:"stat-value","data-flash":m,children:l},void 0,!1,void 0,this),(i!==void 0||c)&&Br.jsxDEV("div",{className:"stat-foot",children:[c&&Br.jsxDEV(QE,{...c},void 0,!1,void 0,this),i!==void 0&&Br.jsxDEV("span",{className:"truncate",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f&&f.length>1&&Br.jsxDEV("div",{className:"stat-spark",children:Br.jsxDEV(rd,{values:f,color:v},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wa({min:r,children:l}){return Br.jsxDEV("div",{className:"stat-grid rise",style:r!==void 0?{"--stat-min":`${r}px`}:void 0,children:l},void 0,!1,void 0,this)}function QE({change:r,good:l="up"}){if(r===null||!Number.isFinite(r))return Br.jsxDEV("span",{className:"delta",children:"new"},void 0,!1,void 0,this);let i=Math.abs(r)<0.0005?0:r,c=i===0?void 0:i>0===(l==="up")?"good":"bad",f=i>0?"+":i<0?"−":"±",v=Math.abs(i)*100;return Br.jsxDEV("span",{className:"delta","data-tone":c,children:[f,v>=100?v.toFixed(0):v.toFixed(1),"%"]},void 0,!0,void 0,this)}function WE(r){let l=nd.useRef(r),[i,c]=nd.useState(!1);return nd.useEffect(()=>{if(l.current===r)return;let f=l.current!==null;if(l.current=r,!f)return;c(!0);let v=setTimeout(()=>c(!1),900);return()=>clearTimeout(v)},[r]),i}var Ba=_(te(),1);function Je({title:r=u("common.nothing-here-yet"),hint:l}){return Ba.jsxDEV("div",{className:"empty",children:[Ba.jsxDEV(kf,{size:20},void 0,!1,void 0,this),Ba.jsxDEV("div",{className:"empty-title",children:r},void 0,!1,void 0,this),l!==void 0&&Ba.jsxDEV("div",{className:"empty-hint",children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ql({error:r,onRetry:l}){return Ba.jsxDEV("div",{className:"error-state",role:"alert",children:[Ba.jsxDEV(Io,{size:15},void 0,!1,void 0,this),Ba.jsxDEV("span",{className:"error-state-message",children:typeof r==="string"?r:r.message},void 0,!1,void 0,this),l&&Ba.jsxDEV("button",{type:"button",className:"btn","data-size":"sm","data-variant":"ghost",onClick:l,children:[Ba.jsxDEV(Df,{size:13},void 0,!1,void 0,this)," ",u("ui.retry")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Fa({width:r="100%",height:l=14,style:i}){return Ba.jsxDEV("div",{className:"skeleton",style:{width:r,height:l,...i}},void 0,!1,void 0,this)}function qt({height:r=220}){return Ba.jsxDEV(Fa,{height:r,style:{borderRadius:8}},void 0,!1,void 0,this)}function pa({rows:r=6}){return Ba.jsxDEV("div",{style:{display:"flex",flexDirection:"column",gap:10,padding:"8px 16px 16px"},children:Array.from({length:r},(l,i)=>Ba.jsxDEV(Fa,{height:16,width:`${92-i*13%30}%`},i,!1,void 0,this))},void 0,!1,void 0,this)}function _e({query:r,skeleton:l,isEmpty:i,empty:c,children:f}){if(r.data===null){if(r.error)return Ba.jsxDEV(ql,{error:r.error,onRetry:r.refetch},void 0,!1,void 0,this);return Ba.jsxDEV(Ba.Fragment,{children:l},void 0,!1,void 0,this)}return Ba.jsxDEV(Ba.Fragment,{children:[r.error&&Ba.jsxDEV(ql,{error:r.error,onRetry:r.refetch},void 0,!1,void 0,this),i?.(r.data)?c??Ba.jsxDEV(Je,{},void 0,!1,void 0,this):f(r.data)]},void 0,!0,void 0,this)}var zi=_(Ke(),1);function BI(){return Or()}function A(r){return r.toLocaleString(BI())}function se(r){return r.toLocaleString("en",{notation:"compact"})}function zt(r,l){if(r===0)return"$0";let i=l!==void 0?l:r>0&&r<0.01?4:2;return`$${r.toLocaleString(BI(),{minimumFractionDigits:i,maximumFractionDigits:i})}`}function oa(r,l,i){return r===0&&l>0?"N/A":zt(r,i)}function bb(r){return r.usage.totalTokens>0&&r.usage.cost.total===0&&(r.provider==="xai-oauth"||r.costUnpriced===!0)}function Ol(r,l){return oa(r.usage.cost.total,bb(r)?1:0,l)}function Ge(r,l=1){return`${(r*100).toFixed(l)}%`}function Ao(r){let l=r*100;if(l>0&&l<0.005)return"<0.01%";return Ge(r,l>0&&l<0.1?2:1)}function Ct(r,l){if(r===null)return"-";let i=r/1000,c=l!==void 0?l:i<1?2:1;return`${i.toFixed(c)}s`}function gr(r){if(r<60000)return Ct(r);let l=Math.floor(r/60000);if(l<60)return`${l}m ${String(Math.floor(r%60000/1000)).padStart(2,"0")}s`;return`${Math.floor(l/60)}h ${String(l%60).padStart(2,"0")}m`}function Gn(r){if(r===null)return"-";return r.toFixed(1)}var xb=[["second",1000],["minute",60000],["hour",3600000],["day",86400000],["month",2629800000],["year",31557600000]],qI=new Map,sd=new Map;function ma(r,l=Date.now()){let i=Or(),c=qI.get(i);if(!c)c=new Intl.RelativeTimeFormat(i,{numeric:"auto"}),qI.set(i,c);let f=r-l,v=0;for(let m=1;m<xb.length;m++)if(Math.abs(f)>=xb[m][1])v=m;let[y,g]=xb[v];return c.format(Math.round(f/g),y)}function Sb(r){let l=Or(),i=`${l}:mdhm`,c=sd.get(i);if(!c)c=new Intl.DateTimeFormat(l,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),sd.set(i,c);return c.format(r)}function ro(r){let l=Or(),i=sd.get(l);if(!i)i=new Intl.DateTimeFormat(l,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),sd.set(l,i);return i.format(r)}var OI=new Map;function _f(r,l=!1){let i=Or(),c=`${i}:${l?"long":"short"}`,f=OI.get(c);if(!f)f=new Intl.DateTimeFormat(i,l?{weekday:"short",month:"short",day:"numeric",year:"numeric"}:{month:"short",day:"numeric"}),OI.set(c,f);return f.format(r)}function Hf(r){let l=Or(),i=`${l}:time`,c=sd.get(i);if(!c)c=new Intl.DateTimeFormat(l,{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),sd.set(i,c);return c.format(r)}function zr(r){return r.replace(/^\/+|\/+$/g,"")||u("common.root")}function kb(r){if(r>=1e9)return`${(r/1e9).toFixed(1)} GB`;if(r>=1e6)return`${(r/1e6).toFixed(1)} MB`;if(r>=1000)return`${(r/1000).toFixed(1)} KB`;return`${r} B`}var Vt=_(te(),1);function Ft({columns:r,rows:l,rowKey:i,onRowClick:c,selectedKey:f,initialSort:v,limit:y,dense:g,empty:m,expanded:b}){let[h,S]=zi.useState(v??null),[L,I]=zi.useState(y??Number.POSITIVE_INFINITY),C=zi.useMemo(()=>{let O=h?r.find((W)=>W.key===h.key):void 0;if(!h||!O?.sort)return l;let z=O.sort,Y=h.dir==="asc"?1:-1;return[...l].sort((W,ue)=>{let Z=z(W),ce=z(ue);if(typeof Z==="number"&&typeof ce==="number")return(Z-ce)*Y;return String(Z).localeCompare(String(ce))*Y})},[l,r,h]);if(l.length===0)return Vt.jsxDEV(Vt.Fragment,{children:m??Vt.jsxDEV(Je,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);let T=C.length>L?C.slice(0,L):C,R=(O)=>{if(!O.sort)return;S((z)=>z?.key===O.key?{key:O.key,dir:z.dir==="asc"?"desc":"asc"}:{key:O.key,dir:O.align==="right"?"desc":"asc"})};return Vt.jsxDEV(Vt.Fragment,{children:[Vt.jsxDEV("div",{className:"table-wrap",children:Vt.jsxDEV("table",{className:"table","data-dense":g??!1,children:[Vt.jsxDEV("thead",{children:Vt.jsxDEV("tr",{children:r.map((O)=>{let z=h?.key===O.key?h.dir:void 0;return Vt.jsxDEV("th",{"data-align":O.align??"left","data-sortable":O.sort!==void 0,"data-sorted":z,style:O.width!==void 0?{width:O.width}:void 0,title:O.title,onClick:()=>R(O),"aria-sort":z==="asc"?"ascending":z==="desc"?"descending":void 0,children:[O.header,z&&Vt.jsxDEV("span",{className:"sort-arrow",children:z==="asc"?Vt.jsxDEV(sf,{size:11},void 0,!1,void 0,this):Vt.jsxDEV(af,{size:11},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},O.key,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),Vt.jsxDEV("tbody",{children:T.map((O)=>{let z=i(O),Y=b?.(O)??null;return Vt.jsxDEV(zi.Fragment,{children:[Vt.jsxDEV("tr",{"data-clickable":c!==void 0,"data-selected":f===z,onClick:c?()=>c(O):void 0,onKeyDown:c?(W)=>{if(W.key==="Enter"||W.key===" ")W.preventDefault(),c(O)}:void 0,tabIndex:c?0:void 0,children:r.map((W)=>Vt.jsxDEV("td",{"data-align":W.align??"left","data-wrap":W.wrap??!1,children:W.render(O)},W.key,!1,void 0,this))},void 0,!1,void 0,this),Y!==null&&Vt.jsxDEV("tr",{children:Vt.jsxDEV("td",{colSpan:r.length,"data-wrap":"true",style:{padding:0},children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},z,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),y!==void 0&&C.length>y&&Vt.jsxDEV("div",{className:"table-more",children:[Vt.jsxDEV("span",{className:"micro",children:u("ui.table-shown-of",{shown:A(T.length),total:A(C.length)})},void 0,!1,void 0,this),C.length>L&&Vt.jsxDEV("button",{type:"button",className:"btn","data-size":"sm","data-variant":"ghost",onClick:()=>I((O)=>O+y*4),children:u("common.show-more")},void 0,!1,void 0,this),L>y&&Vt.jsxDEV("button",{type:"button",className:"btn","data-size":"sm","data-variant":"ghost",onClick:()=>I(y),children:u("ui.show-fewer")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ma({value:r,max:l,display:i,color:c}){let f=l>0?Math.min(100,r/l*100):0;return Vt.jsxDEV("div",{className:"meter-cell",children:[Vt.jsxDEV("span",{className:"num",children:i},void 0,!1,void 0,this),Vt.jsxDEV("div",{className:"meter",children:Vt.jsxDEV("div",{className:"meter-fill",style:{width:`${f}%`,background:c}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function co({primary:r,secondary:l,lead:i}){return Vt.jsxDEV("div",{className:"row",style:{gap:10},children:[i,Vt.jsxDEV("div",{className:"stack",style:{gap:0},children:[Vt.jsxDEV("span",{className:"cell-primary truncate",children:r},void 0,!1,void 0,this),l!==void 0&&Vt.jsxDEV("span",{className:"cell-secondary truncate",children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Ff=_(Ke(),1);function Wh(r){return r instanceof HTMLElement&&(r.isContentEditable||r.tagName==="INPUT"||r.tagName==="TEXTAREA"||r.tagName==="SELECT")}function Zh(){return document.querySelector('[aria-modal="true"]')!==null}var Jh=_(te(),1);function PI(){let r=ZE();if(Ff.useEffect(()=>{if(!r)return;let l=(i)=>{if(!JE(i))return;i.preventDefault(),zI()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[r]),!r)return null;return Jh.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost",onClick:zI,title:"Close the dashboard (Esc)",children:[Jh.jsxDEV(Ro,{size:15},void 0,!1,void 0,this),"Close",Jh.jsxDEV("span",{className:"kbd",children:"Esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zI(){iI().catch((r)=>console.error("Closing the dashboard failed",r))}function ZE(){let[r,l]=Ff.useState(!1);return Ff.useEffect(()=>{let i=new AbortController;return lI(i.signal).then(l,()=>{}),()=>i.abort()},[]),r}function JE(r){if(r.defaultPrevented||r.altKey||r.metaKey||r.shiftKey)return!1;if(Wh(r.target)||Zh())return!1;if(r.key==="Escape")return!r.ctrlKey;return r.ctrlKey&&r.key.toLowerCase()==="c"&&!window.getSelection()?.toString()}var eg=_(te(),1);function UI(){let r=_n(),l=r==="en"?"zh-CN":"en",i=r==="en"?"中文":"EN";return eg.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-locale-toggle":r,onClick:()=>QT(l),"aria-label":u("shell.switch-language"),title:`${u("shell.language")}: ${i}`,children:[eg.jsxDEV(Lf,{size:15},void 0,!1,void 0,this),eg.jsxDEV("span",{className:"topbar-locale-label",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var tg=_(Ke(),1);var ba=_(te(),1);function _I(){let{sync:r,indexingHours:l,connected:i,requestSync:c}=$h(),f=tN(r.phase==="idle"?15000:null),v,y;if(!i)v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(Hn,{tone:"warn"},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.reconnecting")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y=u("shell.lost-connection");else if(r.phase==="syncing")v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(El,{size:13,className:"spin"},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.syncing")},void 0,!1,void 0,this),r.total>0&&ba.jsxDEV("span",{className:"live-chip-count",children:[A(r.current),"/",A(r.total)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y=u("shell.ingesting");else if(r.phase==="error")v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(Hn,{tone:"bad"},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.sync-failed")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y=`${r.error??u("shell.sync-failed")} — click to retry`;else if(l>eN)v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(El,{size:13,className:"spin"},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.indexing")},void 0,!1,void 0,this),ba.jsxDEV("span",{className:"live-chip-count",children:[A(l),"h left"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y=u("shell.building-rollups");else v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(Hn,{tone:"live",pulse:!0},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.live")},void 0,!1,void 0,this),r.lastSyncedAt!==null&&ba.jsxDEV("span",{className:"live-chip-count",children:aN(f-r.lastSyncedAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y=u("shell.sync-now");return ba.jsxDEV("button",{type:"button",className:"live-chip",onClick:c,disabled:r.phase==="syncing",title:y,children:v},void 0,!1,void 0,this)}var eN=24;function tN(r){let[l,i]=tg.useState(Date.now);return tg.useEffect(()=>{if(r===null)return;i(Date.now());let c=setInterval(()=>i(Date.now()),r);return()=>clearInterval(c)},[r]),l}function aN(r){let l=Math.max(0,Math.round(r/1000));if(l<45)return u("shell.just-now");let i=Math.round(l/60);if(i<60)return`${i}m ago`;let c=Math.round(i/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}var ag=[{headingKey:"nav.usage",items:[{id:"overview",labelKey:"nav.overview",icon:wf,hotkey:"o"},{id:"models",labelKey:"nav.models",icon:pf,hotkey:"m"},{id:"providers",labelKey:"nav.providers",icon:Ml,hotkey:"p"},{id:"costs",labelKey:"nav.costs",icon:cf,hotkey:"c"}]},{headingKey:"nav.activity",items:[{id:"requests",labelKey:"nav.requests",icon:ef,hotkey:"r"},{id:"errors",labelKey:"nav.errors",icon:Zr,hotkey:"e"},{id:"traces",labelKey:"nav.traces",icon:Jr,hotkey:"t"}]},{headingKey:"nav.insights",items:[{id:"tools",labelKey:"nav.tools",icon:Ni,hotkey:"l"},{id:"frustration",labelKey:"nav.frustration",icon:Rl,hotkey:"f"},{id:"projects",labelKey:"nav.projects",icon:yf,hotkey:"j"},{id:"tracking",labelKey:"nav.tracking",icon:df,hotkey:"k"},{id:"gain",labelKey:"nav.gain",icon:Un,hotkey:"g"},{id:"spotlight",labelKey:"nav.spotlight",icon:ws,hotkey:"s"}]}],oN=ag.flatMap((r)=>r.items),HI=oN.map((r)=>r.id);var Lb=_(Ke(),1),GI="zeta-stats-theme",VI="(prefers-color-scheme: dark)";function rN(){if(typeof localStorage>"u")return"system";let r=localStorage.getItem(GI);return r==="light"||r==="dark"||r==="system"?r:"system"}function jI(){if(typeof window>"u")return"dark";return window.matchMedia(VI).matches?"dark":"light"}var Pi=rN(),og=Pi==="system"?jI():Pi,wb=new Set;function $I(){for(let r of wb)r()}function Cb(){if(og=Pi==="system"?jI():Pi,typeof document<"u")document.documentElement.dataset.theme=og,document.documentElement.style.colorScheme=og}if(typeof window<"u")Cb(),window.matchMedia(VI).addEventListener("change",()=>{if(Pi==="system")Cb(),$I()});function nN(r){if(Pi=r,typeof localStorage<"u")localStorage.setItem(GI,r);Cb(),$I()}function FI(r){return wb.add(r),()=>wb.delete(r)}function XI(){let r=Lb.useSyncExternalStore(FI,()=>Pi,()=>"system"),l=Lb.useSyncExternalStore(FI,()=>og,()=>"dark");return{preference:r,resolved:l,setPreference:nN}}var Tb=_(te(),1),sN={system:"light",light:"dark",dark:"system"},lN={system:"shell.system-theme",light:"shell.light-theme",dark:"shell.dark-theme"},iN={system:If,light:qf,dark:Rf};function YI(){_n();let{preference:r,setPreference:l}=XI(),i=iN[r],c=u(lN[r]);return Tb.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-icon":"true",onClick:()=>l(sN[r]),"aria-label":`${c} (click to switch)`,title:`${c} — click to switch`,children:Tb.jsxDEV(i,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var st=_(te(),1);function KI({section:r,onSectionChange:l,range:i,onRangeChange:c,children:f}){_n();let v=Zu.map((L,I)=>({value:L,label:u(aa(L).labelKey),title:`${u(aa(L).windowKey)} (${I+1})`})),[y,g]=ld.useState(!1),m=uN(),{sync:b}=$h();dN(l,c);let h=(L)=>{l(L),g(!1),window.scrollTo({top:0})},S=b.phase==="syncing"?b.total>0?b.current/b.total:null:void 0;return st.jsxDEV(st.Fragment,{children:[st.jsxDEV("div",{className:"shell-ambient"},void 0,!1,void 0,this),st.jsxDEV("header",{className:"topbar","data-scrolled":m,children:[st.jsxDEV("button",{type:"button",className:"btn topbar-menu","data-variant":"ghost","data-icon":"true",onClick:()=>g(!0),"aria-label":u("nav.open-navigation"),children:st.jsxDEV(Tf,{size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),st.jsxDEV("div",{className:"topbar-brand",children:[st.jsxDEV("svg",{className:"topbar-mark",viewBox:"0 0 64 64",width:"22",height:"22","aria-hidden":"true",children:[st.jsxDEV("defs",{children:st.jsxDEV("linearGradient",{id:"zeta-mark-grad",x1:"0",y1:"0",x2:"1",y2:"1",children:[st.jsxDEV("stop",{offset:"0",stopColor:"oklch(0.7 0.24 340)"},void 0,!1,void 0,this),st.jsxDEV("stop",{offset:".5",stopColor:"oklch(0.62 0.21 295)"},void 0,!1,void 0,this),st.jsxDEV("stop",{offset:"1",stopColor:"oklch(0.81 0.14 200)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),st.jsxDEV("text",{x:"32",y:"47",textAnchor:"middle",fontSize:"52",fontWeight:"700",fontFamily:"Georgia, 'Times New Roman', serif",fill:"url(#zeta-mark-grad)",children:"ζ"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),st.jsxDEV("span",{children:"zeta"},void 0,!1,void 0,this),st.jsxDEV("span",{className:"topbar-slash",children:"/"},void 0,!1,void 0,this),st.jsxDEV("span",{className:"topbar-title",children:u("nav.breadcrumb-stats")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),st.jsxDEV("div",{className:"topbar-spacer"},void 0,!1,void 0,this),st.jsxDEV("div",{className:"topbar-actions",children:[st.jsxDEV("span",{className:"topbar-hide-narrow",children:st.jsxDEV(_I,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),st.jsxDEV(Oa,{options:v,value:i,onChange:c,"aria-label":u("common.time-range")},void 0,!1,void 0,this),st.jsxDEV(UI,{},void 0,!1,void 0,this),st.jsxDEV(YI,{},void 0,!1,void 0,this),st.jsxDEV(PI,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S!==void 0&&st.jsxDEV("div",{className:"topbar-progress",children:st.jsxDEV("div",{className:"topbar-progress-fill","data-indeterminate":S===null,style:{width:`${(S??0)*100}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y&&st.jsxDEV("div",{className:"drawer-scrim",onClick:()=>g(!1),role:"presentation"},void 0,!1,void 0,this),st.jsxDEV("nav",{className:"sidebar","data-open":y,"aria-label":u("nav.pages"),children:[ag.map((L)=>st.jsxDEV("div",{className:"nav-group",children:[st.jsxDEV("div",{className:"nav-heading",children:u(L.headingKey)},void 0,!1,void 0,this),L.items.map((I)=>st.jsxDEV("button",{type:"button",className:"nav-row","data-active":I.id===r,"aria-current":I.id===r?"page":void 0,onClick:()=>h(I.id),children:[st.jsxDEV(I.icon,{size:15},void 0,!1,void 0,this),st.jsxDEV("span",{className:"nav-row-label",children:u(I.labelKey)},void 0,!1,void 0,this),st.jsxDEV("kbd",{children:["G ",I.hotkey.toUpperCase()]},void 0,!0,void 0,this)]},I.id,!0,void 0,this))]},L.headingKey,!0,void 0,this)),st.jsxDEV("div",{className:"sidebar-foot micro",children:[st.jsxDEV("span",{children:[st.jsxDEV("span",{className:"kbd",children:"1"},void 0,!1,void 0,this),"–",st.jsxDEV("span",{className:"kbd",children:"6"},void 0,!1,void 0,this)," ",u("shell.range-suffix")]},void 0,!0,void 0,this),st.jsxDEV("span",{children:[st.jsxDEV("span",{className:"kbd",children:"G"},void 0,!1,void 0,this)," ",u("shell.jump-hint")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),st.jsxDEV("main",{className:"shell-panel",children:st.jsxDEV("div",{className:"shell-content",children:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function uN(){let[r,l]=ld.useState(!1);return ld.useEffect(()=>{let i=()=>l(window.scrollY>4);return i(),window.addEventListener("scroll",i,{passive:!0}),()=>window.removeEventListener("scroll",i)},[]),r}function dN(r,l){ld.useEffect(()=>{let i=0,c=(f)=>{if(f.metaKey||f.ctrlKey||f.altKey||f.defaultPrevented)return;if(Wh(f.target)||Zh())return;let v=f.key.toLowerCase();if(i&&Date.now()-i<1200){i=0;let g=ag.flatMap((m)=>m.items).find((m)=>m.hotkey===v);if(g)f.preventDefault(),r(g.id),window.scrollTo({top:0});return}if(v==="g"){i=Date.now();return}let y=Number(v)-1;if(Number.isInteger(y)&&y>=0&&y<Zu.length)f.preventDefault(),l(Zu[y])};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r,l])}var Cs=_(Ke(),1);function Gf(r){let[l,i]=r.replace(/^#\/?/,"").split("?"),c=HI.includes(l)?l:"overview",f=new URLSearchParams(i??""),v=f.get("range"),y=Zu.includes(v??"")?v:"24h";return{section:c,range:y,session:f.get("s")}}function rg({section:r,range:l,session:i}){let c=i?`&s=${encodeURIComponent(i)}`:"";return`#/${r}?range=${l}${c}`}function QI(){let[r,l]=Cs.useState(()=>Gf(window.location.hash));Cs.useEffect(()=>{let y=()=>l(Gf(window.location.hash));window.addEventListener("hashchange",y),window.addEventListener("popstate",y);let g=rg(Gf(window.location.hash));if(window.location.hash!==g)history.replaceState(null,"",g);return()=>{window.removeEventListener("hashchange",y),window.removeEventListener("popstate",y)}},[]);let i=Cs.useCallback((y)=>{l(y);let g=rg(y);if(window.location.hash!==g)history.pushState(null,"",g)},[]),c=Cs.useCallback((y)=>i({...r,section:y,session:y==="traces"?r.session:null}),[r,i]),f=Cs.useCallback((y)=>i({...r,range:y}),[r,i]),v=Cs.useCallback((y)=>i({...r,session:y}),[r,i]);return{...r,setSection:c,setRange:f,setSession:v}}var jf=_(Ke(),1);var Vn=_(te(),1);function Ts({items:r,max:l,onSelect:i}){let c=l??Math.max(0,...r.map((f)=>f.value));return Vn.jsxDEV("div",{className:"bar-list",children:r.map((f)=>{let v=c>0?Math.max(0.5,f.value/c*100):0,y=Vn.jsxDEV(Vn.Fragment,{children:[Vn.jsxDEV("span",{className:"bar-list-fill",style:{width:`${v}%`,background:f.color??"var(--chart-primary)"}},void 0,!1,void 0,this),Vn.jsxDEV("span",{className:"bar-list-label",children:f.label},void 0,!1,void 0,this),Vn.jsxDEV("span",{className:"bar-list-value",children:f.display??A(f.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return i?Vn.jsxDEV("button",{type:"button",className:"bar-list-row",onClick:()=>i(f.key),children:y},f.key,!1,void 0,this):Vn.jsxDEV("div",{className:"bar-list-row",children:y},f.key,!1,void 0,this)})},void 0,!1,void 0,this)}var Rs=_(Ke(),1);var ft=_(te(),1),Is=10,cN=24,fN=68,pN=4;function yr({slots:r,tickLabel:l,tooltipTitle:i,series:c,kind:f="bars",stacked:v=!0,height:y=220,format:g=se,formatRight:m,formatTooltip:b,yMax:h,yMaxRight:S,hidden:L,showTotal:I,references:C,markers:T,onSelect:R,emptyLabel:O="No data in this range",tooltipExtra:z}){let[Y,W]=Qh(),[ue,Z]=Rs.useState(null),ce=Rs.useId().replace(/:/g,""),ee=Rs.useMemo(()=>c.filter((j)=>!L?.has(j.key)),[c,L]),G=Rs.useMemo(()=>{let j=ee.filter((Bt)=>Bt.axis!=="right"),We=ee.filter((Bt)=>Bt.axis==="right"),H=(Bt)=>{let ga=Bt.kind??f;return v&&(ga==="bars"||ga==="area")},we=new Map,he=Array.from({length:r},()=>0),it=Array.from({length:r},()=>0),ze=0,ke=0;for(let Bt of j)if(H(Bt)){let ga=Array.from({length:r},()=>0);for(let mo=0;mo<r;mo++){let Ul=Bt.values[mo]??0;if(Ul<0)ga[mo]=it[mo],it[mo]+=Ul;else ga[mo]=he[mo],he[mo]+=Ul}we.set(Bt.key,ga)}else for(let ga=0;ga<r;ga++)ze=Math.max(ze,Bt.values[ga]??0),ke=Math.min(ke,Bt.values[ga]??0);for(let Bt=0;Bt<r;Bt++)ze=Math.max(ze,he[Bt]),ke=Math.min(ke,it[Bt]);let Qt=0,qe=0;for(let Bt of We)for(let ga=0;ga<r;ga++)Qt=Math.max(Qt,Bt.values[ga]??0),qe=Math.min(qe,Bt.values[ga]??0);for(let Bt of C??[])if(Bt.axis==="right")Qt=Math.max(Qt,Bt.value);else ze=Math.max(ze,Bt.value);let Ea=ng(h??ze,ke),Wt=We.length>0?ng(S??Qt,qe):null,ji=ee.every((Bt)=>Bt.values.every((ga)=>!ga));return{left:j,right:We,bases:we,stackable:H,leftScale:Ea,rightScale:Wt,empty:ji}},[ee,r,v,f,h,S,C]),V=G.leftScale.ticks.map((j)=>g(j)),Ie=G.rightScale?.ticks.map((j)=>(m??g)(j))??[],pe=Math.max(28,WI(V)+12),Ne=G.rightScale?Math.max(28,WI(Ie)+12):8,Ce=Math.max(0,W-pe-Ne),oe=y-Is-cN,Se=r>0?Ce/r:0,De=(j,We)=>Is+oe-(We-j.min)/(j.max-j.min)*oe,Qe=(j)=>De(G.leftScale,j),yt=(j)=>G.rightScale?De(G.rightScale,j):Qe(j),Q=(j)=>pe+(j+0.5)*Se,Fe=ee.filter((j)=>(j.kind??f)==="bars"),It=Fe.filter((j)=>!G.stackable(j)||j.axis==="right"),St=Math.max(1,Math.min(56,Se*(Se>6?0.72:0.9))),ge=Math.max(1,Math.ceil(r/Math.max(1,Math.floor(Ce/fN)))),Ye=(j)=>{let We=j.currentTarget.getBoundingClientRect(),H=Math.floor((j.clientX-We.left)/(We.width/r));Z(H>=0&&H<r?H:null)},He=ue===null?[]:ee.filter((j)=>j.tooltip!==!1).map((j)=>({s:j,v:j.values[ue]})).filter((j)=>j.v!==null&&j.v!==void 0&&(j.v!==0||ee.length===1)).sort((j,We)=>ee.length>1?We.v-j.v:0),ua=He.filter((j)=>j.s.axis!=="right").reduce((j,We)=>j+We.v,0),da=I??(v&&G.left.length>1);return ft.jsxDEV("div",{className:"chart",ref:Y,"data-hovering":ue!==null,style:{height:y},children:[W>0&&ft.jsxDEV("svg",{width:W,height:y,role:"img",children:[ft.jsxDEV("defs",{children:ee.filter((j)=>j.pattern==="hatch").map((j)=>ft.jsxDEV("pattern",{id:`${ce}-${Ib(j.key)}`,width:"5",height:"5",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[ft.jsxDEV("rect",{width:"5",height:"5",fill:j.color,fillOpacity:"0.14"},void 0,!1,void 0,this),ft.jsxDEV("rect",{width:"1.6",height:"5",fill:j.color},void 0,!1,void 0,this)]},j.key,!0,void 0,this))},void 0,!1,void 0,this),ft.jsxDEV("g",{className:"chart-grid",children:G.leftScale.ticks.map((j)=>ft.jsxDEV("line",{x1:pe,x2:pe+Ce,y1:Qe(j),y2:Qe(j)},j,!1,void 0,this))},void 0,!1,void 0,this),ft.jsxDEV("g",{className:"chart-axis",children:[G.leftScale.ticks.map((j,We)=>ft.jsxDEV("text",{x:pe-8,y:Qe(j),dy:"0.32em",textAnchor:"end",children:V[We]},j,!1,void 0,this)),G.rightScale?.ticks.map((j,We)=>ft.jsxDEV("text",{x:pe+Ce+8,y:yt(j),dy:"0.32em",textAnchor:"start",children:Ie[We]},j,!1,void 0,this)),Array.from({length:r},(j,We)=>We%ge===0?ft.jsxDEV("text",{x:Q(We),y:y-6,textAnchor:"middle",children:l(We)},We,!1,void 0,this):null)]},void 0,!0,void 0,this),ue!==null&&ft.jsxDEV("rect",{className:"chart-cursor",x:pe+ue*Se,y:Is,width:Se,height:oe},void 0,!1,void 0,this),ee.filter((j)=>(j.kind??f)==="area").map((j)=>{let We=j.axis==="right"?yt:Qe,H=G.bases.get(j.key),we=(ke)=>(H?.[ke]??0)+(j.values[ke]??0),he=ZI(r,Q,(ke)=>We(we(ke))),it=Array.from({length:r},(ke,Qt)=>r-1-Qt).map((ke)=>`L${Q(ke).toFixed(1)},${We(H?.[ke]??0).toFixed(1)}`).join(""),ze=j.pattern==="hatch"?`url(#${ce}-${Ib(j.key)})`:j.color;return ft.jsxDEV("g",{children:[ft.jsxDEV("path",{d:`${he}${it}Z`,fill:ze,fillOpacity:j.pattern?1:0.2},void 0,!1,void 0,this),ft.jsxDEV("path",{className:"chart-line",d:he,stroke:j.color,strokeDasharray:j.dashed?"4 3":void 0},void 0,!1,void 0,this)]},j.key,!0,void 0,this)}),Fe.map((j)=>{let We=j.axis==="right"?yt:Qe,H=G.bases.get(j.key),we=It.indexOf(j),he=we>=0?St/It.length:St,it=j.pattern==="hatch"?`url(#${ce}-${Ib(j.key)})`:j.color;return ft.jsxDEV("g",{children:j.values.map((ze,ke)=>{if(!ze)return null;let Qt=we>=0?0:H?.[ke]??0,qe=We(Qt),Ea=We(Qt+ze),Wt=Q(ke)-St/2+(we>=0?we*he:0);return ft.jsxDEV("rect",{className:"chart-bar","data-hover":ue===ke,x:Wt,y:Math.min(qe,Ea),width:Math.max(1,he-(we>=0&&It.length>1?1:0)),height:Math.max(ze>0?1:0,Math.abs(qe-Ea)),fill:it},ke,!1,void 0,this)})},j.key,!1,void 0,this)}),ee.filter((j)=>(j.kind??f)==="line").map((j)=>{let We=j.axis==="right"?yt:Qe,H=(we)=>{let he=j.values[we];return he===null||he===void 0?null:We(he)};return ft.jsxDEV("g",{children:[ft.jsxDEV("path",{className:"chart-line",d:ZI(r,Q,H),stroke:j.color,strokeDasharray:j.dashed?"4 3":void 0},void 0,!1,void 0,this),j.values.map((we,he)=>{let it=H(he);if(it===null||he>0&&H(he-1)!==null||he<r-1&&H(he+1)!==null)return null;return ft.jsxDEV("circle",{cx:Q(he),cy:it,r:2.5,fill:j.color},he,!1,void 0,this)})]},j.key,!0,void 0,this)}),ee.filter((j)=>(j.kind??f)==="dots").map((j)=>{let We=j.axis==="right"?yt:Qe;return ft.jsxDEV("g",{className:"chart-dots",fill:j.color,children:j.values.map((H,we)=>H===null||H===void 0?null:ft.jsxDEV("circle",{cx:Q(we),cy:We(H),r:ue===we?3.5:2.5},we,!1,void 0,this))},j.key,!1,void 0,this)}),T?.map((j)=>j.index>=0&&j.index<r?ft.jsxDEV("g",{className:"chart-marker",children:[ft.jsxDEV("line",{x1:Q(j.index),x2:Q(j.index),y1:Is,y2:Is+oe},void 0,!1,void 0,this),j.label&&ft.jsxDEV("text",{x:Q(j.index)+(Q(j.index)>pe+Ce/2?-5:5),y:Is+9,textAnchor:Q(j.index)>pe+Ce/2?"end":"start",children:j.label},void 0,!1,void 0,this)]},`marker:${j.index}`,!0,void 0,this):null),C?.map((j)=>{let We=j.axis==="right"?yt(j.value):Qe(j.value);return ft.jsxDEV("g",{className:"chart-axis",children:[ft.jsxDEV("line",{x1:pe,x2:pe+Ce,y1:We,y2:We,stroke:"var(--line-4)",strokeDasharray:"3 3"},void 0,!1,void 0,this),j.label&&ft.jsxDEV("text",{x:pe+Ce-4,y:We-5,textAnchor:"end",children:j.label},void 0,!1,void 0,this)]},`${j.axis??"left"}:${j.value}`,!0,void 0,this)}),ft.jsxDEV("line",{className:"chart-baseline",x1:pe,x2:pe+Ce,y1:Qe(0),y2:Qe(0)},void 0,!1,void 0,this),ft.jsxDEV("rect",{x:pe,y:Is,width:Ce,height:oe,fill:"transparent",onPointerMove:Ye,onPointerLeave:()=>Z(null),onClick:R&&ue!==null?()=>R(ue):void 0,style:{cursor:R?"pointer":"crosshair"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.empty&&ft.jsxDEV("div",{className:"chart-empty",children:O},void 0,!1,void 0,this),ue!==null&&!G.empty&&ft.jsxDEV("div",{className:"chart-tooltip",style:Q(ue)>W/2?{right:W-Q(ue)+Math.min(Se/2,24)+8,top:Is}:{left:Q(ue)+Math.min(Se/2,24)+8,top:Is},children:[ft.jsxDEV("div",{className:"chart-tooltip-title",children:(i??l)(ue)},void 0,!1,void 0,this),He.map(({s:j,v:We})=>ft.jsxDEV("div",{className:"chart-tooltip-row",children:[ft.jsxDEV("span",{className:"swatch",style:{background:j.color}},void 0,!1,void 0,this),ft.jsxDEV("span",{className:"chart-tooltip-label",children:j.label},void 0,!1,void 0,this),ft.jsxDEV("span",{className:"chart-tooltip-value",children:j.axis==="right"?(m??g)(We):(b??g)(We)},void 0,!1,void 0,this)]},j.key,!0,void 0,this)),da&&He.length>1&&ft.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[ft.jsxDEV("span",{className:"chart-tooltip-label",children:"Total"},void 0,!1,void 0,this),ft.jsxDEV("span",{className:"chart-tooltip-value",children:(b??g)(ua)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&ft.jsxDEV(Rs.Fragment,{children:z(ue)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ng(r,l=0){let i=Math.max(0,r),c=Math.min(0,l);if(!(i-c>0))return{min:0,max:1,ticks:[0]};let f=(i-c)/pN,v=10**Math.floor(Math.log10(f)),y=[1,2,2.5,5,10].map((h)=>h*v).find((h)=>h>=f)??10*v,g=Math.ceil(i/y)*y,m=Math.floor(c/y)*y,b=[];for(let h=m;h<=g+y/2;h+=y)b.push(Number(h.toPrecision(12)));return{min:m,max:g>m?g:m+y,ticks:b}}function WI(r){return r.reduce((l,i)=>Math.max(l,i.length*6.3),0)}function ZI(r,l,i){let c="",f=!1;for(let v=0;v<r;v++){let y=i(v);if(y===null){f=!1;continue}c+=`${f?"L":"M"}${l(v).toFixed(1)},${y.toFixed(1)}`,f=!0}return c}function Ib(r){return r.replace(/[^a-zA-Z0-9_-]/g,"_")}var Ga=_(te(),1);function sg({rows:r,guides:l,band:i,format:c,formatTick:f}){let v=0,y=0,g=(I)=>{if(I===null)return;v=Math.max(v,I),y=Math.min(y,I)};for(let I of r)for(let C of I.marks)g(C.value),g(C.lo),g(C.hi);for(let I of l??[])g(I.value);if(i)g(i.lo),g(i.hi);let m=ng(v,y),b=m.max-m.min,h=(I)=>(Math.min(m.max,Math.max(m.min,I))-m.min)/b*100,S=(I)=>`${h(I)}%`,L=Ga.jsxDEV(Ga.Fragment,{children:[i&&Ga.jsxDEV("span",{className:"dw-band",style:{left:S(i.lo),width:`${h(i.hi)-h(i.lo)}%`,"--band":i.color}},void 0,!1,void 0,this),l?.map((I)=>Ga.jsxDEV("span",{className:"dw-guide",style:{left:S(I.value),"--guide":I.color}},I.key,!1,void 0,this))]},void 0,!0,void 0,this);return Ga.jsxDEV("div",{className:"dw",children:[r.map((I)=>{let C=I.marks[0],T=C!==void 0&&C.lo!==null&&C.hi!==null?`${c(C.lo)}–${c(C.hi)}`:"";return Ga.jsxDEV("div",{className:"dw-row",children:[Ga.jsxDEV("div",{className:"dw-label",children:I.label},void 0,!1,void 0,this),Ga.jsxDEV("div",{className:"dw-track",children:[L,I.marks.map((R)=>Ga.jsxDEV("span",{className:"dw-mark","data-shape":R.shape??"dot",style:{"--dot":R.color,"--dy":`${R.offset??0}px`},children:[R.lo!==null&&R.hi!==null&&Ga.jsxDEV("span",{className:"dw-whisker",style:{left:S(R.lo),width:`${h(R.hi)-h(R.lo)}%`}},void 0,!1,void 0,this),R.value!==null&&Ga.jsxDEV("span",{className:"dw-dot",style:{left:S(R.value)},title:R.title},void 0,!1,void 0,this)]},R.key,!0,void 0,this))]},void 0,!0,void 0,this),Ga.jsxDEV("div",{className:"dw-value",children:[Ga.jsxDEV("span",{className:"num",children:I.figure??(C?.value===null||C===void 0?"–":c(C.value))},void 0,!1,void 0,this),Ga.jsxDEV("span",{className:"dw-detail",children:I.detail??T},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},I.key,!0,void 0,this)}),Ga.jsxDEV("div",{className:"dw-row dw-axis","aria-hidden":"true",children:[Ga.jsxDEV("div",{},void 0,!1,void 0,this),Ga.jsxDEV("div",{className:"dw-track",children:m.ticks.map((I)=>Ga.jsxDEV("span",{className:"dw-tick",style:{left:S(I)},children:(f??c)(I)},I,!1,void 0,this))},void 0,!1,void 0,this),Ga.jsxDEV("div",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var lg=_(Ke(),1),jn=_(te(),1);function ia({items:r,hidden:l,onToggle:i}){return jn.jsxDEV("div",{className:"legend",children:r.map((c)=>{let f=jn.jsxDEV(jn.Fragment,{children:[jn.jsxDEV("span",{className:"swatch",style:{background:c.color}},void 0,!1,void 0,this),jn.jsxDEV("span",{className:"truncate",children:c.label},void 0,!1,void 0,this),c.value&&jn.jsxDEV("span",{className:"legend-value",children:c.value},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return i?jn.jsxDEV("button",{type:"button",className:"legend-item","data-off":l?.has(c.key)??!1,onClick:()=>i(c.key),title:c.label,children:f},c.key,!1,void 0,this):jn.jsxDEV("span",{className:"legend-item",title:c.label,children:f},c.key,!1,void 0,this)})},void 0,!1,void 0,this)}function Pr(){let[r,l]=lg.useState(()=>new Set),i=lg.useCallback((c)=>{l((f)=>{let v=new Set(f);if(!v.delete(c))v.add(c);return v})},[]);return[r,i]}var Rb=_(te(),1);function $n({segments:r,height:l=8}){let i=r.reduce((c,f)=>c+Math.max(0,f.value),0);return Rb.jsxDEV("div",{className:"share-bar",style:{height:l},role:"img",children:i>0&&r.filter((c)=>c.value>0).map((c)=>Rb.jsxDEV("div",{className:"share-bar-seg",style:{flexGrow:c.value/i,background:c.color},title:`${c.label}: ${(c.value/i*100).toFixed(1)}%`},c.key,!1,void 0,this))},void 0,!1,void 0,this)}var JI=_(te(),1);function _o({buckets:r,bucketMs:l,onSelectBucket:i,...c}){return JI.jsxDEV(yr,{...c,slots:r.length,tickLabel:(f)=>Gh(r[f],l),tooltipTitle:(f)=>Ju(r[f],l),onSelect:i?(f)=>i(r[f]):void 0},void 0,!1,void 0,this)}var nn=_(te(),1);function e2({steps:r,format:l}){let i=0,c=r.map((m)=>{let b=i;if(m.kind==="total")return i=m.value,{...m,from:0,to:m.value,before:b};return i+=m.value,{...m,from:b,to:i,before:b}}),f=0,v=0;for(let m of c)f=Math.min(f,m.from,m.to),v=Math.max(v,m.from,m.to);let y=v-f||1,g=(m)=>(m-f)/y*100;return nn.jsxDEV("ol",{className:"waterfall",children:c.map((m,b)=>{let h=g(Math.min(m.from,m.to)),S=Math.abs(g(m.to)-g(m.from)),L=m.kind==="delta"?m.value<0?"−":"+":m.value<0?"−":"";return nn.jsxDEV("li",{className:"waterfall-row","data-kind":m.kind,title:m.title,children:[nn.jsxDEV("span",{className:"waterfall-label",children:m.label},void 0,!1,void 0,this),nn.jsxDEV("span",{className:"waterfall-track",children:[f<0&&nn.jsxDEV("span",{className:"waterfall-zero",style:{left:`${g(0)}%`}},void 0,!1,void 0,this),b>0&&nn.jsxDEV("span",{className:"waterfall-link",style:{left:`${g(m.before)}%`}},void 0,!1,void 0,this),nn.jsxDEV("span",{className:"waterfall-bar","data-empty":m.value===0,style:{left:`${h}%`,width:`${S}%`,"--bar":m.color}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),nn.jsxDEV("span",{className:"waterfall-value",children:[nn.jsxDEV("span",{className:"num",children:[L,l(Math.abs(m.value))]},void 0,!0,void 0,this),m.note!==void 0&&nn.jsxDEV("span",{className:"waterfall-note",children:m.note},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},m.key,!0,void 0,this)})},void 0,!1,void 0,this)}var Za=["#5ad8e6","#ed4abf","#9d7bff","#f5b54a","#4ade80","#5b8cff","#ff7a59","#2dd4bf","#c3e94f","#fb7185"],Mo="#6c6c74";function Va(r,l){return`${r}::${l}`}function ig(r){return Vf(r.map((l)=>({key:Va(l.model,l.provider),weight:l.totalRequests})))}function Vf(r){let l=[...r].sort((i,c)=>c.weight-i.weight||i.key.localeCompare(c.key));return new Map(l.map((i,c)=>[i.key,Za[c%Za.length]]))}function ug(r){return r instanceof Error?r:Error(String(r))}var za=_(Ke(),1);var mN={entries:new Map,limit:128},hN={entries:new Map,limit:4},gN={entries:new Map,limit:16},Ui=new Map;function t2(r){if(r.startsWith('["trace",'))return hN;if(r.startsWith('["request",'))return gN;return mN}function id(r){return t2(r).entries.get(r)}function a2(r){return Ui.get(r)}function yN(r,l){let{entries:i,limit:c}=t2(r);if(i.delete(r),i.set(r,l),i.size>c){let f=i.keys().next().value;if(f!==void 0)i.delete(f)}}function o2(r,l,i){let c=Ui.get(r);if(c)return c.waiters++,c;let f=new AbortController,v=id(r)?.data,y={promise:i({signal:f.signal},v).then((g)=>(yN(r,{data:g,updatedAt:Date.now(),version:l}),g)).finally(()=>{if(Ui.get(r)===y)Ui.delete(r)}),controller:f,waiters:1};return Ui.set(r,y),y}function Ab(r,l){if(l.waiters--,l.waiters>0)return;if(Ui.get(r)===l)Ui.delete(r);l.controller.abort()}var vN=1500;function Pt(r,l,i){let c=JSON.stringify(r),f=i?.enabled??!0,v=i?.pollMs,y=MI(f),[,g]=za.useReducer((G)=>G+1,0),[m,b]=za.useReducer((G)=>G+1,0),[h,S]=za.useState(null),[L,I]=za.useState(!1),C=za.useRef(l);C.current=l;let T=za.useRef(c);T.current=c;let R=za.useRef(null),O=za.useRef(0),z=za.useRef(null),Y=za.useCallback((G)=>{O.current=Date.now();let V=z.current;if(V?.key===G&&a2(G)===V.request)return;let Ie=id(G)?.data;I(!0);let pe=o2(G,vb(),C.current);if(z.current={key:G,request:pe},V)Ab(V.key,V.request);let Ne=!1;pe.promise.then((Ce)=>{if(Ne=!0,T.current!==G)return;if(Ce===Ie){S((oe)=>oe===null?oe:null);return}za.startTransition(()=>{S(null),g()})}).catch((Ce)=>{if(T.current!==G||pe.controller.signal.aborted)return;S({key:G,error:ug(Ce)})}).finally(()=>{if(z.current?.request!==pe)return;if(z.current=null,T.current!==G)return;if(I(!1),Ne&&(id(G)?.version??-1)<vb())b()})},[]),W=za.useCallback(()=>{let G=z.current;if(z.current=null,G)Ab(G.key,G.request)},[]);za.useEffect(()=>W,[W]),za.useEffect(()=>{if(!f||z.current&&z.current.key!==c)W();if(!f)return;let G=id(c);if(G&&G.version>=y)return;let V=G?O.current+vN-Date.now():0;if(V<=0){Y(c);return}let Ie=setTimeout(()=>Y(c),V);return()=>clearTimeout(Ie)},[c,f,y,m,Y,W]),za.useEffect(()=>{if(!f||!v)return;let G=setInterval(()=>{if(!document.hidden)Y(T.current)},v);return()=>clearInterval(G)},[f,v,Y]);let ue=za.useCallback(()=>Y(T.current),[Y]),Z=id(c);if(Z)R.current={key:c,data:Z.data,updatedAt:Z.updatedAt};let ce=R.current,ee=h?.key===c?h.error:null;return{data:ce?.data??null,error:ee,loading:!ce&&!ee,stale:!!ce&&ce.key!==c,refreshing:L,updatedAt:ce?.updatedAt??null,refetch:ue}}function dg(r,l){let i=0,c=r.length-1,f=-1;while(i<=c){let v=i+c>>1;if(r[v]<=l)f=v,i=v+1;else c=v-1}return f}function ha(r,l,i){let c=Array.from({length:l.length},()=>0);for(let f of r){let v=dg(l,f.timestamp);if(v>=0)c[v]+=i(f)}return c}function Xn(r,l){let i=new Map;for(let m of r){let b=dg(l.buckets,m.timestamp);if(b<0)continue;let h=l.key(m),S=i.get(h);if(!S)S=Array.from({length:l.buckets.length},()=>0),i.set(h,S);S[b]+=l.value(m)}let c=[...i.entries()].map(([m,b])=>({key:m,values:b,total:b.reduce((h,S)=>h+S,0)})).filter((m)=>m.total!==0).sort((m,b)=>b.total-m.total||m.key.localeCompare(b.key)),f=l.limit??Number.POSITIVE_INFINITY,v=c.slice(0,f),y=c.slice(f),g=v.map((m,b)=>({key:m.key,label:l.label?l.label(m.key):m.key,color:l.colors?.get(m.key)??Za[b%Za.length],values:m.values}));if(y.length>0){let m=Array.from({length:l.buckets.length},()=>0);for(let b of y)for(let h=0;h<m.length;h++)m[h]+=b.values[h];g.push({key:"__other__",label:u("common.other-n",{count:y.length}),color:Mo,values:m})}return g}var xN=["main","subagent","advisor"];function Bl(r){return r.totalInputTokens+r.totalOutputTokens+r.totalCacheReadTokens+r.totalCacheWriteTokens}function s2(r){let l=new Map;for(let y of r)l.set(y.agentType,y);let i=xN.map((y)=>l.get(y)).filter((y)=>y!==void 0),c=i.reduce((y,g)=>y+Bl(g),0),f=i.reduce((y,g)=>y+g.totalCost,0),v=i.map((y)=>{let g=Bl(y);return{agentType:y.agentType,tokens:g,requests:y.totalRequests,cost:y.totalCost,share:c>0?g/c:0}});return{totalTokens:c,totalCost:f,segments:v}}function l2(r){let l={totalCost:0,requests:0,unpricedRequests:0,activeDays:new Set(r.map((f)=>f.timestamp)).size,avgDailyCost:0,costInput:0,costOutput:0,costCacheRead:0,costCacheWrite:0,models:[],topModel:null},i=new Map;for(let f of r){let v=Va(f.model,f.provider),y=i.get(v);if(!y)y={key:v,model:f.model,provider:f.provider,cost:0,requests:0,unpricedRequests:0,costInput:0,costOutput:0,costCacheRead:0,costCacheWrite:0,share:0},i.set(v,y);r2(y,f),r2(l,f),y.cost+=f.cost,l.totalCost+=f.cost}l.avgDailyCost=l.activeDays>0?l.totalCost/l.activeDays:0,l.models=[...i.values()].sort((f,v)=>v.cost-f.cost||v.requests-f.requests||f.key.localeCompare(v.key));for(let f of l.models)f.share=l.totalCost>0?f.cost/l.totalCost:0;let c=l.models[0];return l.topModel=c!==void 0&&c.cost>0?c:null,l}function r2(r,l){r.costInput+=l.costInput,r.costOutput+=l.costOutput,r.costCacheRead+=l.costCacheRead,r.costCacheWrite+=l.costCacheWrite,r.requests+=l.requests,r.unpricedRequests+=l.unpricedRequests}function i2(r){let l=new Map;for(let i of r){let c=Va(i.model,i.provider),f=l.get(c);if(!f)f=[],l.set(c,f);f.push({timestamp:i.timestamp,avgTtftSeconds:i.avgTtft!==null?i.avgTtft/1000:null,avgTokensPerSecond:i.avgTokensPerSecond,requests:i.requests})}for(let i of l.values())i.sort((c,f)=>c.timestamp-f.timestamp);return l}var bN=/^\/?-?(?:private-)?(?:tmp|var-folders)(?:[-/]|$)/;function u2(r){let l=0,i=0,c=0,f=0,v=0,y=0,g=0,m=0,b=0;for(let L of r){if(l+=L.totalRequests,i+=L.failedRequests,c+=L.totalCost,f+=L.unpricedRequests,v+=L.totalInputTokens+L.totalCacheReadTokens+L.totalCacheWriteTokens+L.totalOutputTokens,y+=L.totalInputTokens,g+=L.totalCacheReadTokens,L.totalRequests>m)m=L.totalRequests;if(L.totalCost>b)b=L.totalCost}let h=0;return{rows:r.map((L)=>{let I=bN.test(L.folder);if(I)h++;return{...L,conversationTokens:L.totalInputTokens+L.totalCacheReadTokens+L.totalCacheWriteTokens+L.totalOutputTokens,requestShare:l>0?L.totalRequests/l:0,costShare:c>0?L.totalCost/c:0,temporary:I}}),totalRequests:l,failedRequests:i,totalCost:c,unpricedRequests:f,conversationTokens:v,cacheRate:y+g>0?g/(y+g):0,maxRequests:m,maxCost:b,temporaryCount:h}}function d2(r){let l=0,i=0,c=0;for(let f of r)l+=f.calls,i+=f.totalTokensShare,c+=f.costShare;return r.map((f)=>({...f,errorRate:f.calls>0?f.errors/f.calls:0,callFraction:l>0?f.calls/l:0,tokenFraction:i>0?f.totalTokensShare/i:0,costFraction:c>0?f.costShare/c:0,avgResultChars:f.calls>0?f.resultChars/f.calls:0}))}function As(r){if(r.stopReason==="aborted")return"aborted";if(r.stopReason==="error"||r.errorMessage)return"failed";return"ok"}function Mb(r,l){if(r.length===0)return null;return r[Math.min(r.length-1,Math.max(0,Math.ceil(l*r.length)-1))]}function c2(r){let l=0,i=0,c=0,f=0,v=0,y=null,g=null,m=[],b=[];for(let h of r){let S=As(h);if(S==="failed")l++;else if(S==="aborted")i++;if(c+=h.usage.totalTokens,f+=h.usage.cost.total,bb(h))v++;if(h.duration!==null)m.push(h.duration);if(h.ttft!==null)b.push(h.ttft);if(y===null||h.timestamp<y)y=h.timestamp;if(g===null||h.timestamp>g)g=h.timestamp}return m.sort((h,S)=>h-S),b.sort((h,S)=>h-S),{requests:r.length,failed:l,aborted:i,tokens:c,cost:f,unpriced:v,medianDuration:Mb(m,0.5),p95Duration:Mb(m,0.95),medianTtft:Mb(b,0.5),oldest:y,newest:g}}var n2=180,SN=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,kN=/\b(?:req|msg|call|toolu|chatcmpl|resp|run|gen)[-_][A-Za-z0-9_-]{6,}/g,LN=/\b[0-9a-f]{12,}\b/gi,wN=/(?<![\w.-])\d+(?:\.\d+)?/g,CN=/^[1-5]\d\d$/;function Db(r){if(!r?.trim())return"Unknown error";let l=r.replace(/\s+/g," ").trim().replace(SN,"<id>").replace(kN,"<id>").replace(LN,"<hex>").replace(wN,(i)=>CN.test(i)?i:"N");return l.length>n2?`${l.slice(0,n2-1)}…`:l}function f2(r){let l=new Map;for(let i of r){let c=Db(i.errorMessage),f=l.get(c);if(!f)f={signature:c,count:0,firstSeen:i.timestamp,lastSeen:i.timestamp,latest:i,models:[],byModel:new Map},l.set(c,f);if(f.count++,i.timestamp<f.firstSeen)f.firstSeen=i.timestamp;if(i.timestamp>f.lastSeen)f.lastSeen=i.timestamp,f.latest=i;let v=Va(i.model,i.provider),y=f.byModel.get(v);if(y)y.count++;else f.byModel.set(v,{model:i.model,provider:i.provider,count:1})}return[...l.values()].map(({byModel:i,...c})=>({...c,models:[...i.values()].sort((f,v)=>v.count-f.count||f.model.localeCompare(v.model))})).sort((i,c)=>c.count-i.count||c.lastSeen-i.lastSeen)}var Oe=_(te(),1);function TN(){return[{value:"model",label:u("costs.by-model")},{value:"component",label:u("costs.by-component")}]}var IN=6,RN=86400000;function $f(){return[{key:"costInput",label:u("common.input"),color:"#5b8cff"},{key:"costOutput",label:u("common.output"),color:"var(--chart-secondary)"},{key:"costCacheRead",label:u("common.cache-read"),color:"var(--chart-primary)"},{key:"costCacheWrite",label:u("common.cache-write"),color:"#f5b54a"}]}function p2({active:r,range:l}){let i=Pt(["costs",l],({signal:L})=>rI(l,L),{enabled:r}),c=aa(l),[f,v]=jf.useState("model"),[y,g]=Pr(),m=jf.useMemo(()=>i.data?AN(i.data,l):null,[i.data,l]),b=jf.useMemo(()=>m?EN(m):[],[m]),h=(L)=>L.costSeries.length===0,S=Oe.jsxDEV(Je,{title:u("costs.no-usage-in-range"),hint:u("costs.empty-hint")},void 0,!1,void 0,this);return Oe.jsxDEV("div",{className:"page",children:[Oe.jsxDEV(la,{title:u("costs.title"),description:u("costs.description",{window:u(c.windowKey)})},void 0,!1,void 0,this),Oe.jsxDEV(_e,{query:i,skeleton:Oe.jsxDEV(Fa,{height:112,style:{borderRadius:12}},void 0,!1,void 0,this),isEmpty:h,empty:S,children:()=>m&&Oe.jsxDEV(MN,{view:m,stale:i.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this),Oe.jsxDEV("div",{className:"grid grid-main-side",children:[Oe.jsxDEV(fe,{index:1,title:u("costs.daily-estimate"),description:f==="model"?u("costs.daily-by-model"):u("costs.daily-by-component"),actions:Oe.jsxDEV(Oa,{size:"sm",options:TN(),value:f,onChange:v,"aria-label":u("costs.split-by")},void 0,!1,void 0,this),stale:i.stale,children:Oe.jsxDEV(_e,{query:i,skeleton:Oe.jsxDEV(qt,{height:280},void 0,!1,void 0,this),isEmpty:h,empty:S,children:()=>{if(!m)return null;let L=f==="model"?m.modelSeries:m.componentSeries;return Oe.jsxDEV("div",{className:"stack",style:{gap:12},children:[Oe.jsxDEV(yr,{slots:m.buckets.length,tickLabel:(I)=>_f(m.buckets[I]),tooltipTitle:(I)=>_f(m.buckets[I],!0),series:L,hidden:y,height:280,format:(I)=>zt(I,Number.isInteger(I)?0:2),formatTooltip:(I)=>zt(I),emptyLabel:u("costs.no-priced-usage"),tooltipExtra:(I)=>m.unpricedPerDay[I]>0?Oe.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[Oe.jsxDEV("span",{className:"chart-tooltip-label",children:u("costs.unpriced-requests")},void 0,!1,void 0,this),Oe.jsxDEV("span",{className:"chart-tooltip-value",children:A(m.unpricedPerDay[I])},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),Oe.jsxDEV(ia,{items:L.map((I)=>({key:I.key,label:I.label,color:I.color,value:zt(NN(I.values))})),hidden:y,onToggle:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Oe.jsxDEV(fe,{index:2,title:u("costs.where-it-went"),description:u("costs.estimate-by-component"),stale:i.stale,children:Oe.jsxDEV(_e,{query:i,skeleton:Oe.jsxDEV(qt,{height:280},void 0,!1,void 0,this),isEmpty:h,empty:S,children:()=>m&&Oe.jsxDEV(DN,{summary:m.summary},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Oe.jsxDEV(fe,{index:3,title:u("costs.by-model"),description:u("costs.by-model-description"),stale:i.stale,flush:!0,children:Oe.jsxDEV(_e,{query:i,skeleton:Oe.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),isEmpty:h,empty:S,children:()=>m&&Oe.jsxDEV(Ft,{rows:m.summary.models,rowKey:(L)=>L.key,columns:b,initialSort:{key:"cost",dir:"desc"},limit:20},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AN(r,l){let i=r.costSeries,c=l2(i),f=ig(c.models.map((b)=>({model:b.model,provider:b.provider,totalRequests:b.requests}))),v=new Map(c.models.map((b)=>[b.key,b])),y=oo(l,i.map((b)=>b.timestamp),RN),g=Xn(i,{buckets:y,key:(b)=>Va(b.model,b.provider),label:(b)=>v.get(b)?.model??b,value:(b)=>b.cost,limit:IN,colors:f}).map((b)=>({...b,values:b.values.map((h)=>h||null)})),m=new Set;for(let b of g){if(b.key==="__other__")continue;if(m.has(b.color))b.color=Za.find((h)=>!m.has(h))??b.color;m.add(b.color)}return{summary:c,swatches:new Map(g.filter((b)=>b.key!=="__other__").map((b)=>[b.key,b.color])),buckets:y,dailyTotals:ha(i,y,(b)=>b.cost),unpricedPerDay:ha(i,y,(b)=>b.unpricedRequests),modelSeries:g,componentSeries:$f().map((b)=>({key:b.key,label:b.label,color:b.color,values:ha(i,y,(h)=>h[b.key]).map((h)=>h||null)})),maxModelCost:c.models[0]?.cost??0}}function MN({view:r,stale:l}){let{summary:i}=r,c=i.requests-i.unpricedRequests,f=i.topModel;return Oe.jsxDEV("div",{"data-stale":l,children:Oe.jsxDEV(wa,{min:180,children:[Oe.jsxDEV(ie,{label:u("costs.api-equivalent-estimate"),title:u("costs.api-estimate-title"),value:oa(i.totalCost,i.unpricedRequests),hint:u("costs.requests-n",{count:A(i.requests)}),spark:r.dailyTotals,sparkColor:"var(--chart-secondary)"},void 0,!1,void 0,this),Oe.jsxDEV(ie,{label:u("costs.average-per-day"),title:u("costs.average-per-day-title"),value:oa(i.avgDailyCost,i.unpricedRequests),hint:u(i.activeDays===1?"costs.active-days-one":"costs.active-days-n",{count:A(i.activeDays)})},void 0,!1,void 0,this),Oe.jsxDEV(ie,{label:u("costs.top-model"),title:f?`${f.model} (${f.provider})`:void 0,value:f?f.model:"–",hint:f?u("costs.top-model-hint",{cost:zt(f.cost),share:Ge(f.share)}):u("costs.nothing-priced-yet")},void 0,!1,void 0,this),Oe.jsxDEV(ie,{label:u("costs.per-priced-request"),title:u("costs.per-priced-request-title"),value:c>0?m2(i.totalCost/c):"–",hint:u("costs.priced-n",{count:A(c)})},void 0,!1,void 0,this),Oe.jsxDEV(ie,{label:u("costs.unpriced-requests"),title:u("costs.unpriced-title"),value:A(i.unpricedRequests),hint:i.unpricedRequests>0?u("costs.unpriced-hint"):u("costs.all-priced")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function DN({summary:r}){return Oe.jsxDEV("div",{className:"stack",style:{gap:14},children:[Oe.jsxDEV($n,{height:10,segments:$f().map((l)=>({key:l.key,label:l.label,value:r[l.key],color:l.color}))},void 0,!1,void 0,this),Oe.jsxDEV("div",{className:"costs-components",children:[$f().map((l)=>Oe.jsxDEV("div",{className:"costs-component-row",children:[Oe.jsxDEV("span",{className:"row",children:[Oe.jsxDEV(an,{color:l.color},void 0,!1,void 0,this),l.label]},void 0,!0,void 0,this),Oe.jsxDEV("span",{className:"num",children:zt(r[l.key])},void 0,!1,void 0,this),Oe.jsxDEV("span",{className:"num dim costs-component-share",children:r.totalCost>0?Ge(r[l.key]/r.totalCost):"–"},void 0,!1,void 0,this)]},l.key,!0,void 0,this)),Oe.jsxDEV("div",{className:"costs-component-row costs-component-total",children:[Oe.jsxDEV("span",{children:u("common.total")},void 0,!1,void 0,this),Oe.jsxDEV("span",{className:"num",children:oa(r.totalCost,r.unpricedRequests)},void 0,!1,void 0,this),Oe.jsxDEV("span",{className:"costs-component-share"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r.unpricedRequests>0&&Oe.jsxDEV("p",{className:"micro dim",children:u(r.unpricedRequests===1?"costs.unpriced-note-one":"costs.unpriced-note-n",{count:A(r.unpricedRequests)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function EN(r){let l=$f().map((i)=>({key:i.key,header:i.label,align:"right",sort:(c)=>c[i.key],render:(c)=>Oe.jsxDEV("span",{className:"num",children:zt(c[i.key])},void 0,!1,void 0,this)}));return[{key:"model",header:u("common.model"),sort:(i)=>i.model,render:(i)=>Oe.jsxDEV(co,{lead:Oe.jsxDEV(an,{color:r.swatches.get(i.key)??Mo},void 0,!1,void 0,this),primary:Oe.jsxDEV("span",{className:"mono",children:i.model},void 0,!1,void 0,this),secondary:i.provider},void 0,!1,void 0,this)},{key:"requests",header:u("common.requests"),align:"right",sort:(i)=>i.requests,render:(i)=>Oe.jsxDEV("span",{className:"num",children:A(i.requests)},void 0,!1,void 0,this)},{key:"cost",header:u("costs.estimate"),title:u("costs.estimate-title"),align:"right",sort:(i)=>i.cost,render:(i)=>Oe.jsxDEV(Ma,{value:i.cost,max:r.maxModelCost,display:oa(i.cost,i.unpricedRequests),color:r.swatches.get(i.key)??Mo},void 0,!1,void 0,this)},{key:"share",header:u("common.share"),align:"right",sort:(i)=>i.share,render:(i)=>Oe.jsxDEV("span",{className:"num muted",children:i.cost>0?Ge(i.share):"–"},void 0,!1,void 0,this)},{key:"split",header:u("costs.split"),title:"Input · output · cache read · cache write",width:150,render:(i)=>i.cost>0?Oe.jsxDEV($n,{segments:$f().map((c)=>({key:c.key,label:c.label,value:i[c.key],color:c.color}))},void 0,!1,void 0,this):Oe.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)},...l,{key:"perRequest",header:u("costs.per-request"),title:"Estimate ÷ priced requests",align:"right",sort:(i)=>i.requests>i.unpricedRequests?i.cost/(i.requests-i.unpricedRequests):-1,render:(i)=>Oe.jsxDEV("span",{className:"num",children:i.requests>i.unpricedRequests?m2(i.cost/(i.requests-i.unpricedRequests)):"–"},void 0,!1,void 0,this)},{key:"unpriced",header:u("costs.unpriced"),title:"Requests with no public-equivalent price",align:"right",sort:(i)=>i.unpricedRequests,render:(i)=>i.unpricedRequests>0?Oe.jsxDEV("span",{className:"num tone-warn",children:A(i.unpricedRequests)},void 0,!1,void 0,this):Oe.jsxDEV("span",{className:"num dim",children:"–"},void 0,!1,void 0,this)}]}function m2(r){return r>0&&r<0.0001?"<$0.0001":zt(r)}function NN(r){let l=0;for(let i of r)l+=i??0;return l}var Ms=_(Ke(),1);var Le=_(te(),1),Eb=[50,200,1000];function h2({active:r,range:l,onRequestClick:i}){let[c,f]=Ms.useState(0),v=Eb[c],y=Pt(["errors",l,v],({signal:G})=>nI(l,v,G),{enabled:r}),[g,m]=Ms.useState(null),[b,h]=Ms.useState(null),[S,L]=Ms.useState(""),I=aa(l),C=Ms.useMemo(()=>{let G=(y.data??[]).map((Ce)=>({row:Ce,signature:Db(Ce.errorMessage)})),V=f2(y.data??[]),Ie=new Map;for(let{row:Ce}of G){let oe=Va(Ce.model,Ce.provider),Se=Ie.get(oe);if(Se)Se.count++;else Ie.set(oe,{model:Ce.model,provider:Ce.provider,count:1})}let pe=[...Ie.entries()].map(([Ce,oe])=>({key:Ce,...oe})).sort((Ce,oe)=>oe.count-Ce.count||Ce.model.localeCompare(oe.model)),Ne=G.reduce((Ce,{row:oe})=>!Ce||oe.timestamp>Ce.timestamp?oe:Ce,null);return{rows:G,groups:V,models:pe,newest:Ne}},[y.data]),T=C.groups.some((G)=>G.signature===g)?g:null,R=C.models.some((G)=>G.key===b)?b:null,O=Ms.useMemo(()=>{let G=S.trim().toLowerCase();return C.rows.filter((V)=>(T===null||V.signature===T)&&(R===null||Va(V.row.model,V.row.provider)===R)&&(G===""||V.row.model.toLowerCase().includes(G)||V.row.provider.toLowerCase().includes(G)||V.row.folder.toLowerCase().includes(G)||(V.row.errorMessage??"").toLowerCase().includes(G))).map((V)=>V.row)},[C.rows,T,R,S]),z=y.data?.length??0,Y=!y.stale&&z<v,W=c+1<Eb.length?Eb[c+1]:null,ue=y.data!==null&&!Y?Le.jsxDEV(Le.Fragment,{children:[Le.jsxDEV("span",{children:u("errors.footer",{count:A(z),window:u(I.windowKey)})},void 0,!1,void 0,this),W!==null&&Le.jsxDEV("button",{type:"button",className:"btn","data-size":"sm",disabled:y.refreshing,onClick:()=>f(c+1),children:y.refreshing&&y.stale?u("errors.loading"):u("errors.load-latest",{count:A(W)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):void 0,Z=C.groups[0]?.count??0,ce=Ms.useMemo(()=>qN(Z),[Z]),ee=C.models.find((G)=>G.key===R);return Le.jsxDEV("div",{className:"page",children:[Le.jsxDEV(la,{title:u("errors.title"),description:u("errors.description",{window:u(I.windowKey)})},void 0,!1,void 0,this),Le.jsxDEV(_e,{query:y,skeleton:Le.jsxDEV(Fa,{height:96,style:{borderRadius:12}},void 0,!1,void 0,this),children:()=>Le.jsxDEV("div",{"data-stale":y.stale,children:Le.jsxDEV(wa,{min:170,children:[Le.jsxDEV(ie,{label:u("errors.failures"),value:A(z),hint:Y?u("errors.hint-in-window",{window:u(I.windowKey)}):u("errors.hint-latest-loaded",{count:A(z)})},void 0,!1,void 0,this),Le.jsxDEV(ie,{label:u("errors.signatures"),title:u("errors.signatures-hint"),value:A(C.groups.length),hint:C.groups[0]?u("errors.signatures-top",{count:A(C.groups[0].count)}):void 0},void 0,!1,void 0,this),Le.jsxDEV(ie,{label:u("errors.affected-models"),value:A(C.models.length),hint:C.models[0]?.model},void 0,!1,void 0,this),Le.jsxDEV(ie,{label:u("errors.last-failure"),value:C.newest?ma(C.newest.timestamp):"–",hint:C.newest?ro(C.newest.timestamp):u("errors.none-in-window",{window:u(I.windowKey)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV("div",{className:"grid grid-main-side",children:[Le.jsxDEV(fe,{index:1,title:u("errors.error-signatures"),description:u("errors.signatures-card-description"),flush:!0,stale:y.stale,children:Le.jsxDEV(_e,{query:y,skeleton:Le.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),isEmpty:(G)=>G.length===0,empty:Le.jsxDEV(Je,{title:u("errors.empty-no-failures",{window:u(I.windowKey)}),hint:u("errors.empty-all-succeeded")},void 0,!1,void 0,this),children:()=>Le.jsxDEV(Ft,{rows:C.groups,rowKey:(G)=>G.signature,columns:ce,onRowClick:(G)=>m(T===G.signature?null:G.signature),selectedKey:T,expanded:(G)=>G.signature===T?Le.jsxDEV(ON,{group:G,onRequestClick:i},void 0,!1,void 0,this):null,limit:12},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV(fe,{index:2,title:u("errors.by-model"),description:u("errors.by-model-description"),stale:y.stale,children:Le.jsxDEV(_e,{query:y,skeleton:Le.jsxDEV(Fa,{height:180},void 0,!1,void 0,this),isEmpty:(G)=>G.length===0,empty:Le.jsxDEV(Je,{title:u("errors.empty-no-affected-models")},void 0,!1,void 0,this),children:()=>Le.jsxDEV(Ts,{items:C.models.slice(0,12).map((G)=>({key:G.key,label:Le.jsxDEV("span",{className:"row",style:{gap:6,minWidth:0},children:[Le.jsxDEV("span",{className:"mono truncate",children:G.model},void 0,!1,void 0,this),Le.jsxDEV("span",{className:"dim truncate",children:G.provider},void 0,!1,void 0,this)]},void 0,!0,void 0,this),value:G.count,color:G.key===R?"var(--bad)":"color-mix(in srgb, var(--bad) 45%, transparent)"})),onSelect:(G)=>h(R===G?null:G)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Le.jsxDEV(fe,{index:3,title:u("errors.failures"),description:y.data===null?u("errors.loading-failures"):u("errors.filtered-of-total",{shown:A(O.length),total:A(z)}),actions:Le.jsxDEV(Le.Fragment,{children:[T!==null&&Le.jsxDEV("button",{type:"button",className:"btn errors-filter","data-size":"sm",onClick:()=>m(null),title:T,children:[Le.jsxDEV("span",{className:"mono truncate",children:T},void 0,!1,void 0,this),Le.jsxDEV(Ro,{size:12},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ee&&Le.jsxDEV("button",{type:"button",className:"btn errors-filter","data-size":"sm",onClick:()=>h(null),children:[Le.jsxDEV("span",{className:"mono truncate",children:ee.model},void 0,!1,void 0,this),Le.jsxDEV(Ro,{size:12},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Le.jsxDEV(Fn,{value:S,onChange:L,placeholder:u("errors.search-placeholder")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),flush:!0,stale:y.stale,footer:ue,children:Le.jsxDEV(_e,{query:y,skeleton:Le.jsxDEV(pa,{rows:10},void 0,!1,void 0,this),isEmpty:(G)=>G.length===0,empty:Le.jsxDEV(Je,{title:u("errors.empty-no-failures",{window:u(I.windowKey)})},void 0,!1,void 0,this),children:()=>Le.jsxDEV(Ft,{rows:O,rowKey:(G)=>G.id??`${G.sessionFile}:${G.entryId}`,onRowClick:(G)=>G.id!==void 0&&i(G.id),columns:BN(),initialSort:{key:"time",dir:"desc"},limit:50,dense:!0,empty:Le.jsxDEV(Je,{title:u("errors.no-match"),hint:u("errors.no-match-hint")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qN(r){return[{key:"signature",header:u("errors.signature"),wrap:!0,sort:(l)=>l.signature,render:(l)=>Le.jsxDEV("span",{className:"errors-signature",title:l.latest.errorMessage??void 0,children:l.signature},void 0,!1,void 0,this)},{key:"models",header:u("common.models"),sort:(l)=>l.models.length,render:(l)=>Le.jsxDEV(co,{primary:Le.jsxDEV("span",{className:"mono",children:l.models[0]?.model},void 0,!1,void 0,this),secondary:l.models.length>1?u("errors.more-models",{count:A(l.models.length-1)}):l.models[0]?.provider},void 0,!1,void 0,this)},{key:"last",header:u("errors.last-seen"),sort:(l)=>l.lastSeen,render:(l)=>Le.jsxDEV("span",{className:"muted",title:ro(l.lastSeen),children:ma(l.lastSeen)},void 0,!1,void 0,this)},{key:"count",header:u("errors.failures"),align:"right",width:120,sort:(l)=>l.count,render:(l)=>Le.jsxDEV(Ma,{value:l.count,max:r,display:A(l.count),color:"var(--bad)"},void 0,!1,void 0,this)}]}function ON({group:r,onRequestClick:l}){let i=r.latest.id;return Le.jsxDEV("div",{className:"errors-detail",children:[Le.jsxDEV("pre",{className:"code-block errors-detail-message",children:r.latest.errorMessage??u("errors.unknown-error")},void 0,!1,void 0,this),Le.jsxDEV("div",{className:"errors-detail-meta",children:[Le.jsxDEV("span",{className:"muted",children:u("errors.group-meta",{count:A(r.count),first:ro(r.firstSeen),last:ro(r.lastSeen)})},void 0,!1,void 0,this),i!==void 0&&Le.jsxDEV("button",{type:"button",className:"btn","data-size":"sm",onClick:()=>l(i),children:[u("errors.open-latest")," ",Le.jsxDEV(nf,{size:13},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Le.jsxDEV("div",{className:"errors-detail-models",children:r.models.map((c)=>Le.jsxDEV("span",{className:"badge","data-mono":"true",children:[c.model," ",Le.jsxDEV("span",{className:"dim",children:c.provider},void 0,!1,void 0,this)," ",Le.jsxDEV("span",{className:"num",children:se(c.count)},void 0,!1,void 0,this)]},Va(c.model,c.provider),!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function BN(){return[{key:"time",header:u("errors.when"),width:120,sort:(r)=>r.timestamp,render:(r)=>Le.jsxDEV("span",{className:"muted",title:ro(r.timestamp),children:ma(r.timestamp)},void 0,!1,void 0,this)},{key:"model",header:u("common.model"),sort:(r)=>r.model,render:(r)=>Le.jsxDEV(co,{primary:Le.jsxDEV("span",{className:"mono",children:r.model},void 0,!1,void 0,this),secondary:r.provider},void 0,!1,void 0,this)},{key:"error",header:u("common.error"),sort:(r)=>r.errorMessage??"",render:(r)=>Le.jsxDEV("span",{className:"errors-message",title:r.errorMessage??void 0,children:r.errorMessage??u("errors.unknown-error")},void 0,!1,void 0,this)},{key:"project",header:u("common.project"),sort:(r)=>r.folder,render:(r)=>Le.jsxDEV("span",{className:"mono muted",title:r.folder,children:zr(r.folder)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),align:"right",sort:(r)=>r.usage.totalTokens,render:(r)=>Le.jsxDEV("span",{className:"num",children:A(r.usage.totalTokens)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("errors.cost-hint"),align:"right",sort:(r)=>r.usage.cost.total,render:(r)=>Le.jsxDEV("span",{className:"num",children:Ol(r,4)},void 0,!1,void 0,this)}]}var At=_(Ke(),1);var P=_(te(),1),zN=1000,cg=50,qb=0.5,Xf="*";function y2({active:r,range:l}){let[i,c]=At.useState(!1),f=Pt(["frustration",l],({signal:b})=>dI(l,b),{enabled:r,pollMs:i?zN:void 0}),v=aa(l),y=f.data?.job.state;At.useEffect(()=>{if(y!==void 0)c(y==="running")},[y]);let{refetch:g}=f,m=At.useCallback(()=>{c(!0),g()},[g]);return P.jsxDEV("div",{className:"page",children:[P.jsxDEV(la,{title:u("frustration.title"),description:u("frustration.description",{window:u(v.windowKey)})},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(qt,{height:96},void 0,!1,void 0,this),children:(b)=>P.jsxDEV("div",{"data-stale":f.stale,children:P.jsxDEV(PN,{overall:b.overall},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(qt,{height:120},void 0,!1,void 0,this),children:(b)=>P.jsxDEV(UN,{active:r,range:l,judgeAvailable:b.judgeAvailable,job:b.job,onRunStarted:m,onRunChanged:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(fe,{index:2,title:u("frustration.by-model"),children:[P.jsxDEV(qt,{height:340},void 0,!1,void 0,this),P.jsxDEV(pa,{rows:6},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:(b)=>P.jsxDEV(YN,{models:b.byModel,stale:f.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(qt,{height:96},void 0,!1,void 0,this),children:(b)=>P.jsxDEV("div",{className:"frustration-model-summary","data-stale":f.stale,children:P.jsxDEV(ZN,{overall:b.modelSide.overall,window:u(v.windowKey)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(fe,{index:4,title:u("frustration.model-by-model"),children:[P.jsxDEV(qt,{height:300},void 0,!1,void 0,this),P.jsxDEV(pa,{rows:5},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:(b)=>P.jsxDEV(JN,{models:b.modelSide.byModel,series:b.modelSide.series,range:l,stale:f.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(fe,{index:7,title:u("frustration.model-sessions"),children:P.jsxDEV(pa,{rows:5},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:(b)=>P.jsxDEV(tq,{sessions:b.modelSide.bySession,stale:f.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Da(r,l){return l>0?Ge(r/l):"–"}function Nb(r){return r instanceof Error?r.message:String(r)}function v2(r){let l=Math.max(0,Math.floor(r/1000)),i=Math.floor(l/60),c=l%60;return i>0?`${i}m ${String(c).padStart(2,"0")}s`:`${c}s`}function PN({overall:r}){let l=r.messages-r.judged,i=r.unscored>0?u("frustration.coverage-unscored",{count:A(r.unscored)}):"";return P.jsxDEV(P.Fragment,{children:[P.jsxDEV(wa,{min:170,children:[P.jsxDEV(ie,{label:u("frustration.user-messages"),title:u("frustration.user-messages-title"),value:A(r.messages)},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.judge-coverage"),title:u("frustration.judge-coverage-title"),value:Da(r.judged,r.messages),hint:`${u("frustration.coverage-hint",{judged:A(r.judged),regex:A(l)})}${i}`},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.annoyed"),title:u("frustration.annoyed-title"),value:Da(r.annoyed,r.messages),hint:u("frustration.messages-n",{count:A(r.annoyed)})},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.at-assistant"),title:u("frustration.at-assistant-title"),value:Da(r.atAssistant,r.messages),hint:u("frustration.messages-n",{count:A(r.atAssistant)})},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.angry"),title:u("frustration.angry-title"),value:Da(r.angry,r.messages),hint:u("frustration.messages-n",{count:A(r.angry)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.unscored>0&&P.jsxDEV("p",{className:"micro dim",children:u("frustration.unscored-line",{count:A(r.unscored)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var g2="Judging needs the zeta host process: open the dashboard with zetacode stats and configure a judge model. Until then messages are classified by regex signals.";function UN({active:r,range:l,judgeAvailable:i,job:c,onRunStarted:f,onRunChanged:v}){let[y,g]=At.useState(!1),[m,b]=At.useState({status:"loading"}),[h,S]=At.useState(!1),[L,I]=At.useState(null),[C,T]=At.useState(!1),[R,O]=At.useState(null),z=At.useRef(null),Y=c.state==="running",W=At.useCallback(()=>{z.current?.abort(),z.current=null,g(!1)},[]);At.useEffect(()=>{if(!r)W()},[r,W]),At.useEffect(()=>()=>z.current?.abort(),[]);let ue=()=>{z.current?.abort();let V=new AbortController;z.current=V;let Ie=l;b({status:"loading"}),I(null),O(null),g(!0),cI(Ie,V.signal).then((pe)=>{if(!V.signal.aborted)b({status:"ready",estimate:pe,range:Ie})},(pe)=>{if(!V.signal.aborted)b({status:"error",message:Nb(pe)})})},Z=async()=>{if(m.status!=="ready")return;S(!0),I(null);try{await fI(m.range),W(),f()}catch(V){I(Nb(V))}finally{S(!1)}},ce=async()=>{T(!0),O(null);try{await pI(),v()}catch(V){O(Nb(V))}finally{T(!1)}},ee=m.status==="ready"?m.estimate:null,G=m.status==="loading"?{label:"Proceed",onClick:Z,disabled:!0}:ee?.available?{label:h?"Starting…":"Proceed",onClick:Z,disabled:h||ee.messages===0}:void 0;return P.jsxDEV(fe,{index:1,title:P.jsxDEV(P.Fragment,{children:[u("frustration.judge-panel")," ",P.jsxDEV(_N,{job:c,judgeAvailable:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this),description:u("frustration.judge-description"),actions:P.jsxDEV("button",{type:"button",className:"btn","data-variant":"accent","data-size":"sm",onClick:ue,disabled:!i||Y,title:!i?g2:Y?u("frustration.judge-running"):u("frustration.quote-title"),children:[P.jsxDEV(Un,{size:13},void 0,!1,void 0,this)," ",u("frustration.classify")]},void 0,!0,void 0,this),children:[P.jsxDEV("div",{className:"stack frustration-judge",children:[Y?P.jsxDEV(FN,{job:c,cancelling:C,onCancel:ce},void 0,!1,void 0,this):P.jsxDEV(GN,{job:c},void 0,!1,void 0,this),!i&&P.jsxDEV("p",{className:"micro dim",children:g2},void 0,!1,void 0,this),R&&P.jsxDEV("p",{className:"micro tone-bad",role:"alert",children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(NI,{open:y,title:u("frustration.classify"),onClose:W,primaryAction:G,children:[P.jsxDEV(HN,{estimate:m},void 0,!1,void 0,this),L&&P.jsxDEV("p",{className:"micro tone-bad",role:"alert",children:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function _N({job:r,judgeAvailable:l}){switch(r.state){case"running":return P.jsxDEV(ct,{tone:"ok",children:[P.jsxDEV(Hn,{tone:"live",pulse:!0},void 0,!1,void 0,this)," ",u("frustration.running")]},void 0,!0,void 0,this);case"done":return P.jsxDEV(ct,{tone:"ok",children:u("frustration.last-run-done")},void 0,!1,void 0,this);case"cancelled":return P.jsxDEV(ct,{tone:"warn",children:u("frustration.last-run-cancelled")},void 0,!1,void 0,this);case"failed":return P.jsxDEV(ct,{tone:"bad",children:u("frustration.last-run-failed")},void 0,!1,void 0,this);case"idle":return P.jsxDEV(ct,{children:l?u("frustration.not-run-yet"):u("frustration.regex-only")},void 0,!1,void 0,this)}}function HN({estimate:r}){if(r.status==="loading")return P.jsxDEV("p",{className:"muted",children:u("frustration.estimating")},void 0,!1,void 0,this);if(r.status==="error")return P.jsxDEV("p",{className:"tone-bad",children:r.message},void 0,!1,void 0,this);let l=r.estimate;if(!l.available)return P.jsxDEV("p",{children:l.reason},void 0,!1,void 0,this);if(l.messages===0)return P.jsxDEV("p",{children:u("frustration.all-judged")},void 0,!1,void 0,this);return P.jsxDEV(P.Fragment,{children:[P.jsxDEV("div",{className:"frustration-quote",children:[P.jsxDEV("span",{className:"dim micro",children:u("frustration.estimated-cost")},void 0,!1,void 0,this),P.jsxDEV("span",{className:"num frustration-quote-value",children:["≈ ",zt(l.cost)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(So,{items:[{key:"messages",label:u("frustration.unjudged-messages"),value:A(l.messages)},{key:"chars",label:u("frustration.prose-chars"),value:A(l.chars)},{key:"tokens",label:u("frustration.input-tokens"),value:A(l.inputTokens)},{key:"judge",label:u("frustration.judge-model"),value:l.judge}]},void 0,!1,void 0,this),P.jsxDEV("p",{className:"micro dim",children:u("frustration.estimate-note")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FN({job:r,cancelling:l,onCancel:i}){let c=r.done+r.failed,f=r.total>0?Math.min(1,c/r.total):0;return P.jsxDEV("div",{className:"stack frustration-progress",children:[P.jsxDEV("div",{className:"row frustration-progress-head",children:[P.jsxDEV("span",{className:"num",children:[A(r.done),"/",A(r.total)," judged"]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"num dim",children:Ge(f)},void 0,!1,void 0,this),P.jsxDEV("span",{className:"frustration-spacer"},void 0,!1,void 0,this),P.jsxDEV("button",{type:"button",className:"btn","data-variant":"danger","data-size":"sm",onClick:i,disabled:l,children:l?u("frustration.cancelling"):u("frustration.cancel-run")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV("div",{className:"meter frustration-progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":r.total,"aria-valuenow":c,children:P.jsxDEV("div",{className:"meter-fill frustration-progress-fill",style:{width:`${f*100}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV("div",{className:"row micro muted frustration-progress-meta",children:[P.jsxDEV("span",{className:r.failed>0?"tone-bad":void 0,children:u("frustration.failed-n",{count:A(r.failed)})},void 0,!1,void 0,this),P.jsxDEV("span",{children:[u("frustration.cost-so-far")," ",P.jsxDEV("span",{className:"num",children:zt(r.cost)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.judge&&P.jsxDEV("span",{className:"mono",children:r.judge},void 0,!1,void 0,this),r.startedAt!==null&&P.jsxDEV("span",{children:u("frustration.elapsed",{time:v2(Date.now()-r.startedAt)})},void 0,!1,void 0,this),r.startedAt!==null&&r.done>0&&P.jsxDEV("span",{className:"num",children:[(r.done/Math.max(1,(Date.now()-r.startedAt)/1000)).toFixed(0),"/s"]},void 0,!0,void 0,this),r.concurrency>0&&P.jsxDEV("span",{className:"num",children:u("frustration.in-flight",{count:A(r.concurrency)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function GN({job:r}){let l=u("frustration.messages-progress",{done:A(r.done),total:A(r.total)}),i=r.failed>0?u("frustration.failed-suffix",{count:A(r.failed)}):"",c=r.judge?u("frustration.judge-with",{judge:r.judge}):"",f=r.startedAt!==null&&r.finishedAt!==null?u("frustration.in-time",{time:v2(r.finishedAt-r.startedAt)}):"";switch(r.state){case"idle":return P.jsxDEV("p",{className:"muted",children:u("frustration.no-run-yet")},void 0,!1,void 0,this);case"running":return null;case"done":return P.jsxDEV("p",{className:"muted",children:u("frustration.run-done-line",{progress:l,failed:i,judge:c,elapsed:f,cost:zt(r.cost)})},void 0,!1,void 0,this);case"cancelled":return P.jsxDEV("p",{className:"muted",children:u("frustration.run-cancelled-line",{progress:l,failed:i,cost:zt(r.cost)})},void 0,!1,void 0,this);case"failed":return P.jsxDEV("p",{className:"muted",children:u("frustration.run-failed-line",{progress:l,failed:i,error:r.error??u("frustration.unknown-error"),cost:zt(r.cost)})},void 0,!1,void 0,this)}}function _i(r){return`${r.modelClass}/${r.family??"unclassified"}`}function ud(r){return r.messages>0&&r.judged/r.messages<qb}function VN(r){let l=2166136261;for(let i=0;i<r.length;i++)l^=r.charCodeAt(i),l=Math.imul(l,16777619);return l>>>0}function x2(r){let l=[...new Set(r.map(_i))].sort(),i=new Set,c=new Map;for(let f of l){let v=VN(f)%Za.length;for(let y=0;y<Za.length&&i.has(v);y++)v=(v+1)%Za.length;i.add(v),c.set(f,Za[v])}return c}function jN(r,l){if(l==="angry")return`color-mix(in srgb, ${r} 55%, black)`;if(l==="other")return`color-mix(in srgb, ${r} 32%, transparent)`;return r}var $N=[{key:"angry",label:"Angry at assistant"},{key:"assistant",label:"At assistant, not angry"},{key:"other",label:"Annoyed at other targets"}];function XN(r,l){if(l==="angry")return r.angry;if(l==="assistant")return r.atAssistant-r.angry;return r.annoyed-r.atAssistant}function Yf(r,l){return l>0?r/l*100:0}function YN({models:r,stale:l}){let[i,c]=At.useState(null),[f,v]=Pr(),[y,g]=At.useState(!1),[m,b]=At.useState(!1),h=At.useMemo(()=>x2(r),[r]),S=At.useMemo(()=>{let Z=new Map;for(let ce of r)Z.set(ce.modelClass,(Z.get(ce.modelClass)??0)+ce.messages);return Z},[r]),L=At.useMemo(()=>{let Z=null,ce=-1;for(let[ee,G]of S)if(G>ce)Z=ee,ce=G;return Z??Xf},[S]),I=i!==null&&(i===Xf||S.has(i))?i:L,C=At.useMemo(()=>[{value:Xf,label:"All",title:"Every model class"},...[...S].map(([Z,ce])=>({value:Z,label:Z,title:`${A(ce)} messages`}))],[S]),T=At.useMemo(()=>I===Xf?r:r.filter((Z)=>Z.modelClass===I),[r,I]),R=At.useMemo(()=>{let Z=new Map;for(let ce of T){let ee=_i(ce),G=Z.get(ee);if(G){G.messages+=ce.messages;continue}let V=ce.family??"unclassified";Z.set(ee,{key:ee,label:I===Xf?`${ce.modelClass} · ${V}`:V,messages:ce.messages})}return[...Z.values()]},[T,I]),O=At.useMemo(()=>T.filter((Z)=>!f.has(_i(Z))),[T,f]),z=O.filter((Z)=>Z.messages<cg).length,Y=O.filter(ud).length,W=At.useMemo(()=>O.filter((Z)=>(y||Z.messages>=cg)&&!(m&&ud(Z))),[O,y,m]);if(r.length===0)return P.jsxDEV(fe,{index:2,title:u("frustration.by-model"),stale:l,children:P.jsxDEV(Je,{title:u("frustration.no-messages"),hint:u("frustration.try-longer-range")},void 0,!1,void 0,this)},void 0,!1,void 0,this);let ue=W.some(ud);return P.jsxDEV(P.Fragment,{children:[P.jsxDEV(fe,{index:2,title:u("frustration.by-model"),description:u("frustration.by-model-description"),stale:l,children:P.jsxDEV("div",{className:"stack frustration-chart-body",children:[P.jsxDEV("div",{className:"frustration-classes",children:P.jsxDEV(Oa,{size:"sm","aria-label":u("frustration.model-class"),options:C,value:I,onChange:c},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV("div",{className:"row frustration-filters",children:[P.jsxDEV(ia,{items:R.map((Z)=>({key:Z.key,label:Z.label,color:h.get(Z.key)??Za[0],value:A(Z.messages)})),hidden:f,onToggle:v},void 0,!1,void 0,this),P.jsxDEV("span",{className:"frustration-spacer"},void 0,!1,void 0,this),P.jsxDEV("label",{className:"check",title:u("frustration.small-models-title",{count:cg}),children:[P.jsxDEV("input",{type:"checkbox",checked:y,onChange:(Z)=>g(Z.target.checked)},void 0,!1,void 0,this),u("frustration.include-small",{count:cg}),z>0?` (${z})`:""]},void 0,!0,void 0,this),P.jsxDEV("label",{className:"check",title:u("frustration.hide-regex-title",{share:qb*100}),children:[P.jsxDEV("input",{type:"checkbox",checked:m,onChange:(Z)=>b(Z.target.checked)},void 0,!1,void 0,this),"Hide mostly regex",Y>0?` (${Y})`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(KN,{hasRegexRows:ue},void 0,!1,void 0,this),P.jsxDEV(QN,{rows:W,familyColors:h},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(WN,{rows:W,familyColors:h,stale:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function KN({hasRegexRows:r}){return P.jsxDEV("div",{className:"legend frustration-key",children:[P.jsxDEV("span",{className:"legend-item",children:[P.jsxDEV("span",{className:"swatch frustration-key-swatch","data-variant":"angry"},void 0,!1,void 0,this),"Angry at assistant"]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item",children:[P.jsxDEV("span",{className:"swatch frustration-key-swatch","data-variant":"assistant"},void 0,!1,void 0,this),"At assistant"]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item",children:[P.jsxDEV("span",{className:"swatch frustration-key-swatch","data-variant":"other"},void 0,!1,void 0,this),"Annoyed at other targets"]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item",children:[P.jsxDEV("span",{className:"frustration-key-line"},void 0,!1,void 0,this),u("frustration.legend-trend")]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item frustration-key-wide",title:u("frustration.hatch-title",{share:qb*100}),children:[P.jsxDEV("span",{className:"swatch frustration-key-swatch","data-variant":"hatch"},void 0,!1,void 0,this),r?u("frustration.legend-hatched-run"):u("frustration.legend-hatched")]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item dim",children:u("frustration.legend-hue")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QN({rows:r,familyColors:l}){let i=At.useMemo(()=>{let c=new Map;r.forEach((v,y)=>{let g=_i(v),m=ud(v),b=`${g}|${m?"regex":"judged"}`,h=c.get(b);if(h)h.slots.push(y);else c.set(b,{family:g,regex:m,slots:[y]})});let f=[];for(let v of $N)for(let[y,g]of c){let m=r.map(()=>null);for(let b of g.slots)m[b]=Yf(XN(r[b],v.key),r[b].messages);f.push({key:`${v.key}|${y}`,label:v.label,color:jN(l.get(g.family)??Za[0],v.key),values:m,pattern:g.regex?"hatch":void 0})}return f.push({key:"trend",label:"At assistant (total)",color:"var(--ink-1)",values:r.map((v)=>Yf(v.atAssistant,v.messages)),kind:"line",tooltip:!1}),f},[r,l]);if(r.length===0)return P.jsxDEV("div",{className:"frustration-chart-empty",children:P.jsxDEV(Je,{title:u("frustration.no-model-match")},void 0,!1,void 0,this)},void 0,!1,void 0,this);return P.jsxDEV(yr,{slots:r.length,tickLabel:(c)=>r[c].label,series:i,height:340,format:(c)=>`${c}%`,formatTooltip:(c)=>`${c.toFixed(1)}%`,showTotal:!1,emptyLabel:"No frustrated messages for these models",tooltipExtra:(c)=>{let f=r[c];return P.jsxDEV("div",{className:"frustration-tooltip-extra",children:[P.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[P.jsxDEV("span",{className:"chart-tooltip-label",children:u("frustration.legend-annoyed-any")},void 0,!1,void 0,this),P.jsxDEV("span",{className:"chart-tooltip-value",children:Da(f.annoyed,f.messages)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV("div",{className:"micro dim",children:[A(f.messages)," messages · judged ",A(f.judged)," (",Da(f.judged,f.messages),")",ud(f)?u("frustration.row-mostly-regex"):""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this)}function WN({rows:r,familyColors:l,stale:i}){let c=At.useMemo(()=>[{key:"model",header:u("common.model"),sort:(f)=>f.label,render:(f)=>P.jsxDEV("span",{className:"row",title:f.key,children:[P.jsxDEV("span",{className:"swatch",style:{background:l.get(_i(f))??Za[0]}},void 0,!1,void 0,this),P.jsxDEV("span",{className:"cell-primary",children:f.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"ids",header:u("frustration.column-model-ids"),wrap:!0,render:(f)=>P.jsxDEV("span",{className:"mono micro dim",children:f.models.join(", ")},void 0,!1,void 0,this)},{key:"messages",header:u("frustration.column-messages"),align:"right",sort:(f)=>f.messages,render:(f)=>P.jsxDEV("span",{className:"num",children:A(f.messages)},void 0,!1,void 0,this)},{key:"judged",header:u("frustration.column-judged"),align:"right",sort:(f)=>f.messages>0?f.judged/f.messages:0,render:(f)=>ud(f)?P.jsxDEV("span",{className:"row frustration-judged",title:u("frustration.mostly-regex"),children:[P.jsxDEV(ct,{tone:"warn",children:u("frustration.regex-badge")},void 0,!1,void 0,this),P.jsxDEV("span",{className:"num dim",children:Da(f.judged,f.messages)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):P.jsxDEV("span",{className:"num",children:Da(f.judged,f.messages)},void 0,!1,void 0,this)},{key:"annoyed",header:u("frustration.annoyed"),align:"right",sort:(f)=>Yf(f.annoyed,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.messages-n",{count:A(f.annoyed)}),children:Da(f.annoyed,f.messages)},void 0,!1,void 0,this)},{key:"atAssistant",header:u("frustration.at-assistant"),align:"right",sort:(f)=>Yf(f.atAssistant,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.messages-n",{count:A(f.atAssistant)}),children:Da(f.atAssistant,f.messages)},void 0,!1,void 0,this)},{key:"angry",header:u("frustration.angry"),align:"right",sort:(f)=>Yf(f.angry,f.messages),render:(f)=>P.jsxDEV("span",{className:f.angry>0?"num tone-bad":"num",title:u("frustration.messages-n",{count:A(f.angry)}),children:Da(f.angry,f.messages)},void 0,!1,void 0,this)}],[l]);return P.jsxDEV(fe,{index:3,title:u("frustration.model-versions"),description:u("frustration.table-description"),flush:!0,stale:i,children:P.jsxDEV(Ft,{rows:r,rowKey:(f)=>f.key,columns:c,dense:!0,empty:P.jsxDEV(Je,{title:u("frustration.no-model-match")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function ZN({overall:r,window:l}){let i=r.messages>0?(r.collapse/r.messages).toFixed(2):"–";return P.jsxDEV(P.Fragment,{children:[P.jsxDEV("div",{className:"card-titles",children:[P.jsxDEV("h2",{className:"page-title",children:u("frustration.model-side-title")},void 0,!1,void 0,this),P.jsxDEV("p",{className:"page-description",children:u("frustration.model-side-description",{window:l})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV("div",{className:"frustration-model-notes",children:[P.jsxDEV(wa,{min:170,children:[P.jsxDEV(ie,{label:u("frustration.model-turns"),title:u("frustration.model-turns-title"),value:A(r.messages)},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-breakdown"),title:u("frustration.model-breakdown-title"),value:Da(r.breakdown,r.messages),hint:u("frustration.turns-n",{count:A(r.breakdown)})},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-mean"),title:u("frustration.model-mean-title"),value:i,hint:u("frustration.model-hint-mean",{value:i})},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-self-blame"),title:u("frustration.model-self-blame-title"),value:Da(r.blamed,r.messages)},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-hedge"),title:u("frustration.model-hedge-title"),value:Da(r.hedged,r.messages)},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-spiral"),title:u("frustration.model-spiral-title"),value:Da(r.spiraled,r.messages)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.unscored>0&&P.jsxDEV("p",{className:"micro dim",children:u("frustration.model-unscored-line",{count:A(r.unscored)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function sn(r,l){return l>0?r/l*100:0}function JN({models:r,series:l,range:i,stale:c}){let f=aa(i),v=At.useMemo(()=>x2(r),[r]),y=At.useMemo(()=>oo(i,l.map((h)=>h.timestamp),f.bucketMs),[l,i,f.bucketMs]),g=At.useMemo(()=>new Map(l.map((h)=>[h.timestamp,h])),[l]),m=At.useMemo(()=>[{key:"breakdown",label:u("frustration.model-legend-breakdown"),color:"var(--chart-primary)",values:y.map((h)=>{let S=g.get(h);return S&&S.messages>0?sn(S.breakdown,S.messages):null})}],[y,g]),b=At.useMemo(()=>[...r].sort((h,S)=>sn(S.breakdown,S.messages)-sn(h.breakdown,h.messages)||S.messages-h.messages).slice(0,12),[r]);if(r.length===0)return P.jsxDEV(fe,{index:4,title:u("frustration.model-by-model"),stale:c,children:P.jsxDEV(Je,{title:u("frustration.model-no-turns"),hint:u("frustration.model-try-longer-range")},void 0,!1,void 0,this)},void 0,!1,void 0,this);return P.jsxDEV(P.Fragment,{children:[P.jsxDEV(fe,{index:4,title:u("frustration.model-by-model"),description:u("frustration.model-by-model-description"),stale:c,children:P.jsxDEV(Ts,{max:100,items:b.map((h)=>({key:h.key,label:h.label,value:sn(h.breakdown,h.messages),display:Da(h.breakdown,h.messages),color:v.get(_i(h))??Za[0]}))},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(fe,{index:5,title:u("frustration.model-over-time"),description:u("frustration.model-over-time-description"),actions:P.jsxDEV(ia,{items:m.map((h)=>({key:h.key,label:h.label,color:h.color}))},void 0,!1,void 0,this),stale:c,children:P.jsxDEV(_o,{buckets:y,bucketMs:f.bucketMs,series:m,height:260,yMax:100,format:(h)=>`${h}%`,formatTooltip:(h)=>`${h.toFixed(1)}%`,emptyLabel:u("frustration.model-no-turns")},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(eq,{rows:r,familyColors:v,stale:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function eq({rows:r,familyColors:l,stale:i}){let c=At.useMemo(()=>[{key:"model",header:u("common.model"),sort:(f)=>f.label,render:(f)=>P.jsxDEV("span",{className:"row",title:f.key,children:[P.jsxDEV("span",{className:"swatch",style:{background:l.get(_i(f))??Za[0]}},void 0,!1,void 0,this),P.jsxDEV("span",{className:"cell-primary",children:f.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"ids",header:u("frustration.column-model-ids"),wrap:!0,render:(f)=>P.jsxDEV("span",{className:"mono micro dim",children:f.models.join(", ")},void 0,!1,void 0,this)},{key:"turns",header:u("frustration.column-turns"),align:"right",sort:(f)=>f.messages,render:(f)=>P.jsxDEV("span",{className:"num",children:A(f.messages)},void 0,!1,void 0,this)},{key:"selfBlame",header:u("frustration.model-self-blame"),align:"right",sort:(f)=>sn(f.blamed,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.blamed)}),children:Da(f.blamed,f.messages)},void 0,!1,void 0,this)},{key:"restatement",header:u("frustration.model-restatement"),title:u("frustration.model-restatement-title"),align:"right",sort:(f)=>sn(f.restated,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.restated)}),children:Da(f.restated,f.messages)},void 0,!1,void 0,this)},{key:"hedge",header:u("frustration.model-hedge"),align:"right",sort:(f)=>sn(f.hedged,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.hedged)}),children:Da(f.hedged,f.messages)},void 0,!1,void 0,this)},{key:"rambling",header:u("frustration.model-rambling"),title:u("frustration.model-rambling-title"),align:"right",sort:(f)=>sn(f.verbose,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.verbose)}),children:Da(f.verbose,f.messages)},void 0,!1,void 0,this)},{key:"spiral",header:u("frustration.model-spiral"),align:"right",sort:(f)=>sn(f.spiraled,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.spiraled)}),children:Da(f.spiraled,f.messages)},void 0,!1,void 0,this)},{key:"breakdown",header:u("frustration.model-breakdown"),align:"right",sort:(f)=>sn(f.breakdown,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.breakdown)}),children:Da(f.breakdown,f.messages)},void 0,!1,void 0,this)},{key:"mean",header:u("frustration.column-mean"),align:"right",sort:(f)=>f.messages>0?f.collapse/f.messages:0,render:(f)=>P.jsxDEV("span",{className:"num",children:f.messages>0?(f.collapse/f.messages).toFixed(2):"–"},void 0,!1,void 0,this)}],[l]);return P.jsxDEV(fe,{index:6,title:u("frustration.model-table-title"),description:u("frustration.model-table-description"),flush:!0,stale:i,children:P.jsxDEV(Ft,{rows:r,rowKey:(f)=>f.key,columns:c,dense:!0,empty:P.jsxDEV(Je,{title:u("frustration.model-no-turns")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function tq({sessions:r,stale:l}){let i=At.useMemo(()=>[{key:"session",header:u("frustration.column-session"),render:(c)=>P.jsxDEV("span",{className:"stack",title:c.sessionFile,children:[P.jsxDEV("span",{className:"cell-primary mono micro",children:c.sessionFile.split(/[\\/]/).pop()??c.sessionFile},void 0,!1,void 0,this),P.jsxDEV("span",{className:"micro dim truncate",children:c.folder},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"models",header:u("common.model"),wrap:!0,render:(c)=>P.jsxDEV("span",{className:"mono micro dim",children:c.models.join(", ")},void 0,!1,void 0,this)},{key:"turns",header:u("frustration.column-turns"),align:"right",sort:(c)=>c.messages,render:(c)=>P.jsxDEV("span",{className:"num",children:A(c.messages)},void 0,!1,void 0,this)},{key:"breakdown",header:u("frustration.model-breakdown"),align:"right",sort:(c)=>sn(c.breakdown,c.messages),render:(c)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(c.breakdown)}),children:Da(c.breakdown,c.messages)},void 0,!1,void 0,this)},{key:"mean",header:u("frustration.column-mean"),align:"right",sort:(c)=>c.messages>0?c.collapse/c.messages:0,render:(c)=>P.jsxDEV("span",{className:"num",children:c.messages>0?(c.collapse/c.messages).toFixed(2):"–"},void 0,!1,void 0,this)},{key:"toolErrors",header:u("frustration.column-tool-errors"),align:"right",sort:(c)=>c.toolErrors,render:(c)=>P.jsxDEV("span",{className:c.toolErrors>0?"num tone-bad":"num",children:A(c.toolErrors)},void 0,!1,void 0,this)}],[]);return P.jsxDEV(fe,{index:7,title:u("frustration.model-sessions"),description:u("frustration.model-sessions-description"),flush:!0,stale:l,children:P.jsxDEV(Ft,{rows:r,rowKey:(c)=>c.sessionFile,columns:i,dense:!0,empty:P.jsxDEV(Je,{title:u("frustration.model-no-turns")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var Kf=_(Ke(),1);var Yt=_(te(),1),aq=86400000,oq={snapcompact:"Snapcompact"};function b2({active:r,range:l}){let[i,c]=Kf.useState(null),f=Pt(["gain",l,i],({signal:L})=>yI(l,i,L),{enabled:r}),v=aa(l),y=f.data,g=Kf.useMemo(()=>{let L=(y?.timeSeries??[]).map((O)=>({...O,timestamp:Date.parse(`${O.date}T00:00:00`)})),I=oo(l,L.map((O)=>O.timestamp),aq),C=ha(L,I,(O)=>O.snapcompact),T=0,R=C.map((O)=>T+=O);return{buckets:I,daily:C,cumulative:R}},[y,l]),m=Kf.useMemo(()=>{if(!y)return[];let L=y.overall.savedTokens;return Object.keys(y.bySource).map((I)=>({...y.bySource[I],source:I,share:L>0?y.bySource[I].savedTokens/L:0}))},[y]),b=y?.projects??[],h=i!==null&&!b.includes(i)?[i,...b]:b,S=[{key:"daily",label:u("gain.saved-per-day"),color:"var(--chart-primary)",values:g.daily},{key:"cumulative",label:u("gain.cumulative"),color:"var(--chart-secondary)",values:g.cumulative,kind:"line",axis:"right"}];return Yt.jsxDEV("div",{className:"page",children:[Yt.jsxDEV(la,{title:u("gain.title"),description:i?u("gain.description-scoped",{project:i,window:u(v.windowKey)}):u("gain.description",{window:u(v.windowKey)}),actions:h.length>0&&Yt.jsxDEV("select",{className:"input","aria-label":u("common.project"),value:i??"",onChange:(L)=>c(L.target.value||null),style:{maxWidth:320},children:[Yt.jsxDEV("option",{value:"",children:u("gain.all-projects")},void 0,!1,void 0,this),h.map((L)=>Yt.jsxDEV("option",{value:L,children:L},L,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Yt.jsxDEV(_e,{query:f,skeleton:Yt.jsxDEV(qt,{height:96},void 0,!1,void 0,this),isEmpty:(L)=>L.overall.hits===0&&L.timeSeries.length===0,empty:Yt.jsxDEV(fe,{children:Yt.jsxDEV(Je,{title:i?u("gain.empty-title-scoped",{project:i,window:u(v.windowKey)}):u("gain.empty-title",{window:u(v.windowKey)}),hint:l==="all"?u("gain.empty-hint-all"):u("gain.empty-hint-longer-range")},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:({overall:L})=>Yt.jsxDEV(Yt.Fragment,{children:[Yt.jsxDEV("div",{"data-stale":f.stale,children:Yt.jsxDEV(wa,{min:180,children:[Yt.jsxDEV(ie,{label:u("gain.saved-tokens"),value:se(L.savedTokens),hint:A(L.savedTokens),spark:g.daily},void 0,!1,void 0,this),Yt.jsxDEV(ie,{label:u("gain.saved-bytes"),value:kb(L.savedBytes)},void 0,!1,void 0,this),Yt.jsxDEV(ie,{label:u("gain.reduction"),title:u("gain.reduction-title"),value:L.reductionPercent!==null?Ge(L.reductionPercent):"–",hint:L.reductionPercent===null?u("gain.reduction-unknown"):void 0},void 0,!1,void 0,this),Yt.jsxDEV(ie,{label:u("gain.hits"),value:A(L.hits)},void 0,!1,void 0,this),Yt.jsxDEV(ie,{label:u("gain.saved-per-hit"),value:L.hits>0?se(L.savedTokens/L.hits):"–",hint:u("common.tokens")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Yt.jsxDEV(fe,{index:1,title:u("gain.savings-over-time"),description:u("gain.savings-over-time-description"),actions:Yt.jsxDEV(ia,{items:S.map((I)=>({key:I.key,label:I.label,color:I.color}))},void 0,!1,void 0,this),stale:f.stale,children:Yt.jsxDEV(yr,{slots:g.buckets.length,tickLabel:(I)=>_f(g.buckets[I]),series:S,height:260,formatTooltip:A,formatRight:se},void 0,!1,void 0,this)},void 0,!1,void 0,this),Yt.jsxDEV(fe,{index:2,title:u("gain.by-source"),description:u("gain.by-source-description"),flush:!0,stale:f.stale,children:Yt.jsxDEV(Ft,{rows:m,rowKey:(I)=>I.source,columns:rq()},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rq(){return[{key:"source",header:u("gain.source"),sort:(r)=>r.source,render:(r)=>Yt.jsxDEV("span",{className:"cell-primary",children:oq[r.source]},void 0,!1,void 0,this)},{key:"tokens",header:u("gain.saved-tokens"),align:"right",sort:(r)=>r.savedTokens,render:(r)=>Yt.jsxDEV("span",{title:A(r.savedTokens),children:Yt.jsxDEV(Ma,{value:r.share,max:1,display:se(r.savedTokens)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"share",header:u("common.share"),align:"right",sort:(r)=>r.share,render:(r)=>Yt.jsxDEV("span",{className:"num muted",children:Ge(r.share)},void 0,!1,void 0,this)},{key:"bytes",header:u("gain.saved-bytes"),align:"right",sort:(r)=>r.savedBytes,render:(r)=>Yt.jsxDEV("span",{className:"num",children:kb(r.savedBytes)},void 0,!1,void 0,this)},{key:"hits",header:u("gain.hits"),align:"right",sort:(r)=>r.hits,render:(r)=>Yt.jsxDEV("span",{className:"num",children:A(r.hits)},void 0,!1,void 0,this)},{key:"reduction",header:u("gain.reduction"),align:"right",sort:(r)=>r.reductionPercent??-1,render:(r)=>Yt.jsxDEV("span",{className:"num",children:r.reductionPercent!==null?Ge(r.reductionPercent):"–"},void 0,!1,void 0,this)}]}var dd=_(Ke(),1);var Te=_(te(),1);function nq(){return[{value:"share",label:u("common.share")},{value:"requests",label:u("common.requests")}]}var sq=6;function k2({active:r,range:l}){let i=Pt(["models",l],({signal:T})=>oI(l,T),{enabled:r}),c=aa(l),[f,v]=dd.useState("share"),[y,g]=Pr(),[m,b]=dd.useState(null),h=dd.useMemo(()=>i.data?lq(i.data,l):null,[i.data,l]),S=cq(c.bucketMs),L=dd.useMemo(()=>h?uq(h,m,S):[],[h,m,S]),I=(T)=>T.byModel.length===0,C=Te.jsxDEV(Je,{title:u("models.empty-title"),hint:u("models.empty-hint")},void 0,!1,void 0,this);return Te.jsxDEV("div",{className:"page",children:[Te.jsxDEV(la,{title:u("common.models"),description:u("models.subtitle",{window:u(c.windowKey)})},void 0,!1,void 0,this),Te.jsxDEV(_e,{query:i,skeleton:Te.jsxDEV(Fa,{height:112,style:{borderRadius:12}},void 0,!1,void 0,this),isEmpty:I,empty:C,children:()=>h&&Te.jsxDEV("div",{"data-stale":i.stale,children:Te.jsxDEV(wa,{min:200,children:[Te.jsxDEV(ie,{label:u("models.used"),value:A(h.models.length),hint:h.providerCount===1?u("models.across-providers-one",{count:A(h.providerCount)}):u("models.across-providers",{count:A(h.providerCount)})},void 0,!1,void 0,this),Te.jsxDEV(ie,{label:u("models.most-used"),title:h.top?`${h.top.model} (${h.top.provider})`:void 0,value:h.top?h.top.model:"–",hint:h.top?u("models.most-used-hint",{share:Ge(h.top.totalRequests/Math.max(1,h.totalRequests)),provider:h.top.provider}):void 0},void 0,!1,void 0,this),Te.jsxDEV(ie,{label:u("common.requests"),value:A(h.totalRequests),hint:u("models.failed-n",{count:A(h.failedRequests)}),spark:h.requestTotals},void 0,!1,void 0,this),Te.jsxDEV(ie,{label:u("models.api-cost"),title:u("models.api-cost-title"),value:oa(h.totalCost,h.unpricedRequests),hint:h.unpricedRequests>0?u("models.unpriced-n",{count:A(h.unpricedRequests)}):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Te.jsxDEV(fe,{index:1,title:u("models.request-share"),description:f==="share"?u("models.share-desc",{bucket:S}):u("models.count-desc",{bucket:S}),actions:Te.jsxDEV(Oa,{size:"sm",options:nq(),value:f,onChange:v,"aria-label":u("models.share-mode-aria")},void 0,!1,void 0,this),stale:i.stale,children:Te.jsxDEV(_e,{query:i,skeleton:Te.jsxDEV(qt,{height:260},void 0,!1,void 0,this),isEmpty:I,empty:C,children:()=>h&&Te.jsxDEV("div",{className:"stack",style:{gap:12},children:[Te.jsxDEV(_o,{buckets:h.buckets,bucketMs:c.bucketMs,series:f==="share"?h.shareSeries:h.countSeries,hidden:y,height:260,yMax:f==="share"?1:void 0,format:f==="share"?(T)=>Ge(T,0):se,formatTooltip:f==="share"?(T)=>Ge(T):A,showTotal:f==="requests"},void 0,!1,void 0,this),Te.jsxDEV(ia,{items:h.countSeries.map((T)=>({key:T.key,label:T.label,color:T.color,value:Ge(S2(T.values)/Math.max(1,S2(h.requestTotals)))})),hidden:y,onToggle:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Te.jsxDEV(fe,{index:2,title:u("models.all-models"),description:u("models.table-desc"),stale:i.stale,flush:!0,children:Te.jsxDEV(_e,{query:i,skeleton:Te.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),isEmpty:I,empty:C,children:()=>h&&Te.jsxDEV(Ft,{rows:h.models,rowKey:(T)=>Va(T.model,T.provider),columns:L,initialSort:{key:"requests",dir:"desc"},limit:25,onRowClick:(T)=>{let R=Va(T.model,T.provider);b((O)=>O===R?null:R)},selectedKey:m,expanded:(T)=>{let R=Va(T.model,T.provider);return R===m?Te.jsxDEV(dq,{model:T,color:h.swatches.get(R)??"var(--chart-primary)",points:h.performance.get(R)??[],bucketMs:c.bucketMs,bucketWord:S},void 0,!1,void 0,this):null}},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function lq(r,l){let i=r.byModel,c=ig(i),f=iq(i),v=oo(l,r.modelSeries.map((R)=>R.timestamp)),y=ha(r.modelSeries,v,(R)=>R.requests),g={buckets:v,key:(R)=>Va(R.model,R.provider),label:(R)=>f.get(R)??R,value:(R)=>R.requests,colors:c},m=Xn(r.modelSeries,{...g,limit:sq}).map((R)=>({...R,values:R.values.map((O)=>O||null)})),b=m.map((R)=>({...R,values:R.values.map((O,z)=>O===null?null:O/y[z])})),h=new Map(Xn(r.modelSeries,g).map((R)=>[R.key,R.values])),S,L=0,I=0,C=0,T=0;for(let R of i){if(!S||R.totalRequests>S.totalRequests)S=R;L+=R.totalRequests,I+=R.failedRequests,C+=R.totalCost,T+=R.unpricedRequests}return{models:i,top:S,swatches:new Map(m.filter((R)=>R.key!=="__other__").map((R)=>[R.key,R.color])),labels:f,providerCount:new Set(i.map((R)=>R.provider)).size,totalRequests:L,failedRequests:I,totalCost:C,unpricedRequests:T,maxRequests:S?.totalRequests??0,buckets:v,requestTotals:y,countSeries:m,shareSeries:b,trends:h,performance:i2(r.modelPerformanceSeries)}}function iq(r){let l=new Map;for(let i of r)l.set(i.model,(l.get(i.model)??0)+1);return new Map(r.map((i)=>[Va(i.model,i.provider),(l.get(i.model)??0)>1?`${i.model} · ${i.provider}`:i.model]))}function uq(r,l,i){return[{key:"expand",header:"",width:28,render:(c)=>Te.jsxDEV("span",{className:"models-chevron","data-open":Va(c.model,c.provider)===l,children:Te.jsxDEV(en,{size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"model",header:u("common.model"),sort:(c)=>c.model,render:(c)=>Te.jsxDEV(co,{lead:Te.jsxDEV(an,{color:r.swatches.get(Va(c.model,c.provider))??Mo},void 0,!1,void 0,this),primary:Te.jsxDEV("span",{className:"mono",children:c.model},void 0,!1,void 0,this),secondary:c.provider},void 0,!1,void 0,this)},{key:"requests",header:u("common.requests"),align:"right",sort:(c)=>c.totalRequests,render:(c)=>Te.jsxDEV(Ma,{value:c.totalRequests,max:r.maxRequests,display:A(c.totalRequests),color:r.swatches.get(Va(c.model,c.provider))??Mo},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("models.cost-title"),align:"right",sort:(c)=>c.totalCost,render:(c)=>Te.jsxDEV("span",{className:"num",children:oa(c.totalCost,c.unpricedRequests)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),title:u("models.tokens-title"),align:"right",sort:(c)=>Bl(c),render:(c)=>{let f=Bl(c);return Te.jsxDEV("span",{className:"num",title:A(f),children:se(f)},void 0,!1,void 0,this)}},{key:"cache",header:u("models.cache-rate"),title:u("models.cache-title"),align:"right",sort:(c)=>c.cacheRate,render:(c)=>Te.jsxDEV("span",{className:"num",children:Ge(c.cacheRate)},void 0,!1,void 0,this)},{key:"errors",header:u("models.errors"),align:"right",sort:(c)=>c.errorRate,render:(c)=>c.failedRequests===0?Te.jsxDEV("span",{className:"num dim",children:"0%"},void 0,!1,void 0,this):Te.jsxDEV("span",{title:u("models.failed-n",{count:A(c.failedRequests)}),children:Te.jsxDEV(ct,{tone:hr(c.errorRate),mono:!0,children:Ao(c.errorRate)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"tps",header:u("common.tokens-per-second"),title:u("models.tps-title"),align:"right",sort:(c)=>c.avgTokensPerSecond??-1,render:(c)=>Te.jsxDEV("span",{className:"num",children:Gn(c.avgTokensPerSecond)},void 0,!1,void 0,this)},{key:"ttft",header:u("models.ttft"),title:u("models.ttft-title"),align:"right",sort:(c)=>c.avgTtft??-1,render:(c)=>Te.jsxDEV("span",{className:"num",children:Ct(c.avgTtft)},void 0,!1,void 0,this)},{key:"trend",header:u("models.trend"),title:u("models.trend-title",{bucket:i}),width:112,render:(c)=>{let f=Va(c.model,c.provider),v=r.trends.get(f);return v?Te.jsxDEV(rd,{values:v.map((y)=>y??0),color:r.swatches.get(f)??Mo,width:96,height:22},void 0,!1,void 0,this):Te.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)}}]}function dq({model:r,color:l,points:i,bucketMs:c,bucketWord:f}){let[v,y]=Pr(),g=[{key:"tps",label:u("common.tokens-per-second"),color:l,kind:i.length>1?"line":"bars",values:i.map((m)=>m.avgTokensPerSecond)},{key:"ttft",label:u("models.ttft"),color:Mo,kind:i.length>1?"line":"bars",axis:"right",dashed:!0,values:i.map((m)=>m.avgTtftSeconds)}];return Te.jsxDEV("div",{className:"models-detail",children:[Te.jsxDEV("div",{className:"models-detail-facts",children:[Te.jsxDEV("div",{children:[Te.jsxDEV("div",{className:"section-label",children:u("models.efficiency")},void 0,!1,void 0,this),Te.jsxDEV(So,{items:[{key:"err",label:u("common.error-rate"),value:Te.jsxDEV("span",{className:`tone-${hr(r.errorRate)}`,children:[Ao(r.errorRate)," ",Te.jsxDEV("span",{className:"dim",children:["(",u("models.failed-n",{count:A(r.failedRequests)}),")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},{key:"cache",label:u("models.cache-rate"),value:Ge(r.cacheRate)},{key:"savings",label:u("models.cache-savings"),value:Te.jsxDEV("span",{className:r.cacheSavings<0?"tone-bad":void 0,children:Ge(r.cacheSavings)},void 0,!1,void 0,this)},{key:"premium",label:u("common.premium-requests"),value:A(Math.round(r.totalPremiumRequests*100)/100)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te.jsxDEV("div",{children:[Te.jsxDEV("div",{className:"section-label",children:u("models.latency")},void 0,!1,void 0,this),Te.jsxDEV(So,{items:[{key:"dur",label:u("models.avg-duration"),value:Ct(r.avgDuration)},{key:"ttft",label:u("models.avg-ttft"),value:Ct(r.avgTtft)},{key:"tps",label:u("common.tokens-per-second"),value:Gn(r.avgTokensPerSecond)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te.jsxDEV("div",{children:[Te.jsxDEV("div",{className:"section-label",children:u("common.tokens")},void 0,!1,void 0,this),Te.jsxDEV(So,{items:[{key:"in",label:u("models.uncached-input"),value:se(r.totalInputTokens)},{key:"cr",label:u("common.cache-read"),value:se(r.totalCacheReadTokens)},{key:"cw",label:u("common.cache-write"),value:se(r.totalCacheWriteTokens)},{key:"out",label:u("common.output"),value:se(r.totalOutputTokens)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te.jsxDEV("div",{className:"micro dim",children:u("models.first-last-seen",{first:ma(r.firstTimestamp),last:ma(r.lastTimestamp)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te.jsxDEV("div",{className:"models-detail-chart",children:[Te.jsxDEV("div",{className:"row",style:{justifyContent:"space-between"},children:[Te.jsxDEV("div",{className:"section-label",style:{marginBottom:0},children:u("models.performance-per-bucket",{bucket:f})},void 0,!1,void 0,this),Te.jsxDEV(ia,{items:g.map((m)=>({key:m.key,label:m.label,color:m.color})),hidden:v,onToggle:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.length===0?Te.jsxDEV(Je,{title:u("models.no-samples-title"),hint:u("models.no-samples-hint")},void 0,!1,void 0,this):Te.jsxDEV(_o,{buckets:i.map((m)=>m.timestamp),bucketMs:c,series:g,hidden:v,stacked:!1,height:240,format:se,formatTooltip:(m)=>u("models.tok-per-second",{value:Gn(m)}),formatRight:(m)=>`${Number(m.toFixed(2))}s`,tooltipExtra:(m)=>Te.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[Te.jsxDEV("span",{className:"chart-tooltip-label",children:u("common.requests")},void 0,!1,void 0,this),Te.jsxDEV("span",{className:"chart-tooltip-value",children:A(i[m].requests)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function cq(r){if(r<3600000)return u("models.bucket-5m");if(r<86400000)return u("models.bucket-hour");return u("models.bucket-day")}function S2(r){let l=0;for(let i of r)l+=i??0;return l}var fg=_(Ke(),1);var Ee=_(te(),1);function fq(){return[{value:"requests",label:u("common.requests")},{value:"tokens",label:u("common.tokens")},{value:"cost",label:u("common.cost")}]}var L2={main:"overview.main-agent",subagent:"overview.subagents",advisor:"overview.advisor"},w2={main:"var(--chart-primary)",subagent:"var(--chart-secondary)",advisor:"#9d7bff"};function C2(){return[{key:"input",label:u("overview.uncached-input"),color:"#5b8cff"},{key:"cacheRead",label:u("common.cache-read"),color:"var(--chart-primary)"},{key:"cacheWrite",label:u("common.cache-write"),color:"#f5b54a"},{key:"output",label:u("common.output"),color:"var(--chart-secondary)"}]}function T2({active:r,range:l,onRequestClick:i}){let c=Pt(["overview",l],({signal:h})=>aI(l,h),{enabled:r}),f=Pt(["recent-requests"],({signal:h})=>Vh(12,h),{enabled:r}),[v,y]=fg.useState("requests"),g=aa(l),m=fg.useMemo(()=>{let h=c.data?.timeSeries??[],S=oo(l,h.map((L)=>L.timestamp));return{buckets:S,requests:ha(h,S,(L)=>L.requests-L.errors),errors:ha(h,S,(L)=>L.errors),tokens:ha(h,S,(L)=>L.tokens),cost:ha(h,S,(L)=>L.cost),all:ha(h,S,(L)=>L.requests)}},[c.data,l]),b=v==="requests"?[{key:"ok",label:u("overview.succeeded"),color:"var(--chart-primary)",values:m.requests},{key:"err",label:u("common.failed"),color:"var(--bad)",values:m.errors}]:v==="tokens"?[{key:"tokens",label:u("common.tokens"),color:"var(--chart-primary)",values:m.tokens}]:[{key:"cost",label:u("overview.api-equivalent"),color:"var(--chart-secondary)",values:m.cost}];return Ee.jsxDEV("div",{className:"page",children:[Ee.jsxDEV(la,{title:u("overview.title"),description:u("overview.description",{window:u(g.windowKey)})},void 0,!1,void 0,this),Ee.jsxDEV(_e,{query:c,skeleton:Ee.jsxDEV(qt,{height:112},void 0,!1,void 0,this),children:({overall:h})=>Ee.jsxDEV("div",{"data-stale":c.stale,className:"stack",style:{gap:16},children:[Ee.jsxDEV(wa,{min:190,children:[Ee.jsxDEV(ie,{label:u("overview.api-equivalent-cost"),title:u("overview.api-cost-title"),value:oa(h.totalCost,h.unpricedRequests),hint:h.unpricedRequests>0?u("overview.unpriced-n",{count:A(h.unpricedRequests)}):void 0,spark:m.cost,sparkColor:"var(--chart-secondary)"},void 0,!1,void 0,this),Ee.jsxDEV(ie,{label:u("common.requests"),value:A(h.totalRequests),hint:u("overview.failed-n",{count:A(h.failedRequests)}),spark:m.all},void 0,!1,void 0,this),Ee.jsxDEV(ie,{label:u("overview.conversation-tokens"),title:u("overview.tokens-title"),value:se(Bl(h)),hint:u("overview.output-n",{count:se(h.totalOutputTokens)}),spark:m.tokens},void 0,!1,void 0,this),Ee.jsxDEV(ie,{label:u("overview.cache-rate"),title:u("overview.cache-rate-title"),value:Ge(h.cacheRate),hint:u("overview.cache-saved",{value:Ge(h.cacheSavings)})},void 0,!1,void 0,this),Ee.jsxDEV(ie,{label:u("common.error-rate"),value:Ao(h.errorRate),hint:u("overview.succeeded-n",{count:A(h.successfulRequests)}),spark:m.errors,sparkColor:"var(--bad)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ee.jsxDEV(wa,{min:140,children:[Ee.jsxDEV(ie,{size:"sm",label:u("overview.uncached-input"),value:se(h.totalInputTokens)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.cache-read"),value:se(h.totalCacheReadTokens)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.cache-write"),value:se(h.totalCacheWriteTokens)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.output"),value:se(h.totalOutputTokens)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.premium-requests"),value:A(Math.round(h.totalPremiumRequests*100)/100)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.tokens-per-second"),value:Gn(h.avgTokensPerSecond)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("overview.avg-latency"),value:Ct(h.avgDuration)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("overview.avg-ttft"),value:Ct(h.avgTtft)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ee.jsxDEV("div",{className:"grid grid-main-side",children:[Ee.jsxDEV(fe,{index:1,title:u("overview.activity"),description:g.bucketMs<3600000?u("overview.per-5m"):g.bucketMs<86400000?u("overview.per-hour"):u("overview.per-day"),actions:Ee.jsxDEV(Oa,{size:"sm",options:fq(),value:v,onChange:y},void 0,!1,void 0,this),stale:c.stale,children:Ee.jsxDEV(_e,{query:c,skeleton:Ee.jsxDEV(qt,{height:260},void 0,!1,void 0,this),children:()=>Ee.jsxDEV(_o,{buckets:m.buckets,bucketMs:g.bucketMs,series:b,height:260,format:v==="cost"?(h)=>oa(h,0):se},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ee.jsxDEV(fe,{index:2,title:u("overview.token-mix"),description:u("overview.token-mix-description"),stale:c.stale,children:Ee.jsxDEV(_e,{query:c,skeleton:Ee.jsxDEV(qt,{height:260},void 0,!1,void 0,this),children:({overall:h,byAgentType:S})=>{let L={input:h.totalInputTokens,cacheRead:h.totalCacheReadTokens,cacheWrite:h.totalCacheWriteTokens,output:h.totalOutputTokens},I=Bl(h),C=s2(S);return Ee.jsxDEV("div",{className:"stack",style:{gap:18},children:[Ee.jsxDEV("div",{className:"stack",style:{gap:10},children:[Ee.jsxDEV($n,{segments:C2().map((T)=>({key:T.key,label:T.label,value:L[T.key],color:T.color}))},void 0,!1,void 0,this),Ee.jsxDEV(ia,{items:C2().map((T)=>({key:T.key,label:T.label,color:T.color,value:I>0?Ge(L[T.key]/I,0):"–"}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ee.jsxDEV("div",{className:"stack",style:{gap:10},children:[Ee.jsxDEV("div",{className:"section-label",style:{marginBottom:0},children:u("overview.by-agent")},void 0,!1,void 0,this),Ee.jsxDEV($n,{segments:C.segments.map((T)=>({key:T.agentType,label:u(L2[T.agentType]),value:T.tokens,color:w2[T.agentType]}))},void 0,!1,void 0,this),C.segments.map((T)=>Ee.jsxDEV("div",{className:"row",style:{justifyContent:"space-between"},children:[Ee.jsxDEV("span",{className:"row",children:[Ee.jsxDEV("span",{className:"swatch",style:{background:w2[T.agentType]}},void 0,!1,void 0,this),u(L2[T.agentType]),Ee.jsxDEV("span",{className:"dim num",children:u("overview.requests-short",{count:A(T.requests)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ee.jsxDEV("span",{className:"row",children:[Ee.jsxDEV("span",{className:"dim num",children:se(T.tokens)},void 0,!1,void 0,this),Ee.jsxDEV("span",{className:"num",style:{minWidth:48,textAlign:"right"},children:Ge(T.share)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},T.agentType,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ee.jsxDEV(fe,{index:3,title:Ee.jsxDEV(Ee.Fragment,{children:[Ee.jsxDEV(Hn,{tone:"live",pulse:!0},void 0,!1,void 0,this)," ",u("overview.latest-requests")]},void 0,!0,void 0,this),description:u("overview.latest-requests-description"),actions:Ee.jsxDEV("a",{className:"btn","data-size":"sm","data-variant":"ghost",href:`#/requests?range=${l}`,children:[u("overview.all-requests")," ",Ee.jsxDEV(rf,{size:13},void 0,!1,void 0,this)]},void 0,!0,void 0,this),flush:!0,children:Ee.jsxDEV(_e,{query:f,skeleton:Ee.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),children:(h)=>Ee.jsxDEV(Ft,{rows:h,rowKey:(S)=>S.id??`${S.sessionFile}:${S.entryId}`,onRowClick:(S)=>S.id!==void 0&&i(S.id),columns:pq(),dense:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pq(){return[{key:"model",header:u("common.model"),render:(r)=>Ee.jsxDEV(co,{primary:r.model,secondary:r.provider},void 0,!1,void 0,this)},{key:"time",header:u("overview.when"),render:(r)=>Ee.jsxDEV("span",{className:"muted",children:ma(r.timestamp)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),align:"right",render:(r)=>Ee.jsxDEV("span",{className:"num",children:A(r.usage.totalTokens)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),align:"right",render:(r)=>Ee.jsxDEV("span",{className:"num",children:Ol(r,4)},void 0,!1,void 0,this)},{key:"duration",header:u("common.duration"),align:"right",render:(r)=>Ee.jsxDEV("span",{className:"num",children:Ct(r.duration)},void 0,!1,void 0,this)},{key:"status",header:u("overview.status"),align:"right",render:(r)=>r.errorMessage?Ee.jsxDEV(ct,{tone:"bad",children:u("common.failed")},void 0,!1,void 0,this):Ee.jsxDEV(ct,{tone:"ok",children:u("overview.ok")},void 0,!1,void 0,this)}]}var ln=_(Ke(),1);var et=_(te(),1),mq=100,I2=8;function R2({active:r,range:l}){let i=Pt(["projects",l],({signal:T})=>mI(l,T),{enabled:r}),[c,f]=ln.useState(""),[v,y]=ln.useState(!0),g=ln.useDeferredValue(c.trim().toLowerCase()),m=aa(l),b=ln.useMemo(()=>u2(i.data??[]),[i.data]),h=ln.useMemo(()=>v?b.rows.filter((T)=>!T.temporary):b.rows,[b,v]),S=ln.useMemo(()=>g?h.filter((T)=>T.folder.toLowerCase().includes(g)):h,[h,g]),L=ln.useMemo(()=>({cost:[...h].sort((T,R)=>R.totalCost-T.totalCost).slice(0,I2),requests:[...h].sort((T,R)=>R.totalRequests-T.totalRequests).slice(0,I2)}),[h]),I=et.jsxDEV(Je,{title:u(b.rows.length===0?"projects.empty-no-folders":"projects.empty-only-temporary")},void 0,!1,void 0,this),C=ln.useMemo(()=>hq(b.maxRequests,b.maxCost),[b]);return et.jsxDEV("div",{className:"page",children:[et.jsxDEV(la,{title:u("projects.title"),description:u("projects.description",{window:u(m.windowKey)})},void 0,!1,void 0,this),et.jsxDEV(_e,{query:i,skeleton:et.jsxDEV(qt,{height:96},void 0,!1,void 0,this),children:()=>et.jsxDEV("div",{"data-stale":i.stale,children:et.jsxDEV(wa,{min:180,children:[et.jsxDEV(ie,{label:u("projects.folders"),value:A(b.rows.length),hint:b.temporaryCount>0?u("projects.temporary-n",{count:A(b.temporaryCount)}):void 0},void 0,!1,void 0,this),et.jsxDEV(ie,{label:u("common.requests"),value:A(b.totalRequests),hint:u("projects.failed-n",{count:A(b.failedRequests)})},void 0,!1,void 0,this),et.jsxDEV(ie,{label:u("projects.api-equivalent-cost"),title:u("projects.api-equivalent-cost-hint"),value:oa(b.totalCost,b.unpricedRequests),hint:b.unpricedRequests>0?u("projects.unpriced-n",{count:A(b.unpricedRequests)}):void 0},void 0,!1,void 0,this),et.jsxDEV(ie,{label:u("projects.conversation-tokens"),title:u("projects.conversation-tokens-hint"),value:se(b.conversationTokens)},void 0,!1,void 0,this),et.jsxDEV(ie,{label:u("projects.cache-rate"),title:u("projects.cache-rate-hint-all"),value:Ge(b.cacheRate)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),et.jsxDEV("div",{className:"grid grid-2",children:[et.jsxDEV(fe,{index:1,title:u("projects.top-by-cost"),description:u("projects.top-by-cost-description"),stale:i.stale,children:et.jsxDEV(_e,{query:i,skeleton:et.jsxDEV(qt,{height:236},void 0,!1,void 0,this),isEmpty:()=>L.cost.length===0,empty:I,children:()=>et.jsxDEV(Ts,{items:L.cost.map((T)=>({key:T.folder,label:et.jsxDEV("span",{className:"mono",children:zr(T.folder)},void 0,!1,void 0,this),value:T.totalCost,display:`${oa(T.totalCost,T.unpricedRequests)} · ${Ge(T.costShare)}`,color:"var(--chart-secondary)"})),onSelect:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),et.jsxDEV(fe,{index:2,title:u("projects.top-by-requests"),description:u("projects.top-by-requests-description"),stale:i.stale,children:et.jsxDEV(_e,{query:i,skeleton:et.jsxDEV(qt,{height:236},void 0,!1,void 0,this),isEmpty:()=>L.requests.length===0,empty:I,children:()=>et.jsxDEV(Ts,{items:L.requests.map((T)=>({key:T.folder,label:et.jsxDEV("span",{className:"mono",children:zr(T.folder)},void 0,!1,void 0,this),value:T.totalRequests,display:`${A(T.totalRequests)} · ${Ge(T.requestShare)}`})),onSelect:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),et.jsxDEV(fe,{index:3,title:u("projects.folders"),description:i.data?S.length===b.rows.length?u("projects.folders-n",{count:A(b.rows.length)}):u("projects.folders-of-n",{count:A(S.length),total:A(b.rows.length)}):void 0,actions:et.jsxDEV(et.Fragment,{children:[b.temporaryCount>0&&et.jsxDEV("label",{className:"check",title:u("projects.hide-temporary-hint"),children:[et.jsxDEV("input",{type:"checkbox",checked:v,onChange:(T)=>y(T.target.checked)},void 0,!1,void 0,this),u("projects.hide-temporary",{count:A(b.temporaryCount)})]},void 0,!0,void 0,this),et.jsxDEV(Fn,{value:c,onChange:f,placeholder:u("projects.filter-placeholder"),width:240},void 0,!1,void 0,this)]},void 0,!0,void 0,this),flush:!0,stale:i.stale,children:et.jsxDEV(_e,{query:i,skeleton:et.jsxDEV(pa,{rows:10},void 0,!1,void 0,this),children:()=>et.jsxDEV(Ft,{rows:S,rowKey:(T)=>T.folder,columns:C,initialSort:{key:"cost",dir:"desc"},limit:mq,dense:!0,empty:et.jsxDEV(Je,{title:u(b.rows.length===0?"projects.empty-no-folders":"projects.empty-no-match"),hint:b.rows.length===0?u("projects.hint-longer-range"):v&&b.temporaryCount>0?u("projects.hint-temporary-hidden"):void 0},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function hq(r,l){return[{key:"folder",header:u("projects.folder"),sort:(i)=>i.folder,render:(i)=>et.jsxDEV("span",{className:"row projects-folder",title:i.folder||u("common.root"),children:[et.jsxDEV("span",{className:"mono truncate",children:zr(i.folder)},void 0,!1,void 0,this),i.temporary&&et.jsxDEV(ct,{children:u("projects.temp")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"requests",header:u("common.requests"),align:"right",sort:(i)=>i.totalRequests,render:(i)=>et.jsxDEV("span",{title:u("projects.share-of-requests",{share:Ge(i.requestShare)}),children:et.jsxDEV(Ma,{value:i.totalRequests,max:r,display:A(i.totalRequests)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("projects.api-equivalent-cost-rates"),align:"right",sort:(i)=>i.totalCost,render:(i)=>et.jsxDEV("span",{title:u("projects.share-of-cost",{share:Ge(i.costShare)}),children:et.jsxDEV(Ma,{value:i.totalCost,max:l,display:oa(i.totalCost,i.unpricedRequests),color:"var(--chart-secondary)"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),title:u("projects.conversation-tokens-hint"),align:"right",sort:(i)=>i.conversationTokens,render:(i)=>et.jsxDEV("span",{className:"num",title:A(i.conversationTokens),children:se(i.conversationTokens)},void 0,!1,void 0,this)},{key:"cacheRate",header:u("projects.cache-rate"),title:u("projects.cache-rate-hint"),align:"right",sort:(i)=>i.cacheRate,render:(i)=>et.jsxDEV("span",{className:"num",children:Ge(i.cacheRate)},void 0,!1,void 0,this)},{key:"cacheSavings",header:u("projects.cache-savings"),title:u("projects.cache-savings-hint"),align:"right",sort:(i)=>i.cacheSavings,render:(i)=>et.jsxDEV("span",{className:`num ${i.cacheSavings<0?"tone-bad":"muted"}`,children:Ge(i.cacheSavings)},void 0,!1,void 0,this)},{key:"errorRate",header:u("projects.errors"),align:"right",sort:(i)=>i.errorRate,render:(i)=>et.jsxDEV("span",{title:u("projects.failed-n",{count:A(i.failedRequests)}),children:et.jsxDEV(ct,{tone:i.failedRequests>0?hr(i.errorRate):"neutral",mono:!0,children:Ao(i.errorRate)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"duration",header:u("projects.avg-duration"),align:"right",sort:(i)=>i.avgDuration??-1,render:(i)=>et.jsxDEV("span",{className:"num",children:Ct(i.avgDuration)},void 0,!1,void 0,this)},{key:"last",header:u("projects.last-active"),align:"right",sort:(i)=>i.lastTimestamp,render:(i)=>et.jsxDEV("span",{className:"dim",children:ma(i.lastTimestamp)},void 0,!1,void 0,this)}]}var Ho=_(Ke(),1);var ae=_(te(),1);function gq(){return[{value:"tokens",label:u("common.tokens")},{value:"cost",label:u("common.cost"),title:u("providers.cost-title")},{value:"requests",label:u("common.requests")}]}var A2=6;function M2(){return[{key:"input",label:u("ui.uncached-input"),color:"#5b8cff"},{key:"cacheRead",label:u("common.cache-read"),color:"var(--chart-primary)"},{key:"cacheWrite",label:u("common.cache-write"),color:"#f5b54a"},{key:"output",label:u("common.output"),color:"var(--chart-secondary)"}]}function D2({active:r,range:l}){let i=Pt(["providers",l],({signal:z})=>SI(l,z),{enabled:r}),[c,f]=Ho.useState("tokens"),[v,y]=Pr(),g=aa(l),m=Pt(["provider-windows",l],({signal:z})=>hb(l,null,z),{enabled:r}),[b,h]=Ho.useState(null),S=yq(m.data?.windowInsights??[],b),L=S?.provider??null,I=Pt(["provider-windows",l,L],({signal:z})=>hb(l,L,z),{enabled:r&&L!==null}),C=Ho.useMemo(()=>{let z=i.data?.providers??[],Y=i.data?.series??[],W=Vf(z.map((ee)=>({key:ee.provider,weight:ee.totalTokens}))),ue=oo(l,Y.map((ee)=>ee.timestamp)),Z={requests:0,failed:0,tokens:0,cost:0,unpriced:0};for(let ee of z)Z.requests+=ee.totalRequests,Z.failed+=ee.failedRequests,Z.tokens+=ee.totalTokens,Z.cost+=ee.totalCost,Z.unpriced+=ee.unpricedRequests;let ce=(ee)=>Xn(Y,{buckets:ue,key:(G)=>G.provider,value:ee,limit:A2,colors:W}).map((G)=>({...G,values:G.values.map((V)=>V||null)}));return{colors:W,buckets:ue,totals:Z,burn:{tokens:ce((ee)=>ee.totalTokens),cost:ce((ee)=>ee.cost),requests:ce((ee)=>ee.requests)},spark:{tokens:ha(Y,ue,(ee)=>ee.totalTokens),cost:ha(Y,ue,(ee)=>ee.cost),requests:ha(Y,ue,(ee)=>ee.requests)},topProvider:z.reduce((ee,G)=>ee===null||G.totalTokens>ee.totalTokens?G:ee,null)}},[i.data,l]),T=C.burn[c],R=c==="cost"?(z)=>zt(z):se,O=C.totals;return ae.jsxDEV("div",{className:"page",children:[ae.jsxDEV(la,{title:u("common.providers"),description:u("providers.description",{window:u(g.windowKey)})},void 0,!1,void 0,this),ae.jsxDEV(_e,{query:i,skeleton:ae.jsxDEV(qt,{height:112},void 0,!1,void 0,this),children:({providers:z})=>ae.jsxDEV("div",{"data-stale":i.stale,children:ae.jsxDEV(wa,{min:190,children:[ae.jsxDEV(ie,{label:u("common.providers"),value:A(z.length),hint:C.topProvider?u("providers.most-tokens",{provider:C.topProvider.provider}):void 0},void 0,!1,void 0,this),ae.jsxDEV(ie,{label:u("common.requests"),value:A(O.requests),hint:u("providers.failed-n",{count:A(O.failed)}),spark:C.spark.requests},void 0,!1,void 0,this),ae.jsxDEV(ie,{label:u("common.tokens"),title:u("providers.tokens-title"),value:se(O.tokens),spark:C.spark.tokens},void 0,!1,void 0,this),ae.jsxDEV(ie,{label:u("providers.api-equivalent-cost"),title:u("providers.api-cost-title"),value:oa(O.cost,O.unpriced),hint:O.unpriced>0?u("providers.unpriced-n",{count:A(O.unpriced)}):void 0,spark:C.spark.cost,sparkColor:"var(--chart-secondary)"},void 0,!1,void 0,this),ae.jsxDEV(ie,{label:u("common.error-rate"),value:Ao(O.requests>0?O.failed/O.requests:0),hint:u("providers.succeeded-n",{count:A(O.requests-O.failed)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV(fe,{index:1,title:u("providers.totals"),description:O.unpriced>0?u(O.unpriced===1?"providers.totals-description-unpriced-one":"providers.totals-description-unpriced-n",{count:A(O.unpriced)}):u("providers.totals-description"),flush:!0,stale:i.stale,children:ae.jsxDEV(_e,{query:i,skeleton:ae.jsxDEV(pa,{rows:6},void 0,!1,void 0,this),children:({providers:z})=>ae.jsxDEV(vq,{providers:z,colors:C.colors},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV("div",{className:"grid grid-main-side",children:[ae.jsxDEV(fe,{index:2,title:u("providers.burn"),description:c==="cost"&&O.unpriced>0?u("providers.burn-estimate-description",{bucket:g.bucketMs<86400000?u("providers.bucket-hour"):u("providers.bucket-day")}):u("providers.burn-description",{bucket:g.bucketMs<3600000?u("providers.bucket-5m"):g.bucketMs<86400000?u("providers.bucket-hour"):u("providers.bucket-day"),count:A2}),actions:ae.jsxDEV(Oa,{size:"sm",options:gq(),value:c,onChange:f},void 0,!1,void 0,this),stale:i.stale,children:ae.jsxDEV(_e,{query:i,skeleton:ae.jsxDEV(qt,{height:260},void 0,!1,void 0,this),children:()=>ae.jsxDEV("div",{className:"stack",style:{gap:12},children:[ae.jsxDEV(_o,{buckets:C.buckets,bucketMs:g.bucketMs,series:T,hidden:v,height:260,format:R,formatTooltip:c==="cost"?(z)=>zt(z):A,emptyLabel:u("providers.no-provider-activity")},void 0,!1,void 0,this),ae.jsxDEV(ia,{items:T.map((z)=>({key:z.key,label:z.label,color:z.color,value:R(z.values.reduce((Y,W)=>Y+(W??0),0))})),hidden:v,onToggle:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV(_e,{query:i,skeleton:ae.jsxDEV(qt,{height:320},void 0,!1,void 0,this),children:({hourly:z,providers:Y})=>ae.jsxDEV(bq,{hourly:z,providers:Y,stale:i.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae.jsxDEV(fe,{index:4,title:u("providers.subscription-windows"),description:u("providers.subscription-windows-description"),flush:!0,stale:m.stale,children:ae.jsxDEV(_e,{query:m,skeleton:ae.jsxDEV(pa,{rows:6},void 0,!1,void 0,this),children:(z)=>ae.jsxDEV(Sq,{insights:z.windowInsights,selected:S,onSelect:h},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV(Tq,{insights:m.data?.windowInsights??null,accounts:I,selected:S,onSelect:h},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function yq(r,l){if(l&&r.some((c)=>c.provider===l.provider&&c.windowKey===l.windowKey))return l;let i=l&&r.find((c)=>c.provider===l.provider)||r.reduce((c,f)=>c===void 0||f.fractionConsumed>c.fractionConsumed?f:c,void 0);return i?{provider:i.provider,windowKey:i.windowKey}:null}function vq({providers:r,colors:l}){let[i,c]=Ho.useState(null),f=Ho.useMemo(()=>{let v=0,y=0,g=0;for(let m of r)v=Math.max(v,m.totalRequests),y=Math.max(y,m.totalTokens),g+=m.totalTokens;return[{key:"provider",header:u("common.provider"),sort:(m)=>m.provider,render:(m)=>ae.jsxDEV("span",{className:"row",style:{gap:8},children:[ae.jsxDEV(an,{color:l.get(m.provider)??Mo},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"mono cell-primary",children:m.provider},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"requests",header:u("common.requests"),align:"right",sort:(m)=>m.totalRequests,render:(m)=>ae.jsxDEV(Ma,{value:m.totalRequests,max:v,display:A(m.totalRequests)},void 0,!1,void 0,this)},{key:"errors",header:u("common.error-rate"),align:"right",sort:(m)=>m.totalRequests>0?m.failedRequests/m.totalRequests:0,render:(m)=>{let b=m.totalRequests>0?m.failedRequests/m.totalRequests:0;return ae.jsxDEV("span",{className:"row",style:{gap:8,justifyContent:"flex-end"},children:[ae.jsxDEV("span",{className:"num dim",children:A(m.failedRequests)},void 0,!1,void 0,this),ae.jsxDEV(ct,{tone:m.failedRequests>0?hr(b):"neutral",mono:!0,children:Ao(b)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}},{key:"models",header:u("common.models"),title:u("providers.models-title"),align:"right",sort:(m)=>m.models,render:(m)=>ae.jsxDEV("span",{className:"num",children:A(m.models)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),title:u("providers.tokens-title"),align:"right",sort:(m)=>m.totalTokens,render:(m)=>ae.jsxDEV(Ma,{value:m.totalTokens,max:y,display:se(m.totalTokens),color:l.get(m.provider)},void 0,!1,void 0,this)},{key:"share",header:u("common.share"),title:u("providers.share-title"),align:"right",sort:(m)=>m.totalTokens,render:(m)=>ae.jsxDEV("span",{className:"num muted",children:Ge(g>0?m.totalTokens/g:0)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("providers.cost-title"),align:"right",sort:(m)=>m.totalCost,render:(m)=>ae.jsxDEV("span",{className:"num",title:m.unpricedRequests>0?u("providers.unpriced-n",{count:A(m.unpricedRequests)}):void 0,children:oa(m.totalCost,m.unpricedRequests)},void 0,!1,void 0,this)},{key:"tps",header:u("common.tokens-per-second"),title:u("providers.tps-title"),align:"right",sort:(m)=>m.avgTokensPerSecond??-1,render:(m)=>ae.jsxDEV("span",{className:"num",children:Gn(m.avgTokensPerSecond)},void 0,!1,void 0,this)},{key:"premium",header:u("common.premium"),title:u("providers.premium-title"),align:"right",sort:(m)=>m.totalPremiumRequests,render:(m)=>ae.jsxDEV("span",{className:m.totalPremiumRequests>0?"num":"num dim",children:A(Math.round(m.totalPremiumRequests*100)/100)},void 0,!1,void 0,this)}]},[r,l]);return ae.jsxDEV(Ft,{rows:r,rowKey:(v)=>v.provider,columns:f,initialSort:{key:"tokens",dir:"desc"},limit:12,selectedKey:i,onRowClick:(v)=>c((y)=>y===v.provider?null:v.provider),expanded:(v)=>v.provider===i?ae.jsxDEV(xq,{provider:v},void 0,!1,void 0,this):null,empty:ae.jsxDEV(Je,{title:u("providers.no-requests-in-range")},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function xq({provider:r}){let l={input:r.totalInputTokens,cacheRead:r.totalCacheReadTokens,cacheWrite:r.totalCacheWriteTokens,output:r.totalOutputTokens};return ae.jsxDEV("div",{className:"providers-mix",children:[ae.jsxDEV($n,{segments:M2().map((i)=>({key:i.key,label:i.label,value:l[i.key],color:i.color}))},void 0,!1,void 0,this),ae.jsxDEV(ia,{items:M2().map((i)=>({key:i.key,label:i.label,color:i.color,value:`${se(l[i.key])} · ${r.totalTokens>0?Ge(l[i.key]/r.totalTokens,0):"–"}`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Qf="";function bq({hourly:r,providers:l,stale:i}){let[c,f]=Ho.useState(Qf),v=c===Qf||l.some((m)=>m.provider===c)?c:Qf,y=Ho.useMemo(()=>{let m=Array.from({length:24},()=>0),b=Array.from({length:24},()=>0),h=Array.from({length:24},()=>0);for(let C of r){if(v!==Qf&&C.provider!==v)continue;m[C.hour]+=C.totalTokens,b[C.hour]+=C.outputTokens,h[C.hour]+=C.requests}let S=0;for(let C=1;C<24;C++)if(m[C]>m[S])S=C;let L=m[S]>0;return{series:[{key:"tokens",label:u("common.tokens"),color:"var(--chart-primary)",values:m.map((C,T)=>L&&T===S?null:C)},{key:"peak",label:u("providers.tokens-peak-hour"),color:"var(--chart-secondary)",values:m.map((C,T)=>L&&T===S?C:null)}],output:b,requests:h,peak:S,hasData:L}},[r,v]),g=(m)=>`${String(m).padStart(2,"0")}:00`;return ae.jsxDEV(fe,{index:3,title:u("providers.peak-burn-hours"),description:y.hasData?u("providers.peak-hours-description",{hour:g(y.peak)}):u("providers.hours-description"),actions:ae.jsxDEV("select",{className:"input providers-select",value:v,onChange:(m)=>f(m.target.value),"aria-label":u("common.provider"),children:[ae.jsxDEV("option",{value:Qf,children:u("providers.all-providers")},void 0,!1,void 0,this),l.map((m)=>ae.jsxDEV("option",{value:m.provider,children:m.provider},m.provider,!1,void 0,this))]},void 0,!0,void 0,this),stale:i,children:ae.jsxDEV(yr,{slots:24,tickLabel:(m)=>String(m).padStart(2,"0"),tooltipTitle:(m)=>`${g(m)}–${g((m+1)%24)}`,series:y.series,height:260,showTotal:!1,formatTooltip:A,emptyLabel:u("providers.no-activity-in-range"),tooltipExtra:(m)=>ae.jsxDEV(ae.Fragment,{children:[ae.jsxDEV("div",{className:"chart-tooltip-row",children:[ae.jsxDEV("span",{className:"chart-tooltip-label",children:u("common.output")},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"chart-tooltip-value",children:A(y.output[m])},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae.jsxDEV("div",{className:"chart-tooltip-row",children:[ae.jsxDEV("span",{className:"chart-tooltip-label",children:u("common.requests")},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"chart-tooltip-value",children:A(y.requests[m])},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Sq({insights:r,selected:l,onSelect:i}){return ae.jsxDEV(Ft,{rows:r,rowKey:(c)=>`${c.provider}::${c.windowKey}`,columns:kq(),initialSort:{key:"consumed",dir:"desc"},limit:12,selectedKey:l?`${l.provider}::${l.windowKey}`:null,onRowClick:(c)=>i({provider:c.provider,windowKey:c.windowKey}),empty:ae.jsxDEV(Je,{title:u("providers.no-snapshots-in-range"),hint:u("providers.snapshot-hint")},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function kq(){return[{key:"window",header:u("providers.window"),sort:(r)=>`${r.provider} ${r.windowKey}`,render:(r)=>ae.jsxDEV(co,{primary:r.windowKey,secondary:ae.jsxDEV("span",{className:"mono",children:r.provider},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"accounts",header:u("providers.accounts"),title:u("providers.accounts-title"),align:"right",sort:(r)=>r.accounts,render:(r)=>ae.jsxDEV("span",{className:"num",children:A(r.accounts)},void 0,!1,void 0,this)},{key:"cycles",header:u("providers.resets"),title:u("providers.resets-title"),align:"right",sort:(r)=>r.cycles,render:(r)=>ae.jsxDEV("span",{className:"num muted",children:A(r.cycles)},void 0,!1,void 0,this)},{key:"consumed",header:u("providers.windows-burned"),title:u("providers.windows-burned-title"),align:"right",sort:(r)=>r.fractionConsumed,render:(r)=>ae.jsxDEV("span",{className:"num",children:r.fractionConsumed.toFixed(2)},void 0,!1,void 0,this)},{key:"capacity",header:u("providers.tokens-per-window"),title:u("providers.tokens-per-window-title"),align:"right",sort:(r)=>r.estTokensPerWindow??-1,render:(r)=>r.estTokensPerWindow!==null?ae.jsxDEV("span",{className:"num",children:se(r.estTokensPerWindow)},void 0,!1,void 0,this):ae.jsxDEV("span",{className:"dim",title:u("providers.too-little-consumed"),children:"–"},void 0,!1,void 0,this)},{key:"peak",header:u("providers.peak-utilization"),title:u("providers.peak-utilization-title"),align:"right",sort:(r)=>r.peakConcurrentFraction,render:(r)=>{let l=r.accounts>0?r.peakConcurrentFraction/r.accounts:0;return ae.jsxDEV(Ma,{value:r.peakConcurrentFraction,max:r.accounts,display:Ge(r.peakConcurrentFraction,0),color:l>=0.9?"var(--warn)":void 0},void 0,!1,void 0,this)}},{key:"ideal",header:u("providers.accounts-needed"),title:u("providers.accounts-needed-title"),align:"right",sort:(r)=>r.idealAccounts-r.accounts,render:(r)=>r.idealAccounts>r.accounts?ae.jsxDEV(ct,{tone:"warn",mono:!0,children:u("providers.ideal-accounts",{ideal:A(r.idealAccounts),have:A(r.accounts)})},void 0,!1,void 0,this):ae.jsxDEV("span",{className:"num",children:A(r.idealAccounts)},void 0,!1,void 0,this)},{key:"exhausted",header:u("providers.exhaustions"),title:u("providers.exhaustions-title"),align:"right",sort:(r)=>r.exhaustedEvents,render:(r)=>r.exhaustedEvents>0?ae.jsxDEV(ct,{tone:"warn",mono:!0,children:u("providers.exhausted-n",{count:A(r.exhaustedEvents)})},void 0,!1,void 0,this):ae.jsxDEV("span",{className:"num dim",children:"0"},void 0,!1,void 0,this)}]}var pg=60000,Ds=60*pg,mg=24*Ds,Lq=[5*pg,15*pg,30*pg,Ds,2*Ds,3*Ds,6*Ds,12*Ds,mg],wq=240,Cq=6*Ds;function Tq({insights:r,accounts:l,selected:i,onSelect:c}){let[f,v]=Pr(),y=Ho.useMemo(()=>[...new Set((r??[]).map((C)=>C.provider))],[r]),g=Ho.useMemo(()=>(r??[]).filter((C)=>C.provider===i?.provider).map((C)=>({key:C.windowKey,label:C.windowKey})),[r,i?.provider]),m=Ho.useMemo(()=>(l.data?.usageSeries??[]).filter((C)=>C.provider===i?.provider),[l.data,i?.provider]),b=m.length===0&&(l.loading||l.stale),h=Ho.useMemo(()=>{let C=new Map;for(let R of m){let O=C.get(R.accountLabel)??[];if(!O.includes(R.accountKey))O.push(R.accountKey);C.set(R.accountLabel,O)}let T=new Map;for(let[R,O]of C)O.sort(),O.forEach((z,Y)=>T.set(z,O.length>1?`${R} #${Y+1}`:R));return T},[m]),S=Ho.useMemo(()=>Iq(m.filter((C)=>C.windowKey===i?.windowKey),h),[m,h,i?.windowKey]),L=Ho.useMemo(()=>{let C=new Map(S.series.map((T)=>[T.key,T.color]));return m.map((T)=>{let R=null,O=null;for(let W of T.points){if(W.usedFraction===null)continue;if(O=Math.max(O??0,W.usedFraction),!R||W.timestamp>=R.timestamp)R={fraction:W.usedFraction,exhausted:W.exhausted,timestamp:W.timestamp}}let z=T.windowKey===i?.windowKey?C.get(T.accountKey)??null:null,Y=h.get(T.accountKey)??T.accountLabel;return{series:T,name:Y,color:z,latest:R,peak:O,samples:T.points.length}}).sort((T,R)=>Number(R.color!==null)-Number(T.color!==null)||T.series.windowKey.localeCompare(R.series.windowKey)||(R.latest?.fraction??-1)-(T.latest?.fraction??-1))},[m,h,S.series,i?.windowKey]),I=g.find((C)=>C.key===i?.windowKey)?.label;return ae.jsxDEV(fe,{index:5,title:u("providers.utilization"),description:S.buckets.length>0?u("providers.utilization-description",{window:I??u("providers.window"),from:Sb(S.first),to:Sb(S.last)}):u("providers.utilization-description-plain"),actions:i&&ae.jsxDEV("div",{className:"row",style:{gap:6},children:[ae.jsxDEV("select",{className:"input providers-select",value:i.provider,onChange:(C)=>{let T=C.target.value,R=r?.find((O)=>O.provider===T);if(R)c({provider:T,windowKey:R.windowKey})},"aria-label":u("common.provider"),children:y.map((C)=>ae.jsxDEV("option",{value:C,children:C},C,!1,void 0,this))},void 0,!1,void 0,this),ae.jsxDEV("select",{className:"input providers-select",value:i.windowKey,onChange:(C)=>c({provider:i.provider,windowKey:C.target.value}),"aria-label":u("providers.window"),children:g.map((C)=>ae.jsxDEV("option",{value:C.key,children:C.label},C.key,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),stale:l.stale,children:r===null?ae.jsxDEV(qt,{height:260},void 0,!1,void 0,this):i===null?ae.jsxDEV(Je,{title:u("providers.no-snapshots-in-range"),hint:u("providers.snapshot-hint")},void 0,!1,void 0,this):ae.jsxDEV(_e,{query:l,skeleton:ae.jsxDEV(qt,{height:260},void 0,!1,void 0,this),children:()=>b?ae.jsxDEV(qt,{height:260},void 0,!1,void 0,this):ae.jsxDEV("div",{className:"stack",style:{gap:16},children:[ae.jsxDEV("div",{className:"stack",style:{gap:12},children:[ae.jsxDEV(yr,{slots:S.buckets.length,tickLabel:(C)=>Gh(S.buckets[C],S.last-S.first>mg?mg:S.bucketMs),tooltipTitle:(C)=>Ju(S.buckets[C],Ds),series:S.series,hidden:f,kind:"line",stacked:!1,height:260,yMax:Math.max(1,S.max),format:(C)=>Ge(C,0),formatTooltip:(C)=>Ge(C,1),references:[{value:1,label:"100%"}],emptyLabel:u("providers.no-utilization-readings"),tooltipExtra:(C)=>{let T=S.exhausted[C];return T.length>0?ae.jsxDEV("div",{className:"chart-tooltip-row",children:[ae.jsxDEV("span",{className:"chart-tooltip-label tone-bad",children:u("providers.exhausted")},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"chart-tooltip-value",children:T.join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null}},void 0,!1,void 0,this),S.series.length>1&&ae.jsxDEV(ia,{items:S.series.map((C)=>({key:C.key,label:C.label,color:C.color})),hidden:f,onToggle:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae.jsxDEV("div",{className:"providers-accounts",children:ae.jsxDEV(Ft,{rows:L,rowKey:(C)=>`${C.series.windowKey}::${C.series.accountKey}`,columns:Aq(),limit:16,onRowClick:(C)=>c({provider:C.series.provider,windowKey:C.series.windowKey}),dense:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Iq(r,l){let{POSITIVE_INFINITY:i,NEGATIVE_INFINITY:c}=Number;for(let L of r)for(let I of L.points){if(I.timestamp<i)i=I.timestamp;if(I.timestamp>c)c=I.timestamp}if(!(c>=i))return{buckets:[],bucketMs:Ds,first:0,last:0,max:0,series:[],exhausted:[]};let f=c-i,v=Lq.find((L)=>f/L<wq)??mg,y=oo("all",[i],v,c),g=y.map(()=>[]),m=0,b=(L)=>l.get(L.accountKey)??L.accountLabel,S=[...r].sort((L,I)=>b(L).localeCompare(b(I))).map((L,I)=>{let C=y.map(()=>null),T=y.map(()=>0);for(let z of L.points){let Y=dg(y,z.timestamp);if(Y<0)continue;if(z.exhausted&&!g[Y].includes(b(L)))g[Y].push(b(L));if(z.usedFraction===null||z.timestamp<T[Y])continue;C[Y]=z.usedFraction,T[Y]=z.timestamp,m=Math.max(m,z.usedFraction)}let R=null,O=0;for(let z=0;z<y.length;z++)if(C[z]!==null)R=C[z],O=T[z];else if(R!==null&&y[z]-O<=Cq)C[z]=R;return{key:L.accountKey,label:b(L),color:Za[I%Za.length],values:C}});return{buckets:y,bucketMs:v,first:i,last:c,max:m,series:S,exhausted:g}}function Rq(r){if(!r)return ae.jsxDEV("span",{className:"dim",children:u("providers.no-reading")},void 0,!1,void 0,this);if(r.exhausted)return ae.jsxDEV(ct,{tone:"bad",children:u("providers.exhausted")},void 0,!1,void 0,this);if(r.fraction>=0.8)return ae.jsxDEV(ct,{tone:"warn",children:u("providers.high")},void 0,!1,void 0,this);return ae.jsxDEV(ct,{tone:"ok",children:u("ui.status-ok")},void 0,!1,void 0,this)}function Aq(){return[{key:"account",header:u("providers.account"),sort:(r)=>r.name,render:(r)=>ae.jsxDEV("span",{className:"row",style:{gap:8},children:[ae.jsxDEV("span",{className:"providers-swatch-slot",children:r.color&&ae.jsxDEV(an,{color:r.color},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"truncate providers-account",title:r.series.accountKey,children:r.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"window",header:u("providers.window"),sort:(r)=>r.series.windowKey,render:(r)=>ae.jsxDEV("span",{className:r.color?void 0:"muted",children:r.series.windowKey},void 0,!1,void 0,this)},{key:"latest",header:u("providers.latest-used"),align:"right",sort:(r)=>r.latest?.fraction??-1,render:(r)=>r.latest?ae.jsxDEV(Ma,{value:r.latest.fraction,max:1,display:Ge(r.latest.fraction,0),color:r.latest.exhausted?"var(--bad)":r.latest.fraction>=0.8?"var(--warn)":"var(--ok)"},void 0,!1,void 0,this):ae.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)},{key:"status",header:u("providers.status"),sort:(r)=>r.latest?.exhausted?2:(r.latest?.fraction??0)>=0.8?1:0,render:(r)=>Rq(r.latest)},{key:"peak",header:u("providers.peak-in-range"),align:"right",sort:(r)=>r.peak??-1,render:(r)=>ae.jsxDEV("span",{className:"num",children:r.peak===null?"–":Ge(r.peak,0)},void 0,!1,void 0,this)},{key:"samples",header:u("providers.snapshots"),align:"right",sort:(r)=>r.samples,render:(r)=>ae.jsxDEV("span",{className:"num muted",children:A(r.samples)},void 0,!1,void 0,this)},{key:"recorded",header:u("providers.recorded"),align:"right",sort:(r)=>r.latest?.timestamp??0,render:(r)=>ae.jsxDEV("span",{className:"muted",children:r.latest?ma(r.latest.timestamp):"–"},void 0,!1,void 0,this)}]}var Hi=_(Ke(),1);var pt=_(te(),1),Mq={ok:"ok",aborted:"warn",failed:"bad"},Dq={ok:"ui.status-ok",aborted:"common.aborted",failed:"common.failed"};function hg(r){return{label:u(Dq[r]),tone:Mq[r]}}function E2({id:r,onClose:l}){let i=Pt(["request",r],({signal:v})=>sI(r??0,v),{enabled:r!==null}),c=i.stale?null:i.data,f=c?hg(As(c)):null;return pt.jsxDEV(ed,{open:r!==null,onClose:l,width:620,title:c?pt.jsxDEV("span",{className:"mono",children:c.model},void 0,!1,void 0,this):u("common.request"),subtitle:c?pt.jsxDEV(pt.Fragment,{children:[c.provider," ·"," ",pt.jsxDEV("span",{title:ro(c.timestamp),children:ma(c.timestamp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):r!==null?pt.jsxDEV("span",{className:"mono",children:["#",r]},void 0,!0,void 0,this):void 0,actions:c&&f?pt.jsxDEV("div",{className:"row",style:{gap:6},children:[pt.jsxDEV("a",{className:"btn","data-size":"sm","data-variant":"ghost",href:rg({...Gf(window.location.hash),section:"traces",session:c.sessionFile}),onClick:l,title:u("ui.open-trace"),children:[pt.jsxDEV(xf,{size:13},void 0,!1,void 0,this)," Trace"]},void 0,!0,void 0,this),pt.jsxDEV(ct,{tone:f.tone,children:f.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this):void 0,children:c?pt.jsxDEV(Eq,{details:c,aborted:As(c)==="aborted"},void 0,!1,void 0,this):i.error?pt.jsxDEV(ql,{error:i.error,onRetry:i.refetch},void 0,!1,void 0,this):pt.jsxDEV("div",{className:"stack",style:{gap:12},children:[pt.jsxDEV(Fa,{height:56},void 0,!1,void 0,this),pt.jsxDEV(Fa,{height:120},void 0,!1,void 0,this),pt.jsxDEV(Fa,{height:120},void 0,!1,void 0,this),pt.jsxDEV(Fa,{height:220},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Eq({details:r,aborted:l}){let{usage:i}=r,c=r.duration!==null&&r.duration>0&&i.output>0?i.output*1000/r.duration:null,{messages:f,output:v,...y}=r;return pt.jsxDEV(pt.Fragment,{children:[r.errorMessage&&pt.jsxDEV("section",{className:"request-drawer-error","data-tone":l?"warn":"bad",role:"note",children:[pt.jsxDEV("div",{className:"request-drawer-error-label",children:l?u("common.aborted"):u("common.error")},void 0,!1,void 0,this),pt.jsxDEV("pre",{className:"request-drawer-error-text",children:r.errorMessage},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt.jsxDEV("section",{children:[pt.jsxDEV("div",{className:"section-label",children:u("ui.section-timing")},void 0,!1,void 0,this),pt.jsxDEV(So,{items:[{key:"at",label:u("common.started"),value:ro(r.timestamp)},{key:"duration",label:u("common.duration"),value:Ct(r.duration)},{key:"ttft",label:u("ui.time-to-first-token"),value:Ct(r.ttft)},{key:"tps",label:u("common.output-tokens-per-second"),value:Gn(c)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt.jsxDEV("section",{children:[pt.jsxDEV("div",{className:"section-label",children:u("common.tokens")},void 0,!1,void 0,this),pt.jsxDEV(So,{items:[{key:"input",label:u("ui.uncached-input"),value:A(i.input)},{key:"cacheRead",label:u("common.cache-read"),value:A(i.cacheRead)},{key:"cacheWrite",label:u("common.cache-write"),value:A(i.cacheWrite)},{key:"output",label:u("common.output"),value:A(i.output)},{key:"total",label:u("common.total"),value:A(i.totalTokens)},{key:"premium",label:u("common.premium-requests"),value:A(Math.round((i.premiumRequests??0)*100)/100)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt.jsxDEV("section",{children:[pt.jsxDEV("div",{className:"section-label",children:u("ui.section-cost")},void 0,!1,void 0,this),pt.jsxDEV(So,{items:[{key:"total",label:"Total",value:Ol(r,4)},{key:"input",label:u("common.input"),value:zt(i.cost.input,4)},{key:"cacheRead",label:"Cache read",value:zt(i.cost.cacheRead,4)},{key:"cacheWrite",label:"Cache write",value:zt(i.cost.cacheWrite,4)},{key:"output",label:"Output",value:zt(i.cost.output,4)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt.jsxDEV("section",{children:[pt.jsxDEV("div",{className:"section-label",children:u("ui.section-identity")},void 0,!1,void 0,this),pt.jsxDEV(So,{items:[{key:"id",label:u("common.request-id"),value:r.id??"–"},{key:"entry",label:u("common.entry-id"),value:r.entryId},{key:"stop",label:u("ui.stop-reason"),value:r.stopReason},{key:"api",label:"API",value:r.api},{key:"project",label:u("common.project"),value:pt.jsxDEV("span",{title:r.folder,children:zr(r.folder)},void 0,!1,void 0,this)}]},void 0,!1,void 0,this),pt.jsxDEV("div",{className:"request-drawer-file",children:[pt.jsxDEV("span",{className:"kv-key",children:u("ui.session-file")},void 0,!1,void 0,this),pt.jsxDEV("span",{className:"kv-value",children:r.sessionFile},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v!=null&&pt.jsxDEV(td,{data:v,title:u("common.output-message")},void 0,!1,void 0,this),pt.jsxDEV(td,{data:f,title:u("common.session-entry"),initialCollapsed:!0},void 0,!1,void 0,this),pt.jsxDEV(td,{data:y,title:u("ui.stats-row"),initialCollapsed:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ut=_(te(),1),Ob=[500,2000,1e4];function N2({active:r,range:l,onRequestClick:i}){let[c,f]=Hi.useState(0),v=Ob[c],y=Pt(["requests-log",v],({signal:W})=>Vh(v,W),{enabled:r}),[g,m]=Hi.useState(""),[b,h]=Hi.useState("all"),S=aa(l),L=Hi.useMemo(()=>{let W=y.data??[],ue=S.spanMs===null?null:Date.now()-S.spanMs,Z=ue===null?W:W.filter((G)=>G.timestamp>=ue),ce=!y.stale&&(W.length<v||ue!==null&&Z.length<W.length),ee={all:Z.length,ok:0,aborted:0,failed:0};for(let G of Z)ee[As(G)]++;return{loaded:W.length,inRange:Z,complete:ce,counts:ee,summary:c2(Z)}},[y.data,y.stale,v,S.spanMs]),I=Hi.useMemo(()=>{let W=g.trim().toLowerCase();return L.inRange.filter((ue)=>(b==="all"||As(ue)===b)&&(W===""||ue.model.toLowerCase().includes(W)||ue.provider.toLowerCase().includes(W)||ue.folder.toLowerCase().includes(W)))},[L.inRange,g,b]),{summary:C,counts:T,complete:R}=L,O=c+1<Ob.length?Ob[c+1]:null,z=O!==null?ut.jsxDEV("button",{type:"button",className:"btn","data-size":"sm",disabled:y.refreshing,onClick:()=>f(c+1),children:y.refreshing&&y.stale?u("requests.loading"):u("requests.load-latest",{count:A(O)})},void 0,!1,void 0,this):void 0,Y=["all","ok","aborted","failed"].map((W)=>({value:W,label:ut.jsxDEV(ut.Fragment,{children:[W==="all"?u("requests.status-all"):hg(W).label," ",ut.jsxDEV("span",{className:"dim num",children:se(T[W])},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}));return ut.jsxDEV("div",{className:"page",children:[ut.jsxDEV(la,{title:u("common.requests"),description:u("requests.description",{window:u(S.windowKey)})},void 0,!1,void 0,this),ut.jsxDEV(_e,{query:y,skeleton:ut.jsxDEV(Fa,{height:96,style:{borderRadius:12}},void 0,!1,void 0,this),children:()=>ut.jsxDEV("div",{"data-stale":y.stale,children:ut.jsxDEV(wa,{min:160,children:[ut.jsxDEV(ie,{label:u("common.requests"),value:A(C.requests),hint:C.oldest===null?u("requests.none-in-window",{window:u(S.windowKey)}):u("requests.since",{time:ma(C.oldest)})},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("common.failed"),value:A(C.failed),hint:u("requests.failed-hint",{rate:C.requests>0?Ao(C.failed/C.requests):"–",count:A(C.aborted)})},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("common.tokens"),title:u("requests.tokens-hint"),value:se(C.tokens)},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("requests.api-equivalent-cost"),title:u("requests.cost-hint"),value:oa(C.cost,C.unpriced),hint:C.unpriced>0?u("requests.unpriced-n",{count:A(C.unpriced)}):void 0},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("requests.median-duration"),value:Ct(C.medianDuration),hint:u("requests.p95",{value:Ct(C.p95Duration)})},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("requests.median-ttft"),title:u("requests.ttft-hint"),value:Ct(C.medianTtft)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut.jsxDEV(fe,{index:1,title:u("requests.log-title"),description:y.data===null?u("requests.log-loading"):R?u("requests.log-count-in-window",{shown:A(I.length),total:A(C.requests),window:u(S.windowKey)}):u("requests.log-count-latest",{shown:A(I.length),total:A(C.requests)}),actions:ut.jsxDEV(ut.Fragment,{children:[ut.jsxDEV(Fn,{value:g,onChange:m,placeholder:u("requests.search-placeholder")},void 0,!1,void 0,this),ut.jsxDEV(Oa,{size:"sm","aria-label":u("requests.status"),options:Y,value:b,onChange:h},void 0,!1,void 0,this)]},void 0,!0,void 0,this),flush:!0,stale:y.stale,footer:y.data!==null&&!R?ut.jsxDEV(ut.Fragment,{children:[ut.jsxDEV("span",{children:u("requests.footer",{count:A(L.loaded),time:C.oldest===null?"–":ro(C.oldest),window:u(S.windowKey)})},void 0,!1,void 0,this),z]},void 0,!0,void 0,this):void 0,children:ut.jsxDEV(_e,{query:y,skeleton:ut.jsxDEV(pa,{rows:12},void 0,!1,void 0,this),children:()=>ut.jsxDEV(Ft,{rows:I,rowKey:(W)=>W.id??`${W.sessionFile}:${W.entryId}`,onRowClick:(W)=>W.id!==void 0&&i(W.id),columns:Nq(),initialSort:{key:"time",dir:"desc"},limit:100,dense:!0,empty:ut.jsxDEV(Je,{title:C.requests===0?u("requests.empty-in-window",{window:u(S.windowKey)}):u("requests.empty-no-match"),hint:C.requests===0?void 0:u("requests.empty-no-match-hint")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Nq(){return[{key:"model",header:u("common.model"),sort:(r)=>r.model,render:(r)=>ut.jsxDEV(co,{primary:ut.jsxDEV("span",{className:"mono",children:r.model},void 0,!1,void 0,this),secondary:r.provider},void 0,!1,void 0,this)},{key:"time",header:u("requests.when"),sort:(r)=>r.timestamp,render:(r)=>ut.jsxDEV("span",{className:"muted",title:ro(r.timestamp),children:ma(r.timestamp)},void 0,!1,void 0,this)},{key:"project",header:u("common.project"),sort:(r)=>r.folder,render:(r)=>ut.jsxDEV("span",{className:"mono muted truncate",title:r.folder,style:{display:"block",maxWidth:180},children:zr(r.folder)},void 0,!1,void 0,this)},{key:"input",header:u("common.input"),title:u("requests.uncached-input"),align:"right",sort:(r)=>r.usage.input,render:(r)=>ut.jsxDEV("span",{className:"num",children:se(r.usage.input)},void 0,!1,void 0,this)},{key:"cache",header:u("common.cache-read"),title:u("requests.cache-read-title"),align:"right",sort:(r)=>r.usage.cacheRead,render:(r)=>ut.jsxDEV("span",{className:"num",title:u("requests.cache-write",{count:A(r.usage.cacheWrite)}),children:se(r.usage.cacheRead)},void 0,!1,void 0,this)},{key:"output",header:u("common.output"),align:"right",sort:(r)=>r.usage.output,render:(r)=>ut.jsxDEV("span",{className:"num",children:se(r.usage.output)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("requests.cost-estimate"),align:"right",sort:(r)=>r.usage.cost.total,render:(r)=>ut.jsxDEV("span",{className:"num",children:Ol(r,4)},void 0,!1,void 0,this)},{key:"duration",header:u("common.duration"),align:"right",sort:(r)=>r.duration??-1,render:(r)=>ut.jsxDEV("span",{className:"num",children:Ct(r.duration)},void 0,!1,void 0,this)},{key:"ttft",header:u("requests.ttft"),title:u("requests.ttft-hint"),align:"right",sort:(r)=>r.ttft??-1,render:(r)=>ut.jsxDEV("span",{className:"num muted",children:Ct(r.ttft)},void 0,!1,void 0,this)},{key:"status",header:u("requests.status"),sort:(r)=>As(r),render:(r)=>{let l=hg(As(r));return ut.jsxDEV("span",{title:r.errorMessage??void 0,children:ut.jsxDEV(co,{lead:ut.jsxDEV(Hn,{tone:l.tone},void 0,!1,void 0,this),primary:l.label,secondary:ut.jsxDEV("span",{className:"mono",children:r.stopReason},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}}]}var fR=_(Ke(),1);var q2=["January","February","March","April","May","June","July","August","September","October","November","December"],O2=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],qq=["MMMM","yyyy","EEEE","MMM","EEE","yy","MM","dd","HH","hh","mm","ss","M","d","H","h","m","s","a"];function zl(r,l=2){return String(r).padStart(l,"0")}function Oq(r,l){let i=r.getMonth(),c=r.getDay(),f=r.getHours(),v=f%12||12;switch(l){case"yyyy":return zl(r.getFullYear(),4);case"yy":return zl(r.getFullYear()%100);case"MMMM":return q2[i];case"MMM":return q2[i].slice(0,3);case"MM":return zl(i+1);case"M":return String(i+1);case"dd":return zl(r.getDate());case"d":return String(r.getDate());case"EEEE":return O2[c];case"EEE":return O2[c].slice(0,3);case"HH":return zl(f);case"H":return String(f);case"hh":return zl(v);case"h":return String(v);case"mm":return zl(r.getMinutes());case"m":return String(r.getMinutes());case"ss":return zl(r.getSeconds());case"s":return String(r.getSeconds());case"a":return f<12?"AM":"PM"}}function Bq(r){let l=r instanceof Date?new Date(r.getTime()):new Date(r);if(Number.isNaN(l.getTime()))throw RangeError("Invalid time value");return l}function B2(r,l){let i=Bq(r),c="";for(let f=0;f<l.length;){if(l[f]==="'"){if(l[f+1]==="'"){c+="'",f+=2;continue}f++;while(f<l.length){if(l[f]!=="'"){c+=l[f++];continue}if(l[f+1]==="'"){c+="'",f+=2;continue}f++;break}continue}let v=l.slice(f),y=qq.find((m)=>v.startsWith(m));if(y){c+=Oq(i,y),f+=y.length;continue}let g=l[f++];if(/[A-Za-z]/.test(g))throw RangeError(`Format string contains an unescaped latin alphabet character \`${g}\``);c+=g}return c}var Wf=_(Ke(),1);var gg=["artifact","reread","rerun"],Es={artifact:{label:"Artifact dive",plural:"Artifact dives",icon:tf,color:"var(--spot-artifact)",rule:"A later call read or searched an artifact the shortened result named"},reread:{label:"Re-read",plural:"Re-reads",icon:hf,color:"var(--spot-reread)",rule:"A later read of the same file overlapping the hidden lines, or the whole file again"},rerun:{label:"Rerun",plural:"Reruns",icon:Mf,color:"var(--spot-rerun)",rule:"A call of the same tool within 12 calls repeating the shortened one: a bash command the same, with a pipe or redirect added, or ≥ 60% shared tokens; any other tool with ≥ 60% shared argument tokens"}};function Fi(r){return r.gross.byTool.map((l)=>l.tool)}var zq=6,Ur="other";function Qo(r,l=zq){if(r.length<=l+1)return{listed:r,rest:[]};return{listed:r.slice(0,l),rest:r.slice(l)}}var Pa={applied:{label:"Shortened",color:"var(--spot-applied)",shape:"dot",rule:"Spotlight scored the result, shaping shortened it and the model saw the cut"},scoreFree:{label:"Score-free",color:"var(--spot-score-free)",shape:"square",rule:"A random coin skipped Spotlight: the no-score fallback rules shortened it and the model saw the cut"},holdout:{label:"Held out",color:"var(--spot-holdout)",shape:"ring",rule:"Spotlight would have shortened it, but it was held out at random and the model saw it whole"},reference:{label:"Unchanged",color:"var(--spot-reference)",shape:"diamond",rule:"Results shaping left unchanged, re-weighted to the cuts' original-size mix"},gated:{label:"Gated",color:"var(--spot-gated)",shape:"ring",rule:"A read pi's former edit gate (removed) kept whole: the model saw it uncut"}},Bb=["applied","scoreFree","holdout","gated","reference"],yg=["<250","250–1k","1k–4k","≥4k"],P2=["1","2","3","4–6","7–12"],z2={read:gf,bash:Dl,eval:Cl,grep:Of,find:ws,glob:vf,edit:Al,write:mf,web_search:bf,task:lf,todo:Cf,wait:Sf,fetch:Tl,lsp:Af,[Ur]:Il};function _r(r){return Object.hasOwn(z2,r)?z2[r]:Ni}function vg(r){if(r>=86400000)return"day";if(r>=3600000)return"hour";return`${Math.round(r/60000)} minutes`}function fo(r){return r<0?`−${se(-r)}`:se(r)}function vr(r){return r<0?`−${zt(-r)}`:zt(r)}function Yn(r,l){return r.lo===null||r.hi===null?"":`${l(r.lo)}–${l(r.hi)}`}function jt(r){if(r===null||!Number.isFinite(r))return"–";if(r===0)return"0%";let l=Math.abs(r*100);return`${r<0?"−":""}${l>=10?l.toFixed(0):l.toFixed(1)}%`}var tt=_(te(),1);function Pq(r){let l=r.agentType==="main",i=(r.sessionFile.split("/").pop()??"").replace(/\.jsonl$/,""),c=r.title?.trim()||(l?zr(r.folder):i);return`${l?c:`↳ ${c} (${r.agentType})`} · ${se(r.savedTokens)} saved`}function U2({stats:r,active:l,stale:i}){let{compounding:c}=r,[f,v]=Wf.useState(null),y=r.sessionList,g=y.find((C)=>C.savedTokens>0)??y[0],m=f!==null&&y.some((C)=>C.sessionFile===f)?f:g?.sessionFile,b=Pt(["spotlight-session",m??null],({signal:C})=>xI(m??"",C),{enabled:l&&m!==void 0}),h=c.avoidedTokens-c.recoveredCarriedTokens,S=r.gross.savedTokens>0?c.avoidedTokens/r.gross.savedTokens:null,L=b.data?.points,I=Wf.useMemo(()=>{if(!L)return null;let C=0,T=0;for(let R of L)C+=R.withoutTokens-R.contextTokens,T+=R.withoutTokens;return T>0?{share:C/T,tokens:C}:null},[L]);return tt.jsxDEV(fe,{index:3,title:"Compounding",description:"A cut is never re-read: each later request of the session carries a smaller context",actions:y.length>0&&tt.jsxDEV("select",{className:"input spot-session-select","aria-label":"Session",value:m??"",onChange:(C)=>v(C.target.value),children:y.map((C)=>tt.jsxDEV("option",{value:C.sessionFile,children:Pq(C)},C.sessionFile,!1,void 0,this))},void 0,!1,void 0,this),stale:i,footer:"Context = input + cache read + cache write of each request. A compaction is a request whose context is under 60% of the previous one's; it ends the carry.",children:tt.jsxDEV("div",{className:"spot-compounding",children:[tt.jsxDEV("div",{className:"spot-compounding-chart",children:m===void 0?tt.jsxDEV(Je,{title:"No experiment sessions in this range"},void 0,!1,void 0,this):b.data===null?b.error?tt.jsxDEV(ql,{error:b.error,onRetry:b.refetch},void 0,!1,void 0,this):tt.jsxDEV(qt,{height:280},void 0,!1,void 0,this):tt.jsxDEV(Hq,{context:b.data,stale:b.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this),tt.jsxDEV("aside",{className:"spot-compounding-side",children:[tt.jsxDEV("div",{className:"spot-eyebrow",children:"Context avoided in this session"},void 0,!1,void 0,this),tt.jsxDEV("div",{className:"spot-side-value",children:jt(I?.share??null)},void 0,!1,void 0,this),L!==void 0&&tt.jsxDEV("p",{className:"spot-side-copy",children:I===null?"This session has no recorded requests.":`of what its requests would have carried without Spotlight: ${fo(I.tokens)} prompt tokens, net of recoveries.`},void 0,!1,void 0,this),b.data&&tt.jsxDEV(Uq,{session:b.data.session},void 0,!1,void 0,this),tt.jsxDEV("p",{className:"spot-side-range",children:[tt.jsxDEV("span",{className:"spot-side-range-value",children:jt(c.avoidedShare)},void 0,!1,void 0,this)," across all the sessions shown: cuts kept ",se(Math.max(0,h))," tokens out of later requests",S!==null&&tt.jsxDEV(tt.Fragment,{children:[", each saved token re-sent ",S.toFixed(1)," times on average"]},void 0,!0,void 0,this),"."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Uq({session:r}){return tt.jsxDEV("dl",{className:"spot-facts",children:[tt.jsxDEV("div",{children:[tt.jsxDEV("dt",{children:"Agent"},void 0,!1,void 0,this),tt.jsxDEV("dd",{className:"row",children:tt.jsxDEV(ct,{children:r.agentType},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),tt.jsxDEV("div",{children:[tt.jsxDEV("dt",{children:"Requests"},void 0,!1,void 0,this),tt.jsxDEV("dd",{className:"num",children:A(r.requests)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),tt.jsxDEV("div",{children:[tt.jsxDEV("dt",{children:"Saved"},void 0,!1,void 0,this),tt.jsxDEV("dd",{className:"num",children:fo(r.savedTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),tt.jsxDEV("div",{children:[tt.jsxDEV("dt",{children:"Net $"},void 0,!1,void 0,this),tt.jsxDEV("dd",{className:"num",children:vr(r.netUsd)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var _q=[{key:"actual",label:"Context",color:"var(--spot-gross)"},{key:"ghost",label:"Without Spotlight",color:"var(--spot-ghost)"},{key:"compaction",label:"Compaction",color:"var(--line-4)"}];function Hq({context:r,stale:l}){let{points:i}=r,c=Wf.useMemo(()=>{let f=[{key:"actual",label:"Context",color:"var(--spot-gross)",kind:"area",values:i.map((y)=>y.contextTokens)},{key:"ghost",label:"Avoided",color:"var(--spot-ghost)",kind:"area",pattern:"hatch",dashed:!0,values:i.map((y)=>Math.max(0,y.withoutTokens-y.contextTokens))}],v=[];return i.forEach((y,g)=>{if(y.compacted)v.push({index:g})}),{series:f,markers:v}},[i]);if(i.length===0)return tt.jsxDEV(Je,{title:"No requests recorded for this session"},void 0,!1,void 0,this);return tt.jsxDEV("div",{className:"spot-context","data-stale":l,children:[tt.jsxDEV(ia,{items:_q},void 0,!1,void 0,this),tt.jsxDEV(yr,{slots:i.length,series:c.series,markers:c.markers,height:280,tickLabel:(f)=>`#${f+1}`,tooltipTitle:(f)=>`Request ${f+1} · ${B2(new Date(i[f].timestamp),"MMM d HH:mm:ss")}`,formatTooltip:A,showTotal:!1,tooltipExtra:(f)=>{let v=i[f];return tt.jsxDEV("div",{className:"spot-tooltip-extra",children:[tt.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[tt.jsxDEV("span",{className:"chart-tooltip-label",children:"Without Spotlight"},void 0,!1,void 0,this),tt.jsxDEV("span",{className:"chart-tooltip-value",children:A(v.withoutTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.saved>0&&tt.jsxDEV("div",{className:"chart-tooltip-row",children:[tt.jsxDEV("span",{className:"chart-tooltip-label",children:"Cut since last request"},void 0,!1,void 0,this),tt.jsxDEV("span",{className:"chart-tooltip-value",children:A(v.saved)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.recovered>0&&tt.jsxDEV("div",{className:"chart-tooltip-row",children:[tt.jsxDEV("span",{className:"chart-tooltip-label",children:"Fetched back"},void 0,!1,void 0,this),tt.jsxDEV("span",{className:"chart-tooltip-value",children:A(v.recovered)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.compacted&&tt.jsxDEV("div",{className:"chart-tooltip-row dim",children:"Compaction before this request"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ja=_(te(),1),xg="var(--spot-applied)",bg="var(--spot-unshaped)";function _2({stats:r,stale:l}){let i=[...r.coverage].sort((m,b)=>b.tokens-m.tokens),{listed:c,rest:f}=Qo(i),v=0,y=0;for(let m of i)if(m.shaped)v+=m.share;else y+=m.share;let g=c.map((m)=>({key:m.tool,label:Ja.jsxDEV(Ja.Fragment,{children:[Ja.jsxDEV("span",{className:"spot-coverage-tool",children:m.tool},void 0,!1,void 0,this),m.shaped&&Ja.jsxDEV(ct,{children:"shaped"},void 0,!1,void 0,this),Ja.jsxDEV("span",{className:"dim num",children:[A(m.calls)," calls"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),value:m.share,display:`${jt(m.share)} · ${se(m.tokens)}`,color:m.shaped?xg:bg}));if(f.length>0){let m=0,b=0,h=0;for(let S of f)m+=S.share,b+=S.tokens,h+=S.calls;g.push({key:"\x00rest",label:Ja.jsxDEV(Ja.Fragment,{children:[Ja.jsxDEV("span",{className:"spot-coverage-tool",children:[A(f.length)," more ",f.length===1?"tool":"tools"]},void 0,!0,void 0,this),Ja.jsxDEV("span",{className:"dim num",children:[A(h)," calls"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),value:m,display:`${jt(m)} · ${se(b)}`,color:f.some((S)=>S.shaped)?xg:bg})}return Ja.jsxDEV(fe,{index:5,title:"Not shaped yet",description:"Share of the tool output experiment sessions' models saw, by tool: the unshaped ones are where shaping could reach next",actions:Ja.jsxDEV(ia,{items:[{key:"shaped",label:"Shaped",color:xg},{key:"unshaped",label:"Not shaped",color:bg}]},void 0,!1,void 0,this),stale:l,footer:"Tokens are tool-result chars ÷ 4 over the experiment's sessions in the range; a tool counts as shaped when the experiment evaluated any of its results in the range.",children:i.length===0?Ja.jsxDEV("div",{className:"empty",children:"No tool output in this range."},void 0,!1,void 0,this):Ja.jsxDEV("div",{className:"spot-coverage",children:[Ja.jsxDEV("div",{className:"spot-coverage-summary",children:[Ja.jsxDEV("div",{className:"spot-coverage-headline",children:[Ja.jsxDEV("span",{className:"num",children:jt(y)},void 0,!1,void 0,this)," of tool output comes from tools the experiment did not shape in this range"]},void 0,!0,void 0,this),Ja.jsxDEV($n,{height:8,segments:[{key:"shaped",label:"Shaped",value:v,color:xg},{key:"unshaped",label:"Not shaped",value:y,color:bg}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ja.jsxDEV(Ts,{items:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var $t=_(te(),1),Fq=30,H2=5,Gq=120;function Vq(r){return[`${r.tool}: ${A(r.cuts)} cuts`,`Saved ${se(r.savedTokens)} tokens (${zt(r.savedUsd)})`,`Fetched back ${se(r.recoveredTokens)} tokens (${zt(r.recoveryUsd)})`,`${A(r.extraTurns)} extra turns (${zt(r.turnUsd)})`,`Net ${vr(r.netUsd)}`].join(`
|
|
235
|
+
<%s key={someKey} {...props} />`,St,He,ua,He),yt[He+St]=!0)}if(He=null,It!==void 0&&(i(It),He=""+It),y(Fe)&&(i(Fe.key),He=""+Fe.key),"key"in Fe){It={};for(var da in Fe)da!=="key"&&(It[da]=Fe[da])}else It=Fe;return He&&g(It,typeof Q==="function"?Q.displayName||Q.name||"Unknown":Q),b(Q,He,It,f(),ge,Ye)}function S(Q){L(Q)?Q._store&&(Q._store.validated=1):typeof Q==="object"&&Q!==null&&Q.$$typeof===ee&&(Q._payload.status==="fulfilled"?L(Q._payload.value)&&Q._payload.value._store&&(Q._payload.value._store.validated=1):Q._store&&(Q._store.validated=1))}function L(Q){return typeof Q==="object"&&Q!==null&&Q.$$typeof===I}var I=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),Ie=qi.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe=Object.prototype.hasOwnProperty,Ne=Array.isArray,Ce=console.createTask?console.createTask:function(){return null};qi={react_stack_bottom_frame:function(Q){return Q()}};var oe,Se={},De=qi.react_stack_bottom_frame.bind(qi,v)(),Qe=Ce(c(v)),yt={};KE.Fragment=T,KE.jsxDEV=function(Q,Fe,It,St){var ge=1e4>Ie.recentlyCreatedOwnerStacks++;return h(Q,Fe,It,St,ge?Error("react-stack-top-frame"):De,ge?Ce(c(Q)):Qe)}})()});var PR=_(q1(),1);var vd=_(Ke(),1);var kh=_(Ke(),1);var O1=(r)=>(r.match(/\d+[xX]\d+|[A-Z]?[a-z]+|[A-Z]|\d+/g)??[]).join("-").toLowerCase();function B1(r,l,i=[]){if(l==null)throw Error("[lucide]: iconNode is required when icon name is used");return{name:O1(r),size:24,node:l,...i.length>0?{aliases:i}:{}}}var z1=(r)=>{let l="",i=!1;for(let c of r){if(c==="-"||c==="_"||c<=" "){i=l.length>0;continue}if(l.length===0)l+=c.toLowerCase();else l+=i?c.toUpperCase():c;i=!1}return l};var P1=(r)=>{let l=z1(r);return l.charAt(0).toUpperCase()+l.slice(1)};var Jc=_(Ke(),1);var Zc=(...r)=>{let l=new Set;for(let i of r){if(typeof i!=="string")continue;for(let c of i.split(/\s+/))if(c)l.add(c)}return[...l].join(" ")};var wl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function ib(r){return r!==null&&r!==void 0}function U1(r,l={}){let i=l.attributeNames??{},c=(L)=>i[L]??L,f=r.size??r.width??wl.width,v=r.size??r.height??wl.height,y=r.aliases?.filter((L)=>typeof L==="string"&&L.trim()!=="").map((L)=>`lucide-${L}`)??[],g=[...r.name?[`lucide-${r.name}`]:[],...y],m=l.className?.split(" ").filter(Boolean)??[],b=l.includeDefaultClasses===!1?Zc(...m):Zc("lucide",...g,...m),h=l.absoluteStrokeWidth?Number(l.strokeWidth??wl["stroke-width"])*Number(r.size??r.width??wl.width)/Number(l.size??l.width??wl.width):l.strokeWidth??wl["stroke-width"];return["svg",{...Object.entries(wl).reduce((L,[I,C])=>(L[c(I)]=C,L),{}),..."color"in l&&l.color&&{[c("stroke")]:l.color},..."size"in l&&ib(l.size)&&{[c("width")]:l.size,[c("height")]:l.size},..."width"in l&&ib(l.width)&&{[c("width")]:l.width},..."height"in l&&ib(l.height)&&{[c("height")]:l.height},[c("stroke-width")]:h,...b&&{[c("class")]:b},[c("viewBox")]:`0 0 ${f} ${v}`,...l.hasA11yProp===!1?{[c("aria-hidden")]:"true"}:{},..."attributes"in l&&l.attributes},r.node.map((L)=>{let[I,C,T]=L,R=l.nonScalingStroke?{[c("vector-effect")]:"non-scaling-stroke",...C}:C;return T?[I,R,T]:[I,R]})]}function _1(r,l={}){return U1(r,{...l,attributeNames:{...l.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var H1=(r)=>{if(r==null||typeof r!=="object")return!1;for(let l in r)if(Object.prototype.hasOwnProperty.call(r,l)&&(l.startsWith("aria-")||l==="role"||l==="title")&&r[l]!=null)return!0;return!1};var Wu=_(Ke(),1),EE=Wu.createContext({});var F1=()=>Wu.useContext(EE);var G1=Jc.forwardRef(({color:r,size:l,width:i,height:c,strokeWidth:f,absoluteStrokeWidth:v,nonScalingStroke:y,className:g="",children:m,iconNode:b=[],icon:h={node:b,aliases:[],size:24},...S},L)=>{let{size:I=24,strokeWidth:C=2,absoluteStrokeWidth:T=!1,nonScalingStroke:R=!1,color:O="currentColor",className:z=""}=F1()??{},Y=Boolean(m)||H1(S),[W,ue,Z=[]]=_1(h,{color:r??O,width:i??l??I,height:c??l??I,strokeWidth:f??C,absoluteStrokeWidth:v??T,nonScalingStroke:y??R,className:Zc(z,g),hasA11yProp:Y,attributes:S});return Jc.createElement(W,{ref:L,...ue},[...Z.map(([ce,ee])=>Jc.createElement(ce,ee)),...Array.isArray(m)?m:[m]])});function re(r,l=[],i=[]){let c=typeof r==="string"?B1(r,l,i):r,f=kh.forwardRef(({className:v,...y},g)=>kh.createElement(G1,{ref:g,icon:c,className:v,...y}));if(c.name)f.displayName=P1(c.name);return f}var V1={name:"braces",size:24,node:[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],aliases:["curly-braces"]};V1.node;var Cl=re(V1);var j1={name:"circle-exclamation-point",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle","circle-alert"]};j1.node;var Zr=re(j1);var $1={name:"cloud-download",size:24,node:[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],aliases:["download-cloud"]};$1.node;var Tl=re($1);var X1={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};X1.node;var Il=re(X1);var Y1={name:"face-slightly-frowning",size:24,node:[["path",{d:"M15 10V9",key:"4dkmfx"}],["path",{d:"M9 10V9",key:"1lazqi"}],["path",{d:"M9 16a5 5 0 016 0",key:"34mdxb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aliases:["frown"]};Y1.node;var Rl=re(Y1);var K1={name:"file-pen-line",size:24,node:[["path",{d:"M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z",key:"ukzhwg"}],["path",{d:"M14.487 7.858A1 1 0 0 1 14 7V2",key:"1klhew"}],["path",{d:"M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516",key:"rxaxab"}],["path",{d:"M8 18h1",key:"13wk12"}]],aliases:["file-signature"]};K1.node;var Al=re(K1);var Q1={name:"plug-zap",size:24,node:[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]],aliases:["plug-zap-2"]};Q1.node;var Ml=re(Q1);var W1={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};W1.node;var Un=re(W1);var Z1={name:"square-chart-gantt",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 8h7",key:"kbo1nt"}],["path",{d:"M8 12h6",key:"ikassy"}],["path",{d:"M11 16h5",key:"oq65wt"}]],aliases:["gantt-chart-square","square-gantt-chart"]};Z1.node;var Jr=re(Z1);var J1={name:"square-terminal",size:24,node:[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],aliases:["terminal-square"]};J1.node;var Dl=re(J1);var eT={name:"triangle-exclamation-point",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle","triangle-alert"]};eT.node;var Io=re(eT);var tT={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};tT.node;var ef=re(tT);var aT={name:"archive",size:24,node:[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]};aT.node;var tf=re(aT);var oT={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};oT.node;var af=re(oT);var rT={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};rT.node;var of=re(rT);var nT={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};nT.node;var rf=re(nT);var sT={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};sT.node;var nf=re(sT);var lT={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};lT.node;var sf=re(lT);var iT={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};iT.node;var lf=re(iT);var uT={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};uT.node;var Mi=re(uT);var dT={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};dT.node;var Di=re(dT);var cT={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};cT.node;var uf=re(cT);var fT={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};fT.node;var en=re(fT);var pT={name:"clipboard-list",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]};pT.node;var df=re(pT);var mT={name:"coins",size:24,node:[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]]};mT.node;var cf=re(mT);var hT={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};hT.node;var Ei=re(hT);var gT={name:"corner-down-right",size:24,node:[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]};gT.node;var ff=re(gT);var yT={name:"cpu",size:24,node:[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]};yT.node;var pf=re(yT);var vT={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};vT.node;var mf=re(vT);var xT={name:"file-search",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]};xT.node;var hf=re(xT);var bT={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};bT.node;var gf=re(bT);var ST={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]};ST.node;var yf=re(ST);var kT={name:"folder-search",size:24,node:[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]};kT.node;var vf=re(kT);var LT={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};LT.node;var xf=re(LT);var wT={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};wT.node;var bf=re(wT);var CT={name:"hourglass",size:24,node:[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]};CT.node;var Sf=re(CT);var TT={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};TT.node;var kf=re(TT);var IT={name:"languages",size:24,node:[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]};IT.node;var Lf=re(IT);var RT={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};RT.node;var wf=re(RT);var AT={name:"list-todo",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]};AT.node;var Cf=re(AT);var MT={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]};MT.node;var Tf=re(MT);var DT={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]};DT.node;var If=re(DT);var ET={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};ET.node;var Rf=re(ET);var NT={name:"network",size:24,node:[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]};NT.node;var Af=re(NT);var qT={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};qT.node;var El=re(qT);var OT={name:"repeat-2",size:24,node:[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]};OT.node;var Mf=re(OT);var BT={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};BT.node;var Df=re(BT);var zT={name:"scan-search",size:24,node:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]};zT.node;var ws=re(zT);var PT={name:"scissors",size:24,node:[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]};PT.node;var Ef=re(PT);var UT={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};UT.node;var Nf=re(UT);var _T={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};_T.node;var qf=re(_T);var HT={name:"text-search",size:24,node:[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 19H3",key:"108z41"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]};HT.node;var Of=re(HT);var FT={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};FT.node;var Ni=re(FT);var GT={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};GT.node;var Ro=re(GT);var ld=_(Ke(),1);function Lh(r){let l=r?.trim().toLowerCase()??"";if(l==="zh"||l.startsWith("zh-")||l.startsWith("zh_"))return"zh-CN";return"en"}function VT(r){for(let l of r??[]){let i=Lh(l);if(i!=="en")return i}return"en"}function NE(r,l={}){return r.replace(/\{([\w.-]+)\}/g,(i,c)=>{let f=l[c];return f===void 0?i:String(f)})}function jT(r,l,i,c={}){let f=i[r]?.[l]??i.en?.[l];if(f===void 0)return console.warn(`[stats.i18n] missing translation: ${l}`),l;return NE(f,c)}var wh={en:{"nav.usage":"Usage","nav.activity":"Activity","nav.insights":"Insights","nav.overview":"Overview","nav.models":"Models","nav.providers":"Providers","nav.costs":"Costs","nav.requests":"Requests","nav.errors":"Errors","nav.traces":"Traces","nav.tools":"Tools","nav.frustration":"Frustration","nav.projects":"Projects","nav.tracking":"Tracking","nav.gain":"Gain","nav.spotlight":"Spotlight","nav.dashboard":"zetacode stats","nav.breadcrumb-stats":"stats","nav.pages":"Pages","nav.open-navigation":"Open navigation"},"zh-CN":{"nav.usage":"用量","nav.activity":"活动","nav.insights":"洞察","nav.overview":"总览","nav.models":"模型","nav.providers":"服务商","nav.costs":"费用","nav.requests":"请求","nav.errors":"错误","nav.traces":"调用链","nav.tools":"工具","nav.frustration":"情绪压力","nav.projects":"项目","nav.tracking":"追踪","nav.gain":"收益","nav.spotlight":"亮点","nav.dashboard":"zeta 统计","nav.breadcrumb-stats":"统计","nav.pages":"导航","nav.open-navigation":"打开导航"}};var Ch={en:{"common.provider":"Provider","common.providers":"Providers","common.model":"Model","common.models":"Models","common.requests":"Requests","common.request":"Request","common.tokens":"Tokens","common.share":"Share","common.cost":"Cost","common.error-rate":"Error rate","common.tokens-per-second":"Tokens/s","common.output-tokens-per-second":"Output tokens/s","common.premium":"Premium","common.premium-requests":"Premium requests","common.duration":"Duration","common.started":"Started","common.request-id":"Request id","common.session-entry":"Session entry","common.entry-id":"Entry id","common.input":"Input","common.output":"Output","common.output-message":"Output message","common.cache-read":"Cache read","common.cache-write":"Cache write","common.project":"Project","common.pages":"Pages","common.filter":"Filter…","common.no-data-in-range":"No data in this range","common.nothing-here-yet":"Nothing here yet","common.show-more":"Show more","common.total":"Total","common.average":"Average","common.unknown":"Unknown","common.root":"(root)","common.other-n":"Other ({count})","common.time-range":"Time range","common.range-1h":"1h","common.range-24h":"24h","common.range-7d":"7d","common.range-30d":"30d","common.range-90d":"90d","common.range-all":"All","common.window-1h":"the last hour","common.window-24h":"the last 24 hours","common.window-7d":"the last 7 days","common.window-30d":"the last 30 days","common.window-90d":"the last 90 days","common.window-all":"all time","common.copy":"Copy","common.copied":"Copied","common.close":"Close","common.cancel":"Cancel","common.aborted":"Aborted","common.failed":"Failed","common.error":"Error","shell.live":"Live","shell.reconnecting":"Reconnecting","shell.syncing":"Syncing","shell.sync-failed":"Sync failed","shell.indexing":"Indexing","shell.lost-connection":"Lost the live connection to the stats server; retrying","shell.ingesting":"Ingesting session files","shell.building-rollups":"Building hourly rollups; older ranges fill in as it goes","shell.sync-now":"Click to sync session files now","shell.just-now":"just now","shell.system-theme":"System theme","shell.dark-theme":"Dark theme","shell.light-theme":"Light theme","shell.range-suffix":"range","shell.jump-hint":"then letter to jump","shell.language":"Language","shell.switch-language":"Switch dashboard language"},"zh-CN":{"common.provider":"服务商","common.providers":"服务商","common.model":"模型","common.models":"模型","common.requests":"请求","common.request":"请求","common.tokens":"Token","common.share":"占比","common.cost":"费用","common.error-rate":"错误率","common.tokens-per-second":"Token/s","common.output-tokens-per-second":"输出 Token/s","common.premium":"溢价","common.premium-requests":"溢价请求","common.duration":"耗时","common.started":"开始时间","common.request-id":"请求 ID","common.session-entry":"会话条目","common.entry-id":"条目 ID","common.input":"输入","common.output":"输出","common.output-message":"输出消息","common.cache-read":"缓存读取","common.cache-write":"缓存写入","common.project":"项目","common.pages":"页数","common.filter":"筛选…","common.no-data-in-range":"该时间范围内没有数据","common.nothing-here-yet":"暂无数据","common.show-more":"显示更多","common.total":"合计","common.average":"平均","common.unknown":"未知","common.root":"(根目录)","common.other-n":"其他({count})","common.time-range":"时间范围","common.range-1h":"1 小时","common.range-24h":"24 小时","common.range-7d":"7 天","common.range-30d":"30 天","common.range-90d":"90 天","common.range-all":"全部","common.window-1h":"最近 1 小时","common.window-24h":"最近 24 小时","common.window-7d":"最近 7 天","common.window-30d":"最近 30 天","common.window-90d":"最近 90 天","common.window-all":"全部时间","common.copy":"复制","common.copied":"已复制","common.close":"关闭","common.cancel":"取消","common.aborted":"已中止","common.failed":"失败","common.error":"错误","shell.live":"实时","shell.reconnecting":"重新连接中","shell.syncing":"同步中","shell.sync-failed":"同步失败","shell.indexing":"建立索引","shell.lost-connection":"与统计服务的实时连接已断开,正在重试","shell.ingesting":"正在导入会话文件","shell.building-rollups":"正在构建小时汇总;更早的时间范围会逐步补全","shell.sync-now":"点击立即同步会话文件","shell.just-now":"刚刚","shell.system-theme":"跟随系统","shell.dark-theme":"深色主题","shell.light-theme":"浅色主题","shell.range-suffix":"范围","shell.jump-hint":"再按字母跳转","shell.language":"语言","shell.switch-language":"切换仪表盘语言"}};var Th={en:{"overview.title":"Overview","overview.description":"Everything zeta did across your sessions in {window}.","overview.api-equivalent-cost":"API-equivalent cost","overview.api-cost-title":"What this usage would cost at public API rates","overview.unpriced-n":"{count} unpriced","overview.failed-n":"{count} failed","overview.conversation-tokens":"Conversation tokens","overview.tokens-title":"Uncached input + cache reads + cache writes + output","overview.output-n":"{count} output","overview.cache-rate":"Cache rate","overview.cache-rate-title":"Cache reads ÷ (uncached input + cache reads)","overview.cache-saved":"{value} saved","overview.succeeded-n":"{count} succeeded","overview.uncached-input":"Uncached input","overview.avg-latency":"Avg latency","overview.avg-ttft":"Avg TTFT","overview.activity":"Activity","overview.per-5m":"Per 5 minutes","overview.per-hour":"Per hour","overview.per-day":"Per day","overview.succeeded":"Succeeded","overview.api-equivalent":"API-equivalent","overview.token-mix":"Token mix","overview.token-mix-description":"Where conversation tokens went","overview.by-agent":"By agent","overview.requests-short":"{count} req","overview.main-agent":"Main agent","overview.subagents":"Subagent","overview.advisor":"Advisor","overview.latest-requests":"Latest requests","overview.latest-requests-description":"Most recent model calls across every session","overview.all-requests":"All requests","overview.when":"When","overview.status":"Status","overview.ok":"OK"},"zh-CN":{"overview.title":"概览","overview.description":"在{window}内,zeta 在你的所有会话中完成的一切。","overview.api-equivalent-cost":"API 等效费用","overview.api-cost-title":"这些用量按公开 API 费率计算所需的费用","overview.unpriced-n":"{count} 个未定价","overview.failed-n":"{count} 个失败","overview.conversation-tokens":"对话 Token","overview.tokens-title":"未缓存输入 + 缓存读取 + 缓存写入 + 输出","overview.output-n":"{count} 输出","overview.cache-rate":"缓存命中率","overview.cache-rate-title":"缓存读取 ÷(未缓存输入 + 缓存读取)","overview.cache-saved":"节省 {value}","overview.succeeded-n":"{count} 个成功","overview.uncached-input":"未缓存输入","overview.avg-latency":"平均延迟","overview.avg-ttft":"平均 TTFT","overview.activity":"活动","overview.per-5m":"每 5 分钟","overview.per-hour":"每小时","overview.per-day":"每天","overview.succeeded":"成功","overview.api-equivalent":"API 等效","overview.token-mix":"Token 构成","overview.token-mix-description":"对话 Token 的去向","overview.by-agent":"按代理","overview.requests-short":"{count} 次请求","overview.main-agent":"主代理","overview.subagents":"子代理","overview.advisor":"顾问","overview.latest-requests":"最新请求","overview.latest-requests-description":"所有会话中最近的模型调用","overview.all-requests":"全部请求","overview.when":"时间","overview.status":"状态","overview.ok":"正常"}};var Ih={en:{"models.subtitle":"Which models did the work in {window}, and how fast they answered.","models.empty-title":"No model usage in this range","models.empty-hint":"Pick a wider range in the top bar.","models.used":"Models used","models.across-providers-one":"across {count} provider","models.across-providers":"across {count} providers","models.most-used":"Most used","models.most-used-hint":"{share} of requests · {provider}","models.failed-n":"{count} failed","models.api-cost":"API-equivalent cost","models.api-cost-title":"What this usage would cost at public API rates","models.unpriced-n":"{count} unpriced","models.request-share":"Request share","models.share-desc":"Each model's share of requests per {bucket}","models.count-desc":"Requests per {bucket}, stacked by model","models.share-mode-aria":"Share chart mode","models.all-models":"All models","models.table-desc":"Click a row for latency and throughput over time","models.cost-title":"API-equivalent estimate at public rates","models.tokens-title":"Uncached input + cache reads + cache writes + output","models.cache-rate":"Cache rate","models.cache-title":"Cache reads ÷ (uncached input + cache reads)","models.errors":"Errors","models.tps-title":"Average output tokens per second","models.ttft":"TTFT","models.ttft-title":"Average time to first token","models.trend":"Trend","models.trend-title":"Requests per {bucket}","models.efficiency":"Efficiency","models.latency":"Latency","models.cache-savings":"Cache savings","models.avg-duration":"Avg duration","models.avg-ttft":"Avg TTFT","models.uncached-input":"Uncached input","models.first-last-seen":"First seen {first} · last seen {last}","models.performance-per-bucket":"Performance per active {bucket}","models.no-samples-title":"No performance samples","models.no-samples-hint":"Timing is recorded for streamed responses.","models.tok-per-second":"{value} tok/s","models.bucket-5m":"5 minutes","models.bucket-hour":"hour","models.bucket-day":"day"},"zh-CN":{"models.subtitle":"在{window}内哪些模型完成了工作,以及它们的响应速度如何。","models.empty-title":"该时间范围内没有模型用量","models.empty-hint":"请在顶部栏选择更宽的时间范围。","models.used":"使用模型数","models.across-providers-one":"覆盖 {count} 个服务商","models.across-providers":"覆盖 {count} 个服务商","models.most-used":"使用最多","models.most-used-hint":"{share} 请求占比 · {provider}","models.failed-n":"{count} 个失败","models.api-cost":"API 等价费用","models.api-cost-title":"按公开 API 价格计算这笔用量的费用","models.unpriced-n":"{count} 个未定价","models.request-share":"请求占比","models.share-desc":"每个{bucket}中各模型的请求占比","models.count-desc":"每个{bucket}的请求数,按模型堆叠","models.share-mode-aria":"占比图表模式","models.all-models":"所有模型","models.table-desc":"点击某行可查看延迟与吞吐随时间的变化","models.cost-title":"按公开价格估算的 API 等价费用","models.tokens-title":"未缓存输入 + 缓存读取 + 缓存写入 + 输出","models.cache-rate":"缓存命中率","models.cache-title":"缓存读取 ÷(未缓存输入 + 缓存读取)","models.errors":"错误","models.tps-title":"平均输出 Token/s","models.ttft":"首 Token 延迟","models.ttft-title":"平均首 Token 延迟","models.trend":"趋势","models.trend-title":"每个{bucket}的请求数","models.efficiency":"效率","models.latency":"延迟","models.cache-savings":"缓存节省","models.avg-duration":"平均耗时","models.avg-ttft":"平均首 Token 延迟","models.uncached-input":"未缓存输入","models.first-last-seen":"首次出现 {first} · 最近出现 {last}","models.performance-per-bucket":"每个活跃{bucket}的性能","models.no-samples-title":"没有性能样本","models.no-samples-hint":"只有流式响应会记录耗时。","models.tok-per-second":"{value} Token/s","models.bucket-5m":"5 分钟","models.bucket-hour":"小时","models.bucket-day":"天"}};var Rh={en:{"providers.description":"Burn, reliability and subscription headroom per provider over {window}.","providers.most-tokens":"Most tokens: {provider}","providers.failed-n":"{count} failed","providers.succeeded-n":"{count} succeeded","providers.tokens-title":"Uncached input + cache reads + cache writes + output","providers.api-equivalent-cost":"API-equivalent cost","providers.api-cost-title":"What this usage would cost at public API rates","providers.unpriced-n":"{count} unpriced","providers.totals":"Provider totals","providers.totals-description":"Cost is an API-equivalent estimate. Select a row for its token mix.","providers.totals-description-unpriced-one":"Cost is an API-equivalent estimate and excludes {count} unpriced subscription request. Select a row for its token mix.","providers.totals-description-unpriced-n":"Cost is an API-equivalent estimate and excludes {count} unpriced subscription requests. Select a row for its token mix.","providers.no-requests-in-range":"No requests in this range","providers.models-title":"Distinct models used through this provider","providers.share-title":"Fraction of all tokens in range","providers.cost-title":"API-equivalent estimate","providers.tps-title":"Average output throughput","providers.premium-title":"Premium requests (subscription multiplier units)","providers.burn":"Burn by provider","providers.burn-estimate-description":"API-equivalent estimate per {bucket}; excludes unpriced subscription requests","providers.burn-description":"Per {bucket}, top {count} providers stacked","providers.bucket-5m":"5 minutes","providers.bucket-hour":"hour","providers.bucket-day":"day","providers.no-provider-activity":"No provider activity in this range","providers.peak-burn-hours":"Peak burn hours","providers.peak-hours-description":"Tokens by local hour of day; peak at {hour}","providers.hours-description":"Tokens by local hour of day","providers.all-providers":"All providers","providers.tokens-peak-hour":"Tokens (peak hour)","providers.no-activity-in-range":"No activity in this range","providers.subscription-windows":"Subscription windows","providers.subscription-windows-description":"What one usage window buys you and how many accounts peak demand needs. Select a row to chart it.","providers.window":"Window","providers.accounts":"Accounts","providers.accounts-title":"Accounts with at least one snapshot for this window in range","providers.resets":"Resets","providers.resets-title":"Window resets observed (drops in used fraction)","providers.windows-burned":"Windows burned","providers.windows-burned-title":"Subscription-window equivalents consumed in range (sum of used-fraction increases across accounts)","providers.tokens-per-window":"Tokens / window","providers.tokens-per-window-title":"Provider tokens burned in range ÷ windows burned — what one full window is worth","providers.too-little-consumed":"Too little of the window was consumed to extrapolate","providers.peak-utilization":"Peak utilization","providers.peak-utilization-title":"Peak of summed used fraction across accounts at any sampled instant; the bar is relative to fleet capacity","providers.accounts-needed":"Accounts needed","providers.accounts-needed-title":"Accounts needed to keep peak demand under 90% of fleet capacity","providers.ideal-accounts":"{ideal} · have {have}","providers.exhaustions":"Exhaustions","providers.exhaustions-title":"Transitions into an exhausted state observed in range","providers.exhausted-n":"{count} exhausted","providers.no-snapshots-in-range":"No usage snapshots in this range","providers.snapshot-hint":"Usage snapshots accumulate whenever usage limits are fetched (TUI footer, /usage, zetacode usage).","providers.utilization":"Window utilization","providers.utilization-description":"{window} used fraction per account, {from} – {to}","providers.utilization-description-plain":"Recorded limit utilization per account","providers.no-utilization-readings":"No utilization readings for this window","providers.exhausted":"Exhausted","providers.no-reading":"No reading","providers.high":"High","providers.account":"Account","providers.latest-used":"Latest used","providers.status":"Status","providers.peak-in-range":"Peak in range","providers.snapshots":"Snapshots","providers.recorded":"Recorded"},"zh-CN":{"providers.description":"各服务商在{window}内的消耗、可靠性与订阅余量。","providers.most-tokens":"Token 最多:{provider}","providers.failed-n":"{count} 次失败","providers.succeeded-n":"{count} 次成功","providers.tokens-title":"未缓存输入 + 缓存读取 + 缓存写入 + 输出","providers.api-equivalent-cost":"API 等效费用","providers.api-cost-title":"此用量按公开 API 费率计算需要多少费用","providers.unpriced-n":"{count} 个未定价","providers.totals":"服务商汇总","providers.totals-description":"费用为 API 等效估算。选择一行可查看其 Token 构成。","providers.totals-description-unpriced-one":"费用为 API 等效估算,且未包含 {count} 个未定价的订阅请求。选择一行可查看其 Token 构成。","providers.totals-description-unpriced-n":"费用为 API 等效估算,且未包含 {count} 个未定价的订阅请求。选择一行可查看其 Token 构成。","providers.no-requests-in-range":"该时间范围内没有请求","providers.models-title":"通过该服务商使用的不同模型","providers.share-title":"该时间范围内全部 Token 中的占比","providers.cost-title":"API 等效估算","providers.tps-title":"平均输出吞吐量","providers.premium-title":"溢价请求(订阅倍率单位)","providers.burn":"按服务商的消耗","providers.burn-estimate-description":"每{bucket}的 API 等效估算;不含未定价的订阅请求","providers.burn-description":"每{bucket},堆叠显示前 {count} 个服务商","providers.bucket-5m":"5 分钟","providers.bucket-hour":"小时","providers.bucket-day":"天","providers.no-provider-activity":"该时间范围内没有服务商活动","providers.peak-burn-hours":"消耗高峰时段","providers.peak-hours-description":"按本地时段统计的 Token;高峰在 {hour}","providers.hours-description":"按本地时段统计的 Token","providers.all-providers":"全部服务商","providers.tokens-peak-hour":"Token(高峰时段)","providers.no-activity-in-range":"该时间范围内没有活动","providers.subscription-windows":"订阅窗口","providers.subscription-windows-description":"一个用量窗口能带来多少用量,以及峰值需求需要多少个账号。选择一行可将它绘制成图表。","providers.window":"窗口","providers.accounts":"账号","providers.accounts-title":"该时间范围内对此窗口至少有一个快照的账号","providers.resets":"重置次数","providers.resets-title":"观测到的窗口重置次数(已用比例下降)","providers.windows-burned":"消耗的窗口数","providers.windows-burned-title":"该时间范围内消耗的订阅窗口等效量(各账号已用比例增量之和)","providers.tokens-per-window":"Token / 窗口","providers.tokens-per-window-title":"该时间范围内消耗的服务商 Token ÷ 消耗的窗口数 —— 一个完整窗口的价值","providers.too-little-consumed":"该窗口消耗太少,无法外推","providers.peak-utilization":"峰值利用率","providers.peak-utilization-title":"任意采样时刻各账号已用比例之和的峰值;进度条相对于整体容量","providers.accounts-needed":"所需账号数","providers.accounts-needed-title":"将峰值需求控制在整体容量 90% 以下所需的账号数","providers.ideal-accounts":"{ideal} · 现有 {have}","providers.exhaustions":"耗尽次数","providers.exhaustions-title":"该时间范围内观测到的进入耗尽状态的次数","providers.exhausted-n":"{count} 次耗尽","providers.no-snapshots-in-range":"该时间范围内没有用量快照","providers.snapshot-hint":"每当获取用量限额时都会累积用量快照(TUI 底部、/usage、zetacode usage)。","providers.utilization":"窗口利用率","providers.utilization-description":"{window} 各账号的已用比例,{from} – {to}","providers.utilization-description-plain":"各账号已记录的限额利用率","providers.no-utilization-readings":"该窗口没有利用率记录","providers.exhausted":"已耗尽","providers.no-reading":"无读数","providers.high":"偏高","providers.account":"账号","providers.latest-used":"最新已用","providers.status":"状态","providers.peak-in-range":"范围内峰值","providers.snapshots":"快照数","providers.recorded":"记录时间"}};var Ah={en:{"costs.title":"Costs","costs.description":"What {window} of usage would cost at public API rates. Subscription usage without a public price is counted as unpriced, not free.","costs.no-usage-in-range":"No usage in this range","costs.empty-hint":"Pick a wider range in the top bar.","costs.daily-estimate":"Daily estimate","costs.daily-by-model":"Per day, stacked by model","costs.daily-by-component":"Per day, stacked by billing component","costs.split-by":"Split by","costs.by-model":"By model","costs.by-component":"By component","costs.no-priced-usage":"No priced usage in this range","costs.unpriced-requests":"Unpriced requests","costs.where-it-went":"Where it went","costs.estimate-by-component":"Estimate by billing component","costs.unpriced-note-one":"{count} unpriced subscription request is not included.","costs.unpriced-note-n":"{count} unpriced subscription requests are not included.","costs.by-model-description":"Estimate per model with its input, output and cache split","costs.estimate":"Estimate","costs.estimate-title":"API-equivalent estimate at public rates","costs.split":"Split","costs.split-title":"Input · output · cache read · cache write","costs.per-request":"Per request","costs.per-request-title":"Estimate ÷ priced requests","costs.unpriced":"Unpriced","costs.unpriced-column-title":"Requests with no public-equivalent price","costs.api-equivalent-estimate":"API-equivalent estimate","costs.api-estimate-title":"What this usage would cost at public API rates","costs.requests-n":"{count} requests","costs.average-per-day":"Average per day","costs.average-per-day-title":"Estimate ÷ days with any usage","costs.active-days-one":"over {count} active day","costs.active-days-n":"over {count} active days","costs.top-model":"Top model","costs.top-model-hint":"{cost} · {share} of estimate","costs.nothing-priced-yet":"Nothing priced yet","costs.per-priced-request":"Per priced request","costs.per-priced-request-title":"Estimate ÷ requests that have a public price","costs.priced-n":"{count} priced","costs.unpriced-title":"Subscription usage with no public-equivalent price; excluded from the estimate","costs.unpriced-hint":"excluded from the estimate","costs.all-priced":"all usage priced"},"zh-CN":{"costs.title":"费用","costs.description":"按公开 API 费率计算,{window}的用量需要多少费用。没有公开价格的订阅用量计为未定价,而不是免费。","costs.no-usage-in-range":"此时间范围内没有用量","costs.empty-hint":"请在顶栏选择更宽的时间范围。","costs.daily-estimate":"每日估算","costs.daily-by-model":"按本地日统计,按模型堆叠","costs.daily-by-component":"按本地日统计,按计费组件堆叠","costs.split-by":"拆分依据","costs.by-model":"按模型","costs.by-component":"按组件","costs.no-priced-usage":"此时间范围内没有已定价的用量","costs.unpriced-requests":"未定价请求","costs.where-it-went":"费用去向","costs.estimate-by-component":"按计费组件估算","costs.unpriced-note-one":"{count} 个未定价的订阅请求未计入。","costs.unpriced-note-n":"{count} 个未定价的订阅请求未计入。","costs.by-model-description":"按模型估算,并附输入、输出与缓存的拆分","costs.estimate":"估算","costs.estimate-title":"按公开费率计算的 API 等效估算","costs.split":"拆分","costs.split-title":"输入 · 输出 · 缓存读取 · 缓存写入","costs.per-request":"单次请求","costs.per-request-title":"估算值 ÷ 已定价请求数","costs.unpriced":"未定价","costs.unpriced-column-title":"没有公开等效价格的请求","costs.api-equivalent-estimate":"API 等效估算","costs.api-estimate-title":"此用量按公开 API 费率计算需要多少费用","costs.requests-n":"{count} 个请求","costs.average-per-day":"日均","costs.average-per-day-title":"估算值 ÷ 有用量的天数","costs.active-days-one":"共 {count} 个活跃日","costs.active-days-n":"共 {count} 个活跃日","costs.top-model":"费用最高的模型","costs.top-model-hint":"{cost} · 占估算值的 {share}","costs.nothing-priced-yet":"暂无已定价用量","costs.per-priced-request":"单个已定价请求","costs.per-priced-request-title":"估算值 ÷ 有公开价格的请求数","costs.priced-n":"已定价 {count} 个","costs.unpriced-title":"没有公开等效价格的订阅用量;不计入估算","costs.unpriced-hint":"不计入估算","costs.all-priced":"全部用量均已定价"}};var Mh={en:{"requests.description":"Every model call zeta made in {window}, newest first. Open a row for its full payload.","requests.loading":"Loading…","requests.load-latest":"Load latest {count}","requests.status":"Status","requests.status-all":"All","requests.none-in-window":"none in {window}","requests.since":"since {time}","requests.failed-hint":"{rate} · {count} aborted","requests.tokens-hint":"Total tokens across these requests","requests.api-equivalent-cost":"API-equivalent cost","requests.cost-hint":"What these requests would cost at public API rates","requests.unpriced-n":"{count} unpriced","requests.median-duration":"Median duration","requests.p95":"p95 {value}","requests.median-ttft":"Median TTFT","requests.ttft":"TTFT","requests.ttft-hint":"Time to first token","requests.log-title":"Request log","requests.log-loading":"Loading the latest requests…","requests.log-count-in-window":"{shown} of {total} requests in {window}","requests.log-count-latest":"{shown} of the latest {total} requests","requests.search-placeholder":"Model, provider or project","requests.footer":"Showing the latest {count} requests, back to {time}. Older requests in {window} are not loaded.","requests.empty-in-window":"No requests in {window}","requests.empty-no-match":"No requests match","requests.empty-no-match-hint":"Clear the search or status filter.","requests.when":"When","requests.uncached-input":"Uncached input tokens","requests.cache-read-title":"Cache read tokens (hover a cell for cache writes)","requests.cache-write":"Cache write: {count}","requests.cost-estimate":"API-equivalent estimate"},"zh-CN":{"requests.description":"zeta 在 {window} 内发出的每一次模型调用,最新在前。打开某一行可查看其完整载荷。","requests.loading":"加载中…","requests.load-latest":"加载最新 {count} 条","requests.status":"状态","requests.status-all":"全部","requests.none-in-window":"{window} 内没有请求","requests.since":"自 {time} 起","requests.failed-hint":"{rate} · {count} 个已中止","requests.tokens-hint":"这些请求的 Token 总量","requests.api-equivalent-cost":"API 等价费用","requests.cost-hint":"这些请求按公开 API 费率计算的费用","requests.unpriced-n":"{count} 个未定价","requests.median-duration":"耗时中位数","requests.p95":"p95 分位 {value}","requests.median-ttft":"首 Token 延迟中位数","requests.ttft":"首 Token 延迟","requests.ttft-hint":"首 Token 延迟","requests.log-title":"请求日志","requests.log-loading":"正在加载最新请求…","requests.log-count-in-window":"{window} 内共 {total} 个请求,显示 {shown} 个","requests.log-count-latest":"最新 {total} 个请求中显示 {shown} 个","requests.search-placeholder":"模型、服务商或项目","requests.footer":"显示最新 {count} 个请求,回溯至 {time}。{window} 内更早的请求未加载。","requests.empty-in-window":"{window} 内没有请求","requests.empty-no-match":"没有匹配的请求","requests.empty-no-match-hint":"清除搜索内容或状态筛选。","requests.when":"时间","requests.uncached-input":"未缓存输入 Token","requests.cache-read-title":"缓存读取 Token(将鼠标悬停在单元格上可查看缓存写入)","requests.cache-write":"缓存写入:{count}","requests.cost-estimate":"API 等价估算"}};var Dh={en:{"errors.title":"Errors","errors.description":"Failed model requests in {window}, grouped by error signature. Open a failure for its full payload.","errors.footer":"Showing the latest {count} failures in {window}; older ones are not loaded.","errors.loading":"Loading…","errors.load-latest":"Load latest {count}","errors.failures":"Failures","errors.hint-in-window":"in {window}","errors.hint-latest-loaded":"latest {count} loaded","errors.signatures":"Signatures","errors.signatures-hint":"Distinct error messages after normalizing ids and numbers","errors.signatures-top":"top: {count} failures","errors.affected-models":"Affected models","errors.last-failure":"Last failure","errors.none-in-window":"none in {window}","errors.error-signatures":"Error signatures","errors.signatures-card-description":"Same message with ids and counters normalized. Select one to filter the failures below.","errors.empty-no-failures":"No failures in {window}","errors.empty-all-succeeded":"Every request succeeded or was aborted.","errors.by-model":"By model","errors.by-model-description":"Failures per model. Select one to filter.","errors.empty-no-affected-models":"No affected models","errors.loading-failures":"Loading failures…","errors.filtered-of-total":"{shown} of {total} failures, newest first","errors.search-placeholder":"Message, model or project","errors.no-match":"No failures match","errors.no-match-hint":"Clear the search or the selected filters.","errors.signature":"Signature","errors.more-models":"+{count} more","errors.last-seen":"Last seen","errors.unknown-error":"Unknown error","errors.group-meta":"{count} failures · first {first} · last {last}","errors.open-latest":"Open latest","errors.when":"When","errors.cost-hint":"API-equivalent estimate"},"zh-CN":{"errors.title":"错误","errors.description":"在 {window} 内失败的模型请求,按错误签名分组。打开某条失败可查看完整载荷。","errors.footer":"显示 {window} 内最新的 {count} 个失败;更早的未加载。","errors.loading":"加载中…","errors.load-latest":"加载最新 {count} 条","errors.failures":"失败","errors.hint-in-window":"{window} 内","errors.hint-latest-loaded":"已加载最新 {count} 条","errors.signatures":"签名","errors.signatures-hint":"对 ID 和数字归一化后不同的错误消息","errors.signatures-top":"最多:{count} 个失败","errors.affected-models":"受影响的模型","errors.last-failure":"最近一次失败","errors.none-in-window":"{window} 内没有失败","errors.error-signatures":"错误签名","errors.signatures-card-description":"同一消息在归一化 ID 和计数后归为一组。选择一项可筛选下方的失败。","errors.empty-no-failures":"{window} 内没有失败","errors.empty-all-succeeded":"所有请求均已成功或被中止。","errors.by-model":"按模型","errors.by-model-description":"各模型的失败数。选择一项可筛选。","errors.empty-no-affected-models":"没有受影响的模型","errors.loading-failures":"正在加载失败…","errors.filtered-of-total":"共 {total} 个失败,显示 {shown} 个,最新在前","errors.search-placeholder":"消息、模型或项目","errors.no-match":"没有匹配的失败","errors.no-match-hint":"清除搜索内容或已选筛选条件。","errors.signature":"签名","errors.more-models":"另有 {count} 个","errors.last-seen":"最近出现","errors.unknown-error":"未知错误","errors.group-meta":"{count} 个失败 · 首次 {first} · 最近 {last}","errors.open-latest":"打开最新","errors.when":"时间","errors.cost-hint":"按 API 价格估算"}};var Eh={en:{"trace.title":"Traces","trace.description":"Recent sessions with subagent activity folded in. Open one to inspect its timeline.","trace.sessions":"Sessions","trace.session":"Session","trace.most-recent":"{count} most recent","trace.most-recent-filtered":"{shown} of {total} most recent","trace.filter-placeholder":"Filter by title, project, model…","trace.empty-title":"No sessions found","trace.empty-hint":"Run a sync to index recent activity.","trace.no-matching-title":"No matching sessions","trace.no-matching-hint":"Try a different filter.","trace.tool":"Tool","trace.tools":"Tools","trace.agent":"Agent","trace.agents":"Agents","trace.background":"Background","trace.bg":"Bg","trace.refresh":"Refresh trace","trace.timeline":"Timeline","trace.timeline-hint":"W/S zoom · A/D pan · drag pan · wheel zoom · 0 fit · F focus selection · dbl-click focus · Esc deselect","trace.expand-all":"Expand all","trace.collapse-all":"Collapse all","trace.axis-mode":"Axis mode","trace.mode-time-title":"Real wall-clock time","trace.mode-turns-title":"Equal width per user turn","trace.mode-calls-title":"Equal width per model/tool call boundary","trace.turns":"Turns","trace.calls":"Calls","trace.compress-idle":"Compress idle","trace.search-placeholder":"Search spans…","trace.previous-match":"Previous match","trace.next-match":"Next match","trace.transcript":"Transcript","trace.transcript-description":"Every span and marker in order; click to inspect","trace.no-matching-events":"No matching events","trace.canvas-aria":"Trace timeline. W and S zoom, A and D pan, 0 fits all, F focuses the selection.","trace.minimap-aria":"Timeline overview brush","trace.expand-track":"Expand {track}","trace.collapse-track":"Collapse {track}","trace.unterminated":"unterminated","trace.tok":"tok","trace.ttft":"TTFT","trace.wall-time":"Wall time","trace.model-time":"Model time","trace.tool-time":"Tool time","trace.idle":"Idle","trace.tool-calls-n":"{count} tool calls","trace.of-wall":"{percent} of wall","trace.tool-aggregates":"Tool aggregates","trace.tool-aggregates-desc":"{count} tools, by total time","trace.errors":"Errors","trace.failed-n":"{count} failed","trace.avg":"Avg","trace.max":"Max","trace.start":"Start","trace.track":"Track","trace.io-cached":"Input / output / cached","trace.stop-reason":"Stop reason","trace.copy-json":"Copy raw JSON","trace.error-message":"Error message","trace.task":"Task","trace.open-child-track":"Open child track","trace.args":"Args","trace.thinking":"Thinking","trace.text":"Text","trace.raw-entry":"Raw entry","trace.load-failed":"Failed to load entry: {message}"},"zh-CN":{"trace.title":"调用链","trace.description":"最近的会话,已合并子代理活动。打开其中一个即可查看其时间线。","trace.sessions":"会话","trace.session":"会话","trace.most-recent":"最近 {count} 条","trace.most-recent-filtered":"最近 {total} 条中的 {shown} 条","trace.filter-placeholder":"按标题、项目或模型筛选…","trace.empty-title":"未找到会话","trace.empty-hint":"运行一次同步以索引最近的活动。","trace.no-matching-title":"没有匹配的会话","trace.no-matching-hint":"请尝试其他筛选条件。","trace.tool":"工具","trace.tools":"工具","trace.agent":"智能体","trace.agents":"智能体","trace.background":"后台","trace.bg":"背景","trace.refresh":"刷新调用链","trace.timeline":"时间线","trace.timeline-hint":"W/S 缩放 · A/D 平移 · 拖拽平移 · 滚轮缩放 · 0 适应全部 · F 聚焦所选 · 双击聚焦 · Esc 取消选择","trace.expand-all":"全部展开","trace.collapse-all":"全部折叠","trace.axis-mode":"坐标轴模式","trace.mode-time-title":"真实墙钟时间","trace.mode-turns-title":"每个用户轮次等宽","trace.mode-calls-title":"每个模型/工具调用边界等宽","trace.turns":"轮次","trace.calls":"调用次数","trace.compress-idle":"压缩空闲时间","trace.search-placeholder":"搜索跨度…","trace.previous-match":"上一个匹配","trace.next-match":"下一个匹配","trace.transcript":"对话记录","trace.transcript-description":"按顺序列出所有跨度和标记;点击可查看详情","trace.no-matching-events":"没有匹配的事件","trace.canvas-aria":"调用链时间线。W 和 S 缩放,A 和 D 平移,0 适应全部,F 聚焦所选。","trace.minimap-aria":"时间线概览刷选","trace.expand-track":"展开 {track}","trace.collapse-track":"折叠 {track}","trace.unterminated":"未结束","trace.tok":"Token","trace.ttft":"首 Token 延迟","trace.wall-time":"墙钟时间","trace.model-time":"模型耗时","trace.tool-time":"工具耗时","trace.idle":"空闲","trace.tool-calls-n":"{count} 次工具调用","trace.of-wall":"占墙钟时间 {percent}","trace.tool-aggregates":"工具汇总","trace.tool-aggregates-desc":"{count} 个工具,按总耗时排序","trace.errors":"错误","trace.failed-n":"{count} 个失败","trace.avg":"平均","trace.max":"最大","trace.start":"开始","trace.track":"轨道","trace.io-cached":"输入 / 输出 / 缓存读取","trace.stop-reason":"停止原因","trace.copy-json":"复制原始 JSON","trace.error-message":"错误信息","trace.task":"任务","trace.open-child-track":"打开子轨道","trace.args":"参数","trace.thinking":"思考过程","trace.text":"文本","trace.raw-entry":"原始条目","trace.load-failed":"加载条目失败:{message}"}};var Nh={en:{"tools.title":"Tools","tools.description":"Which tools zeta called in {window}, how often they failed, and what they cost.","tools.tool-calls":"Tool calls","tools.failed-n":"{count} failed","tools.distinct-tools":"Distinct tools","tools.most-used":"Most used: {tool}","tools.error-rate-title":"Tool results that came back flagged as errors","tools.succeeded-n":"{count} succeeded","tools.attributed-tokens":"Attributed tokens","tools.tokens-output":"{tokens} output","tools.attributed-cost":"Attributed cost","tools.attribution-note":"Tokens and API-equivalent cost of each invoking turn, split evenly across that turn's tool calls","tools.attribution-estimate":"{note}; API-equivalent estimate","tools.unpriced-requests-n":"{count} unpriced requests","tools.api-equivalent":"API-equivalent","tools.result-text":"Result text","tools.result-chars-title":"Characters of tool-result text fed back into context","tools.chars":"{count} chars","tools.call-arguments":"Call arguments","tools.args-chars-title":"Characters of serialized tool-call arguments","tools.avg-result-per-call":"Avg result per call","tools.avg-args-per-call":"Avg arguments per call","tools.calls-over-time":"Calls over time","tools.errors-over-time":"Errors over time","tools.chart-description":"Per {bucket}, top {count} tools stacked","tools.bucket-5m":"5 minutes","tools.bucket-hour":"hour","tools.bucket-day":"day","tools.calls":"Calls","tools.errors":"Errors","tools.no-tool-errors":"No tool errors in this range","tools.by-tool":"By tool","tools.by-tool-description":"{note}. Select a tool to break it down by model.","tools.by-tool-and-model":"By tool and model","tools.by-tool-and-model-description":"Which models call which tools, and how often those calls fail","tools.filter-by-tool":"Filter by tool","tools.all-tools":"All tools","tools.clear-tool-filter":"Clear tool filter","tools.no-tool-calls":"No tool calls in this range","tools.no-calls-to-tool":"No calls to {tool} in this range","tools.tool":"Tool","tools.trend":"Trend","tools.trend-title":"Calls per bucket over the range","tools.share-of-calls":"{percent} of all tool calls","tools.errors-title":"Calls whose result came back flagged as an error","tools.args":"Args","tools.result":"Result","tools.result-per-call":"Result / call","tools.result-per-call-title":"Mean tool-result characters per call","tools.attr-tokens":"Attr. tokens","tools.share-of-tokens":"{percent} of attributed tokens","tools.attr-cost":"Attr. cost","tools.share-of-cost":"{percent} of attributed cost","tools.last-used":"Last used"},"zh-CN":{"tools.title":"工具","tools.description":"zeta 在{window}调用了哪些工具、它们的失败频率如何,以及产生了多少费用。","tools.tool-calls":"工具调用","tools.failed-n":"{count} 个失败","tools.distinct-tools":"不同工具数","tools.most-used":"使用最多:{tool}","tools.error-rate-title":"返回时被标记为错误的工具结果","tools.succeeded-n":"{count} 个成功","tools.attributed-tokens":"归属 Token","tools.tokens-output":"{tokens} 输出","tools.attributed-cost":"归属费用","tools.attribution-note":"每次调用回合的 Token 与 API 等价费用,平均分摊到该回合的各个工具调用","tools.attribution-estimate":"{note};按 API 等价估算","tools.unpriced-requests-n":"{count} 个未定价请求","tools.api-equivalent":"按 API 等价","tools.result-text":"结果文本","tools.result-chars-title":"回填到上下文中的工具结果文本字符数","tools.chars":"{count} 字符","tools.call-arguments":"调用参数","tools.args-chars-title":"序列化后的工具调用参数字符数","tools.avg-result-per-call":"每次调用平均结果","tools.avg-args-per-call":"每次调用平均参数","tools.calls-over-time":"调用次数随时间变化","tools.errors-over-time":"错误数随时间变化","tools.chart-description":"按{bucket}统计,堆叠显示前 {count} 个工具","tools.bucket-5m":"5 分钟","tools.bucket-hour":"小时","tools.bucket-day":"天","tools.calls":"调用次数","tools.errors":"错误数","tools.no-tool-errors":"该时间范围内没有工具错误","tools.by-tool":"按工具","tools.by-tool-description":"{note}。选择某个工具可按模型细分。","tools.by-tool-and-model":"按工具和模型","tools.by-tool-and-model-description":"哪些模型调用了哪些工具,以及这些调用的失败频率","tools.filter-by-tool":"按工具筛选","tools.all-tools":"全部工具","tools.clear-tool-filter":"清除工具筛选","tools.no-tool-calls":"该时间范围内没有工具调用","tools.no-calls-to-tool":"该时间范围内没有对 {tool} 的调用","tools.tool":"工具","tools.trend":"趋势","tools.trend-title":"时间范围内每个分桶的调用次数","tools.share-of-calls":"占全部工具调用的 {percent}","tools.errors-title":"结果返回时被标记为错误的调用","tools.args":"参数","tools.result":"结果","tools.result-per-call":"结果 / 次","tools.result-per-call-title":"每次调用平均工具结果字符数","tools.attr-tokens":"归属 Token","tools.share-of-tokens":"占归属 Token 的 {percent}","tools.attr-cost":"归属费用","tools.share-of-cost":"占归属费用的 {percent}","tools.last-used":"最近使用"}};var qh={en:{"frustration.estimate-note":"Identical messages share one verdict, and verdicts are cached, so later runs only pay for new messages. Nothing is spent until you proceed.","frustration.column-model-ids":"Model IDs","frustration.column-messages":"Messages","frustration.column-judged":"Judged","frustration.model-versions":"Model versions","frustration.no-model-match":"No model versions match the filters","frustration.small-models-title":"Models with fewer than {count} messages have noisy rates","frustration.hide-regex-title":"Hide models with under {share}% judged messages (rates from regex signals)","frustration.hatch-title":"Under {share}% of these messages are judged; their rates come from regex signals","frustration.regex-badge":"regex","frustration.legend-annoyed-any":"Annoyed, any target","frustration.table-description":"Rates are shares of user messages; rows follow the chart filters.","frustration.running":"Running","frustration.estimating":"Estimating cost…","frustration.failed-n":"{count} failed","frustration.cost-so-far":"cost so far","frustration.elapsed":"elapsed {time}","frustration.in-flight":"{count} in flight","frustration.messages-progress":"{done}/{total} messages","frustration.failed-suffix":", {count} failed","frustration.judge-with":" with {judge}","frustration.in-time":" in {time}","frustration.run-done-line":"Last run judged {progress}{failed}{judge}{elapsed} for {cost}.","frustration.run-cancelled-line":"Last run cancelled after {progress}{failed}; spent {cost}.","frustration.run-failed-line":"Last run failed after {progress}{failed}: {error}. Spent {cost}.","frustration.title":"Frustration","frustration.description":"How often your messages sound annoyed, per model version, in {window}.","frustration.user-messages":"User messages","frustration.user-messages-title":"User messages with prose in range","frustration.judge-coverage":"Judge coverage","frustration.judge-coverage-title":"Messages with a cached judge verdict; the rest use the regex lexicons","frustration.coverage-hint":"{judged} judged · {regex} regex","frustration.coverage-unscored":" · {count} unscored (no lexicon)","frustration.unscored-line":"Messages in a language without a lexicon: {count} — unscored, not calm.","frustration.annoyed":"Annoyed","frustration.annoyed-title":"Messages annoyed at any target","frustration.at-assistant":"At assistant","frustration.at-assistant-title":"Messages annoyed at the assistant","frustration.angry":"Angry","frustration.angry-title":"Messages angry or hostile toward the assistant","frustration.messages-n":"{count} messages","frustration.judge-panel":"Judge classification","frustration.judge-description":"Cached LLM verdicts replace the regex lexicons; unjudged messages fall back to regex signals. Messages in a language no lexicon covers are reported as unscored rather than counted as calm.","frustration.classify":"Classify with judge","frustration.proceed":"Proceed","frustration.starting":"Starting…","frustration.judge-running":"A judge run is in progress","frustration.quote-title":"Quote the cost of judging every unjudged message in range","frustration.estimated-cost":"Estimated cost","frustration.unjudged-messages":"Unjudged unique messages","frustration.prose-chars":"Prose characters","frustration.input-tokens":"Estimated input tokens","frustration.judge-model":"Judge","frustration.all-judged":"Everything in this range is already judged. There is nothing left to classify.","frustration.no-run-yet":"No judge run yet. Classify the unjudged messages to replace regex estimates with verdicts.","frustration.last-run-done":"Last run done","frustration.last-run-cancelled":"Last run cancelled","frustration.last-run-failed":"Last run failed","frustration.not-run-yet":"Not run yet","frustration.regex-only":"Regex only","frustration.cancel-run":"Cancel run","frustration.cancelling":"Cancelling…","frustration.run-judged":"Last run judged {progress}","frustration.run-cancelled-after":"Last run cancelled after {progress}","frustration.run-failed-after":"Last run failed after {progress}","frustration.by-model":"Frustration by model version","frustration.by-model-description":"Share of user messages per model version. Each bar reaches the annoyed rate; the subsets aimed at the assistant stack inside it.","frustration.all-classes":"All","frustration.every-model-class":"Every model class","frustration.model-class":"Model class","frustration.include-small":"Include < {count} messages","frustration.unclassified":"unclassified","frustration.legend-angry":"Angry at assistant","frustration.legend-assistant":"At assistant, not angry","frustration.legend-other":"Annoyed at other targets","frustration.legend-trend":"At assistant trend","frustration.legend-hatched":"Hatched: mostly regex fallback","frustration.legend-hatched-run":"Hatched: mostly regex fallback (run the judge)","frustration.legend-hue":"Hue = model family","frustration.no-messages":"No user messages in this range","frustration.try-longer-range":"Try a longer range.","frustration.mostly-regex":"Mostly regex fallback: run the judge for accurate rates","frustration.row-mostly-regex":" · mostly regex fallback","frustration.stack-relation":"annoyed ⊇ atAssistant ⊇ angry","frustration.unknown-error":"unknown error","frustration.cancelled":"Cancelled","frustration.failed":"Failed","frustration.done":"Done","frustration.model-side-title":"AI breakdown","frustration.model-side-description":"How the model's own replies read, per model version, in {window}.","frustration.model-turns":"Assistant turns","frustration.model-turns-title":"Assistant replies with text in range; tool-call-only replies and thinking blocks are not analyzed","frustration.model-breakdown":"Breakdown rate","frustration.model-breakdown-title":"Share of analyzed turns with at least one breakdown signal","frustration.model-mean":"Signals / turn","frustration.model-mean-title":"Average per-turn aggregate: text markers plus capped failed tool results","frustration.model-self-blame":"Self-blame","frustration.model-self-blame-title":"Turns containing an apology or admission","frustration.model-restatement":"Restatement","frustration.model-restatement-title":"Turns repeating earlier content, by explicit marker or near-duplicate reply","frustration.model-hedge":"Hedged","frustration.model-hedge-title":"Turns with hedged fallbacks: uncertainty or suggested alternatives","frustration.model-spiral":"Tool spirals","frustration.model-spiral-title":"Turns following three or more failed tool results","frustration.model-rambling":"Rambling","frustration.model-rambling-title":"Turns past the verbosity threshold","frustration.model-unscored-line":"Turns in a language without a lexicon: {count} — unscored, not calm.","frustration.model-by-model":"AI breakdown by model version","frustration.model-table-title":"Model breakdown detail","frustration.model-by-model-description":"Share of each model's analyzed turns carrying a breakdown signal. Hue = model family.","frustration.model-over-time":"AI breakdown over time","frustration.model-over-time-description":"Breakdown rate per bucket: turns with a signal over analyzed turns. Gaps are buckets with no turns.","frustration.model-sessions":"Sessions by breakdown","frustration.model-sessions-description":"Sessions with the most analyzed assistant turns.","frustration.model-table-description":"Rates are shares of analyzed assistant turns.","frustration.column-session":"Session","frustration.column-turns":"Turns","frustration.column-mean":"Signals/turn","frustration.column-tool-errors":"Tool errors","frustration.model-no-turns":"No assistant turns with text in this range","frustration.model-try-longer-range":"Try a longer range.","frustration.model-legend-breakdown":"Breakdown rate","frustration.turns-n":"{count} turns","frustration.model-hint-mean":"{value} signals per turn on average"},"zh-CN":{"frustration.estimate-note":"内容相同的消息共用一份结论,且结论会被缓存,因此后续运行只为新消息付费。在你开始之前不会产生任何费用。","frustration.column-model-ids":"模型 ID","frustration.column-messages":"消息数","frustration.column-judged":"已评判","frustration.model-versions":"模型版本","frustration.no-model-match":"没有符合筛选条件的模型版本","frustration.small-models-title":"消息少于 {count} 条的模型比例噪声较大","frustration.hide-regex-title":"隐藏已评判比例低于 {share}% 的模型(其比例来自正则信号)","frustration.hatch-title":"这些消息中已评判比例低于 {share}%,其比例来自正则信号","frustration.regex-badge":"正则","frustration.legend-annoyed-any":"不耐烦(任意对象)","frustration.table-description":"比例为占用户消息的百分比;行跟随图表筛选。","frustration.running":"运行中","frustration.estimating":"正在估算费用…","frustration.failed-n":"{count} 条失败","frustration.cost-so-far":"当前费用","frustration.elapsed":"已用时 {time}","frustration.in-flight":"并发 {count}","frustration.messages-progress":"{done}/{total} 条消息","frustration.failed-suffix":",{count} 条失败","frustration.judge-with":",评判模型 {judge}","frustration.in-time":",用时 {time}","frustration.run-done-line":"上次运行评判了 {progress}{failed}{judge}{elapsed},花费 {cost}。","frustration.run-cancelled-line":"上次运行在 {progress}{failed} 后取消,花费 {cost}。","frustration.run-failed-line":"上次运行在 {progress}{failed} 后失败:{error}。花费 {cost}。","frustration.title":"情绪压力","frustration.description":"按模型版本统计你的消息有多不耐烦({window})。","frustration.user-messages":"用户消息","frustration.user-messages-title":"该时间范围内的用户消息(含正文)","frustration.judge-coverage":"判据覆盖率","frustration.judge-coverage-title":"已有缓存的评判模型结论的消息;其余使用正则词典","frustration.coverage-hint":"{judged} 条已评判 · {regex} 条正则","frustration.coverage-unscored":" · {count} 条未评分(无词典)","frustration.unscored-line":"缺少对应词典的语言:{count} 条 —— 未评分,不代表平静。","frustration.annoyed":"不耐烦","frustration.annoyed-title":"对任何对象不耐烦的消息","frustration.at-assistant":"针对助手","frustration.at-assistant-title":"对助手不耐烦的消息","frustration.angry":"发怒","frustration.angry-title":"对助手发怒或带有敌意的消息","frustration.messages-n":"{count} 条消息","frustration.judge-panel":"评判模型分类","frustration.judge-description":"缓存的模型结论会取代正则词典;未评判的消息回退到正则信号。缺少词典的语言显示为未评分,而不是判定为平静。","frustration.classify":"用评判模型分类","frustration.proceed":"开始","frustration.starting":"正在开始…","frustration.judge-running":"评判任务正在进行","frustration.quote-title":"估算对该范围内所有未评判消息进行判定的成本","frustration.estimated-cost":"预估费用","frustration.unjudged-messages":"未评判的唯一消息","frustration.prose-chars":"正文字符数","frustration.input-tokens":"预估输入 Token","frustration.judge-model":"评判模型","frustration.all-judged":"该范围内已全部评判,没有需要分类的消息。","frustration.no-run-yet":"尚未运行评判。对未评判的消息分类,即可用结论取代正则估算。","frustration.last-run-done":"上次运行完成","frustration.last-run-cancelled":"上次运行已取消","frustration.last-run-failed":"上次运行失败","frustration.not-run-yet":"尚未运行","frustration.regex-only":"仅正则","frustration.cancel-run":"取消运行","frustration.cancelling":"正在取消…","frustration.run-judged":"上次运行已评判 {progress}","frustration.run-cancelled-after":"上次运行在 {progress} 后取消","frustration.run-failed-after":"上次运行在 {progress} 后失败","frustration.by-model":"按模型版本的情绪压力","frustration.by-model-description":"各模型版本中用户消息的占比。每根柱子到达不耐烦比例,其中针对助手的子集叠在其内部。","frustration.all-classes":"全部","frustration.every-model-class":"所有模型类别","frustration.model-class":"模型类别","frustration.include-small":"包含少于 {count} 条消息","frustration.unclassified":"未分类","frustration.legend-angry":"对助手发怒","frustration.legend-assistant":"针对助手但未发怒","frustration.legend-other":"对其他对象不耐烦","frustration.legend-trend":"针对助手趋势","frustration.legend-hatched":"斜线:多为正则回退","frustration.legend-hatched-run":"斜线:多为正则回退(运行评判)","frustration.legend-hue":"色相 = 模型家族","frustration.no-messages":"该时间范围内没有用户消息","frustration.try-longer-range":"试试更长的时间范围。","frustration.mostly-regex":"多为正则回退:运行评判以获得准确比例","frustration.row-mostly-regex":" · 多为正则回退","frustration.stack-relation":"不耐烦 ⊇ 针对助手 ⊇ 发怒","frustration.unknown-error":"未知错误","frustration.cancelled":"已取消","frustration.failed":"失败","frustration.done":"完成","frustration.model-side-title":"AI 崩溃度","frustration.model-side-description":"各模型版本自身回复的读感,统计窗口:{window}。","frustration.model-turns":"助手回合","frustration.model-turns-title":"时间范围内带文本的助手回复;仅含工具调用的回复与思考块不参与分析","frustration.model-breakdown":"崩溃率","frustration.model-breakdown-title":"至少带一个崩溃信号的已分析回合占比","frustration.model-mean":"信号 / 回合","frustration.model-mean-title":"每回合聚合均值:文本标记加上封顶的工具失败数","frustration.model-self-blame":"自责","frustration.model-self-blame-title":"包含道歉或认错的回合","frustration.model-restatement":"重复陈述","frustration.model-restatement-title":"以显式标记或与上一条回复高度相似的方式重复先前内容的回合","frustration.model-hedge":"含糊兜底","frustration.model-hedge-title":"带有含糊兜底的回合:不确定表述或建议替代方案","frustration.model-spiral":"工具失败螺旋","frustration.model-spiral-title":"紧随三个及以上工具失败之后的回合","frustration.model-rambling":"冗长","frustration.model-rambling-title":"超过冗长阈值的回合","frustration.model-unscored-line":"使用无词典语言的回合:{count} — 未评分,而非平静。","frustration.model-by-model":"各模型版本的 AI 崩溃度","frustration.model-table-title":"模型崩溃明细","frustration.model-by-model-description":"每个模型已分析回合中带崩溃信号的占比。色相 = 模型家族。","frustration.model-over-time":"AI 崩溃度随时间变化","frustration.model-over-time-description":"每个时间桶的崩溃率:带信号的回合除以已分析回合。空白表示该桶没有回合。","frustration.model-sessions":"按崩溃度查看会话","frustration.model-sessions-description":"已分析助手回合最多的会话。","frustration.model-table-description":"比例为已分析助手回合的占比。","frustration.column-session":"会话","frustration.column-turns":"回合数","frustration.column-mean":"信号/回合","frustration.column-tool-errors":"工具错误","frustration.model-no-turns":"该时间范围内没有带文本的助手回合","frustration.model-try-longer-range":"试试更长的时间范围。","frustration.model-legend-breakdown":"崩溃率","frustration.turns-n":"{count} 个回合","frustration.model-hint-mean":"平均每回合 {value} 个信号"}};var Oh={en:{"projects.title":"Projects","projects.description":"Usage by session folder in {window}.","projects.folders":"Folders","projects.folder":"Folder","projects.temporary-n":"{count} temporary","projects.failed-n":"{count} failed","projects.api-equivalent-cost":"API-equivalent cost","projects.api-equivalent-cost-hint":"What this usage would cost at public API rates","projects.unpriced-n":"{count} unpriced","projects.conversation-tokens":"Conversation tokens","projects.conversation-tokens-hint":"Uncached input + cache reads + cache writes + output","projects.cache-rate":"Cache rate","projects.cache-rate-hint":"Cache reads ÷ (uncached input + cache reads)","projects.cache-rate-hint-all":"Cache reads ÷ (uncached input + cache reads), across every folder","projects.top-by-cost":"Top by cost","projects.top-by-cost-description":"Share of API-equivalent cost","projects.top-by-requests":"Top by requests","projects.top-by-requests-description":"Share of all requests","projects.folders-n":"{count} folders","projects.folders-of-n":"{count} of {total} folders","projects.hide-temporary":"Hide temporary ({count})","projects.hide-temporary-hint":"Session folders under /tmp or /var/folders","projects.filter-placeholder":"Filter folders…","projects.empty-no-folders":"No project folders in this range","projects.empty-only-temporary":"Only temporary folders in this range","projects.empty-no-match":"No folders match","projects.hint-longer-range":"Try a longer range.","projects.hint-temporary-hidden":"Temporary folders are hidden.","projects.temp":"temp","projects.share-of-requests":"{share} of all requests","projects.share-of-cost":"{share} of all cost","projects.api-equivalent-cost-rates":"API-equivalent cost at public API rates","projects.cache-savings":"Cache savings","projects.cache-savings-hint":"Prompt-input cost saved versus billing the same tokens uncached","projects.errors":"Errors","projects.avg-duration":"Avg duration","projects.last-active":"Last active"},"zh-CN":{"projects.title":"项目","projects.description":"{window}内按会话文件夹统计的用量。","projects.folders":"文件夹","projects.folder":"文件夹","projects.temporary-n":"{count} 个临时","projects.failed-n":"{count} 个失败","projects.api-equivalent-cost":"API 等效费用","projects.api-equivalent-cost-hint":"这些用量按公开 API 费率计算所需的费用","projects.unpriced-n":"{count} 个未计价","projects.conversation-tokens":"对话 Token","projects.conversation-tokens-hint":"未缓存输入 + 缓存读取 + 缓存写入 + 输出","projects.cache-rate":"缓存命中率","projects.cache-rate-hint":"缓存读取 ÷(未缓存输入 + 缓存读取)","projects.cache-rate-hint-all":"缓存读取 ÷(未缓存输入 + 缓存读取),覆盖所有文件夹","projects.top-by-cost":"费用最高","projects.top-by-cost-description":"占 API 等效费用的比例","projects.top-by-requests":"请求最多","projects.top-by-requests-description":"占全部请求的比例","projects.folders-n":"{count} 个文件夹","projects.folders-of-n":"{total} 个文件夹中的 {count} 个","projects.hide-temporary":"隐藏临时文件夹({count})","projects.hide-temporary-hint":"/tmp 或 /var/folders 下的会话文件夹","projects.filter-placeholder":"筛选文件夹…","projects.empty-no-folders":"该时间范围内没有项目文件夹","projects.empty-only-temporary":"该时间范围内只有临时文件夹","projects.empty-no-match":"没有匹配的文件夹","projects.hint-longer-range":"试试更长的时间范围。","projects.hint-temporary-hidden":"临时文件夹已隐藏。","projects.temp":"临时","projects.share-of-requests":"占全部请求的 {share}","projects.share-of-cost":"占全部费用的 {share}","projects.api-equivalent-cost-rates":"按公开 API 费率计算的等效费用","projects.cache-savings":"缓存节省","projects.cache-savings-hint":"同样的 Token 按未缓存计费时,提示输入费用节省的比例","projects.errors":"错误","projects.avg-duration":"平均耗时","projects.last-active":"最近活动"}};var Bh={en:{"tracking.title":"Tracking","tracking.description":"Read-only snapshot of a project's tracking documents: process state, not learned facts.","tracking.project":"Project","tracking.select-project":"Select a project…","tracking.no-projects":"No projects in the stats registry","tracking.no-projects-hint":"Tracking is scoped to folders the stats database has seen.","tracking.read-only":"The dashboard only reads these files; it never writes tracking.","tracking.directory":"Directory","tracking.updated":"Updated","tracking.none":"None","tracking.no-documents":"No tracking documents","tracking.no-documents-hint":"Tracking is opt-in. Run /tracking on, or enable tools → Project Tracking (tracking.enabled) in /settings, then /tracking start.","tracking.status":"Status","tracking.index":"Index","tracking.actions":"Actions","tracking.sessions":"Sessions","tracking.phase":"Phase","tracking.progress":"Progress","tracking.blockers":"Blockers","tracking.decisions":"Decisions","tracking.stage":"Stage","tracking.phases":"Todo phases","tracking.last-updated":"Last updated","tracking.last-session":"Last session","tracking.missing":"Missing","tracking.partial":"Partial","tracking.corrupt":"Corrupt","tracking.error":"Error","tracking.truncated":"Truncated read","tracking.status-missing":"status.json is missing","tracking.status-corrupt":"status.json is not valid JSON","tracking.status-error":"Could not read status.json","tracking.index-missing":"INDEX.md is missing","tracking.actions-missing":"No action log yet","tracking.sessions-missing":"No sessions directory yet","tracking.sessions-empty":"No session documents","tracking.invalid-rows":"{count} malformed action rows skipped","tracking.actions-empty":"The action log has no readable rows","tracking.document-empty":"This document is empty"},"zh-CN":{"tracking.title":"追踪","tracking.description":"项目追踪文档的只读快照:这里是过程状态,不是学到的知识事实。","tracking.project":"项目","tracking.select-project":"选择项目…","tracking.no-projects":"统计注册表中没有项目","tracking.no-projects-hint":"追踪只读取统计数据库见过的项目文件夹。","tracking.read-only":"仪表盘只读取这些文件,绝不写入追踪。","tracking.directory":"目录","tracking.updated":"更新时间","tracking.none":"无","tracking.no-documents":"没有追踪文档","tracking.no-documents-hint":"追踪是可选功能。运行 /tracking on,或在 /settings → tools → Project Tracking(tracking.enabled)中启用,然后执行 /tracking start。","tracking.status":"状态","tracking.index":"索引","tracking.actions":"操作","tracking.sessions":"会话","tracking.phase":"阶段","tracking.progress":"进度","tracking.blockers":"阻塞","tracking.decisions":"决策","tracking.stage":"当前阶段","tracking.phases":"待办阶段","tracking.last-updated":"最近更新","tracking.last-session":"最近会话","tracking.missing":"缺失","tracking.partial":"不完整","tracking.corrupt":"损坏","tracking.error":"错误","tracking.truncated":"读取已截断","tracking.status-missing":"status.json 缺失","tracking.status-corrupt":"status.json 不是有效 JSON","tracking.status-error":"无法读取 status.json","tracking.index-missing":"INDEX.md 缺失","tracking.actions-missing":"还没有操作日志","tracking.sessions-missing":"还没有 sessions 目录","tracking.sessions-empty":"没有会话文档","tracking.invalid-rows":"已跳过 {count} 行格式错误的操作记录","tracking.actions-empty":"操作日志没有可读记录","tracking.document-empty":"该文档为空"}};var zh={en:{"gain.title":"Gain","gain.description":"Tokens snapcompact kept out of context in {window}.","gain.description-scoped":"Tokens snapcompact kept out of context for {project} in {window}.","gain.all-projects":"All projects","gain.empty-title":"No savings recorded in {window}","gain.empty-title-scoped":"No savings recorded for {project} in {window}","gain.empty-hint-all":"Savings appear here once snapcompact compacts tool output.","gain.empty-hint-longer-range":"Try a longer range.","gain.saved-tokens":"Saved tokens","gain.saved-bytes":"Saved bytes","gain.reduction":"Reduction","gain.reduction-title":"Saved bytes ÷ original bytes, when the original size is known","gain.reduction-unknown":"original size not recorded","gain.hits":"Hits","gain.saved-per-hit":"Saved per hit","gain.savings-over-time":"Savings over time","gain.savings-over-time-description":"Tokens saved per day, with the running total","gain.saved-per-day":"Saved per day","gain.cumulative":"Cumulative","gain.by-source":"By source","gain.by-source-description":"Savings per subsystem","gain.source":"Source"},"zh-CN":{"gain.title":"收益","gain.description":"在{window}内被 snapcompact 挡在上下文之外的 Token。","gain.description-scoped":"在{window}内被 snapcompact 为 {project} 挡在上下文之外的 Token。","gain.all-projects":"全部项目","gain.empty-title":"在{window}内没有节省记录","gain.empty-title-scoped":"在{window}内没有 {project} 的节省记录","gain.empty-hint-all":"snapcompact 压缩工具输出后,节省量会显示在这里。","gain.empty-hint-longer-range":"请尝试更长的时间范围。","gain.saved-tokens":"节省的 Token","gain.saved-bytes":"节省的字节","gain.reduction":"节省比例","gain.reduction-title":"原始大小已知时,节省字节 ÷ 原始字节","gain.reduction-unknown":"未记录原始大小","gain.hits":"命中次数","gain.saved-per-hit":"每次命中节省","gain.savings-over-time":"节省趋势","gain.savings-over-time-description":"按本地日统计节省的 Token,以及累计总量","gain.saved-per-day":"每日节省","gain.cumulative":"累计","gain.by-source":"按来源","gain.by-source-description":"各子系统节省量","gain.source":"来源"}};var Ph={en:{"ui.table-shown-of":"{shown} of {total}","ui.show-fewer":"Show fewer","ui.retry":"Retry","ui.delta-new":"new","ui.json":"JSON","ui.trace":"Trace","ui.open-trace":"Open this request's session in the trace view","ui.status-ok":"OK","ui.section-timing":"Timing","ui.time-to-first-token":"Time to first token","ui.uncached-input":"Uncached input","ui.section-cost":"API-equivalent cost","ui.section-identity":"Identity","ui.stop-reason":"Stop reason","ui.api":"API","ui.session-file":"Session file","ui.stats-row":"Stats row"},"zh-CN":{"ui.table-shown-of":"已显示 {shown} / 共 {total}","ui.show-fewer":"收起","ui.retry":"重试","ui.delta-new":"新增","ui.json":"JSON 数据","ui.trace":"调用链","ui.open-trace":"在调用链视图中打开该请求的会话","ui.status-ok":"正常","ui.section-timing":"时间","ui.time-to-first-token":"首 Token 延迟","ui.uncached-input":"未缓存输入","ui.section-cost":"API 等价费用","ui.section-identity":"标识","ui.stop-reason":"停止原因","ui.api":"接口","ui.session-file":"会话文件","ui.stats-row":"统计行"}};var Uh={en:{},"zh-CN":{}};var qE={...wh.en,...Ch.en,...Th.en,...Ih.en,...Rh.en,...Ah.en,...Mh.en,...Dh.en,...Eh.en,...Nh.en,...qh.en,...Oh.en,...Bh.en,...zh.en,...Ph.en,...Uh.en},$T={id:"en",messages:qE};var OE={...wh["zh-CN"],...Ch["zh-CN"],...Th["zh-CN"],...Ih["zh-CN"],...Rh["zh-CN"],...Ah["zh-CN"],...Mh["zh-CN"],...Dh["zh-CN"],...Eh["zh-CN"],...Nh["zh-CN"],...qh["zh-CN"],...Oh["zh-CN"],...Bh["zh-CN"],...zh["zh-CN"],...Ph["zh-CN"],...Uh["zh-CN"]},XT={id:"zh-CN",messages:OE};function BE(){return globalThis.__ZETA_STATS_LOCALE__}var zE={en:$T.messages,"zh-CN":XT.messages},YT="zeta.stats.locale",ub=new Set,Hh="en";UE();function Or(){return Hh}function KT(r){return ub.add(r),()=>{ub.delete(r)}}function _h(r){return Hh=Lh(r),Hh}function QT(r){let l=_h(r);try{globalThis.localStorage?.setItem(YT,l)}catch{}for(let i of[...ub])i();return l}function PE(){try{let r=globalThis.localStorage?.getItem(YT);if(!r)return;let l=Lh(r);return l==="en"||l==="zh-CN"?l:void 0}catch{return}}function UE(){let r=PE();if(r)return _h(r);let l=BE();if(l)return _h(l);if(typeof navigator>"u")return"en";return _h(VT(navigator.languages))}function u(r,l){return jT(Hh,r,zE,l)}var ZT=60000,Fh=60*ZT,tn=24*Fh,db={"1h":{labelKey:"common.range-1h",windowKey:"common.window-1h",spanMs:Fh,bucketMs:5*ZT},"24h":{labelKey:"common.range-24h",windowKey:"common.window-24h",spanMs:tn,bucketMs:Fh},"7d":{labelKey:"common.range-7d",windowKey:"common.window-7d",spanMs:7*tn,bucketMs:tn},"30d":{labelKey:"common.range-30d",windowKey:"common.window-30d",spanMs:30*tn,bucketMs:tn},"90d":{labelKey:"common.range-90d",windowKey:"common.window-90d",spanMs:90*tn,bucketMs:tn},all:{labelKey:"common.range-all",windowKey:"common.window-all",spanMs:null,bucketMs:tn}},_E=1500,Zu=["1h","24h","7d","30d","90d","all"];function aa(r){return db[r]}var cb={hour:"2-digit",minute:"2-digit",hourCycle:"h23"},fb={month:"short",day:"numeric"},WT=new Map;function Bf(r,l){let i=Or(),c=`${i}:${r}`,f=WT.get(c);if(!f)f=new Intl.DateTimeFormat(i,l),WT.set(c,f);return f}function Ju(r,l){if(l<Fh)return Bf("hm",cb).format(r);if(l<tn)return Bf("mdhm",{...fb,...cb}).format(r);return Bf("md",fb).format(r)}function Gh(r,l){return l<tn?Bf("hm",cb).format(r):Bf("md",fb).format(r)}function oo(r,l,i=db[r].bucketMs,c=Date.now()){let f=i===tn,v=(h)=>f?new Date(h).setHours(0,0,0,0):Math.floor(h/i)*i,y=v(c),g=db[r].spanMs,m;if(g!==null)m=v(c-g);else{m=y;for(let h of l)if(h<m)m=h;m=v(m)}m=Math.max(m,v(y-(_E-1)*i));let b=[];for(let h=m;h<=y;)if(b.push(h),f){let S=new Date(h);S.setDate(S.getDate()+1),h=S.setHours(0,0,0,0)}else h+=i;return b}var JT=_(Ke(),1);function _n(){return JT.useSyncExternalStore(KT,Or,Or)}var zf=_(Ke(),1);class pb extends Error{status;endpoint;constructor(r,l,i){super(i);this.name="ApiError",this.status=r,this.endpoint=l}}async function tI(r,l){try{let i=await r.json();if(typeof i==="object"&&i!==null&&"error"in i&&typeof i.error==="string")return i.error}catch{}return`HTTP error ${r.status} on ${l}`}var eI=new WeakMap;async function Ia(r,l,i){let c=typeof i==="object"&&i!==null?eI.get(i):void 0,f=l;if(c){let m=new Headers(l?.headers);m.set("If-None-Match",c),f={...l,headers:m}}let v=await fetch(r,f);if(v.status===304&&c)return i;if(!v.ok)throw new pb(v.status,r,await tI(v,r));let y=await v.json(),g=v.headers.get("ETag");if(g&&typeof y==="object"&&y!==null)eI.set(y,g);return y}var mb={"X-Zeta-Stats-Action":"1"};async function aI(r="24h",l){return Ia(`/api/stats/overview?range=${encodeURIComponent(r)}`,{signal:l})}async function oI(r="24h",l){return Ia(`/api/stats/model-dashboard?range=${encodeURIComponent(r)}`,{signal:l})}async function rI(r="24h",l){return Ia(`/api/stats/costs?range=${encodeURIComponent(r)}`,{signal:l})}async function Vh(r=50,l){return Ia(`/api/stats/recent?limit=${r}`,{signal:l})}async function nI(r="24h",l=50,i){return Ia(`/api/stats/errors?range=${encodeURIComponent(r)}&limit=${l}`,{signal:i})}async function sI(r,l){return Ia(`/api/request/${r}`,{signal:l})}async function lI(r){let{closable:l}=await Ia("/api/close",{signal:r});return l}async function iI(){let l=await fetch("/api/close",{method:"POST",headers:mb});if(!l.ok)throw new pb(l.status,"/api/close",await tI(l,"/api/close"))}async function uI(){return Ia("/api/sync",{method:"POST"})}async function dI(r="24h",l){return Ia(`/api/stats/frustration?range=${encodeURIComponent(r)}`,{signal:l})}async function cI(r,l){return Ia(`/api/frustration/estimate?range=${encodeURIComponent(r)}`,{signal:l})}async function fI(r){return Ia(`/api/frustration/judge?range=${encodeURIComponent(r)}`,{method:"POST",headers:mb})}async function pI(){return Ia("/api/frustration/cancel",{method:"POST",headers:mb})}async function mI(r="24h",l){return Ia(`/api/stats/folders?range=${encodeURIComponent(r)}`,{signal:l})}async function hI(r){return Ia("/api/tracking/projects",{signal:r})}async function gI(r,l){return Ia(`/api/tracking?project=${encodeURIComponent(r)}`,{signal:l})}async function yI(r="24h",l,i){let c=new URLSearchParams({range:r});if(l)c.set("project",l);return Ia(`/api/stats/gain?${c}`,{signal:i})}async function vI(r="24h",l="all",i){return Ia(`/api/stats/spotlight?range=${encodeURIComponent(r)}&agent=${encodeURIComponent(l)}`,{signal:i})}async function xI(r,l){return Ia(`/api/stats/spotlight/session?file=${encodeURIComponent(r)}`,{signal:l})}async function bI(r="24h",l){return Ia(`/api/stats/tools?range=${encodeURIComponent(r)}`,{signal:l})}async function SI(r="24h",l){return Ia(`/api/stats/providers?range=${encodeURIComponent(r)}`,{signal:l})}async function hb(r,l,i){let c=new URLSearchParams({range:r});if(l!==null)c.set("provider",l);return Ia(`/api/stats/provider-windows?${c}`,{signal:i})}async function kI(r=100,l,i){let c=new URLSearchParams({limit:String(r)});if(l)c.set("q",l);return Ia(`/api/sessions?${c}`,{signal:i})}async function LI(r,l,i){return Ia(`/api/session/trace?file=${encodeURIComponent(r)}`,{signal:l,cache:"no-store"},i)}async function wI(r,l,i){return Ia(`/api/session/entry?file=${encodeURIComponent(r)}&id=${encodeURIComponent(l)}`,{signal:i})}var FE={phase:"idle",current:0,total:0,processed:0,lastSyncedAt:null,error:null};function GE(){uI().catch(()=>{})}var CI=null,TI=0,jh=0,Nl={sync:FE,indexingHours:0,connected:!1,requestSync:GE},yb=new Set;function II(r){return yb.add(r),()=>yb.delete(r)}function RI(){for(let r of yb)r()}function VE(r,l){return r.phase===l.phase&&r.current===l.current&&r.total===l.total&&r.processed===l.processed&&r.lastSyncedAt===l.lastSyncedAt&&r.error===l.error}function jE(r){if(CI!==r.version)CI=r.version,TI++;let l=Math.max(0,TI-1),i=r.indexingHours!==Nl.indexingHours||!VE(r.sync,Nl.sync);if(!i&&l===jh)return;if(jh=l,i)Nl={...Nl,sync:r.sync,indexingHours:r.indexingHours};RI()}function gb(r){if(r===Nl.connected)return;Nl={...Nl,connected:r},RI()}var $E=()=>Nl,XE=()=>jh,YE=()=>-1;function vb(){return jh}function AI({children:r}){return zf.useEffect(()=>{let l=new EventSource("/api/events");return l.onopen=()=>gb(!0),l.onerror=()=>gb(!1),l.onmessage=(i)=>jE(JSON.parse(i.data)),()=>{l.close(),gb(!1)}},[]),r}function $h(){return zf.useSyncExternalStore(II,$E)}function MI(r=!0){return zf.useSyncExternalStore(II,r?XE:YE)}var Xh=_(te(),1);function ct({tone:r="neutral",mono:l,children:i}){return Xh.jsxDEV("span",{className:"badge","data-tone":r,"data-mono":l??!1,children:i},void 0,!1,void 0,this)}function Hn({tone:r="neutral",pulse:l}){return Xh.jsxDEV("span",{className:"dot","data-tone":r,"data-pulse":l??!1},void 0,!1,void 0,this)}function an({color:r}){return Xh.jsxDEV("span",{className:"swatch",style:{background:r}},void 0,!1,void 0,this)}function hr(r){if(r>=0.05)return"bad";if(r>=0.01)return"warn";return"ok"}var Ko=_(te(),1);function fe({title:r,description:l,actions:i,flush:c,footer:f,className:v,index:y,stale:g,children:m}){let b=r!==void 0||l!==void 0||i!==void 0;return Ko.jsxDEV("section",{className:v?`card rise ${v}`:"card rise",style:y!==void 0?{"--i":y}:void 0,children:[b&&Ko.jsxDEV("header",{className:"card-header",children:[Ko.jsxDEV("div",{className:"card-titles",children:[r!==void 0&&Ko.jsxDEV("h2",{className:"card-title",children:r},void 0,!1,void 0,this),l!==void 0&&Ko.jsxDEV("p",{className:"card-description",children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i!==void 0&&Ko.jsxDEV("div",{className:"card-actions",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ko.jsxDEV("div",{className:"card-body","data-flush":c??!1,"data-stale":g??!1,children:m},void 0,!1,void 0,this),f!==void 0&&Ko.jsxDEV("footer",{className:"card-footer",children:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function la({title:r,description:l,actions:i}){return Ko.jsxDEV("header",{className:"page-header rise",children:[Ko.jsxDEV("div",{children:[Ko.jsxDEV("h1",{className:"page-title",children:r},void 0,!1,void 0,this),l!==void 0&&Ko.jsxDEV("p",{className:"page-description",children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i!==void 0&&Ko.jsxDEV("div",{className:"page-actions",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Pf=_(Ke(),1),DI=_(Wc(),1),bo=_(te(),1);function ed({open:r,onClose:l,title:i,subtitle:c,actions:f,width:v,children:y}){let g=Pf.useRef(l);g.current=l;let m=Pf.useRef(null);if(Pf.useEffect(()=>{if(!r)return;let b=document.activeElement instanceof HTMLElement?document.activeElement:null;m.current?.focus();let h=(S)=>{if(S.key==="Escape")S.preventDefault(),g.current()};return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h),b?.focus()}},[r]),!r)return null;return DI.createPortal(bo.jsxDEV(bo.Fragment,{children:[bo.jsxDEV("div",{className:"drawer-scrim",onClick:l,role:"presentation"},void 0,!1,void 0,this),bo.jsxDEV("div",{ref:m,className:"drawer",role:"dialog","aria-modal":"true",tabIndex:-1,style:v!==void 0?{"--drawer-w":`${v}px`}:void 0,children:[bo.jsxDEV("header",{className:"drawer-header",children:[bo.jsxDEV("div",{className:"drawer-titles",children:[bo.jsxDEV("h2",{className:"drawer-title",children:i},void 0,!1,void 0,this),c!==void 0&&bo.jsxDEV("div",{className:"drawer-subtitle",children:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f,bo.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-icon":"true",onClick:l,"aria-label":"Close",children:bo.jsxDEV(Ro,{size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bo.jsxDEV("div",{className:"drawer-body",children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),document.body)}function So({items:r}){return bo.jsxDEV("dl",{className:"kv",style:{margin:0},children:r.map((l)=>bo.jsxDEV("div",{className:"kv-item",children:[bo.jsxDEV("dt",{className:"kv-key",children:l.label},void 0,!1,void 0,this),bo.jsxDEV("dd",{className:"kv-value",style:{margin:0},children:l.value},void 0,!1,void 0,this)]},l.key,!0,void 0,this))},void 0,!1,void 0,this)}var Oi=_(Ke(),1);var on=_(te(),1);function td({data:r,title:l=u("ui.json"),initialCollapsed:i=!1}){let[c,f]=Oi.useState(i),[v,y]=Oi.useState(!1),g=Oi.useRef(0),m=JSON.stringify(r,null,2);return Oi.useEffect(()=>()=>window.clearTimeout(g.current),[]),on.jsxDEV("div",{className:"stack",style:{gap:6},children:[on.jsxDEV("div",{className:"row",style:{justifyContent:"space-between"},children:[on.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-size":"sm",onClick:()=>f((h)=>!h),"aria-expanded":!c,children:[c?on.jsxDEV(en,{size:13},void 0,!1,void 0,this):on.jsxDEV(Di,{size:13},void 0,!1,void 0,this),l]},void 0,!0,void 0,this),on.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-size":"sm",onClick:async()=>{try{await navigator.clipboard.writeText(m),y(!0),window.clearTimeout(g.current),g.current=window.setTimeout(()=>y(!1),1500)}catch{}},children:[v?on.jsxDEV(Mi,{size:13},void 0,!1,void 0,this):on.jsxDEV(Ei,{size:13},void 0,!1,void 0,this),v?u("common.copied"):u("common.copy")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!c&&on.jsxDEV("pre",{className:"code-block",children:on.jsxDEV("code",{children:m},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Bi=_(Ke(),1),EI=_(Wc(),1);var rn=_(te(),1);function NI({open:r,title:l,onClose:i,primaryAction:c,cancelLabel:f=u("common.cancel"),children:v}){let y=Bi.useRef(null),g=Bi.useRef(null),m=Bi.useRef(i);m.current=i,Bi.useEffect(()=>{if(!r)return;let L=document.activeElement instanceof HTMLElement?document.activeElement:null,I=(C)=>{if(C.key==="Escape")C.preventDefault(),m.current()};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I),L?.focus()}},[r]);let b=c!==void 0,h=c?.disabled??!1;if(Bi.useEffect(()=>{if(!r)return;(b&&!h?y.current:g.current)?.focus()},[r,b,h]),!r)return null;return EI.createPortal(rn.jsxDEV("div",{className:"modal-overlay",onClick:(L)=>{if(L.target===L.currentTarget)i()},role:"presentation",children:rn.jsxDEV("div",{className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[rn.jsxDEV("div",{className:"modal-header",children:[rn.jsxDEV("h2",{id:"modal-title",className:"modal-title",children:l},void 0,!1,void 0,this),rn.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-icon":"true","data-size":"sm",onClick:i,"aria-label":u("common.close"),children:rn.jsxDEV(Ro,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),rn.jsxDEV("div",{className:"modal-body",children:v},void 0,!1,void 0,this),rn.jsxDEV("div",{className:"modal-footer",children:[rn.jsxDEV("button",{ref:g,type:"button",className:"btn",onClick:i,children:f},void 0,!1,void 0,this),c&&rn.jsxDEV("button",{ref:y,type:"button",className:"btn","data-variant":"primary",onClick:c.onClick,disabled:c.disabled,children:c.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body)}var Yh=_(te(),1);function Fn({value:r,onChange:l,placeholder:i=u("common.filter"),label:c="Filter",width:f}){return Yh.jsxDEV("label",{className:"search",children:[Yh.jsxDEV(Nf,{size:14},void 0,!1,void 0,this),Yh.jsxDEV("input",{className:"input",type:"search","aria-label":c,value:r,placeholder:i,onChange:(v)=>l(v.target.value),style:f!==void 0?{width:f}:void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ad=_(Ke(),1),Kh=_(te(),1);function Oa({options:r,value:l,onChange:i,size:c="md","aria-label":f}){let v=ad.useRef(null),[y,g]=ad.useState(null);return ad.useLayoutEffect(()=>{let m=v.current,b=m?.querySelector('[data-active="true"]');if(!m||!b){g(null);return}let h=()=>g({left:b.offsetLeft,width:b.offsetWidth});h();let S=new ResizeObserver(h);return S.observe(m),()=>S.disconnect()},[l,r]),Kh.jsxDEV("div",{ref:v,className:"segmented","data-size":c,role:"radiogroup","aria-label":f,children:[y&&Kh.jsxDEV("span",{className:"segmented-thumb",style:{left:y.left,width:y.width}},void 0,!1,void 0,this),r.map((m)=>Kh.jsxDEV("button",{type:"button",role:"radio","aria-checked":m.value===l,className:"segmented-option","data-active":m.value===l,title:m.title,onClick:()=>i(m.value),children:m.label},m.value,!1,void 0,this))]},void 0,!0,void 0,this)}var nd=_(Ke(),1);var od=_(Ke(),1);function Qh(){let r=od.useRef(null),[l,i]=od.useState(0);return od.useLayoutEffect(()=>{let c=r.current;if(!c)return;i(c.clientWidth);let f=new ResizeObserver((v)=>{let y=Math.round(v[0]?.contentRect.width??0);i((g)=>g===y?g:y)});return f.observe(c),()=>f.disconnect()},[]),[r,l]}var Uf=_(te(),1);function rd({values:r,color:l="var(--chart-primary)",height:i=28,width:c,area:f=!0}){let[v,y]=Qh(),g=c??y,m=Math.max(0,...r),b=Math.min(0,...r),h=r.length,S="";if(g>0&&h>0){let L=h>1?g/(h-1):0;for(let I=0;I<h;I++){let C=h>1?I*L:g/2,T=m>b?i-2-(r[I]-b)/(m-b)*(i-4):i-2;S+=`${I===0?"M":"L"}${C.toFixed(1)},${T.toFixed(1)}`}}return Uf.jsxDEV("div",{ref:v,className:"sparkline",style:{width:c??"100%",height:i},children:g>0&&h>0&&Uf.jsxDEV("svg",{width:g,height:i,"aria-hidden":"true",children:[f&&Uf.jsxDEV("path",{className:"area",d:`${S}L${g},${i}L0,${i}Z`,fill:l},void 0,!1,void 0,this),Uf.jsxDEV("path",{className:"chart-line",d:S,stroke:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Br=_(te(),1);function ie({label:r,value:l,hint:i,delta:c,spark:f,sparkColor:v,size:y="md",title:g}){let m=WE(typeof l==="string"||typeof l==="number"?l:null);return Br.jsxDEV("div",{className:"stat","data-size":y,title:g,children:[Br.jsxDEV("div",{className:"stat-label",children:r},void 0,!1,void 0,this),Br.jsxDEV("div",{className:"stat-value","data-flash":m,children:l},void 0,!1,void 0,this),(i!==void 0||c)&&Br.jsxDEV("div",{className:"stat-foot",children:[c&&Br.jsxDEV(QE,{...c},void 0,!1,void 0,this),i!==void 0&&Br.jsxDEV("span",{className:"truncate",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f&&f.length>1&&Br.jsxDEV("div",{className:"stat-spark",children:Br.jsxDEV(rd,{values:f,color:v},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wa({min:r,children:l}){return Br.jsxDEV("div",{className:"stat-grid rise",style:r!==void 0?{"--stat-min":`${r}px`}:void 0,children:l},void 0,!1,void 0,this)}function QE({change:r,good:l="up"}){if(r===null||!Number.isFinite(r))return Br.jsxDEV("span",{className:"delta",children:"new"},void 0,!1,void 0,this);let i=Math.abs(r)<0.0005?0:r,c=i===0?void 0:i>0===(l==="up")?"good":"bad",f=i>0?"+":i<0?"−":"±",v=Math.abs(i)*100;return Br.jsxDEV("span",{className:"delta","data-tone":c,children:[f,v>=100?v.toFixed(0):v.toFixed(1),"%"]},void 0,!0,void 0,this)}function WE(r){let l=nd.useRef(r),[i,c]=nd.useState(!1);return nd.useEffect(()=>{if(l.current===r)return;let f=l.current!==null;if(l.current=r,!f)return;c(!0);let v=setTimeout(()=>c(!1),900);return()=>clearTimeout(v)},[r]),i}var Ba=_(te(),1);function Je({title:r=u("common.nothing-here-yet"),hint:l}){return Ba.jsxDEV("div",{className:"empty",children:[Ba.jsxDEV(kf,{size:20},void 0,!1,void 0,this),Ba.jsxDEV("div",{className:"empty-title",children:r},void 0,!1,void 0,this),l!==void 0&&Ba.jsxDEV("div",{className:"empty-hint",children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ql({error:r,onRetry:l}){return Ba.jsxDEV("div",{className:"error-state",role:"alert",children:[Ba.jsxDEV(Io,{size:15},void 0,!1,void 0,this),Ba.jsxDEV("span",{className:"error-state-message",children:typeof r==="string"?r:r.message},void 0,!1,void 0,this),l&&Ba.jsxDEV("button",{type:"button",className:"btn","data-size":"sm","data-variant":"ghost",onClick:l,children:[Ba.jsxDEV(Df,{size:13},void 0,!1,void 0,this)," ",u("ui.retry")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Fa({width:r="100%",height:l=14,style:i}){return Ba.jsxDEV("div",{className:"skeleton",style:{width:r,height:l,...i}},void 0,!1,void 0,this)}function qt({height:r=220}){return Ba.jsxDEV(Fa,{height:r,style:{borderRadius:8}},void 0,!1,void 0,this)}function pa({rows:r=6}){return Ba.jsxDEV("div",{style:{display:"flex",flexDirection:"column",gap:10,padding:"8px 16px 16px"},children:Array.from({length:r},(l,i)=>Ba.jsxDEV(Fa,{height:16,width:`${92-i*13%30}%`},i,!1,void 0,this))},void 0,!1,void 0,this)}function _e({query:r,skeleton:l,isEmpty:i,empty:c,children:f}){if(r.data===null){if(r.error)return Ba.jsxDEV(ql,{error:r.error,onRetry:r.refetch},void 0,!1,void 0,this);return Ba.jsxDEV(Ba.Fragment,{children:l},void 0,!1,void 0,this)}return Ba.jsxDEV(Ba.Fragment,{children:[r.error&&Ba.jsxDEV(ql,{error:r.error,onRetry:r.refetch},void 0,!1,void 0,this),i?.(r.data)?c??Ba.jsxDEV(Je,{},void 0,!1,void 0,this):f(r.data)]},void 0,!0,void 0,this)}var zi=_(Ke(),1);function BI(){return Or()}function A(r){return r.toLocaleString(BI())}function se(r){return r.toLocaleString("en",{notation:"compact"})}function zt(r,l){if(r===0)return"$0";let i=l!==void 0?l:r>0&&r<0.01?4:2;return`$${r.toLocaleString(BI(),{minimumFractionDigits:i,maximumFractionDigits:i})}`}function oa(r,l,i){return r===0&&l>0?"N/A":zt(r,i)}function bb(r){return r.usage.totalTokens>0&&r.usage.cost.total===0&&(r.provider==="xai-oauth"||r.costUnpriced===!0)}function Ol(r,l){return oa(r.usage.cost.total,bb(r)?1:0,l)}function Ge(r,l=1){return`${(r*100).toFixed(l)}%`}function Ao(r){let l=r*100;if(l>0&&l<0.005)return"<0.01%";return Ge(r,l>0&&l<0.1?2:1)}function Ct(r,l){if(r===null)return"-";let i=r/1000,c=l!==void 0?l:i<1?2:1;return`${i.toFixed(c)}s`}function gr(r){if(r<60000)return Ct(r);let l=Math.floor(r/60000);if(l<60)return`${l}m ${String(Math.floor(r%60000/1000)).padStart(2,"0")}s`;return`${Math.floor(l/60)}h ${String(l%60).padStart(2,"0")}m`}function Gn(r){if(r===null)return"-";return r.toFixed(1)}var xb=[["second",1000],["minute",60000],["hour",3600000],["day",86400000],["month",2629800000],["year",31557600000]],qI=new Map,sd=new Map;function ma(r,l=Date.now()){let i=Or(),c=qI.get(i);if(!c)c=new Intl.RelativeTimeFormat(i,{numeric:"auto"}),qI.set(i,c);let f=r-l,v=0;for(let m=1;m<xb.length;m++)if(Math.abs(f)>=xb[m][1])v=m;let[y,g]=xb[v];return c.format(Math.round(f/g),y)}function Sb(r){let l=Or(),i=`${l}:mdhm`,c=sd.get(i);if(!c)c=new Intl.DateTimeFormat(l,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),sd.set(i,c);return c.format(r)}function ro(r){let l=Or(),i=sd.get(l);if(!i)i=new Intl.DateTimeFormat(l,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),sd.set(l,i);return i.format(r)}var OI=new Map;function _f(r,l=!1){let i=Or(),c=`${i}:${l?"long":"short"}`,f=OI.get(c);if(!f)f=new Intl.DateTimeFormat(i,l?{weekday:"short",month:"short",day:"numeric",year:"numeric"}:{month:"short",day:"numeric"}),OI.set(c,f);return f.format(r)}function Hf(r){let l=Or(),i=`${l}:time`,c=sd.get(i);if(!c)c=new Intl.DateTimeFormat(l,{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),sd.set(i,c);return c.format(r)}function zr(r){return r.replace(/^\/+|\/+$/g,"")||u("common.root")}function kb(r){if(r>=1e9)return`${(r/1e9).toFixed(1)} GB`;if(r>=1e6)return`${(r/1e6).toFixed(1)} MB`;if(r>=1000)return`${(r/1000).toFixed(1)} KB`;return`${r} B`}var Vt=_(te(),1);function Ft({columns:r,rows:l,rowKey:i,onRowClick:c,selectedKey:f,initialSort:v,limit:y,dense:g,empty:m,expanded:b}){let[h,S]=zi.useState(v??null),[L,I]=zi.useState(y??Number.POSITIVE_INFINITY),C=zi.useMemo(()=>{let O=h?r.find((W)=>W.key===h.key):void 0;if(!h||!O?.sort)return l;let z=O.sort,Y=h.dir==="asc"?1:-1;return[...l].sort((W,ue)=>{let Z=z(W),ce=z(ue);if(typeof Z==="number"&&typeof ce==="number")return(Z-ce)*Y;return String(Z).localeCompare(String(ce))*Y})},[l,r,h]);if(l.length===0)return Vt.jsxDEV(Vt.Fragment,{children:m??Vt.jsxDEV(Je,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);let T=C.length>L?C.slice(0,L):C,R=(O)=>{if(!O.sort)return;S((z)=>z?.key===O.key?{key:O.key,dir:z.dir==="asc"?"desc":"asc"}:{key:O.key,dir:O.align==="right"?"desc":"asc"})};return Vt.jsxDEV(Vt.Fragment,{children:[Vt.jsxDEV("div",{className:"table-wrap",children:Vt.jsxDEV("table",{className:"table","data-dense":g??!1,children:[Vt.jsxDEV("thead",{children:Vt.jsxDEV("tr",{children:r.map((O)=>{let z=h?.key===O.key?h.dir:void 0;return Vt.jsxDEV("th",{"data-align":O.align??"left","data-sortable":O.sort!==void 0,"data-sorted":z,style:O.width!==void 0?{width:O.width}:void 0,title:O.title,onClick:()=>R(O),"aria-sort":z==="asc"?"ascending":z==="desc"?"descending":void 0,children:[O.header,z&&Vt.jsxDEV("span",{className:"sort-arrow",children:z==="asc"?Vt.jsxDEV(sf,{size:11},void 0,!1,void 0,this):Vt.jsxDEV(af,{size:11},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},O.key,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),Vt.jsxDEV("tbody",{children:T.map((O)=>{let z=i(O),Y=b?.(O)??null;return Vt.jsxDEV(zi.Fragment,{children:[Vt.jsxDEV("tr",{"data-clickable":c!==void 0,"data-selected":f===z,onClick:c?()=>c(O):void 0,onKeyDown:c?(W)=>{if(W.key==="Enter"||W.key===" ")W.preventDefault(),c(O)}:void 0,tabIndex:c?0:void 0,children:r.map((W)=>Vt.jsxDEV("td",{"data-align":W.align??"left","data-wrap":W.wrap??!1,children:W.render(O)},W.key,!1,void 0,this))},void 0,!1,void 0,this),Y!==null&&Vt.jsxDEV("tr",{children:Vt.jsxDEV("td",{colSpan:r.length,"data-wrap":"true",style:{padding:0},children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},z,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),y!==void 0&&C.length>y&&Vt.jsxDEV("div",{className:"table-more",children:[Vt.jsxDEV("span",{className:"micro",children:u("ui.table-shown-of",{shown:A(T.length),total:A(C.length)})},void 0,!1,void 0,this),C.length>L&&Vt.jsxDEV("button",{type:"button",className:"btn","data-size":"sm","data-variant":"ghost",onClick:()=>I((O)=>O+y*4),children:u("common.show-more")},void 0,!1,void 0,this),L>y&&Vt.jsxDEV("button",{type:"button",className:"btn","data-size":"sm","data-variant":"ghost",onClick:()=>I(y),children:u("ui.show-fewer")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ma({value:r,max:l,display:i,color:c}){let f=l>0?Math.min(100,r/l*100):0;return Vt.jsxDEV("div",{className:"meter-cell",children:[Vt.jsxDEV("span",{className:"num",children:i},void 0,!1,void 0,this),Vt.jsxDEV("div",{className:"meter",children:Vt.jsxDEV("div",{className:"meter-fill",style:{width:`${f}%`,background:c}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function co({primary:r,secondary:l,lead:i}){return Vt.jsxDEV("div",{className:"row",style:{gap:10},children:[i,Vt.jsxDEV("div",{className:"stack",style:{gap:0},children:[Vt.jsxDEV("span",{className:"cell-primary truncate",children:r},void 0,!1,void 0,this),l!==void 0&&Vt.jsxDEV("span",{className:"cell-secondary truncate",children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Ff=_(Ke(),1);function Wh(r){return r instanceof HTMLElement&&(r.isContentEditable||r.tagName==="INPUT"||r.tagName==="TEXTAREA"||r.tagName==="SELECT")}function Zh(){return document.querySelector('[aria-modal="true"]')!==null}var Jh=_(te(),1);function PI(){let r=ZE();if(Ff.useEffect(()=>{if(!r)return;let l=(i)=>{if(!JE(i))return;i.preventDefault(),zI()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[r]),!r)return null;return Jh.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost",onClick:zI,title:"Close the dashboard (Esc)",children:[Jh.jsxDEV(Ro,{size:15},void 0,!1,void 0,this),"Close",Jh.jsxDEV("span",{className:"kbd",children:"Esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zI(){iI().catch((r)=>console.error("Closing the dashboard failed",r))}function ZE(){let[r,l]=Ff.useState(!1);return Ff.useEffect(()=>{let i=new AbortController;return lI(i.signal).then(l,()=>{}),()=>i.abort()},[]),r}function JE(r){if(r.defaultPrevented||r.altKey||r.metaKey||r.shiftKey)return!1;if(Wh(r.target)||Zh())return!1;if(r.key==="Escape")return!r.ctrlKey;return r.ctrlKey&&r.key.toLowerCase()==="c"&&!window.getSelection()?.toString()}var eg=_(te(),1);function UI(){let r=_n(),l=r==="en"?"zh-CN":"en",i=r==="en"?"中文":"EN";return eg.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-locale-toggle":r,onClick:()=>QT(l),"aria-label":u("shell.switch-language"),title:`${u("shell.language")}: ${i}`,children:[eg.jsxDEV(Lf,{size:15},void 0,!1,void 0,this),eg.jsxDEV("span",{className:"topbar-locale-label",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var tg=_(Ke(),1);var ba=_(te(),1);function _I(){let{sync:r,indexingHours:l,connected:i,requestSync:c}=$h(),f=tN(r.phase==="idle"?15000:null),v,y;if(!i)v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(Hn,{tone:"warn"},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.reconnecting")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y=u("shell.lost-connection");else if(r.phase==="syncing")v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(El,{size:13,className:"spin"},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.syncing")},void 0,!1,void 0,this),r.total>0&&ba.jsxDEV("span",{className:"live-chip-count",children:[A(r.current),"/",A(r.total)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y=u("shell.ingesting");else if(r.phase==="error")v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(Hn,{tone:"bad"},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.sync-failed")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y=`${r.error??u("shell.sync-failed")} — click to retry`;else if(l>eN)v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(El,{size:13,className:"spin"},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.indexing")},void 0,!1,void 0,this),ba.jsxDEV("span",{className:"live-chip-count",children:[A(l),"h left"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y=u("shell.building-rollups");else v=ba.jsxDEV(ba.Fragment,{children:[ba.jsxDEV(Hn,{tone:"live",pulse:!0},void 0,!1,void 0,this),ba.jsxDEV("span",{children:u("shell.live")},void 0,!1,void 0,this),r.lastSyncedAt!==null&&ba.jsxDEV("span",{className:"live-chip-count",children:aN(f-r.lastSyncedAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y=u("shell.sync-now");return ba.jsxDEV("button",{type:"button",className:"live-chip",onClick:c,disabled:r.phase==="syncing",title:y,children:v},void 0,!1,void 0,this)}var eN=24;function tN(r){let[l,i]=tg.useState(Date.now);return tg.useEffect(()=>{if(r===null)return;i(Date.now());let c=setInterval(()=>i(Date.now()),r);return()=>clearInterval(c)},[r]),l}function aN(r){let l=Math.max(0,Math.round(r/1000));if(l<45)return u("shell.just-now");let i=Math.round(l/60);if(i<60)return`${i}m ago`;let c=Math.round(i/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}var ag=[{headingKey:"nav.usage",items:[{id:"overview",labelKey:"nav.overview",icon:wf,hotkey:"o"},{id:"models",labelKey:"nav.models",icon:pf,hotkey:"m"},{id:"providers",labelKey:"nav.providers",icon:Ml,hotkey:"p"},{id:"costs",labelKey:"nav.costs",icon:cf,hotkey:"c"}]},{headingKey:"nav.activity",items:[{id:"requests",labelKey:"nav.requests",icon:ef,hotkey:"r"},{id:"errors",labelKey:"nav.errors",icon:Zr,hotkey:"e"},{id:"traces",labelKey:"nav.traces",icon:Jr,hotkey:"t"}]},{headingKey:"nav.insights",items:[{id:"tools",labelKey:"nav.tools",icon:Ni,hotkey:"l"},{id:"frustration",labelKey:"nav.frustration",icon:Rl,hotkey:"f"},{id:"projects",labelKey:"nav.projects",icon:yf,hotkey:"j"},{id:"tracking",labelKey:"nav.tracking",icon:df,hotkey:"k"},{id:"gain",labelKey:"nav.gain",icon:Un,hotkey:"g"},{id:"spotlight",labelKey:"nav.spotlight",icon:ws,hotkey:"s"}]}],oN=ag.flatMap((r)=>r.items),HI=oN.map((r)=>r.id);var Lb=_(Ke(),1),GI="zeta-stats-theme",VI="(prefers-color-scheme: dark)";function rN(){if(typeof localStorage>"u")return"system";let r=localStorage.getItem(GI);return r==="light"||r==="dark"||r==="system"?r:"system"}function jI(){if(typeof window>"u")return"dark";return window.matchMedia(VI).matches?"dark":"light"}var Pi=rN(),og=Pi==="system"?jI():Pi,wb=new Set;function $I(){for(let r of wb)r()}function Cb(){if(og=Pi==="system"?jI():Pi,typeof document<"u")document.documentElement.dataset.theme=og,document.documentElement.style.colorScheme=og}if(typeof window<"u")Cb(),window.matchMedia(VI).addEventListener("change",()=>{if(Pi==="system")Cb(),$I()});function nN(r){if(Pi=r,typeof localStorage<"u")localStorage.setItem(GI,r);Cb(),$I()}function FI(r){return wb.add(r),()=>wb.delete(r)}function XI(){let r=Lb.useSyncExternalStore(FI,()=>Pi,()=>"system"),l=Lb.useSyncExternalStore(FI,()=>og,()=>"dark");return{preference:r,resolved:l,setPreference:nN}}var Tb=_(te(),1),sN={system:"light",light:"dark",dark:"system"},lN={system:"shell.system-theme",light:"shell.light-theme",dark:"shell.dark-theme"},iN={system:If,light:qf,dark:Rf};function YI(){_n();let{preference:r,setPreference:l}=XI(),i=iN[r],c=u(lN[r]);return Tb.jsxDEV("button",{type:"button",className:"btn","data-variant":"ghost","data-icon":"true",onClick:()=>l(sN[r]),"aria-label":`${c} (click to switch)`,title:`${c} — click to switch`,children:Tb.jsxDEV(i,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var st=_(te(),1);function KI({section:r,onSectionChange:l,range:i,onRangeChange:c,children:f}){_n();let v=Zu.map((L,I)=>({value:L,label:u(aa(L).labelKey),title:`${u(aa(L).windowKey)} (${I+1})`})),[y,g]=ld.useState(!1),m=uN(),{sync:b}=$h();dN(l,c);let h=(L)=>{l(L),g(!1),window.scrollTo({top:0})},S=b.phase==="syncing"?b.total>0?b.current/b.total:null:void 0;return st.jsxDEV(st.Fragment,{children:[st.jsxDEV("div",{className:"shell-ambient"},void 0,!1,void 0,this),st.jsxDEV("header",{className:"topbar","data-scrolled":m,children:[st.jsxDEV("button",{type:"button",className:"btn topbar-menu","data-variant":"ghost","data-icon":"true",onClick:()=>g(!0),"aria-label":u("nav.open-navigation"),children:st.jsxDEV(Tf,{size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),st.jsxDEV("div",{className:"topbar-brand",children:[st.jsxDEV("svg",{className:"topbar-mark",viewBox:"0 0 64 64",width:"22",height:"22","aria-hidden":"true",children:[st.jsxDEV("defs",{children:st.jsxDEV("linearGradient",{id:"zeta-mark-grad",x1:"0",y1:"0",x2:"1",y2:"1",children:[st.jsxDEV("stop",{offset:"0",stopColor:"oklch(0.7 0.24 340)"},void 0,!1,void 0,this),st.jsxDEV("stop",{offset:".5",stopColor:"oklch(0.62 0.21 295)"},void 0,!1,void 0,this),st.jsxDEV("stop",{offset:"1",stopColor:"oklch(0.81 0.14 200)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),st.jsxDEV("text",{x:"32",y:"47",textAnchor:"middle",fontSize:"52",fontWeight:"700",fontFamily:"Georgia, 'Times New Roman', serif",fill:"url(#zeta-mark-grad)",children:"ζ"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),st.jsxDEV("span",{children:"zeta"},void 0,!1,void 0,this),st.jsxDEV("span",{className:"topbar-slash",children:"/"},void 0,!1,void 0,this),st.jsxDEV("span",{className:"topbar-title",children:u("nav.breadcrumb-stats")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),st.jsxDEV("div",{className:"topbar-spacer"},void 0,!1,void 0,this),st.jsxDEV("div",{className:"topbar-actions",children:[st.jsxDEV("span",{className:"topbar-hide-narrow",children:st.jsxDEV(_I,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),st.jsxDEV(Oa,{options:v,value:i,onChange:c,"aria-label":u("common.time-range")},void 0,!1,void 0,this),st.jsxDEV(UI,{},void 0,!1,void 0,this),st.jsxDEV(YI,{},void 0,!1,void 0,this),st.jsxDEV(PI,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S!==void 0&&st.jsxDEV("div",{className:"topbar-progress",children:st.jsxDEV("div",{className:"topbar-progress-fill","data-indeterminate":S===null,style:{width:`${(S??0)*100}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y&&st.jsxDEV("div",{className:"drawer-scrim",onClick:()=>g(!1),role:"presentation"},void 0,!1,void 0,this),st.jsxDEV("nav",{className:"sidebar","data-open":y,"aria-label":u("nav.pages"),children:[ag.map((L)=>st.jsxDEV("div",{className:"nav-group",children:[st.jsxDEV("div",{className:"nav-heading",children:u(L.headingKey)},void 0,!1,void 0,this),L.items.map((I)=>st.jsxDEV("button",{type:"button",className:"nav-row","data-active":I.id===r,"aria-current":I.id===r?"page":void 0,onClick:()=>h(I.id),children:[st.jsxDEV(I.icon,{size:15},void 0,!1,void 0,this),st.jsxDEV("span",{className:"nav-row-label",children:u(I.labelKey)},void 0,!1,void 0,this),st.jsxDEV("kbd",{children:["G ",I.hotkey.toUpperCase()]},void 0,!0,void 0,this)]},I.id,!0,void 0,this))]},L.headingKey,!0,void 0,this)),st.jsxDEV("div",{className:"sidebar-foot micro",children:[st.jsxDEV("span",{children:[st.jsxDEV("span",{className:"kbd",children:"1"},void 0,!1,void 0,this),"–",st.jsxDEV("span",{className:"kbd",children:"6"},void 0,!1,void 0,this)," ",u("shell.range-suffix")]},void 0,!0,void 0,this),st.jsxDEV("span",{children:[st.jsxDEV("span",{className:"kbd",children:"G"},void 0,!1,void 0,this)," ",u("shell.jump-hint")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),st.jsxDEV("main",{className:"shell-panel",children:st.jsxDEV("div",{className:"shell-content",children:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function uN(){let[r,l]=ld.useState(!1);return ld.useEffect(()=>{let i=()=>l(window.scrollY>4);return i(),window.addEventListener("scroll",i,{passive:!0}),()=>window.removeEventListener("scroll",i)},[]),r}function dN(r,l){ld.useEffect(()=>{let i=0,c=(f)=>{if(f.metaKey||f.ctrlKey||f.altKey||f.defaultPrevented)return;if(Wh(f.target)||Zh())return;let v=f.key.toLowerCase();if(i&&Date.now()-i<1200){i=0;let g=ag.flatMap((m)=>m.items).find((m)=>m.hotkey===v);if(g)f.preventDefault(),r(g.id),window.scrollTo({top:0});return}if(v==="g"){i=Date.now();return}let y=Number(v)-1;if(Number.isInteger(y)&&y>=0&&y<Zu.length)f.preventDefault(),l(Zu[y])};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r,l])}var Cs=_(Ke(),1);function Gf(r){let[l,i]=r.replace(/^#\/?/,"").split("?"),c=HI.includes(l)?l:"overview",f=new URLSearchParams(i??""),v=f.get("range"),y=Zu.includes(v??"")?v:"24h";return{section:c,range:y,session:f.get("s")}}function rg({section:r,range:l,session:i}){let c=i?`&s=${encodeURIComponent(i)}`:"";return`#/${r}?range=${l}${c}`}function QI(){let[r,l]=Cs.useState(()=>Gf(window.location.hash));Cs.useEffect(()=>{let y=()=>l(Gf(window.location.hash));window.addEventListener("hashchange",y),window.addEventListener("popstate",y);let g=rg(Gf(window.location.hash));if(window.location.hash!==g)history.replaceState(null,"",g);return()=>{window.removeEventListener("hashchange",y),window.removeEventListener("popstate",y)}},[]);let i=Cs.useCallback((y)=>{l(y);let g=rg(y);if(window.location.hash!==g)history.pushState(null,"",g)},[]),c=Cs.useCallback((y)=>i({...r,section:y,session:y==="traces"?r.session:null}),[r,i]),f=Cs.useCallback((y)=>i({...r,range:y}),[r,i]),v=Cs.useCallback((y)=>i({...r,session:y}),[r,i]);return{...r,setSection:c,setRange:f,setSession:v}}var jf=_(Ke(),1);var Vn=_(te(),1);function Ts({items:r,max:l,onSelect:i}){let c=l??Math.max(0,...r.map((f)=>f.value));return Vn.jsxDEV("div",{className:"bar-list",children:r.map((f)=>{let v=c>0?Math.max(0.5,f.value/c*100):0,y=Vn.jsxDEV(Vn.Fragment,{children:[Vn.jsxDEV("span",{className:"bar-list-fill",style:{width:`${v}%`,background:f.color??"var(--chart-primary)"}},void 0,!1,void 0,this),Vn.jsxDEV("span",{className:"bar-list-label",children:f.label},void 0,!1,void 0,this),Vn.jsxDEV("span",{className:"bar-list-value",children:f.display??A(f.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return i?Vn.jsxDEV("button",{type:"button",className:"bar-list-row",onClick:()=>i(f.key),children:y},f.key,!1,void 0,this):Vn.jsxDEV("div",{className:"bar-list-row",children:y},f.key,!1,void 0,this)})},void 0,!1,void 0,this)}var Rs=_(Ke(),1);var ft=_(te(),1),Is=10,cN=24,fN=68,pN=4;function yr({slots:r,tickLabel:l,tooltipTitle:i,series:c,kind:f="bars",stacked:v=!0,height:y=220,format:g=se,formatRight:m,formatTooltip:b,yMax:h,yMaxRight:S,hidden:L,showTotal:I,references:C,markers:T,onSelect:R,emptyLabel:O="No data in this range",tooltipExtra:z}){let[Y,W]=Qh(),[ue,Z]=Rs.useState(null),ce=Rs.useId().replace(/:/g,""),ee=Rs.useMemo(()=>c.filter((j)=>!L?.has(j.key)),[c,L]),G=Rs.useMemo(()=>{let j=ee.filter((Bt)=>Bt.axis!=="right"),We=ee.filter((Bt)=>Bt.axis==="right"),H=(Bt)=>{let ga=Bt.kind??f;return v&&(ga==="bars"||ga==="area")},we=new Map,he=Array.from({length:r},()=>0),it=Array.from({length:r},()=>0),ze=0,ke=0;for(let Bt of j)if(H(Bt)){let ga=Array.from({length:r},()=>0);for(let mo=0;mo<r;mo++){let Ul=Bt.values[mo]??0;if(Ul<0)ga[mo]=it[mo],it[mo]+=Ul;else ga[mo]=he[mo],he[mo]+=Ul}we.set(Bt.key,ga)}else for(let ga=0;ga<r;ga++)ze=Math.max(ze,Bt.values[ga]??0),ke=Math.min(ke,Bt.values[ga]??0);for(let Bt=0;Bt<r;Bt++)ze=Math.max(ze,he[Bt]),ke=Math.min(ke,it[Bt]);let Qt=0,qe=0;for(let Bt of We)for(let ga=0;ga<r;ga++)Qt=Math.max(Qt,Bt.values[ga]??0),qe=Math.min(qe,Bt.values[ga]??0);for(let Bt of C??[])if(Bt.axis==="right")Qt=Math.max(Qt,Bt.value);else ze=Math.max(ze,Bt.value);let Ea=ng(h??ze,ke),Wt=We.length>0?ng(S??Qt,qe):null,ji=ee.every((Bt)=>Bt.values.every((ga)=>!ga));return{left:j,right:We,bases:we,stackable:H,leftScale:Ea,rightScale:Wt,empty:ji}},[ee,r,v,f,h,S,C]),V=G.leftScale.ticks.map((j)=>g(j)),Ie=G.rightScale?.ticks.map((j)=>(m??g)(j))??[],pe=Math.max(28,WI(V)+12),Ne=G.rightScale?Math.max(28,WI(Ie)+12):8,Ce=Math.max(0,W-pe-Ne),oe=y-Is-cN,Se=r>0?Ce/r:0,De=(j,We)=>Is+oe-(We-j.min)/(j.max-j.min)*oe,Qe=(j)=>De(G.leftScale,j),yt=(j)=>G.rightScale?De(G.rightScale,j):Qe(j),Q=(j)=>pe+(j+0.5)*Se,Fe=ee.filter((j)=>(j.kind??f)==="bars"),It=Fe.filter((j)=>!G.stackable(j)||j.axis==="right"),St=Math.max(1,Math.min(56,Se*(Se>6?0.72:0.9))),ge=Math.max(1,Math.ceil(r/Math.max(1,Math.floor(Ce/fN)))),Ye=(j)=>{let We=j.currentTarget.getBoundingClientRect(),H=Math.floor((j.clientX-We.left)/(We.width/r));Z(H>=0&&H<r?H:null)},He=ue===null?[]:ee.filter((j)=>j.tooltip!==!1).map((j)=>({s:j,v:j.values[ue]})).filter((j)=>j.v!==null&&j.v!==void 0&&(j.v!==0||ee.length===1)).sort((j,We)=>ee.length>1?We.v-j.v:0),ua=He.filter((j)=>j.s.axis!=="right").reduce((j,We)=>j+We.v,0),da=I??(v&&G.left.length>1);return ft.jsxDEV("div",{className:"chart",ref:Y,"data-hovering":ue!==null,style:{height:y},children:[W>0&&ft.jsxDEV("svg",{width:W,height:y,role:"img",children:[ft.jsxDEV("defs",{children:ee.filter((j)=>j.pattern==="hatch").map((j)=>ft.jsxDEV("pattern",{id:`${ce}-${Ib(j.key)}`,width:"5",height:"5",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[ft.jsxDEV("rect",{width:"5",height:"5",fill:j.color,fillOpacity:"0.14"},void 0,!1,void 0,this),ft.jsxDEV("rect",{width:"1.6",height:"5",fill:j.color},void 0,!1,void 0,this)]},j.key,!0,void 0,this))},void 0,!1,void 0,this),ft.jsxDEV("g",{className:"chart-grid",children:G.leftScale.ticks.map((j)=>ft.jsxDEV("line",{x1:pe,x2:pe+Ce,y1:Qe(j),y2:Qe(j)},j,!1,void 0,this))},void 0,!1,void 0,this),ft.jsxDEV("g",{className:"chart-axis",children:[G.leftScale.ticks.map((j,We)=>ft.jsxDEV("text",{x:pe-8,y:Qe(j),dy:"0.32em",textAnchor:"end",children:V[We]},j,!1,void 0,this)),G.rightScale?.ticks.map((j,We)=>ft.jsxDEV("text",{x:pe+Ce+8,y:yt(j),dy:"0.32em",textAnchor:"start",children:Ie[We]},j,!1,void 0,this)),Array.from({length:r},(j,We)=>We%ge===0?ft.jsxDEV("text",{x:Q(We),y:y-6,textAnchor:"middle",children:l(We)},We,!1,void 0,this):null)]},void 0,!0,void 0,this),ue!==null&&ft.jsxDEV("rect",{className:"chart-cursor",x:pe+ue*Se,y:Is,width:Se,height:oe},void 0,!1,void 0,this),ee.filter((j)=>(j.kind??f)==="area").map((j)=>{let We=j.axis==="right"?yt:Qe,H=G.bases.get(j.key),we=(ke)=>(H?.[ke]??0)+(j.values[ke]??0),he=ZI(r,Q,(ke)=>We(we(ke))),it=Array.from({length:r},(ke,Qt)=>r-1-Qt).map((ke)=>`L${Q(ke).toFixed(1)},${We(H?.[ke]??0).toFixed(1)}`).join(""),ze=j.pattern==="hatch"?`url(#${ce}-${Ib(j.key)})`:j.color;return ft.jsxDEV("g",{children:[ft.jsxDEV("path",{d:`${he}${it}Z`,fill:ze,fillOpacity:j.pattern?1:0.2},void 0,!1,void 0,this),ft.jsxDEV("path",{className:"chart-line",d:he,stroke:j.color,strokeDasharray:j.dashed?"4 3":void 0},void 0,!1,void 0,this)]},j.key,!0,void 0,this)}),Fe.map((j)=>{let We=j.axis==="right"?yt:Qe,H=G.bases.get(j.key),we=It.indexOf(j),he=we>=0?St/It.length:St,it=j.pattern==="hatch"?`url(#${ce}-${Ib(j.key)})`:j.color;return ft.jsxDEV("g",{children:j.values.map((ze,ke)=>{if(!ze)return null;let Qt=we>=0?0:H?.[ke]??0,qe=We(Qt),Ea=We(Qt+ze),Wt=Q(ke)-St/2+(we>=0?we*he:0);return ft.jsxDEV("rect",{className:"chart-bar","data-hover":ue===ke,x:Wt,y:Math.min(qe,Ea),width:Math.max(1,he-(we>=0&&It.length>1?1:0)),height:Math.max(ze>0?1:0,Math.abs(qe-Ea)),fill:it},ke,!1,void 0,this)})},j.key,!1,void 0,this)}),ee.filter((j)=>(j.kind??f)==="line").map((j)=>{let We=j.axis==="right"?yt:Qe,H=(we)=>{let he=j.values[we];return he===null||he===void 0?null:We(he)};return ft.jsxDEV("g",{children:[ft.jsxDEV("path",{className:"chart-line",d:ZI(r,Q,H),stroke:j.color,strokeDasharray:j.dashed?"4 3":void 0},void 0,!1,void 0,this),j.values.map((we,he)=>{let it=H(he);if(it===null||he>0&&H(he-1)!==null||he<r-1&&H(he+1)!==null)return null;return ft.jsxDEV("circle",{cx:Q(he),cy:it,r:2.5,fill:j.color},he,!1,void 0,this)})]},j.key,!0,void 0,this)}),ee.filter((j)=>(j.kind??f)==="dots").map((j)=>{let We=j.axis==="right"?yt:Qe;return ft.jsxDEV("g",{className:"chart-dots",fill:j.color,children:j.values.map((H,we)=>H===null||H===void 0?null:ft.jsxDEV("circle",{cx:Q(we),cy:We(H),r:ue===we?3.5:2.5},we,!1,void 0,this))},j.key,!1,void 0,this)}),T?.map((j)=>j.index>=0&&j.index<r?ft.jsxDEV("g",{className:"chart-marker",children:[ft.jsxDEV("line",{x1:Q(j.index),x2:Q(j.index),y1:Is,y2:Is+oe},void 0,!1,void 0,this),j.label&&ft.jsxDEV("text",{x:Q(j.index)+(Q(j.index)>pe+Ce/2?-5:5),y:Is+9,textAnchor:Q(j.index)>pe+Ce/2?"end":"start",children:j.label},void 0,!1,void 0,this)]},`marker:${j.index}`,!0,void 0,this):null),C?.map((j)=>{let We=j.axis==="right"?yt(j.value):Qe(j.value);return ft.jsxDEV("g",{className:"chart-axis",children:[ft.jsxDEV("line",{x1:pe,x2:pe+Ce,y1:We,y2:We,stroke:"var(--line-4)",strokeDasharray:"3 3"},void 0,!1,void 0,this),j.label&&ft.jsxDEV("text",{x:pe+Ce-4,y:We-5,textAnchor:"end",children:j.label},void 0,!1,void 0,this)]},`${j.axis??"left"}:${j.value}`,!0,void 0,this)}),ft.jsxDEV("line",{className:"chart-baseline",x1:pe,x2:pe+Ce,y1:Qe(0),y2:Qe(0)},void 0,!1,void 0,this),ft.jsxDEV("rect",{x:pe,y:Is,width:Ce,height:oe,fill:"transparent",onPointerMove:Ye,onPointerLeave:()=>Z(null),onClick:R&&ue!==null?()=>R(ue):void 0,style:{cursor:R?"pointer":"crosshair"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.empty&&ft.jsxDEV("div",{className:"chart-empty",children:O},void 0,!1,void 0,this),ue!==null&&!G.empty&&ft.jsxDEV("div",{className:"chart-tooltip",style:Q(ue)>W/2?{right:W-Q(ue)+Math.min(Se/2,24)+8,top:Is}:{left:Q(ue)+Math.min(Se/2,24)+8,top:Is},children:[ft.jsxDEV("div",{className:"chart-tooltip-title",children:(i??l)(ue)},void 0,!1,void 0,this),He.map(({s:j,v:We})=>ft.jsxDEV("div",{className:"chart-tooltip-row",children:[ft.jsxDEV("span",{className:"swatch",style:{background:j.color}},void 0,!1,void 0,this),ft.jsxDEV("span",{className:"chart-tooltip-label",children:j.label},void 0,!1,void 0,this),ft.jsxDEV("span",{className:"chart-tooltip-value",children:j.axis==="right"?(m??g)(We):(b??g)(We)},void 0,!1,void 0,this)]},j.key,!0,void 0,this)),da&&He.length>1&&ft.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[ft.jsxDEV("span",{className:"chart-tooltip-label",children:"Total"},void 0,!1,void 0,this),ft.jsxDEV("span",{className:"chart-tooltip-value",children:(b??g)(ua)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&ft.jsxDEV(Rs.Fragment,{children:z(ue)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ng(r,l=0){let i=Math.max(0,r),c=Math.min(0,l);if(!(i-c>0))return{min:0,max:1,ticks:[0]};let f=(i-c)/pN,v=10**Math.floor(Math.log10(f)),y=[1,2,2.5,5,10].map((h)=>h*v).find((h)=>h>=f)??10*v,g=Math.ceil(i/y)*y,m=Math.floor(c/y)*y,b=[];for(let h=m;h<=g+y/2;h+=y)b.push(Number(h.toPrecision(12)));return{min:m,max:g>m?g:m+y,ticks:b}}function WI(r){return r.reduce((l,i)=>Math.max(l,i.length*6.3),0)}function ZI(r,l,i){let c="",f=!1;for(let v=0;v<r;v++){let y=i(v);if(y===null){f=!1;continue}c+=`${f?"L":"M"}${l(v).toFixed(1)},${y.toFixed(1)}`,f=!0}return c}function Ib(r){return r.replace(/[^a-zA-Z0-9_-]/g,"_")}var Ga=_(te(),1);function sg({rows:r,guides:l,band:i,format:c,formatTick:f}){let v=0,y=0,g=(I)=>{if(I===null)return;v=Math.max(v,I),y=Math.min(y,I)};for(let I of r)for(let C of I.marks)g(C.value),g(C.lo),g(C.hi);for(let I of l??[])g(I.value);if(i)g(i.lo),g(i.hi);let m=ng(v,y),b=m.max-m.min,h=(I)=>(Math.min(m.max,Math.max(m.min,I))-m.min)/b*100,S=(I)=>`${h(I)}%`,L=Ga.jsxDEV(Ga.Fragment,{children:[i&&Ga.jsxDEV("span",{className:"dw-band",style:{left:S(i.lo),width:`${h(i.hi)-h(i.lo)}%`,"--band":i.color}},void 0,!1,void 0,this),l?.map((I)=>Ga.jsxDEV("span",{className:"dw-guide",style:{left:S(I.value),"--guide":I.color}},I.key,!1,void 0,this))]},void 0,!0,void 0,this);return Ga.jsxDEV("div",{className:"dw",children:[r.map((I)=>{let C=I.marks[0],T=C!==void 0&&C.lo!==null&&C.hi!==null?`${c(C.lo)}–${c(C.hi)}`:"";return Ga.jsxDEV("div",{className:"dw-row",children:[Ga.jsxDEV("div",{className:"dw-label",children:I.label},void 0,!1,void 0,this),Ga.jsxDEV("div",{className:"dw-track",children:[L,I.marks.map((R)=>Ga.jsxDEV("span",{className:"dw-mark","data-shape":R.shape??"dot",style:{"--dot":R.color,"--dy":`${R.offset??0}px`},children:[R.lo!==null&&R.hi!==null&&Ga.jsxDEV("span",{className:"dw-whisker",style:{left:S(R.lo),width:`${h(R.hi)-h(R.lo)}%`}},void 0,!1,void 0,this),R.value!==null&&Ga.jsxDEV("span",{className:"dw-dot",style:{left:S(R.value)},title:R.title},void 0,!1,void 0,this)]},R.key,!0,void 0,this))]},void 0,!0,void 0,this),Ga.jsxDEV("div",{className:"dw-value",children:[Ga.jsxDEV("span",{className:"num",children:I.figure??(C?.value===null||C===void 0?"–":c(C.value))},void 0,!1,void 0,this),Ga.jsxDEV("span",{className:"dw-detail",children:I.detail??T},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},I.key,!0,void 0,this)}),Ga.jsxDEV("div",{className:"dw-row dw-axis","aria-hidden":"true",children:[Ga.jsxDEV("div",{},void 0,!1,void 0,this),Ga.jsxDEV("div",{className:"dw-track",children:m.ticks.map((I)=>Ga.jsxDEV("span",{className:"dw-tick",style:{left:S(I)},children:(f??c)(I)},I,!1,void 0,this))},void 0,!1,void 0,this),Ga.jsxDEV("div",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var lg=_(Ke(),1),jn=_(te(),1);function ia({items:r,hidden:l,onToggle:i}){return jn.jsxDEV("div",{className:"legend",children:r.map((c)=>{let f=jn.jsxDEV(jn.Fragment,{children:[jn.jsxDEV("span",{className:"swatch",style:{background:c.color}},void 0,!1,void 0,this),jn.jsxDEV("span",{className:"truncate",children:c.label},void 0,!1,void 0,this),c.value&&jn.jsxDEV("span",{className:"legend-value",children:c.value},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return i?jn.jsxDEV("button",{type:"button",className:"legend-item","data-off":l?.has(c.key)??!1,onClick:()=>i(c.key),title:c.label,children:f},c.key,!1,void 0,this):jn.jsxDEV("span",{className:"legend-item",title:c.label,children:f},c.key,!1,void 0,this)})},void 0,!1,void 0,this)}function Pr(){let[r,l]=lg.useState(()=>new Set),i=lg.useCallback((c)=>{l((f)=>{let v=new Set(f);if(!v.delete(c))v.add(c);return v})},[]);return[r,i]}var Rb=_(te(),1);function $n({segments:r,height:l=8}){let i=r.reduce((c,f)=>c+Math.max(0,f.value),0);return Rb.jsxDEV("div",{className:"share-bar",style:{height:l},role:"img",children:i>0&&r.filter((c)=>c.value>0).map((c)=>Rb.jsxDEV("div",{className:"share-bar-seg",style:{flexGrow:c.value/i,background:c.color},title:`${c.label}: ${(c.value/i*100).toFixed(1)}%`},c.key,!1,void 0,this))},void 0,!1,void 0,this)}var JI=_(te(),1);function _o({buckets:r,bucketMs:l,onSelectBucket:i,...c}){return JI.jsxDEV(yr,{...c,slots:r.length,tickLabel:(f)=>Gh(r[f],l),tooltipTitle:(f)=>Ju(r[f],l),onSelect:i?(f)=>i(r[f]):void 0},void 0,!1,void 0,this)}var nn=_(te(),1);function e2({steps:r,format:l}){let i=0,c=r.map((m)=>{let b=i;if(m.kind==="total")return i=m.value,{...m,from:0,to:m.value,before:b};return i+=m.value,{...m,from:b,to:i,before:b}}),f=0,v=0;for(let m of c)f=Math.min(f,m.from,m.to),v=Math.max(v,m.from,m.to);let y=v-f||1,g=(m)=>(m-f)/y*100;return nn.jsxDEV("ol",{className:"waterfall",children:c.map((m,b)=>{let h=g(Math.min(m.from,m.to)),S=Math.abs(g(m.to)-g(m.from)),L=m.kind==="delta"?m.value<0?"−":"+":m.value<0?"−":"";return nn.jsxDEV("li",{className:"waterfall-row","data-kind":m.kind,title:m.title,children:[nn.jsxDEV("span",{className:"waterfall-label",children:m.label},void 0,!1,void 0,this),nn.jsxDEV("span",{className:"waterfall-track",children:[f<0&&nn.jsxDEV("span",{className:"waterfall-zero",style:{left:`${g(0)}%`}},void 0,!1,void 0,this),b>0&&nn.jsxDEV("span",{className:"waterfall-link",style:{left:`${g(m.before)}%`}},void 0,!1,void 0,this),nn.jsxDEV("span",{className:"waterfall-bar","data-empty":m.value===0,style:{left:`${h}%`,width:`${S}%`,"--bar":m.color}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),nn.jsxDEV("span",{className:"waterfall-value",children:[nn.jsxDEV("span",{className:"num",children:[L,l(Math.abs(m.value))]},void 0,!0,void 0,this),m.note!==void 0&&nn.jsxDEV("span",{className:"waterfall-note",children:m.note},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},m.key,!0,void 0,this)})},void 0,!1,void 0,this)}var Za=["#5ad8e6","#ed4abf","#9d7bff","#f5b54a","#4ade80","#5b8cff","#ff7a59","#2dd4bf","#c3e94f","#fb7185"],Mo="#6c6c74";function Va(r,l){return`${r}::${l}`}function ig(r){return Vf(r.map((l)=>({key:Va(l.model,l.provider),weight:l.totalRequests})))}function Vf(r){let l=[...r].sort((i,c)=>c.weight-i.weight||i.key.localeCompare(c.key));return new Map(l.map((i,c)=>[i.key,Za[c%Za.length]]))}function ug(r){return r instanceof Error?r:Error(String(r))}var za=_(Ke(),1);var mN={entries:new Map,limit:128},hN={entries:new Map,limit:4},gN={entries:new Map,limit:16},Ui=new Map;function t2(r){if(r.startsWith('["trace",'))return hN;if(r.startsWith('["request",'))return gN;return mN}function id(r){return t2(r).entries.get(r)}function a2(r){return Ui.get(r)}function yN(r,l){let{entries:i,limit:c}=t2(r);if(i.delete(r),i.set(r,l),i.size>c){let f=i.keys().next().value;if(f!==void 0)i.delete(f)}}function o2(r,l,i){let c=Ui.get(r);if(c)return c.waiters++,c;let f=new AbortController,v=id(r)?.data,y={promise:i({signal:f.signal},v).then((g)=>(yN(r,{data:g,updatedAt:Date.now(),version:l}),g)).finally(()=>{if(Ui.get(r)===y)Ui.delete(r)}),controller:f,waiters:1};return Ui.set(r,y),y}function Ab(r,l){if(l.waiters--,l.waiters>0)return;if(Ui.get(r)===l)Ui.delete(r);l.controller.abort()}var vN=1500;function Pt(r,l,i){let c=JSON.stringify(r),f=i?.enabled??!0,v=i?.pollMs,y=MI(f),[,g]=za.useReducer((G)=>G+1,0),[m,b]=za.useReducer((G)=>G+1,0),[h,S]=za.useState(null),[L,I]=za.useState(!1),C=za.useRef(l);C.current=l;let T=za.useRef(c);T.current=c;let R=za.useRef(null),O=za.useRef(0),z=za.useRef(null),Y=za.useCallback((G)=>{O.current=Date.now();let V=z.current;if(V?.key===G&&a2(G)===V.request)return;let Ie=id(G)?.data;I(!0);let pe=o2(G,vb(),C.current);if(z.current={key:G,request:pe},V)Ab(V.key,V.request);let Ne=!1;pe.promise.then((Ce)=>{if(Ne=!0,T.current!==G)return;if(Ce===Ie){S((oe)=>oe===null?oe:null);return}za.startTransition(()=>{S(null),g()})}).catch((Ce)=>{if(T.current!==G||pe.controller.signal.aborted)return;S({key:G,error:ug(Ce)})}).finally(()=>{if(z.current?.request!==pe)return;if(z.current=null,T.current!==G)return;if(I(!1),Ne&&(id(G)?.version??-1)<vb())b()})},[]),W=za.useCallback(()=>{let G=z.current;if(z.current=null,G)Ab(G.key,G.request)},[]);za.useEffect(()=>W,[W]),za.useEffect(()=>{if(!f||z.current&&z.current.key!==c)W();if(!f)return;let G=id(c);if(G&&G.version>=y)return;let V=G?O.current+vN-Date.now():0;if(V<=0){Y(c);return}let Ie=setTimeout(()=>Y(c),V);return()=>clearTimeout(Ie)},[c,f,y,m,Y,W]),za.useEffect(()=>{if(!f||!v)return;let G=setInterval(()=>{if(!document.hidden)Y(T.current)},v);return()=>clearInterval(G)},[f,v,Y]);let ue=za.useCallback(()=>Y(T.current),[Y]),Z=id(c);if(Z)R.current={key:c,data:Z.data,updatedAt:Z.updatedAt};let ce=R.current,ee=h?.key===c?h.error:null;return{data:ce?.data??null,error:ee,loading:!ce&&!ee,stale:!!ce&&ce.key!==c,refreshing:L,updatedAt:ce?.updatedAt??null,refetch:ue}}function dg(r,l){let i=0,c=r.length-1,f=-1;while(i<=c){let v=i+c>>1;if(r[v]<=l)f=v,i=v+1;else c=v-1}return f}function ha(r,l,i){let c=Array.from({length:l.length},()=>0);for(let f of r){let v=dg(l,f.timestamp);if(v>=0)c[v]+=i(f)}return c}function Xn(r,l){let i=new Map;for(let m of r){let b=dg(l.buckets,m.timestamp);if(b<0)continue;let h=l.key(m),S=i.get(h);if(!S)S=Array.from({length:l.buckets.length},()=>0),i.set(h,S);S[b]+=l.value(m)}let c=[...i.entries()].map(([m,b])=>({key:m,values:b,total:b.reduce((h,S)=>h+S,0)})).filter((m)=>m.total!==0).sort((m,b)=>b.total-m.total||m.key.localeCompare(b.key)),f=l.limit??Number.POSITIVE_INFINITY,v=c.slice(0,f),y=c.slice(f),g=v.map((m,b)=>({key:m.key,label:l.label?l.label(m.key):m.key,color:l.colors?.get(m.key)??Za[b%Za.length],values:m.values}));if(y.length>0){let m=Array.from({length:l.buckets.length},()=>0);for(let b of y)for(let h=0;h<m.length;h++)m[h]+=b.values[h];g.push({key:"__other__",label:u("common.other-n",{count:y.length}),color:Mo,values:m})}return g}var xN=["main","subagent","advisor"];function Bl(r){return r.totalInputTokens+r.totalOutputTokens+r.totalCacheReadTokens+r.totalCacheWriteTokens}function s2(r){let l=new Map;for(let y of r)l.set(y.agentType,y);let i=xN.map((y)=>l.get(y)).filter((y)=>y!==void 0),c=i.reduce((y,g)=>y+Bl(g),0),f=i.reduce((y,g)=>y+g.totalCost,0),v=i.map((y)=>{let g=Bl(y);return{agentType:y.agentType,tokens:g,requests:y.totalRequests,cost:y.totalCost,share:c>0?g/c:0}});return{totalTokens:c,totalCost:f,segments:v}}function l2(r){let l={totalCost:0,requests:0,unpricedRequests:0,activeDays:new Set(r.map((f)=>f.timestamp)).size,avgDailyCost:0,costInput:0,costOutput:0,costCacheRead:0,costCacheWrite:0,models:[],topModel:null},i=new Map;for(let f of r){let v=Va(f.model,f.provider),y=i.get(v);if(!y)y={key:v,model:f.model,provider:f.provider,cost:0,requests:0,unpricedRequests:0,costInput:0,costOutput:0,costCacheRead:0,costCacheWrite:0,share:0},i.set(v,y);r2(y,f),r2(l,f),y.cost+=f.cost,l.totalCost+=f.cost}l.avgDailyCost=l.activeDays>0?l.totalCost/l.activeDays:0,l.models=[...i.values()].sort((f,v)=>v.cost-f.cost||v.requests-f.requests||f.key.localeCompare(v.key));for(let f of l.models)f.share=l.totalCost>0?f.cost/l.totalCost:0;let c=l.models[0];return l.topModel=c!==void 0&&c.cost>0?c:null,l}function r2(r,l){r.costInput+=l.costInput,r.costOutput+=l.costOutput,r.costCacheRead+=l.costCacheRead,r.costCacheWrite+=l.costCacheWrite,r.requests+=l.requests,r.unpricedRequests+=l.unpricedRequests}function i2(r){let l=new Map;for(let i of r){let c=Va(i.model,i.provider),f=l.get(c);if(!f)f=[],l.set(c,f);f.push({timestamp:i.timestamp,avgTtftSeconds:i.avgTtft!==null?i.avgTtft/1000:null,avgTokensPerSecond:i.avgTokensPerSecond,requests:i.requests})}for(let i of l.values())i.sort((c,f)=>c.timestamp-f.timestamp);return l}var bN=/^\/?-?(?:private-)?(?:tmp|var-folders)(?:[-/]|$)/;function u2(r){let l=0,i=0,c=0,f=0,v=0,y=0,g=0,m=0,b=0;for(let L of r){if(l+=L.totalRequests,i+=L.failedRequests,c+=L.totalCost,f+=L.unpricedRequests,v+=L.totalInputTokens+L.totalCacheReadTokens+L.totalCacheWriteTokens+L.totalOutputTokens,y+=L.totalInputTokens,g+=L.totalCacheReadTokens,L.totalRequests>m)m=L.totalRequests;if(L.totalCost>b)b=L.totalCost}let h=0;return{rows:r.map((L)=>{let I=bN.test(L.folder);if(I)h++;return{...L,conversationTokens:L.totalInputTokens+L.totalCacheReadTokens+L.totalCacheWriteTokens+L.totalOutputTokens,requestShare:l>0?L.totalRequests/l:0,costShare:c>0?L.totalCost/c:0,temporary:I}}),totalRequests:l,failedRequests:i,totalCost:c,unpricedRequests:f,conversationTokens:v,cacheRate:y+g>0?g/(y+g):0,maxRequests:m,maxCost:b,temporaryCount:h}}function d2(r){let l=0,i=0,c=0;for(let f of r)l+=f.calls,i+=f.totalTokensShare,c+=f.costShare;return r.map((f)=>({...f,errorRate:f.calls>0?f.errors/f.calls:0,callFraction:l>0?f.calls/l:0,tokenFraction:i>0?f.totalTokensShare/i:0,costFraction:c>0?f.costShare/c:0,avgResultChars:f.calls>0?f.resultChars/f.calls:0}))}function As(r){if(r.stopReason==="aborted")return"aborted";if(r.stopReason==="error"||r.errorMessage)return"failed";return"ok"}function Mb(r,l){if(r.length===0)return null;return r[Math.min(r.length-1,Math.max(0,Math.ceil(l*r.length)-1))]}function c2(r){let l=0,i=0,c=0,f=0,v=0,y=null,g=null,m=[],b=[];for(let h of r){let S=As(h);if(S==="failed")l++;else if(S==="aborted")i++;if(c+=h.usage.totalTokens,f+=h.usage.cost.total,bb(h))v++;if(h.duration!==null)m.push(h.duration);if(h.ttft!==null)b.push(h.ttft);if(y===null||h.timestamp<y)y=h.timestamp;if(g===null||h.timestamp>g)g=h.timestamp}return m.sort((h,S)=>h-S),b.sort((h,S)=>h-S),{requests:r.length,failed:l,aborted:i,tokens:c,cost:f,unpriced:v,medianDuration:Mb(m,0.5),p95Duration:Mb(m,0.95),medianTtft:Mb(b,0.5),oldest:y,newest:g}}var n2=180,SN=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,kN=/\b(?:req|msg|call|toolu|chatcmpl|resp|run|gen)[-_][A-Za-z0-9_-]{6,}/g,LN=/\b[0-9a-f]{12,}\b/gi,wN=/(?<![\w.-])\d+(?:\.\d+)?/g,CN=/^[1-5]\d\d$/;function Db(r){if(!r?.trim())return"Unknown error";let l=r.replace(/\s+/g," ").trim().replace(SN,"<id>").replace(kN,"<id>").replace(LN,"<hex>").replace(wN,(i)=>CN.test(i)?i:"N");return l.length>n2?`${l.slice(0,n2-1)}…`:l}function f2(r){let l=new Map;for(let i of r){let c=Db(i.errorMessage),f=l.get(c);if(!f)f={signature:c,count:0,firstSeen:i.timestamp,lastSeen:i.timestamp,latest:i,models:[],byModel:new Map},l.set(c,f);if(f.count++,i.timestamp<f.firstSeen)f.firstSeen=i.timestamp;if(i.timestamp>f.lastSeen)f.lastSeen=i.timestamp,f.latest=i;let v=Va(i.model,i.provider),y=f.byModel.get(v);if(y)y.count++;else f.byModel.set(v,{model:i.model,provider:i.provider,count:1})}return[...l.values()].map(({byModel:i,...c})=>({...c,models:[...i.values()].sort((f,v)=>v.count-f.count||f.model.localeCompare(v.model))})).sort((i,c)=>c.count-i.count||c.lastSeen-i.lastSeen)}var Oe=_(te(),1);function TN(){return[{value:"model",label:u("costs.by-model")},{value:"component",label:u("costs.by-component")}]}var IN=6,RN=86400000;function $f(){return[{key:"costInput",label:u("common.input"),color:"#5b8cff"},{key:"costOutput",label:u("common.output"),color:"var(--chart-secondary)"},{key:"costCacheRead",label:u("common.cache-read"),color:"var(--chart-primary)"},{key:"costCacheWrite",label:u("common.cache-write"),color:"#f5b54a"}]}function p2({active:r,range:l}){let i=Pt(["costs",l],({signal:L})=>rI(l,L),{enabled:r}),c=aa(l),[f,v]=jf.useState("model"),[y,g]=Pr(),m=jf.useMemo(()=>i.data?AN(i.data,l):null,[i.data,l]),b=jf.useMemo(()=>m?EN(m):[],[m]),h=(L)=>L.costSeries.length===0,S=Oe.jsxDEV(Je,{title:u("costs.no-usage-in-range"),hint:u("costs.empty-hint")},void 0,!1,void 0,this);return Oe.jsxDEV("div",{className:"page",children:[Oe.jsxDEV(la,{title:u("costs.title"),description:u("costs.description",{window:u(c.windowKey)})},void 0,!1,void 0,this),Oe.jsxDEV(_e,{query:i,skeleton:Oe.jsxDEV(Fa,{height:112,style:{borderRadius:12}},void 0,!1,void 0,this),isEmpty:h,empty:S,children:()=>m&&Oe.jsxDEV(MN,{view:m,stale:i.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this),Oe.jsxDEV("div",{className:"grid grid-main-side",children:[Oe.jsxDEV(fe,{index:1,title:u("costs.daily-estimate"),description:f==="model"?u("costs.daily-by-model"):u("costs.daily-by-component"),actions:Oe.jsxDEV(Oa,{size:"sm",options:TN(),value:f,onChange:v,"aria-label":u("costs.split-by")},void 0,!1,void 0,this),stale:i.stale,children:Oe.jsxDEV(_e,{query:i,skeleton:Oe.jsxDEV(qt,{height:280},void 0,!1,void 0,this),isEmpty:h,empty:S,children:()=>{if(!m)return null;let L=f==="model"?m.modelSeries:m.componentSeries;return Oe.jsxDEV("div",{className:"stack",style:{gap:12},children:[Oe.jsxDEV(yr,{slots:m.buckets.length,tickLabel:(I)=>_f(m.buckets[I]),tooltipTitle:(I)=>_f(m.buckets[I],!0),series:L,hidden:y,height:280,format:(I)=>zt(I,Number.isInteger(I)?0:2),formatTooltip:(I)=>zt(I),emptyLabel:u("costs.no-priced-usage"),tooltipExtra:(I)=>m.unpricedPerDay[I]>0?Oe.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[Oe.jsxDEV("span",{className:"chart-tooltip-label",children:u("costs.unpriced-requests")},void 0,!1,void 0,this),Oe.jsxDEV("span",{className:"chart-tooltip-value",children:A(m.unpricedPerDay[I])},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),Oe.jsxDEV(ia,{items:L.map((I)=>({key:I.key,label:I.label,color:I.color,value:zt(NN(I.values))})),hidden:y,onToggle:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Oe.jsxDEV(fe,{index:2,title:u("costs.where-it-went"),description:u("costs.estimate-by-component"),stale:i.stale,children:Oe.jsxDEV(_e,{query:i,skeleton:Oe.jsxDEV(qt,{height:280},void 0,!1,void 0,this),isEmpty:h,empty:S,children:()=>m&&Oe.jsxDEV(DN,{summary:m.summary},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Oe.jsxDEV(fe,{index:3,title:u("costs.by-model"),description:u("costs.by-model-description"),stale:i.stale,flush:!0,children:Oe.jsxDEV(_e,{query:i,skeleton:Oe.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),isEmpty:h,empty:S,children:()=>m&&Oe.jsxDEV(Ft,{rows:m.summary.models,rowKey:(L)=>L.key,columns:b,initialSort:{key:"cost",dir:"desc"},limit:20},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AN(r,l){let i=r.costSeries,c=l2(i),f=ig(c.models.map((b)=>({model:b.model,provider:b.provider,totalRequests:b.requests}))),v=new Map(c.models.map((b)=>[b.key,b])),y=oo(l,i.map((b)=>b.timestamp),RN),g=Xn(i,{buckets:y,key:(b)=>Va(b.model,b.provider),label:(b)=>v.get(b)?.model??b,value:(b)=>b.cost,limit:IN,colors:f}).map((b)=>({...b,values:b.values.map((h)=>h||null)})),m=new Set;for(let b of g){if(b.key==="__other__")continue;if(m.has(b.color))b.color=Za.find((h)=>!m.has(h))??b.color;m.add(b.color)}return{summary:c,swatches:new Map(g.filter((b)=>b.key!=="__other__").map((b)=>[b.key,b.color])),buckets:y,dailyTotals:ha(i,y,(b)=>b.cost),unpricedPerDay:ha(i,y,(b)=>b.unpricedRequests),modelSeries:g,componentSeries:$f().map((b)=>({key:b.key,label:b.label,color:b.color,values:ha(i,y,(h)=>h[b.key]).map((h)=>h||null)})),maxModelCost:c.models[0]?.cost??0}}function MN({view:r,stale:l}){let{summary:i}=r,c=i.requests-i.unpricedRequests,f=i.topModel;return Oe.jsxDEV("div",{"data-stale":l,children:Oe.jsxDEV(wa,{min:180,children:[Oe.jsxDEV(ie,{label:u("costs.api-equivalent-estimate"),title:u("costs.api-estimate-title"),value:oa(i.totalCost,i.unpricedRequests),hint:u("costs.requests-n",{count:A(i.requests)}),spark:r.dailyTotals,sparkColor:"var(--chart-secondary)"},void 0,!1,void 0,this),Oe.jsxDEV(ie,{label:u("costs.average-per-day"),title:u("costs.average-per-day-title"),value:oa(i.avgDailyCost,i.unpricedRequests),hint:u(i.activeDays===1?"costs.active-days-one":"costs.active-days-n",{count:A(i.activeDays)})},void 0,!1,void 0,this),Oe.jsxDEV(ie,{label:u("costs.top-model"),title:f?`${f.model} (${f.provider})`:void 0,value:f?f.model:"–",hint:f?u("costs.top-model-hint",{cost:zt(f.cost),share:Ge(f.share)}):u("costs.nothing-priced-yet")},void 0,!1,void 0,this),Oe.jsxDEV(ie,{label:u("costs.per-priced-request"),title:u("costs.per-priced-request-title"),value:c>0?m2(i.totalCost/c):"–",hint:u("costs.priced-n",{count:A(c)})},void 0,!1,void 0,this),Oe.jsxDEV(ie,{label:u("costs.unpriced-requests"),title:u("costs.unpriced-title"),value:A(i.unpricedRequests),hint:i.unpricedRequests>0?u("costs.unpriced-hint"):u("costs.all-priced")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function DN({summary:r}){return Oe.jsxDEV("div",{className:"stack",style:{gap:14},children:[Oe.jsxDEV($n,{height:10,segments:$f().map((l)=>({key:l.key,label:l.label,value:r[l.key],color:l.color}))},void 0,!1,void 0,this),Oe.jsxDEV("div",{className:"costs-components",children:[$f().map((l)=>Oe.jsxDEV("div",{className:"costs-component-row",children:[Oe.jsxDEV("span",{className:"row",children:[Oe.jsxDEV(an,{color:l.color},void 0,!1,void 0,this),l.label]},void 0,!0,void 0,this),Oe.jsxDEV("span",{className:"num",children:zt(r[l.key])},void 0,!1,void 0,this),Oe.jsxDEV("span",{className:"num dim costs-component-share",children:r.totalCost>0?Ge(r[l.key]/r.totalCost):"–"},void 0,!1,void 0,this)]},l.key,!0,void 0,this)),Oe.jsxDEV("div",{className:"costs-component-row costs-component-total",children:[Oe.jsxDEV("span",{children:u("common.total")},void 0,!1,void 0,this),Oe.jsxDEV("span",{className:"num",children:oa(r.totalCost,r.unpricedRequests)},void 0,!1,void 0,this),Oe.jsxDEV("span",{className:"costs-component-share"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r.unpricedRequests>0&&Oe.jsxDEV("p",{className:"micro dim",children:u(r.unpricedRequests===1?"costs.unpriced-note-one":"costs.unpriced-note-n",{count:A(r.unpricedRequests)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function EN(r){let l=$f().map((i)=>({key:i.key,header:i.label,align:"right",sort:(c)=>c[i.key],render:(c)=>Oe.jsxDEV("span",{className:"num",children:zt(c[i.key])},void 0,!1,void 0,this)}));return[{key:"model",header:u("common.model"),sort:(i)=>i.model,render:(i)=>Oe.jsxDEV(co,{lead:Oe.jsxDEV(an,{color:r.swatches.get(i.key)??Mo},void 0,!1,void 0,this),primary:Oe.jsxDEV("span",{className:"mono",children:i.model},void 0,!1,void 0,this),secondary:i.provider},void 0,!1,void 0,this)},{key:"requests",header:u("common.requests"),align:"right",sort:(i)=>i.requests,render:(i)=>Oe.jsxDEV("span",{className:"num",children:A(i.requests)},void 0,!1,void 0,this)},{key:"cost",header:u("costs.estimate"),title:u("costs.estimate-title"),align:"right",sort:(i)=>i.cost,render:(i)=>Oe.jsxDEV(Ma,{value:i.cost,max:r.maxModelCost,display:oa(i.cost,i.unpricedRequests),color:r.swatches.get(i.key)??Mo},void 0,!1,void 0,this)},{key:"share",header:u("common.share"),align:"right",sort:(i)=>i.share,render:(i)=>Oe.jsxDEV("span",{className:"num muted",children:i.cost>0?Ge(i.share):"–"},void 0,!1,void 0,this)},{key:"split",header:u("costs.split"),title:"Input · output · cache read · cache write",width:150,render:(i)=>i.cost>0?Oe.jsxDEV($n,{segments:$f().map((c)=>({key:c.key,label:c.label,value:i[c.key],color:c.color}))},void 0,!1,void 0,this):Oe.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)},...l,{key:"perRequest",header:u("costs.per-request"),title:"Estimate ÷ priced requests",align:"right",sort:(i)=>i.requests>i.unpricedRequests?i.cost/(i.requests-i.unpricedRequests):-1,render:(i)=>Oe.jsxDEV("span",{className:"num",children:i.requests>i.unpricedRequests?m2(i.cost/(i.requests-i.unpricedRequests)):"–"},void 0,!1,void 0,this)},{key:"unpriced",header:u("costs.unpriced"),title:"Requests with no public-equivalent price",align:"right",sort:(i)=>i.unpricedRequests,render:(i)=>i.unpricedRequests>0?Oe.jsxDEV("span",{className:"num tone-warn",children:A(i.unpricedRequests)},void 0,!1,void 0,this):Oe.jsxDEV("span",{className:"num dim",children:"–"},void 0,!1,void 0,this)}]}function m2(r){return r>0&&r<0.0001?"<$0.0001":zt(r)}function NN(r){let l=0;for(let i of r)l+=i??0;return l}var Ms=_(Ke(),1);var Le=_(te(),1),Eb=[50,200,1000];function h2({active:r,range:l,onRequestClick:i}){let[c,f]=Ms.useState(0),v=Eb[c],y=Pt(["errors",l,v],({signal:G})=>nI(l,v,G),{enabled:r}),[g,m]=Ms.useState(null),[b,h]=Ms.useState(null),[S,L]=Ms.useState(""),I=aa(l),C=Ms.useMemo(()=>{let G=(y.data??[]).map((Ce)=>({row:Ce,signature:Db(Ce.errorMessage)})),V=f2(y.data??[]),Ie=new Map;for(let{row:Ce}of G){let oe=Va(Ce.model,Ce.provider),Se=Ie.get(oe);if(Se)Se.count++;else Ie.set(oe,{model:Ce.model,provider:Ce.provider,count:1})}let pe=[...Ie.entries()].map(([Ce,oe])=>({key:Ce,...oe})).sort((Ce,oe)=>oe.count-Ce.count||Ce.model.localeCompare(oe.model)),Ne=G.reduce((Ce,{row:oe})=>!Ce||oe.timestamp>Ce.timestamp?oe:Ce,null);return{rows:G,groups:V,models:pe,newest:Ne}},[y.data]),T=C.groups.some((G)=>G.signature===g)?g:null,R=C.models.some((G)=>G.key===b)?b:null,O=Ms.useMemo(()=>{let G=S.trim().toLowerCase();return C.rows.filter((V)=>(T===null||V.signature===T)&&(R===null||Va(V.row.model,V.row.provider)===R)&&(G===""||V.row.model.toLowerCase().includes(G)||V.row.provider.toLowerCase().includes(G)||V.row.folder.toLowerCase().includes(G)||(V.row.errorMessage??"").toLowerCase().includes(G))).map((V)=>V.row)},[C.rows,T,R,S]),z=y.data?.length??0,Y=!y.stale&&z<v,W=c+1<Eb.length?Eb[c+1]:null,ue=y.data!==null&&!Y?Le.jsxDEV(Le.Fragment,{children:[Le.jsxDEV("span",{children:u("errors.footer",{count:A(z),window:u(I.windowKey)})},void 0,!1,void 0,this),W!==null&&Le.jsxDEV("button",{type:"button",className:"btn","data-size":"sm",disabled:y.refreshing,onClick:()=>f(c+1),children:y.refreshing&&y.stale?u("errors.loading"):u("errors.load-latest",{count:A(W)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):void 0,Z=C.groups[0]?.count??0,ce=Ms.useMemo(()=>qN(Z),[Z]),ee=C.models.find((G)=>G.key===R);return Le.jsxDEV("div",{className:"page",children:[Le.jsxDEV(la,{title:u("errors.title"),description:u("errors.description",{window:u(I.windowKey)})},void 0,!1,void 0,this),Le.jsxDEV(_e,{query:y,skeleton:Le.jsxDEV(Fa,{height:96,style:{borderRadius:12}},void 0,!1,void 0,this),children:()=>Le.jsxDEV("div",{"data-stale":y.stale,children:Le.jsxDEV(wa,{min:170,children:[Le.jsxDEV(ie,{label:u("errors.failures"),value:A(z),hint:Y?u("errors.hint-in-window",{window:u(I.windowKey)}):u("errors.hint-latest-loaded",{count:A(z)})},void 0,!1,void 0,this),Le.jsxDEV(ie,{label:u("errors.signatures"),title:u("errors.signatures-hint"),value:A(C.groups.length),hint:C.groups[0]?u("errors.signatures-top",{count:A(C.groups[0].count)}):void 0},void 0,!1,void 0,this),Le.jsxDEV(ie,{label:u("errors.affected-models"),value:A(C.models.length),hint:C.models[0]?.model},void 0,!1,void 0,this),Le.jsxDEV(ie,{label:u("errors.last-failure"),value:C.newest?ma(C.newest.timestamp):"–",hint:C.newest?ro(C.newest.timestamp):u("errors.none-in-window",{window:u(I.windowKey)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV("div",{className:"grid grid-main-side",children:[Le.jsxDEV(fe,{index:1,title:u("errors.error-signatures"),description:u("errors.signatures-card-description"),flush:!0,stale:y.stale,children:Le.jsxDEV(_e,{query:y,skeleton:Le.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),isEmpty:(G)=>G.length===0,empty:Le.jsxDEV(Je,{title:u("errors.empty-no-failures",{window:u(I.windowKey)}),hint:u("errors.empty-all-succeeded")},void 0,!1,void 0,this),children:()=>Le.jsxDEV(Ft,{rows:C.groups,rowKey:(G)=>G.signature,columns:ce,onRowClick:(G)=>m(T===G.signature?null:G.signature),selectedKey:T,expanded:(G)=>G.signature===T?Le.jsxDEV(ON,{group:G,onRequestClick:i},void 0,!1,void 0,this):null,limit:12},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV(fe,{index:2,title:u("errors.by-model"),description:u("errors.by-model-description"),stale:y.stale,children:Le.jsxDEV(_e,{query:y,skeleton:Le.jsxDEV(Fa,{height:180},void 0,!1,void 0,this),isEmpty:(G)=>G.length===0,empty:Le.jsxDEV(Je,{title:u("errors.empty-no-affected-models")},void 0,!1,void 0,this),children:()=>Le.jsxDEV(Ts,{items:C.models.slice(0,12).map((G)=>({key:G.key,label:Le.jsxDEV("span",{className:"row",style:{gap:6,minWidth:0},children:[Le.jsxDEV("span",{className:"mono truncate",children:G.model},void 0,!1,void 0,this),Le.jsxDEV("span",{className:"dim truncate",children:G.provider},void 0,!1,void 0,this)]},void 0,!0,void 0,this),value:G.count,color:G.key===R?"var(--bad)":"color-mix(in srgb, var(--bad) 45%, transparent)"})),onSelect:(G)=>h(R===G?null:G)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Le.jsxDEV(fe,{index:3,title:u("errors.failures"),description:y.data===null?u("errors.loading-failures"):u("errors.filtered-of-total",{shown:A(O.length),total:A(z)}),actions:Le.jsxDEV(Le.Fragment,{children:[T!==null&&Le.jsxDEV("button",{type:"button",className:"btn errors-filter","data-size":"sm",onClick:()=>m(null),title:T,children:[Le.jsxDEV("span",{className:"mono truncate",children:T},void 0,!1,void 0,this),Le.jsxDEV(Ro,{size:12},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ee&&Le.jsxDEV("button",{type:"button",className:"btn errors-filter","data-size":"sm",onClick:()=>h(null),children:[Le.jsxDEV("span",{className:"mono truncate",children:ee.model},void 0,!1,void 0,this),Le.jsxDEV(Ro,{size:12},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Le.jsxDEV(Fn,{value:S,onChange:L,placeholder:u("errors.search-placeholder")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),flush:!0,stale:y.stale,footer:ue,children:Le.jsxDEV(_e,{query:y,skeleton:Le.jsxDEV(pa,{rows:10},void 0,!1,void 0,this),isEmpty:(G)=>G.length===0,empty:Le.jsxDEV(Je,{title:u("errors.empty-no-failures",{window:u(I.windowKey)})},void 0,!1,void 0,this),children:()=>Le.jsxDEV(Ft,{rows:O,rowKey:(G)=>G.id??`${G.sessionFile}:${G.entryId}`,onRowClick:(G)=>G.id!==void 0&&i(G.id),columns:BN(),initialSort:{key:"time",dir:"desc"},limit:50,dense:!0,empty:Le.jsxDEV(Je,{title:u("errors.no-match"),hint:u("errors.no-match-hint")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qN(r){return[{key:"signature",header:u("errors.signature"),wrap:!0,sort:(l)=>l.signature,render:(l)=>Le.jsxDEV("span",{className:"errors-signature",title:l.latest.errorMessage??void 0,children:l.signature},void 0,!1,void 0,this)},{key:"models",header:u("common.models"),sort:(l)=>l.models.length,render:(l)=>Le.jsxDEV(co,{primary:Le.jsxDEV("span",{className:"mono",children:l.models[0]?.model},void 0,!1,void 0,this),secondary:l.models.length>1?u("errors.more-models",{count:A(l.models.length-1)}):l.models[0]?.provider},void 0,!1,void 0,this)},{key:"last",header:u("errors.last-seen"),sort:(l)=>l.lastSeen,render:(l)=>Le.jsxDEV("span",{className:"muted",title:ro(l.lastSeen),children:ma(l.lastSeen)},void 0,!1,void 0,this)},{key:"count",header:u("errors.failures"),align:"right",width:120,sort:(l)=>l.count,render:(l)=>Le.jsxDEV(Ma,{value:l.count,max:r,display:A(l.count),color:"var(--bad)"},void 0,!1,void 0,this)}]}function ON({group:r,onRequestClick:l}){let i=r.latest.id;return Le.jsxDEV("div",{className:"errors-detail",children:[Le.jsxDEV("pre",{className:"code-block errors-detail-message",children:r.latest.errorMessage??u("errors.unknown-error")},void 0,!1,void 0,this),Le.jsxDEV("div",{className:"errors-detail-meta",children:[Le.jsxDEV("span",{className:"muted",children:u("errors.group-meta",{count:A(r.count),first:ro(r.firstSeen),last:ro(r.lastSeen)})},void 0,!1,void 0,this),i!==void 0&&Le.jsxDEV("button",{type:"button",className:"btn","data-size":"sm",onClick:()=>l(i),children:[u("errors.open-latest")," ",Le.jsxDEV(nf,{size:13},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Le.jsxDEV("div",{className:"errors-detail-models",children:r.models.map((c)=>Le.jsxDEV("span",{className:"badge","data-mono":"true",children:[c.model," ",Le.jsxDEV("span",{className:"dim",children:c.provider},void 0,!1,void 0,this)," ",Le.jsxDEV("span",{className:"num",children:se(c.count)},void 0,!1,void 0,this)]},Va(c.model,c.provider),!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function BN(){return[{key:"time",header:u("errors.when"),width:120,sort:(r)=>r.timestamp,render:(r)=>Le.jsxDEV("span",{className:"muted",title:ro(r.timestamp),children:ma(r.timestamp)},void 0,!1,void 0,this)},{key:"model",header:u("common.model"),sort:(r)=>r.model,render:(r)=>Le.jsxDEV(co,{primary:Le.jsxDEV("span",{className:"mono",children:r.model},void 0,!1,void 0,this),secondary:r.provider},void 0,!1,void 0,this)},{key:"error",header:u("common.error"),sort:(r)=>r.errorMessage??"",render:(r)=>Le.jsxDEV("span",{className:"errors-message",title:r.errorMessage??void 0,children:r.errorMessage??u("errors.unknown-error")},void 0,!1,void 0,this)},{key:"project",header:u("common.project"),sort:(r)=>r.folder,render:(r)=>Le.jsxDEV("span",{className:"mono muted",title:r.folder,children:zr(r.folder)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),align:"right",sort:(r)=>r.usage.totalTokens,render:(r)=>Le.jsxDEV("span",{className:"num",children:A(r.usage.totalTokens)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("errors.cost-hint"),align:"right",sort:(r)=>r.usage.cost.total,render:(r)=>Le.jsxDEV("span",{className:"num",children:Ol(r,4)},void 0,!1,void 0,this)}]}var At=_(Ke(),1);var P=_(te(),1),zN=1000,cg=50,qb=0.5,Xf="*";function y2({active:r,range:l}){let[i,c]=At.useState(!1),f=Pt(["frustration",l],({signal:b})=>dI(l,b),{enabled:r,pollMs:i?zN:void 0}),v=aa(l),y=f.data?.job.state;At.useEffect(()=>{if(y!==void 0)c(y==="running")},[y]);let{refetch:g}=f,m=At.useCallback(()=>{c(!0),g()},[g]);return P.jsxDEV("div",{className:"page",children:[P.jsxDEV(la,{title:u("frustration.title"),description:u("frustration.description",{window:u(v.windowKey)})},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(qt,{height:96},void 0,!1,void 0,this),children:(b)=>P.jsxDEV("div",{"data-stale":f.stale,children:P.jsxDEV(PN,{overall:b.overall},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(qt,{height:120},void 0,!1,void 0,this),children:(b)=>P.jsxDEV(UN,{active:r,range:l,judgeAvailable:b.judgeAvailable,job:b.job,onRunStarted:m,onRunChanged:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(fe,{index:2,title:u("frustration.by-model"),children:[P.jsxDEV(qt,{height:340},void 0,!1,void 0,this),P.jsxDEV(pa,{rows:6},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:(b)=>P.jsxDEV(YN,{models:b.byModel,stale:f.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(qt,{height:96},void 0,!1,void 0,this),children:(b)=>P.jsxDEV("div",{className:"frustration-model-summary","data-stale":f.stale,children:P.jsxDEV(ZN,{overall:b.modelSide.overall,window:u(v.windowKey)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(fe,{index:4,title:u("frustration.model-by-model"),children:[P.jsxDEV(qt,{height:300},void 0,!1,void 0,this),P.jsxDEV(pa,{rows:5},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:(b)=>P.jsxDEV(JN,{models:b.modelSide.byModel,series:b.modelSide.series,range:l,stale:f.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(_e,{query:f,skeleton:P.jsxDEV(fe,{index:7,title:u("frustration.model-sessions"),children:P.jsxDEV(pa,{rows:5},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:(b)=>P.jsxDEV(tq,{sessions:b.modelSide.bySession,stale:f.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Da(r,l){return l>0?Ge(r/l):"–"}function Nb(r){return r instanceof Error?r.message:String(r)}function v2(r){let l=Math.max(0,Math.floor(r/1000)),i=Math.floor(l/60),c=l%60;return i>0?`${i}m ${String(c).padStart(2,"0")}s`:`${c}s`}function PN({overall:r}){let l=r.messages-r.judged,i=r.unscored>0?u("frustration.coverage-unscored",{count:A(r.unscored)}):"";return P.jsxDEV(P.Fragment,{children:[P.jsxDEV(wa,{min:170,children:[P.jsxDEV(ie,{label:u("frustration.user-messages"),title:u("frustration.user-messages-title"),value:A(r.messages)},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.judge-coverage"),title:u("frustration.judge-coverage-title"),value:Da(r.judged,r.messages),hint:`${u("frustration.coverage-hint",{judged:A(r.judged),regex:A(l)})}${i}`},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.annoyed"),title:u("frustration.annoyed-title"),value:Da(r.annoyed,r.messages),hint:u("frustration.messages-n",{count:A(r.annoyed)})},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.at-assistant"),title:u("frustration.at-assistant-title"),value:Da(r.atAssistant,r.messages),hint:u("frustration.messages-n",{count:A(r.atAssistant)})},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.angry"),title:u("frustration.angry-title"),value:Da(r.angry,r.messages),hint:u("frustration.messages-n",{count:A(r.angry)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.unscored>0&&P.jsxDEV("p",{className:"micro dim",children:u("frustration.unscored-line",{count:A(r.unscored)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var g2="Judging needs the zeta host process: open the dashboard with zetacode stats and configure a judge model. Until then messages are classified by regex signals.";function UN({active:r,range:l,judgeAvailable:i,job:c,onRunStarted:f,onRunChanged:v}){let[y,g]=At.useState(!1),[m,b]=At.useState({status:"loading"}),[h,S]=At.useState(!1),[L,I]=At.useState(null),[C,T]=At.useState(!1),[R,O]=At.useState(null),z=At.useRef(null),Y=c.state==="running",W=At.useCallback(()=>{z.current?.abort(),z.current=null,g(!1)},[]);At.useEffect(()=>{if(!r)W()},[r,W]),At.useEffect(()=>()=>z.current?.abort(),[]);let ue=()=>{z.current?.abort();let V=new AbortController;z.current=V;let Ie=l;b({status:"loading"}),I(null),O(null),g(!0),cI(Ie,V.signal).then((pe)=>{if(!V.signal.aborted)b({status:"ready",estimate:pe,range:Ie})},(pe)=>{if(!V.signal.aborted)b({status:"error",message:Nb(pe)})})},Z=async()=>{if(m.status!=="ready")return;S(!0),I(null);try{await fI(m.range),W(),f()}catch(V){I(Nb(V))}finally{S(!1)}},ce=async()=>{T(!0),O(null);try{await pI(),v()}catch(V){O(Nb(V))}finally{T(!1)}},ee=m.status==="ready"?m.estimate:null,G=m.status==="loading"?{label:"Proceed",onClick:Z,disabled:!0}:ee?.available?{label:h?"Starting…":"Proceed",onClick:Z,disabled:h||ee.messages===0}:void 0;return P.jsxDEV(fe,{index:1,title:P.jsxDEV(P.Fragment,{children:[u("frustration.judge-panel")," ",P.jsxDEV(_N,{job:c,judgeAvailable:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this),description:u("frustration.judge-description"),actions:P.jsxDEV("button",{type:"button",className:"btn","data-variant":"accent","data-size":"sm",onClick:ue,disabled:!i||Y,title:!i?g2:Y?u("frustration.judge-running"):u("frustration.quote-title"),children:[P.jsxDEV(Un,{size:13},void 0,!1,void 0,this)," ",u("frustration.classify")]},void 0,!0,void 0,this),children:[P.jsxDEV("div",{className:"stack frustration-judge",children:[Y?P.jsxDEV(FN,{job:c,cancelling:C,onCancel:ce},void 0,!1,void 0,this):P.jsxDEV(GN,{job:c},void 0,!1,void 0,this),!i&&P.jsxDEV("p",{className:"micro dim",children:g2},void 0,!1,void 0,this),R&&P.jsxDEV("p",{className:"micro tone-bad",role:"alert",children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(NI,{open:y,title:u("frustration.classify"),onClose:W,primaryAction:G,children:[P.jsxDEV(HN,{estimate:m},void 0,!1,void 0,this),L&&P.jsxDEV("p",{className:"micro tone-bad",role:"alert",children:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function _N({job:r,judgeAvailable:l}){switch(r.state){case"running":return P.jsxDEV(ct,{tone:"ok",children:[P.jsxDEV(Hn,{tone:"live",pulse:!0},void 0,!1,void 0,this)," ",u("frustration.running")]},void 0,!0,void 0,this);case"done":return P.jsxDEV(ct,{tone:"ok",children:u("frustration.last-run-done")},void 0,!1,void 0,this);case"cancelled":return P.jsxDEV(ct,{tone:"warn",children:u("frustration.last-run-cancelled")},void 0,!1,void 0,this);case"failed":return P.jsxDEV(ct,{tone:"bad",children:u("frustration.last-run-failed")},void 0,!1,void 0,this);case"idle":return P.jsxDEV(ct,{children:l?u("frustration.not-run-yet"):u("frustration.regex-only")},void 0,!1,void 0,this)}}function HN({estimate:r}){if(r.status==="loading")return P.jsxDEV("p",{className:"muted",children:u("frustration.estimating")},void 0,!1,void 0,this);if(r.status==="error")return P.jsxDEV("p",{className:"tone-bad",children:r.message},void 0,!1,void 0,this);let l=r.estimate;if(!l.available)return P.jsxDEV("p",{children:l.reason},void 0,!1,void 0,this);if(l.messages===0)return P.jsxDEV("p",{children:u("frustration.all-judged")},void 0,!1,void 0,this);return P.jsxDEV(P.Fragment,{children:[P.jsxDEV("div",{className:"frustration-quote",children:[P.jsxDEV("span",{className:"dim micro",children:u("frustration.estimated-cost")},void 0,!1,void 0,this),P.jsxDEV("span",{className:"num frustration-quote-value",children:["≈ ",zt(l.cost)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(So,{items:[{key:"messages",label:u("frustration.unjudged-messages"),value:A(l.messages)},{key:"chars",label:u("frustration.prose-chars"),value:A(l.chars)},{key:"tokens",label:u("frustration.input-tokens"),value:A(l.inputTokens)},{key:"judge",label:u("frustration.judge-model"),value:l.judge}]},void 0,!1,void 0,this),P.jsxDEV("p",{className:"micro dim",children:u("frustration.estimate-note")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FN({job:r,cancelling:l,onCancel:i}){let c=r.done+r.failed,f=r.total>0?Math.min(1,c/r.total):0;return P.jsxDEV("div",{className:"stack frustration-progress",children:[P.jsxDEV("div",{className:"row frustration-progress-head",children:[P.jsxDEV("span",{className:"num",children:[A(r.done),"/",A(r.total)," judged"]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"num dim",children:Ge(f)},void 0,!1,void 0,this),P.jsxDEV("span",{className:"frustration-spacer"},void 0,!1,void 0,this),P.jsxDEV("button",{type:"button",className:"btn","data-variant":"danger","data-size":"sm",onClick:i,disabled:l,children:l?u("frustration.cancelling"):u("frustration.cancel-run")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV("div",{className:"meter frustration-progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":r.total,"aria-valuenow":c,children:P.jsxDEV("div",{className:"meter-fill frustration-progress-fill",style:{width:`${f*100}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV("div",{className:"row micro muted frustration-progress-meta",children:[P.jsxDEV("span",{className:r.failed>0?"tone-bad":void 0,children:u("frustration.failed-n",{count:A(r.failed)})},void 0,!1,void 0,this),P.jsxDEV("span",{children:[u("frustration.cost-so-far")," ",P.jsxDEV("span",{className:"num",children:zt(r.cost)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.judge&&P.jsxDEV("span",{className:"mono",children:r.judge},void 0,!1,void 0,this),r.startedAt!==null&&P.jsxDEV("span",{children:u("frustration.elapsed",{time:v2(Date.now()-r.startedAt)})},void 0,!1,void 0,this),r.startedAt!==null&&r.done>0&&P.jsxDEV("span",{className:"num",children:[(r.done/Math.max(1,(Date.now()-r.startedAt)/1000)).toFixed(0),"/s"]},void 0,!0,void 0,this),r.concurrency>0&&P.jsxDEV("span",{className:"num",children:u("frustration.in-flight",{count:A(r.concurrency)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function GN({job:r}){let l=u("frustration.messages-progress",{done:A(r.done),total:A(r.total)}),i=r.failed>0?u("frustration.failed-suffix",{count:A(r.failed)}):"",c=r.judge?u("frustration.judge-with",{judge:r.judge}):"",f=r.startedAt!==null&&r.finishedAt!==null?u("frustration.in-time",{time:v2(r.finishedAt-r.startedAt)}):"";switch(r.state){case"idle":return P.jsxDEV("p",{className:"muted",children:u("frustration.no-run-yet")},void 0,!1,void 0,this);case"running":return null;case"done":return P.jsxDEV("p",{className:"muted",children:u("frustration.run-done-line",{progress:l,failed:i,judge:c,elapsed:f,cost:zt(r.cost)})},void 0,!1,void 0,this);case"cancelled":return P.jsxDEV("p",{className:"muted",children:u("frustration.run-cancelled-line",{progress:l,failed:i,cost:zt(r.cost)})},void 0,!1,void 0,this);case"failed":return P.jsxDEV("p",{className:"muted",children:u("frustration.run-failed-line",{progress:l,failed:i,error:r.error??u("frustration.unknown-error"),cost:zt(r.cost)})},void 0,!1,void 0,this)}}function _i(r){return`${r.modelClass}/${r.family??"unclassified"}`}function ud(r){return r.messages>0&&r.judged/r.messages<qb}function VN(r){let l=2166136261;for(let i=0;i<r.length;i++)l^=r.charCodeAt(i),l=Math.imul(l,16777619);return l>>>0}function x2(r){let l=[...new Set(r.map(_i))].sort(),i=new Set,c=new Map;for(let f of l){let v=VN(f)%Za.length;for(let y=0;y<Za.length&&i.has(v);y++)v=(v+1)%Za.length;i.add(v),c.set(f,Za[v])}return c}function jN(r,l){if(l==="angry")return`color-mix(in srgb, ${r} 55%, black)`;if(l==="other")return`color-mix(in srgb, ${r} 32%, transparent)`;return r}var $N=[{key:"angry",label:"Angry at assistant"},{key:"assistant",label:"At assistant, not angry"},{key:"other",label:"Annoyed at other targets"}];function XN(r,l){if(l==="angry")return r.angry;if(l==="assistant")return r.atAssistant-r.angry;return r.annoyed-r.atAssistant}function Yf(r,l){return l>0?r/l*100:0}function YN({models:r,stale:l}){let[i,c]=At.useState(null),[f,v]=Pr(),[y,g]=At.useState(!1),[m,b]=At.useState(!1),h=At.useMemo(()=>x2(r),[r]),S=At.useMemo(()=>{let Z=new Map;for(let ce of r)Z.set(ce.modelClass,(Z.get(ce.modelClass)??0)+ce.messages);return Z},[r]),L=At.useMemo(()=>{let Z=null,ce=-1;for(let[ee,G]of S)if(G>ce)Z=ee,ce=G;return Z??Xf},[S]),I=i!==null&&(i===Xf||S.has(i))?i:L,C=At.useMemo(()=>[{value:Xf,label:"All",title:"Every model class"},...[...S].map(([Z,ce])=>({value:Z,label:Z,title:`${A(ce)} messages`}))],[S]),T=At.useMemo(()=>I===Xf?r:r.filter((Z)=>Z.modelClass===I),[r,I]),R=At.useMemo(()=>{let Z=new Map;for(let ce of T){let ee=_i(ce),G=Z.get(ee);if(G){G.messages+=ce.messages;continue}let V=ce.family??"unclassified";Z.set(ee,{key:ee,label:I===Xf?`${ce.modelClass} · ${V}`:V,messages:ce.messages})}return[...Z.values()]},[T,I]),O=At.useMemo(()=>T.filter((Z)=>!f.has(_i(Z))),[T,f]),z=O.filter((Z)=>Z.messages<cg).length,Y=O.filter(ud).length,W=At.useMemo(()=>O.filter((Z)=>(y||Z.messages>=cg)&&!(m&&ud(Z))),[O,y,m]);if(r.length===0)return P.jsxDEV(fe,{index:2,title:u("frustration.by-model"),stale:l,children:P.jsxDEV(Je,{title:u("frustration.no-messages"),hint:u("frustration.try-longer-range")},void 0,!1,void 0,this)},void 0,!1,void 0,this);let ue=W.some(ud);return P.jsxDEV(P.Fragment,{children:[P.jsxDEV(fe,{index:2,title:u("frustration.by-model"),description:u("frustration.by-model-description"),stale:l,children:P.jsxDEV("div",{className:"stack frustration-chart-body",children:[P.jsxDEV("div",{className:"frustration-classes",children:P.jsxDEV(Oa,{size:"sm","aria-label":u("frustration.model-class"),options:C,value:I,onChange:c},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV("div",{className:"row frustration-filters",children:[P.jsxDEV(ia,{items:R.map((Z)=>({key:Z.key,label:Z.label,color:h.get(Z.key)??Za[0],value:A(Z.messages)})),hidden:f,onToggle:v},void 0,!1,void 0,this),P.jsxDEV("span",{className:"frustration-spacer"},void 0,!1,void 0,this),P.jsxDEV("label",{className:"check",title:u("frustration.small-models-title",{count:cg}),children:[P.jsxDEV("input",{type:"checkbox",checked:y,onChange:(Z)=>g(Z.target.checked)},void 0,!1,void 0,this),u("frustration.include-small",{count:cg}),z>0?` (${z})`:""]},void 0,!0,void 0,this),P.jsxDEV("label",{className:"check",title:u("frustration.hide-regex-title",{share:qb*100}),children:[P.jsxDEV("input",{type:"checkbox",checked:m,onChange:(Z)=>b(Z.target.checked)},void 0,!1,void 0,this),"Hide mostly regex",Y>0?` (${Y})`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(KN,{hasRegexRows:ue},void 0,!1,void 0,this),P.jsxDEV(QN,{rows:W,familyColors:h},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(WN,{rows:W,familyColors:h,stale:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function KN({hasRegexRows:r}){return P.jsxDEV("div",{className:"legend frustration-key",children:[P.jsxDEV("span",{className:"legend-item",children:[P.jsxDEV("span",{className:"swatch frustration-key-swatch","data-variant":"angry"},void 0,!1,void 0,this),"Angry at assistant"]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item",children:[P.jsxDEV("span",{className:"swatch frustration-key-swatch","data-variant":"assistant"},void 0,!1,void 0,this),"At assistant"]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item",children:[P.jsxDEV("span",{className:"swatch frustration-key-swatch","data-variant":"other"},void 0,!1,void 0,this),"Annoyed at other targets"]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item",children:[P.jsxDEV("span",{className:"frustration-key-line"},void 0,!1,void 0,this),u("frustration.legend-trend")]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item frustration-key-wide",title:u("frustration.hatch-title",{share:qb*100}),children:[P.jsxDEV("span",{className:"swatch frustration-key-swatch","data-variant":"hatch"},void 0,!1,void 0,this),r?u("frustration.legend-hatched-run"):u("frustration.legend-hatched")]},void 0,!0,void 0,this),P.jsxDEV("span",{className:"legend-item dim",children:u("frustration.legend-hue")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QN({rows:r,familyColors:l}){let i=At.useMemo(()=>{let c=new Map;r.forEach((v,y)=>{let g=_i(v),m=ud(v),b=`${g}|${m?"regex":"judged"}`,h=c.get(b);if(h)h.slots.push(y);else c.set(b,{family:g,regex:m,slots:[y]})});let f=[];for(let v of $N)for(let[y,g]of c){let m=r.map(()=>null);for(let b of g.slots)m[b]=Yf(XN(r[b],v.key),r[b].messages);f.push({key:`${v.key}|${y}`,label:v.label,color:jN(l.get(g.family)??Za[0],v.key),values:m,pattern:g.regex?"hatch":void 0})}return f.push({key:"trend",label:"At assistant (total)",color:"var(--ink-1)",values:r.map((v)=>Yf(v.atAssistant,v.messages)),kind:"line",tooltip:!1}),f},[r,l]);if(r.length===0)return P.jsxDEV("div",{className:"frustration-chart-empty",children:P.jsxDEV(Je,{title:u("frustration.no-model-match")},void 0,!1,void 0,this)},void 0,!1,void 0,this);return P.jsxDEV(yr,{slots:r.length,tickLabel:(c)=>r[c].label,series:i,height:340,format:(c)=>`${c}%`,formatTooltip:(c)=>`${c.toFixed(1)}%`,showTotal:!1,emptyLabel:"No frustrated messages for these models",tooltipExtra:(c)=>{let f=r[c];return P.jsxDEV("div",{className:"frustration-tooltip-extra",children:[P.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[P.jsxDEV("span",{className:"chart-tooltip-label",children:u("frustration.legend-annoyed-any")},void 0,!1,void 0,this),P.jsxDEV("span",{className:"chart-tooltip-value",children:Da(f.annoyed,f.messages)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV("div",{className:"micro dim",children:[A(f.messages)," messages · judged ",A(f.judged)," (",Da(f.judged,f.messages),")",ud(f)?u("frustration.row-mostly-regex"):""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this)}function WN({rows:r,familyColors:l,stale:i}){let c=At.useMemo(()=>[{key:"model",header:u("common.model"),sort:(f)=>f.label,render:(f)=>P.jsxDEV("span",{className:"row",title:f.key,children:[P.jsxDEV("span",{className:"swatch",style:{background:l.get(_i(f))??Za[0]}},void 0,!1,void 0,this),P.jsxDEV("span",{className:"cell-primary",children:f.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"ids",header:u("frustration.column-model-ids"),wrap:!0,render:(f)=>P.jsxDEV("span",{className:"mono micro dim",children:f.models.join(", ")},void 0,!1,void 0,this)},{key:"messages",header:u("frustration.column-messages"),align:"right",sort:(f)=>f.messages,render:(f)=>P.jsxDEV("span",{className:"num",children:A(f.messages)},void 0,!1,void 0,this)},{key:"judged",header:u("frustration.column-judged"),align:"right",sort:(f)=>f.messages>0?f.judged/f.messages:0,render:(f)=>ud(f)?P.jsxDEV("span",{className:"row frustration-judged",title:u("frustration.mostly-regex"),children:[P.jsxDEV(ct,{tone:"warn",children:u("frustration.regex-badge")},void 0,!1,void 0,this),P.jsxDEV("span",{className:"num dim",children:Da(f.judged,f.messages)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):P.jsxDEV("span",{className:"num",children:Da(f.judged,f.messages)},void 0,!1,void 0,this)},{key:"annoyed",header:u("frustration.annoyed"),align:"right",sort:(f)=>Yf(f.annoyed,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.messages-n",{count:A(f.annoyed)}),children:Da(f.annoyed,f.messages)},void 0,!1,void 0,this)},{key:"atAssistant",header:u("frustration.at-assistant"),align:"right",sort:(f)=>Yf(f.atAssistant,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.messages-n",{count:A(f.atAssistant)}),children:Da(f.atAssistant,f.messages)},void 0,!1,void 0,this)},{key:"angry",header:u("frustration.angry"),align:"right",sort:(f)=>Yf(f.angry,f.messages),render:(f)=>P.jsxDEV("span",{className:f.angry>0?"num tone-bad":"num",title:u("frustration.messages-n",{count:A(f.angry)}),children:Da(f.angry,f.messages)},void 0,!1,void 0,this)}],[l]);return P.jsxDEV(fe,{index:3,title:u("frustration.model-versions"),description:u("frustration.table-description"),flush:!0,stale:i,children:P.jsxDEV(Ft,{rows:r,rowKey:(f)=>f.key,columns:c,dense:!0,empty:P.jsxDEV(Je,{title:u("frustration.no-model-match")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function ZN({overall:r,window:l}){let i=r.messages>0?(r.collapse/r.messages).toFixed(2):"–";return P.jsxDEV(P.Fragment,{children:[P.jsxDEV("div",{className:"card-titles",children:[P.jsxDEV("h2",{className:"page-title",children:u("frustration.model-side-title")},void 0,!1,void 0,this),P.jsxDEV("p",{className:"page-description",children:u("frustration.model-side-description",{window:l})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV("div",{className:"frustration-model-notes",children:[P.jsxDEV(wa,{min:170,children:[P.jsxDEV(ie,{label:u("frustration.model-turns"),title:u("frustration.model-turns-title"),value:A(r.messages)},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-breakdown"),title:u("frustration.model-breakdown-title"),value:Da(r.breakdown,r.messages),hint:u("frustration.turns-n",{count:A(r.breakdown)})},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-mean"),title:u("frustration.model-mean-title"),value:i,hint:u("frustration.model-hint-mean",{value:i})},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-self-blame"),title:u("frustration.model-self-blame-title"),value:Da(r.blamed,r.messages)},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-hedge"),title:u("frustration.model-hedge-title"),value:Da(r.hedged,r.messages)},void 0,!1,void 0,this),P.jsxDEV(ie,{label:u("frustration.model-spiral"),title:u("frustration.model-spiral-title"),value:Da(r.spiraled,r.messages)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.unscored>0&&P.jsxDEV("p",{className:"micro dim",children:u("frustration.model-unscored-line",{count:A(r.unscored)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function sn(r,l){return l>0?r/l*100:0}function JN({models:r,series:l,range:i,stale:c}){let f=aa(i),v=At.useMemo(()=>x2(r),[r]),y=At.useMemo(()=>oo(i,l.map((h)=>h.timestamp),f.bucketMs),[l,i,f.bucketMs]),g=At.useMemo(()=>new Map(l.map((h)=>[h.timestamp,h])),[l]),m=At.useMemo(()=>[{key:"breakdown",label:u("frustration.model-legend-breakdown"),color:"var(--chart-primary)",values:y.map((h)=>{let S=g.get(h);return S&&S.messages>0?sn(S.breakdown,S.messages):null})}],[y,g]),b=At.useMemo(()=>[...r].sort((h,S)=>sn(S.breakdown,S.messages)-sn(h.breakdown,h.messages)||S.messages-h.messages).slice(0,12),[r]);if(r.length===0)return P.jsxDEV(fe,{index:4,title:u("frustration.model-by-model"),stale:c,children:P.jsxDEV(Je,{title:u("frustration.model-no-turns"),hint:u("frustration.model-try-longer-range")},void 0,!1,void 0,this)},void 0,!1,void 0,this);return P.jsxDEV(P.Fragment,{children:[P.jsxDEV(fe,{index:4,title:u("frustration.model-by-model"),description:u("frustration.model-by-model-description"),stale:c,children:P.jsxDEV(Ts,{max:100,items:b.map((h)=>({key:h.key,label:h.label,value:sn(h.breakdown,h.messages),display:Da(h.breakdown,h.messages),color:v.get(_i(h))??Za[0]}))},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(fe,{index:5,title:u("frustration.model-over-time"),description:u("frustration.model-over-time-description"),actions:P.jsxDEV(ia,{items:m.map((h)=>({key:h.key,label:h.label,color:h.color}))},void 0,!1,void 0,this),stale:c,children:P.jsxDEV(_o,{buckets:y,bucketMs:f.bucketMs,series:m,height:260,yMax:100,format:(h)=>`${h}%`,formatTooltip:(h)=>`${h.toFixed(1)}%`,emptyLabel:u("frustration.model-no-turns")},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(eq,{rows:r,familyColors:v,stale:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function eq({rows:r,familyColors:l,stale:i}){let c=At.useMemo(()=>[{key:"model",header:u("common.model"),sort:(f)=>f.label,render:(f)=>P.jsxDEV("span",{className:"row",title:f.key,children:[P.jsxDEV("span",{className:"swatch",style:{background:l.get(_i(f))??Za[0]}},void 0,!1,void 0,this),P.jsxDEV("span",{className:"cell-primary",children:f.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"ids",header:u("frustration.column-model-ids"),wrap:!0,render:(f)=>P.jsxDEV("span",{className:"mono micro dim",children:f.models.join(", ")},void 0,!1,void 0,this)},{key:"turns",header:u("frustration.column-turns"),align:"right",sort:(f)=>f.messages,render:(f)=>P.jsxDEV("span",{className:"num",children:A(f.messages)},void 0,!1,void 0,this)},{key:"selfBlame",header:u("frustration.model-self-blame"),align:"right",sort:(f)=>sn(f.blamed,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.blamed)}),children:Da(f.blamed,f.messages)},void 0,!1,void 0,this)},{key:"restatement",header:u("frustration.model-restatement"),title:u("frustration.model-restatement-title"),align:"right",sort:(f)=>sn(f.restated,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.restated)}),children:Da(f.restated,f.messages)},void 0,!1,void 0,this)},{key:"hedge",header:u("frustration.model-hedge"),align:"right",sort:(f)=>sn(f.hedged,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.hedged)}),children:Da(f.hedged,f.messages)},void 0,!1,void 0,this)},{key:"rambling",header:u("frustration.model-rambling"),title:u("frustration.model-rambling-title"),align:"right",sort:(f)=>sn(f.verbose,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.verbose)}),children:Da(f.verbose,f.messages)},void 0,!1,void 0,this)},{key:"spiral",header:u("frustration.model-spiral"),align:"right",sort:(f)=>sn(f.spiraled,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.spiraled)}),children:Da(f.spiraled,f.messages)},void 0,!1,void 0,this)},{key:"breakdown",header:u("frustration.model-breakdown"),align:"right",sort:(f)=>sn(f.breakdown,f.messages),render:(f)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(f.breakdown)}),children:Da(f.breakdown,f.messages)},void 0,!1,void 0,this)},{key:"mean",header:u("frustration.column-mean"),align:"right",sort:(f)=>f.messages>0?f.collapse/f.messages:0,render:(f)=>P.jsxDEV("span",{className:"num",children:f.messages>0?(f.collapse/f.messages).toFixed(2):"–"},void 0,!1,void 0,this)}],[l]);return P.jsxDEV(fe,{index:6,title:u("frustration.model-table-title"),description:u("frustration.model-table-description"),flush:!0,stale:i,children:P.jsxDEV(Ft,{rows:r,rowKey:(f)=>f.key,columns:c,dense:!0,empty:P.jsxDEV(Je,{title:u("frustration.model-no-turns")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function tq({sessions:r,stale:l}){let i=At.useMemo(()=>[{key:"session",header:u("frustration.column-session"),render:(c)=>P.jsxDEV("span",{className:"stack",title:c.sessionFile,children:[P.jsxDEV("span",{className:"cell-primary mono micro",children:c.sessionFile.split(/[\\/]/).pop()??c.sessionFile},void 0,!1,void 0,this),P.jsxDEV("span",{className:"micro dim truncate",children:c.folder},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"models",header:u("common.model"),wrap:!0,render:(c)=>P.jsxDEV("span",{className:"mono micro dim",children:c.models.join(", ")},void 0,!1,void 0,this)},{key:"turns",header:u("frustration.column-turns"),align:"right",sort:(c)=>c.messages,render:(c)=>P.jsxDEV("span",{className:"num",children:A(c.messages)},void 0,!1,void 0,this)},{key:"breakdown",header:u("frustration.model-breakdown"),align:"right",sort:(c)=>sn(c.breakdown,c.messages),render:(c)=>P.jsxDEV("span",{className:"num",title:u("frustration.turns-n",{count:A(c.breakdown)}),children:Da(c.breakdown,c.messages)},void 0,!1,void 0,this)},{key:"mean",header:u("frustration.column-mean"),align:"right",sort:(c)=>c.messages>0?c.collapse/c.messages:0,render:(c)=>P.jsxDEV("span",{className:"num",children:c.messages>0?(c.collapse/c.messages).toFixed(2):"–"},void 0,!1,void 0,this)},{key:"toolErrors",header:u("frustration.column-tool-errors"),align:"right",sort:(c)=>c.toolErrors,render:(c)=>P.jsxDEV("span",{className:c.toolErrors>0?"num tone-bad":"num",children:A(c.toolErrors)},void 0,!1,void 0,this)}],[]);return P.jsxDEV(fe,{index:7,title:u("frustration.model-sessions"),description:u("frustration.model-sessions-description"),flush:!0,stale:l,children:P.jsxDEV(Ft,{rows:r,rowKey:(c)=>c.sessionFile,columns:i,dense:!0,empty:P.jsxDEV(Je,{title:u("frustration.model-no-turns")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var Kf=_(Ke(),1);var Yt=_(te(),1),aq=86400000,oq={snapcompact:"Snapcompact"};function b2({active:r,range:l}){let[i,c]=Kf.useState(null),f=Pt(["gain",l,i],({signal:L})=>yI(l,i,L),{enabled:r}),v=aa(l),y=f.data,g=Kf.useMemo(()=>{let L=(y?.timeSeries??[]).map((O)=>({...O,timestamp:Date.parse(`${O.date}T00:00:00`)})),I=oo(l,L.map((O)=>O.timestamp),aq),C=ha(L,I,(O)=>O.snapcompact),T=0,R=C.map((O)=>T+=O);return{buckets:I,daily:C,cumulative:R}},[y,l]),m=Kf.useMemo(()=>{if(!y)return[];let L=y.overall.savedTokens;return Object.keys(y.bySource).map((I)=>({...y.bySource[I],source:I,share:L>0?y.bySource[I].savedTokens/L:0}))},[y]),b=y?.projects??[],h=i!==null&&!b.includes(i)?[i,...b]:b,S=[{key:"daily",label:u("gain.saved-per-day"),color:"var(--chart-primary)",values:g.daily},{key:"cumulative",label:u("gain.cumulative"),color:"var(--chart-secondary)",values:g.cumulative,kind:"line",axis:"right"}];return Yt.jsxDEV("div",{className:"page",children:[Yt.jsxDEV(la,{title:u("gain.title"),description:i?u("gain.description-scoped",{project:i,window:u(v.windowKey)}):u("gain.description",{window:u(v.windowKey)}),actions:h.length>0&&Yt.jsxDEV("select",{className:"input","aria-label":u("common.project"),value:i??"",onChange:(L)=>c(L.target.value||null),style:{maxWidth:320},children:[Yt.jsxDEV("option",{value:"",children:u("gain.all-projects")},void 0,!1,void 0,this),h.map((L)=>Yt.jsxDEV("option",{value:L,children:L},L,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Yt.jsxDEV(_e,{query:f,skeleton:Yt.jsxDEV(qt,{height:96},void 0,!1,void 0,this),isEmpty:(L)=>L.overall.hits===0&&L.timeSeries.length===0,empty:Yt.jsxDEV(fe,{children:Yt.jsxDEV(Je,{title:i?u("gain.empty-title-scoped",{project:i,window:u(v.windowKey)}):u("gain.empty-title",{window:u(v.windowKey)}),hint:l==="all"?u("gain.empty-hint-all"):u("gain.empty-hint-longer-range")},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:({overall:L})=>Yt.jsxDEV(Yt.Fragment,{children:[Yt.jsxDEV("div",{"data-stale":f.stale,children:Yt.jsxDEV(wa,{min:180,children:[Yt.jsxDEV(ie,{label:u("gain.saved-tokens"),value:se(L.savedTokens),hint:A(L.savedTokens),spark:g.daily},void 0,!1,void 0,this),Yt.jsxDEV(ie,{label:u("gain.saved-bytes"),value:kb(L.savedBytes)},void 0,!1,void 0,this),Yt.jsxDEV(ie,{label:u("gain.reduction"),title:u("gain.reduction-title"),value:L.reductionPercent!==null?Ge(L.reductionPercent):"–",hint:L.reductionPercent===null?u("gain.reduction-unknown"):void 0},void 0,!1,void 0,this),Yt.jsxDEV(ie,{label:u("gain.hits"),value:A(L.hits)},void 0,!1,void 0,this),Yt.jsxDEV(ie,{label:u("gain.saved-per-hit"),value:L.hits>0?se(L.savedTokens/L.hits):"–",hint:u("common.tokens")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Yt.jsxDEV(fe,{index:1,title:u("gain.savings-over-time"),description:u("gain.savings-over-time-description"),actions:Yt.jsxDEV(ia,{items:S.map((I)=>({key:I.key,label:I.label,color:I.color}))},void 0,!1,void 0,this),stale:f.stale,children:Yt.jsxDEV(yr,{slots:g.buckets.length,tickLabel:(I)=>_f(g.buckets[I]),series:S,height:260,formatTooltip:A,formatRight:se},void 0,!1,void 0,this)},void 0,!1,void 0,this),Yt.jsxDEV(fe,{index:2,title:u("gain.by-source"),description:u("gain.by-source-description"),flush:!0,stale:f.stale,children:Yt.jsxDEV(Ft,{rows:m,rowKey:(I)=>I.source,columns:rq()},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rq(){return[{key:"source",header:u("gain.source"),sort:(r)=>r.source,render:(r)=>Yt.jsxDEV("span",{className:"cell-primary",children:oq[r.source]},void 0,!1,void 0,this)},{key:"tokens",header:u("gain.saved-tokens"),align:"right",sort:(r)=>r.savedTokens,render:(r)=>Yt.jsxDEV("span",{title:A(r.savedTokens),children:Yt.jsxDEV(Ma,{value:r.share,max:1,display:se(r.savedTokens)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"share",header:u("common.share"),align:"right",sort:(r)=>r.share,render:(r)=>Yt.jsxDEV("span",{className:"num muted",children:Ge(r.share)},void 0,!1,void 0,this)},{key:"bytes",header:u("gain.saved-bytes"),align:"right",sort:(r)=>r.savedBytes,render:(r)=>Yt.jsxDEV("span",{className:"num",children:kb(r.savedBytes)},void 0,!1,void 0,this)},{key:"hits",header:u("gain.hits"),align:"right",sort:(r)=>r.hits,render:(r)=>Yt.jsxDEV("span",{className:"num",children:A(r.hits)},void 0,!1,void 0,this)},{key:"reduction",header:u("gain.reduction"),align:"right",sort:(r)=>r.reductionPercent??-1,render:(r)=>Yt.jsxDEV("span",{className:"num",children:r.reductionPercent!==null?Ge(r.reductionPercent):"–"},void 0,!1,void 0,this)}]}var dd=_(Ke(),1);var Te=_(te(),1);function nq(){return[{value:"share",label:u("common.share")},{value:"requests",label:u("common.requests")}]}var sq=6;function k2({active:r,range:l}){let i=Pt(["models",l],({signal:T})=>oI(l,T),{enabled:r}),c=aa(l),[f,v]=dd.useState("share"),[y,g]=Pr(),[m,b]=dd.useState(null),h=dd.useMemo(()=>i.data?lq(i.data,l):null,[i.data,l]),S=cq(c.bucketMs),L=dd.useMemo(()=>h?uq(h,m,S):[],[h,m,S]),I=(T)=>T.byModel.length===0,C=Te.jsxDEV(Je,{title:u("models.empty-title"),hint:u("models.empty-hint")},void 0,!1,void 0,this);return Te.jsxDEV("div",{className:"page",children:[Te.jsxDEV(la,{title:u("common.models"),description:u("models.subtitle",{window:u(c.windowKey)})},void 0,!1,void 0,this),Te.jsxDEV(_e,{query:i,skeleton:Te.jsxDEV(Fa,{height:112,style:{borderRadius:12}},void 0,!1,void 0,this),isEmpty:I,empty:C,children:()=>h&&Te.jsxDEV("div",{"data-stale":i.stale,children:Te.jsxDEV(wa,{min:200,children:[Te.jsxDEV(ie,{label:u("models.used"),value:A(h.models.length),hint:h.providerCount===1?u("models.across-providers-one",{count:A(h.providerCount)}):u("models.across-providers",{count:A(h.providerCount)})},void 0,!1,void 0,this),Te.jsxDEV(ie,{label:u("models.most-used"),title:h.top?`${h.top.model} (${h.top.provider})`:void 0,value:h.top?h.top.model:"–",hint:h.top?u("models.most-used-hint",{share:Ge(h.top.totalRequests/Math.max(1,h.totalRequests)),provider:h.top.provider}):void 0},void 0,!1,void 0,this),Te.jsxDEV(ie,{label:u("common.requests"),value:A(h.totalRequests),hint:u("models.failed-n",{count:A(h.failedRequests)}),spark:h.requestTotals},void 0,!1,void 0,this),Te.jsxDEV(ie,{label:u("models.api-cost"),title:u("models.api-cost-title"),value:oa(h.totalCost,h.unpricedRequests),hint:h.unpricedRequests>0?u("models.unpriced-n",{count:A(h.unpricedRequests)}):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Te.jsxDEV(fe,{index:1,title:u("models.request-share"),description:f==="share"?u("models.share-desc",{bucket:S}):u("models.count-desc",{bucket:S}),actions:Te.jsxDEV(Oa,{size:"sm",options:nq(),value:f,onChange:v,"aria-label":u("models.share-mode-aria")},void 0,!1,void 0,this),stale:i.stale,children:Te.jsxDEV(_e,{query:i,skeleton:Te.jsxDEV(qt,{height:260},void 0,!1,void 0,this),isEmpty:I,empty:C,children:()=>h&&Te.jsxDEV("div",{className:"stack",style:{gap:12},children:[Te.jsxDEV(_o,{buckets:h.buckets,bucketMs:c.bucketMs,series:f==="share"?h.shareSeries:h.countSeries,hidden:y,height:260,yMax:f==="share"?1:void 0,format:f==="share"?(T)=>Ge(T,0):se,formatTooltip:f==="share"?(T)=>Ge(T):A,showTotal:f==="requests"},void 0,!1,void 0,this),Te.jsxDEV(ia,{items:h.countSeries.map((T)=>({key:T.key,label:T.label,color:T.color,value:Ge(S2(T.values)/Math.max(1,S2(h.requestTotals)))})),hidden:y,onToggle:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Te.jsxDEV(fe,{index:2,title:u("models.all-models"),description:u("models.table-desc"),stale:i.stale,flush:!0,children:Te.jsxDEV(_e,{query:i,skeleton:Te.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),isEmpty:I,empty:C,children:()=>h&&Te.jsxDEV(Ft,{rows:h.models,rowKey:(T)=>Va(T.model,T.provider),columns:L,initialSort:{key:"requests",dir:"desc"},limit:25,onRowClick:(T)=>{let R=Va(T.model,T.provider);b((O)=>O===R?null:R)},selectedKey:m,expanded:(T)=>{let R=Va(T.model,T.provider);return R===m?Te.jsxDEV(dq,{model:T,color:h.swatches.get(R)??"var(--chart-primary)",points:h.performance.get(R)??[],bucketMs:c.bucketMs,bucketWord:S},void 0,!1,void 0,this):null}},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function lq(r,l){let i=r.byModel,c=ig(i),f=iq(i),v=oo(l,r.modelSeries.map((R)=>R.timestamp)),y=ha(r.modelSeries,v,(R)=>R.requests),g={buckets:v,key:(R)=>Va(R.model,R.provider),label:(R)=>f.get(R)??R,value:(R)=>R.requests,colors:c},m=Xn(r.modelSeries,{...g,limit:sq}).map((R)=>({...R,values:R.values.map((O)=>O||null)})),b=m.map((R)=>({...R,values:R.values.map((O,z)=>O===null?null:O/y[z])})),h=new Map(Xn(r.modelSeries,g).map((R)=>[R.key,R.values])),S,L=0,I=0,C=0,T=0;for(let R of i){if(!S||R.totalRequests>S.totalRequests)S=R;L+=R.totalRequests,I+=R.failedRequests,C+=R.totalCost,T+=R.unpricedRequests}return{models:i,top:S,swatches:new Map(m.filter((R)=>R.key!=="__other__").map((R)=>[R.key,R.color])),labels:f,providerCount:new Set(i.map((R)=>R.provider)).size,totalRequests:L,failedRequests:I,totalCost:C,unpricedRequests:T,maxRequests:S?.totalRequests??0,buckets:v,requestTotals:y,countSeries:m,shareSeries:b,trends:h,performance:i2(r.modelPerformanceSeries)}}function iq(r){let l=new Map;for(let i of r)l.set(i.model,(l.get(i.model)??0)+1);return new Map(r.map((i)=>[Va(i.model,i.provider),(l.get(i.model)??0)>1?`${i.model} · ${i.provider}`:i.model]))}function uq(r,l,i){return[{key:"expand",header:"",width:28,render:(c)=>Te.jsxDEV("span",{className:"models-chevron","data-open":Va(c.model,c.provider)===l,children:Te.jsxDEV(en,{size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"model",header:u("common.model"),sort:(c)=>c.model,render:(c)=>Te.jsxDEV(co,{lead:Te.jsxDEV(an,{color:r.swatches.get(Va(c.model,c.provider))??Mo},void 0,!1,void 0,this),primary:Te.jsxDEV("span",{className:"mono",children:c.model},void 0,!1,void 0,this),secondary:c.provider},void 0,!1,void 0,this)},{key:"requests",header:u("common.requests"),align:"right",sort:(c)=>c.totalRequests,render:(c)=>Te.jsxDEV(Ma,{value:c.totalRequests,max:r.maxRequests,display:A(c.totalRequests),color:r.swatches.get(Va(c.model,c.provider))??Mo},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("models.cost-title"),align:"right",sort:(c)=>c.totalCost,render:(c)=>Te.jsxDEV("span",{className:"num",children:oa(c.totalCost,c.unpricedRequests)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),title:u("models.tokens-title"),align:"right",sort:(c)=>Bl(c),render:(c)=>{let f=Bl(c);return Te.jsxDEV("span",{className:"num",title:A(f),children:se(f)},void 0,!1,void 0,this)}},{key:"cache",header:u("models.cache-rate"),title:u("models.cache-title"),align:"right",sort:(c)=>c.cacheRate,render:(c)=>Te.jsxDEV("span",{className:"num",children:Ge(c.cacheRate)},void 0,!1,void 0,this)},{key:"errors",header:u("models.errors"),align:"right",sort:(c)=>c.errorRate,render:(c)=>c.failedRequests===0?Te.jsxDEV("span",{className:"num dim",children:"0%"},void 0,!1,void 0,this):Te.jsxDEV("span",{title:u("models.failed-n",{count:A(c.failedRequests)}),children:Te.jsxDEV(ct,{tone:hr(c.errorRate),mono:!0,children:Ao(c.errorRate)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"tps",header:u("common.tokens-per-second"),title:u("models.tps-title"),align:"right",sort:(c)=>c.avgTokensPerSecond??-1,render:(c)=>Te.jsxDEV("span",{className:"num",children:Gn(c.avgTokensPerSecond)},void 0,!1,void 0,this)},{key:"ttft",header:u("models.ttft"),title:u("models.ttft-title"),align:"right",sort:(c)=>c.avgTtft??-1,render:(c)=>Te.jsxDEV("span",{className:"num",children:Ct(c.avgTtft)},void 0,!1,void 0,this)},{key:"trend",header:u("models.trend"),title:u("models.trend-title",{bucket:i}),width:112,render:(c)=>{let f=Va(c.model,c.provider),v=r.trends.get(f);return v?Te.jsxDEV(rd,{values:v.map((y)=>y??0),color:r.swatches.get(f)??Mo,width:96,height:22},void 0,!1,void 0,this):Te.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)}}]}function dq({model:r,color:l,points:i,bucketMs:c,bucketWord:f}){let[v,y]=Pr(),g=[{key:"tps",label:u("common.tokens-per-second"),color:l,kind:i.length>1?"line":"bars",values:i.map((m)=>m.avgTokensPerSecond)},{key:"ttft",label:u("models.ttft"),color:Mo,kind:i.length>1?"line":"bars",axis:"right",dashed:!0,values:i.map((m)=>m.avgTtftSeconds)}];return Te.jsxDEV("div",{className:"models-detail",children:[Te.jsxDEV("div",{className:"models-detail-facts",children:[Te.jsxDEV("div",{children:[Te.jsxDEV("div",{className:"section-label",children:u("models.efficiency")},void 0,!1,void 0,this),Te.jsxDEV(So,{items:[{key:"err",label:u("common.error-rate"),value:Te.jsxDEV("span",{className:`tone-${hr(r.errorRate)}`,children:[Ao(r.errorRate)," ",Te.jsxDEV("span",{className:"dim",children:["(",u("models.failed-n",{count:A(r.failedRequests)}),")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},{key:"cache",label:u("models.cache-rate"),value:Ge(r.cacheRate)},{key:"savings",label:u("models.cache-savings"),value:Te.jsxDEV("span",{className:r.cacheSavings<0?"tone-bad":void 0,children:Ge(r.cacheSavings)},void 0,!1,void 0,this)},{key:"premium",label:u("common.premium-requests"),value:A(Math.round(r.totalPremiumRequests*100)/100)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te.jsxDEV("div",{children:[Te.jsxDEV("div",{className:"section-label",children:u("models.latency")},void 0,!1,void 0,this),Te.jsxDEV(So,{items:[{key:"dur",label:u("models.avg-duration"),value:Ct(r.avgDuration)},{key:"ttft",label:u("models.avg-ttft"),value:Ct(r.avgTtft)},{key:"tps",label:u("common.tokens-per-second"),value:Gn(r.avgTokensPerSecond)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te.jsxDEV("div",{children:[Te.jsxDEV("div",{className:"section-label",children:u("common.tokens")},void 0,!1,void 0,this),Te.jsxDEV(So,{items:[{key:"in",label:u("models.uncached-input"),value:se(r.totalInputTokens)},{key:"cr",label:u("common.cache-read"),value:se(r.totalCacheReadTokens)},{key:"cw",label:u("common.cache-write"),value:se(r.totalCacheWriteTokens)},{key:"out",label:u("common.output"),value:se(r.totalOutputTokens)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te.jsxDEV("div",{className:"micro dim",children:u("models.first-last-seen",{first:ma(r.firstTimestamp),last:ma(r.lastTimestamp)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te.jsxDEV("div",{className:"models-detail-chart",children:[Te.jsxDEV("div",{className:"row",style:{justifyContent:"space-between"},children:[Te.jsxDEV("div",{className:"section-label",style:{marginBottom:0},children:u("models.performance-per-bucket",{bucket:f})},void 0,!1,void 0,this),Te.jsxDEV(ia,{items:g.map((m)=>({key:m.key,label:m.label,color:m.color})),hidden:v,onToggle:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.length===0?Te.jsxDEV(Je,{title:u("models.no-samples-title"),hint:u("models.no-samples-hint")},void 0,!1,void 0,this):Te.jsxDEV(_o,{buckets:i.map((m)=>m.timestamp),bucketMs:c,series:g,hidden:v,stacked:!1,height:240,format:se,formatTooltip:(m)=>u("models.tok-per-second",{value:Gn(m)}),formatRight:(m)=>`${Number(m.toFixed(2))}s`,tooltipExtra:(m)=>Te.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[Te.jsxDEV("span",{className:"chart-tooltip-label",children:u("common.requests")},void 0,!1,void 0,this),Te.jsxDEV("span",{className:"chart-tooltip-value",children:A(i[m].requests)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function cq(r){if(r<3600000)return u("models.bucket-5m");if(r<86400000)return u("models.bucket-hour");return u("models.bucket-day")}function S2(r){let l=0;for(let i of r)l+=i??0;return l}var fg=_(Ke(),1);var Ee=_(te(),1);function fq(){return[{value:"requests",label:u("common.requests")},{value:"tokens",label:u("common.tokens")},{value:"cost",label:u("common.cost")}]}var L2={main:"overview.main-agent",subagent:"overview.subagents",advisor:"overview.advisor"},w2={main:"var(--chart-primary)",subagent:"var(--chart-secondary)",advisor:"#9d7bff"};function C2(){return[{key:"input",label:u("overview.uncached-input"),color:"#5b8cff"},{key:"cacheRead",label:u("common.cache-read"),color:"var(--chart-primary)"},{key:"cacheWrite",label:u("common.cache-write"),color:"#f5b54a"},{key:"output",label:u("common.output"),color:"var(--chart-secondary)"}]}function T2({active:r,range:l,onRequestClick:i}){let c=Pt(["overview",l],({signal:h})=>aI(l,h),{enabled:r}),f=Pt(["recent-requests"],({signal:h})=>Vh(12,h),{enabled:r}),[v,y]=fg.useState("requests"),g=aa(l),m=fg.useMemo(()=>{let h=c.data?.timeSeries??[],S=oo(l,h.map((L)=>L.timestamp));return{buckets:S,requests:ha(h,S,(L)=>L.requests-L.errors),errors:ha(h,S,(L)=>L.errors),tokens:ha(h,S,(L)=>L.tokens),cost:ha(h,S,(L)=>L.cost),all:ha(h,S,(L)=>L.requests)}},[c.data,l]),b=v==="requests"?[{key:"ok",label:u("overview.succeeded"),color:"var(--chart-primary)",values:m.requests},{key:"err",label:u("common.failed"),color:"var(--bad)",values:m.errors}]:v==="tokens"?[{key:"tokens",label:u("common.tokens"),color:"var(--chart-primary)",values:m.tokens}]:[{key:"cost",label:u("overview.api-equivalent"),color:"var(--chart-secondary)",values:m.cost}];return Ee.jsxDEV("div",{className:"page",children:[Ee.jsxDEV(la,{title:u("overview.title"),description:u("overview.description",{window:u(g.windowKey)})},void 0,!1,void 0,this),Ee.jsxDEV(_e,{query:c,skeleton:Ee.jsxDEV(qt,{height:112},void 0,!1,void 0,this),children:({overall:h})=>Ee.jsxDEV("div",{"data-stale":c.stale,className:"stack",style:{gap:16},children:[Ee.jsxDEV(wa,{min:190,children:[Ee.jsxDEV(ie,{label:u("overview.api-equivalent-cost"),title:u("overview.api-cost-title"),value:oa(h.totalCost,h.unpricedRequests),hint:h.unpricedRequests>0?u("overview.unpriced-n",{count:A(h.unpricedRequests)}):void 0,spark:m.cost,sparkColor:"var(--chart-secondary)"},void 0,!1,void 0,this),Ee.jsxDEV(ie,{label:u("common.requests"),value:A(h.totalRequests),hint:u("overview.failed-n",{count:A(h.failedRequests)}),spark:m.all},void 0,!1,void 0,this),Ee.jsxDEV(ie,{label:u("overview.conversation-tokens"),title:u("overview.tokens-title"),value:se(Bl(h)),hint:u("overview.output-n",{count:se(h.totalOutputTokens)}),spark:m.tokens},void 0,!1,void 0,this),Ee.jsxDEV(ie,{label:u("overview.cache-rate"),title:u("overview.cache-rate-title"),value:Ge(h.cacheRate),hint:u("overview.cache-saved",{value:Ge(h.cacheSavings)})},void 0,!1,void 0,this),Ee.jsxDEV(ie,{label:u("common.error-rate"),value:Ao(h.errorRate),hint:u("overview.succeeded-n",{count:A(h.successfulRequests)}),spark:m.errors,sparkColor:"var(--bad)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ee.jsxDEV(wa,{min:140,children:[Ee.jsxDEV(ie,{size:"sm",label:u("overview.uncached-input"),value:se(h.totalInputTokens)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.cache-read"),value:se(h.totalCacheReadTokens)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.cache-write"),value:se(h.totalCacheWriteTokens)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.output"),value:se(h.totalOutputTokens)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.premium-requests"),value:A(Math.round(h.totalPremiumRequests*100)/100)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("common.tokens-per-second"),value:Gn(h.avgTokensPerSecond)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("overview.avg-latency"),value:Ct(h.avgDuration)},void 0,!1,void 0,this),Ee.jsxDEV(ie,{size:"sm",label:u("overview.avg-ttft"),value:Ct(h.avgTtft)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ee.jsxDEV("div",{className:"grid grid-main-side",children:[Ee.jsxDEV(fe,{index:1,title:u("overview.activity"),description:g.bucketMs<3600000?u("overview.per-5m"):g.bucketMs<86400000?u("overview.per-hour"):u("overview.per-day"),actions:Ee.jsxDEV(Oa,{size:"sm",options:fq(),value:v,onChange:y},void 0,!1,void 0,this),stale:c.stale,children:Ee.jsxDEV(_e,{query:c,skeleton:Ee.jsxDEV(qt,{height:260},void 0,!1,void 0,this),children:()=>Ee.jsxDEV(_o,{buckets:m.buckets,bucketMs:g.bucketMs,series:b,height:260,format:v==="cost"?(h)=>oa(h,0):se},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ee.jsxDEV(fe,{index:2,title:u("overview.token-mix"),description:u("overview.token-mix-description"),stale:c.stale,children:Ee.jsxDEV(_e,{query:c,skeleton:Ee.jsxDEV(qt,{height:260},void 0,!1,void 0,this),children:({overall:h,byAgentType:S})=>{let L={input:h.totalInputTokens,cacheRead:h.totalCacheReadTokens,cacheWrite:h.totalCacheWriteTokens,output:h.totalOutputTokens},I=Bl(h),C=s2(S);return Ee.jsxDEV("div",{className:"stack",style:{gap:18},children:[Ee.jsxDEV("div",{className:"stack",style:{gap:10},children:[Ee.jsxDEV($n,{segments:C2().map((T)=>({key:T.key,label:T.label,value:L[T.key],color:T.color}))},void 0,!1,void 0,this),Ee.jsxDEV(ia,{items:C2().map((T)=>({key:T.key,label:T.label,color:T.color,value:I>0?Ge(L[T.key]/I,0):"–"}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ee.jsxDEV("div",{className:"stack",style:{gap:10},children:[Ee.jsxDEV("div",{className:"section-label",style:{marginBottom:0},children:u("overview.by-agent")},void 0,!1,void 0,this),Ee.jsxDEV($n,{segments:C.segments.map((T)=>({key:T.agentType,label:u(L2[T.agentType]),value:T.tokens,color:w2[T.agentType]}))},void 0,!1,void 0,this),C.segments.map((T)=>Ee.jsxDEV("div",{className:"row",style:{justifyContent:"space-between"},children:[Ee.jsxDEV("span",{className:"row",children:[Ee.jsxDEV("span",{className:"swatch",style:{background:w2[T.agentType]}},void 0,!1,void 0,this),u(L2[T.agentType]),Ee.jsxDEV("span",{className:"dim num",children:u("overview.requests-short",{count:A(T.requests)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ee.jsxDEV("span",{className:"row",children:[Ee.jsxDEV("span",{className:"dim num",children:se(T.tokens)},void 0,!1,void 0,this),Ee.jsxDEV("span",{className:"num",style:{minWidth:48,textAlign:"right"},children:Ge(T.share)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},T.agentType,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ee.jsxDEV(fe,{index:3,title:Ee.jsxDEV(Ee.Fragment,{children:[Ee.jsxDEV(Hn,{tone:"live",pulse:!0},void 0,!1,void 0,this)," ",u("overview.latest-requests")]},void 0,!0,void 0,this),description:u("overview.latest-requests-description"),actions:Ee.jsxDEV("a",{className:"btn","data-size":"sm","data-variant":"ghost",href:`#/requests?range=${l}`,children:[u("overview.all-requests")," ",Ee.jsxDEV(rf,{size:13},void 0,!1,void 0,this)]},void 0,!0,void 0,this),flush:!0,children:Ee.jsxDEV(_e,{query:f,skeleton:Ee.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),children:(h)=>Ee.jsxDEV(Ft,{rows:h,rowKey:(S)=>S.id??`${S.sessionFile}:${S.entryId}`,onRowClick:(S)=>S.id!==void 0&&i(S.id),columns:pq(),dense:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pq(){return[{key:"model",header:u("common.model"),render:(r)=>Ee.jsxDEV(co,{primary:r.model,secondary:r.provider},void 0,!1,void 0,this)},{key:"time",header:u("overview.when"),render:(r)=>Ee.jsxDEV("span",{className:"muted",children:ma(r.timestamp)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),align:"right",render:(r)=>Ee.jsxDEV("span",{className:"num",children:A(r.usage.totalTokens)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),align:"right",render:(r)=>Ee.jsxDEV("span",{className:"num",children:Ol(r,4)},void 0,!1,void 0,this)},{key:"duration",header:u("common.duration"),align:"right",render:(r)=>Ee.jsxDEV("span",{className:"num",children:Ct(r.duration)},void 0,!1,void 0,this)},{key:"status",header:u("overview.status"),align:"right",render:(r)=>r.errorMessage?Ee.jsxDEV(ct,{tone:"bad",children:u("common.failed")},void 0,!1,void 0,this):Ee.jsxDEV(ct,{tone:"ok",children:u("overview.ok")},void 0,!1,void 0,this)}]}var ln=_(Ke(),1);var et=_(te(),1),mq=100,I2=8;function R2({active:r,range:l}){let i=Pt(["projects",l],({signal:T})=>mI(l,T),{enabled:r}),[c,f]=ln.useState(""),[v,y]=ln.useState(!0),g=ln.useDeferredValue(c.trim().toLowerCase()),m=aa(l),b=ln.useMemo(()=>u2(i.data??[]),[i.data]),h=ln.useMemo(()=>v?b.rows.filter((T)=>!T.temporary):b.rows,[b,v]),S=ln.useMemo(()=>g?h.filter((T)=>T.folder.toLowerCase().includes(g)):h,[h,g]),L=ln.useMemo(()=>({cost:[...h].sort((T,R)=>R.totalCost-T.totalCost).slice(0,I2),requests:[...h].sort((T,R)=>R.totalRequests-T.totalRequests).slice(0,I2)}),[h]),I=et.jsxDEV(Je,{title:u(b.rows.length===0?"projects.empty-no-folders":"projects.empty-only-temporary")},void 0,!1,void 0,this),C=ln.useMemo(()=>hq(b.maxRequests,b.maxCost),[b]);return et.jsxDEV("div",{className:"page",children:[et.jsxDEV(la,{title:u("projects.title"),description:u("projects.description",{window:u(m.windowKey)})},void 0,!1,void 0,this),et.jsxDEV(_e,{query:i,skeleton:et.jsxDEV(qt,{height:96},void 0,!1,void 0,this),children:()=>et.jsxDEV("div",{"data-stale":i.stale,children:et.jsxDEV(wa,{min:180,children:[et.jsxDEV(ie,{label:u("projects.folders"),value:A(b.rows.length),hint:b.temporaryCount>0?u("projects.temporary-n",{count:A(b.temporaryCount)}):void 0},void 0,!1,void 0,this),et.jsxDEV(ie,{label:u("common.requests"),value:A(b.totalRequests),hint:u("projects.failed-n",{count:A(b.failedRequests)})},void 0,!1,void 0,this),et.jsxDEV(ie,{label:u("projects.api-equivalent-cost"),title:u("projects.api-equivalent-cost-hint"),value:oa(b.totalCost,b.unpricedRequests),hint:b.unpricedRequests>0?u("projects.unpriced-n",{count:A(b.unpricedRequests)}):void 0},void 0,!1,void 0,this),et.jsxDEV(ie,{label:u("projects.conversation-tokens"),title:u("projects.conversation-tokens-hint"),value:se(b.conversationTokens)},void 0,!1,void 0,this),et.jsxDEV(ie,{label:u("projects.cache-rate"),title:u("projects.cache-rate-hint-all"),value:Ge(b.cacheRate)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),et.jsxDEV("div",{className:"grid grid-2",children:[et.jsxDEV(fe,{index:1,title:u("projects.top-by-cost"),description:u("projects.top-by-cost-description"),stale:i.stale,children:et.jsxDEV(_e,{query:i,skeleton:et.jsxDEV(qt,{height:236},void 0,!1,void 0,this),isEmpty:()=>L.cost.length===0,empty:I,children:()=>et.jsxDEV(Ts,{items:L.cost.map((T)=>({key:T.folder,label:et.jsxDEV("span",{className:"mono",children:zr(T.folder)},void 0,!1,void 0,this),value:T.totalCost,display:`${oa(T.totalCost,T.unpricedRequests)} · ${Ge(T.costShare)}`,color:"var(--chart-secondary)"})),onSelect:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),et.jsxDEV(fe,{index:2,title:u("projects.top-by-requests"),description:u("projects.top-by-requests-description"),stale:i.stale,children:et.jsxDEV(_e,{query:i,skeleton:et.jsxDEV(qt,{height:236},void 0,!1,void 0,this),isEmpty:()=>L.requests.length===0,empty:I,children:()=>et.jsxDEV(Ts,{items:L.requests.map((T)=>({key:T.folder,label:et.jsxDEV("span",{className:"mono",children:zr(T.folder)},void 0,!1,void 0,this),value:T.totalRequests,display:`${A(T.totalRequests)} · ${Ge(T.requestShare)}`})),onSelect:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),et.jsxDEV(fe,{index:3,title:u("projects.folders"),description:i.data?S.length===b.rows.length?u("projects.folders-n",{count:A(b.rows.length)}):u("projects.folders-of-n",{count:A(S.length),total:A(b.rows.length)}):void 0,actions:et.jsxDEV(et.Fragment,{children:[b.temporaryCount>0&&et.jsxDEV("label",{className:"check",title:u("projects.hide-temporary-hint"),children:[et.jsxDEV("input",{type:"checkbox",checked:v,onChange:(T)=>y(T.target.checked)},void 0,!1,void 0,this),u("projects.hide-temporary",{count:A(b.temporaryCount)})]},void 0,!0,void 0,this),et.jsxDEV(Fn,{value:c,onChange:f,placeholder:u("projects.filter-placeholder"),width:240},void 0,!1,void 0,this)]},void 0,!0,void 0,this),flush:!0,stale:i.stale,children:et.jsxDEV(_e,{query:i,skeleton:et.jsxDEV(pa,{rows:10},void 0,!1,void 0,this),children:()=>et.jsxDEV(Ft,{rows:S,rowKey:(T)=>T.folder,columns:C,initialSort:{key:"cost",dir:"desc"},limit:mq,dense:!0,empty:et.jsxDEV(Je,{title:u(b.rows.length===0?"projects.empty-no-folders":"projects.empty-no-match"),hint:b.rows.length===0?u("projects.hint-longer-range"):v&&b.temporaryCount>0?u("projects.hint-temporary-hidden"):void 0},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function hq(r,l){return[{key:"folder",header:u("projects.folder"),sort:(i)=>i.folder,render:(i)=>et.jsxDEV("span",{className:"row projects-folder",title:i.folder||u("common.root"),children:[et.jsxDEV("span",{className:"mono truncate",children:zr(i.folder)},void 0,!1,void 0,this),i.temporary&&et.jsxDEV(ct,{children:u("projects.temp")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"requests",header:u("common.requests"),align:"right",sort:(i)=>i.totalRequests,render:(i)=>et.jsxDEV("span",{title:u("projects.share-of-requests",{share:Ge(i.requestShare)}),children:et.jsxDEV(Ma,{value:i.totalRequests,max:r,display:A(i.totalRequests)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("projects.api-equivalent-cost-rates"),align:"right",sort:(i)=>i.totalCost,render:(i)=>et.jsxDEV("span",{title:u("projects.share-of-cost",{share:Ge(i.costShare)}),children:et.jsxDEV(Ma,{value:i.totalCost,max:l,display:oa(i.totalCost,i.unpricedRequests),color:"var(--chart-secondary)"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),title:u("projects.conversation-tokens-hint"),align:"right",sort:(i)=>i.conversationTokens,render:(i)=>et.jsxDEV("span",{className:"num",title:A(i.conversationTokens),children:se(i.conversationTokens)},void 0,!1,void 0,this)},{key:"cacheRate",header:u("projects.cache-rate"),title:u("projects.cache-rate-hint"),align:"right",sort:(i)=>i.cacheRate,render:(i)=>et.jsxDEV("span",{className:"num",children:Ge(i.cacheRate)},void 0,!1,void 0,this)},{key:"cacheSavings",header:u("projects.cache-savings"),title:u("projects.cache-savings-hint"),align:"right",sort:(i)=>i.cacheSavings,render:(i)=>et.jsxDEV("span",{className:`num ${i.cacheSavings<0?"tone-bad":"muted"}`,children:Ge(i.cacheSavings)},void 0,!1,void 0,this)},{key:"errorRate",header:u("projects.errors"),align:"right",sort:(i)=>i.errorRate,render:(i)=>et.jsxDEV("span",{title:u("projects.failed-n",{count:A(i.failedRequests)}),children:et.jsxDEV(ct,{tone:i.failedRequests>0?hr(i.errorRate):"neutral",mono:!0,children:Ao(i.errorRate)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"duration",header:u("projects.avg-duration"),align:"right",sort:(i)=>i.avgDuration??-1,render:(i)=>et.jsxDEV("span",{className:"num",children:Ct(i.avgDuration)},void 0,!1,void 0,this)},{key:"last",header:u("projects.last-active"),align:"right",sort:(i)=>i.lastTimestamp,render:(i)=>et.jsxDEV("span",{className:"dim",children:ma(i.lastTimestamp)},void 0,!1,void 0,this)}]}var Ho=_(Ke(),1);var ae=_(te(),1);function gq(){return[{value:"tokens",label:u("common.tokens")},{value:"cost",label:u("common.cost"),title:u("providers.cost-title")},{value:"requests",label:u("common.requests")}]}var A2=6;function M2(){return[{key:"input",label:u("ui.uncached-input"),color:"#5b8cff"},{key:"cacheRead",label:u("common.cache-read"),color:"var(--chart-primary)"},{key:"cacheWrite",label:u("common.cache-write"),color:"#f5b54a"},{key:"output",label:u("common.output"),color:"var(--chart-secondary)"}]}function D2({active:r,range:l}){let i=Pt(["providers",l],({signal:z})=>SI(l,z),{enabled:r}),[c,f]=Ho.useState("tokens"),[v,y]=Pr(),g=aa(l),m=Pt(["provider-windows",l],({signal:z})=>hb(l,null,z),{enabled:r}),[b,h]=Ho.useState(null),S=yq(m.data?.windowInsights??[],b),L=S?.provider??null,I=Pt(["provider-windows",l,L],({signal:z})=>hb(l,L,z),{enabled:r&&L!==null}),C=Ho.useMemo(()=>{let z=i.data?.providers??[],Y=i.data?.series??[],W=Vf(z.map((ee)=>({key:ee.provider,weight:ee.totalTokens}))),ue=oo(l,Y.map((ee)=>ee.timestamp)),Z={requests:0,failed:0,tokens:0,cost:0,unpriced:0};for(let ee of z)Z.requests+=ee.totalRequests,Z.failed+=ee.failedRequests,Z.tokens+=ee.totalTokens,Z.cost+=ee.totalCost,Z.unpriced+=ee.unpricedRequests;let ce=(ee)=>Xn(Y,{buckets:ue,key:(G)=>G.provider,value:ee,limit:A2,colors:W}).map((G)=>({...G,values:G.values.map((V)=>V||null)}));return{colors:W,buckets:ue,totals:Z,burn:{tokens:ce((ee)=>ee.totalTokens),cost:ce((ee)=>ee.cost),requests:ce((ee)=>ee.requests)},spark:{tokens:ha(Y,ue,(ee)=>ee.totalTokens),cost:ha(Y,ue,(ee)=>ee.cost),requests:ha(Y,ue,(ee)=>ee.requests)},topProvider:z.reduce((ee,G)=>ee===null||G.totalTokens>ee.totalTokens?G:ee,null)}},[i.data,l]),T=C.burn[c],R=c==="cost"?(z)=>zt(z):se,O=C.totals;return ae.jsxDEV("div",{className:"page",children:[ae.jsxDEV(la,{title:u("common.providers"),description:u("providers.description",{window:u(g.windowKey)})},void 0,!1,void 0,this),ae.jsxDEV(_e,{query:i,skeleton:ae.jsxDEV(qt,{height:112},void 0,!1,void 0,this),children:({providers:z})=>ae.jsxDEV("div",{"data-stale":i.stale,children:ae.jsxDEV(wa,{min:190,children:[ae.jsxDEV(ie,{label:u("common.providers"),value:A(z.length),hint:C.topProvider?u("providers.most-tokens",{provider:C.topProvider.provider}):void 0},void 0,!1,void 0,this),ae.jsxDEV(ie,{label:u("common.requests"),value:A(O.requests),hint:u("providers.failed-n",{count:A(O.failed)}),spark:C.spark.requests},void 0,!1,void 0,this),ae.jsxDEV(ie,{label:u("common.tokens"),title:u("providers.tokens-title"),value:se(O.tokens),spark:C.spark.tokens},void 0,!1,void 0,this),ae.jsxDEV(ie,{label:u("providers.api-equivalent-cost"),title:u("providers.api-cost-title"),value:oa(O.cost,O.unpriced),hint:O.unpriced>0?u("providers.unpriced-n",{count:A(O.unpriced)}):void 0,spark:C.spark.cost,sparkColor:"var(--chart-secondary)"},void 0,!1,void 0,this),ae.jsxDEV(ie,{label:u("common.error-rate"),value:Ao(O.requests>0?O.failed/O.requests:0),hint:u("providers.succeeded-n",{count:A(O.requests-O.failed)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV(fe,{index:1,title:u("providers.totals"),description:O.unpriced>0?u(O.unpriced===1?"providers.totals-description-unpriced-one":"providers.totals-description-unpriced-n",{count:A(O.unpriced)}):u("providers.totals-description"),flush:!0,stale:i.stale,children:ae.jsxDEV(_e,{query:i,skeleton:ae.jsxDEV(pa,{rows:6},void 0,!1,void 0,this),children:({providers:z})=>ae.jsxDEV(vq,{providers:z,colors:C.colors},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV("div",{className:"grid grid-main-side",children:[ae.jsxDEV(fe,{index:2,title:u("providers.burn"),description:c==="cost"&&O.unpriced>0?u("providers.burn-estimate-description",{bucket:g.bucketMs<86400000?u("providers.bucket-hour"):u("providers.bucket-day")}):u("providers.burn-description",{bucket:g.bucketMs<3600000?u("providers.bucket-5m"):g.bucketMs<86400000?u("providers.bucket-hour"):u("providers.bucket-day"),count:A2}),actions:ae.jsxDEV(Oa,{size:"sm",options:gq(),value:c,onChange:f},void 0,!1,void 0,this),stale:i.stale,children:ae.jsxDEV(_e,{query:i,skeleton:ae.jsxDEV(qt,{height:260},void 0,!1,void 0,this),children:()=>ae.jsxDEV("div",{className:"stack",style:{gap:12},children:[ae.jsxDEV(_o,{buckets:C.buckets,bucketMs:g.bucketMs,series:T,hidden:v,height:260,format:R,formatTooltip:c==="cost"?(z)=>zt(z):A,emptyLabel:u("providers.no-provider-activity")},void 0,!1,void 0,this),ae.jsxDEV(ia,{items:T.map((z)=>({key:z.key,label:z.label,color:z.color,value:R(z.values.reduce((Y,W)=>Y+(W??0),0))})),hidden:v,onToggle:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV(_e,{query:i,skeleton:ae.jsxDEV(qt,{height:320},void 0,!1,void 0,this),children:({hourly:z,providers:Y})=>ae.jsxDEV(bq,{hourly:z,providers:Y,stale:i.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae.jsxDEV(fe,{index:4,title:u("providers.subscription-windows"),description:u("providers.subscription-windows-description"),flush:!0,stale:m.stale,children:ae.jsxDEV(_e,{query:m,skeleton:ae.jsxDEV(pa,{rows:6},void 0,!1,void 0,this),children:(z)=>ae.jsxDEV(Sq,{insights:z.windowInsights,selected:S,onSelect:h},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV(Tq,{insights:m.data?.windowInsights??null,accounts:I,selected:S,onSelect:h},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function yq(r,l){if(l&&r.some((c)=>c.provider===l.provider&&c.windowKey===l.windowKey))return l;let i=l&&r.find((c)=>c.provider===l.provider)||r.reduce((c,f)=>c===void 0||f.fractionConsumed>c.fractionConsumed?f:c,void 0);return i?{provider:i.provider,windowKey:i.windowKey}:null}function vq({providers:r,colors:l}){let[i,c]=Ho.useState(null),f=Ho.useMemo(()=>{let v=0,y=0,g=0;for(let m of r)v=Math.max(v,m.totalRequests),y=Math.max(y,m.totalTokens),g+=m.totalTokens;return[{key:"provider",header:u("common.provider"),sort:(m)=>m.provider,render:(m)=>ae.jsxDEV("span",{className:"row",style:{gap:8},children:[ae.jsxDEV(an,{color:l.get(m.provider)??Mo},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"mono cell-primary",children:m.provider},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"requests",header:u("common.requests"),align:"right",sort:(m)=>m.totalRequests,render:(m)=>ae.jsxDEV(Ma,{value:m.totalRequests,max:v,display:A(m.totalRequests)},void 0,!1,void 0,this)},{key:"errors",header:u("common.error-rate"),align:"right",sort:(m)=>m.totalRequests>0?m.failedRequests/m.totalRequests:0,render:(m)=>{let b=m.totalRequests>0?m.failedRequests/m.totalRequests:0;return ae.jsxDEV("span",{className:"row",style:{gap:8,justifyContent:"flex-end"},children:[ae.jsxDEV("span",{className:"num dim",children:A(m.failedRequests)},void 0,!1,void 0,this),ae.jsxDEV(ct,{tone:m.failedRequests>0?hr(b):"neutral",mono:!0,children:Ao(b)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}},{key:"models",header:u("common.models"),title:u("providers.models-title"),align:"right",sort:(m)=>m.models,render:(m)=>ae.jsxDEV("span",{className:"num",children:A(m.models)},void 0,!1,void 0,this)},{key:"tokens",header:u("common.tokens"),title:u("providers.tokens-title"),align:"right",sort:(m)=>m.totalTokens,render:(m)=>ae.jsxDEV(Ma,{value:m.totalTokens,max:y,display:se(m.totalTokens),color:l.get(m.provider)},void 0,!1,void 0,this)},{key:"share",header:u("common.share"),title:u("providers.share-title"),align:"right",sort:(m)=>m.totalTokens,render:(m)=>ae.jsxDEV("span",{className:"num muted",children:Ge(g>0?m.totalTokens/g:0)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("providers.cost-title"),align:"right",sort:(m)=>m.totalCost,render:(m)=>ae.jsxDEV("span",{className:"num",title:m.unpricedRequests>0?u("providers.unpriced-n",{count:A(m.unpricedRequests)}):void 0,children:oa(m.totalCost,m.unpricedRequests)},void 0,!1,void 0,this)},{key:"tps",header:u("common.tokens-per-second"),title:u("providers.tps-title"),align:"right",sort:(m)=>m.avgTokensPerSecond??-1,render:(m)=>ae.jsxDEV("span",{className:"num",children:Gn(m.avgTokensPerSecond)},void 0,!1,void 0,this)},{key:"premium",header:u("common.premium"),title:u("providers.premium-title"),align:"right",sort:(m)=>m.totalPremiumRequests,render:(m)=>ae.jsxDEV("span",{className:m.totalPremiumRequests>0?"num":"num dim",children:A(Math.round(m.totalPremiumRequests*100)/100)},void 0,!1,void 0,this)}]},[r,l]);return ae.jsxDEV(Ft,{rows:r,rowKey:(v)=>v.provider,columns:f,initialSort:{key:"tokens",dir:"desc"},limit:12,selectedKey:i,onRowClick:(v)=>c((y)=>y===v.provider?null:v.provider),expanded:(v)=>v.provider===i?ae.jsxDEV(xq,{provider:v},void 0,!1,void 0,this):null,empty:ae.jsxDEV(Je,{title:u("providers.no-requests-in-range")},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function xq({provider:r}){let l={input:r.totalInputTokens,cacheRead:r.totalCacheReadTokens,cacheWrite:r.totalCacheWriteTokens,output:r.totalOutputTokens};return ae.jsxDEV("div",{className:"providers-mix",children:[ae.jsxDEV($n,{segments:M2().map((i)=>({key:i.key,label:i.label,value:l[i.key],color:i.color}))},void 0,!1,void 0,this),ae.jsxDEV(ia,{items:M2().map((i)=>({key:i.key,label:i.label,color:i.color,value:`${se(l[i.key])} · ${r.totalTokens>0?Ge(l[i.key]/r.totalTokens,0):"–"}`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Qf="";function bq({hourly:r,providers:l,stale:i}){let[c,f]=Ho.useState(Qf),v=c===Qf||l.some((m)=>m.provider===c)?c:Qf,y=Ho.useMemo(()=>{let m=Array.from({length:24},()=>0),b=Array.from({length:24},()=>0),h=Array.from({length:24},()=>0);for(let C of r){if(v!==Qf&&C.provider!==v)continue;m[C.hour]+=C.totalTokens,b[C.hour]+=C.outputTokens,h[C.hour]+=C.requests}let S=0;for(let C=1;C<24;C++)if(m[C]>m[S])S=C;let L=m[S]>0;return{series:[{key:"tokens",label:u("common.tokens"),color:"var(--chart-primary)",values:m.map((C,T)=>L&&T===S?null:C)},{key:"peak",label:u("providers.tokens-peak-hour"),color:"var(--chart-secondary)",values:m.map((C,T)=>L&&T===S?C:null)}],output:b,requests:h,peak:S,hasData:L}},[r,v]),g=(m)=>`${String(m).padStart(2,"0")}:00`;return ae.jsxDEV(fe,{index:3,title:u("providers.peak-burn-hours"),description:y.hasData?u("providers.peak-hours-description",{hour:g(y.peak)}):u("providers.hours-description"),actions:ae.jsxDEV("select",{className:"input providers-select",value:v,onChange:(m)=>f(m.target.value),"aria-label":u("common.provider"),children:[ae.jsxDEV("option",{value:Qf,children:u("providers.all-providers")},void 0,!1,void 0,this),l.map((m)=>ae.jsxDEV("option",{value:m.provider,children:m.provider},m.provider,!1,void 0,this))]},void 0,!0,void 0,this),stale:i,children:ae.jsxDEV(yr,{slots:24,tickLabel:(m)=>String(m).padStart(2,"0"),tooltipTitle:(m)=>`${g(m)}–${g((m+1)%24)}`,series:y.series,height:260,showTotal:!1,formatTooltip:A,emptyLabel:u("providers.no-activity-in-range"),tooltipExtra:(m)=>ae.jsxDEV(ae.Fragment,{children:[ae.jsxDEV("div",{className:"chart-tooltip-row",children:[ae.jsxDEV("span",{className:"chart-tooltip-label",children:u("common.output")},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"chart-tooltip-value",children:A(y.output[m])},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae.jsxDEV("div",{className:"chart-tooltip-row",children:[ae.jsxDEV("span",{className:"chart-tooltip-label",children:u("common.requests")},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"chart-tooltip-value",children:A(y.requests[m])},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Sq({insights:r,selected:l,onSelect:i}){return ae.jsxDEV(Ft,{rows:r,rowKey:(c)=>`${c.provider}::${c.windowKey}`,columns:kq(),initialSort:{key:"consumed",dir:"desc"},limit:12,selectedKey:l?`${l.provider}::${l.windowKey}`:null,onRowClick:(c)=>i({provider:c.provider,windowKey:c.windowKey}),empty:ae.jsxDEV(Je,{title:u("providers.no-snapshots-in-range"),hint:u("providers.snapshot-hint")},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function kq(){return[{key:"window",header:u("providers.window"),sort:(r)=>`${r.provider} ${r.windowKey}`,render:(r)=>ae.jsxDEV(co,{primary:r.windowKey,secondary:ae.jsxDEV("span",{className:"mono",children:r.provider},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{key:"accounts",header:u("providers.accounts"),title:u("providers.accounts-title"),align:"right",sort:(r)=>r.accounts,render:(r)=>ae.jsxDEV("span",{className:"num",children:A(r.accounts)},void 0,!1,void 0,this)},{key:"cycles",header:u("providers.resets"),title:u("providers.resets-title"),align:"right",sort:(r)=>r.cycles,render:(r)=>ae.jsxDEV("span",{className:"num muted",children:A(r.cycles)},void 0,!1,void 0,this)},{key:"consumed",header:u("providers.windows-burned"),title:u("providers.windows-burned-title"),align:"right",sort:(r)=>r.fractionConsumed,render:(r)=>ae.jsxDEV("span",{className:"num",children:r.fractionConsumed.toFixed(2)},void 0,!1,void 0,this)},{key:"capacity",header:u("providers.tokens-per-window"),title:u("providers.tokens-per-window-title"),align:"right",sort:(r)=>r.estTokensPerWindow??-1,render:(r)=>r.estTokensPerWindow!==null?ae.jsxDEV("span",{className:"num",children:se(r.estTokensPerWindow)},void 0,!1,void 0,this):ae.jsxDEV("span",{className:"dim",title:u("providers.too-little-consumed"),children:"–"},void 0,!1,void 0,this)},{key:"peak",header:u("providers.peak-utilization"),title:u("providers.peak-utilization-title"),align:"right",sort:(r)=>r.peakConcurrentFraction,render:(r)=>{let l=r.accounts>0?r.peakConcurrentFraction/r.accounts:0;return ae.jsxDEV(Ma,{value:r.peakConcurrentFraction,max:r.accounts,display:Ge(r.peakConcurrentFraction,0),color:l>=0.9?"var(--warn)":void 0},void 0,!1,void 0,this)}},{key:"ideal",header:u("providers.accounts-needed"),title:u("providers.accounts-needed-title"),align:"right",sort:(r)=>r.idealAccounts-r.accounts,render:(r)=>r.idealAccounts>r.accounts?ae.jsxDEV(ct,{tone:"warn",mono:!0,children:u("providers.ideal-accounts",{ideal:A(r.idealAccounts),have:A(r.accounts)})},void 0,!1,void 0,this):ae.jsxDEV("span",{className:"num",children:A(r.idealAccounts)},void 0,!1,void 0,this)},{key:"exhausted",header:u("providers.exhaustions"),title:u("providers.exhaustions-title"),align:"right",sort:(r)=>r.exhaustedEvents,render:(r)=>r.exhaustedEvents>0?ae.jsxDEV(ct,{tone:"warn",mono:!0,children:u("providers.exhausted-n",{count:A(r.exhaustedEvents)})},void 0,!1,void 0,this):ae.jsxDEV("span",{className:"num dim",children:"0"},void 0,!1,void 0,this)}]}var pg=60000,Ds=60*pg,mg=24*Ds,Lq=[5*pg,15*pg,30*pg,Ds,2*Ds,3*Ds,6*Ds,12*Ds,mg],wq=240,Cq=6*Ds;function Tq({insights:r,accounts:l,selected:i,onSelect:c}){let[f,v]=Pr(),y=Ho.useMemo(()=>[...new Set((r??[]).map((C)=>C.provider))],[r]),g=Ho.useMemo(()=>(r??[]).filter((C)=>C.provider===i?.provider).map((C)=>({key:C.windowKey,label:C.windowKey})),[r,i?.provider]),m=Ho.useMemo(()=>(l.data?.usageSeries??[]).filter((C)=>C.provider===i?.provider),[l.data,i?.provider]),b=m.length===0&&(l.loading||l.stale),h=Ho.useMemo(()=>{let C=new Map;for(let R of m){let O=C.get(R.accountLabel)??[];if(!O.includes(R.accountKey))O.push(R.accountKey);C.set(R.accountLabel,O)}let T=new Map;for(let[R,O]of C)O.sort(),O.forEach((z,Y)=>T.set(z,O.length>1?`${R} #${Y+1}`:R));return T},[m]),S=Ho.useMemo(()=>Iq(m.filter((C)=>C.windowKey===i?.windowKey),h),[m,h,i?.windowKey]),L=Ho.useMemo(()=>{let C=new Map(S.series.map((T)=>[T.key,T.color]));return m.map((T)=>{let R=null,O=null;for(let W of T.points){if(W.usedFraction===null)continue;if(O=Math.max(O??0,W.usedFraction),!R||W.timestamp>=R.timestamp)R={fraction:W.usedFraction,exhausted:W.exhausted,timestamp:W.timestamp}}let z=T.windowKey===i?.windowKey?C.get(T.accountKey)??null:null,Y=h.get(T.accountKey)??T.accountLabel;return{series:T,name:Y,color:z,latest:R,peak:O,samples:T.points.length}}).sort((T,R)=>Number(R.color!==null)-Number(T.color!==null)||T.series.windowKey.localeCompare(R.series.windowKey)||(R.latest?.fraction??-1)-(T.latest?.fraction??-1))},[m,h,S.series,i?.windowKey]),I=g.find((C)=>C.key===i?.windowKey)?.label;return ae.jsxDEV(fe,{index:5,title:u("providers.utilization"),description:S.buckets.length>0?u("providers.utilization-description",{window:I??u("providers.window"),from:Sb(S.first),to:Sb(S.last)}):u("providers.utilization-description-plain"),actions:i&&ae.jsxDEV("div",{className:"row",style:{gap:6},children:[ae.jsxDEV("select",{className:"input providers-select",value:i.provider,onChange:(C)=>{let T=C.target.value,R=r?.find((O)=>O.provider===T);if(R)c({provider:T,windowKey:R.windowKey})},"aria-label":u("common.provider"),children:y.map((C)=>ae.jsxDEV("option",{value:C,children:C},C,!1,void 0,this))},void 0,!1,void 0,this),ae.jsxDEV("select",{className:"input providers-select",value:i.windowKey,onChange:(C)=>c({provider:i.provider,windowKey:C.target.value}),"aria-label":u("providers.window"),children:g.map((C)=>ae.jsxDEV("option",{value:C.key,children:C.label},C.key,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),stale:l.stale,children:r===null?ae.jsxDEV(qt,{height:260},void 0,!1,void 0,this):i===null?ae.jsxDEV(Je,{title:u("providers.no-snapshots-in-range"),hint:u("providers.snapshot-hint")},void 0,!1,void 0,this):ae.jsxDEV(_e,{query:l,skeleton:ae.jsxDEV(qt,{height:260},void 0,!1,void 0,this),children:()=>b?ae.jsxDEV(qt,{height:260},void 0,!1,void 0,this):ae.jsxDEV("div",{className:"stack",style:{gap:16},children:[ae.jsxDEV("div",{className:"stack",style:{gap:12},children:[ae.jsxDEV(yr,{slots:S.buckets.length,tickLabel:(C)=>Gh(S.buckets[C],S.last-S.first>mg?mg:S.bucketMs),tooltipTitle:(C)=>Ju(S.buckets[C],Ds),series:S.series,hidden:f,kind:"line",stacked:!1,height:260,yMax:Math.max(1,S.max),format:(C)=>Ge(C,0),formatTooltip:(C)=>Ge(C,1),references:[{value:1,label:"100%"}],emptyLabel:u("providers.no-utilization-readings"),tooltipExtra:(C)=>{let T=S.exhausted[C];return T.length>0?ae.jsxDEV("div",{className:"chart-tooltip-row",children:[ae.jsxDEV("span",{className:"chart-tooltip-label tone-bad",children:u("providers.exhausted")},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"chart-tooltip-value",children:T.join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null}},void 0,!1,void 0,this),S.series.length>1&&ae.jsxDEV(ia,{items:S.series.map((C)=>({key:C.key,label:C.label,color:C.color})),hidden:f,onToggle:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae.jsxDEV("div",{className:"providers-accounts",children:ae.jsxDEV(Ft,{rows:L,rowKey:(C)=>`${C.series.windowKey}::${C.series.accountKey}`,columns:Aq(),limit:16,onRowClick:(C)=>c({provider:C.series.provider,windowKey:C.series.windowKey}),dense:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Iq(r,l){let{POSITIVE_INFINITY:i,NEGATIVE_INFINITY:c}=Number;for(let L of r)for(let I of L.points){if(I.timestamp<i)i=I.timestamp;if(I.timestamp>c)c=I.timestamp}if(!(c>=i))return{buckets:[],bucketMs:Ds,first:0,last:0,max:0,series:[],exhausted:[]};let f=c-i,v=Lq.find((L)=>f/L<wq)??mg,y=oo("all",[i],v,c),g=y.map(()=>[]),m=0,b=(L)=>l.get(L.accountKey)??L.accountLabel,S=[...r].sort((L,I)=>b(L).localeCompare(b(I))).map((L,I)=>{let C=y.map(()=>null),T=y.map(()=>0);for(let z of L.points){let Y=dg(y,z.timestamp);if(Y<0)continue;if(z.exhausted&&!g[Y].includes(b(L)))g[Y].push(b(L));if(z.usedFraction===null||z.timestamp<T[Y])continue;C[Y]=z.usedFraction,T[Y]=z.timestamp,m=Math.max(m,z.usedFraction)}let R=null,O=0;for(let z=0;z<y.length;z++)if(C[z]!==null)R=C[z],O=T[z];else if(R!==null&&y[z]-O<=Cq)C[z]=R;return{key:L.accountKey,label:b(L),color:Za[I%Za.length],values:C}});return{buckets:y,bucketMs:v,first:i,last:c,max:m,series:S,exhausted:g}}function Rq(r){if(!r)return ae.jsxDEV("span",{className:"dim",children:u("providers.no-reading")},void 0,!1,void 0,this);if(r.exhausted)return ae.jsxDEV(ct,{tone:"bad",children:u("providers.exhausted")},void 0,!1,void 0,this);if(r.fraction>=0.8)return ae.jsxDEV(ct,{tone:"warn",children:u("providers.high")},void 0,!1,void 0,this);return ae.jsxDEV(ct,{tone:"ok",children:u("ui.status-ok")},void 0,!1,void 0,this)}function Aq(){return[{key:"account",header:u("providers.account"),sort:(r)=>r.name,render:(r)=>ae.jsxDEV("span",{className:"row",style:{gap:8},children:[ae.jsxDEV("span",{className:"providers-swatch-slot",children:r.color&&ae.jsxDEV(an,{color:r.color},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae.jsxDEV("span",{className:"truncate providers-account",title:r.series.accountKey,children:r.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"window",header:u("providers.window"),sort:(r)=>r.series.windowKey,render:(r)=>ae.jsxDEV("span",{className:r.color?void 0:"muted",children:r.series.windowKey},void 0,!1,void 0,this)},{key:"latest",header:u("providers.latest-used"),align:"right",sort:(r)=>r.latest?.fraction??-1,render:(r)=>r.latest?ae.jsxDEV(Ma,{value:r.latest.fraction,max:1,display:Ge(r.latest.fraction,0),color:r.latest.exhausted?"var(--bad)":r.latest.fraction>=0.8?"var(--warn)":"var(--ok)"},void 0,!1,void 0,this):ae.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)},{key:"status",header:u("providers.status"),sort:(r)=>r.latest?.exhausted?2:(r.latest?.fraction??0)>=0.8?1:0,render:(r)=>Rq(r.latest)},{key:"peak",header:u("providers.peak-in-range"),align:"right",sort:(r)=>r.peak??-1,render:(r)=>ae.jsxDEV("span",{className:"num",children:r.peak===null?"–":Ge(r.peak,0)},void 0,!1,void 0,this)},{key:"samples",header:u("providers.snapshots"),align:"right",sort:(r)=>r.samples,render:(r)=>ae.jsxDEV("span",{className:"num muted",children:A(r.samples)},void 0,!1,void 0,this)},{key:"recorded",header:u("providers.recorded"),align:"right",sort:(r)=>r.latest?.timestamp??0,render:(r)=>ae.jsxDEV("span",{className:"muted",children:r.latest?ma(r.latest.timestamp):"–"},void 0,!1,void 0,this)}]}var Hi=_(Ke(),1);var pt=_(te(),1),Mq={ok:"ok",aborted:"warn",failed:"bad"},Dq={ok:"ui.status-ok",aborted:"common.aborted",failed:"common.failed"};function hg(r){return{label:u(Dq[r]),tone:Mq[r]}}function E2({id:r,onClose:l}){let i=Pt(["request",r],({signal:v})=>sI(r??0,v),{enabled:r!==null}),c=i.stale?null:i.data,f=c?hg(As(c)):null;return pt.jsxDEV(ed,{open:r!==null,onClose:l,width:620,title:c?pt.jsxDEV("span",{className:"mono",children:c.model},void 0,!1,void 0,this):u("common.request"),subtitle:c?pt.jsxDEV(pt.Fragment,{children:[c.provider," ·"," ",pt.jsxDEV("span",{title:ro(c.timestamp),children:ma(c.timestamp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):r!==null?pt.jsxDEV("span",{className:"mono",children:["#",r]},void 0,!0,void 0,this):void 0,actions:c&&f?pt.jsxDEV("div",{className:"row",style:{gap:6},children:[pt.jsxDEV("a",{className:"btn","data-size":"sm","data-variant":"ghost",href:rg({...Gf(window.location.hash),section:"traces",session:c.sessionFile}),onClick:l,title:u("ui.open-trace"),children:[pt.jsxDEV(xf,{size:13},void 0,!1,void 0,this)," Trace"]},void 0,!0,void 0,this),pt.jsxDEV(ct,{tone:f.tone,children:f.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this):void 0,children:c?pt.jsxDEV(Eq,{details:c,aborted:As(c)==="aborted"},void 0,!1,void 0,this):i.error?pt.jsxDEV(ql,{error:i.error,onRetry:i.refetch},void 0,!1,void 0,this):pt.jsxDEV("div",{className:"stack",style:{gap:12},children:[pt.jsxDEV(Fa,{height:56},void 0,!1,void 0,this),pt.jsxDEV(Fa,{height:120},void 0,!1,void 0,this),pt.jsxDEV(Fa,{height:120},void 0,!1,void 0,this),pt.jsxDEV(Fa,{height:220},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Eq({details:r,aborted:l}){let{usage:i}=r,c=r.duration!==null&&r.duration>0&&i.output>0?i.output*1000/r.duration:null,{messages:f,output:v,...y}=r;return pt.jsxDEV(pt.Fragment,{children:[r.errorMessage&&pt.jsxDEV("section",{className:"request-drawer-error","data-tone":l?"warn":"bad",role:"note",children:[pt.jsxDEV("div",{className:"request-drawer-error-label",children:l?u("common.aborted"):u("common.error")},void 0,!1,void 0,this),pt.jsxDEV("pre",{className:"request-drawer-error-text",children:r.errorMessage},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt.jsxDEV("section",{children:[pt.jsxDEV("div",{className:"section-label",children:u("ui.section-timing")},void 0,!1,void 0,this),pt.jsxDEV(So,{items:[{key:"at",label:u("common.started"),value:ro(r.timestamp)},{key:"duration",label:u("common.duration"),value:Ct(r.duration)},{key:"ttft",label:u("ui.time-to-first-token"),value:Ct(r.ttft)},{key:"tps",label:u("common.output-tokens-per-second"),value:Gn(c)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt.jsxDEV("section",{children:[pt.jsxDEV("div",{className:"section-label",children:u("common.tokens")},void 0,!1,void 0,this),pt.jsxDEV(So,{items:[{key:"input",label:u("ui.uncached-input"),value:A(i.input)},{key:"cacheRead",label:u("common.cache-read"),value:A(i.cacheRead)},{key:"cacheWrite",label:u("common.cache-write"),value:A(i.cacheWrite)},{key:"output",label:u("common.output"),value:A(i.output)},{key:"total",label:u("common.total"),value:A(i.totalTokens)},{key:"premium",label:u("common.premium-requests"),value:A(Math.round((i.premiumRequests??0)*100)/100)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt.jsxDEV("section",{children:[pt.jsxDEV("div",{className:"section-label",children:u("ui.section-cost")},void 0,!1,void 0,this),pt.jsxDEV(So,{items:[{key:"total",label:"Total",value:Ol(r,4)},{key:"input",label:u("common.input"),value:zt(i.cost.input,4)},{key:"cacheRead",label:"Cache read",value:zt(i.cost.cacheRead,4)},{key:"cacheWrite",label:"Cache write",value:zt(i.cost.cacheWrite,4)},{key:"output",label:"Output",value:zt(i.cost.output,4)}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt.jsxDEV("section",{children:[pt.jsxDEV("div",{className:"section-label",children:u("ui.section-identity")},void 0,!1,void 0,this),pt.jsxDEV(So,{items:[{key:"id",label:u("common.request-id"),value:r.id??"–"},{key:"entry",label:u("common.entry-id"),value:r.entryId},{key:"stop",label:u("ui.stop-reason"),value:r.stopReason},{key:"api",label:"API",value:r.api},{key:"project",label:u("common.project"),value:pt.jsxDEV("span",{title:r.folder,children:zr(r.folder)},void 0,!1,void 0,this)}]},void 0,!1,void 0,this),pt.jsxDEV("div",{className:"request-drawer-file",children:[pt.jsxDEV("span",{className:"kv-key",children:u("ui.session-file")},void 0,!1,void 0,this),pt.jsxDEV("span",{className:"kv-value",children:r.sessionFile},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v!=null&&pt.jsxDEV(td,{data:v,title:u("common.output-message")},void 0,!1,void 0,this),pt.jsxDEV(td,{data:f,title:u("common.session-entry"),initialCollapsed:!0},void 0,!1,void 0,this),pt.jsxDEV(td,{data:y,title:u("ui.stats-row"),initialCollapsed:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ut=_(te(),1),Ob=[500,2000,1e4];function N2({active:r,range:l,onRequestClick:i}){let[c,f]=Hi.useState(0),v=Ob[c],y=Pt(["requests-log",v],({signal:W})=>Vh(v,W),{enabled:r}),[g,m]=Hi.useState(""),[b,h]=Hi.useState("all"),S=aa(l),L=Hi.useMemo(()=>{let W=y.data??[],ue=S.spanMs===null?null:Date.now()-S.spanMs,Z=ue===null?W:W.filter((G)=>G.timestamp>=ue),ce=!y.stale&&(W.length<v||ue!==null&&Z.length<W.length),ee={all:Z.length,ok:0,aborted:0,failed:0};for(let G of Z)ee[As(G)]++;return{loaded:W.length,inRange:Z,complete:ce,counts:ee,summary:c2(Z)}},[y.data,y.stale,v,S.spanMs]),I=Hi.useMemo(()=>{let W=g.trim().toLowerCase();return L.inRange.filter((ue)=>(b==="all"||As(ue)===b)&&(W===""||ue.model.toLowerCase().includes(W)||ue.provider.toLowerCase().includes(W)||ue.folder.toLowerCase().includes(W)))},[L.inRange,g,b]),{summary:C,counts:T,complete:R}=L,O=c+1<Ob.length?Ob[c+1]:null,z=O!==null?ut.jsxDEV("button",{type:"button",className:"btn","data-size":"sm",disabled:y.refreshing,onClick:()=>f(c+1),children:y.refreshing&&y.stale?u("requests.loading"):u("requests.load-latest",{count:A(O)})},void 0,!1,void 0,this):void 0,Y=["all","ok","aborted","failed"].map((W)=>({value:W,label:ut.jsxDEV(ut.Fragment,{children:[W==="all"?u("requests.status-all"):hg(W).label," ",ut.jsxDEV("span",{className:"dim num",children:se(T[W])},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}));return ut.jsxDEV("div",{className:"page",children:[ut.jsxDEV(la,{title:u("common.requests"),description:u("requests.description",{window:u(S.windowKey)})},void 0,!1,void 0,this),ut.jsxDEV(_e,{query:y,skeleton:ut.jsxDEV(Fa,{height:96,style:{borderRadius:12}},void 0,!1,void 0,this),children:()=>ut.jsxDEV("div",{"data-stale":y.stale,children:ut.jsxDEV(wa,{min:160,children:[ut.jsxDEV(ie,{label:u("common.requests"),value:A(C.requests),hint:C.oldest===null?u("requests.none-in-window",{window:u(S.windowKey)}):u("requests.since",{time:ma(C.oldest)})},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("common.failed"),value:A(C.failed),hint:u("requests.failed-hint",{rate:C.requests>0?Ao(C.failed/C.requests):"–",count:A(C.aborted)})},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("common.tokens"),title:u("requests.tokens-hint"),value:se(C.tokens)},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("requests.api-equivalent-cost"),title:u("requests.cost-hint"),value:oa(C.cost,C.unpriced),hint:C.unpriced>0?u("requests.unpriced-n",{count:A(C.unpriced)}):void 0},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("requests.median-duration"),value:Ct(C.medianDuration),hint:u("requests.p95",{value:Ct(C.p95Duration)})},void 0,!1,void 0,this),ut.jsxDEV(ie,{label:u("requests.median-ttft"),title:u("requests.ttft-hint"),value:Ct(C.medianTtft)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut.jsxDEV(fe,{index:1,title:u("requests.log-title"),description:y.data===null?u("requests.log-loading"):R?u("requests.log-count-in-window",{shown:A(I.length),total:A(C.requests),window:u(S.windowKey)}):u("requests.log-count-latest",{shown:A(I.length),total:A(C.requests)}),actions:ut.jsxDEV(ut.Fragment,{children:[ut.jsxDEV(Fn,{value:g,onChange:m,placeholder:u("requests.search-placeholder")},void 0,!1,void 0,this),ut.jsxDEV(Oa,{size:"sm","aria-label":u("requests.status"),options:Y,value:b,onChange:h},void 0,!1,void 0,this)]},void 0,!0,void 0,this),flush:!0,stale:y.stale,footer:y.data!==null&&!R?ut.jsxDEV(ut.Fragment,{children:[ut.jsxDEV("span",{children:u("requests.footer",{count:A(L.loaded),time:C.oldest===null?"–":ro(C.oldest),window:u(S.windowKey)})},void 0,!1,void 0,this),z]},void 0,!0,void 0,this):void 0,children:ut.jsxDEV(_e,{query:y,skeleton:ut.jsxDEV(pa,{rows:12},void 0,!1,void 0,this),children:()=>ut.jsxDEV(Ft,{rows:I,rowKey:(W)=>W.id??`${W.sessionFile}:${W.entryId}`,onRowClick:(W)=>W.id!==void 0&&i(W.id),columns:Nq(),initialSort:{key:"time",dir:"desc"},limit:100,dense:!0,empty:ut.jsxDEV(Je,{title:C.requests===0?u("requests.empty-in-window",{window:u(S.windowKey)}):u("requests.empty-no-match"),hint:C.requests===0?void 0:u("requests.empty-no-match-hint")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Nq(){return[{key:"model",header:u("common.model"),sort:(r)=>r.model,render:(r)=>ut.jsxDEV(co,{primary:ut.jsxDEV("span",{className:"mono",children:r.model},void 0,!1,void 0,this),secondary:r.provider},void 0,!1,void 0,this)},{key:"time",header:u("requests.when"),sort:(r)=>r.timestamp,render:(r)=>ut.jsxDEV("span",{className:"muted",title:ro(r.timestamp),children:ma(r.timestamp)},void 0,!1,void 0,this)},{key:"project",header:u("common.project"),sort:(r)=>r.folder,render:(r)=>ut.jsxDEV("span",{className:"mono muted truncate",title:r.folder,style:{display:"block",maxWidth:180},children:zr(r.folder)},void 0,!1,void 0,this)},{key:"input",header:u("common.input"),title:u("requests.uncached-input"),align:"right",sort:(r)=>r.usage.input,render:(r)=>ut.jsxDEV("span",{className:"num",children:se(r.usage.input)},void 0,!1,void 0,this)},{key:"cache",header:u("common.cache-read"),title:u("requests.cache-read-title"),align:"right",sort:(r)=>r.usage.cacheRead,render:(r)=>ut.jsxDEV("span",{className:"num",title:u("requests.cache-write",{count:A(r.usage.cacheWrite)}),children:se(r.usage.cacheRead)},void 0,!1,void 0,this)},{key:"output",header:u("common.output"),align:"right",sort:(r)=>r.usage.output,render:(r)=>ut.jsxDEV("span",{className:"num",children:se(r.usage.output)},void 0,!1,void 0,this)},{key:"cost",header:u("common.cost"),title:u("requests.cost-estimate"),align:"right",sort:(r)=>r.usage.cost.total,render:(r)=>ut.jsxDEV("span",{className:"num",children:Ol(r,4)},void 0,!1,void 0,this)},{key:"duration",header:u("common.duration"),align:"right",sort:(r)=>r.duration??-1,render:(r)=>ut.jsxDEV("span",{className:"num",children:Ct(r.duration)},void 0,!1,void 0,this)},{key:"ttft",header:u("requests.ttft"),title:u("requests.ttft-hint"),align:"right",sort:(r)=>r.ttft??-1,render:(r)=>ut.jsxDEV("span",{className:"num muted",children:Ct(r.ttft)},void 0,!1,void 0,this)},{key:"status",header:u("requests.status"),sort:(r)=>As(r),render:(r)=>{let l=hg(As(r));return ut.jsxDEV("span",{title:r.errorMessage??void 0,children:ut.jsxDEV(co,{lead:ut.jsxDEV(Hn,{tone:l.tone},void 0,!1,void 0,this),primary:l.label,secondary:ut.jsxDEV("span",{className:"mono",children:r.stopReason},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}}]}var fR=_(Ke(),1);var q2=["January","February","March","April","May","June","July","August","September","October","November","December"],O2=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],qq=["MMMM","yyyy","EEEE","MMM","EEE","yy","MM","dd","HH","hh","mm","ss","M","d","H","h","m","s","a"];function zl(r,l=2){return String(r).padStart(l,"0")}function Oq(r,l){let i=r.getMonth(),c=r.getDay(),f=r.getHours(),v=f%12||12;switch(l){case"yyyy":return zl(r.getFullYear(),4);case"yy":return zl(r.getFullYear()%100);case"MMMM":return q2[i];case"MMM":return q2[i].slice(0,3);case"MM":return zl(i+1);case"M":return String(i+1);case"dd":return zl(r.getDate());case"d":return String(r.getDate());case"EEEE":return O2[c];case"EEE":return O2[c].slice(0,3);case"HH":return zl(f);case"H":return String(f);case"hh":return zl(v);case"h":return String(v);case"mm":return zl(r.getMinutes());case"m":return String(r.getMinutes());case"ss":return zl(r.getSeconds());case"s":return String(r.getSeconds());case"a":return f<12?"AM":"PM"}}function Bq(r){let l=r instanceof Date?new Date(r.getTime()):new Date(r);if(Number.isNaN(l.getTime()))throw RangeError("Invalid time value");return l}function B2(r,l){let i=Bq(r),c="";for(let f=0;f<l.length;){if(l[f]==="'"){if(l[f+1]==="'"){c+="'",f+=2;continue}f++;while(f<l.length){if(l[f]!=="'"){c+=l[f++];continue}if(l[f+1]==="'"){c+="'",f+=2;continue}f++;break}continue}let v=l.slice(f),y=qq.find((m)=>v.startsWith(m));if(y){c+=Oq(i,y),f+=y.length;continue}let g=l[f++];if(/[A-Za-z]/.test(g))throw RangeError(`Format string contains an unescaped latin alphabet character \`${g}\``);c+=g}return c}var Wf=_(Ke(),1);var gg=["artifact","reread","rerun"],Es={artifact:{label:"Artifact dive",plural:"Artifact dives",icon:tf,color:"var(--spot-artifact)",rule:"A later call read or searched an artifact the shortened result named"},reread:{label:"Re-read",plural:"Re-reads",icon:hf,color:"var(--spot-reread)",rule:"A later read of the same file overlapping the hidden lines, or the whole file again"},rerun:{label:"Rerun",plural:"Reruns",icon:Mf,color:"var(--spot-rerun)",rule:"A call of the same tool within 12 calls repeating the shortened one: a bash command the same, with a pipe or redirect added, or ≥ 60% shared tokens; any other tool with ≥ 60% shared argument tokens"}};function Fi(r){return r.gross.byTool.map((l)=>l.tool)}var zq=6,Ur="other";function Qo(r,l=zq){if(r.length<=l+1)return{listed:r,rest:[]};return{listed:r.slice(0,l),rest:r.slice(l)}}var Pa={applied:{label:"Shortened",color:"var(--spot-applied)",shape:"dot",rule:"Spotlight scored the result, shaping shortened it and the model saw the cut"},scoreFree:{label:"Score-free",color:"var(--spot-score-free)",shape:"square",rule:"A random coin skipped Spotlight: the no-score fallback rules shortened it and the model saw the cut"},holdout:{label:"Held out",color:"var(--spot-holdout)",shape:"ring",rule:"Spotlight would have shortened it, but it was held out at random and the model saw it whole"},reference:{label:"Unchanged",color:"var(--spot-reference)",shape:"diamond",rule:"Results shaping left unchanged, re-weighted to the cuts' original-size mix"},gated:{label:"Gated",color:"var(--spot-gated)",shape:"ring",rule:"A read pi's former edit gate (removed) kept whole: the model saw it uncut"}},Bb=["applied","scoreFree","holdout","gated","reference"],yg=["<250","250–1k","1k–4k","≥4k"],P2=["1","2","3","4–6","7–12"],z2={read:gf,bash:Dl,eval:Cl,grep:Of,find:ws,glob:vf,edit:Al,write:mf,web_search:bf,task:lf,todo:Cf,wait:Sf,fetch:Tl,lsp:Af,[Ur]:Il};function _r(r){return Object.hasOwn(z2,r)?z2[r]:Ni}function vg(r){if(r>=86400000)return"day";if(r>=3600000)return"hour";return`${Math.round(r/60000)} minutes`}function fo(r){return r<0?`−${se(-r)}`:se(r)}function vr(r){return r<0?`−${zt(-r)}`:zt(r)}function Yn(r,l){return r.lo===null||r.hi===null?"":`${l(r.lo)}–${l(r.hi)}`}function jt(r){if(r===null||!Number.isFinite(r))return"–";if(r===0)return"0%";let l=Math.abs(r*100);return`${r<0?"−":""}${l>=10?l.toFixed(0):l.toFixed(1)}%`}var tt=_(te(),1);function Pq(r){let l=r.agentType==="main",i=(r.sessionFile.split("/").pop()??"").replace(/\.jsonl$/,""),c=r.title?.trim()||(l?zr(r.folder):i);return`${l?c:`↳ ${c} (${r.agentType})`} · ${se(r.savedTokens)} saved`}function U2({stats:r,active:l,stale:i}){let{compounding:c}=r,[f,v]=Wf.useState(null),y=r.sessionList,g=y.find((C)=>C.savedTokens>0)??y[0],m=f!==null&&y.some((C)=>C.sessionFile===f)?f:g?.sessionFile,b=Pt(["spotlight-session",m??null],({signal:C})=>xI(m??"",C),{enabled:l&&m!==void 0}),h=c.avoidedTokens-c.recoveredCarriedTokens,S=r.gross.savedTokens>0?c.avoidedTokens/r.gross.savedTokens:null,L=b.data?.points,I=Wf.useMemo(()=>{if(!L)return null;let C=0,T=0;for(let R of L)C+=R.withoutTokens-R.contextTokens,T+=R.withoutTokens;return T>0?{share:C/T,tokens:C}:null},[L]);return tt.jsxDEV(fe,{index:3,title:"Compounding",description:"A cut is never re-read: each later request of the session carries a smaller context",actions:y.length>0&&tt.jsxDEV("select",{className:"input spot-session-select","aria-label":"Session",value:m??"",onChange:(C)=>v(C.target.value),children:y.map((C)=>tt.jsxDEV("option",{value:C.sessionFile,children:Pq(C)},C.sessionFile,!1,void 0,this))},void 0,!1,void 0,this),stale:i,footer:"Context = input + cache read + cache write of each request. A compaction is a request whose context is under 60% of the previous one's; it ends the carry.",children:tt.jsxDEV("div",{className:"spot-compounding",children:[tt.jsxDEV("div",{className:"spot-compounding-chart",children:m===void 0?tt.jsxDEV(Je,{title:"No experiment sessions in this range"},void 0,!1,void 0,this):b.data===null?b.error?tt.jsxDEV(ql,{error:b.error,onRetry:b.refetch},void 0,!1,void 0,this):tt.jsxDEV(qt,{height:280},void 0,!1,void 0,this):tt.jsxDEV(Hq,{context:b.data,stale:b.stale},void 0,!1,void 0,this)},void 0,!1,void 0,this),tt.jsxDEV("aside",{className:"spot-compounding-side",children:[tt.jsxDEV("div",{className:"spot-eyebrow",children:"Context avoided in this session"},void 0,!1,void 0,this),tt.jsxDEV("div",{className:"spot-side-value",children:jt(I?.share??null)},void 0,!1,void 0,this),L!==void 0&&tt.jsxDEV("p",{className:"spot-side-copy",children:I===null?"This session has no recorded requests.":`of what its requests would have carried without Spotlight: ${fo(I.tokens)} prompt tokens, net of recoveries.`},void 0,!1,void 0,this),b.data&&tt.jsxDEV(Uq,{session:b.data.session},void 0,!1,void 0,this),tt.jsxDEV("p",{className:"spot-side-range",children:[tt.jsxDEV("span",{className:"spot-side-range-value",children:jt(c.avoidedShare)},void 0,!1,void 0,this)," across all the sessions shown: cuts kept ",se(Math.max(0,h))," tokens out of later requests",S!==null&&tt.jsxDEV(tt.Fragment,{children:[", each saved token re-sent ",S.toFixed(1)," times on average"]},void 0,!0,void 0,this),"."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Uq({session:r}){return tt.jsxDEV("dl",{className:"spot-facts",children:[tt.jsxDEV("div",{children:[tt.jsxDEV("dt",{children:"Agent"},void 0,!1,void 0,this),tt.jsxDEV("dd",{className:"row",children:tt.jsxDEV(ct,{children:r.agentType},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),tt.jsxDEV("div",{children:[tt.jsxDEV("dt",{children:"Requests"},void 0,!1,void 0,this),tt.jsxDEV("dd",{className:"num",children:A(r.requests)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),tt.jsxDEV("div",{children:[tt.jsxDEV("dt",{children:"Saved"},void 0,!1,void 0,this),tt.jsxDEV("dd",{className:"num",children:fo(r.savedTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),tt.jsxDEV("div",{children:[tt.jsxDEV("dt",{children:"Net $"},void 0,!1,void 0,this),tt.jsxDEV("dd",{className:"num",children:vr(r.netUsd)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var _q=[{key:"actual",label:"Context",color:"var(--spot-gross)"},{key:"ghost",label:"Without Spotlight",color:"var(--spot-ghost)"},{key:"compaction",label:"Compaction",color:"var(--line-4)"}];function Hq({context:r,stale:l}){let{points:i}=r,c=Wf.useMemo(()=>{let f=[{key:"actual",label:"Context",color:"var(--spot-gross)",kind:"area",values:i.map((y)=>y.contextTokens)},{key:"ghost",label:"Avoided",color:"var(--spot-ghost)",kind:"area",pattern:"hatch",dashed:!0,values:i.map((y)=>Math.max(0,y.withoutTokens-y.contextTokens))}],v=[];return i.forEach((y,g)=>{if(y.compacted)v.push({index:g})}),{series:f,markers:v}},[i]);if(i.length===0)return tt.jsxDEV(Je,{title:"No requests recorded for this session"},void 0,!1,void 0,this);return tt.jsxDEV("div",{className:"spot-context","data-stale":l,children:[tt.jsxDEV(ia,{items:_q},void 0,!1,void 0,this),tt.jsxDEV(yr,{slots:i.length,series:c.series,markers:c.markers,height:280,tickLabel:(f)=>`#${f+1}`,tooltipTitle:(f)=>`Request ${f+1} · ${B2(new Date(i[f].timestamp),"MMM d HH:mm:ss")}`,formatTooltip:A,showTotal:!1,tooltipExtra:(f)=>{let v=i[f];return tt.jsxDEV("div",{className:"spot-tooltip-extra",children:[tt.jsxDEV("div",{className:"chart-tooltip-row chart-tooltip-total",children:[tt.jsxDEV("span",{className:"chart-tooltip-label",children:"Without Spotlight"},void 0,!1,void 0,this),tt.jsxDEV("span",{className:"chart-tooltip-value",children:A(v.withoutTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.saved>0&&tt.jsxDEV("div",{className:"chart-tooltip-row",children:[tt.jsxDEV("span",{className:"chart-tooltip-label",children:"Cut since last request"},void 0,!1,void 0,this),tt.jsxDEV("span",{className:"chart-tooltip-value",children:A(v.saved)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.recovered>0&&tt.jsxDEV("div",{className:"chart-tooltip-row",children:[tt.jsxDEV("span",{className:"chart-tooltip-label",children:"Fetched back"},void 0,!1,void 0,this),tt.jsxDEV("span",{className:"chart-tooltip-value",children:A(v.recovered)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.compacted&&tt.jsxDEV("div",{className:"chart-tooltip-row dim",children:"Compaction before this request"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ja=_(te(),1),xg="var(--spot-applied)",bg="var(--spot-unshaped)";function _2({stats:r,stale:l}){let i=[...r.coverage].sort((m,b)=>b.tokens-m.tokens),{listed:c,rest:f}=Qo(i),v=0,y=0;for(let m of i)if(m.shaped)v+=m.share;else y+=m.share;let g=c.map((m)=>({key:m.tool,label:Ja.jsxDEV(Ja.Fragment,{children:[Ja.jsxDEV("span",{className:"spot-coverage-tool",children:m.tool},void 0,!1,void 0,this),m.shaped&&Ja.jsxDEV(ct,{children:"shaped"},void 0,!1,void 0,this),Ja.jsxDEV("span",{className:"dim num",children:[A(m.calls)," calls"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),value:m.share,display:`${jt(m.share)} · ${se(m.tokens)}`,color:m.shaped?xg:bg}));if(f.length>0){let m=0,b=0,h=0;for(let S of f)m+=S.share,b+=S.tokens,h+=S.calls;g.push({key:"\x00rest",label:Ja.jsxDEV(Ja.Fragment,{children:[Ja.jsxDEV("span",{className:"spot-coverage-tool",children:[A(f.length)," more ",f.length===1?"tool":"tools"]},void 0,!0,void 0,this),Ja.jsxDEV("span",{className:"dim num",children:[A(h)," calls"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),value:m,display:`${jt(m)} · ${se(b)}`,color:f.some((S)=>S.shaped)?xg:bg})}return Ja.jsxDEV(fe,{index:5,title:"Not shaped yet",description:"Share of the tool output experiment sessions' models saw, by tool: the unshaped ones are where shaping could reach next",actions:Ja.jsxDEV(ia,{items:[{key:"shaped",label:"Shaped",color:xg},{key:"unshaped",label:"Not shaped",color:bg}]},void 0,!1,void 0,this),stale:l,footer:"Tokens are tool-result chars ÷ 4 over the experiment's sessions in the range; a tool counts as shaped when the experiment evaluated any of its results in the range.",children:i.length===0?Ja.jsxDEV("div",{className:"empty",children:"No tool output in this range."},void 0,!1,void 0,this):Ja.jsxDEV("div",{className:"spot-coverage",children:[Ja.jsxDEV("div",{className:"spot-coverage-summary",children:[Ja.jsxDEV("div",{className:"spot-coverage-headline",children:[Ja.jsxDEV("span",{className:"num",children:jt(y)},void 0,!1,void 0,this)," of tool output comes from tools the experiment did not shape in this range"]},void 0,!0,void 0,this),Ja.jsxDEV($n,{height:8,segments:[{key:"shaped",label:"Shaped",value:v,color:xg},{key:"unshaped",label:"Not shaped",value:y,color:bg}]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ja.jsxDEV(Ts,{items:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var $t=_(te(),1),Fq=30,H2=5,Gq=120;function Vq(r){return[`${r.tool}: ${A(r.cuts)} cuts`,`Saved ${se(r.savedTokens)} tokens (${zt(r.savedUsd)})`,`Fetched back ${se(r.recoveredTokens)} tokens (${zt(r.recoveryUsd)})`,`${A(r.extraTurns)} extra turns (${zt(r.turnUsd)})`,`Net ${vr(r.netUsd)}`].join(`
|
|
236
236
|
`)}function jq(r){if(r.length===0)return;let l={tool:Ur,cuts:0,savedTokens:0,recoveredTokens:0,extraTurns:0,savedUsd:0,recoveryUsd:0,turnUsd:0,netUsd:0,extraTurnsPer100Cuts:0,netUsdPer100Cuts:0};for(let i of r)l.cuts+=i.cuts,l.savedTokens+=i.savedTokens,l.recoveredTokens+=i.recoveredTokens,l.extraTurns+=i.extraTurns,l.savedUsd+=i.savedUsd,l.recoveryUsd+=i.recoveryUsd,l.turnUsd+=i.turnUsd,l.netUsd+=i.netUsd;if(l.cuts>0)l.extraTurnsPer100Cuts=l.extraTurns*100/l.cuts,l.netUsdPer100Cuts=l.netUsd*100/l.cuts;return l}function F2({stats:r,stale:l}){let i=new Set(r.economics.filter((h)=>h.cuts>0).map((h)=>h.tool)),{listed:c,rest:f}=Qo(Fi(r).filter((h)=>i.has(h))),v=new Set(f),y=new Map(r.economics.filter((h)=>!v.has(h.tool)).map((h)=>[h.tool,h])),g=jq(r.economics.filter((h)=>v.has(h.tool)));if(g)y.set(Ur,g);let m=f.length>0?[...c,Ur]:c,b=0;for(let h of y.values())if(h.cuts>0)b=Math.max(b,Math.abs(h.netUsdPer100Cuts));return $t.jsxDEV(fe,{index:3,title:"What cuts earn, by tool",description:"Net dollars per 100 cuts after fetch-backs, extra turns and Spotlight's own bill",actions:b>0&&$t.jsxDEV("span",{className:"spot-econ-scale","aria-hidden":"true",children:[$t.jsxDEV("span",{className:"num",children:vr(-b)},void 0,!1,void 0,this),$t.jsxDEV("span",{className:"spot-econ-ramp"},void 0,!1,void 0,this),$t.jsxDEV("span",{className:"num",children:vr(b)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),stale:l,footer:"Shortened results only; held-out ones save nothing. Every fetch-back counts against the cut here, the share held-out results show comes back anyway included, so this is the cautious view. An extra turn is a request whose every tool call fetched back output these cuts hid. Dollars price saved and fetched-back tokens as carried context, like Compounding.",children:m.length===0?$t.jsxDEV("div",{className:"empty",children:"No shortened results in this range."},void 0,!1,void 0,this):$t.jsxDEV("div",{className:"spot-econ-scroll",children:$t.jsxDEV("table",{className:"spot-econ",style:{minWidth:`${m.length*Gq}px`},children:[$t.jsxDEV("thead",{children:$t.jsxDEV("tr",{children:m.map((h)=>{let S=_r(h);return $t.jsxDEV("th",{scope:"col",title:h===Ur?f.join(", "):h,children:$t.jsxDEV("span",{className:"row spot-econ-tool",children:[$t.jsxDEV(S,{size:13,"aria-hidden":"true"},void 0,!1,void 0,this),$t.jsxDEV("span",{className:"spot-econ-tool-name",children:h},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},h,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),$t.jsxDEV("tbody",{children:$t.jsxDEV("tr",{children:m.map((h)=>{let S=y.get(h);if(S===void 0||S.cuts===0)return $t.jsxDEV("td",{children:$t.jsxDEV("div",{className:"spot-econ-cell","data-empty":"true",children:$t.jsxDEV("span",{className:"dim",children:"No cuts"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},h,!1,void 0,this);let L=S.netUsdPer100Cuts,I=b>0?H2+Math.sqrt(Math.abs(L)/b)*(Fq-H2):0,C=L<0?"bad":L>0?"ok":"neutral";return $t.jsxDEV("td",{children:$t.jsxDEV("div",{className:"spot-econ-cell","data-tone":C,style:{"--tint":`${I}%`},title:Vq(S),children:[$t.jsxDEV("span",{className:"spot-econ-net num",children:vr(L)},void 0,!1,void 0,this),$t.jsxDEV("dl",{className:"spot-econ-facts",children:[$t.jsxDEV("div",{children:[$t.jsxDEV("dt",{children:"cuts"},void 0,!1,void 0,this),$t.jsxDEV("dd",{className:"num",children:A(S.cuts)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$t.jsxDEV("div",{children:[$t.jsxDEV("dt",{children:"saved"},void 0,!1,void 0,this),$t.jsxDEV("dd",{className:"num",children:se(S.savedTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$t.jsxDEV("div",{children:[$t.jsxDEV("dt",{children:"extra turns /100"},void 0,!1,void 0,this),$t.jsxDEV("dd",{className:"num",children:S.extraTurnsPer100Cuts.toFixed(1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},h,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var Pb=_(Ke(),1);var Ns=_(te(),1);function Zf({groups:r}){return Ns.jsxDEV("div",{className:"legend spot-group-legend",children:r.map((l)=>Ns.jsxDEV("span",{className:"legend-item",title:Pa[l].rule,style:{"--dot":Pa[l].color},children:[Ns.jsxDEV("span",{className:"spot-group-mark","data-shape":Pa[l].shape,"aria-hidden":"true"},void 0,!1,void 0,this),Pa[l].label]},l,!0,void 0,this))},void 0,!1,void 0,this)}function Jf({hidden:r,expanded:l,onToggle:i}){return Ns.jsxDEV("button",{type:"button",className:"btn spot-more-tools","data-variant":"ghost","data-size":"sm","aria-expanded":l,title:l?void 0:r.join(", "),onClick:i,children:l?"Show fewer tools":`Show ${r.length} more tools`},void 0,!1,void 0,this)}function zb({kind:r,count:l}){let i=Es[r],c=i.icon;return Ns.jsxDEV("span",{className:"spot-kind",style:{"--kind":i.color},title:l===void 0?i.rule:`${l} × ${i.label.toLowerCase()}: ${i.rule}`,children:[Ns.jsxDEV(c,{size:12,"aria-hidden":"true"},void 0,!1,void 0,this),l===void 0?i.label:Ns.jsxDEV("span",{className:"num",children:l},void 0,!1,void 0,this),l!==void 0&&Ns.jsxDEV("span",{className:"sr-only",children:i.plural},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Mt=_(te(),1),$q={applied:-12,scoreFree:-6,holdout:0,gated:6,reference:12},Xq=["scoreFree","holdout","reference"],G2=["applied","holdout"],Yq="One rule for every group: within 12 calls, a read of the same path overlapping the result's own window (the whole file without a selector), a rerun of the call (a similar bash command; for other tools, ≥ 60% shared argument tokens), or a read of an artifact it named; not after an edit of that path (reads) or any edit (reruns), nor from the same request.";function V2({stats:r,stale:l}){let[i,c]=Pb.useState(!1),f=new Map;for(let h of r.fetchBack)f.set(`${h.tool}/${h.group}`,h);let v=new Set(r.fetchBack.filter((h)=>h.results>0).map((h)=>h.tool)),{listed:y,rest:g}=Qo(Fi(r).filter((h)=>v.has(h))),m=Bb.filter((h)=>h!=="gated"||r.fetchBack.some((S)=>S.group==="gated"&&S.results>0)),b=[];for(let h of i?[...y,...g]:y){let S=_r(h),L=Bb.flatMap((R)=>{let O=f.get(`${h}/${R}`);return O!==void 0&&O.results>0?[O]:[]});if(L.length===0)continue;let I=new Map(L.map((R)=>[R.group,R])),C=I.get("applied"),T=L.map((R)=>({key:R.group,...R.rate,color:Pa[R.group].color,shape:Pa[R.group].shape,offset:$q[R.group],title:`${Pa[R.group].label}: ${jt(R.rate.value)} of ${A(R.results)} results in ${A(R.sessions)} sessions`}));b.push({key:h,label:Mt.jsxDEV("span",{className:"spot-fb-tool",title:h,children:[Mt.jsxDEV(S,{size:13,"aria-hidden":"true"},void 0,!1,void 0,this),Mt.jsxDEV("span",{className:"spot-fb-tool-name",children:h},void 0,!1,void 0,this)]},void 0,!0,void 0,this),marks:T,figure:Mt.jsxDEV("span",{style:{color:Pa.applied.color},title:Pa.applied.rule,children:C===void 0?"–":jt(C.rate.value)},void 0,!1,void 0,this),detail:Mt.jsxDEV(Mt.Fragment,{children:Xq.map((R,O)=>{let z=I.get(R);return Mt.jsxDEV("span",{title:`${Pa[R].label}: ${Pa[R].rule}`,children:[O>0&&" · ",Mt.jsxDEV("span",{className:"spot-fb-detail","data-group":R,children:z===void 0?"–":jt(z.rate.value)},void 0,!1,void 0,this)]},R,!0,void 0,this)})},void 0,!1,void 0,this)})}return Mt.jsxDEV(fe,{index:3,title:"Does the agent come back for it?",description:"Share of results the agent fetched more of within 12 calls: cut with Spotlight's scores, cut without them, held out at random, kept whole by pi's former edit gate, and left unchanged",stale:l,footer:`${Yq} Held-out results are the true counterfactual: drawn at random from the would-be cuts and shown whole; until they accumulate, unchanged results stand in, re-weighted to the cuts' size mix. Score-free cuts skip Spotlight by a second coin and take the no-score fallback rules: if they come back as often as scored cuts, the scores add nothing. Gated reads are reads pi's former edit gate (removed) kept whole, listed only where the range has any. Small print: score-free · held out · unchanged. Whiskers are 90% session bootstrap intervals, from 3 sessions.`,children:b.length===0?Mt.jsxDEV("div",{className:"empty",children:"No evaluated results in this range."},void 0,!1,void 0,this):Mt.jsxDEV("div",{className:"spot-fb",children:[Mt.jsxDEV(Zf,{groups:m},void 0,!1,void 0,this),Mt.jsxDEV(sg,{rows:b,format:jt,formatTick:(h)=>`${Math.round(h*100)}%`},void 0,!1,void 0,this),g.length>0&&Mt.jsxDEV(Jf,{hidden:g,expanded:i,onToggle:()=>c((h)=>!h)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Kq({tool:r,counts:l}){let i=_r(r),c=new Map(l.map((m)=>[m.gap,m])),f=0,v=0;for(let m of l)f+=m.applied,v+=m.holdout;let y={applied:f,holdout:v},g=0;for(let m of l){if(f>0)g=Math.max(g,m.applied/f);if(v>0)g=Math.max(g,m.holdout/v)}return Mt.jsxDEV("section",{className:"spot-gap","aria-label":`${r} fetch-back gaps`,children:[Mt.jsxDEV("h3",{className:"spot-panel-title row spot-gap-title",children:[Mt.jsxDEV(i,{size:13,"aria-hidden":"true"},void 0,!1,void 0,this),r,Mt.jsxDEV("span",{className:"dim",children:[Mt.jsxDEV("span",{className:"num",children:A(f)},void 0,!1,void 0,this)," shortened ·"," ",Mt.jsxDEV("span",{className:"num",children:A(v)},void 0,!1,void 0,this)," held out"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),f+v===0?Mt.jsxDEV("div",{className:"spot-gap-empty dim",children:"No fetch-backs"},void 0,!1,void 0,this):Mt.jsxDEV("div",{className:"spot-gap-bins",children:P2.map((m)=>{let b=c.get(m);return Mt.jsxDEV("div",{className:"spot-gap-bin",children:[Mt.jsxDEV("div",{className:"spot-gap-bars",children:G2.map((h)=>{let S=b?.[h]??0,L=y[h],I=L>0?S/L:0;return Mt.jsxDEV("span",{className:"spot-gap-bar","data-group":h,"data-empty":L===0,title:`${m} ${m==="1"?"call":"calls"} later: ${A(S)} of ${A(L)} ${Pa[h].label.toLowerCase()} fetch-backs`,children:[L>0&&Mt.jsxDEV("span",{className:"spot-gap-value num",children:jt(I)},void 0,!1,void 0,this),Mt.jsxDEV("span",{className:"spot-gap-fill",style:{height:`${g>0?I/g*100:0}%`}},void 0,!1,void 0,this)]},h,!0,void 0,this)})},void 0,!1,void 0,this),Mt.jsxDEV("span",{className:"spot-gap-label num",children:m},void 0,!1,void 0,this)]},m,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function j2({stats:r,stale:l}){let[i,c]=Pb.useState(!1),f=new Set(r.gaps.map((g)=>g.tool)),{listed:v,rest:y}=Qo(Fi(r).filter((g)=>f.has(g)));return Mt.jsxDEV(fe,{index:3,title:"How soon it comes back",description:"Calls between a result and the first fetch-back after it",stale:l,footer:"Bars are each group's share of its own fetch-backs, so shortened and held-out results compare despite their different counts (next to each tool). Same rule as above; nothing after 12 calls counts.",children:v.length===0?Mt.jsxDEV("div",{className:"empty",children:"No fetch-backs in this range."},void 0,!1,void 0,this):Mt.jsxDEV(Mt.Fragment,{children:[Mt.jsxDEV(Zf,{groups:G2},void 0,!1,void 0,this),Mt.jsxDEV("div",{className:"spot-gaps",children:(i?[...v,...y]:v).map((g)=>Mt.jsxDEV(Kq,{tool:g,counts:r.gaps.filter((m)=>m.tool===g)},g,!1,void 0,this))},void 0,!1,void 0,this),y.length>0&&Mt.jsxDEV(Jf,{hidden:y,expanded:i,onToggle:()=>c((g)=>!g)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Ot=_(te(),1);function $2({stats:r,windowLabel:l,stale:i}){let{gross:c,clawback:f,adjusted:v}=r,{netTokens:y,netUsd:g}=v,m=Yn(y,fo),b=Yn(g,vr),h=v.byTool.filter((O)=>O.cuts>0&&O.holdouts<v.minHoldouts).map((O)=>O.tool),S=Qo(h),L=S.rest.length>0?[...S.listed,`${S.rest.length} more tools`]:h,I=L.length<2?L[0]??"":`${L.slice(0,-1).join(", ")} and ${L.at(-1)}`,C=Qo(v.byTool),T=C.listed.map((O)=>({tool:O.tool,holdouts:O.holdouts,thin:h.includes(O.tool)}));if(C.rest.length>0)T.push({tool:Ur,holdouts:C.rest.reduce((O,z)=>O+z.holdouts,0),thin:C.rest.some((O)=>h.includes(O.tool))});let R=c.fullSavedTokens>0?1-c.savedTokens/c.fullSavedTokens:null;return Ot.jsxDEV("section",{className:"card rise spot-hero","data-stale":i,"aria-label":"Spotlight savings summary",children:[Ot.jsxDEV("div",{className:"spot-hero-main",children:[Ot.jsxDEV("div",{className:"spot-hero-headline",children:[Ot.jsxDEV("div",{className:"spot-eyebrow",children:["Net saved in ",l,", after fetch-backs a cut caused"]},void 0,!0,void 0,this),Ot.jsxDEV("div",{className:"spot-hero-figures",children:[Ot.jsxDEV("span",{className:"spot-hero-value gradient-text",title:y.value===null?void 0:`${A(y.value)} tokens`,children:y.value===null?"–":fo(y.value)},void 0,!1,void 0,this),Ot.jsxDEV("span",{className:"spot-hero-unit",children:"tokens"},void 0,!1,void 0,this),g.value!==null&&Ot.jsxDEV("span",{className:"spot-hero-usd","data-negative":g.value<0,title:"Avoided context priced at each later request's cache rates, minus the fetch-backs beyond the holdout baseline (priced the same way) and Spotlight's own bill",children:vr(g.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(m!==""||b!=="")&&Ot.jsxDEV("div",{className:"spot-hero-interval",children:["90% interval"," ",Ot.jsxDEV("span",{className:"num",children:[m,b].filter(Boolean).join(" · ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ot.jsxDEV("div",{className:"spot-hero-aside",children:[Ot.jsxDEV("p",{className:"spot-hero-note",children:["Counted against what pi would have shown unshaped (",Ot.jsxDEV("code",{children:"plain"},void 0,!1,void 0,this),") for the same call (its inline cap and read page), with fetch-backs that held-out results show happen anyway added back."," ",c.fullSavedTokens>c.savedTokens&&Ot.jsxDEV(Ot.Fragment,{children:["Against the full output the shaping read, the cuts would claim"," ",Ot.jsxDEV("s",{className:"spot-struck num",children:se(c.fullSavedTokens)},void 0,!1,void 0,this),", overstating the gross by ",jt(R),"."," "]},void 0,!0,void 0,this),c.widerThanPlain>0&&`${A(c.widerThanPlain)} ${c.widerThanPlain===1?"result was":"results were"} wider than plain would have shown: cuts shown that way count as losses, results pi capped at plain's text save nothing. `,c.estimatedPlain>0&&`${A(c.estimatedPlain)} older ${c.estimatedPlain===1?"result estimates":"results estimate"} plain from the inline cap.`]},void 0,!0,void 0,this),h.length>0&&Ot.jsxDEV("p",{className:"spot-hero-warn",role:"note",children:[Ot.jsxDEV(Io,{size:14,"aria-hidden":"true"},void 0,!1,void 0,this),Ot.jsxDEV("span",{children:[I," ",h.length===1?"has":"have"," fewer than"," ",A(v.minHoldouts)," held-out results: ",h.length===1?"its":"their"," ","part of the net rests on a thin baseline."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ot.jsxDEV("div",{className:"spot-hero-stats",children:[Ot.jsxDEV(ie,{size:"sm",label:"Gross vs plain",title:"Σ (plain − shortened) tokens over shortened results; a cut that showed more than plain counts negative",value:fo(c.savedTokens),hint:`${jt(c.ofToolOutput)} of tool output · ${A(c.shaped)} of ${A(c.results)} results shortened`},void 0,!1,void 0,this),Ot.jsxDEV(ie,{size:"sm",label:"Fetched back beyond baseline",title:"Fetch-back tokens beyond what held-out results (shown whole) fetch anyway, per tool (reads split by whether the agent was likely to edit them); 90% interval below",value:v.excessTokens.value===null?"–":fo(-v.excessTokens.value),hint:Ot.jsxDEV(Ot.Fragment,{children:["of ",se(f.tokens)," fetched back",v.excessTokens.lo!==null&&v.excessTokens.hi!==null&&Ot.jsxDEV(Ot.Fragment,{children:[" ",Ot.jsxDEV("span",{className:"dim",children:["·"," ",Ot.jsxDEV("span",{className:"spot-nowrap",children:["90% ",Yn(v.excessTokens,se)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ot.jsxDEV(ie,{size:"sm",label:"Held out",title:`Would-be cuts shown whole at random: the baseline per tool (under ${v.minHoldouts} is thin)`,value:A(r.holdouts),hint:Ot.jsxDEV("span",{className:"spot-hero-tools",children:T.map((O)=>Ot.jsxDEV("span",{"data-thin":O.thin,title:O.tool===Ur?C.rest.map((z)=>`${z.tool} ${A(z.holdouts)}`).join(", "):O.thin?`${O.tool}: under ${v.minHoldouts} held out`:void 0,children:[O.tool," ",Ot.jsxDEV("span",{className:"num",children:A(O.holdouts)},void 0,!1,void 0,this),O.thin&&Ot.jsxDEV(Io,{size:11,"aria-label":"thin baseline"},void 0,!1,void 0,this)]},O.tool,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ot.jsxDEV(ie,{size:"sm",label:"Score-free cuts",title:"Cuts a random coin made without Spotlight (the no-score fallback rules): what Spotlight's scores add is the difference",value:A(r.scoreFree),hint:"cut without Spotlight, for comparison"},void 0,!1,void 0,this),Ot.jsxDEV(ie,{size:"sm",label:"Sessions",value:A(r.sessions),hint:"experiment sessions, all shaped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Y2=_(Ke(),1);var Dt=_(te(),1);function X2({p50:r,p90:l}){if(r===null)return Dt.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this);return Dt.jsxDEV("span",{className:"num",children:[Ct(r),Dt.jsxDEV("span",{className:"dim",children:[" / ",Ct(l)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Qq={no_credential:"not signed in",transport:"network"};function Wq(r){let l=/^http_(\d+)$/.exec(r);if(l)return`HTTP ${l[1]}`;return Qq[r]??r.replaceAll("_"," ")}function Zq({causes:r}){if(r.length===0)return Dt.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this);return Dt.jsxDEV("span",{children:r.map(({cause:l,results:i,share:c},f)=>Dt.jsxDEV(Y2.Fragment,{children:[f>0&&Dt.jsxDEV("span",{className:"dim",children:" · "},void 0,!1,void 0,this),Dt.jsxDEV("span",{className:"spot-nowrap",title:`${A(i)} results`,children:[Wq(l)," ",Dt.jsxDEV("span",{className:"num",children:jt(c)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},l,!0,void 0,this))},void 0,!1,void 0,this)}var Jq=[{key:"failures",header:"Spotlight failures",align:"right",sort:(r)=>r.failureRate??-1,title:"Results whose Spotlight calls failed or timed out, of those that called it: they were cut by the no-score fallback",render:(r)=>r.failureRate===null?Dt.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this):Dt.jsxDEV(ct,{tone:hr(r.failureRate),mono:!0,children:jt(r.failureRate)},void 0,!1,void 0,this)},{key:"causes",header:"Failure causes",align:"right",sort:(r)=>r.failureCauses[0]?.share??-1,wrap:!0,title:"Why the calls failed, as shares of the results that called Spotlight. A result whose calls failed two ways counts under both; unrecorded results were journaled before pi recorded causes",render:(r)=>Dt.jsxDEV(Zq,{causes:r.failureCauses},void 0,!1,void 0,this)},{key:"failedWait",header:"Waited on failures",align:"right",sort:(r)=>r.failedWaitMs,title:"Wall time tool calls spent on Spotlight calls that failed or timed out",render:(r)=>r.failedWaitMs>0?Dt.jsxDEV("span",{className:"num",children:Ct(r.failedWaitMs)},void 0,!1,void 0,this):Dt.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)},{key:"results",header:"Results",align:"right",sort:(r)=>r.results,title:"Results Spotlight evaluated, held-out ones included",render:(r)=>Dt.jsxDEV("span",{className:"num",children:A(r.results)},void 0,!1,void 0,this)},{key:"shape",header:"Shaping p50 / p90",align:"right",sort:(r)=>r.shapeMsP50??-1,title:"Wall time shaping added to a tool call",render:(r)=>Dt.jsxDEV(X2,{p50:r.shapeMsP50,p90:r.shapeMsP90},void 0,!1,void 0,this)},{key:"spotlight",header:"Spotlight p50 / p90",align:"right",sort:(r)=>r.spotlightMsP50??-1,title:"Spotlight's own request time, over results whose calls all answered",render:(r)=>Dt.jsxDEV(X2,{p50:r.spotlightMsP50,p90:r.spotlightMsP90},void 0,!1,void 0,this)},{key:"usd",header:"Spotlight $",align:"right",sort:(r)=>r.spotlightUsd,render:(r)=>Dt.jsxDEV("span",{className:"num",children:zt(r.spotlightUsd)},void 0,!1,void 0,this)}];function eO({overhead:r}){let l=r.failureRate;if(l===null)return null;let i=hr(l);if(i==="ok")return null;let c=r.failedWaitMs,f=r.failureCauses.find((v)=>v.cause==="no_credential");return Dt.jsxDEV("div",{className:"spot-callout","data-tone":i,role:"note",children:[Dt.jsxDEV(Io,{size:16,"aria-hidden":"true"},void 0,!1,void 0,this),Dt.jsxDEV("div",{children:[Dt.jsxDEV("div",{className:"spot-callout-head",children:[Dt.jsxDEV("span",{className:"num",children:jt(l)},void 0,!1,void 0,this)," of results that called Spotlight failed"]},void 0,!0,void 0,this),Dt.jsxDEV("p",{className:"spot-callout-copy",children:["A failed or timed-out call leaves the cut to the no-score fallback, so those results measure the fallback rather than Spotlight's scorer. Read every comparison on this page with that share in mind.",c>0&&Dt.jsxDEV(Dt.Fragment,{children:[" ","Tool calls waited ",Dt.jsxDEV("span",{className:"num",children:Ct(c)},void 0,!1,void 0,this)," on those failures."]},void 0,!0,void 0,this),f&&Dt.jsxDEV(Dt.Fragment,{children:[" ",Dt.jsxDEV("span",{className:"num",children:jt(f.share)},void 0,!1,void 0,this)," had no Stencil sign-in: run"," ",Dt.jsxDEV("code",{children:"/login"},void 0,!1,void 0,this)," and choose Stencil, or set ",Dt.jsxDEV("code",{children:"STENCIL_API_KEY"},void 0,!1,void 0,this),", to restore ranking."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function K2({stats:r,stale:l}){let{overhead:i}=r,c=i.results>0?[i]:[];return Dt.jsxDEV(fe,{index:3,title:"Overhead",description:"What shaping costs: Spotlight failures, added latency and its bill",flush:!0,stale:l,footer:"Every evaluated result counts, held-out ones included: they were shaped too, just not shown.",children:[i.results>0&&Dt.jsxDEV(eO,{overhead:i},void 0,!1,void 0,this),Dt.jsxDEV(Ft,{rows:c,rowKey:()=>"overhead",columns:Jq,dense:!0,empty:Dt.jsxDEV("div",{className:"empty",children:"No evaluated results in this range."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ve=_(te(),1),ep=["applied","scoreFree","holdout"],tO={applied:-7,scoreFree:0,holdout:7},aO=[{key:"auc",title:"Heat ranks needed lines higher",chanceLabel:"AUC · chance 0.5",chance:0.5,rule:"P(a needed line is hotter than an unneeded line of the same result), ties half",format:(r)=>r.toFixed(2)},{key:"topLift",title:"Hottest tenth holds them",chanceLabel:"lift · chance 1.0",chance:1,rule:"Needed-line rate among each result's hottest 10% of lines over its rate among all lines",format:(r)=>`${r.toFixed(2)}×`},{key:"keptLift",title:"The cut keeps them",chanceLabel:"lift · random cut 1.0",chance:1,rule:"Share of needed lines the cut kept over the share of all lines it kept",format:(r)=>`${r.toFixed(2)}×`}],oO=[{key:"reread",label:"Read again",rule:"A later read of the same file selected the lines"},{key:"edit",label:"Edited",rule:"A later edit's Find text matched the lines"}];function Q2({stats:r,stale:l}){let{ranking:i}=r,c=new Map(i.cells.map((v)=>[v.group,v])),f=ep.some((v)=>(c.get(v)?.results??0)>0);return Ve.jsxDEV(fe,{index:4,title:"Does Spotlight keep what the agent needs?",description:"Lines of a shaped read the agent read again or edited later, against Spotlight's heat and the cut",actions:Ve.jsxDEV(Zf,{groups:ep},void 0,!1,void 0,this),stale:l,footer:"Shaped reads with at least one needed line, until the file's first edit or a later whole-file read. Scored and score-free cuts are biased alike (the agent re-reads what a cut hid), so compare them with each other; held-out would-be cuts, shown whole, are the unbiased measure. Score-free cuts have no heat, so only the cut's lift exists for them. Dashed lines are chance; whiskers are 90% session bootstrap intervals, from 3 sessions.",children:!f?Ve.jsxDEV("div",{className:"empty",children:"No shaped read was needed again in this range."},void 0,!1,void 0,this):Ve.jsxDEV("div",{className:"spot-rank",children:[Ve.jsxDEV("div",{className:"spot-rank-panels",children:aO.map((v)=>Ve.jsxDEV(rO,{measure:v,cells:c},v.key,!1,void 0,this))},void 0,!1,void 0,this),Ve.jsxDEV("div",{className:"spot-rank-foot",children:[Ve.jsxDEV(nO,{cells:c},void 0,!1,void 0,this),Ve.jsxDEV(sO,{positions:i.position},void 0,!1,void 0,this),Ve.jsxDEV("section",{className:"spot-rank-sources","aria-label":"How the need was seen",children:[Ve.jsxDEV("h3",{className:"spot-panel-title",children:"How the need was seen"},void 0,!1,void 0,this),Ve.jsxDEV("dl",{className:"spot-facts spot-rank-facts",children:oO.map((v)=>Ve.jsxDEV("div",{title:v.rule,children:[Ve.jsxDEV("dt",{children:v.label},void 0,!1,void 0,this),Ve.jsxDEV("dd",{className:"num",children:[A(i.sources[v.key]),Ve.jsxDEV("span",{className:"dim",children:" results"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},v.key,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function rO({measure:r,cells:l}){let i=ep.flatMap((v)=>{let y=l.get(v);if(y===void 0||y.results===0)return[];let g=y[r.key],m=Yn(g,r.format);return[{key:v,...g,color:Pa[v].color,shape:Pa[v].shape,offset:tO[v],title:`${Pa[v].label}: ${g.value===null?"–":r.format(g.value)}${m===""?"":` (${m})`} over ${A(y.results)} results, ${A(y.neededLines)} needed lines`}]}),c=l.get("applied")?.[r.key].value??null,f=[{key:"reads",label:"Shaped reads",marks:i,figure:Ve.jsxDEV("span",{style:{color:Pa.applied.color},children:c===null?"–":r.format(c)},void 0,!1,void 0,this),detail:Ve.jsxDEV(Ve.Fragment,{children:["scoreFree","holdout"].map((v,y)=>{let g=l.get(v)?.[r.key].value??null;return Ve.jsxDEV("span",{title:Pa[v].label,children:[y>0&&" · ",Ve.jsxDEV("span",{className:"spot-fb-detail","data-group":v,children:g===null?"–":r.format(g)},void 0,!1,void 0,this)]},v,!0,void 0,this)})},void 0,!1,void 0,this)}];return Ve.jsxDEV("section",{className:"spot-rank-panel","aria-label":r.title,children:[Ve.jsxDEV("h3",{className:"spot-panel-title",title:r.rule,children:[r.title,Ve.jsxDEV("span",{className:"spot-rank-chance",children:r.chanceLabel},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ve.jsxDEV(sg,{rows:f,guides:[{key:"chance",value:r.chance,color:"var(--ink-3)"}],format:r.format,formatTick:(v)=>String(Number(v.toFixed(2)))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function nO({cells:r}){return Ve.jsxDEV("section",{"aria-label":"Sample per cell",children:[Ve.jsxDEV("h3",{className:"spot-panel-title",children:["Sample per cell",Ve.jsxDEV("span",{className:"spot-rank-chance",children:"results · needed lines"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ve.jsxDEV("table",{className:"spot-rank-n",children:[Ve.jsxDEV("thead",{children:Ve.jsxDEV("tr",{children:ep.map((l)=>Ve.jsxDEV("th",{scope:"col",title:Pa[l].rule,children:Pa[l].label},l,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ve.jsxDEV("tbody",{children:Ve.jsxDEV("tr",{children:ep.map((l)=>{let i=r.get(l);return Ve.jsxDEV("td",{className:"num","data-thin":i!==void 0&&i.results<20,children:i===void 0||i.results===0?Ve.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this):Ve.jsxDEV("span",{title:`${A(i.neededLines)} needed lines`,children:[A(i.results),Ve.jsxDEV("span",{className:"dim",children:[" · ",se(i.neededLines)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},l,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function sO({positions:r}){let l=Math.max(0,...r.map((i)=>i.meanHeat));return Ve.jsxDEV("section",{className:"spot-rank-pos","aria-label":"Mean heat by position",children:[Ve.jsxDEV("h3",{className:"spot-panel-title",children:["Mean heat by position",Ve.jsxDEV("span",{className:"spot-rank-chance",children:"0–9, outputs ≥ 40 lines"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.length===0||l===0?Ve.jsxDEV("div",{className:"dim spot-gap-empty",children:"No heat recorded"},void 0,!1,void 0,this):Ve.jsxDEV(Ve.Fragment,{children:[Ve.jsxDEV("div",{className:"spot-rank-bars",children:r.map((i)=>Ve.jsxDEV("div",{className:"spot-rank-bar",title:`${i.label}: mean heat ${i.meanHeat.toFixed(2)} over ${A(i.lines)} lines`,children:[Ve.jsxDEV("span",{className:"spot-rank-bar-track",children:[Ve.jsxDEV("span",{className:"spot-rank-bar-value num",children:i.meanHeat.toFixed(1)},void 0,!1,void 0,this),Ve.jsxDEV("span",{className:"spot-rank-bar-fill",style:{height:`calc((100% - 14px) * ${i.meanHeat/l})`}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ve.jsxDEV("span",{className:"spot-rank-bar-label num",children:i.label.replace(/^lines? /,"L").replace(/%$/,"")},void 0,!1,void 0,this)]},i.label,!0,void 0,this))},void 0,!1,void 0,this),Ve.jsxDEV("div",{className:"micro spot-rank-axis",children:"L = line of the output, then each tenth of it (% into it)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var cd=_(Ke(),1);var de=_(te(),1);function Ub(r){return`${r.sessionFile}\x00${r.toolCallId}`}function W2({value:r}){return de.jsxDEV("span",{className:r<0?"num tone-bad":r>0?"num tone-ok":"num",children:fo(r)},void 0,!1,void 0,this)}function lO({row:r}){let{plainTokens:l,outTokens:i}=r,c=l>0?Math.min(1,i/l):1;return de.jsxDEV("div",{className:"spot-shrink","data-holdout":r.holdout,title:`plain would show ${A(l)} tokens, the cut ${r.holdout?"would show":"showed"} ${A(i)} (shaping read ${A(r.inTokens)})`,children:[de.jsxDEV("span",{className:"num",children:[se(l),de.jsxDEV("span",{className:"dim",children:" → "},void 0,!1,void 0,this),se(i)]},void 0,!0,void 0,this),de.jsxDEV("span",{className:"spot-shrink-bar","aria-hidden":"true",children:de.jsxDEV("span",{className:"spot-shrink-kept",style:{width:`${c*100}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function iO(r){let l=new Map;for(let i of r.recoveries)l.set(i.kind,(l.get(i.kind)??0)+1);return gg.flatMap((i)=>{let c=l.get(i);return c?[[i,c]]:[]})}var uO=[{key:"target",header:"Result",width:"40%",sort:(r)=>r.timestamp,render:(r)=>{let l=_r(r.tool);return de.jsxDEV("div",{className:"spot-result",children:[de.jsxDEV("span",{className:"spot-tool",title:r.tool,children:[de.jsxDEV(l,{size:14,"aria-hidden":"true"},void 0,!1,void 0,this),de.jsxDEV("span",{className:"sr-only",children:r.tool},void 0,!1,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV("div",{className:"stack spot-result-text",children:[de.jsxDEV("span",{className:"spot-target truncate",title:r.target,children:r.target},void 0,!1,void 0,this),de.jsxDEV("span",{className:"row spot-result-meta",children:[r.holdout&&de.jsxDEV(Z2,{},void 0,!1,void 0,this),r.scoreFree&&de.jsxDEV(J2,{},void 0,!1,void 0,this),de.jsxDEV("span",{className:"dim",title:ro(r.timestamp),children:ma(r.timestamp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}},{key:"shrink",header:"Plain → out",align:"right",sort:(r)=>r.plainTokens>0?r.outTokens/r.plainTokens:1,title:"What pi would have shown unshaped (plain) for the call, and what the cut showed; the bar is the share that survived",render:(r)=>de.jsxDEV(lO,{row:r},void 0,!1,void 0,this)},{key:"saved",header:"Saved",align:"right",sort:(r)=>r.savedTokens,render:(r)=>r.holdout?de.jsxDEV("span",{className:"spot-would-save",title:"Held out: what the cut would have saved",children:[de.jsxDEV("span",{className:"dim",children:"would save "},void 0,!1,void 0,this),de.jsxDEV("span",{className:"num",children:fo(r.savedTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):de.jsxDEV("span",{className:"num",children:fo(r.savedTokens)},void 0,!1,void 0,this)},{key:"hidden",header:"Hidden lines",align:"right",sort:(r)=>r.hiddenLines,render:(r)=>r.hiddenLines>0?de.jsxDEV("span",{className:"num",children:A(r.hiddenLines)},void 0,!1,void 0,this):de.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)},{key:"recoveries",header:"Fetched back",sort:(r)=>r.recoveries.length,render:(r)=>{let l=iO(r);return l.length===0?de.jsxDEV("span",{className:"dim",title:"Nothing fetched back",children:"–"},void 0,!1,void 0,this):de.jsxDEV("span",{className:"row spot-kinds",children:l.map(([i,c])=>de.jsxDEV(zb,{kind:i,count:c},i,!1,void 0,this))},void 0,!1,void 0,this)}},{key:"net",header:"Net",align:"right",sort:(r)=>r.netTokens,title:"Saved tokens minus the tokens of the calls that fetched hidden output back",render:(r)=>r.holdout?de.jsxDEV("span",{className:"dim",title:"Held out: the model saw the whole result, so nothing was saved",children:"–"},void 0,!1,void 0,this):de.jsxDEV(W2,{value:r.netTokens},void 0,!1,void 0,this)}];function Z2(){return de.jsxDEV("span",{title:"Held out at random: the model saw the original, unshortened result",children:de.jsxDEV(ct,{children:"held out"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function J2(){return de.jsxDEV("span",{title:"A random coin skipped Spotlight: the no-score fallback rules made this cut",children:de.jsxDEV(ct,{children:"score-free"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function eR({rows:r,stale:l}){let[i,c]=cd.useState(null),f=cd.useCallback(()=>c(null),[]),v=cd.useMemo(()=>r.find((y)=>Ub(y)===i)??null,[r,i]);return de.jsxDEV(de.Fragment,{children:[de.jsxDEV(fe,{index:6,title:"Recent results",description:"The newest shortened and held-out tool results and what the agent fetched back",flush:!0,stale:l,footer:"Saved is what plain would have shown minus what the cut showed (the would-be cut for held-out ones, which save nothing); recovery tokens are the recovery calls' results (chars ÷ 4 when no exact count exists).",children:de.jsxDEV(Ft,{rows:r,rowKey:Ub,columns:uO,onRowClick:(y)=>c(Ub(y)),selectedKey:i,limit:15,empty:de.jsxDEV("div",{className:"empty",children:"No shortened or held-out results in this range."},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(dO,{row:v,onClose:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function dO({row:r,onClose:l}){if(r===null)return null;let i=_r(r.tool),c=r.savedTokens-r.netTokens;return de.jsxDEV(ed,{open:!0,onClose:l,width:600,title:de.jsxDEV("span",{className:"spot-drawer-title",title:r.target,children:r.target},void 0,!1,void 0,this),subtitle:de.jsxDEV("span",{className:"row spot-drawer-subtitle",children:[de.jsxDEV(i,{size:13,"aria-hidden":"true"},void 0,!1,void 0,this),r.tool,r.holdout&&de.jsxDEV(Z2,{},void 0,!1,void 0,this),r.scoreFree&&de.jsxDEV(J2,{},void 0,!1,void 0,this),de.jsxDEV("span",{children:ro(r.timestamp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:[de.jsxDEV("div",{className:"spot-drawer-summary",children:[de.jsxDEV("div",{children:[de.jsxDEV("div",{className:"spot-eyebrow",children:r.holdout?"Would save":"Saved"},void 0,!1,void 0,this),de.jsxDEV("div",{className:"spot-drawer-figure num",children:fo(r.savedTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV("div",{children:[de.jsxDEV("div",{className:"spot-eyebrow",children:"Fetched back"},void 0,!1,void 0,this),de.jsxDEV("div",{className:c>0?"spot-drawer-figure num tone-warn":"spot-drawer-figure num",children:se(c)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV("div",{children:[de.jsxDEV("div",{className:"spot-eyebrow",children:"Net"},void 0,!1,void 0,this),r.holdout?de.jsxDEV("div",{className:"spot-drawer-figure dim",title:"Held out: the model saw the whole result",children:"–"},void 0,!1,void 0,this):de.jsxDEV("div",{className:r.netTokens<0?"spot-drawer-figure num tone-bad":"spot-drawer-figure num tone-ok",children:fo(r.netTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV(So,{items:[{key:"plain",label:"Plain would show",value:A(r.plainTokens)},{key:"out",label:"Tokens out",value:A(r.outTokens)},{key:"in",label:"Full output read",value:A(r.inTokens)},{key:"hidden",label:r.holdout?"Lines it would hide":"Hidden lines",value:A(r.hiddenLines)},{key:"steps",label:"Steps",value:r.steps.length>0?r.steps.join(" → "):"–"},{key:"cost",label:"Spotlight cost",value:zt(r.spotlightUsd)},{key:"ms",label:"Shaping time",value:Ct(r.shapeMs)}]},void 0,!1,void 0,this),de.jsxDEV("div",{children:[de.jsxDEV("div",{className:"section-label",children:"Call"},void 0,!1,void 0,this),de.jsxDEV("pre",{className:"code-block spot-drawer-call",children:r.target},void 0,!1,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV("div",{children:[de.jsxDEV("div",{className:"section-label",children:"Recovery timeline"},void 0,!1,void 0,this),de.jsxDEV("ol",{className:"spot-timeline",children:[de.jsxDEV("li",{className:"spot-timeline-item","data-kind":r.holdout?"holdout":"cut",children:[de.jsxDEV("span",{className:"spot-timeline-node","aria-hidden":"true",children:de.jsxDEV(Ef,{size:12},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV("div",{className:"spot-timeline-body",children:de.jsxDEV("div",{className:"row spot-timeline-head",children:[de.jsxDEV("span",{className:"cell-primary",children:r.holdout?"Held out: the model saw the original":"Shortened"},void 0,!1,void 0,this),de.jsxDEV("span",{className:"dim num",children:[r.holdout&&"would be ",se(r.plainTokens)," → ",se(r.outTokens)," tokens",r.hiddenLines>0&&`, ${A(r.hiddenLines)} lines hidden`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.recoveries.map((f)=>de.jsxDEV("li",{className:"spot-timeline-item","data-kind":f.kind,style:{"--kind":Es[f.kind].color},children:[de.jsxDEV("span",{className:"spot-timeline-node","aria-hidden":"true",children:de.jsxDEV(ff,{size:12},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV("div",{className:"spot-timeline-body",children:[de.jsxDEV("div",{className:"row spot-timeline-head",children:[de.jsxDEV(zb,{kind:f.kind},void 0,!1,void 0,this),f.turn&&de.jsxDEV(ct,{tone:"warn",children:"extra turn"},void 0,!1,void 0,this),de.jsxDEV("span",{className:"spot-timeline-spacer"},void 0,!1,void 0,this),de.jsxDEV("span",{className:"num tone-warn",children:["+",se(f.tokens)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV("code",{className:"spot-timeline-target",title:f.target,children:[de.jsxDEV("span",{className:"dim",children:[f.tool," "]},void 0,!0,void 0,this),f.target]},void 0,!0,void 0,this),de.jsxDEV("div",{className:"micro",children:[f.after===0?"The next call":`${A(f.after)} ${f.after===1?"call":"calls"} later`,` · ${gr(Math.max(0,f.timestamp-r.timestamp))} after the cut`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},f.toolCallId,!0,void 0,this)),de.jsxDEV("li",{className:"spot-timeline-item","data-kind":"net",children:[de.jsxDEV("span",{className:"spot-timeline-node","aria-hidden":"true"},void 0,!1,void 0,this),de.jsxDEV("div",{className:"spot-timeline-body",children:de.jsxDEV("div",{className:"row spot-timeline-head",children:[de.jsxDEV("span",{className:"cell-primary",children:r.holdout?r.recoveries.length===0?"Nothing fetched back":"Fetched more although it saw everything":r.recoveries.length===0?"Nothing fetched back: the full saving stands":"Net"},void 0,!1,void 0,this),de.jsxDEV("span",{className:"spot-timeline-spacer"},void 0,!1,void 0,this),r.holdout?de.jsxDEV("span",{className:"dim",children:"saves nothing"},void 0,!1,void 0,this):de.jsxDEV(W2,{value:r.netTokens},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var fd=_(Ke(),1);var xt=_(te(),1),cO=[{value:"tokens",label:"Tokens"},{value:"usd",label:"$"}];function tR({value:r,onChange:l}){return xt.jsxDEV(Oa,{size:"sm","aria-label":"Unit",options:cO,value:r,onChange:l},void 0,!1,void 0,this)}function aR({stats:r,range:l,stale:i}){let[c,f]=fd.useState("tokens"),v=aa(l),y=fd.useMemo(()=>{let m=oo(l,r.series.map((T)=>T.timestamp),v.bucketMs),b=c==="usd",h=ha(r.series,m,(T)=>b?T.savedUsd:T.savedTokens),S=ha(r.series,m,(T)=>b?T.netUsd:T.netTokens),L=0,I=0,C=[{key:"gross",label:"Gross (cumulative)",color:"var(--spot-gross)",kind:"area",values:h.map((T)=>L+=T)},{key:"clawback",label:b?"Recoveries + Spotlight cost":"Fetched back",color:"var(--spot-clawback)",kind:"bars",values:h.map((T,R)=>S[R]-T)},{key:"net",label:"Net of every fetch-back (cumulative)",color:"var(--spot-net)",kind:"line",values:S.map((T)=>I+=T)}];return{buckets:m,series:C}},[r.series,l,v.bucketMs,c]),g=c==="usd"?vr:fo;return xt.jsxDEV(fe,{index:1,title:"Savings over time",description:`Running gross and net per ${vg(v.bucketMs)}; what recoveries took back hangs below zero`,actions:xt.jsxDEV(tR,{value:c,onChange:f},void 0,!1,void 0,this),stale:i,footer:c==="usd"?"Dollars price each saved token at the cache-read rate of every later request that would have carried it (plus one cache write); recoveries are priced the same way.":"Gross is what the cuts removed against what plain would have shown; this net subtracts every later call that fetched hidden output back, including the share held-out results show comes back anyway (the headline adds that back). Each lands in the bucket of its own timestamp.",children:[xt.jsxDEV("div",{className:"spot-chart-legend",children:xt.jsxDEV(ia,{items:y.series.map((m)=>({key:m.key,label:m.label,color:m.color}))},void 0,!1,void 0,this)},void 0,!1,void 0,this),xt.jsxDEV(_o,{buckets:y.buckets,bucketMs:v.bucketMs,series:y.series,stacked:!1,height:480,format:g,formatTooltip:c==="usd"?vr:(m)=>m<0?`−${A(-m)}`:A(m),showTotal:!1,emptyLabel:"No shortened results in this range"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function oR({stats:r,stale:l}){let[i,c]=fd.useState("tokens"),{gross:f,clawback:v,compounding:y,adjusted:g}=r,m=fd.useMemo(()=>{let b=i==="usd",h=b?y.savedUsd:f.savedTokens,S=(O)=>h>0?jt(O/h):"",L=gg.map((O)=>{let z=v.byKind[O],Y=b?z.usd:z.tokens;return{key:O,label:xt.jsxDEV(xt.Fragment,{children:[xt.jsxDEV("span",{className:"spot-step-swatch",style:{background:Es[O].color}},void 0,!1,void 0,this),Es[O].plural,xt.jsxDEV("span",{className:"dim num",children:A(z.events)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),kind:"delta",value:-Y,color:Es[O].color,note:S(Y),title:Es[O].rule}}),I=[{key:"gross",label:b?"Gross saved":"Gross vs plain",kind:"total",value:h,color:"var(--spot-gross)",title:b?"Avoided context priced at each later request's cache-read rate, plus one cache write":"Σ (plain − shortened) tokens over shortened results; a cut that showed more than plain counts negative"},...L];if(b)I.push({key:"turns",label:xt.jsxDEV(xt.Fragment,{children:[xt.jsxDEV("span",{className:"spot-step-swatch",style:{background:"var(--spot-turns)"}},void 0,!1,void 0,this),"Extra turns",xt.jsxDEV("span",{className:"dim num",children:A(v.turns)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),kind:"delta",value:-v.turnsUsd,color:"var(--spot-turns)",note:S(v.turnsUsd),title:"Provider cost of requests that issued nothing but recovery calls"},{key:"spotlight",label:xt.jsxDEV(xt.Fragment,{children:[xt.jsxDEV("span",{className:"spot-step-swatch",style:{background:"var(--spot-cost)"}},void 0,!1,void 0,this),"Spotlight cost"]},void 0,!0,void 0,this),kind:"delta",value:-y.spotlightUsd,color:"var(--spot-cost)",note:S(y.spotlightUsd),title:"Spotlight's own scoring bill"});let C=b?y.netUsd:v.netTokens,T=b?g.netUsd.value:g.netTokens.value;if(T!==null){let O=T-C;I.push({key:"anyway",label:xt.jsxDEV(xt.Fragment,{children:[xt.jsxDEV("span",{className:"spot-step-swatch",style:{background:"var(--spot-anyway)"}},void 0,!1,void 0,this),"Back anyway"]},void 0,!0,void 0,this),kind:"delta",value:O,color:"var(--spot-anyway)",note:S(O),title:"Fetch-backs held-out results (shown whole) show the agent makes regardless, per tool: not the cut's cost"})}let R=T??C;return I.push({key:"net",label:T===null?"Net (no holdout baseline yet)":"Net",kind:"total",value:R,color:"var(--spot-net-fill)",note:S(R)}),I},[i,f,v,y,g]);return xt.jsxDEV(fe,{index:2,title:"Where the savings went",description:"Gross, minus each way hidden output came back",actions:xt.jsxDEV(tR,{value:i,onChange:c},void 0,!1,void 0,this),stale:l,footer:i==="usd"?"Recoveries are priced as carried context; extra turns are requests that only recovered; Spotlight cost is its own scoring bill. What comes back anyway is the recovery $ in proportion to the tokens held-out results fetch regardless.":"Recovered tokens are the full results of the recovery calls (estimated as chars ÷ 4 where no exact count exists). What comes back anyway is, per tool, the tokens a held-out result gets fetched back times the tool's cuts.",children:[xt.jsxDEV(e2,{steps:m,format:i==="usd"?zt:se},void 0,!1,void 0,this),xt.jsxDEV("div",{className:"spot-by-tool",children:[xt.jsxDEV("div",{className:"section-label",children:"Net by tool, tokens"},void 0,!1,void 0,this),xt.jsxDEV(pO,{byTool:f.byTool,adjusted:g.byTool},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var fO=3;function pO({byTool:r,adjusted:l}){let i=new Map(l.map((g)=>[g.tool,g])),{listed:c,rest:f}=Qo(r,fO),v=c.map((g)=>{let m=i.get(g.tool),b=m===void 0?"":Yn(m.excessTokens,se),h=m?.baselinePerCut.value??null;return{tool:g.tool,totals:g,excess:m?.excessTokens.value??null,title:m===void 0?void 0:[`${A(m.cuts)} cuts fetched back ${se(m.recoveredTokens)} tokens`,h===null?"No held-out baseline yet":`${A(m.holdouts)} held-out results get ${se(h)} each fetched back anyway`,b===""?"":`Beyond the baseline: ${b} (90%)`].filter(Boolean).join(`
|
|
237
237
|
`)}});if(f.length>0){let g={tool:Ur,results:0,shaped:0,inTokens:0,plainTokens:0,outTokens:0,savedTokens:0,fullSavedTokens:0},m=null;for(let b of f){g.results+=b.results,g.shaped+=b.shaped,g.savedTokens+=b.savedTokens;let h=i.get(b.tool)?.excessTokens.value??null;if(h!==null)m=(m??0)+h}v.push({tool:Ur,totals:g,excess:m,title:`${A(f.length)} more tools: ${f.map((b)=>b.tool).join(", ")}`})}let y=Math.max(0,...v.map((g)=>g.totals.savedTokens));return xt.jsxDEV("ul",{className:"spot-tool-net",children:v.map(({tool:g,totals:m,excess:b,title:h})=>{let S=b===null?null:m.savedTokens-b,L=_r(g),I=y>0?Math.max(0,m.savedTokens)/y*100:0,C=b!==null&&m.savedTokens>0?Math.min(1,b/m.savedTokens):0;return xt.jsxDEV("li",{className:"spot-tool-net-row",title:h,children:[xt.jsxDEV("div",{className:"row spot-tool-net-head",children:[xt.jsxDEV(L,{size:13,"aria-hidden":"true"},void 0,!1,void 0,this),xt.jsxDEV("span",{className:"cell-primary",children:g},void 0,!1,void 0,this),xt.jsxDEV("span",{className:"dim num",children:[A(m.shaped)," of ",A(m.results)," shortened"]},void 0,!0,void 0,this),xt.jsxDEV("span",{className:"spot-tool-net-value num",title:S===null?"No holdout baseline yet":void 0,children:fo(S??m.savedTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),xt.jsxDEV("div",{className:"spot-tool-net-track","aria-hidden":"true",children:xt.jsxDEV("span",{className:"spot-tool-net-bar",style:{width:`${I}%`},children:xt.jsxDEV("span",{className:"spot-tool-net-excess",style:{width:`${C*100}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),xt.jsxDEV("div",{className:"micro spot-tool-net-detail",children:[fo(m.savedTokens)," gross",b!==null&&xt.jsxDEV(xt.Fragment,{children:[" − ",se(b)," beyond baseline"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},g,!0,void 0,this)})},void 0,!1,void 0,this)}var nR=_(Ke(),1);var Sg=_(te(),1),rR=7,mO=[{group:"shaped",label:"Shaped sessions",color:"var(--spot-shaped)"},{group:"outside",label:"Outside the experiment",color:"var(--spot-outside)"}];function sR({stats:r,range:l,stale:i}){let c=aa(l),f=nR.useMemo(()=>{let v=oo(l,r.share.map((b)=>b.timestamp),c.bucketMs),y=[],g=[];for(let{group:b,label:h,color:S}of mO){let L=r.share.filter((z)=>z.group===b),I=ha(L,v,(z)=>z.toolTokens),C=ha(L,v,(z)=>z.contextTokens),T=0,R=0,O=v.map((z,Y)=>{let W=0,ue=0;for(let Z=Math.max(0,Y-rR+1);Z<=Y;Z++)W+=I[Z],ue+=C[Z];return T+=I[Y],R+=C[Y],ue>0?W/ue:null});if(R===0)continue;y.push({key:`${b}:raw`,label:`${h} · bucket`,color:S,kind:"dots",values:v.map((z,Y)=>C[Y]>0?I[Y]/C[Y]:null)},{key:`${b}:avg`,label:`${h} · rolling`,color:S,kind:"line",values:O}),g.push({key:b,label:h,color:S,value:jt(T/R)})}let m=[];if(r.experimentStart!==null){let b=Math.floor(r.experimentStart/c.bucketMs)*c.bucketMs,h=v.indexOf(b);if(h>=0)m.push({index:h,label:"experiment starts"})}return{buckets:v,series:y,legend:g,markers:m}},[r.share,r.experimentStart,l,c.bucketMs]);return Sg.jsxDEV(fe,{index:4,title:"Tool-output share of context",description:r.experimentStart!==null&&f.markers.length===0?`Since ${Ju(r.experimentStart,86400000)}, shaped sessions should carry less tool output`:"Shaped sessions should carry less tool output than the rest of your history",actions:Sg.jsxDEV(ia,{items:f.legend},void 0,!1,void 0,this),stale:i,footer:`Tool tokens are result chars ÷ 4; context adds assistant output, your prompts (chars ÷ 4) and each session's first prompt. Dots are single buckets (one ${vg(c.bucketMs)}); lines are the trailing ${rR}-bucket ratio of sums.`,children:Sg.jsxDEV(_o,{buckets:f.buckets,bucketMs:c.bucketMs,series:f.series,markers:f.markers,stacked:!1,height:260,format:(v)=>Ge(v,0),formatTooltip:(v)=>Ge(v),showTotal:!1,emptyLabel:"No tool calls in this range"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var kg=_(Ke(),1);var Xe=_(te(),1),uR=10,hO=30,lR=4;function gO(r,l){let i=new Map;for(let c of r){if(c.tool!==l)continue;let f=i.get(c.steps);if(f===void 0)f={steps:c.steps,bySize:new Map,total:{cuts:0,savedTokens:0,excessTokens:0}},i.set(c.steps,f);f.bySize.set(c.size,c),f.total.cuts+=c.cuts,f.total.savedTokens+=c.savedTokens,f.total.excessTokens+=c.excessTokens}return[...i.values()].sort((c,f)=>Number(c.steps==="other")-Number(f.steps==="other")||f.total.savedTokens-c.total.savedTokens)}function iR({kept:r,cuts:l,title:i,children:c}){if(r===null)return Xe.jsxDEV("div",{className:"spot-econ-cell","data-empty":"true",title:i,children:Xe.jsxDEV("span",{className:"dim",children:"No saving"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let f=lR+Math.min(1,Math.abs(r-0.5)*2)*(hO-lR);return Xe.jsxDEV("div",{className:"spot-econ-cell","data-tone":r>=0.5?"ok":"bad","data-thin":l<uR,style:{"--tint":`${f}%`},title:i,children:[Xe.jsxDEV("span",{className:"spot-econ-net num",children:[jt(r),Xe.jsxDEV("span",{className:"spot-steps-unit",children:" kept"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Xe.jsxDEV("dl",{className:"spot-econ-facts",children:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function dR({stats:r,stale:l}){let[i,c]=kg.useState(!1),f=Fi(r).flatMap((m)=>{let b=gO(r.steps,m);return b.length===0?[]:[{tool:m,rows:b}]}),{listed:v,rest:y}=Qo(f),g=i?f:v;return Xe.jsxDEV(fe,{index:5,title:"Which cuts pay",description:"Share of each kind of cut's saving that stays saved after fetch-backs beyond the holdout baseline, by size",actions:Xe.jsxDEV("span",{className:"spot-econ-scale","aria-hidden":"true",children:[Xe.jsxDEV("span",{className:"num",children:"0%"},void 0,!1,void 0,this),Xe.jsxDEV("span",{className:"spot-econ-ramp"},void 0,!1,void 0,this),Xe.jsxDEV("span",{className:"num",children:"100% kept"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),stale:l,footer:`Scored and score-free cuts. Kept = (saved − fetch-back beyond the tool's holdout baseline) ÷ saved; fetched back is the share of cuts the agent came back for within 12 calls. Sizes are the tokens a cut saved against plain; step combinations under 10 cuts fold into "other". Cells under ${uR} cuts are dimmed.`,children:g.length===0?Xe.jsxDEV("div",{className:"empty",children:"No shortened results in this range."},void 0,!1,void 0,this):Xe.jsxDEV(Xe.Fragment,{children:[Xe.jsxDEV("div",{className:"spot-steps-scroll",children:Xe.jsxDEV("table",{className:"spot-econ spot-steps",children:[Xe.jsxDEV("thead",{children:Xe.jsxDEV("tr",{children:[Xe.jsxDEV("th",{scope:"col",children:"Steps"},void 0,!1,void 0,this),yg.map((m)=>Xe.jsxDEV("th",{scope:"col",className:"num",children:[m," ",Xe.jsxDEV("span",{className:"dim",children:"saved"},void 0,!1,void 0,this)]},m,!0,void 0,this)),Xe.jsxDEV("th",{scope:"col",children:"All sizes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Xe.jsxDEV("tbody",{children:g.map(({tool:m,rows:b})=>{let h=_r(m);return Xe.jsxDEV(kg.Fragment,{children:[Xe.jsxDEV("tr",{className:"spot-steps-tool",children:Xe.jsxDEV("th",{scope:"rowgroup",colSpan:yg.length+2,children:Xe.jsxDEV("span",{className:"row spot-econ-tool",children:[Xe.jsxDEV(h,{size:13,"aria-hidden":"true"},void 0,!1,void 0,this),m]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b.map((S)=>{let{total:L}=S,I=L.savedTokens>0?(L.savedTokens-L.excessTokens)/L.savedTokens:null;return Xe.jsxDEV("tr",{children:[Xe.jsxDEV("th",{scope:"row",className:"spot-steps-name",title:S.steps,children:S.steps},void 0,!1,void 0,this),yg.map((C)=>{let T=S.bySize.get(C);if(T===void 0||T.cuts===0)return Xe.jsxDEV("td",{children:Xe.jsxDEV("div",{className:"spot-econ-cell","data-empty":"true",children:Xe.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},C,!1,void 0,this);let R=Yn(T.fetchBackRate,jt);return Xe.jsxDEV("td",{children:Xe.jsxDEV(iR,{kept:T.keptShare,cuts:T.cuts,title:[`${m} · ${S.steps} · ${C} saved: ${A(T.cuts)} cuts`,`Saved ${se(T.savedTokens)}, fetched back ${se(T.recoveredTokens)}, ${se(T.excessTokens)} beyond the baseline`,`Fetched back after ${jt(T.fetchBackRate.value)} of cuts${R===""?"":` (${R})`}`].join(`
|
|
238
238
|
`),children:[Xe.jsxDEV("div",{children:[Xe.jsxDEV("dt",{children:"cuts"},void 0,!1,void 0,this),Xe.jsxDEV("dd",{className:"num",children:A(T.cuts)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Xe.jsxDEV("div",{children:[Xe.jsxDEV("dt",{children:"fetched back"},void 0,!1,void 0,this),Xe.jsxDEV("dd",{className:"num",children:jt(T.fetchBackRate.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},C,!1,void 0,this)}),Xe.jsxDEV("td",{children:Xe.jsxDEV(iR,{kept:I,cuts:L.cuts,title:`${m} · ${S.steps}: ${A(L.cuts)} cuts saved ${se(L.savedTokens)}, ${se(L.excessTokens)} fetched back beyond the baseline`,children:[Xe.jsxDEV("div",{children:[Xe.jsxDEV("dt",{children:"cuts"},void 0,!1,void 0,this),Xe.jsxDEV("dd",{className:"num",children:A(L.cuts)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Xe.jsxDEV("div",{children:[Xe.jsxDEV("dt",{children:"saved"},void 0,!1,void 0,this),Xe.jsxDEV("dd",{className:"num",children:se(L.savedTokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},S.steps,!0,void 0,this)})]},m,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),y.length>0&&Xe.jsxDEV(Jf,{hidden:y.map((m)=>m.tool),expanded:i,onToggle:()=>c((m)=>!m)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var ko=_(te(),1),yO=[{key:"fetch",label:"Fetch-back turns",color:"var(--spot-turns)"},{key:"shape",label:"Shaping",color:"var(--spot-cost)"}];function cR({stats:r,stale:l}){let i=r.timeCost,c=i.agentMs>0?i.fetchBackMs/i.agentMs:0,f=i.agentMs>0?i.shapeMs/i.agentMs:0,v=c+f,y=v>0?v*1.15:1,g=c/y*100,m=f/y*100;return ko.jsxDEV(fe,{index:3,title:"Time cost",description:"Share of the experiment sessions' model time spent on requests that only fetched cut output back, plus the time tool calls spent shaping",actions:ko.jsxDEV(ia,{items:yO},void 0,!1,void 0,this),stale:l,footer:`Model time is the summed duration of the experiment sessions' requests. A fetch-back turn is a request whose every tool call fetched back output a cut hid; shaping is the wall time tool calls spent shaping (Spotlight's requests included, held-out results too). Bars run to ${jt(y)} of model time.`,children:i.agentMs===0?ko.jsxDEV("div",{className:"empty",children:"No experiment requests in this range."},void 0,!1,void 0,this):ko.jsxDEV("ul",{className:"spot-time",children:ko.jsxDEV("li",{className:"spot-time-row",children:[ko.jsxDEV("span",{className:"spot-time-label",children:"Shaped sessions"},void 0,!1,void 0,this),ko.jsxDEV("span",{className:"spot-time-track","aria-hidden":"true",children:[ko.jsxDEV("span",{className:"spot-time-fill",style:{width:`${g}%`,background:"var(--spot-turns)"}},void 0,!1,void 0,this),ko.jsxDEV("span",{className:"spot-time-fill",style:{width:`${m}%`,background:"var(--spot-cost)"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ko.jsxDEV("span",{className:"spot-time-share num",children:jt(v)},void 0,!1,void 0,this),ko.jsxDEV("span",{className:"spot-time-detail",children:[ko.jsxDEV("span",{className:"num",children:gr(i.fetchBackMs)},void 0,!1,void 0,this)," in"," ",ko.jsxDEV("span",{className:"num",children:A(i.fetchBackTurns)},void 0,!1,void 0,this)," ",i.fetchBackTurns===1?"turn":"turns"," ·"," ",ko.jsxDEV("span",{className:"num",children:gr(i.shapeMs)},void 0,!1,void 0,this)," shaping",ko.jsxDEV("span",{className:"dim",children:[" ","of ",ko.jsxDEV("span",{className:"num",children:gr(i.agentMs)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var bt=_(te(),1),vO=[{value:"all",label:"All",title:"Every experiment session, subagents and advisors included"},{value:"main",label:"Main",title:"Sessions you drove: the main agent only"},{value:"subagent",label:"Subagents",title:"Sessions the task tool spawned"}],xO={all:"",main:"main-agent ",subagent:"subagent "};function Lg({id:r,title:l,children:i}){return bt.jsxDEV("header",{className:"spot-section rise",id:r,children:[bt.jsxDEV("h2",{className:"spot-section-title",children:l},void 0,!1,void 0,this),bt.jsxDEV("p",{className:"spot-section-copy",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pR({active:r,range:l}){let[i,c]=fR.useState("all"),f=Pt(["spotlight",l,i],({signal:g})=>vI(l,i,g),{enabled:r}),v=aa(l),y=f.data?.experimentStart??null;return bt.jsxDEV("div",{className:"page spot-page",children:[bt.jsxDEV(la,{title:"Spotlight",description:`What shaping tool output saved in ${u(v.windowKey)} against what pi would have shown unshaped, after taking back what the agent fetched again because of a cut.`,actions:bt.jsxDEV(Oa,{"aria-label":"Sessions",options:vO,value:i,onChange:c},void 0,!1,void 0,this)},void 0,!1,void 0,this),bt.jsxDEV(_e,{query:f,skeleton:bt.jsxDEV(qt,{height:220},void 0,!1,void 0,this),isEmpty:(g)=>g.sessions===0&&g.recent.length===0,empty:bt.jsxDEV(fe,{children:bt.jsxDEV("div",{className:"spot-empty",children:[bt.jsxDEV("span",{className:"spot-empty-icon","aria-hidden":"true",children:bt.jsxDEV(ws,{size:20},void 0,!1,void 0,this)},void 0,!1,void 0,this),bt.jsxDEV("h2",{className:"spot-empty-title",children:y===null?"The Spotlight experiment hasn't run yet":`No ${xO[i]}experiment sessions in ${u(v.windowKey)}`},void 0,!1,void 0,this),bt.jsxDEV("p",{className:"spot-empty-hint",children:y===null?bt.jsxDEV(bt.Fragment,{children:["Turn it on with ",bt.jsxDEV("code",{children:"spotlight.experiment.enabled"},void 0,!1,void 0,this)," in your settings or"," ",bt.jsxDEV("code",{children:"PI_SPOTLIGHT_EXPERIMENT=1"},void 0,!1,void 0,this),". Every session then shapes tool output, a random share of results is held out unshaped as the counterfactual, and this page tracks what the cuts save as you work."]},void 0,!0,void 0,this):i==="all"?"Try a longer range, or start a session with the experiment enabled.":"Try a longer range, or switch to All sessions."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),children:(g)=>bt.jsxDEV(bt.Fragment,{children:[bt.jsxDEV($2,{stats:g,windowLabel:u(v.windowKey),stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(Lg,{id:"spot-saved",title:"What it saved",children:"Where the saving came from, what fetch-backs took back, and what later requests no longer carry."},void 0,!1,void 0,this),bt.jsxDEV("div",{className:"grid grid-main-side",children:[bt.jsxDEV(aR,{stats:g,range:l,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(oR,{stats:g,stale:f.stale},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bt.jsxDEV(U2,{stats:g,active:r,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(sR,{stats:g,range:l,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(Lg,{id:"spot-cost",title:"What it cost",children:"Agent time, Spotlight's latency and failures, and whether shaped sessions got worse."},void 0,!1,void 0,this),bt.jsxDEV(cR,{stats:g,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(K2,{stats:g,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(Lg,{id:"spot-work",title:"Is Spotlight doing the work?",children:"Whether its heat finds the lines the agent needs, and whether its cuts come back less than cuts made without it."},void 0,!1,void 0,this),bt.jsxDEV(Q2,{stats:g,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(V2,{stats:g,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(j2,{stats:g,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(Lg,{id:"spot-tune",title:"Where to tune",children:"Which steps, sizes and tools pay, and which tools Spotlight doesn't shape yet."},void 0,!1,void 0,this),bt.jsxDEV(dR,{stats:g,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(F2,{stats:g,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(_2,{stats:g,stale:f.stale},void 0,!1,void 0,this),bt.jsxDEV(eR,{rows:g.recent,stale:f.stale},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Gi=_(Ke(),1);var be=_(te(),1);function bO(){return[{value:"calls",label:u("tools.calls")},{value:"errors",label:u("tools.errors")}]}var mR=6;function SO(r){if(r<3600000)return u("tools.bucket-5m");if(r<86400000)return u("tools.bucket-hour");return u("tools.bucket-day")}function hR({active:r,range:l}){let i=be.jsxDEV(Je,{title:u("tools.no-tool-calls")},void 0,!1,void 0,this),c=Pt(["tools",l],({signal:T})=>bI(l,T),{enabled:r}),[f,v]=Gi.useState("calls"),[y,g]=Pr(),[m,b]=Gi.useState(null),h=aa(l),S=Gi.useMemo(()=>kO(c.data,l),[c.data,l]),L=m!==null&&S.toolNames.includes(m)?m:null,I=f==="calls"?S.callSeries:S.errorSeries,C=(T)=>T.byTool.length===0;return be.jsxDEV("div",{className:"page",children:[be.jsxDEV(la,{title:u("tools.title"),description:u("tools.description",{window:u(h.windowKey)})},void 0,!1,void 0,this),be.jsxDEV(_e,{query:c,skeleton:be.jsxDEV(qt,{height:112},void 0,!1,void 0,this),children:()=>{let T=S.totals;return be.jsxDEV("div",{"data-stale":c.stale,className:"stack",style:{gap:16},children:[be.jsxDEV(wa,{min:190,children:[be.jsxDEV(ie,{label:u("tools.tool-calls"),value:A(T.calls),hint:u("tools.failed-n",{count:A(T.errors)}),spark:S.totalCalls},void 0,!1,void 0,this),be.jsxDEV(ie,{label:u("tools.distinct-tools"),value:A(T.tools),hint:S.rows[0]?u("tools.most-used",{tool:S.rows[0].tool}):void 0},void 0,!1,void 0,this),be.jsxDEV(ie,{label:u("common.error-rate"),title:u("tools.error-rate-title"),value:Ao(T.calls>0?T.errors/T.calls:0),hint:u("tools.succeeded-n",{count:A(T.calls-T.errors)}),spark:S.totalErrors,sparkColor:"var(--bad)"},void 0,!1,void 0,this),be.jsxDEV(ie,{label:u("tools.attributed-tokens"),title:u("tools.attribution-note"),value:se(Math.round(T.tokens)),hint:u("tools.tokens-output",{tokens:se(Math.round(T.output))})},void 0,!1,void 0,this),be.jsxDEV(ie,{label:u("tools.attributed-cost"),title:u("tools.attribution-estimate",{note:u("tools.attribution-note")}),value:oa(T.cost,T.unpriced),hint:T.unpriced>0?u("tools.unpriced-requests-n",{count:A(Math.round(T.unpriced))}):u("tools.api-equivalent")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),be.jsxDEV(wa,{min:150,children:[be.jsxDEV(ie,{size:"sm",label:u("tools.result-text"),title:u("tools.result-chars-title"),value:u("tools.chars",{count:se(T.resultChars)})},void 0,!1,void 0,this),be.jsxDEV(ie,{size:"sm",label:u("tools.call-arguments"),title:u("tools.args-chars-title"),value:u("tools.chars",{count:se(T.argsChars)})},void 0,!1,void 0,this),be.jsxDEV(ie,{size:"sm",label:u("tools.avg-result-per-call"),value:u("tools.chars",{count:se(T.calls>0?Math.round(T.resultChars/T.calls):0)})},void 0,!1,void 0,this),be.jsxDEV(ie,{size:"sm",label:u("tools.avg-args-per-call"),value:u("tools.chars",{count:se(T.calls>0?Math.round(T.argsChars/T.calls):0)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}},void 0,!1,void 0,this),be.jsxDEV(fe,{index:1,title:f==="calls"?u("tools.calls-over-time"):u("tools.errors-over-time"),description:u("tools.chart-description",{bucket:SO(h.bucketMs),count:mR}),actions:be.jsxDEV(Oa,{size:"sm",options:bO(),value:f,onChange:v},void 0,!1,void 0,this),stale:c.stale,children:be.jsxDEV(_e,{query:c,skeleton:be.jsxDEV(qt,{height:260},void 0,!1,void 0,this),isEmpty:C,empty:i,children:()=>be.jsxDEV("div",{className:"stack",style:{gap:12},children:[be.jsxDEV(_o,{buckets:S.buckets,bucketMs:h.bucketMs,series:I,hidden:y,height:260,formatTooltip:A,emptyLabel:f==="errors"?u("tools.no-tool-errors"):void 0},void 0,!1,void 0,this),be.jsxDEV(ia,{items:I.map((T)=>({key:T.key,label:T.label,color:T.color,value:se(T.values.reduce((R,O)=>R+(O??0),0))})),hidden:y,onToggle:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),be.jsxDEV(fe,{index:2,title:u("tools.by-tool"),description:u("tools.by-tool-description",{note:u("tools.attribution-note")}),flush:!0,stale:c.stale,children:be.jsxDEV(_e,{query:c,skeleton:be.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),isEmpty:C,empty:i,children:()=>be.jsxDEV(Ft,{rows:S.rows,rowKey:(T)=>T.tool,columns:S.toolColumns,initialSort:{key:"calls",dir:"desc"},limit:20,selectedKey:L,onRowClick:(T)=>b((R)=>R===T.tool?null:T.tool),dense:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),be.jsxDEV(fe,{index:3,title:u("tools.by-tool-and-model"),description:u("tools.by-tool-and-model-description"),flush:!0,stale:c.stale,actions:be.jsxDEV("div",{className:"row",style:{gap:6},children:[be.jsxDEV("select",{className:"input tools-filter",value:L??"",onChange:(T)=>b(T.target.value||null),"aria-label":u("tools.filter-by-tool"),children:[be.jsxDEV("option",{value:"",children:u("tools.all-tools")},void 0,!1,void 0,this),S.toolNames.map((T)=>be.jsxDEV("option",{value:T,children:T},T,!1,void 0,this))]},void 0,!0,void 0,this),L!==null&&be.jsxDEV("button",{type:"button",className:"btn","data-size":"sm","data-variant":"ghost","data-icon":"true",title:u("tools.clear-tool-filter"),"aria-label":u("tools.clear-tool-filter"),onClick:()=>b(null),children:be.jsxDEV(Ro,{size:13},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:be.jsxDEV(_e,{query:c,skeleton:be.jsxDEV(pa,{rows:8},void 0,!1,void 0,this),isEmpty:C,empty:i,children:(T)=>be.jsxDEV(wO,{rows:T.byToolModel,tool:L,colors:S.colors},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function kO(r,l){let i=r?.byTool??[],c=r?.series??[],f=d2(i).sort((I,C)=>C.calls-I.calls),v=Vf(i.map((I)=>({key:I.tool,weight:I.calls}))),y=oo(l,c.map((I)=>I.timestamp)),g={calls:0,errors:0,tools:i.length,tokens:0,output:0,cost:0,unpriced:0,resultChars:0,argsChars:0};for(let I of i)g.calls+=I.calls,g.errors+=I.errors,g.tokens+=I.totalTokensShare,g.output+=I.outputTokensShare,g.cost+=I.costShare,g.unpriced+=I.unpricedRequestsShare,g.resultChars+=I.resultChars,g.argsChars+=I.argsChars;let[m,b]=[(I)=>I.calls,(I)=>I.errors].map((I)=>Xn(c,{buckets:y,key:(C)=>C.tool,value:I,limit:mR,colors:v}).map((C)=>({...C,values:C.values.map((T)=>T||null)}))),h=new Map(Xn(c,{buckets:y,key:(I)=>I.tool,value:(I)=>I.calls}).map((I)=>[I.key,I.values])),S=f[0]?.calls??0,L=LO(S,v,h);return{rows:f,colors:v,buckets:y,totals:g,callSeries:m,errorSeries:b,totalCalls:ha(c,y,(I)=>I.calls),totalErrors:ha(c,y,(I)=>I.errors),toolNames:f.map((I)=>I.tool).sort((I,C)=>I.localeCompare(C)),toolColumns:L}}function LO(r,l,i){return[{key:"tool",header:u("tools.tool"),sort:(c)=>c.tool,render:(c)=>be.jsxDEV("span",{className:"row",style:{gap:8},children:[be.jsxDEV(an,{color:l.get(c.tool)??Mo},void 0,!1,void 0,this),be.jsxDEV("span",{className:"mono truncate tools-name",title:c.tool,children:c.tool},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"trend",header:u("tools.trend"),title:u("tools.trend-title"),render:(c)=>{let f=i.get(c.tool);return f&&f.length>1?be.jsxDEV(rd,{values:f,width:80,height:20,color:l.get(c.tool)??Mo},void 0,!1,void 0,this):be.jsxDEV("span",{className:"dim",children:"–"},void 0,!1,void 0,this)}},{key:"calls",header:u("tools.calls"),align:"right",sort:(c)=>c.calls,render:(c)=>be.jsxDEV(Ma,{value:c.calls,max:r,display:be.jsxDEV("span",{title:u("tools.share-of-calls",{percent:Ge(c.callFraction)}),children:[A(c.calls),be.jsxDEV("span",{className:"dim tools-share",children:Ge(c.callFraction,0)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},{key:"errorRate",header:u("tools.errors"),title:u("tools.errors-title"),align:"right",sort:(c)=>c.errorRate,render:(c)=>be.jsxDEV("span",{className:"row",style:{gap:8,justifyContent:"flex-end"},children:[be.jsxDEV("span",{className:"num dim",children:A(c.errors)},void 0,!1,void 0,this),be.jsxDEV(ct,{tone:c.errors>0?hr(c.errorRate):"neutral",mono:!0,children:Ao(c.errorRate)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"args",header:u("tools.args"),title:u("tools.args-chars-title"),align:"right",sort:(c)=>c.argsChars,render:(c)=>be.jsxDEV("span",{className:"num",children:se(c.argsChars)},void 0,!1,void 0,this)},{key:"result",header:u("tools.result"),title:u("tools.result-chars-title"),align:"right",sort:(c)=>c.resultChars,render:(c)=>be.jsxDEV("span",{className:"num",children:se(c.resultChars)},void 0,!1,void 0,this)},{key:"avgResult",header:u("tools.result-per-call"),title:u("tools.result-per-call-title"),align:"right",sort:(c)=>c.avgResultChars,render:(c)=>be.jsxDEV("span",{className:"num muted",children:se(Math.round(c.avgResultChars))},void 0,!1,void 0,this)},{key:"tokens",header:u("tools.attr-tokens"),title:u("tools.attribution-note"),align:"right",sort:(c)=>c.totalTokensShare,render:(c)=>be.jsxDEV("span",{className:"num",title:u("tools.share-of-tokens",{percent:Ge(c.tokenFraction)}),children:[se(Math.round(c.totalTokensShare)),be.jsxDEV("span",{className:"dim tools-share",children:Ge(c.tokenFraction,0)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"cost",header:u("tools.attr-cost"),title:u("tools.attribution-estimate",{note:u("tools.attribution-note")}),align:"right",sort:(c)=>c.costShare,render:(c)=>be.jsxDEV("span",{className:"num",title:u("tools.share-of-cost",{percent:Ge(c.costFraction)}),children:[oa(c.costShare,c.unpricedRequestsShare),be.jsxDEV("span",{className:"dim tools-share",children:Ge(c.costFraction,0)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"lastUsed",header:u("tools.last-used"),align:"right",sort:(c)=>c.lastUsed,render:(c)=>be.jsxDEV("span",{className:"muted",children:ma(c.lastUsed)},void 0,!1,void 0,this)}]}function wO({rows:r,tool:l,colors:i}){let c=Gi.useMemo(()=>(l===null?r:r.filter((v)=>v.tool===l)).map((v)=>({...v,errorRate:v.calls>0?v.errors/v.calls:0})),[r,l]),f=Gi.useMemo(()=>{let v=c.reduce((y,g)=>Math.max(y,g.calls),0);return[{key:"tool",header:u("tools.tool"),sort:(y)=>y.tool,render:(y)=>be.jsxDEV("span",{className:"row",style:{gap:8},children:[be.jsxDEV(an,{color:i.get(y.tool)??Mo},void 0,!1,void 0,this),be.jsxDEV("span",{className:"mono truncate tools-name",title:y.tool,children:y.tool},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"model",header:u("common.model"),sort:(y)=>y.model,render:(y)=>be.jsxDEV(co,{primary:be.jsxDEV("span",{className:"mono",children:y.model||u("common.unknown")},void 0,!1,void 0,this),secondary:y.provider},void 0,!1,void 0,this)},{key:"calls",header:u("tools.calls"),align:"right",sort:(y)=>y.calls,render:(y)=>be.jsxDEV(Ma,{value:y.calls,max:v,display:A(y.calls)},void 0,!1,void 0,this)},{key:"errorRate",header:u("tools.errors"),align:"right",sort:(y)=>y.errorRate,render:(y)=>be.jsxDEV("span",{className:"row",style:{gap:8,justifyContent:"flex-end"},children:[be.jsxDEV("span",{className:"num dim",children:A(y.errors)},void 0,!1,void 0,this),be.jsxDEV(ct,{tone:y.errors>0?hr(y.errorRate):"neutral",mono:!0,children:Ao(y.errorRate)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},{key:"result",header:u("tools.result"),title:u("tools.result-chars-title"),align:"right",sort:(y)=>y.resultChars,render:(y)=>be.jsxDEV("span",{className:"num",children:se(y.resultChars)},void 0,!1,void 0,this)},{key:"tokens",header:u("tools.attr-tokens"),title:u("tools.attribution-note"),align:"right",sort:(y)=>y.totalTokensShare,render:(y)=>be.jsxDEV("span",{className:"num",children:se(Math.round(y.totalTokensShare))},void 0,!1,void 0,this)},{key:"cost",header:u("tools.attr-cost"),title:u("tools.attribution-estimate",{note:u("tools.attribution-note")}),align:"right",sort:(y)=>y.costShare,render:(y)=>be.jsxDEV("span",{className:"num",children:oa(y.costShare,y.unpricedRequestsShare)},void 0,!1,void 0,this)},{key:"lastUsed",header:u("tools.last-used"),align:"right",sort:(y)=>y.lastUsed,render:(y)=>be.jsxDEV("span",{className:"muted",children:ma(y.lastUsed)},void 0,!1,void 0,this)}]},[c,i]);return be.jsxDEV(Ft,{rows:c,rowKey:(v)=>`${v.tool}::${v.model}::${v.provider}`,columns:f,initialSort:{key:"calls",dir:"desc"},limit:25,dense:!0,empty:be.jsxDEV(Je,{title:l?u("tools.no-calls-to-tool",{tool:l}):u("tools.no-tool-calls")},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var gR=_(Ke(),1);var Me=_(te(),1),CO={missing:"tracking.missing",partial:"tracking.partial",corrupt:"tracking.corrupt",error:"tracking.error"};function TO(r){if(r==="present")return"ok";if(r==="partial")return"warn";if(r==="corrupt"||r==="error")return"bad";return"neutral"}function tp({state:r,truncated:l}){if(r==="present"&&!l)return null;return Me.jsxDEV(ct,{tone:TO(r),children:r==="present"?u("tracking.truncated"):u(CO[r])},void 0,!1,void 0,this)}function IO(r){return[{key:"phase",label:u("tracking.phase"),value:r.phase||u("tracking.none")},{key:"progress",label:u("tracking.progress"),value:r.progress||u("tracking.none")},...r.stage?[{key:"stage",label:u("tracking.stage"),value:r.stage}]:[],{key:"blockers",label:u("tracking.blockers"),value:r.blockers.length?r.blockers.join("; "):u("tracking.none")},{key:"decisions",label:u("tracking.decisions"),value:r.decisions.length?r.decisions.join("; "):u("tracking.none")},{key:"updated",label:u("tracking.last-updated"),value:r.lastUpdated||u("tracking.none")},...r.lastSessionId?[{key:"session",label:u("tracking.last-session"),value:Me.jsxDEV("span",{className:"mono",children:r.lastSessionId},void 0,!1,void 0,this)}]:[],...r.phases?.length?[{key:"phases",label:u("tracking.phases"),value:r.phases.map((l)=>`${l.name} · ${l.status}`).join("; ")}]:[]]}function wg(r){if(!r)return null;return Me.jsxDEV("p",{className:"tracking-error",children:r},void 0,!1,void 0,this)}function yR({active:r}){let l=Pt(["tracking-projects"],({signal:g})=>hI(g),{enabled:r}),i=l.data?.projects??[],[c,f]=gR.useState(null),v=c!==null&&i.includes(c)?c:i[0]??null,y=Pt(["tracking",v],({signal:g})=>gI(v??"",g),{enabled:r&&v!==null});return Me.jsxDEV("div",{className:"page",children:[Me.jsxDEV(la,{title:u("tracking.title"),description:u("tracking.description")},void 0,!1,void 0,this),Me.jsxDEV(fe,{index:0,children:Me.jsxDEV("div",{className:"tracking-toolbar",children:[Me.jsxDEV("label",{className:"tracking-project",children:[Me.jsxDEV("span",{className:"section-label",children:u("tracking.project")},void 0,!1,void 0,this),l.data===null?Me.jsxDEV(Fa,{width:280,height:30},void 0,!1,void 0,this):Me.jsxDEV("select",{className:"tracking-select",value:v??"","aria-label":u("tracking.project"),onChange:(g)=>f(g.target.value),disabled:i.length===0,children:[i.length===0&&Me.jsxDEV("option",{value:"",children:u("tracking.no-projects")},void 0,!1,void 0,this),i.map((g)=>Me.jsxDEV("option",{value:g,children:g},g,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Me.jsxDEV("p",{className:"tracking-note",children:u("tracking.read-only")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),l.data!==null&&i.length===0?Me.jsxDEV(fe,{index:1,children:Me.jsxDEV(Je,{title:u("tracking.no-projects"),hint:u("tracking.no-projects-hint")},void 0,!1,void 0,this)},void 0,!1,void 0,this):Me.jsxDEV(_e,{query:y,skeleton:Me.jsxDEV(pa,{rows:5},void 0,!1,void 0,this),isEmpty:(g)=>!g.exists,empty:Me.jsxDEV(Je,{title:u("tracking.no-documents"),hint:`${u("tracking.no-documents-hint")}
|