claude-session-dashboard 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -14
- package/dist/client/assets/_dashboard-I7m6D7BE.js +1 -0
- package/dist/client/assets/_sessionId-DEliIff6.js +12 -0
- package/dist/client/assets/app-D7yorIIh.css +1 -0
- package/dist/client/assets/{createServerFn-Le0d8Pjz.js → createServerFn-Bn6_ISOt.js} +1 -1
- package/dist/client/assets/format-Bsprb3az.js +1 -0
- package/dist/client/assets/index-BkqRvnEf.js +1 -0
- package/dist/client/assets/{main-CzD8HjLq.js → main-CfJIADCp.js} +7 -7
- package/dist/client/assets/sessions.queries-CrJg4dYU.js +1 -0
- package/dist/client/assets/settings-C4_lsEzl.js +1 -0
- package/dist/client/assets/{settings.types-B4841OLF.js → settings.types-9Qf5WcRY.js} +1 -1
- package/dist/client/assets/stats-_r1gmaTe.js +4 -0
- package/dist/client/assets/useSessionCost-DPZ-ubM1.js +65 -0
- package/dist/client/favicon.svg +3 -0
- package/dist/server/assets/_dashboard-TUzgwLqB.js +112 -0
- package/dist/server/assets/{_sessionId-BwZK4Ezz.js → _sessionId-C-XZIPqn.js} +57 -35
- package/dist/server/assets/_tanstack-start-manifest_v-B51mSkGz.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-CKfH7HpA.js} +28 -60
- package/dist/server/assets/project-analytics.server-BkWSd6a8.js +61 -0
- package/dist/server/assets/{router-xTSe9UH_.js → router-Cb_hBXHI.js} +62 -31
- 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/{settings-ko61yfVs.js → settings-C0_KyVQQ.js} +66 -20
- package/dist/server/assets/stats-BtgVene-.js +886 -0
- package/dist/server/assets/{stats.server-BZWxV-mC.js → stats.server-qTOvID9-.js} +62 -3
- package/dist/server/assets/useSessionCost-CYs5UOX-.js +209 -0
- package/dist/server/server.js +13 -10
- package/package.json +11 -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/settings-BSPc79zZ.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/_dashboard--ukhquwO.js +0 -97
- 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,t as c,w as s,y as d,v as n,A as i}from"./main-CfJIADCp.js";import{c as a,q as r}from"./createServerFn-Bn6_ISOt.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")),b=r({queryKey:["sessions","active"],queryFn:()=>f(),refetchInterval:3e3});function u(t){return r({queryKey:["sessions","paginated",t],queryFn:()=>o({data:t}),placeholderData:i,refetchInterval:3e4})}export{b as a,u as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,b as f,r as p}from"./main-CfJIADCp.js";import{u as N}from"./createServerFn-Bn6_ISOt.js";import{S as v,D as y,u as k,a as b,s as P}from"./settings.types-9Qf5WcRY.js";function T({value:a,onChange:n}){return e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",children:v.map(i=>{const d=a===i.id;return e.jsxs("button",{type:"button",onClick:()=>n(i.id),className:`rounded-lg border px-3 py-2 text-left transition-colors ${d?"border-brand-500 bg-brand-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:i.displayName}),e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-gray-500",children:i.monthlyUSD!==null?`$${i.monthlyUSD}/mo`:"Custom"})]},i.id)})})}const j=[{key:"inputPerMTok",label:"Input"},{key:"outputPerMTok",label:"Output"},{key:"cacheReadPerMTok",label:"Cache Read"},{key:"cacheWritePerMTok",label:"Cache Write"}];function S({overrides:a,onChange:n}){function i(t,r,c){const o=parseFloat(c);if(!Number.isFinite(o)||o<0||o>1e6)return;const s=y.find(g=>g.modelId===t);if(!s)return;const l=a[t]?{...a[t]}:{inputPerMTok:s.inputPerMTok,outputPerMTok:s.outputPerMTok,cacheReadPerMTok:s.cacheReadPerMTok,cacheWritePerMTok:s.cacheWritePerMTok};l[r]=o;const h=l.inputPerMTok===s.inputPerMTok&&l.outputPerMTok===s.outputPerMTok&&l.cacheReadPerMTok===s.cacheReadPerMTok&&l.cacheWritePerMTok===s.cacheWritePerMTok,x={...a};h?delete x[t]:x[t]=l,n(x)}function d(t,r){const c=a[t.modelId];return c?c[r]:t[r]}function u(t,r){const c=a[t];if(!c)return!1;const o=y.find(s=>s.modelId===t);return o?c[r]!==o[r]:!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"}),j.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:y.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}),j.map(r=>{const c=d(t,r.key),o=u(t.modelId,r.key);return e.jsx("td",{className:"px-1 py-1.5",children:e.jsx("input",{type:"number",step:"0.01",min:"0",value:c,onChange:s=>i(t.modelId,r.key,s.target.value),className:`w-20 rounded border px-2 py-1 text-right font-mono text-xs ${o?"border-brand-500/50 bg-brand-500/10 text-brand-400":"border-gray-700 bg-gray-800 text-gray-300"} focus:border-brand-500 focus:outline-none`})},r.key)})]},t.modelId))})]}),e.jsx("p",{className:"mt-2 text-[10px] text-gray-600",children:"Prices in USD per million tokens. Overridden values are highlighted."})]})}function M(){const{data:a,isLoading:n}=N(P);return n||!a?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.jsx(C,{settings:a})}function C({settings:a}){const n=k(),{privacyMode:i,togglePrivacyMode:d}=f(),[u,t]=p.useState(a.subscriptionTier),[r,c]=p.useState(a.pricingOverrides),[o,s]=p.useState(!1);function l(m){t(m),s(!0)}function h(m){c(m),s(!0)}function x(){t(b.subscriptionTier),c(b.pricingOverrides),s(!0)}function g(){const m={version:1,subscriptionTier:u,pricingOverrides:r};n.mutate(m,{onSuccess:()=>{s(!1)}})}return 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:"Privacy Mode"}),e.jsx("p",{className:"mt-1 text-[10px] text-gray-500",children:"Hide project names, file paths, and branch names across the dashboard. Useful when screen-sharing or recording demos."}),e.jsxs("div",{className:"mt-3 rounded-xl border border-gray-800 bg-gray-900/50 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-gray-300",children:"Enable privacy mode"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-gray-500",children:i?"On":"Off"}),e.jsx("button",{type:"button",role:"switch","aria-checked":i,onClick:d,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full transition-colors ${i?"bg-brand-600":"bg-gray-800"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${i?"translate-x-[18px]":"translate-x-[3px]"}`})})]})]}),e.jsxs("div",{className:"mt-3 border-t border-gray-800 pt-3",children:[e.jsx("p",{className:"text-[10px] font-medium text-gray-400",children:"What gets hidden:"}),e.jsxs("ul",{className:"mt-1.5 space-y-1 text-[10px] text-gray-500",children:[e.jsxs("li",{children:[e.jsx("span",{className:"text-gray-400",children:"Project names"})," ",e.jsx("span",{className:"font-mono text-gray-600",children:"→ project-1, project-2, ..."})]}),e.jsxs("li",{children:[e.jsx("span",{className:"text-gray-400",children:"File paths"})," ",e.jsx("span",{className:"font-mono text-gray-600",children:"→ .../project-1"})]}),e.jsxs("li",{children:[e.jsx("span",{className:"text-gray-400",children:"Branch names"})," ",e.jsx("span",{className:"font-mono text-gray-600",children:"→ branch-1, branch-2, ..."})]})]})]})]})]}),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(T,{value:u,onChange:l})})]}),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(S,{overrides:r,onChange:h})})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsx("button",{type:"button",onClick:x,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:[n.isSuccess&&!o&&e.jsx("span",{className:"text-xs text-emerald-400",children:"Saved"}),n.isError&&e.jsxs("span",{className:"text-xs text-red-400",children:["Failed to save: ",n.error?.message??"Unknown error"]}),e.jsx("button",{type:"button",onClick:g,disabled:!o||n.isPending,className:`rounded-lg px-4 py-1.5 text-xs font-medium transition-colors ${o&&!n.isPending?"bg-brand-600 text-white hover:bg-brand-500":"cursor-not-allowed bg-gray-800 text-gray-500"}`,children:n.isPending?"Saving...":"Save"})]})]})]})}function O(){return e.jsx(M,{})}export{O as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,q as M}from"./createServerFn-
|
|
1
|
+
import{c as d,q as M}from"./createServerFn-Bn6_ISOt.js";import{S as P,s as k,l as u,m as b,n as h,o as l,r,p as f,q as S,c as p,t as m,v as o,w as c,x as v,y as O,z as C}from"./main-CfJIADCp.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 ht,R as p,g as pt,r as _,j as o,a as Ut,b as yt,L as Wt,d as qe}from"./main-CfJIADCp.js";import{c as gt,q as vt,u as xt}from"./createServerFn-Bn6_ISOt.js";import{t as ve,c as bt,m as jt,a as kt,f as G,b as ee,s as Vt,d as Ie,e as Gt,g as Ye}from"./format-Bsprb3az.js";import{c as B,f as A,r as At,a as Ht,b as Ot,d as qt,i as L,T as Le,p as R,L as I,g as Nt,e as $e,h as wt,D as Yt,C as Zt,j as X,k as Z,S as Jt,A as Qt,l as Xt,m as Ze,n as er,o as w,q as tr,u as rr,G as nr,s as pe,t as ar,v as Pt,w as ir,x as ue,y as xe,z as sr,B as or,E as lr,F as cr,H as ur,I as St,J as Tt,K as _t,M as Ct,N as Et,O as ye,X as Re,Y as ze,P as dr,Q as fr,R as Fe,U as Be,V as mr,W as hr,Z as pr,_ as yr,$ as gr,a0 as de,a1 as vr,a2 as xr,a3 as br,a4 as jr}from"./useSessionCost-DPZ-ubM1.js";import"./settings.types-9Qf5WcRY.js";const kr=gt({method:"GET"}).handler(ht("4b9a58c176f487b49800a372100037cdf33cf048f3592a449f115c7e3f5ea799")),Ar=vt({queryKey:["stats"],queryFn:()=>kr(),refetchInterval:6e4});var Or=["points","className","baseLinePoints","connectNulls"];function J(){return J=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},J.apply(this,arguments)}function Nr(t,e){if(t==null)return{};var n=wr(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 wr(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 Je(t){return _r(t)||Tr(t)||Sr(t)||Pr()}function Pr(){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 Sr(t,e){if(t){if(typeof t=="string")return Ce(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 Ce(t,e)}}function Tr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _r(t){if(Array.isArray(t))return Ce(t)}function Ce(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 Qe=function(e){return e&&e.x===+e.x&&e.y===+e.y},Cr=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){Qe(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),Qe(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},oe=function(e,n){var r=Cr(e);n&&(r=[r.reduce(function(i,s){return[].concat(Je(i),Je(s))},[])]);var a=r.map(function(i){return i.reduce(function(s,c,u){return"".concat(s).concat(u===0?"M":"L").concat(c.x,",").concat(c.y)},"")}).join("");return r.length===1?"".concat(a,"Z"):a},Er=function(e,n,r){var a=oe(e,r);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(oe(n.reverse(),r).slice(1))},Dr=function(e){var n=e.points,r=e.className,a=e.baseLinePoints,i=e.connectNulls,s=Nr(e,Or);if(!n||!n.length)return null;var c=B("recharts-polygon",r);if(a&&a.length){var u=s.stroke&&s.stroke!=="none",l=Er(n,a,i);return p.createElement("g",{className:c},p.createElement("path",J({},A(s,!0),{fill:l.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:l})),u?p.createElement("path",J({},A(s,!0),{fill:"none",d:oe(n,i)})):null,u?p.createElement("path",J({},A(s,!0),{fill:"none",d:oe(a,i)})):null)}var d=oe(n,i);return p.createElement("path",J({},A(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:c,d}))},Pe,Xe;function Mr(){if(Xe)return Pe;Xe=1;var t=At(),e=Ht(),n=Ot();function r(a,i){return a&&a.length?t(a,n(i,2),e):void 0}return Pe=r,Pe}var Ir=Mr();const Lr=pt(Ir);var Se,et;function $r(){if(et)return Se;et=1;var t=At(),e=Ot(),n=qt();function r(a,i){return a&&a.length?t(a,e(i,2),n):void 0}return Se=r,Se}var Rr=$r();const zr=pt(Rr);var Fr=["cx","cy","angle","ticks","axisLine"],Br=["ticks","tick","angle","tickFormatter","stroke"];function te(t){"@babel/helpers - typeof";return te=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},te(t)}function le(){return le=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},le.apply(this,arguments)}function tt(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 K(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tt(Object(n),!0).forEach(function(r){Ae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rt(t,e){if(t==null)return{};var n=Kr(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 Kr(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 Ur(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nt(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,Mt(r.key),r)}}function Wr(t,e,n){return e&&nt(t.prototype,e),n&&nt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vr(t,e,n){return e=be(e),Gr(t,Dt()?Reflect.construct(e,n||[],be(t).constructor):e.apply(t,n))}function Gr(t,e){if(e&&(te(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hr(t)}function Hr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Dt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Dt=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},be(t)}function qr(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&&Ee(t,e)}function Ee(t,e){return Ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Ee(t,e)}function Ae(t,e,n){return e=Mt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mt(t){var e=Yr(t,"string");return te(e)=="symbol"?e:e+""}function Yr(t,e){if(te(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(te(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Oe=(function(t){function e(){return Ur(this,e),Vr(this,e,arguments)}return qr(e,t),Wr(e,[{key:"getTickValueCoord",value:function(r){var a=r.coordinate,i=this.props,s=i.angle,c=i.cx,u=i.cy;return R(c,u,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,u=Lr(c,function(d){return d.coordinate||0}),l=zr(c,function(d){return d.coordinate||0});return{cx:a,cy:i,startAngle:s,endAngle:s,innerRadius:l.coordinate||0,outerRadius:u.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,a=r.cx,i=r.cy,s=r.angle,c=r.ticks,u=r.axisLine,l=rt(r,Fr),d=c.reduce(function(g,f){return[Math.min(g[0],f.coordinate),Math.max(g[1],f.coordinate)]},[1/0,-1/0]),y=R(a,i,d[0],s),h=R(a,i,d[1],s),v=K(K(K({},A(l,!1)),{},{fill:"none"},A(u,!1)),{},{x1:y.x,y1:y.y,x2:h.x,y2:h.y});return p.createElement("line",le({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,u=a.tickFormatter,l=a.stroke,d=rt(a,Br),y=this.getTickTextAnchor(),h=A(d,!1),v=A(s,!1),g=i.map(function(f,m){var x=r.getTickValueCoord(f),b=K(K(K(K({textAnchor:y,transform:"rotate(".concat(90-c,", ").concat(x.x,", ").concat(x.y,")")},h),{},{stroke:"none",fill:l},v),{},{index:m},x),{},{payload:f});return p.createElement(I,le({className:B("recharts-polar-radius-axis-tick",Nt(s)),key:"tick-".concat(f.coordinate)},$e(r.props,f,m)),e.renderTickItem(s,b,u?u(f.value,m):f.value))});return p.createElement(I,{className:"recharts-polar-radius-axis-ticks"},g)}},{key:"render",value:function(){var r=this.props,a=r.ticks,i=r.axisLine,s=r.tick;return!a||!a.length?null:p.createElement(I,{className:B("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),s&&this.renderTicks(),wt.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,a,i){var s;return p.isValidElement(r)?s=p.cloneElement(r,a):L(r)?s=r(a):s=p.createElement(Le,le({},a,{className:"recharts-polar-radius-axis-tick-value"}),i),s}}])})(_.PureComponent);Ae(Oe,"displayName","PolarRadiusAxis");Ae(Oe,"axisType","radiusAxis");Ae(Oe,"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 re(t){"@babel/helpers - typeof";return re=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},re(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 at(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?at(Object(n),!0).forEach(function(r){Ne(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):at(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Zr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function it(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,Lt(r.key),r)}}function Jr(t,e,n){return e&&it(t.prototype,e),n&&it(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Qr(t,e,n){return e=je(e),Xr(t,It()?Reflect.construct(e,n||[],je(t).constructor):e.apply(t,n))}function Xr(t,e){if(e&&(re(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return en(t)}function en(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function It(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(It=function(){return!!t})()}function je(t){return je=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},je(t)}function tn(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&&De(t,e)}function De(t,e){return De=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},De(t,e)}function Ne(t,e,n){return e=Lt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lt(t){var e=rn(t,"string");return re(e)=="symbol"?e:e+""}function rn(t,e){if(re(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(re(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nn=Math.PI/180,st=1e-5,we=(function(t){function e(){return Zr(this,e),Qr(this,e,arguments)}return tn(e,t),Jr(e,[{key:"getTickLineCoord",value:function(r){var a=this.props,i=a.cx,s=a.cy,c=a.radius,u=a.orientation,l=a.tickSize,d=l||8,y=R(i,s,c,r.coordinate),h=R(i,s,c+(u==="inner"?-1:1)*d,r.coordinate);return{x1:y.x,y1:y.y,x2:h.x,y2:h.y}}},{key:"getTickTextAnchor",value:function(r){var a=this.props.orientation,i=Math.cos(-r.coordinate*nn),s;return i>st?s=a==="outer"?"start":"end":i<-st?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,u=r.axisLineType,l=U(U({},A(this.props,!1)),{},{fill:"none"},A(c,!1));if(u==="circle")return p.createElement(Yt,W({className:"recharts-polar-angle-axis-line"},l,{cx:a,cy:i,r:s}));var d=this.props.ticks,y=d.map(function(h){return R(a,i,s,h.coordinate)});return p.createElement(Dr,W({className:"recharts-polar-angle-axis-line"},l,{points:y}))}},{key:"renderTicks",value:function(){var r=this,a=this.props,i=a.ticks,s=a.tick,c=a.tickLine,u=a.tickFormatter,l=a.stroke,d=A(this.props,!1),y=A(s,!1),h=U(U({},d),{},{fill:"none"},A(c,!1)),v=i.map(function(g,f){var m=r.getTickLineCoord(g),x=r.getTickTextAnchor(g),b=U(U(U({textAnchor:x},d),{},{stroke:"none",fill:l},y),{},{index:f,payload:g,x:m.x2,y:m.y2});return p.createElement(I,W({className:B("recharts-polar-angle-axis-tick",Nt(s)),key:"tick-".concat(g.coordinate)},$e(r.props,g,f)),c&&p.createElement("line",W({className:"recharts-polar-angle-axis-tick-line"},h,m)),s&&e.renderTickItem(s,b,u?u(g.value,f):g.value))});return p.createElement(I,{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:p.createElement(I,{className:B("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,a,i){var s;return p.isValidElement(r)?s=p.cloneElement(r,a):L(r)?s=r(a):s=p.createElement(Le,W({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),s}}])})(_.PureComponent);Ne(we,"displayName","PolarAngleAxis");Ne(we,"axisType","angleAxis");Ne(we,"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 ge;function ne(t){"@babel/helpers - typeof";return ne=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},ne(t)}function Q(){return Q=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},Q.apply(this,arguments)}function ot(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 j(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ot(Object(n),!0).forEach(function(r){E(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function an(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lt(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,Rt(r.key),r)}}function sn(t,e,n){return e&<(t.prototype,e),n&<(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function on(t,e,n){return e=ke(e),ln(t,$t()?Reflect.construct(e,n||[],ke(t).constructor):e.apply(t,n))}function ln(t,e){if(e&&(ne(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cn(t)}function cn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($t=function(){return!!t})()}function ke(t){return ke=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ke(t)}function un(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&&Me(t,e)}function Me(t,e){return Me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Me(t,e)}function E(t,e,n){return e=Rt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rt(t){var e=dn(t,"string");return ne(e)=="symbol"?e:e+""}function dn(t,e){if(ne(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ne(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 an(this,e),r=on(this,e,[n]),E(r,"pieRef",null),E(r,"sectorRefs",[]),E(r,"id",rr("recharts-pie-")),E(r,"handleAnimationEnd",function(){var a=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),L(a)&&a()}),E(r,"handleAnimationStart",function(){var a=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),L(a)&&a()}),r.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},r}return un(e,t),sn(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,u=i.dataKey,l=i.valueKey,d=A(this.props,!1),y=A(s,!1),h=A(c,!1),v=s&&s.offsetRadius||20,g=r.map(function(f,m){var x=(f.startAngle+f.endAngle)/2,b=R(f.cx,f.cy,f.outerRadius+v,x),k=j(j(j(j({},d),f),{},{stroke:"none"},y),{},{index:m,textAnchor:e.getTextAnchor(b.x,f.cx)},b),C=j(j(j(j({},d),f),{},{fill:"none",stroke:f.fill},h),{},{index:m,points:[R(f.cx,f.cy,f.outerRadius,x),b]}),P=u;return X(u)&&X(l)?P="value":X(u)&&(P=l),p.createElement(I,{key:"label-".concat(f.startAngle,"-").concat(f.endAngle,"-").concat(f.midAngle,"-").concat(m)},c&&e.renderLabelLineItem(c,C,"line"),e.renderLabelItem(s,k,Z(f,P)))});return p.createElement(I,{className:"recharts-pie-labels"},g)}},{key:"renderSectorsStatically",value:function(r){var a=this,i=this.props,s=i.activeShape,c=i.blendStroke,u=i.inactiveShape;return r.map(function(l,d){if(l?.startAngle===0&&l?.endAngle===0&&r.length!==1)return null;var y=a.isActiveIndex(d),h=u&&a.hasActiveIndex()?u:null,v=y?s:h,g=j(j({},l),{},{stroke:c?l.fill:l.stroke,tabIndex:-1});return p.createElement(I,Q({ref:function(m){m&&!a.sectorRefs.includes(m)&&a.sectorRefs.push(m)},tabIndex:-1,className:"recharts-pie-sector"},$e(a.props,l,d),{key:"sector-".concat(l?.startAngle,"-").concat(l?.endAngle,"-").concat(l.midAngle,"-").concat(d)}),p.createElement(Jt,Q({option:v,isActive:y,shapeType:"sector"},g)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,a=this.props,i=a.sectors,s=a.isAnimationActive,c=a.animationBegin,u=a.animationDuration,l=a.animationEasing,d=a.animationId,y=this.state,h=y.prevSectors,v=y.prevIsAnimationActive;return p.createElement(Qt,{begin:c,duration:u,isActive:s,easing:l,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(v),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(g){var f=g.t,m=[],x=i&&i[0],b=x.startAngle;return i.forEach(function(k,C){var P=h&&h[C],S=C>0?Xt(k,"paddingAngle",0):0;if(P){var D=Ze(P.endAngle-P.startAngle,k.endAngle-k.startAngle),O=j(j({},k),{},{startAngle:b+S,endAngle:b+D(f)+S});m.push(O),b=O.endAngle}else{var M=k.endAngle,T=k.startAngle,$=Ze(0,M-T),ce=$(f),F=j(j({},k),{},{startAngle:b+S,endAngle:b+ce+S});m.push(F),b=F.endAngle}}),p.createElement(I,null,r.renderSectorsStatically(m))})}},{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||!er(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,u=a.label,l=a.cx,d=a.cy,y=a.innerRadius,h=a.outerRadius,v=a.isAnimationActive,g=this.state.isAnimationFinished;if(i||!s||!s.length||!w(l)||!w(d)||!w(y)||!w(h))return null;var f=B("recharts-pie",c);return p.createElement(I,{tabIndex:this.props.rootTabIndex,className:f,ref:function(x){r.pieRef=x}},this.renderSectors(),u&&this.renderLabels(s),wt.renderCallByParent(this.props,null,!1),(!v||g)&&tr.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(p.isValidElement(r))return p.cloneElement(r,a);if(L(r))return r(a);var s=B("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return p.createElement(Zt,Q({},a,{key:i,type:"linear",className:s}))}},{key:"renderLabelItem",value:function(r,a,i){if(p.isValidElement(r))return p.cloneElement(r,a);var s=i;if(L(r)&&(s=r(a),p.isValidElement(s)))return s;var c=B("recharts-pie-label-text",typeof r!="boolean"&&!L(r)?r.className:"");return p.createElement(Le,Q({},a,{alignmentBaseline:"middle",className:c}),s)}}])})(_.PureComponent);ge=z;E(z,"displayName","Pie");E(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:!nr.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});E(z,"parseDeltaAngle",function(t,e){var n=pe(e-t),r=Math.min(Math.abs(e-t),360);return n*r});E(z,"getRealPieData",function(t){var e=t.data,n=t.children,r=A(t,!1),a=ar(n,Pt);return e&&e.length?e.map(function(i,s){return j(j(j({payload:i},r),i),a&&a[s]&&a[s].props)}):a&&a.length?a.map(function(i){return j(j({},r),i.props)}):[]});E(z,"parseCoordinateOfPie",function(t,e){var n=e.top,r=e.left,a=e.width,i=e.height,s=ir(a,i),c=r+ue(t.cx,a,a/2),u=n+ue(t.cy,i,i/2),l=ue(t.innerRadius,s,0),d=ue(t.outerRadius,s,s*.8),y=t.maxRadius||Math.sqrt(a*a+i*i)/2;return{cx:c,cy:u,innerRadius:l,outerRadius:d,maxRadius:y}});E(z,"getComposedData",function(t){var e=t.item,n=t.offset,r=e.type.defaultProps!==void 0?j(j({},e.type.defaultProps),e.props):e.props,a=ge.getRealPieData(r);if(!a||!a.length)return null;var i=r.cornerRadius,s=r.startAngle,c=r.endAngle,u=r.paddingAngle,l=r.dataKey,d=r.nameKey,y=r.valueKey,h=r.tooltipType,v=Math.abs(r.minAngle),g=ge.parseCoordinateOfPie(r,n),f=ge.parseDeltaAngle(s,c),m=Math.abs(f),x=l;X(l)&&X(y)?(xe(!1,`Use "dataKey" to specify the value of pie,
|
|
3
|
+
the props "valueKey" will be deprecated in 1.1.0`),x="value"):X(l)&&(xe(!1,`Use "dataKey" to specify the value of pie,
|
|
4
|
+
the props "valueKey" will be deprecated in 1.1.0`),x=y);var b=a.filter(function(O){return Z(O,x,0)!==0}).length,k=(m>=360?b:b-1)*u,C=m-b*v-k,P=a.reduce(function(O,M){var T=Z(M,x,0);return O+(w(T)?T:0)},0),S;if(P>0){var D;S=a.map(function(O,M){var T=Z(O,x,0),$=Z(O,d,M),ce=(w(T)?T:0)/P,F;M?F=D.endAngle+pe(f)*u*(T!==0?1:0):F=s;var Ve=F+pe(f)*((T!==0?v:0)+ce*C),Ge=(F+Ve)/2,He=(g.innerRadius+g.outerRadius)/2,Bt=[{name:$,value:T,payload:O,dataKey:x,type:h}],Kt=R(g.cx,g.cy,He,Ge);return D=j(j(j({percent:ce,cornerRadius:i,name:$,tooltipPayload:Bt,midAngle:Ge,middleRadius:He,tooltipPosition:Kt},O),g),{},{value:Z(O,x),startAngle:F,endAngle:Ve,payload:O,paddingAngle:pe(f)*u}),D})}return j(j({},g),{},{sectors:S,data:a})});var fn=["x1","y1","x2","y2","key"],mn=["offset"];function H(t){"@babel/helpers - typeof";return H=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},H(t)}function ct(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 N(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ct(Object(n),!0).forEach(function(r){hn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hn(t,e,n){return e=pn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pn(t){var e=yn(t,"string");return H(e)=="symbol"?e:e+""}function yn(t,e){if(H(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(H(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(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 ut(t,e){if(t==null)return{};var n=gn(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 gn(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 vn=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,u=e.ry;return p.createElement("rect",{x:a,y:i,ry:u,width:s,height:c,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function zt(t,e){var n;if(p.isValidElement(t))n=p.cloneElement(t,e);else if(L(t))n=t(e);else{var r=e.x1,a=e.y1,i=e.x2,s=e.y2,c=e.key,u=ut(e,fn),l=A(u,!1);l.offset;var d=ut(l,mn);n=p.createElement("line",V({},d,{x1:r,y1:a,x2:i,y2:s,fill:"none",key:c}))}return n}function xn(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,u){var l=N(N({},t),{},{x1:e,y1:c,x2:e+n,y2:c,key:"line-".concat(u),index:u});return zt(a,l)});return p.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function bn(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,u){var l=N(N({},t),{},{x1:c,y1:e,x2:c,y2:e+n,key:"line-".concat(u),index:u});return zt(a,l)});return p.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function jn(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,a=t.y,i=t.width,s=t.height,c=t.horizontalPoints,u=t.horizontal,l=u===void 0?!0:u;if(!l||!e||!e.length)return null;var d=c.map(function(h){return Math.round(h+a-a)}).sort(function(h,v){return h-v});a!==d[0]&&d.unshift(0);var y=d.map(function(h,v){var g=!d[v+1],f=g?a+s-h:d[v+1]-h;if(f<=0)return null;var m=v%e.length;return p.createElement("rect",{key:"react-".concat(v),y:h,x:r,height:f,width:i,stroke:"none",fill:e[m],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return p.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function kn(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,u=t.height,l=t.verticalPoints;if(!n||!r||!r.length)return null;var d=l.map(function(h){return Math.round(h+i-i)}).sort(function(h,v){return h-v});i!==d[0]&&d.unshift(0);var y=d.map(function(h,v){var g=!d[v+1],f=g?i+c-h:d[v+1]-h;if(f<=0)return null;var m=v%r.length;return p.createElement("rect",{key:"react-".concat(v),x:h,y:s,width:f,height:u,stroke:"none",fill:r[m],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return p.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var An=function(e,n){var r=e.xAxis,a=e.width,i=e.height,s=e.offset;return St(Tt(N(N(N({},Ct.defaultProps),r),{},{ticks:_t(r,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.left,s.left+s.width,n)},On=function(e,n){var r=e.yAxis,a=e.width,i=e.height,s=e.offset;return St(Tt(N(N(N({},Ct.defaultProps),r),{},{ticks:_t(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 Ke(t){var e,n,r,a,i,s,c=sr(),u=or(),l=lr(),d=N(N({},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:w(t.x)?t.x:l.left,y:w(t.y)?t.y:l.top,width:w(t.width)?t.width:l.width,height:w(t.height)?t.height:l.height}),y=d.x,h=d.y,v=d.width,g=d.height,f=d.syncWithTicks,m=d.horizontalValues,x=d.verticalValues,b=cr(),k=ur();if(!w(v)||v<=0||!w(g)||g<=0||!w(y)||y!==+y||!w(h)||h!==+h)return null;var C=d.verticalCoordinatesGenerator||An,P=d.horizontalCoordinatesGenerator||On,S=d.horizontalPoints,D=d.verticalPoints;if((!S||!S.length)&&L(P)){var O=m&&m.length,M=P({yAxis:k?N(N({},k),{},{ticks:O?m:k.ticks}):void 0,width:c,height:u,offset:l},O?!0:f);xe(Array.isArray(M),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(H(M),"]")),Array.isArray(M)&&(S=M)}if((!D||!D.length)&&L(C)){var T=x&&x.length,$=C({xAxis:b?N(N({},b),{},{ticks:T?x:b.ticks}):void 0,width:c,height:u,offset:l},T?!0:f);xe(Array.isArray($),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(H($),"]")),Array.isArray($)&&(D=$)}return p.createElement("g",{className:"recharts-cartesian-grid"},p.createElement(vn,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),p.createElement(xn,V({},d,{offset:l,horizontalPoints:S,xAxis:b,yAxis:k})),p.createElement(bn,V({},d,{offset:l,verticalPoints:D,xAxis:b,yAxis:k})),p.createElement(jn,V({},d,{horizontalPoints:S})),p.createElement(kn,V({},d,{verticalPoints:D})))}Ke.displayName="CartesianGrid";var Nn=Et({chartName:"BarChart",GraphicalChild:ye,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Re},{axisType:"yAxis",AxisComp:ze}],formatAxisMap:dr}),wn=Et({chartName:"PieChart",GraphicalChild:z,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:we},{axisType:"radiusAxis",AxisComp:Oe}],formatAxisMap:fr,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function Te(t,e,n){const r=ve(t,n?.in);return isNaN(e)?bt(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function dt(t,e){return ve(t,e?.in).getDay()}function Ue(t,e){const n=()=>bt(e?.in,NaN),a=_n(t);let i;if(a.date){const l=Cn(a.date,2);i=En(l.restDateString,l.year)}if(!i||isNaN(+i))return n();const s=+i;let c=0,u;if(a.time&&(c=Dn(a.time),isNaN(c)))return n();if(a.timezone){if(u=Mn(a.timezone),isNaN(u))return n()}else{const l=new Date(s+c),d=ve(0,e?.in);return d.setFullYear(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()),d.setHours(l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()),d}return ve(s+c+u,e?.in)}const fe={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Pn=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Sn=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Tn=/^([+-])(\d{2})(?::?(\d{2}))?$/;function _n(t){const e={},n=t.split(fe.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],fe.timeZoneDelimiter.test(e.date)&&(e.date=t.split(fe.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const a=fe.timezone.exec(r);a?(e.time=r.replace(a[1],""),e.timezone=a[1]):e.time=r}return e}function Cn(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 En(t,e){if(e===null)return new Date(NaN);const n=t.match(Pn);if(!n)return new Date(NaN);const r=!!n[4],a=ae(n[1]),i=ae(n[2])-1,s=ae(n[3]),c=ae(n[4]),u=ae(n[5])-1;if(r)return zn(e,c,u)?In(e,c,u):new Date(NaN);{const l=new Date(0);return!$n(e,i,s)||!Rn(e,a)?new Date(NaN):(l.setUTCFullYear(e,i,Math.max(a,s)),l)}}function ae(t){return t?parseInt(t):1}function Dn(t){const e=t.match(Sn);if(!e)return NaN;const n=_e(e[1]),r=_e(e[2]),a=_e(e[3]);return Fn(n,r,a)?n*jt+r*kt+a*1e3:NaN}function _e(t){return t&&parseFloat(t.replace(",","."))||0}function Mn(t){if(t==="Z")return 0;const e=t.match(Tn);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return Bn(r,a)?n*(r*jt+a*kt):NaN}function In(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 Ln=[31,null,31,30,31,30,31,31,30,31,30,31];function Ft(t){return t%400===0||t%4===0&&t%100!==0}function $n(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(Ln[e]||(Ft(t)?29:28))}function Rn(t,e){return e>=1&&e<=(Ft(t)?366:365)}function zn(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function Fn(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function Bn(t,e){return e>=0&&e<=59}function Kn({data:t}){const e=t.map(n=>({...n,dateLabel:G(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(Fe,{width:"100%",height:"100%",children:o.jsxs(Nn,{data:e,children:[o.jsx(Ke,{strokeDasharray:"3 3",stroke:"#2a2926"}),o.jsx(Re,{dataKey:"dateLabel",tick:{fill:"#7a7668",fontSize:10},tickLine:!1}),o.jsx(ze,{tick:{fill:"#7a7668",fontSize:10},tickLine:!1,axisLine:!1}),o.jsx(Be,{contentStyle:{backgroundColor:"#1c1c1a",border:"1px solid #3d3b36",borderRadius:"8px",fontSize:"12px"}}),o.jsx(ye,{dataKey:"messageCount",name:"Messages",fill:"#d97757",radius:[2,2,0,0]}),o.jsx(ye,{dataKey:"toolCallCount",name:"Tool Calls",fill:"#8b5cf6",radius:[2,2,0,0]}),o.jsx(ye,{dataKey:"sessionCount",name:"Sessions",fill:"#10b981",radius:[2,2,0,0]})]})})})]})}const Un=["#2a2926","#3d2a1e","#a8512eb3","#d97757cc","#e09070"],Wn=["Mon","","Wed","","Fri","",""],Y=10,ie=2,Vn=28;function Gn(t){if(t.length===0)return{p25:0,p50:0,p75:0};const e=[...t].sort((r,a)=>r-a),n=r=>{const a=r/100*(e.length-1),i=Math.floor(a),s=Math.ceil(a);return i===s?e[i]:e[i]+(e[s]-e[i])*(a-i)};return{p25:n(25),p50:n(50),p75:n(75)}}function Hn(t,e){return t===0?0:t<=e.p25?1:t<=e.p50?2:t<=e.p75?3:4}function ft(t){return t===0?6:t-1}function qn({dailyActivity:t,dailyModelTokens:e}){const[n,r]=_.useState(null),{days:a,monthLabels:i}=_.useMemo(()=>{const s=new Map;for(const m of t){const x=s.get(m.date)??{sessionCount:0,totalTokens:0};x.sessionCount=m.sessionCount,s.set(m.date,x)}for(const m of e){const x=s.get(m.date)??{sessionCount:0,totalTokens:0};x.totalTokens=Object.values(m.tokensByModel).reduce((b,k)=>b+k,0),s.set(m.date,x)}const c=new Date;c.setHours(0,0,0,0);let u=Te(c,-364);const l=ft(dt(u));l!==0&&(u=Te(u,-l));const d=[];let y=u;for(;y<=c;){const m=G(y,"yyyy-MM-dd"),x=ft(dt(y)),b=Math.floor((y.getTime()-u.getTime())/(1e3*60*60*24)),k=Math.floor(b/7),C=s.get(m);d.push({date:m,dateFormatted:G(y,"MMM d, yyyy"),sessionCount:C?.sessionCount??0,totalTokens:C?.totalTokens??0,intensity:0,weekIndex:k,dayOfWeek:x}),y=Te(y,1)}const h=d.filter(m=>m.totalTokens>0).map(m=>m.totalTokens),v=Gn(h);for(const m of d)m.intensity=Hn(m.totalTokens,v);const g=[];let f=-1;for(const m of d)if(m.dayOfWeek===0){const x=Ue(m.date),b=x.getMonth();b!==f&&(g.push({label:G(x,"MMM"),weekIndex:m.weekIndex}),f=b)}return{days:d,monthLabels:g}},[t,e]);return a.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:"Activity"}),o.jsx("div",{className:"flex h-32 items-center justify-center",children:o.jsx("p",{className:"text-sm text-gray-500",children:"No activity data available"})})]}):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:"Activity"}),o.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Token usage intensity over the past year"}),o.jsx("div",{className:"mt-4 overflow-x-auto",children:o.jsx("div",{className:"relative w-full",children:o.jsxs("div",{className:"flex",children:[o.jsxs("div",{className:"flex flex-col text-[10px] text-gray-500",style:{width:Vn},children:[o.jsx("div",{style:{height:16,marginBottom:ie}}),Wn.map((s,c)=>o.jsx("div",{className:"flex items-center",style:{height:Y,marginTop:c>0?ie:0},children:s},c))]}),o.jsxs("div",{className:"flex flex-1 flex-col",children:[o.jsx("div",{className:"grid text-[10px] text-gray-500",style:{gridAutoFlow:"column",gridAutoColumns:`minmax(${Y}px, 1fr)`,gap:ie,height:16,marginBottom:ie},children:i.map((s,c)=>o.jsx("div",{className:"flex items-end",style:{gridColumn:s.weekIndex+1},children:s.label},`${s.label}-${c}`))}),o.jsx("div",{className:"relative grid",style:{gridTemplateRows:`repeat(7, ${Y}px)`,gridAutoFlow:"column",gridAutoColumns:`minmax(${Y}px, 1fr)`,gap:ie},children:a.map(s=>o.jsx("div",{className:"rounded-sm transition-colors",style:{width:Y,height:Y,backgroundColor:Un[s.intensity],gridRow:s.dayOfWeek+1,gridColumn:s.weekIndex+1},onMouseEnter:c=>{const u=c.target.getBoundingClientRect();r({date:s.date,dateFormatted:s.dateFormatted,sessionCount:s.sessionCount,totalTokens:s.totalTokens,x:u.left+u.width/2,y:u.top-8})},onMouseLeave:()=>r(null)},s.date))})]})]})})}),n&&Ut.createPortal(o.jsxs("div",{className:"pointer-events-none fixed z-50 rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-xs shadow-lg",style:{left:n.x,top:n.y,transform:"translate(-50%, -100%)",whiteSpace:"nowrap"},children:[o.jsx("p",{className:"font-medium text-gray-300",children:n.dateFormatted}),n.totalTokens>0||n.sessionCount>0?o.jsxs("div",{className:"mt-1 space-y-0.5 text-gray-400",children:[o.jsxs("p",{children:[n.sessionCount," ",n.sessionCount===1?"session":"sessions"]}),o.jsxs("p",{children:[ee(n.totalTokens)," tokens"]})]}):o.jsx("p",{className:"mt-1 text-gray-500",children:"No activity"})]}),document.body)]})}const me=["#d97757","#8b5cf6","#10b981","#f59e0b","#ef4444","#b07cc5"];function We(t){return t.replace(/^claude-/,"").split("-202")[0]}function Yn(t,e){const n={};for(const s of t)for(const[c,u]of Object.entries(s.tokensByModel)){const l=We(c);n[l]=(n[l]??0)+u}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 Zn(t,e,n){return t.map(r=>{const a={dateLabel:G(Ue(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=We(i);e.includes(c)?a[c]=a[c]+s:n&&(a.Other=a.Other+s)}return a})}function Jn(t,e,n){const r=new Map;for(const a of t){const i=Vt(Ue(a.date)),s=G(i,"yyyy-MM-dd");if(!r.has(s)){const u={dateLabel:`Week of ${G(i,"MMM d")}`,sortKey:s};for(const l of e)u[l]=0;n&&(u.Other=0),r.set(s,u)}const c=r.get(s);for(const[u,l]of Object.entries(a.tokensByModel)){const d=We(u);e.includes(d)?c[d]=c[d]+l:n&&(c.Other=c.Other+l)}}return Array.from(r.values()).sort((a,i)=>a.sortKey.localeCompare(i.sortKey))}function Qn({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:ee(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:ee(r)})]})]})}function Xn({data:t}){const[e,n]=_.useState("daily"),{topModels:r,hasOther:a}=_.useMemo(()=>Yn(t,5),[t]),i=_.useMemo(()=>{const c=[...r];return a&&c.push("Other"),c},[r,a]),s=_.useMemo(()=>e==="weekly"?Jn(t,r,a):Zn(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(Fe,{width:"100%",height:"100%",children:o.jsxs(mr,{data:s,children:[o.jsx(Ke,{strokeDasharray:"3 3",stroke:"#2a2926"}),o.jsx(Re,{dataKey:"dateLabel",tick:{fill:"#7a7668",fontSize:10},tickLine:!1}),o.jsx(ze,{tick:{fill:"#7a7668",fontSize:10},tickLine:!1,axisLine:!1,tickFormatter:c=>ee(c)}),o.jsx(Be,{content:o.jsx(Qn,{})}),i.map((c,u)=>o.jsx(hr,{type:"monotone",dataKey:c,stackId:"1",stroke:me[u%me.length],fill:me[u%me.length],fillOpacity:.6},c))]})})})]})}const mt=["#d97757","#8b5cf6","#10b981","#f59e0b","#ef4444","#b07cc5"];function ea({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(Fe,{width:"100%",height:"100%",children:o.jsxs(wn,{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(Pt,{fill:mt[r%mt.length],opacity:.8},r))}),o.jsx(Be,{formatter:n=>ee(n),contentStyle:{backgroundColor:"#1c1c1a",border:"1px solid #3d3b36",borderRadius:"8px",fontSize:"12px"}}),o.jsx(pr,{wrapperStyle:{fontSize:"11px"}})]})})})]})}function ta({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(217, 119, 87, ${.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 ra=gt({method:"GET"}).handler(ht("64052f224a1d6696436e5d3deeee2b798f0742e1292ffabd038c3a7bf75e6fcb")),na=vt({queryKey:["projects","analytics"],queryFn:()=>ra(),refetchInterval:6e4}),aa=[{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 ia({projects:t}){const{anonymizeProjectName:e}=yt(),[n,r]=_.useState("lastSessionAt"),[a,i]=_.useState("desc"),s=_.useMemo(()=>{const l=[...t];return l.sort((d,y)=>{let h=0;switch(n){case"projectName":h=d.projectName.localeCompare(y.projectName);break;case"totalSessions":h=d.totalSessions-y.totalSessions;break;case"totalMessages":h=d.totalMessages-y.totalMessages;break;case"totalDurationMs":h=d.totalDurationMs-y.totalDurationMs;break;case"lastSessionAt":h=d.lastSessionAt.localeCompare(y.lastSessionAt);break}return a==="asc"?h:-h}),l},[t,n,a]);function c(l){l===n?i(d=>d==="asc"?"desc":"asc"):(r(l),i("desc"))}function u(l){return l!==n?null:o.jsx("span",{className:"ml-1",children:a==="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:aa.map(l=>o.jsxs("th",{onClick:()=>c(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,u(l.key)]},l.key))})}),o.jsx("tbody",{children:s.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(Wt,{to:"/sessions",search:{project:l.projectName},className:"text-sm text-brand-300 hover:underline",children:e(l.projectName)}),l.activeSessions>0&&o.jsxs("span",{className:"ml-2 rounded-full bg-emerald-500/20 px-1.5 py-0.5 text-[10px] font-medium text-emerald-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:Ie(l.totalDurationMs)}),o.jsx("td",{className:"px-4 py-3 text-right text-sm text-gray-400",children:Gt(l.lastSessionAt)})]},l.projectPath))})]})})}function sa(){const{anonymizeProjectName:t}=yt(),{data:e,isLoading:n}=xt(na);if(n)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((c,u)=>o.jsx("div",{className:"h-20 animate-pulse rounded-xl bg-gray-900/50"},u))}),o.jsx("div",{className:"h-64 animate-pulse rounded-xl bg-gray-900/50"})]});const r=e?.projects??[];if(r.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 a=r.reduce((c,u)=>c+u.totalSessions,0),i=r.reduce((c,u)=>c+u.totalDurationMs,0),s=r.reduce((c,u)=>u.totalSessions>c.totalSessions?u:c);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(he,{label:"Total Projects",value:String(r.length)}),o.jsx(he,{label:"Total Sessions",value:a.toLocaleString()}),o.jsx(he,{label:"Total Duration",value:Ie(i)}),o.jsx(he,{label:"Most Active",value:t(s.projectName),sub:`${s.totalSessions} sessions`})]}),o.jsx(ia,{projects:r})]})}function he({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 oa={};function ha(){const{tab:t}=qe.useSearch(),e=qe.useNavigate(),{data:n,isLoading:r}=xt(Ar),a=_.useMemo(()=>{if(!n)return oa;const s={};for(const[c,u]of Object.entries(n.modelUsage))s[c]={inputTokens:u.inputTokens,outputTokens:u.outputTokens,cacheReadInputTokens:u.cacheReadInputTokens,cacheCreationInputTokens:u.cacheCreationInputTokens};return s},[n]),{cost:i}=yr(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(gr,{options:[{label:"Daily Activity (CSV)",onClick:()=>de(vr(n),"daily-activity.csv","text/csv")},{label:"Token Usage (CSV)",onClick:()=>de(xr(n),"daily-tokens.csv","text/csv")},{label:"Model Usage (CSV)",onClick:()=>de(br(n),"model-usage.csv","text/csv")},{label:"Full Stats (JSON)",onClick:()=>de(jr(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-brand-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-brand-500 text-white":"border-transparent text-gray-400 hover:text-gray-200"}`,children:"Projects"})]}),t==="overview"?o.jsx(la,{stats:n,isLoading:r,cost:i}):o.jsx("div",{className:"mt-6",children:o.jsx(sa,{})})]})}function la({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(se,{label:"Total Sessions",value:String(t.totalSessions)}),o.jsx(se,{label:"Total Messages",value:t.totalMessages.toLocaleString()}),o.jsx(se,{label:"Total Tokens",value:ee(r),sub:n?`~${Ye(n.totalUSD)}`:void 0}),o.jsx(se,{label:"Total Estimated Cost",value:n?`~${Ye(n.totalUSD)}`:"N/A"}),o.jsx(se,{label:"Longest Session",value:Ie(t.longestSession.duration),sub:`${t.longestSession.messageCount} messages`})]}),o.jsx("div",{className:"mt-6",children:o.jsx(qn,{dailyActivity:t.dailyActivity,dailyModelTokens:t.dailyModelTokens})}),o.jsx("div",{className:"mt-4",children:o.jsx(Kn,{data:t.dailyActivity})}),o.jsx("div",{className:"mt-4",children:o.jsx(Xn,{data:t.dailyModelTokens})}),o.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsx(ea,{data:t.modelUsage}),o.jsx(ta,{hourCounts:t.hourCounts})]})]})}function se({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{ha as component};
|