claude-session-dashboard 0.1.3 → 0.2.1
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/client/assets/_dashboard-Bxw4OxIS.js +1 -0
- package/dist/client/assets/_sessionId-CNR4Ln7m.js +12 -0
- package/dist/client/assets/app-u2nTs9ny.css +1 -0
- package/dist/client/assets/{createServerFn-Le0d8Pjz.js → createServerFn-B0pEGqTk.js} +1 -1
- package/dist/client/assets/format-Bsprb3az.js +1 -0
- package/dist/client/assets/index-BbdJ1jMA.js +1 -0
- package/dist/client/assets/{main-CzD8HjLq.js → main-CM5g2n-_.js} +7 -7
- package/dist/client/assets/sessions.queries-AUVV0tJj.js +1 -0
- package/dist/client/assets/{settings-BSPc79zZ.js → settings-CIwZDakc.js} +1 -1
- package/dist/client/assets/{settings.types-B4841OLF.js → settings.types-BRNIMHGJ.js} +1 -1
- package/dist/client/assets/stats-CjWSMX3y.js +4 -0
- package/dist/client/assets/useSessionCost-DgFKglaG.js +65 -0
- package/dist/server/assets/{_dashboard--ukhquwO.js → _dashboard-CAO6-qAS.js} +22 -3
- package/dist/server/assets/{_sessionId-BwZK4Ezz.js → _sessionId-BZf2Aqy5.js} +30 -7
- package/dist/server/assets/_tanstack-start-manifest_v-C5hwNzs-.js +4 -0
- package/dist/server/assets/{claude-path-CkuljM34.js → claude-path-BdwflgZ1.js} +9 -3
- package/dist/server/assets/{format-CGmJnuhZ.js → format-DIZHV7IJ.js} +3 -3
- package/dist/server/assets/{index-D4VWrt2z.js → index-Do0HxVmM.js} +7 -40
- package/dist/server/assets/project-analytics.server-BkWSd6a8.js +61 -0
- package/dist/server/assets/{router-xTSe9UH_.js → router-ChxlsPNU.js} +12 -7
- package/dist/server/assets/{session-detail.server-azkRfON2.js → session-detail.server-DLXl-Pn-.js} +1 -1
- package/dist/server/assets/session-scanner-CLfls9u-.js +93 -0
- package/dist/server/assets/sessions.queries-B5ZBiVJy.js +42 -0
- package/dist/server/assets/{sessions.server-B8zbmvSM.js → sessions.server-CUhasKW2.js} +5 -89
- package/dist/server/assets/stats-C9cZXTP5.js +649 -0
- package/dist/server/assets/{stats.server-BZWxV-mC.js → stats.server-52mNk2Yw.js} +1 -1
- package/dist/server/assets/useSessionCost-CYs5UOX-.js +209 -0
- package/dist/server/server.js +19 -16
- package/package.json +5 -1
- package/dist/client/assets/_dashboard-CYwTENkn.js +0 -1
- package/dist/client/assets/_sessionId-Bwfhm_El.js +0 -12
- package/dist/client/assets/app-DhZyFob1.css +0 -1
- package/dist/client/assets/format-Bf-cSf6L.js +0 -1
- package/dist/client/assets/index-DXhX1hdS.js +0 -1
- package/dist/client/assets/stats-CDIvpOt9.js +0 -4
- package/dist/client/assets/useSessionCost-9NP6uhla.js +0 -61
- package/dist/server/assets/_tanstack-start-manifest_v-gtQY7f-T.js +0 -4
- package/dist/server/assets/stats-DItsFPp5.js +0 -266
- package/dist/server/assets/useSessionCost-EB0VxklP.js +0 -76
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,q as c,v as s,x as d,t as n,z as i}from"./main-CM5g2n-_.js";import{c as a,q as r}from"./createServerFn-B0pEGqTk.js";a({method:"GET"}).handler(e("bf8e4a7901f1843bdc9c46be1ad5ad59c615b8bbe611b73eb3ff28f20e43ee0d"));const f=a({method:"GET"}).handler(e("839d29fe93dfa2a6d506af7b48ca25197190a5ff4c796e970ddfdc6e8c98827f"));c({page:n().int().min(1),pageSize:n().int().min(5).max(100),search:s(),status:d(["all","active","completed"]),project:s()});const o=a({method:"GET"}).handler(e("a3f42f9012fd83586787da8f7cb90649da739dd947d867eb67572f68735ff495")),u=r({queryKey:["sessions","active"],queryFn:()=>f(),refetchInterval:3e3});function y(t){return r({queryKey:["sessions","paginated",t],queryFn:()=>o({data:t}),placeholderData:i,refetchInterval:3e4})}export{u as a,y as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as g}from"./main-
|
|
1
|
+
import{j as e,r as g}from"./main-CM5g2n-_.js";import{u as f}from"./createServerFn-B0pEGqTk.js";import{S as j,D as p,u as v,a as b,s as N}from"./settings.types-BRNIMHGJ.js";function k({value:o,onChange:u}){return e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",children:j.map(r=>{const d=o===r.id;return e.jsxs("button",{type:"button",onClick:()=>u(r.id),className:`rounded-lg border px-3 py-2 text-left transition-colors ${d?"border-blue-500 bg-blue-500/10 text-white":"border-gray-800 bg-gray-900/50 text-gray-400 hover:border-gray-700 hover:text-gray-300"}`,children:[e.jsx("div",{className:"text-sm font-medium",children:r.displayName}),e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-gray-500",children:r.monthlyUSD!==null?`$${r.monthlyUSD}/mo`:"Custom"})]},r.id)})})}const y=[{key:"inputPerMTok",label:"Input"},{key:"outputPerMTok",label:"Output"},{key:"cacheReadPerMTok",label:"Cache Read"},{key:"cacheWritePerMTok",label:"Cache Write"}];function T({overrides:o,onChange:u}){function r(t,s,i){const n=parseFloat(i);if(!Number.isFinite(n)||n<0||n>1e6)return;const a=p.find(l=>l.modelId===t);if(!a)return;const c=o[t]?{...o[t]}:{inputPerMTok:a.inputPerMTok,outputPerMTok:a.outputPerMTok,cacheReadPerMTok:a.cacheReadPerMTok,cacheWritePerMTok:a.cacheWritePerMTok};c[s]=n;const h=c.inputPerMTok===a.inputPerMTok&&c.outputPerMTok===a.outputPerMTok&&c.cacheReadPerMTok===a.cacheReadPerMTok&&c.cacheWritePerMTok===a.cacheWritePerMTok,m={...o};h?delete m[t]:m[t]=c,u(m)}function d(t,s){const i=o[t.modelId];return i?i[s]:t[s]}function x(t,s){const i=o[t];if(!i)return!1;const n=p.find(a=>a.modelId===t);return n?i[s]!==n[s]:!1}return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-800",children:[e.jsx("th",{className:"pb-2 pr-4 text-gray-400 font-medium",children:"Model"}),y.map(t=>e.jsx("th",{className:"pb-2 px-2 text-right text-gray-400 font-medium",children:t.label},t.key))]})}),e.jsx("tbody",{children:p.map(t=>e.jsxs("tr",{className:"border-b border-gray-800/50",children:[e.jsx("td",{className:"py-2 pr-4 font-mono text-gray-300",children:t.displayName}),y.map(s=>{const i=d(t,s.key),n=x(t.modelId,s.key);return e.jsx("td",{className:"px-1 py-1.5",children:e.jsx("input",{type:"number",step:"0.01",min:"0",value:i,onChange:a=>r(t.modelId,s.key,a.target.value),className:`w-20 rounded border px-2 py-1 text-right font-mono text-xs ${n?"border-blue-500/50 bg-blue-500/10 text-blue-400":"border-gray-700 bg-gray-800 text-gray-300"} focus:border-blue-500 focus:outline-none`})},s.key)})]},t.modelId))})]}),e.jsx("p",{className:"mt-2 text-[10px] text-gray-600",children:"Prices in USD per million tokens. Overridden values shown in blue."})]})}function P(){const{data:o,isLoading:u}=f(N),r=v(),[d,x]=g.useState("pro"),[t,s]=g.useState({}),[i,n]=g.useState(!1);g.useEffect(()=>{o&&(x(o.subscriptionTier),s(o.pricingOverrides),n(!1))},[o]);function a(l){x(l),n(!0)}function c(l){s(l),n(!0)}function h(){x(b.subscriptionTier),s(b.pricingOverrides),n(!0)}function m(){const l={version:1,subscriptionTier:d,pricingOverrides:t};r.mutate(l,{onSuccess:()=>{n(!1)}})}return u?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),e.jsx("div",{className:"h-64 animate-pulse rounded-xl bg-gray-900/50"})]}):e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-white",children:"Settings"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Configure your subscription tier and API pricing for cost estimation."}),e.jsxs("div",{className:"mt-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-300",children:"Subscription Tier"}),e.jsx("p",{className:"mt-1 text-[10px] text-gray-500",children:"Select your Claude subscription plan. This is informational only and does not affect cost calculations."}),e.jsx("div",{className:"mt-3",children:e.jsx(k,{value:d,onChange:a})})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-300",children:"API Pricing (per million tokens)"}),e.jsx("p",{className:"mt-1 text-[10px] text-gray-500",children:"Default prices from Anthropic. Override any value to match your negotiated rates."}),e.jsx("div",{className:"mt-3 rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:e.jsx(T,{overrides:t,onChange:c})})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsx("button",{type:"button",onClick:h,className:"rounded-lg border border-gray-700 px-3 py-1.5 text-xs text-gray-400 transition-colors hover:border-gray-600 hover:text-gray-300",children:"Reset to Defaults"}),e.jsxs("div",{className:"flex items-center gap-3",children:[r.isSuccess&&!i&&e.jsx("span",{className:"text-xs text-emerald-400",children:"Saved"}),r.isError&&e.jsxs("span",{className:"text-xs text-red-400",children:["Failed to save: ",r.error?.message??"Unknown error"]}),e.jsx("button",{type:"button",onClick:m,disabled:!i||r.isPending,className:`rounded-lg px-4 py-1.5 text-xs font-medium transition-colors ${i&&!r.isPending?"bg-blue-600 text-white hover:bg-blue-500":"cursor-not-allowed bg-gray-800 text-gray-500"}`,children:r.isPending?"Saving...":"Save"})]})]})]})}function R(){return e.jsx(P,{})}export{R as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,q as M}from"./createServerFn-
|
|
1
|
+
import{c as d,q as M}from"./createServerFn-B0pEGqTk.js";import{S as P,s as k,k as u,l as b,n as h,m as l,r,o as f,p as S,c as p,q as m,t as o,v as c,w as v,x as O,y as C}from"./main-CM5g2n-_.js";var g=class extends P{#t;#i=void 0;#e;#s;constructor(e,t){super(),this.#t=e,this.setOptions(t),this.bindMethods(),this.#a()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#t.defaultMutationOptions(e),k(this.options,t)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#e,observer:this}),t?.mutationKey&&this.options.mutationKey&&u(t.mutationKey)!==u(this.options.mutationKey)?this.reset():this.#e?.state.status==="pending"&&this.#e.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#e?.removeObserver(this)}onMutationUpdate(e){this.#a(),this.#r(e)}getCurrentResult(){return this.#i}reset(){this.#e?.removeObserver(this),this.#e=void 0,this.#a(),this.#r()}mutate(e,t){return this.#s=t,this.#e?.removeObserver(this),this.#e=this.#t.getMutationCache().build(this.#t,this.options),this.#e.addObserver(this),this.#e.execute(e)}#a(){const e=this.#e?.state??b();this.#i={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#r(e){h.batch(()=>{if(this.#s&&this.hasListeners()){const t=this.#i.variables,a=this.#i.context,s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#s.onSuccess?.(e.data,t,a,s)}catch(i){Promise.reject(i)}try{this.#s.onSettled?.(e.data,null,t,a,s)}catch(i){Promise.reject(i)}}else if(e?.type==="error"){try{this.#s.onError?.(e.error,t,a,s)}catch(i){Promise.reject(i)}try{this.#s.onSettled?.(void 0,e.error,t,a,s)}catch(i){Promise.reject(i)}}}this.listeners.forEach(t=>{t(this.#i)})})}};function x(e,t){const a=l(),[s]=r.useState(()=>new g(a,e));r.useEffect(()=>{s.setOptions(e)},[s,e]);const i=r.useSyncExternalStore(r.useCallback(n=>s.subscribe(h.batchCalls(n)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),y=r.useCallback((n,T)=>{s.mutate(n,T).catch(f)},[s]);if(i.error&&S(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:y,mutateAsync:i.mutate}}const R=d({method:"GET"}).handler(p("810657681a273df5b4e58f0d8fcc6a5451598b489431b9bcaa98eea0ad815da8")),N=d({method:"POST"}).handler(p("3050115d92ca91ab1fd8fd698e33076328aae80dc64ca27c088eee16cebccc1a")),D=M({queryKey:["settings"],queryFn:()=>R(),staleTime:3e5,refetchOnWindowFocus:!1});function W(){const e=l();return x({mutationFn:t=>N({data:t}),onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}const I=m({inputPerMTok:o().min(0),outputPerMTok:o().min(0),cacheReadPerMTok:o().min(0),cacheWritePerMTok:o().min(0)});m({version:C(1),subscriptionTier:O(["free","pro","max-5x","max-20x","teams","enterprise","api"]).default("pro"),pricingOverrides:v(c(),I).default({}),updatedAt:c().datetime().optional()});const q=[{modelId:"claude-opus-4-6",displayName:"Claude Opus 4.6",inputPerMTok:5,outputPerMTok:25,cacheReadPerMTok:.5,cacheWritePerMTok:6.25},{modelId:"claude-opus-4-5",displayName:"Claude Opus 4.5",inputPerMTok:5,outputPerMTok:25,cacheReadPerMTok:.5,cacheWritePerMTok:6.25},{modelId:"claude-opus-4-1",displayName:"Claude Opus 4.1",inputPerMTok:15,outputPerMTok:75,cacheReadPerMTok:1.5,cacheWritePerMTok:18.75},{modelId:"claude-opus-4",displayName:"Claude Opus 4",inputPerMTok:15,outputPerMTok:75,cacheReadPerMTok:1.5,cacheWritePerMTok:18.75},{modelId:"claude-sonnet-4-5",displayName:"Claude Sonnet 4.5",inputPerMTok:3,outputPerMTok:15,cacheReadPerMTok:.3,cacheWritePerMTok:3.75},{modelId:"claude-sonnet-4",displayName:"Claude Sonnet 4",inputPerMTok:3,outputPerMTok:15,cacheReadPerMTok:.3,cacheWritePerMTok:3.75},{modelId:"claude-haiku-4-5",displayName:"Claude Haiku 4.5",inputPerMTok:1,outputPerMTok:5,cacheReadPerMTok:.1,cacheWritePerMTok:1.25},{modelId:"claude-haiku-3-5",displayName:"Claude Haiku 3.5",inputPerMTok:.8,outputPerMTok:4,cacheReadPerMTok:.08,cacheWritePerMTok:1},{modelId:"claude-haiku-3",displayName:"Claude Haiku 3",inputPerMTok:.25,outputPerMTok:1.25,cacheReadPerMTok:.03,cacheWritePerMTok:.3}],K=[{id:"free",displayName:"Free",monthlyUSD:0},{id:"pro",displayName:"Pro",monthlyUSD:20},{id:"max-5x",displayName:"Max 5x",monthlyUSD:100},{id:"max-20x",displayName:"Max 20x",monthlyUSD:200},{id:"teams",displayName:"Teams",monthlyUSD:150},{id:"enterprise",displayName:"Enterprise",monthlyUSD:null},{id:"api",displayName:"API Only",monthlyUSD:null}],w={subscriptionTier:"pro",pricingOverrides:{}};function F(e){return e.replace(/-\d{8}$/,"")}export{q as D,K as S,w as a,F as n,D as s,W as u};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{c as lt,R as f,g as ct,r as $,j as o,L as Rt,b as Ue}from"./main-CM5g2n-_.js";import{c as ut,q as dt,u as ft}from"./createServerFn-B0pEGqTk.js";import{t as Ve,c as Lt,m as ht,a as mt,f as pe,b as ie,s as Mt,d as Ee,e as zt,g as We}from"./format-Bsprb3az.js";import{c as K,f as A,r as pt,a as Ft,b as yt,d as Kt,i as I,T as Ce,p as M,L as D,g as vt,e as De,h as gt,D as Bt,C as Ut,j as J,k as H,S as Vt,A as Wt,l as Gt,m as Ge,n as qt,o as S,q as Ht,u as Yt,G as Zt,s as fe,t as Jt,v as xt,w as Qt,x as oe,y as ye,z as Xt,B as er,E as tr,F as rr,H as nr,I as bt,J as jt,K as At,M as kt,N as Ot,O as he,X as $e,Y as Ie,P as ar,Q as ir,R as Re,U as Le,V as sr,W as or,Z as lr,_ as cr,$ as ur,a0 as le,a1 as dr,a2 as fr,a3 as hr,a4 as mr}from"./useSessionCost-DgFKglaG.js";import"./settings.types-BRNIMHGJ.js";const pr=ut({method:"GET"}).handler(lt("4b9a58c176f487b49800a372100037cdf33cf048f3592a449f115c7e3f5ea799")),yr=dt({queryKey:["stats"],queryFn:()=>pr(),refetchInterval:6e4});var vr=["points","className","baseLinePoints","connectNulls"];function Y(){return Y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Y.apply(this,arguments)}function gr(t,e){if(t==null)return{};var n=xr(t,e),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function qe(t){return kr(t)||Ar(t)||jr(t)||br()}function br(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jr(t,e){if(t){if(typeof t=="string")return we(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return we(t,e)}}function Ar(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function kr(t){if(Array.isArray(t))return we(t)}function we(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var He=function(e){return e&&e.x===+e.x&&e.y===+e.y},Or=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){He(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),He(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},ne=function(e,n){var r=Or(e);n&&(r=[r.reduce(function(i,s){return[].concat(qe(i),qe(s))},[])]);var a=r.map(function(i){return i.reduce(function(s,c,l){return"".concat(s).concat(l===0?"M":"L").concat(c.x,",").concat(c.y)},"")}).join("");return r.length===1?"".concat(a,"Z"):a},Pr=function(e,n,r){var a=ne(e,r);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(ne(n.reverse(),r).slice(1))},Sr=function(e){var n=e.points,r=e.className,a=e.baseLinePoints,i=e.connectNulls,s=gr(e,vr);if(!n||!n.length)return null;var c=K("recharts-polygon",r);if(a&&a.length){var l=s.stroke&&s.stroke!=="none",u=Pr(n,a,i);return f.createElement("g",{className:c},f.createElement("path",Y({},A(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),l?f.createElement("path",Y({},A(s,!0),{fill:"none",d:ne(n,i)})):null,l?f.createElement("path",Y({},A(s,!0),{fill:"none",d:ne(a,i)})):null)}var d=ne(n,i);return f.createElement("path",Y({},A(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:c,d}))},Oe,Ye;function wr(){if(Ye)return Oe;Ye=1;var t=pt(),e=Ft(),n=yt();function r(a,i){return a&&a.length?t(a,n(i,2),e):void 0}return Oe=r,Oe}var Nr=wr();const Tr=ct(Nr);var Pe,Ze;function _r(){if(Ze)return Pe;Ze=1;var t=pt(),e=yt(),n=Kt();function r(a,i){return a&&a.length?t(a,e(i,2),n):void 0}return Pe=r,Pe}var Er=_r();const Cr=ct(Er);var Dr=["cx","cy","angle","ticks","axisLine"],$r=["ticks","tick","angle","tickFormatter","stroke"];function Q(t){"@babel/helpers - typeof";return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Q(t)}function ae(){return ae=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ae.apply(this,arguments)}function Je(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function B(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Je(Object(n),!0).forEach(function(r){be(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Je(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Qe(t,e){if(t==null)return{};var n=Ir(t,e),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Ir(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Rr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,St(r.key),r)}}function Lr(t,e,n){return e&&Xe(t.prototype,e),n&&Xe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mr(t,e,n){return e=ve(e),zr(t,Pt()?Reflect.construct(e,n||[],ve(t).constructor):e.apply(t,n))}function zr(t,e){if(e&&(Q(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fr(t)}function Fr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Pt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pt=function(){return!!t})()}function ve(t){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ve(t)}function Kr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ne(t,e)}function Ne(t,e){return Ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Ne(t,e)}function be(t,e,n){return e=St(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function St(t){var e=Br(t,"string");return Q(e)=="symbol"?e:e+""}function Br(t,e){if(Q(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Q(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var je=(function(t){function e(){return Rr(this,e),Mr(this,e,arguments)}return Kr(e,t),Lr(e,[{key:"getTickValueCoord",value:function(r){var a=r.coordinate,i=this.props,s=i.angle,c=i.cx,l=i.cy;return M(c,l,a,s)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,a;switch(r){case"left":a="end";break;case"right":a="start";break;default:a="middle";break}return a}},{key:"getViewBox",value:function(){var r=this.props,a=r.cx,i=r.cy,s=r.angle,c=r.ticks,l=Tr(c,function(d){return d.coordinate||0}),u=Cr(c,function(d){return d.coordinate||0});return{cx:a,cy:i,startAngle:s,endAngle:s,innerRadius:u.coordinate||0,outerRadius:l.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,a=r.cx,i=r.cy,s=r.angle,c=r.ticks,l=r.axisLine,u=Qe(r,Dr),d=c.reduce(function(y,h){return[Math.min(y[0],h.coordinate),Math.max(y[1],h.coordinate)]},[1/0,-1/0]),m=M(a,i,d[0],s),p=M(a,i,d[1],s),v=B(B(B({},A(u,!1)),{},{fill:"none"},A(l,!1)),{},{x1:m.x,y1:m.y,x2:p.x,y2:p.y});return f.createElement("line",ae({className:"recharts-polar-radius-axis-line"},v))}},{key:"renderTicks",value:function(){var r=this,a=this.props,i=a.ticks,s=a.tick,c=a.angle,l=a.tickFormatter,u=a.stroke,d=Qe(a,$r),m=this.getTickTextAnchor(),p=A(d,!1),v=A(s,!1),y=i.map(function(h,g){var b=r.getTickValueCoord(h),j=B(B(B(B({textAnchor:m,transform:"rotate(".concat(90-c,", ").concat(b.x,", ").concat(b.y,")")},p),{},{stroke:"none",fill:u},v),{},{index:g},b),{},{payload:h});return f.createElement(D,ae({className:K("recharts-polar-radius-axis-tick",vt(s)),key:"tick-".concat(h.coordinate)},De(r.props,h,g)),e.renderTickItem(s,j,l?l(h.value,g):h.value))});return f.createElement(D,{className:"recharts-polar-radius-axis-ticks"},y)}},{key:"render",value:function(){var r=this.props,a=r.ticks,i=r.axisLine,s=r.tick;return!a||!a.length?null:f.createElement(D,{className:K("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),s&&this.renderTicks(),gt.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,a,i){var s;return f.isValidElement(r)?s=f.cloneElement(r,a):I(r)?s=r(a):s=f.createElement(Ce,ae({},a,{className:"recharts-polar-radius-axis-tick-value"}),i),s}}])})($.PureComponent);be(je,"displayName","PolarRadiusAxis");be(je,"axisType","radiusAxis");be(je,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function X(t){"@babel/helpers - typeof";return X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(t)}function V(){return V=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},V.apply(this,arguments)}function et(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function U(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?et(Object(n),!0).forEach(function(r){Ae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):et(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ur(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Nt(r.key),r)}}function Vr(t,e,n){return e&&tt(t.prototype,e),n&&tt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wr(t,e,n){return e=ge(e),Gr(t,wt()?Reflect.construct(e,n||[],ge(t).constructor):e.apply(t,n))}function Gr(t,e){if(e&&(X(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qr(t)}function qr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function wt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wt=function(){return!!t})()}function ge(t){return ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ge(t)}function Hr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Te(t,e)}function Te(t,e){return Te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Te(t,e)}function Ae(t,e,n){return e=Nt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Nt(t){var e=Yr(t,"string");return X(e)=="symbol"?e:e+""}function Yr(t,e){if(X(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(X(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Zr=Math.PI/180,rt=1e-5,ke=(function(t){function e(){return Ur(this,e),Wr(this,e,arguments)}return Hr(e,t),Vr(e,[{key:"getTickLineCoord",value:function(r){var a=this.props,i=a.cx,s=a.cy,c=a.radius,l=a.orientation,u=a.tickSize,d=u||8,m=M(i,s,c,r.coordinate),p=M(i,s,c+(l==="inner"?-1:1)*d,r.coordinate);return{x1:m.x,y1:m.y,x2:p.x,y2:p.y}}},{key:"getTickTextAnchor",value:function(r){var a=this.props.orientation,i=Math.cos(-r.coordinate*Zr),s;return i>rt?s=a==="outer"?"start":"end":i<-rt?s=a==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var r=this.props,a=r.cx,i=r.cy,s=r.radius,c=r.axisLine,l=r.axisLineType,u=U(U({},A(this.props,!1)),{},{fill:"none"},A(c,!1));if(l==="circle")return f.createElement(Bt,V({className:"recharts-polar-angle-axis-line"},u,{cx:a,cy:i,r:s}));var d=this.props.ticks,m=d.map(function(p){return M(a,i,s,p.coordinate)});return f.createElement(Sr,V({className:"recharts-polar-angle-axis-line"},u,{points:m}))}},{key:"renderTicks",value:function(){var r=this,a=this.props,i=a.ticks,s=a.tick,c=a.tickLine,l=a.tickFormatter,u=a.stroke,d=A(this.props,!1),m=A(s,!1),p=U(U({},d),{},{fill:"none"},A(c,!1)),v=i.map(function(y,h){var g=r.getTickLineCoord(y),b=r.getTickTextAnchor(y),j=U(U(U({textAnchor:b},d),{},{stroke:"none",fill:u},m),{},{index:h,payload:y,x:g.x2,y:g.y2});return f.createElement(D,V({className:K("recharts-polar-angle-axis-tick",vt(s)),key:"tick-".concat(y.coordinate)},De(r.props,y,h)),c&&f.createElement("line",V({className:"recharts-polar-angle-axis-tick-line"},p,g)),s&&e.renderTickItem(s,j,l?l(y.value,h):y.value))});return f.createElement(D,{className:"recharts-polar-angle-axis-ticks"},v)}},{key:"render",value:function(){var r=this.props,a=r.ticks,i=r.radius,s=r.axisLine;return i<=0||!a||!a.length?null:f.createElement(D,{className:K("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,a,i){var s;return f.isValidElement(r)?s=f.cloneElement(r,a):I(r)?s=r(a):s=f.createElement(Ce,V({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),s}}])})($.PureComponent);Ae(ke,"displayName","PolarAngleAxis");Ae(ke,"axisType","angleAxis");Ae(ke,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var me;function ee(t){"@babel/helpers - typeof";return ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(t)}function Z(){return Z=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Z.apply(this,arguments)}function nt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function x(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nt(Object(n),!0).forEach(function(r){_(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nt(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Jr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function at(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_t(r.key),r)}}function Qr(t,e,n){return e&&at(t.prototype,e),n&&at(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xr(t,e,n){return e=xe(e),en(t,Tt()?Reflect.construct(e,n||[],xe(t).constructor):e.apply(t,n))}function en(t,e){if(e&&(ee(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tn(t)}function tn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Tt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Tt=function(){return!!t})()}function xe(t){return xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},xe(t)}function rn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_e(t,e)}function _e(t,e){return _e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},_e(t,e)}function _(t,e,n){return e=_t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _t(t){var e=nn(t,"string");return ee(e)=="symbol"?e:e+""}function nn(t,e){if(ee(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ee(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var z=(function(t){function e(n){var r;return Jr(this,e),r=Xr(this,e,[n]),_(r,"pieRef",null),_(r,"sectorRefs",[]),_(r,"id",Yt("recharts-pie-")),_(r,"handleAnimationEnd",function(){var a=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),I(a)&&a()}),_(r,"handleAnimationStart",function(){var a=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),I(a)&&a()}),r.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},r}return rn(e,t),Qr(e,[{key:"isActiveIndex",value:function(r){var a=this.props.activeIndex;return Array.isArray(a)?a.indexOf(r)!==-1:r===a}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var i=this.props,s=i.label,c=i.labelLine,l=i.dataKey,u=i.valueKey,d=A(this.props,!1),m=A(s,!1),p=A(c,!1),v=s&&s.offsetRadius||20,y=r.map(function(h,g){var b=(h.startAngle+h.endAngle)/2,j=M(h.cx,h.cy,h.outerRadius+v,b),k=x(x(x(x({},d),h),{},{stroke:"none"},m),{},{index:g,textAnchor:e.getTextAnchor(j.x,h.cx)},j),R=x(x(x(x({},d),h),{},{fill:"none",stroke:h.fill},p),{},{index:g,points:[M(h.cx,h.cy,h.outerRadius,b),j]}),w=l;return J(l)&&J(u)?w="value":J(l)&&(w=u),f.createElement(D,{key:"label-".concat(h.startAngle,"-").concat(h.endAngle,"-").concat(h.midAngle,"-").concat(g)},c&&e.renderLabelLineItem(c,R,"line"),e.renderLabelItem(s,k,H(h,w)))});return f.createElement(D,{className:"recharts-pie-labels"},y)}},{key:"renderSectorsStatically",value:function(r){var a=this,i=this.props,s=i.activeShape,c=i.blendStroke,l=i.inactiveShape;return r.map(function(u,d){if(u?.startAngle===0&&u?.endAngle===0&&r.length!==1)return null;var m=a.isActiveIndex(d),p=l&&a.hasActiveIndex()?l:null,v=m?s:p,y=x(x({},u),{},{stroke:c?u.fill:u.stroke,tabIndex:-1});return f.createElement(D,Z({ref:function(g){g&&!a.sectorRefs.includes(g)&&a.sectorRefs.push(g)},tabIndex:-1,className:"recharts-pie-sector"},De(a.props,u,d),{key:"sector-".concat(u?.startAngle,"-").concat(u?.endAngle,"-").concat(u.midAngle,"-").concat(d)}),f.createElement(Vt,Z({option:v,isActive:m,shapeType:"sector"},y)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,a=this.props,i=a.sectors,s=a.isAnimationActive,c=a.animationBegin,l=a.animationDuration,u=a.animationEasing,d=a.animationId,m=this.state,p=m.prevSectors,v=m.prevIsAnimationActive;return f.createElement(Wt,{begin:c,duration:l,isActive:s,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(v),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(y){var h=y.t,g=[],b=i&&i[0],j=b.startAngle;return i.forEach(function(k,R){var w=p&&p[R],N=R>0?Gt(k,"paddingAngle",0):0;if(w){var E=Ge(w.endAngle-w.startAngle,k.endAngle-k.startAngle),O=x(x({},k),{},{startAngle:j+N,endAngle:j+E(h)+N});g.push(O),j=O.endAngle}else{var C=k.endAngle,T=k.startAngle,L=Ge(0,C-T),se=L(h),F=x(x({},k),{},{startAngle:j+N,endAngle:j+se+N});g.push(F),j=F.endAngle}}),f.createElement(D,null,r.renderSectorsStatically(g))})}},{key:"attachKeyboardHandlers",value:function(r){var a=this;r.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var s=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[s].focus(),a.setState({sectorToFocus:s});break}case"ArrowRight":{var c=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[c].focus(),a.setState({sectorToFocus:c});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,a=r.sectors,i=r.isAnimationActive,s=this.state.prevSectors;return i&&a&&a.length&&(!s||!qt(s,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,a=this.props,i=a.hide,s=a.sectors,c=a.className,l=a.label,u=a.cx,d=a.cy,m=a.innerRadius,p=a.outerRadius,v=a.isAnimationActive,y=this.state.isAnimationFinished;if(i||!s||!s.length||!S(u)||!S(d)||!S(m)||!S(p))return null;var h=K("recharts-pie",c);return f.createElement(D,{tabIndex:this.props.rootTabIndex,className:h,ref:function(b){r.pieRef=b}},this.renderSectors(),l&&this.renderLabels(s),gt.renderCallByParent(this.props,null,!1),(!v||y)&&Ht.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,a){return a.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==a.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:r.sectors!==a.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,a){return r>a?"start":r<a?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,a,i){if(f.isValidElement(r))return f.cloneElement(r,a);if(I(r))return r(a);var s=K("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return f.createElement(Ut,Z({},a,{key:i,type:"linear",className:s}))}},{key:"renderLabelItem",value:function(r,a,i){if(f.isValidElement(r))return f.cloneElement(r,a);var s=i;if(I(r)&&(s=r(a),f.isValidElement(s)))return s;var c=K("recharts-pie-label-text",typeof r!="boolean"&&!I(r)?r.className:"");return f.createElement(Ce,Z({},a,{alignmentBaseline:"middle",className:c}),s)}}])})($.PureComponent);me=z;_(z,"displayName","Pie");_(z,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Zt.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});_(z,"parseDeltaAngle",function(t,e){var n=fe(e-t),r=Math.min(Math.abs(e-t),360);return n*r});_(z,"getRealPieData",function(t){var e=t.data,n=t.children,r=A(t,!1),a=Jt(n,xt);return e&&e.length?e.map(function(i,s){return x(x(x({payload:i},r),i),a&&a[s]&&a[s].props)}):a&&a.length?a.map(function(i){return x(x({},r),i.props)}):[]});_(z,"parseCoordinateOfPie",function(t,e){var n=e.top,r=e.left,a=e.width,i=e.height,s=Qt(a,i),c=r+oe(t.cx,a,a/2),l=n+oe(t.cy,i,i/2),u=oe(t.innerRadius,s,0),d=oe(t.outerRadius,s,s*.8),m=t.maxRadius||Math.sqrt(a*a+i*i)/2;return{cx:c,cy:l,innerRadius:u,outerRadius:d,maxRadius:m}});_(z,"getComposedData",function(t){var e=t.item,n=t.offset,r=e.type.defaultProps!==void 0?x(x({},e.type.defaultProps),e.props):e.props,a=me.getRealPieData(r);if(!a||!a.length)return null;var i=r.cornerRadius,s=r.startAngle,c=r.endAngle,l=r.paddingAngle,u=r.dataKey,d=r.nameKey,m=r.valueKey,p=r.tooltipType,v=Math.abs(r.minAngle),y=me.parseCoordinateOfPie(r,n),h=me.parseDeltaAngle(s,c),g=Math.abs(h),b=u;J(u)&&J(m)?(ye(!1,`Use "dataKey" to specify the value of pie,
|
|
3
|
+
the props "valueKey" will be deprecated in 1.1.0`),b="value"):J(u)&&(ye(!1,`Use "dataKey" to specify the value of pie,
|
|
4
|
+
the props "valueKey" will be deprecated in 1.1.0`),b=m);var j=a.filter(function(O){return H(O,b,0)!==0}).length,k=(g>=360?j:j-1)*l,R=g-j*v-k,w=a.reduce(function(O,C){var T=H(C,b,0);return O+(S(T)?T:0)},0),N;if(w>0){var E;N=a.map(function(O,C){var T=H(O,b,0),L=H(O,d,C),se=(S(T)?T:0)/w,F;C?F=E.endAngle+fe(h)*l*(T!==0?1:0):F=s;var Fe=F+fe(h)*((T!==0?v:0)+se*R),Ke=(F+Fe)/2,Be=(y.innerRadius+y.outerRadius)/2,$t=[{name:L,value:T,payload:O,dataKey:b,type:p}],It=M(y.cx,y.cy,Be,Ke);return E=x(x(x({percent:se,cornerRadius:i,name:L,tooltipPayload:$t,midAngle:Ke,middleRadius:Be,tooltipPosition:It},O),y),{},{value:H(O,b),startAngle:F,endAngle:Fe,payload:O,paddingAngle:fe(h)*l}),E})}return x(x({},y),{},{sectors:N,data:a})});var an=["x1","y1","x2","y2","key"],sn=["offset"];function G(t){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(t)}function it(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function P(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?it(Object(n),!0).forEach(function(r){on(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):it(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function on(t,e,n){return e=ln(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ln(t){var e=cn(t,"string");return G(e)=="symbol"?e:e+""}function cn(t,e){if(G(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(G(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function W(){return W=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},W.apply(this,arguments)}function st(t,e){if(t==null)return{};var n=un(t,e),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function un(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var dn=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,a=e.x,i=e.y,s=e.width,c=e.height,l=e.ry;return f.createElement("rect",{x:a,y:i,ry:l,width:s,height:c,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Et(t,e){var n;if(f.isValidElement(t))n=f.cloneElement(t,e);else if(I(t))n=t(e);else{var r=e.x1,a=e.y1,i=e.x2,s=e.y2,c=e.key,l=st(e,an),u=A(l,!1);u.offset;var d=st(u,sn);n=f.createElement("line",W({},d,{x1:r,y1:a,x2:i,y2:s,fill:"none",key:c}))}return n}function fn(t){var e=t.x,n=t.width,r=t.horizontal,a=r===void 0?!0:r,i=t.horizontalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(c,l){var u=P(P({},t),{},{x1:e,y1:c,x2:e+n,y2:c,key:"line-".concat(l),index:l});return Et(a,u)});return f.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function hn(t){var e=t.y,n=t.height,r=t.vertical,a=r===void 0?!0:r,i=t.verticalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(c,l){var u=P(P({},t),{},{x1:c,y1:e,x2:c,y2:e+n,key:"line-".concat(l),index:l});return Et(a,u)});return f.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function mn(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,a=t.y,i=t.width,s=t.height,c=t.horizontalPoints,l=t.horizontal,u=l===void 0?!0:l;if(!u||!e||!e.length)return null;var d=c.map(function(p){return Math.round(p+a-a)}).sort(function(p,v){return p-v});a!==d[0]&&d.unshift(0);var m=d.map(function(p,v){var y=!d[v+1],h=y?a+s-p:d[v+1]-p;if(h<=0)return null;var g=v%e.length;return f.createElement("rect",{key:"react-".concat(v),y:p,x:r,height:h,width:i,stroke:"none",fill:e[g],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return f.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function pn(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,a=t.fillOpacity,i=t.x,s=t.y,c=t.width,l=t.height,u=t.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(p){return Math.round(p+i-i)}).sort(function(p,v){return p-v});i!==d[0]&&d.unshift(0);var m=d.map(function(p,v){var y=!d[v+1],h=y?i+c-p:d[v+1]-p;if(h<=0)return null;var g=v%r.length;return f.createElement("rect",{key:"react-".concat(v),x:p,y:s,width:h,height:l,stroke:"none",fill:r[g],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return f.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var yn=function(e,n){var r=e.xAxis,a=e.width,i=e.height,s=e.offset;return bt(jt(P(P(P({},kt.defaultProps),r),{},{ticks:At(r,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.left,s.left+s.width,n)},vn=function(e,n){var r=e.yAxis,a=e.width,i=e.height,s=e.offset;return bt(jt(P(P(P({},kt.defaultProps),r),{},{ticks:At(r,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.top,s.top+s.height,n)},q={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Me(t){var e,n,r,a,i,s,c=Xt(),l=er(),u=tr(),d=P(P({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:q.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:q.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:q.horizontal,horizontalFill:(a=t.horizontalFill)!==null&&a!==void 0?a:q.horizontalFill,vertical:(i=t.vertical)!==null&&i!==void 0?i:q.vertical,verticalFill:(s=t.verticalFill)!==null&&s!==void 0?s:q.verticalFill,x:S(t.x)?t.x:u.left,y:S(t.y)?t.y:u.top,width:S(t.width)?t.width:u.width,height:S(t.height)?t.height:u.height}),m=d.x,p=d.y,v=d.width,y=d.height,h=d.syncWithTicks,g=d.horizontalValues,b=d.verticalValues,j=rr(),k=nr();if(!S(v)||v<=0||!S(y)||y<=0||!S(m)||m!==+m||!S(p)||p!==+p)return null;var R=d.verticalCoordinatesGenerator||yn,w=d.horizontalCoordinatesGenerator||vn,N=d.horizontalPoints,E=d.verticalPoints;if((!N||!N.length)&&I(w)){var O=g&&g.length,C=w({yAxis:k?P(P({},k),{},{ticks:O?g:k.ticks}):void 0,width:c,height:l,offset:u},O?!0:h);ye(Array.isArray(C),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(G(C),"]")),Array.isArray(C)&&(N=C)}if((!E||!E.length)&&I(R)){var T=b&&b.length,L=R({xAxis:j?P(P({},j),{},{ticks:T?b:j.ticks}):void 0,width:c,height:l,offset:u},T?!0:h);ye(Array.isArray(L),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(G(L),"]")),Array.isArray(L)&&(E=L)}return f.createElement("g",{className:"recharts-cartesian-grid"},f.createElement(dn,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),f.createElement(fn,W({},d,{offset:u,horizontalPoints:N,xAxis:j,yAxis:k})),f.createElement(hn,W({},d,{offset:u,verticalPoints:E,xAxis:j,yAxis:k})),f.createElement(mn,W({},d,{horizontalPoints:N})),f.createElement(pn,W({},d,{verticalPoints:E})))}Me.displayName="CartesianGrid";var gn=Ot({chartName:"BarChart",GraphicalChild:he,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:$e},{axisType:"yAxis",AxisComp:Ie}],formatAxisMap:ar}),xn=Ot({chartName:"PieChart",GraphicalChild:z,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:ke},{axisType:"radiusAxis",AxisComp:je}],formatAxisMap:ir,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function Ct(t,e){const n=()=>Lt(e?.in,NaN),a=kn(t);let i;if(a.date){const u=On(a.date,2);i=Pn(u.restDateString,u.year)}if(!i||isNaN(+i))return n();const s=+i;let c=0,l;if(a.time&&(c=Sn(a.time),isNaN(c)))return n();if(a.timezone){if(l=wn(a.timezone),isNaN(l))return n()}else{const u=new Date(s+c),d=Ve(0,e?.in);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return Ve(s+c+l,e?.in)}const ce={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},bn=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,jn=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,An=/^([+-])(\d{2})(?::?(\d{2}))?$/;function kn(t){const e={},n=t.split(ce.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],ce.timeZoneDelimiter.test(e.date)&&(e.date=t.split(ce.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const a=ce.timezone.exec(r);a?(e.time=r.replace(a[1],""),e.timezone=a[1]):e.time=r}return e}function On(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const a=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?a:i*100,restDateString:t.slice((r[1]||r[2]).length)}}function Pn(t,e){if(e===null)return new Date(NaN);const n=t.match(bn);if(!n)return new Date(NaN);const r=!!n[4],a=te(n[1]),i=te(n[2])-1,s=te(n[3]),c=te(n[4]),l=te(n[5])-1;if(r)return Cn(e,c,l)?Nn(e,c,l):new Date(NaN);{const u=new Date(0);return!_n(e,i,s)||!En(e,a)?new Date(NaN):(u.setUTCFullYear(e,i,Math.max(a,s)),u)}}function te(t){return t?parseInt(t):1}function Sn(t){const e=t.match(jn);if(!e)return NaN;const n=Se(e[1]),r=Se(e[2]),a=Se(e[3]);return Dn(n,r,a)?n*ht+r*mt+a*1e3:NaN}function Se(t){return t&&parseFloat(t.replace(",","."))||0}function wn(t){if(t==="Z")return 0;const e=t.match(An);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return $n(r,a)?n*(r*ht+a*mt):NaN}function Nn(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const a=r.getUTCDay()||7,i=(e-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const Tn=[31,null,31,30,31,30,31,31,30,31,30,31];function Dt(t){return t%400===0||t%4===0&&t%100!==0}function _n(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(Tn[e]||(Dt(t)?29:28))}function En(t,e){return e>=1&&e<=(Dt(t)?366:365)}function Cn(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function Dn(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function $n(t,e){return e>=0&&e<=59}function In({data:t}){const e=t.map(n=>({...n,dateLabel:pe(new Date(n.date),"MMM d")}));return o.jsxs("div",{className:"rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Daily Activity"}),o.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Messages, sessions, and tool calls per day"}),o.jsx("div",{className:"mt-4 h-64",children:o.jsx(Re,{width:"100%",height:"100%",children:o.jsxs(gn,{data:e,children:[o.jsx(Me,{strokeDasharray:"3 3",stroke:"#1f2937"}),o.jsx($e,{dataKey:"dateLabel",tick:{fill:"#6b7280",fontSize:10},tickLine:!1}),o.jsx(Ie,{tick:{fill:"#6b7280",fontSize:10},tickLine:!1,axisLine:!1}),o.jsx(Le,{contentStyle:{backgroundColor:"#111827",border:"1px solid #374151",borderRadius:"8px",fontSize:"12px"}}),o.jsx(he,{dataKey:"messageCount",name:"Messages",fill:"#3b82f6",radius:[2,2,0,0]}),o.jsx(he,{dataKey:"toolCallCount",name:"Tool Calls",fill:"#8b5cf6",radius:[2,2,0,0]}),o.jsx(he,{dataKey:"sessionCount",name:"Sessions",fill:"#10b981",radius:[2,2,0,0]})]})})})]})}const ue=["#3b82f6","#8b5cf6","#10b981","#f59e0b","#ef4444","#6366f1"];function ze(t){return t.replace(/^claude-/,"").split("-202")[0]}function Rn(t,e){const n={};for(const s of t)for(const[c,l]of Object.entries(s.tokensByModel)){const u=ze(c);n[u]=(n[u]??0)+l}const r=Object.entries(n).sort((s,c)=>c[1]-s[1]),a=r.slice(0,e).map(([s])=>s),i=r.length>e;return{topModels:a,hasOther:i}}function Ln(t,e,n){return t.map(r=>{const a={dateLabel:pe(Ct(r.date),"MMM d"),sortKey:r.date};for(const i of e)a[i]=0;n&&(a.Other=0);for(const[i,s]of Object.entries(r.tokensByModel)){const c=ze(i);e.includes(c)?a[c]=a[c]+s:n&&(a.Other=a.Other+s)}return a})}function Mn(t,e,n){const r=new Map;for(const a of t){const i=Mt(Ct(a.date)),s=pe(i,"yyyy-MM-dd");if(!r.has(s)){const l={dateLabel:`Week of ${pe(i,"MMM d")}`,sortKey:s};for(const u of e)l[u]=0;n&&(l.Other=0),r.set(s,l)}const c=r.get(s);for(const[l,u]of Object.entries(a.tokensByModel)){const d=ze(l);e.includes(d)?c[d]=c[d]+u:n&&(c.Other=c.Other+u)}}return Array.from(r.values()).sort((a,i)=>a.sortKey.localeCompare(i.sortKey))}function zn({active:t,payload:e,label:n}){if(!t||!e||e.length===0)return null;const r=e.reduce((a,i)=>a+i.value,0);return o.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 p-3 text-xs shadow-lg",children:[o.jsx("p",{className:"mb-2 font-medium text-gray-300",children:n}),e.filter(a=>a.value>0).sort((a,i)=>i.value-a.value).map(a=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:a.color}}),o.jsx("span",{className:"text-gray-400",children:a.name})]}),o.jsx("span",{className:"font-mono text-gray-300",children:ie(a.value)})]},a.name)),o.jsxs("div",{className:"mt-1.5 border-t border-gray-700 pt-1.5 flex justify-between",children:[o.jsx("span",{className:"text-gray-400",children:"Total"}),o.jsx("span",{className:"font-mono font-medium text-white",children:ie(r)})]})]})}function Fn({data:t}){const[e,n]=$.useState("daily"),{topModels:r,hasOther:a}=$.useMemo(()=>Rn(t,5),[t]),i=$.useMemo(()=>{const c=[...r];return a&&c.push("Other"),c},[r,a]),s=$.useMemo(()=>e==="weekly"?Mn(t,r,a):Ln(t,r,a),[t,r,a,e]);return t.length===0?o.jsxs("div",{className:"rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Token Usage Over Time"}),o.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Total tokens by model per day"}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx("p",{className:"text-sm text-gray-500",children:"No data available"})})]}):o.jsxs("div",{className:"rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Token Usage Over Time"}),o.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Total tokens by model per day"})]}),o.jsxs("div",{className:"flex rounded-lg border border-gray-700 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>n("daily"),className:`rounded-l-lg px-3 py-1 ${e==="daily"?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:"Daily"}),o.jsx("button",{type:"button",onClick:()=>n("weekly"),className:`rounded-r-lg px-3 py-1 ${e==="weekly"?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:"Weekly"})]})]}),o.jsx("div",{className:"mt-4 h-72",children:o.jsx(Re,{width:"100%",height:"100%",children:o.jsxs(sr,{data:s,children:[o.jsx(Me,{strokeDasharray:"3 3",stroke:"#1f2937"}),o.jsx($e,{dataKey:"dateLabel",tick:{fill:"#6b7280",fontSize:10},tickLine:!1}),o.jsx(Ie,{tick:{fill:"#6b7280",fontSize:10},tickLine:!1,axisLine:!1,tickFormatter:c=>ie(c)}),o.jsx(Le,{content:o.jsx(zn,{})}),i.map((c,l)=>o.jsx(or,{type:"monotone",dataKey:c,stackId:"1",stroke:ue[l%ue.length],fill:ue[l%ue.length],fillOpacity:.6},c))]})})})]})}const ot=["#3b82f6","#8b5cf6","#10b981","#f59e0b","#ef4444","#6366f1"];function Kn({data:t}){const e=Object.entries(t).map(([n,r])=>({name:n.replace(/^claude-/,"").split("-202")[0],fullName:n,totalTokens:r.inputTokens+r.outputTokens,outputTokens:r.outputTokens}));return e.sort((n,r)=>r.totalTokens-n.totalTokens),o.jsxs("div",{className:"rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Model Usage"}),o.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Token usage by model"}),o.jsx("div",{className:"mt-4 h-64",children:o.jsx(Re,{width:"100%",height:"100%",children:o.jsxs(xn,{children:[o.jsx(z,{data:e,cx:"50%",cy:"50%",innerRadius:50,outerRadius:80,dataKey:"totalTokens",nameKey:"name",strokeWidth:0,children:e.map((n,r)=>o.jsx(xt,{fill:ot[r%ot.length],opacity:.8},r))}),o.jsx(Le,{formatter:n=>ie(n),contentStyle:{backgroundColor:"#111827",border:"1px solid #374151",borderRadius:"8px",fontSize:"12px"}}),o.jsx(lr,{wrapperStyle:{fontSize:"11px"}})]})})})]})}function Bn({hourCounts:t}){const e=Array.from({length:24},(r,a)=>({hour:a,label:`${a.toString().padStart(2,"0")}:00`,count:t[String(a)]??0})),n=Math.max(...e.map(r=>r.count),1);return o.jsxs("div",{className:"rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Hourly Distribution"}),o.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Session starts by hour of day"}),o.jsx("div",{className:"mt-4 flex items-end gap-0.5",style:{height:"120px"},children:e.map(r=>{const a=r.count>0?Math.max(r.count/n*100,4):0,i=r.count/n;return o.jsxs("div",{className:"group relative flex-1",style:{height:"100%"},children:[o.jsx("div",{className:"absolute bottom-0 w-full rounded-t transition-colors",style:{height:`${a}%`,backgroundColor:`rgba(59, 130, 246, ${.2+i*.6})`}}),o.jsxs("div",{className:"absolute -top-8 left-1/2 hidden -translate-x-1/2 whitespace-nowrap rounded bg-gray-800 px-1.5 py-0.5 text-[10px] text-gray-300 group-hover:block",children:[r.label,": ",r.count]})]},r.hour)})}),o.jsxs("div",{className:"mt-1 flex justify-between text-[10px] text-gray-600",children:[o.jsx("span",{children:"00:00"}),o.jsx("span",{children:"06:00"}),o.jsx("span",{children:"12:00"}),o.jsx("span",{children:"18:00"}),o.jsx("span",{children:"23:00"})]})]})}const Un=ut({method:"GET"}).handler(lt("64052f224a1d6696436e5d3deeee2b798f0742e1292ffabd038c3a7bf75e6fcb")),Vn=dt({queryKey:["projects","analytics"],queryFn:()=>Un(),refetchInterval:6e4}),Wn=[{key:"projectName",label:"Project"},{key:"totalSessions",label:"Sessions",align:"right"},{key:"totalMessages",label:"Messages",align:"right"},{key:"totalDurationMs",label:"Duration",align:"right"},{key:"lastSessionAt",label:"Last Active",align:"right"}];function Gn({projects:t}){const[e,n]=$.useState("lastSessionAt"),[r,a]=$.useState("desc"),i=$.useMemo(()=>{const l=[...t];return l.sort((u,d)=>{let m=0;switch(e){case"projectName":m=u.projectName.localeCompare(d.projectName);break;case"totalSessions":m=u.totalSessions-d.totalSessions;break;case"totalMessages":m=u.totalMessages-d.totalMessages;break;case"totalDurationMs":m=u.totalDurationMs-d.totalDurationMs;break;case"lastSessionAt":m=u.lastSessionAt.localeCompare(d.lastSessionAt);break}return r==="asc"?m:-m}),l},[t,e,r]);function s(l){l===e?a(u=>u==="asc"?"desc":"asc"):(n(l),a("desc"))}function c(l){return l!==e?null:o.jsx("span",{className:"ml-1",children:r==="asc"?"▲":"▼"})}return o.jsx("div",{className:"overflow-x-auto rounded-xl border border-gray-800 bg-gray-900/50",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{children:o.jsx("tr",{className:"border-b border-gray-800",children:Wn.map(l=>o.jsxs("th",{onClick:()=>s(l.key),className:`cursor-pointer px-4 py-3 text-xs font-medium text-gray-400 hover:text-gray-200 ${l.align==="right"?"text-right":"text-left"}`,children:[l.label,c(l.key)]},l.key))})}),o.jsx("tbody",{children:i.map(l=>o.jsxs("tr",{className:"border-b border-gray-800/50 transition-colors hover:bg-gray-800/30",children:[o.jsxs("td",{className:"px-4 py-3",children:[o.jsx(Rt,{to:"/sessions",search:{project:l.projectName},className:"text-sm text-blue-400 hover:underline",children:l.projectName}),l.activeSessions>0&&o.jsxs("span",{className:"ml-2 rounded-full bg-green-500/20 px-1.5 py-0.5 text-[10px] font-medium text-green-400",children:[l.activeSessions," active"]})]}),o.jsx("td",{className:"px-4 py-3 text-right font-mono text-sm text-gray-300",children:l.totalSessions}),o.jsx("td",{className:"px-4 py-3 text-right font-mono text-sm text-gray-300",children:l.totalMessages.toLocaleString()}),o.jsx("td",{className:"px-4 py-3 text-right font-mono text-sm text-gray-300",children:Ee(l.totalDurationMs)}),o.jsx("td",{className:"px-4 py-3 text-right text-sm text-gray-400",children:zt(l.lastSessionAt)})]},l.projectPath))})]})})}function qn(){const{data:t,isLoading:e}=ft(Vn);if(e)return o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3",children:Array.from({length:3}).map((s,c)=>o.jsx("div",{className:"h-20 animate-pulse rounded-xl bg-gray-900/50"},c))}),o.jsx("div",{className:"h-64 animate-pulse rounded-xl bg-gray-900/50"})]});const n=t?.projects??[];if(n.length===0)return o.jsx("div",{className:"py-12 text-center text-sm text-gray-500",children:"No projects found. Sessions will appear here once scanned."});const r=n.reduce((s,c)=>s+c.totalSessions,0),a=n.reduce((s,c)=>s+c.totalDurationMs,0),i=n.reduce((s,c)=>c.totalSessions>s.totalSessions?c:s);return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-4",children:[o.jsx(de,{label:"Total Projects",value:String(n.length)}),o.jsx(de,{label:"Total Sessions",value:r.toLocaleString()}),o.jsx(de,{label:"Total Duration",value:Ee(a)}),o.jsx(de,{label:"Most Active",value:i.projectName,sub:`${i.totalSessions} sessions`})]}),o.jsx(Gn,{projects:n})]})}function de({label:t,value:e,sub:n}){return o.jsxs("div",{className:"rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:[o.jsx("p",{className:"text-xs text-gray-400",children:t}),o.jsx("p",{className:"mt-1 truncate text-xl font-bold text-white",children:e}),n&&o.jsx("p",{className:"mt-0.5 text-xs text-gray-500",children:n})]})}const Hn={};function ta(){const{tab:t}=Ue.useSearch(),e=Ue.useNavigate(),{data:n,isLoading:r}=ft(yr),a=$.useMemo(()=>{if(!n)return Hn;const s={};for(const[c,l]of Object.entries(n.modelUsage))s[c]={inputTokens:l.inputTokens,outputTokens:l.outputTokens,cacheReadInputTokens:l.cacheReadInputTokens,cacheCreationInputTokens:l.cacheCreationInputTokens};return s},[n]),{cost:i}=cr(a);return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-white",children:"Stats"}),o.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Usage analytics and project insights"})]}),t==="overview"&&n&&o.jsx(ur,{options:[{label:"Daily Activity (CSV)",onClick:()=>le(dr(n),"daily-activity.csv","text/csv")},{label:"Token Usage (CSV)",onClick:()=>le(fr(n),"daily-tokens.csv","text/csv")},{label:"Model Usage (CSV)",onClick:()=>le(hr(n),"model-usage.csv","text/csv")},{label:"Full Stats (JSON)",onClick:()=>le(mr(n),"stats.json","application/json")}]})]}),o.jsxs("div",{className:"mt-4 flex gap-1 border-b border-gray-800",children:[o.jsx("button",{onClick:()=>e({search:{tab:"overview"}}),className:`px-4 py-2 text-sm border-b-2 transition-colors ${t==="overview"?"border-blue-500 text-white":"border-transparent text-gray-400 hover:text-gray-200"}`,children:"Overview"}),o.jsx("button",{onClick:()=>e({search:{tab:"projects"}}),className:`px-4 py-2 text-sm border-b-2 transition-colors ${t==="projects"?"border-blue-500 text-white":"border-transparent text-gray-400 hover:text-gray-200"}`,children:"Projects"})]}),t==="overview"?o.jsx(Yn,{stats:n,isLoading:r,cost:i}):o.jsx("div",{className:"mt-6",children:o.jsx(qn,{})})]})}function Yn({stats:t,isLoading:e,cost:n}){if(e)return o.jsxs("div",{className:"mt-6 space-y-4",children:[o.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-5",children:Array.from({length:5}).map((a,i)=>o.jsx("div",{className:"h-20 animate-pulse rounded-xl bg-gray-900/50"},i))}),Array.from({length:3}).map((a,i)=>o.jsx("div",{className:"h-64 animate-pulse rounded-xl bg-gray-900/50"},i))]});if(!t)return o.jsx("div",{className:"py-12 text-center text-sm text-gray-500",children:"No stats data found. Check ~/.claude/stats-cache.json"});const r=Object.values(t.modelUsage).reduce((a,i)=>a+i.inputTokens+i.outputTokens,0);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3 md:grid-cols-5",children:[o.jsx(re,{label:"Total Sessions",value:String(t.totalSessions)}),o.jsx(re,{label:"Total Messages",value:t.totalMessages.toLocaleString()}),o.jsx(re,{label:"Total Tokens",value:ie(r),sub:n?`~${We(n.totalUSD)}`:void 0}),o.jsx(re,{label:"Total Estimated Cost",value:n?`~${We(n.totalUSD)}`:"N/A"}),o.jsx(re,{label:"Longest Session",value:Ee(t.longestSession.duration),sub:`${t.longestSession.messageCount} messages`})]}),o.jsx("div",{className:"mt-6",children:o.jsx(In,{data:t.dailyActivity})}),o.jsx("div",{className:"mt-4",children:o.jsx(Fn,{data:t.dailyModelTokens})}),o.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsx(Kn,{data:t.modelUsage}),o.jsx(Bn,{hourCounts:t.hourCounts})]})]})}function re({label:t,value:e,sub:n}){return o.jsxs("div",{className:"rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:[o.jsx("p",{className:"text-xs text-gray-400",children:t}),o.jsx("p",{className:"mt-1 text-xl font-bold text-white",children:e}),n&&o.jsx("p",{className:"mt-0.5 text-xs text-gray-500",children:n})]})}export{ta as component};
|