@swestash/agent-lens 0.17.4 → 0.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-lens.js +22 -32
- package/dist/agent-lens.js.map +1 -1
- package/package.json +1 -1
- package/web/404.html +2 -2
- package/web/assets/{AboutView-tTOWbdtR.js → AboutView-DE58gn6y.js} +1 -1
- package/web/assets/{Dashboard-C3qXLVs0.js → Dashboard-DNVg4C8Q.js} +2 -2
- package/web/assets/{FileView-DMUoh5N2.js → FileView-Bp1FQn6s.js} +1 -1
- package/web/assets/{FilesView-CDA5f05Z.js → FilesView-CVZN72Gq.js} +1 -1
- package/web/assets/{SecurityView-DXDnsRCb.js → SecurityView-WfNKjnOq.js} +1 -1
- package/web/assets/{SessionView-Cb_Q-gSc.js → SessionView-MC9E6Co7.js} +12 -12
- package/web/assets/{SkillView-AX-xMPdI.js → SkillView-BYDmKcd1.js} +1 -1
- package/web/assets/{SkillsView-BwUdENAc.js → SkillsView-B8WjUwoi.js} +1 -1
- package/web/assets/{WorkflowView-C-39SjGW.js → WorkflowView-9UxUoXwT.js} +1 -1
- package/web/assets/{index-CtNviuC1.js → index-CSQQtD7p.js} +1 -1
- package/web/assets/{index-7p3QjWYa.css → index-CZlMEmLZ.css} +1 -1
- package/web/assets/{index-DiDvUUQ7.js → index-Yyr3A1Uv.js} +2 -2
- package/web/assets/{jsonish-DDjKYx9o.js → jsonish-BeB9o74x.js} +1 -1
- package/web/assets/{theme-BMrL_mzt.js → theme-B5typivv.js} +1 -1
- package/web/assets/{useResetOn-D_B_9yU4.js → useResetOn-BFLXE-9_.js} +1 -1
- package/web/index.html +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as R,j as v,u as l0,f as yt,s as fr,a as Nn,b as Ti,L as C_,c as Ei,g as le,R as P,l as kl,d as M_,e as lh,h as $_,i as I_,k as So,m as Ao,M as N_,S as fh,E as jo,n as D_,o as yn}from"./index-DiDvUUQ7.js";import{u as ge,K as et,C as Pe}from"./theme-BMrL_mzt.js";const Po=8,R_=26;function q_(){const[e,t]=R.useState(new Set),r=o=>t(s=>{const u=new Set(s);return u.has(o)?u.delete(o):u.add(o),u});return{topN:(o,s)=>e.has(s)?o:o.slice(0,Po),expandHeight:(o,s,u=R_)=>e.has(o)?Math.max(240,s*u):void 0,expandBtn:(o,s)=>{if(!(s<=Po))return v.jsx("button",{type:"button",className:"link-btn",onClick:()=>r(o),children:e.has(o)?`show top ${Po}`:`show all (${s})`})}}}function f0(e,t){var n;const r=((n=e==null?void 0:e.payload)==null?void 0:n[t])??(e==null?void 0:e[t]);return typeof r=="string"&&r!==""?r:null}function L_({active:e,payload:t,versionsByName:r}){var u,c,f,l;const{C:n,tooltipStyle:i}=ge();if(!e||!(t!=null&&t.length))return null;const a=String(((c=(u=t[0])==null?void 0:u.payload)==null?void 0:c.name)??""),o=Number(((l=(f=t[0])==null?void 0:f.payload)==null?void 0:l.n)??0),s=r.get(a)??[];return v.jsxs("div",{style:{...i.contentStyle,padding:"8px 10px",maxWidth:280},children:[v.jsx("div",{style:{color:n.text,fontWeight:600,marginBottom:4},children:a}),v.jsxs("div",{style:{color:n.muted,marginBottom:s.length?6:0},children:[o," firing",o===1?"":"s"," total"]}),s.map(d=>v.jsxs("div",{style:{color:n.text,display:"flex",justifyContent:"space-between",gap:12},children:[v.jsx("span",{style:{color:n.muted},children:d.version_id.slice(0,8)}),v.jsx("span",{children:d.n})]},d.version_id)),s.length>0&&v.jsx("div",{style:{color:n.muted,marginTop:6,fontSize:11},children:"click to open skill →"})]})}function Qf({x:e,y:t,payload:r,onSelect:n,title:i}){return v.jsx("text",{x:e,y:t,dy:4,textAnchor:"end",className:"axis-link",fontSize:11,onClick:()=>(r==null?void 0:r.value)&&n(r.value),"data-tip":i,children:r==null?void 0:r.value})}function B_(){const e=l0(),t=(n,i)=>{i!=null&&i!==""&&e(`/?${n}=${encodeURIComponent(i)}`)};return{drillFilter:t,drillTo:(n,i)=>a=>t(n,f0(a,i))}}const Ir="custom",Ka="all",d0=[{id:Ka,label:"All"},{id:"cost",label:"Cost",kpis:["cost","cost-per-session","total-tokens","token-breakdown","cache-read-ratio","sessions"],charts:["cost-over-time","tokens-over-time","tokens-by-model"]},{id:"reliability",label:"Reliability",kpis:["tool-error-rate","rejection-rate","workflow-runs","turns","turn-duration","session-duration","security"],charts:["tool-errors","error-types","activity"]},{id:"time",label:"Time",kpis:["sessions","total-tokens","cost","turn-duration","session-duration"],charts:["burn-heatmap","weekly-burn","model-latency","review-latency"]},{id:"activity",label:"Activity",kpis:["sessions","projects","turns","session-duration"],charts:["activity","category","complexity","tool-frequency","skill-activation","subagent-fanout"]}];function h0(e){return d0.find(t=>t.id===e)}const To="dashboard.layout",dh="dashboard.charts";function Ui(){return{hidden:[],order:[]}}function p0(){return{kpis:Ui(),charts:Ui()}}function F_(){return{v:1,active:Ka,custom:null,kpisCollapsed:!1}}function Cl(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function hh(e){if(typeof e!="object"||e===null)return Ui();const t=e;return{hidden:Cl(t.hidden),order:Cl(t.order)}}function W_(e){if(typeof e!="object"||e===null)return null;const t=e;return{kpis:hh(t.kpis),charts:hh(t.charts)}}function ph(e,t){if(typeof e!="object"||e===null){const n=Cl(t);if(n.length===0)return F_();const i=p0();return i.charts.hidden=n,{v:1,active:Ir,custom:i,kpisCollapsed:!1}}const r=e;return{v:1,active:typeof r.active=="string"?r.active:Ka,custom:W_(r.custom),kpisCollapsed:r.kpisCollapsed===!0}}function v0(e,t){const r=new Set(e),n=new Set,i=[];for(const a of t)r.has(a)&&!n.has(a)&&(i.push(a),n.add(a));for(const a of e)n.has(a)||i.push(a);return i}function zi(e,t){const r=new Map(e.map(n=>[n.id,n]));return v0(e.map(n=>n.id),t).map(n=>r.get(n))}function vh(e,t){if(!e)return Ui();const r=new Set(e);return{order:[...e],hidden:t.filter(n=>!r.has(n))}}function z_(e,t,r){return{kpis:vh(e.kpis,t),charts:vh(e.charts,r)}}function y0(e){return e.active!==Ir&&h0(e.active)?e.active:e.custom?Ir:Ka}function yh(e,t,r){const n=y0(e);return n!==Ir?z_(h0(n),t,r):e.custom??p0()}function U_(e,t){return{...e,active:Ir,custom:t}}function K_(e,t,r,n){const i=v0(e,t),a=i.indexOf(r),o=a+n;return a<0||o<0||o>=i.length?t:([i[a],i[o]]=[i[o],i[a]],i)}function H_(e,t,r){const n=e.filter(i=>i!==t);return r||n.push(t),n}function G_({s:e}){const t=new Map(e.by_severity.map(a=>[a.severity,a.n])),r=t.get("critical")??0,n=t.get("high")??0,i=e.total===0?"—":`${r} / ${n}`;return v.jsxs(C_,{className:"kpi kpi-btn"+(r>0?" sev-critical":n>0?" sev-high":""),to:"/security","data-tip":"Security findings — critical / high. Opens the Security page.",children:[v.jsx("div",{className:"kpi-label",children:"Security findings"}),v.jsx("div",{className:"kpi-value",children:i}),v.jsx("div",{className:"kpi-sub",children:e.total===0?"no open findings":`critical / high · ${e.total} open in ${e.sessions_flagged} sessions`})]})}function V_({t:e}){const{TOKEN_COLORS:t}=ge(),r=e.input+e.output+e.cache_creation+e.cache_read,n=[{name:"Input",v:e.input,c:t.input},{name:"Output",v:e.output,c:t.output},{name:"Cache write",v:e.cache_creation,c:t.cache_creation},{name:"Cache read",v:e.cache_read,c:t.cache_read}];return v.jsxs("div",{className:"kpi","data-tip":"Token totals by type: input · output · cache-write · cache-read",children:[v.jsx("div",{className:"kpi-label",children:"Token breakdown"}),v.jsx("ul",{className:"kpi-bd",children:n.map(i=>v.jsxs("li",{children:[v.jsx("span",{className:"kpi-bd-dot",style:{background:i.c},"aria-hidden":"true"}),v.jsx("span",{className:"kpi-bd-name",children:i.name}),v.jsx("span",{className:"kpi-bd-val",children:yt(i.v)}),v.jsxs("span",{className:"kpi-bd-pct",children:[r?Math.round(i.v/r*100):0,"%"]})]},i.name))})]})}function mh({overview:e,bd:t}){var a,o;const r=((a=t==null?void 0:t.error_types)==null?void 0:a.failures)??0,n=((o=t==null?void 0:t.error_types)==null?void 0:o.rejections)??0,i=e.tool_calls??0;return{failures:r,rejections:n,toolCalls:i,errRate:i?r/i*100:0,rejRate:i?n/i*100:0}}const ed=[{id:"sessions",label:"Sessions",render:({overview:e})=>v.jsx(et,{label:"Sessions",value:e.sessions_main,sub:`+${e.sessions_subagent.toLocaleString()} subagent runs`})},{id:"projects",label:"Projects",render:({overview:e})=>v.jsx(et,{label:"Projects",value:e.projects,sub:"distinct project paths"})},{id:"turns",label:"Turns",render:({overview:e})=>v.jsx(et,{label:"Turns",value:e.turns,sub:`${e.tool_calls.toLocaleString()} tool calls`})},{id:"tool-error-rate",label:"Tool error rate",render:e=>{const{failures:t,toolCalls:r,errRate:n}=mh(e);return v.jsx(et,{label:"Tool error rate",value:r?n.toFixed(1)+"%":"—",tip:"Genuine tool failures as a share of all tool calls (rejections/blocks excluded — see the rejection rate).",sub:`${t.toLocaleString()} failed of ${r.toLocaleString()} calls`})}},{id:"rejection-rate",label:"Rejection rate",render:e=>{const{rejections:t,toolCalls:r,rejRate:n}=mh(e);return v.jsx(et,{label:"Rejection rate",value:r?n.toFixed(1)+"%":"—",tip:"User-rejected + guardrail-blocked tool calls as a share of all tool calls. Not agent failures.",sub:`${t.toLocaleString()} rejected/blocked`})}},{id:"workflow-runs",label:"Workflow runs",render:({overview:e})=>v.jsx(et,{label:"Workflow runs",value:e.workflows.total||"—",tip:"Async workflow runs in range. Success rate is over decided runs (completed vs failed); in-flight runs are excluded from the rate.",sub:e.workflows.total?`${Math.round(e.workflows.success_rate*100)}% success · ${yt(e.workflows.total_tokens)}`:"no workflow runs"})},{id:"cost",label:"Est. cost",render:({overview:e})=>v.jsx(et,{label:"Est. cost (API-equiv.)",value:Nn(e.cost),tip:"Estimated at API list prices for this usage (cache reads/writes included at their discounted cache rates).",sub:e.unpriced_models.length?`⚠ unpriced: ${e.unpriced_models.map(fr).join(", ")}`:"API list price estimate"})},{id:"cost-per-session",label:"Cost / session",render:({overview:e})=>v.jsx(et,{label:"Cost / session",value:e.sessions_main?Nn(e.cost/e.sessions_main):"—",tip:"Estimated API-equivalent cost divided by main sessions in range.",sub:"API-equiv. per main session"})},{id:"cache-read-ratio",label:"Cache-read ratio",render:({overview:e})=>v.jsx(et,{label:"Cache-read ratio",value:(e.cache_read_ratio*100).toFixed(1)+"%",sub:"of all tokens are cached replays — excluded from “work”"})},{id:"turn-duration",label:"Turn duration",render:({overview:e})=>v.jsx(et,{label:"Turn duration p50 / p95",value:`${Ti(e.turn_duration_ms.p50)} / ${Ti(e.turn_duration_ms.p95)}`,sub:`${e.turn_duration_ms.count} turns`})},{id:"session-duration",label:"Session duration",render:({overview:e})=>v.jsx(et,{label:"Session duration p50 / p95",value:`${Ti(e.session_duration_ms.p50)} / ${Ti(e.session_duration_ms.p95)}`,tip:"End-to-end wall-clock length of main sessions (subagents excluded).",sub:`${e.session_duration_ms.count} sessions`})},{id:"total-tokens",label:"Total tokens",render:({overview:e})=>v.jsx(et,{label:"Total tokens",value:yt(e.total_tokens),sub:`${yt(e.tokens.input+e.tokens.output)} non-cache`})},{id:"token-breakdown",label:"Token breakdown",render:({overview:e})=>v.jsx(V_,{t:e.tokens})},{id:"security",label:"Security findings",render:({security:e})=>e?v.jsx(G_,{s:e}):null}];function X_({ctx:e,layout:t}){const r=new Set(t.hidden);return v.jsx("div",{className:"kpis",children:zi(ed,t.order).filter(n=>!r.has(n.id)).map(n=>v.jsx(R.Fragment,{children:n.render(e)},n.id))})}function m0(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=m0(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ee(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=m0(e))&&(n&&(n+=" "),n+=t);return n}var Eo,gh;function He(){if(gh)return Eo;gh=1;var e=Array.isArray;return Eo=e,Eo}var ko,bh;function g0(){if(bh)return ko;bh=1;var e=typeof Ei=="object"&&Ei&&Ei.Object===Object&&Ei;return ko=e,ko}var Co,xh;function St(){if(xh)return Co;xh=1;var e=g0(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Co=r,Co}var Mo,wh;function mi(){if(wh)return Mo;wh=1;var e=St(),t=e.Symbol;return Mo=t,Mo}var $o,_h;function Y_(){if(_h)return $o;_h=1;var e=mi(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(s?o[i]=u:delete o[i]),f}return $o=a,$o}var Io,Oh;function Z_(){if(Oh)return Io;Oh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Io=r,Io}var No,Sh;function Dt(){if(Sh)return No;Sh=1;var e=mi(),t=Y_(),r=Z_(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return No=o,No}var Do,Ah;function Rt(){if(Ah)return Do;Ah=1;function e(t){return t!=null&&typeof t=="object"}return Do=e,Do}var Ro,jh;function on(){if(jh)return Ro;jh=1;var e=Dt(),t=Rt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Ro=n,Ro}var qo,Ph;function td(){if(Ph)return qo;Ph=1;var e=He(),t=on(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return qo=i,qo}var Lo,Th;function Ht(){if(Th)return Lo;Th=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Lo=e,Lo}var Bo,Eh;function rd(){if(Eh)return Bo;Eh=1;var e=Dt(),t=Ht(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var u=e(s);return u==n||u==i||u==r||u==a}return Bo=o,Bo}var Fo,kh;function J_(){if(kh)return Fo;kh=1;var e=St(),t=e["__core-js_shared__"];return Fo=t,Fo}var Wo,Ch;function Q_(){if(Ch)return Wo;Ch=1;var e=J_(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Wo=r,Wo}var zo,Mh;function b0(){if(Mh)return zo;Mh=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return zo=r,zo}var Uo,$h;function eO(){if($h)return Uo;$h=1;var e=rd(),t=Q_(),r=Ht(),n=b0(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,c=s.hasOwnProperty,f=RegExp("^"+u.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(d){if(!r(d)||t(d))return!1;var h=e(d)?f:a;return h.test(n(d))}return Uo=l,Uo}var Ko,Ih;function tO(){if(Ih)return Ko;Ih=1;function e(t,r){return t==null?void 0:t[r]}return Ko=e,Ko}var Ho,Nh;function mr(){if(Nh)return Ho;Nh=1;var e=eO(),t=tO();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Ho=r,Ho}var Go,Dh;function Ha(){if(Dh)return Go;Dh=1;var e=mr(),t=e(Object,"create");return Go=t,Go}var Vo,Rh;function rO(){if(Rh)return Vo;Rh=1;var e=Ha();function t(){this.__data__=e?e(null):{},this.size=0}return Vo=t,Vo}var Xo,qh;function nO(){if(qh)return Xo;qh=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Xo=e,Xo}var Yo,Lh;function iO(){if(Lh)return Yo;Lh=1;var e=Ha(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return n.call(o,a)?o[a]:void 0}return Yo=i,Yo}var Zo,Bh;function aO(){if(Bh)return Zo;Bh=1;var e=Ha(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Zo=n,Zo}var Jo,Fh;function oO(){if(Fh)return Jo;Fh=1;var e=Ha(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return Jo=r,Jo}var Qo,Wh;function sO(){if(Wh)return Qo;Wh=1;var e=rO(),t=nO(),r=iO(),n=aO(),i=oO();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Qo=a,Qo}var es,zh;function uO(){if(zh)return es;zh=1;function e(){this.__data__=[],this.size=0}return es=e,es}var ts,Uh;function nd(){if(Uh)return ts;Uh=1;function e(t,r){return t===r||t!==t&&r!==r}return ts=e,ts}var rs,Kh;function Ga(){if(Kh)return rs;Kh=1;var e=nd();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return rs=t,rs}var ns,Hh;function cO(){if(Hh)return ns;Hh=1;var e=Ga(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return ns=n,ns}var is,Gh;function lO(){if(Gh)return is;Gh=1;var e=Ga();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return is=t,is}var as,Vh;function fO(){if(Vh)return as;Vh=1;var e=Ga();function t(r){return e(this.__data__,r)>-1}return as=t,as}var os,Xh;function dO(){if(Xh)return os;Xh=1;var e=Ga();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return os=t,os}var ss,Yh;function Va(){if(Yh)return ss;Yh=1;var e=uO(),t=cO(),r=lO(),n=fO(),i=dO();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ss=a,ss}var us,Zh;function id(){if(Zh)return us;Zh=1;var e=mr(),t=St(),r=e(t,"Map");return us=r,us}var cs,Jh;function hO(){if(Jh)return cs;Jh=1;var e=sO(),t=Va(),r=id();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return cs=n,cs}var ls,Qh;function pO(){if(Qh)return ls;Qh=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return ls=e,ls}var fs,ep;function Xa(){if(ep)return fs;ep=1;var e=pO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return fs=t,fs}var ds,tp;function vO(){if(tp)return ds;tp=1;var e=Xa();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return ds=t,ds}var hs,rp;function yO(){if(rp)return hs;rp=1;var e=Xa();function t(r){return e(this,r).get(r)}return hs=t,hs}var ps,np;function mO(){if(np)return ps;np=1;var e=Xa();function t(r){return e(this,r).has(r)}return ps=t,ps}var vs,ip;function gO(){if(ip)return vs;ip=1;var e=Xa();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return vs=t,vs}var ys,ap;function ad(){if(ap)return ys;ap=1;var e=hO(),t=vO(),r=yO(),n=mO(),i=gO();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ys=a,ys}var ms,op;function x0(){if(op)return ms;op=1;var e=ad(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],u=a.cache;if(u.has(s))return u.get(s);var c=n.apply(this,o);return a.cache=u.set(s,c)||u,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,ms=r,ms}var gs,sp;function bO(){if(sp)return gs;sp=1;var e=x0(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return gs=r,gs}var bs,up;function xO(){if(up)return bs;up=1;var e=bO(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,u,c){a.push(u?c.replace(r,"$1"):s||o)}),a});return bs=n,bs}var xs,cp;function od(){if(cp)return xs;cp=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return xs=e,xs}var ws,lp;function wO(){if(lp)return ws;lp=1;var e=mi(),t=od(),r=He(),n=on(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return t(s,o)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return ws=o,ws}var _s,fp;function w0(){if(fp)return _s;fp=1;var e=wO();function t(r){return r==null?"":e(r)}return _s=t,_s}var Os,dp;function _0(){if(dp)return Os;dp=1;var e=He(),t=td(),r=xO(),n=w0();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return Os=i,Os}var Ss,hp;function Ya(){if(hp)return Ss;hp=1;var e=on();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Ss=t,Ss}var As,pp;function sd(){if(pp)return As;pp=1;var e=_0(),t=Ya();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return As=r,As}var js,vp;function O0(){if(vp)return js;vp=1;var e=sd();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return js=t,js}var _O=O0();const at=le(_O);var Ps,yp;function OO(){if(yp)return Ps;yp=1;function e(t){return t==null}return Ps=e,Ps}var SO=OO();const Q=le(SO);var Ts,mp;function AO(){if(mp)return Ts;mp=1;var e=Dt(),t=He(),r=Rt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return Ts=i,Ts}var jO=AO();const dr=le(jO);var PO=rd();const X=le(PO);var TO=Ht();const sn=le(TO);var Es={exports:{}},ne={};/**
|
|
1
|
+
import{r as R,j as v,u as l0,f as yt,s as fr,a as Nn,b as Ti,L as C_,c as Ei,g as le,R as P,l as kl,d as M_,e as lh,h as $_,i as I_,k as So,m as Ao,M as N_,S as fh,E as jo,n as D_,o as yn}from"./index-Yyr3A1Uv.js";import{u as ge,K as et,C as Pe}from"./theme-B5typivv.js";const Po=8,R_=26;function q_(){const[e,t]=R.useState(new Set),r=o=>t(s=>{const u=new Set(s);return u.has(o)?u.delete(o):u.add(o),u});return{topN:(o,s)=>e.has(s)?o:o.slice(0,Po),expandHeight:(o,s,u=R_)=>e.has(o)?Math.max(240,s*u):void 0,expandBtn:(o,s)=>{if(!(s<=Po))return v.jsx("button",{type:"button",className:"link-btn",onClick:()=>r(o),children:e.has(o)?`show top ${Po}`:`show all (${s})`})}}}function f0(e,t){var n;const r=((n=e==null?void 0:e.payload)==null?void 0:n[t])??(e==null?void 0:e[t]);return typeof r=="string"&&r!==""?r:null}function L_({active:e,payload:t,versionsByName:r}){var u,c,f,l;const{C:n,tooltipStyle:i}=ge();if(!e||!(t!=null&&t.length))return null;const a=String(((c=(u=t[0])==null?void 0:u.payload)==null?void 0:c.name)??""),o=Number(((l=(f=t[0])==null?void 0:f.payload)==null?void 0:l.n)??0),s=r.get(a)??[];return v.jsxs("div",{style:{...i.contentStyle,padding:"8px 10px",maxWidth:280},children:[v.jsx("div",{style:{color:n.text,fontWeight:600,marginBottom:4},children:a}),v.jsxs("div",{style:{color:n.muted,marginBottom:s.length?6:0},children:[o," firing",o===1?"":"s"," total"]}),s.map(d=>v.jsxs("div",{style:{color:n.text,display:"flex",justifyContent:"space-between",gap:12},children:[v.jsx("span",{style:{color:n.muted},children:d.version_id.slice(0,8)}),v.jsx("span",{children:d.n})]},d.version_id)),s.length>0&&v.jsx("div",{style:{color:n.muted,marginTop:6,fontSize:11},children:"click to open skill →"})]})}function Qf({x:e,y:t,payload:r,onSelect:n,title:i}){return v.jsx("text",{x:e,y:t,dy:4,textAnchor:"end",className:"axis-link",fontSize:11,onClick:()=>(r==null?void 0:r.value)&&n(r.value),"data-tip":i,children:r==null?void 0:r.value})}function B_(){const e=l0(),t=(n,i)=>{i!=null&&i!==""&&e(`/?${n}=${encodeURIComponent(i)}`)};return{drillFilter:t,drillTo:(n,i)=>a=>t(n,f0(a,i))}}const Ir="custom",Ka="all",d0=[{id:Ka,label:"All"},{id:"cost",label:"Cost",kpis:["cost","cost-per-session","total-tokens","token-breakdown","cache-read-ratio","sessions"],charts:["cost-over-time","tokens-over-time","tokens-by-model"]},{id:"reliability",label:"Reliability",kpis:["tool-error-rate","rejection-rate","workflow-runs","turns","turn-duration","session-duration","security"],charts:["tool-errors","error-types","activity"]},{id:"time",label:"Time",kpis:["sessions","total-tokens","cost","turn-duration","session-duration"],charts:["burn-heatmap","weekly-burn","model-latency","review-latency"]},{id:"activity",label:"Activity",kpis:["sessions","projects","turns","session-duration"],charts:["activity","category","complexity","tool-frequency","skill-activation","subagent-fanout"]}];function h0(e){return d0.find(t=>t.id===e)}const To="dashboard.layout",dh="dashboard.charts";function Ui(){return{hidden:[],order:[]}}function p0(){return{kpis:Ui(),charts:Ui()}}function F_(){return{v:1,active:Ka,custom:null,kpisCollapsed:!1}}function Cl(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function hh(e){if(typeof e!="object"||e===null)return Ui();const t=e;return{hidden:Cl(t.hidden),order:Cl(t.order)}}function W_(e){if(typeof e!="object"||e===null)return null;const t=e;return{kpis:hh(t.kpis),charts:hh(t.charts)}}function ph(e,t){if(typeof e!="object"||e===null){const n=Cl(t);if(n.length===0)return F_();const i=p0();return i.charts.hidden=n,{v:1,active:Ir,custom:i,kpisCollapsed:!1}}const r=e;return{v:1,active:typeof r.active=="string"?r.active:Ka,custom:W_(r.custom),kpisCollapsed:r.kpisCollapsed===!0}}function v0(e,t){const r=new Set(e),n=new Set,i=[];for(const a of t)r.has(a)&&!n.has(a)&&(i.push(a),n.add(a));for(const a of e)n.has(a)||i.push(a);return i}function zi(e,t){const r=new Map(e.map(n=>[n.id,n]));return v0(e.map(n=>n.id),t).map(n=>r.get(n))}function vh(e,t){if(!e)return Ui();const r=new Set(e);return{order:[...e],hidden:t.filter(n=>!r.has(n))}}function z_(e,t,r){return{kpis:vh(e.kpis,t),charts:vh(e.charts,r)}}function y0(e){return e.active!==Ir&&h0(e.active)?e.active:e.custom?Ir:Ka}function yh(e,t,r){const n=y0(e);return n!==Ir?z_(h0(n),t,r):e.custom??p0()}function U_(e,t){return{...e,active:Ir,custom:t}}function K_(e,t,r,n){const i=v0(e,t),a=i.indexOf(r),o=a+n;return a<0||o<0||o>=i.length?t:([i[a],i[o]]=[i[o],i[a]],i)}function H_(e,t,r){const n=e.filter(i=>i!==t);return r||n.push(t),n}function G_({s:e}){const t=new Map(e.by_severity.map(a=>[a.severity,a.n])),r=t.get("critical")??0,n=t.get("high")??0,i=e.total===0?"—":`${r} / ${n}`;return v.jsxs(C_,{className:"kpi kpi-btn"+(r>0?" sev-critical":n>0?" sev-high":""),to:"/security","data-tip":"Security findings — critical / high. Opens the Security page.",children:[v.jsx("div",{className:"kpi-label",children:"Security findings"}),v.jsx("div",{className:"kpi-value",children:i}),v.jsx("div",{className:"kpi-sub",children:e.total===0?"no open findings":`critical / high · ${e.total} open in ${e.sessions_flagged} sessions`})]})}function V_({t:e}){const{TOKEN_COLORS:t}=ge(),r=e.input+e.output+e.cache_creation+e.cache_read,n=[{name:"Input",v:e.input,c:t.input},{name:"Output",v:e.output,c:t.output},{name:"Cache write",v:e.cache_creation,c:t.cache_creation},{name:"Cache read",v:e.cache_read,c:t.cache_read}];return v.jsxs("div",{className:"kpi","data-tip":"Token totals by type: input · output · cache-write · cache-read",children:[v.jsx("div",{className:"kpi-label",children:"Token breakdown"}),v.jsx("ul",{className:"kpi-bd",children:n.map(i=>v.jsxs("li",{children:[v.jsx("span",{className:"kpi-bd-dot",style:{background:i.c},"aria-hidden":"true"}),v.jsx("span",{className:"kpi-bd-name",children:i.name}),v.jsx("span",{className:"kpi-bd-val",children:yt(i.v)}),v.jsxs("span",{className:"kpi-bd-pct",children:[r?Math.round(i.v/r*100):0,"%"]})]},i.name))})]})}function mh({overview:e,bd:t}){var a,o;const r=((a=t==null?void 0:t.error_types)==null?void 0:a.failures)??0,n=((o=t==null?void 0:t.error_types)==null?void 0:o.rejections)??0,i=e.tool_calls??0;return{failures:r,rejections:n,toolCalls:i,errRate:i?r/i*100:0,rejRate:i?n/i*100:0}}const ed=[{id:"sessions",label:"Sessions",render:({overview:e})=>v.jsx(et,{label:"Sessions",value:e.sessions_main,sub:`+${e.sessions_subagent.toLocaleString()} subagent runs`})},{id:"projects",label:"Projects",render:({overview:e})=>v.jsx(et,{label:"Projects",value:e.projects,sub:"distinct project paths"})},{id:"turns",label:"Turns",render:({overview:e})=>v.jsx(et,{label:"Turns",value:e.turns,sub:`${e.tool_calls.toLocaleString()} tool calls`})},{id:"tool-error-rate",label:"Tool error rate",render:e=>{const{failures:t,toolCalls:r,errRate:n}=mh(e);return v.jsx(et,{label:"Tool error rate",value:r?n.toFixed(1)+"%":"—",tip:"Genuine tool failures as a share of all tool calls (rejections/blocks excluded — see the rejection rate).",sub:`${t.toLocaleString()} failed of ${r.toLocaleString()} calls`})}},{id:"rejection-rate",label:"Rejection rate",render:e=>{const{rejections:t,toolCalls:r,rejRate:n}=mh(e);return v.jsx(et,{label:"Rejection rate",value:r?n.toFixed(1)+"%":"—",tip:"User-rejected + guardrail-blocked tool calls as a share of all tool calls. Not agent failures.",sub:`${t.toLocaleString()} rejected/blocked`})}},{id:"workflow-runs",label:"Workflow runs",render:({overview:e})=>v.jsx(et,{label:"Workflow runs",value:e.workflows.total||"—",tip:"Async workflow runs in range. Success rate is over decided runs (completed vs failed); in-flight runs are excluded from the rate.",sub:e.workflows.total?`${Math.round(e.workflows.success_rate*100)}% success · ${yt(e.workflows.total_tokens)}`:"no workflow runs"})},{id:"cost",label:"Est. cost",render:({overview:e})=>v.jsx(et,{label:"Est. cost (API-equiv.)",value:Nn(e.cost),tip:"Estimated at API list prices for this usage (cache reads/writes included at their discounted cache rates).",sub:e.unpriced_models.length?`⚠ unpriced: ${e.unpriced_models.map(fr).join(", ")}`:"API list price estimate"})},{id:"cost-per-session",label:"Cost / session",render:({overview:e})=>v.jsx(et,{label:"Cost / session",value:e.sessions_main?Nn(e.cost/e.sessions_main):"—",tip:"Estimated API-equivalent cost divided by main sessions in range.",sub:"API-equiv. per main session"})},{id:"cache-read-ratio",label:"Cache-read ratio",render:({overview:e})=>v.jsx(et,{label:"Cache-read ratio",value:(e.cache_read_ratio*100).toFixed(1)+"%",sub:"of all tokens are cached replays — excluded from “work”"})},{id:"turn-duration",label:"Turn duration",render:({overview:e})=>v.jsx(et,{label:"Turn duration p50 / p95",value:`${Ti(e.turn_duration_ms.p50)} / ${Ti(e.turn_duration_ms.p95)}`,sub:`${e.turn_duration_ms.count} turns`})},{id:"session-duration",label:"Session duration",render:({overview:e})=>v.jsx(et,{label:"Session duration p50 / p95",value:`${Ti(e.session_duration_ms.p50)} / ${Ti(e.session_duration_ms.p95)}`,tip:"End-to-end wall-clock length of main sessions (subagents excluded).",sub:`${e.session_duration_ms.count} sessions`})},{id:"total-tokens",label:"Total tokens",render:({overview:e})=>v.jsx(et,{label:"Total tokens",value:yt(e.total_tokens),sub:`${yt(e.tokens.input+e.tokens.output)} non-cache`})},{id:"token-breakdown",label:"Token breakdown",render:({overview:e})=>v.jsx(V_,{t:e.tokens})},{id:"security",label:"Security findings",render:({security:e})=>e?v.jsx(G_,{s:e}):null}];function X_({ctx:e,layout:t}){const r=new Set(t.hidden);return v.jsx("div",{className:"kpis",children:zi(ed,t.order).filter(n=>!r.has(n.id)).map(n=>v.jsx(R.Fragment,{children:n.render(e)},n.id))})}function m0(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=m0(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ee(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=m0(e))&&(n&&(n+=" "),n+=t);return n}var Eo,gh;function He(){if(gh)return Eo;gh=1;var e=Array.isArray;return Eo=e,Eo}var ko,bh;function g0(){if(bh)return ko;bh=1;var e=typeof Ei=="object"&&Ei&&Ei.Object===Object&&Ei;return ko=e,ko}var Co,xh;function St(){if(xh)return Co;xh=1;var e=g0(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Co=r,Co}var Mo,wh;function mi(){if(wh)return Mo;wh=1;var e=St(),t=e.Symbol;return Mo=t,Mo}var $o,_h;function Y_(){if(_h)return $o;_h=1;var e=mi(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(s?o[i]=u:delete o[i]),f}return $o=a,$o}var Io,Oh;function Z_(){if(Oh)return Io;Oh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Io=r,Io}var No,Sh;function Dt(){if(Sh)return No;Sh=1;var e=mi(),t=Y_(),r=Z_(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return No=o,No}var Do,Ah;function Rt(){if(Ah)return Do;Ah=1;function e(t){return t!=null&&typeof t=="object"}return Do=e,Do}var Ro,jh;function on(){if(jh)return Ro;jh=1;var e=Dt(),t=Rt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Ro=n,Ro}var qo,Ph;function td(){if(Ph)return qo;Ph=1;var e=He(),t=on(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return qo=i,qo}var Lo,Th;function Ht(){if(Th)return Lo;Th=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Lo=e,Lo}var Bo,Eh;function rd(){if(Eh)return Bo;Eh=1;var e=Dt(),t=Ht(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var u=e(s);return u==n||u==i||u==r||u==a}return Bo=o,Bo}var Fo,kh;function J_(){if(kh)return Fo;kh=1;var e=St(),t=e["__core-js_shared__"];return Fo=t,Fo}var Wo,Ch;function Q_(){if(Ch)return Wo;Ch=1;var e=J_(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Wo=r,Wo}var zo,Mh;function b0(){if(Mh)return zo;Mh=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return zo=r,zo}var Uo,$h;function eO(){if($h)return Uo;$h=1;var e=rd(),t=Q_(),r=Ht(),n=b0(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,c=s.hasOwnProperty,f=RegExp("^"+u.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(d){if(!r(d)||t(d))return!1;var h=e(d)?f:a;return h.test(n(d))}return Uo=l,Uo}var Ko,Ih;function tO(){if(Ih)return Ko;Ih=1;function e(t,r){return t==null?void 0:t[r]}return Ko=e,Ko}var Ho,Nh;function mr(){if(Nh)return Ho;Nh=1;var e=eO(),t=tO();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Ho=r,Ho}var Go,Dh;function Ha(){if(Dh)return Go;Dh=1;var e=mr(),t=e(Object,"create");return Go=t,Go}var Vo,Rh;function rO(){if(Rh)return Vo;Rh=1;var e=Ha();function t(){this.__data__=e?e(null):{},this.size=0}return Vo=t,Vo}var Xo,qh;function nO(){if(qh)return Xo;qh=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Xo=e,Xo}var Yo,Lh;function iO(){if(Lh)return Yo;Lh=1;var e=Ha(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return n.call(o,a)?o[a]:void 0}return Yo=i,Yo}var Zo,Bh;function aO(){if(Bh)return Zo;Bh=1;var e=Ha(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Zo=n,Zo}var Jo,Fh;function oO(){if(Fh)return Jo;Fh=1;var e=Ha(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return Jo=r,Jo}var Qo,Wh;function sO(){if(Wh)return Qo;Wh=1;var e=rO(),t=nO(),r=iO(),n=aO(),i=oO();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Qo=a,Qo}var es,zh;function uO(){if(zh)return es;zh=1;function e(){this.__data__=[],this.size=0}return es=e,es}var ts,Uh;function nd(){if(Uh)return ts;Uh=1;function e(t,r){return t===r||t!==t&&r!==r}return ts=e,ts}var rs,Kh;function Ga(){if(Kh)return rs;Kh=1;var e=nd();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return rs=t,rs}var ns,Hh;function cO(){if(Hh)return ns;Hh=1;var e=Ga(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return ns=n,ns}var is,Gh;function lO(){if(Gh)return is;Gh=1;var e=Ga();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return is=t,is}var as,Vh;function fO(){if(Vh)return as;Vh=1;var e=Ga();function t(r){return e(this.__data__,r)>-1}return as=t,as}var os,Xh;function dO(){if(Xh)return os;Xh=1;var e=Ga();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return os=t,os}var ss,Yh;function Va(){if(Yh)return ss;Yh=1;var e=uO(),t=cO(),r=lO(),n=fO(),i=dO();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ss=a,ss}var us,Zh;function id(){if(Zh)return us;Zh=1;var e=mr(),t=St(),r=e(t,"Map");return us=r,us}var cs,Jh;function hO(){if(Jh)return cs;Jh=1;var e=sO(),t=Va(),r=id();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return cs=n,cs}var ls,Qh;function pO(){if(Qh)return ls;Qh=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return ls=e,ls}var fs,ep;function Xa(){if(ep)return fs;ep=1;var e=pO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return fs=t,fs}var ds,tp;function vO(){if(tp)return ds;tp=1;var e=Xa();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return ds=t,ds}var hs,rp;function yO(){if(rp)return hs;rp=1;var e=Xa();function t(r){return e(this,r).get(r)}return hs=t,hs}var ps,np;function mO(){if(np)return ps;np=1;var e=Xa();function t(r){return e(this,r).has(r)}return ps=t,ps}var vs,ip;function gO(){if(ip)return vs;ip=1;var e=Xa();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return vs=t,vs}var ys,ap;function ad(){if(ap)return ys;ap=1;var e=hO(),t=vO(),r=yO(),n=mO(),i=gO();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ys=a,ys}var ms,op;function x0(){if(op)return ms;op=1;var e=ad(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],u=a.cache;if(u.has(s))return u.get(s);var c=n.apply(this,o);return a.cache=u.set(s,c)||u,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,ms=r,ms}var gs,sp;function bO(){if(sp)return gs;sp=1;var e=x0(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return gs=r,gs}var bs,up;function xO(){if(up)return bs;up=1;var e=bO(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,u,c){a.push(u?c.replace(r,"$1"):s||o)}),a});return bs=n,bs}var xs,cp;function od(){if(cp)return xs;cp=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return xs=e,xs}var ws,lp;function wO(){if(lp)return ws;lp=1;var e=mi(),t=od(),r=He(),n=on(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return t(s,o)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return ws=o,ws}var _s,fp;function w0(){if(fp)return _s;fp=1;var e=wO();function t(r){return r==null?"":e(r)}return _s=t,_s}var Os,dp;function _0(){if(dp)return Os;dp=1;var e=He(),t=td(),r=xO(),n=w0();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return Os=i,Os}var Ss,hp;function Ya(){if(hp)return Ss;hp=1;var e=on();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Ss=t,Ss}var As,pp;function sd(){if(pp)return As;pp=1;var e=_0(),t=Ya();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return As=r,As}var js,vp;function O0(){if(vp)return js;vp=1;var e=sd();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return js=t,js}var _O=O0();const at=le(_O);var Ps,yp;function OO(){if(yp)return Ps;yp=1;function e(t){return t==null}return Ps=e,Ps}var SO=OO();const Q=le(SO);var Ts,mp;function AO(){if(mp)return Ts;mp=1;var e=Dt(),t=He(),r=Rt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return Ts=i,Ts}var jO=AO();const dr=le(jO);var PO=rd();const X=le(PO);var TO=Ht();const sn=le(TO);var Es={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -66,4 +66,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
66
66
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OR(e,t){if(e){if(typeof e=="string")return Lf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Lf(e,t)}}function SR(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function AR(e){if(Array.isArray(e))return Lf(e)}function Lf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function jR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ub(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c_(n.key),n)}}function PR(e,t,r){return t&&Ub(e.prototype,t),r&&Ub(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function TR(e,t,r){return t=Ba(t),ER(e,u_()?Reflect.construct(t,r||[],Ba(e).constructor):t.apply(e,r))}function ER(e,t){if(t&&(Qr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kR(e)}function kR(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(u_=function(){return!!e})()}function Ba(e){return Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ba(e)}function CR(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Bf(e,t)}function Bf(e,t){return Bf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Bf(e,t)}function ht(e,t,r){return t=c_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c_(e){var t=MR(e,"string");return Qr(t)=="symbol"?t:t+""}function MR(e,t){if(Qr(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Qr(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ut=(function(e){function t(){var r;jR(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=TR(this,t,[].concat(i)),ht(r,"state",{isAnimationFinished:!0,totalLength:0}),ht(r,"generateSimpleStrokeDasharray",function(o,s){return"".concat(s,"px ").concat(o-s,"px")}),ht(r,"getStrokeDasharray",function(o,s,u){var c=u.reduce(function(x,w){return x+w});if(!c)return r.generateSimpleStrokeDasharray(s,o);for(var f=Math.floor(o/c),l=o%c,d=s-o,h=[],m=0,y=0;m<u.length;y+=u[m],++m)if(y+u[m]>l){h=[].concat(jr(u.slice(0,m)),[l-y]);break}var p=h.length%2===0?[0,d]:[d];return[].concat(jr(t.repeat(u,f)),jr(h),p).map(function(x){return"".concat(x,"px")}).join(", ")}),ht(r,"id",cn("recharts-line-")),ht(r,"pathRef",function(o){r.mainCurve=o}),ht(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),ht(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return CR(t,e),PR(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,s=a.xAxis,u=a.yAxis,c=a.layout,f=a.children,l=ot(f,Si);if(!l)return null;var d=function(y,p){return{x:y.x,y:y.y,value:y.value,errorVal:Be(y.payload,p)}},h={clipPath:n?"url(#clipPath-".concat(i,")"):null};return P.createElement(ce,h,l.map(function(m){return P.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:o,xAxis:s,yAxis:u,layout:c,dataPointFormatter:d})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var s=this.props,u=s.dot,c=s.points,f=s.dataKey,l=Z(this.props,!1),d=Z(u,!0),h=c.map(function(y,p){var x=Xe(Xe(Xe({key:"dot-".concat(p),r:3},l),d),{},{index:p,cx:y.x,cy:y.y,value:y.value,dataKey:f,payload:y.payload,points:c});return t.renderDotItem(u,x)}),m={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return P.createElement(ce,$n({className:"recharts-line-dots",key:"dots"},m),h)}},{key:"renderCurveStatically",value:function(n,i,a,o){var s=this.props,u=s.type,c=s.layout,f=s.connectNulls;s.ref;var l=Wb(s,bR),d=Xe(Xe(Xe({},Z(l,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:u,layout:c,connectNulls:f});return P.createElement($r,$n({},d,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,s=o.points,u=o.strokeDasharray,c=o.isAnimationActive,f=o.animationBegin,l=o.animationDuration,d=o.animationEasing,h=o.animationId,m=o.animateNewValues,y=o.width,p=o.height,x=this.state,w=x.prevPoints,O=x.totalLength;return P.createElement(Ot,{begin:f,duration:l,isActive:c,easing:d,from:{t:0},to:{t:1},key:"line-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(_){var g=_.t;if(w){var b=w.length/s.length,S=s.map(function(T,C){var $=Math.floor(C*b);if(w[$]){var M=w[$],N=$e(M.x,T.x),q=$e(M.y,T.y);return Xe(Xe({},T),{},{x:N(g),y:q(g)})}if(m){var D=$e(y*2,T.x),F=$e(p/2,T.y);return Xe(Xe({},T),{},{x:D(g),y:F(g)})}return Xe(Xe({},T),{},{x:T.x,y:T.y})});return a.renderCurveStatically(S,n,i)}var A=$e(0,O),j=A(g),k;if(u){var E="".concat(u).split(/[,\s]+/gim).map(function(T){return parseFloat(T)});k=a.getStrokeDasharray(j,O,E)}else k=a.generateSimpleStrokeDasharray(O,j);return a.renderCurveStatically(s,n,i,{strokeDasharray:k})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,s=a.isAnimationActive,u=this.state,c=u.prevPoints,f=u.totalLength;return s&&o&&o.length&&(!c&&f>0||!zr(c,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,s=i.points,u=i.className,c=i.xAxis,f=i.yAxis,l=i.top,d=i.left,h=i.width,m=i.height,y=i.isAnimationActive,p=i.id;if(a||!s||!s.length)return null;var x=this.state.isAnimationFinished,w=s.length===1,O=ee("recharts-line",u),_=c&&c.allowDataOverflow,g=f&&f.allowDataOverflow,b=_||g,S=Q(p)?this.id:p,A=(n=Z(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},j=A.r,k=j===void 0?3:j,E=A.strokeWidth,T=E===void 0?2:E,C=A0(o)?o:{},$=C.clipDot,M=$===void 0?!0:$,N=k*2+T;return P.createElement(ce,{className:O},_||g?P.createElement("defs",null,P.createElement("clipPath",{id:"clipPath-".concat(S)},P.createElement("rect",{x:_?d:d-h/2,y:g?l:l-m/2,width:_?h:h*2,height:g?m:m*2})),!M&&P.createElement("clipPath",{id:"clipPath-dots-".concat(S)},P.createElement("rect",{x:d-N/2,y:l-N/2,width:h+N,height:m+N}))):null,!w&&this.renderCurve(b,S),this.renderErrorBar(b,S),(w||o)&&this.renderDots(b,M,S),(!y||x)&&Mt.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(jr(n),[0]):n,o=[],s=0;s<i;++s)o=[].concat(jr(o),jr(a));return o}},{key:"renderDotItem",value:function(n,i){var a;if(P.isValidElement(n))a=P.cloneElement(n,i);else if(X(n))a=n(i);else{var o=i.key,s=Wb(i,xR),u=ee("recharts-line-dot",typeof n!="boolean"?n.className:"");a=P.createElement(po,$n({key:o},s,{className:u}))}return a}}])})(R.PureComponent);ht(ut,"displayName","Line");ht(ut,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!gr.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});ht(ut,"getComposedData",function(e){var t=e.props,r=e.xAxis,n=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize,u=e.displayedData,c=e.offset,f=t.layout,l=u.map(function(d,h){var m=Be(d,o);return f==="horizontal"?{x:ba({axis:r,ticks:i,bandSize:s,entry:d,index:h}),y:Q(m)?null:n.scale(m),value:m,payload:d}:{x:Q(m)?null:r.scale(m),y:ba({axis:n,ticks:a,bandSize:s,entry:d,index:h}),value:m,payload:d}});return Xe({points:l,layout:f},c)});var $R=["layout","type","stroke","connectNulls","isRange","ref"],IR=["key"],l_;function en(e){"@babel/helpers - typeof";return en=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},en(e)}function f_(e,t){if(e==null)return{};var r=NR(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function NR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ur(){return ur=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ur.apply(this,arguments)}function Kb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Bt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Kb(Object(r),!0).forEach(function(n){bt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function DR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hb(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h_(n.key),n)}}function RR(e,t,r){return t&&Hb(e.prototype,t),r&&Hb(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qR(e,t,r){return t=Fa(t),LR(e,d_()?Reflect.construct(t,r||[],Fa(e).constructor):t.apply(e,r))}function LR(e,t){if(t&&(en(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BR(e)}function BR(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(d_=function(){return!!e})()}function Fa(e){return Fa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Fa(e)}function FR(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ff(e,t)}function Ff(e,t){return Ff=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ff(e,t)}function bt(e,t,r){return t=h_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h_(e){var t=WR(e,"string");return en(t)=="symbol"?t:t+""}function WR(e,t){if(en(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(en(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ke=(function(e){function t(){var r;DR(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=qR(this,t,[].concat(i)),bt(r,"state",{isAnimationFinished:!0}),bt(r,"id",cn("recharts-area-")),bt(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),X(o)&&o()}),bt(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),X(o)&&o()}),r}return FR(t,e),RR(t,[{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,c=u.dot,f=u.points,l=u.dataKey,d=Z(this.props,!1),h=Z(c,!0),m=f.map(function(p,x){var w=Bt(Bt(Bt({key:"dot-".concat(x),r:3},d),h),{},{index:x,cx:p.x,cy:p.y,dataKey:l,value:p.value,payload:p.payload,points:f});return t.renderDotItem(c,w)}),y={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return P.createElement(ce,ur({className:"recharts-area-dots"},y),m)}},{key:"renderHorizontalRect",value:function(n){var i=this.props,a=i.baseLine,o=i.points,s=i.strokeWidth,u=o[0].x,c=o[o.length-1].x,f=n*Math.abs(u-c),l=zt(o.map(function(d){return d.y||0}));return B(a)&&typeof a=="number"?l=Math.max(a,l):a&&Array.isArray(a)&&a.length&&(l=Math.max(zt(a.map(function(d){return d.y||0})),l)),B(l)?P.createElement("rect",{x:u<c?u:u-f,y:0,width:f,height:Math.floor(l+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(n){var i=this.props,a=i.baseLine,o=i.points,s=i.strokeWidth,u=o[0].y,c=o[o.length-1].y,f=n*Math.abs(u-c),l=zt(o.map(function(d){return d.x||0}));return B(a)&&typeof a=="number"?l=Math.max(a,l):a&&Array.isArray(a)&&a.length&&(l=Math.max(zt(a.map(function(d){return d.x||0})),l)),B(l)?P.createElement("rect",{x:0,y:u<c?u:u-f,width:l+(s?parseInt("".concat(s),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(n){var i=this.props.layout;return i==="vertical"?this.renderVerticalRect(n):this.renderHorizontalRect(n)}},{key:"renderAreaStatically",value:function(n,i,a,o){var s=this.props,u=s.layout,c=s.type,f=s.stroke,l=s.connectNulls,d=s.isRange;s.ref;var h=f_(s,$R);return P.createElement(ce,{clipPath:a?"url(#clipPath-".concat(o,")"):null},P.createElement($r,ur({},Z(h,!0),{points:n,connectNulls:l,type:c,baseLine:i,layout:u,stroke:"none",className:"recharts-area-area"})),f!=="none"&&P.createElement($r,ur({},Z(this.props,!1),{className:"recharts-area-curve",layout:u,type:c,connectNulls:l,fill:"none",points:n})),f!=="none"&&d&&P.createElement($r,ur({},Z(this.props,!1),{className:"recharts-area-curve",layout:u,type:c,connectNulls:l,fill:"none",points:i})))}},{key:"renderAreaWithAnimation",value:function(n,i){var a=this,o=this.props,s=o.points,u=o.baseLine,c=o.isAnimationActive,f=o.animationBegin,l=o.animationDuration,d=o.animationEasing,h=o.animationId,m=this.state,y=m.prevPoints,p=m.prevBaseLine;return P.createElement(Ot,{begin:f,duration:l,isActive:c,easing:d,from:{t:0},to:{t:1},key:"area-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(x){var w=x.t;if(y){var O=y.length/s.length,_=s.map(function(A,j){var k=Math.floor(j*O);if(y[k]){var E=y[k],T=$e(E.x,A.x),C=$e(E.y,A.y);return Bt(Bt({},A),{},{x:T(w),y:C(w)})}return A}),g;if(B(u)&&typeof u=="number"){var b=$e(p,u);g=b(w)}else if(Q(u)||un(u)){var S=$e(p,0);g=S(w)}else g=u.map(function(A,j){var k=Math.floor(j*O);if(p[k]){var E=p[k],T=$e(E.x,A.x),C=$e(E.y,A.y);return Bt(Bt({},A),{},{x:T(w),y:C(w)})}return A});return a.renderAreaStatically(_,g,n,i)}return P.createElement(ce,null,P.createElement("defs",null,P.createElement("clipPath",{id:"animationClipPath-".concat(i)},a.renderClipRect(w))),P.createElement(ce,{clipPath:"url(#animationClipPath-".concat(i,")")},a.renderAreaStatically(s,u,n,i)))})}},{key:"renderArea",value:function(n,i){var a=this.props,o=a.points,s=a.baseLine,u=a.isAnimationActive,c=this.state,f=c.prevPoints,l=c.prevBaseLine,d=c.totalLength;return u&&o&&o.length&&(!f&&d>0||!zr(f,o)||!zr(l,s))?this.renderAreaWithAnimation(n,i):this.renderAreaStatically(o,s,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,s=i.points,u=i.className,c=i.top,f=i.left,l=i.xAxis,d=i.yAxis,h=i.width,m=i.height,y=i.isAnimationActive,p=i.id;if(a||!s||!s.length)return null;var x=this.state.isAnimationFinished,w=s.length===1,O=ee("recharts-area",u),_=l&&l.allowDataOverflow,g=d&&d.allowDataOverflow,b=_||g,S=Q(p)?this.id:p,A=(n=Z(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},j=A.r,k=j===void 0?3:j,E=A.strokeWidth,T=E===void 0?2:E,C=A0(o)?o:{},$=C.clipDot,M=$===void 0?!0:$,N=k*2+T;return P.createElement(ce,{className:O},_||g?P.createElement("defs",null,P.createElement("clipPath",{id:"clipPath-".concat(S)},P.createElement("rect",{x:_?f:f-h/2,y:g?c:c-m/2,width:_?h:h*2,height:g?m:m*2})),!M&&P.createElement("clipPath",{id:"clipPath-dots-".concat(S)},P.createElement("rect",{x:f-N/2,y:c-N/2,width:h+N,height:m+N}))):null,w?null:this.renderArea(b,S),(o||w)&&this.renderDots(b,M,S),(!y||x)&&Mt.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,curBaseLine:n.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:n.points!==i.curPoints||n.baseLine!==i.curBaseLine?{curPoints:n.points,curBaseLine:n.baseLine}:null}}])})(R.PureComponent);l_=Ke;bt(Ke,"displayName","Area");bt(Ke,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!gr.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});bt(Ke,"getBaseValue",function(e,t,r,n){var i=e.layout,a=e.baseValue,o=t.props.baseValue,s=o??a;if(B(s)&&typeof s=="number")return s;var u=i==="horizontal"?n:r,c=u.scale.domain();if(u.type==="number"){var f=Math.max(c[0],c[1]),l=Math.min(c[0],c[1]);return s==="dataMin"?l:s==="dataMax"||f<0?f:Math.max(Math.min(c[0],c[1]),0)}return s==="dataMin"?c[0]:s==="dataMax"?c[1]:c[0]});bt(Ke,"getComposedData",function(e){var t=e.props,r=e.item,n=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,u=e.dataKey,c=e.stackedData,f=e.dataStartIndex,l=e.displayedData,d=e.offset,h=t.layout,m=c&&c.length,y=l_.getBaseValue(t,r,n,i),p=h==="horizontal",x=!1,w=l.map(function(_,g){var b;m?b=c[f+g]:(b=Be(_,u),Array.isArray(b)?x=!0:b=[y,b]);var S=b[1]==null||m&&Be(_,u)==null;return p?{x:ba({axis:n,ticks:a,bandSize:s,entry:_,index:g}),y:S?null:i.scale(b[1]),value:b,payload:_}:{x:S?null:n.scale(b[1]),y:ba({axis:i,ticks:o,bandSize:s,entry:_,index:g}),value:b,payload:_}}),O;return m||x?O=w.map(function(_){var g=Array.isArray(_.value)?_.value[0]:null;return p?{x:_.x,y:g!=null&&_.y!=null?i.scale(g):null}:{x:g!=null?n.scale(g):null,y:_.y}}):O=p?i.scale(y):n.scale(y),Bt({points:w,baseLine:O,layout:h,isRange:x},d)});bt(Ke,"renderDotItem",function(e,t){var r;if(P.isValidElement(e))r=P.cloneElement(e,t);else if(X(e))r=e(t);else{var n=ee("recharts-area-dot",typeof e!="boolean"?e.className:""),i=t.key,a=f_(t,IR);r=P.createElement(po,ur({},a,{key:i,className:n}))}return r});function tn(e){"@babel/helpers - typeof";return tn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tn(e)}function zR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function UR(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y_(n.key),n)}}function KR(e,t,r){return t&&UR(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function HR(e,t,r){return t=Wa(t),GR(e,p_()?Reflect.construct(t,r||[],Wa(e).constructor):t.apply(e,r))}function GR(e,t){if(t&&(tn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return VR(e)}function VR(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(p_=function(){return!!e})()}function Wa(e){return Wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Wa(e)}function XR(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Wf(e,t)}function Wf(e,t){return Wf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Wf(e,t)}function v_(e,t,r){return t=y_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y_(e){var t=YR(e,"string");return tn(t)=="symbol"?t:t+""}function YR(e,t){if(tn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(tn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function zf(){return zf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zf.apply(this,arguments)}function ZR(e){var t=e.xAxisId,r=Qd(),n=eh(),i=Yw(t);return i==null?null:R.createElement(pn,zf({},i,{className:ee("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Tt(o,!0)}}))}var Ce=(function(e){function t(){return zR(this,t),HR(this,t,arguments)}return XR(t,e),KR(t,[{key:"render",value:function(){return R.createElement(ZR,this.props)}}])})(R.Component);v_(Ce,"displayName","XAxis");v_(Ce,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function rn(e){"@babel/helpers - typeof";return rn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rn(e)}function JR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QR(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b_(n.key),n)}}function e2(e,t,r){return t&&QR(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function t2(e,t,r){return t=za(t),r2(e,m_()?Reflect.construct(t,r||[],za(e).constructor):t.apply(e,r))}function r2(e,t){if(t&&(rn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return n2(e)}function n2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(m_=function(){return!!e})()}function za(e){return za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},za(e)}function i2(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Uf(e,t)}function Uf(e,t){return Uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Uf(e,t)}function g_(e,t,r){return t=b_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b_(e){var t=a2(e,"string");return rn(t)=="symbol"?t:t+""}function a2(e,t){if(rn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(rn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Kf(){return Kf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kf.apply(this,arguments)}var o2=function(t){var r=t.yAxisId,n=Qd(),i=eh(),a=Zw(r);return a==null?null:R.createElement(pn,Kf({},a,{className:ee("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:i},ticksGenerator:function(s){return Tt(s,!0)}}))},ve=(function(e){function t(){return JR(this,t),t2(this,t,arguments)}return i2(t,e),e2(t,[{key:"render",value:function(){return R.createElement(o2,this.props)}}])})(R.Component);g_(ve,"displayName","YAxis");g_(ve,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function Gb(e){return l2(e)||c2(e)||u2(e)||s2()}function s2(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
67
67
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u2(e,t){if(e){if(typeof e=="string")return Hf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Hf(e,t)}}function c2(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function l2(e){if(Array.isArray(e))return Hf(e)}function Hf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Gf=function(t,r,n,i,a){var o=ot(t,rh),s=ot(t,bo),u=[].concat(Gb(o),Gb(s)),c=ot(t,wo),f="".concat(i,"Id"),l=i[0],d=r;if(u.length&&(d=u.reduce(function(y,p){if(p.props[f]===n&&wt(p.props,"extendDomain")&&B(p.props[l])){var x=p.props[l];return[Math.min(y[0],x),Math.max(y[1],x)]}return y},d)),c.length){var h="".concat(l,"1"),m="".concat(l,"2");d=c.reduce(function(y,p){if(p.props[f]===n&&wt(p.props,"extendDomain")&&B(p.props[h])&&B(p.props[m])){var x=p.props[h],w=p.props[m];return[Math.min(y[0],x,w),Math.max(y[1],x,w)]}return y},d)}return a&&a.length&&(d=a.reduce(function(y,p){return B(p)?[Math.min(y[0],p),Math.max(y[1],p)]:y},d)),d},Al={exports:{}},Vb;function f2(){return Vb||(Vb=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,c,f){this.fn=u,this.context=c,this.once=f||!1}function a(u,c,f,l,d){if(typeof f!="function")throw new TypeError("The listener must be a function");var h=new i(f,l||u,d),m=r?r+c:c;return u._events[m]?u._events[m].fn?u._events[m]=[u._events[m],h]:u._events[m].push(h):(u._events[m]=h,u._eventsCount++),u}function o(u,c){--u._eventsCount===0?u._events=new n:delete u._events[c]}function s(){this._events=new n,this._eventsCount=0}s.prototype.eventNames=function(){var c=[],f,l;if(this._eventsCount===0)return c;for(l in f=this._events)t.call(f,l)&&c.push(r?l.slice(1):l);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(f)):c},s.prototype.listeners=function(c){var f=r?r+c:c,l=this._events[f];if(!l)return[];if(l.fn)return[l.fn];for(var d=0,h=l.length,m=new Array(h);d<h;d++)m[d]=l[d].fn;return m},s.prototype.listenerCount=function(c){var f=r?r+c:c,l=this._events[f];return l?l.fn?1:l.length:0},s.prototype.emit=function(c,f,l,d,h,m){var y=r?r+c:c;if(!this._events[y])return!1;var p=this._events[y],x=arguments.length,w,O;if(p.fn){switch(p.once&&this.removeListener(c,p.fn,void 0,!0),x){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,f),!0;case 3:return p.fn.call(p.context,f,l),!0;case 4:return p.fn.call(p.context,f,l,d),!0;case 5:return p.fn.call(p.context,f,l,d,h),!0;case 6:return p.fn.call(p.context,f,l,d,h,m),!0}for(O=1,w=new Array(x-1);O<x;O++)w[O-1]=arguments[O];p.fn.apply(p.context,w)}else{var _=p.length,g;for(O=0;O<_;O++)switch(p[O].once&&this.removeListener(c,p[O].fn,void 0,!0),x){case 1:p[O].fn.call(p[O].context);break;case 2:p[O].fn.call(p[O].context,f);break;case 3:p[O].fn.call(p[O].context,f,l);break;case 4:p[O].fn.call(p[O].context,f,l,d);break;default:if(!w)for(g=1,w=new Array(x-1);g<x;g++)w[g-1]=arguments[g];p[O].fn.apply(p[O].context,w)}}return!0},s.prototype.on=function(c,f,l){return a(this,c,f,l,!1)},s.prototype.once=function(c,f,l){return a(this,c,f,l,!0)},s.prototype.removeListener=function(c,f,l,d){var h=r?r+c:c;if(!this._events[h])return this;if(!f)return o(this,h),this;var m=this._events[h];if(m.fn)m.fn===f&&(!d||m.once)&&(!l||m.context===l)&&o(this,h);else{for(var y=0,p=[],x=m.length;y<x;y++)(m[y].fn!==f||d&&!m[y].once||l&&m[y].context!==l)&&p.push(m[y]);p.length?this._events[h]=p.length===1?p[0]:p:o(this,h)}return this},s.prototype.removeAllListeners=function(c){var f;return c?(f=r?r+c:c,this._events[f]&&o(this,f)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s})(Al)),Al.exports}var d2=f2();const h2=le(d2);var jl=new h2,Pl="recharts.syncMouseEvents";function vi(e){"@babel/helpers - typeof";return vi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vi(e)}function p2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,x_(n.key),n)}}function y2(e,t,r){return t&&v2(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tl(e,t,r){return t=x_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x_(e){var t=m2(e,"string");return vi(t)=="symbol"?t:t+""}function m2(e,t){if(vi(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(vi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var g2=(function(){function e(){p2(this,e),Tl(this,"activeIndex",0),Tl(this,"coordinateList",[]),Tl(this,"layout","horizontal")}return y2(e,[{key:"setDetails",value:function(r){var n,i=r.coordinateList,a=i===void 0?null:i,o=r.container,s=o===void 0?null:o,u=r.layout,c=u===void 0?null:u,f=r.offset,l=f===void 0?null:f,d=r.mouseHandlerCallback,h=d===void 0?null:d;this.coordinateList=(n=a??this.coordinateList)!==null&&n!==void 0?n:[],this.container=s??this.container,this.layout=c??this.layout,this.offset=l??this.offset,this.mouseHandlerCallback=h??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),a=i.x,o=i.y,s=i.height,u=this.coordinateList[this.activeIndex].coordinate,c=((r=window)===null||r===void 0?void 0:r.scrollX)||0,f=((n=window)===null||n===void 0?void 0:n.scrollY)||0,l=a+u+c,d=o+this.offset.top+s/2+f;this.mouseHandlerCallback({pageX:l,pageY:d})}}}])})();function b2(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var n=e==null?void 0:e[0],i=e==null?void 0:e[1];if(n&&i&&B(n)&&B(i))return!0}return!1}function x2(e,t,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-i,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function w_(e){var t=e.cx,r=e.cy,n=e.radius,i=e.startAngle,a=e.endAngle,o=Ie(t,r,n,i),s=Ie(t,r,n,a);return{points:[o,s],cx:t,cy:r,radius:n,startAngle:i,endAngle:a}}function w2(e,t,r){var n,i,a,o;if(e==="horizontal")n=t.x,a=n,i=r.top,o=r.top+r.height;else if(e==="vertical")i=t.y,o=i,n=r.left,a=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var s=t.cx,u=t.cy,c=t.innerRadius,f=t.outerRadius,l=t.angle,d=Ie(s,u,c,l),h=Ie(s,u,f,l);n=d.x,i=d.y,a=h.x,o=h.y}else return w_(t);return[{x:n,y:i},{x:a,y:o}]}function yi(e){"@babel/helpers - typeof";return yi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yi(e)}function Xb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Fi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xb(Object(r),!0).forEach(function(n){_2(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _2(e,t,r){return t=O2(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O2(e){var t=S2(e,"string");return yi(t)=="symbol"?t:t+""}function S2(e,t){if(yi(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(yi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function A2(e){var t,r,n=e.element,i=e.tooltipEventType,a=e.isActive,o=e.activeCoordinate,s=e.activePayload,u=e.offset,c=e.activeTooltipIndex,f=e.tooltipAxisBandSize,l=e.layout,d=e.chartName,h=(t=n.props.cursor)!==null&&t!==void 0?t:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!h||!a||!o||d!=="ScatterChart"&&i!=="axis")return null;var m,y=$r;if(d==="ScatterChart")m=o,y=hI;else if(d==="BarChart")m=x2(l,o,u,f),y=Vd;else if(l==="radial"){var p=w_(o),x=p.cx,w=p.cy,O=p.radius,_=p.startAngle,g=p.endAngle;m={cx:x,cy:w,startAngle:_,endAngle:g,innerRadius:O,outerRadius:O},y=jw}else m={points:w2(l,o,u)},y=$r;var b=Fi(Fi(Fi(Fi({stroke:"#ccc",pointerEvents:"none"},u),m),Z(h,!1)),{},{payload:s,payloadIndex:c,className:ee("recharts-tooltip-cursor",h.className)});return R.isValidElement(h)?R.cloneElement(h,b):R.createElement(y,b)}var j2=["item"],P2=["children","className","width","height","style","compact","title","desc"];function nn(e){"@babel/helpers - typeof";return nn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nn(e)}function Er(){return Er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Er.apply(this,arguments)}function Yb(e,t){return k2(e)||E2(e,t)||O_(e,t)||T2()}function T2(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
68
68
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E2(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(f){c=!0,i=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}function k2(e){if(Array.isArray(e))return e}function Zb(e,t){if(e==null)return{};var r=C2(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function C2(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function M2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,S_(n.key),n)}}function I2(e,t,r){return t&&$2(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function N2(e,t,r){return t=Ua(t),D2(e,__()?Reflect.construct(t,r||[],Ua(e).constructor):t.apply(e,r))}function D2(e,t){if(t&&(nn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return R2(e)}function R2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function __(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(__=function(){return!!e})()}function Ua(e){return Ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ua(e)}function q2(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vf(e,t)}function Vf(e,t){return Vf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Vf(e,t)}function an(e){return F2(e)||B2(e)||O_(e)||L2()}function L2(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
69
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O_(e,t){if(e){if(typeof e=="string")return Xf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xf(e,t)}}function B2(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function F2(e){if(Array.isArray(e))return Xf(e)}function Xf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Jb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function I(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jb(Object(r),!0).forEach(function(n){H(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function H(e,t,r){return t=S_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S_(e){var t=W2(e,"string");return nn(t)=="symbol"?t:t+""}function W2(e,t){if(nn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(nn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var z2={xAxis:["bottom","top"],yAxis:["left","right"]},U2={width:"100%",height:"100%"},A_={x:0,y:0};function Wi(e){return e}var K2=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},H2=function(t,r,n,i){var a=r.find(function(f){return f&&f.index===n});if(a){if(t==="horizontal")return{x:a.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:a.coordinate};if(t==="centric"){var o=a.coordinate,s=i.radius;return I(I(I({},i),Ie(i.cx,i.cy,s,o)),{},{angle:o,radius:s})}var u=a.coordinate,c=i.angle;return I(I(I({},i),Ie(i.cx,i.cy,u,c)),{},{angle:c,radius:u})}return A_},_o=function(t,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(s,u){var c=u.props.data;return c&&c.length?[].concat(an(s),an(c)):s},[]);return o.length>0?o:t&&t.length&&B(i)&&B(a)?t.slice(i,a+1):[]};function j_(e){return e==="number"?[0,"auto"]:void 0}var Yf=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,s=_o(r,t);return n<0||!a||!a.length||n>=s.length?null:a.reduce(function(u,c){var f,l=(f=c.props.data)!==null&&f!==void 0?f:r;l&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(l=l.slice(t.dataStartIndex,t.dataEndIndex+1));var d;if(o.dataKey&&!o.allowDuplicatedCategory){var h=l===void 0?s:l;d=Ki(h,o.dataKey,i)}else d=l&&l[n]||s[n];return d?[].concat(an(u),[Ow(c,d)]):u},[])},Qb=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=K2(a,n),s=t.orderedTooltipTicks,u=t.tooltipAxis,c=t.tooltipTicks,f=Hk(o,s,c,u);if(f>=0&&c){var l=c[f]&&c[f].value,d=Yf(t,r,f,l),h=H2(n,s,f,a);return{activeTooltipIndex:f,activeLabel:l,activePayload:d,activeCoordinate:h}}return null},G2=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,s=r.stackGroups,u=r.dataStartIndex,c=r.dataEndIndex,f=t.layout,l=t.children,d=t.stackOffset,h=xw(f,a);return n.reduce(function(m,y){var p,x=y.type.defaultProps!==void 0?I(I({},y.type.defaultProps),y.props):y.props,w=x.type,O=x.dataKey,_=x.allowDataOverflow,g=x.allowDuplicatedCategory,b=x.scale,S=x.ticks,A=x.includeHidden,j=x[o];if(m[j])return m;var k=_o(t.data,{graphicalItems:i.filter(function(z){var V,fe=o in z.props?z.props[o]:(V=z.type.defaultProps)===null||V===void 0?void 0:V[o];return fe===j}),dataStartIndex:u,dataEndIndex:c}),E=k.length,T,C,$;b2(x.domain,_,w)&&(T=hf(x.domain,null,_),h&&(w==="number"||b!=="auto")&&($=Cn(k,O,"category")));var M=j_(w);if(!T||T.length===0){var N,q=(N=x.domain)!==null&&N!==void 0?N:M;if(O){if(T=Cn(k,O,w),w==="category"&&h){var D=qO(T);g&&D?(C=T,T=ka(0,E)):g||(T=fg(q,T,y).reduce(function(z,V){return z.indexOf(V)>=0?z:[].concat(an(z),[V])},[]))}else if(w==="category")g?T=T.filter(function(z){return z!==""&&!Q(z)}):T=fg(q,T,y).reduce(function(z,V){return z.indexOf(V)>=0||V===""||Q(V)?z:[].concat(an(z),[V])},[]);else if(w==="number"){var F=Zk(k,i.filter(function(z){var V,fe,be=o in z.props?z.props[o]:(V=z.type.defaultProps)===null||V===void 0?void 0:V[o],Ve="hide"in z.props?z.props.hide:(fe=z.type.defaultProps)===null||fe===void 0?void 0:fe.hide;return be===j&&(A||!Ve)}),O,a,f);F&&(T=F)}h&&(w==="number"||b!=="auto")&&($=Cn(k,O,"category"))}else h?T=ka(0,E):s&&s[j]&&s[j].hasStack&&w==="number"?T=d==="expand"?[0,1]:_w(s[j].stackGroups,u,c):T=bw(k,i.filter(function(z){var V=o in z.props?z.props[o]:z.type.defaultProps[o],fe="hide"in z.props?z.props.hide:z.type.defaultProps.hide;return V===j&&(A||!fe)}),w,f,!0);if(w==="number")T=Gf(l,T,j,a,S),q&&(T=hf(q,T,_));else if(w==="category"&&q){var K=q,G=T.every(function(z){return K.indexOf(z)>=0});G&&(T=K)}}return I(I({},m),{},H({},j,I(I({},x),{},{axisType:a,domain:T,categoricalDomain:$,duplicateDomain:C,originalDomain:(p=x.domain)!==null&&p!==void 0?p:M,isCategorical:h,layout:f})))},{})},V2=function(t,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,s=r.stackGroups,u=r.dataStartIndex,c=r.dataEndIndex,f=t.layout,l=t.children,d=_o(t.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:c}),h=d.length,m=xw(f,a),y=-1;return n.reduce(function(p,x){var w=x.type.defaultProps!==void 0?I(I({},x.type.defaultProps),x.props):x.props,O=w[o],_=j_("number");if(!p[O]){y++;var g;return m?g=ka(0,h):s&&s[O]&&s[O].hasStack?(g=_w(s[O].stackGroups,u,c),g=Gf(l,g,O,a)):(g=hf(_,bw(d,n.filter(function(b){var S,A,j=o in b.props?b.props[o]:(S=b.type.defaultProps)===null||S===void 0?void 0:S[o],k="hide"in b.props?b.props.hide:(A=b.type.defaultProps)===null||A===void 0?void 0:A.hide;return j===O&&!k}),"number",f),i.defaultProps.allowDataOverflow),g=Gf(l,g,O,a)),I(I({},p),{},H({},O,I(I({axisType:a},i.defaultProps),{},{hide:!0,orientation:at(z2,"".concat(a,".").concat(y%2),null),domain:g,originalDomain:_,isCategorical:m,layout:f})))}return p},{})},X2=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,s=r.stackGroups,u=r.dataStartIndex,c=r.dataEndIndex,f=t.children,l="".concat(i,"Id"),d=ot(f,a),h={};return d&&d.length?h=G2(t,{axes:d,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:s,dataStartIndex:u,dataEndIndex:c}):o&&o.length&&(h=V2(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:s,dataStartIndex:u,dataEndIndex:c})),h},Y2=function(t){var r=Wt(t),n=Tt(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:wd(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:xa(r,n)}},e0=function(t){var r=t.children,n=t.defaultShowTooltip,i=Ze(r,Gr),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},Z2=function(t){return!t||!t.length?!1:t.some(function(r){var n=Et(r&&r.type);return n&&n.indexOf("Bar")>=0})},t0=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},J2=function(t,r){var n=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,s=t.yAxisMap,u=s===void 0?{}:s,c=n.width,f=n.height,l=n.children,d=n.margin||{},h=Ze(l,Gr),m=Ze(l,Le),y=Object.keys(u).reduce(function(g,b){var S=u[b],A=S.orientation;return!S.mirror&&!S.hide?I(I({},g),{},H({},A,g[A]+S.width)):g},{left:d.left||0,right:d.right||0}),p=Object.keys(o).reduce(function(g,b){var S=o[b],A=S.orientation;return!S.mirror&&!S.hide?I(I({},g),{},H({},A,at(g,"".concat(A))+S.height)):g},{top:d.top||0,bottom:d.bottom||0}),x=I(I({},p),y),w=x.bottom;h&&(x.bottom+=h.props.height||Gr.defaultProps.height),m&&r&&(x=Xk(x,i,n,r));var O=c-x.left-x.right,_=f-x.top-x.bottom;return I(I({brushBottom:w},x),{},{width:Math.max(O,0),height:Math.max(_,0)})},Q2=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},ah=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,s=o===void 0?["axis"]:o,u=t.axisComponents,c=t.legendContent,f=t.formatAxisMap,l=t.defaultProps,d=function(x,w){var O=w.graphicalItems,_=w.stackGroups,g=w.offset,b=w.updateId,S=w.dataStartIndex,A=w.dataEndIndex,j=x.barSize,k=x.layout,E=x.barGap,T=x.barCategoryGap,C=x.maxBarSize,$=t0(k),M=$.numericAxisName,N=$.cateAxisName,q=Z2(O),D=[];return O.forEach(function(F,K){var G=_o(x.data,{graphicalItems:[F],dataStartIndex:S,dataEndIndex:A}),z=F.type.defaultProps!==void 0?I(I({},F.type.defaultProps),F.props):F.props,V=z.dataKey,fe=z.maxBarSize,be=z["".concat(M,"Id")],Ve=z["".concat(N,"Id")],Jt={},We=u.reduce(function(Qt,er){var Oo=w["".concat(er.axisType,"Map")],uh=z["".concat(er.axisType,"Id")];Oo&&Oo[uh]||er.axisType==="zAxis"||vr();var ch=Oo[uh];return I(I({},Qt),{},H(H({},er.axisType,ch),"".concat(er.axisType,"Ticks"),Tt(ch)))},Jt),W=We[N],Y=We["".concat(N,"Ticks")],J=_&&_[be]&&_[be].hasStack&&cC(F,_[be].stackGroups),L=Et(F.type).indexOf("Bar")>=0,ye=xa(W,Y),te=[],_e=q&&Gk({barSize:j,stackGroups:_,totalSize:Q2(We,N)});if(L){var Oe,ze,Lt=Q(fe)?C:fe,_r=(Oe=(ze=xa(W,Y,!0))!==null&&ze!==void 0?ze:Lt)!==null&&Oe!==void 0?Oe:0;te=Vk({barGap:E,barCategoryGap:T,bandSize:_r!==ye?_r:ye,sizeList:_e[Ve],maxBarSize:Lt}),_r!==ye&&(te=te.map(function(Qt){return I(I({},Qt),{},{position:I(I({},Qt.position),{},{offset:Qt.position.offset-_r/2})})}))}var Pi=F&&F.type&&F.type.getComposedData;Pi&&D.push({props:I(I({},Pi(I(I({},We),{},{displayedData:G,props:x,dataKey:V,item:F,bandSize:ye,barPosition:te,offset:g,stackedData:J,layout:k,dataStartIndex:S,dataEndIndex:A}))),{},H(H(H({key:F.key||"item-".concat(K)},M,We[M]),N,We[N]),"animationId",b)),childIndex:YO(F,x.children),item:F})}),D},h=function(x,w){var O=x.props,_=x.dataStartIndex,g=x.dataEndIndex,b=x.updateId;if(!jp({props:O}))return null;var S=O.children,A=O.layout,j=O.stackOffset,k=O.data,E=O.reverseStackOrder,T=t0(A),C=T.numericAxisName,$=T.cateAxisName,M=ot(S,n),N=oC(k,M,"".concat(C,"Id"),"".concat($,"Id"),j,E),q=u.reduce(function(z,V){var fe="".concat(V.axisType,"Map");return I(I({},z),{},H({},fe,X2(O,I(I({},V),{},{graphicalItems:M,stackGroups:V.axisType===C&&N,dataStartIndex:_,dataEndIndex:g}))))},{}),D=J2(I(I({},q),{},{props:O,graphicalItems:M}),w==null?void 0:w.legendBBox);Object.keys(q).forEach(function(z){q[z]=f(O,q[z],D,z.replace("Map",""),r)});var F=q["".concat($,"Map")],K=Y2(F),G=d(O,I(I({},q),{},{dataStartIndex:_,dataEndIndex:g,updateId:b,graphicalItems:M,stackGroups:N,offset:D}));return I(I({formattedGraphicalItems:G,graphicalItems:M,offset:D,stackGroups:N},K),q)},m=(function(p){function x(w){var O,_,g;return M2(this,x),g=N2(this,x,[w]),H(g,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),H(g,"accessibilityManager",new g2),H(g,"handleLegendBBoxUpdate",function(b){if(b){var S=g.state,A=S.dataStartIndex,j=S.dataEndIndex,k=S.updateId;g.setState(I({legendBBox:b},h({props:g.props,dataStartIndex:A,dataEndIndex:j,updateId:k},I(I({},g.state),{},{legendBBox:b}))))}}),H(g,"handleReceiveSyncEvent",function(b,S,A){if(g.props.syncId===b){if(A===g.eventEmitterSymbol&&typeof g.props.syncMethod!="function")return;g.applySyncEvent(S)}}),H(g,"handleBrushChange",function(b){var S=b.startIndex,A=b.endIndex;if(S!==g.state.dataStartIndex||A!==g.state.dataEndIndex){var j=g.state.updateId;g.setState(function(){return I({dataStartIndex:S,dataEndIndex:A},h({props:g.props,dataStartIndex:S,dataEndIndex:A,updateId:j},g.state))}),g.triggerSyncEvent({dataStartIndex:S,dataEndIndex:A})}}),H(g,"handleMouseEnter",function(b){var S=g.getMouseInfo(b);if(S){var A=I(I({},S),{},{isTooltipActive:!0});g.setState(A),g.triggerSyncEvent(A);var j=g.props.onMouseEnter;X(j)&&j(A,b)}}),H(g,"triggeredAfterMouseMove",function(b){var S=g.getMouseInfo(b),A=S?I(I({},S),{},{isTooltipActive:!0}):{isTooltipActive:!1};g.setState(A),g.triggerSyncEvent(A);var j=g.props.onMouseMove;X(j)&&j(A,b)}),H(g,"handleItemMouseEnter",function(b){g.setState(function(){return{isTooltipActive:!0,activeItem:b,activePayload:b.tooltipPayload,activeCoordinate:b.tooltipPosition||{x:b.cx,y:b.cy}}})}),H(g,"handleItemMouseLeave",function(){g.setState(function(){return{isTooltipActive:!1}})}),H(g,"handleMouseMove",function(b){b.persist(),g.throttleTriggeredAfterMouseMove(b)}),H(g,"handleMouseLeave",function(b){g.throttleTriggeredAfterMouseMove.cancel();var S={isTooltipActive:!1};g.setState(S),g.triggerSyncEvent(S);var A=g.props.onMouseLeave;X(A)&&A(S,b)}),H(g,"handleOuterEvent",function(b){var S=XO(b),A=at(g.props,"".concat(S));if(S&&X(A)){var j,k;/.*touch.*/i.test(S)?k=g.getMouseInfo(b.changedTouches[0]):k=g.getMouseInfo(b),A((j=k)!==null&&j!==void 0?j:{},b)}}),H(g,"handleClick",function(b){var S=g.getMouseInfo(b);if(S){var A=I(I({},S),{},{isTooltipActive:!0});g.setState(A),g.triggerSyncEvent(A);var j=g.props.onClick;X(j)&&j(A,b)}}),H(g,"handleMouseDown",function(b){var S=g.props.onMouseDown;if(X(S)){var A=g.getMouseInfo(b);S(A,b)}}),H(g,"handleMouseUp",function(b){var S=g.props.onMouseUp;if(X(S)){var A=g.getMouseInfo(b);S(A,b)}}),H(g,"handleTouchMove",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.throttleTriggeredAfterMouseMove(b.changedTouches[0])}),H(g,"handleTouchStart",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.handleMouseDown(b.changedTouches[0])}),H(g,"handleTouchEnd",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.handleMouseUp(b.changedTouches[0])}),H(g,"handleDoubleClick",function(b){var S=g.props.onDoubleClick;if(X(S)){var A=g.getMouseInfo(b);S(A,b)}}),H(g,"handleContextMenu",function(b){var S=g.props.onContextMenu;if(X(S)){var A=g.getMouseInfo(b);S(A,b)}}),H(g,"triggerSyncEvent",function(b){g.props.syncId!==void 0&&jl.emit(Pl,g.props.syncId,b,g.eventEmitterSymbol)}),H(g,"applySyncEvent",function(b){var S=g.props,A=S.layout,j=S.syncMethod,k=g.state.updateId,E=b.dataStartIndex,T=b.dataEndIndex;if(b.dataStartIndex!==void 0||b.dataEndIndex!==void 0)g.setState(I({dataStartIndex:E,dataEndIndex:T},h({props:g.props,dataStartIndex:E,dataEndIndex:T,updateId:k},g.state)));else if(b.activeTooltipIndex!==void 0){var C=b.chartX,$=b.chartY,M=b.activeTooltipIndex,N=g.state,q=N.offset,D=N.tooltipTicks;if(!q)return;if(typeof j=="function")M=j(D,b);else if(j==="value"){M=-1;for(var F=0;F<D.length;F++)if(D[F].value===b.activeLabel){M=F;break}}var K=I(I({},q),{},{x:q.left,y:q.top}),G=Math.min(C,K.x+K.width),z=Math.min($,K.y+K.height),V=D[M]&&D[M].value,fe=Yf(g.state,g.props.data,M),be=D[M]?{x:A==="horizontal"?D[M].coordinate:G,y:A==="horizontal"?z:D[M].coordinate}:A_;g.setState(I(I({},b),{},{activeLabel:V,activeCoordinate:be,activePayload:fe,activeTooltipIndex:M}))}else g.setState(b)}),H(g,"renderCursor",function(b){var S,A=g.state,j=A.isTooltipActive,k=A.activeCoordinate,E=A.activePayload,T=A.offset,C=A.activeTooltipIndex,$=A.tooltipAxisBandSize,M=g.getTooltipEventType(),N=(S=b.props.active)!==null&&S!==void 0?S:j,q=g.props.layout,D=b.key||"_recharts-cursor";return P.createElement(A2,{key:D,activeCoordinate:k,activePayload:E,activeTooltipIndex:C,chartName:r,element:b,isActive:N,layout:q,offset:T,tooltipAxisBandSize:$,tooltipEventType:M})}),H(g,"renderPolarAxis",function(b,S,A){var j=at(b,"type.axisType"),k=at(g.state,"".concat(j,"Map")),E=b.type.defaultProps,T=E!==void 0?I(I({},E),b.props):b.props,C=k&&k[T["".concat(j,"Id")]];return R.cloneElement(b,I(I({},C),{},{className:ee(j,C.className),key:b.key||"".concat(S,"-").concat(A),ticks:Tt(C,!0)}))}),H(g,"renderPolarGrid",function(b){var S=b.props,A=S.radialLines,j=S.polarAngles,k=S.polarRadius,E=g.state,T=E.radiusAxisMap,C=E.angleAxisMap,$=Wt(T),M=Wt(C),N=M.cx,q=M.cy,D=M.innerRadius,F=M.outerRadius;return R.cloneElement(b,{polarAngles:Array.isArray(j)?j:Tt(M,!0).map(function(K){return K.coordinate}),polarRadius:Array.isArray(k)?k:Tt($,!0).map(function(K){return K.coordinate}),cx:N,cy:q,innerRadius:D,outerRadius:F,key:b.key||"polar-grid",radialLines:A})}),H(g,"renderLegend",function(){var b=g.state.formattedGraphicalItems,S=g.props,A=S.children,j=S.width,k=S.height,E=g.props.margin||{},T=j-(E.left||0)-(E.right||0),C=mw({children:A,formattedGraphicalItems:b,legendWidth:T,legendContent:c});if(!C)return null;var $=C.item,M=Zb(C,j2);return R.cloneElement($,I(I({},M),{},{chartWidth:j,chartHeight:k,margin:E,onBBoxUpdate:g.handleLegendBBoxUpdate}))}),H(g,"renderTooltip",function(){var b,S=g.props,A=S.children,j=S.accessibilityLayer,k=Ze(A,oe);if(!k)return null;var E=g.state,T=E.isTooltipActive,C=E.activeCoordinate,$=E.activePayload,M=E.activeLabel,N=E.offset,q=(b=k.props.active)!==null&&b!==void 0?b:T;return R.cloneElement(k,{viewBox:I(I({},N),{},{x:N.left,y:N.top}),active:q,label:M,payload:q?$:[],coordinate:C,accessibilityLayer:j})}),H(g,"renderBrush",function(b){var S=g.props,A=S.margin,j=S.data,k=g.state,E=k.offset,T=k.dataStartIndex,C=k.dataEndIndex,$=k.updateId;return R.cloneElement(b,{key:b.key||"_recharts-brush",onChange:Ri(g.handleBrushChange,b.props.onChange),data:j,x:B(b.props.x)?b.props.x:E.left,y:B(b.props.y)?b.props.y:E.top+E.height+E.brushBottom-(A.bottom||0),width:B(b.props.width)?b.props.width:E.width,startIndex:T,endIndex:C,updateId:"brush-".concat($)})}),H(g,"renderReferenceElement",function(b,S,A){if(!b)return null;var j=g,k=j.clipPathId,E=g.state,T=E.xAxisMap,C=E.yAxisMap,$=E.offset,M=b.type.defaultProps||{},N=b.props,q=N.xAxisId,D=q===void 0?M.xAxisId:q,F=N.yAxisId,K=F===void 0?M.yAxisId:F;return R.cloneElement(b,{key:b.key||"".concat(S,"-").concat(A),xAxis:T[D],yAxis:C[K],viewBox:{x:$.left,y:$.top,width:$.width,height:$.height},clipPathId:k})}),H(g,"renderActivePoints",function(b){var S=b.item,A=b.activePoint,j=b.basePoint,k=b.childIndex,E=b.isRange,T=[],C=S.props.key,$=S.item.type.defaultProps!==void 0?I(I({},S.item.type.defaultProps),S.item.props):S.item.props,M=$.activeDot,N=$.dataKey,q=I(I({index:k,dataKey:N,cx:A.x,cy:A.y,r:4,fill:Gd(S.item),strokeWidth:2,stroke:"#fff",payload:A.payload,value:A.value},Z(M,!1)),Hi(M));return T.push(x.renderActiveDot(M,q,"".concat(C,"-activePoint-").concat(k))),j?T.push(x.renderActiveDot(M,I(I({},q),{},{cx:j.x,cy:j.y}),"".concat(C,"-basePoint-").concat(k))):E&&T.push(null),T}),H(g,"renderGraphicChild",function(b,S,A){var j=g.filterFormatItem(b,S,A);if(!j)return null;var k=g.getTooltipEventType(),E=g.state,T=E.isTooltipActive,C=E.tooltipAxis,$=E.activeTooltipIndex,M=E.activeLabel,N=g.props.children,q=Ze(N,oe),D=j.props,F=D.points,K=D.isRange,G=D.baseLine,z=j.item.type.defaultProps!==void 0?I(I({},j.item.type.defaultProps),j.item.props):j.item.props,V=z.activeDot,fe=z.hide,be=z.activeBar,Ve=z.activeShape,Jt=!!(!fe&&T&&q&&(V||be||Ve)),We={};k!=="axis"&&q&&q.props.trigger==="click"?We={onClick:Ri(g.handleItemMouseEnter,b.props.onClick)}:k!=="axis"&&(We={onMouseLeave:Ri(g.handleItemMouseLeave,b.props.onMouseLeave),onMouseEnter:Ri(g.handleItemMouseEnter,b.props.onMouseEnter)});var W=R.cloneElement(b,I(I({},j.props),We));function Y(er){return typeof C.dataKey=="function"?C.dataKey(er.payload):null}if(Jt)if($>=0){var J,L;if(C.dataKey&&!C.allowDuplicatedCategory){var ye=typeof C.dataKey=="function"?Y:"payload.".concat(C.dataKey.toString());J=Ki(F,ye,M),L=K&&G&&Ki(G,ye,M)}else J=F==null?void 0:F[$],L=K&&G&&G[$];if(Ve||be){var te=b.props.activeIndex!==void 0?b.props.activeIndex:$;return[R.cloneElement(b,I(I(I({},j.props),We),{},{activeIndex:te})),null,null]}if(!Q(J))return[W].concat(an(g.renderActivePoints({item:j,activePoint:J,basePoint:L,childIndex:$,isRange:K})))}else{var _e,Oe=(_e=g.getItemByXY(g.state.activeCoordinate))!==null&&_e!==void 0?_e:{graphicalItem:W},ze=Oe.graphicalItem,Lt=ze.item,_r=Lt===void 0?b:Lt,Pi=ze.childIndex,Qt=I(I(I({},j.props),We),{},{activeIndex:Pi});return[R.cloneElement(_r,Qt),null,null]}return K?[W,null,null]:[W,null]}),H(g,"renderCustomized",function(b,S,A){return R.cloneElement(b,I(I({key:"recharts-customized-".concat(A)},g.props),g.state))}),H(g,"renderMap",{CartesianGrid:{handler:Wi,once:!0},ReferenceArea:{handler:g.renderReferenceElement},ReferenceLine:{handler:Wi},ReferenceDot:{handler:g.renderReferenceElement},XAxis:{handler:Wi},YAxis:{handler:Wi},Brush:{handler:g.renderBrush,once:!0},Bar:{handler:g.renderGraphicChild},Line:{handler:g.renderGraphicChild},Area:{handler:g.renderGraphicChild},Radar:{handler:g.renderGraphicChild},RadialBar:{handler:g.renderGraphicChild},Scatter:{handler:g.renderGraphicChild},Pie:{handler:g.renderGraphicChild},Funnel:{handler:g.renderGraphicChild},Tooltip:{handler:g.renderCursor,once:!0},PolarGrid:{handler:g.renderPolarGrid,once:!0},PolarAngleAxis:{handler:g.renderPolarAxis},PolarRadiusAxis:{handler:g.renderPolarAxis},Customized:{handler:g.renderCustomized}}),g.clipPathId="".concat((O=w.id)!==null&&O!==void 0?O:cn("recharts"),"-clip"),g.throttleTriggeredAfterMouseMove=gx(g.triggeredAfterMouseMove,(_=w.throttleDelay)!==null&&_!==void 0?_:1e3/60),g.state={},g}return q2(x,p),I2(x,[{key:"componentDidMount",value:function(){var O,_;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O:0,top:(_=this.props.margin.top)!==null&&_!==void 0?_:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var O=this.props,_=O.children,g=O.data,b=O.height,S=O.layout,A=Ze(_,oe);if(A){var j=A.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var k=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,E=Yf(this.state,g,j,k),T=this.state.tooltipTicks[j].coordinate,C=(this.state.offset.top+b)/2,$=S==="horizontal",M=$?{x:T,y:C}:{y:T,x:C},N=this.state.formattedGraphicalItems.find(function(D){var F=D.item;return F.type.name==="Scatter"});N&&(M=I(I({},M),N.props.points[j].tooltipPosition),E=N.props.points[j].tooltipPayload);var q={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:k,activePayload:E,activeCoordinate:M};this.setState(q),this.renderCursor(A),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(O,_){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==_.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==O.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==O.margin){var g,b;this.accessibilityManager.setDetails({offset:{left:(g=this.props.margin.left)!==null&&g!==void 0?g:0,top:(b=this.props.margin.top)!==null&&b!==void 0?b:0}})}return null}},{key:"componentDidUpdate",value:function(O){Il([Ze(O.children,oe)],[Ze(this.props.children,oe)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var O=Ze(this.props.children,oe);if(O&&typeof O.props.shared=="boolean"){var _=O.props.shared?"axis":"item";return s.indexOf(_)>=0?_:a}return a}},{key:"getMouseInfo",value:function(O){if(!this.container)return null;var _=this.container,g=_.getBoundingClientRect(),b=Dj(g),S={chartX:Math.round(O.pageX-b.left),chartY:Math.round(O.pageY-b.top)},A=g.width/_.offsetWidth||1,j=this.inRange(S.chartX,S.chartY,A);if(!j)return null;var k=this.state,E=k.xAxisMap,T=k.yAxisMap,C=this.getTooltipEventType(),$=Qb(this.state,this.props.data,this.props.layout,j);if(C!=="axis"&&E&&T){var M=Wt(E).scale,N=Wt(T).scale,q=M&&M.invert?M.invert(S.chartX):null,D=N&&N.invert?N.invert(S.chartY):null;return I(I({},S),{},{xValue:q,yValue:D},$)}return $?I(I({},S),$):null}},{key:"inRange",value:function(O,_){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,b=this.props.layout,S=O/g,A=_/g;if(b==="horizontal"||b==="vertical"){var j=this.state.offset,k=S>=j.left&&S<=j.left+j.width&&A>=j.top&&A<=j.top+j.height;return k?{x:S,y:A}:null}var E=this.state,T=E.angleAxisMap,C=E.radiusAxisMap;if(T&&C){var $=Wt(T);return pg({x:S,y:A},$)}return null}},{key:"parseEventsOfWrapper",value:function(){var O=this.props.children,_=this.getTooltipEventType(),g=Ze(O,oe),b={};g&&_==="axis"&&(g.props.trigger==="click"?b={onClick:this.handleClick}:b={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var S=Hi(this.props,this.handleOuterEvent);return I(I({},S),b)}},{key:"addListener",value:function(){jl.on(Pl,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){jl.removeListener(Pl,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(O,_,g){for(var b=this.state.formattedGraphicalItems,S=0,A=b.length;S<A;S++){var j=b[S];if(j.item===O||j.props.key===O.key||_===Et(j.item.type)&&g===j.childIndex)return j}return null}},{key:"renderClipPath",value:function(){var O=this.clipPathId,_=this.state.offset,g=_.left,b=_.top,S=_.height,A=_.width;return P.createElement("defs",null,P.createElement("clipPath",{id:O},P.createElement("rect",{x:g,y:b,height:S,width:A})))}},{key:"getXScales",value:function(){var O=this.state.xAxisMap;return O?Object.entries(O).reduce(function(_,g){var b=Yb(g,2),S=b[0],A=b[1];return I(I({},_),{},H({},S,A.scale))},{}):null}},{key:"getYScales",value:function(){var O=this.state.yAxisMap;return O?Object.entries(O).reduce(function(_,g){var b=Yb(g,2),S=b[0],A=b[1];return I(I({},_),{},H({},S,A.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(O){var _;return(_=this.state.xAxisMap)===null||_===void 0||(_=_[O])===null||_===void 0?void 0:_.scale}},{key:"getYScaleByAxisId",value:function(O){var _;return(_=this.state.yAxisMap)===null||_===void 0||(_=_[O])===null||_===void 0?void 0:_.scale}},{key:"getItemByXY",value:function(O){var _=this.state,g=_.formattedGraphicalItems,b=_.activeItem;if(g&&g.length)for(var S=0,A=g.length;S<A;S++){var j=g[S],k=j.props,E=j.item,T=E.type.defaultProps!==void 0?I(I({},E.type.defaultProps),E.props):E.props,C=Et(E.type);if(C==="Bar"){var $=(k.data||[]).find(function(D){return nI(O,D)});if($)return{graphicalItem:j,payload:$}}else if(C==="RadialBar"){var M=(k.data||[]).find(function(D){return pg(O,D)});if(M)return{graphicalItem:j,payload:M}}else if(vo(j,b)||yo(j,b)||li(j,b)){var N=GI({graphicalItem:j,activeTooltipItem:b,itemData:T.data}),q=T.activeIndex===void 0?N:T.activeIndex;return{graphicalItem:I(I({},j),{},{childIndex:q}),payload:li(j,b)?T.data[N]:j.props.data[N]}}}return null}},{key:"render",value:function(){var O=this;if(!jp(this))return null;var _=this.props,g=_.children,b=_.className,S=_.width,A=_.height,j=_.style,k=_.compact,E=_.title,T=_.desc,C=Zb(_,P2),$=Z(C,!1);if(k)return P.createElement(Eb,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},P.createElement(Dl,Er({},$,{width:S,height:A,title:E,desc:T}),this.renderClipPath(),Tp(g,this.renderMap)));if(this.props.accessibilityLayer){var M,N;$.tabIndex=(M=this.props.tabIndex)!==null&&M!==void 0?M:0,$.role=(N=this.props.role)!==null&&N!==void 0?N:"application",$.onKeyDown=function(D){O.accessibilityManager.keyboardEvent(D)},$.onFocus=function(){O.accessibilityManager.focus()}}var q=this.parseEventsOfWrapper();return P.createElement(Eb,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},P.createElement("div",Er({className:ee("recharts-wrapper",b),style:I({position:"relative",cursor:"default",width:S,height:A},j)},q,{ref:function(F){O.container=F}}),P.createElement(Dl,Er({},$,{width:S,height:A,title:E,desc:T,style:U2}),this.renderClipPath(),Tp(g,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(R.Component);H(m,"displayName",r),H(m,"defaultProps",I({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},l)),H(m,"getDerivedStateFromProps",function(p,x){var w=p.dataKey,O=p.data,_=p.children,g=p.width,b=p.height,S=p.layout,A=p.stackOffset,j=p.margin,k=x.dataStartIndex,E=x.dataEndIndex;if(x.updateId===void 0){var T=e0(p);return I(I(I({},T),{},{updateId:0},h(I(I({props:p},T),{},{updateId:0}),x)),{},{prevDataKey:w,prevData:O,prevWidth:g,prevHeight:b,prevLayout:S,prevStackOffset:A,prevMargin:j,prevChildren:_})}if(w!==x.prevDataKey||O!==x.prevData||g!==x.prevWidth||b!==x.prevHeight||S!==x.prevLayout||A!==x.prevStackOffset||!kr(j,x.prevMargin)){var C=e0(p),$={chartX:x.chartX,chartY:x.chartY,isTooltipActive:x.isTooltipActive},M=I(I({},Qb(x,O,S)),{},{updateId:x.updateId+1}),N=I(I(I({},C),$),M);return I(I(I({},N),h(I({props:p},N),x)),{},{prevDataKey:w,prevData:O,prevWidth:g,prevHeight:b,prevLayout:S,prevStackOffset:A,prevMargin:j,prevChildren:_})}if(!Il(_,x.prevChildren)){var q,D,F,K,G=Ze(_,Gr),z=G&&(q=(D=G.props)===null||D===void 0?void 0:D.startIndex)!==null&&q!==void 0?q:k,V=G&&(F=(K=G.props)===null||K===void 0?void 0:K.endIndex)!==null&&F!==void 0?F:E,fe=z!==k||V!==E,be=!Q(O),Ve=be&&!fe?x.updateId:x.updateId+1;return I(I({updateId:Ve},h(I(I({props:p},x),{},{updateId:Ve,dataStartIndex:z,dataEndIndex:V}),x)),{},{prevChildren:_,dataStartIndex:z,dataEndIndex:V})}return null}),H(m,"renderActiveDot",function(p,x,w){var O;return R.isValidElement(p)?O=R.cloneElement(p,x):X(p)?O=p(x):O=P.createElement(po,x),P.createElement(ce,{className:"recharts-active-dot",key:w},O)});var y=R.forwardRef(function(x,w){return P.createElement(m,Er({},x,{ref:w}))});return y.displayName=m.displayName,y},Ai=ah({chartName:"LineChart",GraphicalChild:ut,axisComponents:[{axisType:"xAxis",AxisComp:Ce},{axisType:"yAxis",AxisComp:ve}],formatAxisMap:Xd}),Zt=ah({chartName:"BarChart",GraphicalChild:pe,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ce},{axisType:"yAxis",AxisComp:ve}],formatAxisMap:Xd}),oh=ah({chartName:"AreaChart",GraphicalChild:Ke,axisComponents:[{axisType:"xAxis",AxisComp:Ce},{axisType:"yAxis",AxisComp:ve}],formatAxisMap:Xd});function lt(e,t){if(e!=="count")return{value:e.toUpperCase(),position:"insideTopLeft",offset:0,dy:-19,dx:2,fill:t,fontSize:9.5,letterSpacing:.7,fillOpacity:.75}}const Fe={top:30,right:8,left:0,bottom:0},eq=6,ji=36;function sh(e){const t=R.useRef(null),[r,n]=R.useState(0);return R.useEffect(()=>{if(!t.current||typeof ResizeObserver>"u")return;const i=new ResizeObserver(([a])=>n(a.contentRect.width));return i.observe(t.current),()=>i.disconnect()},[]),[t,r===0||e*eq<=r-ji]}function vn({data:e,left:t=24,top:r=4,xAxisProps:n,yAxis:i,children:a}){const{axisProps:o,gridProps:s}=ge();return v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:e,layout:"vertical",margin:{top:r,right:8,left:t,bottom:0},children:[v.jsx(Ge,{...s,horizontal:!1}),v.jsx(Ce,{type:"number",...o,...n}),i,a]})})}function tq(e,t=[1e3,1e5]){const r=e.filter(s=>Number.isFinite(s)&&s>0),[n,i]=r.length?[10**Math.floor(Math.log10(Math.min(...r))),10**Math.ceil(Math.log10(Math.max(...r)))]:t,a=Math.max(i,n*10),o=[];for(let s=n;s<=a;s*=10)o.push(s);return{domain:[n,a],ticks:o}}function rq({hidden:e,ts:t}){const{C:r,TOKEN_COLORS:n,axisProps:i,gridProps:a,tooltipStyle:o}=ge(),[s,u]=R.useState(new Set),c=f=>u(l=>{const d=new Set(l);return d.has(f)?d.delete(f):d.add(f),d});return v.jsx(Pe,{title:"Tokens over time",hint:"input · output · cache-write · cache-read (kept separate)",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Total tokens per bucket, stacked by kind. Click a legend entry to hide that series and let the others use the full scale."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month, chosen from the range (the picker above overrides it)."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"tokens."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Cache reads usually dominate."})," They are an order of magnitude larger than everything else and cost a fraction as much, so hide that series to read the rest."]}),v.jsx("p",{children:"Buckets by the session's start, so a long session's tokens all land in the bucket it began."})]}),hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(oh,{data:(t==null?void 0:t.series)??[],margin:Fe,children:[v.jsx(Ge,{...a}),v.jsx(Ce,{dataKey:"bucket",...i,minTickGap:24}),v.jsx(ve,{...i,tickFormatter:f=>yt(f),width:48,label:lt("tokens",r.muted)}),v.jsx(oe,{...o,formatter:(f,l)=>[`${yt(Number(f))} tokens`,l]}),v.jsx(Le,{wrapperStyle:{fontSize:12,cursor:"pointer"},onClick:f=>(f==null?void 0:f.dataKey)&&c(String(f.dataKey)),formatter:(f,l)=>v.jsx("span",{style:{opacity:s.has(String(l==null?void 0:l.dataKey))?.4:1},children:f})}),v.jsx(Ke,{type:"monotone",dataKey:"input",hide:s.has("input"),stackId:"1",stroke:n.input,fill:n.input,fillOpacity:.5}),v.jsx(Ke,{type:"monotone",dataKey:"output",hide:s.has("output"),stackId:"1",stroke:n.output,fill:n.output,fillOpacity:.5}),v.jsx(Ke,{type:"monotone",dataKey:"cache_creation",hide:s.has("cache_creation"),stackId:"1",stroke:n.cache_creation,fill:n.cache_creation,fillOpacity:.5}),v.jsx(Ke,{type:"monotone",dataKey:"cache_read",hide:s.has("cache_read"),stackId:"1",stroke:n.cache_read,fill:n.cache_read,fillOpacity:.35})]})})})}function nq({hidden:e,ts:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge();return v.jsx(Pe,{title:"Cost over time",hint:"API list price estimate, model × tokens (cache-aware)",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"What the tokens in each bucket would have cost at API list prices."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"US dollars, estimated."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"An estimate, and a lower bound."}),` It prices each model's tokens at public list rates with cache reads charged at their reduced rate — it is not your bill, and it knows nothing about subscription plans. Models with no known price contribute zero and are named in the "unpriced models" metric rather than being silently counted as free.`]})]}),hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Ai,{data:(t==null?void 0:t.series)??[],margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"bucket",...n,minTickGap:24}),v.jsx(ve,{...n,tickFormatter:o=>"$"+o,width:48,label:lt("USD (est.)",r.muted)}),v.jsx(oe,{...a,formatter:o=>Nn(Number(o))}),v.jsx(ut,{type:"monotone",dataKey:"cost",stroke:r.red,strokeWidth:2,dot:!1})]})})})}function iq({hidden:e,ts:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=(t==null?void 0:t.series)??[],[s,u]=sh(o.length),c=v.jsxs(v.Fragment,{children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"bucket",...n,minTickGap:24}),v.jsx(ve,{...n,width:ji,label:lt("count",r.muted)}),v.jsx(oe,{...a}),v.jsx(Le,{wrapperStyle:{fontSize:12}})]});return v.jsx(Pe,{title:"Activity over time",hint:"sessions & turns per bucket",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How much work happened in each bucket, by count rather than by size."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsxs("dd",{children:["count. ",v.jsx("strong",{children:"sessions"})," = sessions that started in the bucket, subagent runs included; ",v.jsx("strong",{children:"turns"})," = prompt-and-response exchanges within them."]})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Under a model filter this counts whole sessions, not model-attributable rows."})," ","A session has no single model, so it is counted here whenever it used any model you ticked — including the work it did with the others. That is why a session count and a token total move by different amounts when you untick a model."]}),v.jsx("p",{children:"Bars become lines once the range holds more buckets than can be drawn as readable bars."})]}),hidden:e,children:v.jsx("div",{ref:s,style:{width:"100%",height:"100%"},children:v.jsx(Qe,{width:"100%",height:"100%",children:u?v.jsxs(Zt,{data:o,margin:Fe,children:[c,v.jsx(pe,{dataKey:"sessions",fill:r.accent}),v.jsx(pe,{dataKey:"turns",fill:r.green})]}):v.jsxs(Ai,{data:o,margin:Fe,children:[c,v.jsx(ut,{dataKey:"sessions",stroke:r.accent,strokeWidth:2,dot:!1}),v.jsx(ut,{dataKey:"turns",stroke:r.green,strokeWidth:2,dot:!1})]})})})})}function aq({hidden:e,ts:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=(t==null?void 0:t.series)??[],[s,u]=sh(o.length),c=v.jsxs(v.Fragment,{children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"bucket",...n,minTickGap:24}),v.jsx(ve,{...n,width:ji,allowDecimals:!1,label:lt("errored calls",r.muted)}),v.jsx(oe,{...a}),v.jsx(Le,{wrapperStyle:{fontSize:12}})]});return v.jsx(Pe,{title:"Tool errors over time",hint:"failed tool calls per bucket · rejections/blocks kept separate (not agent failures)",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Tool calls that came back as errors, stacked by kind."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"count of errored tool calls."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"failures"})," are the agent's — a bad edit, a command that did not run.",v.jsx("strong",{children:" rejected/blocked"})," are yours or a guardrail's: you declined a permission prompt, or a rule stopped it. They are kept apart because a rejection is the system working."]}),v.jsx("p",{children:"The split is a heuristic over the tool's result text, so treat the two totals as indicative and the combined count as exact."})]}),hidden:e,children:v.jsx("div",{ref:s,style:{width:"100%",height:"100%"},children:v.jsx(Qe,{width:"100%",height:"100%",children:u?v.jsxs(Zt,{data:o,margin:Fe,children:[c,v.jsx(pe,{dataKey:"failures",name:"failures",stackId:"e",fill:r.red}),v.jsx(pe,{dataKey:"rejections",name:"rejected/blocked",stackId:"e",fill:r.muted})]}):v.jsxs(oh,{data:o,margin:Fe,children:[c,v.jsx(Ke,{dataKey:"failures",name:"failures",stackId:"e",stroke:"none",fill:r.red,fillOpacity:1}),v.jsx(Ke,{dataKey:"rejections",name:"rejected/blocked",stackId:"e",stroke:"none",fill:r.muted,fillOpacity:1})]})})})})}const oq=["trivial","small","medium","large","xl"];function sq({hidden:e,bd:t,expand:r,drill:n}){var c;const{C:i,tooltipStyle:a,axisProps:o}=ge(),s=(((c=t==null?void 0:t.error_types)==null?void 0:c.by_type)??[]).map(f=>({name:f.type,n:f.n,kind:f.kind})),u=r.topN(s,"errors");return v.jsx(Pe,{title:"Error types",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which kinds of tool error occurred, ranked by count. Click a bar to open the sessions behind it."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"number of errored tool calls of that type."})]}),v.jsxs("p",{children:["The type buckets are a ",v.jsx("strong",{children:"heuristic over the tool's result text"}),": the totals are exact, the labels best-effort. Rejections and guardrail blocks are counted separately because they are not agent failures."]})]}),hint:"heuristic buckets from the tool result text · rejections/blocks are not agent failures · click a bar for those sessions",actions:r.expandBtn("errors",s.length),bodyHeight:r.expandHeight("errors",s.length,28),hidden:e,children:t&&s.length===0?v.jsx("div",{className:"empty",children:"No errored tool calls in range."}):v.jsxs(vn,{data:u,xAxisProps:{allowDecimals:!1},yAxis:v.jsx(ve,{type:"category",dataKey:"name",...o,width:130,tick:f=>v.jsx(Qf,{...f,title:"click to filter sessions",onSelect:l=>n.drillFilter("error_type",l)})}),children:[v.jsx(oe,{...a,formatter:(f,l,d)=>{var h;return[`${f} (${(h=d.payload)==null?void 0:h.kind})`,"count"]}}),v.jsx(pe,{dataKey:"n",cursor:"pointer",onClick:n.drillTo("error_type","name"),children:u.map((f,l)=>v.jsx(bi,{fill:f.kind==="rejection"?i.muted:i.red},l))})]})})}function uq({hidden:e,bd:t,drill:r}){const{PALETTE:n,tooltipStyle:i,axisProps:a}=ge(),[o,s]=R.useState("tokens"),u=((t==null?void 0:t.by_model)??[]).map(c=>({name:fr(c.model),model:c.model,tokens:c.total_tokens,cost:c.cost}));return v.jsx(Pe,{title:"Tokens by model",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which models the tokens went to. Switch between tokens and estimated cost — the ranking often differs, because models are priced very differently."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"tokens, or estimated US dollars at API list prices, depending on the toggle."})]}),v.jsx("p",{children:"Counts both main and subagent sessions: a subagent's tokens come off the same quota. Click a bar to open that model's sessions."})]}),hint:"click a bar for those sessions",hidden:e,actions:v.jsxs("span",{className:"seg",role:"group","aria-label":"Metric",children:[v.jsx("button",{type:"button",className:o==="tokens"?"on":"",onClick:()=>s("tokens"),children:"tokens"}),v.jsx("button",{type:"button",className:o==="cost"?"on":"",onClick:()=>s("cost"),children:"cost"})]}),children:v.jsxs(vn,{data:u,top:8,xAxisProps:{tickFormatter:c=>o==="cost"?Nn(Number(c)):yt(c)},yAxis:v.jsx(ve,{type:"category",dataKey:"name",...a,width:120,tick:c=>v.jsx(Qf,{...c,title:"click to filter sessions",onSelect:f=>{var l;return r.drillFilter("model",(l=u.find(d=>d.name===f))==null?void 0:l.model)}})}),children:[v.jsx(oe,{...i,formatter:(c,f,l)=>{var d,h;return[`${yt(Number((d=l.payload)==null?void 0:d.tokens))} · ${Nn(Number((h=l.payload)==null?void 0:h.cost))}`,o]}}),v.jsx(pe,{dataKey:o,cursor:"pointer",onClick:r.drillTo("model","model"),children:u.map((c,f)=>v.jsx(bi,{fill:n[f%n.length]},f))})]})})}function cq({hidden:e,bd:t}){const{PALETTE:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=((t==null?void 0:t.by_category)??[]).map(s=>({name:s.category,value:s.n}));return v.jsx(Pe,{title:"Category distribution",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"What kind of work the sessions were, as judged by the classifier."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"category — feature, bugfix, refactor, docs, ops, chore, review."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"number of sessions."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Under a model filter this counts whole sessions, not model-attributable rows."})," ","A session has no single model, so it is counted here whenever it used any model you ticked — including the work it did with the others. That is why a session count and a token total move by different amounts when you untick a model."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Main sessions only"}),": subagents inherit their parent's task and would multiply-count it. The label is inferred from the transcript rather than declared by you, so read it as a rough shape, not a ledger."]})]}),hint:"main sessions only",hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:o,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"name",...n}),v.jsx(ve,{...n,width:36,allowDecimals:!1,label:lt("sessions",n.stroke)}),v.jsx(oe,{...a}),v.jsx(pe,{dataKey:"value",children:o.map((s,u)=>v.jsx(bi,{fill:r[u%r.length]},u))})]})})})}function lq({hidden:e,bd:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=oq.map(s=>{var u;return{name:s,value:((u=t==null?void 0:t.by_complexity.find(c=>c.band===s))==null?void 0:u.n)??0}}).filter(s=>s.value>0);return v.jsx(Pe,{title:"Complexity bands",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How involved each session was, banded by a score over signals like turn count, tools used and files touched."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"band — trivial, small, medium, large, xl."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"number of sessions."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Under a model filter this counts whole sessions, not model-attributable rows."})," ","A session has no single model, so it is counted here whenever it used any model you ticked — including the work it did with the others. That is why a session count and a token total move by different amounts when you untick a model."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Main sessions only."})," Most sessions landing in the lower bands is the real shape of the corpus, not a bug. Complexity measures effort spent — not difficulty, and not quality."]})]}),hint:"main sessions only",hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:o,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"name",...n}),v.jsx(ve,{...n,width:36,allowDecimals:!1,label:lt("sessions",n.stroke)}),v.jsx(oe,{...a}),v.jsx(pe,{dataKey:"value",fill:r.violet})]})})})}function fq({hidden:e,bd:t,expand:r}){const{C:n,tooltipStyle:i,axisProps:a}=ge(),o=(t==null?void 0:t.tools.length)??0;return v.jsx(Pe,{title:"Tool frequency",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which tools the agent reached for most."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"number of calls to that tool."})]}),v.jsx("p",{children:'Every call counts, successful or not, across both main and subagent sessions. "show all" opens the full list beyond the top few.'})]}),hint:"top tools by call count",actions:r.expandBtn("tools",o),bodyHeight:r.expandHeight("tools",o,22),hidden:e,children:v.jsxs(vn,{data:r.topN((t==null?void 0:t.tools)??[],"tools"),yAxis:v.jsx(ve,{type:"category",dataKey:"name",...a,width:110}),children:[v.jsx(oe,{...i}),v.jsx(pe,{dataKey:"n",fill:n.teal})]})})}function dq({hidden:e,bd:t,expand:r}){const{C:n,axisProps:i}=ge(),a=l0(),o=(t==null?void 0:t.skills.length)??0,s=new Map;for(const u of(t==null?void 0:t.skill_versions)??[]){const c=s.get(u.name)??[];c.push(u),s.set(u.name,c)}return v.jsx(Pe,{title:"Skill activation",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which skills actually fired, ranked by how often."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"number of activations, with every version of a skill grouped together."})]}),v.jsx("p",{children:"Hover a bar for the per-version split, click one to open that skill. A skill that is installed but never invoked does not appear at all."})]}),hint:"firings per skill (all versions grouped) · hover for versions · click to open",actions:r.expandBtn("skills",o),bodyHeight:r.expandHeight("skills",o,22),hidden:e,children:t&&t.skills.length===0?v.jsxs("div",{className:"empty",children:["No ",v.jsx("code",{children:"Skill"})," tool calls in range. Skill usage is captured from ",v.jsx("code",{children:"input.skill"}),"; this fills in once skills are actually invoked in collected sessions."]}):v.jsxs(vn,{data:r.topN((t==null?void 0:t.skills)??[],"skills"),yAxis:v.jsx(ve,{type:"category",dataKey:"name",...i,width:140,tick:u=>v.jsx(Qf,{...u,title:"click to open skill",onSelect:c=>c&&a(`/skill/${encodeURIComponent(c)}`)})}),children:[v.jsx(oe,{cursor:{fill:n.border,fillOpacity:.25},content:v.jsx(L_,{versionsByName:s})}),v.jsx(pe,{dataKey:"n",fill:n.gold,cursor:"pointer",onClick:u=>{const c=f0(u,"name");c&&a(`/skill/${encodeURIComponent(c)}`)}})]})})}function hq({hidden:e,bd:t,expand:r}){const{C:n,tooltipStyle:i,axisProps:a}=ge(),o=(t==null?void 0:t.subagent_fanout.by_type.length)??0;return v.jsx(Pe,{title:"Subagent fan-out",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which kinds of subagent got spawned, and how often."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"number of spawns of that agent type."})]}),v.jsxs("p",{children:["Counted from the spawning side and ",v.jsx("strong",{children:"main sessions only"}),", so a subagent that spawns its own children cannot inflate the total. The subtitle carries the per-session average and the busiest single session."]})]}),hint:t?`${t.subagent_fanout.total_spawns} spawns · ${t.subagent_fanout.sessions_with_subagents} sessions · avg ${t.subagent_fanout.avg_per_session}, max ${t.subagent_fanout.max_per_session}`:void 0,actions:r.expandBtn("subagents",o),bodyHeight:r.expandHeight("subagents",o,28),hidden:e,children:t&&o===0?v.jsx("div",{className:"empty",children:"No subagents spawned in range."}):v.jsxs(vn,{data:r.topN((t==null?void 0:t.subagent_fanout.by_type)??[],"subagents"),yAxis:v.jsx(ve,{type:"category",dataKey:"type",...a,width:120}),children:[v.jsx(oe,{...i}),v.jsx(pe,{dataKey:"n",fill:n.accent})]})})}const pq="dashboard.timezone";function P_(e){const t=kl(pq,null);if(t)return t;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}const vq=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r0=new Map;function yq(e){let t=r0.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit"}),r0.set(e,t)),t}function T_(e,t){const r=Date.parse(e+":00:00Z");if(Number.isNaN(r))return null;const n=yq(t).formatToParts(new Date(r)),i=f=>{var l;return((l=n.find(d=>d.type===f))==null?void 0:l.value)??""},a=vq.indexOf(i("weekday")),o=Number(i("hour")),[s,u,c]=[i("year"),i("month"),i("day")];return a<0||!Number.isFinite(o)||!s||!u||!c?null:{weekday:a,hour:o%24,dayKey:`${s}-${u}-${c}`}}function In(e,t=new Date){var r;try{return((r=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"}).formatToParts(t).find(i=>i.type==="timeZoneName"))==null?void 0:r.value)??e}catch{return e}}function mq(e,t){return e?t==="tokens"?e.burn_hours.map(r=>({hour:r.hour,value:r.work})):e.turn_hours.map(r=>({hour:r.hour,value:r.turns})):[]}function n0(e,t){const r=Date.parse(`${e}T00:00:00Z`),n=Date.parse(`${t}T00:00:00Z`),i=new Array(7).fill(0);if(!Number.isFinite(r)||!Number.isFinite(n)||n<r)return i;const a=Math.round((n-r)/864e5)+1;i.fill(Math.floor(a/7));const o=new Date(r).getUTCDay();for(let s=0;s<a%7;s++)i[(o+s)%7]++;return i}function gq(e,t,r){var f;const n=new Map,i=new Map;let a=null,o=null;for(const l of e){const d=T_(l.hour,t);if(!d)continue;(a===null||d.dayKey<a)&&(a=d.dayKey),(o===null||d.dayKey>o)&&(o=d.dayKey);const h=`${d.weekday}:${d.hour}`;n.set(h,(n.get(h)??0)+l.value),l.value>0&&(i.get(h)??i.set(h,new Set).get(h)).add(d.dayKey)}let s=r!=null&&r.from&&(r!=null&&r.to)?n0(r.from,r.to):[];s.some(l=>l>0)||(s=a&&o?n0(a,o):new Array(7).fill(0));const u=[];let c=0;for(let l=0;l<7;l++){const d=s[l];for(let h=0;h<24;h++){const m=n.get(`${l}:${h}`)??0,y=d?m/d:0;y>c&&(c=y),u.push({weekday:l,hour:h,mean:y,total:m,observed:((f=i.get(`${l}:${h}`))==null?void 0:f.size)??0,days:d})}}return{cells:u,max:c}}function bq(e,t,r){if(e<=0||t<=0)return null;const n=Math.min(1,e/t);return r==="sqrt"?Math.sqrt(n):n}function xq(e,t,r){const n=(a,o)=>parseInt(a.slice(1+o*2,3+o*2),16);return`#${[0,1,2].map(a=>Math.round(n(e,a)+(n(t,a)-n(e,a))*r)).map(a=>a.toString(16).padStart(2,"0")).join("")}`}function wq(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];const r=Math.max(0,Math.min(1,e))*(t.length-1),n=Math.min(t.length-2,Math.floor(r));return xq(t[n],t[n+1],r-n)}function _q(e,t,r=5){return e<=0?[]:Array.from({length:r},(n,i)=>{const a=i/(r-1);return[a,t==="sqrt"?a**2*e:a*e]})}function Oq(e,t){return t==="day"?e:t==="month"?e.slice(0,7):Aq(e)}function Sq(e,t,r){const n=new Map,i=new Set;for(const o of e){const s=T_(o.hour,t);if(!s)continue;const u=o.source??"(unassigned)";i.add(u);const c=Oq(s.dayKey,r),f=n.get(c)??{};f[u]=(f[u]??0)+o.work,n.set(c,f)}return{points:[...n.entries()].sort((o,s)=>o[0].localeCompare(s[0])).map(([o,s])=>({bucket:o,bySource:s})),sources:[...i].sort()}}function Aq(e){const[t,r,n]=e.split("-").map(Number),i=new Date(Date.UTC(t,r-1,n)),a=(i.getUTCDay()+6)%7;i.setUTCDate(i.getUTCDate()-a+3);const o=i.getTime(),s=new Date(Date.UTC(i.getUTCFullYear(),0,1)),u=1+Math.round((o-s.getTime())/6048e5-((s.getUTCDay()+6)%7>3?-1:0));return`${i.getUTCFullYear()}-W${String(u).padStart(2,"0")}`}const El=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],jq=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Pq=4,i0=100,E_=e=>t=>v.jsx("span",{style:{color:e},children:t});function Tq({hidden:e,time:t,range:r}){const{BURN_RAMP:n,C:i}=ge(),a=P_(),[o,s]=R.useState("turns"),u=o==="tokens",c=R.useMemo(()=>mq(t,o),[t,o]),{cells:f,max:l}=R.useMemo(()=>gq(c,a,r),[c,a,r.from,r.to]),[d,h]=R.useState(null),m=u?0:l<2?2:1,y=_=>u?yt(Math.round(_)):_.toFixed(m),p=u?"work tokens":"turns",x=u?"sqrt":"linear",w=[i.panel2,...n],O=`linear-gradient(to right, ${w.join(", ")})`;return v.jsx(Pe,{title:"When work happens",hint:`mean ${p} per weekday × hour, ${In(a)}`,guide:v.jsxs(v.Fragment,{children:[v.jsxs("p",{children:["Each cell is one hour of one weekday. Darker means more ",p," in that hour on a typical day — hover any cell for its exact figure."]}),v.jsxs("dl",{children:[v.jsx("dt",{children:"rows / columns"}),v.jsxs("dd",{children:["weekday (Sun–Sat) × hour of day, 0–23, in ",In(a)," — your own clock."]}),v.jsx("dt",{children:"cell value"}),v.jsxs("dd",{children:["mean ",u?v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"work tokens"})," (input + output + cache-write; cache reads excluded)"]}):v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"turns started"})," — one turn is one prompt and its answer"]})," ","per ",v.jsx("strong",{children:"calendar"})," occurrence of that weekday in range — a weekday you did not work is a zero, not a missing day, and a range ending mid-week does not read as a quiet Thursday."]}),v.jsx("dt",{children:"which sessions"}),v.jsx("dd",{children:u?"Both populations: a subagent's tokens come off the same quota.":"Main sessions only — a turn is a person sitting down to prompt, and a subagent has nobody in it."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Turns and tokens do not draw the same picture, and the difference is the point."})," ","Tokens per hour are unbounded: one 12-minute fan-out of subagents can burn more than a month of evenings, so a one-off lands in the same colour as a habit. A turn count is bounded per hour, so a cell tracks how ",v.jsx("em",{children:"often"})," that hour is worked. Switch to tokens when you want the spend rather than the rhythm."]}),v.jsxs("p",{children:["Bucketed by when the work happened — the usage event's own timestamp, or the turn's start — not by its session's start, so its totals deliberately"," ",v.jsx("strong",{children:'do not match "Tokens over time"'}),", which buckets by session."]}),v.jsx("p",{children:"It shows when work happened. It says nothing about whether that was a good time for it."})]}),hidden:e,actions:v.jsxs("span",{className:"seg",role:"group","aria-label":"Metric",children:[v.jsx("button",{type:"button",className:o==="turns"?"on":"",onClick:()=>s("turns"),children:"turns"}),v.jsx("button",{type:"button",className:u?"on":"",onClick:()=>s("tokens"),children:"tokens"})]}),children:_=>t&&l===0?v.jsxs("div",{className:"empty",children:["No ",p," in range."]}):v.jsxs("div",{className:_?"burn burn-lg":"burn",children:[v.jsxs("div",{className:"burn-grid",role:"img","aria-label":`Mean ${p} by weekday and hour, ${In(a)}`,children:[El.map((g,b)=>v.jsxs("div",{className:"burn-row",children:[v.jsx("span",{className:"burn-day",children:g}),f.filter(S=>S.weekday===b).map(S=>{const A=bq(S.mean,l,x);return v.jsx("i",{className:"burn-cell",style:{background:A===null?i.panel2:wq(A,w)},onPointerEnter:j=>{const k=j.currentTarget.getBoundingClientRect(),E=j.currentTarget.closest(".burn").getBoundingClientRect();h({cell:S,x:k.left-E.left+k.width/2,y:k.top-E.top})},onPointerLeave:()=>h(null)},S.hour)})]},g)),v.jsxs("div",{className:"burn-row burn-hours",children:[v.jsx("span",{className:"burn-day"}),Array.from({length:24},(g,b)=>v.jsx("i",{className:"burn-tick",children:b%(_?2:6)===0?b:""},b))]})]}),v.jsxs("div",{className:"burn-legend",children:[v.jsxs("span",{className:"burn-legend-cap",children:[p," per hour"]}),v.jsx("div",{className:"burn-bar",style:{background:O}}),v.jsx("div",{className:"burn-ticks",children:_q(l,x).map(([g,b])=>v.jsx("span",{style:{left:`${g*100}%`},children:y(b)},g))})]}),d&&v.jsxs("div",{className:"burn-tip",style:{top:Math.max(0,d.y-46),...d.x>210?{right:0}:{left:Math.max(0,d.x-60)}},"aria-hidden":"true",children:[v.jsxs("div",{className:"burn-tip-head",children:[El[d.cell.weekday]," ",String(d.cell.hour).padStart(2,"0"),":00"]}),v.jsxs("div",{className:"burn-tip-row",children:[y(d.cell.mean)," ",p," · average ",El[d.cell.weekday]]}),v.jsxs("div",{className:"burn-tip-row burn-tip-support",children:["on ",d.cell.observed," of ",d.cell.days," ",jq[d.cell.weekday],d.cell.days===1?"":"s"]})]})]})})}function Eq({hidden:e,ts:t,time:r}){const{C:n,PALETTE:i,axisProps:a,gridProps:o,tooltipStyle:s}=ge(),u=P_(),c=(t==null?void 0:t.bucket)??"week",{points:f,sources:l}=R.useMemo(()=>Sq((r==null?void 0:r.burn_hours)??[],u,c),[r,u,c]),d=f.map(h=>({bucket:h.bucket,...h.bySource}));return v.jsx(Pe,{title:"Burn by source",hint:`work tokens per local ${c}, ${In(u)}`,guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How much each account spent over time. Use it to compare the sources, and to spot a bucket that broke the pattern."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsxs("dd",{children:["local ",c,", in ",In(u)," — it follows the dashboard's bucket control, so switching to ",v.jsx("em",{children:"day"})," shows each source's shape where a month would flatten it."]}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"work tokens — input + output + cache-write, summed over the bucket. Cache reads are excluded."}),v.jsx("dt",{children:"one line per source"}),v.jsxs("dd",{children:["Sources are ",v.jsx("strong",{children:"never added together"}),": they are separate accounts with genuinely different usage profiles, and a combined line would hide the only thing this chart is for."]})]}),v.jsx("p",{children:"The first and last buckets are usually partial, so their dip is the range boundary, not a change in behaviour."}),v.jsxs("p",{children:["These totals ",v.jsx("strong",{children:'deliberately do not match "Tokens over time"'})," even at the same bucket: this chart places tokens by ",v.jsx("em",{children:"when they were spent"}),", that one by the start of the session that spent them, so a session straddling a boundary lands differently in each."]})]}),hidden:e,children:r&&!d.length?v.jsx("div",{className:"empty",children:"No token usage in range."}):v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Ai,{data:d,margin:Fe,children:[v.jsx(Ge,{...o}),v.jsx(Ce,{dataKey:"bucket",...a,minTickGap:24}),v.jsx(ve,{...a,tickFormatter:h=>yt(h),width:48,label:lt("work tokens",n.muted)}),v.jsx(oe,{...s,formatter:(h,m)=>[`${yt(Number(h))} tokens`,m]}),l.length>1&&v.jsx(Le,{wrapperStyle:{fontSize:12},formatter:E_(n.muted)}),l.map((h,m)=>v.jsx(ut,{type:"monotone",dataKey:h,stroke:i[m%i.length],strokeWidth:2,dot:!1},h))]})})})}function a0(e){if(e<=0)return"0";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4){const t=e/1e3;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}s`}return`${(e/6e4).toFixed(1).replace(/\.0$/,"")}m`}function kq({models:e,colorFor:t,shows:r,onToggle:n,muted:i}){const a=(o,s)=>v.jsx("svg",{width:"18",height:"8","aria-hidden":"true",style:{flex:"none"},children:v.jsx("line",{x1:"0",y1:"4",x2:"18",y2:"4",stroke:o,strokeWidth:"2",strokeDasharray:s?"4 3":void 0})});return v.jsxs("div",{className:"lat-legend",children:[e.map(o=>{const s=r(o);return v.jsxs("button",{type:"button",className:"lat-chip","aria-pressed":s,onClick:()=>n(o,!s),"data-tip":`${s?"Hide":"Show"} ${fr(o)}`,style:{opacity:s?1:.4},children:[a(t(o)),v.jsx("span",{style:{color:i},children:fr(o)})]},o)}),v.jsxs("span",{className:"lat-key",style:{color:i},children:[a(i)," p50 ",a(i,!0)," p90"]})]})}function Cq({hidden:e,time:t}){const{C:r,PALETTE:n,axisProps:i,gridProps:a,tooltipStyle:o}=ge(),s=(t==null?void 0:t.latency.bucket)??"week",[u,c]=R.useState(new Map),f=(_,g)=>c(b=>new Map(b).set(_,g)),{data:l,models:d,offByDefault:h}=R.useMemo(()=>{const _=(t==null?void 0:t.latency.series)??[],g=new Map;for(const A of _)g.set(A.model,(g.get(A.model)??0)+A.n);const b=[...g.entries()].sort((A,j)=>j[1]-A[1]).map(([A])=>A),S=new Map;for(const A of _){const j=S.get(A.bucket)??{bucket:A.bucket};j[`${A.model} p50`]=A.p50_ms,j[`${A.model} p90`]=A.p90_ms,S.set(A.bucket,j)}return{data:[...S.values()].sort((A,j)=>String(A.bucket).localeCompare(String(j.bucket))),models:b,offByDefault:new Set(b.slice(Pq))}},[t]),m=_=>n[Math.max(0,d.indexOf(_))%n.length],y=_=>u.get(_)??!h.has(_),p=d.filter(y),{logScale:x,domain:w,ticks:O}=R.useMemo(()=>{const _=[];for(const b of l)for(const S of p)for(const A of["p50","p90"]){const j=b[`${S} ${A}`];typeof j=="number"&&j>0&&_.push(j)}return(_.length?Math.max(..._)/Math.min(..._):1)<i0?{logScale:!1,domain:void 0,ticks:void 0}:{logScale:!0,...tq(_)}},[l,p.join("|")]);return v.jsx(Pe,{title:"Model response latency",hint:"prompt → first assistant token, per model"+(h.size?` · ${h.size} lower-volume model${h.size>1?"s":""} off by default — switch on in the legend`:""),guide:v.jsxs(v.Fragment,{children:[v.jsxs("p",{children:["How long a model took to start replying. ",v.jsx("strong",{children:"Read it for drift between buckets"})," ","— a model whose p90 doubles is the signal — not as an absolute number."]}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsxs("dd",{children:["local ",s,", following the dashboard's bucket control. Split by model the turns thin out fast, so at a fine bucket ",v.jsx("strong",{children:"points drop out rather than being drawn"})," ","— see the note below."]}),v.jsx("dt",{children:"y-axis"}),v.jsxs("dd",{children:["elapsed time from the prompt to the model's first response. Solid = median (p50), dashed = p90, one colour per model. Never a mean — the tail is the story."," ",v.jsx("strong",{children:"Linear normally."})," If the visible series span more than ",i0,"× the axis switches to logarithmic — each gridline ten times the one below, equal distances meaning equal ",v.jsx("em",{children:"ratios"})," rather than equal seconds — because at that spread a linear axis puts the smallest line at one percent of the plot and flattens it onto the baseline. The caption says which is in force, and hiding the widest series can bring it back to linear."]})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"The p90 is not pure model latency."})," A turn whose reply lands hours later is usually an agent parked on a permission prompt waiting for you, and nothing in the data separates that from a genuinely slow response. Replies Claude Code generated"," ",v.jsx("em",{children:"without"})," calling a model at all (its ",v.jsx("code",{children:"<synthetic>"})," marker) are excluded here — their elapsed time is not a model response time."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"The filter bar moves this chart less than it moves the token charts."})," A model is counted here once per turn it answered, but in the token charts by everything it spent — so a model doing subagent work, haiku above all, can be a top-three consumer while contributing almost nothing to this tile. Unticking it visibly moves one and not the other."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Every model is in the legend; click one to show or hide it"}),", and the axis rescales around what is left. Only the highest-volume few start switched on, so a model you do not see is off rather than absent — though a low-volume one may plot as a point or two, since a bucket under 5 turns is dropped. The legend is a ",v.jsx("em",{children:"view"})," control over whatever the filter bar admits: unticking a model up there removes it from every chart, while hiding it here only takes it off this one."]}),v.jsxs("p",{children:["Main sessions only, and only the highest-volume models are plotted. A ",s," holding fewer than ",v.jsx("strong",{children:"5 turns for a given model is dropped"}),', because a percentile over three observations is not a percentile — so a finer bucket gives a sparser chart, not a noisier one. Where a cell holds only a handful of turns its "p90" is close to simply its slowest.']})]}),hidden:e,children:t&&!l.length?v.jsx("div",{className:"empty",children:"No turns with a model response in range."}):v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Ai,{data:l,margin:Fe,children:[v.jsx(Ge,{...a}),v.jsx(Ce,{dataKey:"bucket",...i,minTickGap:24}),v.jsx(ve,{...i,...x?{scale:"log",domain:w,ticks:O,allowDataOverflow:!0}:{},tickFormatter:_=>a0(_),width:52,label:lt(`time to first token${x?" (log)":""}`,r.muted)}),v.jsx(oe,{...o,formatter:(_,g)=>[a0(Number(_)),fr(String(g).replace(/ p\d0$/,""))+String(g).slice(-4)]}),v.jsx(Le,{wrapperStyle:{fontSize:12},content:v.jsx(kq,{models:d,colorFor:m,shows:y,onToggle:f,muted:r.muted})}),d.map(_=>v.jsx(ut,{type:"monotone",dataKey:`${_} p50`,hide:!y(_),stroke:m(_),strokeWidth:2,dot:!1,connectNulls:!0},_)),d.map(_=>v.jsx(ut,{type:"monotone",dataKey:`${_} p90`,hide:!y(_),stroke:m(_),strokeWidth:2,strokeDasharray:"4 3",dot:!1,connectNulls:!0},`${_}-p90`))]})})})}function Mq({hidden:e,time:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=t==null?void 0:t.review,s=(c,f)=>f?Math.round(c/f*1e3)/10:0,u=o?[{band:"under 10s",wrote:s(o.wrote.under_10s,o.wrote.n),none:s(o.none.under_10s,o.none.n)},{band:"under 30s",wrote:s(o.wrote.under_30s,o.wrote.n),none:s(o.none.under_30s,o.none.n)},{band:"under 2min",wrote:s(o.wrote.under_2min,o.wrote.n),none:s(o.none.under_2min,o.none.n)}]:[];return v.jsx(Pe,{title:"Turnaround after a turn",hint:o&&o.wrote.n?`share of turns answered within each window · ${o.wrote.n} wrote files, ${o.none.n} did not`:"share of turns answered within each window",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How quickly the next prompt arrived after a turn finished, split by whether that turn changed any files."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:'how soon the next prompt came — the bands are cumulative, so "under 2min" also counts everything under 30s.'}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"percentage of turns in that group. The two groups have different denominators, shown in the subtitle, so compare the shares and not the bar heights as counts."})]}),v.jsxs("p",{children:["This is an ",v.jsx("strong",{children:"audit"})," view, not a productivity score. It reports that a reply came in four seconds; it makes no claim about whether that was long enough to read the diff, and nothing here is coloured or thresholded to suggest one."]}),v.jsx("p",{children:"Main sessions only — a subagent has no human to turn it around."})]}),hidden:e,children:t&&!(o!=null&&o.wrote.n)&&!(o!=null&&o.none.n)?v.jsx("div",{className:"empty",children:"No turns with a successor in range."}):v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:u,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"band",...n}),v.jsx(ve,{...n,width:40,tickFormatter:c=>`${c}%`,label:lt("% of turns",r.muted)}),v.jsx(oe,{...a,formatter:(c,f)=>[`${c}%`,f]}),v.jsx(Le,{wrapperStyle:{fontSize:12},formatter:E_(r.muted)}),v.jsx(pe,{dataKey:"wrote",name:"turn wrote files",fill:r.accent,radius:[4,4,0,0]}),v.jsx(pe,{dataKey:"none",name:"turn wrote nothing",fill:r.muted,radius:[4,4,0,0]})]})})})}const o0=["info","low","medium","high","critical"],Zf=(e,t)=>t?e/t*100:0,k_=e=>`${e.toFixed(1)}%`;function $q({hidden:e,audit:t}){const{C:r,axisProps:n,tooltipStyle:i}=ge(),a=((t==null?void 0:t.edit_reliability)??[]).map(o=>({name:fr(o.model),model:o.model,rate:Zf(o.errors,o.calls),calls:o.calls,errors:o.errors}));return v.jsx(Pe,{title:"Edit failures by model",hint:"share of Edit/Write/NotebookEdit calls that errored · ordered by call volume",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How often a model's attempt to write a file came back as an error."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"errored calls as a share of that model's file-writing calls."}),v.jsx("dt",{children:"rows"}),v.jsx("dd",{children:"one per model, ordered by how many such calls it made."})]}),v.jsxs("p",{children:["A failed Edit usually means the model got the file's existing contents wrong, so this is a"," ",v.jsx("strong",{children:"capability signal"})," rather than a speed one. Both main and subagent sessions count — a subagent's edits are real edits."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Confounded by era and task mix."})," Older models ran on older sessions doing different work, so read this within a date range rather than as a standing leaderboard. The model comes from the event that issued the call."]})]}),hidden:e,children:v.jsxs(vn,{data:a,left:8,xAxisProps:{tickFormatter:o=>`${o}%`},yAxis:v.jsx(ve,{type:"category",dataKey:"name",...n,width:104}),children:[v.jsx(oe,{...i,formatter:(o,s,u)=>{var c,f;return[`${k_(o)} — ${((c=u.payload)==null?void 0:c.errors)??0} of ${(((f=u.payload)==null?void 0:f.calls)??0).toLocaleString()} calls`,"failure rate"]}}),v.jsx(pe,{dataKey:"rate",fill:r.red})]})})}function Iq({hidden:e,audit:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=((t==null?void 0:t.plan_rejections)??[]).map(s=>({bucket:s.bucket,plans:s.plan_calls?Zf(s.plan_rejected,s.plan_calls):null,questions:s.question_calls?Zf(s.question_rejected,s.question_calls):null,plan_calls:s.plan_calls,question_calls:s.question_calls}));return v.jsx(Pe,{title:"Plans & questions sent back",hint:"main sessions only · a bucket with none of that kind plots as a gap, not as 0%",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Share of plans and questions put to you that you rejected rather than approved."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"rejected as a percentage of that bucket's calls of that kind."})]}),v.jsxs("p",{children:["This is ",v.jsx("strong",{children:"alignment measured at the cheapest possible moment"})," — before the work happens. A rising line means briefs are getting worse or the model is drifting; nothing here says a rejection was wrong, and a healthy rate is not zero."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Not the same number as the rejection-rate KPI."})," That one is every rejected or blocked tool call over every tool call, a far larger denominator. This counts only ExitPlanMode and AskUserQuestion, and only where the result was recorded as a user rejection rather than a genuine failure."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Main sessions only"}),", and the model filter attributes each call to the event that issued it — a subagent has no human to reject it."]})]}),hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Ai,{data:o,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"bucket",...n,minTickGap:24}),v.jsx(ve,{...n,width:ji,tickFormatter:s=>`${s}%`,label:lt("rejected",r.muted)}),v.jsx(oe,{...a,formatter:s=>k_(s)}),v.jsx(Le,{wrapperStyle:{fontSize:12}}),v.jsx(ut,{type:"monotone",dataKey:"plans",name:"plans",stroke:r.violet,dot:!1,strokeWidth:2,connectNulls:!1}),v.jsx(ut,{type:"monotone",dataKey:"questions",name:"questions",stroke:r.accent,dot:!1,strokeWidth:2,connectNulls:!1})]})})})}function Nq({hidden:e,audit:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=(t==null?void 0:t.file_rework)??[];return v.jsx(Pe,{title:"Repeat edits per file",hint:"(session, file) pairs banded by how many times that session touched that file",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How often a session came back to a file it had already edited."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"times that session touched that file — 1, 2–3, 4–6, 7–12, 13+."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"two counts per band: the number of (session, file) pairs in it, and the number of individual edits those pairs account for."})]}),v.jsx("p",{children:"The two series disagree on purpose. Most pairs sit in the left band, while a large share of all edits lands in the right ones — a small number of files absorbing a lot of rework."}),v.jsxs("p",{children:[v.jsx("strong",{children:"A count and a list, never a score."})," Rework was tested against session cost in both directions and the relationship is flat; it correlates with total tokens only because bigger sessions edit more files. Both populations count, and the model filter attributes each edit to the event that made it."]})]}),hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:o,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"band",...n}),v.jsx(ve,{...n,width:44,allowDecimals:!1,label:lt("count",r.muted)}),v.jsx(oe,{...a}),v.jsx(Le,{wrapperStyle:{fontSize:12}}),v.jsx(pe,{dataKey:"pairs",name:"file/session pairs",fill:r.teal}),v.jsx(pe,{dataKey:"changes",name:"edits they account for",fill:r.gold})]})})})}function Dq({hidden:e,audit:t}){const{C:r,SEVERITY_COLORS:n,axisProps:i,gridProps:a,tooltipStyle:o}=ge(),s=(t==null?void 0:t.findings_over_time)??[],[u,c]=sh(s.length),f=v.jsxs(v.Fragment,{children:[v.jsx(Ge,{...a}),v.jsx(Ce,{dataKey:"bucket",...i,minTickGap:24}),v.jsx(ve,{...i,width:ji,allowDecimals:!1,label:lt("findings",r.muted)}),v.jsx(oe,{...o}),v.jsx(Le,{wrapperStyle:{fontSize:12}})]});return v.jsx(Pe,{title:"Findings over time",hint:"detector findings per bucket, stacked by severity · dated by the finding, not its session",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Security findings the detector raised, over time and by severity."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"findings raised in that bucket, stacked with the most severe on top."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Dated by the finding's own moment"}),", not by when its session started. A finding belongs to the tool call that triggered it, and a long session can raise one hours after it began — so a bucket here is when the risky thing was done."]}),v.jsx("p",{children:"A rising low-severity band is usually the detector getting better, not the work getting worse; a new critical is the line worth reading. Both populations count. Individual findings, their evidence and their mute state live on the Security page."})]}),hidden:e,children:v.jsx("div",{ref:u,style:{width:"100%",height:"100%"},children:v.jsx(Qe,{width:"100%",height:"100%",children:c?v.jsxs(Zt,{data:s,margin:Fe,children:[f,o0.map(l=>v.jsx(pe,{dataKey:l,name:l,stackId:"f",fill:n[l]},l))]}):v.jsxs(oh,{data:s,margin:Fe,children:[f,o0.map(l=>v.jsx(Ke,{dataKey:l,name:l,stackId:"f",stroke:"none",fill:n[l],fillOpacity:1},l))]})})})})}const Jf=[{id:"tokens-over-time",label:"Tokens over time",Component:rq},{id:"cost-over-time",label:"Cost over time",Component:nq},{id:"activity",label:"Activity over time",Component:iq},{id:"tool-errors",label:"Tool errors over time",Component:aq},{id:"error-types",label:"Error types",Component:sq},{id:"tokens-by-model",label:"Tokens by model",Component:uq},{id:"category",label:"Category distribution",Component:cq},{id:"complexity",label:"Complexity bands",Component:lq},{id:"tool-frequency",label:"Tool frequency",Component:fq},{id:"skill-activation",label:"Skill activation",Component:dq},{id:"subagent-fanout",label:"Subagent fan-out",Component:hq},{id:"burn-heatmap",label:"When work happens",Component:Tq},{id:"weekly-burn",label:"Burn by source",Component:Eq},{id:"model-latency",label:"Model response latency",Component:Cq},{id:"review-latency",label:"Turnaround after a turn",Component:Mq},{id:"edit-reliability",label:"Edit failures by model",Component:$q},{id:"plan-rejections",label:"Plans & questions sent back",Component:Iq},{id:"file-rework",label:"Repeat edits per file",Component:Nq},{id:"findings-over-time",label:"Findings over time",Component:Dq}],Rq=["burn-heatmap","weekly-burn","model-latency","review-latency"],qq=["edit-reliability","plan-rejections","file-rework","findings-over-time"];function s0({label:e,items:t,hidden:r,onToggle:n,onMove:i,onReset:a}){const o=M_();return v.jsxs("details",{className:"col-customizer",ref:o,children:[v.jsx("summary",{"aria-label":`Customize ${e.toLowerCase()}`,"data-tip":`Show, hide and reorder ${e.toLowerCase()}`,children:"⚙"}),v.jsxs("div",{className:"col-menu strip-menu",role:"group","aria-label":`Customize ${e.toLowerCase()}`,children:[t.map((s,u)=>v.jsxs("div",{className:"strip-row",children:[v.jsxs("label",{children:[v.jsx("input",{type:"checkbox",checked:!r.has(s.id),onChange:c=>n(s.id,c.target.checked)}),s.label]}),v.jsx("button",{type:"button",className:"move","aria-label":`Move ${s.label} up`,disabled:u===0,onClick:()=>i(s.id,-1),children:"↑"}),v.jsx("button",{type:"button",className:"move","aria-label":`Move ${s.label} down`,disabled:u===t.length-1,onClick:()=>i(s.id,1),children:"↓"})]},s.id)),v.jsx("button",{type:"button",className:"ghost small ms-clear",onClick:a,children:"reset"})]})]})}function Lq({active:e,hasCustom:t,onSelect:r}){const n=[...d0.map(i=>({id:i.id,label:i.label})),...t?[{id:Ir,label:"Custom"}]:[]];return v.jsx("div",{className:"views view-toggle",role:"group","aria-label":"Dashboard view",children:n.map(i=>v.jsx("button",{type:"button",className:"ghost"+(i.id===e?" is-active":""),"aria-pressed":i.id===e,onClick:()=>r(i.id),children:i.label},i.id))})}function Bq(e,t){const[r,n]=R.useState(()=>ph(kl(To,null),kl(dh,null)));R.useEffect(()=>{Promise.all([lh(To),lh(dh)]).then(([h,m])=>{(h!=null||m!=null)&&n(ph(h,m))})},[]);const i=y0(r),a=R.useMemo(()=>yh(r,e,t),[r,e,t]),o=R.useCallback(h=>{n(h),$_(To,h)},[]),s=R.useCallback(h=>{const m=yh(r,e,t),y=h({kpis:{...m.kpis},charts:{...m.charts}});y&&o(U_(r,y))},[r,e,t,o]),u=R.useCallback(h=>o({...r,active:h}),[r,o]),c=R.useCallback((h,m,y)=>s(p=>({...p,[h]:{...p[h],hidden:H_(p[h].hidden,m,y)}})),[s]),f=R.useCallback((h,m,y,p)=>s(x=>{const w=K_(m,x[h].order,y,p);return w===x[h].order?null:{...x,[h]:{...x[h],order:w}}}),[s]),l=R.useCallback(h=>s(m=>({...m,[h]:{hidden:[],order:[]}})),[s]),d=R.useCallback(h=>o({...r,kpisCollapsed:h}),[r,o]);return{layout:r,active:i,body:a,setActive:u,toggle:c,move:f,reset:l,setKpisCollapsed:d}}const u0=ed.map(e=>e.id),c0=Jf.map(e=>e.id),Fq=[null,null,null];function Uq(){const{get:e,set:t,pick:r}=I_(),n=So("/sources",[]),i=So("/models",[]).filter(D=>D!=="<synthetic>"),a=So("/security/summary",null),o=q_(),s=B_(),{layout:u,active:c,body:f,setActive:l,toggle:d,move:h,reset:m,setKpisCollapsed:y}=Bq(u0,c0),p=new Set(f.charts.hidden),x=e("models").split(",").filter(Boolean),w=x.length?x:i,O=r(["source","from","to","bucket","models"]),_=O.toString()?"?"+O.toString():"",{data:g,loading:b,error:S}=Ao(()=>Promise.all([yn("/dashboard/overview"+_),yn("/dashboard/timeseries"+_),yn("/dashboard/breakdowns"+_)]),[_]),[A,j,k]=g??Fq,E={from:e("from"),to:e("to")},T=Rq.some(D=>!p.has(D)),{data:C,error:$}=Ao(()=>T?yn("/dashboard/time"+_):null,[_,T]),M=qq.some(D=>!p.has(D)),{data:N,error:q}=Ao(()=>M?yn("/dashboard/audit"+_):null,[_,M]);return v.jsxs("div",{children:[v.jsx("h1",{className:"sr-only",children:"Dashboard"}),v.jsxs("div",{className:"filters",children:[v.jsxs("select",{"aria-label":"Filter by source",value:e("source"),onChange:D=>t({source:D.target.value}),children:[v.jsx("option",{value:"",children:"all sources"}),n.map(D=>v.jsxs("option",{value:D.id,children:[D.label," (",D.session_count,")"]},D.id))]}),v.jsx(N_,{label:"Models",options:i.map(D=>({value:D,label:fr(D)})),selected:w,onChange:D=>t({models:D.length===i.length?"":D.join(",")}),reset:{label:"select all",to:i},disabled:fh,tip:fh?"The exported demo serves one pre-computed view, so filters do not apply to it.":"Applies to every chart. Spend, turns and tool calls filter on the model that produced them; anything counted per session counts sessions that used one of these."}),v.jsxs("label",{className:"ctl",children:["from ",v.jsx("input",{type:"date",value:e("from"),onChange:D=>t({from:D.target.value})})]}),v.jsxs("label",{className:"ctl",children:["to ",v.jsx("input",{type:"date",value:e("to"),onChange:D=>t({to:D.target.value})})]}),v.jsxs("select",{"aria-label":"Time bucket",value:e("bucket"),onChange:D=>t({bucket:D.target.value}),children:[v.jsxs("option",{value:"",children:["bucket: auto",j?` (${j.bucket})`:""]}),v.jsx("option",{value:"day",children:"day"}),v.jsx("option",{value:"week",children:"week"}),v.jsx("option",{value:"month",children:"month"})]})]}),v.jsx(jo,{error:S}),v.jsx(jo,{error:$}),v.jsx(jo,{error:q}),b&&v.jsx(D_,{}),A&&!b&&v.jsxs(v.Fragment,{children:[v.jsx(Lq,{active:c,hasCustom:u.custom!=null,onSelect:l}),v.jsxs("section",{className:"dash-strip",children:[v.jsxs("div",{className:"strip-head",children:[v.jsx("h2",{children:"Metrics"}),v.jsxs("div",{className:"strip-actions",children:[v.jsx("button",{type:"button",className:"link-btn","aria-expanded":!u.kpisCollapsed,onClick:()=>y(!u.kpisCollapsed),children:u.kpisCollapsed?"▸ show":"▾ hide"}),v.jsx(s0,{label:"Metrics",items:zi(ed,f.kpis.order),hidden:new Set(f.kpis.hidden),onToggle:(D,F)=>d("kpis",D,F),onMove:(D,F)=>h("kpis",u0,D,F),onReset:()=>m("kpis")})]})]}),!u.kpisCollapsed&&v.jsx(X_,{ctx:{overview:A,bd:k,security:a},layout:f.kpis})]}),v.jsxs("section",{className:"dash-strip",children:[v.jsxs("div",{className:"strip-head",children:[v.jsx("h2",{children:"Charts"}),v.jsx("div",{className:"strip-actions",children:v.jsx(s0,{label:"Charts",items:zi(Jf,f.charts.order),hidden:p,onToggle:(D,F)=>d("charts",D,F),onMove:(D,F)=>h("charts",c0,D,F),onReset:()=>m("charts")})})]}),v.jsx("div",{className:"cards",children:zi(Jf,f.charts.order).map(({id:D,Component:F})=>v.jsx(F,{hidden:p.has(D),ts:j,bd:k,time:C,audit:N,expand:o,drill:s,range:E},D))})]})]})]})}export{Uq as default};
|
|
69
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O_(e,t){if(e){if(typeof e=="string")return Xf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xf(e,t)}}function B2(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function F2(e){if(Array.isArray(e))return Xf(e)}function Xf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Jb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function I(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jb(Object(r),!0).forEach(function(n){H(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function H(e,t,r){return t=S_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S_(e){var t=W2(e,"string");return nn(t)=="symbol"?t:t+""}function W2(e,t){if(nn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(nn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var z2={xAxis:["bottom","top"],yAxis:["left","right"]},U2={width:"100%",height:"100%"},A_={x:0,y:0};function Wi(e){return e}var K2=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},H2=function(t,r,n,i){var a=r.find(function(f){return f&&f.index===n});if(a){if(t==="horizontal")return{x:a.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:a.coordinate};if(t==="centric"){var o=a.coordinate,s=i.radius;return I(I(I({},i),Ie(i.cx,i.cy,s,o)),{},{angle:o,radius:s})}var u=a.coordinate,c=i.angle;return I(I(I({},i),Ie(i.cx,i.cy,u,c)),{},{angle:c,radius:u})}return A_},_o=function(t,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(s,u){var c=u.props.data;return c&&c.length?[].concat(an(s),an(c)):s},[]);return o.length>0?o:t&&t.length&&B(i)&&B(a)?t.slice(i,a+1):[]};function j_(e){return e==="number"?[0,"auto"]:void 0}var Yf=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,s=_o(r,t);return n<0||!a||!a.length||n>=s.length?null:a.reduce(function(u,c){var f,l=(f=c.props.data)!==null&&f!==void 0?f:r;l&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(l=l.slice(t.dataStartIndex,t.dataEndIndex+1));var d;if(o.dataKey&&!o.allowDuplicatedCategory){var h=l===void 0?s:l;d=Ki(h,o.dataKey,i)}else d=l&&l[n]||s[n];return d?[].concat(an(u),[Ow(c,d)]):u},[])},Qb=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=K2(a,n),s=t.orderedTooltipTicks,u=t.tooltipAxis,c=t.tooltipTicks,f=Hk(o,s,c,u);if(f>=0&&c){var l=c[f]&&c[f].value,d=Yf(t,r,f,l),h=H2(n,s,f,a);return{activeTooltipIndex:f,activeLabel:l,activePayload:d,activeCoordinate:h}}return null},G2=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,s=r.stackGroups,u=r.dataStartIndex,c=r.dataEndIndex,f=t.layout,l=t.children,d=t.stackOffset,h=xw(f,a);return n.reduce(function(m,y){var p,x=y.type.defaultProps!==void 0?I(I({},y.type.defaultProps),y.props):y.props,w=x.type,O=x.dataKey,_=x.allowDataOverflow,g=x.allowDuplicatedCategory,b=x.scale,S=x.ticks,A=x.includeHidden,j=x[o];if(m[j])return m;var k=_o(t.data,{graphicalItems:i.filter(function(z){var V,fe=o in z.props?z.props[o]:(V=z.type.defaultProps)===null||V===void 0?void 0:V[o];return fe===j}),dataStartIndex:u,dataEndIndex:c}),E=k.length,T,C,$;b2(x.domain,_,w)&&(T=hf(x.domain,null,_),h&&(w==="number"||b!=="auto")&&($=Cn(k,O,"category")));var M=j_(w);if(!T||T.length===0){var N,q=(N=x.domain)!==null&&N!==void 0?N:M;if(O){if(T=Cn(k,O,w),w==="category"&&h){var D=qO(T);g&&D?(C=T,T=ka(0,E)):g||(T=fg(q,T,y).reduce(function(z,V){return z.indexOf(V)>=0?z:[].concat(an(z),[V])},[]))}else if(w==="category")g?T=T.filter(function(z){return z!==""&&!Q(z)}):T=fg(q,T,y).reduce(function(z,V){return z.indexOf(V)>=0||V===""||Q(V)?z:[].concat(an(z),[V])},[]);else if(w==="number"){var F=Zk(k,i.filter(function(z){var V,fe,be=o in z.props?z.props[o]:(V=z.type.defaultProps)===null||V===void 0?void 0:V[o],Ve="hide"in z.props?z.props.hide:(fe=z.type.defaultProps)===null||fe===void 0?void 0:fe.hide;return be===j&&(A||!Ve)}),O,a,f);F&&(T=F)}h&&(w==="number"||b!=="auto")&&($=Cn(k,O,"category"))}else h?T=ka(0,E):s&&s[j]&&s[j].hasStack&&w==="number"?T=d==="expand"?[0,1]:_w(s[j].stackGroups,u,c):T=bw(k,i.filter(function(z){var V=o in z.props?z.props[o]:z.type.defaultProps[o],fe="hide"in z.props?z.props.hide:z.type.defaultProps.hide;return V===j&&(A||!fe)}),w,f,!0);if(w==="number")T=Gf(l,T,j,a,S),q&&(T=hf(q,T,_));else if(w==="category"&&q){var K=q,G=T.every(function(z){return K.indexOf(z)>=0});G&&(T=K)}}return I(I({},m),{},H({},j,I(I({},x),{},{axisType:a,domain:T,categoricalDomain:$,duplicateDomain:C,originalDomain:(p=x.domain)!==null&&p!==void 0?p:M,isCategorical:h,layout:f})))},{})},V2=function(t,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,s=r.stackGroups,u=r.dataStartIndex,c=r.dataEndIndex,f=t.layout,l=t.children,d=_o(t.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:c}),h=d.length,m=xw(f,a),y=-1;return n.reduce(function(p,x){var w=x.type.defaultProps!==void 0?I(I({},x.type.defaultProps),x.props):x.props,O=w[o],_=j_("number");if(!p[O]){y++;var g;return m?g=ka(0,h):s&&s[O]&&s[O].hasStack?(g=_w(s[O].stackGroups,u,c),g=Gf(l,g,O,a)):(g=hf(_,bw(d,n.filter(function(b){var S,A,j=o in b.props?b.props[o]:(S=b.type.defaultProps)===null||S===void 0?void 0:S[o],k="hide"in b.props?b.props.hide:(A=b.type.defaultProps)===null||A===void 0?void 0:A.hide;return j===O&&!k}),"number",f),i.defaultProps.allowDataOverflow),g=Gf(l,g,O,a)),I(I({},p),{},H({},O,I(I({axisType:a},i.defaultProps),{},{hide:!0,orientation:at(z2,"".concat(a,".").concat(y%2),null),domain:g,originalDomain:_,isCategorical:m,layout:f})))}return p},{})},X2=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,s=r.stackGroups,u=r.dataStartIndex,c=r.dataEndIndex,f=t.children,l="".concat(i,"Id"),d=ot(f,a),h={};return d&&d.length?h=G2(t,{axes:d,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:s,dataStartIndex:u,dataEndIndex:c}):o&&o.length&&(h=V2(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:s,dataStartIndex:u,dataEndIndex:c})),h},Y2=function(t){var r=Wt(t),n=Tt(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:wd(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:xa(r,n)}},e0=function(t){var r=t.children,n=t.defaultShowTooltip,i=Ze(r,Gr),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},Z2=function(t){return!t||!t.length?!1:t.some(function(r){var n=Et(r&&r.type);return n&&n.indexOf("Bar")>=0})},t0=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},J2=function(t,r){var n=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,s=t.yAxisMap,u=s===void 0?{}:s,c=n.width,f=n.height,l=n.children,d=n.margin||{},h=Ze(l,Gr),m=Ze(l,Le),y=Object.keys(u).reduce(function(g,b){var S=u[b],A=S.orientation;return!S.mirror&&!S.hide?I(I({},g),{},H({},A,g[A]+S.width)):g},{left:d.left||0,right:d.right||0}),p=Object.keys(o).reduce(function(g,b){var S=o[b],A=S.orientation;return!S.mirror&&!S.hide?I(I({},g),{},H({},A,at(g,"".concat(A))+S.height)):g},{top:d.top||0,bottom:d.bottom||0}),x=I(I({},p),y),w=x.bottom;h&&(x.bottom+=h.props.height||Gr.defaultProps.height),m&&r&&(x=Xk(x,i,n,r));var O=c-x.left-x.right,_=f-x.top-x.bottom;return I(I({brushBottom:w},x),{},{width:Math.max(O,0),height:Math.max(_,0)})},Q2=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},ah=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,s=o===void 0?["axis"]:o,u=t.axisComponents,c=t.legendContent,f=t.formatAxisMap,l=t.defaultProps,d=function(x,w){var O=w.graphicalItems,_=w.stackGroups,g=w.offset,b=w.updateId,S=w.dataStartIndex,A=w.dataEndIndex,j=x.barSize,k=x.layout,E=x.barGap,T=x.barCategoryGap,C=x.maxBarSize,$=t0(k),M=$.numericAxisName,N=$.cateAxisName,q=Z2(O),D=[];return O.forEach(function(F,K){var G=_o(x.data,{graphicalItems:[F],dataStartIndex:S,dataEndIndex:A}),z=F.type.defaultProps!==void 0?I(I({},F.type.defaultProps),F.props):F.props,V=z.dataKey,fe=z.maxBarSize,be=z["".concat(M,"Id")],Ve=z["".concat(N,"Id")],Jt={},We=u.reduce(function(Qt,er){var Oo=w["".concat(er.axisType,"Map")],uh=z["".concat(er.axisType,"Id")];Oo&&Oo[uh]||er.axisType==="zAxis"||vr();var ch=Oo[uh];return I(I({},Qt),{},H(H({},er.axisType,ch),"".concat(er.axisType,"Ticks"),Tt(ch)))},Jt),W=We[N],Y=We["".concat(N,"Ticks")],J=_&&_[be]&&_[be].hasStack&&cC(F,_[be].stackGroups),L=Et(F.type).indexOf("Bar")>=0,ye=xa(W,Y),te=[],_e=q&&Gk({barSize:j,stackGroups:_,totalSize:Q2(We,N)});if(L){var Oe,ze,Lt=Q(fe)?C:fe,_r=(Oe=(ze=xa(W,Y,!0))!==null&&ze!==void 0?ze:Lt)!==null&&Oe!==void 0?Oe:0;te=Vk({barGap:E,barCategoryGap:T,bandSize:_r!==ye?_r:ye,sizeList:_e[Ve],maxBarSize:Lt}),_r!==ye&&(te=te.map(function(Qt){return I(I({},Qt),{},{position:I(I({},Qt.position),{},{offset:Qt.position.offset-_r/2})})}))}var Pi=F&&F.type&&F.type.getComposedData;Pi&&D.push({props:I(I({},Pi(I(I({},We),{},{displayedData:G,props:x,dataKey:V,item:F,bandSize:ye,barPosition:te,offset:g,stackedData:J,layout:k,dataStartIndex:S,dataEndIndex:A}))),{},H(H(H({key:F.key||"item-".concat(K)},M,We[M]),N,We[N]),"animationId",b)),childIndex:YO(F,x.children),item:F})}),D},h=function(x,w){var O=x.props,_=x.dataStartIndex,g=x.dataEndIndex,b=x.updateId;if(!jp({props:O}))return null;var S=O.children,A=O.layout,j=O.stackOffset,k=O.data,E=O.reverseStackOrder,T=t0(A),C=T.numericAxisName,$=T.cateAxisName,M=ot(S,n),N=oC(k,M,"".concat(C,"Id"),"".concat($,"Id"),j,E),q=u.reduce(function(z,V){var fe="".concat(V.axisType,"Map");return I(I({},z),{},H({},fe,X2(O,I(I({},V),{},{graphicalItems:M,stackGroups:V.axisType===C&&N,dataStartIndex:_,dataEndIndex:g}))))},{}),D=J2(I(I({},q),{},{props:O,graphicalItems:M}),w==null?void 0:w.legendBBox);Object.keys(q).forEach(function(z){q[z]=f(O,q[z],D,z.replace("Map",""),r)});var F=q["".concat($,"Map")],K=Y2(F),G=d(O,I(I({},q),{},{dataStartIndex:_,dataEndIndex:g,updateId:b,graphicalItems:M,stackGroups:N,offset:D}));return I(I({formattedGraphicalItems:G,graphicalItems:M,offset:D,stackGroups:N},K),q)},m=(function(p){function x(w){var O,_,g;return M2(this,x),g=N2(this,x,[w]),H(g,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),H(g,"accessibilityManager",new g2),H(g,"handleLegendBBoxUpdate",function(b){if(b){var S=g.state,A=S.dataStartIndex,j=S.dataEndIndex,k=S.updateId;g.setState(I({legendBBox:b},h({props:g.props,dataStartIndex:A,dataEndIndex:j,updateId:k},I(I({},g.state),{},{legendBBox:b}))))}}),H(g,"handleReceiveSyncEvent",function(b,S,A){if(g.props.syncId===b){if(A===g.eventEmitterSymbol&&typeof g.props.syncMethod!="function")return;g.applySyncEvent(S)}}),H(g,"handleBrushChange",function(b){var S=b.startIndex,A=b.endIndex;if(S!==g.state.dataStartIndex||A!==g.state.dataEndIndex){var j=g.state.updateId;g.setState(function(){return I({dataStartIndex:S,dataEndIndex:A},h({props:g.props,dataStartIndex:S,dataEndIndex:A,updateId:j},g.state))}),g.triggerSyncEvent({dataStartIndex:S,dataEndIndex:A})}}),H(g,"handleMouseEnter",function(b){var S=g.getMouseInfo(b);if(S){var A=I(I({},S),{},{isTooltipActive:!0});g.setState(A),g.triggerSyncEvent(A);var j=g.props.onMouseEnter;X(j)&&j(A,b)}}),H(g,"triggeredAfterMouseMove",function(b){var S=g.getMouseInfo(b),A=S?I(I({},S),{},{isTooltipActive:!0}):{isTooltipActive:!1};g.setState(A),g.triggerSyncEvent(A);var j=g.props.onMouseMove;X(j)&&j(A,b)}),H(g,"handleItemMouseEnter",function(b){g.setState(function(){return{isTooltipActive:!0,activeItem:b,activePayload:b.tooltipPayload,activeCoordinate:b.tooltipPosition||{x:b.cx,y:b.cy}}})}),H(g,"handleItemMouseLeave",function(){g.setState(function(){return{isTooltipActive:!1}})}),H(g,"handleMouseMove",function(b){b.persist(),g.throttleTriggeredAfterMouseMove(b)}),H(g,"handleMouseLeave",function(b){g.throttleTriggeredAfterMouseMove.cancel();var S={isTooltipActive:!1};g.setState(S),g.triggerSyncEvent(S);var A=g.props.onMouseLeave;X(A)&&A(S,b)}),H(g,"handleOuterEvent",function(b){var S=XO(b),A=at(g.props,"".concat(S));if(S&&X(A)){var j,k;/.*touch.*/i.test(S)?k=g.getMouseInfo(b.changedTouches[0]):k=g.getMouseInfo(b),A((j=k)!==null&&j!==void 0?j:{},b)}}),H(g,"handleClick",function(b){var S=g.getMouseInfo(b);if(S){var A=I(I({},S),{},{isTooltipActive:!0});g.setState(A),g.triggerSyncEvent(A);var j=g.props.onClick;X(j)&&j(A,b)}}),H(g,"handleMouseDown",function(b){var S=g.props.onMouseDown;if(X(S)){var A=g.getMouseInfo(b);S(A,b)}}),H(g,"handleMouseUp",function(b){var S=g.props.onMouseUp;if(X(S)){var A=g.getMouseInfo(b);S(A,b)}}),H(g,"handleTouchMove",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.throttleTriggeredAfterMouseMove(b.changedTouches[0])}),H(g,"handleTouchStart",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.handleMouseDown(b.changedTouches[0])}),H(g,"handleTouchEnd",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.handleMouseUp(b.changedTouches[0])}),H(g,"handleDoubleClick",function(b){var S=g.props.onDoubleClick;if(X(S)){var A=g.getMouseInfo(b);S(A,b)}}),H(g,"handleContextMenu",function(b){var S=g.props.onContextMenu;if(X(S)){var A=g.getMouseInfo(b);S(A,b)}}),H(g,"triggerSyncEvent",function(b){g.props.syncId!==void 0&&jl.emit(Pl,g.props.syncId,b,g.eventEmitterSymbol)}),H(g,"applySyncEvent",function(b){var S=g.props,A=S.layout,j=S.syncMethod,k=g.state.updateId,E=b.dataStartIndex,T=b.dataEndIndex;if(b.dataStartIndex!==void 0||b.dataEndIndex!==void 0)g.setState(I({dataStartIndex:E,dataEndIndex:T},h({props:g.props,dataStartIndex:E,dataEndIndex:T,updateId:k},g.state)));else if(b.activeTooltipIndex!==void 0){var C=b.chartX,$=b.chartY,M=b.activeTooltipIndex,N=g.state,q=N.offset,D=N.tooltipTicks;if(!q)return;if(typeof j=="function")M=j(D,b);else if(j==="value"){M=-1;for(var F=0;F<D.length;F++)if(D[F].value===b.activeLabel){M=F;break}}var K=I(I({},q),{},{x:q.left,y:q.top}),G=Math.min(C,K.x+K.width),z=Math.min($,K.y+K.height),V=D[M]&&D[M].value,fe=Yf(g.state,g.props.data,M),be=D[M]?{x:A==="horizontal"?D[M].coordinate:G,y:A==="horizontal"?z:D[M].coordinate}:A_;g.setState(I(I({},b),{},{activeLabel:V,activeCoordinate:be,activePayload:fe,activeTooltipIndex:M}))}else g.setState(b)}),H(g,"renderCursor",function(b){var S,A=g.state,j=A.isTooltipActive,k=A.activeCoordinate,E=A.activePayload,T=A.offset,C=A.activeTooltipIndex,$=A.tooltipAxisBandSize,M=g.getTooltipEventType(),N=(S=b.props.active)!==null&&S!==void 0?S:j,q=g.props.layout,D=b.key||"_recharts-cursor";return P.createElement(A2,{key:D,activeCoordinate:k,activePayload:E,activeTooltipIndex:C,chartName:r,element:b,isActive:N,layout:q,offset:T,tooltipAxisBandSize:$,tooltipEventType:M})}),H(g,"renderPolarAxis",function(b,S,A){var j=at(b,"type.axisType"),k=at(g.state,"".concat(j,"Map")),E=b.type.defaultProps,T=E!==void 0?I(I({},E),b.props):b.props,C=k&&k[T["".concat(j,"Id")]];return R.cloneElement(b,I(I({},C),{},{className:ee(j,C.className),key:b.key||"".concat(S,"-").concat(A),ticks:Tt(C,!0)}))}),H(g,"renderPolarGrid",function(b){var S=b.props,A=S.radialLines,j=S.polarAngles,k=S.polarRadius,E=g.state,T=E.radiusAxisMap,C=E.angleAxisMap,$=Wt(T),M=Wt(C),N=M.cx,q=M.cy,D=M.innerRadius,F=M.outerRadius;return R.cloneElement(b,{polarAngles:Array.isArray(j)?j:Tt(M,!0).map(function(K){return K.coordinate}),polarRadius:Array.isArray(k)?k:Tt($,!0).map(function(K){return K.coordinate}),cx:N,cy:q,innerRadius:D,outerRadius:F,key:b.key||"polar-grid",radialLines:A})}),H(g,"renderLegend",function(){var b=g.state.formattedGraphicalItems,S=g.props,A=S.children,j=S.width,k=S.height,E=g.props.margin||{},T=j-(E.left||0)-(E.right||0),C=mw({children:A,formattedGraphicalItems:b,legendWidth:T,legendContent:c});if(!C)return null;var $=C.item,M=Zb(C,j2);return R.cloneElement($,I(I({},M),{},{chartWidth:j,chartHeight:k,margin:E,onBBoxUpdate:g.handleLegendBBoxUpdate}))}),H(g,"renderTooltip",function(){var b,S=g.props,A=S.children,j=S.accessibilityLayer,k=Ze(A,oe);if(!k)return null;var E=g.state,T=E.isTooltipActive,C=E.activeCoordinate,$=E.activePayload,M=E.activeLabel,N=E.offset,q=(b=k.props.active)!==null&&b!==void 0?b:T;return R.cloneElement(k,{viewBox:I(I({},N),{},{x:N.left,y:N.top}),active:q,label:M,payload:q?$:[],coordinate:C,accessibilityLayer:j})}),H(g,"renderBrush",function(b){var S=g.props,A=S.margin,j=S.data,k=g.state,E=k.offset,T=k.dataStartIndex,C=k.dataEndIndex,$=k.updateId;return R.cloneElement(b,{key:b.key||"_recharts-brush",onChange:Ri(g.handleBrushChange,b.props.onChange),data:j,x:B(b.props.x)?b.props.x:E.left,y:B(b.props.y)?b.props.y:E.top+E.height+E.brushBottom-(A.bottom||0),width:B(b.props.width)?b.props.width:E.width,startIndex:T,endIndex:C,updateId:"brush-".concat($)})}),H(g,"renderReferenceElement",function(b,S,A){if(!b)return null;var j=g,k=j.clipPathId,E=g.state,T=E.xAxisMap,C=E.yAxisMap,$=E.offset,M=b.type.defaultProps||{},N=b.props,q=N.xAxisId,D=q===void 0?M.xAxisId:q,F=N.yAxisId,K=F===void 0?M.yAxisId:F;return R.cloneElement(b,{key:b.key||"".concat(S,"-").concat(A),xAxis:T[D],yAxis:C[K],viewBox:{x:$.left,y:$.top,width:$.width,height:$.height},clipPathId:k})}),H(g,"renderActivePoints",function(b){var S=b.item,A=b.activePoint,j=b.basePoint,k=b.childIndex,E=b.isRange,T=[],C=S.props.key,$=S.item.type.defaultProps!==void 0?I(I({},S.item.type.defaultProps),S.item.props):S.item.props,M=$.activeDot,N=$.dataKey,q=I(I({index:k,dataKey:N,cx:A.x,cy:A.y,r:4,fill:Gd(S.item),strokeWidth:2,stroke:"#fff",payload:A.payload,value:A.value},Z(M,!1)),Hi(M));return T.push(x.renderActiveDot(M,q,"".concat(C,"-activePoint-").concat(k))),j?T.push(x.renderActiveDot(M,I(I({},q),{},{cx:j.x,cy:j.y}),"".concat(C,"-basePoint-").concat(k))):E&&T.push(null),T}),H(g,"renderGraphicChild",function(b,S,A){var j=g.filterFormatItem(b,S,A);if(!j)return null;var k=g.getTooltipEventType(),E=g.state,T=E.isTooltipActive,C=E.tooltipAxis,$=E.activeTooltipIndex,M=E.activeLabel,N=g.props.children,q=Ze(N,oe),D=j.props,F=D.points,K=D.isRange,G=D.baseLine,z=j.item.type.defaultProps!==void 0?I(I({},j.item.type.defaultProps),j.item.props):j.item.props,V=z.activeDot,fe=z.hide,be=z.activeBar,Ve=z.activeShape,Jt=!!(!fe&&T&&q&&(V||be||Ve)),We={};k!=="axis"&&q&&q.props.trigger==="click"?We={onClick:Ri(g.handleItemMouseEnter,b.props.onClick)}:k!=="axis"&&(We={onMouseLeave:Ri(g.handleItemMouseLeave,b.props.onMouseLeave),onMouseEnter:Ri(g.handleItemMouseEnter,b.props.onMouseEnter)});var W=R.cloneElement(b,I(I({},j.props),We));function Y(er){return typeof C.dataKey=="function"?C.dataKey(er.payload):null}if(Jt)if($>=0){var J,L;if(C.dataKey&&!C.allowDuplicatedCategory){var ye=typeof C.dataKey=="function"?Y:"payload.".concat(C.dataKey.toString());J=Ki(F,ye,M),L=K&&G&&Ki(G,ye,M)}else J=F==null?void 0:F[$],L=K&&G&&G[$];if(Ve||be){var te=b.props.activeIndex!==void 0?b.props.activeIndex:$;return[R.cloneElement(b,I(I(I({},j.props),We),{},{activeIndex:te})),null,null]}if(!Q(J))return[W].concat(an(g.renderActivePoints({item:j,activePoint:J,basePoint:L,childIndex:$,isRange:K})))}else{var _e,Oe=(_e=g.getItemByXY(g.state.activeCoordinate))!==null&&_e!==void 0?_e:{graphicalItem:W},ze=Oe.graphicalItem,Lt=ze.item,_r=Lt===void 0?b:Lt,Pi=ze.childIndex,Qt=I(I(I({},j.props),We),{},{activeIndex:Pi});return[R.cloneElement(_r,Qt),null,null]}return K?[W,null,null]:[W,null]}),H(g,"renderCustomized",function(b,S,A){return R.cloneElement(b,I(I({key:"recharts-customized-".concat(A)},g.props),g.state))}),H(g,"renderMap",{CartesianGrid:{handler:Wi,once:!0},ReferenceArea:{handler:g.renderReferenceElement},ReferenceLine:{handler:Wi},ReferenceDot:{handler:g.renderReferenceElement},XAxis:{handler:Wi},YAxis:{handler:Wi},Brush:{handler:g.renderBrush,once:!0},Bar:{handler:g.renderGraphicChild},Line:{handler:g.renderGraphicChild},Area:{handler:g.renderGraphicChild},Radar:{handler:g.renderGraphicChild},RadialBar:{handler:g.renderGraphicChild},Scatter:{handler:g.renderGraphicChild},Pie:{handler:g.renderGraphicChild},Funnel:{handler:g.renderGraphicChild},Tooltip:{handler:g.renderCursor,once:!0},PolarGrid:{handler:g.renderPolarGrid,once:!0},PolarAngleAxis:{handler:g.renderPolarAxis},PolarRadiusAxis:{handler:g.renderPolarAxis},Customized:{handler:g.renderCustomized}}),g.clipPathId="".concat((O=w.id)!==null&&O!==void 0?O:cn("recharts"),"-clip"),g.throttleTriggeredAfterMouseMove=gx(g.triggeredAfterMouseMove,(_=w.throttleDelay)!==null&&_!==void 0?_:1e3/60),g.state={},g}return q2(x,p),I2(x,[{key:"componentDidMount",value:function(){var O,_;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O:0,top:(_=this.props.margin.top)!==null&&_!==void 0?_:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var O=this.props,_=O.children,g=O.data,b=O.height,S=O.layout,A=Ze(_,oe);if(A){var j=A.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var k=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,E=Yf(this.state,g,j,k),T=this.state.tooltipTicks[j].coordinate,C=(this.state.offset.top+b)/2,$=S==="horizontal",M=$?{x:T,y:C}:{y:T,x:C},N=this.state.formattedGraphicalItems.find(function(D){var F=D.item;return F.type.name==="Scatter"});N&&(M=I(I({},M),N.props.points[j].tooltipPosition),E=N.props.points[j].tooltipPayload);var q={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:k,activePayload:E,activeCoordinate:M};this.setState(q),this.renderCursor(A),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(O,_){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==_.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==O.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==O.margin){var g,b;this.accessibilityManager.setDetails({offset:{left:(g=this.props.margin.left)!==null&&g!==void 0?g:0,top:(b=this.props.margin.top)!==null&&b!==void 0?b:0}})}return null}},{key:"componentDidUpdate",value:function(O){Il([Ze(O.children,oe)],[Ze(this.props.children,oe)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var O=Ze(this.props.children,oe);if(O&&typeof O.props.shared=="boolean"){var _=O.props.shared?"axis":"item";return s.indexOf(_)>=0?_:a}return a}},{key:"getMouseInfo",value:function(O){if(!this.container)return null;var _=this.container,g=_.getBoundingClientRect(),b=Dj(g),S={chartX:Math.round(O.pageX-b.left),chartY:Math.round(O.pageY-b.top)},A=g.width/_.offsetWidth||1,j=this.inRange(S.chartX,S.chartY,A);if(!j)return null;var k=this.state,E=k.xAxisMap,T=k.yAxisMap,C=this.getTooltipEventType(),$=Qb(this.state,this.props.data,this.props.layout,j);if(C!=="axis"&&E&&T){var M=Wt(E).scale,N=Wt(T).scale,q=M&&M.invert?M.invert(S.chartX):null,D=N&&N.invert?N.invert(S.chartY):null;return I(I({},S),{},{xValue:q,yValue:D},$)}return $?I(I({},S),$):null}},{key:"inRange",value:function(O,_){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,b=this.props.layout,S=O/g,A=_/g;if(b==="horizontal"||b==="vertical"){var j=this.state.offset,k=S>=j.left&&S<=j.left+j.width&&A>=j.top&&A<=j.top+j.height;return k?{x:S,y:A}:null}var E=this.state,T=E.angleAxisMap,C=E.radiusAxisMap;if(T&&C){var $=Wt(T);return pg({x:S,y:A},$)}return null}},{key:"parseEventsOfWrapper",value:function(){var O=this.props.children,_=this.getTooltipEventType(),g=Ze(O,oe),b={};g&&_==="axis"&&(g.props.trigger==="click"?b={onClick:this.handleClick}:b={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var S=Hi(this.props,this.handleOuterEvent);return I(I({},S),b)}},{key:"addListener",value:function(){jl.on(Pl,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){jl.removeListener(Pl,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(O,_,g){for(var b=this.state.formattedGraphicalItems,S=0,A=b.length;S<A;S++){var j=b[S];if(j.item===O||j.props.key===O.key||_===Et(j.item.type)&&g===j.childIndex)return j}return null}},{key:"renderClipPath",value:function(){var O=this.clipPathId,_=this.state.offset,g=_.left,b=_.top,S=_.height,A=_.width;return P.createElement("defs",null,P.createElement("clipPath",{id:O},P.createElement("rect",{x:g,y:b,height:S,width:A})))}},{key:"getXScales",value:function(){var O=this.state.xAxisMap;return O?Object.entries(O).reduce(function(_,g){var b=Yb(g,2),S=b[0],A=b[1];return I(I({},_),{},H({},S,A.scale))},{}):null}},{key:"getYScales",value:function(){var O=this.state.yAxisMap;return O?Object.entries(O).reduce(function(_,g){var b=Yb(g,2),S=b[0],A=b[1];return I(I({},_),{},H({},S,A.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(O){var _;return(_=this.state.xAxisMap)===null||_===void 0||(_=_[O])===null||_===void 0?void 0:_.scale}},{key:"getYScaleByAxisId",value:function(O){var _;return(_=this.state.yAxisMap)===null||_===void 0||(_=_[O])===null||_===void 0?void 0:_.scale}},{key:"getItemByXY",value:function(O){var _=this.state,g=_.formattedGraphicalItems,b=_.activeItem;if(g&&g.length)for(var S=0,A=g.length;S<A;S++){var j=g[S],k=j.props,E=j.item,T=E.type.defaultProps!==void 0?I(I({},E.type.defaultProps),E.props):E.props,C=Et(E.type);if(C==="Bar"){var $=(k.data||[]).find(function(D){return nI(O,D)});if($)return{graphicalItem:j,payload:$}}else if(C==="RadialBar"){var M=(k.data||[]).find(function(D){return pg(O,D)});if(M)return{graphicalItem:j,payload:M}}else if(vo(j,b)||yo(j,b)||li(j,b)){var N=GI({graphicalItem:j,activeTooltipItem:b,itemData:T.data}),q=T.activeIndex===void 0?N:T.activeIndex;return{graphicalItem:I(I({},j),{},{childIndex:q}),payload:li(j,b)?T.data[N]:j.props.data[N]}}}return null}},{key:"render",value:function(){var O=this;if(!jp(this))return null;var _=this.props,g=_.children,b=_.className,S=_.width,A=_.height,j=_.style,k=_.compact,E=_.title,T=_.desc,C=Zb(_,P2),$=Z(C,!1);if(k)return P.createElement(Eb,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},P.createElement(Dl,Er({},$,{width:S,height:A,title:E,desc:T}),this.renderClipPath(),Tp(g,this.renderMap)));if(this.props.accessibilityLayer){var M,N;$.tabIndex=(M=this.props.tabIndex)!==null&&M!==void 0?M:0,$.role=(N=this.props.role)!==null&&N!==void 0?N:"application",$.onKeyDown=function(D){O.accessibilityManager.keyboardEvent(D)},$.onFocus=function(){O.accessibilityManager.focus()}}var q=this.parseEventsOfWrapper();return P.createElement(Eb,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},P.createElement("div",Er({className:ee("recharts-wrapper",b),style:I({position:"relative",cursor:"default",width:S,height:A},j)},q,{ref:function(F){O.container=F}}),P.createElement(Dl,Er({},$,{width:S,height:A,title:E,desc:T,style:U2}),this.renderClipPath(),Tp(g,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(R.Component);H(m,"displayName",r),H(m,"defaultProps",I({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},l)),H(m,"getDerivedStateFromProps",function(p,x){var w=p.dataKey,O=p.data,_=p.children,g=p.width,b=p.height,S=p.layout,A=p.stackOffset,j=p.margin,k=x.dataStartIndex,E=x.dataEndIndex;if(x.updateId===void 0){var T=e0(p);return I(I(I({},T),{},{updateId:0},h(I(I({props:p},T),{},{updateId:0}),x)),{},{prevDataKey:w,prevData:O,prevWidth:g,prevHeight:b,prevLayout:S,prevStackOffset:A,prevMargin:j,prevChildren:_})}if(w!==x.prevDataKey||O!==x.prevData||g!==x.prevWidth||b!==x.prevHeight||S!==x.prevLayout||A!==x.prevStackOffset||!kr(j,x.prevMargin)){var C=e0(p),$={chartX:x.chartX,chartY:x.chartY,isTooltipActive:x.isTooltipActive},M=I(I({},Qb(x,O,S)),{},{updateId:x.updateId+1}),N=I(I(I({},C),$),M);return I(I(I({},N),h(I({props:p},N),x)),{},{prevDataKey:w,prevData:O,prevWidth:g,prevHeight:b,prevLayout:S,prevStackOffset:A,prevMargin:j,prevChildren:_})}if(!Il(_,x.prevChildren)){var q,D,F,K,G=Ze(_,Gr),z=G&&(q=(D=G.props)===null||D===void 0?void 0:D.startIndex)!==null&&q!==void 0?q:k,V=G&&(F=(K=G.props)===null||K===void 0?void 0:K.endIndex)!==null&&F!==void 0?F:E,fe=z!==k||V!==E,be=!Q(O),Ve=be&&!fe?x.updateId:x.updateId+1;return I(I({updateId:Ve},h(I(I({props:p},x),{},{updateId:Ve,dataStartIndex:z,dataEndIndex:V}),x)),{},{prevChildren:_,dataStartIndex:z,dataEndIndex:V})}return null}),H(m,"renderActiveDot",function(p,x,w){var O;return R.isValidElement(p)?O=R.cloneElement(p,x):X(p)?O=p(x):O=P.createElement(po,x),P.createElement(ce,{className:"recharts-active-dot",key:w},O)});var y=R.forwardRef(function(x,w){return P.createElement(m,Er({},x,{ref:w}))});return y.displayName=m.displayName,y},Ai=ah({chartName:"LineChart",GraphicalChild:ut,axisComponents:[{axisType:"xAxis",AxisComp:Ce},{axisType:"yAxis",AxisComp:ve}],formatAxisMap:Xd}),Zt=ah({chartName:"BarChart",GraphicalChild:pe,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ce},{axisType:"yAxis",AxisComp:ve}],formatAxisMap:Xd}),oh=ah({chartName:"AreaChart",GraphicalChild:Ke,axisComponents:[{axisType:"xAxis",AxisComp:Ce},{axisType:"yAxis",AxisComp:ve}],formatAxisMap:Xd});function lt(e,t){if(e!=="count")return{value:e.toUpperCase(),position:"insideTopLeft",offset:0,dy:-19,dx:2,fill:t,fontSize:9.5,letterSpacing:.7,fillOpacity:.75}}const Fe={top:30,right:8,left:0,bottom:0},eq=6,ji=36;function sh(e){const t=R.useRef(null),[r,n]=R.useState(0);return R.useEffect(()=>{if(!t.current||typeof ResizeObserver>"u")return;const i=new ResizeObserver(([a])=>n(a.contentRect.width));return i.observe(t.current),()=>i.disconnect()},[]),[t,r===0||e*eq<=r-ji]}function vn({data:e,left:t=24,top:r=4,xAxisProps:n,yAxis:i,children:a}){const{axisProps:o,gridProps:s}=ge();return v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:e,layout:"vertical",margin:{top:r,right:8,left:t,bottom:0},children:[v.jsx(Ge,{...s,horizontal:!1}),v.jsx(Ce,{type:"number",...o,...n}),i,a]})})}function tq(e,t=[1e3,1e5]){const r=e.filter(s=>Number.isFinite(s)&&s>0),[n,i]=r.length?[10**Math.floor(Math.log10(Math.min(...r))),10**Math.ceil(Math.log10(Math.max(...r)))]:t,a=Math.max(i,n*10),o=[];for(let s=n;s<=a;s*=10)o.push(s);return{domain:[n,a],ticks:o}}function rq({hidden:e,ts:t}){const{C:r,TOKEN_COLORS:n,axisProps:i,gridProps:a,tooltipStyle:o}=ge(),[s,u]=R.useState(new Set),c=f=>u(l=>{const d=new Set(l);return d.has(f)?d.delete(f):d.add(f),d});return v.jsx(Pe,{title:"Tokens over time",hint:"input · output · cache-write · cache-read (kept separate)",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Total tokens per bucket, stacked by kind. Click a legend entry to hide that series and let the others use the full scale."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month, chosen from the range (the picker above overrides it)."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"tokens."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Cache reads usually dominate."})," They are an order of magnitude larger than everything else and cost a fraction as much, so hide that series to read the rest."]}),v.jsx("p",{children:"Buckets by the session's start, so a long session's tokens all land in the bucket it began."})]}),hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(oh,{data:(t==null?void 0:t.series)??[],margin:Fe,children:[v.jsx(Ge,{...a}),v.jsx(Ce,{dataKey:"bucket",...i,minTickGap:24}),v.jsx(ve,{...i,tickFormatter:f=>yt(f),width:48,label:lt("tokens",r.muted)}),v.jsx(oe,{...o,formatter:(f,l)=>[`${yt(Number(f))} tokens`,l]}),v.jsx(Le,{wrapperStyle:{fontSize:12,cursor:"pointer"},onClick:f=>(f==null?void 0:f.dataKey)&&c(String(f.dataKey)),formatter:(f,l)=>v.jsx("span",{style:{opacity:s.has(String(l==null?void 0:l.dataKey))?.4:1},children:f})}),v.jsx(Ke,{type:"monotone",dataKey:"input",hide:s.has("input"),stackId:"1",stroke:n.input,fill:n.input,fillOpacity:.5}),v.jsx(Ke,{type:"monotone",dataKey:"output",hide:s.has("output"),stackId:"1",stroke:n.output,fill:n.output,fillOpacity:.5}),v.jsx(Ke,{type:"monotone",dataKey:"cache_creation",hide:s.has("cache_creation"),stackId:"1",stroke:n.cache_creation,fill:n.cache_creation,fillOpacity:.5}),v.jsx(Ke,{type:"monotone",dataKey:"cache_read",hide:s.has("cache_read"),stackId:"1",stroke:n.cache_read,fill:n.cache_read,fillOpacity:.35})]})})})}function nq({hidden:e,ts:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge();return v.jsx(Pe,{title:"Cost over time",hint:"API list price estimate, model × tokens (cache-aware)",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"What the tokens in each bucket would have cost at API list prices."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"US dollars, estimated."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"An estimate, and a lower bound."}),` It prices each model's tokens at public list rates with cache reads charged at their reduced rate — it is not your bill, and it knows nothing about subscription plans. Models with no known price contribute zero and are named in the "unpriced models" metric rather than being silently counted as free.`]})]}),hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Ai,{data:(t==null?void 0:t.series)??[],margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"bucket",...n,minTickGap:24}),v.jsx(ve,{...n,tickFormatter:o=>"$"+o,width:48,label:lt("USD (est.)",r.muted)}),v.jsx(oe,{...a,formatter:o=>Nn(Number(o))}),v.jsx(ut,{type:"monotone",dataKey:"cost",stroke:r.red,strokeWidth:2,dot:!1})]})})})}function iq({hidden:e,ts:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=(t==null?void 0:t.series)??[],[s,u]=sh(o.length),c=v.jsxs(v.Fragment,{children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"bucket",...n,minTickGap:24}),v.jsx(ve,{...n,width:ji,label:lt("count",r.muted)}),v.jsx(oe,{...a}),v.jsx(Le,{wrapperStyle:{fontSize:12}})]});return v.jsx(Pe,{title:"Activity over time",hint:"sessions & turns per bucket",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How much work happened in each bucket, by count rather than by size."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsxs("dd",{children:["count. ",v.jsx("strong",{children:"sessions"})," = sessions that started in the bucket, subagent runs included; ",v.jsx("strong",{children:"turns"})," = prompt-and-response exchanges within them."]})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Under a model filter this counts whole sessions, not model-attributable rows."})," ","A session has no single model, so it is counted here whenever it used any model you ticked — including the work it did with the others. That is why a session count and a token total move by different amounts when you untick a model."]}),v.jsx("p",{children:"Bars become lines once the range holds more buckets than can be drawn as readable bars."})]}),hidden:e,children:v.jsx("div",{ref:s,style:{width:"100%",height:"100%"},children:v.jsx(Qe,{width:"100%",height:"100%",children:u?v.jsxs(Zt,{data:o,margin:Fe,children:[c,v.jsx(pe,{dataKey:"sessions",fill:r.accent}),v.jsx(pe,{dataKey:"turns",fill:r.green})]}):v.jsxs(Ai,{data:o,margin:Fe,children:[c,v.jsx(ut,{dataKey:"sessions",stroke:r.accent,strokeWidth:2,dot:!1}),v.jsx(ut,{dataKey:"turns",stroke:r.green,strokeWidth:2,dot:!1})]})})})})}function aq({hidden:e,ts:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=(t==null?void 0:t.series)??[],[s,u]=sh(o.length),c=v.jsxs(v.Fragment,{children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"bucket",...n,minTickGap:24}),v.jsx(ve,{...n,width:ji,allowDecimals:!1,label:lt("errored calls",r.muted)}),v.jsx(oe,{...a}),v.jsx(Le,{wrapperStyle:{fontSize:12}})]});return v.jsx(Pe,{title:"Tool errors over time",hint:"failed tool calls per bucket · rejections/blocks kept separate (not agent failures)",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Tool calls that came back as errors, stacked by kind."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"count of errored tool calls."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"failures"})," are the agent's — a bad edit, a command that did not run.",v.jsx("strong",{children:" rejected/blocked"})," are yours or a guardrail's: you declined a permission prompt, or a rule stopped it. They are kept apart because a rejection is the system working."]}),v.jsx("p",{children:"The split is a heuristic over the tool's result text, so treat the two totals as indicative and the combined count as exact."})]}),hidden:e,children:v.jsx("div",{ref:s,style:{width:"100%",height:"100%"},children:v.jsx(Qe,{width:"100%",height:"100%",children:u?v.jsxs(Zt,{data:o,margin:Fe,children:[c,v.jsx(pe,{dataKey:"failures",name:"failures",stackId:"e",fill:r.red}),v.jsx(pe,{dataKey:"rejections",name:"rejected/blocked",stackId:"e",fill:r.muted})]}):v.jsxs(oh,{data:o,margin:Fe,children:[c,v.jsx(Ke,{dataKey:"failures",name:"failures",stackId:"e",stroke:"none",fill:r.red,fillOpacity:1}),v.jsx(Ke,{dataKey:"rejections",name:"rejected/blocked",stackId:"e",stroke:"none",fill:r.muted,fillOpacity:1})]})})})})}const oq=["trivial","small","medium","large","xl"];function sq({hidden:e,bd:t,expand:r,drill:n}){var c;const{C:i,tooltipStyle:a,axisProps:o}=ge(),s=(((c=t==null?void 0:t.error_types)==null?void 0:c.by_type)??[]).map(f=>({name:f.type,n:f.n,kind:f.kind})),u=r.topN(s,"errors");return v.jsx(Pe,{title:"Error types",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which kinds of tool error occurred, ranked by count. Click a bar to open the sessions behind it."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"number of errored tool calls of that type."})]}),v.jsxs("p",{children:["The type buckets are a ",v.jsx("strong",{children:"heuristic over the tool's result text"}),": the totals are exact, the labels best-effort. Rejections and guardrail blocks are counted separately because they are not agent failures."]})]}),hint:"heuristic buckets from the tool result text · rejections/blocks are not agent failures · click a bar for those sessions",actions:r.expandBtn("errors",s.length),bodyHeight:r.expandHeight("errors",s.length,28),hidden:e,children:t&&s.length===0?v.jsx("div",{className:"empty",children:"No errored tool calls in range."}):v.jsxs(vn,{data:u,xAxisProps:{allowDecimals:!1},yAxis:v.jsx(ve,{type:"category",dataKey:"name",...o,width:130,tick:f=>v.jsx(Qf,{...f,title:"click to filter sessions",onSelect:l=>n.drillFilter("error_type",l)})}),children:[v.jsx(oe,{...a,formatter:(f,l,d)=>{var h;return[`${f} (${(h=d.payload)==null?void 0:h.kind})`,"count"]}}),v.jsx(pe,{dataKey:"n",cursor:"pointer",onClick:n.drillTo("error_type","name"),children:u.map((f,l)=>v.jsx(bi,{fill:f.kind==="rejection"?i.muted:i.red},l))})]})})}function uq({hidden:e,bd:t,drill:r}){const{PALETTE:n,tooltipStyle:i,axisProps:a}=ge(),[o,s]=R.useState("tokens"),u=((t==null?void 0:t.by_model)??[]).map(c=>({name:fr(c.model),model:c.model,tokens:c.total_tokens,cost:c.cost}));return v.jsx(Pe,{title:"Tokens by model",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which models the tokens went to. Switch between tokens and estimated cost — the ranking often differs, because models are priced very differently."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"tokens, or estimated US dollars at API list prices, depending on the toggle."})]}),v.jsx("p",{children:"Counts both main and subagent sessions: a subagent's tokens come off the same quota. Click a bar to open that model's sessions."})]}),hint:"click a bar for those sessions",hidden:e,actions:v.jsxs("span",{className:"seg",role:"group","aria-label":"Metric",children:[v.jsx("button",{type:"button",className:o==="tokens"?"on":"",onClick:()=>s("tokens"),children:"tokens"}),v.jsx("button",{type:"button",className:o==="cost"?"on":"",onClick:()=>s("cost"),children:"cost"})]}),children:v.jsxs(vn,{data:u,top:8,xAxisProps:{tickFormatter:c=>o==="cost"?Nn(Number(c)):yt(c)},yAxis:v.jsx(ve,{type:"category",dataKey:"name",...a,width:120,tick:c=>v.jsx(Qf,{...c,title:"click to filter sessions",onSelect:f=>{var l;return r.drillFilter("model",(l=u.find(d=>d.name===f))==null?void 0:l.model)}})}),children:[v.jsx(oe,{...i,formatter:(c,f,l)=>{var d,h;return[`${yt(Number((d=l.payload)==null?void 0:d.tokens))} · ${Nn(Number((h=l.payload)==null?void 0:h.cost))}`,o]}}),v.jsx(pe,{dataKey:o,cursor:"pointer",onClick:r.drillTo("model","model"),children:u.map((c,f)=>v.jsx(bi,{fill:n[f%n.length]},f))})]})})}function cq({hidden:e,bd:t}){const{PALETTE:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=((t==null?void 0:t.by_category)??[]).map(s=>({name:s.category,value:s.n}));return v.jsx(Pe,{title:"Category distribution",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"What kind of work the sessions were, as judged by the classifier."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"category — feature, bugfix, refactor, docs, ops, chore, review."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"number of sessions."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Under a model filter this counts whole sessions, not model-attributable rows."})," ","A session has no single model, so it is counted here whenever it used any model you ticked — including the work it did with the others. That is why a session count and a token total move by different amounts when you untick a model."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Main sessions only"}),": subagents inherit their parent's task and would multiply-count it. The label is inferred from the transcript rather than declared by you, so read it as a rough shape, not a ledger."]})]}),hint:"main sessions only",hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:o,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"name",...n}),v.jsx(ve,{...n,width:36,allowDecimals:!1,label:lt("sessions",n.stroke)}),v.jsx(oe,{...a}),v.jsx(pe,{dataKey:"value",children:o.map((s,u)=>v.jsx(bi,{fill:r[u%r.length]},u))})]})})})}function lq({hidden:e,bd:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=oq.map(s=>{var u;return{name:s,value:((u=t==null?void 0:t.by_complexity.find(c=>c.band===s))==null?void 0:u.n)??0}}).filter(s=>s.value>0);return v.jsx(Pe,{title:"Complexity bands",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How involved each session was, banded by a score over signals like turn count, tools used and files touched."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"band — trivial, small, medium, large, xl."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"number of sessions."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Under a model filter this counts whole sessions, not model-attributable rows."})," ","A session has no single model, so it is counted here whenever it used any model you ticked — including the work it did with the others. That is why a session count and a token total move by different amounts when you untick a model."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Main sessions only."})," Most sessions landing in the lower bands is the real shape of the corpus, not a bug. Complexity measures effort spent — not difficulty, and not quality."]})]}),hint:"main sessions only",hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:o,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"name",...n}),v.jsx(ve,{...n,width:36,allowDecimals:!1,label:lt("sessions",n.stroke)}),v.jsx(oe,{...a}),v.jsx(pe,{dataKey:"value",fill:r.violet})]})})})}function fq({hidden:e,bd:t,expand:r}){const{C:n,tooltipStyle:i,axisProps:a}=ge(),o=(t==null?void 0:t.tools.length)??0;return v.jsx(Pe,{title:"Tool frequency",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which tools the agent reached for most."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"number of calls to that tool."})]}),v.jsx("p",{children:'Every call counts, successful or not, across both main and subagent sessions. "show all" opens the full list beyond the top few.'})]}),hint:"top tools by call count",actions:r.expandBtn("tools",o),bodyHeight:r.expandHeight("tools",o,22),hidden:e,children:v.jsxs(vn,{data:r.topN((t==null?void 0:t.tools)??[],"tools"),yAxis:v.jsx(ve,{type:"category",dataKey:"name",...a,width:110}),children:[v.jsx(oe,{...i}),v.jsx(pe,{dataKey:"n",fill:n.teal})]})})}function dq({hidden:e,bd:t,expand:r}){const{C:n,axisProps:i}=ge(),a=l0(),o=(t==null?void 0:t.skills.length)??0,s=new Map;for(const u of(t==null?void 0:t.skill_versions)??[]){const c=s.get(u.name)??[];c.push(u),s.set(u.name,c)}return v.jsx(Pe,{title:"Skill activation",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which skills actually fired, ranked by how often."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"number of activations, with every version of a skill grouped together."})]}),v.jsx("p",{children:"Hover a bar for the per-version split, click one to open that skill. A skill that is installed but never invoked does not appear at all."})]}),hint:"firings per skill (all versions grouped) · hover for versions · click to open",actions:r.expandBtn("skills",o),bodyHeight:r.expandHeight("skills",o,22),hidden:e,children:t&&t.skills.length===0?v.jsxs("div",{className:"empty",children:["No ",v.jsx("code",{children:"Skill"})," tool calls in range. Skill usage is captured from ",v.jsx("code",{children:"input.skill"}),"; this fills in once skills are actually invoked in collected sessions."]}):v.jsxs(vn,{data:r.topN((t==null?void 0:t.skills)??[],"skills"),yAxis:v.jsx(ve,{type:"category",dataKey:"name",...i,width:140,tick:u=>v.jsx(Qf,{...u,title:"click to open skill",onSelect:c=>c&&a(`/skill/${encodeURIComponent(c)}`)})}),children:[v.jsx(oe,{cursor:{fill:n.border,fillOpacity:.25},content:v.jsx(L_,{versionsByName:s})}),v.jsx(pe,{dataKey:"n",fill:n.gold,cursor:"pointer",onClick:u=>{const c=f0(u,"name");c&&a(`/skill/${encodeURIComponent(c)}`)}})]})})}function hq({hidden:e,bd:t,expand:r}){const{C:n,tooltipStyle:i,axisProps:a}=ge(),o=(t==null?void 0:t.subagent_fanout.by_type.length)??0;return v.jsx(Pe,{title:"Subagent fan-out",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Which kinds of subagent got spawned, and how often."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"number of spawns of that agent type."})]}),v.jsxs("p",{children:["Counted from the spawning side and ",v.jsx("strong",{children:"main sessions only"}),", so a subagent that spawns its own children cannot inflate the total. The subtitle carries the per-session average and the busiest single session."]})]}),hint:t?`${t.subagent_fanout.total_spawns} spawns · ${t.subagent_fanout.sessions_with_subagents} sessions · avg ${t.subagent_fanout.avg_per_session}, max ${t.subagent_fanout.max_per_session}`:void 0,actions:r.expandBtn("subagents",o),bodyHeight:r.expandHeight("subagents",o,28),hidden:e,children:t&&o===0?v.jsx("div",{className:"empty",children:"No subagents spawned in range."}):v.jsxs(vn,{data:r.topN((t==null?void 0:t.subagent_fanout.by_type)??[],"subagents"),yAxis:v.jsx(ve,{type:"category",dataKey:"type",...a,width:120}),children:[v.jsx(oe,{...i}),v.jsx(pe,{dataKey:"n",fill:n.accent})]})})}const pq="dashboard.timezone";function P_(e){const t=kl(pq,null);if(t)return t;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}const vq=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r0=new Map;function yq(e){let t=r0.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit"}),r0.set(e,t)),t}function T_(e,t){const r=Date.parse(e+":00:00Z");if(Number.isNaN(r))return null;const n=yq(t).formatToParts(new Date(r)),i=f=>{var l;return((l=n.find(d=>d.type===f))==null?void 0:l.value)??""},a=vq.indexOf(i("weekday")),o=Number(i("hour")),[s,u,c]=[i("year"),i("month"),i("day")];return a<0||!Number.isFinite(o)||!s||!u||!c?null:{weekday:a,hour:o%24,dayKey:`${s}-${u}-${c}`}}function In(e,t=new Date){var r;try{return((r=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"}).formatToParts(t).find(i=>i.type==="timeZoneName"))==null?void 0:r.value)??e}catch{return e}}function mq(e,t){return e?t==="tokens"?e.burn_hours.map(r=>({hour:r.hour,value:r.work})):e.turn_hours.map(r=>({hour:r.hour,value:r.turns})):[]}function n0(e,t){const r=Date.parse(`${e}T00:00:00Z`),n=Date.parse(`${t}T00:00:00Z`),i=new Array(7).fill(0);if(!Number.isFinite(r)||!Number.isFinite(n)||n<r)return i;const a=Math.round((n-r)/864e5)+1;i.fill(Math.floor(a/7));const o=new Date(r).getUTCDay();for(let s=0;s<a%7;s++)i[(o+s)%7]++;return i}function gq(e,t,r){var f;const n=new Map,i=new Map;let a=null,o=null;for(const l of e){const d=T_(l.hour,t);if(!d)continue;(a===null||d.dayKey<a)&&(a=d.dayKey),(o===null||d.dayKey>o)&&(o=d.dayKey);const h=`${d.weekday}:${d.hour}`;n.set(h,(n.get(h)??0)+l.value),l.value>0&&(i.get(h)??i.set(h,new Set).get(h)).add(d.dayKey)}let s=r!=null&&r.from&&(r!=null&&r.to)?n0(r.from,r.to):[];s.some(l=>l>0)||(s=a&&o?n0(a,o):new Array(7).fill(0));const u=[];let c=0;for(let l=0;l<7;l++){const d=s[l];for(let h=0;h<24;h++){const m=n.get(`${l}:${h}`)??0,y=d?m/d:0;y>c&&(c=y),u.push({weekday:l,hour:h,mean:y,total:m,observed:((f=i.get(`${l}:${h}`))==null?void 0:f.size)??0,days:d})}}return{cells:u,max:c}}function bq(e,t,r){if(e<=0||t<=0)return null;const n=Math.min(1,e/t);return r==="sqrt"?Math.sqrt(n):n}function xq(e,t,r){const n=(a,o)=>parseInt(a.slice(1+o*2,3+o*2),16);return`#${[0,1,2].map(a=>Math.round(n(e,a)+(n(t,a)-n(e,a))*r)).map(a=>a.toString(16).padStart(2,"0")).join("")}`}function wq(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];const r=Math.max(0,Math.min(1,e))*(t.length-1),n=Math.min(t.length-2,Math.floor(r));return xq(t[n],t[n+1],r-n)}function _q(e,t,r=5){return e<=0?[]:Array.from({length:r},(n,i)=>{const a=i/(r-1);return[a,t==="sqrt"?a**2*e:a*e]})}function Oq(e,t){return t==="day"?e:t==="month"?e.slice(0,7):Aq(e)}function Sq(e,t,r){const n=new Map,i=new Set;for(const o of e){const s=T_(o.hour,t);if(!s)continue;const u=o.source??"(unassigned)";i.add(u);const c=Oq(s.dayKey,r),f=n.get(c)??{};f[u]=(f[u]??0)+o.work,n.set(c,f)}return{points:[...n.entries()].sort((o,s)=>o[0].localeCompare(s[0])).map(([o,s])=>({bucket:o,bySource:s})),sources:[...i].sort()}}function Aq(e){const[t,r,n]=e.split("-").map(Number),i=new Date(Date.UTC(t,r-1,n)),a=(i.getUTCDay()+6)%7;i.setUTCDate(i.getUTCDate()-a+3);const o=i.getTime(),s=new Date(Date.UTC(i.getUTCFullYear(),0,1)),u=1+Math.round((o-s.getTime())/6048e5-((s.getUTCDay()+6)%7>3?-1:0));return`${i.getUTCFullYear()}-W${String(u).padStart(2,"0")}`}const El=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],jq=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Pq=4,i0=100,E_=e=>t=>v.jsx("span",{style:{color:e},children:t});function Tq({hidden:e,time:t,range:r}){const{BURN_RAMP:n,C:i}=ge(),a=P_(),[o,s]=R.useState("turns"),u=o==="tokens",c=R.useMemo(()=>mq(t,o),[t,o]),{cells:f,max:l}=R.useMemo(()=>gq(c,a,r),[c,a,r.from,r.to]),[d,h]=R.useState(null),m=u?0:l<2?2:1,y=_=>u?yt(Math.round(_)):_.toFixed(m),p=u?"work tokens":"turns",x=u?"sqrt":"linear",w=[i.panel2,...n],O=`linear-gradient(to right, ${w.join(", ")})`;return v.jsx(Pe,{title:"When work happens",hint:`mean ${p} per weekday × hour, ${In(a)}`,guide:v.jsxs(v.Fragment,{children:[v.jsxs("p",{children:["Each cell is one hour of one weekday. Darker means more ",p," in that hour on a typical day — hover any cell for its exact figure."]}),v.jsxs("dl",{children:[v.jsx("dt",{children:"rows / columns"}),v.jsxs("dd",{children:["weekday (Sun–Sat) × hour of day, 0–23, in ",In(a)," — your own clock."]}),v.jsx("dt",{children:"cell value"}),v.jsxs("dd",{children:["mean ",u?v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"work tokens"})," (input + output + cache-write; cache reads excluded)"]}):v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"turns started"})," — one turn is one prompt and its answer"]})," ","per ",v.jsx("strong",{children:"calendar"})," occurrence of that weekday in range — a weekday you did not work is a zero, not a missing day, and a range ending mid-week does not read as a quiet Thursday."]}),v.jsx("dt",{children:"which sessions"}),v.jsx("dd",{children:u?"Both populations: a subagent's tokens come off the same quota.":"Main sessions only — a turn is a person sitting down to prompt, and a subagent has nobody in it."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Turns and tokens do not draw the same picture, and the difference is the point."})," ","Tokens per hour are unbounded: one 12-minute fan-out of subagents can burn more than a month of evenings, so a one-off lands in the same colour as a habit. A turn count is bounded per hour, so a cell tracks how ",v.jsx("em",{children:"often"})," that hour is worked. Switch to tokens when you want the spend rather than the rhythm."]}),v.jsxs("p",{children:["Bucketed by when the work happened — the usage event's own timestamp, or the turn's start — not by its session's start, so its totals deliberately"," ",v.jsx("strong",{children:'do not match "Tokens over time"'}),", which buckets by session."]}),v.jsx("p",{children:"It shows when work happened. It says nothing about whether that was a good time for it."})]}),hidden:e,actions:v.jsxs("span",{className:"seg",role:"group","aria-label":"Metric",children:[v.jsx("button",{type:"button",className:o==="turns"?"on":"",onClick:()=>s("turns"),children:"turns"}),v.jsx("button",{type:"button",className:u?"on":"",onClick:()=>s("tokens"),children:"tokens"})]}),children:_=>t&&l===0?v.jsxs("div",{className:"empty",children:["No ",p," in range."]}):v.jsxs("div",{className:_?"burn burn-lg":"burn",children:[v.jsxs("div",{className:"burn-grid",role:"img","aria-label":`Mean ${p} by weekday and hour, ${In(a)}`,children:[El.map((g,b)=>v.jsxs("div",{className:"burn-row",children:[v.jsx("span",{className:"burn-day",children:g}),f.filter(S=>S.weekday===b).map(S=>{const A=bq(S.mean,l,x);return v.jsx("i",{className:"burn-cell",style:{background:A===null?i.panel2:wq(A,w)},onPointerEnter:j=>{const k=j.currentTarget.getBoundingClientRect(),E=j.currentTarget.closest(".burn").getBoundingClientRect();h({cell:S,x:k.left-E.left+k.width/2,y:k.top-E.top})},onPointerLeave:()=>h(null)},S.hour)})]},g)),v.jsxs("div",{className:"burn-row burn-hours",children:[v.jsx("span",{className:"burn-day"}),Array.from({length:24},(g,b)=>v.jsx("i",{className:"burn-tick",children:b%(_?2:6)===0?b:""},b))]})]}),v.jsxs("div",{className:"burn-legend",children:[v.jsxs("span",{className:"burn-legend-cap",children:[p," per hour"]}),v.jsx("div",{className:"burn-bar",style:{background:O}}),v.jsx("div",{className:"burn-ticks",children:_q(l,x).map(([g,b])=>v.jsx("span",{style:{left:`${g*100}%`},children:y(b)},g))})]}),d&&v.jsxs("div",{className:"burn-tip",style:{top:Math.max(0,d.y-46),...d.x>210?{right:0}:{left:Math.max(0,d.x-60)}},"aria-hidden":"true",children:[v.jsxs("div",{className:"burn-tip-head",children:[El[d.cell.weekday]," ",String(d.cell.hour).padStart(2,"0"),":00"]}),v.jsxs("div",{className:"burn-tip-row",children:[y(d.cell.mean)," ",p," · average ",El[d.cell.weekday]]}),v.jsxs("div",{className:"burn-tip-row burn-tip-support",children:["on ",d.cell.observed," of ",d.cell.days," ",jq[d.cell.weekday],d.cell.days===1?"":"s"]})]})]})})}function Eq({hidden:e,ts:t,time:r}){const{C:n,PALETTE:i,axisProps:a,gridProps:o,tooltipStyle:s}=ge(),u=P_(),c=(t==null?void 0:t.bucket)??"week",{points:f,sources:l}=R.useMemo(()=>Sq((r==null?void 0:r.burn_hours)??[],u,c),[r,u,c]),d=f.map(h=>({bucket:h.bucket,...h.bySource}));return v.jsx(Pe,{title:"Burn by source",hint:`work tokens per local ${c}, ${In(u)}`,guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How much each account spent over time. Use it to compare the sources, and to spot a bucket that broke the pattern."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsxs("dd",{children:["local ",c,", in ",In(u)," — it follows the dashboard's bucket control, so switching to ",v.jsx("em",{children:"day"})," shows each source's shape where a month would flatten it."]}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"work tokens — input + output + cache-write, summed over the bucket. Cache reads are excluded."}),v.jsx("dt",{children:"one line per source"}),v.jsxs("dd",{children:["Sources are ",v.jsx("strong",{children:"never added together"}),": they are separate accounts with genuinely different usage profiles, and a combined line would hide the only thing this chart is for."]})]}),v.jsx("p",{children:"The first and last buckets are usually partial, so their dip is the range boundary, not a change in behaviour."}),v.jsxs("p",{children:["These totals ",v.jsx("strong",{children:'deliberately do not match "Tokens over time"'})," even at the same bucket: this chart places tokens by ",v.jsx("em",{children:"when they were spent"}),", that one by the start of the session that spent them, so a session straddling a boundary lands differently in each."]})]}),hidden:e,children:r&&!d.length?v.jsx("div",{className:"empty",children:"No token usage in range."}):v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Ai,{data:d,margin:Fe,children:[v.jsx(Ge,{...o}),v.jsx(Ce,{dataKey:"bucket",...a,minTickGap:24}),v.jsx(ve,{...a,tickFormatter:h=>yt(h),width:48,label:lt("work tokens",n.muted)}),v.jsx(oe,{...s,formatter:(h,m)=>[`${yt(Number(h))} tokens`,m]}),l.length>1&&v.jsx(Le,{wrapperStyle:{fontSize:12},formatter:E_(n.muted)}),l.map((h,m)=>v.jsx(ut,{type:"monotone",dataKey:h,stroke:i[m%i.length],strokeWidth:2,dot:!1},h))]})})})}function a0(e){if(e<=0)return"0";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4){const t=e/1e3;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}s`}return`${(e/6e4).toFixed(1).replace(/\.0$/,"")}m`}function kq({models:e,colorFor:t,shows:r,onToggle:n,muted:i}){const a=(o,s)=>v.jsx("svg",{width:"18",height:"8","aria-hidden":"true",style:{flex:"none"},children:v.jsx("line",{x1:"0",y1:"4",x2:"18",y2:"4",stroke:o,strokeWidth:"2",strokeDasharray:s?"4 3":void 0})});return v.jsxs("div",{className:"lat-legend",children:[e.map(o=>{const s=r(o);return v.jsxs("button",{type:"button",className:"lat-chip","aria-pressed":s,onClick:()=>n(o,!s),"data-tip":`${s?"Hide":"Show"} ${fr(o)}`,style:{opacity:s?1:.4},children:[a(t(o)),v.jsx("span",{style:{color:i},children:fr(o)})]},o)}),v.jsxs("span",{className:"lat-key",style:{color:i},children:[a(i)," p50 ",a(i,!0)," p90"]})]})}function Cq({hidden:e,time:t}){const{C:r,PALETTE:n,axisProps:i,gridProps:a,tooltipStyle:o}=ge(),s=(t==null?void 0:t.latency.bucket)??"week",[u,c]=R.useState(new Map),f=(_,g)=>c(b=>new Map(b).set(_,g)),{data:l,models:d,offByDefault:h}=R.useMemo(()=>{const _=(t==null?void 0:t.latency.series)??[],g=new Map;for(const A of _)g.set(A.model,(g.get(A.model)??0)+A.n);const b=[...g.entries()].sort((A,j)=>j[1]-A[1]).map(([A])=>A),S=new Map;for(const A of _){const j=S.get(A.bucket)??{bucket:A.bucket};j[`${A.model} p50`]=A.p50_ms,j[`${A.model} p90`]=A.p90_ms,S.set(A.bucket,j)}return{data:[...S.values()].sort((A,j)=>String(A.bucket).localeCompare(String(j.bucket))),models:b,offByDefault:new Set(b.slice(Pq))}},[t]),m=_=>n[Math.max(0,d.indexOf(_))%n.length],y=_=>u.get(_)??!h.has(_),p=d.filter(y),{logScale:x,domain:w,ticks:O}=R.useMemo(()=>{const _=[];for(const b of l)for(const S of p)for(const A of["p50","p90"]){const j=b[`${S} ${A}`];typeof j=="number"&&j>0&&_.push(j)}return(_.length?Math.max(..._)/Math.min(..._):1)<i0?{logScale:!1,domain:void 0,ticks:void 0}:{logScale:!0,...tq(_)}},[l,p.join("|")]);return v.jsx(Pe,{title:"Model response latency",hint:"prompt → first assistant token, per model"+(h.size?` · ${h.size} lower-volume model${h.size>1?"s":""} off by default — switch on in the legend`:""),guide:v.jsxs(v.Fragment,{children:[v.jsxs("p",{children:["How long a model took to start replying. ",v.jsx("strong",{children:"Read it for drift between buckets"})," ","— a model whose p90 doubles is the signal — not as an absolute number."]}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsxs("dd",{children:["local ",s,", following the dashboard's bucket control. Split by model the turns thin out fast, so at a fine bucket ",v.jsx("strong",{children:"points drop out rather than being drawn"})," ","— see the note below."]}),v.jsx("dt",{children:"y-axis"}),v.jsxs("dd",{children:["elapsed time from the prompt to the model's first response. Solid = median (p50), dashed = p90, one colour per model. Never a mean — the tail is the story."," ",v.jsx("strong",{children:"Linear normally."})," If the visible series span more than ",i0,"× the axis switches to logarithmic — each gridline ten times the one below, equal distances meaning equal ",v.jsx("em",{children:"ratios"})," rather than equal seconds — because at that spread a linear axis puts the smallest line at one percent of the plot and flattens it onto the baseline. The caption says which is in force, and hiding the widest series can bring it back to linear."]})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"The p90 is not pure model latency."})," A turn whose reply lands hours later is usually an agent parked on a permission prompt waiting for you, and nothing in the data separates that from a genuinely slow response. Replies Claude Code generated"," ",v.jsx("em",{children:"without"})," calling a model at all (its ",v.jsx("code",{children:"<synthetic>"})," marker) are excluded here — their elapsed time is not a model response time."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"The filter bar moves this chart less than it moves the token charts."})," A model is counted here once per turn it answered, but in the token charts by everything it spent — so a model doing subagent work, haiku above all, can be a top-three consumer while contributing almost nothing to this tile. Unticking it visibly moves one and not the other."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Every model is in the legend; click one to show or hide it"}),", and the axis rescales around what is left. Only the highest-volume few start switched on, so a model you do not see is off rather than absent — though a low-volume one may plot as a point or two, since a bucket under 5 turns is dropped. The legend is a ",v.jsx("em",{children:"view"})," control over whatever the filter bar admits: unticking a model up there removes it from every chart, while hiding it here only takes it off this one."]}),v.jsxs("p",{children:["Main sessions only. A ",s," holding fewer than ",v.jsx("strong",{children:"5 turns for a given model is dropped"}),', because a percentile over three observations is not a percentile — so a finer bucket gives a sparser chart, not a noisier one. Where a cell holds only a handful of turns its "p90" is close to simply its slowest.']})]}),hidden:e,children:t&&!l.length?v.jsx("div",{className:"empty",children:"No turns with a model response in range."}):v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Ai,{data:l,margin:Fe,children:[v.jsx(Ge,{...a}),v.jsx(Ce,{dataKey:"bucket",...i,minTickGap:24}),v.jsx(ve,{...i,...x?{scale:"log",domain:w,ticks:O,allowDataOverflow:!0}:{},tickFormatter:_=>a0(_),width:52,label:lt(`time to first token${x?" (log)":""}`,r.muted)}),v.jsx(oe,{...o,formatter:(_,g)=>[a0(Number(_)),fr(String(g).replace(/ p\d0$/,""))+String(g).slice(-4)]}),v.jsx(Le,{wrapperStyle:{fontSize:12},content:v.jsx(kq,{models:d,colorFor:m,shows:y,onToggle:f,muted:r.muted})}),d.map(_=>v.jsx(ut,{type:"monotone",dataKey:`${_} p50`,hide:!y(_),stroke:m(_),strokeWidth:2,dot:!1,connectNulls:!0},_)),d.map(_=>v.jsx(ut,{type:"monotone",dataKey:`${_} p90`,hide:!y(_),stroke:m(_),strokeWidth:2,strokeDasharray:"4 3",dot:!1,connectNulls:!0},`${_}-p90`))]})})})}function Mq({hidden:e,time:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=t==null?void 0:t.review,s=(c,f)=>f?Math.round(c/f*1e3)/10:0,u=o?[{band:"under 10s",wrote:s(o.wrote.under_10s,o.wrote.n),none:s(o.none.under_10s,o.none.n)},{band:"under 30s",wrote:s(o.wrote.under_30s,o.wrote.n),none:s(o.none.under_30s,o.none.n)},{band:"under 2min",wrote:s(o.wrote.under_2min,o.wrote.n),none:s(o.none.under_2min,o.none.n)}]:[];return v.jsx(Pe,{title:"Turnaround after a turn",hint:o&&o.wrote.n?`share of turns answered within each window · ${o.wrote.n} wrote files, ${o.none.n} did not`:"share of turns answered within each window",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How quickly the next prompt arrived after a turn finished, split by whether that turn changed any files."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:'how soon the next prompt came — the bands are cumulative, so "under 2min" also counts everything under 30s.'}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"percentage of turns in that group. The two groups have different denominators, shown in the subtitle, so compare the shares and not the bar heights as counts."})]}),v.jsxs("p",{children:["This is an ",v.jsx("strong",{children:"audit"})," view, not a productivity score. It reports that a reply came in four seconds; it makes no claim about whether that was long enough to read the diff, and nothing here is coloured or thresholded to suggest one."]}),v.jsx("p",{children:"Main sessions only — a subagent has no human to turn it around."})]}),hidden:e,children:t&&!(o!=null&&o.wrote.n)&&!(o!=null&&o.none.n)?v.jsx("div",{className:"empty",children:"No turns with a successor in range."}):v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:u,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"band",...n}),v.jsx(ve,{...n,width:40,tickFormatter:c=>`${c}%`,label:lt("% of turns",r.muted)}),v.jsx(oe,{...a,formatter:(c,f)=>[`${c}%`,f]}),v.jsx(Le,{wrapperStyle:{fontSize:12},formatter:E_(r.muted)}),v.jsx(pe,{dataKey:"wrote",name:"turn wrote files",fill:r.accent,radius:[4,4,0,0]}),v.jsx(pe,{dataKey:"none",name:"turn wrote nothing",fill:r.muted,radius:[4,4,0,0]})]})})})}const o0=["info","low","medium","high","critical"],Zf=(e,t)=>t?e/t*100:0,k_=e=>`${e.toFixed(1)}%`;function $q({hidden:e,audit:t}){const{C:r,axisProps:n,tooltipStyle:i}=ge(),a=((t==null?void 0:t.edit_reliability)??[]).map(o=>({name:fr(o.model),model:o.model,rate:Zf(o.errors,o.calls),calls:o.calls,errors:o.errors}));return v.jsx(Pe,{title:"Edit failures by model",hint:"share of Edit/Write/NotebookEdit calls that errored · ordered by call volume",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How often a model's attempt to write a file came back as an error."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"bar length"}),v.jsx("dd",{children:"errored calls as a share of that model's file-writing calls."}),v.jsx("dt",{children:"rows"}),v.jsx("dd",{children:"one per model, ordered by how many such calls it made."})]}),v.jsxs("p",{children:["A failed Edit usually means the model got the file's existing contents wrong, so this is a"," ",v.jsx("strong",{children:"capability signal"})," rather than a speed one. Both main and subagent sessions count — a subagent's edits are real edits."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Confounded by era and task mix."})," Older models ran on older sessions doing different work, so read this within a date range rather than as a standing leaderboard. The model comes from the event that issued the call."]})]}),hidden:e,children:v.jsxs(vn,{data:a,left:8,xAxisProps:{tickFormatter:o=>`${o}%`},yAxis:v.jsx(ve,{type:"category",dataKey:"name",...n,width:104}),children:[v.jsx(oe,{...i,formatter:(o,s,u)=>{var c,f;return[`${k_(o)} — ${((c=u.payload)==null?void 0:c.errors)??0} of ${(((f=u.payload)==null?void 0:f.calls)??0).toLocaleString()} calls`,"failure rate"]}}),v.jsx(pe,{dataKey:"rate",fill:r.red})]})})}function Iq({hidden:e,audit:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=((t==null?void 0:t.plan_rejections)??[]).map(s=>({bucket:s.bucket,plans:s.plan_calls?Zf(s.plan_rejected,s.plan_calls):null,questions:s.question_calls?Zf(s.question_rejected,s.question_calls):null,plan_calls:s.plan_calls,question_calls:s.question_calls}));return v.jsx(Pe,{title:"Plans & questions sent back",hint:"main sessions only · a bucket with none of that kind plots as a gap, not as 0%",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Share of plans and questions put to you that you rejected rather than approved."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"rejected as a percentage of that bucket's calls of that kind."})]}),v.jsxs("p",{children:["This is ",v.jsx("strong",{children:"alignment measured at the cheapest possible moment"})," — before the work happens. A rising line means briefs are getting worse or the model is drifting; nothing here says a rejection was wrong, and a healthy rate is not zero."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Not the same number as the rejection-rate KPI."})," That one is every rejected or blocked tool call over every tool call, a far larger denominator. This counts only ExitPlanMode and AskUserQuestion, and only where the result was recorded as a user rejection rather than a genuine failure."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Main sessions only"}),", and the model filter attributes each call to the event that issued it — a subagent has no human to reject it."]})]}),hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Ai,{data:o,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"bucket",...n,minTickGap:24}),v.jsx(ve,{...n,width:ji,tickFormatter:s=>`${s}%`,label:lt("rejected",r.muted)}),v.jsx(oe,{...a,formatter:s=>k_(s)}),v.jsx(Le,{wrapperStyle:{fontSize:12}}),v.jsx(ut,{type:"monotone",dataKey:"plans",name:"plans",stroke:r.violet,dot:!1,strokeWidth:2,connectNulls:!1}),v.jsx(ut,{type:"monotone",dataKey:"questions",name:"questions",stroke:r.accent,dot:!1,strokeWidth:2,connectNulls:!1})]})})})}function Nq({hidden:e,audit:t}){const{C:r,axisProps:n,gridProps:i,tooltipStyle:a}=ge(),o=(t==null?void 0:t.file_rework)??[];return v.jsx(Pe,{title:"Repeat edits per file",hint:"(session, file) pairs banded by how many times that session touched that file",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"How often a session came back to a file it had already edited."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"times that session touched that file — 1, 2–3, 4–6, 7–12, 13+."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"two counts per band: the number of (session, file) pairs in it, and the number of individual edits those pairs account for."})]}),v.jsx("p",{children:"The two series disagree on purpose. Most pairs sit in the left band, while a large share of all edits lands in the right ones — a small number of files absorbing a lot of rework."}),v.jsxs("p",{children:[v.jsx("strong",{children:"A count and a list, never a score."})," Rework was tested against session cost in both directions and the relationship is flat; it correlates with total tokens only because bigger sessions edit more files. Both populations count, and the model filter attributes each edit to the event that made it."]})]}),hidden:e,children:v.jsx(Qe,{width:"100%",height:"100%",children:v.jsxs(Zt,{data:o,margin:Fe,children:[v.jsx(Ge,{...i}),v.jsx(Ce,{dataKey:"band",...n}),v.jsx(ve,{...n,width:44,allowDecimals:!1,label:lt("count",r.muted)}),v.jsx(oe,{...a}),v.jsx(Le,{wrapperStyle:{fontSize:12}}),v.jsx(pe,{dataKey:"pairs",name:"file/session pairs",fill:r.teal}),v.jsx(pe,{dataKey:"changes",name:"edits they account for",fill:r.gold})]})})})}function Dq({hidden:e,audit:t}){const{C:r,SEVERITY_COLORS:n,axisProps:i,gridProps:a,tooltipStyle:o}=ge(),s=(t==null?void 0:t.findings_over_time)??[],[u,c]=sh(s.length),f=v.jsxs(v.Fragment,{children:[v.jsx(Ge,{...a}),v.jsx(Ce,{dataKey:"bucket",...i,minTickGap:24}),v.jsx(ve,{...i,width:ji,allowDecimals:!1,label:lt("findings",r.muted)}),v.jsx(oe,{...o}),v.jsx(Le,{wrapperStyle:{fontSize:12}})]});return v.jsx(Pe,{title:"Findings over time",hint:"detector findings per bucket, stacked by severity · dated by the finding, not its session",guide:v.jsxs(v.Fragment,{children:[v.jsx("p",{children:"Security findings the detector raised, over time and by severity."}),v.jsxs("dl",{children:[v.jsx("dt",{children:"x-axis"}),v.jsx("dd",{children:"time bucket — day, week or month."}),v.jsx("dt",{children:"y-axis"}),v.jsx("dd",{children:"findings raised in that bucket, stacked with the most severe on top."})]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Dated by the finding's own moment"}),", not by when its session started. A finding belongs to the tool call that triggered it, and a long session can raise one hours after it began — so a bucket here is when the risky thing was done."]}),v.jsx("p",{children:"A rising low-severity band is usually the detector getting better, not the work getting worse; a new critical is the line worth reading. Both populations count. Individual findings, their evidence and their mute state live on the Security page."})]}),hidden:e,children:v.jsx("div",{ref:u,style:{width:"100%",height:"100%"},children:v.jsx(Qe,{width:"100%",height:"100%",children:c?v.jsxs(Zt,{data:s,margin:Fe,children:[f,o0.map(l=>v.jsx(pe,{dataKey:l,name:l,stackId:"f",fill:n[l]},l))]}):v.jsxs(oh,{data:s,margin:Fe,children:[f,o0.map(l=>v.jsx(Ke,{dataKey:l,name:l,stackId:"f",stroke:"none",fill:n[l],fillOpacity:1},l))]})})})})}const Jf=[{id:"tokens-over-time",label:"Tokens over time",Component:rq},{id:"cost-over-time",label:"Cost over time",Component:nq},{id:"activity",label:"Activity over time",Component:iq},{id:"tool-errors",label:"Tool errors over time",Component:aq},{id:"error-types",label:"Error types",Component:sq},{id:"tokens-by-model",label:"Tokens by model",Component:uq},{id:"category",label:"Category distribution",Component:cq},{id:"complexity",label:"Complexity bands",Component:lq},{id:"tool-frequency",label:"Tool frequency",Component:fq},{id:"skill-activation",label:"Skill activation",Component:dq},{id:"subagent-fanout",label:"Subagent fan-out",Component:hq},{id:"burn-heatmap",label:"When work happens",Component:Tq},{id:"weekly-burn",label:"Burn by source",Component:Eq},{id:"model-latency",label:"Model response latency",Component:Cq},{id:"review-latency",label:"Turnaround after a turn",Component:Mq},{id:"edit-reliability",label:"Edit failures by model",Component:$q},{id:"plan-rejections",label:"Plans & questions sent back",Component:Iq},{id:"file-rework",label:"Repeat edits per file",Component:Nq},{id:"findings-over-time",label:"Findings over time",Component:Dq}],Rq=["burn-heatmap","weekly-burn","model-latency","review-latency"],qq=["edit-reliability","plan-rejections","file-rework","findings-over-time"];function s0({label:e,items:t,hidden:r,onToggle:n,onMove:i,onReset:a}){const o=M_();return v.jsxs("details",{className:"col-customizer",ref:o,children:[v.jsx("summary",{"aria-label":`Customize ${e.toLowerCase()}`,"data-tip":`Show, hide and reorder ${e.toLowerCase()}`,children:"⚙"}),v.jsxs("div",{className:"col-menu strip-menu",role:"group","aria-label":`Customize ${e.toLowerCase()}`,children:[t.map((s,u)=>v.jsxs("div",{className:"strip-row",children:[v.jsxs("label",{children:[v.jsx("input",{type:"checkbox",checked:!r.has(s.id),onChange:c=>n(s.id,c.target.checked)}),s.label]}),v.jsx("button",{type:"button",className:"move","aria-label":`Move ${s.label} up`,disabled:u===0,onClick:()=>i(s.id,-1),children:"↑"}),v.jsx("button",{type:"button",className:"move","aria-label":`Move ${s.label} down`,disabled:u===t.length-1,onClick:()=>i(s.id,1),children:"↓"})]},s.id)),v.jsx("button",{type:"button",className:"ghost small ms-clear",onClick:a,children:"reset"})]})]})}function Lq({active:e,hasCustom:t,onSelect:r}){const n=[...d0.map(i=>({id:i.id,label:i.label})),...t?[{id:Ir,label:"Custom"}]:[]];return v.jsx("div",{className:"views view-toggle",role:"group","aria-label":"Dashboard view",children:n.map(i=>v.jsx("button",{type:"button",className:"ghost"+(i.id===e?" is-active":""),"aria-pressed":i.id===e,onClick:()=>r(i.id),children:i.label},i.id))})}function Bq(e,t){const[r,n]=R.useState(()=>ph(kl(To,null),kl(dh,null)));R.useEffect(()=>{Promise.all([lh(To),lh(dh)]).then(([h,m])=>{(h!=null||m!=null)&&n(ph(h,m))})},[]);const i=y0(r),a=R.useMemo(()=>yh(r,e,t),[r,e,t]),o=R.useCallback(h=>{n(h),$_(To,h)},[]),s=R.useCallback(h=>{const m=yh(r,e,t),y=h({kpis:{...m.kpis},charts:{...m.charts}});y&&o(U_(r,y))},[r,e,t,o]),u=R.useCallback(h=>o({...r,active:h}),[r,o]),c=R.useCallback((h,m,y)=>s(p=>({...p,[h]:{...p[h],hidden:H_(p[h].hidden,m,y)}})),[s]),f=R.useCallback((h,m,y,p)=>s(x=>{const w=K_(m,x[h].order,y,p);return w===x[h].order?null:{...x,[h]:{...x[h],order:w}}}),[s]),l=R.useCallback(h=>s(m=>({...m,[h]:{hidden:[],order:[]}})),[s]),d=R.useCallback(h=>o({...r,kpisCollapsed:h}),[r,o]);return{layout:r,active:i,body:a,setActive:u,toggle:c,move:f,reset:l,setKpisCollapsed:d}}const u0=ed.map(e=>e.id),c0=Jf.map(e=>e.id),Fq=[null,null,null];function Uq(){const{get:e,set:t,pick:r}=I_(),n=So("/sources",[]),i=So("/models",[]).filter(D=>D!=="<synthetic>"),a=So("/security/summary",null),o=q_(),s=B_(),{layout:u,active:c,body:f,setActive:l,toggle:d,move:h,reset:m,setKpisCollapsed:y}=Bq(u0,c0),p=new Set(f.charts.hidden),x=e("models").split(",").filter(Boolean),w=x.length?x:i,O=r(["source","from","to","bucket","models"]),_=O.toString()?"?"+O.toString():"",{data:g,loading:b,error:S}=Ao(()=>Promise.all([yn("/dashboard/overview"+_),yn("/dashboard/timeseries"+_),yn("/dashboard/breakdowns"+_)]),[_]),[A,j,k]=g??Fq,E={from:e("from"),to:e("to")},T=Rq.some(D=>!p.has(D)),{data:C,error:$}=Ao(()=>T?yn("/dashboard/time"+_):null,[_,T]),M=qq.some(D=>!p.has(D)),{data:N,error:q}=Ao(()=>M?yn("/dashboard/audit"+_):null,[_,M]);return v.jsxs("div",{children:[v.jsx("h1",{className:"sr-only",children:"Dashboard"}),v.jsxs("div",{className:"filters",children:[v.jsxs("select",{"aria-label":"Filter by source",value:e("source"),onChange:D=>t({source:D.target.value}),children:[v.jsx("option",{value:"",children:"all sources"}),n.map(D=>v.jsxs("option",{value:D.id,children:[D.label," (",D.session_count,")"]},D.id))]}),v.jsx(N_,{label:"Models",options:i.map(D=>({value:D,label:fr(D)})),selected:w,onChange:D=>t({models:D.length===i.length?"":D.join(",")}),reset:{label:"select all",to:i},disabled:fh,tip:fh?"The exported demo serves one pre-computed view, so filters do not apply to it.":"Applies to every chart. Spend, turns and tool calls filter on the model that produced them; anything counted per session counts sessions that used one of these."}),v.jsxs("label",{className:"ctl",children:["from ",v.jsx("input",{type:"date",value:e("from"),onChange:D=>t({from:D.target.value})})]}),v.jsxs("label",{className:"ctl",children:["to ",v.jsx("input",{type:"date",value:e("to"),onChange:D=>t({to:D.target.value})})]}),v.jsxs("select",{"aria-label":"Time bucket",value:e("bucket"),onChange:D=>t({bucket:D.target.value}),children:[v.jsxs("option",{value:"",children:["bucket: auto",j?` (${j.bucket})`:""]}),v.jsx("option",{value:"day",children:"day"}),v.jsx("option",{value:"week",children:"week"}),v.jsx("option",{value:"month",children:"month"})]})]}),v.jsx(jo,{error:S}),v.jsx(jo,{error:$}),v.jsx(jo,{error:q}),b&&v.jsx(D_,{}),A&&!b&&v.jsxs(v.Fragment,{children:[v.jsx(Lq,{active:c,hasCustom:u.custom!=null,onSelect:l}),v.jsxs("section",{className:"dash-strip",children:[v.jsxs("div",{className:"strip-head",children:[v.jsx("h2",{children:"Metrics"}),v.jsxs("div",{className:"strip-actions",children:[v.jsx("button",{type:"button",className:"link-btn","aria-expanded":!u.kpisCollapsed,onClick:()=>y(!u.kpisCollapsed),children:u.kpisCollapsed?"▸ show":"▾ hide"}),v.jsx(s0,{label:"Metrics",items:zi(ed,f.kpis.order),hidden:new Set(f.kpis.hidden),onToggle:(D,F)=>d("kpis",D,F),onMove:(D,F)=>h("kpis",u0,D,F),onReset:()=>m("kpis")})]})]}),!u.kpisCollapsed&&v.jsx(X_,{ctx:{overview:A,bd:k,security:a},layout:f.kpis})]}),v.jsxs("section",{className:"dash-strip",children:[v.jsxs("div",{className:"strip-head",children:[v.jsx("h2",{children:"Charts"}),v.jsx("div",{className:"strip-actions",children:v.jsx(s0,{label:"Charts",items:zi(Jf,f.charts.order),hidden:p,onToggle:(D,F)=>d("charts",D,F),onMove:(D,F)=>h("charts",c0,D,F),onReset:()=>m("charts")})})]}),v.jsx("div",{className:"cards",children:zi(Jf,f.charts.order).map(({id:D,Component:F})=>v.jsx(F,{hidden:p.has(D),ts:j,bd:k,time:C,audit:N,expand:o,drill:s,range:E},D))})]})]})]})}export{Uq as default};
|