specrails-hub 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/cli/dist/srm.js +12 -12
- package/client/dist/assets/{index-DoIYcnfd.js → index-WpfmJNiC.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +11 -4
- package/server/index.ts +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ A local dashboard and CLI for managing all your [specrails](https://github.com/f
|
|
|
10
10
|
- **Command launcher** — organized into Discovery (propose-spec, auto-propose specs, auto-select specs) and Delivery (implement, batch-implement) sections; other commands available in a collapsible group
|
|
11
11
|
- **Analytics** — cost, duration, token usage, and throughput metrics per project
|
|
12
12
|
- **Conversations** — full-page chat interface with Claude, scoped per project
|
|
13
|
-
- **`
|
|
13
|
+
- **`specrails-hub` CLI** — terminal bridge that auto-routes commands to the correct project
|
|
14
14
|
|
|
15
15
|
## Prerequisites
|
|
16
16
|
|
|
@@ -28,10 +28,10 @@ npm install -g @specrails/hub
|
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
30
|
# Start the hub server
|
|
31
|
-
|
|
31
|
+
specrails-hub hub start
|
|
32
32
|
|
|
33
33
|
# Register a project
|
|
34
|
-
|
|
34
|
+
specrails-hub hub add /path/to/your/project
|
|
35
35
|
|
|
36
36
|
# Open in browser
|
|
37
37
|
open http://localhost:4200
|
|
@@ -90,29 +90,29 @@ A single Express process (port 4200) manages all projects. Each project gets its
|
|
|
90
90
|
- **Conversations** — Claude chat sessions scoped to the project
|
|
91
91
|
- **Settings** (gear icon) — global hub configuration, registered projects
|
|
92
92
|
|
|
93
|
-
## CLI: `
|
|
93
|
+
## CLI: `specrails-hub`
|
|
94
94
|
|
|
95
95
|
### Hub management
|
|
96
96
|
|
|
97
97
|
| Command | Description |
|
|
98
98
|
|---------|-------------|
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
99
|
+
| `specrails-hub hub start [--port N]` | Start the hub server (default port 4200) |
|
|
100
|
+
| `specrails-hub hub stop` | Stop the hub server |
|
|
101
|
+
| `specrails-hub hub status` | Show hub state and registered projects |
|
|
102
|
+
| `specrails-hub hub list` | List all registered projects |
|
|
103
|
+
| `specrails-hub hub add <path>` | Register a project |
|
|
104
|
+
| `specrails-hub hub remove <id>` | Unregister a project |
|
|
105
105
|
|
|
106
106
|
### Running commands
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
109
|
cd ~/repos/my-app
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
specrails-hub implement #42 # auto-detects project from CWD
|
|
111
|
+
specrails-hub product-backlog # routes to the correct project
|
|
112
|
+
specrails-hub "any raw prompt" # passes directly to claude
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
`
|
|
115
|
+
`specrails-hub` detects which project you're in by matching your current directory against registered projects. If the hub isn't running, it falls back to invoking `claude` directly.
|
|
116
116
|
|
|
117
117
|
### Options
|
|
118
118
|
|
package/cli/dist/srm.js
CHANGED
|
@@ -61,7 +61,7 @@ const red = (t) => ansi('31', t);
|
|
|
61
61
|
const bold = (t) => ansi('1', t);
|
|
62
62
|
const dimCyan = (t) => ansi('2;36', t);
|
|
63
63
|
function srmPrefix() {
|
|
64
|
-
return dim('[
|
|
64
|
+
return dim('[specrails-hub]');
|
|
65
65
|
}
|
|
66
66
|
function srmLog(msg) {
|
|
67
67
|
process.stdout.write(`${srmPrefix()} ${msg}\n`);
|
|
@@ -116,17 +116,17 @@ function parseArgs(argv) {
|
|
|
116
116
|
}
|
|
117
117
|
function printHelp() {
|
|
118
118
|
process.stdout.write(`
|
|
119
|
-
${bold('
|
|
119
|
+
${bold('specrails-hub')} — specrails CLI bridge
|
|
120
120
|
|
|
121
121
|
${bold('Usage:')}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
specrails-hub implement #42 Run a known specrails verb (prepends /sr:)
|
|
123
|
+
specrails-hub batch-implement #40 #41 Known verbs: ${[...KNOWN_VERBS].join(', ')}
|
|
124
|
+
specrails-hub "any raw prompt" Pass a raw prompt directly to claude
|
|
125
|
+
specrails-hub --status Print manager status and exit
|
|
126
|
+
specrails-hub --jobs Print recent job history and exit
|
|
127
|
+
specrails-hub hub <subcommand> Manage the hub (multi-project mode)
|
|
128
|
+
specrails-hub --port <n> Override default port (${DEFAULT_PORT})
|
|
129
|
+
specrails-hub --help Show this help text
|
|
130
130
|
|
|
131
131
|
${bold('Execution paths:')}
|
|
132
132
|
Manager running → POST /api/spawn + stream logs via WebSocket
|
|
@@ -219,7 +219,7 @@ function formatTokens(n) {
|
|
|
219
219
|
.replace(/,/g, ' ');
|
|
220
220
|
}
|
|
221
221
|
function printSummary(data) {
|
|
222
|
-
const doneLabel = isTTY ? bold('[
|
|
222
|
+
const doneLabel = isTTY ? bold('[specrails-hub] done') : '[specrails-hub] done';
|
|
223
223
|
const durationPart = `duration: ${formatDuration(data.durationMs)}`;
|
|
224
224
|
const costPart = data.costUsd != null ? ` cost: $${data.costUsd.toFixed(2)}` : '';
|
|
225
225
|
const tokenPart = data.totalTokens != null ? ` tokens: ${formatTokens(data.totalTokens)}` : '';
|
|
@@ -251,7 +251,7 @@ async function runViaWebManager(command, baseUrl) {
|
|
|
251
251
|
const project = await resolveProjectFromCwd(baseUrl);
|
|
252
252
|
if (!project) {
|
|
253
253
|
srmError('hub is running but no project registered for the current directory.\n' +
|
|
254
|
-
` Run:
|
|
254
|
+
` Run: specrails-hub hub add ${process.cwd()}`);
|
|
255
255
|
return 1;
|
|
256
256
|
}
|
|
257
257
|
spawnUrl = `${baseUrl}/api/projects/${project.id}/spawn`;
|
|
@@ -460,7 +460,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
460
460
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w1e(e,t){if(e){if(typeof e=="string")return bb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bb(e,t)}}function S1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function k1e(e){if(Array.isArray(e))return bb(e)}function bb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FA(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,RD(r.key),r)}}function E1e(e,t,n){return t&&FA(e.prototype,t),n&&FA(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function P1e(e,t,n){return t=dh(t),j1e(e,ID()?Reflect.construct(t,n||[],dh(e).constructor):t.apply(e,n))}function j1e(e,t){if(t&&(Gs(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return A1e(e)}function A1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ID(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ID=function(){return!!e})()}function dh(e){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},dh(e)}function _1e(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&&wb(e,t)}function wb(e,t){return wb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},wb(e,t)}function hr(e,t,n){return t=RD(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RD(e){var t=C1e(e,"string");return Gs(t)=="symbol"?t:t+""}function C1e(e,t){if(Gs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Jc=function(e){function t(){var n;O1e(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=P1e(this,t,[].concat(i)),hr(n,"state",{isAnimationFinished:!0,totalLength:0}),hr(n,"generateSimpleStrokeDasharray",function(a,s){return"".concat(s,"px ").concat(a-s,"px")}),hr(n,"getStrokeDasharray",function(a,s,l){var u=l.reduce(function(y,x){return y+x});if(!u)return n.generateSimpleStrokeDasharray(s,a);for(var f=Math.floor(a/u),c=a%u,d=s-a,p=[],m=0,g=0;m<l.length;g+=l[m],++m)if(g+l[m]>c){p=[].concat(Ra(l.slice(0,m)),[c-g]);break}var v=p.length%2===0?[0,d]:[d];return[].concat(Ra(t.repeat(l,f)),Ra(p),v).map(function(y){return"".concat(y,"px")}).join(", ")}),hr(n,"id",ba("recharts-line-")),hr(n,"pathRef",function(a){n.mainCurve=a}),hr(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),hr(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return _1e(t,e),E1e(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,a=o.points,s=o.xAxis,l=o.yAxis,u=o.layout,f=o.children,c=Mn(f,Xc);if(!c)return null;var d=function(g,v){return{x:g.x,y:g.y,value:g.value,errorVal:dt(g.payload,v)}},p={clipPath:r?"url(#clipPath-".concat(i,")"):null};return C.createElement(Oe,p,c.map(function(m){return C.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:a,xAxis:s,yAxis:l,layout:u,dataPointFormatter:d})}))}},{key:"renderDots",value:function(r,i,o){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var s=this.props,l=s.dot,u=s.points,f=s.dataKey,c=se(this.props,!1),d=se(l,!0),p=u.map(function(g,v){var y=On(On(On({key:"dot-".concat(v),r:3},c),d),{},{index:v,cx:g.x,cy:g.y,value:g.value,dataKey:f,payload:g.payload,points:u});return t.renderDotItem(l,y)}),m={clipPath:r?"url(#clipPath-".concat(i?"":"dots-").concat(o,")"):null};return C.createElement(Oe,wu({className:"recharts-line-dots",key:"dots"},m),p)}},{key:"renderCurveStatically",value:function(r,i,o,a){var s=this.props,l=s.type,u=s.layout,f=s.connectNulls;s.ref;var c=DA(s,y1e),d=On(On(On({},se(c,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(o,")"):null,points:r},a),{},{type:l,layout:u,connectNulls:f});return C.createElement(Vp,wu({},d,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,i){var o=this,a=this.props,s=a.points,l=a.strokeDasharray,u=a.isAnimationActive,f=a.animationBegin,c=a.animationDuration,d=a.animationEasing,p=a.animationId,m=a.animateNewValues,g=a.width,v=a.height,y=this.state,x=y.prevPoints,b=y.totalLength;return C.createElement(tr,{begin:f,duration:c,isActive:u,easing:d,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var S=O.t;if(x){var w=x.length/s.length,E=s.map(function(N,R){var F=Math.floor(R*w);if(x[F]){var I=x[F],D=An(I.x,N.x),L=An(I.y,N.y);return On(On({},N),{},{x:D(S),y:L(S)})}if(m){var M=An(g*2,N.x),z=An(v/2,N.y);return On(On({},N),{},{x:M(S),y:z(S)})}return On(On({},N),{},{x:N.x,y:N.y})});return o.renderCurveStatically(E,r,i)}var P=An(0,b),_=P(S),A;if(l){var $="".concat(l).split(/[,\s]+/gim).map(function(N){return parseFloat(N)});A=o.getStrokeDasharray(_,b,$)}else A=o.generateSimpleStrokeDasharray(b,_);return o.renderCurveStatically(s,r,i,{strokeDasharray:A})})}},{key:"renderCurve",value:function(r,i){var o=this.props,a=o.points,s=o.isAnimationActive,l=this.state,u=l.prevPoints,f=l.totalLength;return s&&a&&a.length&&(!u&&f>0||!Yc(u,a))?this.renderCurveWithAnimation(r,i):this.renderCurveStatically(a,r,i)}},{key:"render",value:function(){var r,i=this.props,o=i.hide,a=i.dot,s=i.points,l=i.className,u=i.xAxis,f=i.yAxis,c=i.top,d=i.left,p=i.width,m=i.height,g=i.isAnimationActive,v=i.id;if(o||!s||!s.length)return null;var y=this.state.isAnimationFinished,x=s.length===1,b=he("recharts-line",l),O=u&&u.allowDataOverflow,S=f&&f.allowDataOverflow,w=O||S,E=me(v)?this.id:v,P=(r=se(a,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},_=P.r,A=_===void 0?3:_,$=P.strokeWidth,N=$===void 0?2:$,R=fee(a)?a:{},F=R.clipDot,I=F===void 0?!0:F,D=A*2+N;return C.createElement(Oe,{className:b},O||S?C.createElement("defs",null,C.createElement("clipPath",{id:"clipPath-".concat(E)},C.createElement("rect",{x:O?d:d-p/2,y:S?c:c-m/2,width:O?p:p*2,height:S?m:m*2})),!I&&C.createElement("clipPath",{id:"clipPath-dots-".concat(E)},C.createElement("rect",{x:d-D/2,y:c-D/2,width:p+D,height:m+D}))):null,!x&&this.renderCurve(w,E),this.renderErrorBar(w,E),(x||a)&&this.renderDots(w,I,E),(!g||y)&&di.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:i.curPoints}:r.points!==i.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,i){for(var o=r.length%2!==0?[].concat(Ra(r),[0]):r,a=[],s=0;s<i;++s)a=[].concat(Ra(a),Ra(o));return a}},{key:"renderDotItem",value:function(r,i){var o;if(C.isValidElement(r))o=C.cloneElement(r,i);else if(ce(r))o=r(i);else{var a=i.key,s=DA(i,v1e),l=he("recharts-line-dot",typeof r!="boolean"?r.className:"");o=C.createElement(Vm,wu({key:a},s,{className:l}))}return o}}])}(k.PureComponent);hr(Jc,"displayName","Line");hr(Jc,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Ei.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});hr(Jc,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,a=e.dataKey,s=e.bandSize,l=e.displayedData,u=e.offset,f=t.layout,c=l.map(function(d,p){var m=dt(d,a);return f==="horizontal"?{x:dj({axis:n,ticks:i,bandSize:s,entry:d,index:p}),y:me(m)?null:r.scale(m),value:m,payload:d}:{x:me(m)?null:n.scale(m),y:dj({axis:r,ticks:o,bandSize:s,entry:d,index:p}),value:m,payload:d}});return On({points:c,layout:f},u)});function Ys(e){"@babel/helpers - typeof";return Ys=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},Ys(e)}function T1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N1e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,FD(r.key),r)}}function $1e(e,t,n){return t&&N1e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function M1e(e,t,n){return t=ph(t),I1e(e,DD()?Reflect.construct(t,n||[],ph(e).constructor):t.apply(e,n))}function I1e(e,t){if(t&&(Ys(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return R1e(e)}function R1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function DD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DD=function(){return!!e})()}function ph(e){return ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ph(e)}function D1e(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&&Sb(e,t)}function Sb(e,t){return Sb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Sb(e,t)}function LD(e,t,n){return t=FD(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FD(e){var t=L1e(e,"string");return Ys(t)=="symbol"?t:t+""}function L1e(e,t){if(Ys(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ys(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function kb(){return kb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kb.apply(this,arguments)}function F1e(e){var t=e.xAxisId,n=O1(),r=E1(),i=kD(t);return i==null?null:k.createElement(Al,kb({},i,{className:he("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(a){return si(a,!0)}}))}var Oo=function(e){function t(){return T1e(this,t),M1e(this,t,arguments)}return D1e(t,e),$1e(t,[{key:"render",value:function(){return k.createElement(F1e,this.props)}}])}(k.Component);LD(Oo,"displayName","XAxis");LD(Oo,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function Xs(e){"@babel/helpers - typeof";return Xs=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},Xs(e)}function z1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B1e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,WD(r.key),r)}}function W1e(e,t,n){return t&&B1e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function U1e(e,t,n){return t=hh(t),H1e(e,zD()?Reflect.construct(t,n||[],hh(e).constructor):t.apply(e,n))}function H1e(e,t){if(t&&(Xs(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return V1e(e)}function V1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zD=function(){return!!e})()}function hh(e){return hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},hh(e)}function K1e(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&&Ob(e,t)}function Ob(e,t){return Ob=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Ob(e,t)}function BD(e,t,n){return t=WD(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WD(e){var t=q1e(e,"string");return Xs(t)=="symbol"?t:t+""}function q1e(e,t){if(Xs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Xs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Eb(){return Eb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Eb.apply(this,arguments)}var G1e=function(t){var n=t.yAxisId,r=O1(),i=E1(),o=OD(n);return o==null?null:k.createElement(Al,Eb({},o,{className:he("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:r,height:i},ticksGenerator:function(s){return si(s,!0)}}))},Eo=function(e){function t(){return z1e(this,t),U1e(this,t,arguments)}return K1e(t,e),W1e(t,[{key:"render",value:function(){return k.createElement(G1e,this.props)}}])}(k.Component);BD(Eo,"displayName","YAxis");BD(Eo,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function zA(e){return J1e(e)||Q1e(e)||X1e(e)||Y1e()}function Y1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
461
461
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X1e(e,t){if(e){if(typeof e=="string")return Pb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pb(e,t)}}function Q1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function J1e(e){if(Array.isArray(e))return Pb(e)}function Pb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var jb=function(t,n,r,i,o){var a=Mn(t,j1),s=Mn(t,eg),l=[].concat(zA(a),zA(s)),u=Mn(t,ng),f="".concat(i,"Id"),c=i[0],d=n;if(l.length&&(d=l.reduce(function(g,v){if(v.props[f]===r&&Hr(v.props,"extendDomain")&&X(v.props[c])){var y=v.props[c];return[Math.min(g[0],y),Math.max(g[1],y)]}return g},d)),u.length){var p="".concat(c,"1"),m="".concat(c,"2");d=u.reduce(function(g,v){if(v.props[f]===r&&Hr(v.props,"extendDomain")&&X(v.props[p])&&X(v.props[m])){var y=v.props[p],x=v.props[m];return[Math.min(g[0],y,x),Math.max(g[1],y,x)]}return g},d)}return o&&o.length&&(d=o.reduce(function(g,v){return X(v)?[Math.min(g[0],v),Math.max(g[1],v)]:g},d)),d},UD={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,u,f){this.fn=l,this.context=u,this.once=f||!1}function o(l,u,f,c,d){if(typeof f!="function")throw new TypeError("The listener must be a function");var p=new i(f,c||l,d),m=n?n+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],p]:l._events[m].push(p):(l._events[m]=p,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new r:delete l._events[u]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],f,c;if(this._eventsCount===0)return u;for(c in f=this._events)t.call(f,c)&&u.push(n?c.slice(1):c);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},s.prototype.listeners=function(u){var f=n?n+u:u,c=this._events[f];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,p=c.length,m=new Array(p);d<p;d++)m[d]=c[d].fn;return m},s.prototype.listenerCount=function(u){var f=n?n+u:u,c=this._events[f];return c?c.fn?1:c.length:0},s.prototype.emit=function(u,f,c,d,p,m){var g=n?n+u:u;if(!this._events[g])return!1;var v=this._events[g],y=arguments.length,x,b;if(v.fn){switch(v.once&&this.removeListener(u,v.fn,void 0,!0),y){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,f),!0;case 3:return v.fn.call(v.context,f,c),!0;case 4:return v.fn.call(v.context,f,c,d),!0;case 5:return v.fn.call(v.context,f,c,d,p),!0;case 6:return v.fn.call(v.context,f,c,d,p,m),!0}for(b=1,x=new Array(y-1);b<y;b++)x[b-1]=arguments[b];v.fn.apply(v.context,x)}else{var O=v.length,S;for(b=0;b<O;b++)switch(v[b].once&&this.removeListener(u,v[b].fn,void 0,!0),y){case 1:v[b].fn.call(v[b].context);break;case 2:v[b].fn.call(v[b].context,f);break;case 3:v[b].fn.call(v[b].context,f,c);break;case 4:v[b].fn.call(v[b].context,f,c,d);break;default:if(!x)for(S=1,x=new Array(y-1);S<y;S++)x[S-1]=arguments[S];v[b].fn.apply(v[b].context,x)}}return!0},s.prototype.on=function(u,f,c){return o(this,u,f,c,!1)},s.prototype.once=function(u,f,c){return o(this,u,f,c,!0)},s.prototype.removeListener=function(u,f,c,d){var p=n?n+u:u;if(!this._events[p])return this;if(!f)return a(this,p),this;var m=this._events[p];if(m.fn)m.fn===f&&(!d||m.once)&&(!c||m.context===c)&&a(this,p);else{for(var g=0,v=[],y=m.length;g<y;g++)(m[g].fn!==f||d&&!m[g].once||c&&m[g].context!==c)&&v.push(m[g]);v.length?this._events[p]=v.length===1?v[0]:v:a(this,p)}return this},s.prototype.removeAllListeners=function(u){var f;return u?(f=n?n+u:u,this._events[f]&&a(this,f)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})(UD);var Z1e=UD.exports;const eSe=Ce(Z1e);var My=new eSe,Iy="recharts.syncMouseEvents";function Ec(e){"@babel/helpers - typeof";return Ec=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},Ec(e)}function tSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nSe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,HD(r.key),r)}}function rSe(e,t,n){return t&&nSe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ry(e,t,n){return t=HD(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HD(e){var t=iSe(e,"string");return Ec(t)=="symbol"?t:t+""}function iSe(e,t){if(Ec(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ec(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var oSe=function(){function e(){tSe(this,e),Ry(this,"activeIndex",0),Ry(this,"coordinateList",[]),Ry(this,"layout","horizontal")}return rSe(e,[{key:"setDetails",value:function(n){var r,i=n.coordinateList,o=i===void 0?null:i,a=n.container,s=a===void 0?null:a,l=n.layout,u=l===void 0?null:l,f=n.offset,c=f===void 0?null:f,d=n.mouseHandlerCallback,p=d===void 0?null:d;this.coordinateList=(r=o??this.coordinateList)!==null&&r!==void 0?r:[],this.container=s??this.container,this.layout=u??this.layout,this.offset=c??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),o=i.x,a=i.y,s=i.height,l=this.coordinateList[this.activeIndex].coordinate,u=((n=window)===null||n===void 0?void 0:n.scrollX)||0,f=((r=window)===null||r===void 0?void 0:r.scrollY)||0,c=o+l+u,d=a+this.offset.top+s/2+f;this.mouseHandlerCallback({pageX:c,pageY:d})}}}])}();function aSe(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e==null?void 0:e[0],i=e==null?void 0:e[1];if(r&&i&&X(r)&&X(i))return!0}return!1}function sSe(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function VD(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,o=e.endAngle,a=qe(t,n,r,i),s=qe(t,n,r,o);return{points:[a,s],cx:t,cy:n,radius:r,startAngle:i,endAngle:o}}function lSe(e,t,n){var r,i,o,a;if(e==="horizontal")r=t.x,o=r,i=n.top,a=n.top+n.height;else if(e==="vertical")i=t.y,a=i,r=n.left,o=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var s=t.cx,l=t.cy,u=t.innerRadius,f=t.outerRadius,c=t.angle,d=qe(s,l,u,c),p=qe(s,l,f,c);r=d.x,i=d.y,o=p.x,a=p.y}else return VD(t);return[{x:r,y:i},{x:o,y:a}]}function Pc(e){"@babel/helpers - typeof";return Pc=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},Pc(e)}function BA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Xf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?BA(Object(n),!0).forEach(function(r){uSe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BA(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function uSe(e,t,n){return t=cSe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cSe(e){var t=fSe(e,"string");return Pc(t)=="symbol"?t:t+""}function fSe(e,t){if(Pc(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pc(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dSe(e){var t,n,r=e.element,i=e.tooltipEventType,o=e.isActive,a=e.activeCoordinate,s=e.activePayload,l=e.offset,u=e.activeTooltipIndex,f=e.tooltipAxisBandSize,c=e.layout,d=e.chartName,p=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!p||!o||!a||d!=="ScatterChart"&&i!=="axis")return null;var m,g=Vp;if(d==="ScatterChart")m=a,g=$ve;else if(d==="BarChart")m=sSe(c,a,l,f),g=Hm;else if(c==="radial"){var v=VD(a),y=v.cx,x=v.cy,b=v.radius,O=v.startAngle,S=v.endAngle;m={cx:y,cy:x,startAngle:O,endAngle:S,innerRadius:b,outerRadius:b},g=FR}else m={points:lSe(c,a,l)},g=Vp;var w=Xf(Xf(Xf(Xf({stroke:"#ccc",pointerEvents:"none"},l),m),se(p,!1)),{},{payload:s,payloadIndex:u,className:he("recharts-tooltip-cursor",p.className)});return k.isValidElement(p)?k.cloneElement(p,w):k.createElement(g,w)}var pSe=["item"],hSe=["children","className","width","height","style","compact","title","desc"];function Qs(e){"@babel/helpers - typeof";return Qs=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},Qs(e)}function ts(){return ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ts.apply(this,arguments)}function WA(e,t){return ySe(e)||gSe(e,t)||qD(e,t)||mSe()}function mSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
462
462
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gSe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){u=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function ySe(e){if(Array.isArray(e))return e}function UA(e,t){if(e==null)return{};var n=vSe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function vSe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function xSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bSe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,GD(r.key),r)}}function wSe(e,t,n){return t&&bSe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function SSe(e,t,n){return t=mh(t),kSe(e,KD()?Reflect.construct(t,n||[],mh(e).constructor):t.apply(e,n))}function kSe(e,t){if(t&&(Qs(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OSe(e)}function OSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function KD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KD=function(){return!!e})()}function mh(e){return mh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},mh(e)}function ESe(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&&Ab(e,t)}function Ab(e,t){return Ab=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Ab(e,t)}function Js(e){return ASe(e)||jSe(e)||qD(e)||PSe()}function PSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
463
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qD(e,t){if(e){if(typeof e=="string")return _b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _b(e,t)}}function jSe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ASe(e){if(Array.isArray(e))return _b(e)}function _b(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function HA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HA(Object(n),!0).forEach(function(r){fe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HA(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fe(e,t,n){return t=GD(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GD(e){var t=_Se(e,"string");return Qs(t)=="symbol"?t:t+""}function _Se(e,t){if(Qs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var CSe={xAxis:["bottom","top"],yAxis:["left","right"]},TSe={width:"100%",height:"100%"},YD={x:0,y:0};function Qf(e){return e}var NSe=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},$Se=function(t,n,r,i){var o=n.find(function(f){return f&&f.index===r});if(o){if(t==="horizontal")return{x:o.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:o.coordinate};if(t==="centric"){var a=o.coordinate,s=i.radius;return B(B(B({},i),qe(i.cx,i.cy,s,a)),{},{angle:a,radius:s})}var l=o.coordinate,u=i.angle;return B(B(B({},i),qe(i.cx,i.cy,l,u)),{},{angle:u,radius:l})}return YD},rg=function(t,n){var r=n.graphicalItems,i=n.dataStartIndex,o=n.dataEndIndex,a=(r??[]).reduce(function(s,l){var u=l.props.data;return u&&u.length?[].concat(Js(s),Js(u)):s},[]);return a.length>0?a:t&&t.length&&X(i)&&X(o)?t.slice(i,o+1):[]};function XD(e){return e==="number"?[0,"auto"]:void 0}var Cb=function(t,n,r,i){var o=t.graphicalItems,a=t.tooltipAxis,s=rg(n,t);return r<0||!o||!o.length||r>=s.length?null:o.reduce(function(l,u){var f,c=(f=u.props.data)!==null&&f!==void 0?f:n;c&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(c=c.slice(t.dataStartIndex,t.dataEndIndex+1));var d;if(a.dataKey&&!a.allowDuplicatedCategory){var p=c===void 0?s:c;d=dp(p,a.dataKey,i)}else d=c&&c[r]||s[r];return d?[].concat(Js(l),[NR(u,d)]):l},[])},VA=function(t,n,r,i){var o=i||{x:t.chartX,y:t.chartY},a=NSe(o,r),s=t.orderedTooltipTicks,l=t.tooltipAxis,u=t.tooltipTicks,f=tme(a,s,u,l);if(f>=0&&u){var c=u[f]&&u[f].value,d=Cb(t,n,f,c),p=$Se(r,s,f,o);return{activeTooltipIndex:f,activeLabel:c,activePayload:d,activeCoordinate:p}}return null},MSe=function(t,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,a=n.axisIdKey,s=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,f=t.layout,c=t.children,d=t.stackOffset,p=PR(f,o);return r.reduce(function(m,g){var v,y=g.type.defaultProps!==void 0?B(B({},g.type.defaultProps),g.props):g.props,x=y.type,b=y.dataKey,O=y.allowDataOverflow,S=y.allowDuplicatedCategory,w=y.scale,E=y.ticks,P=y.includeHidden,_=y[a];if(m[_])return m;var A=rg(t.data,{graphicalItems:i.filter(function(U){var T,Y=a in U.props?U.props[a]:(T=U.type.defaultProps)===null||T===void 0?void 0:T[a];return Y===_}),dataStartIndex:l,dataEndIndex:u}),$=A.length,N,R,F;aSe(y.domain,O,x)&&(N=Hx(y.domain,null,O),p&&(x==="number"||w!=="auto")&&(F=yu(A,b,"category")));var I=XD(x);if(!N||N.length===0){var D,L=(D=y.domain)!==null&&D!==void 0?D:I;if(b){if(N=yu(A,b,x),x==="category"&&p){var M=nee(N);S&&M?(R=N,N=nh(0,$)):S||(N=gj(L,N,g).reduce(function(U,T){return U.indexOf(T)>=0?U:[].concat(Js(U),[T])},[]))}else if(x==="category")S?N=N.filter(function(U){return U!==""&&!me(U)}):N=gj(L,N,g).reduce(function(U,T){return U.indexOf(T)>=0||T===""||me(T)?U:[].concat(Js(U),[T])},[]);else if(x==="number"){var z=ame(A,i.filter(function(U){var T,Y,J=a in U.props?U.props[a]:(T=U.type.defaultProps)===null||T===void 0?void 0:T[a],Z="hide"in U.props?U.props.hide:(Y=U.type.defaultProps)===null||Y===void 0?void 0:Y.hide;return J===_&&(P||!Z)}),b,o,f);z&&(N=z)}p&&(x==="number"||w!=="auto")&&(F=yu(A,b,"category"))}else p?N=nh(0,$):s&&s[_]&&s[_].hasStack&&x==="number"?N=d==="expand"?[0,1]:TR(s[_].stackGroups,l,u):N=ER(A,i.filter(function(U){var T=a in U.props?U.props[a]:U.type.defaultProps[a],Y="hide"in U.props?U.props.hide:U.type.defaultProps.hide;return T===_&&(P||!Y)}),x,f,!0);if(x==="number")N=jb(c,N,_,o,E),L&&(N=Hx(L,N,O));else if(x==="category"&&L){var j=L,W=N.every(function(U){return j.indexOf(U)>=0});W&&(N=j)}}return B(B({},m),{},fe({},_,B(B({},y),{},{axisType:o,domain:N,categoricalDomain:F,duplicateDomain:R,originalDomain:(v=y.domain)!==null&&v!==void 0?v:I,isCategorical:p,layout:f})))},{})},ISe=function(t,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,a=n.axisIdKey,s=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,f=t.layout,c=t.children,d=rg(t.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:u}),p=d.length,m=PR(f,o),g=-1;return r.reduce(function(v,y){var x=y.type.defaultProps!==void 0?B(B({},y.type.defaultProps),y.props):y.props,b=x[a],O=XD("number");if(!v[b]){g++;var S;return m?S=nh(0,p):s&&s[b]&&s[b].hasStack?(S=TR(s[b].stackGroups,l,u),S=jb(c,S,b,o)):(S=Hx(O,ER(d,r.filter(function(w){var E,P,_=a in w.props?w.props[a]:(E=w.type.defaultProps)===null||E===void 0?void 0:E[a],A="hide"in w.props?w.props.hide:(P=w.type.defaultProps)===null||P===void 0?void 0:P.hide;return _===b&&!A}),"number",f),i.defaultProps.allowDataOverflow),S=jb(c,S,b,o)),B(B({},v),{},fe({},b,B(B({axisType:o},i.defaultProps),{},{hide:!0,orientation:vn(CSe,"".concat(o,".").concat(g%2),null),domain:S,originalDomain:O,isCategorical:m,layout:f})))}return v},{})},RSe=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,a=n.graphicalItems,s=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,f=t.children,c="".concat(i,"Id"),d=Mn(f,o),p={};return d&&d.length?p=MSe(t,{axes:d,graphicalItems:a,axisType:i,axisIdKey:c,stackGroups:s,dataStartIndex:l,dataEndIndex:u}):a&&a.length&&(p=ISe(t,{Axis:o,graphicalItems:a,axisType:i,axisIdKey:c,stackGroups:s,dataStartIndex:l,dataEndIndex:u})),p},DSe=function(t){var n=Xi(t),r=si(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Kw(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Wp(n,r)}},KA=function(t){var n=t.children,r=t.defaultShowTooltip,i=Ut(n,Ws),o=0,a=0;return t.data&&t.data.length!==0&&(a=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(a=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!r}},LSe=function(t){return!t||!t.length?!1:t.some(function(n){var r=ui(n&&n.type);return r&&r.indexOf("Bar")>=0})},qA=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},FSe=function(t,n){var r=t.props,i=t.graphicalItems,o=t.xAxisMap,a=o===void 0?{}:o,s=t.yAxisMap,l=s===void 0?{}:s,u=r.width,f=r.height,c=r.children,d=r.margin||{},p=Ut(c,Ws),m=Ut(c,ci),g=Object.keys(l).reduce(function(S,w){var E=l[w],P=E.orientation;return!E.mirror&&!E.hide?B(B({},S),{},fe({},P,S[P]+E.width)):S},{left:d.left||0,right:d.right||0}),v=Object.keys(a).reduce(function(S,w){var E=a[w],P=E.orientation;return!E.mirror&&!E.hide?B(B({},S),{},fe({},P,vn(S,"".concat(P))+E.height)):S},{top:d.top||0,bottom:d.bottom||0}),y=B(B({},v),g),x=y.bottom;p&&(y.bottom+=p.props.height||Ws.defaultProps.height),m&&n&&(y=ime(y,i,r,n));var b=u-y.left-y.right,O=f-y.top-y.bottom;return B(B({brushBottom:x},y),{},{width:Math.max(b,0),height:Math.max(O,0)})},zSe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},C1=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,a=t.validateTooltipEventTypes,s=a===void 0?["axis"]:a,l=t.axisComponents,u=t.legendContent,f=t.formatAxisMap,c=t.defaultProps,d=function(y,x){var b=x.graphicalItems,O=x.stackGroups,S=x.offset,w=x.updateId,E=x.dataStartIndex,P=x.dataEndIndex,_=y.barSize,A=y.layout,$=y.barGap,N=y.barCategoryGap,R=y.maxBarSize,F=qA(A),I=F.numericAxisName,D=F.cateAxisName,L=LSe(b),M=[];return b.forEach(function(z,j){var W=rg(y.data,{graphicalItems:[z],dataStartIndex:E,dataEndIndex:P}),U=z.type.defaultProps!==void 0?B(B({},z.type.defaultProps),z.props):z.props,T=U.dataKey,Y=U.maxBarSize,J=U["".concat(I,"Id")],Z=U["".concat(D,"Id")],Ae={},ae=l.reduce(function(or,ot){var Fn=x["".concat(ot.axisType,"Map")],Oa=U["".concat(ot.axisType,"Id")];Fn&&Fn[Oa]||ot.axisType==="zAxis"||da();var Ea=Fn[Oa];return B(B({},or),{},fe(fe({},ot.axisType,Ea),"".concat(ot.axisType,"Ticks"),si(Ea)))},Ae),K=ae[D],ie=ae["".concat(D,"Ticks")],oe=O&&O[J]&&O[J].hasStack&&mme(z,O[J].stackGroups),V=ui(z.type).indexOf("Bar")>=0,ke=Wp(K,ie),de=[],ze=L&&nme({barSize:_,stackGroups:O,totalSize:zSe(ae,D)});if(V){var De,Ge,Yt=me(Y)?R:Y,et=(De=(Ge=Wp(K,ie,!0))!==null&&Ge!==void 0?Ge:Yt)!==null&&De!==void 0?De:0;de=rme({barGap:$,barCategoryGap:N,bandSize:et!==ke?et:ke,sizeList:ze[Z],maxBarSize:Yt}),et!==ke&&(de=de.map(function(or){return B(B({},or),{},{position:B(B({},or.position),{},{offset:or.position.offset-et/2})})}))}var Qr=z&&z.type&&z.type.getComposedData;Qr&&M.push({props:B(B({},Qr(B(B({},ae),{},{displayedData:W,props:y,dataKey:T,item:z,bandSize:ke,barPosition:de,offset:S,stackedData:oe,layout:A,dataStartIndex:E,dataEndIndex:P}))),{},fe(fe(fe({key:z.key||"item-".concat(j)},I,ae[I]),D,ae[D]),"animationId",w)),childIndex:mee(z,y.children),item:z})}),M},p=function(y,x){var b=y.props,O=y.dataStartIndex,S=y.dataEndIndex,w=y.updateId;if(!ox({props:b}))return null;var E=b.children,P=b.layout,_=b.stackOffset,A=b.data,$=b.reverseStackOrder,N=qA(P),R=N.numericAxisName,F=N.cateAxisName,I=Mn(E,r),D=pme(A,I,"".concat(R,"Id"),"".concat(F,"Id"),_,$),L=l.reduce(function(U,T){var Y="".concat(T.axisType,"Map");return B(B({},U),{},fe({},Y,RSe(b,B(B({},T),{},{graphicalItems:I,stackGroups:T.axisType===R&&D,dataStartIndex:O,dataEndIndex:S}))))},{}),M=FSe(B(B({},L),{},{props:b,graphicalItems:I}),x==null?void 0:x.legendBBox);Object.keys(L).forEach(function(U){L[U]=f(b,L[U],M,U.replace("Map",""),n)});var z=L["".concat(F,"Map")],j=DSe(z),W=d(b,B(B({},L),{},{dataStartIndex:O,dataEndIndex:S,updateId:w,graphicalItems:I,stackGroups:D,offset:M}));return B(B({formattedGraphicalItems:W,graphicalItems:I,offset:M,stackGroups:D},j),L)},m=function(v){function y(x){var b,O,S;return xSe(this,y),S=SSe(this,y,[x]),fe(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),fe(S,"accessibilityManager",new oSe),fe(S,"handleLegendBBoxUpdate",function(w){if(w){var E=S.state,P=E.dataStartIndex,_=E.dataEndIndex,A=E.updateId;S.setState(B({legendBBox:w},p({props:S.props,dataStartIndex:P,dataEndIndex:_,updateId:A},B(B({},S.state),{},{legendBBox:w}))))}}),fe(S,"handleReceiveSyncEvent",function(w,E,P){if(S.props.syncId===w){if(P===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(E)}}),fe(S,"handleBrushChange",function(w){var E=w.startIndex,P=w.endIndex;if(E!==S.state.dataStartIndex||P!==S.state.dataEndIndex){var _=S.state.updateId;S.setState(function(){return B({dataStartIndex:E,dataEndIndex:P},p({props:S.props,dataStartIndex:E,dataEndIndex:P,updateId:_},S.state))}),S.triggerSyncEvent({dataStartIndex:E,dataEndIndex:P})}}),fe(S,"handleMouseEnter",function(w){var E=S.getMouseInfo(w);if(E){var P=B(B({},E),{},{isTooltipActive:!0});S.setState(P),S.triggerSyncEvent(P);var _=S.props.onMouseEnter;ce(_)&&_(P,w)}}),fe(S,"triggeredAfterMouseMove",function(w){var E=S.getMouseInfo(w),P=E?B(B({},E),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(P),S.triggerSyncEvent(P);var _=S.props.onMouseMove;ce(_)&&_(P,w)}),fe(S,"handleItemMouseEnter",function(w){S.setState(function(){return{isTooltipActive:!0,activeItem:w,activePayload:w.tooltipPayload,activeCoordinate:w.tooltipPosition||{x:w.cx,y:w.cy}}})}),fe(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),fe(S,"handleMouseMove",function(w){w.persist(),S.throttleTriggeredAfterMouseMove(w)}),fe(S,"handleMouseLeave",function(w){S.throttleTriggeredAfterMouseMove.cancel();var E={isTooltipActive:!1};S.setState(E),S.triggerSyncEvent(E);var P=S.props.onMouseLeave;ce(P)&&P(E,w)}),fe(S,"handleOuterEvent",function(w){var E=hee(w),P=vn(S.props,"".concat(E));if(E&&ce(P)){var _,A;/.*touch.*/i.test(E)?A=S.getMouseInfo(w.changedTouches[0]):A=S.getMouseInfo(w),P((_=A)!==null&&_!==void 0?_:{},w)}}),fe(S,"handleClick",function(w){var E=S.getMouseInfo(w);if(E){var P=B(B({},E),{},{isTooltipActive:!0});S.setState(P),S.triggerSyncEvent(P);var _=S.props.onClick;ce(_)&&_(P,w)}}),fe(S,"handleMouseDown",function(w){var E=S.props.onMouseDown;if(ce(E)){var P=S.getMouseInfo(w);E(P,w)}}),fe(S,"handleMouseUp",function(w){var E=S.props.onMouseUp;if(ce(E)){var P=S.getMouseInfo(w);E(P,w)}}),fe(S,"handleTouchMove",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(w.changedTouches[0])}),fe(S,"handleTouchStart",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&S.handleMouseDown(w.changedTouches[0])}),fe(S,"handleTouchEnd",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&S.handleMouseUp(w.changedTouches[0])}),fe(S,"handleDoubleClick",function(w){var E=S.props.onDoubleClick;if(ce(E)){var P=S.getMouseInfo(w);E(P,w)}}),fe(S,"handleContextMenu",function(w){var E=S.props.onContextMenu;if(ce(E)){var P=S.getMouseInfo(w);E(P,w)}}),fe(S,"triggerSyncEvent",function(w){S.props.syncId!==void 0&&My.emit(Iy,S.props.syncId,w,S.eventEmitterSymbol)}),fe(S,"applySyncEvent",function(w){var E=S.props,P=E.layout,_=E.syncMethod,A=S.state.updateId,$=w.dataStartIndex,N=w.dataEndIndex;if(w.dataStartIndex!==void 0||w.dataEndIndex!==void 0)S.setState(B({dataStartIndex:$,dataEndIndex:N},p({props:S.props,dataStartIndex:$,dataEndIndex:N,updateId:A},S.state)));else if(w.activeTooltipIndex!==void 0){var R=w.chartX,F=w.chartY,I=w.activeTooltipIndex,D=S.state,L=D.offset,M=D.tooltipTicks;if(!L)return;if(typeof _=="function")I=_(M,w);else if(_==="value"){I=-1;for(var z=0;z<M.length;z++)if(M[z].value===w.activeLabel){I=z;break}}var j=B(B({},L),{},{x:L.left,y:L.top}),W=Math.min(R,j.x+j.width),U=Math.min(F,j.y+j.height),T=M[I]&&M[I].value,Y=Cb(S.state,S.props.data,I),J=M[I]?{x:P==="horizontal"?M[I].coordinate:W,y:P==="horizontal"?U:M[I].coordinate}:YD;S.setState(B(B({},w),{},{activeLabel:T,activeCoordinate:J,activePayload:Y,activeTooltipIndex:I}))}else S.setState(w)}),fe(S,"renderCursor",function(w){var E,P=S.state,_=P.isTooltipActive,A=P.activeCoordinate,$=P.activePayload,N=P.offset,R=P.activeTooltipIndex,F=P.tooltipAxisBandSize,I=S.getTooltipEventType(),D=(E=w.props.active)!==null&&E!==void 0?E:_,L=S.props.layout,M=w.key||"_recharts-cursor";return C.createElement(dSe,{key:M,activeCoordinate:A,activePayload:$,activeTooltipIndex:R,chartName:n,element:w,isActive:D,layout:L,offset:N,tooltipAxisBandSize:F,tooltipEventType:I})}),fe(S,"renderPolarAxis",function(w,E,P){var _=vn(w,"type.axisType"),A=vn(S.state,"".concat(_,"Map")),$=w.type.defaultProps,N=$!==void 0?B(B({},$),w.props):w.props,R=A&&A[N["".concat(_,"Id")]];return k.cloneElement(w,B(B({},R),{},{className:he(_,R.className),key:w.key||"".concat(E,"-").concat(P),ticks:si(R,!0)}))}),fe(S,"renderPolarGrid",function(w){var E=w.props,P=E.radialLines,_=E.polarAngles,A=E.polarRadius,$=S.state,N=$.radiusAxisMap,R=$.angleAxisMap,F=Xi(N),I=Xi(R),D=I.cx,L=I.cy,M=I.innerRadius,z=I.outerRadius;return k.cloneElement(w,{polarAngles:Array.isArray(_)?_:si(I,!0).map(function(j){return j.coordinate}),polarRadius:Array.isArray(A)?A:si(F,!0).map(function(j){return j.coordinate}),cx:D,cy:L,innerRadius:M,outerRadius:z,key:w.key||"polar-grid",radialLines:P})}),fe(S,"renderLegend",function(){var w=S.state.formattedGraphicalItems,E=S.props,P=E.children,_=E.width,A=E.height,$=S.props.margin||{},N=_-($.left||0)-($.right||0),R=kR({children:P,formattedGraphicalItems:w,legendWidth:N,legendContent:u});if(!R)return null;var F=R.item,I=UA(R,pSe);return k.cloneElement(F,B(B({},I),{},{chartWidth:_,chartHeight:A,margin:$,onBBoxUpdate:S.handleLegendBBoxUpdate}))}),fe(S,"renderTooltip",function(){var w,E=S.props,P=E.children,_=E.accessibilityLayer,A=Ut(P,jt);if(!A)return null;var $=S.state,N=$.isTooltipActive,R=$.activeCoordinate,F=$.activePayload,I=$.activeLabel,D=$.offset,L=(w=A.props.active)!==null&&w!==void 0?w:N;return k.cloneElement(A,{viewBox:B(B({},D),{},{x:D.left,y:D.top}),active:L,label:I,payload:L?F:[],coordinate:R,accessibilityLayer:_})}),fe(S,"renderBrush",function(w){var E=S.props,P=E.margin,_=E.data,A=S.state,$=A.offset,N=A.dataStartIndex,R=A.dataEndIndex,F=A.updateId;return k.cloneElement(w,{key:w.key||"_recharts-brush",onChange:Kf(S.handleBrushChange,w.props.onChange),data:_,x:X(w.props.x)?w.props.x:$.left,y:X(w.props.y)?w.props.y:$.top+$.height+$.brushBottom-(P.bottom||0),width:X(w.props.width)?w.props.width:$.width,startIndex:N,endIndex:R,updateId:"brush-".concat(F)})}),fe(S,"renderReferenceElement",function(w,E,P){if(!w)return null;var _=S,A=_.clipPathId,$=S.state,N=$.xAxisMap,R=$.yAxisMap,F=$.offset,I=w.type.defaultProps||{},D=w.props,L=D.xAxisId,M=L===void 0?I.xAxisId:L,z=D.yAxisId,j=z===void 0?I.yAxisId:z;return k.cloneElement(w,{key:w.key||"".concat(E,"-").concat(P),xAxis:N[M],yAxis:R[j],viewBox:{x:F.left,y:F.top,width:F.width,height:F.height},clipPathId:A})}),fe(S,"renderActivePoints",function(w){var E=w.item,P=w.activePoint,_=w.basePoint,A=w.childIndex,$=w.isRange,N=[],R=E.props.key,F=E.item.type.defaultProps!==void 0?B(B({},E.item.type.defaultProps),E.item.props):E.item.props,I=F.activeDot,D=F.dataKey,L=B(B({index:A,dataKey:D,cx:P.x,cy:P.y,r:4,fill:v1(E.item),strokeWidth:2,stroke:"#fff",payload:P.payload,value:P.value},se(I,!1)),pp(I));return N.push(y.renderActiveDot(I,L,"".concat(R,"-activePoint-").concat(A))),_?N.push(y.renderActiveDot(I,B(B({},L),{},{cx:_.x,cy:_.y}),"".concat(R,"-basePoint-").concat(A))):$&&N.push(null),N}),fe(S,"renderGraphicChild",function(w,E,P){var _=S.filterFormatItem(w,E,P);if(!_)return null;var A=S.getTooltipEventType(),$=S.state,N=$.isTooltipActive,R=$.tooltipAxis,F=$.activeTooltipIndex,I=$.activeLabel,D=S.props.children,L=Ut(D,jt),M=_.props,z=M.points,j=M.isRange,W=M.baseLine,U=_.item.type.defaultProps!==void 0?B(B({},_.item.type.defaultProps),_.item.props):_.item.props,T=U.activeDot,Y=U.hide,J=U.activeBar,Z=U.activeShape,Ae=!!(!Y&&N&&L&&(T||J||Z)),ae={};A!=="axis"&&L&&L.props.trigger==="click"?ae={onClick:Kf(S.handleItemMouseEnter,w.props.onClick)}:A!=="axis"&&(ae={onMouseLeave:Kf(S.handleItemMouseLeave,w.props.onMouseLeave),onMouseEnter:Kf(S.handleItemMouseEnter,w.props.onMouseEnter)});var K=k.cloneElement(w,B(B({},_.props),ae));function ie(ot){return typeof R.dataKey=="function"?R.dataKey(ot.payload):null}if(Ae)if(F>=0){var oe,V;if(R.dataKey&&!R.allowDuplicatedCategory){var ke=typeof R.dataKey=="function"?ie:"payload.".concat(R.dataKey.toString());oe=dp(z,ke,I),V=j&&W&&dp(W,ke,I)}else oe=z==null?void 0:z[F],V=j&&W&&W[F];if(Z||J){var de=w.props.activeIndex!==void 0?w.props.activeIndex:F;return[k.cloneElement(w,B(B(B({},_.props),ae),{},{activeIndex:de})),null,null]}if(!me(oe))return[K].concat(Js(S.renderActivePoints({item:_,activePoint:oe,basePoint:V,childIndex:F,isRange:j})))}else{var ze,De=(ze=S.getItemByXY(S.state.activeCoordinate))!==null&&ze!==void 0?ze:{graphicalItem:K},Ge=De.graphicalItem,Yt=Ge.item,et=Yt===void 0?w:Yt,Qr=Ge.childIndex,or=B(B(B({},_.props),ae),{},{activeIndex:Qr});return[k.cloneElement(et,or),null,null]}return j?[K,null,null]:[K,null]}),fe(S,"renderCustomized",function(w,E,P){return k.cloneElement(w,B(B({key:"recharts-customized-".concat(P)},S.props),S.state))}),fe(S,"renderMap",{CartesianGrid:{handler:Qf,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:Qf},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:Qf},YAxis:{handler:Qf},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((b=x.id)!==null&&b!==void 0?b:ba("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=kI(S.triggeredAfterMouseMove,(O=x.throttleDelay)!==null&&O!==void 0?O:1e3/60),S.state={},S}return ESe(y,v),wSe(y,[{key:"componentDidMount",value:function(){var b,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var b=this.props,O=b.children,S=b.data,w=b.height,E=b.layout,P=Ut(O,jt);if(P){var _=P.props.defaultIndex;if(!(typeof _!="number"||_<0||_>this.state.tooltipTicks.length-1)){var A=this.state.tooltipTicks[_]&&this.state.tooltipTicks[_].value,$=Cb(this.state,S,_,A),N=this.state.tooltipTicks[_].coordinate,R=(this.state.offset.top+w)/2,F=E==="horizontal",I=F?{x:N,y:R}:{y:N,x:R},D=this.state.formattedGraphicalItems.find(function(M){var z=M.item;return z.type.name==="Scatter"});D&&(I=B(B({},I),D.props.points[_].tooltipPosition),$=D.props.points[_].tooltipPayload);var L={activeTooltipIndex:_,isTooltipActive:!0,activeLabel:A,activePayload:$,activeCoordinate:I};this.setState(L),this.renderCursor(P),this.accessibilityManager.setIndex(_)}}}},{key:"getSnapshotBeforeUpdate",value:function(b,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==b.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==b.margin){var S,w;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0}})}return null}},{key:"componentDidUpdate",value:function(b){ax([Ut(b.children,jt)],[Ut(this.props.children,jt)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var b=Ut(this.props.children,jt);if(b&&typeof b.props.shared=="boolean"){var O=b.props.shared?"axis":"item";return s.indexOf(O)>=0?O:o}return o}},{key:"getMouseInfo",value:function(b){if(!this.container)return null;var O=this.container,S=O.getBoundingClientRect(),w=_ce(S),E={chartX:Math.round(b.pageX-w.left),chartY:Math.round(b.pageY-w.top)},P=S.width/O.offsetWidth||1,_=this.inRange(E.chartX,E.chartY,P);if(!_)return null;var A=this.state,$=A.xAxisMap,N=A.yAxisMap,R=this.getTooltipEventType(),F=VA(this.state,this.props.data,this.props.layout,_);if(R!=="axis"&&$&&N){var I=Xi($).scale,D=Xi(N).scale,L=I&&I.invert?I.invert(E.chartX):null,M=D&&D.invert?D.invert(E.chartY):null;return B(B({},E),{},{xValue:L,yValue:M},F)}return F?B(B({},E),F):null}},{key:"inRange",value:function(b,O){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,w=this.props.layout,E=b/S,P=O/S;if(w==="horizontal"||w==="vertical"){var _=this.state.offset,A=E>=_.left&&E<=_.left+_.width&&P>=_.top&&P<=_.top+_.height;return A?{x:E,y:P}:null}var $=this.state,N=$.angleAxisMap,R=$.radiusAxisMap;if(N&&R){var F=Xi(N);return xj({x:E,y:P},F)}return null}},{key:"parseEventsOfWrapper",value:function(){var b=this.props.children,O=this.getTooltipEventType(),S=Ut(b,jt),w={};S&&O==="axis"&&(S.props.trigger==="click"?w={onClick:this.handleClick}:w={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var E=pp(this.props,this.handleOuterEvent);return B(B({},E),w)}},{key:"addListener",value:function(){My.on(Iy,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){My.removeListener(Iy,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(b,O,S){for(var w=this.state.formattedGraphicalItems,E=0,P=w.length;E<P;E++){var _=w[E];if(_.item===b||_.props.key===b.key||O===ui(_.item.type)&&S===_.childIndex)return _}return null}},{key:"renderClipPath",value:function(){var b=this.clipPathId,O=this.state.offset,S=O.left,w=O.top,E=O.height,P=O.width;return C.createElement("defs",null,C.createElement("clipPath",{id:b},C.createElement("rect",{x:S,y:w,height:E,width:P})))}},{key:"getXScales",value:function(){var b=this.state.xAxisMap;return b?Object.entries(b).reduce(function(O,S){var w=WA(S,2),E=w[0],P=w[1];return B(B({},O),{},fe({},E,P.scale))},{}):null}},{key:"getYScales",value:function(){var b=this.state.yAxisMap;return b?Object.entries(b).reduce(function(O,S){var w=WA(S,2),E=w[0],P=w[1];return B(B({},O),{},fe({},E,P.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(b){var O;return(O=this.state.xAxisMap)===null||O===void 0||(O=O[b])===null||O===void 0?void 0:O.scale}},{key:"getYScaleByAxisId",value:function(b){var O;return(O=this.state.yAxisMap)===null||O===void 0||(O=O[b])===null||O===void 0?void 0:O.scale}},{key:"getItemByXY",value:function(b){var O=this.state,S=O.formattedGraphicalItems,w=O.activeItem;if(S&&S.length)for(var E=0,P=S.length;E<P;E++){var _=S[E],A=_.props,$=_.item,N=$.type.defaultProps!==void 0?B(B({},$.type.defaultProps),$.props):$.props,R=ui($.type);if(R==="Bar"){var F=(A.data||[]).find(function(M){return hve(b,M)});if(F)return{graphicalItem:_,payload:F}}else if(R==="RadialBar"){var I=(A.data||[]).find(function(M){return xj(b,M)});if(I)return{graphicalItem:_,payload:I}}else if(Xm(_,w)||Qm(_,w)||bc(_,w)){var D=Zxe({graphicalItem:_,activeTooltipItem:w,itemData:N.data}),L=N.activeIndex===void 0?D:N.activeIndex;return{graphicalItem:B(B({},_),{},{childIndex:L}),payload:bc(_,w)?N.data[D]:_.props.data[D]}}}return null}},{key:"render",value:function(){var b=this;if(!ox(this))return null;var O=this.props,S=O.children,w=O.className,E=O.width,P=O.height,_=O.style,A=O.compact,$=O.title,N=O.desc,R=UA(O,hSe),F=se(R,!1);if(A)return C.createElement(OA,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},C.createElement(hp,ts({},F,{width:E,height:P,title:$,desc:N}),this.renderClipPath(),fE(S,this.renderMap)));if(this.props.accessibilityLayer){var I,D;F.tabIndex=(I=this.props.tabIndex)!==null&&I!==void 0?I:0,F.role=(D=this.props.role)!==null&&D!==void 0?D:"application",F.onKeyDown=function(M){b.accessibilityManager.keyboardEvent(M)},F.onFocus=function(){b.accessibilityManager.focus()}}var L=this.parseEventsOfWrapper();return C.createElement(OA,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},C.createElement("div",ts({className:he("recharts-wrapper",w),style:B({position:"relative",cursor:"default",width:E,height:P},_)},L,{ref:function(z){b.container=z}}),C.createElement(hp,ts({},F,{width:E,height:P,title:$,desc:N,style:TSe}),this.renderClipPath(),fE(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(k.Component);fe(m,"displayName",n),fe(m,"defaultProps",B({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},c)),fe(m,"getDerivedStateFromProps",function(v,y){var x=v.dataKey,b=v.data,O=v.children,S=v.width,w=v.height,E=v.layout,P=v.stackOffset,_=v.margin,A=y.dataStartIndex,$=y.dataEndIndex;if(y.updateId===void 0){var N=KA(v);return B(B(B({},N),{},{updateId:0},p(B(B({props:v},N),{},{updateId:0}),y)),{},{prevDataKey:x,prevData:b,prevWidth:S,prevHeight:w,prevLayout:E,prevStackOffset:P,prevMargin:_,prevChildren:O})}if(x!==y.prevDataKey||b!==y.prevData||S!==y.prevWidth||w!==y.prevHeight||E!==y.prevLayout||P!==y.prevStackOffset||!fs(_,y.prevMargin)){var R=KA(v),F={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},I=B(B({},VA(y,b,E)),{},{updateId:y.updateId+1}),D=B(B(B({},R),F),I);return B(B(B({},D),p(B({props:v},D),y)),{},{prevDataKey:x,prevData:b,prevWidth:S,prevHeight:w,prevLayout:E,prevStackOffset:P,prevMargin:_,prevChildren:O})}if(!ax(O,y.prevChildren)){var L,M,z,j,W=Ut(O,Ws),U=W&&(L=(M=W.props)===null||M===void 0?void 0:M.startIndex)!==null&&L!==void 0?L:A,T=W&&(z=(j=W.props)===null||j===void 0?void 0:j.endIndex)!==null&&z!==void 0?z:$,Y=U!==A||T!==$,J=!me(b),Z=J&&!Y?y.updateId:y.updateId+1;return B(B({updateId:Z},p(B(B({props:v},y),{},{updateId:Z,dataStartIndex:U,dataEndIndex:T}),y)),{},{prevChildren:O,dataStartIndex:U,dataEndIndex:T})}return null}),fe(m,"renderActiveDot",function(v,y,x){var b;return k.isValidElement(v)?b=k.cloneElement(v,y):ce(v)?b=v(y):b=C.createElement(Vm,y),C.createElement(Oe,{className:"recharts-active-dot",key:x},b)});var g=k.forwardRef(function(y,x){return C.createElement(m,ts({},y,{ref:x}))});return g.displayName=m.displayName,g},BSe=C1({chartName:"LineChart",GraphicalChild:Jc,axisComponents:[{axisType:"xAxis",AxisComp:Oo},{axisType:"yAxis",AxisComp:Eo}],formatAxisMap:mD}),T1=C1({chartName:"BarChart",GraphicalChild:Qn,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Oo},{axisType:"yAxis",AxisComp:Eo}],formatAxisMap:mD}),WSe=C1({chartName:"PieChart",GraphicalChild:Ii,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Ym},{axisType:"radiusAxis",AxisComp:qm}],formatAxisMap:Eme,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function USe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var HSe=USe,VSe=b1,KSe=am,qSe=Object.prototype,GSe=qSe.hasOwnProperty;function YSe(e,t,n){var r=e[t];(!(GSe.call(e,t)&&KSe(r,n))||n===void 0&&!(t in e))&&VSe(e,t,n)}var QD=YSe,XSe=QD,QSe=b1;function JSe(e,t,n,r){var i=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],l=r?r(n[s],e[s],s,n,e):void 0;l===void 0&&(l=e[s]),i?QSe(n,s,l):XSe(n,s,l)}return n}var Zc=JSe,ZSe=Zc,eke=wl;function tke(e,t){return e&&ZSe(t,eke(t),e)}var nke=tke;function rke(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ike=rke,oke=_r,ake=Ww,ske=ike,lke=Object.prototype,uke=lke.hasOwnProperty;function cke(e){if(!oke(e))return ske(e);var t=ake(e),n=[];for(var r in e)r=="constructor"&&(t||!uke.call(e,r))||n.push(r);return n}var fke=cke,dke=eI,pke=fke,hke=bl;function mke(e){return hke(e)?dke(e,!0):pke(e)}var N1=mke,gke=Zc,yke=N1;function vke(e,t){return e&&gke(t,yke(t),e)}var xke=vke,gh={exports:{}};gh.exports;(function(e,t){var n=jr,r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,a=o?n.Buffer:void 0,s=a?a.allocUnsafe:void 0;function l(u,f){if(f)return u.slice();var c=u.length,d=s?s(c):new u.constructor(c);return u.copy(d),d}e.exports=l})(gh,gh.exports);var bke=gh.exports;function wke(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Ske=wke,kke=Zc,Oke=Rw;function Eke(e,t){return kke(e,Oke(e),t)}var Pke=Eke,jke=Iw,Ake=x1,_ke=Rw,Cke=QM,Tke=Object.getOwnPropertySymbols,Nke=Tke?function(e){for(var t=[];e;)jke(t,_ke(e)),e=Ake(e);return t}:Cke,JD=Nke,$ke=Zc,Mke=JD;function Ike(e,t){return $ke(e,Mke(e),t)}var Rke=Ike,Dke=XM,Lke=JD,Fke=N1;function zke(e){return Dke(e,Fke,Lke)}var ZD=zke,Bke=Object.prototype,Wke=Bke.hasOwnProperty;function Uke(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Wke.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var Hke=Uke,GA=YM;function Vke(e){var t=new e.constructor(e.byteLength);return new GA(t).set(new GA(e)),t}var $1=Vke,Kke=$1;function qke(e,t){var n=t?Kke(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Gke=qke,Yke=/\w*$/;function Xke(e){var t=new e.constructor(e.source,Yke.exec(e));return t.lastIndex=e.lastIndex,t}var Qke=Xke,YA=pl,XA=YA?YA.prototype:void 0,QA=XA?XA.valueOf:void 0;function Jke(e){return QA?Object(QA.call(e)):{}}var Zke=Jke,eOe=$1;function tOe(e,t){var n=t?eOe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var nOe=tOe,rOe=$1,iOe=Gke,oOe=Qke,aOe=Zke,sOe=nOe,lOe="[object Boolean]",uOe="[object Date]",cOe="[object Map]",fOe="[object Number]",dOe="[object RegExp]",pOe="[object Set]",hOe="[object String]",mOe="[object Symbol]",gOe="[object ArrayBuffer]",yOe="[object DataView]",vOe="[object Float32Array]",xOe="[object Float64Array]",bOe="[object Int8Array]",wOe="[object Int16Array]",SOe="[object Int32Array]",kOe="[object Uint8Array]",OOe="[object Uint8ClampedArray]",EOe="[object Uint16Array]",POe="[object Uint32Array]";function jOe(e,t,n){var r=e.constructor;switch(t){case gOe:return rOe(e);case lOe:case uOe:return new r(+e);case yOe:return iOe(e,n);case vOe:case xOe:case bOe:case wOe:case SOe:case kOe:case OOe:case EOe:case POe:return sOe(e,n);case cOe:return new r;case fOe:case hOe:return new r(e);case dOe:return oOe(e);case pOe:return new r;case mOe:return aOe(e)}}var AOe=jOe,_Oe=_r,JA=Object.create,COe=function(){function e(){}return function(t){if(!_Oe(t))return{};if(JA)return JA(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),TOe=COe,NOe=TOe,$Oe=x1,MOe=Ww;function IOe(e){return typeof e.constructor=="function"&&!MOe(e)?NOe($Oe(e)):{}}var ROe=IOe,DOe=_m,LOe=Ar,FOe="[object Map]";function zOe(e){return LOe(e)&&DOe(e)==FOe}var BOe=zOe,WOe=BOe,UOe=Am,ZA=Bw,e_=ZA&&ZA.isMap,HOe=e_?UOe(e_):WOe,VOe=HOe,KOe=_m,qOe=Ar,GOe="[object Set]";function YOe(e){return qOe(e)&&KOe(e)==GOe}var XOe=YOe,QOe=XOe,JOe=Am,t_=Bw,n_=t_&&t_.isSet,ZOe=n_?JOe(n_):QOe,eEe=ZOe,tEe=$w,nEe=HSe,rEe=QD,iEe=nke,oEe=xke,aEe=bke,sEe=Ske,lEe=Pke,uEe=Rke,cEe=nI,fEe=ZD,dEe=_m,pEe=Hke,hEe=AOe,mEe=ROe,gEe=an,yEe=Lw,vEe=VOe,xEe=_r,bEe=eEe,wEe=wl,SEe=N1,kEe=1,OEe=2,EEe=4,eL="[object Arguments]",PEe="[object Array]",jEe="[object Boolean]",AEe="[object Date]",_Ee="[object Error]",tL="[object Function]",CEe="[object GeneratorFunction]",TEe="[object Map]",NEe="[object Number]",nL="[object Object]",$Ee="[object RegExp]",MEe="[object Set]",IEe="[object String]",REe="[object Symbol]",DEe="[object WeakMap]",LEe="[object ArrayBuffer]",FEe="[object DataView]",zEe="[object Float32Array]",BEe="[object Float64Array]",WEe="[object Int8Array]",UEe="[object Int16Array]",HEe="[object Int32Array]",VEe="[object Uint8Array]",KEe="[object Uint8ClampedArray]",qEe="[object Uint16Array]",GEe="[object Uint32Array]",Be={};Be[eL]=Be[PEe]=Be[LEe]=Be[FEe]=Be[jEe]=Be[AEe]=Be[zEe]=Be[BEe]=Be[WEe]=Be[UEe]=Be[HEe]=Be[TEe]=Be[NEe]=Be[nL]=Be[$Ee]=Be[MEe]=Be[IEe]=Be[REe]=Be[VEe]=Be[KEe]=Be[qEe]=Be[GEe]=!0;Be[_Ee]=Be[tL]=Be[DEe]=!1;function jd(e,t,n,r,i,o){var a,s=t&kEe,l=t&OEe,u=t&EEe;if(n&&(a=i?n(e,r,i,o):n(e)),a!==void 0)return a;if(!xEe(e))return e;var f=gEe(e);if(f){if(a=pEe(e),!s)return sEe(e,a)}else{var c=dEe(e),d=c==tL||c==CEe;if(yEe(e))return aEe(e,s);if(c==nL||c==eL||d&&!i){if(a=l||d?{}:mEe(e),!s)return l?uEe(e,oEe(a,e)):lEe(e,iEe(a,e))}else{if(!Be[c])return i?e:{};a=hEe(e,c,s)}}o||(o=new tEe);var p=o.get(e);if(p)return p;o.set(e,a),bEe(e)?e.forEach(function(v){a.add(jd(v,t,n,v,e,o))}):vEe(e)&&e.forEach(function(v,y){a.set(y,jd(v,t,n,y,e,o))});var m=u?l?fEe:cEe:l?SEe:wEe,g=f?void 0:m(e);return nEe(g||e,function(v,y){g&&(y=v,v=e[y]),rEe(a,y,jd(v,t,n,y,e,o))}),a}var YEe=jd,XEe=dm,QEe=vM;function JEe(e,t){return t.length<2?e:XEe(e,QEe(t,0,-1))}var ZEe=JEe,ePe=fm,tPe=DR,nPe=ZEe,rPe=Hc,iPe=Object.prototype,oPe=iPe.hasOwnProperty;function aPe(e,t){t=ePe(t,e);var n=-1,r=t.length;if(!r)return!0;for(var i=e==null||typeof e!="object"&&typeof e!="function";++n<r;){var o=t[n];if(typeof o=="string"){if(o==="__proto__"&&!oPe.call(e,"__proto__"))return!1;if(o==="constructor"&&n+1<r&&typeof t[n+1]=="string"&&t[n+1]==="prototype"){if(i&&n===0)continue;return!1}}}var a=nPe(e,t);return a==null||delete a[rPe(tPe(t))]}var sPe=aPe,lPe=nD;function uPe(e){return lPe(e)?void 0:e}var cPe=uPe,fPe=Hw;function dPe(e){var t=e==null?0:e.length;return t?fPe(e,1):[]}var pPe=dPe,hPe=pPe,mPe=mI,gPe=yI;function yPe(e){return gPe(mPe(e,void 0,hPe),e+"")}var vPe=yPe,xPe=cm,bPe=YEe,wPe=sPe,SPe=fm,kPe=Zc,OPe=cPe,EPe=vPe,PPe=ZD,jPe=1,APe=2,_Pe=4,CPe=EPe(function(e,t){var n={};if(e==null)return n;var r=!1;t=xPe(t,function(o){return o=SPe(o,e),r||(r=o.length>1),o}),kPe(e,PPe(e),n),r&&(n=bPe(n,jPe|APe|_Pe,OPe));for(var i=t.length;i--;)wPe(n,t[i]);return n}),TPe=CPe;const NPe=Ce(TPe);var $Pe=["#1890FF","#66B5FF","#41D9C7","#2FC25B","#6EDB8F","#9AE65C","#FACC14","#E6965C","#57AD71","#223273","#738AE6","#7564CC","#8543E0","#A877ED","#5C8EE6","#13C2C2","#70E0E0","#5CA3E6","#3436C7","#8082FF","#DD81E6","#F04864","#FA7D92","#D598D9"],MPe=["width","height","className","style","children","type"];function Zs(e){"@babel/helpers - typeof";return Zs=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},Zs(e)}function yh(){return yh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yh.apply(this,arguments)}function IPe(e,t){if(e==null)return{};var n=RPe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function RPe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function DPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r_(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,iL(r.key),r)}}function LPe(e,t,n){return t&&r_(e.prototype,t),n&&r_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function FPe(e,t,n){return t=vh(t),zPe(e,rL()?Reflect.construct(t,n||[],vh(e).constructor):t.apply(e,n))}function zPe(e,t){if(t&&(Zs(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BPe(e)}function BPe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rL=function(){return!!e})()}function vh(e){return vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},vh(e)}function WPe(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&&Tb(e,t)}function Tb(e,t){return Tb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Tb(e,t)}function i_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?i_(Object(n),!0).forEach(function(r){pi(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pi(e,t,n){return t=iL(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iL(e){var t=UPe(e,"string");return Zs(t)=="symbol"?t:t+""}function UPe(e,t){if(Zs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var jc="value",Dy=function e(t){var n=t.depth,r=t.node,i=t.index,o=t.valueKey,a=r.children,s=n+1,l=a&&a.length?a.map(function(f,c){return e({depth:s,node:f,index:c,valueKey:o})}):null,u;return a&&a.length?u=l.reduce(function(f,c){return f+c[jc]},0):u=xa(r[o])||r[o]<=0?0:r[o],Ue(Ue({},r),{},pi(pi(pi({children:l},jc,u),"depth",n),"index",i))},HPe=function(t){return{x:t.x,y:t.y,width:t.width,height:t.height}},VPe=function(t,n){var r=n<0?0:n;return t.map(function(i){var o=i[jc]*r;return Ue(Ue({},i),{},{area:xa(o)||o<=0?0:o})})},KPe=function(t,n,r){var i=n*n,o=t.area*t.area,a=t.reduce(function(u,f){return{min:Math.min(u.min,f.area),max:Math.max(u.max,f.area)}},{min:1/0,max:0}),s=a.min,l=a.max;return o?Math.max(i*l*r/o,o/(i*s*r)):1/0},qPe=function(t,n,r,i){var o=n?Math.round(t.area/n):0;(i||o>r.height)&&(o=r.height);for(var a=r.x,s,l=0,u=t.length;l<u;l++)s=t[l],s.x=a,s.y=r.y,s.height=o,s.width=Math.min(o?Math.round(s.area/o):0,r.x+r.width-a),a+=s.width;return s.width+=r.x+r.width-a,Ue(Ue({},r),{},{y:r.y+o,height:r.height-o})},GPe=function(t,n,r,i){var o=n?Math.round(t.area/n):0;(i||o>r.width)&&(o=r.width);for(var a=r.y,s,l=0,u=t.length;l<u;l++)s=t[l],s.x=r.x,s.y=a,s.width=o,s.height=Math.min(o?Math.round(s.area/o):0,r.y+r.height-a),a+=s.height;return s&&(s.height+=r.y+r.height-a),Ue(Ue({},r),{},{x:r.x+o,width:r.width-o})},o_=function(t,n,r,i){return n===r.width?qPe(t,n,r,i):GPe(t,n,r,i)},Ly=function e(t,n){var r=t.children;if(r&&r.length){var i=HPe(t),o=[],a=1/0,s,l,u=Math.min(i.width,i.height),f=VPe(r,i.width*i.height/t[jc]),c=f.slice();for(o.area=0;c.length>0;)o.push(s=c[0]),o.area+=s.area,l=KPe(o,u,n),l<=a?(c.shift(),a=l):(o.area-=o.pop().area,i=o_(o,u,i,!1),u=Math.min(i.width,i.height),o.length=o.area=0,a=1/0);return o.length&&(i=o_(o,u,i,!0),o.length=o.area=0),Ue(Ue({},t),{},{children:f.map(function(d){return e(d,n)})})}return t},YPe={isTooltipActive:!1,isAnimationFinished:!1,activeNode:null,formatRoot:null,currentRoot:null,nestIndex:[]},M1=function(e){function t(){var n;DPe(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=FPe(this,t,[].concat(i)),pi(n,"state",Ue({},YPe)),pi(n,"handleAnimationEnd",function(){var a=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),ce(a)&&a()}),pi(n,"handleAnimationStart",function(){var a=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),ce(a)&&a()}),n}return WPe(t,e),LPe(t,[{key:"handleMouseEnter",value:function(r,i){i.persist();var o=this.props,a=o.onMouseEnter,s=o.children,l=Ut(s,jt);l?this.setState({isTooltipActive:!0,activeNode:r},function(){a&&a(r,i)}):a&&a(r,i)}},{key:"handleMouseLeave",value:function(r,i){i.persist();var o=this.props,a=o.onMouseLeave,s=o.children,l=Ut(s,jt);l?this.setState({isTooltipActive:!1,activeNode:null},function(){a&&a(r,i)}):a&&a(r,i)}},{key:"handleClick",value:function(r){var i=this.props,o=i.onClick,a=i.type;if(a==="nest"&&r.children){var s=this.props,l=s.width,u=s.height,f=s.dataKey,c=s.aspectRatio,d=Dy({depth:0,node:Ue(Ue({},r),{},{x:0,y:0,width:l,height:u}),index:0,valueKey:f}),p=Ly(d,c),m=this.state.nestIndex;m.push(r),this.setState({formatRoot:p,currentRoot:d,nestIndex:m})}o&&o(r)}},{key:"handleNestIndex",value:function(r,i){var o=this.state.nestIndex,a=this.props,s=a.width,l=a.height,u=a.dataKey,f=a.aspectRatio,c=Dy({depth:0,node:Ue(Ue({},r),{},{x:0,y:0,width:s,height:l}),index:0,valueKey:u}),d=Ly(c,f);o=o.slice(0,i+1),this.setState({formatRoot:d,currentRoot:r,nestIndex:o})}},{key:"renderItem",value:function(r,i,o){var a=this,s=this.props,l=s.isAnimationActive,u=s.animationBegin,f=s.animationDuration,c=s.animationEasing,d=s.isUpdateAnimationActive,p=s.type,m=s.animationId,g=s.colorPanel,v=this.state.isAnimationFinished,y=i.width,x=i.height,b=i.x,O=i.y,S=i.depth,w=parseInt("".concat((Math.random()*2-1)*y),10),E={};return(o||p==="nest")&&(E={onMouseEnter:this.handleMouseEnter.bind(this,i),onMouseLeave:this.handleMouseLeave.bind(this,i),onClick:this.handleClick.bind(this,i)}),l?C.createElement(tr,{begin:u,duration:f,isActive:l,easing:c,key:"treemap-".concat(m),from:{x:b,y:O,width:y,height:x},to:{x:b,y:O,width:y,height:x},onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(P){var _=P.x,A=P.y,$=P.width,N=P.height;return C.createElement(tr,{from:"translate(".concat(w,"px, ").concat(w,"px)"),to:"translate(0, 0)",attributeName:"transform",begin:u,easing:c,isActive:l,duration:f},C.createElement(Oe,E,function(){return S>2&&!v?null:a.constructor.renderContentItem(r,Ue(Ue({},i),{},{isAnimationActive:l,isUpdateAnimationActive:!d,width:$,height:N,x:_,y:A}),p,g)}()))}):C.createElement(Oe,E,this.constructor.renderContentItem(r,Ue(Ue({},i),{},{isAnimationActive:!1,isUpdateAnimationActive:!1,width:y,height:x,x:b,y:O}),p,g))}},{key:"renderNode",value:function(r,i){var o=this,a=this.props,s=a.content,l=a.type,u=Ue(Ue(Ue({},se(this.props,!1)),i),{},{root:r}),f=!i.children||!i.children.length,c=this.state.currentRoot,d=(c.children||[]).filter(function(p){return p.depth===i.depth&&p.name===i.name});return!d.length&&r.depth&&l==="nest"?null:C.createElement(Oe,{key:"recharts-treemap-node-".concat(u.x,"-").concat(u.y,"-").concat(u.name),className:"recharts-treemap-depth-".concat(i.depth)},this.renderItem(s,u,f),i.children&&i.children.length?i.children.map(function(p){return o.renderNode(i,p)}):null)}},{key:"renderAllNodes",value:function(){var r=this.state.formatRoot;return r?this.renderNode(r,r):null}},{key:"renderTooltip",value:function(){var r=this.props,i=r.children,o=r.nameKey,a=Ut(i,jt);if(!a)return null;var s=this.props,l=s.width,u=s.height,f=this.state,c=f.isTooltipActive,d=f.activeNode,p={x:0,y:0,width:l,height:u},m=d?{x:d.x+d.width/2,y:d.y+d.height/2}:null,g=c&&d?[{payload:d,name:dt(d,o,""),value:dt(d,jc)}]:[];return C.cloneElement(a,{viewBox:p,active:c,coordinate:m,label:"",payload:g})}},{key:"renderNestIndex",value:function(){var r=this,i=this.props,o=i.nameKey,a=i.nestIndexContent,s=this.state.nestIndex;return C.createElement("div",{className:"recharts-treemap-nest-index-wrapper",style:{marginTop:"8px",textAlign:"center"}},s.map(function(l,u){var f=vn(l,o,"root"),c=null;return C.isValidElement(a)&&(c=C.cloneElement(a,l,u)),ce(a)?c=a(l,u):c=f,C.createElement("div",{onClick:r.handleNestIndex.bind(r,l,u),key:"nest-index-".concat(ba()),className:"recharts-treemap-nest-index-box",style:{cursor:"pointer",display:"inline-block",padding:"0 7px",background:"#000",color:"#fff",marginRight:"3px"}},c)}))}},{key:"render",value:function(){if(!ox(this))return null;var r=this.props,i=r.width,o=r.height,a=r.className,s=r.style,l=r.children,u=r.type,f=IPe(r,MPe),c=se(f,!1);return C.createElement("div",{className:he("recharts-wrapper",a),style:Ue(Ue({},s),{},{position:"relative",cursor:"default",width:i,height:o}),role:"region"},C.createElement(hp,yh({},c,{width:i,height:u==="nest"?o-30:o}),this.renderAllNodes(),pee(l)),this.renderTooltip(),u==="nest"&&this.renderNestIndex())}}],[{key:"getDerivedStateFromProps",value:function(r,i){if(r.data!==i.prevData||r.type!==i.prevType||r.width!==i.prevWidth||r.height!==i.prevHeight||r.dataKey!==i.prevDataKey||r.aspectRatio!==i.prevAspectRatio){var o=Dy({depth:0,node:{children:r.data,x:0,y:0,width:r.width,height:r.height},index:0,valueKey:r.dataKey}),a=Ly(o,r.aspectRatio);return Ue(Ue({},i),{},{formatRoot:a,currentRoot:o,nestIndex:[o],prevAspectRatio:r.aspectRatio,prevData:r.data,prevWidth:r.width,prevHeight:r.height,prevDataKey:r.dataKey,prevType:r.type})}return null}},{key:"renderContentItem",value:function(r,i,o,a){if(C.isValidElement(r))return C.cloneElement(r,i);if(ce(r))return r(i);var s=i.x,l=i.y,u=i.width,f=i.height,c=i.index,d=null;u>10&&f>10&&i.children&&o==="nest"&&(d=C.createElement(XR,{points:[{x:s+2,y:l+f/2},{x:s+6,y:l+f/2+3},{x:s+2,y:l+f/2+6}]}));var p=null,m=ds(i.name);u>20&&f>20&&m.width<u&&m.height<f&&(p=C.createElement("text",{x:s+8,y:l+f/2+7,fontSize:14},i.name));var g=a||$Pe;return C.createElement("g",null,C.createElement(Hm,yh({fill:i.depth<2?g[c%g.length]:"rgba(255,255,255,0)",stroke:"#fff"},NPe(i,"children"),{role:"img"})),d,p)}}])}(k.PureComponent);pi(M1,"displayName","Treemap");pi(M1,"defaultProps",{aspectRatio:.5*(1+Math.sqrt(5)),dataKey:"value",type:"flat",isAnimationActive:!Ei.isSsr,isUpdateAnimationActive:!Ei.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"linear"});const _t={purple:"hsl(265 89% 78%)",cyan:"hsl(191 97% 77%)",green:"hsl(135 94% 65%)",pink:"hsl(326 100% 74%)",orange:"hsl(31 100% 71%)",comment:"hsl(225 27% 51%)"},XPe={completed:_t.purple,failed:_t.pink,canceled:_t.orange,running:_t.cyan,queued:_t.comment},a_=[_t.purple,_t.cyan,_t.green,_t.pink,_t.orange];function QPe({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"text-muted-foreground mb-1",children:n}),h.jsxs("p",{className:"font-medium",children:["$",t[0].value.toFixed(4)]})]})}function JPe(e){try{return b$(new Date(e),"MMM d")}catch{return e}}function ZPe({data:e}){if(!(e.length>0&&e.some(i=>i.costUsd>0)))return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Cost Over Time"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No cost data for this period"})]});const n=Math.max(1,Math.floor(e.length/7)),r=e.filter((i,o)=>o%n===0).map(i=>i.date);return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Cost Over Time"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsxs(BSe,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[h.jsx(Qc,{strokeDasharray:"3 3",stroke:"var(--color-border)"}),h.jsx(Oo,{dataKey:"date",ticks:r,tickFormatter:JPe,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1}),h.jsx(Eo,{tickFormatter:i=>`$${i.toFixed(2)}`,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1,width:55}),h.jsx(jt,{content:h.jsx(QPe,{})}),h.jsx(Jc,{type:"monotone",dataKey:"costUsd",stroke:_t.purple,strokeWidth:2,dot:!1,activeDot:{r:3,fill:_t.purple}})]})})]})}function eje({active:e,payload:t}){if(!e||!(t!=null&&t.length))return null;const n=t[0];return h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"capitalize font-medium",children:n.name}),h.jsxs("p",{className:"text-muted-foreground",children:[n.value," jobs"]})]})}function tje({data:e}){if(e.length===0)return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Jobs by Status"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No jobs in this period"})]});const t=e.reduce((n,r)=>n+r.count,0);return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Jobs by Status"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsxs(WSe,{children:[h.jsx(Ii,{data:e,dataKey:"count",nameKey:"status",cx:"50%",cy:"50%",innerRadius:60,outerRadius:90,paddingAngle:2,children:e.map(n=>h.jsx(Nm,{fill:XPe[n.status]??"var(--color-muted-foreground)"},n.status))}),h.jsx(jt,{content:h.jsx(eje,{})}),h.jsx(ci,{formatter:n=>{const r=e.find(o=>o.status===n),i=r?(r.count/t*100).toFixed(0):"0";return h.jsxs("span",{className:"text-xs capitalize",children:[n," (",(r==null?void 0:r.count)??0,", ",i,"%)"]})}})]})})]})}const nje=["<1m","1-3m","3-5m","5-10m",">10m"];function rje(e){if(e===null)return"—";const t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function ije({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"text-muted-foreground mb-1",children:n}),h.jsxs("p",{className:"font-medium",children:[t[0].value," jobs"]})]})}function oje({data:e,percentiles:t}){const n=nje.map(i=>{const o=e.find(a=>a.bucket===i);return{bucket:i,count:(o==null?void 0:o.count)??0}});return n.some(i=>i.count>0)?h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Duration Distribution"}),h.jsx(Ol,{width:"100%",height:180,children:h.jsxs(T1,{data:n,margin:{top:4,right:8,left:0,bottom:0},children:[h.jsx(Qc,{strokeDasharray:"3 3",stroke:"var(--color-border)",vertical:!1}),h.jsx(Oo,{dataKey:"bucket",tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1}),h.jsx(Eo,{allowDecimals:!1,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1,width:30}),h.jsx(jt,{content:h.jsx(ije,{})}),h.jsx(Qn,{dataKey:"count",fill:_t.cyan,radius:[3,3,0,0]})]})}),h.jsx("div",{className:"flex items-center gap-3 mt-2",children:["p50","p75","p95"].map(i=>h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground uppercase",children:[i,":"]}),h.jsx("span",{className:"text-[10px] font-medium tabular-nums",children:rje(t[i])})]},i))})]}):h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Duration Distribution"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No duration data available"})]})}function aje({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"text-muted-foreground mb-1 font-mono truncate max-w-48",children:n}),t.map(r=>h.jsxs("p",{style:{color:r.color},children:[r.name,": ",r.value.toLocaleString()]},r.name))]})}function sje({data:e}){if(e.length===0)return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Token Efficiency"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No token data for this period"})]});const t=e.map(n=>({...n,name:n.command.length>20?`…${n.command.slice(-18)}`:n.command}));return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Token Efficiency"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsxs(T1,{layout:"vertical",data:t,margin:{top:4,right:8,left:0,bottom:0},children:[h.jsx(Qc,{strokeDasharray:"3 3",stroke:"var(--color-border)",horizontal:!1}),h.jsx(Oo,{type:"number",tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1,tickFormatter:n=>n>=1e3?`${(n/1e3).toFixed(0)}k`:String(n)}),h.jsx(Eo,{type:"category",dataKey:"name",width:110,tick:{fontSize:9,fill:"var(--color-muted-foreground)",fontFamily:"monospace"},axisLine:!1,tickLine:!1}),h.jsx(jt,{content:h.jsx(aje,{})}),h.jsx(ci,{formatter:n=>h.jsx("span",{className:"text-xs",children:n})}),h.jsx(Qn,{dataKey:"tokensOut",name:"Output tokens",fill:_t.purple,stackId:"a",radius:[0,3,3,0]}),h.jsx(Qn,{dataKey:"tokensCacheRead",name:"Cached tokens",fill:_t.cyan,stackId:"a",radius:[0,3,3,0]})]})})]})}function s_(e){return e===null?"—":`$${e.toFixed(4)}`}function lje(e){if(e===null)return"—";const t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function uje({rate:e}){const t=(e*100).toFixed(0);return h.jsxs("span",{className:le("inline-block px-1.5 py-0.5 rounded text-[10px] font-medium",e>=.8?"bg-green-400/10 text-green-400":e>=.5?"bg-orange-400/10 text-orange-400":"bg-red-400/10 text-red-400"),children:[t,"%"]})}function Da({label:e,sortKey:t,current:n,dir:r,onSort:i}){const o=n===t;return h.jsx("th",{onClick:()=>i(t),className:"px-3 py-2 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide cursor-pointer select-none hover:text-foreground whitespace-nowrap",children:h.jsxs("span",{className:"inline-flex items-center gap-1",children:[e,o?r==="asc"?h.jsx(t8,{className:"w-3 h-3"}):h.jsx(K0,{className:"w-3 h-3"}):h.jsx(r8,{className:"w-3 h-3 opacity-40"})]})})}function cje({data:e}){const[t,n]=k.useState("totalCostUsd"),[r,i]=k.useState("desc");function o(s){s===t?i(l=>l==="asc"?"desc":"asc"):(n(s),i("desc"))}const a=[...e].sort((s,l)=>{const u=s[t]??-1/0,f=l[t]??-1/0,c=typeof u=="string"?u.localeCompare(f):u-f;return r==="asc"?c:-c});return e.length===0?h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Command Performance"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"No command data for this period"})]}):h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Command Performance"}),h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-xs",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b border-border/30",children:[h.jsx(Da,{label:"Command",sortKey:"command",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Runs",sortKey:"totalRuns",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Success Rate",sortKey:"successRate",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Avg Cost",sortKey:"avgCostUsd",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Avg Duration",sortKey:"avgDurationMs",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Total Cost",sortKey:"totalCostUsd",current:t,dir:r,onSort:o})]})}),h.jsx("tbody",{children:a.map(s=>h.jsxs("tr",{className:"border-b border-border/20 hover:bg-accent/20 transition-colors",children:[h.jsx("td",{className:"px-3 py-2 font-mono text-[10px] text-foreground",children:s.command}),h.jsx("td",{className:"px-3 py-2 tabular-nums",children:s.totalRuns}),h.jsx("td",{className:"px-3 py-2",children:h.jsx(uje,{rate:s.successRate})}),h.jsx("td",{className:"px-3 py-2 tabular-nums",children:s_(s.avgCostUsd)}),h.jsx("td",{className:"px-3 py-2 tabular-nums",children:lje(s.avgDurationMs)}),h.jsx("td",{className:"px-3 py-2 tabular-nums font-medium",children:s_(s.totalCostUsd)})]},s.command))})]})})]})}function fje({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"text-muted-foreground mb-1",children:n}),t.map(r=>h.jsxs("p",{style:{color:r.color},children:[r.name,": ",r.value]},r.name))]})}function dje(e){try{return b$(new Date(e),"MMM d")}catch{return e}}function pje({data:e}){if(!(e.length>0&&e.some(i=>i.completed+i.failed+i.canceled>0)))return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Daily Throughput"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No throughput data for this period"})]});const n=Math.max(1,Math.floor(e.length/7)),r=e.filter((i,o)=>o%n===0).map(i=>i.date);return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Daily Throughput"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsxs(T1,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[h.jsx(Qc,{strokeDasharray:"3 3",stroke:"var(--color-border)",vertical:!1}),h.jsx(Oo,{dataKey:"date",ticks:r,tickFormatter:dje,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1}),h.jsx(Eo,{allowDecimals:!1,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1,width:30}),h.jsx(jt,{content:h.jsx(fje,{})}),h.jsx(ci,{formatter:i=>h.jsx("span",{className:"text-xs capitalize",children:i})}),h.jsx(Qn,{dataKey:"completed",name:"Completed",stackId:"a",fill:_t.purple}),h.jsx(Qn,{dataKey:"failed",name:"Failed",stackId:"a",fill:_t.pink}),h.jsx(Qn,{dataKey:"canceled",name:"Canceled",stackId:"a",fill:_t.orange,radius:[3,3,0,0]})]})})]})}function hje({x:e=0,y:t=0,width:n=0,height:r=0,name:i="",size:o=0,colorIndex:a=0}){const s=a_[a%a_.length],l=n>50&&r>30;return h.jsxs("g",{children:[h.jsx("rect",{x:e,y:t,width:n,height:r,style:{fill:s,fillOpacity:.8,stroke:"var(--color-background)",strokeWidth:2},rx:4}),l&&h.jsxs(h.Fragment,{children:[h.jsx("text",{x:e+6,y:t+16,fill:"var(--color-background)",fontSize:10,fontFamily:"monospace",style:{overflow:"hidden"},children:i.length>Math.floor(n/6)?i.slice(0,Math.floor(n/6)-1)+"…":i}),r>45&&h.jsxs("text",{x:e+6,y:t+30,fill:"hsl(231 15% 18% / 0.7)",fontSize:9,children:["$",o.toFixed(4)]})]})]})}function mje({active:e,payload:t}){if(!e||!(t!=null&&t.length))return null;const n=t[0].payload;return n?h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"font-mono font-medium mb-1",children:n.name}),h.jsxs("p",{className:"text-muted-foreground",children:["Cost: $",n.size.toFixed(4)]}),h.jsxs("p",{className:"text-muted-foreground",children:["Jobs: ",n.jobCount]})]}):null}function gje({data:e}){const t=e.filter(r=>r.totalCostUsd>0);if(t.length===0)return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Cost per Command"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No cost data for this period"})]});const n=t.map((r,i)=>({name:r.command,size:r.totalCostUsd,jobCount:r.jobCount,colorIndex:i}));return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Cost per Command"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsx(M1,{data:n,dataKey:"size",content:h.jsx(hje,{}),children:h.jsx(jt,{content:h.jsx(mje,{})})})})]})}function Fy({label:e,value:t}){return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-3 space-y-1",children:[h.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:e}),h.jsx("p",{className:"text-base font-semibold tabular-nums",children:t})]})}function yje({data:e}){const t=e.costPerSuccess!==null?`$${e.costPerSuccess.toFixed(4)}`:"—",n=e.apiEfficiencyPct!==null?`${e.apiEfficiencyPct.toFixed(0)}%`:"—",r=`$${e.failureCostUsd.toFixed(4)}`;return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4 space-y-4",children:[h.jsx("h3",{className:"text-sm font-medium",children:"Bonus Metrics"}),h.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[h.jsx(Fy,{label:"Cost per Success",value:t}),h.jsx(Fy,{label:"API Efficiency",value:n}),h.jsx(Fy,{label:"Failure Cost",value:r})]}),h.jsxs("div",{children:[h.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Model Breakdown"}),e.modelBreakdown.length===0?h.jsx("p",{className:"text-xs text-muted-foreground",children:"No model data for this period"}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-xs",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b border-border/30",children:[h.jsx("th",{className:"px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide",children:"Model"}),h.jsx("th",{className:"px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide",children:"Jobs"}),h.jsx("th",{className:"px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide",children:"Total Cost"})]})}),h.jsx("tbody",{children:e.modelBreakdown.map(i=>h.jsxs("tr",{className:"border-b border-border/20",children:[h.jsx("td",{className:"px-3 py-1.5 font-mono text-[10px]",children:i.model}),h.jsx("td",{className:"px-3 py-1.5 tabular-nums",children:i.jobCount}),h.jsxs("td",{className:"px-3 py-1.5 tabular-nums",children:["$",i.totalCostUsd.toFixed(4)]})]},i.model))})]})})]})]})}function vje(){return h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:4}).map((e,t)=>h.jsx("div",{className:"h-20 rounded-lg border border-border/40 bg-card/50 animate-pulse"},t))}),h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Array.from({length:4}).map((e,t)=>h.jsx("div",{className:"h-[260px] rounded-lg border border-border/40 bg-card/50 animate-pulse"},t))}),h.jsx("div",{className:"h-[180px] rounded-lg border border-border/40 bg-card/50 animate-pulse"})]})}function xje({message:e,onRetry:t}){return h.jsxs("div",{className:"rounded-lg border border-red-400/30 bg-red-400/10 p-4 flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-red-400",children:e}),h.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 h-7 px-3 rounded-md text-xs text-red-400 border border-red-400/30 hover:bg-red-400/10 transition-colors",children:[h.jsx(N8,{className:"w-3 h-3"}),"Retry"]})]})}function oL(){const{activeProjectId:e}=Ni(),[t,n]=k.useState("7d"),[r,i]=k.useState(""),[o,a]=k.useState(""),[s,l]=k.useState(null),[u,f]=k.useState(!0),[c,d]=k.useState(null),[p,m]=k.useState(0),g=k.useRef(new Map);k.useEffect(()=>{if(e){const O=g.current.get(e);O&&(l(O),f(!1))}const x=new AbortController;!s&&!g.current.get(e??"")&&f(!0),d(null);const b=new URLSearchParams({period:t});if(t==="custom"){if(!r||!o){f(!1);return}b.set("from",r),b.set("to",o)}return fetch(`${Je()}/analytics?${b}`,{signal:x.signal}).then(O=>{if(!O.ok)throw new Error(`HTTP ${O.status}`);return O.json()}).then(O=>{l(O),e&&g.current.set(e,O),f(!1)}).catch(O=>{O.name!=="AbortError"&&(d(O.message),f(!1))}),()=>x.abort()},[t,r,o,p,e]);function v(x,b,O){n(x),i(b??""),a(O??"")}function y(){m(x=>x+1)}return h.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-base font-semibold",children:"Analytics"}),s&&h.jsx("p",{className:"text-xs text-muted-foreground",children:s.period.label})]}),h.jsx(bX,{period:t,from:r,to:o,onChange:v})]}),u&&h.jsx(vje,{}),!u&&c&&h.jsx(xje,{message:`Failed to load analytics: ${c}`,onRetry:y}),!u&&!c&&s&&h.jsxs("div",{className:"space-y-6",children:[h.jsx(kX,{kpi:s.kpi}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsx(ZPe,{data:s.costTimeline}),h.jsx(tje,{data:s.statusBreakdown}),h.jsx(oje,{data:s.durationHistogram,percentiles:s.durationPercentiles}),h.jsx(sje,{data:s.tokenEfficiency})]}),h.jsx(cje,{data:s.commandPerformance}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsx(pje,{data:s.dailyThroughput}),h.jsx(gje,{data:s.costPerCommand})]}),h.jsx(yje,{data:s.bonusMetrics})]})]})}function bje({project:e,onRemove:t}){return h.jsxs("div",{className:"flex items-center gap-3 p-2.5 rounded-md border border-border",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-xs font-medium truncate",children:e.name}),h.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:e.path})]}),h.jsx(je,{size:"sm",variant:"ghost",className:"h-6 px-2 text-[10px] text-muted-foreground hover:text-destructive shrink-0",onClick:()=>t(e.id),children:"Remove"})]})}function wje({open:e,onClose:t}){const{projects:n,removeProject:r}=Ni(),[i,o]=k.useState(null),[a,s]=k.useState(!0);k.useEffect(()=>{if(!e)return;s(!0);async function u(){try{const f=await fetch("/api/hub/settings");if(f.ok){const c=await f.json();o(c)}}catch{}finally{s(!1)}}u()},[e]);async function l(u){try{await r(u),nt.success("Project removed")}catch(f){nt.error("Failed to remove project",{description:f.message})}}return h.jsx(Wc,{open:e,onOpenChange:u=>{u||t()},children:h.jsxs(cl,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[h.jsxs(fl,{children:[h.jsxs(dl,{className:"flex items-center gap-2",children:[h.jsx(Y0,{className:"w-4 h-4"}),"Hub Settings"]}),h.jsx(xw,{children:"Manage registered projects and view hub information."})]}),a?h.jsxs("div",{className:"space-y-3 py-2",children:[h.jsx("div",{className:"h-20 bg-muted/30 rounded-lg animate-pulse"}),h.jsx("div",{className:"h-16 bg-muted/30 rounded-lg animate-pulse"})]}):h.jsxs("div",{className:"space-y-5 py-2",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Registered Projects"}),n.length===0?h.jsx("div",{className:"rounded-md border border-dashed border-border p-4 text-center",children:h.jsx("p",{className:"text-xs text-muted-foreground",children:"No projects registered yet"})}):h.jsx("div",{className:"space-y-1.5",children:n.map(u=>h.jsx(bje,{project:u,onRemove:l},u.id))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Hub Information"}),h.jsxs("div",{className:"rounded-md border border-border p-3 space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between text-xs",children:[h.jsx("span",{className:"text-muted-foreground",children:"Port"}),h.jsx("span",{className:"font-mono",children:(i==null?void 0:i.port)??4200})]}),h.jsxs("div",{className:"flex items-center justify-between text-xs",children:[h.jsx("span",{className:"text-muted-foreground",children:"Projects"}),h.jsx("span",{className:"font-mono",children:n.length})]}),h.jsxs("div",{className:"flex items-center justify-between text-xs",children:[h.jsx("span",{className:"text-muted-foreground",children:"Hub DB"}),h.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:"~/.specrails/hub.sqlite"})]})]})]})]})]})})}function Sje({project:e}){const t=[{to:"/",end:!0,icon:q2,label:"Home"},{to:"/analytics",end:!1,icon:H2,label:"Analytics"}];return h.jsxs("nav",{className:"flex items-center justify-between h-9 px-3 border-b border-border bg-background/50",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[160px]",children:e.path}),h.jsx("div",{className:"flex items-center gap-0.5",children:t.map(({to:n,end:r,icon:i,label:o})=>h.jsxs(Vo,{to:n,end:r,className:({isActive:a})=>le("h-7 px-2 flex items-center gap-1.5 rounded-md text-xs transition-colors",a?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent"),children:[h.jsx(i,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:o})]},n))}),h.jsxs(wi,{children:[h.jsx(Si,{asChild:!0,children:h.jsx(Vo,{to:"/settings",className:({isActive:n})=>le("h-7 w-7 flex items-center justify-center rounded-md transition-colors",n?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent"),children:h.jsx(Y0,{className:"w-3.5 h-3.5"})})}),h.jsx(Vr,{children:"Project Settings"})]})]})}function kje({project:e}){const{connectionStatus:t}=mw(),n=d$();return h.jsxs(B2,{delayDuration:400,children:[h.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[h.jsx(Sje,{project:e}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("main",{className:"flex-1 overflow-auto",children:h.jsx(LT,{})}),h.jsx(u$,{chat:n})]}),h.jsx(eN,{connectionStatus:t})]}),h.jsx(HT,{position:"bottom-right",toastOptions:{unstyled:!0,classNames:{toast:"glass-card border border-border/30 text-foreground text-xs p-3 rounded-lg flex items-start gap-2 w-[356px]",title:"font-medium",description:"text-muted-foreground mt-0.5"}}})]})}function Oje({onAddProject:e}){return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[400px] gap-6 px-8 text-center",children:[h.jsx("div",{className:"w-14 h-14 rounded-2xl bg-muted/50 flex items-center justify-center",children:h.jsx(Q2,{className:"w-7 h-7 text-muted-foreground"})}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("h2",{className:"text-base font-semibold",children:["Welcome to ",h.jsx("span",{className:"text-dracula-purple",children:"spec"}),h.jsx("span",{className:"text-dracula-pink",children:"rails"})," hub"]}),h.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:"The hub manages multiple projects from a single interface. Add your first project to get started."})]}),h.jsxs(je,{onClick:e,size:"sm",className:"gap-2",children:[h.jsx(G0,{className:"w-3.5 h-3.5"}),"Add your first project"]}),h.jsxs("div",{className:"text-[10px] text-muted-foreground space-y-1",children:[h.jsx("p",{children:"Or register a project from the terminal:"}),h.jsx("code",{className:"font-mono bg-muted/50 px-2 py-0.5 rounded text-xs",children:"srm hub add /path/to/project"})]})]})}function Eje({checkpoint:e,index:t}){const n=e.status==="done",r=e.status==="running",i=e.status==="pending";return h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("div",{className:"flex flex-col items-center flex-shrink-0",children:h.jsx("div",{className:le("w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold border-2 transition-all",n&&"bg-dracula-green/20 border-dracula-green text-dracula-green",r&&"bg-dracula-purple/20 border-dracula-purple text-dracula-purple animate-pulse",i&&"bg-muted/30 border-border text-muted-foreground"),children:n?h.jsx(Gh,{className:"w-3 h-3"}):r?h.jsx(h8,{className:"w-3 h-3"}):h.jsx("span",{children:t+1})})}),h.jsxs("div",{className:"pb-4 flex-1 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsx("span",{className:le("text-xs font-medium",n&&"text-foreground",r&&"text-dracula-purple",i&&"text-muted-foreground"),children:e.name})}),(r||n)&&e.detail&&h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate",children:e.detail})]})]})}function Pje({checkpoints:e,logLines:t}){const[n,r]=k.useState(!1),i=e.filter(s=>s.status==="done").length,o=e.length,a=o>0?Math.round(i/o*100):0;return h.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[h.jsxs("div",{className:"px-4 py-3 border-b border-border/30 flex-shrink-0",children:[h.jsx("h3",{className:"text-xs font-semibold text-foreground mb-2",children:"Setup progress"}),h.jsx("div",{className:"h-1.5 bg-muted/50 rounded-full overflow-hidden",children:h.jsx("div",{className:"h-full bg-dracula-green rounded-full transition-all duration-500",style:{width:`${a}%`}})}),h.jsxs("div",{className:"flex justify-between items-center mt-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[i," of ",o," complete"]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[a,"%"]})]})]}),h.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-0",children:e.map((s,l)=>h.jsxs("div",{className:"relative",children:[h.jsx(Eje,{checkpoint:s,index:l}),l<e.length-1&&h.jsx("div",{className:le("absolute left-[11px] top-6 w-0.5 h-4",s.status==="done"?"bg-dracula-green/40":"bg-border/40")})]},s.key))}),h.jsxs("div",{className:"flex-shrink-0 border-t border-border/30",children:[h.jsxs("button",{className:"w-full flex items-center gap-1.5 px-4 py-2 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>r(s=>!s),children:[n?h.jsx(K0,{className:"w-3 h-3 flex-shrink-0"}):h.jsx(q0,{className:"w-3 h-3 flex-shrink-0"}),"Raw log (",t.length," lines)"]}),n&&h.jsx("div",{className:"max-h-40 overflow-auto px-4 pb-3 font-mono text-[9px] text-muted-foreground space-y-0.5",children:t.slice(-200).map((s,l)=>h.jsx("div",{className:"whitespace-pre-wrap break-all leading-tight",children:s},l))})]})]})}const l_=`prose prose-invert prose-xs max-w-none
|
|
463
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qD(e,t){if(e){if(typeof e=="string")return _b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _b(e,t)}}function jSe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ASe(e){if(Array.isArray(e))return _b(e)}function _b(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function HA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HA(Object(n),!0).forEach(function(r){fe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HA(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fe(e,t,n){return t=GD(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GD(e){var t=_Se(e,"string");return Qs(t)=="symbol"?t:t+""}function _Se(e,t){if(Qs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var CSe={xAxis:["bottom","top"],yAxis:["left","right"]},TSe={width:"100%",height:"100%"},YD={x:0,y:0};function Qf(e){return e}var NSe=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},$Se=function(t,n,r,i){var o=n.find(function(f){return f&&f.index===r});if(o){if(t==="horizontal")return{x:o.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:o.coordinate};if(t==="centric"){var a=o.coordinate,s=i.radius;return B(B(B({},i),qe(i.cx,i.cy,s,a)),{},{angle:a,radius:s})}var l=o.coordinate,u=i.angle;return B(B(B({},i),qe(i.cx,i.cy,l,u)),{},{angle:u,radius:l})}return YD},rg=function(t,n){var r=n.graphicalItems,i=n.dataStartIndex,o=n.dataEndIndex,a=(r??[]).reduce(function(s,l){var u=l.props.data;return u&&u.length?[].concat(Js(s),Js(u)):s},[]);return a.length>0?a:t&&t.length&&X(i)&&X(o)?t.slice(i,o+1):[]};function XD(e){return e==="number"?[0,"auto"]:void 0}var Cb=function(t,n,r,i){var o=t.graphicalItems,a=t.tooltipAxis,s=rg(n,t);return r<0||!o||!o.length||r>=s.length?null:o.reduce(function(l,u){var f,c=(f=u.props.data)!==null&&f!==void 0?f:n;c&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(c=c.slice(t.dataStartIndex,t.dataEndIndex+1));var d;if(a.dataKey&&!a.allowDuplicatedCategory){var p=c===void 0?s:c;d=dp(p,a.dataKey,i)}else d=c&&c[r]||s[r];return d?[].concat(Js(l),[NR(u,d)]):l},[])},VA=function(t,n,r,i){var o=i||{x:t.chartX,y:t.chartY},a=NSe(o,r),s=t.orderedTooltipTicks,l=t.tooltipAxis,u=t.tooltipTicks,f=tme(a,s,u,l);if(f>=0&&u){var c=u[f]&&u[f].value,d=Cb(t,n,f,c),p=$Se(r,s,f,o);return{activeTooltipIndex:f,activeLabel:c,activePayload:d,activeCoordinate:p}}return null},MSe=function(t,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,a=n.axisIdKey,s=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,f=t.layout,c=t.children,d=t.stackOffset,p=PR(f,o);return r.reduce(function(m,g){var v,y=g.type.defaultProps!==void 0?B(B({},g.type.defaultProps),g.props):g.props,x=y.type,b=y.dataKey,O=y.allowDataOverflow,S=y.allowDuplicatedCategory,w=y.scale,E=y.ticks,P=y.includeHidden,_=y[a];if(m[_])return m;var A=rg(t.data,{graphicalItems:i.filter(function(U){var T,Y=a in U.props?U.props[a]:(T=U.type.defaultProps)===null||T===void 0?void 0:T[a];return Y===_}),dataStartIndex:l,dataEndIndex:u}),$=A.length,N,R,F;aSe(y.domain,O,x)&&(N=Hx(y.domain,null,O),p&&(x==="number"||w!=="auto")&&(F=yu(A,b,"category")));var I=XD(x);if(!N||N.length===0){var D,L=(D=y.domain)!==null&&D!==void 0?D:I;if(b){if(N=yu(A,b,x),x==="category"&&p){var M=nee(N);S&&M?(R=N,N=nh(0,$)):S||(N=gj(L,N,g).reduce(function(U,T){return U.indexOf(T)>=0?U:[].concat(Js(U),[T])},[]))}else if(x==="category")S?N=N.filter(function(U){return U!==""&&!me(U)}):N=gj(L,N,g).reduce(function(U,T){return U.indexOf(T)>=0||T===""||me(T)?U:[].concat(Js(U),[T])},[]);else if(x==="number"){var z=ame(A,i.filter(function(U){var T,Y,J=a in U.props?U.props[a]:(T=U.type.defaultProps)===null||T===void 0?void 0:T[a],Z="hide"in U.props?U.props.hide:(Y=U.type.defaultProps)===null||Y===void 0?void 0:Y.hide;return J===_&&(P||!Z)}),b,o,f);z&&(N=z)}p&&(x==="number"||w!=="auto")&&(F=yu(A,b,"category"))}else p?N=nh(0,$):s&&s[_]&&s[_].hasStack&&x==="number"?N=d==="expand"?[0,1]:TR(s[_].stackGroups,l,u):N=ER(A,i.filter(function(U){var T=a in U.props?U.props[a]:U.type.defaultProps[a],Y="hide"in U.props?U.props.hide:U.type.defaultProps.hide;return T===_&&(P||!Y)}),x,f,!0);if(x==="number")N=jb(c,N,_,o,E),L&&(N=Hx(L,N,O));else if(x==="category"&&L){var j=L,W=N.every(function(U){return j.indexOf(U)>=0});W&&(N=j)}}return B(B({},m),{},fe({},_,B(B({},y),{},{axisType:o,domain:N,categoricalDomain:F,duplicateDomain:R,originalDomain:(v=y.domain)!==null&&v!==void 0?v:I,isCategorical:p,layout:f})))},{})},ISe=function(t,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,a=n.axisIdKey,s=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,f=t.layout,c=t.children,d=rg(t.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:u}),p=d.length,m=PR(f,o),g=-1;return r.reduce(function(v,y){var x=y.type.defaultProps!==void 0?B(B({},y.type.defaultProps),y.props):y.props,b=x[a],O=XD("number");if(!v[b]){g++;var S;return m?S=nh(0,p):s&&s[b]&&s[b].hasStack?(S=TR(s[b].stackGroups,l,u),S=jb(c,S,b,o)):(S=Hx(O,ER(d,r.filter(function(w){var E,P,_=a in w.props?w.props[a]:(E=w.type.defaultProps)===null||E===void 0?void 0:E[a],A="hide"in w.props?w.props.hide:(P=w.type.defaultProps)===null||P===void 0?void 0:P.hide;return _===b&&!A}),"number",f),i.defaultProps.allowDataOverflow),S=jb(c,S,b,o)),B(B({},v),{},fe({},b,B(B({axisType:o},i.defaultProps),{},{hide:!0,orientation:vn(CSe,"".concat(o,".").concat(g%2),null),domain:S,originalDomain:O,isCategorical:m,layout:f})))}return v},{})},RSe=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,a=n.graphicalItems,s=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,f=t.children,c="".concat(i,"Id"),d=Mn(f,o),p={};return d&&d.length?p=MSe(t,{axes:d,graphicalItems:a,axisType:i,axisIdKey:c,stackGroups:s,dataStartIndex:l,dataEndIndex:u}):a&&a.length&&(p=ISe(t,{Axis:o,graphicalItems:a,axisType:i,axisIdKey:c,stackGroups:s,dataStartIndex:l,dataEndIndex:u})),p},DSe=function(t){var n=Xi(t),r=si(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Kw(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Wp(n,r)}},KA=function(t){var n=t.children,r=t.defaultShowTooltip,i=Ut(n,Ws),o=0,a=0;return t.data&&t.data.length!==0&&(a=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(a=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!r}},LSe=function(t){return!t||!t.length?!1:t.some(function(n){var r=ui(n&&n.type);return r&&r.indexOf("Bar")>=0})},qA=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},FSe=function(t,n){var r=t.props,i=t.graphicalItems,o=t.xAxisMap,a=o===void 0?{}:o,s=t.yAxisMap,l=s===void 0?{}:s,u=r.width,f=r.height,c=r.children,d=r.margin||{},p=Ut(c,Ws),m=Ut(c,ci),g=Object.keys(l).reduce(function(S,w){var E=l[w],P=E.orientation;return!E.mirror&&!E.hide?B(B({},S),{},fe({},P,S[P]+E.width)):S},{left:d.left||0,right:d.right||0}),v=Object.keys(a).reduce(function(S,w){var E=a[w],P=E.orientation;return!E.mirror&&!E.hide?B(B({},S),{},fe({},P,vn(S,"".concat(P))+E.height)):S},{top:d.top||0,bottom:d.bottom||0}),y=B(B({},v),g),x=y.bottom;p&&(y.bottom+=p.props.height||Ws.defaultProps.height),m&&n&&(y=ime(y,i,r,n));var b=u-y.left-y.right,O=f-y.top-y.bottom;return B(B({brushBottom:x},y),{},{width:Math.max(b,0),height:Math.max(O,0)})},zSe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},C1=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,a=t.validateTooltipEventTypes,s=a===void 0?["axis"]:a,l=t.axisComponents,u=t.legendContent,f=t.formatAxisMap,c=t.defaultProps,d=function(y,x){var b=x.graphicalItems,O=x.stackGroups,S=x.offset,w=x.updateId,E=x.dataStartIndex,P=x.dataEndIndex,_=y.barSize,A=y.layout,$=y.barGap,N=y.barCategoryGap,R=y.maxBarSize,F=qA(A),I=F.numericAxisName,D=F.cateAxisName,L=LSe(b),M=[];return b.forEach(function(z,j){var W=rg(y.data,{graphicalItems:[z],dataStartIndex:E,dataEndIndex:P}),U=z.type.defaultProps!==void 0?B(B({},z.type.defaultProps),z.props):z.props,T=U.dataKey,Y=U.maxBarSize,J=U["".concat(I,"Id")],Z=U["".concat(D,"Id")],Ae={},ae=l.reduce(function(or,ot){var Fn=x["".concat(ot.axisType,"Map")],Oa=U["".concat(ot.axisType,"Id")];Fn&&Fn[Oa]||ot.axisType==="zAxis"||da();var Ea=Fn[Oa];return B(B({},or),{},fe(fe({},ot.axisType,Ea),"".concat(ot.axisType,"Ticks"),si(Ea)))},Ae),K=ae[D],ie=ae["".concat(D,"Ticks")],oe=O&&O[J]&&O[J].hasStack&&mme(z,O[J].stackGroups),V=ui(z.type).indexOf("Bar")>=0,ke=Wp(K,ie),de=[],ze=L&&nme({barSize:_,stackGroups:O,totalSize:zSe(ae,D)});if(V){var De,Ge,Yt=me(Y)?R:Y,et=(De=(Ge=Wp(K,ie,!0))!==null&&Ge!==void 0?Ge:Yt)!==null&&De!==void 0?De:0;de=rme({barGap:$,barCategoryGap:N,bandSize:et!==ke?et:ke,sizeList:ze[Z],maxBarSize:Yt}),et!==ke&&(de=de.map(function(or){return B(B({},or),{},{position:B(B({},or.position),{},{offset:or.position.offset-et/2})})}))}var Qr=z&&z.type&&z.type.getComposedData;Qr&&M.push({props:B(B({},Qr(B(B({},ae),{},{displayedData:W,props:y,dataKey:T,item:z,bandSize:ke,barPosition:de,offset:S,stackedData:oe,layout:A,dataStartIndex:E,dataEndIndex:P}))),{},fe(fe(fe({key:z.key||"item-".concat(j)},I,ae[I]),D,ae[D]),"animationId",w)),childIndex:mee(z,y.children),item:z})}),M},p=function(y,x){var b=y.props,O=y.dataStartIndex,S=y.dataEndIndex,w=y.updateId;if(!ox({props:b}))return null;var E=b.children,P=b.layout,_=b.stackOffset,A=b.data,$=b.reverseStackOrder,N=qA(P),R=N.numericAxisName,F=N.cateAxisName,I=Mn(E,r),D=pme(A,I,"".concat(R,"Id"),"".concat(F,"Id"),_,$),L=l.reduce(function(U,T){var Y="".concat(T.axisType,"Map");return B(B({},U),{},fe({},Y,RSe(b,B(B({},T),{},{graphicalItems:I,stackGroups:T.axisType===R&&D,dataStartIndex:O,dataEndIndex:S}))))},{}),M=FSe(B(B({},L),{},{props:b,graphicalItems:I}),x==null?void 0:x.legendBBox);Object.keys(L).forEach(function(U){L[U]=f(b,L[U],M,U.replace("Map",""),n)});var z=L["".concat(F,"Map")],j=DSe(z),W=d(b,B(B({},L),{},{dataStartIndex:O,dataEndIndex:S,updateId:w,graphicalItems:I,stackGroups:D,offset:M}));return B(B({formattedGraphicalItems:W,graphicalItems:I,offset:M,stackGroups:D},j),L)},m=function(v){function y(x){var b,O,S;return xSe(this,y),S=SSe(this,y,[x]),fe(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),fe(S,"accessibilityManager",new oSe),fe(S,"handleLegendBBoxUpdate",function(w){if(w){var E=S.state,P=E.dataStartIndex,_=E.dataEndIndex,A=E.updateId;S.setState(B({legendBBox:w},p({props:S.props,dataStartIndex:P,dataEndIndex:_,updateId:A},B(B({},S.state),{},{legendBBox:w}))))}}),fe(S,"handleReceiveSyncEvent",function(w,E,P){if(S.props.syncId===w){if(P===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(E)}}),fe(S,"handleBrushChange",function(w){var E=w.startIndex,P=w.endIndex;if(E!==S.state.dataStartIndex||P!==S.state.dataEndIndex){var _=S.state.updateId;S.setState(function(){return B({dataStartIndex:E,dataEndIndex:P},p({props:S.props,dataStartIndex:E,dataEndIndex:P,updateId:_},S.state))}),S.triggerSyncEvent({dataStartIndex:E,dataEndIndex:P})}}),fe(S,"handleMouseEnter",function(w){var E=S.getMouseInfo(w);if(E){var P=B(B({},E),{},{isTooltipActive:!0});S.setState(P),S.triggerSyncEvent(P);var _=S.props.onMouseEnter;ce(_)&&_(P,w)}}),fe(S,"triggeredAfterMouseMove",function(w){var E=S.getMouseInfo(w),P=E?B(B({},E),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(P),S.triggerSyncEvent(P);var _=S.props.onMouseMove;ce(_)&&_(P,w)}),fe(S,"handleItemMouseEnter",function(w){S.setState(function(){return{isTooltipActive:!0,activeItem:w,activePayload:w.tooltipPayload,activeCoordinate:w.tooltipPosition||{x:w.cx,y:w.cy}}})}),fe(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),fe(S,"handleMouseMove",function(w){w.persist(),S.throttleTriggeredAfterMouseMove(w)}),fe(S,"handleMouseLeave",function(w){S.throttleTriggeredAfterMouseMove.cancel();var E={isTooltipActive:!1};S.setState(E),S.triggerSyncEvent(E);var P=S.props.onMouseLeave;ce(P)&&P(E,w)}),fe(S,"handleOuterEvent",function(w){var E=hee(w),P=vn(S.props,"".concat(E));if(E&&ce(P)){var _,A;/.*touch.*/i.test(E)?A=S.getMouseInfo(w.changedTouches[0]):A=S.getMouseInfo(w),P((_=A)!==null&&_!==void 0?_:{},w)}}),fe(S,"handleClick",function(w){var E=S.getMouseInfo(w);if(E){var P=B(B({},E),{},{isTooltipActive:!0});S.setState(P),S.triggerSyncEvent(P);var _=S.props.onClick;ce(_)&&_(P,w)}}),fe(S,"handleMouseDown",function(w){var E=S.props.onMouseDown;if(ce(E)){var P=S.getMouseInfo(w);E(P,w)}}),fe(S,"handleMouseUp",function(w){var E=S.props.onMouseUp;if(ce(E)){var P=S.getMouseInfo(w);E(P,w)}}),fe(S,"handleTouchMove",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(w.changedTouches[0])}),fe(S,"handleTouchStart",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&S.handleMouseDown(w.changedTouches[0])}),fe(S,"handleTouchEnd",function(w){w.changedTouches!=null&&w.changedTouches.length>0&&S.handleMouseUp(w.changedTouches[0])}),fe(S,"handleDoubleClick",function(w){var E=S.props.onDoubleClick;if(ce(E)){var P=S.getMouseInfo(w);E(P,w)}}),fe(S,"handleContextMenu",function(w){var E=S.props.onContextMenu;if(ce(E)){var P=S.getMouseInfo(w);E(P,w)}}),fe(S,"triggerSyncEvent",function(w){S.props.syncId!==void 0&&My.emit(Iy,S.props.syncId,w,S.eventEmitterSymbol)}),fe(S,"applySyncEvent",function(w){var E=S.props,P=E.layout,_=E.syncMethod,A=S.state.updateId,$=w.dataStartIndex,N=w.dataEndIndex;if(w.dataStartIndex!==void 0||w.dataEndIndex!==void 0)S.setState(B({dataStartIndex:$,dataEndIndex:N},p({props:S.props,dataStartIndex:$,dataEndIndex:N,updateId:A},S.state)));else if(w.activeTooltipIndex!==void 0){var R=w.chartX,F=w.chartY,I=w.activeTooltipIndex,D=S.state,L=D.offset,M=D.tooltipTicks;if(!L)return;if(typeof _=="function")I=_(M,w);else if(_==="value"){I=-1;for(var z=0;z<M.length;z++)if(M[z].value===w.activeLabel){I=z;break}}var j=B(B({},L),{},{x:L.left,y:L.top}),W=Math.min(R,j.x+j.width),U=Math.min(F,j.y+j.height),T=M[I]&&M[I].value,Y=Cb(S.state,S.props.data,I),J=M[I]?{x:P==="horizontal"?M[I].coordinate:W,y:P==="horizontal"?U:M[I].coordinate}:YD;S.setState(B(B({},w),{},{activeLabel:T,activeCoordinate:J,activePayload:Y,activeTooltipIndex:I}))}else S.setState(w)}),fe(S,"renderCursor",function(w){var E,P=S.state,_=P.isTooltipActive,A=P.activeCoordinate,$=P.activePayload,N=P.offset,R=P.activeTooltipIndex,F=P.tooltipAxisBandSize,I=S.getTooltipEventType(),D=(E=w.props.active)!==null&&E!==void 0?E:_,L=S.props.layout,M=w.key||"_recharts-cursor";return C.createElement(dSe,{key:M,activeCoordinate:A,activePayload:$,activeTooltipIndex:R,chartName:n,element:w,isActive:D,layout:L,offset:N,tooltipAxisBandSize:F,tooltipEventType:I})}),fe(S,"renderPolarAxis",function(w,E,P){var _=vn(w,"type.axisType"),A=vn(S.state,"".concat(_,"Map")),$=w.type.defaultProps,N=$!==void 0?B(B({},$),w.props):w.props,R=A&&A[N["".concat(_,"Id")]];return k.cloneElement(w,B(B({},R),{},{className:he(_,R.className),key:w.key||"".concat(E,"-").concat(P),ticks:si(R,!0)}))}),fe(S,"renderPolarGrid",function(w){var E=w.props,P=E.radialLines,_=E.polarAngles,A=E.polarRadius,$=S.state,N=$.radiusAxisMap,R=$.angleAxisMap,F=Xi(N),I=Xi(R),D=I.cx,L=I.cy,M=I.innerRadius,z=I.outerRadius;return k.cloneElement(w,{polarAngles:Array.isArray(_)?_:si(I,!0).map(function(j){return j.coordinate}),polarRadius:Array.isArray(A)?A:si(F,!0).map(function(j){return j.coordinate}),cx:D,cy:L,innerRadius:M,outerRadius:z,key:w.key||"polar-grid",radialLines:P})}),fe(S,"renderLegend",function(){var w=S.state.formattedGraphicalItems,E=S.props,P=E.children,_=E.width,A=E.height,$=S.props.margin||{},N=_-($.left||0)-($.right||0),R=kR({children:P,formattedGraphicalItems:w,legendWidth:N,legendContent:u});if(!R)return null;var F=R.item,I=UA(R,pSe);return k.cloneElement(F,B(B({},I),{},{chartWidth:_,chartHeight:A,margin:$,onBBoxUpdate:S.handleLegendBBoxUpdate}))}),fe(S,"renderTooltip",function(){var w,E=S.props,P=E.children,_=E.accessibilityLayer,A=Ut(P,jt);if(!A)return null;var $=S.state,N=$.isTooltipActive,R=$.activeCoordinate,F=$.activePayload,I=$.activeLabel,D=$.offset,L=(w=A.props.active)!==null&&w!==void 0?w:N;return k.cloneElement(A,{viewBox:B(B({},D),{},{x:D.left,y:D.top}),active:L,label:I,payload:L?F:[],coordinate:R,accessibilityLayer:_})}),fe(S,"renderBrush",function(w){var E=S.props,P=E.margin,_=E.data,A=S.state,$=A.offset,N=A.dataStartIndex,R=A.dataEndIndex,F=A.updateId;return k.cloneElement(w,{key:w.key||"_recharts-brush",onChange:Kf(S.handleBrushChange,w.props.onChange),data:_,x:X(w.props.x)?w.props.x:$.left,y:X(w.props.y)?w.props.y:$.top+$.height+$.brushBottom-(P.bottom||0),width:X(w.props.width)?w.props.width:$.width,startIndex:N,endIndex:R,updateId:"brush-".concat(F)})}),fe(S,"renderReferenceElement",function(w,E,P){if(!w)return null;var _=S,A=_.clipPathId,$=S.state,N=$.xAxisMap,R=$.yAxisMap,F=$.offset,I=w.type.defaultProps||{},D=w.props,L=D.xAxisId,M=L===void 0?I.xAxisId:L,z=D.yAxisId,j=z===void 0?I.yAxisId:z;return k.cloneElement(w,{key:w.key||"".concat(E,"-").concat(P),xAxis:N[M],yAxis:R[j],viewBox:{x:F.left,y:F.top,width:F.width,height:F.height},clipPathId:A})}),fe(S,"renderActivePoints",function(w){var E=w.item,P=w.activePoint,_=w.basePoint,A=w.childIndex,$=w.isRange,N=[],R=E.props.key,F=E.item.type.defaultProps!==void 0?B(B({},E.item.type.defaultProps),E.item.props):E.item.props,I=F.activeDot,D=F.dataKey,L=B(B({index:A,dataKey:D,cx:P.x,cy:P.y,r:4,fill:v1(E.item),strokeWidth:2,stroke:"#fff",payload:P.payload,value:P.value},se(I,!1)),pp(I));return N.push(y.renderActiveDot(I,L,"".concat(R,"-activePoint-").concat(A))),_?N.push(y.renderActiveDot(I,B(B({},L),{},{cx:_.x,cy:_.y}),"".concat(R,"-basePoint-").concat(A))):$&&N.push(null),N}),fe(S,"renderGraphicChild",function(w,E,P){var _=S.filterFormatItem(w,E,P);if(!_)return null;var A=S.getTooltipEventType(),$=S.state,N=$.isTooltipActive,R=$.tooltipAxis,F=$.activeTooltipIndex,I=$.activeLabel,D=S.props.children,L=Ut(D,jt),M=_.props,z=M.points,j=M.isRange,W=M.baseLine,U=_.item.type.defaultProps!==void 0?B(B({},_.item.type.defaultProps),_.item.props):_.item.props,T=U.activeDot,Y=U.hide,J=U.activeBar,Z=U.activeShape,Ae=!!(!Y&&N&&L&&(T||J||Z)),ae={};A!=="axis"&&L&&L.props.trigger==="click"?ae={onClick:Kf(S.handleItemMouseEnter,w.props.onClick)}:A!=="axis"&&(ae={onMouseLeave:Kf(S.handleItemMouseLeave,w.props.onMouseLeave),onMouseEnter:Kf(S.handleItemMouseEnter,w.props.onMouseEnter)});var K=k.cloneElement(w,B(B({},_.props),ae));function ie(ot){return typeof R.dataKey=="function"?R.dataKey(ot.payload):null}if(Ae)if(F>=0){var oe,V;if(R.dataKey&&!R.allowDuplicatedCategory){var ke=typeof R.dataKey=="function"?ie:"payload.".concat(R.dataKey.toString());oe=dp(z,ke,I),V=j&&W&&dp(W,ke,I)}else oe=z==null?void 0:z[F],V=j&&W&&W[F];if(Z||J){var de=w.props.activeIndex!==void 0?w.props.activeIndex:F;return[k.cloneElement(w,B(B(B({},_.props),ae),{},{activeIndex:de})),null,null]}if(!me(oe))return[K].concat(Js(S.renderActivePoints({item:_,activePoint:oe,basePoint:V,childIndex:F,isRange:j})))}else{var ze,De=(ze=S.getItemByXY(S.state.activeCoordinate))!==null&&ze!==void 0?ze:{graphicalItem:K},Ge=De.graphicalItem,Yt=Ge.item,et=Yt===void 0?w:Yt,Qr=Ge.childIndex,or=B(B(B({},_.props),ae),{},{activeIndex:Qr});return[k.cloneElement(et,or),null,null]}return j?[K,null,null]:[K,null]}),fe(S,"renderCustomized",function(w,E,P){return k.cloneElement(w,B(B({key:"recharts-customized-".concat(P)},S.props),S.state))}),fe(S,"renderMap",{CartesianGrid:{handler:Qf,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:Qf},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:Qf},YAxis:{handler:Qf},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((b=x.id)!==null&&b!==void 0?b:ba("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=kI(S.triggeredAfterMouseMove,(O=x.throttleDelay)!==null&&O!==void 0?O:1e3/60),S.state={},S}return ESe(y,v),wSe(y,[{key:"componentDidMount",value:function(){var b,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var b=this.props,O=b.children,S=b.data,w=b.height,E=b.layout,P=Ut(O,jt);if(P){var _=P.props.defaultIndex;if(!(typeof _!="number"||_<0||_>this.state.tooltipTicks.length-1)){var A=this.state.tooltipTicks[_]&&this.state.tooltipTicks[_].value,$=Cb(this.state,S,_,A),N=this.state.tooltipTicks[_].coordinate,R=(this.state.offset.top+w)/2,F=E==="horizontal",I=F?{x:N,y:R}:{y:N,x:R},D=this.state.formattedGraphicalItems.find(function(M){var z=M.item;return z.type.name==="Scatter"});D&&(I=B(B({},I),D.props.points[_].tooltipPosition),$=D.props.points[_].tooltipPayload);var L={activeTooltipIndex:_,isTooltipActive:!0,activeLabel:A,activePayload:$,activeCoordinate:I};this.setState(L),this.renderCursor(P),this.accessibilityManager.setIndex(_)}}}},{key:"getSnapshotBeforeUpdate",value:function(b,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==b.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==b.margin){var S,w;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0}})}return null}},{key:"componentDidUpdate",value:function(b){ax([Ut(b.children,jt)],[Ut(this.props.children,jt)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var b=Ut(this.props.children,jt);if(b&&typeof b.props.shared=="boolean"){var O=b.props.shared?"axis":"item";return s.indexOf(O)>=0?O:o}return o}},{key:"getMouseInfo",value:function(b){if(!this.container)return null;var O=this.container,S=O.getBoundingClientRect(),w=_ce(S),E={chartX:Math.round(b.pageX-w.left),chartY:Math.round(b.pageY-w.top)},P=S.width/O.offsetWidth||1,_=this.inRange(E.chartX,E.chartY,P);if(!_)return null;var A=this.state,$=A.xAxisMap,N=A.yAxisMap,R=this.getTooltipEventType(),F=VA(this.state,this.props.data,this.props.layout,_);if(R!=="axis"&&$&&N){var I=Xi($).scale,D=Xi(N).scale,L=I&&I.invert?I.invert(E.chartX):null,M=D&&D.invert?D.invert(E.chartY):null;return B(B({},E),{},{xValue:L,yValue:M},F)}return F?B(B({},E),F):null}},{key:"inRange",value:function(b,O){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,w=this.props.layout,E=b/S,P=O/S;if(w==="horizontal"||w==="vertical"){var _=this.state.offset,A=E>=_.left&&E<=_.left+_.width&&P>=_.top&&P<=_.top+_.height;return A?{x:E,y:P}:null}var $=this.state,N=$.angleAxisMap,R=$.radiusAxisMap;if(N&&R){var F=Xi(N);return xj({x:E,y:P},F)}return null}},{key:"parseEventsOfWrapper",value:function(){var b=this.props.children,O=this.getTooltipEventType(),S=Ut(b,jt),w={};S&&O==="axis"&&(S.props.trigger==="click"?w={onClick:this.handleClick}:w={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var E=pp(this.props,this.handleOuterEvent);return B(B({},E),w)}},{key:"addListener",value:function(){My.on(Iy,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){My.removeListener(Iy,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(b,O,S){for(var w=this.state.formattedGraphicalItems,E=0,P=w.length;E<P;E++){var _=w[E];if(_.item===b||_.props.key===b.key||O===ui(_.item.type)&&S===_.childIndex)return _}return null}},{key:"renderClipPath",value:function(){var b=this.clipPathId,O=this.state.offset,S=O.left,w=O.top,E=O.height,P=O.width;return C.createElement("defs",null,C.createElement("clipPath",{id:b},C.createElement("rect",{x:S,y:w,height:E,width:P})))}},{key:"getXScales",value:function(){var b=this.state.xAxisMap;return b?Object.entries(b).reduce(function(O,S){var w=WA(S,2),E=w[0],P=w[1];return B(B({},O),{},fe({},E,P.scale))},{}):null}},{key:"getYScales",value:function(){var b=this.state.yAxisMap;return b?Object.entries(b).reduce(function(O,S){var w=WA(S,2),E=w[0],P=w[1];return B(B({},O),{},fe({},E,P.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(b){var O;return(O=this.state.xAxisMap)===null||O===void 0||(O=O[b])===null||O===void 0?void 0:O.scale}},{key:"getYScaleByAxisId",value:function(b){var O;return(O=this.state.yAxisMap)===null||O===void 0||(O=O[b])===null||O===void 0?void 0:O.scale}},{key:"getItemByXY",value:function(b){var O=this.state,S=O.formattedGraphicalItems,w=O.activeItem;if(S&&S.length)for(var E=0,P=S.length;E<P;E++){var _=S[E],A=_.props,$=_.item,N=$.type.defaultProps!==void 0?B(B({},$.type.defaultProps),$.props):$.props,R=ui($.type);if(R==="Bar"){var F=(A.data||[]).find(function(M){return hve(b,M)});if(F)return{graphicalItem:_,payload:F}}else if(R==="RadialBar"){var I=(A.data||[]).find(function(M){return xj(b,M)});if(I)return{graphicalItem:_,payload:I}}else if(Xm(_,w)||Qm(_,w)||bc(_,w)){var D=Zxe({graphicalItem:_,activeTooltipItem:w,itemData:N.data}),L=N.activeIndex===void 0?D:N.activeIndex;return{graphicalItem:B(B({},_),{},{childIndex:L}),payload:bc(_,w)?N.data[D]:_.props.data[D]}}}return null}},{key:"render",value:function(){var b=this;if(!ox(this))return null;var O=this.props,S=O.children,w=O.className,E=O.width,P=O.height,_=O.style,A=O.compact,$=O.title,N=O.desc,R=UA(O,hSe),F=se(R,!1);if(A)return C.createElement(OA,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},C.createElement(hp,ts({},F,{width:E,height:P,title:$,desc:N}),this.renderClipPath(),fE(S,this.renderMap)));if(this.props.accessibilityLayer){var I,D;F.tabIndex=(I=this.props.tabIndex)!==null&&I!==void 0?I:0,F.role=(D=this.props.role)!==null&&D!==void 0?D:"application",F.onKeyDown=function(M){b.accessibilityManager.keyboardEvent(M)},F.onFocus=function(){b.accessibilityManager.focus()}}var L=this.parseEventsOfWrapper();return C.createElement(OA,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},C.createElement("div",ts({className:he("recharts-wrapper",w),style:B({position:"relative",cursor:"default",width:E,height:P},_)},L,{ref:function(z){b.container=z}}),C.createElement(hp,ts({},F,{width:E,height:P,title:$,desc:N,style:TSe}),this.renderClipPath(),fE(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(k.Component);fe(m,"displayName",n),fe(m,"defaultProps",B({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},c)),fe(m,"getDerivedStateFromProps",function(v,y){var x=v.dataKey,b=v.data,O=v.children,S=v.width,w=v.height,E=v.layout,P=v.stackOffset,_=v.margin,A=y.dataStartIndex,$=y.dataEndIndex;if(y.updateId===void 0){var N=KA(v);return B(B(B({},N),{},{updateId:0},p(B(B({props:v},N),{},{updateId:0}),y)),{},{prevDataKey:x,prevData:b,prevWidth:S,prevHeight:w,prevLayout:E,prevStackOffset:P,prevMargin:_,prevChildren:O})}if(x!==y.prevDataKey||b!==y.prevData||S!==y.prevWidth||w!==y.prevHeight||E!==y.prevLayout||P!==y.prevStackOffset||!fs(_,y.prevMargin)){var R=KA(v),F={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},I=B(B({},VA(y,b,E)),{},{updateId:y.updateId+1}),D=B(B(B({},R),F),I);return B(B(B({},D),p(B({props:v},D),y)),{},{prevDataKey:x,prevData:b,prevWidth:S,prevHeight:w,prevLayout:E,prevStackOffset:P,prevMargin:_,prevChildren:O})}if(!ax(O,y.prevChildren)){var L,M,z,j,W=Ut(O,Ws),U=W&&(L=(M=W.props)===null||M===void 0?void 0:M.startIndex)!==null&&L!==void 0?L:A,T=W&&(z=(j=W.props)===null||j===void 0?void 0:j.endIndex)!==null&&z!==void 0?z:$,Y=U!==A||T!==$,J=!me(b),Z=J&&!Y?y.updateId:y.updateId+1;return B(B({updateId:Z},p(B(B({props:v},y),{},{updateId:Z,dataStartIndex:U,dataEndIndex:T}),y)),{},{prevChildren:O,dataStartIndex:U,dataEndIndex:T})}return null}),fe(m,"renderActiveDot",function(v,y,x){var b;return k.isValidElement(v)?b=k.cloneElement(v,y):ce(v)?b=v(y):b=C.createElement(Vm,y),C.createElement(Oe,{className:"recharts-active-dot",key:x},b)});var g=k.forwardRef(function(y,x){return C.createElement(m,ts({},y,{ref:x}))});return g.displayName=m.displayName,g},BSe=C1({chartName:"LineChart",GraphicalChild:Jc,axisComponents:[{axisType:"xAxis",AxisComp:Oo},{axisType:"yAxis",AxisComp:Eo}],formatAxisMap:mD}),T1=C1({chartName:"BarChart",GraphicalChild:Qn,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Oo},{axisType:"yAxis",AxisComp:Eo}],formatAxisMap:mD}),WSe=C1({chartName:"PieChart",GraphicalChild:Ii,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Ym},{axisType:"radiusAxis",AxisComp:qm}],formatAxisMap:Eme,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function USe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var HSe=USe,VSe=b1,KSe=am,qSe=Object.prototype,GSe=qSe.hasOwnProperty;function YSe(e,t,n){var r=e[t];(!(GSe.call(e,t)&&KSe(r,n))||n===void 0&&!(t in e))&&VSe(e,t,n)}var QD=YSe,XSe=QD,QSe=b1;function JSe(e,t,n,r){var i=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],l=r?r(n[s],e[s],s,n,e):void 0;l===void 0&&(l=e[s]),i?QSe(n,s,l):XSe(n,s,l)}return n}var Zc=JSe,ZSe=Zc,eke=wl;function tke(e,t){return e&&ZSe(t,eke(t),e)}var nke=tke;function rke(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ike=rke,oke=_r,ake=Ww,ske=ike,lke=Object.prototype,uke=lke.hasOwnProperty;function cke(e){if(!oke(e))return ske(e);var t=ake(e),n=[];for(var r in e)r=="constructor"&&(t||!uke.call(e,r))||n.push(r);return n}var fke=cke,dke=eI,pke=fke,hke=bl;function mke(e){return hke(e)?dke(e,!0):pke(e)}var N1=mke,gke=Zc,yke=N1;function vke(e,t){return e&&gke(t,yke(t),e)}var xke=vke,gh={exports:{}};gh.exports;(function(e,t){var n=jr,r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,a=o?n.Buffer:void 0,s=a?a.allocUnsafe:void 0;function l(u,f){if(f)return u.slice();var c=u.length,d=s?s(c):new u.constructor(c);return u.copy(d),d}e.exports=l})(gh,gh.exports);var bke=gh.exports;function wke(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Ske=wke,kke=Zc,Oke=Rw;function Eke(e,t){return kke(e,Oke(e),t)}var Pke=Eke,jke=Iw,Ake=x1,_ke=Rw,Cke=QM,Tke=Object.getOwnPropertySymbols,Nke=Tke?function(e){for(var t=[];e;)jke(t,_ke(e)),e=Ake(e);return t}:Cke,JD=Nke,$ke=Zc,Mke=JD;function Ike(e,t){return $ke(e,Mke(e),t)}var Rke=Ike,Dke=XM,Lke=JD,Fke=N1;function zke(e){return Dke(e,Fke,Lke)}var ZD=zke,Bke=Object.prototype,Wke=Bke.hasOwnProperty;function Uke(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Wke.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var Hke=Uke,GA=YM;function Vke(e){var t=new e.constructor(e.byteLength);return new GA(t).set(new GA(e)),t}var $1=Vke,Kke=$1;function qke(e,t){var n=t?Kke(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Gke=qke,Yke=/\w*$/;function Xke(e){var t=new e.constructor(e.source,Yke.exec(e));return t.lastIndex=e.lastIndex,t}var Qke=Xke,YA=pl,XA=YA?YA.prototype:void 0,QA=XA?XA.valueOf:void 0;function Jke(e){return QA?Object(QA.call(e)):{}}var Zke=Jke,eOe=$1;function tOe(e,t){var n=t?eOe(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var nOe=tOe,rOe=$1,iOe=Gke,oOe=Qke,aOe=Zke,sOe=nOe,lOe="[object Boolean]",uOe="[object Date]",cOe="[object Map]",fOe="[object Number]",dOe="[object RegExp]",pOe="[object Set]",hOe="[object String]",mOe="[object Symbol]",gOe="[object ArrayBuffer]",yOe="[object DataView]",vOe="[object Float32Array]",xOe="[object Float64Array]",bOe="[object Int8Array]",wOe="[object Int16Array]",SOe="[object Int32Array]",kOe="[object Uint8Array]",OOe="[object Uint8ClampedArray]",EOe="[object Uint16Array]",POe="[object Uint32Array]";function jOe(e,t,n){var r=e.constructor;switch(t){case gOe:return rOe(e);case lOe:case uOe:return new r(+e);case yOe:return iOe(e,n);case vOe:case xOe:case bOe:case wOe:case SOe:case kOe:case OOe:case EOe:case POe:return sOe(e,n);case cOe:return new r;case fOe:case hOe:return new r(e);case dOe:return oOe(e);case pOe:return new r;case mOe:return aOe(e)}}var AOe=jOe,_Oe=_r,JA=Object.create,COe=function(){function e(){}return function(t){if(!_Oe(t))return{};if(JA)return JA(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),TOe=COe,NOe=TOe,$Oe=x1,MOe=Ww;function IOe(e){return typeof e.constructor=="function"&&!MOe(e)?NOe($Oe(e)):{}}var ROe=IOe,DOe=_m,LOe=Ar,FOe="[object Map]";function zOe(e){return LOe(e)&&DOe(e)==FOe}var BOe=zOe,WOe=BOe,UOe=Am,ZA=Bw,e_=ZA&&ZA.isMap,HOe=e_?UOe(e_):WOe,VOe=HOe,KOe=_m,qOe=Ar,GOe="[object Set]";function YOe(e){return qOe(e)&&KOe(e)==GOe}var XOe=YOe,QOe=XOe,JOe=Am,t_=Bw,n_=t_&&t_.isSet,ZOe=n_?JOe(n_):QOe,eEe=ZOe,tEe=$w,nEe=HSe,rEe=QD,iEe=nke,oEe=xke,aEe=bke,sEe=Ske,lEe=Pke,uEe=Rke,cEe=nI,fEe=ZD,dEe=_m,pEe=Hke,hEe=AOe,mEe=ROe,gEe=an,yEe=Lw,vEe=VOe,xEe=_r,bEe=eEe,wEe=wl,SEe=N1,kEe=1,OEe=2,EEe=4,eL="[object Arguments]",PEe="[object Array]",jEe="[object Boolean]",AEe="[object Date]",_Ee="[object Error]",tL="[object Function]",CEe="[object GeneratorFunction]",TEe="[object Map]",NEe="[object Number]",nL="[object Object]",$Ee="[object RegExp]",MEe="[object Set]",IEe="[object String]",REe="[object Symbol]",DEe="[object WeakMap]",LEe="[object ArrayBuffer]",FEe="[object DataView]",zEe="[object Float32Array]",BEe="[object Float64Array]",WEe="[object Int8Array]",UEe="[object Int16Array]",HEe="[object Int32Array]",VEe="[object Uint8Array]",KEe="[object Uint8ClampedArray]",qEe="[object Uint16Array]",GEe="[object Uint32Array]",Be={};Be[eL]=Be[PEe]=Be[LEe]=Be[FEe]=Be[jEe]=Be[AEe]=Be[zEe]=Be[BEe]=Be[WEe]=Be[UEe]=Be[HEe]=Be[TEe]=Be[NEe]=Be[nL]=Be[$Ee]=Be[MEe]=Be[IEe]=Be[REe]=Be[VEe]=Be[KEe]=Be[qEe]=Be[GEe]=!0;Be[_Ee]=Be[tL]=Be[DEe]=!1;function jd(e,t,n,r,i,o){var a,s=t&kEe,l=t&OEe,u=t&EEe;if(n&&(a=i?n(e,r,i,o):n(e)),a!==void 0)return a;if(!xEe(e))return e;var f=gEe(e);if(f){if(a=pEe(e),!s)return sEe(e,a)}else{var c=dEe(e),d=c==tL||c==CEe;if(yEe(e))return aEe(e,s);if(c==nL||c==eL||d&&!i){if(a=l||d?{}:mEe(e),!s)return l?uEe(e,oEe(a,e)):lEe(e,iEe(a,e))}else{if(!Be[c])return i?e:{};a=hEe(e,c,s)}}o||(o=new tEe);var p=o.get(e);if(p)return p;o.set(e,a),bEe(e)?e.forEach(function(v){a.add(jd(v,t,n,v,e,o))}):vEe(e)&&e.forEach(function(v,y){a.set(y,jd(v,t,n,y,e,o))});var m=u?l?fEe:cEe:l?SEe:wEe,g=f?void 0:m(e);return nEe(g||e,function(v,y){g&&(y=v,v=e[y]),rEe(a,y,jd(v,t,n,y,e,o))}),a}var YEe=jd,XEe=dm,QEe=vM;function JEe(e,t){return t.length<2?e:XEe(e,QEe(t,0,-1))}var ZEe=JEe,ePe=fm,tPe=DR,nPe=ZEe,rPe=Hc,iPe=Object.prototype,oPe=iPe.hasOwnProperty;function aPe(e,t){t=ePe(t,e);var n=-1,r=t.length;if(!r)return!0;for(var i=e==null||typeof e!="object"&&typeof e!="function";++n<r;){var o=t[n];if(typeof o=="string"){if(o==="__proto__"&&!oPe.call(e,"__proto__"))return!1;if(o==="constructor"&&n+1<r&&typeof t[n+1]=="string"&&t[n+1]==="prototype"){if(i&&n===0)continue;return!1}}}var a=nPe(e,t);return a==null||delete a[rPe(tPe(t))]}var sPe=aPe,lPe=nD;function uPe(e){return lPe(e)?void 0:e}var cPe=uPe,fPe=Hw;function dPe(e){var t=e==null?0:e.length;return t?fPe(e,1):[]}var pPe=dPe,hPe=pPe,mPe=mI,gPe=yI;function yPe(e){return gPe(mPe(e,void 0,hPe),e+"")}var vPe=yPe,xPe=cm,bPe=YEe,wPe=sPe,SPe=fm,kPe=Zc,OPe=cPe,EPe=vPe,PPe=ZD,jPe=1,APe=2,_Pe=4,CPe=EPe(function(e,t){var n={};if(e==null)return n;var r=!1;t=xPe(t,function(o){return o=SPe(o,e),r||(r=o.length>1),o}),kPe(e,PPe(e),n),r&&(n=bPe(n,jPe|APe|_Pe,OPe));for(var i=t.length;i--;)wPe(n,t[i]);return n}),TPe=CPe;const NPe=Ce(TPe);var $Pe=["#1890FF","#66B5FF","#41D9C7","#2FC25B","#6EDB8F","#9AE65C","#FACC14","#E6965C","#57AD71","#223273","#738AE6","#7564CC","#8543E0","#A877ED","#5C8EE6","#13C2C2","#70E0E0","#5CA3E6","#3436C7","#8082FF","#DD81E6","#F04864","#FA7D92","#D598D9"],MPe=["width","height","className","style","children","type"];function Zs(e){"@babel/helpers - typeof";return Zs=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},Zs(e)}function yh(){return yh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yh.apply(this,arguments)}function IPe(e,t){if(e==null)return{};var n=RPe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function RPe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function DPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r_(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,iL(r.key),r)}}function LPe(e,t,n){return t&&r_(e.prototype,t),n&&r_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function FPe(e,t,n){return t=vh(t),zPe(e,rL()?Reflect.construct(t,n||[],vh(e).constructor):t.apply(e,n))}function zPe(e,t){if(t&&(Zs(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BPe(e)}function BPe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rL=function(){return!!e})()}function vh(e){return vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},vh(e)}function WPe(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&&Tb(e,t)}function Tb(e,t){return Tb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Tb(e,t)}function i_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?i_(Object(n),!0).forEach(function(r){pi(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pi(e,t,n){return t=iL(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iL(e){var t=UPe(e,"string");return Zs(t)=="symbol"?t:t+""}function UPe(e,t){if(Zs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var jc="value",Dy=function e(t){var n=t.depth,r=t.node,i=t.index,o=t.valueKey,a=r.children,s=n+1,l=a&&a.length?a.map(function(f,c){return e({depth:s,node:f,index:c,valueKey:o})}):null,u;return a&&a.length?u=l.reduce(function(f,c){return f+c[jc]},0):u=xa(r[o])||r[o]<=0?0:r[o],Ue(Ue({},r),{},pi(pi(pi({children:l},jc,u),"depth",n),"index",i))},HPe=function(t){return{x:t.x,y:t.y,width:t.width,height:t.height}},VPe=function(t,n){var r=n<0?0:n;return t.map(function(i){var o=i[jc]*r;return Ue(Ue({},i),{},{area:xa(o)||o<=0?0:o})})},KPe=function(t,n,r){var i=n*n,o=t.area*t.area,a=t.reduce(function(u,f){return{min:Math.min(u.min,f.area),max:Math.max(u.max,f.area)}},{min:1/0,max:0}),s=a.min,l=a.max;return o?Math.max(i*l*r/o,o/(i*s*r)):1/0},qPe=function(t,n,r,i){var o=n?Math.round(t.area/n):0;(i||o>r.height)&&(o=r.height);for(var a=r.x,s,l=0,u=t.length;l<u;l++)s=t[l],s.x=a,s.y=r.y,s.height=o,s.width=Math.min(o?Math.round(s.area/o):0,r.x+r.width-a),a+=s.width;return s.width+=r.x+r.width-a,Ue(Ue({},r),{},{y:r.y+o,height:r.height-o})},GPe=function(t,n,r,i){var o=n?Math.round(t.area/n):0;(i||o>r.width)&&(o=r.width);for(var a=r.y,s,l=0,u=t.length;l<u;l++)s=t[l],s.x=r.x,s.y=a,s.width=o,s.height=Math.min(o?Math.round(s.area/o):0,r.y+r.height-a),a+=s.height;return s&&(s.height+=r.y+r.height-a),Ue(Ue({},r),{},{x:r.x+o,width:r.width-o})},o_=function(t,n,r,i){return n===r.width?qPe(t,n,r,i):GPe(t,n,r,i)},Ly=function e(t,n){var r=t.children;if(r&&r.length){var i=HPe(t),o=[],a=1/0,s,l,u=Math.min(i.width,i.height),f=VPe(r,i.width*i.height/t[jc]),c=f.slice();for(o.area=0;c.length>0;)o.push(s=c[0]),o.area+=s.area,l=KPe(o,u,n),l<=a?(c.shift(),a=l):(o.area-=o.pop().area,i=o_(o,u,i,!1),u=Math.min(i.width,i.height),o.length=o.area=0,a=1/0);return o.length&&(i=o_(o,u,i,!0),o.length=o.area=0),Ue(Ue({},t),{},{children:f.map(function(d){return e(d,n)})})}return t},YPe={isTooltipActive:!1,isAnimationFinished:!1,activeNode:null,formatRoot:null,currentRoot:null,nestIndex:[]},M1=function(e){function t(){var n;DPe(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=FPe(this,t,[].concat(i)),pi(n,"state",Ue({},YPe)),pi(n,"handleAnimationEnd",function(){var a=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),ce(a)&&a()}),pi(n,"handleAnimationStart",function(){var a=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),ce(a)&&a()}),n}return WPe(t,e),LPe(t,[{key:"handleMouseEnter",value:function(r,i){i.persist();var o=this.props,a=o.onMouseEnter,s=o.children,l=Ut(s,jt);l?this.setState({isTooltipActive:!0,activeNode:r},function(){a&&a(r,i)}):a&&a(r,i)}},{key:"handleMouseLeave",value:function(r,i){i.persist();var o=this.props,a=o.onMouseLeave,s=o.children,l=Ut(s,jt);l?this.setState({isTooltipActive:!1,activeNode:null},function(){a&&a(r,i)}):a&&a(r,i)}},{key:"handleClick",value:function(r){var i=this.props,o=i.onClick,a=i.type;if(a==="nest"&&r.children){var s=this.props,l=s.width,u=s.height,f=s.dataKey,c=s.aspectRatio,d=Dy({depth:0,node:Ue(Ue({},r),{},{x:0,y:0,width:l,height:u}),index:0,valueKey:f}),p=Ly(d,c),m=this.state.nestIndex;m.push(r),this.setState({formatRoot:p,currentRoot:d,nestIndex:m})}o&&o(r)}},{key:"handleNestIndex",value:function(r,i){var o=this.state.nestIndex,a=this.props,s=a.width,l=a.height,u=a.dataKey,f=a.aspectRatio,c=Dy({depth:0,node:Ue(Ue({},r),{},{x:0,y:0,width:s,height:l}),index:0,valueKey:u}),d=Ly(c,f);o=o.slice(0,i+1),this.setState({formatRoot:d,currentRoot:r,nestIndex:o})}},{key:"renderItem",value:function(r,i,o){var a=this,s=this.props,l=s.isAnimationActive,u=s.animationBegin,f=s.animationDuration,c=s.animationEasing,d=s.isUpdateAnimationActive,p=s.type,m=s.animationId,g=s.colorPanel,v=this.state.isAnimationFinished,y=i.width,x=i.height,b=i.x,O=i.y,S=i.depth,w=parseInt("".concat((Math.random()*2-1)*y),10),E={};return(o||p==="nest")&&(E={onMouseEnter:this.handleMouseEnter.bind(this,i),onMouseLeave:this.handleMouseLeave.bind(this,i),onClick:this.handleClick.bind(this,i)}),l?C.createElement(tr,{begin:u,duration:f,isActive:l,easing:c,key:"treemap-".concat(m),from:{x:b,y:O,width:y,height:x},to:{x:b,y:O,width:y,height:x},onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(P){var _=P.x,A=P.y,$=P.width,N=P.height;return C.createElement(tr,{from:"translate(".concat(w,"px, ").concat(w,"px)"),to:"translate(0, 0)",attributeName:"transform",begin:u,easing:c,isActive:l,duration:f},C.createElement(Oe,E,function(){return S>2&&!v?null:a.constructor.renderContentItem(r,Ue(Ue({},i),{},{isAnimationActive:l,isUpdateAnimationActive:!d,width:$,height:N,x:_,y:A}),p,g)}()))}):C.createElement(Oe,E,this.constructor.renderContentItem(r,Ue(Ue({},i),{},{isAnimationActive:!1,isUpdateAnimationActive:!1,width:y,height:x,x:b,y:O}),p,g))}},{key:"renderNode",value:function(r,i){var o=this,a=this.props,s=a.content,l=a.type,u=Ue(Ue(Ue({},se(this.props,!1)),i),{},{root:r}),f=!i.children||!i.children.length,c=this.state.currentRoot,d=(c.children||[]).filter(function(p){return p.depth===i.depth&&p.name===i.name});return!d.length&&r.depth&&l==="nest"?null:C.createElement(Oe,{key:"recharts-treemap-node-".concat(u.x,"-").concat(u.y,"-").concat(u.name),className:"recharts-treemap-depth-".concat(i.depth)},this.renderItem(s,u,f),i.children&&i.children.length?i.children.map(function(p){return o.renderNode(i,p)}):null)}},{key:"renderAllNodes",value:function(){var r=this.state.formatRoot;return r?this.renderNode(r,r):null}},{key:"renderTooltip",value:function(){var r=this.props,i=r.children,o=r.nameKey,a=Ut(i,jt);if(!a)return null;var s=this.props,l=s.width,u=s.height,f=this.state,c=f.isTooltipActive,d=f.activeNode,p={x:0,y:0,width:l,height:u},m=d?{x:d.x+d.width/2,y:d.y+d.height/2}:null,g=c&&d?[{payload:d,name:dt(d,o,""),value:dt(d,jc)}]:[];return C.cloneElement(a,{viewBox:p,active:c,coordinate:m,label:"",payload:g})}},{key:"renderNestIndex",value:function(){var r=this,i=this.props,o=i.nameKey,a=i.nestIndexContent,s=this.state.nestIndex;return C.createElement("div",{className:"recharts-treemap-nest-index-wrapper",style:{marginTop:"8px",textAlign:"center"}},s.map(function(l,u){var f=vn(l,o,"root"),c=null;return C.isValidElement(a)&&(c=C.cloneElement(a,l,u)),ce(a)?c=a(l,u):c=f,C.createElement("div",{onClick:r.handleNestIndex.bind(r,l,u),key:"nest-index-".concat(ba()),className:"recharts-treemap-nest-index-box",style:{cursor:"pointer",display:"inline-block",padding:"0 7px",background:"#000",color:"#fff",marginRight:"3px"}},c)}))}},{key:"render",value:function(){if(!ox(this))return null;var r=this.props,i=r.width,o=r.height,a=r.className,s=r.style,l=r.children,u=r.type,f=IPe(r,MPe),c=se(f,!1);return C.createElement("div",{className:he("recharts-wrapper",a),style:Ue(Ue({},s),{},{position:"relative",cursor:"default",width:i,height:o}),role:"region"},C.createElement(hp,yh({},c,{width:i,height:u==="nest"?o-30:o}),this.renderAllNodes(),pee(l)),this.renderTooltip(),u==="nest"&&this.renderNestIndex())}}],[{key:"getDerivedStateFromProps",value:function(r,i){if(r.data!==i.prevData||r.type!==i.prevType||r.width!==i.prevWidth||r.height!==i.prevHeight||r.dataKey!==i.prevDataKey||r.aspectRatio!==i.prevAspectRatio){var o=Dy({depth:0,node:{children:r.data,x:0,y:0,width:r.width,height:r.height},index:0,valueKey:r.dataKey}),a=Ly(o,r.aspectRatio);return Ue(Ue({},i),{},{formatRoot:a,currentRoot:o,nestIndex:[o],prevAspectRatio:r.aspectRatio,prevData:r.data,prevWidth:r.width,prevHeight:r.height,prevDataKey:r.dataKey,prevType:r.type})}return null}},{key:"renderContentItem",value:function(r,i,o,a){if(C.isValidElement(r))return C.cloneElement(r,i);if(ce(r))return r(i);var s=i.x,l=i.y,u=i.width,f=i.height,c=i.index,d=null;u>10&&f>10&&i.children&&o==="nest"&&(d=C.createElement(XR,{points:[{x:s+2,y:l+f/2},{x:s+6,y:l+f/2+3},{x:s+2,y:l+f/2+6}]}));var p=null,m=ds(i.name);u>20&&f>20&&m.width<u&&m.height<f&&(p=C.createElement("text",{x:s+8,y:l+f/2+7,fontSize:14},i.name));var g=a||$Pe;return C.createElement("g",null,C.createElement(Hm,yh({fill:i.depth<2?g[c%g.length]:"rgba(255,255,255,0)",stroke:"#fff"},NPe(i,"children"),{role:"img"})),d,p)}}])}(k.PureComponent);pi(M1,"displayName","Treemap");pi(M1,"defaultProps",{aspectRatio:.5*(1+Math.sqrt(5)),dataKey:"value",type:"flat",isAnimationActive:!Ei.isSsr,isUpdateAnimationActive:!Ei.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"linear"});const _t={purple:"hsl(265 89% 78%)",cyan:"hsl(191 97% 77%)",green:"hsl(135 94% 65%)",pink:"hsl(326 100% 74%)",orange:"hsl(31 100% 71%)",comment:"hsl(225 27% 51%)"},XPe={completed:_t.purple,failed:_t.pink,canceled:_t.orange,running:_t.cyan,queued:_t.comment},a_=[_t.purple,_t.cyan,_t.green,_t.pink,_t.orange];function QPe({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"text-muted-foreground mb-1",children:n}),h.jsxs("p",{className:"font-medium",children:["$",t[0].value.toFixed(4)]})]})}function JPe(e){try{return b$(new Date(e),"MMM d")}catch{return e}}function ZPe({data:e}){if(!(e.length>0&&e.some(i=>i.costUsd>0)))return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Cost Over Time"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No cost data for this period"})]});const n=Math.max(1,Math.floor(e.length/7)),r=e.filter((i,o)=>o%n===0).map(i=>i.date);return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Cost Over Time"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsxs(BSe,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[h.jsx(Qc,{strokeDasharray:"3 3",stroke:"var(--color-border)"}),h.jsx(Oo,{dataKey:"date",ticks:r,tickFormatter:JPe,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1}),h.jsx(Eo,{tickFormatter:i=>`$${i.toFixed(2)}`,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1,width:55}),h.jsx(jt,{content:h.jsx(QPe,{})}),h.jsx(Jc,{type:"monotone",dataKey:"costUsd",stroke:_t.purple,strokeWidth:2,dot:!1,activeDot:{r:3,fill:_t.purple}})]})})]})}function eje({active:e,payload:t}){if(!e||!(t!=null&&t.length))return null;const n=t[0];return h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"capitalize font-medium",children:n.name}),h.jsxs("p",{className:"text-muted-foreground",children:[n.value," jobs"]})]})}function tje({data:e}){if(e.length===0)return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Jobs by Status"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No jobs in this period"})]});const t=e.reduce((n,r)=>n+r.count,0);return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Jobs by Status"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsxs(WSe,{children:[h.jsx(Ii,{data:e,dataKey:"count",nameKey:"status",cx:"50%",cy:"50%",innerRadius:60,outerRadius:90,paddingAngle:2,children:e.map(n=>h.jsx(Nm,{fill:XPe[n.status]??"var(--color-muted-foreground)"},n.status))}),h.jsx(jt,{content:h.jsx(eje,{})}),h.jsx(ci,{formatter:n=>{const r=e.find(o=>o.status===n),i=r?(r.count/t*100).toFixed(0):"0";return h.jsxs("span",{className:"text-xs capitalize",children:[n," (",(r==null?void 0:r.count)??0,", ",i,"%)"]})}})]})})]})}const nje=["<1m","1-3m","3-5m","5-10m",">10m"];function rje(e){if(e===null)return"—";const t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function ije({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"text-muted-foreground mb-1",children:n}),h.jsxs("p",{className:"font-medium",children:[t[0].value," jobs"]})]})}function oje({data:e,percentiles:t}){const n=nje.map(i=>{const o=e.find(a=>a.bucket===i);return{bucket:i,count:(o==null?void 0:o.count)??0}});return n.some(i=>i.count>0)?h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Duration Distribution"}),h.jsx(Ol,{width:"100%",height:180,children:h.jsxs(T1,{data:n,margin:{top:4,right:8,left:0,bottom:0},children:[h.jsx(Qc,{strokeDasharray:"3 3",stroke:"var(--color-border)",vertical:!1}),h.jsx(Oo,{dataKey:"bucket",tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1}),h.jsx(Eo,{allowDecimals:!1,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1,width:30}),h.jsx(jt,{content:h.jsx(ije,{})}),h.jsx(Qn,{dataKey:"count",fill:_t.cyan,radius:[3,3,0,0]})]})}),h.jsx("div",{className:"flex items-center gap-3 mt-2",children:["p50","p75","p95"].map(i=>h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground uppercase",children:[i,":"]}),h.jsx("span",{className:"text-[10px] font-medium tabular-nums",children:rje(t[i])})]},i))})]}):h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Duration Distribution"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No duration data available"})]})}function aje({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"text-muted-foreground mb-1 font-mono truncate max-w-48",children:n}),t.map(r=>h.jsxs("p",{style:{color:r.color},children:[r.name,": ",r.value.toLocaleString()]},r.name))]})}function sje({data:e}){if(e.length===0)return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Token Efficiency"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No token data for this period"})]});const t=e.map(n=>({...n,name:n.command.length>20?`…${n.command.slice(-18)}`:n.command}));return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Token Efficiency"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsxs(T1,{layout:"vertical",data:t,margin:{top:4,right:8,left:0,bottom:0},children:[h.jsx(Qc,{strokeDasharray:"3 3",stroke:"var(--color-border)",horizontal:!1}),h.jsx(Oo,{type:"number",tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1,tickFormatter:n=>n>=1e3?`${(n/1e3).toFixed(0)}k`:String(n)}),h.jsx(Eo,{type:"category",dataKey:"name",width:110,tick:{fontSize:9,fill:"var(--color-muted-foreground)",fontFamily:"monospace"},axisLine:!1,tickLine:!1}),h.jsx(jt,{content:h.jsx(aje,{})}),h.jsx(ci,{formatter:n=>h.jsx("span",{className:"text-xs",children:n})}),h.jsx(Qn,{dataKey:"tokensOut",name:"Output tokens",fill:_t.purple,stackId:"a",radius:[0,3,3,0]}),h.jsx(Qn,{dataKey:"tokensCacheRead",name:"Cached tokens",fill:_t.cyan,stackId:"a",radius:[0,3,3,0]})]})})]})}function s_(e){return e===null?"—":`$${e.toFixed(4)}`}function lje(e){if(e===null)return"—";const t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function uje({rate:e}){const t=(e*100).toFixed(0);return h.jsxs("span",{className:le("inline-block px-1.5 py-0.5 rounded text-[10px] font-medium",e>=.8?"bg-green-400/10 text-green-400":e>=.5?"bg-orange-400/10 text-orange-400":"bg-red-400/10 text-red-400"),children:[t,"%"]})}function Da({label:e,sortKey:t,current:n,dir:r,onSort:i}){const o=n===t;return h.jsx("th",{onClick:()=>i(t),className:"px-3 py-2 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide cursor-pointer select-none hover:text-foreground whitespace-nowrap",children:h.jsxs("span",{className:"inline-flex items-center gap-1",children:[e,o?r==="asc"?h.jsx(t8,{className:"w-3 h-3"}):h.jsx(K0,{className:"w-3 h-3"}):h.jsx(r8,{className:"w-3 h-3 opacity-40"})]})})}function cje({data:e}){const[t,n]=k.useState("totalCostUsd"),[r,i]=k.useState("desc");function o(s){s===t?i(l=>l==="asc"?"desc":"asc"):(n(s),i("desc"))}const a=[...e].sort((s,l)=>{const u=s[t]??-1/0,f=l[t]??-1/0,c=typeof u=="string"?u.localeCompare(f):u-f;return r==="asc"?c:-c});return e.length===0?h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Command Performance"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"No command data for this period"})]}):h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Command Performance"}),h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-xs",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b border-border/30",children:[h.jsx(Da,{label:"Command",sortKey:"command",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Runs",sortKey:"totalRuns",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Success Rate",sortKey:"successRate",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Avg Cost",sortKey:"avgCostUsd",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Avg Duration",sortKey:"avgDurationMs",current:t,dir:r,onSort:o}),h.jsx(Da,{label:"Total Cost",sortKey:"totalCostUsd",current:t,dir:r,onSort:o})]})}),h.jsx("tbody",{children:a.map(s=>h.jsxs("tr",{className:"border-b border-border/20 hover:bg-accent/20 transition-colors",children:[h.jsx("td",{className:"px-3 py-2 font-mono text-[10px] text-foreground",children:s.command}),h.jsx("td",{className:"px-3 py-2 tabular-nums",children:s.totalRuns}),h.jsx("td",{className:"px-3 py-2",children:h.jsx(uje,{rate:s.successRate})}),h.jsx("td",{className:"px-3 py-2 tabular-nums",children:s_(s.avgCostUsd)}),h.jsx("td",{className:"px-3 py-2 tabular-nums",children:lje(s.avgDurationMs)}),h.jsx("td",{className:"px-3 py-2 tabular-nums font-medium",children:s_(s.totalCostUsd)})]},s.command))})]})})]})}function fje({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"text-muted-foreground mb-1",children:n}),t.map(r=>h.jsxs("p",{style:{color:r.color},children:[r.name,": ",r.value]},r.name))]})}function dje(e){try{return b$(new Date(e),"MMM d")}catch{return e}}function pje({data:e}){if(!(e.length>0&&e.some(i=>i.completed+i.failed+i.canceled>0)))return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Daily Throughput"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No throughput data for this period"})]});const n=Math.max(1,Math.floor(e.length/7)),r=e.filter((i,o)=>o%n===0).map(i=>i.date);return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Daily Throughput"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsxs(T1,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[h.jsx(Qc,{strokeDasharray:"3 3",stroke:"var(--color-border)",vertical:!1}),h.jsx(Oo,{dataKey:"date",ticks:r,tickFormatter:dje,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1}),h.jsx(Eo,{allowDecimals:!1,tick:{fontSize:10,fill:"var(--color-muted-foreground)"},axisLine:!1,tickLine:!1,width:30}),h.jsx(jt,{content:h.jsx(fje,{})}),h.jsx(ci,{formatter:i=>h.jsx("span",{className:"text-xs capitalize",children:i})}),h.jsx(Qn,{dataKey:"completed",name:"Completed",stackId:"a",fill:_t.purple}),h.jsx(Qn,{dataKey:"failed",name:"Failed",stackId:"a",fill:_t.pink}),h.jsx(Qn,{dataKey:"canceled",name:"Canceled",stackId:"a",fill:_t.orange,radius:[3,3,0,0]})]})})]})}function hje({x:e=0,y:t=0,width:n=0,height:r=0,name:i="",size:o=0,colorIndex:a=0}){const s=a_[a%a_.length],l=n>50&&r>30;return h.jsxs("g",{children:[h.jsx("rect",{x:e,y:t,width:n,height:r,style:{fill:s,fillOpacity:.8,stroke:"var(--color-background)",strokeWidth:2},rx:4}),l&&h.jsxs(h.Fragment,{children:[h.jsx("text",{x:e+6,y:t+16,fill:"var(--color-background)",fontSize:10,fontFamily:"monospace",style:{overflow:"hidden"},children:i.length>Math.floor(n/6)?i.slice(0,Math.floor(n/6)-1)+"…":i}),r>45&&h.jsxs("text",{x:e+6,y:t+30,fill:"hsl(231 15% 18% / 0.7)",fontSize:9,children:["$",o.toFixed(4)]})]})]})}function mje({active:e,payload:t}){if(!e||!(t!=null&&t.length))return null;const n=t[0].payload;return n?h.jsxs("div",{className:"bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg",children:[h.jsx("p",{className:"font-mono font-medium mb-1",children:n.name}),h.jsxs("p",{className:"text-muted-foreground",children:["Cost: $",n.size.toFixed(4)]}),h.jsxs("p",{className:"text-muted-foreground",children:["Jobs: ",n.jobCount]})]}):null}function gje({data:e}){const t=e.filter(r=>r.totalCostUsd>0);if(t.length===0)return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Cost per Command"}),h.jsx("div",{className:"h-[220px] flex items-center justify-center text-xs text-muted-foreground",children:"No cost data for this period"})]});const n=t.map((r,i)=>({name:r.command,size:r.totalCostUsd,jobCount:r.jobCount,colorIndex:i}));return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4",children:[h.jsx("h3",{className:"text-sm font-medium mb-3",children:"Cost per Command"}),h.jsx(Ol,{width:"100%",height:220,children:h.jsx(M1,{data:n,dataKey:"size",content:h.jsx(hje,{}),children:h.jsx(jt,{content:h.jsx(mje,{})})})})]})}function Fy({label:e,value:t}){return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-3 space-y-1",children:[h.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:e}),h.jsx("p",{className:"text-base font-semibold tabular-nums",children:t})]})}function yje({data:e}){const t=e.costPerSuccess!==null?`$${e.costPerSuccess.toFixed(4)}`:"—",n=e.apiEfficiencyPct!==null?`${e.apiEfficiencyPct.toFixed(0)}%`:"—",r=`$${e.failureCostUsd.toFixed(4)}`;return h.jsxs("div",{className:"rounded-lg border border-border/40 bg-card/50 p-4 space-y-4",children:[h.jsx("h3",{className:"text-sm font-medium",children:"Bonus Metrics"}),h.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[h.jsx(Fy,{label:"Cost per Success",value:t}),h.jsx(Fy,{label:"API Efficiency",value:n}),h.jsx(Fy,{label:"Failure Cost",value:r})]}),h.jsxs("div",{children:[h.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Model Breakdown"}),e.modelBreakdown.length===0?h.jsx("p",{className:"text-xs text-muted-foreground",children:"No model data for this period"}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-xs",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b border-border/30",children:[h.jsx("th",{className:"px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide",children:"Model"}),h.jsx("th",{className:"px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide",children:"Jobs"}),h.jsx("th",{className:"px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide",children:"Total Cost"})]})}),h.jsx("tbody",{children:e.modelBreakdown.map(i=>h.jsxs("tr",{className:"border-b border-border/20",children:[h.jsx("td",{className:"px-3 py-1.5 font-mono text-[10px]",children:i.model}),h.jsx("td",{className:"px-3 py-1.5 tabular-nums",children:i.jobCount}),h.jsxs("td",{className:"px-3 py-1.5 tabular-nums",children:["$",i.totalCostUsd.toFixed(4)]})]},i.model))})]})})]})]})}function vje(){return h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:4}).map((e,t)=>h.jsx("div",{className:"h-20 rounded-lg border border-border/40 bg-card/50 animate-pulse"},t))}),h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Array.from({length:4}).map((e,t)=>h.jsx("div",{className:"h-[260px] rounded-lg border border-border/40 bg-card/50 animate-pulse"},t))}),h.jsx("div",{className:"h-[180px] rounded-lg border border-border/40 bg-card/50 animate-pulse"})]})}function xje({message:e,onRetry:t}){return h.jsxs("div",{className:"rounded-lg border border-red-400/30 bg-red-400/10 p-4 flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-red-400",children:e}),h.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 h-7 px-3 rounded-md text-xs text-red-400 border border-red-400/30 hover:bg-red-400/10 transition-colors",children:[h.jsx(N8,{className:"w-3 h-3"}),"Retry"]})]})}function oL(){const{activeProjectId:e}=Ni(),[t,n]=k.useState("7d"),[r,i]=k.useState(""),[o,a]=k.useState(""),[s,l]=k.useState(null),[u,f]=k.useState(!0),[c,d]=k.useState(null),[p,m]=k.useState(0),g=k.useRef(new Map);k.useEffect(()=>{if(e){const O=g.current.get(e);O&&(l(O),f(!1))}const x=new AbortController;!s&&!g.current.get(e??"")&&f(!0),d(null);const b=new URLSearchParams({period:t});if(t==="custom"){if(!r||!o){f(!1);return}b.set("from",r),b.set("to",o)}return fetch(`${Je()}/analytics?${b}`,{signal:x.signal}).then(O=>{if(!O.ok)throw new Error(`HTTP ${O.status}`);return O.json()}).then(O=>{l(O),e&&g.current.set(e,O),f(!1)}).catch(O=>{O.name!=="AbortError"&&(d(O.message),f(!1))}),()=>x.abort()},[t,r,o,p,e]);function v(x,b,O){n(x),i(b??""),a(O??"")}function y(){m(x=>x+1)}return h.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-base font-semibold",children:"Analytics"}),s&&h.jsx("p",{className:"text-xs text-muted-foreground",children:s.period.label})]}),h.jsx(bX,{period:t,from:r,to:o,onChange:v})]}),u&&h.jsx(vje,{}),!u&&c&&h.jsx(xje,{message:`Failed to load analytics: ${c}`,onRetry:y}),!u&&!c&&s&&h.jsxs("div",{className:"space-y-6",children:[h.jsx(kX,{kpi:s.kpi}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsx(ZPe,{data:s.costTimeline}),h.jsx(tje,{data:s.statusBreakdown}),h.jsx(oje,{data:s.durationHistogram,percentiles:s.durationPercentiles}),h.jsx(sje,{data:s.tokenEfficiency})]}),h.jsx(cje,{data:s.commandPerformance}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsx(pje,{data:s.dailyThroughput}),h.jsx(gje,{data:s.costPerCommand})]}),h.jsx(yje,{data:s.bonusMetrics})]})]})}function bje({project:e,onRemove:t}){return h.jsxs("div",{className:"flex items-center gap-3 p-2.5 rounded-md border border-border",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-xs font-medium truncate",children:e.name}),h.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:e.path})]}),h.jsx(je,{size:"sm",variant:"ghost",className:"h-6 px-2 text-[10px] text-muted-foreground hover:text-destructive shrink-0",onClick:()=>t(e.id),children:"Remove"})]})}function wje({open:e,onClose:t}){const{projects:n,removeProject:r}=Ni(),[i,o]=k.useState(null),[a,s]=k.useState(!0);k.useEffect(()=>{if(!e)return;s(!0);async function u(){try{const f=await fetch("/api/hub/settings");if(f.ok){const c=await f.json();o(c)}}catch{}finally{s(!1)}}u()},[e]);async function l(u){try{await r(u),nt.success("Project removed")}catch(f){nt.error("Failed to remove project",{description:f.message})}}return h.jsx(Wc,{open:e,onOpenChange:u=>{u||t()},children:h.jsxs(cl,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[h.jsxs(fl,{children:[h.jsxs(dl,{className:"flex items-center gap-2",children:[h.jsx(Y0,{className:"w-4 h-4"}),"Hub Settings"]}),h.jsx(xw,{children:"Manage registered projects and view hub information."})]}),a?h.jsxs("div",{className:"space-y-3 py-2",children:[h.jsx("div",{className:"h-20 bg-muted/30 rounded-lg animate-pulse"}),h.jsx("div",{className:"h-16 bg-muted/30 rounded-lg animate-pulse"})]}):h.jsxs("div",{className:"space-y-5 py-2",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Registered Projects"}),n.length===0?h.jsx("div",{className:"rounded-md border border-dashed border-border p-4 text-center",children:h.jsx("p",{className:"text-xs text-muted-foreground",children:"No projects registered yet"})}):h.jsx("div",{className:"space-y-1.5",children:n.map(u=>h.jsx(bje,{project:u,onRemove:l},u.id))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Hub Information"}),h.jsxs("div",{className:"rounded-md border border-border p-3 space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between text-xs",children:[h.jsx("span",{className:"text-muted-foreground",children:"Port"}),h.jsx("span",{className:"font-mono",children:(i==null?void 0:i.port)??4200})]}),h.jsxs("div",{className:"flex items-center justify-between text-xs",children:[h.jsx("span",{className:"text-muted-foreground",children:"Projects"}),h.jsx("span",{className:"font-mono",children:n.length})]}),h.jsxs("div",{className:"flex items-center justify-between text-xs",children:[h.jsx("span",{className:"text-muted-foreground",children:"Hub DB"}),h.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:"~/.specrails/hub.sqlite"})]})]})]})]})]})})}function Sje({project:e}){const t=[{to:"/",end:!0,icon:q2,label:"Home"},{to:"/analytics",end:!1,icon:H2,label:"Analytics"}];return h.jsxs("nav",{className:"flex items-center justify-between h-9 px-3 border-b border-border bg-background/50",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[160px]",children:e.path}),h.jsx("div",{className:"flex items-center gap-0.5",children:t.map(({to:n,end:r,icon:i,label:o})=>h.jsxs(Vo,{to:n,end:r,className:({isActive:a})=>le("h-7 px-2 flex items-center gap-1.5 rounded-md text-xs transition-colors",a?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent"),children:[h.jsx(i,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:o})]},n))}),h.jsxs(wi,{children:[h.jsx(Si,{asChild:!0,children:h.jsx(Vo,{to:"/settings",className:({isActive:n})=>le("h-7 w-7 flex items-center justify-center rounded-md transition-colors",n?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent"),children:h.jsx(Y0,{className:"w-3.5 h-3.5"})})}),h.jsx(Vr,{children:"Project Settings"})]})]})}function kje({project:e}){const{connectionStatus:t}=mw(),n=d$();return h.jsxs(B2,{delayDuration:400,children:[h.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[h.jsx(Sje,{project:e}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("main",{className:"flex-1 overflow-auto",children:h.jsx(LT,{})}),h.jsx(u$,{chat:n})]}),h.jsx(eN,{connectionStatus:t})]}),h.jsx(HT,{position:"bottom-right",toastOptions:{unstyled:!0,classNames:{toast:"glass-card border border-border/30 text-foreground text-xs p-3 rounded-lg flex items-start gap-2 w-[356px]",title:"font-medium",description:"text-muted-foreground mt-0.5"}}})]})}function Oje({onAddProject:e}){return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[400px] gap-6 px-8 text-center",children:[h.jsx("div",{className:"w-14 h-14 rounded-2xl bg-muted/50 flex items-center justify-center",children:h.jsx(Q2,{className:"w-7 h-7 text-muted-foreground"})}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("h2",{className:"text-base font-semibold",children:["Welcome to ",h.jsx("span",{className:"text-dracula-purple",children:"spec"}),h.jsx("span",{className:"text-dracula-pink",children:"rails"})," hub"]}),h.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:"The hub manages multiple projects from a single interface. Add your first project to get started."})]}),h.jsxs(je,{onClick:e,size:"sm",className:"gap-2",children:[h.jsx(G0,{className:"w-3.5 h-3.5"}),"Add your first project"]}),h.jsxs("div",{className:"text-[10px] text-muted-foreground space-y-1",children:[h.jsx("p",{children:"Or register a project from the terminal:"}),h.jsx("code",{className:"font-mono bg-muted/50 px-2 py-0.5 rounded text-xs",children:"specrails-hub hub add /path/to/project"})]})]})}function Eje({checkpoint:e,index:t}){const n=e.status==="done",r=e.status==="running",i=e.status==="pending";return h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("div",{className:"flex flex-col items-center flex-shrink-0",children:h.jsx("div",{className:le("w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold border-2 transition-all",n&&"bg-dracula-green/20 border-dracula-green text-dracula-green",r&&"bg-dracula-purple/20 border-dracula-purple text-dracula-purple animate-pulse",i&&"bg-muted/30 border-border text-muted-foreground"),children:n?h.jsx(Gh,{className:"w-3 h-3"}):r?h.jsx(h8,{className:"w-3 h-3"}):h.jsx("span",{children:t+1})})}),h.jsxs("div",{className:"pb-4 flex-1 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsx("span",{className:le("text-xs font-medium",n&&"text-foreground",r&&"text-dracula-purple",i&&"text-muted-foreground"),children:e.name})}),(r||n)&&e.detail&&h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate",children:e.detail})]})]})}function Pje({checkpoints:e,logLines:t}){const[n,r]=k.useState(!1),i=e.filter(s=>s.status==="done").length,o=e.length,a=o>0?Math.round(i/o*100):0;return h.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[h.jsxs("div",{className:"px-4 py-3 border-b border-border/30 flex-shrink-0",children:[h.jsx("h3",{className:"text-xs font-semibold text-foreground mb-2",children:"Setup progress"}),h.jsx("div",{className:"h-1.5 bg-muted/50 rounded-full overflow-hidden",children:h.jsx("div",{className:"h-full bg-dracula-green rounded-full transition-all duration-500",style:{width:`${a}%`}})}),h.jsxs("div",{className:"flex justify-between items-center mt-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[i," of ",o," complete"]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[a,"%"]})]})]}),h.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-0",children:e.map((s,l)=>h.jsxs("div",{className:"relative",children:[h.jsx(Eje,{checkpoint:s,index:l}),l<e.length-1&&h.jsx("div",{className:le("absolute left-[11px] top-6 w-0.5 h-4",s.status==="done"?"bg-dracula-green/40":"bg-border/40")})]},s.key))}),h.jsxs("div",{className:"flex-shrink-0 border-t border-border/30",children:[h.jsxs("button",{className:"w-full flex items-center gap-1.5 px-4 py-2 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>r(s=>!s),children:[n?h.jsx(K0,{className:"w-3 h-3 flex-shrink-0"}):h.jsx(q0,{className:"w-3 h-3 flex-shrink-0"}),"Raw log (",t.length," lines)"]}),n&&h.jsx("div",{className:"max-h-40 overflow-auto px-4 pb-3 font-mono text-[9px] text-muted-foreground space-y-0.5",children:t.slice(-200).map((s,l)=>h.jsx("div",{className:"whitespace-pre-wrap break-all leading-tight",children:s},l))})]})]})}const l_=`prose prose-invert prose-xs max-w-none
|
|
464
464
|
prose-p:my-1 prose-p:leading-relaxed
|
|
465
465
|
prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold
|
|
466
466
|
prose-ul:my-1 prose-ol:my-1 prose-li:my-0
|
package/client/dist/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>specrails manager</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-WpfmJNiC.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-BEc7DzgE.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/package.json
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specrails-hub",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Local dashboard and CLI for managing multiple specrails projects from a single interface",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"specrails",
|
|
7
|
+
"claude",
|
|
8
|
+
"ai",
|
|
9
|
+
"pipeline",
|
|
10
|
+
"dashboard",
|
|
11
|
+
"cli"
|
|
12
|
+
],
|
|
6
13
|
"author": "fjpulidop",
|
|
7
14
|
"license": "MIT",
|
|
8
15
|
"repository": {
|
|
9
16
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/fjpulidop/specrails-hub.git"
|
|
17
|
+
"url": "git+https://github.com/fjpulidop/specrails-hub.git"
|
|
11
18
|
},
|
|
12
19
|
"homepage": "https://github.com/fjpulidop/specrails-hub#readme",
|
|
13
20
|
"engines": {
|
|
@@ -21,7 +28,7 @@
|
|
|
21
28
|
"LICENSE"
|
|
22
29
|
],
|
|
23
30
|
"bin": {
|
|
24
|
-
"
|
|
31
|
+
"specrails-hub": "cli/dist/srm.js"
|
|
25
32
|
},
|
|
26
33
|
"scripts": {
|
|
27
34
|
"dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
|
package/server/index.ts
CHANGED
|
@@ -514,7 +514,7 @@ if (isHubMode) {
|
|
|
514
514
|
server.on('error', (err: NodeJS.ErrnoException) => {
|
|
515
515
|
if (err.code === 'EADDRINUSE') {
|
|
516
516
|
console.error(`[error] Port ${port} is already in use. Is another manager instance running?`)
|
|
517
|
-
console.error(`[error] Try stopping it first:
|
|
517
|
+
console.error(`[error] Try stopping it first: specrails-hub hub stop`)
|
|
518
518
|
process.exit(1)
|
|
519
519
|
}
|
|
520
520
|
throw err
|