tokenrace 0.1.7 → 0.1.8
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.
|
@@ -184,4 +184,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
184
184
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P7(e,t){if(e){if(typeof e=="string")return Ab(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 Ab(e,t)}}function R7(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $7(e){if(Array.isArray(e))return Ab(e)}function Ab(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 q7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E2(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,RN(r.key),r)}}function z7(e,t,n){return t&&E2(e.prototype,t),n&&E2(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function B7(e,t,n){return t=mf(t),L7(e,PN()?Reflect.construct(t,n||[],mf(e).constructor):t.apply(e,n))}function L7(e,t){if(t&&(To(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return k7(e)}function k7(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PN=function(){return!!e})()}function mf(e){return mf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},mf(e)}function U7(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,o){return r.__proto__=o,r},wb(e,t)}function In(e,t,n){return t=RN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RN(e){var t=I7(e,"string");return To(t)=="symbol"?t:t+""}function I7(e,t){if(To(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(To(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Il=(function(e){function t(){var n;q7(this,t);for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n=B7(this,t,[].concat(o)),In(n,"state",{isAnimationFinished:!0,totalLength:0}),In(n,"generateSimpleStrokeDasharray",function(c,f){return"".concat(f,"px ").concat(c-f,"px")}),In(n,"getStrokeDasharray",function(c,f,d){var h=d.reduce(function(w,E){return w+E});if(!h)return n.generateSimpleStrokeDasharray(f,c);for(var v=Math.floor(c/h),y=c%h,g=f-c,x=[],_=0,S=0;_<d.length;S+=d[_],++_)if(S+d[_]>y){x=[].concat(Ji(d.slice(0,_)),[y-S]);break}var b=x.length%2===0?[0,g]:[g];return[].concat(Ji(t.repeat(d,v)),Ji(x),b).map(function(w){return"".concat(w,"px")}).join(", ")}),In(n,"id",$o("recharts-line-")),In(n,"pathRef",function(c){n.mainCurve=c}),In(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),In(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return U7(t,e),z7(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,o){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.points,f=l.xAxis,d=l.yAxis,h=l.layout,v=l.children,y=Nn(v,kl);if(!y)return null;var g=function(S,b){return{x:S.x,y:S.y,value:S.value,errorVal:Yt(S.payload,b)}},x={clipPath:r?"url(#clipPath-".concat(o,")"):null};return L.createElement(Je,x,y.map(function(_){return L.cloneElement(_,{key:"bar-".concat(_.props.dataKey),data:c,xAxis:f,yAxis:d,layout:h,dataPointFormatter:g})}))}},{key:"renderDots",value:function(r,o,l){var c=this.props.isAnimationActive;if(c&&!this.state.isAnimationFinished)return null;var f=this.props,d=f.dot,h=f.points,v=f.dataKey,y=Ee(this.props,!1),g=Ee(d,!0),x=h.map(function(S,b){var w=fn(fn(fn({key:"dot-".concat(b),r:3},y),g),{},{index:b,cx:S.x,cy:S.y,value:S.value,dataKey:v,payload:S.payload,points:h});return t.renderDotItem(d,w)}),_={clipPath:r?"url(#clipPath-".concat(o?"":"dots-").concat(l,")"):null};return L.createElement(Je,Wu({className:"recharts-line-dots",key:"dots"},_),x)}},{key:"renderCurveStatically",value:function(r,o,l,c){var f=this.props,d=f.type,h=f.layout,v=f.connectNulls;f.ref;var y=w2(f,M7),g=fn(fn(fn({},Ee(y,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:o?"url(#clipPath-".concat(l,")"):null,points:r},c),{},{type:d,layout:h,connectNulls:v});return L.createElement(oo,Wu({},g,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,o){var l=this,c=this.props,f=c.points,d=c.strokeDasharray,h=c.isAnimationActive,v=c.animationBegin,y=c.animationDuration,g=c.animationEasing,x=c.animationId,_=c.animateNewValues,S=c.width,b=c.height,w=this.state,E=w.prevPoints,j=w.totalLength;return L.createElement(ar,{begin:v,duration:y,isActive:h,easing:g,from:{t:0},to:{t:1},key:"line-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var A=N.t;if(E){var T=E.length/f.length,C=f.map(function(B,V){var Q=Math.floor(V*T);if(E[Q]){var Z=E[Q],R=$t(Z.x,B.x),G=$t(Z.y,B.y);return fn(fn({},B),{},{x:R(A),y:G(A)})}if(_){var ee=$t(S*2,B.x),oe=$t(b/2,B.y);return fn(fn({},B),{},{x:ee(A),y:oe(A)})}return fn(fn({},B),{},{x:B.x,y:B.y})});return l.renderCurveStatically(C,r,o)}var $=$t(0,j),z=$(A),F;if(d){var U="".concat(d).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});F=l.getStrokeDasharray(z,j,U)}else F=l.generateSimpleStrokeDasharray(j,z);return l.renderCurveStatically(f,r,o,{strokeDasharray:F})})}},{key:"renderCurve",value:function(r,o){var l=this.props,c=l.points,f=l.isAnimationActive,d=this.state,h=d.prevPoints,v=d.totalLength;return f&&c&&c.length&&(!h&&v>0||!yo(h,c))?this.renderCurveWithAnimation(r,o):this.renderCurveStatically(c,r,o)}},{key:"render",value:function(){var r,o=this.props,l=o.hide,c=o.dot,f=o.points,d=o.className,h=o.xAxis,v=o.yAxis,y=o.top,g=o.left,x=o.width,_=o.height,S=o.isAnimationActive,b=o.id;if(l||!f||!f.length)return null;var w=this.state.isAnimationFinished,E=f.length===1,j=$e("recharts-line",d),N=h&&h.allowDataOverflow,A=v&&v.allowDataOverflow,T=N||A,C=je(b)?this.id:b,$=(r=Ee(c,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},z=$.r,F=z===void 0?3:z,U=$.strokeWidth,B=U===void 0?2:U,V=Z2(c)?c:{},Q=V.clipDot,Z=Q===void 0?!0:Q,R=F*2+B;return L.createElement(Je,{className:j},N||A?L.createElement("defs",null,L.createElement("clipPath",{id:"clipPath-".concat(C)},L.createElement("rect",{x:N?g:g-x/2,y:A?y:y-_/2,width:N?x:x*2,height:A?_:_*2})),!Z&&L.createElement("clipPath",{id:"clipPath-dots-".concat(C)},L.createElement("rect",{x:g-R/2,y:y-R/2,width:x+R,height:_+R}))):null,!E&&this.renderCurve(T,C),this.renderErrorBar(T,C),(E||c)&&this.renderDots(T,Z,C),(!S||w)&&Dr.renderCallByParent(this.props,f))}}],[{key:"getDerivedStateFromProps",value:function(r,o){return r.animationId!==o.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:o.curPoints}:r.points!==o.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,o){for(var l=r.length%2!==0?[].concat(Ji(r),[0]):r,c=[],f=0;f<o;++f)c=[].concat(Ji(c),Ji(l));return c}},{key:"renderDotItem",value:function(r,o){var l;if(L.isValidElement(r))l=L.cloneElement(r,o);else if(Ae(r))l=r(o);else{var c=o.key,f=w2(o,C7),d=$e("recharts-line-dot",typeof r!="boolean"?r.className:"");l=L.createElement(Gf,Wu({key:c},f,{className:d}))}return l}}])})(W.PureComponent);In(Il,"displayName","Line");In(Il,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!ui.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});In(Il,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,o=e.xAxisTicks,l=e.yAxisTicks,c=e.dataKey,f=e.bandSize,d=e.displayedData,h=e.offset,v=t.layout,y=d.map(function(g,x){var _=Yt(g,c);return v==="horizontal"?{x:Zs({axis:n,ticks:o,bandSize:f,entry:g,index:x}),y:je(_)?null:r.scale(_),value:_,payload:g}:{x:je(_)?null:n.scale(_),y:Zs({axis:r,ticks:l,bandSize:f,entry:g,index:x}),value:_,payload:g}});return fn({points:y,layout:v},h)});var H7=["layout","type","stroke","connectNulls","isRange","ref"],G7=["key"],$N;function Eo(e){"@babel/helpers - typeof";return Eo=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},Eo(e)}function qN(e,t){if(e==null)return{};var n=Y7(e,t),r,o;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)r=l[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Y7(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 Qa(){return Qa=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},Qa.apply(this,arguments)}function j2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function pa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?j2(Object(n),!0).forEach(function(r){Jn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function X7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M2(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,BN(r.key),r)}}function K7(e,t,n){return t&&M2(e.prototype,t),n&&M2(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function V7(e,t,n){return t=gf(t),Z7(e,zN()?Reflect.construct(t,n||[],gf(e).constructor):t.apply(e,n))}function Z7(e,t){if(t&&(Eo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F7(e)}function F7(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zN=function(){return!!e})()}function gf(e){return gf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gf(e)}function Q7(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,o){return r.__proto__=o,r},Tb(e,t)}function Jn(e,t,n){return t=BN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BN(e){var t=W7(e,"string");return Eo(t)=="symbol"?t:t+""}function W7(e,t){if(Eo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Eo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Yn=(function(e){function t(){var n;X7(this,t);for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n=V7(this,t,[].concat(o)),Jn(n,"state",{isAnimationFinished:!0}),Jn(n,"id",$o("recharts-area-")),Jn(n,"handleAnimationEnd",function(){var c=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Ae(c)&&c()}),Jn(n,"handleAnimationStart",function(){var c=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Ae(c)&&c()}),n}return Q7(t,e),K7(t,[{key:"renderDots",value:function(r,o,l){var c=this.props.isAnimationActive,f=this.state.isAnimationFinished;if(c&&!f)return null;var d=this.props,h=d.dot,v=d.points,y=d.dataKey,g=Ee(this.props,!1),x=Ee(h,!0),_=v.map(function(b,w){var E=pa(pa(pa({key:"dot-".concat(w),r:3},g),x),{},{index:w,cx:b.x,cy:b.y,dataKey:y,value:b.value,payload:b.payload,points:v});return t.renderDotItem(h,E)}),S={clipPath:r?"url(#clipPath-".concat(o?"":"dots-").concat(l,")"):null};return L.createElement(Je,Qa({className:"recharts-area-dots"},S),_)}},{key:"renderHorizontalRect",value:function(r){var o=this.props,l=o.baseLine,c=o.points,f=o.strokeWidth,d=c[0].x,h=c[c.length-1].x,v=r*Math.abs(d-h),y=ma(c.map(function(g){return g.y||0}));return fe(l)&&typeof l=="number"?y=Math.max(l,y):l&&Array.isArray(l)&&l.length&&(y=Math.max(ma(l.map(function(g){return g.y||0})),y)),fe(y)?L.createElement("rect",{x:d<h?d:d-v,y:0,width:v,height:Math.floor(y+(f?parseInt("".concat(f),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var o=this.props,l=o.baseLine,c=o.points,f=o.strokeWidth,d=c[0].y,h=c[c.length-1].y,v=r*Math.abs(d-h),y=ma(c.map(function(g){return g.x||0}));return fe(l)&&typeof l=="number"?y=Math.max(l,y):l&&Array.isArray(l)&&l.length&&(y=Math.max(ma(l.map(function(g){return g.x||0})),y)),fe(y)?L.createElement("rect",{x:0,y:d<h?d:d-v,width:y+(f?parseInt("".concat(f),10):1),height:Math.floor(v)}):null}},{key:"renderClipRect",value:function(r){var o=this.props.layout;return o==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,o,l,c){var f=this.props,d=f.layout,h=f.type,v=f.stroke,y=f.connectNulls,g=f.isRange;f.ref;var x=qN(f,H7);return L.createElement(Je,{clipPath:l?"url(#clipPath-".concat(c,")"):null},L.createElement(oo,Qa({},Ee(x,!0),{points:r,connectNulls:y,type:h,baseLine:o,layout:d,stroke:"none",className:"recharts-area-area"})),v!=="none"&&L.createElement(oo,Qa({},Ee(this.props,!1),{className:"recharts-area-curve",layout:d,type:h,connectNulls:y,fill:"none",points:r})),v!=="none"&&g&&L.createElement(oo,Qa({},Ee(this.props,!1),{className:"recharts-area-curve",layout:d,type:h,connectNulls:y,fill:"none",points:o})))}},{key:"renderAreaWithAnimation",value:function(r,o){var l=this,c=this.props,f=c.points,d=c.baseLine,h=c.isAnimationActive,v=c.animationBegin,y=c.animationDuration,g=c.animationEasing,x=c.animationId,_=this.state,S=_.prevPoints,b=_.prevBaseLine;return L.createElement(ar,{begin:v,duration:y,isActive:h,easing:g,from:{t:0},to:{t:1},key:"area-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(w){var E=w.t;if(S){var j=S.length/f.length,N=f.map(function($,z){var F=Math.floor(z*j);if(S[F]){var U=S[F],B=$t(U.x,$.x),V=$t(U.y,$.y);return pa(pa({},$),{},{x:B(E),y:V(E)})}return $}),A;if(fe(d)&&typeof d=="number"){var T=$t(b,d);A=T(E)}else if(je(d)||Ro(d)){var C=$t(b,0);A=C(E)}else A=d.map(function($,z){var F=Math.floor(z*j);if(b[F]){var U=b[F],B=$t(U.x,$.x),V=$t(U.y,$.y);return pa(pa({},$),{},{x:B(E),y:V(E)})}return $});return l.renderAreaStatically(N,A,r,o)}return L.createElement(Je,null,L.createElement("defs",null,L.createElement("clipPath",{id:"animationClipPath-".concat(o)},l.renderClipRect(E))),L.createElement(Je,{clipPath:"url(#animationClipPath-".concat(o,")")},l.renderAreaStatically(f,d,r,o)))})}},{key:"renderArea",value:function(r,o){var l=this.props,c=l.points,f=l.baseLine,d=l.isAnimationActive,h=this.state,v=h.prevPoints,y=h.prevBaseLine,g=h.totalLength;return d&&c&&c.length&&(!v&&g>0||!yo(v,c)||!yo(y,f))?this.renderAreaWithAnimation(r,o):this.renderAreaStatically(c,f,r,o)}},{key:"render",value:function(){var r,o=this.props,l=o.hide,c=o.dot,f=o.points,d=o.className,h=o.top,v=o.left,y=o.xAxis,g=o.yAxis,x=o.width,_=o.height,S=o.isAnimationActive,b=o.id;if(l||!f||!f.length)return null;var w=this.state.isAnimationFinished,E=f.length===1,j=$e("recharts-area",d),N=y&&y.allowDataOverflow,A=g&&g.allowDataOverflow,T=N||A,C=je(b)?this.id:b,$=(r=Ee(c,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},z=$.r,F=z===void 0?3:z,U=$.strokeWidth,B=U===void 0?2:U,V=Z2(c)?c:{},Q=V.clipDot,Z=Q===void 0?!0:Q,R=F*2+B;return L.createElement(Je,{className:j},N||A?L.createElement("defs",null,L.createElement("clipPath",{id:"clipPath-".concat(C)},L.createElement("rect",{x:N?v:v-x/2,y:A?h:h-_/2,width:N?x:x*2,height:A?_:_*2})),!Z&&L.createElement("clipPath",{id:"clipPath-dots-".concat(C)},L.createElement("rect",{x:v-R/2,y:h-R/2,width:x+R,height:_+R}))):null,E?null:this.renderArea(T,C),(c||E)&&this.renderDots(T,Z,C),(!S||w)&&Dr.renderCallByParent(this.props,f))}}],[{key:"getDerivedStateFromProps",value:function(r,o){return r.animationId!==o.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:o.curPoints,prevBaseLine:o.curBaseLine}:r.points!==o.curPoints||r.baseLine!==o.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])})(W.PureComponent);$N=Yn;Jn(Yn,"displayName","Area");Jn(Yn,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ui.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Jn(Yn,"getBaseValue",function(e,t,n,r){var o=e.layout,l=e.baseValue,c=t.props.baseValue,f=c??l;if(fe(f)&&typeof f=="number")return f;var d=o==="horizontal"?r:n,h=d.scale.domain();if(d.type==="number"){var v=Math.max(h[0],h[1]),y=Math.min(h[0],h[1]);return f==="dataMin"?y:f==="dataMax"||v<0?v:Math.max(Math.min(h[0],h[1]),0)}return f==="dataMin"?h[0]:f==="dataMax"?h[1]:h[0]});Jn(Yn,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,f=e.bandSize,d=e.dataKey,h=e.stackedData,v=e.dataStartIndex,y=e.displayedData,g=e.offset,x=t.layout,_=h&&h.length,S=$N.getBaseValue(t,n,r,o),b=x==="horizontal",w=!1,E=y.map(function(N,A){var T;_?T=h[v+A]:(T=Yt(N,d),Array.isArray(T)?w=!0:T=[S,T]);var C=T[1]==null||_&&Yt(N,d)==null;return b?{x:Zs({axis:r,ticks:l,bandSize:f,entry:N,index:A}),y:C?null:o.scale(T[1]),value:T,payload:N}:{x:C?null:r.scale(T[1]),y:Zs({axis:o,ticks:c,bandSize:f,entry:N,index:A}),value:T,payload:N}}),j;return _||w?j=E.map(function(N){var A=Array.isArray(N.value)?N.value[0]:null;return b?{x:N.x,y:A!=null&&N.y!=null?o.scale(A):null}:{x:A!=null?r.scale(A):null,y:N.y}}):j=b?o.scale(S):r.scale(S),pa({points:E,baseLine:j,layout:x,isRange:w},g)});Jn(Yn,"renderDotItem",function(e,t){var n;if(L.isValidElement(e))n=L.cloneElement(e,t);else if(Ae(e))n=e(t);else{var r=$e("recharts-area-dot",typeof e!="boolean"?e.className:""),o=t.key,l=qN(t,G7);n=L.createElement(Gf,Qa({},l,{key:o,className:r}))}return n});function jo(e){"@babel/helpers - typeof";return jo=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},jo(e)}function J7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eG(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,UN(r.key),r)}}function tG(e,t,n){return t&&eG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function nG(e,t,n){return t=bf(t),rG(e,LN()?Reflect.construct(t,n||[],bf(e).constructor):t.apply(e,n))}function rG(e,t){if(t&&(jo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aG(e)}function aG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function LN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(LN=function(){return!!e})()}function bf(e){return bf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bf(e)}function iG(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&&Eb(e,t)}function Eb(e,t){return Eb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Eb(e,t)}function kN(e,t,n){return t=UN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UN(e){var t=oG(e,"string");return jo(t)=="symbol"?t:t+""}function oG(e,t){if(jo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(jo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function jb(){return jb=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},jb.apply(this,arguments)}function uG(e){var t=e.xAxisId,n=z0(),r=B0(),o=SN(t);return o==null?null:W.createElement(ko,jb({},o,{className:$e("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(c){return jr(c,!0)}}))}var kr=(function(e){function t(){return J7(this,t),nG(this,t,arguments)}return iG(t,e),tG(t,[{key:"render",value:function(){return W.createElement(uG,this.props)}}])})(W.Component);kN(kr,"displayName","XAxis");kN(kr,"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 Mo(e){"@babel/helpers - typeof";return Mo=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},Mo(e)}function lG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cG(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,GN(r.key),r)}}function sG(e,t,n){return t&&cG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function fG(e,t,n){return t=xf(t),dG(e,IN()?Reflect.construct(t,n||[],xf(e).constructor):t.apply(e,n))}function dG(e,t){if(t&&(Mo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hG(e)}function hG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function IN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IN=function(){return!!e})()}function xf(e){return xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},xf(e)}function pG(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&&Mb(e,t)}function Mb(e,t){return Mb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Mb(e,t)}function HN(e,t,n){return t=GN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GN(e){var t=vG(e,"string");return Mo(t)=="symbol"?t:t+""}function vG(e,t){if(Mo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Mo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Cb(){return Cb=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},Cb.apply(this,arguments)}var yG=function(t){var n=t.yAxisId,r=z0(),o=B0(),l=ON(n);return l==null?null:W.createElement(ko,Cb({},l,{className:$e("recharts-".concat(l.axisType," ").concat(l.axisType),l.className),viewBox:{x:0,y:0,width:r,height:o},ticksGenerator:function(f){return jr(f,!0)}}))},Ur=(function(e){function t(){return lG(this,t),fG(this,t,arguments)}return pG(t,e),sG(t,[{key:"render",value:function(){return W.createElement(yG,this.props)}}])})(W.Component);HN(Ur,"displayName","YAxis");HN(Ur,"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 C2(e){return xG(e)||bG(e)||gG(e)||mG()}function mG(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
185
185
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gG(e,t){if(e){if(typeof e=="string")return Nb(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 Nb(e,t)}}function bG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xG(e){if(Array.isArray(e))return Nb(e)}function Nb(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 Db=function(t,n,r,o,l){var c=Nn(t,Vf),f=Nn(t,Ff),d=[].concat(C2(c),C2(f)),h=Nn(t,Wf),v="".concat(o,"Id"),y=o[0],g=n;if(d.length&&(g=d.reduce(function(S,b){if(b.props[v]===r&&nr(b.props,"extendDomain")&&fe(b.props[y])){var w=b.props[y];return[Math.min(S[0],w),Math.max(S[1],w)]}return S},g)),h.length){var x="".concat(y,"1"),_="".concat(y,"2");g=h.reduce(function(S,b){if(b.props[v]===r&&nr(b.props,"extendDomain")&&fe(b.props[x])&&fe(b.props[_])){var w=b.props[x],E=b.props[_];return[Math.min(S[0],w,E),Math.max(S[1],w,E)]}return S},g)}return l&&l.length&&(g=l.reduce(function(S,b){return fe(b)?[Math.min(S[0],b),Math.max(S[1],b)]:S},g)),g},pg={exports:{}},N2;function SG(){return N2||(N2=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function o(d,h,v){this.fn=d,this.context=h,this.once=v||!1}function l(d,h,v,y,g){if(typeof v!="function")throw new TypeError("The listener must be a function");var x=new o(v,y||d,g),_=n?n+h:h;return d._events[_]?d._events[_].fn?d._events[_]=[d._events[_],x]:d._events[_].push(x):(d._events[_]=x,d._eventsCount++),d}function c(d,h){--d._eventsCount===0?d._events=new r:delete d._events[h]}function f(){this._events=new r,this._eventsCount=0}f.prototype.eventNames=function(){var h=[],v,y;if(this._eventsCount===0)return h;for(y in v=this._events)t.call(v,y)&&h.push(n?y.slice(1):y);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(v)):h},f.prototype.listeners=function(h){var v=n?n+h:h,y=this._events[v];if(!y)return[];if(y.fn)return[y.fn];for(var g=0,x=y.length,_=new Array(x);g<x;g++)_[g]=y[g].fn;return _},f.prototype.listenerCount=function(h){var v=n?n+h:h,y=this._events[v];return y?y.fn?1:y.length:0},f.prototype.emit=function(h,v,y,g,x,_){var S=n?n+h:h;if(!this._events[S])return!1;var b=this._events[S],w=arguments.length,E,j;if(b.fn){switch(b.once&&this.removeListener(h,b.fn,void 0,!0),w){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,v),!0;case 3:return b.fn.call(b.context,v,y),!0;case 4:return b.fn.call(b.context,v,y,g),!0;case 5:return b.fn.call(b.context,v,y,g,x),!0;case 6:return b.fn.call(b.context,v,y,g,x,_),!0}for(j=1,E=new Array(w-1);j<w;j++)E[j-1]=arguments[j];b.fn.apply(b.context,E)}else{var N=b.length,A;for(j=0;j<N;j++)switch(b[j].once&&this.removeListener(h,b[j].fn,void 0,!0),w){case 1:b[j].fn.call(b[j].context);break;case 2:b[j].fn.call(b[j].context,v);break;case 3:b[j].fn.call(b[j].context,v,y);break;case 4:b[j].fn.call(b[j].context,v,y,g);break;default:if(!E)for(A=1,E=new Array(w-1);A<w;A++)E[A-1]=arguments[A];b[j].fn.apply(b[j].context,E)}}return!0},f.prototype.on=function(h,v,y){return l(this,h,v,y,!1)},f.prototype.once=function(h,v,y){return l(this,h,v,y,!0)},f.prototype.removeListener=function(h,v,y,g){var x=n?n+h:h;if(!this._events[x])return this;if(!v)return c(this,x),this;var _=this._events[x];if(_.fn)_.fn===v&&(!g||_.once)&&(!y||_.context===y)&&c(this,x);else{for(var S=0,b=[],w=_.length;S<w;S++)(_[S].fn!==v||g&&!_[S].once||y&&_[S].context!==y)&&b.push(_[S]);b.length?this._events[x]=b.length===1?b[0]:b:c(this,x)}return this},f.prototype.removeAllListeners=function(h){var v;return h?(v=n?n+h:h,this._events[v]&&c(this,v)):(this._events=new r,this._eventsCount=0),this},f.prototype.off=f.prototype.removeListener,f.prototype.addListener=f.prototype.on,f.prefixed=n,f.EventEmitter=f,e.exports=f})(pg)),pg.exports}var OG=SG();const _G=Qe(OG);var vg=new _G,yg="recharts.syncMouseEvents";function Dl(e){"@babel/helpers - typeof";return Dl=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},Dl(e)}function AG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wG(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,YN(r.key),r)}}function TG(e,t,n){return t&&wG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mg(e,t,n){return t=YN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YN(e){var t=EG(e,"string");return Dl(t)=="symbol"?t:t+""}function EG(e,t){if(Dl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Dl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var jG=(function(){function e(){AG(this,e),mg(this,"activeIndex",0),mg(this,"coordinateList",[]),mg(this,"layout","horizontal")}return TG(e,[{key:"setDetails",value:function(n){var r,o=n.coordinateList,l=o===void 0?null:o,c=n.container,f=c===void 0?null:c,d=n.layout,h=d===void 0?null:d,v=n.offset,y=v===void 0?null:v,g=n.mouseHandlerCallback,x=g===void 0?null:g;this.coordinateList=(r=l??this.coordinateList)!==null&&r!==void 0?r:[],this.container=f??this.container,this.layout=h??this.layout,this.offset=y??this.offset,this.mouseHandlerCallback=x??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 o=this.container.getBoundingClientRect(),l=o.x,c=o.y,f=o.height,d=this.coordinateList[this.activeIndex].coordinate,h=((n=window)===null||n===void 0?void 0:n.scrollX)||0,v=((r=window)===null||r===void 0?void 0:r.scrollY)||0,y=l+d+h,g=c+this.offset.top+f/2+v;this.mouseHandlerCallback({pageX:y,pageY:g})}}}])})();function MG(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e==null?void 0:e[0],o=e==null?void 0:e[1];if(r&&o&&fe(r)&&fe(o))return!0}return!1}function CG(e,t,n,r){var o=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-o:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-o,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function XN(e){var t=e.cx,n=e.cy,r=e.radius,o=e.startAngle,l=e.endAngle,c=qt(t,n,r,o),f=qt(t,n,r,l);return{points:[c,f],cx:t,cy:n,radius:r,startAngle:o,endAngle:l}}function NG(e,t,n){var r,o,l,c;if(e==="horizontal")r=t.x,l=r,o=n.top,c=n.top+n.height;else if(e==="vertical")o=t.y,c=o,r=n.left,l=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var f=t.cx,d=t.cy,h=t.innerRadius,v=t.outerRadius,y=t.angle,g=qt(f,d,h,y),x=qt(f,d,v,y);r=g.x,o=g.y,l=x.x,c=x.y}else return XN(t);return[{x:r,y:o},{x:l,y:c}]}function Pl(e){"@babel/helpers - typeof";return Pl=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},Pl(e)}function D2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function bs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?D2(Object(n),!0).forEach(function(r){DG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function DG(e,t,n){return t=PG(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PG(e){var t=RG(e,"string");return Pl(t)=="symbol"?t:t+""}function RG(e,t){if(Pl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $G(e){var t,n,r=e.element,o=e.tooltipEventType,l=e.isActive,c=e.activeCoordinate,f=e.activePayload,d=e.offset,h=e.activeTooltipIndex,v=e.tooltipAxisBandSize,y=e.layout,g=e.chartName,x=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!x||!l||!c||g!=="ScatterChart"&&o!=="axis")return null;var _,S=oo;if(g==="ScatterChart")_=c,S=_I;else if(g==="BarChart")_=CG(y,c,d,v),S=D0;else if(y==="radial"){var b=XN(c),w=b.cx,E=b.cy,j=b.radius,N=b.startAngle,A=b.endAngle;_={cx:w,cy:E,startAngle:N,endAngle:A,innerRadius:j,outerRadius:j},S=QC}else _={points:NG(y,c,d)},S=oo;var T=bs(bs(bs(bs({stroke:"#ccc",pointerEvents:"none"},d),_),Ee(x,!1)),{},{payload:f,payloadIndex:h,className:$e("recharts-tooltip-cursor",x.className)});return W.isValidElement(x)?W.cloneElement(x,T):W.createElement(S,T)}var qG=["item"],zG=["children","className","width","height","style","compact","title","desc"];function Co(e){"@babel/helpers - typeof";return Co=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},Co(e)}function no(){return no=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},no.apply(this,arguments)}function P2(e,t){return kG(e)||LG(e,t)||VN(e,t)||BG()}function BG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
186
186
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,l,c,f=[],d=!0,h=!1;try{if(l=(n=n.call(e)).next,t!==0)for(;!(d=(r=l.call(n)).done)&&(f.push(r.value),f.length!==t);d=!0);}catch(v){h=!0,o=v}finally{try{if(!d&&n.return!=null&&(c=n.return(),Object(c)!==c))return}finally{if(h)throw o}}return f}}function kG(e){if(Array.isArray(e))return e}function R2(e,t){if(e==null)return{};var n=UG(e,t),r,o;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)r=l[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function UG(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 IG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HG(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,ZN(r.key),r)}}function GG(e,t,n){return t&&HG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function YG(e,t,n){return t=Sf(t),XG(e,KN()?Reflect.construct(t,n||[],Sf(e).constructor):t.apply(e,n))}function XG(e,t){if(t&&(Co(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return KG(e)}function KG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function KN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KN=function(){return!!e})()}function Sf(e){return Sf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sf(e)}function VG(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&&Pb(e,t)}function Pb(e,t){return Pb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Pb(e,t)}function No(e){return QG(e)||FG(e)||VN(e)||ZG()}function ZG(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
187
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VN(e,t){if(e){if(typeof e=="string")return Rb(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 Rb(e,t)}}function FG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function QG(e){if(Array.isArray(e))return Rb(e)}function Rb(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 $2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$2(Object(n),!0).forEach(function(r){be(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function be(e,t,n){return t=ZN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZN(e){var t=WG(e,"string");return Co(t)=="symbol"?t:t+""}function WG(e,t){if(Co(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var JG={xAxis:["bottom","top"],yAxis:["left","right"]},eY={width:"100%",height:"100%"},FN={x:0,y:0};function xs(e){return e}var tY=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},nY=function(t,n,r,o){var l=n.find(function(v){return v&&v.index===r});if(l){if(t==="horizontal")return{x:l.coordinate,y:o.y};if(t==="vertical")return{x:o.x,y:l.coordinate};if(t==="centric"){var c=l.coordinate,f=o.radius;return ne(ne(ne({},o),qt(o.cx,o.cy,f,c)),{},{angle:c,radius:f})}var d=l.coordinate,h=o.angle;return ne(ne(ne({},o),qt(o.cx,o.cy,d,h)),{},{angle:h,radius:d})}return FN},Jf=function(t,n){var r=n.graphicalItems,o=n.dataStartIndex,l=n.dataEndIndex,c=(r??[]).reduce(function(f,d){var h=d.props.data;return h&&h.length?[].concat(No(f),No(h)):f},[]);return c.length>0?c:t&&t.length&&fe(o)&&fe(l)?t.slice(o,l+1):[]};function QN(e){return e==="number"?[0,"auto"]:void 0}var $b=function(t,n,r,o){var l=t.graphicalItems,c=t.tooltipAxis,f=Jf(n,t);return r<0||!l||!l.length||r>=f.length?null:l.reduce(function(d,h){var v,y=(v=h.props.data)!==null&&v!==void 0?v:n;y&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(y=y.slice(t.dataStartIndex,t.dataEndIndex+1));var g;if(c.dataKey&&!c.allowDuplicatedCategory){var x=y===void 0?f:y;g=Ss(x,c.dataKey,o)}else g=y&&y[r]||f[r];return g?[].concat(No(d),[VC(h,g)]):d},[])},q2=function(t,n,r,o){var l=o||{x:t.chartX,y:t.chartY},c=tY(l,r),f=t.orderedTooltipTicks,d=t.tooltipAxis,h=t.tooltipTicks,v=n5(c,f,h,d);if(v>=0&&h){var y=h[v]&&h[v].value,g=$b(t,n,v,y),x=nY(r,f,v,l);return{activeTooltipIndex:v,activeLabel:y,activePayload:g,activeCoordinate:x}}return null},rY=function(t,n){var r=n.axes,o=n.graphicalItems,l=n.axisType,c=n.axisIdKey,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,y=t.children,g=t.stackOffset,x=YC(v,l);return r.reduce(function(_,S){var b,w=S.type.defaultProps!==void 0?ne(ne({},S.type.defaultProps),S.props):S.props,E=w.type,j=w.dataKey,N=w.allowDataOverflow,A=w.allowDuplicatedCategory,T=w.scale,C=w.ticks,$=w.includeHidden,z=w[c];if(_[z])return _;var F=Jf(t.data,{graphicalItems:o.filter(function(I){var re,se=c in I.props?I.props[c]:(re=I.type.defaultProps)===null||re===void 0?void 0:re[c];return se===z}),dataStartIndex:d,dataEndIndex:h}),U=F.length,B,V,Q;MG(w.domain,N,E)&&(B=Wg(w.domain,null,N),x&&(E==="number"||T!=="auto")&&(Q=Fu(F,j,"category")));var Z=QN(E);if(!B||B.length===0){var R,G=(R=w.domain)!==null&&R!==void 0?R:Z;if(j){if(B=Fu(F,j,E),E==="category"&&x){var ee=V3(B);A&&ee?(V=B,B=uf(0,U)):A||(B=VE(G,B,S).reduce(function(I,re){return I.indexOf(re)>=0?I:[].concat(No(I),[re])},[]))}else if(E==="category")A?B=B.filter(function(I){return I!==""&&!je(I)}):B=VE(G,B,S).reduce(function(I,re){return I.indexOf(re)>=0||re===""||je(re)?I:[].concat(No(I),[re])},[]);else if(E==="number"){var oe=u5(F,o.filter(function(I){var re,se,pe=c in I.props?I.props[c]:(re=I.type.defaultProps)===null||re===void 0?void 0:re[c],me="hide"in I.props?I.props.hide:(se=I.type.defaultProps)===null||se===void 0?void 0:se.hide;return pe===z&&($||!me)}),j,l,v);oe&&(B=oe)}x&&(E==="number"||T!=="auto")&&(Q=Fu(F,j,"category"))}else x?B=uf(0,U):f&&f[z]&&f[z].hasStack&&E==="number"?B=g==="expand"?[0,1]:KC(f[z].stackGroups,d,h):B=GC(F,o.filter(function(I){var re=c in I.props?I.props[c]:I.type.defaultProps[c],se="hide"in I.props?I.props.hide:I.type.defaultProps.hide;return re===z&&($||!se)}),E,v,!0);if(E==="number")B=Db(y,B,z,l,C),G&&(B=Wg(G,B,N));else if(E==="category"&&G){var le=G,P=B.every(function(I){return le.indexOf(I)>=0});P&&(B=le)}}return ne(ne({},_),{},be({},z,ne(ne({},w),{},{axisType:l,domain:B,categoricalDomain:Q,duplicateDomain:V,originalDomain:(b=w.domain)!==null&&b!==void 0?b:Z,isCategorical:x,layout:v})))},{})},aY=function(t,n){var r=n.graphicalItems,o=n.Axis,l=n.axisType,c=n.axisIdKey,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,y=t.children,g=Jf(t.data,{graphicalItems:r,dataStartIndex:d,dataEndIndex:h}),x=g.length,_=YC(v,l),S=-1;return r.reduce(function(b,w){var E=w.type.defaultProps!==void 0?ne(ne({},w.type.defaultProps),w.props):w.props,j=E[c],N=QN("number");if(!b[j]){S++;var A;return _?A=uf(0,x):f&&f[j]&&f[j].hasStack?(A=KC(f[j].stackGroups,d,h),A=Db(y,A,j,l)):(A=Wg(N,GC(g,r.filter(function(T){var C,$,z=c in T.props?T.props[c]:(C=T.type.defaultProps)===null||C===void 0?void 0:C[c],F="hide"in T.props?T.props.hide:($=T.type.defaultProps)===null||$===void 0?void 0:$.hide;return z===j&&!F}),"number",v),o.defaultProps.allowDataOverflow),A=Db(y,A,j,l)),ne(ne({},b),{},be({},j,ne(ne({axisType:l},o.defaultProps),{},{hide:!0,orientation:Cn(JG,"".concat(l,".").concat(S%2),null),domain:A,originalDomain:N,isCategorical:_,layout:v})))}return b},{})},iY=function(t,n){var r=n.axisType,o=r===void 0?"xAxis":r,l=n.AxisComp,c=n.graphicalItems,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.children,y="".concat(o,"Id"),g=Nn(v,l),x={};return g&&g.length?x=rY(t,{axes:g,graphicalItems:c,axisType:o,axisIdKey:y,stackGroups:f,dataStartIndex:d,dataEndIndex:h}):c&&c.length&&(x=aY(t,{Axis:l,graphicalItems:c,axisType:o,axisIdKey:y,stackGroups:f,dataStartIndex:d,dataEndIndex:h})),x},oY=function(t){var n=ya(t),r=jr(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:i0(r,function(o){return o.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Fs(n,r)}},z2=function(t){var n=t.children,r=t.defaultShowTooltip,o=hn(n,xo),l=0,c=0;return t.data&&t.data.length!==0&&(c=t.data.length-1),o&&o.props&&(o.props.startIndex>=0&&(l=o.props.startIndex),o.props.endIndex>=0&&(c=o.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:l,dataEndIndex:c,activeTooltipIndex:-1,isTooltipActive:!!r}},uY=function(t){return!t||!t.length?!1:t.some(function(n){var r=Mr(n&&n.type);return r&&r.indexOf("Bar")>=0})},B2=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"}},lY=function(t,n){var r=t.props,o=t.graphicalItems,l=t.xAxisMap,c=l===void 0?{}:l,f=t.yAxisMap,d=f===void 0?{}:f,h=r.width,v=r.height,y=r.children,g=r.margin||{},x=hn(y,xo),_=hn(y,ba),S=Object.keys(d).reduce(function(A,T){var C=d[T],$=C.orientation;return!C.mirror&&!C.hide?ne(ne({},A),{},be({},$,A[$]+C.width)):A},{left:g.left||0,right:g.right||0}),b=Object.keys(c).reduce(function(A,T){var C=c[T],$=C.orientation;return!C.mirror&&!C.hide?ne(ne({},A),{},be({},$,Cn(A,"".concat($))+C.height)):A},{top:g.top||0,bottom:g.bottom||0}),w=ne(ne({},b),S),E=w.bottom;x&&(w.bottom+=x.props.height||xo.defaultProps.height),_&&n&&(w=i5(w,o,r,n));var j=h-w.left-w.right,N=v-w.top-w.bottom;return ne(ne({brushBottom:E},w),{},{width:Math.max(j,0),height:Math.max(N,0)})},cY=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},I0=function(t){var n=t.chartName,r=t.GraphicalChild,o=t.defaultTooltipEventType,l=o===void 0?"axis":o,c=t.validateTooltipEventTypes,f=c===void 0?["axis"]:c,d=t.axisComponents,h=t.legendContent,v=t.formatAxisMap,y=t.defaultProps,g=function(w,E){var j=E.graphicalItems,N=E.stackGroups,A=E.offset,T=E.updateId,C=E.dataStartIndex,$=E.dataEndIndex,z=w.barSize,F=w.layout,U=w.barGap,B=w.barCategoryGap,V=w.maxBarSize,Q=B2(F),Z=Q.numericAxisName,R=Q.cateAxisName,G=uY(j),ee=[];return j.forEach(function(oe,le){var P=Jf(w.data,{graphicalItems:[oe],dataStartIndex:C,dataEndIndex:$}),I=oe.type.defaultProps!==void 0?ne(ne({},oe.type.defaultProps),oe.props):oe.props,re=I.dataKey,se=I.maxBarSize,pe=I["".concat(Z,"Id")],me=I["".concat(R,"Id")],Me={},ke=d.reduce(function($n,or){var Uo=E["".concat(or.axisType,"Map")],Bt=I["".concat(or.axisType,"Id")];Uo&&Uo[Bt]||or.axisType==="zAxis"||ai();var Hl=Uo[Bt];return ne(ne({},$n),{},be(be({},or.axisType,Hl),"".concat(or.axisType,"Ticks"),jr(Hl)))},Me),ce=ke[R],xe=ke["".concat(R,"Ticks")],Se=N&&N[pe]&&N[pe].hasStack&&b5(oe,N[pe].stackGroups),ue=Mr(oe.type).indexOf("Bar")>=0,et=Fs(ce,xe),we=[],ot=G&&r5({barSize:z,stackGroups:N,totalSize:cY(ke,R)});if(ue){var ut,zt,Rn=je(se)?V:se,Kn=(ut=(zt=Fs(ce,xe,!0))!==null&&zt!==void 0?zt:Rn)!==null&&ut!==void 0?ut:0;we=a5({barGap:U,barCategoryGap:B,bandSize:Kn!==et?Kn:et,sizeList:ot[me],maxBarSize:Rn}),Kn!==et&&(we=we.map(function($n){return ne(ne({},$n),{},{position:ne(ne({},$n.position),{},{offset:$n.position.offset-Kn/2})})}))}var Ir=oe&&oe.type&&oe.type.getComposedData;Ir&&ee.push({props:ne(ne({},Ir(ne(ne({},ke),{},{displayedData:P,props:w,dataKey:re,item:oe,bandSize:et,barPosition:we,offset:A,stackedData:Se,layout:F,dataStartIndex:C,dataEndIndex:$}))),{},be(be(be({key:oe.key||"item-".concat(le)},Z,ke[Z]),R,ke[R]),"animationId",T)),childIndex:o$(oe,w.children),item:oe})}),ee},x=function(w,E){var j=w.props,N=w.dataStartIndex,A=w.dataEndIndex,T=w.updateId;if(!cA({props:j}))return null;var C=j.children,$=j.layout,z=j.stackOffset,F=j.data,U=j.reverseStackOrder,B=B2($),V=B.numericAxisName,Q=B.cateAxisName,Z=Nn(C,r),R=y5(F,Z,"".concat(V,"Id"),"".concat(Q,"Id"),z,U),G=d.reduce(function(I,re){var se="".concat(re.axisType,"Map");return ne(ne({},I),{},be({},se,iY(j,ne(ne({},re),{},{graphicalItems:Z,stackGroups:re.axisType===V&&R,dataStartIndex:N,dataEndIndex:A}))))},{}),ee=lY(ne(ne({},G),{},{props:j,graphicalItems:Z}),E==null?void 0:E.legendBBox);Object.keys(G).forEach(function(I){G[I]=v(j,G[I],ee,I.replace("Map",""),n)});var oe=G["".concat(Q,"Map")],le=oY(oe),P=g(j,ne(ne({},G),{},{dataStartIndex:N,dataEndIndex:A,updateId:T,graphicalItems:Z,stackGroups:R,offset:ee}));return ne(ne({formattedGraphicalItems:P,graphicalItems:Z,offset:ee,stackGroups:R},le),G)},_=(function(b){function w(E){var j,N,A;return IG(this,w),A=YG(this,w,[E]),be(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),be(A,"accessibilityManager",new jG),be(A,"handleLegendBBoxUpdate",function(T){if(T){var C=A.state,$=C.dataStartIndex,z=C.dataEndIndex,F=C.updateId;A.setState(ne({legendBBox:T},x({props:A.props,dataStartIndex:$,dataEndIndex:z,updateId:F},ne(ne({},A.state),{},{legendBBox:T}))))}}),be(A,"handleReceiveSyncEvent",function(T,C,$){if(A.props.syncId===T){if($===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(C)}}),be(A,"handleBrushChange",function(T){var C=T.startIndex,$=T.endIndex;if(C!==A.state.dataStartIndex||$!==A.state.dataEndIndex){var z=A.state.updateId;A.setState(function(){return ne({dataStartIndex:C,dataEndIndex:$},x({props:A.props,dataStartIndex:C,dataEndIndex:$,updateId:z},A.state))}),A.triggerSyncEvent({dataStartIndex:C,dataEndIndex:$})}}),be(A,"handleMouseEnter",function(T){var C=A.getMouseInfo(T);if(C){var $=ne(ne({},C),{},{isTooltipActive:!0});A.setState($),A.triggerSyncEvent($);var z=A.props.onMouseEnter;Ae(z)&&z($,T)}}),be(A,"triggeredAfterMouseMove",function(T){var C=A.getMouseInfo(T),$=C?ne(ne({},C),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState($),A.triggerSyncEvent($);var z=A.props.onMouseMove;Ae(z)&&z($,T)}),be(A,"handleItemMouseEnter",function(T){A.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),be(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),be(A,"handleMouseMove",function(T){T.persist(),A.throttleTriggeredAfterMouseMove(T)}),be(A,"handleMouseLeave",function(T){A.throttleTriggeredAfterMouseMove.cancel();var C={isTooltipActive:!1};A.setState(C),A.triggerSyncEvent(C);var $=A.props.onMouseLeave;Ae($)&&$(C,T)}),be(A,"handleOuterEvent",function(T){var C=i$(T),$=Cn(A.props,"".concat(C));if(C&&Ae($)){var z,F;/.*touch.*/i.test(C)?F=A.getMouseInfo(T.changedTouches[0]):F=A.getMouseInfo(T),$((z=F)!==null&&z!==void 0?z:{},T)}}),be(A,"handleClick",function(T){var C=A.getMouseInfo(T);if(C){var $=ne(ne({},C),{},{isTooltipActive:!0});A.setState($),A.triggerSyncEvent($);var z=A.props.onClick;Ae(z)&&z($,T)}}),be(A,"handleMouseDown",function(T){var C=A.props.onMouseDown;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleMouseUp",function(T){var C=A.props.onMouseUp;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),be(A,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.handleMouseDown(T.changedTouches[0])}),be(A,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.handleMouseUp(T.changedTouches[0])}),be(A,"handleDoubleClick",function(T){var C=A.props.onDoubleClick;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleContextMenu",function(T){var C=A.props.onContextMenu;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"triggerSyncEvent",function(T){A.props.syncId!==void 0&&vg.emit(yg,A.props.syncId,T,A.eventEmitterSymbol)}),be(A,"applySyncEvent",function(T){var C=A.props,$=C.layout,z=C.syncMethod,F=A.state.updateId,U=T.dataStartIndex,B=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)A.setState(ne({dataStartIndex:U,dataEndIndex:B},x({props:A.props,dataStartIndex:U,dataEndIndex:B,updateId:F},A.state)));else if(T.activeTooltipIndex!==void 0){var V=T.chartX,Q=T.chartY,Z=T.activeTooltipIndex,R=A.state,G=R.offset,ee=R.tooltipTicks;if(!G)return;if(typeof z=="function")Z=z(ee,T);else if(z==="value"){Z=-1;for(var oe=0;oe<ee.length;oe++)if(ee[oe].value===T.activeLabel){Z=oe;break}}var le=ne(ne({},G),{},{x:G.left,y:G.top}),P=Math.min(V,le.x+le.width),I=Math.min(Q,le.y+le.height),re=ee[Z]&&ee[Z].value,se=$b(A.state,A.props.data,Z),pe=ee[Z]?{x:$==="horizontal"?ee[Z].coordinate:P,y:$==="horizontal"?I:ee[Z].coordinate}:FN;A.setState(ne(ne({},T),{},{activeLabel:re,activeCoordinate:pe,activePayload:se,activeTooltipIndex:Z}))}else A.setState(T)}),be(A,"renderCursor",function(T){var C,$=A.state,z=$.isTooltipActive,F=$.activeCoordinate,U=$.activePayload,B=$.offset,V=$.activeTooltipIndex,Q=$.tooltipAxisBandSize,Z=A.getTooltipEventType(),R=(C=T.props.active)!==null&&C!==void 0?C:z,G=A.props.layout,ee=T.key||"_recharts-cursor";return L.createElement($G,{key:ee,activeCoordinate:F,activePayload:U,activeTooltipIndex:V,chartName:n,element:T,isActive:R,layout:G,offset:B,tooltipAxisBandSize:Q,tooltipEventType:Z})}),be(A,"renderPolarAxis",function(T,C,$){var z=Cn(T,"type.axisType"),F=Cn(A.state,"".concat(z,"Map")),U=T.type.defaultProps,B=U!==void 0?ne(ne({},U),T.props):T.props,V=F&&F[B["".concat(z,"Id")]];return W.cloneElement(T,ne(ne({},V),{},{className:$e(z,V.className),key:T.key||"".concat(C,"-").concat($),ticks:jr(V,!0)}))}),be(A,"renderPolarGrid",function(T){var C=T.props,$=C.radialLines,z=C.polarAngles,F=C.polarRadius,U=A.state,B=U.radiusAxisMap,V=U.angleAxisMap,Q=ya(B),Z=ya(V),R=Z.cx,G=Z.cy,ee=Z.innerRadius,oe=Z.outerRadius;return W.cloneElement(T,{polarAngles:Array.isArray(z)?z:jr(Z,!0).map(function(le){return le.coordinate}),polarRadius:Array.isArray(F)?F:jr(Q,!0).map(function(le){return le.coordinate}),cx:R,cy:G,innerRadius:ee,outerRadius:oe,key:T.key||"polar-grid",radialLines:$})}),be(A,"renderLegend",function(){var T=A.state.formattedGraphicalItems,C=A.props,$=C.children,z=C.width,F=C.height,U=A.props.margin||{},B=z-(U.left||0)-(U.right||0),V=IC({children:$,formattedGraphicalItems:T,legendWidth:B,legendContent:h});if(!V)return null;var Q=V.item,Z=R2(V,qG);return W.cloneElement(Q,ne(ne({},Z),{},{chartWidth:z,chartHeight:F,margin:U,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),be(A,"renderTooltip",function(){var T,C=A.props,$=C.children,z=C.accessibilityLayer,F=hn($,pn);if(!F)return null;var U=A.state,B=U.isTooltipActive,V=U.activeCoordinate,Q=U.activePayload,Z=U.activeLabel,R=U.offset,G=(T=F.props.active)!==null&&T!==void 0?T:B;return W.cloneElement(F,{viewBox:ne(ne({},R),{},{x:R.left,y:R.top}),active:G,label:Z,payload:G?Q:[],coordinate:V,accessibilityLayer:z})}),be(A,"renderBrush",function(T){var C=A.props,$=C.margin,z=C.data,F=A.state,U=F.offset,B=F.dataStartIndex,V=F.dataEndIndex,Q=F.updateId;return W.cloneElement(T,{key:T.key||"_recharts-brush",onChange:vs(A.handleBrushChange,T.props.onChange),data:z,x:fe(T.props.x)?T.props.x:U.left,y:fe(T.props.y)?T.props.y:U.top+U.height+U.brushBottom-($.bottom||0),width:fe(T.props.width)?T.props.width:U.width,startIndex:B,endIndex:V,updateId:"brush-".concat(Q)})}),be(A,"renderReferenceElement",function(T,C,$){if(!T)return null;var z=A,F=z.clipPathId,U=A.state,B=U.xAxisMap,V=U.yAxisMap,Q=U.offset,Z=T.type.defaultProps||{},R=T.props,G=R.xAxisId,ee=G===void 0?Z.xAxisId:G,oe=R.yAxisId,le=oe===void 0?Z.yAxisId:oe;return W.cloneElement(T,{key:T.key||"".concat(C,"-").concat($),xAxis:B[ee],yAxis:V[le],viewBox:{x:Q.left,y:Q.top,width:Q.width,height:Q.height},clipPathId:F})}),be(A,"renderActivePoints",function(T){var C=T.item,$=T.activePoint,z=T.basePoint,F=T.childIndex,U=T.isRange,B=[],V=C.props.key,Q=C.item.type.defaultProps!==void 0?ne(ne({},C.item.type.defaultProps),C.item.props):C.item.props,Z=Q.activeDot,R=Q.dataKey,G=ne(ne({index:F,dataKey:R,cx:$.x,cy:$.y,r:4,fill:N0(C.item),strokeWidth:2,stroke:"#fff",payload:$.payload,value:$.value},Ee(Z,!1)),Os(Z));return B.push(w.renderActiveDot(Z,G,"".concat(V,"-activePoint-").concat(F))),z?B.push(w.renderActiveDot(Z,ne(ne({},G),{},{cx:z.x,cy:z.y}),"".concat(V,"-basePoint-").concat(F))):U&&B.push(null),B}),be(A,"renderGraphicChild",function(T,C,$){var z=A.filterFormatItem(T,C,$);if(!z)return null;var F=A.getTooltipEventType(),U=A.state,B=U.isTooltipActive,V=U.tooltipAxis,Q=U.activeTooltipIndex,Z=U.activeLabel,R=A.props.children,G=hn(R,pn),ee=z.props,oe=ee.points,le=ee.isRange,P=ee.baseLine,I=z.item.type.defaultProps!==void 0?ne(ne({},z.item.type.defaultProps),z.item.props):z.item.props,re=I.activeDot,se=I.hide,pe=I.activeBar,me=I.activeShape,Me=!!(!se&&B&&G&&(re||pe||me)),ke={};F!=="axis"&&G&&G.props.trigger==="click"?ke={onClick:vs(A.handleItemMouseEnter,T.props.onClick)}:F!=="axis"&&(ke={onMouseLeave:vs(A.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:vs(A.handleItemMouseEnter,T.props.onMouseEnter)});var ce=W.cloneElement(T,ne(ne({},z.props),ke));function xe(or){return typeof V.dataKey=="function"?V.dataKey(or.payload):null}if(Me)if(Q>=0){var Se,ue;if(V.dataKey&&!V.allowDuplicatedCategory){var et=typeof V.dataKey=="function"?xe:"payload.".concat(V.dataKey.toString());Se=Ss(oe,et,Z),ue=le&&P&&Ss(P,et,Z)}else Se=oe==null?void 0:oe[Q],ue=le&&P&&P[Q];if(me||pe){var we=T.props.activeIndex!==void 0?T.props.activeIndex:Q;return[W.cloneElement(T,ne(ne(ne({},z.props),ke),{},{activeIndex:we})),null,null]}if(!je(Se))return[ce].concat(No(A.renderActivePoints({item:z,activePoint:Se,basePoint:ue,childIndex:Q,isRange:le})))}else{var ot,ut=(ot=A.getItemByXY(A.state.activeCoordinate))!==null&&ot!==void 0?ot:{graphicalItem:ce},zt=ut.graphicalItem,Rn=zt.item,Kn=Rn===void 0?T:Rn,Ir=zt.childIndex,$n=ne(ne(ne({},z.props),ke),{},{activeIndex:Ir});return[W.cloneElement(Kn,$n),null,null]}return le?[ce,null,null]:[ce,null]}),be(A,"renderCustomized",function(T,C,$){return W.cloneElement(T,ne(ne({key:"recharts-customized-".concat($)},A.props),A.state))}),be(A,"renderMap",{CartesianGrid:{handler:xs,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:xs},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:xs},YAxis:{handler:xs},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((j=E.id)!==null&&j!==void 0?j:$o("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=IM(A.triggeredAfterMouseMove,(N=E.throttleDelay)!==null&&N!==void 0?N:1e3/60),A.state={},A}return VG(w,b),GG(w,[{key:"componentDidMount",value:function(){var j,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var j=this.props,N=j.children,A=j.data,T=j.height,C=j.layout,$=hn(N,pn);if($){var z=$.props.defaultIndex;if(!(typeof z!="number"||z<0||z>this.state.tooltipTicks.length-1)){var F=this.state.tooltipTicks[z]&&this.state.tooltipTicks[z].value,U=$b(this.state,A,z,F),B=this.state.tooltipTicks[z].coordinate,V=(this.state.offset.top+T)/2,Q=C==="horizontal",Z=Q?{x:B,y:V}:{y:B,x:V},R=this.state.formattedGraphicalItems.find(function(ee){var oe=ee.item;return oe.type.name==="Scatter"});R&&(Z=ne(ne({},Z),R.props.points[z].tooltipPosition),U=R.props.points[z].tooltipPayload);var G={activeTooltipIndex:z,isTooltipActive:!0,activeLabel:F,activePayload:U,activeCoordinate:Z};this.setState(G),this.renderCursor($),this.accessibilityManager.setIndex(z)}}}},{key:"getSnapshotBeforeUpdate",value:function(j,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==j.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==j.margin){var A,T;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(j){xg([hn(j.children,pn)],[hn(this.props.children,pn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var j=hn(this.props.children,pn);if(j&&typeof j.props.shared=="boolean"){var N=j.props.shared?"axis":"item";return f.indexOf(N)>=0?N:l}return l}},{key:"getMouseInfo",value:function(j){if(!this.container)return null;var N=this.container,A=N.getBoundingClientRect(),T=X8(A),C={chartX:Math.round(j.pageX-T.left),chartY:Math.round(j.pageY-T.top)},$=A.width/N.offsetWidth||1,z=this.inRange(C.chartX,C.chartY,$);if(!z)return null;var F=this.state,U=F.xAxisMap,B=F.yAxisMap,V=this.getTooltipEventType(),Q=q2(this.state,this.props.data,this.props.layout,z);if(V!=="axis"&&U&&B){var Z=ya(U).scale,R=ya(B).scale,G=Z&&Z.invert?Z.invert(C.chartX):null,ee=R&&R.invert?R.invert(C.chartY):null;return ne(ne({},C),{},{xValue:G,yValue:ee},Q)}return Q?ne(ne({},C),Q):null}},{key:"inRange",value:function(j,N){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,C=j/A,$=N/A;if(T==="horizontal"||T==="vertical"){var z=this.state.offset,F=C>=z.left&&C<=z.left+z.width&&$>=z.top&&$<=z.top+z.height;return F?{x:C,y:$}:null}var U=this.state,B=U.angleAxisMap,V=U.radiusAxisMap;if(B&&V){var Q=ya(B);return QE({x:C,y:$},Q)}return null}},{key:"parseEventsOfWrapper",value:function(){var j=this.props.children,N=this.getTooltipEventType(),A=hn(j,pn),T={};A&&N==="axis"&&(A.props.trigger==="click"?T={onClick:this.handleClick}:T={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 C=Os(this.props,this.handleOuterEvent);return ne(ne({},C),T)}},{key:"addListener",value:function(){vg.on(yg,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){vg.removeListener(yg,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(j,N,A){for(var T=this.state.formattedGraphicalItems,C=0,$=T.length;C<$;C++){var z=T[C];if(z.item===j||z.props.key===j.key||N===Mr(z.item.type)&&A===z.childIndex)return z}return null}},{key:"renderClipPath",value:function(){var j=this.clipPathId,N=this.state.offset,A=N.left,T=N.top,C=N.height,$=N.width;return L.createElement("defs",null,L.createElement("clipPath",{id:j},L.createElement("rect",{x:A,y:T,height:C,width:$})))}},{key:"getXScales",value:function(){var j=this.state.xAxisMap;return j?Object.entries(j).reduce(function(N,A){var T=P2(A,2),C=T[0],$=T[1];return ne(ne({},N),{},be({},C,$.scale))},{}):null}},{key:"getYScales",value:function(){var j=this.state.yAxisMap;return j?Object.entries(j).reduce(function(N,A){var T=P2(A,2),C=T[0],$=T[1];return ne(ne({},N),{},be({},C,$.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(j){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(j){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(j){var N=this.state,A=N.formattedGraphicalItems,T=N.activeItem;if(A&&A.length)for(var C=0,$=A.length;C<$;C++){var z=A[C],F=z.props,U=z.item,B=U.type.defaultProps!==void 0?ne(ne({},U.type.defaultProps),U.props):U.props,V=Mr(U.type);if(V==="Bar"){var Q=(F.data||[]).find(function(ee){return hI(j,ee)});if(Q)return{graphicalItem:z,payload:Q}}else if(V==="RadialBar"){var Z=(F.data||[]).find(function(ee){return QE(j,ee)});if(Z)return{graphicalItem:z,payload:Z}}else if(Yf(z,T)||Xf(z,T)||El(z,T)){var R=r9({graphicalItem:z,activeTooltipItem:T,itemData:B.data}),G=B.activeIndex===void 0?R:B.activeIndex;return{graphicalItem:ne(ne({},z),{},{childIndex:G}),payload:El(z,T)?B.data[R]:z.props.data[R]}}}return null}},{key:"render",value:function(){var j=this;if(!cA(this))return null;var N=this.props,A=N.children,T=N.className,C=N.width,$=N.height,z=N.style,F=N.compact,U=N.title,B=N.desc,V=R2(N,zG),Q=Ee(V,!1);if(F)return L.createElement(d2,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement(Og,no({},Q,{width:C,height:$,title:U,desc:B}),this.renderClipPath(),fA(A,this.renderMap)));if(this.props.accessibilityLayer){var Z,R;Q.tabIndex=(Z=this.props.tabIndex)!==null&&Z!==void 0?Z:0,Q.role=(R=this.props.role)!==null&&R!==void 0?R:"application",Q.onKeyDown=function(ee){j.accessibilityManager.keyboardEvent(ee)},Q.onFocus=function(){j.accessibilityManager.focus()}}var G=this.parseEventsOfWrapper();return L.createElement(d2,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement("div",no({className:$e("recharts-wrapper",T),style:ne({position:"relative",cursor:"default",width:C,height:$},z)},G,{ref:function(oe){j.container=oe}}),L.createElement(Og,no({},Q,{width:C,height:$,title:U,desc:B,style:eY}),this.renderClipPath(),fA(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(W.Component);be(_,"displayName",n),be(_,"defaultProps",ne({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},y)),be(_,"getDerivedStateFromProps",function(b,w){var E=b.dataKey,j=b.data,N=b.children,A=b.width,T=b.height,C=b.layout,$=b.stackOffset,z=b.margin,F=w.dataStartIndex,U=w.dataEndIndex;if(w.updateId===void 0){var B=z2(b);return ne(ne(ne({},B),{},{updateId:0},x(ne(ne({props:b},B),{},{updateId:0}),w)),{},{prevDataKey:E,prevData:j,prevWidth:A,prevHeight:T,prevLayout:C,prevStackOffset:$,prevMargin:z,prevChildren:N})}if(E!==w.prevDataKey||j!==w.prevData||A!==w.prevWidth||T!==w.prevHeight||C!==w.prevLayout||$!==w.prevStackOffset||!ro(z,w.prevMargin)){var V=z2(b),Q={chartX:w.chartX,chartY:w.chartY,isTooltipActive:w.isTooltipActive},Z=ne(ne({},q2(w,j,C)),{},{updateId:w.updateId+1}),R=ne(ne(ne({},V),Q),Z);return ne(ne(ne({},R),x(ne({props:b},R),w)),{},{prevDataKey:E,prevData:j,prevWidth:A,prevHeight:T,prevLayout:C,prevStackOffset:$,prevMargin:z,prevChildren:N})}if(!xg(N,w.prevChildren)){var G,ee,oe,le,P=hn(N,xo),I=P&&(G=(ee=P.props)===null||ee===void 0?void 0:ee.startIndex)!==null&&G!==void 0?G:F,re=P&&(oe=(le=P.props)===null||le===void 0?void 0:le.endIndex)!==null&&oe!==void 0?oe:U,se=I!==F||re!==U,pe=!je(j),me=pe&&!se?w.updateId:w.updateId+1;return ne(ne({updateId:me},x(ne(ne({props:b},w),{},{updateId:me,dataStartIndex:I,dataEndIndex:re}),w)),{},{prevChildren:N,dataStartIndex:I,dataEndIndex:re})}return null}),be(_,"renderActiveDot",function(b,w,E){var j;return W.isValidElement(b)?j=W.cloneElement(b,w):Ae(b)?j=b(w):j=L.createElement(Gf,w),L.createElement(Je,{className:"recharts-active-dot",key:E},j)});var S=W.forwardRef(function(w,E){return L.createElement(_,no({},w,{ref:E}))});return S.displayName=_.displayName,S},sY=I0({chartName:"LineChart",GraphicalChild:Il,axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:P0}),fY=I0({chartName:"BarChart",GraphicalChild:fi,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:P0}),WN=I0({chartName:"AreaChart",GraphicalChild:Yn,axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:P0});function dY(e){return new Date(e).toLocaleString("es",{hour:"2-digit",minute:"2-digit",day:"numeric",month:"short"})}function hY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.input",e,v),ht.timeseries("claude_code.tokens.output",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>({ts:v,label:dY(v),input:f.get(v)??0,output:d.get(v)??0}));return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de tokens"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Tokens por período"}),D.jsx(Rf,{width:"100%",height:220,children:D.jsxs(WN,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsxs("defs",{children:[D.jsxs("linearGradient",{id:"colorInput",x1:"0",y1:"0",x2:"0",y2:"1",children:[D.jsx("stop",{offset:"5%",stopColor:"#4da6ff",stopOpacity:.3}),D.jsx("stop",{offset:"95%",stopColor:"#4da6ff",stopOpacity:0})]}),D.jsxs("linearGradient",{id:"colorOutput",x1:"0",y1:"0",x2:"0",y2:"1",children:[D.jsx("stop",{offset:"5%",stopColor:"#00ff88",stopOpacity:.3}),D.jsx("stop",{offset:"95%",stopColor:"#00ff88",stopOpacity:0})]})]}),D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:v=>v>=1e3?`${(v/1e3).toFixed(0)}K`:String(v)}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},labelStyle:{color:"#888888",fontSize:12},itemStyle:{fontSize:12}}),D.jsx(ba,{wrapperStyle:{fontSize:12,color:"#888888"}}),D.jsx(Yn,{type:"monotone",dataKey:"input",name:"Input",stroke:"#4da6ff",fill:"url(#colorInput)",strokeWidth:2}),D.jsx(Yn,{type:"monotone",dataKey:"output",name:"Output",stroke:"#00ff88",fill:"url(#colorOutput)",strokeWidth:2})]})})]})}function pY(e){return new Date(e).toLocaleDateString("es",{day:"numeric",month:"short"})}function vY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]);W.useEffect(()=>{ht.timeseries("claude_code.cost",e,"1d").then(r).catch(()=>{})},[e,t]);const o=n.map(l=>({label:pY(l.timestamp),cost:Number(l.value.toFixed(4))}));return o.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de coste"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Coste por día ($)"}),D.jsx(Rf,{width:"100%",height:220,children:D.jsxs(fY,{data:o,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a",vertical:!1}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:l=>`$${l.toFixed(3)}`}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},labelStyle:{color:"#888888",fontSize:12},formatter:l=>[`$${l.toFixed(4)}`,"Coste"]}),D.jsx(fi,{dataKey:"cost",fill:"#a855f7",radius:[3,3,0,0]})]})})]})}function yY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.cache.read",e,v),ht.timeseries("claude_code.tokens.cache.creation",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>({label:new Date(v).toLocaleString("es",{hour:"2-digit",day:"numeric",month:"short"}),read:f.get(v)??0,create:d.get(v)??0}));return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de caché"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Tokens de caché"}),D.jsx(Rf,{width:"100%",height:220,children:D.jsxs(WN,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:v=>v>=1e3?`${(v/1e3).toFixed(0)}K`:String(v)}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"}}),D.jsx(ba,{wrapperStyle:{fontSize:12,color:"#888888"}}),D.jsx(Yn,{type:"monotone",dataKey:"read",name:"Leído",stroke:"#00d4aa",fill:"#00d4aa",fillOpacity:.2,strokeWidth:2}),D.jsx(Yn,{type:"monotone",dataKey:"create",name:"Creado",stroke:"#4da6ff",fill:"#4da6ff",fillOpacity:.2,strokeWidth:2})]})})]})}function mY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.input",e,v),ht.timeseries("claude_code.tokens.output",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>{const y=f.get(v)??0,g=d.get(v)??0;return{label:new Date(v).toLocaleString("es",{hour:"2-digit",day:"numeric",month:"short"}),efficiency:y>0?Number((g/y).toFixed(3)):0}});return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de eficiencia"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Ratio output/input"}),D.jsx(Rf,{width:"100%",height:220,children:D.jsxs(sY,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,domain:[0,"auto"]}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},formatter:v=>[v.toFixed(3),"Eficiencia"]}),D.jsx(Vf,{y:.5,stroke:"#444444",strokeDasharray:"4 4",label:{value:"0.5",fill:"#666",fontSize:10}}),D.jsx(Il,{type:"monotone",dataKey:"efficiency",stroke:"#a855f7",strokeWidth:2,dot:!1})]})})]})}function gY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState(null),[c,f]=W.useState([]),[d,h]=W.useState(null),[v,y]=W.useState("");W.useEffect(()=>{ht.sessions(50).then(r).catch(()=>{})},[e,t]);function g(S){o===S?l(null):(l(S),ht.sessionEvents(S).then(f).catch(()=>{}))}function x(S,b,w){w.stopPropagation(),h(S),y(b??"")}async function _(S){v.trim()&&(await ht.labelSession(S,v.trim()).catch(()=>{}),r(b=>b.map(w=>w.sessionId===S?{...w,project:v.trim()}:w))),h(null)}return n.length===0?D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin sesiones registradas"}):D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:D.jsxs("table",{className:"w-full text-sm",children:[D.jsx("thead",{children:D.jsxs("tr",{className:"border-b border-bg-border",children:[D.jsx("th",{className:"w-6 px-3 py-2"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"ID"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Proyecto"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Modelo"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Inicio"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Duración"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Input"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Output"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Coste"})]})}),D.jsx("tbody",{children:n.map(S=>D.jsxs(W.Fragment,{children:[D.jsxs("tr",{className:"border-b border-bg-border hover:bg-bg-card-hover cursor-pointer",onClick:()=>g(S.sessionId),children:[D.jsx("td",{className:"px-3 py-2 text-text-muted",children:o===S.sessionId?D.jsx($R,{size:14}):D.jsx(zR,{size:14})}),D.jsxs("td",{className:"px-3 py-2 font-mono text-text-secondary text-xs",children:[S.sessionId.slice(0,8),"…"]}),D.jsx("td",{className:"px-3 py-2",onClick:b=>b.stopPropagation(),children:d===S.sessionId?D.jsxs("span",{className:"flex items-center gap-1",children:[D.jsx("input",{autoFocus:!0,value:v,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&_(S.sessionId),b.key==="Escape"&&h(null)},className:"bg-bg-base border border-bg-border rounded px-1 py-0.5 text-xs text-text-primary w-24 outline-none focus:border-accent-green"}),D.jsx("button",{onClick:()=>_(S.sessionId),className:"text-accent-green",children:D.jsx(zb,{size:12})}),D.jsx("button",{onClick:()=>h(null),className:"text-accent-orange",children:D.jsx(k2,{size:12})})]}):D.jsxs("span",{onClick:b=>x(S.sessionId,S.project,b),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bg-base border border-bg-border text-text-secondary hover:border-accent-green cursor-pointer transition-colors",children:[S.project??"—",D.jsx(HR,{size:10,className:"opacity-50"})]})}),D.jsx("td",{className:"px-3 py-2 text-text-secondary font-mono text-xs",children:S.model??"—"}),D.jsx("td",{className:"px-3 py-2 text-text-secondary",children:a3(S.startTime)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-text-secondary",children:Bb(S.durationActiveMs)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-blue",children:er(S.tokensInput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-green",children:er(S.tokensOutput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-purple",children:ei(S.cost)})]}),o===S.sessionId&&D.jsx("tr",{children:D.jsx("td",{colSpan:9,className:"bg-bg-subtle px-6 py-3",children:D.jsx("div",{className:"text-xs font-mono space-y-0.5 max-h-40 overflow-y-auto",children:c.length===0?D.jsx("span",{className:"text-text-muted",children:"Sin eventos"}):c.slice(-20).map((b,w)=>D.jsxs("div",{className:"flex gap-2 text-text-secondary",children:[D.jsx("span",{className:"text-text-muted shrink-0",children:new Date(b.timestamp).toLocaleTimeString()}),D.jsx("span",{className:"text-accent-teal",children:b.eventName})]},w))})})})]},S.sessionId))})]})})}function bY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]);if(W.useEffect(()=>{ht.projects(e).then(r).catch(()=>{})},[e,t]),n.length===0)return D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin proyectos registrados"});const o=Math.max(...n.map(l=>l.cost),1e-4);return D.jsxs("div",{className:"flex flex-col gap-4",children:[D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4 space-y-3",children:n.map(l=>D.jsxs("div",{children:[D.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[D.jsx("span",{className:"text-text-primary font-medium",children:l.project}),D.jsx("span",{className:"text-accent-purple font-mono",children:ei(l.cost)})]}),D.jsx("div",{className:"h-2 bg-bg-base rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-accent-purple rounded-full",style:{width:`${l.cost/o*100}%`}})})]},l.project))}),D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:D.jsxs("table",{className:"w-full text-sm",children:[D.jsx("thead",{children:D.jsxs("tr",{className:"border-b border-bg-border",children:[D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Proyecto"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Sesiones"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Input"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Output"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Caché %"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Coste"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Commits"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"LOC +/-"})]})}),D.jsx("tbody",{children:n.map(l=>D.jsxs("tr",{className:"border-b border-bg-border hover:bg-bg-card-hover",children:[D.jsx("td",{className:"px-3 py-2 text-text-primary font-medium",children:l.project}),D.jsx("td",{className:"px-3 py-2 text-right text-text-secondary",children:l.sessions}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-blue",children:er(l.tokensInput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-green",children:er(l.tokensOutput)}),D.jsxs("td",{className:"px-3 py-2 text-right font-mono text-accent-teal",children:[(l.cacheHitRate*100).toFixed(1),"%"]}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-purple",children:ei(l.cost)}),D.jsx("td",{className:"px-3 py-2 text-right text-text-secondary",children:l.commits}),D.jsxs("td",{className:"px-3 py-2 text-right font-mono text-xs",children:[D.jsxs("span",{className:"text-accent-green",children:["+",l.linesAdded]}),D.jsx("span",{className:"text-text-muted",children:" / "}),D.jsxs("span",{className:"text-accent-orange",children:["-",l.linesRemoved]})]})]},l.project))})]})})]})}function xY({timeRange:e,sseVersion:t}){const[n,r]=W.useState(null);if(W.useEffect(()=>{ht.tools(e).then(r).catch(()=>{})},[e,t]),!n||n.usage.length===0)return D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin datos de herramientas"});const o=Math.max(...n.usage.map(f=>f.count),1),l=n.decisionRate.approved+n.decisionRate.rejected,c=l>0?(n.decisionRate.approved/l*100).toFixed(1):"—";return D.jsxs("div",{className:"flex flex-col gap-4",children:[D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("span",{className:"text-text-secondary text-sm",children:"Tasa de aprobación: "}),D.jsxs("span",{className:"text-accent-green font-mono font-bold",children:[c,"%"]}),D.jsxs("span",{className:"text-text-muted text-xs ml-2",children:["(",n.decisionRate.approved," aprobadas / ",n.decisionRate.rejected," rechazadas)"]})]}),D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4 space-y-2",children:n.usage.map(f=>D.jsxs("div",{children:[D.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[D.jsx("span",{className:"font-mono text-text-primary",children:f.toolName}),D.jsxs("span",{className:"text-text-secondary",children:[f.count," usos · ",(f.successRate*100).toFixed(0),"% éxito"]})]}),D.jsx("div",{className:"h-1.5 bg-bg-base rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-accent-teal rounded-full",style:{width:`${f.count/o*100}%`}})})]},f.toolName))})]})}const SY=[{id:"all",label:"Todos"},{id:"api",label:"API"},{id:"tools",label:"Tools"},{id:"prompts",label:"Prompts"},{id:"errors",label:"Errores"}];function OY(e){return e.includes("error")?"text-accent-orange":e==="user_prompt"?"text-accent-blue":e==="api_request"?"text-accent-green":e==="tool_use"?"text-accent-teal":e.startsWith("hook_")?"text-accent-yellow":"text-text-secondary"}function _Y(e,t){return t==="all"?!0:t==="api"?e.eventName.includes("api"):t==="tools"?e.eventName.includes("tool"):t==="prompts"?e.eventName.includes("prompt"):t==="errors"?e.eventName.includes("error"):!0}function AY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState("all"),[c,f]=W.useState(!1),d=W.useRef(null);W.useEffect(()=>{ht.events(500).then(r).catch(()=>{})},[e,t]),W.useEffect(()=>{var v;c||(v=d.current)==null||v.scrollIntoView({behavior:"smooth"})},[n,c]);const h=n.filter(v=>_Y(v,o)).reverse();return D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg flex flex-col h-[600px]",children:[D.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-bg-border flex-wrap",children:[SY.map(({id:v,label:y})=>D.jsx("button",{onClick:()=>l(v),className:`px-2 py-1 rounded text-xs transition-colors ${o===v?"bg-accent-green text-black font-medium":"text-text-secondary hover:text-text-primary"}`,children:y},v)),D.jsx("div",{className:"flex-1"}),D.jsxs("button",{onClick:()=>f(v=>!v),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-text-secondary hover:text-text-primary",children:[c?D.jsx(YR,{size:12}):D.jsx(UR,{size:12}),D.jsx("span",{children:c?"Reanudar":"Pausar"})]})]}),D.jsxs("div",{className:"flex-1 overflow-y-auto p-3 font-mono text-xs space-y-0.5",children:[h.length===0?D.jsx("span",{className:"text-text-muted",children:"Sin eventos"}):h.map((v,y)=>D.jsxs("div",{className:"flex gap-2 hover:bg-bg-base px-1 rounded",children:[D.jsx("span",{className:"text-text-muted shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),D.jsx("span",{className:`shrink-0 ${OY(v.eventName)}`,children:v.eventName}),v.sessionId&&D.jsxs("span",{className:"text-text-muted",children:[v.sessionId.slice(0,6),"…"]})]},y)),D.jsx("div",{ref:d})]})]})}function wY({sseVersion:e}){const[t,n]=W.useState([]);if(W.useEffect(()=>{ht.agents().then(n).catch(()=>{})},[e]),t.length===0)return D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-8 flex items-center justify-center",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de agentes. Aparece cuando hay múltiples agentes en trazas OTLP."})});const r=t.filter(c=>!c.parentAgentId),o=c=>t.filter(f=>f.parentAgentId===c);function l({agent:c,depth:f=0}){const d=o(c.agentId);return D.jsxs("div",{style:{paddingLeft:`${f*16}px`},children:[D.jsxs("div",{className:"flex items-center gap-4 py-2 border-b border-bg-border text-sm hover:bg-bg-card-hover px-2",children:[D.jsxs("span",{className:"font-mono text-text-muted text-xs w-20 shrink-0",children:[c.agentId.slice(0,8),"…"]}),D.jsx("span",{className:"font-mono text-accent-blue",children:er(c.tokensInput)}),D.jsx("span",{className:"font-mono text-accent-green",children:er(c.tokensOutput)}),D.jsx("span",{className:"font-mono text-accent-purple",children:ei(c.cost)}),D.jsx("span",{className:"text-text-secondary",children:Bb(c.durationMs)}),D.jsxs("span",{className:"text-text-muted text-xs",children:[c.toolCalls," tools"]})]}),d.map(h=>D.jsx(l,{agent:h,depth:f+1},h.agentId))]})}return D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:[D.jsxs("div",{className:"px-3 py-2 border-b border-bg-border grid grid-cols-6 text-xs text-text-muted",children:[D.jsx("span",{children:"Agent ID"}),D.jsx("span",{children:"Input"}),D.jsx("span",{children:"Output"}),D.jsx("span",{children:"Coste"}),D.jsx("span",{children:"Duración"}),D.jsx("span",{children:"Tools"})]}),r.map(c=>D.jsx(l,{agent:c},c.agentId))]})}function TY(){const[e,t]=W.useState("now-7d");return{timeRange:e,setTimeRange:t}}function EY(e){W.useEffect(()=>{let t=null,n;function r(){t=new EventSource("/api/stream"),t.onmessage=o=>{try{const{type:l,payload:c}=JSON.parse(o.data);l!=="ping"&&e(l,c)}catch{}},t.onerror=()=>{t==null||t.close(),t=null,n=setTimeout(r,3e3)}}return r(),()=>{clearTimeout(n),t==null||t.close()}},[])}function jY(e){const[t,n]=W.useState({connected:!1,lastSeen:null,sessionCount:0,totalEvents:0,uptime:0}),[r,o]=W.useState(null),[l,c]=W.useState(0),f=W.useRef(0),d=W.useCallback(async()=>{f.current=Date.now();try{const[v,y]=await Promise.all([ht.status(),ht.summary(e)]);n(v),o(y)}catch{}},[e]);W.useEffect(()=>{d()},[d]);const h=W.useCallback((v,y)=>{c(g=>g+1),Date.now()-f.current>5e3?d():ht.status().then(n).catch(()=>{})},[d]);return EY(h),{status:t,summary:r,refetch:d,sseVersion:l}}function MY(){const[e,t]=W.useState("overview"),{timeRange:n,setTimeRange:r}=TY(),{status:o,summary:l,refetch:c,sseVersion:f}=jY(n),d=W.useCallback(async()=>{await ht.reset(),c()},[c]);return!o.connected&&o.totalEvents===0?D.jsxs("div",{className:"min-h-screen bg-bg-base text-text-primary flex flex-col",children:[D.jsx(JO,{timeRange:n,onTimeRangeChange:r,connected:!1,lastSeen:null,onReset:d}),D.jsx(JR,{})]}):D.jsxs("div",{className:"min-h-screen bg-bg-base text-text-primary flex flex-col",children:[D.jsx(JO,{timeRange:n,onTimeRangeChange:r,connected:o.connected,lastSeen:o.lastSeen,onReset:d}),D.jsx(n3,{onLabeled:c}),D.jsx(WR,{activeTab:e,onTabChange:t}),D.jsxs("main",{className:"flex-1 p-4 max-w-screen-2xl mx-auto w-full",children:[e==="overview"&&D.jsxs("div",{className:"flex flex-col gap-4",children:[l&&D.jsx(i3,{summary:l}),D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[D.jsx(hY,{timeRange:n,sseVersion:f}),D.jsx(vY,{timeRange:n,sseVersion:f})]})]}),e==="sessions"&&D.jsx(gY,{timeRange:n,sseVersion:f}),e==="projects"&&D.jsx(bY,{timeRange:n,sseVersion:f}),e==="tools"&&D.jsx(xY,{timeRange:n,sseVersion:f}),e==="agents"&&D.jsx(wY,{sseVersion:f}),e==="events"&&D.jsx(AY,{timeRange:n,sseVersion:f}),e==="costs"&&D.jsxs("div",{className:"flex flex-col gap-4",children:[l&&D.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Coste período"}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-purple",children:ei(l.cost)})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Eficiencia"}),D.jsxs("div",{className:"text-2xl font-mono font-bold text-accent-green",children:[(l.efficiency*100).toFixed(1),"%"]})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Tokens caché"}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-teal",children:er(l.tokens.cache)})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Ahorro caché est."}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-yellow",children:ei(l.tokens.cache*3e-7)})]})]}),D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[D.jsx(yY,{timeRange:n,sseVersion:f}),D.jsx(mY,{timeRange:n,sseVersion:f})]})]})]})]})}ER.createRoot(document.getElementById("root")).render(D.jsx(W.StrictMode,{children:D.jsx(MY,{})}));
|
|
187
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VN(e,t){if(e){if(typeof e=="string")return Rb(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 Rb(e,t)}}function FG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function QG(e){if(Array.isArray(e))return Rb(e)}function Rb(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 $2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$2(Object(n),!0).forEach(function(r){be(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function be(e,t,n){return t=ZN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZN(e){var t=WG(e,"string");return Co(t)=="symbol"?t:t+""}function WG(e,t){if(Co(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var JG={xAxis:["bottom","top"],yAxis:["left","right"]},eY={width:"100%",height:"100%"},FN={x:0,y:0};function xs(e){return e}var tY=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},nY=function(t,n,r,o){var l=n.find(function(v){return v&&v.index===r});if(l){if(t==="horizontal")return{x:l.coordinate,y:o.y};if(t==="vertical")return{x:o.x,y:l.coordinate};if(t==="centric"){var c=l.coordinate,f=o.radius;return ne(ne(ne({},o),qt(o.cx,o.cy,f,c)),{},{angle:c,radius:f})}var d=l.coordinate,h=o.angle;return ne(ne(ne({},o),qt(o.cx,o.cy,d,h)),{},{angle:h,radius:d})}return FN},Jf=function(t,n){var r=n.graphicalItems,o=n.dataStartIndex,l=n.dataEndIndex,c=(r??[]).reduce(function(f,d){var h=d.props.data;return h&&h.length?[].concat(No(f),No(h)):f},[]);return c.length>0?c:t&&t.length&&fe(o)&&fe(l)?t.slice(o,l+1):[]};function QN(e){return e==="number"?[0,"auto"]:void 0}var $b=function(t,n,r,o){var l=t.graphicalItems,c=t.tooltipAxis,f=Jf(n,t);return r<0||!l||!l.length||r>=f.length?null:l.reduce(function(d,h){var v,y=(v=h.props.data)!==null&&v!==void 0?v:n;y&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(y=y.slice(t.dataStartIndex,t.dataEndIndex+1));var g;if(c.dataKey&&!c.allowDuplicatedCategory){var x=y===void 0?f:y;g=Ss(x,c.dataKey,o)}else g=y&&y[r]||f[r];return g?[].concat(No(d),[VC(h,g)]):d},[])},q2=function(t,n,r,o){var l=o||{x:t.chartX,y:t.chartY},c=tY(l,r),f=t.orderedTooltipTicks,d=t.tooltipAxis,h=t.tooltipTicks,v=n5(c,f,h,d);if(v>=0&&h){var y=h[v]&&h[v].value,g=$b(t,n,v,y),x=nY(r,f,v,l);return{activeTooltipIndex:v,activeLabel:y,activePayload:g,activeCoordinate:x}}return null},rY=function(t,n){var r=n.axes,o=n.graphicalItems,l=n.axisType,c=n.axisIdKey,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,y=t.children,g=t.stackOffset,x=YC(v,l);return r.reduce(function(_,S){var b,w=S.type.defaultProps!==void 0?ne(ne({},S.type.defaultProps),S.props):S.props,E=w.type,j=w.dataKey,N=w.allowDataOverflow,A=w.allowDuplicatedCategory,T=w.scale,C=w.ticks,$=w.includeHidden,z=w[c];if(_[z])return _;var F=Jf(t.data,{graphicalItems:o.filter(function(I){var re,se=c in I.props?I.props[c]:(re=I.type.defaultProps)===null||re===void 0?void 0:re[c];return se===z}),dataStartIndex:d,dataEndIndex:h}),U=F.length,B,V,Q;MG(w.domain,N,E)&&(B=Wg(w.domain,null,N),x&&(E==="number"||T!=="auto")&&(Q=Fu(F,j,"category")));var Z=QN(E);if(!B||B.length===0){var R,G=(R=w.domain)!==null&&R!==void 0?R:Z;if(j){if(B=Fu(F,j,E),E==="category"&&x){var ee=V3(B);A&&ee?(V=B,B=uf(0,U)):A||(B=VE(G,B,S).reduce(function(I,re){return I.indexOf(re)>=0?I:[].concat(No(I),[re])},[]))}else if(E==="category")A?B=B.filter(function(I){return I!==""&&!je(I)}):B=VE(G,B,S).reduce(function(I,re){return I.indexOf(re)>=0||re===""||je(re)?I:[].concat(No(I),[re])},[]);else if(E==="number"){var oe=u5(F,o.filter(function(I){var re,se,pe=c in I.props?I.props[c]:(re=I.type.defaultProps)===null||re===void 0?void 0:re[c],me="hide"in I.props?I.props.hide:(se=I.type.defaultProps)===null||se===void 0?void 0:se.hide;return pe===z&&($||!me)}),j,l,v);oe&&(B=oe)}x&&(E==="number"||T!=="auto")&&(Q=Fu(F,j,"category"))}else x?B=uf(0,U):f&&f[z]&&f[z].hasStack&&E==="number"?B=g==="expand"?[0,1]:KC(f[z].stackGroups,d,h):B=GC(F,o.filter(function(I){var re=c in I.props?I.props[c]:I.type.defaultProps[c],se="hide"in I.props?I.props.hide:I.type.defaultProps.hide;return re===z&&($||!se)}),E,v,!0);if(E==="number")B=Db(y,B,z,l,C),G&&(B=Wg(G,B,N));else if(E==="category"&&G){var le=G,P=B.every(function(I){return le.indexOf(I)>=0});P&&(B=le)}}return ne(ne({},_),{},be({},z,ne(ne({},w),{},{axisType:l,domain:B,categoricalDomain:Q,duplicateDomain:V,originalDomain:(b=w.domain)!==null&&b!==void 0?b:Z,isCategorical:x,layout:v})))},{})},aY=function(t,n){var r=n.graphicalItems,o=n.Axis,l=n.axisType,c=n.axisIdKey,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,y=t.children,g=Jf(t.data,{graphicalItems:r,dataStartIndex:d,dataEndIndex:h}),x=g.length,_=YC(v,l),S=-1;return r.reduce(function(b,w){var E=w.type.defaultProps!==void 0?ne(ne({},w.type.defaultProps),w.props):w.props,j=E[c],N=QN("number");if(!b[j]){S++;var A;return _?A=uf(0,x):f&&f[j]&&f[j].hasStack?(A=KC(f[j].stackGroups,d,h),A=Db(y,A,j,l)):(A=Wg(N,GC(g,r.filter(function(T){var C,$,z=c in T.props?T.props[c]:(C=T.type.defaultProps)===null||C===void 0?void 0:C[c],F="hide"in T.props?T.props.hide:($=T.type.defaultProps)===null||$===void 0?void 0:$.hide;return z===j&&!F}),"number",v),o.defaultProps.allowDataOverflow),A=Db(y,A,j,l)),ne(ne({},b),{},be({},j,ne(ne({axisType:l},o.defaultProps),{},{hide:!0,orientation:Cn(JG,"".concat(l,".").concat(S%2),null),domain:A,originalDomain:N,isCategorical:_,layout:v})))}return b},{})},iY=function(t,n){var r=n.axisType,o=r===void 0?"xAxis":r,l=n.AxisComp,c=n.graphicalItems,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.children,y="".concat(o,"Id"),g=Nn(v,l),x={};return g&&g.length?x=rY(t,{axes:g,graphicalItems:c,axisType:o,axisIdKey:y,stackGroups:f,dataStartIndex:d,dataEndIndex:h}):c&&c.length&&(x=aY(t,{Axis:l,graphicalItems:c,axisType:o,axisIdKey:y,stackGroups:f,dataStartIndex:d,dataEndIndex:h})),x},oY=function(t){var n=ya(t),r=jr(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:i0(r,function(o){return o.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Fs(n,r)}},z2=function(t){var n=t.children,r=t.defaultShowTooltip,o=hn(n,xo),l=0,c=0;return t.data&&t.data.length!==0&&(c=t.data.length-1),o&&o.props&&(o.props.startIndex>=0&&(l=o.props.startIndex),o.props.endIndex>=0&&(c=o.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:l,dataEndIndex:c,activeTooltipIndex:-1,isTooltipActive:!!r}},uY=function(t){return!t||!t.length?!1:t.some(function(n){var r=Mr(n&&n.type);return r&&r.indexOf("Bar")>=0})},B2=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"}},lY=function(t,n){var r=t.props,o=t.graphicalItems,l=t.xAxisMap,c=l===void 0?{}:l,f=t.yAxisMap,d=f===void 0?{}:f,h=r.width,v=r.height,y=r.children,g=r.margin||{},x=hn(y,xo),_=hn(y,ba),S=Object.keys(d).reduce(function(A,T){var C=d[T],$=C.orientation;return!C.mirror&&!C.hide?ne(ne({},A),{},be({},$,A[$]+C.width)):A},{left:g.left||0,right:g.right||0}),b=Object.keys(c).reduce(function(A,T){var C=c[T],$=C.orientation;return!C.mirror&&!C.hide?ne(ne({},A),{},be({},$,Cn(A,"".concat($))+C.height)):A},{top:g.top||0,bottom:g.bottom||0}),w=ne(ne({},b),S),E=w.bottom;x&&(w.bottom+=x.props.height||xo.defaultProps.height),_&&n&&(w=i5(w,o,r,n));var j=h-w.left-w.right,N=v-w.top-w.bottom;return ne(ne({brushBottom:E},w),{},{width:Math.max(j,0),height:Math.max(N,0)})},cY=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},I0=function(t){var n=t.chartName,r=t.GraphicalChild,o=t.defaultTooltipEventType,l=o===void 0?"axis":o,c=t.validateTooltipEventTypes,f=c===void 0?["axis"]:c,d=t.axisComponents,h=t.legendContent,v=t.formatAxisMap,y=t.defaultProps,g=function(w,E){var j=E.graphicalItems,N=E.stackGroups,A=E.offset,T=E.updateId,C=E.dataStartIndex,$=E.dataEndIndex,z=w.barSize,F=w.layout,U=w.barGap,B=w.barCategoryGap,V=w.maxBarSize,Q=B2(F),Z=Q.numericAxisName,R=Q.cateAxisName,G=uY(j),ee=[];return j.forEach(function(oe,le){var P=Jf(w.data,{graphicalItems:[oe],dataStartIndex:C,dataEndIndex:$}),I=oe.type.defaultProps!==void 0?ne(ne({},oe.type.defaultProps),oe.props):oe.props,re=I.dataKey,se=I.maxBarSize,pe=I["".concat(Z,"Id")],me=I["".concat(R,"Id")],Me={},ke=d.reduce(function($n,or){var Uo=E["".concat(or.axisType,"Map")],Bt=I["".concat(or.axisType,"Id")];Uo&&Uo[Bt]||or.axisType==="zAxis"||ai();var Hl=Uo[Bt];return ne(ne({},$n),{},be(be({},or.axisType,Hl),"".concat(or.axisType,"Ticks"),jr(Hl)))},Me),ce=ke[R],xe=ke["".concat(R,"Ticks")],Se=N&&N[pe]&&N[pe].hasStack&&b5(oe,N[pe].stackGroups),ue=Mr(oe.type).indexOf("Bar")>=0,et=Fs(ce,xe),we=[],ot=G&&r5({barSize:z,stackGroups:N,totalSize:cY(ke,R)});if(ue){var ut,zt,Rn=je(se)?V:se,Kn=(ut=(zt=Fs(ce,xe,!0))!==null&&zt!==void 0?zt:Rn)!==null&&ut!==void 0?ut:0;we=a5({barGap:U,barCategoryGap:B,bandSize:Kn!==et?Kn:et,sizeList:ot[me],maxBarSize:Rn}),Kn!==et&&(we=we.map(function($n){return ne(ne({},$n),{},{position:ne(ne({},$n.position),{},{offset:$n.position.offset-Kn/2})})}))}var Ir=oe&&oe.type&&oe.type.getComposedData;Ir&&ee.push({props:ne(ne({},Ir(ne(ne({},ke),{},{displayedData:P,props:w,dataKey:re,item:oe,bandSize:et,barPosition:we,offset:A,stackedData:Se,layout:F,dataStartIndex:C,dataEndIndex:$}))),{},be(be(be({key:oe.key||"item-".concat(le)},Z,ke[Z]),R,ke[R]),"animationId",T)),childIndex:o$(oe,w.children),item:oe})}),ee},x=function(w,E){var j=w.props,N=w.dataStartIndex,A=w.dataEndIndex,T=w.updateId;if(!cA({props:j}))return null;var C=j.children,$=j.layout,z=j.stackOffset,F=j.data,U=j.reverseStackOrder,B=B2($),V=B.numericAxisName,Q=B.cateAxisName,Z=Nn(C,r),R=y5(F,Z,"".concat(V,"Id"),"".concat(Q,"Id"),z,U),G=d.reduce(function(I,re){var se="".concat(re.axisType,"Map");return ne(ne({},I),{},be({},se,iY(j,ne(ne({},re),{},{graphicalItems:Z,stackGroups:re.axisType===V&&R,dataStartIndex:N,dataEndIndex:A}))))},{}),ee=lY(ne(ne({},G),{},{props:j,graphicalItems:Z}),E==null?void 0:E.legendBBox);Object.keys(G).forEach(function(I){G[I]=v(j,G[I],ee,I.replace("Map",""),n)});var oe=G["".concat(Q,"Map")],le=oY(oe),P=g(j,ne(ne({},G),{},{dataStartIndex:N,dataEndIndex:A,updateId:T,graphicalItems:Z,stackGroups:R,offset:ee}));return ne(ne({formattedGraphicalItems:P,graphicalItems:Z,offset:ee,stackGroups:R},le),G)},_=(function(b){function w(E){var j,N,A;return IG(this,w),A=YG(this,w,[E]),be(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),be(A,"accessibilityManager",new jG),be(A,"handleLegendBBoxUpdate",function(T){if(T){var C=A.state,$=C.dataStartIndex,z=C.dataEndIndex,F=C.updateId;A.setState(ne({legendBBox:T},x({props:A.props,dataStartIndex:$,dataEndIndex:z,updateId:F},ne(ne({},A.state),{},{legendBBox:T}))))}}),be(A,"handleReceiveSyncEvent",function(T,C,$){if(A.props.syncId===T){if($===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(C)}}),be(A,"handleBrushChange",function(T){var C=T.startIndex,$=T.endIndex;if(C!==A.state.dataStartIndex||$!==A.state.dataEndIndex){var z=A.state.updateId;A.setState(function(){return ne({dataStartIndex:C,dataEndIndex:$},x({props:A.props,dataStartIndex:C,dataEndIndex:$,updateId:z},A.state))}),A.triggerSyncEvent({dataStartIndex:C,dataEndIndex:$})}}),be(A,"handleMouseEnter",function(T){var C=A.getMouseInfo(T);if(C){var $=ne(ne({},C),{},{isTooltipActive:!0});A.setState($),A.triggerSyncEvent($);var z=A.props.onMouseEnter;Ae(z)&&z($,T)}}),be(A,"triggeredAfterMouseMove",function(T){var C=A.getMouseInfo(T),$=C?ne(ne({},C),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState($),A.triggerSyncEvent($);var z=A.props.onMouseMove;Ae(z)&&z($,T)}),be(A,"handleItemMouseEnter",function(T){A.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),be(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),be(A,"handleMouseMove",function(T){T.persist(),A.throttleTriggeredAfterMouseMove(T)}),be(A,"handleMouseLeave",function(T){A.throttleTriggeredAfterMouseMove.cancel();var C={isTooltipActive:!1};A.setState(C),A.triggerSyncEvent(C);var $=A.props.onMouseLeave;Ae($)&&$(C,T)}),be(A,"handleOuterEvent",function(T){var C=i$(T),$=Cn(A.props,"".concat(C));if(C&&Ae($)){var z,F;/.*touch.*/i.test(C)?F=A.getMouseInfo(T.changedTouches[0]):F=A.getMouseInfo(T),$((z=F)!==null&&z!==void 0?z:{},T)}}),be(A,"handleClick",function(T){var C=A.getMouseInfo(T);if(C){var $=ne(ne({},C),{},{isTooltipActive:!0});A.setState($),A.triggerSyncEvent($);var z=A.props.onClick;Ae(z)&&z($,T)}}),be(A,"handleMouseDown",function(T){var C=A.props.onMouseDown;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleMouseUp",function(T){var C=A.props.onMouseUp;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),be(A,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.handleMouseDown(T.changedTouches[0])}),be(A,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.handleMouseUp(T.changedTouches[0])}),be(A,"handleDoubleClick",function(T){var C=A.props.onDoubleClick;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleContextMenu",function(T){var C=A.props.onContextMenu;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"triggerSyncEvent",function(T){A.props.syncId!==void 0&&vg.emit(yg,A.props.syncId,T,A.eventEmitterSymbol)}),be(A,"applySyncEvent",function(T){var C=A.props,$=C.layout,z=C.syncMethod,F=A.state.updateId,U=T.dataStartIndex,B=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)A.setState(ne({dataStartIndex:U,dataEndIndex:B},x({props:A.props,dataStartIndex:U,dataEndIndex:B,updateId:F},A.state)));else if(T.activeTooltipIndex!==void 0){var V=T.chartX,Q=T.chartY,Z=T.activeTooltipIndex,R=A.state,G=R.offset,ee=R.tooltipTicks;if(!G)return;if(typeof z=="function")Z=z(ee,T);else if(z==="value"){Z=-1;for(var oe=0;oe<ee.length;oe++)if(ee[oe].value===T.activeLabel){Z=oe;break}}var le=ne(ne({},G),{},{x:G.left,y:G.top}),P=Math.min(V,le.x+le.width),I=Math.min(Q,le.y+le.height),re=ee[Z]&&ee[Z].value,se=$b(A.state,A.props.data,Z),pe=ee[Z]?{x:$==="horizontal"?ee[Z].coordinate:P,y:$==="horizontal"?I:ee[Z].coordinate}:FN;A.setState(ne(ne({},T),{},{activeLabel:re,activeCoordinate:pe,activePayload:se,activeTooltipIndex:Z}))}else A.setState(T)}),be(A,"renderCursor",function(T){var C,$=A.state,z=$.isTooltipActive,F=$.activeCoordinate,U=$.activePayload,B=$.offset,V=$.activeTooltipIndex,Q=$.tooltipAxisBandSize,Z=A.getTooltipEventType(),R=(C=T.props.active)!==null&&C!==void 0?C:z,G=A.props.layout,ee=T.key||"_recharts-cursor";return L.createElement($G,{key:ee,activeCoordinate:F,activePayload:U,activeTooltipIndex:V,chartName:n,element:T,isActive:R,layout:G,offset:B,tooltipAxisBandSize:Q,tooltipEventType:Z})}),be(A,"renderPolarAxis",function(T,C,$){var z=Cn(T,"type.axisType"),F=Cn(A.state,"".concat(z,"Map")),U=T.type.defaultProps,B=U!==void 0?ne(ne({},U),T.props):T.props,V=F&&F[B["".concat(z,"Id")]];return W.cloneElement(T,ne(ne({},V),{},{className:$e(z,V.className),key:T.key||"".concat(C,"-").concat($),ticks:jr(V,!0)}))}),be(A,"renderPolarGrid",function(T){var C=T.props,$=C.radialLines,z=C.polarAngles,F=C.polarRadius,U=A.state,B=U.radiusAxisMap,V=U.angleAxisMap,Q=ya(B),Z=ya(V),R=Z.cx,G=Z.cy,ee=Z.innerRadius,oe=Z.outerRadius;return W.cloneElement(T,{polarAngles:Array.isArray(z)?z:jr(Z,!0).map(function(le){return le.coordinate}),polarRadius:Array.isArray(F)?F:jr(Q,!0).map(function(le){return le.coordinate}),cx:R,cy:G,innerRadius:ee,outerRadius:oe,key:T.key||"polar-grid",radialLines:$})}),be(A,"renderLegend",function(){var T=A.state.formattedGraphicalItems,C=A.props,$=C.children,z=C.width,F=C.height,U=A.props.margin||{},B=z-(U.left||0)-(U.right||0),V=IC({children:$,formattedGraphicalItems:T,legendWidth:B,legendContent:h});if(!V)return null;var Q=V.item,Z=R2(V,qG);return W.cloneElement(Q,ne(ne({},Z),{},{chartWidth:z,chartHeight:F,margin:U,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),be(A,"renderTooltip",function(){var T,C=A.props,$=C.children,z=C.accessibilityLayer,F=hn($,pn);if(!F)return null;var U=A.state,B=U.isTooltipActive,V=U.activeCoordinate,Q=U.activePayload,Z=U.activeLabel,R=U.offset,G=(T=F.props.active)!==null&&T!==void 0?T:B;return W.cloneElement(F,{viewBox:ne(ne({},R),{},{x:R.left,y:R.top}),active:G,label:Z,payload:G?Q:[],coordinate:V,accessibilityLayer:z})}),be(A,"renderBrush",function(T){var C=A.props,$=C.margin,z=C.data,F=A.state,U=F.offset,B=F.dataStartIndex,V=F.dataEndIndex,Q=F.updateId;return W.cloneElement(T,{key:T.key||"_recharts-brush",onChange:vs(A.handleBrushChange,T.props.onChange),data:z,x:fe(T.props.x)?T.props.x:U.left,y:fe(T.props.y)?T.props.y:U.top+U.height+U.brushBottom-($.bottom||0),width:fe(T.props.width)?T.props.width:U.width,startIndex:B,endIndex:V,updateId:"brush-".concat(Q)})}),be(A,"renderReferenceElement",function(T,C,$){if(!T)return null;var z=A,F=z.clipPathId,U=A.state,B=U.xAxisMap,V=U.yAxisMap,Q=U.offset,Z=T.type.defaultProps||{},R=T.props,G=R.xAxisId,ee=G===void 0?Z.xAxisId:G,oe=R.yAxisId,le=oe===void 0?Z.yAxisId:oe;return W.cloneElement(T,{key:T.key||"".concat(C,"-").concat($),xAxis:B[ee],yAxis:V[le],viewBox:{x:Q.left,y:Q.top,width:Q.width,height:Q.height},clipPathId:F})}),be(A,"renderActivePoints",function(T){var C=T.item,$=T.activePoint,z=T.basePoint,F=T.childIndex,U=T.isRange,B=[],V=C.props.key,Q=C.item.type.defaultProps!==void 0?ne(ne({},C.item.type.defaultProps),C.item.props):C.item.props,Z=Q.activeDot,R=Q.dataKey,G=ne(ne({index:F,dataKey:R,cx:$.x,cy:$.y,r:4,fill:N0(C.item),strokeWidth:2,stroke:"#fff",payload:$.payload,value:$.value},Ee(Z,!1)),Os(Z));return B.push(w.renderActiveDot(Z,G,"".concat(V,"-activePoint-").concat(F))),z?B.push(w.renderActiveDot(Z,ne(ne({},G),{},{cx:z.x,cy:z.y}),"".concat(V,"-basePoint-").concat(F))):U&&B.push(null),B}),be(A,"renderGraphicChild",function(T,C,$){var z=A.filterFormatItem(T,C,$);if(!z)return null;var F=A.getTooltipEventType(),U=A.state,B=U.isTooltipActive,V=U.tooltipAxis,Q=U.activeTooltipIndex,Z=U.activeLabel,R=A.props.children,G=hn(R,pn),ee=z.props,oe=ee.points,le=ee.isRange,P=ee.baseLine,I=z.item.type.defaultProps!==void 0?ne(ne({},z.item.type.defaultProps),z.item.props):z.item.props,re=I.activeDot,se=I.hide,pe=I.activeBar,me=I.activeShape,Me=!!(!se&&B&&G&&(re||pe||me)),ke={};F!=="axis"&&G&&G.props.trigger==="click"?ke={onClick:vs(A.handleItemMouseEnter,T.props.onClick)}:F!=="axis"&&(ke={onMouseLeave:vs(A.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:vs(A.handleItemMouseEnter,T.props.onMouseEnter)});var ce=W.cloneElement(T,ne(ne({},z.props),ke));function xe(or){return typeof V.dataKey=="function"?V.dataKey(or.payload):null}if(Me)if(Q>=0){var Se,ue;if(V.dataKey&&!V.allowDuplicatedCategory){var et=typeof V.dataKey=="function"?xe:"payload.".concat(V.dataKey.toString());Se=Ss(oe,et,Z),ue=le&&P&&Ss(P,et,Z)}else Se=oe==null?void 0:oe[Q],ue=le&&P&&P[Q];if(me||pe){var we=T.props.activeIndex!==void 0?T.props.activeIndex:Q;return[W.cloneElement(T,ne(ne(ne({},z.props),ke),{},{activeIndex:we})),null,null]}if(!je(Se))return[ce].concat(No(A.renderActivePoints({item:z,activePoint:Se,basePoint:ue,childIndex:Q,isRange:le})))}else{var ot,ut=(ot=A.getItemByXY(A.state.activeCoordinate))!==null&&ot!==void 0?ot:{graphicalItem:ce},zt=ut.graphicalItem,Rn=zt.item,Kn=Rn===void 0?T:Rn,Ir=zt.childIndex,$n=ne(ne(ne({},z.props),ke),{},{activeIndex:Ir});return[W.cloneElement(Kn,$n),null,null]}return le?[ce,null,null]:[ce,null]}),be(A,"renderCustomized",function(T,C,$){return W.cloneElement(T,ne(ne({key:"recharts-customized-".concat($)},A.props),A.state))}),be(A,"renderMap",{CartesianGrid:{handler:xs,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:xs},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:xs},YAxis:{handler:xs},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((j=E.id)!==null&&j!==void 0?j:$o("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=IM(A.triggeredAfterMouseMove,(N=E.throttleDelay)!==null&&N!==void 0?N:1e3/60),A.state={},A}return VG(w,b),GG(w,[{key:"componentDidMount",value:function(){var j,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var j=this.props,N=j.children,A=j.data,T=j.height,C=j.layout,$=hn(N,pn);if($){var z=$.props.defaultIndex;if(!(typeof z!="number"||z<0||z>this.state.tooltipTicks.length-1)){var F=this.state.tooltipTicks[z]&&this.state.tooltipTicks[z].value,U=$b(this.state,A,z,F),B=this.state.tooltipTicks[z].coordinate,V=(this.state.offset.top+T)/2,Q=C==="horizontal",Z=Q?{x:B,y:V}:{y:B,x:V},R=this.state.formattedGraphicalItems.find(function(ee){var oe=ee.item;return oe.type.name==="Scatter"});R&&(Z=ne(ne({},Z),R.props.points[z].tooltipPosition),U=R.props.points[z].tooltipPayload);var G={activeTooltipIndex:z,isTooltipActive:!0,activeLabel:F,activePayload:U,activeCoordinate:Z};this.setState(G),this.renderCursor($),this.accessibilityManager.setIndex(z)}}}},{key:"getSnapshotBeforeUpdate",value:function(j,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==j.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==j.margin){var A,T;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(j){xg([hn(j.children,pn)],[hn(this.props.children,pn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var j=hn(this.props.children,pn);if(j&&typeof j.props.shared=="boolean"){var N=j.props.shared?"axis":"item";return f.indexOf(N)>=0?N:l}return l}},{key:"getMouseInfo",value:function(j){if(!this.container)return null;var N=this.container,A=N.getBoundingClientRect(),T=X8(A),C={chartX:Math.round(j.pageX-T.left),chartY:Math.round(j.pageY-T.top)},$=A.width/N.offsetWidth||1,z=this.inRange(C.chartX,C.chartY,$);if(!z)return null;var F=this.state,U=F.xAxisMap,B=F.yAxisMap,V=this.getTooltipEventType(),Q=q2(this.state,this.props.data,this.props.layout,z);if(V!=="axis"&&U&&B){var Z=ya(U).scale,R=ya(B).scale,G=Z&&Z.invert?Z.invert(C.chartX):null,ee=R&&R.invert?R.invert(C.chartY):null;return ne(ne({},C),{},{xValue:G,yValue:ee},Q)}return Q?ne(ne({},C),Q):null}},{key:"inRange",value:function(j,N){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,C=j/A,$=N/A;if(T==="horizontal"||T==="vertical"){var z=this.state.offset,F=C>=z.left&&C<=z.left+z.width&&$>=z.top&&$<=z.top+z.height;return F?{x:C,y:$}:null}var U=this.state,B=U.angleAxisMap,V=U.radiusAxisMap;if(B&&V){var Q=ya(B);return QE({x:C,y:$},Q)}return null}},{key:"parseEventsOfWrapper",value:function(){var j=this.props.children,N=this.getTooltipEventType(),A=hn(j,pn),T={};A&&N==="axis"&&(A.props.trigger==="click"?T={onClick:this.handleClick}:T={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 C=Os(this.props,this.handleOuterEvent);return ne(ne({},C),T)}},{key:"addListener",value:function(){vg.on(yg,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){vg.removeListener(yg,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(j,N,A){for(var T=this.state.formattedGraphicalItems,C=0,$=T.length;C<$;C++){var z=T[C];if(z.item===j||z.props.key===j.key||N===Mr(z.item.type)&&A===z.childIndex)return z}return null}},{key:"renderClipPath",value:function(){var j=this.clipPathId,N=this.state.offset,A=N.left,T=N.top,C=N.height,$=N.width;return L.createElement("defs",null,L.createElement("clipPath",{id:j},L.createElement("rect",{x:A,y:T,height:C,width:$})))}},{key:"getXScales",value:function(){var j=this.state.xAxisMap;return j?Object.entries(j).reduce(function(N,A){var T=P2(A,2),C=T[0],$=T[1];return ne(ne({},N),{},be({},C,$.scale))},{}):null}},{key:"getYScales",value:function(){var j=this.state.yAxisMap;return j?Object.entries(j).reduce(function(N,A){var T=P2(A,2),C=T[0],$=T[1];return ne(ne({},N),{},be({},C,$.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(j){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(j){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(j){var N=this.state,A=N.formattedGraphicalItems,T=N.activeItem;if(A&&A.length)for(var C=0,$=A.length;C<$;C++){var z=A[C],F=z.props,U=z.item,B=U.type.defaultProps!==void 0?ne(ne({},U.type.defaultProps),U.props):U.props,V=Mr(U.type);if(V==="Bar"){var Q=(F.data||[]).find(function(ee){return hI(j,ee)});if(Q)return{graphicalItem:z,payload:Q}}else if(V==="RadialBar"){var Z=(F.data||[]).find(function(ee){return QE(j,ee)});if(Z)return{graphicalItem:z,payload:Z}}else if(Yf(z,T)||Xf(z,T)||El(z,T)){var R=r9({graphicalItem:z,activeTooltipItem:T,itemData:B.data}),G=B.activeIndex===void 0?R:B.activeIndex;return{graphicalItem:ne(ne({},z),{},{childIndex:G}),payload:El(z,T)?B.data[R]:z.props.data[R]}}}return null}},{key:"render",value:function(){var j=this;if(!cA(this))return null;var N=this.props,A=N.children,T=N.className,C=N.width,$=N.height,z=N.style,F=N.compact,U=N.title,B=N.desc,V=R2(N,zG),Q=Ee(V,!1);if(F)return L.createElement(d2,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement(Og,no({},Q,{width:C,height:$,title:U,desc:B}),this.renderClipPath(),fA(A,this.renderMap)));if(this.props.accessibilityLayer){var Z,R;Q.tabIndex=(Z=this.props.tabIndex)!==null&&Z!==void 0?Z:0,Q.role=(R=this.props.role)!==null&&R!==void 0?R:"application",Q.onKeyDown=function(ee){j.accessibilityManager.keyboardEvent(ee)},Q.onFocus=function(){j.accessibilityManager.focus()}}var G=this.parseEventsOfWrapper();return L.createElement(d2,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement("div",no({className:$e("recharts-wrapper",T),style:ne({position:"relative",cursor:"default",width:C,height:$},z)},G,{ref:function(oe){j.container=oe}}),L.createElement(Og,no({},Q,{width:C,height:$,title:U,desc:B,style:eY}),this.renderClipPath(),fA(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(W.Component);be(_,"displayName",n),be(_,"defaultProps",ne({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},y)),be(_,"getDerivedStateFromProps",function(b,w){var E=b.dataKey,j=b.data,N=b.children,A=b.width,T=b.height,C=b.layout,$=b.stackOffset,z=b.margin,F=w.dataStartIndex,U=w.dataEndIndex;if(w.updateId===void 0){var B=z2(b);return ne(ne(ne({},B),{},{updateId:0},x(ne(ne({props:b},B),{},{updateId:0}),w)),{},{prevDataKey:E,prevData:j,prevWidth:A,prevHeight:T,prevLayout:C,prevStackOffset:$,prevMargin:z,prevChildren:N})}if(E!==w.prevDataKey||j!==w.prevData||A!==w.prevWidth||T!==w.prevHeight||C!==w.prevLayout||$!==w.prevStackOffset||!ro(z,w.prevMargin)){var V=z2(b),Q={chartX:w.chartX,chartY:w.chartY,isTooltipActive:w.isTooltipActive},Z=ne(ne({},q2(w,j,C)),{},{updateId:w.updateId+1}),R=ne(ne(ne({},V),Q),Z);return ne(ne(ne({},R),x(ne({props:b},R),w)),{},{prevDataKey:E,prevData:j,prevWidth:A,prevHeight:T,prevLayout:C,prevStackOffset:$,prevMargin:z,prevChildren:N})}if(!xg(N,w.prevChildren)){var G,ee,oe,le,P=hn(N,xo),I=P&&(G=(ee=P.props)===null||ee===void 0?void 0:ee.startIndex)!==null&&G!==void 0?G:F,re=P&&(oe=(le=P.props)===null||le===void 0?void 0:le.endIndex)!==null&&oe!==void 0?oe:U,se=I!==F||re!==U,pe=!je(j),me=pe&&!se?w.updateId:w.updateId+1;return ne(ne({updateId:me},x(ne(ne({props:b},w),{},{updateId:me,dataStartIndex:I,dataEndIndex:re}),w)),{},{prevChildren:N,dataStartIndex:I,dataEndIndex:re})}return null}),be(_,"renderActiveDot",function(b,w,E){var j;return W.isValidElement(b)?j=W.cloneElement(b,w):Ae(b)?j=b(w):j=L.createElement(Gf,w),L.createElement(Je,{className:"recharts-active-dot",key:E},j)});var S=W.forwardRef(function(w,E){return L.createElement(_,no({},w,{ref:E}))});return S.displayName=_.displayName,S},sY=I0({chartName:"LineChart",GraphicalChild:Il,axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:P0}),fY=I0({chartName:"BarChart",GraphicalChild:fi,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:P0}),WN=I0({chartName:"AreaChart",GraphicalChild:Yn,axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:P0});function dY(e){return new Date(e).toLocaleString("es",{hour:"2-digit",minute:"2-digit",day:"numeric",month:"short"})}function hY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.input",e,v),ht.timeseries("claude_code.tokens.output",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>({ts:v,label:dY(v),input:f.get(v)??0,output:d.get(v)??0}));return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de tokens"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Tokens por período"}),D.jsx(Rf,{width:"100%",height:220,children:D.jsxs(WN,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsxs("defs",{children:[D.jsxs("linearGradient",{id:"colorInput",x1:"0",y1:"0",x2:"0",y2:"1",children:[D.jsx("stop",{offset:"5%",stopColor:"#4da6ff",stopOpacity:.3}),D.jsx("stop",{offset:"95%",stopColor:"#4da6ff",stopOpacity:0})]}),D.jsxs("linearGradient",{id:"colorOutput",x1:"0",y1:"0",x2:"0",y2:"1",children:[D.jsx("stop",{offset:"5%",stopColor:"#00ff88",stopOpacity:.3}),D.jsx("stop",{offset:"95%",stopColor:"#00ff88",stopOpacity:0})]})]}),D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:v=>v>=1e3?`${(v/1e3).toFixed(0)}K`:String(v)}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},labelStyle:{color:"#888888",fontSize:12},itemStyle:{fontSize:12}}),D.jsx(ba,{wrapperStyle:{fontSize:12,color:"#888888"}}),D.jsx(Yn,{type:"monotone",dataKey:"input",name:"Input",stroke:"#4da6ff",fill:"url(#colorInput)",strokeWidth:2}),D.jsx(Yn,{type:"monotone",dataKey:"output",name:"Output",stroke:"#00ff88",fill:"url(#colorOutput)",strokeWidth:2})]})})]})}function pY(e){return new Date(e).toLocaleDateString("es",{day:"numeric",month:"short"})}function vY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]);W.useEffect(()=>{ht.timeseries("claude_code.cost",e,"1d").then(r).catch(()=>{})},[e,t]);const o=n.map(l=>({label:pY(l.timestamp),cost:Number(l.value.toFixed(4))}));return o.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de coste"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Coste por día ($)"}),D.jsx(Rf,{width:"100%",height:220,children:D.jsxs(fY,{data:o,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a",vertical:!1}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:l=>`$${l.toFixed(3)}`}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},labelStyle:{color:"#888888",fontSize:12},formatter:l=>[`$${l.toFixed(4)}`,"Coste"]}),D.jsx(fi,{dataKey:"cost",fill:"#a855f7",radius:[3,3,0,0]})]})})]})}function yY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.cache.read",e,v),ht.timeseries("claude_code.tokens.cache.creation",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>({label:new Date(v).toLocaleString("es",{hour:"2-digit",day:"numeric",month:"short"}),read:f.get(v)??0,create:d.get(v)??0}));return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de caché"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Tokens de caché"}),D.jsx(Rf,{width:"100%",height:220,children:D.jsxs(WN,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:v=>v>=1e3?`${(v/1e3).toFixed(0)}K`:String(v)}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"}}),D.jsx(ba,{wrapperStyle:{fontSize:12,color:"#888888"}}),D.jsx(Yn,{type:"monotone",dataKey:"read",name:"Leído",stroke:"#00d4aa",fill:"#00d4aa",fillOpacity:.2,strokeWidth:2}),D.jsx(Yn,{type:"monotone",dataKey:"create",name:"Creado",stroke:"#4da6ff",fill:"#4da6ff",fillOpacity:.2,strokeWidth:2})]})})]})}function mY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.input",e,v),ht.timeseries("claude_code.tokens.output",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>{const y=f.get(v)??0,g=d.get(v)??0;return{label:new Date(v).toLocaleString("es",{hour:"2-digit",day:"numeric",month:"short"}),efficiency:y>0?Number((g/y).toFixed(3)):0}});return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de eficiencia"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Ratio output/input"}),D.jsx(Rf,{width:"100%",height:220,children:D.jsxs(sY,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,domain:[0,"auto"]}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},formatter:v=>[v.toFixed(3),"Eficiencia"]}),D.jsx(Vf,{y:.5,stroke:"#444444",strokeDasharray:"4 4",label:{value:"0.5",fill:"#666",fontSize:10}}),D.jsx(Il,{type:"monotone",dataKey:"efficiency",stroke:"#a855f7",strokeWidth:2,dot:!1})]})})]})}function gY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState(null),[c,f]=W.useState([]),[d,h]=W.useState(null),[v,y]=W.useState("");W.useEffect(()=>{ht.sessions(50).then(r).catch(()=>{})},[e,t]);function g(S){o===S?l(null):(l(S),ht.sessionEvents(S).then(f).catch(()=>{}))}function x(S,b,w){w.stopPropagation(),h(S),y(b??"")}async function _(S){v.trim()&&(await ht.labelSession(S,v.trim()).catch(()=>{}),r(b=>b.map(w=>w.sessionId===S?{...w,project:v.trim()}:w))),h(null)}return n.length===0?D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin sesiones registradas"}):D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:D.jsxs("table",{className:"w-full text-sm",children:[D.jsx("thead",{children:D.jsxs("tr",{className:"border-b border-bg-border",children:[D.jsx("th",{className:"w-6 px-3 py-2"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"ID"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Proyecto"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Modelo"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Inicio"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Duración"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Input"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Output"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Coste"})]})}),D.jsx("tbody",{children:n.map(S=>D.jsxs(W.Fragment,{children:[D.jsxs("tr",{className:"border-b border-bg-border hover:bg-bg-card-hover cursor-pointer",onClick:()=>g(S.sessionId),children:[D.jsx("td",{className:"px-3 py-2 text-text-muted",children:o===S.sessionId?D.jsx($R,{size:14}):D.jsx(zR,{size:14})}),D.jsxs("td",{className:"px-3 py-2 font-mono text-text-secondary text-xs",children:[S.sessionId.slice(0,8),"…"]}),D.jsx("td",{className:"px-3 py-2",onClick:b=>b.stopPropagation(),children:d===S.sessionId?D.jsxs("span",{className:"flex items-center gap-1",children:[D.jsx("input",{autoFocus:!0,value:v,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&_(S.sessionId),b.key==="Escape"&&h(null)},className:"bg-bg-base border border-bg-border rounded px-1 py-0.5 text-xs text-text-primary w-24 outline-none focus:border-accent-green"}),D.jsx("button",{onClick:()=>_(S.sessionId),className:"text-accent-green",children:D.jsx(zb,{size:12})}),D.jsx("button",{onClick:()=>h(null),className:"text-accent-orange",children:D.jsx(k2,{size:12})})]}):D.jsxs("span",{onClick:b=>x(S.sessionId,S.project,b),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bg-base border border-bg-border text-text-secondary hover:border-accent-green cursor-pointer transition-colors",children:[S.project??"—",D.jsx(HR,{size:10,className:"opacity-50"})]})}),D.jsx("td",{className:"px-3 py-2 text-text-secondary font-mono text-xs",children:S.model??"—"}),D.jsx("td",{className:"px-3 py-2 text-text-secondary",children:a3(S.startTime)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-text-secondary",children:Bb(S.durationActiveMs)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-blue",children:er(S.tokensInput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-green",children:er(S.tokensOutput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-purple",children:ei(S.cost)})]}),o===S.sessionId&&D.jsx("tr",{children:D.jsx("td",{colSpan:9,className:"bg-bg-subtle px-6 py-3",children:D.jsx("div",{className:"text-xs font-mono space-y-0.5 max-h-40 overflow-y-auto",children:c.length===0?D.jsx("span",{className:"text-text-muted",children:"Sin eventos"}):c.slice(-20).map((b,w)=>D.jsxs("div",{className:"flex gap-2 text-text-secondary",children:[D.jsx("span",{className:"text-text-muted shrink-0",children:new Date(b.timestamp).toLocaleTimeString()}),D.jsx("span",{className:"text-accent-teal",children:b.eventName})]},w))})})})]},S.sessionId))})]})})}function bY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]);if(W.useEffect(()=>{ht.projects(e).then(r).catch(()=>{})},[e,t]),n.length===0)return D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin proyectos registrados"});const o=Math.max(...n.map(l=>l.cost),1e-4);return D.jsxs("div",{className:"flex flex-col gap-4",children:[D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4 space-y-3",children:n.map(l=>D.jsxs("div",{children:[D.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[D.jsx("span",{className:"text-text-primary font-medium",children:l.project}),D.jsx("span",{className:"text-accent-purple font-mono",children:ei(l.cost)})]}),D.jsx("div",{className:"h-2 bg-bg-base rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-accent-purple rounded-full",style:{width:`${l.cost/o*100}%`}})})]},l.project))}),D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:D.jsxs("table",{className:"w-full text-sm",children:[D.jsx("thead",{children:D.jsxs("tr",{className:"border-b border-bg-border",children:[D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Proyecto"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Sesiones"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Input"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Output"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Caché %"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Coste"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Commits"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"LOC +/-"})]})}),D.jsx("tbody",{children:n.map(l=>D.jsxs("tr",{className:"border-b border-bg-border hover:bg-bg-card-hover",children:[D.jsx("td",{className:"px-3 py-2 text-text-primary font-medium",children:l.project}),D.jsx("td",{className:"px-3 py-2 text-right text-text-secondary",children:l.sessions}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-blue",children:er(l.tokensInput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-green",children:er(l.tokensOutput)}),D.jsxs("td",{className:"px-3 py-2 text-right font-mono text-accent-teal",children:[(l.cacheHitRate*100).toFixed(1),"%"]}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-purple",children:ei(l.cost)}),D.jsx("td",{className:"px-3 py-2 text-right text-text-secondary",children:l.commits}),D.jsxs("td",{className:"px-3 py-2 text-right font-mono text-xs",children:[D.jsxs("span",{className:"text-accent-green",children:["+",l.linesAdded]}),D.jsx("span",{className:"text-text-muted",children:" / "}),D.jsxs("span",{className:"text-accent-orange",children:["-",l.linesRemoved]})]})]},l.project))})]})})]})}function xY({timeRange:e,sseVersion:t}){const[n,r]=W.useState(null);if(W.useEffect(()=>{ht.tools(e).then(r).catch(()=>{})},[e,t]),!n||n.usage.length===0)return D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin datos de herramientas"});const o=Math.max(...n.usage.map(f=>f.count),1),l=n.decisionRate.approved+n.decisionRate.rejected,c=l>0?(n.decisionRate.approved/l*100).toFixed(1):"—";return D.jsxs("div",{className:"flex flex-col gap-4",children:[D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("span",{className:"text-text-secondary text-sm",children:"Tasa de aprobación: "}),D.jsxs("span",{className:"text-accent-green font-mono font-bold",children:[c,"%"]}),D.jsxs("span",{className:"text-text-muted text-xs ml-2",children:["(",n.decisionRate.approved," aprobadas / ",n.decisionRate.rejected," rechazadas)"]})]}),D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4 space-y-2",children:n.usage.map(f=>D.jsxs("div",{children:[D.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[D.jsx("span",{className:"font-mono text-text-primary",children:f.toolName}),D.jsxs("span",{className:"text-text-secondary",children:[f.count," usos · ",(f.successRate*100).toFixed(0),"% éxito"]})]}),D.jsx("div",{className:"h-1.5 bg-bg-base rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-accent-teal rounded-full",style:{width:`${f.count/o*100}%`}})})]},f.toolName))})]})}const SY=[{id:"all",label:"Todos"},{id:"api",label:"API"},{id:"tools",label:"Tools"},{id:"prompts",label:"Prompts"},{id:"errors",label:"Errores"}];function OY(e){return e.includes("error")?"text-accent-orange":e==="user_prompt"?"text-accent-blue":e==="api_request"?"text-accent-green":e==="tool_use"?"text-accent-teal":e.startsWith("hook_")?"text-accent-yellow":"text-text-secondary"}function _Y(e,t){return t==="all"?!0:t==="api"?e.eventName.includes("api"):t==="tools"?e.eventName.includes("tool"):t==="prompts"?e.eventName.includes("prompt"):t==="errors"?e.eventName.includes("error"):!0}function AY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState("all"),[c,f]=W.useState(!1);W.useEffect(()=>{ht.events(500).then(r).catch(()=>{})},[e,t]);const d=n.filter(h=>_Y(h,o));return D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg flex flex-col h-[600px]",children:[D.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-bg-border flex-wrap",children:[SY.map(({id:h,label:v})=>D.jsx("button",{onClick:()=>l(h),className:`px-2 py-1 rounded text-xs transition-colors ${o===h?"bg-accent-green text-black font-medium":"text-text-secondary hover:text-text-primary"}`,children:v},h)),D.jsx("div",{className:"flex-1"}),D.jsxs("button",{onClick:()=>f(h=>!h),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-text-secondary hover:text-text-primary",children:[c?D.jsx(YR,{size:12}):D.jsx(UR,{size:12}),D.jsx("span",{children:c?"Reanudar":"Pausar"})]})]}),D.jsx("div",{className:"flex-1 overflow-y-auto p-3 font-mono text-xs space-y-0.5",children:d.length===0?D.jsx("span",{className:"text-text-muted",children:"Sin eventos"}):d.map((h,v)=>D.jsxs("div",{className:"flex gap-2 hover:bg-bg-base px-1 rounded",children:[D.jsx("span",{className:"text-text-muted shrink-0",children:new Date(h.timestamp).toLocaleTimeString()}),D.jsx("span",{className:`shrink-0 ${OY(h.eventName)}`,children:h.eventName}),h.sessionId&&D.jsxs("span",{className:"text-text-muted",children:[h.sessionId.slice(0,6),"…"]})]},v))})]})}function wY({sseVersion:e}){const[t,n]=W.useState([]);if(W.useEffect(()=>{ht.agents().then(n).catch(()=>{})},[e]),t.length===0)return D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-8 flex items-center justify-center",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de agentes. Aparece cuando hay múltiples agentes en trazas OTLP."})});const r=t.filter(c=>!c.parentAgentId),o=c=>t.filter(f=>f.parentAgentId===c);function l({agent:c,depth:f=0}){const d=o(c.agentId);return D.jsxs("div",{style:{paddingLeft:`${f*16}px`},children:[D.jsxs("div",{className:"flex items-center gap-4 py-2 border-b border-bg-border text-sm hover:bg-bg-card-hover px-2",children:[D.jsxs("span",{className:"font-mono text-text-muted text-xs w-20 shrink-0",children:[c.agentId.slice(0,8),"…"]}),D.jsx("span",{className:"font-mono text-accent-blue",children:er(c.tokensInput)}),D.jsx("span",{className:"font-mono text-accent-green",children:er(c.tokensOutput)}),D.jsx("span",{className:"font-mono text-accent-purple",children:ei(c.cost)}),D.jsx("span",{className:"text-text-secondary",children:Bb(c.durationMs)}),D.jsxs("span",{className:"text-text-muted text-xs",children:[c.toolCalls," tools"]})]}),d.map(h=>D.jsx(l,{agent:h,depth:f+1},h.agentId))]})}return D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:[D.jsxs("div",{className:"px-3 py-2 border-b border-bg-border grid grid-cols-6 text-xs text-text-muted",children:[D.jsx("span",{children:"Agent ID"}),D.jsx("span",{children:"Input"}),D.jsx("span",{children:"Output"}),D.jsx("span",{children:"Coste"}),D.jsx("span",{children:"Duración"}),D.jsx("span",{children:"Tools"})]}),r.map(c=>D.jsx(l,{agent:c},c.agentId))]})}function TY(){const[e,t]=W.useState("now-7d");return{timeRange:e,setTimeRange:t}}function EY(e){W.useEffect(()=>{let t=null,n;function r(){t=new EventSource("/api/stream"),t.onmessage=o=>{try{const{type:l,payload:c}=JSON.parse(o.data);l!=="ping"&&e(l,c)}catch{}},t.onerror=()=>{t==null||t.close(),t=null,n=setTimeout(r,3e3)}}return r(),()=>{clearTimeout(n),t==null||t.close()}},[])}function jY(e){const[t,n]=W.useState({connected:!1,lastSeen:null,sessionCount:0,totalEvents:0,uptime:0}),[r,o]=W.useState(null),[l,c]=W.useState(0),f=W.useRef(0),d=W.useCallback(async()=>{f.current=Date.now();try{const[v,y]=await Promise.all([ht.status(),ht.summary(e)]);n(v),o(y)}catch{}},[e]);W.useEffect(()=>{d()},[d]);const h=W.useCallback((v,y)=>{c(g=>g+1),Date.now()-f.current>5e3?d():ht.status().then(n).catch(()=>{})},[d]);return EY(h),{status:t,summary:r,refetch:d,sseVersion:l}}function MY(){const[e,t]=W.useState("overview"),{timeRange:n,setTimeRange:r}=TY(),{status:o,summary:l,refetch:c,sseVersion:f}=jY(n),d=W.useCallback(async()=>{await ht.reset(),c()},[c]);return!o.connected&&o.totalEvents===0?D.jsxs("div",{className:"min-h-screen bg-bg-base text-text-primary flex flex-col",children:[D.jsx(JO,{timeRange:n,onTimeRangeChange:r,connected:!1,lastSeen:null,onReset:d}),D.jsx(JR,{})]}):D.jsxs("div",{className:"min-h-screen bg-bg-base text-text-primary flex flex-col",children:[D.jsx(JO,{timeRange:n,onTimeRangeChange:r,connected:o.connected,lastSeen:o.lastSeen,onReset:d}),D.jsx(n3,{onLabeled:c}),D.jsx(WR,{activeTab:e,onTabChange:t}),D.jsxs("main",{className:"flex-1 p-4 max-w-screen-2xl mx-auto w-full",children:[e==="overview"&&D.jsxs("div",{className:"flex flex-col gap-4",children:[l&&D.jsx(i3,{summary:l}),D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[D.jsx(hY,{timeRange:n,sseVersion:f}),D.jsx(vY,{timeRange:n,sseVersion:f})]})]}),e==="sessions"&&D.jsx(gY,{timeRange:n,sseVersion:f}),e==="projects"&&D.jsx(bY,{timeRange:n,sseVersion:f}),e==="tools"&&D.jsx(xY,{timeRange:n,sseVersion:f}),e==="agents"&&D.jsx(wY,{sseVersion:f}),e==="events"&&D.jsx(AY,{timeRange:n,sseVersion:f}),e==="costs"&&D.jsxs("div",{className:"flex flex-col gap-4",children:[l&&D.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Coste período"}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-purple",children:ei(l.cost)})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Eficiencia"}),D.jsxs("div",{className:"text-2xl font-mono font-bold text-accent-green",children:[(l.efficiency*100).toFixed(1),"%"]})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Tokens caché"}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-teal",children:er(l.tokens.cache)})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Ahorro caché est."}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-yellow",children:ei(l.tokens.cache*3e-7)})]})]}),D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[D.jsx(yY,{timeRange:n,sseVersion:f}),D.jsx(mY,{timeRange:n,sseVersion:f})]})]})]})]})}ER.createRoot(document.getElementById("root")).render(D.jsx(W.StrictMode,{children:D.jsx(MY,{})}));
|
package/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>tokenrace</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-Bq_1mbQ9.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-B0dy8dWP.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/package.json
CHANGED
package/src/store.js
CHANGED
|
@@ -263,7 +263,44 @@ export function processEvent({ eventName, timestamp, severity, attributes }) {
|
|
|
263
263
|
}
|
|
264
264
|
state.eventIndex++
|
|
265
265
|
|
|
266
|
-
// ──
|
|
266
|
+
// ── Asegurar que la sesión existe (puede llegar un evento antes que una métrica) ──
|
|
267
|
+
if (sessionId && !state.sessions.has(sessionId)) {
|
|
268
|
+
state.sessions.set(sessionId, {
|
|
269
|
+
sessionId,
|
|
270
|
+
project,
|
|
271
|
+
feature: attributes.feature ?? null,
|
|
272
|
+
model,
|
|
273
|
+
startTime: timestamp,
|
|
274
|
+
lastSeen: timestamp,
|
|
275
|
+
durationActiveMs: 0,
|
|
276
|
+
tokensInput: 0,
|
|
277
|
+
tokensOutput: 0,
|
|
278
|
+
tokensCache: 0,
|
|
279
|
+
cost: 0,
|
|
280
|
+
apiRequests: 0,
|
|
281
|
+
toolCalls: 0
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (sessionId && state.sessions.has(sessionId)) {
|
|
286
|
+
const session = state.sessions.get(sessionId)
|
|
287
|
+
session.lastSeen = Math.max(session.lastSeen, timestamp)
|
|
288
|
+
if (model && !session.model) session.model = model
|
|
289
|
+
|
|
290
|
+
// ── Tiempo activo desde eventos api_request (duration_ms) ──
|
|
291
|
+
if (eventName === 'api_request') {
|
|
292
|
+
const dur = Number(attributes['duration_ms'] ?? 0)
|
|
293
|
+
if (dur > 0) session.durationActiveMs += dur
|
|
294
|
+
session.apiRequests++
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// ── Tool stats ──
|
|
298
|
+
if (eventName === 'tool_use') {
|
|
299
|
+
session.toolCalls++
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// ── Tool stats globales ──
|
|
267
304
|
if (eventName === 'tool_use') {
|
|
268
305
|
const toolName = attributes['tool.name'] ?? attributes.tool ?? 'unknown'
|
|
269
306
|
|
|
@@ -279,11 +316,6 @@ export function processEvent({ eventName, timestamp, severity, attributes }) {
|
|
|
279
316
|
if (attributes['tool.duration_ms'] !== undefined) {
|
|
280
317
|
tool.totalDurationMs += Number(attributes['tool.duration_ms'])
|
|
281
318
|
}
|
|
282
|
-
|
|
283
|
-
// Incrementar toolCalls en la sesión
|
|
284
|
-
if (sessionId && state.sessions.has(sessionId)) {
|
|
285
|
-
state.sessions.get(sessionId).toolCalls++
|
|
286
|
-
}
|
|
287
319
|
}
|
|
288
320
|
|
|
289
321
|
state.lastSeen = timestamp
|