@statforge/claudestat 1.5.0 → 1.6.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/LICENSE +21 -0
- package/README.md +27 -4
- package/dashboard/dist/assets/{AnalyticsView-BApcOGsD.js → AnalyticsView-5bUM3UHp.js} +1 -1
- package/dashboard/dist/assets/{HistoryView-B331k5oL.js → HistoryView-C-AsEqos.js} +1 -1
- package/dashboard/dist/assets/{ProjectsView-DUleaXsP.js → ProjectsView-D9bZBdY2.js} +1 -1
- package/dashboard/dist/assets/{SystemView-BGe__vl1.js → SystemView-DIYDCCF3.js} +1 -1
- package/dashboard/dist/assets/{TopView-CXggyydU.js → TopView-DhdLpsiA.js} +1 -1
- package/dashboard/dist/assets/index-DgbWvj42.js +84 -0
- package/dashboard/dist/index.html +1 -1
- package/dist/daemon.js +3 -1
- package/dist/db.d.ts +1 -0
- package/dist/db.js +8 -0
- package/dist/enricher.js +20 -11
- package/dist/paths.js +1 -1
- package/dist/routes/events.d.ts +0 -2
- package/dist/routes/events.js +3 -20
- package/dist/routes/helpers.d.ts +2 -0
- package/dist/routes/helpers.js +21 -0
- package/dist/routes/misc.js +34 -0
- package/dist/routes/opencode-reader.d.ts +7 -0
- package/dist/routes/opencode-reader.js +129 -0
- package/dist/routes/projects.d.ts +0 -2
- package/dist/routes/projects.js +3 -17
- package/dist/routes/stream.js +1 -1
- package/dist/watch.js +0 -1
- package/dist/watchdog.d.ts +5 -0
- package/dist/watchdog.js +6 -1
- package/dist/watchers/adapter.d.ts +10 -0
- package/dist/watchers/adapter.js +4 -0
- package/dist/watchers/claude-code.js +9 -9
- package/dist/watchers/opencode.d.ts +6 -6
- package/dist/watchers/opencode.js +49 -9
- package/package.json +3 -2
- package/dashboard/dist/assets/index-CB01c5lb.js +0 -84
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Deiby Gorrin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# claudestat
|
|
4
4
|
|
|
5
|
-
**Live
|
|
5
|
+
**Live AI coding monitor — real-time trace, quota guard, and MCP server**
|
|
6
6
|
|
|
7
7
|
Most tools read your logs after a session ends. claudestat hooks into every event as it fires.
|
|
8
|
-
See what
|
|
8
|
+
See what your AI is spending right now, get alerted before you hit your quota, and ask Claude about its own usage — from inside the terminal.
|
|
9
9
|
|
|
10
|
-
Works with Claude
|
|
10
|
+
Works with **Claude Code** and **OpenCode**. Zero cloud dependencies. Pure Node.js. Runs on macOS, Linux, and Windows.
|
|
11
11
|
|
|
12
12
|
[](https://www.npmjs.com/package/@statforge/claudestat)
|
|
13
13
|
[](https://www.npmjs.com/package/@statforge/claudestat)
|
|
@@ -47,6 +47,7 @@ Works with Claude Pro, Max 5, and Max 20. Zero cloud dependencies. Pure Node.js.
|
|
|
47
47
|
- [Installation](#installation)
|
|
48
48
|
- [Commands](#commands)
|
|
49
49
|
- [Dashboard](#dashboard)
|
|
50
|
+
- [OpenCode Support](#opencode-support)
|
|
50
51
|
- [MCP Server](#mcp-server)
|
|
51
52
|
- [Configuration](#configuration)
|
|
52
53
|
- [Troubleshooting](#troubleshooting)
|
|
@@ -102,6 +103,7 @@ Then just ask:
|
|
|
102
103
|
## Features
|
|
103
104
|
|
|
104
105
|
- **Live tool trace** — every call with duration and token cost as it runs
|
|
106
|
+
- **OpenCode support** — same live dashboard for OpenCode sessions (tool calls, prompts, model, intent)
|
|
105
107
|
- **Quota guard** — alerts at 70%, 85%, 95%; optional kill switch blocks new sessions at X%
|
|
106
108
|
- **Loop detector** — flags context thrashing with estimated waste cost
|
|
107
109
|
- **Top tools** — know which tools eat most of your budget
|
|
@@ -109,7 +111,7 @@ Then just ask:
|
|
|
109
111
|
- **Web dashboard** — 6 tabs: Live, History, Projects, Analytics, Top, System
|
|
110
112
|
- **MCP server** — 7 tools so Claude can answer questions about its own usage
|
|
111
113
|
- **Weekly insights** — pattern analysis with actionable tips
|
|
112
|
-
- **Multi-
|
|
114
|
+
- **Multi-source** — switch between Claude Code and OpenCode sessions in one click
|
|
113
115
|
|
|
114
116
|
---
|
|
115
117
|
|
|
@@ -202,6 +204,27 @@ The dashboard lives at `http://localhost:7337` and has six tabs: **Live** (real-
|
|
|
202
204
|
|
|
203
205
|
---
|
|
204
206
|
|
|
207
|
+
## OpenCode Support
|
|
208
|
+
|
|
209
|
+
When you run **OpenCode** alongside Claude Code, claudestat automatically detects both sessions and shows a source switcher in the Live tab.
|
|
210
|
+
|
|
211
|
+
Click between **Claude Code** and **OpenCode** to see each session's real-time view — tool calls, prompts, model name, intent badges, and timing — without leaving the dashboard.
|
|
212
|
+
|
|
213
|
+
| Feature | Claude Code | OpenCode |
|
|
214
|
+
|---|:---:|:---:|
|
|
215
|
+
| Tool calls (Read, Write, Bash, Edit…) | ✅ | ✅ |
|
|
216
|
+
| Prompts per block | ✅ | ✅ |
|
|
217
|
+
| Model name | ✅ | ✅ |
|
|
218
|
+
| Intent detection (Exploring / Implementing…) | ✅ | ✅ |
|
|
219
|
+
| Session cost | ✅ | ✅ |
|
|
220
|
+
| Weekly usage chart | ✅ | ✅ |
|
|
221
|
+
| Per-block cost breakdown | ✅ | — |
|
|
222
|
+
| Quota / context window | ✅ | — |
|
|
223
|
+
|
|
224
|
+
OpenCode data is read directly from its local SQLite database — no configuration required.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
205
228
|
## MCP Server
|
|
206
229
|
|
|
207
230
|
claudestat includes an MCP server with 7 tools for querying usage stats. Register once:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Ut,a as Xt,b as Jt,i as D,c as Zt,d as Qt,e as te,w as Je,g as mt,f as xt,h as vt,C as gt,k as W,l as ke,D as bt,m as He,E as jt,L as R,n as xe,A as Ke,o as I,p as _e,q as K,r as kt,s as Ge,t as ee,v as Ve,G as Ye,x as ue,y as we,z as qt,S as Ze,B as ei,F as ti,H as ii,I as ni,J as St,X as $e,Y as ve,K as wt,M as At,j as n,T as N,R as Qe,N as qe,O as ri}from"./index-
|
|
1
|
+
import{u as Ut,a as Xt,b as Jt,i as D,c as Zt,d as Qt,e as te,w as Je,g as mt,f as xt,h as vt,C as gt,k as W,l as ke,D as bt,m as He,E as jt,L as R,n as xe,A as Ke,o as I,p as _e,q as K,r as kt,s as Ge,t as ee,v as Ve,G as Ye,x as ue,y as we,z as qt,S as Ze,B as ei,F as ti,H as ii,I as ni,J as St,X as $e,Y as ve,K as wt,M as At,j as n,T as N,R as Qe,N as qe,O as ri}from"./index-DgbWvj42.js";import{x as g,a as T,_ as Pt,d as Ue,y as Se,q as oi,$ as ai,p as si,M as li,a0 as Ot,W as ci,Z as Xe,a1 as di,U as et,f as zt,I as _t,s as ui,a2 as fi,b as $t,a3 as tt,a4 as hi,F as pi,n as it,V as yi,Y as mi,a5 as xi,X as vi}from"./vendor-lucide-Cym0q5l_.js";import"./vendor-react-B_Jzs0gY.js";var gi=["x1","y1","x2","y2","key"],bi=["offset"];function re(e){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},re(e)}function nt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nt(Object(r),!0).forEach(function(i){ji(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function ji(e,t,r){return t=ki(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ki(e){var t=Si(e,"string");return re(t)=="symbol"?t:t+""}function Si(e,t){if(re(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(re(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ie(){return ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ie.apply(this,arguments)}function rt(e,t){if(e==null)return{};var r=wi(e,t),i,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)i=a[o],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function wi(e,t){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(t.indexOf(i)>=0)continue;r[i]=e[i]}return r}var Ai=function(t){var r=t.fill;if(!r||r==="none")return null;var i=t.fillOpacity,o=t.x,a=t.y,s=t.width,l=t.height,d=t.ry;return g.createElement("rect",{x:o,y:a,ry:d,width:s,height:l,stroke:"none",fill:r,fillOpacity:i,className:"recharts-cartesian-grid-bg"})};function Tt(e,t){var r;if(g.isValidElement(e))r=g.cloneElement(e,t);else if(te(e))r=e(t);else{var i=t.x1,o=t.y1,a=t.x2,s=t.y2,l=t.key,d=rt(t,gi),u=W(d,!1);u.offset;var c=rt(u,bi);r=g.createElement("line",ie({},c,{x1:i,y1:o,x2:a,y2:s,fill:"none",key:l}))}return r}function Pi(e){var t=e.x,r=e.width,i=e.horizontal,o=i===void 0?!0:i,a=e.horizontalPoints;if(!o||!a||!a.length)return null;var s=a.map(function(l,d){var u=C(C({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(d),index:d});return Tt(o,u)});return g.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function Oi(e){var t=e.y,r=e.height,i=e.vertical,o=i===void 0?!0:i,a=e.verticalPoints;if(!o||!a||!a.length)return null;var s=a.map(function(l,d){var u=C(C({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(d),index:d});return Tt(o,u)});return g.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function zi(e){var t=e.horizontalFill,r=e.fillOpacity,i=e.x,o=e.y,a=e.width,s=e.height,l=e.horizontalPoints,d=e.horizontal,u=d===void 0?!0:d;if(!u||!t||!t.length)return null;var c=l.map(function(f){return Math.round(f+o-o)}).sort(function(f,p){return f-p});o!==c[0]&&c.unshift(0);var h=c.map(function(f,p){var m=!c[p+1],y=m?o+s-f:c[p+1]-f;if(y<=0)return null;var j=p%t.length;return g.createElement("rect",{key:"react-".concat(p),y:f,x:i,height:y,width:a,stroke:"none",fill:t[j],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return g.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},h)}function _i(e){var t=e.vertical,r=t===void 0?!0:t,i=e.verticalFill,o=e.fillOpacity,a=e.x,s=e.y,l=e.width,d=e.height,u=e.verticalPoints;if(!r||!i||!i.length)return null;var c=u.map(function(f){return Math.round(f+a-a)}).sort(function(f,p){return f-p});a!==c[0]&&c.unshift(0);var h=c.map(function(f,p){var m=!c[p+1],y=m?a+l-f:c[p+1]-f;if(y<=0)return null;var j=p%i.length;return g.createElement("rect",{key:"react-".concat(p),x:f,y:s,width:y,height:d,stroke:"none",fill:i[j],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return g.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},h)}var $i=function(t,r){var i=t.xAxis,o=t.width,a=t.height,s=t.offset;return mt(xt(C(C(C({},gt.defaultProps),i),{},{ticks:vt(i,!0),viewBox:{x:0,y:0,width:o,height:a}})),s.left,s.left+s.width,r)},Ti=function(t,r){var i=t.yAxis,o=t.width,a=t.height,s=t.offset;return mt(xt(C(C(C({},gt.defaultProps),i),{},{ticks:vt(i,!0),viewBox:{x:0,y:0,width:o,height:a}})),s.top,s.top+s.height,r)},se={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Be(e){var t,r,i,o,a,s,l=Ut(),d=Xt(),u=Jt(),c=C(C({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:se.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:se.fill,horizontal:(i=e.horizontal)!==null&&i!==void 0?i:se.horizontal,horizontalFill:(o=e.horizontalFill)!==null&&o!==void 0?o:se.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:se.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:se.verticalFill,x:D(e.x)?e.x:u.left,y:D(e.y)?e.y:u.top,width:D(e.width)?e.width:u.width,height:D(e.height)?e.height:u.height}),h=c.x,f=c.y,p=c.width,m=c.height,y=c.syncWithTicks,j=c.horizontalValues,k=c.verticalValues,x=Zt(),b=Qt();if(!D(p)||p<=0||!D(m)||m<=0||!D(h)||h!==+h||!D(f)||f!==+f)return null;var w=c.verticalCoordinatesGenerator||$i,A=c.horizontalCoordinatesGenerator||Ti,P=c.horizontalPoints,O=c.verticalPoints;if((!P||!P.length)&&te(A)){var z=j&&j.length,_=A({yAxis:b?C(C({},b),{},{ticks:z?j:b.ticks}):void 0,width:l,height:d,offset:u},z?!0:y);Je(Array.isArray(_),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(re(_),"]")),Array.isArray(_)&&(P=_)}if((!O||!O.length)&&te(w)){var $=k&&k.length,v=w({xAxis:x?C(C({},x),{},{ticks:$?k:x.ticks}):void 0,width:l,height:d,offset:u},$?!0:y);Je(Array.isArray(v),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(re(v),"]")),Array.isArray(v)&&(O=v)}return g.createElement("g",{className:"recharts-cartesian-grid"},g.createElement(Ai,{fill:c.fill,fillOpacity:c.fillOpacity,x:c.x,y:c.y,width:c.width,height:c.height,ry:c.ry}),g.createElement(Pi,ie({},c,{offset:u,horizontalPoints:P,xAxis:x,yAxis:b})),g.createElement(Oi,ie({},c,{offset:u,verticalPoints:O,xAxis:x,yAxis:b})),g.createElement(zi,ie({},c,{horizontalPoints:P})),g.createElement(_i,ie({},c,{verticalPoints:O})))}Be.displayName="CartesianGrid";var Ci=["type","layout","connectNulls","ref"],Ei=["key"];function fe(e){"@babel/helpers - typeof";return fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fe(e)}function ot(e,t){if(e==null)return{};var r=Ii(e,t),i,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)i=a[o],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Ii(e,t){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(t.indexOf(i)>=0)continue;r[i]=e[i]}return r}function ge(){return ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ge.apply(this,arguments)}function at(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function B(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?at(Object(r),!0).forEach(function(i){H(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function le(e){return Ri(e)||Bi(e)||Wi(e)||Di()}function Di(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wi(e,t){if(e){if(typeof e=="string")return Re(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Re(e,t)}}function Bi(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ri(e){if(Array.isArray(e))return Re(e)}function Re(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function Li(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function st(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Et(i.key),i)}}function Ni(e,t,r){return t&&st(e.prototype,t),r&&st(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mi(e,t,r){return t=Te(t),Fi(e,Ct()?Reflect.construct(t,r||[],Te(e).constructor):t.apply(e,r))}function Fi(e,t){if(t&&(fe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hi(e)}function Hi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ct=function(){return!!e})()}function Te(e){return Te=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Te(e)}function Ki(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Le(e,t)}function Le(e,t){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},Le(e,t)}function H(e,t,r){return t=Et(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Et(e){var t=Gi(e,"string");return fe(t)=="symbol"?t:t+""}function Gi(e,t){if(fe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(fe(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var oe=(function(e){function t(){var r;Li(this,t);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r=Mi(this,t,[].concat(o)),H(r,"state",{isAnimationFinished:!0,totalLength:0}),H(r,"generateSimpleStrokeDasharray",function(s,l){return"".concat(l,"px ").concat(s-l,"px")}),H(r,"getStrokeDasharray",function(s,l,d){var u=d.reduce(function(k,x){return k+x});if(!u)return r.generateSimpleStrokeDasharray(l,s);for(var c=Math.floor(s/u),h=s%u,f=l-s,p=[],m=0,y=0;m<d.length;y+=d[m],++m)if(y+d[m]>h){p=[].concat(le(d.slice(0,m)),[h-y]);break}var j=p.length%2===0?[0,f]:[f];return[].concat(le(t.repeat(d,c)),le(p),j).map(function(k){return"".concat(k,"px")}).join(", ")}),H(r,"id",Ve("recharts-line-")),H(r,"pathRef",function(s){r.mainCurve=s}),H(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),H(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Ki(t,e),Ni(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var i=this.getTotalLength();this.setState({totalLength:i})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var i=this.getTotalLength();i!==this.state.totalLength&&this.setState({totalLength:i})}}},{key:"getTotalLength",value:function(){var i=this.mainCurve;try{return i&&i.getTotalLength&&i.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(i,o){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,s=a.points,l=a.xAxis,d=a.yAxis,u=a.layout,c=a.children,h=He(c,jt);if(!h)return null;var f=function(y,j){return{x:y.x,y:y.y,value:y.value,errorVal:ee(y.payload,j)}},p={clipPath:i?"url(#clipPath-".concat(o,")"):null};return g.createElement(R,p,h.map(function(m){return g.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:s,xAxis:l,yAxis:d,layout:u,dataPointFormatter:f})}))}},{key:"renderDots",value:function(i,o,a){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var l=this.props,d=l.dot,u=l.points,c=l.dataKey,h=W(this.props,!1),f=W(d,!0),p=u.map(function(y,j){var k=B(B(B({key:"dot-".concat(j),r:3},h),f),{},{index:j,cx:y.x,cy:y.y,value:y.value,dataKey:c,payload:y.payload,points:u});return t.renderDotItem(d,k)}),m={clipPath:i?"url(#clipPath-".concat(o?"":"dots-").concat(a,")"):null};return g.createElement(R,ge({className:"recharts-line-dots",key:"dots"},m),p)}},{key:"renderCurveStatically",value:function(i,o,a,s){var l=this.props,d=l.type,u=l.layout,c=l.connectNulls;l.ref;var h=ot(l,Ci),f=B(B(B({},W(h,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:o?"url(#clipPath-".concat(a,")"):null,points:i},s),{},{type:d,layout:u,connectNulls:c});return g.createElement(xe,ge({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(i,o){var a=this,s=this.props,l=s.points,d=s.strokeDasharray,u=s.isAnimationActive,c=s.animationBegin,h=s.animationDuration,f=s.animationEasing,p=s.animationId,m=s.animateNewValues,y=s.width,j=s.height,k=this.state,x=k.prevPoints,b=k.totalLength;return g.createElement(Ke,{begin:c,duration:h,isActive:u,easing:f,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(w){var A=w.t;if(x){var P=x.length/l.length,O=l.map(function(S,E){var J=Math.floor(E*P);if(x[J]){var Z=x[J],F=I(Z.x,S.x),Gt=I(Z.y,S.y);return B(B({},S),{},{x:F(A),y:Gt(A)})}if(m){var Vt=I(y*2,S.x),Yt=I(j/2,S.y);return B(B({},S),{},{x:Vt(A),y:Yt(A)})}return B(B({},S),{},{x:S.x,y:S.y})});return a.renderCurveStatically(O,i,o)}var z=I(0,b),_=z(A),$;if(d){var v="".concat(d).split(/[,\s]+/gim).map(function(S){return parseFloat(S)});$=a.getStrokeDasharray(_,b,v)}else $=a.generateSimpleStrokeDasharray(b,_);return a.renderCurveStatically(l,i,o,{strokeDasharray:$})})}},{key:"renderCurve",value:function(i,o){var a=this.props,s=a.points,l=a.isAnimationActive,d=this.state,u=d.prevPoints,c=d.totalLength;return l&&s&&s.length&&(!u&&c>0||!_e(u,s))?this.renderCurveWithAnimation(i,o):this.renderCurveStatically(s,i,o)}},{key:"render",value:function(){var i,o=this.props,a=o.hide,s=o.dot,l=o.points,d=o.className,u=o.xAxis,c=o.yAxis,h=o.top,f=o.left,p=o.width,m=o.height,y=o.isAnimationActive,j=o.id;if(a||!l||!l.length)return null;var k=this.state.isAnimationFinished,x=l.length===1,b=ke("recharts-line",d),w=u&&u.allowDataOverflow,A=c&&c.allowDataOverflow,P=w||A,O=K(j)?this.id:j,z=(i=W(s,!1))!==null&&i!==void 0?i:{r:3,strokeWidth:2},_=z.r,$=_===void 0?3:_,v=z.strokeWidth,S=v===void 0?2:v,E=kt(s)?s:{},J=E.clipDot,Z=J===void 0?!0:J,F=$*2+S;return g.createElement(R,{className:b},w||A?g.createElement("defs",null,g.createElement("clipPath",{id:"clipPath-".concat(O)},g.createElement("rect",{x:w?f:f-p/2,y:A?h:h-m/2,width:w?p:p*2,height:A?m:m*2})),!Z&&g.createElement("clipPath",{id:"clipPath-dots-".concat(O)},g.createElement("rect",{x:f-F/2,y:h-F/2,width:p+F,height:m+F}))):null,!x&&this.renderCurve(P,O),this.renderErrorBar(P,O),(x||s)&&this.renderDots(P,Z,O),(!y||k)&&Ge.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(i,o){return i.animationId!==o.prevAnimationId?{prevAnimationId:i.animationId,curPoints:i.points,prevPoints:o.curPoints}:i.points!==o.curPoints?{curPoints:i.points}:null}},{key:"repeat",value:function(i,o){for(var a=i.length%2!==0?[].concat(le(i),[0]):i,s=[],l=0;l<o;++l)s=[].concat(le(s),le(a));return s}},{key:"renderDotItem",value:function(i,o){var a;if(g.isValidElement(i))a=g.cloneElement(i,o);else if(te(i))a=i(o);else{var s=o.key,l=ot(o,Ei),d=ke("recharts-line-dot",typeof i!="boolean"?i.className:"");a=g.createElement(bt,ge({key:s},l,{className:d}))}return a}}])})(T.PureComponent);H(oe,"displayName","Line");H(oe,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Ye.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});H(oe,"getComposedData",function(e){var t=e.props,r=e.xAxis,i=e.yAxis,o=e.xAxisTicks,a=e.yAxisTicks,s=e.dataKey,l=e.bandSize,d=e.displayedData,u=e.offset,c=t.layout,h=d.map(function(f,p){var m=ee(f,s);return c==="horizontal"?{x:ue({axis:r,ticks:o,bandSize:l,entry:f,index:p}),y:K(m)?null:i.scale(m),value:m,payload:f}:{x:K(m)?null:r.scale(m),y:ue({axis:i,ticks:a,bandSize:l,entry:f,index:p}),value:m,payload:f}});return B({points:h,layout:c},u)});var Vi=["layout","type","stroke","connectNulls","isRange","ref"],Yi=["key"],It;function he(e){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(e)}function Dt(e,t){if(e==null)return{};var r=Ui(e,t),i,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)i=a[o],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Ui(e,t){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(t.indexOf(i)>=0)continue;r[i]=e[i]}return r}function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ne.apply(this,arguments)}function lt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function Q(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lt(Object(r),!0).forEach(function(i){V(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lt(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Xi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ct(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Bt(i.key),i)}}function Ji(e,t,r){return t&&ct(e.prototype,t),r&&ct(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zi(e,t,r){return t=Ce(t),Qi(e,Wt()?Reflect.construct(t,r||[],Ce(e).constructor):t.apply(e,r))}function Qi(e,t){if(t&&(he(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qi(e)}function qi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wt=function(){return!!e})()}function Ce(e){return Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ce(e)}function en(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ne(e,t)}function Ne(e,t){return Ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},Ne(e,t)}function V(e,t,r){return t=Bt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bt(e){var t=tn(e,"string");return he(t)=="symbol"?t:t+""}function tn(e,t){if(he(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(he(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ae=(function(e){function t(){var r;Xi(this,t);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r=Zi(this,t,[].concat(o)),V(r,"state",{isAnimationFinished:!0}),V(r,"id",Ve("recharts-area-")),V(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),te(s)&&s()}),V(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),te(s)&&s()}),r}return en(t,e),Ji(t,[{key:"renderDots",value:function(i,o,a){var s=this.props.isAnimationActive,l=this.state.isAnimationFinished;if(s&&!l)return null;var d=this.props,u=d.dot,c=d.points,h=d.dataKey,f=W(this.props,!1),p=W(u,!0),m=c.map(function(j,k){var x=Q(Q(Q({key:"dot-".concat(k),r:3},f),p),{},{index:k,cx:j.x,cy:j.y,dataKey:h,value:j.value,payload:j.payload,points:c});return t.renderDotItem(u,x)}),y={clipPath:i?"url(#clipPath-".concat(o?"":"dots-").concat(a,")"):null};return g.createElement(R,ne({className:"recharts-area-dots"},y),m)}},{key:"renderHorizontalRect",value:function(i){var o=this.props,a=o.baseLine,s=o.points,l=o.strokeWidth,d=s[0].x,u=s[s.length-1].x,c=i*Math.abs(d-u),h=we(s.map(function(f){return f.y||0}));return D(a)&&typeof a=="number"?h=Math.max(a,h):a&&Array.isArray(a)&&a.length&&(h=Math.max(we(a.map(function(f){return f.y||0})),h)),D(h)?g.createElement("rect",{x:d<u?d:d-c,y:0,width:c,height:Math.floor(h+(l?parseInt("".concat(l),10):1))}):null}},{key:"renderVerticalRect",value:function(i){var o=this.props,a=o.baseLine,s=o.points,l=o.strokeWidth,d=s[0].y,u=s[s.length-1].y,c=i*Math.abs(d-u),h=we(s.map(function(f){return f.x||0}));return D(a)&&typeof a=="number"?h=Math.max(a,h):a&&Array.isArray(a)&&a.length&&(h=Math.max(we(a.map(function(f){return f.x||0})),h)),D(h)?g.createElement("rect",{x:0,y:d<u?d:d-c,width:h+(l?parseInt("".concat(l),10):1),height:Math.floor(c)}):null}},{key:"renderClipRect",value:function(i){var o=this.props.layout;return o==="vertical"?this.renderVerticalRect(i):this.renderHorizontalRect(i)}},{key:"renderAreaStatically",value:function(i,o,a,s){var l=this.props,d=l.layout,u=l.type,c=l.stroke,h=l.connectNulls,f=l.isRange;l.ref;var p=Dt(l,Vi);return g.createElement(R,{clipPath:a?"url(#clipPath-".concat(s,")"):null},g.createElement(xe,ne({},W(p,!0),{points:i,connectNulls:h,type:u,baseLine:o,layout:d,stroke:"none",className:"recharts-area-area"})),c!=="none"&&g.createElement(xe,ne({},W(this.props,!1),{className:"recharts-area-curve",layout:d,type:u,connectNulls:h,fill:"none",points:i})),c!=="none"&&f&&g.createElement(xe,ne({},W(this.props,!1),{className:"recharts-area-curve",layout:d,type:u,connectNulls:h,fill:"none",points:o})))}},{key:"renderAreaWithAnimation",value:function(i,o){var a=this,s=this.props,l=s.points,d=s.baseLine,u=s.isAnimationActive,c=s.animationBegin,h=s.animationDuration,f=s.animationEasing,p=s.animationId,m=this.state,y=m.prevPoints,j=m.prevBaseLine;return g.createElement(Ke,{begin:c,duration:h,isActive:u,easing:f,from:{t:0},to:{t:1},key:"area-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(k){var x=k.t;if(y){var b=y.length/l.length,w=l.map(function(z,_){var $=Math.floor(_*b);if(y[$]){var v=y[$],S=I(v.x,z.x),E=I(v.y,z.y);return Q(Q({},z),{},{x:S(x),y:E(x)})}return z}),A;if(D(d)&&typeof d=="number"){var P=I(j,d);A=P(x)}else if(K(d)||qt(d)){var O=I(j,0);A=O(x)}else A=d.map(function(z,_){var $=Math.floor(_*b);if(j[$]){var v=j[$],S=I(v.x,z.x),E=I(v.y,z.y);return Q(Q({},z),{},{x:S(x),y:E(x)})}return z});return a.renderAreaStatically(w,A,i,o)}return g.createElement(R,null,g.createElement("defs",null,g.createElement("clipPath",{id:"animationClipPath-".concat(o)},a.renderClipRect(x))),g.createElement(R,{clipPath:"url(#animationClipPath-".concat(o,")")},a.renderAreaStatically(l,d,i,o)))})}},{key:"renderArea",value:function(i,o){var a=this.props,s=a.points,l=a.baseLine,d=a.isAnimationActive,u=this.state,c=u.prevPoints,h=u.prevBaseLine,f=u.totalLength;return d&&s&&s.length&&(!c&&f>0||!_e(c,s)||!_e(h,l))?this.renderAreaWithAnimation(i,o):this.renderAreaStatically(s,l,i,o)}},{key:"render",value:function(){var i,o=this.props,a=o.hide,s=o.dot,l=o.points,d=o.className,u=o.top,c=o.left,h=o.xAxis,f=o.yAxis,p=o.width,m=o.height,y=o.isAnimationActive,j=o.id;if(a||!l||!l.length)return null;var k=this.state.isAnimationFinished,x=l.length===1,b=ke("recharts-area",d),w=h&&h.allowDataOverflow,A=f&&f.allowDataOverflow,P=w||A,O=K(j)?this.id:j,z=(i=W(s,!1))!==null&&i!==void 0?i:{r:3,strokeWidth:2},_=z.r,$=_===void 0?3:_,v=z.strokeWidth,S=v===void 0?2:v,E=kt(s)?s:{},J=E.clipDot,Z=J===void 0?!0:J,F=$*2+S;return g.createElement(R,{className:b},w||A?g.createElement("defs",null,g.createElement("clipPath",{id:"clipPath-".concat(O)},g.createElement("rect",{x:w?c:c-p/2,y:A?u:u-m/2,width:w?p:p*2,height:A?m:m*2})),!Z&&g.createElement("clipPath",{id:"clipPath-dots-".concat(O)},g.createElement("rect",{x:c-F/2,y:u-F/2,width:p+F,height:m+F}))):null,x?null:this.renderArea(P,O),(s||x)&&this.renderDots(P,Z,O),(!y||k)&&Ge.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(i,o){return i.animationId!==o.prevAnimationId?{prevAnimationId:i.animationId,curPoints:i.points,curBaseLine:i.baseLine,prevPoints:o.curPoints,prevBaseLine:o.curBaseLine}:i.points!==o.curPoints||i.baseLine!==o.curBaseLine?{curPoints:i.points,curBaseLine:i.baseLine}:null}}])})(T.PureComponent);It=ae;V(ae,"displayName","Area");V(ae,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Ye.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});V(ae,"getBaseValue",function(e,t,r,i){var o=e.layout,a=e.baseValue,s=t.props.baseValue,l=s??a;if(D(l)&&typeof l=="number")return l;var d=o==="horizontal"?i:r,u=d.scale.domain();if(d.type==="number"){var c=Math.max(u[0],u[1]),h=Math.min(u[0],u[1]);return l==="dataMin"?h:l==="dataMax"||c<0?c:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});V(ae,"getComposedData",function(e){var t=e.props,r=e.item,i=e.xAxis,o=e.yAxis,a=e.xAxisTicks,s=e.yAxisTicks,l=e.bandSize,d=e.dataKey,u=e.stackedData,c=e.dataStartIndex,h=e.displayedData,f=e.offset,p=t.layout,m=u&&u.length,y=It.getBaseValue(t,r,i,o),j=p==="horizontal",k=!1,x=h.map(function(w,A){var P;m?P=u[c+A]:(P=ee(w,d),Array.isArray(P)?k=!0:P=[y,P]);var O=P[1]==null||m&&ee(w,d)==null;return j?{x:ue({axis:i,ticks:a,bandSize:l,entry:w,index:A}),y:O?null:o.scale(P[1]),value:P,payload:w}:{x:O?null:i.scale(P[1]),y:ue({axis:o,ticks:s,bandSize:l,entry:w,index:A}),value:P,payload:w}}),b;return m||k?b=x.map(function(w){var A=Array.isArray(w.value)?w.value[0]:null;return j?{x:w.x,y:A!=null&&w.y!=null?o.scale(A):null}:{x:A!=null?i.scale(A):null,y:w.y}}):b=j?o.scale(y):i.scale(y),Q({points:x,baseLine:b,layout:p,isRange:k},f)});V(ae,"renderDotItem",function(e,t){var r;if(g.isValidElement(e))r=g.cloneElement(e,t);else if(te(e))r=e(t);else{var i=ke("recharts-area-dot",typeof e!="boolean"?e.className:""),o=t.key,a=Dt(t,Yi);r=g.createElement(bt,ne({},a,{key:o,className:i}))}return r});function pe(e){"@babel/helpers - typeof";return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(e)}function nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rn(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Nt(i.key),i)}}function on(e,t,r){return t&&rn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function an(e,t,r){return t=Ee(t),sn(e,Rt()?Reflect.construct(t,r||[],Ee(e).constructor):t.apply(e,r))}function sn(e,t){if(t&&(pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ln(e)}function ln(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Rt=function(){return!!e})()}function Ee(e){return Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ee(e)}function cn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Me(e,t)}function Me(e,t){return Me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},Me(e,t)}function Lt(e,t,r){return t=Nt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nt(e){var t=dn(e,"string");return pe(t)=="symbol"?t:t+""}function dn(e,t){if(pe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(pe(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var De=(function(e){function t(){return nn(this,t),an(this,t,arguments)}return cn(t,e),on(t,[{key:"render",value:function(){return null}}])})(T.Component);Lt(De,"displayName","ZAxis");Lt(De,"defaultProps",{zAxisId:0,range:[64,64],scale:"auto",type:"number"});var un=["option","isActive"];function be(){return be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},be.apply(this,arguments)}function fn(e,t){if(e==null)return{};var r=hn(e,t),i,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)i=a[o],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function hn(e,t){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(t.indexOf(i)>=0)continue;r[i]=e[i]}return r}function pn(e){var t=e.option,r=e.isActive,i=fn(e,un);return typeof t=="string"?T.createElement(Ze,be({option:T.createElement(ei,be({type:t},i)),isActive:r,shapeType:"symbols"},i)):T.createElement(Ze,be({option:t,isActive:r,shapeType:"symbols"},i))}function ye(e){"@babel/helpers - typeof";return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(e)}function je(){return je=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},je.apply(this,arguments)}function dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dt(Object(r),!0).forEach(function(i){q(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dt(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function yn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ut(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Ft(i.key),i)}}function mn(e,t,r){return t&&ut(e.prototype,t),r&&ut(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xn(e,t,r){return t=Ie(t),vn(e,Mt()?Reflect.construct(t,r||[],Ie(e).constructor):t.apply(e,r))}function vn(e,t){if(t&&(ye(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gn(e)}function gn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Mt=function(){return!!e})()}function Ie(e){return Ie=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ie(e)}function bn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fe(e,t)}function Fe(e,t){return Fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},Fe(e,t)}function q(e,t,r){return t=Ft(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ft(e){var t=jn(e,"string");return ye(t)=="symbol"?t:t+""}function jn(e,t){if(ye(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(ye(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var We=(function(e){function t(){var r;yn(this,t);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r=xn(this,t,[].concat(o)),q(r,"state",{isAnimationFinished:!1}),q(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0})}),q(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1})}),q(r,"id",Ve("recharts-scatter-")),r}return bn(t,e),mn(t,[{key:"renderSymbolsStatically",value:function(i){var o=this,a=this.props,s=a.shape,l=a.activeShape,d=a.activeIndex,u=W(this.props,!1);return i.map(function(c,h){var f=d===h,p=f?l:s,m=L(L({},u),c);return g.createElement(R,je({className:"recharts-scatter-symbol",key:"symbol-".concat(c==null?void 0:c.cx,"-").concat(c==null?void 0:c.cy,"-").concat(c==null?void 0:c.size,"-").concat(h)},ti(o.props,c,h),{role:"img"}),g.createElement(pn,je({option:p,isActive:f,key:"symbol-".concat(h)},m)))})}},{key:"renderSymbolsWithAnimation",value:function(){var i=this,o=this.props,a=o.points,s=o.isAnimationActive,l=o.animationBegin,d=o.animationDuration,u=o.animationEasing,c=o.animationId,h=this.state.prevPoints;return g.createElement(Ke,{begin:l,duration:d,isActive:s,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(c),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(f){var p=f.t,m=a.map(function(y,j){var k=h&&h[j];if(k){var x=I(k.cx,y.cx),b=I(k.cy,y.cy),w=I(k.size,y.size);return L(L({},y),{},{cx:x(p),cy:b(p),size:w(p)})}var A=I(0,y.size);return L(L({},y),{},{size:A(p)})});return g.createElement(R,null,i.renderSymbolsStatically(m))})}},{key:"renderSymbols",value:function(){var i=this.props,o=i.points,a=i.isAnimationActive,s=this.state.prevPoints;return a&&o&&o.length&&(!s||!_e(s,o))?this.renderSymbolsWithAnimation():this.renderSymbolsStatically(o)}},{key:"renderErrorBar",value:function(){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var o=this.props,a=o.points,s=o.xAxis,l=o.yAxis,d=o.children,u=He(d,jt);return u?u.map(function(c,h){var f=c.props,p=f.direction,m=f.dataKey;return g.cloneElement(c,{key:"".concat(p,"-").concat(m,"-").concat(a[h]),data:a,xAxis:s,yAxis:l,layout:p==="x"?"vertical":"horizontal",dataPointFormatter:function(j,k){return{x:j.cx,y:j.cy,value:p==="x"?+j.node.x:+j.node.y,errorVal:ee(j,k)}}})}):null}},{key:"renderLine",value:function(){var i=this.props,o=i.points,a=i.line,s=i.lineType,l=i.lineJointType,d=W(this.props,!1),u=W(a,!1),c,h;if(s==="joint")c=o.map(function(b){return{x:b.cx,y:b.cy}});else if(s==="fitting"){var f=ii(o),p=f.xmin,m=f.xmax,y=f.a,j=f.b,k=function(w){return y*w+j};c=[{x:p,y:k(p)},{x:m,y:k(m)}]}var x=L(L(L({},d),{},{fill:"none",stroke:d&&d.fill},u),{},{points:c});return g.isValidElement(a)?h=g.cloneElement(a,x):te(a)?h=a(x):h=g.createElement(xe,je({},x,{type:l})),g.createElement(R,{className:"recharts-scatter-line",key:"recharts-scatter-line"},h)}},{key:"render",value:function(){var i=this.props,o=i.hide,a=i.points,s=i.line,l=i.className,d=i.xAxis,u=i.yAxis,c=i.left,h=i.top,f=i.width,p=i.height,m=i.id,y=i.isAnimationActive;if(o||!a||!a.length)return null;var j=this.state.isAnimationFinished,k=ke("recharts-scatter",l),x=d&&d.allowDataOverflow,b=u&&u.allowDataOverflow,w=x||b,A=K(m)?this.id:m;return g.createElement(R,{className:k,clipPath:w?"url(#clipPath-".concat(A,")"):null},x||b?g.createElement("defs",null,g.createElement("clipPath",{id:"clipPath-".concat(A)},g.createElement("rect",{x:x?c:c-f/2,y:b?h:h-p/2,width:x?f:f*2,height:b?p:p*2}))):null,s&&this.renderLine(),this.renderErrorBar(),g.createElement(R,{key:"recharts-scatter-symbols"},this.renderSymbols()),(!y||j)&&Ge.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(i,o){return i.animationId!==o.prevAnimationId?{prevAnimationId:i.animationId,curPoints:i.points,prevPoints:o.curPoints}:i.points!==o.curPoints?{curPoints:i.points}:null}}])})(T.PureComponent);q(We,"displayName","Scatter");q(We,"defaultProps",{xAxisId:0,yAxisId:0,zAxisId:0,legendType:"circle",lineType:"joint",lineJointType:"linear",data:[],shape:"circle",hide:!1,isAnimationActive:!Ye.isSsr,animationBegin:0,animationDuration:400,animationEasing:"linear"});q(We,"getComposedData",function(e){var t=e.xAxis,r=e.yAxis,i=e.zAxis,o=e.item,a=e.displayedData,s=e.xAxisTicks,l=e.yAxisTicks,d=e.offset,u=o.props.tooltipType,c=He(o.props.children,ni),h=K(t.dataKey)?o.props.dataKey:t.dataKey,f=K(r.dataKey)?o.props.dataKey:r.dataKey,p=i&&i.dataKey,m=i?i.range:De.defaultProps.range,y=m&&m[0],j=t.scale.bandwidth?t.scale.bandwidth():0,k=r.scale.bandwidth?r.scale.bandwidth():0,x=a.map(function(b,w){var A=ee(b,h),P=ee(b,f),O=!K(p)&&ee(b,p)||"-",z=[{name:K(t.dataKey)?o.props.name:t.name||t.dataKey,unit:t.unit||"",value:A,payload:b,dataKey:h,type:u},{name:K(r.dataKey)?o.props.name:r.name||r.dataKey,unit:r.unit||"",value:P,payload:b,dataKey:f,type:u}];O!=="-"&&z.push({name:i.name||i.dataKey,unit:i.unit||"",value:O,payload:b,dataKey:p,type:u});var _=ue({axis:t,ticks:s,bandSize:j,entry:b,index:w,dataKey:h}),$=ue({axis:r,ticks:l,bandSize:k,entry:b,index:w,dataKey:f}),v=O!=="-"?i.scale(O):y,S=Math.sqrt(Math.max(v,0)/Math.PI);return L(L({},b),{},{cx:_,cy:$,x:_-S,y:$-S,xAxis:t,yAxis:r,zAxis:i,width:2*S,height:2*S,size:v,node:{x:A,y:P,z:O},tooltipPayload:z,tooltipPosition:{x:_,y:$},payload:b},c&&c[w]&&c[w].props)});return L({points:x},d)});var kn=St({chartName:"LineChart",GraphicalChild:oe,axisComponents:[{axisType:"xAxis",AxisComp:$e},{axisType:"yAxis",AxisComp:ve}],formatAxisMap:wt}),Sn=St({chartName:"ComposedChart",GraphicalChild:[oe,ae,At,We],axisComponents:[{axisType:"xAxis",AxisComp:$e},{axisType:"yAxis",AxisComp:ve},{axisType:"zAxis",AxisComp:De}],formatAxisMap:wt});const U={sonnet:6.6,haiku:1.76,opus:33};function Ht(e){return e!=null&&e.includes("opus")?13.5:e!=null&&e.includes("haiku")?.22:2.7}function wn(e){return e.includes("opus")?U.opus:e.includes("haiku")?U.haiku:U.sonnet}function An(e){return e.includes("opus")?"Opus":e.includes("haiku")?"Haiku":"Sonnet"}function X(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function Y(e){return e===0?"$0.00":e<.001?"<$0.001":e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function Pn(e,t=5){const r=[];let i=0,o=[];function a(s,l){if(l.length===0)return;let d=0;for(;d<l.length;){const u=l[d].tool_name;let c=d+1;for(;c<l.length&&l[c].tool_name===u;)c++;const h=c-d;if(h>=t){const f=l.slice(d,c);let p,m=!1;if(["Read","Edit","Write","Glob","Grep"].includes(u)){const y=new Set;for(const j of f)try{const k=JSON.parse(j.tool_input||"{}"),x=k.file_path||k.pattern||k.path||"";x&&y.add(x.split("/").pop()||x)}catch{}if(m=y.size>1,p=y.size===1?[...y][0]:y.size>1?`${y.size} different files`:void 0,m&&h<6){d=c;continue}}else if(u.includes("mem_save")){const y=new Set;for(const j of f)try{const k=JSON.parse(j.tool_input||"{}");k.topic&&y.add(k.topic)}catch{}if(m=y.size>1,p=y.size===1?[...y][0]:void 0,m){d=c;continue}}else if(u==="Bash")try{const y=JSON.parse(f[0].tool_input||"{}").command||"";p=y.length>50?y.slice(0,48)+"…":y}catch{}r.push({blockIndex:s+1,toolName:u,count:h,detail:p,multiFile:m})}d=c}}for(const s of e)s.type==="Stop"?(a(i,o),i++,o=[]):(s.type==="Done"||s.type==="PreToolUse")&&s.tool_name&&o.push(s);return o.length>0&&a(i,o),r}function ft(e,t,r){switch(e){case"Read":return t?"Claude is reading different files in sequence without processing information between reads. Group exploration with Glob/Grep first to reduce the number of Reads.":`"${r||"the file"}" was read multiple times in a row. Use offset+limit to read only the necessary section, or Grep to search without reading the entire file. Re-reading the same file wastes context tokens.`;case"Edit":return`"${r||"the file"}" was edited multiple times in a row. This happens when instructions are imprecise — Claude attempts the edit, fails or it doesn't match expectations, and retries. Be more specific: indicate the exact change (old_string → new_string) instead of describing the result.`;case"Write":return`"${r||"the file"}" was overwritten multiple times. Consolidate all changes into a single instruction instead of writing intermediate versions.`;case"Bash":return`Repeated command: "${r||"…"}". Bash loops are usually retries due to error. Verify that the previous command succeeded before continuing, or ask Claude to show the error output.`;case"Grep":case"Glob":return"Repeated searches with similar patterns. Claude is searching for something it can't find. Try a broader pattern or use Read to see the directory structure directly.";default:return e.includes("mem_save")?`The same topic "${r||"…"}" was saved in Engram multiple times in a row. Use mem_update to edit an existing observation instead of creating duplicates.`:`The tool ${e} was executed multiple times in a row. Check if Claude is ignoring previous results.`}}function On(e,t,r,i){var a;const o=[];if(r&&r.length>0){const s=Pn(r,5),l=new Map;for(const d of s){const u=l.get(d.toolName)||[];u.push(d),l.set(d.toolName,u)}for(const[d,u]of l){const c=u.map(m=>`#${m.blockIndex}`).join(", "),h=u.reduce((m,y)=>m+y.count,0),f=u[0],p=(a=i==null?void 0:i.find(m=>m.index===f.blockIndex))==null?void 0:a.text;o.push({level:"error",title:`Loop: ${d} ×${h} — bloques ${c}`,text:ft(d,f.multiFile,f.detail),prompt:p,blockIndex:f.blockIndex})}}else if(e!=null&&e.loops&&e.loops.length>0)for(const s of e.loops)o.push({level:"error",title:`Loop: ${s.toolName} ×${s.count}`,text:ft(s.toolName,!1)});if(r&&r.length>0){const s=new Map;for(const d of r)if(d.tool_name==="Read"&&d.type==="Done"&&d.tool_input)try{const u=JSON.parse(d.tool_input).file_path||"";u&&s.set(u,(s.get(u)||0)+1)}catch{}const l=[...s.entries()].filter(([,d])=>d>=5);if(l.length>0){const d=l.map(([u,c])=>`${u.split("/").pop()} (×${c})`).join(", ");o.push({level:"warning",title:`Scattered re-reads: ${l.length} file${l.length>1?"s":""}`,text:`${d}. These reads are not consecutive but add up to many context tokens. Consider saving the structure mentally before continuing to edit, or use Grep instead of reading the entire file.`})}}if(e){const s=e.input_tokens+e.cache_read+e.cache_creation,l=s>5e3?e.cache_read/s:-1;l>=0&&l<.3&&o.push({level:"warning",title:`Low cache hit: ${Math.round(l*100)}%`,text:"Claude caches context automatically in long sessions. Avoid manually clearing history and work in continuous sessions to accumulate cache."})}if(e&&e.efficiency_score>0&&e.efficiency_score<70&&o.push({level:"warning",title:`Low efficiency: ${e.efficiency_score}/100`,text:"Loops and re-reads are consuming tokens unnecessarily. Check if Claude is repeating steps or if instructions are ambiguous."}),t&&t.burnRateTokensPerMin>6e3&&o.push({level:"info",title:`High burn rate: ${t.burnRateTokensPerMin.toLocaleString()} tok/min`,text:"You are consuming tokens very quickly. Consider asking for more concise responses, avoid attaching large complete files, or break the task into steps."}),r&&r.length>0){const s=r.filter(c=>c.type==="Done"),l=s.filter(c=>c.tool_name==="Bash").length,d=s.filter(c=>c.tool_name==="Read").length,u=s.filter(c=>c.tool_name==="Grep").length;l>6&&u<Math.floor(l*.3)&&d>4&&o.push({level:"info",title:`Bash+Read without Grep (${l} Bash, ${d} Read)`,text:"You are combining Bash and Read to search for information. Grep is more efficient for searching within files — use Grep before Read when you don't know what line something is on."})}if(t&&t.cyclePct>70&&o.push({level:t.cyclePct>85?"error":"warning",title:`Quota at ${t.cyclePct}%`,text:`You used ${t.cyclePrompts}/${t.cycleLimit} prompts in the 5h window. Group several changes in a single message instead of sending one by one.`}),e&&e.cache_read>3e4){const s=e.cache_read/1e6*Ht(e.model);s>.02&&o.push({level:"success",title:`Optimal cache — saving ${Y(s)}`,text:"You are making good use of prompt cache. Long and continuous sessions maximize savings."})}return e&&e.efficiency_score>=90&&o.push({level:"success",title:`Excellent efficiency: ${e.efficiency_score}/100`,text:"No loops detected in this session. Good work pace."}),o}function M({children:e,style:t}){return n.jsx("div",{style:{background:"#161b22",border:"1px solid #21262d",borderRadius:8,padding:"14px 16px",...t},children:e})}function G({icon:e,title:t,subtitle:r,color:i="#58a6ff"}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:12},children:[n.jsx(e,{size:13,color:i}),n.jsx("span",{style:{fontSize:12,color:"#e6edf3",fontWeight:700},children:t}),r&&n.jsx("span",{style:{fontSize:10,color:"#484f58",marginLeft:2},children:r})]})}function ze({content:e,position:t="bottom",align:r="left",style:i}){return n.jsx(N,{position:t,align:r,content:e,children:n.jsx(_t,{size:9,color:"#3d444d",style:{cursor:"help",...i}})})}function zn({quota:e,cost:t}){const r=(t==null?void 0:t.context_used)??0,i=(t==null?void 0:t.context_window)??2e5,o=Math.round(i*.85),a=r>0&&o>0?Math.min(100,Math.round(r/o*100)):null,s=a!==null?100-a:null,l=s===null?"#484f58":s<20?"#f85149":s<40?"#d29922":"#3fb950",d=(t==null?void 0:t.cost_usd)??0,u=(t==null?void 0:t.input_tokens)??0,c=(t==null?void 0:t.output_tokens)??0,h=(t==null?void 0:t.cache_read)??0,f=(t==null?void 0:t.model)??null,p=e.burnRateTokensPerMin??0,m=f?f.replace("claude-","").replace(/-\d{8}$/,""):null;return n.jsxs(M,{style:{borderColor:"#30363d"},children:[n.jsx(G,{icon:Se,title:"Current status",subtitle:"real-time",color:"#58a6ff"}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:12},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:6},children:[n.jsx(oi,{size:10,color:"#484f58"}),n.jsx("span",{style:{fontSize:10,color:"#484f58",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em"},children:"Context"}),n.jsx(ze,{position:"bottom",align:"left",content:n.jsxs("div",{children:[n.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:11,marginBottom:4},children:"Free context space"}),n.jsxs("div",{style:{color:"#8b949e",fontSize:10,lineHeight:1.6},children:["Percentage available before Claude activates auto-compact.",n.jsx("br",{}),"Compact occurs at 85% of the window limit (normally 200K tokens).",n.jsx("br",{}),n.jsx("span",{style:{color:"#d29922"},children:"Below 20%: consider using /clear."})]})]})})]}),s!==null?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{fontSize:26,fontWeight:700,color:l,lineHeight:1,fontVariantNumeric:"tabular-nums"},children:[s,"%"]}),n.jsx("div",{style:{fontSize:9,color:l,opacity:.7,lineHeight:1,marginBottom:4},children:"free"}),n.jsxs("div",{style:{fontSize:9,color:"#484f58",marginBottom:6},children:[Math.round(r/1e3),"k used · limit ",Math.round(o/1e3),"k"]}),n.jsx("div",{style:{width:"100%",height:4,background:"#21262d",borderRadius:2,overflow:"hidden"},children:n.jsx("div",{style:{width:`${a}%`,height:"100%",background:l,borderRadius:2,transition:"width 0.5s"}})}),n.jsx("div",{style:{fontSize:9,color:"#3d444d",marginTop:4},children:s<20?"⚠ Consider /clear soon":s<40?"Moderate — ok for now":"No context pressure"})]}):n.jsx("div",{style:{fontSize:12,color:"#484f58"},children:"Waiting for data…"})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:6},children:[n.jsx(Se,{size:10,color:"#484f58"}),n.jsx("span",{style:{fontSize:10,color:"#484f58",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em"},children:"Current session"}),n.jsx(ze,{position:"bottom",align:"left",content:n.jsxs("div",{children:[n.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:11,marginBottom:4},children:"Cost of this session"}),n.jsxs("div",{style:{color:"#8b949e",fontSize:10,lineHeight:1.6},children:["Accumulated from the first message of the active session.",n.jsx("br",{}),n.jsx("span",{style:{color:"#79c0ff"},children:"in"})," = tokens sent to Claude (context + message).",n.jsx("br",{}),n.jsx("span",{style:{color:"#56d364"},children:"out"})," = tokens generated by Claude.",n.jsx("br",{}),"cache = tokens reused (~10× cheaper than fresh input)."]})]})})]}),d>0?n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{fontSize:26,fontWeight:700,color:"#e6edf3",lineHeight:1,fontVariantNumeric:"tabular-nums"},children:Y(d)}),n.jsxs("div",{style:{fontSize:9,color:"#484f58",marginTop:6,lineHeight:2},children:[n.jsx("span",{style:{color:"#79c0ff"},children:"in"})," ",X(u),h>0&&n.jsxs("span",{style:{color:"#3d444d"},children:[" · ",X(h)," cache"]}),n.jsx("br",{}),n.jsx("span",{style:{color:"#56d364"},children:"out"})," ",X(c)]})]}):n.jsx("div",{style:{fontSize:12,color:"#484f58"},children:"No active session"})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:6},children:[n.jsx(ai,{size:10,color:"#484f58"}),n.jsx("span",{style:{fontSize:10,color:"#484f58",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em"},children:"Model"}),n.jsx(ze,{position:"bottom",align:"right",content:n.jsxs("div",{children:[n.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:11,marginBottom:4},children:"Active model"}),n.jsxs("div",{style:{color:"#8b949e",fontSize:10,lineHeight:1.6},children:["Claude model used in the current session.",n.jsx("br",{}),"The ",n.jsx("span",{style:{color:"#d29922"},children:"burn rate"})," indicates tokens consumed per minute in real time — useful for estimating how long the quota will last before the next 5h reset."]})]})})]}),m?n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{fontSize:15,fontWeight:700,color:"#e6edf3",lineHeight:1.3},children:m}),n.jsx("div",{style:{fontSize:9,color:"#3d444d",marginTop:3,wordBreak:"break-all"},children:f})]}):n.jsx("div",{style:{fontSize:12,color:"#484f58"},children:"—"}),p>0&&n.jsx(N,{position:"top",align:"right",content:n.jsxs("div",{children:[n.jsx("div",{style:{color:"#d29922",fontWeight:700,fontSize:11,marginBottom:3},children:"Current burn rate"}),n.jsxs("div",{style:{color:"#8b949e",fontSize:10,lineHeight:1.5},children:["Tokens consumed per minute in this session.",n.jsx("br",{}),"High burn rate = large context or long responses.",n.jsx("br",{}),"More than 6,000 tok/min can drain quota quickly."]})]}),children:n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginTop:8,cursor:"help"},children:[n.jsx(si,{size:9,color:"#d29922"}),n.jsxs("span",{style:{fontSize:10,color:"#d29922",fontWeight:600,fontVariantNumeric:"tabular-nums"},children:[p.toLocaleString()," tok/min"]})]})})]})]})]})}function _n({stats:e}){const t=e.today,r=e.todayLabel,i=e.last7;if(!t&&i.messages===0)return n.jsxs(M,{children:[n.jsx(G,{icon:Se,title:"Activity (stats-cache.json)"}),n.jsx("span",{style:{fontSize:12,color:"#484f58"},children:"No data yet in stats-cache.json"})]});const o=[{label:"Messages",icon:li,today:(t==null?void 0:t.messages)??0,week:i.messages,color:"#58a6ff",tooltip:`Total messages (human + assistant).
|
|
3
3
|
Divide by 2 to estimate real prompts.
|
|
4
4
|
Source: ~/.claude/stats-cache.json`},{label:"Sessions",icon:Ot,today:(t==null?void 0:t.sessions)??0,week:i.sessions,color:"#3fb950",tooltip:`Different conversations started with Claude Code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,T as l}from"./index-CB01c5lb.js";import{a as u,E as F,c as E,d as G,J as P,K as L,H as N,j as C,X as _,N as V,O as q,Q as R}from"./vendor-lucide-Cym0q5l_.js";import"./vendor-react-B_Jzs0gY.js";const v={Read:"#58a6ff",Write:"#3fb950",Edit:"#3fb950",Bash:"#d29922",Glob:"#79c0ff",Grep:"#79c0ff",WebSearch:"#56d364",WebFetch:"#56d364",Agent:"#bc8cff",Skill:"#58a6ff",TodoWrite:"#8b949e",TodoRead:"#8b949e",Task:"#8b949e",default:"#6e7681"},T={directo:"direct",agentes:"agents",skills:"skills","agentes+skills":"agents+skills"},K={directo:"#7d8590",agentes:"#d29922",skills:"#58a6ff","agentes+skills":"#d29922"},Q={directo:"Claude responded directly, without launching sub-agents or invoking skills",agentes:"Sub-agents (Agent tool) were launched during the session",skills:"Skills (Skill tool) were invoked during the session","agentes+skills":"Both sub-agents and skills were used in this session"};function D(t){return new Date(t).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})}function Y(t){const o=Math.floor(t/36e5),n=Math.floor(t%36e5/6e4);return o>0?`${o}h ${n}m`:n>0?`${n}m`:"<1m"}function J(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}const a={card:(t,o)=>({background:o?"#1a2332":t?"#1c2128":"#161b22",border:`1px solid ${o?"#58a6ff80":t?"#1f6feb":"#21262d"}`,borderRadius:8,padding:"10px 14px",display:"flex",flexDirection:"column",gap:6,cursor:"pointer",transition:"border-color 0.15s, background 0.15s"}),row:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},dim:{color:"#7d8590",fontSize:11},badge:t=>({color:t,background:t+"18",border:`1px solid ${t}30`,borderRadius:4,padding:"1px 6px",fontSize:10,fontWeight:600,display:"inline-flex",alignItems:"center",gap:3}),sep:{color:"#21262d",userSelect:"none",fontSize:11}};function X({session:t,isActive:o,selectable:n,selected:r=!1,onSelect:f}){const m=K[t.mode]??"#7d8590",d=t.efficiency_score>=90?"#3fb950":t.efficiency_score>=70?"#d29922":"#f85149";return e.jsxs("div",{style:a.card(!!o,r),onClick:()=>n&&(f==null?void 0:f(t.id)),children:[e.jsxs("div",{style:a.row,children:[n&&e.jsx("div",{style:{width:15,height:15,borderRadius:3,flexShrink:0,border:`2px solid ${r?"#58a6ff":"#484f58"}`,background:r?"#58a6ff":"transparent",display:"flex",alignItems:"center",justifyContent:"center"},children:r&&e.jsx(F,{size:9,color:"#0d1117",strokeWidth:3})}),o&&e.jsxs("span",{style:{color:"#3fb950",fontSize:10,fontWeight:700,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#3fb950",animation:"livePulse 1.2s ease-in-out infinite",display:"inline-block"}}),"LIVE"]}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Session interval"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Time of first event → last recorded event"})]}),children:e.jsxs("span",{style:a.dim,children:[D(t.started_at)," → ",D(t.last_event_at)]})}),e.jsx("span",{style:a.dim,children:"·"}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Duration"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Elapsed time from the first to the last event in the session"})]}),children:e.jsx("span",{style:{...a.dim,fontWeight:600},children:Y(t.duration_ms)})}),t.project_name&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:a.sep,children:"│"}),e.jsxs("span",{style:{color:"#79c0ff",fontSize:11,display:"inline-flex",alignItems:"center",gap:3},children:[e.jsx(E,{size:10})," ",t.project_name]})]}),e.jsx("div",{style:{flex:1}}),e.jsx(l,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:m,fontWeight:700,fontSize:12,marginBottom:4},children:T[t.mode]??t.mode}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:Q[t.mode]??t.mode})]}),children:e.jsx("span",{style:a.badge(m),children:T[t.mode]??t.mode})})]}),e.jsxs("div",{style:a.row,children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"API Cost"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Sum of all session blocks at Anthropic pricing"})]}),children:e.jsxs("span",{style:a.badge("#3fb950"),children:["$",t.total_cost_usd.toFixed(4)]})}),e.jsx("span",{style:a.dim,children:"·"}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#79c0ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Total tokens"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Input + Output + Cache read.",e.jsx("br",{}),"Cache read dominates in long sessions — it's the context resent on each API call."]})]}),children:e.jsxs("span",{style:{color:"#79c0ff",background:"#79c0ff22",border:"1px solid #79c0ff50",borderRadius:4,padding:"2px 8px",fontSize:11,fontWeight:700,display:"inline-flex",alignItems:"center",gap:3},children:[J(t.total_tokens)," tok"]})}),e.jsx("span",{style:a.sep,children:"│"}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsxs("div",{style:{color:d,fontWeight:700,fontSize:12,marginBottom:4},children:["Efficiency ",t.efficiency_score,"/100"]}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Score calculated by the daemon.",e.jsx("br",{}),"Penalizes detected loops, re-reads of the same file, and excessive context use."]})]}),children:e.jsxs("span",{style:a.badge(d),children:["efficiency ",t.efficiency_score,"/100"]})}),t.loops_detected>0&&e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#f85149",fontWeight:700,fontSize:12,marginBottom:4},children:"Detected loops"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:[t.loops_detected," loop",t.loops_detected!==1?"s":""," in this session.",e.jsx("br",{}),"Detected when the same action (tool + input) repeats ≥3 times without real progress."]})]}),children:e.jsxs("span",{style:a.badge("#f85149"),children:[e.jsx(G,{size:9})," ",t.loops_detected," loops"]})}),e.jsx("span",{style:a.sep,children:"│"}),e.jsx(l,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Tool calls"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Number of tools that completed execution (Done type) in this session"})]}),children:e.jsxs("span",{style:a.dim,children:[t.done_count," tools"]})})]}),t.top_tools.length>0&&e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:6},children:"Most used tools"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:3},children:t.top_tools.map((c,h)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:v[c]??v.default,flexShrink:0}}),e.jsx("span",{style:{color:"#c9d1d9",fontSize:10},children:c}),h===0&&e.jsx("span",{style:{color:"#484f58",fontSize:9},children:"— most frequent"})]},h))})]}),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[t.top_tools.slice(0,12).map((c,h)=>e.jsx("span",{style:{width:12,height:4,borderRadius:2,flexShrink:0,background:v[c]??v.default,opacity:Math.max(.2,1-h*.07)}},h)),e.jsxs("span",{style:{color:"#484f58",fontSize:9,marginLeft:5},children:[t.top_tools[0],t.top_tools.length>1?` +${t.top_tools.length-1}`:""]})]})}),t.git_branch&&e.jsx("div",{style:a.row,children:e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#8b949e",fontWeight:700,fontSize:12,marginBottom:6},children:"Git status"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{style:{color:"#c9d1d9",fontSize:10},children:["Branch: ",e.jsx("span",{style:{fontFamily:"monospace",color:"#79c0ff"},children:t.git_branch})]}),t.git_dirty&&e.jsx("div",{style:{color:"#d29922",fontSize:10},children:"* Local changes not committed"}),(t.git_ahead??0)>0&&e.jsxs("div",{style:{color:"#58a6ff",fontSize:10},children:["↑ ",t.git_ahead," commit",(t.git_ahead??0)!==1?"s":""," ahead of remote"]}),(t.git_behind??0)>0&&e.jsxs("div",{style:{color:"#d29922",fontSize:10},children:["↓ ",t.git_behind," commit",(t.git_behind??0)!==1?"s":""," behind remote"]}),!t.git_dirty&&!(t.git_ahead??0)&&!(t.git_behind??0)&&e.jsx("div",{style:{color:"#3fb950",fontSize:10},children:"Synced with remote"})]})]}),children:e.jsxs("span",{style:a.badge("#8b949e"),children:[e.jsx(P,{size:9}),t.git_branch,t.git_dirty?e.jsx("span",{style:{color:"#d29922"},children:"*"}):null,(t.git_ahead??0)>0?e.jsxs("span",{style:{color:"#58a6ff"},children:[" ↑",t.git_ahead]}):null,(t.git_behind??0)>0?e.jsxs("span",{style:{color:"#d29922"},children:[" ↓",t.git_behind]}):null]})})}),t.ai_summary&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:5,marginTop:2},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"AI Summary"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Automatically generated by the daemon when the session ends"})]}),children:e.jsx(L,{size:10,color:"#7d8590",style:{flexShrink:0,marginTop:1}})}),e.jsx("span",{style:{color:"#9198a1",fontSize:11,fontStyle:"italic",lineHeight:1.4},children:t.ai_summary})]})]})}const U=u.memo(X),I={directo:"#7d8590",agentes:"#d29922",skills:"#58a6ff","agentes+skills":"#d29922"};function A(t){const o=new Date(t+"T12:00:00"),n=new Date().toISOString().slice(0,10),r=new Date(Date.now()-864e5).toISOString().slice(0,10);return t===n?"Today":t===r?"Yesterday":o.toLocaleDateString("en",{weekday:"long",day:"numeric",month:"long"})}function z(t){const o=Math.floor(t/36e5),n=Math.floor(t%36e5/6e4);return o>0?`${o}h ${n}m`:`${n}m`}function b(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function x(t,o,n=!1){return t===o?{color:"#8b949e"}:{color:(n?t<o:t>o)?"#3fb950":"#f85149",fontWeight:700}}function Z({a:t,b:o,onClose:n}){const r=[{label:"Cost",tooltip:"Total API cost of the session. Green = cheaper (better).",va:`$${t.total_cost_usd.toFixed(4)}`,vb:`$${o.total_cost_usd.toFixed(4)}`,styleA:x(t.total_cost_usd,o.total_cost_usd,!0),styleB:x(o.total_cost_usd,t.total_cost_usd,!0)},{label:"Tokens",tooltip:"Input + Output + Cache read. Green = fewer tokens consumed (better).",va:b(t.total_tokens),vb:b(o.total_tokens),styleA:x(t.total_tokens,o.total_tokens,!0),styleB:x(o.total_tokens,t.total_tokens,!0)},{label:"Duration",tooltip:"Time between first and last event. Green = shorter session (better).",va:z(t.duration_ms),vb:z(o.duration_ms),styleA:x(t.duration_ms,o.duration_ms,!0),styleB:x(o.duration_ms,t.duration_ms,!0)},{label:"Efficiency",tooltip:"Score 0–100 calculated by the daemon. Penalizes loops, re-reads and excessive context. Green = more efficient (better).",va:`${t.efficiency_score}/100`,vb:`${o.efficiency_score}/100`,styleA:x(t.efficiency_score,o.efficiency_score,!1),styleB:x(o.efficiency_score,t.efficiency_score,!1)},{label:"Tools used",tooltip:"Number of completed tool calls (Done type). Green = fewer calls for the same result (better).",va:`${t.done_count} calls`,vb:`${o.done_count} calls`,styleA:x(t.done_count,o.done_count,!0),styleB:x(o.done_count,t.done_count,!0)},{label:"Loops",tooltip:"Detected loops: same action repeated ≥3 times without real progress. Green = none or fewer (better).",va:`${t.loops_detected} loop${t.loops_detected!==1?"s":""}`,vb:`${o.loops_detected} loop${o.loops_detected!==1?"s":""}`,styleA:x(t.loops_detected,o.loops_detected,!0),styleB:x(o.loops_detected,t.loops_detected,!0)},{label:"Mode",tooltip:"Detected mode: direct (no agents or skills), agents, skills, or both.",va:t.mode,vb:o.mode,styleA:{color:I[t.mode]??"#7d8590",fontWeight:600},styleB:{color:I[o.mode]??"#7d8590",fontWeight:600}}],f=t.project_name||t.id.slice(0,8),m=o.project_name||o.id.slice(0,8);return e.jsxs("div",{style:{margin:"0 0 20px 0",background:"#161b22",border:"1px solid #30363d",borderLeft:"3px solid #58a6ff",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 16px",borderBottom:"1px solid #21262d",background:"#1c2128"},children:[e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Session comparison"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Green = better · Red = worse",e.jsx("br",{}),"Metrics are compared against each other. For cost, tokens, duration and loops: less is better. For efficiency: more is better."]})]}),children:e.jsx(R,{size:14,color:"#58a6ff",style:{cursor:"default"}})}),e.jsx("span",{style:{color:"#e6edf3",fontWeight:700,fontSize:13},children:"Session comparison"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Session A"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10},children:[t.project_name??t.id.slice(0,8)," · ",new Date(t.started_at).toLocaleDateString("en",{day:"numeric",month:"short"})]})]}),children:e.jsx("span",{style:{color:"#58a6ff",fontSize:11,background:"#58a6ff18",borderRadius:4,padding:"1px 7px",border:"1px solid #58a6ff30",cursor:"default"},children:new Date(t.started_at).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})})}),e.jsx("span",{style:{color:"#6e7681",fontSize:11},children:"vs"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#bc8cff",fontWeight:700,fontSize:12,marginBottom:4},children:"Session B"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10},children:[o.project_name??o.id.slice(0,8)," · ",new Date(o.started_at).toLocaleDateString("en",{day:"numeric",month:"short"})]})]}),children:e.jsx("span",{style:{color:"#bc8cff",fontSize:11,background:"#bc8cff18",borderRadius:4,padding:"1px 7px",border:"1px solid #bc8cff30",cursor:"default"},children:new Date(o.started_at).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})})}),e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:n,style:{background:"none",border:"none",cursor:"pointer",color:"#6e7681",display:"flex"},children:e.jsx(_,{size:14})})]}),e.jsxs("div",{style:{padding:"0 0 8px 0"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr 1fr",padding:"6px 16px",borderBottom:"1px solid #21262d"},children:[e.jsx("span",{style:{color:"#484f58",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em"},children:"Metric"}),e.jsx("span",{style:{color:"#58a6ff",fontSize:10,fontWeight:700},children:f}),e.jsx("span",{style:{color:"#bc8cff",fontSize:10,fontWeight:700},children:m})]}),r.map((d,c)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr 1fr",padding:"5px 16px",background:c%2===0?"transparent":"#ffffff08"},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:d.label}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:d.tooltip})]}),children:e.jsx("span",{style:{color:"#7d8590",fontSize:11,cursor:"default"},children:d.label})}),e.jsx("span",{style:{fontSize:12,...d.styleA},children:d.va}),e.jsx("span",{style:{fontSize:12,...d.styleB},children:d.vb})]},c)),(t.top_tools.length>0||o.top_tools.length>0)&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr 1fr",padding:"5px 16px"},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Top tools"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Most invoked tools in each session, sorted by frequency"})]}),children:e.jsx("span",{style:{color:"#7d8590",fontSize:11,cursor:"default"},children:"Top tools"})}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:(t.top_tools.length>0?t.top_tools:["—"]).map((d,c)=>e.jsx("span",{style:{color:"#8b949e",fontSize:10,background:"#ffffff08",borderRadius:3,padding:"1px 5px"},children:d},c))}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:(o.top_tools.length>0?o.top_tools:["—"]).map((d,c)=>e.jsx("span",{style:{color:"#8b949e",fontSize:10,background:"#ffffff08",borderRadius:3,padding:"1px 5px"},children:d},c))})]})]}),(t.ai_summary||o.ai_summary)&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,padding:"10px 16px",borderTop:"1px solid #21262d"},children:[{s:t,color:"#58a6ff"},{s:o,color:"#bc8cff"}].map(({s:d,color:c})=>e.jsxs("div",{style:{background:c+"08",border:`1px solid ${c}20`,borderRadius:6,padding:"7px 10px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:4},children:[e.jsx(L,{size:10,color:c}),e.jsx("span",{style:{color:c,fontSize:10,fontWeight:700},children:new Date(d.started_at).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})})]}),e.jsx("span",{style:{color:"#9198a1",fontSize:11,fontStyle:"italic",lineHeight:1.4},children:d.ai_summary??e.jsx("span",{style:{color:"#484f58"},children:"No summary"})})]},d.id))})]})}const p={wrap:{padding:"16px 24px",overflowY:"auto",height:"100%"},dayWrap:{marginBottom:28},dayHead:{display:"flex",alignItems:"center",gap:16,marginBottom:10,paddingBottom:6,borderBottom:"1px solid #21262d"},dayLabel:{color:"#e6edf3",fontWeight:700,fontSize:14},dayStat:{color:"#7d8590",fontSize:11},badge:t=>({color:t,background:t+"18",border:`1px solid ${t}30`,borderRadius:4,padding:"1px 7px",fontSize:11,fontWeight:600}),sessions:{display:"flex",flexDirection:"column",gap:8},empty:{padding:"60px 24px",color:"#7d8590",textAlign:"center",fontSize:13}};function ee({days:t,activeSessionId:o}){return e.jsxs("div",{style:{paddingLeft:8},children:[e.jsx("style",{children:"@keyframes livePulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.4;transform:scale(1.5)} }"}),t.map(n=>e.jsxs("div",{style:{marginBottom:28},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10},children:[e.jsx("div",{style:{width:10,height:10,borderRadius:"50%",background:"#30363d",border:"2px solid #484f58",flexShrink:0}}),e.jsx("div",{style:{height:1,width:12,background:"#21262d"}}),e.jsx("span",{style:{color:"#8b949e",fontSize:12,fontWeight:700},children:A(n.date)}),e.jsxs("span",{style:{color:"#484f58",fontSize:11},children:[n.sessions.length," ses. · $",n.total_cost.toFixed(3)," · ",b(n.total_tokens)]})]}),e.jsxs("div",{style:{position:"relative",paddingLeft:28},children:[e.jsx("div",{style:{position:"absolute",left:4,top:0,bottom:0,width:2,background:"#21262d",borderRadius:1}}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:n.sessions.map(r=>{const f=r.efficiency_score>=90?"#3fb950":r.efficiency_score>=70?"#d29922":"#f85149",m=r.id===o;return e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start"},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsxs("div",{style:{color:f,fontWeight:700,fontSize:12,marginBottom:4},children:["Efficiency ",r.efficiency_score,"/100"]}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Green ≥90 · Amber ≥70 · Red <70",e.jsx("br",{}),"Penalizes loops, re-reads and excessive context"]})]}),children:e.jsx("div",{style:{width:10,height:10,borderRadius:"50%",flexShrink:0,marginTop:6,background:f,border:"2px solid #0d1117",boxShadow:`0 0 6px ${f}66`,position:"relative",zIndex:1,animation:m?"livePulse 1.5s ease-in-out infinite":void 0,cursor:"default"}})}),e.jsx("div",{style:{flex:1,background:"#161b22",border:`1px solid ${m?"#1f6feb":"#21262d"}`,borderRadius:7,padding:"7px 12px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Start time"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"First recorded event of the session"})]}),children:e.jsx("span",{style:{color:"#6e7681",fontSize:10,fontFamily:"monospace",cursor:"default"},children:new Date(r.started_at).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})})}),r.project_name&&e.jsx("span",{style:{color:"#79c0ff",fontSize:11,fontWeight:600},children:r.project_name}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"API Cost"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Sum of all session blocks"})]}),children:e.jsxs("span",{style:{color:"#3fb950",fontSize:10,fontWeight:600,cursor:"default"},children:["$",r.total_cost_usd.toFixed(4)]})}),e.jsx("span",{style:{color:"#484f58",fontSize:10},children:"·"}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:f,fontWeight:700,fontSize:12,marginBottom:4},children:"Efficiency"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Score 0–100. Penalizes loops, re-reads and excessive context"})]}),children:e.jsxs("span",{style:{color:f,fontSize:10,cursor:"default"},children:[r.efficiency_score,"/100"]})}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#79c0ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Total tokens"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Input + Output + Cache read"})]}),children:e.jsxs("span",{style:{color:"#484f58",fontSize:10,cursor:"default"},children:["· ",b(r.total_tokens)," tok"]})}),r.ai_summary&&e.jsxs("span",{style:{color:"#7d8590",fontSize:10,fontStyle:"italic",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["— ",r.ai_summary]})]})})]},r.id)})})]})]},n.date))]})}const S=[{label:"All",min:null,max:null},{label:"< $0.01",min:null,max:.01},{label:"$0.01+",min:.01,max:null},{label:"$0.10+",min:.1,max:null},{label:"$1+",min:1,max:null}];function se({days:t,activeSessionId:o}){const[n,r]=u.useState([]),[f,m]=u.useState("list"),[d,c]=u.useState(""),[h,H]=u.useState(0),j=u.useMemo(()=>{const i=d.trim().toLowerCase(),s=S[h];return t.map(g=>({...g,sessions:g.sessions.filter(y=>{var B,$;return s.min!==null&&y.total_cost_usd<s.min||s.max!==null&&y.total_cost_usd>=s.max?!1:i?((B=y.project_name)==null?void 0:B.toLowerCase().includes(i))||y.top_tools.some(M=>M.toLowerCase().includes(i))||(($=y.ai_summary)==null?void 0:$.toLowerCase().includes(i))||y.id.includes(i):!0})})).filter(g=>g.sessions.length>0)},[t,d,h]),k=t.flatMap(i=>i.sessions),w=k.find(i=>i.id===n[0]),W=k.find(i=>i.id===n[1]);function O(i){r(s=>s.includes(i)?s.filter(g=>g!==i):s.length>=2?[s[1],i]:[...s,i])}return t.length===0?e.jsxs("div",{style:{...p.empty,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[e.jsx(N,{size:40,color:"#30363d"}),e.jsxs("div",{children:[e.jsx("div",{style:{color:"#6e7681",fontSize:14,fontWeight:600,marginBottom:4},children:"No sessions recorded"}),e.jsx("div",{style:{fontSize:11,color:"#484f58"},children:"Sessions appear here once the daemon processes them."})]})]}):e.jsxs("div",{style:p.wrap,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,padding:"5px 10px",background:"#161b22",border:"1px solid #21262d",borderRadius:6},children:[e.jsx(C,{size:12,color:"#484f58"}),e.jsx("input",{type:"text",placeholder:"Search by project, tool or summary…",value:d,onChange:i=>c(i.target.value),style:{flex:1,background:"transparent",border:"none",outline:"none",color:"#c9d1d9",fontSize:12,fontFamily:"inherit"}}),d&&e.jsx("button",{onClick:()=>c(""),style:{background:"none",border:"none",cursor:"pointer",color:"#6e7681",display:"flex"},children:e.jsx(_,{size:12})}),e.jsx("div",{style:{width:1,height:16,background:"#21262d"}}),e.jsx("div",{style:{display:"flex",gap:3},children:S.map((i,s)=>{const g=s===0?"Show all sessions without filtering by cost":s===1?"Only sessions with cost under $0.01 — very short conversations":s===2?"Sessions with cost of $0.01 or more — real work":s===3?"Sessions with cost of $0.10 or more — intensive work":"Sessions with cost of $1 or more — long or high-complexity sessions";return e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsxs("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:["Filtro: ",i.label]}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:g})]}),children:e.jsx("button",{onClick:()=>H(s),style:{padding:"2px 7px",borderRadius:4,border:`1px solid ${h===s?"#3fb95060":"#21262d"}`,background:h===s?"#1a2d1a":"transparent",color:h===s?"#3fb950":"#6e7681",fontSize:10,fontWeight:600,cursor:"pointer"},children:i.label})},s)})}),(d||h>0)&&e.jsxs("span",{style:{color:"#484f58",fontSize:10},children:[j.reduce((i,s)=>i+s.sessions.length,0)," result",j.reduce((i,s)=>i+s.sessions.length,0)!==1?"s":""]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12,padding:"6px 10px",background:"#161b22",border:"1px solid #21262d",borderRadius:6},children:[e.jsx("div",{style:{display:"flex",gap:2,background:"#0d1117",borderRadius:5,padding:2},children:[["list",V,"List","Card view grouped by day. Shows all details for each session."],["timeline",q,"Timeline","Chronological view with a timeline. Shows the session flow for the day."]].map(([i,s,g,y])=>e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:g}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:y})]}),children:e.jsxs("button",{onClick:()=>m(i),style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:4,border:"none",cursor:"pointer",fontSize:10,fontWeight:600,background:f===i?"#21262d":"transparent",color:f===i?"#e6edf3":"#6e7681",transition:"all 0.15s"},children:[e.jsx(s,{size:10}),g]})},i))}),e.jsx("div",{style:{width:1,height:16,background:"#21262d"}}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Compare sessions"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Click 2 sessions to compare their metrics.",e.jsx("br",{}),"If 2 are already selected, the new one replaces the oldest."]})]}),children:e.jsx(R,{size:12,color:"#58a6ff",style:{cursor:"default"}})}),e.jsx("span",{style:{color:"#6e7681",fontSize:11},children:n.length===0?"Select 2 sessions to compare":n.length===1?"Select 1 more":"Comparing 2 sessions"}),n.length>0&&e.jsx("button",{onClick:()=>r([]),style:{background:"none",border:"none",cursor:"pointer",color:"#6e7681",display:"flex",marginLeft:"auto"},children:e.jsx(_,{size:12})})]}),w&&W&&e.jsx(Z,{a:w,b:W,onClose:()=>r([])}),j.length===0&&(d||h>0)&&e.jsxs("div",{style:{...p.empty},children:[e.jsx(C,{size:32,color:"#30363d",style:{marginBottom:8}}),e.jsxs("div",{style:{color:"#6e7681",fontSize:13},children:['No results for "',d||S[h].label,'"']})]}),f==="timeline"?e.jsx(ee,{days:j,activeSessionId:o}):j.map(i=>e.jsxs("div",{style:p.dayWrap,children:[e.jsxs("div",{style:p.dayHead,children:[e.jsx("span",{style:p.dayLabel,children:A(i.date)}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Day sessions"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Number of Claude Code sessions recorded this day"})]}),children:e.jsxs("span",{style:{...p.dayStat,cursor:"default"},children:[i.sessions.length," session",i.sessions.length>1?"s":""]})}),e.jsx("span",{style:p.dayStat,children:"·"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Accumulated duration"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Sum of the duration of all sessions in the day"})]}),children:e.jsx("span",{style:{...p.dayStat,cursor:"default"},children:z(i.total_duration_ms)})}),e.jsx("span",{style:p.dayStat,children:"·"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"Day cost"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Sum of API costs of all sessions in the day"})]}),children:e.jsxs("span",{style:{...p.badge("#3fb950"),cursor:"default"},children:["$",i.total_cost.toFixed(3)]})}),e.jsx("span",{style:p.dayStat,children:"·"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#79c0ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Day tokens"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Sum of tokens (input + output + cache read) of all sessions in the day"})]}),children:e.jsxs("span",{style:{...p.dayStat,cursor:"default"},children:[b(i.total_tokens)," tokens"]})})]}),e.jsx("div",{style:p.sessions,children:i.sessions.map(s=>e.jsx(U,{session:s,isActive:s.id===o,selectable:!0,selected:n.includes(s.id),onSelect:O},s.id))})]},i.date))]})}export{se as HistoryView};
|
|
1
|
+
import{j as e,T as l}from"./index-DgbWvj42.js";import{a as u,E as F,c as E,d as G,J as P,K as L,H as N,j as C,X as _,N as V,O as q,Q as R}from"./vendor-lucide-Cym0q5l_.js";import"./vendor-react-B_Jzs0gY.js";const v={Read:"#58a6ff",Write:"#3fb950",Edit:"#3fb950",Bash:"#d29922",Glob:"#79c0ff",Grep:"#79c0ff",WebSearch:"#56d364",WebFetch:"#56d364",Agent:"#bc8cff",Skill:"#58a6ff",TodoWrite:"#8b949e",TodoRead:"#8b949e",Task:"#8b949e",default:"#6e7681"},T={directo:"direct",agentes:"agents",skills:"skills","agentes+skills":"agents+skills"},K={directo:"#7d8590",agentes:"#d29922",skills:"#58a6ff","agentes+skills":"#d29922"},Q={directo:"Claude responded directly, without launching sub-agents or invoking skills",agentes:"Sub-agents (Agent tool) were launched during the session",skills:"Skills (Skill tool) were invoked during the session","agentes+skills":"Both sub-agents and skills were used in this session"};function D(t){return new Date(t).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})}function Y(t){const o=Math.floor(t/36e5),n=Math.floor(t%36e5/6e4);return o>0?`${o}h ${n}m`:n>0?`${n}m`:"<1m"}function J(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}const a={card:(t,o)=>({background:o?"#1a2332":t?"#1c2128":"#161b22",border:`1px solid ${o?"#58a6ff80":t?"#1f6feb":"#21262d"}`,borderRadius:8,padding:"10px 14px",display:"flex",flexDirection:"column",gap:6,cursor:"pointer",transition:"border-color 0.15s, background 0.15s"}),row:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},dim:{color:"#7d8590",fontSize:11},badge:t=>({color:t,background:t+"18",border:`1px solid ${t}30`,borderRadius:4,padding:"1px 6px",fontSize:10,fontWeight:600,display:"inline-flex",alignItems:"center",gap:3}),sep:{color:"#21262d",userSelect:"none",fontSize:11}};function X({session:t,isActive:o,selectable:n,selected:r=!1,onSelect:f}){const m=K[t.mode]??"#7d8590",d=t.efficiency_score>=90?"#3fb950":t.efficiency_score>=70?"#d29922":"#f85149";return e.jsxs("div",{style:a.card(!!o,r),onClick:()=>n&&(f==null?void 0:f(t.id)),children:[e.jsxs("div",{style:a.row,children:[n&&e.jsx("div",{style:{width:15,height:15,borderRadius:3,flexShrink:0,border:`2px solid ${r?"#58a6ff":"#484f58"}`,background:r?"#58a6ff":"transparent",display:"flex",alignItems:"center",justifyContent:"center"},children:r&&e.jsx(F,{size:9,color:"#0d1117",strokeWidth:3})}),o&&e.jsxs("span",{style:{color:"#3fb950",fontSize:10,fontWeight:700,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#3fb950",animation:"livePulse 1.2s ease-in-out infinite",display:"inline-block"}}),"LIVE"]}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Session interval"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Time of first event → last recorded event"})]}),children:e.jsxs("span",{style:a.dim,children:[D(t.started_at)," → ",D(t.last_event_at)]})}),e.jsx("span",{style:a.dim,children:"·"}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Duration"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Elapsed time from the first to the last event in the session"})]}),children:e.jsx("span",{style:{...a.dim,fontWeight:600},children:Y(t.duration_ms)})}),t.project_name&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:a.sep,children:"│"}),e.jsxs("span",{style:{color:"#79c0ff",fontSize:11,display:"inline-flex",alignItems:"center",gap:3},children:[e.jsx(E,{size:10})," ",t.project_name]})]}),e.jsx("div",{style:{flex:1}}),e.jsx(l,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:m,fontWeight:700,fontSize:12,marginBottom:4},children:T[t.mode]??t.mode}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:Q[t.mode]??t.mode})]}),children:e.jsx("span",{style:a.badge(m),children:T[t.mode]??t.mode})})]}),e.jsxs("div",{style:a.row,children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"API Cost"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Sum of all session blocks at Anthropic pricing"})]}),children:e.jsxs("span",{style:a.badge("#3fb950"),children:["$",t.total_cost_usd.toFixed(4)]})}),e.jsx("span",{style:a.dim,children:"·"}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#79c0ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Total tokens"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Input + Output + Cache read.",e.jsx("br",{}),"Cache read dominates in long sessions — it's the context resent on each API call."]})]}),children:e.jsxs("span",{style:{color:"#79c0ff",background:"#79c0ff22",border:"1px solid #79c0ff50",borderRadius:4,padding:"2px 8px",fontSize:11,fontWeight:700,display:"inline-flex",alignItems:"center",gap:3},children:[J(t.total_tokens)," tok"]})}),e.jsx("span",{style:a.sep,children:"│"}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsxs("div",{style:{color:d,fontWeight:700,fontSize:12,marginBottom:4},children:["Efficiency ",t.efficiency_score,"/100"]}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Score calculated by the daemon.",e.jsx("br",{}),"Penalizes detected loops, re-reads of the same file, and excessive context use."]})]}),children:e.jsxs("span",{style:a.badge(d),children:["efficiency ",t.efficiency_score,"/100"]})}),t.loops_detected>0&&e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#f85149",fontWeight:700,fontSize:12,marginBottom:4},children:"Detected loops"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:[t.loops_detected," loop",t.loops_detected!==1?"s":""," in this session.",e.jsx("br",{}),"Detected when the same action (tool + input) repeats ≥3 times without real progress."]})]}),children:e.jsxs("span",{style:a.badge("#f85149"),children:[e.jsx(G,{size:9})," ",t.loops_detected," loops"]})}),e.jsx("span",{style:a.sep,children:"│"}),e.jsx(l,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Tool calls"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Number of tools that completed execution (Done type) in this session"})]}),children:e.jsxs("span",{style:a.dim,children:[t.done_count," tools"]})})]}),t.top_tools.length>0&&e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:6},children:"Most used tools"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:3},children:t.top_tools.map((c,h)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:v[c]??v.default,flexShrink:0}}),e.jsx("span",{style:{color:"#c9d1d9",fontSize:10},children:c}),h===0&&e.jsx("span",{style:{color:"#484f58",fontSize:9},children:"— most frequent"})]},h))})]}),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[t.top_tools.slice(0,12).map((c,h)=>e.jsx("span",{style:{width:12,height:4,borderRadius:2,flexShrink:0,background:v[c]??v.default,opacity:Math.max(.2,1-h*.07)}},h)),e.jsxs("span",{style:{color:"#484f58",fontSize:9,marginLeft:5},children:[t.top_tools[0],t.top_tools.length>1?` +${t.top_tools.length-1}`:""]})]})}),t.git_branch&&e.jsx("div",{style:a.row,children:e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#8b949e",fontWeight:700,fontSize:12,marginBottom:6},children:"Git status"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{style:{color:"#c9d1d9",fontSize:10},children:["Branch: ",e.jsx("span",{style:{fontFamily:"monospace",color:"#79c0ff"},children:t.git_branch})]}),t.git_dirty&&e.jsx("div",{style:{color:"#d29922",fontSize:10},children:"* Local changes not committed"}),(t.git_ahead??0)>0&&e.jsxs("div",{style:{color:"#58a6ff",fontSize:10},children:["↑ ",t.git_ahead," commit",(t.git_ahead??0)!==1?"s":""," ahead of remote"]}),(t.git_behind??0)>0&&e.jsxs("div",{style:{color:"#d29922",fontSize:10},children:["↓ ",t.git_behind," commit",(t.git_behind??0)!==1?"s":""," behind remote"]}),!t.git_dirty&&!(t.git_ahead??0)&&!(t.git_behind??0)&&e.jsx("div",{style:{color:"#3fb950",fontSize:10},children:"Synced with remote"})]})]}),children:e.jsxs("span",{style:a.badge("#8b949e"),children:[e.jsx(P,{size:9}),t.git_branch,t.git_dirty?e.jsx("span",{style:{color:"#d29922"},children:"*"}):null,(t.git_ahead??0)>0?e.jsxs("span",{style:{color:"#58a6ff"},children:[" ↑",t.git_ahead]}):null,(t.git_behind??0)>0?e.jsxs("span",{style:{color:"#d29922"},children:[" ↓",t.git_behind]}):null]})})}),t.ai_summary&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:5,marginTop:2},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"AI Summary"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Automatically generated by the daemon when the session ends"})]}),children:e.jsx(L,{size:10,color:"#7d8590",style:{flexShrink:0,marginTop:1}})}),e.jsx("span",{style:{color:"#9198a1",fontSize:11,fontStyle:"italic",lineHeight:1.4},children:t.ai_summary})]})]})}const U=u.memo(X),I={directo:"#7d8590",agentes:"#d29922",skills:"#58a6ff","agentes+skills":"#d29922"};function A(t){const o=new Date(t+"T12:00:00"),n=new Date().toISOString().slice(0,10),r=new Date(Date.now()-864e5).toISOString().slice(0,10);return t===n?"Today":t===r?"Yesterday":o.toLocaleDateString("en",{weekday:"long",day:"numeric",month:"long"})}function z(t){const o=Math.floor(t/36e5),n=Math.floor(t%36e5/6e4);return o>0?`${o}h ${n}m`:`${n}m`}function b(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function x(t,o,n=!1){return t===o?{color:"#8b949e"}:{color:(n?t<o:t>o)?"#3fb950":"#f85149",fontWeight:700}}function Z({a:t,b:o,onClose:n}){const r=[{label:"Cost",tooltip:"Total API cost of the session. Green = cheaper (better).",va:`$${t.total_cost_usd.toFixed(4)}`,vb:`$${o.total_cost_usd.toFixed(4)}`,styleA:x(t.total_cost_usd,o.total_cost_usd,!0),styleB:x(o.total_cost_usd,t.total_cost_usd,!0)},{label:"Tokens",tooltip:"Input + Output + Cache read. Green = fewer tokens consumed (better).",va:b(t.total_tokens),vb:b(o.total_tokens),styleA:x(t.total_tokens,o.total_tokens,!0),styleB:x(o.total_tokens,t.total_tokens,!0)},{label:"Duration",tooltip:"Time between first and last event. Green = shorter session (better).",va:z(t.duration_ms),vb:z(o.duration_ms),styleA:x(t.duration_ms,o.duration_ms,!0),styleB:x(o.duration_ms,t.duration_ms,!0)},{label:"Efficiency",tooltip:"Score 0–100 calculated by the daemon. Penalizes loops, re-reads and excessive context. Green = more efficient (better).",va:`${t.efficiency_score}/100`,vb:`${o.efficiency_score}/100`,styleA:x(t.efficiency_score,o.efficiency_score,!1),styleB:x(o.efficiency_score,t.efficiency_score,!1)},{label:"Tools used",tooltip:"Number of completed tool calls (Done type). Green = fewer calls for the same result (better).",va:`${t.done_count} calls`,vb:`${o.done_count} calls`,styleA:x(t.done_count,o.done_count,!0),styleB:x(o.done_count,t.done_count,!0)},{label:"Loops",tooltip:"Detected loops: same action repeated ≥3 times without real progress. Green = none or fewer (better).",va:`${t.loops_detected} loop${t.loops_detected!==1?"s":""}`,vb:`${o.loops_detected} loop${o.loops_detected!==1?"s":""}`,styleA:x(t.loops_detected,o.loops_detected,!0),styleB:x(o.loops_detected,t.loops_detected,!0)},{label:"Mode",tooltip:"Detected mode: direct (no agents or skills), agents, skills, or both.",va:t.mode,vb:o.mode,styleA:{color:I[t.mode]??"#7d8590",fontWeight:600},styleB:{color:I[o.mode]??"#7d8590",fontWeight:600}}],f=t.project_name||t.id.slice(0,8),m=o.project_name||o.id.slice(0,8);return e.jsxs("div",{style:{margin:"0 0 20px 0",background:"#161b22",border:"1px solid #30363d",borderLeft:"3px solid #58a6ff",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 16px",borderBottom:"1px solid #21262d",background:"#1c2128"},children:[e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Session comparison"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Green = better · Red = worse",e.jsx("br",{}),"Metrics are compared against each other. For cost, tokens, duration and loops: less is better. For efficiency: more is better."]})]}),children:e.jsx(R,{size:14,color:"#58a6ff",style:{cursor:"default"}})}),e.jsx("span",{style:{color:"#e6edf3",fontWeight:700,fontSize:13},children:"Session comparison"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Session A"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10},children:[t.project_name??t.id.slice(0,8)," · ",new Date(t.started_at).toLocaleDateString("en",{day:"numeric",month:"short"})]})]}),children:e.jsx("span",{style:{color:"#58a6ff",fontSize:11,background:"#58a6ff18",borderRadius:4,padding:"1px 7px",border:"1px solid #58a6ff30",cursor:"default"},children:new Date(t.started_at).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})})}),e.jsx("span",{style:{color:"#6e7681",fontSize:11},children:"vs"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#bc8cff",fontWeight:700,fontSize:12,marginBottom:4},children:"Session B"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10},children:[o.project_name??o.id.slice(0,8)," · ",new Date(o.started_at).toLocaleDateString("en",{day:"numeric",month:"short"})]})]}),children:e.jsx("span",{style:{color:"#bc8cff",fontSize:11,background:"#bc8cff18",borderRadius:4,padding:"1px 7px",border:"1px solid #bc8cff30",cursor:"default"},children:new Date(o.started_at).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})})}),e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:n,style:{background:"none",border:"none",cursor:"pointer",color:"#6e7681",display:"flex"},children:e.jsx(_,{size:14})})]}),e.jsxs("div",{style:{padding:"0 0 8px 0"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr 1fr",padding:"6px 16px",borderBottom:"1px solid #21262d"},children:[e.jsx("span",{style:{color:"#484f58",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em"},children:"Metric"}),e.jsx("span",{style:{color:"#58a6ff",fontSize:10,fontWeight:700},children:f}),e.jsx("span",{style:{color:"#bc8cff",fontSize:10,fontWeight:700},children:m})]}),r.map((d,c)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr 1fr",padding:"5px 16px",background:c%2===0?"transparent":"#ffffff08"},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:d.label}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:d.tooltip})]}),children:e.jsx("span",{style:{color:"#7d8590",fontSize:11,cursor:"default"},children:d.label})}),e.jsx("span",{style:{fontSize:12,...d.styleA},children:d.va}),e.jsx("span",{style:{fontSize:12,...d.styleB},children:d.vb})]},c)),(t.top_tools.length>0||o.top_tools.length>0)&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr 1fr",padding:"5px 16px"},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Top tools"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Most invoked tools in each session, sorted by frequency"})]}),children:e.jsx("span",{style:{color:"#7d8590",fontSize:11,cursor:"default"},children:"Top tools"})}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:(t.top_tools.length>0?t.top_tools:["—"]).map((d,c)=>e.jsx("span",{style:{color:"#8b949e",fontSize:10,background:"#ffffff08",borderRadius:3,padding:"1px 5px"},children:d},c))}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:(o.top_tools.length>0?o.top_tools:["—"]).map((d,c)=>e.jsx("span",{style:{color:"#8b949e",fontSize:10,background:"#ffffff08",borderRadius:3,padding:"1px 5px"},children:d},c))})]})]}),(t.ai_summary||o.ai_summary)&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,padding:"10px 16px",borderTop:"1px solid #21262d"},children:[{s:t,color:"#58a6ff"},{s:o,color:"#bc8cff"}].map(({s:d,color:c})=>e.jsxs("div",{style:{background:c+"08",border:`1px solid ${c}20`,borderRadius:6,padding:"7px 10px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:4},children:[e.jsx(L,{size:10,color:c}),e.jsx("span",{style:{color:c,fontSize:10,fontWeight:700},children:new Date(d.started_at).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})})]}),e.jsx("span",{style:{color:"#9198a1",fontSize:11,fontStyle:"italic",lineHeight:1.4},children:d.ai_summary??e.jsx("span",{style:{color:"#484f58"},children:"No summary"})})]},d.id))})]})}const p={wrap:{padding:"16px 24px",overflowY:"auto",height:"100%"},dayWrap:{marginBottom:28},dayHead:{display:"flex",alignItems:"center",gap:16,marginBottom:10,paddingBottom:6,borderBottom:"1px solid #21262d"},dayLabel:{color:"#e6edf3",fontWeight:700,fontSize:14},dayStat:{color:"#7d8590",fontSize:11},badge:t=>({color:t,background:t+"18",border:`1px solid ${t}30`,borderRadius:4,padding:"1px 7px",fontSize:11,fontWeight:600}),sessions:{display:"flex",flexDirection:"column",gap:8},empty:{padding:"60px 24px",color:"#7d8590",textAlign:"center",fontSize:13}};function ee({days:t,activeSessionId:o}){return e.jsxs("div",{style:{paddingLeft:8},children:[e.jsx("style",{children:"@keyframes livePulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.4;transform:scale(1.5)} }"}),t.map(n=>e.jsxs("div",{style:{marginBottom:28},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10},children:[e.jsx("div",{style:{width:10,height:10,borderRadius:"50%",background:"#30363d",border:"2px solid #484f58",flexShrink:0}}),e.jsx("div",{style:{height:1,width:12,background:"#21262d"}}),e.jsx("span",{style:{color:"#8b949e",fontSize:12,fontWeight:700},children:A(n.date)}),e.jsxs("span",{style:{color:"#484f58",fontSize:11},children:[n.sessions.length," ses. · $",n.total_cost.toFixed(3)," · ",b(n.total_tokens)]})]}),e.jsxs("div",{style:{position:"relative",paddingLeft:28},children:[e.jsx("div",{style:{position:"absolute",left:4,top:0,bottom:0,width:2,background:"#21262d",borderRadius:1}}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:n.sessions.map(r=>{const f=r.efficiency_score>=90?"#3fb950":r.efficiency_score>=70?"#d29922":"#f85149",m=r.id===o;return e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start"},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsxs("div",{style:{color:f,fontWeight:700,fontSize:12,marginBottom:4},children:["Efficiency ",r.efficiency_score,"/100"]}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Green ≥90 · Amber ≥70 · Red <70",e.jsx("br",{}),"Penalizes loops, re-reads and excessive context"]})]}),children:e.jsx("div",{style:{width:10,height:10,borderRadius:"50%",flexShrink:0,marginTop:6,background:f,border:"2px solid #0d1117",boxShadow:`0 0 6px ${f}66`,position:"relative",zIndex:1,animation:m?"livePulse 1.5s ease-in-out infinite":void 0,cursor:"default"}})}),e.jsx("div",{style:{flex:1,background:"#161b22",border:`1px solid ${m?"#1f6feb":"#21262d"}`,borderRadius:7,padding:"7px 12px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Start time"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"First recorded event of the session"})]}),children:e.jsx("span",{style:{color:"#6e7681",fontSize:10,fontFamily:"monospace",cursor:"default"},children:new Date(r.started_at).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})})}),r.project_name&&e.jsx("span",{style:{color:"#79c0ff",fontSize:11,fontWeight:600},children:r.project_name}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"API Cost"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Sum of all session blocks"})]}),children:e.jsxs("span",{style:{color:"#3fb950",fontSize:10,fontWeight:600,cursor:"default"},children:["$",r.total_cost_usd.toFixed(4)]})}),e.jsx("span",{style:{color:"#484f58",fontSize:10},children:"·"}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:f,fontWeight:700,fontSize:12,marginBottom:4},children:"Efficiency"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Score 0–100. Penalizes loops, re-reads and excessive context"})]}),children:e.jsxs("span",{style:{color:f,fontSize:10,cursor:"default"},children:[r.efficiency_score,"/100"]})}),e.jsx(l,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#79c0ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Total tokens"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Input + Output + Cache read"})]}),children:e.jsxs("span",{style:{color:"#484f58",fontSize:10,cursor:"default"},children:["· ",b(r.total_tokens)," tok"]})}),r.ai_summary&&e.jsxs("span",{style:{color:"#7d8590",fontSize:10,fontStyle:"italic",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["— ",r.ai_summary]})]})})]},r.id)})})]})]},n.date))]})}const S=[{label:"All",min:null,max:null},{label:"< $0.01",min:null,max:.01},{label:"$0.01+",min:.01,max:null},{label:"$0.10+",min:.1,max:null},{label:"$1+",min:1,max:null}];function se({days:t,activeSessionId:o}){const[n,r]=u.useState([]),[f,m]=u.useState("list"),[d,c]=u.useState(""),[h,H]=u.useState(0),j=u.useMemo(()=>{const i=d.trim().toLowerCase(),s=S[h];return t.map(g=>({...g,sessions:g.sessions.filter(y=>{var B,$;return s.min!==null&&y.total_cost_usd<s.min||s.max!==null&&y.total_cost_usd>=s.max?!1:i?((B=y.project_name)==null?void 0:B.toLowerCase().includes(i))||y.top_tools.some(M=>M.toLowerCase().includes(i))||(($=y.ai_summary)==null?void 0:$.toLowerCase().includes(i))||y.id.includes(i):!0})})).filter(g=>g.sessions.length>0)},[t,d,h]),k=t.flatMap(i=>i.sessions),w=k.find(i=>i.id===n[0]),W=k.find(i=>i.id===n[1]);function O(i){r(s=>s.includes(i)?s.filter(g=>g!==i):s.length>=2?[s[1],i]:[...s,i])}return t.length===0?e.jsxs("div",{style:{...p.empty,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[e.jsx(N,{size:40,color:"#30363d"}),e.jsxs("div",{children:[e.jsx("div",{style:{color:"#6e7681",fontSize:14,fontWeight:600,marginBottom:4},children:"No sessions recorded"}),e.jsx("div",{style:{fontSize:11,color:"#484f58"},children:"Sessions appear here once the daemon processes them."})]})]}):e.jsxs("div",{style:p.wrap,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,padding:"5px 10px",background:"#161b22",border:"1px solid #21262d",borderRadius:6},children:[e.jsx(C,{size:12,color:"#484f58"}),e.jsx("input",{type:"text",placeholder:"Search by project, tool or summary…",value:d,onChange:i=>c(i.target.value),style:{flex:1,background:"transparent",border:"none",outline:"none",color:"#c9d1d9",fontSize:12,fontFamily:"inherit"}}),d&&e.jsx("button",{onClick:()=>c(""),style:{background:"none",border:"none",cursor:"pointer",color:"#6e7681",display:"flex"},children:e.jsx(_,{size:12})}),e.jsx("div",{style:{width:1,height:16,background:"#21262d"}}),e.jsx("div",{style:{display:"flex",gap:3},children:S.map((i,s)=>{const g=s===0?"Show all sessions without filtering by cost":s===1?"Only sessions with cost under $0.01 — very short conversations":s===2?"Sessions with cost of $0.01 or more — real work":s===3?"Sessions with cost of $0.10 or more — intensive work":"Sessions with cost of $1 or more — long or high-complexity sessions";return e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsxs("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:["Filtro: ",i.label]}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:g})]}),children:e.jsx("button",{onClick:()=>H(s),style:{padding:"2px 7px",borderRadius:4,border:`1px solid ${h===s?"#3fb95060":"#21262d"}`,background:h===s?"#1a2d1a":"transparent",color:h===s?"#3fb950":"#6e7681",fontSize:10,fontWeight:600,cursor:"pointer"},children:i.label})},s)})}),(d||h>0)&&e.jsxs("span",{style:{color:"#484f58",fontSize:10},children:[j.reduce((i,s)=>i+s.sessions.length,0)," result",j.reduce((i,s)=>i+s.sessions.length,0)!==1?"s":""]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12,padding:"6px 10px",background:"#161b22",border:"1px solid #21262d",borderRadius:6},children:[e.jsx("div",{style:{display:"flex",gap:2,background:"#0d1117",borderRadius:5,padding:2},children:[["list",V,"List","Card view grouped by day. Shows all details for each session."],["timeline",q,"Timeline","Chronological view with a timeline. Shows the session flow for the day."]].map(([i,s,g,y])=>e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:g}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:y})]}),children:e.jsxs("button",{onClick:()=>m(i),style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:4,border:"none",cursor:"pointer",fontSize:10,fontWeight:600,background:f===i?"#21262d":"transparent",color:f===i?"#e6edf3":"#6e7681",transition:"all 0.15s"},children:[e.jsx(s,{size:10}),g]})},i))}),e.jsx("div",{style:{width:1,height:16,background:"#21262d"}}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#58a6ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Compare sessions"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Click 2 sessions to compare their metrics.",e.jsx("br",{}),"If 2 are already selected, the new one replaces the oldest."]})]}),children:e.jsx(R,{size:12,color:"#58a6ff",style:{cursor:"default"}})}),e.jsx("span",{style:{color:"#6e7681",fontSize:11},children:n.length===0?"Select 2 sessions to compare":n.length===1?"Select 1 more":"Comparing 2 sessions"}),n.length>0&&e.jsx("button",{onClick:()=>r([]),style:{background:"none",border:"none",cursor:"pointer",color:"#6e7681",display:"flex",marginLeft:"auto"},children:e.jsx(_,{size:12})})]}),w&&W&&e.jsx(Z,{a:w,b:W,onClose:()=>r([])}),j.length===0&&(d||h>0)&&e.jsxs("div",{style:{...p.empty},children:[e.jsx(C,{size:32,color:"#30363d",style:{marginBottom:8}}),e.jsxs("div",{style:{color:"#6e7681",fontSize:13},children:['No results for "',d||S[h].label,'"']})]}),f==="timeline"?e.jsx(ee,{days:j,activeSessionId:o}):j.map(i=>e.jsxs("div",{style:p.dayWrap,children:[e.jsxs("div",{style:p.dayHead,children:[e.jsx("span",{style:p.dayLabel,children:A(i.date)}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Day sessions"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Number of Claude Code sessions recorded this day"})]}),children:e.jsxs("span",{style:{...p.dayStat,cursor:"default"},children:[i.sessions.length," session",i.sessions.length>1?"s":""]})}),e.jsx("span",{style:p.dayStat,children:"·"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Accumulated duration"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Sum of the duration of all sessions in the day"})]}),children:e.jsx("span",{style:{...p.dayStat,cursor:"default"},children:z(i.total_duration_ms)})}),e.jsx("span",{style:p.dayStat,children:"·"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"Day cost"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10},children:"Sum of API costs of all sessions in the day"})]}),children:e.jsxs("span",{style:{...p.badge("#3fb950"),cursor:"default"},children:["$",i.total_cost.toFixed(3)]})}),e.jsx("span",{style:p.dayStat,children:"·"}),e.jsx(l,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#79c0ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Day tokens"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Sum of tokens (input + output + cache read) of all sessions in the day"})]}),children:e.jsxs("span",{style:{...p.dayStat,cursor:"default"},children:[b(i.total_tokens)," tokens"]})})]}),e.jsx("div",{style:p.sessions,children:i.sessions.map(s=>e.jsx(U,{session:s,isActive:s.id===o,selectable:!0,selected:n.includes(s.id),onSelect:O},s.id))})]},i.date))]})}export{se as HistoryView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,T as a}from"./index-CB01c5lb.js";import{a as j,c as b,d as m,U as y,V as k,Y as S,f as z,F as w}from"./vendor-lucide-Cym0q5l_.js";import"./vendor-react-B_Jzs0gY.js";function p(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function u(t){return t>0&&t<.01?"<$0.01":`$${t.toFixed(2)}`}function T(t){if(!t)return null;const{opusTokens:n,sonnetTokens:l,haikuTokens:s}=t;return n===0&&l===0&&s===0?null:n>=l&&n>=s?{label:"Opus",color:"#d29922"}:l>=s?{label:"Sonnet",color:"#58a6ff"}:{label:"Haiku",color:"#3fb950"}}function W(t){if(!t)return"never";const n=Date.now()-t;return n<6e4?"just now":n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:n<7*864e5?`${Math.round(n/864e5)}d ago`:new Date(t).toLocaleDateString("en",{day:"numeric",month:"short"})}function F({usage:t}){const n=t.opusTokens+t.sonnetTokens+t.haikuTokens;if(n===0)return null;const l=[{label:"Sonnet",tokens:t.sonnetTokens,color:"#58a6ff"},{label:"Opus",tokens:t.opusTokens,color:"#d29922"},{label:"Haiku",tokens:t.haikuTokens,color:"#3fb950"}].filter(s=>s.tokens>0);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[e.jsx(a,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:6},children:"Usage by model"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:l.map(s=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:s.color,flexShrink:0}}),e.jsx("span",{style:{color:s.color,fontSize:10,fontWeight:700,width:42},children:s.label}),e.jsxs("span",{style:{color:"#c9d1d9",fontSize:10},children:[p(s.tokens)," tok"]}),e.jsxs("span",{style:{color:"#484f58",fontSize:9},children:[Math.round(s.tokens/n*100),"%"]})]},s.label))})]}),children:e.jsx("span",{style:{color:"#7d8590",fontSize:10,marginBottom:1},children:"model usage"})}),e.jsx("div",{style:{display:"flex",height:5,borderRadius:3,overflow:"hidden",gap:1},children:l.map(s=>e.jsx("div",{style:{height:"100%",width:`${Math.round(s.tokens/n*100)}%`,background:s.color,minWidth:s.tokens>0?2:0}},s.label))}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:l.map(s=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:3},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:s.color,flexShrink:0}}),e.jsx("span",{style:{color:s.color,fontSize:9,fontWeight:700},children:s.label}),e.jsx("span",{style:{color:"#7d8590",fontSize:9},children:p(s.tokens)})]},s.label))})]})}const I={tip:"#58a6ff",warning:"#d29922",positive:"#3fb950"},H={tip:y,warning:m,positive:z};function C({insights:t}){const[n,l]=j.useState(!1);if(t.length===0)return null;const s=t.filter(r=>r.level==="warning").length,h=s>0?"#d29922":"#58a6ff";return e.jsxs("div",{style:{borderTop:"1px solid #21262d",paddingTop:8},children:[e.jsxs("button",{onClick:()=>l(r=>!r),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",background:"none",border:"none",cursor:"pointer",padding:"4px 0"},children:[e.jsxs("span",{style:{color:h,fontSize:11,fontWeight:700,display:"flex",alignItems:"center",gap:5},children:[s>0?e.jsx(m,{size:12}):e.jsx(y,{size:12}),t.length," insight",t.length>1?"s":"",s>0&&e.jsxs("span",{style:{color:"#d29922",fontSize:10},children:["· ",s," warning",s>1?"s":""]})]}),n?e.jsx(k,{size:14,color:"#484f58"}):e.jsx(S,{size:14,color:"#484f58"})]}),n&&e.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:6},children:t.map((r,x)=>{const c=I[r.level];return e.jsxs("div",{style:{background:c+"0d",border:`1px solid ${c}30`,borderRadius:6,padding:"7px 10px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:3},children:[(()=>{const g=H[r.level];return e.jsx(g,{size:11,color:c})})(),e.jsx("span",{style:{color:c,fontSize:11,fontWeight:700},children:r.title}),r.metric&&e.jsx("span",{style:{color:"#7d8590",fontSize:9,marginLeft:"auto"},children:r.metric})]}),e.jsx("p",{style:{color:"#8b949e",fontSize:10,margin:0,lineHeight:1.5},children:r.description})]},x)})})]})}const i={card:t=>({background:t?"#1c2128":"#161b22",border:`1px solid ${t?"#1f6feb":"#21262d"}`,borderRadius:10,padding:"14px 16px",display:"flex",flexDirection:"column",gap:10,cursor:"default",transition:"border-color 0.2s"}),header:{display:"flex",alignItems:"center",gap:8},name:{color:"#e6edf3",fontWeight:700,fontSize:15,flex:1},activeBadge:{color:"#3fb950",background:"#3fb95018",border:"1px solid #3fb95030",borderRadius:4,padding:"1px 7px",fontSize:10,fontWeight:700},autoBadge:{color:"#7d8590",background:"#7d859015",border:"1px solid #7d859030",borderRadius:4,padding:"1px 6px",fontSize:9},path:{color:"#7d8590",fontSize:10,marginTop:-4},progressWrap:{display:"flex",flexDirection:"column",gap:4},progressRow:{display:"flex",alignItems:"center",justifyContent:"space-between"},progressLabel:{color:"#7d8590",fontSize:11},progressPct:t=>({color:t>=80?"#3fb950":t>=50?"#d29922":"#7d8590",fontWeight:700,fontSize:12}),barTrack:{height:6,background:"#21262d",borderRadius:3,overflow:"hidden"},barFill:t=>({height:"100%",width:`${t}%`,background:t>=80?"#3fb950":t>=50?"#d29922":"#58a6ff",borderRadius:3,transition:"width 0.5s ease",boxShadow:`0 0 4px ${t>=80?"#3fb95088":t>=50?"#d2992288":"#58a6ff88"}`}),nextTask:{color:"#58a6ff",fontSize:10,fontStyle:"italic",opacity:.85,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},stats:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:8,marginTop:2},stat:{display:"flex",flexDirection:"column",gap:1},statVal:{color:"#e6edf3",fontWeight:700,fontSize:12},statLbl:{color:"#7d8590",fontSize:10}};function B({project:t,isActive:n}){const l=!!t.auto_handoff,s=T(t.model_usage);return e.jsxs("div",{style:i.card(!!n),children:[e.jsxs("div",{children:[e.jsxs("div",{style:i.header,children:[e.jsxs("span",{style:{...i.name,display:"flex",alignItems:"center",gap:6},children:[e.jsx(b,{size:14,color:"#6e7681",style:{flexShrink:0}}),t.name]}),n&&e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"Active project"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Claude Code is currently working in this directory"})]}),children:e.jsx("span",{style:i.activeBadge,children:"● active"})}),l&&e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#7d8590",fontWeight:700,fontSize:12,marginBottom:4},children:"Auto-generated HANDOFF"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"The daemon generated an automatic HANDOFF.md. Edit it to record your pending tasks."})]}),children:e.jsx("span",{style:i.autoBadge,children:"HANDOFF auto"})})]}),e.jsx(a,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Project path"}),e.jsx("div",{style:{color:"#79c0ff",fontSize:10,fontFamily:"monospace",wordBreak:"break-all"},children:t.path})]}),children:e.jsx("div",{style:i.path,children:t.path.split("/").slice(-3).join("/")})})]}),t.has_handoff?e.jsx("div",{style:i.progressWrap,children:t.progress.total===0?e.jsx("span",{style:{...i.progressLabel,fontStyle:"italic"},children:l?"→ Auto-generated HANDOFF — fill in the sections with your tasks":"no tasks recorded"}):t.progress.done===0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:i.progressLabel,children:[t.progress.total," pending task",t.progress.total>1?"s":""]}),t.progress.nextTask&&e.jsxs("div",{style:i.nextTask,children:["→ next: ",t.progress.nextTask]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:i.progressRow,children:[e.jsxs("span",{style:i.progressLabel,children:[t.progress.done,"/",t.progress.total," tasks"]}),e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"HANDOFF progress"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:[t.progress.done," completed task",t.progress.done!==1?"s":""," out of ",t.progress.total," in HANDOFF.md"]})]}),children:e.jsxs("span",{style:i.progressPct(t.progress.pct),children:[t.progress.pct,"%"]})})]}),e.jsx("div",{style:i.barTrack,children:e.jsx("div",{style:i.barFill(t.progress.pct)})}),t.progress.nextTask&&e.jsxs("div",{style:i.nextTask,children:["→ next: ",t.progress.nextTask]})]})}):null,t.model_usage&&e.jsx(F,{usage:t.model_usage}),e.jsxs("div",{style:i.stats,children:[e.jsx(a,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"Total cost"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Sum of all API costs of the sessions in this project"})]}),children:e.jsxs("div",{style:i.stat,children:[e.jsx("span",{style:i.statVal,children:u(t.total_cost_usd)}),e.jsxs("span",{style:i.statLbl,children:["total cost",t.session_count>1&&e.jsxs("span",{style:{color:"#484f58",marginLeft:3},children:["· ",u(t.total_cost_usd/t.session_count),"/ses"]})]})]})}),e.jsx(a,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#79c0ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Total tokens"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Input + Output + Cache read accumulated.",e.jsx("br",{}),s?e.jsxs(e.Fragment,{children:["Dominant model: ",e.jsx("span",{style:{color:s.color,fontWeight:700},children:s.label})]}):"No model data"]})]}),children:e.jsxs("div",{style:i.stat,children:[e.jsx("span",{style:i.statVal,children:p(t.total_tokens)}),e.jsxs("span",{style:i.statLbl,children:["tokens",s&&e.jsxs("span",{style:{color:s.color,marginLeft:3},children:["· ",s.label]})]})]})}),e.jsx(a,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Sessions"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Total recorded sessions, including those before claudestat was installed (read from Claude Code JSONL files)."})]}),children:e.jsxs("div",{style:i.stat,children:[e.jsx("span",{style:i.statVal,children:t.session_count}),e.jsx("span",{style:i.statLbl,children:"sessions"})]})}),e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Last activity"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:t.last_active?new Date(t.last_active).toLocaleString("en",{dateStyle:"medium",timeStyle:"short"}):"No activity recorded"})]}),children:e.jsxs("div",{style:i.stat,children:[e.jsx("span",{style:i.statVal,children:W(t.last_active)}),e.jsx("span",{style:i.statLbl,children:"last seen"})]})})]}),t.insights&&t.insights.length>0&&e.jsx(C,{insights:t.insights})]})}const _=j.memo(B);function v(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function L({data:t}){if(t.length===0)return null;const n=Math.max(...t.map(s=>s.tokens),1),l=["M","T","W","T","F","S","S"];return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:3},children:[e.jsx("div",{style:{display:"flex",gap:3},children:t.slice(-7).map((s,h)=>{const r=s.tokens/n,x=r<.05?"#1c2128":r<.3?"#0e4429":r<.6?"#006d32":r<.85?"#26a641":"#39d353";return e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:3},children:s.date}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10},children:[v(s.tokens)," tokens that day"]})]}),children:e.jsx("div",{style:{width:12,height:12,borderRadius:2,background:x,border:"1px solid #21262d"}})},h)})}),e.jsx("div",{style:{display:"flex",gap:3},children:t.slice(-7).map((s,h)=>e.jsx("span",{style:{width:12,fontSize:8,color:"#484f58",textAlign:"center"},children:l[h]},h))})]})}function D(){return e.jsxs("div",{style:{background:"#161b22",border:"1px solid #21262d",borderRadius:10,padding:"14px 16px",display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:120,height:14,borderRadius:4,background:"#21262d",animation:"skeletonShimmer 1.4s ease-in-out infinite"}}),e.jsx("div",{style:{width:40,height:14,borderRadius:4,background:"#21262d",animation:"skeletonShimmer 1.4s ease-in-out infinite 0.2s"}})]}),e.jsx("div",{style:{width:"70%",height:10,borderRadius:3,background:"#21262d",animation:"skeletonShimmer 1.4s ease-in-out infinite 0.1s"}}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:8},children:[0,1,2,3].map(t=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("div",{style:{height:12,borderRadius:3,background:"#21262d",animation:`skeletonShimmer 1.4s ease-in-out infinite ${t*.1}s`}}),e.jsx("div",{style:{height:8,borderRadius:2,background:"#21262d",animation:`skeletonShimmer 1.4s ease-in-out infinite ${t*.1+.1}s`}})]},t))})]})}const o={wrap:{padding:"16px 24px",overflowY:"auto",height:"100%"},summary:{display:"flex",alignItems:"center",gap:20,padding:"12px 16px",marginBottom:20,background:"#161b22",borderRadius:8,border:"1px solid #21262d",flexWrap:"wrap"},sumItem:{display:"flex",flexDirection:"column",gap:2},sumVal:{color:"#e6edf3",fontWeight:700,fontSize:16},sumLbl:{color:"#7d8590",fontSize:11},grid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:12},sep:{width:1,height:32,background:"#21262d",flexShrink:0}};function A({projects:t,activeProject:n,weeklyData:l=[],loading:s=!1}){const h=t.reduce((d,f)=>d+f.total_cost_usd,0),r=t.reduce((d,f)=>d+f.total_tokens,0),x=t.reduce((d,f)=>d+f.session_count,0),c=t.filter(d=>d.has_handoff&&!d.auto_handoff),g=c.length>0?Math.round(c.reduce((d,f)=>d+f.progress.pct,0)/c.length):0;return e.jsxs("div",{style:o.wrap,children:[e.jsx("style",{children:`
|
|
1
|
+
import{j as e,T as a}from"./index-DgbWvj42.js";import{a as j,c as b,d as m,U as y,V as k,Y as S,f as z,F as w}from"./vendor-lucide-Cym0q5l_.js";import"./vendor-react-B_Jzs0gY.js";function p(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function u(t){return t>0&&t<.01?"<$0.01":`$${t.toFixed(2)}`}function T(t){if(!t)return null;const{opusTokens:n,sonnetTokens:l,haikuTokens:s}=t;return n===0&&l===0&&s===0?null:n>=l&&n>=s?{label:"Opus",color:"#d29922"}:l>=s?{label:"Sonnet",color:"#58a6ff"}:{label:"Haiku",color:"#3fb950"}}function W(t){if(!t)return"never";const n=Date.now()-t;return n<6e4?"just now":n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:n<7*864e5?`${Math.round(n/864e5)}d ago`:new Date(t).toLocaleDateString("en",{day:"numeric",month:"short"})}function F({usage:t}){const n=t.opusTokens+t.sonnetTokens+t.haikuTokens;if(n===0)return null;const l=[{label:"Sonnet",tokens:t.sonnetTokens,color:"#58a6ff"},{label:"Opus",tokens:t.opusTokens,color:"#d29922"},{label:"Haiku",tokens:t.haikuTokens,color:"#3fb950"}].filter(s=>s.tokens>0);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[e.jsx(a,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:6},children:"Usage by model"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:l.map(s=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:s.color,flexShrink:0}}),e.jsx("span",{style:{color:s.color,fontSize:10,fontWeight:700,width:42},children:s.label}),e.jsxs("span",{style:{color:"#c9d1d9",fontSize:10},children:[p(s.tokens)," tok"]}),e.jsxs("span",{style:{color:"#484f58",fontSize:9},children:[Math.round(s.tokens/n*100),"%"]})]},s.label))})]}),children:e.jsx("span",{style:{color:"#7d8590",fontSize:10,marginBottom:1},children:"model usage"})}),e.jsx("div",{style:{display:"flex",height:5,borderRadius:3,overflow:"hidden",gap:1},children:l.map(s=>e.jsx("div",{style:{height:"100%",width:`${Math.round(s.tokens/n*100)}%`,background:s.color,minWidth:s.tokens>0?2:0}},s.label))}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:l.map(s=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:3},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:s.color,flexShrink:0}}),e.jsx("span",{style:{color:s.color,fontSize:9,fontWeight:700},children:s.label}),e.jsx("span",{style:{color:"#7d8590",fontSize:9},children:p(s.tokens)})]},s.label))})]})}const I={tip:"#58a6ff",warning:"#d29922",positive:"#3fb950"},H={tip:y,warning:m,positive:z};function C({insights:t}){const[n,l]=j.useState(!1);if(t.length===0)return null;const s=t.filter(r=>r.level==="warning").length,h=s>0?"#d29922":"#58a6ff";return e.jsxs("div",{style:{borderTop:"1px solid #21262d",paddingTop:8},children:[e.jsxs("button",{onClick:()=>l(r=>!r),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",background:"none",border:"none",cursor:"pointer",padding:"4px 0"},children:[e.jsxs("span",{style:{color:h,fontSize:11,fontWeight:700,display:"flex",alignItems:"center",gap:5},children:[s>0?e.jsx(m,{size:12}):e.jsx(y,{size:12}),t.length," insight",t.length>1?"s":"",s>0&&e.jsxs("span",{style:{color:"#d29922",fontSize:10},children:["· ",s," warning",s>1?"s":""]})]}),n?e.jsx(k,{size:14,color:"#484f58"}):e.jsx(S,{size:14,color:"#484f58"})]}),n&&e.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:6},children:t.map((r,x)=>{const c=I[r.level];return e.jsxs("div",{style:{background:c+"0d",border:`1px solid ${c}30`,borderRadius:6,padding:"7px 10px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:3},children:[(()=>{const g=H[r.level];return e.jsx(g,{size:11,color:c})})(),e.jsx("span",{style:{color:c,fontSize:11,fontWeight:700},children:r.title}),r.metric&&e.jsx("span",{style:{color:"#7d8590",fontSize:9,marginLeft:"auto"},children:r.metric})]}),e.jsx("p",{style:{color:"#8b949e",fontSize:10,margin:0,lineHeight:1.5},children:r.description})]},x)})})]})}const i={card:t=>({background:t?"#1c2128":"#161b22",border:`1px solid ${t?"#1f6feb":"#21262d"}`,borderRadius:10,padding:"14px 16px",display:"flex",flexDirection:"column",gap:10,cursor:"default",transition:"border-color 0.2s"}),header:{display:"flex",alignItems:"center",gap:8},name:{color:"#e6edf3",fontWeight:700,fontSize:15,flex:1},activeBadge:{color:"#3fb950",background:"#3fb95018",border:"1px solid #3fb95030",borderRadius:4,padding:"1px 7px",fontSize:10,fontWeight:700},autoBadge:{color:"#7d8590",background:"#7d859015",border:"1px solid #7d859030",borderRadius:4,padding:"1px 6px",fontSize:9},path:{color:"#7d8590",fontSize:10,marginTop:-4},progressWrap:{display:"flex",flexDirection:"column",gap:4},progressRow:{display:"flex",alignItems:"center",justifyContent:"space-between"},progressLabel:{color:"#7d8590",fontSize:11},progressPct:t=>({color:t>=80?"#3fb950":t>=50?"#d29922":"#7d8590",fontWeight:700,fontSize:12}),barTrack:{height:6,background:"#21262d",borderRadius:3,overflow:"hidden"},barFill:t=>({height:"100%",width:`${t}%`,background:t>=80?"#3fb950":t>=50?"#d29922":"#58a6ff",borderRadius:3,transition:"width 0.5s ease",boxShadow:`0 0 4px ${t>=80?"#3fb95088":t>=50?"#d2992288":"#58a6ff88"}`}),nextTask:{color:"#58a6ff",fontSize:10,fontStyle:"italic",opacity:.85,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},stats:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:8,marginTop:2},stat:{display:"flex",flexDirection:"column",gap:1},statVal:{color:"#e6edf3",fontWeight:700,fontSize:12},statLbl:{color:"#7d8590",fontSize:10}};function B({project:t,isActive:n}){const l=!!t.auto_handoff,s=T(t.model_usage);return e.jsxs("div",{style:i.card(!!n),children:[e.jsxs("div",{children:[e.jsxs("div",{style:i.header,children:[e.jsxs("span",{style:{...i.name,display:"flex",alignItems:"center",gap:6},children:[e.jsx(b,{size:14,color:"#6e7681",style:{flexShrink:0}}),t.name]}),n&&e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"Active project"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Claude Code is currently working in this directory"})]}),children:e.jsx("span",{style:i.activeBadge,children:"● active"})}),l&&e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#7d8590",fontWeight:700,fontSize:12,marginBottom:4},children:"Auto-generated HANDOFF"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"The daemon generated an automatic HANDOFF.md. Edit it to record your pending tasks."})]}),children:e.jsx("span",{style:i.autoBadge,children:"HANDOFF auto"})})]}),e.jsx(a,{position:"bottom",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Project path"}),e.jsx("div",{style:{color:"#79c0ff",fontSize:10,fontFamily:"monospace",wordBreak:"break-all"},children:t.path})]}),children:e.jsx("div",{style:i.path,children:t.path.split("/").slice(-3).join("/")})})]}),t.has_handoff?e.jsx("div",{style:i.progressWrap,children:t.progress.total===0?e.jsx("span",{style:{...i.progressLabel,fontStyle:"italic"},children:l?"→ Auto-generated HANDOFF — fill in the sections with your tasks":"no tasks recorded"}):t.progress.done===0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:i.progressLabel,children:[t.progress.total," pending task",t.progress.total>1?"s":""]}),t.progress.nextTask&&e.jsxs("div",{style:i.nextTask,children:["→ next: ",t.progress.nextTask]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:i.progressRow,children:[e.jsxs("span",{style:i.progressLabel,children:[t.progress.done,"/",t.progress.total," tasks"]}),e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"HANDOFF progress"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:[t.progress.done," completed task",t.progress.done!==1?"s":""," out of ",t.progress.total," in HANDOFF.md"]})]}),children:e.jsxs("span",{style:i.progressPct(t.progress.pct),children:[t.progress.pct,"%"]})})]}),e.jsx("div",{style:i.barTrack,children:e.jsx("div",{style:i.barFill(t.progress.pct)})}),t.progress.nextTask&&e.jsxs("div",{style:i.nextTask,children:["→ next: ",t.progress.nextTask]})]})}):null,t.model_usage&&e.jsx(F,{usage:t.model_usage}),e.jsxs("div",{style:i.stats,children:[e.jsx(a,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#3fb950",fontWeight:700,fontSize:12,marginBottom:4},children:"Total cost"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Sum of all API costs of the sessions in this project"})]}),children:e.jsxs("div",{style:i.stat,children:[e.jsx("span",{style:i.statVal,children:u(t.total_cost_usd)}),e.jsxs("span",{style:i.statLbl,children:["total cost",t.session_count>1&&e.jsxs("span",{style:{color:"#484f58",marginLeft:3},children:["· ",u(t.total_cost_usd/t.session_count),"/ses"]})]})]})}),e.jsx(a,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#79c0ff",fontWeight:700,fontSize:12,marginBottom:4},children:"Total tokens"}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.6},children:["Input + Output + Cache read accumulated.",e.jsx("br",{}),s?e.jsxs(e.Fragment,{children:["Dominant model: ",e.jsx("span",{style:{color:s.color,fontWeight:700},children:s.label})]}):"No model data"]})]}),children:e.jsxs("div",{style:i.stat,children:[e.jsx("span",{style:i.statVal,children:p(t.total_tokens)}),e.jsxs("span",{style:i.statLbl,children:["tokens",s&&e.jsxs("span",{style:{color:s.color,marginLeft:3},children:["· ",s.label]})]})]})}),e.jsx(a,{position:"top",align:"left",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Sessions"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:"Total recorded sessions, including those before claudestat was installed (read from Claude Code JSONL files)."})]}),children:e.jsxs("div",{style:i.stat,children:[e.jsx("span",{style:i.statVal,children:t.session_count}),e.jsx("span",{style:i.statLbl,children:"sessions"})]})}),e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:4},children:"Last activity"}),e.jsx("div",{style:{color:"#7d8590",fontSize:10,lineHeight:1.5},children:t.last_active?new Date(t.last_active).toLocaleString("en",{dateStyle:"medium",timeStyle:"short"}):"No activity recorded"})]}),children:e.jsxs("div",{style:i.stat,children:[e.jsx("span",{style:i.statVal,children:W(t.last_active)}),e.jsx("span",{style:i.statLbl,children:"last seen"})]})})]}),t.insights&&t.insights.length>0&&e.jsx(C,{insights:t.insights})]})}const _=j.memo(B);function v(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function L({data:t}){if(t.length===0)return null;const n=Math.max(...t.map(s=>s.tokens),1),l=["M","T","W","T","F","S","S"];return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:3},children:[e.jsx("div",{style:{display:"flex",gap:3},children:t.slice(-7).map((s,h)=>{const r=s.tokens/n,x=r<.05?"#1c2128":r<.3?"#0e4429":r<.6?"#006d32":r<.85?"#26a641":"#39d353";return e.jsx(a,{position:"top",align:"right",content:e.jsxs("div",{children:[e.jsx("div",{style:{color:"#e6edf3",fontWeight:700,fontSize:12,marginBottom:3},children:s.date}),e.jsxs("div",{style:{color:"#7d8590",fontSize:10},children:[v(s.tokens)," tokens that day"]})]}),children:e.jsx("div",{style:{width:12,height:12,borderRadius:2,background:x,border:"1px solid #21262d"}})},h)})}),e.jsx("div",{style:{display:"flex",gap:3},children:t.slice(-7).map((s,h)=>e.jsx("span",{style:{width:12,fontSize:8,color:"#484f58",textAlign:"center"},children:l[h]},h))})]})}function D(){return e.jsxs("div",{style:{background:"#161b22",border:"1px solid #21262d",borderRadius:10,padding:"14px 16px",display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:120,height:14,borderRadius:4,background:"#21262d",animation:"skeletonShimmer 1.4s ease-in-out infinite"}}),e.jsx("div",{style:{width:40,height:14,borderRadius:4,background:"#21262d",animation:"skeletonShimmer 1.4s ease-in-out infinite 0.2s"}})]}),e.jsx("div",{style:{width:"70%",height:10,borderRadius:3,background:"#21262d",animation:"skeletonShimmer 1.4s ease-in-out infinite 0.1s"}}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:8},children:[0,1,2,3].map(t=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("div",{style:{height:12,borderRadius:3,background:"#21262d",animation:`skeletonShimmer 1.4s ease-in-out infinite ${t*.1}s`}}),e.jsx("div",{style:{height:8,borderRadius:2,background:"#21262d",animation:`skeletonShimmer 1.4s ease-in-out infinite ${t*.1+.1}s`}})]},t))})]})}const o={wrap:{padding:"16px 24px",overflowY:"auto",height:"100%"},summary:{display:"flex",alignItems:"center",gap:20,padding:"12px 16px",marginBottom:20,background:"#161b22",borderRadius:8,border:"1px solid #21262d",flexWrap:"wrap"},sumItem:{display:"flex",flexDirection:"column",gap:2},sumVal:{color:"#e6edf3",fontWeight:700,fontSize:16},sumLbl:{color:"#7d8590",fontSize:11},grid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:12},sep:{width:1,height:32,background:"#21262d",flexShrink:0}};function A({projects:t,activeProject:n,weeklyData:l=[],loading:s=!1}){const h=t.reduce((d,f)=>d+f.total_cost_usd,0),r=t.reduce((d,f)=>d+f.total_tokens,0),x=t.reduce((d,f)=>d+f.session_count,0),c=t.filter(d=>d.has_handoff&&!d.auto_handoff),g=c.length>0?Math.round(c.reduce((d,f)=>d+f.progress.pct,0)/c.length):0;return e.jsxs("div",{style:o.wrap,children:[e.jsx("style",{children:`
|
|
2
2
|
@keyframes skeletonShimmer {
|
|
3
3
|
0%,100% { opacity: 1 }
|
|
4
4
|
50% { opacity: 0.4 }
|