heyio 4.1.2 → 4.1.4

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.
@@ -514,7 +514,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
514
514
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pre(t,e){if(t){if(typeof t=="string")return ww(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ww(t,e)}}function Rre(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ire(t){if(Array.isArray(t))return ww(t)}function ww(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $re(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ON(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,SM(n.key),n)}}function Mre(t,e,r){return e&&ON(t.prototype,e),r&&ON(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Dre(t,e,r){return e=Qh(e),Lre(t,_M()?Reflect.construct(e,r||[],Qh(t).constructor):e.apply(t,r))}function Lre(t,e){if(e&&(ll(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zre(t)}function zre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _M(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_M=function(){return!!t})()}function Qh(t){return Qh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Qh(t)}function Bre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_w(t,e)}function _w(t,e){return _w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},_w(t,e)}function Wn(t,e,r){return e=SM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function SM(t){var e=Ure(t,"string");return ll(e)=="symbol"?e:e+""}function Ure(t,e){if(ll(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ll(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Gu=(function(t){function e(){var r;$re(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=Dre(this,e,[].concat(i)),Wn(r,"state",{isAnimationFinished:!0,totalLength:0}),Wn(r,"generateSimpleStrokeDasharray",function(o,c){return"".concat(c,"px ").concat(o-c,"px")}),Wn(r,"getStrokeDasharray",function(o,c,u){var d=u.reduce(function(k,S){return k+S});if(!d)return r.generateSimpleStrokeDasharray(c,o);for(var p=Math.floor(o/d),f=o%d,m=c-o,v=[],b=0,w=0;b<u.length;w+=u[b],++b)if(w+u[b]>f){v=[].concat(Os(u.slice(0,b)),[f-w]);break}var x=v.length%2===0?[0,m]:[m];return[].concat(Os(e.repeat(u,p)),Os(v),x).map(function(k){return"".concat(k,"px")}).join(", ")}),Wn(r,"id",Bu("recharts-line-")),Wn(r,"pathRef",function(o){r.mainCurve=o}),Wn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Wn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Bre(e,t),Mre(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,c=a.xAxis,u=a.yAxis,d=a.layout,p=a.children,f=Tn(p,Ku);if(!f)return null;var m=function(w,x){return{x:w.x,y:w.y,value:w.value,errorVal:dn(w.payload,x)}},v={clipPath:n?"url(#clipPath-".concat(i,")"):null};return M.createElement(Xt,v,f.map(function(b){return M.cloneElement(b,{key:"bar-".concat(b.props.dataKey),data:o,xAxis:c,yAxis:u,layout:d,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var c=this.props,u=c.dot,d=c.points,p=c.dataKey,f=at(this.props,!1),m=at(u,!0),v=d.map(function(w,x){var k=an(an(an({key:"dot-".concat(x),r:3},f),m),{},{index:x,cx:w.x,cy:w.y,value:w.value,dataKey:p,payload:w.payload,points:d});return e.renderDotItem(u,k)}),b={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return M.createElement(Xt,Bc({className:"recharts-line-dots",key:"dots"},b),v)}},{key:"renderCurveStatically",value:function(n,i,a,o){var c=this.props,u=c.type,d=c.layout,p=c.connectNulls;c.ref;var f=EN(c,Tre),m=an(an(an({},at(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:u,layout:d,connectNulls:p});return M.createElement(Qx,Bc({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,c=o.points,u=o.strokeDasharray,d=o.isAnimationActive,p=o.animationBegin,f=o.animationDuration,m=o.animationEasing,v=o.animationId,b=o.animateNewValues,w=o.width,x=o.height,k=this.state,S=k.prevPoints,A=k.totalLength;return M.createElement(ea,{begin:p,duration:f,isActive:d,easing:m,from:{t:0},to:{t:1},key:"line-".concat(v),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(C){var T=C.t;if(S){var O=S.length/c.length,N=c.map(function(U,F){var X=Math.floor(F*O);if(S[X]){var Y=S[X],G=Vn(Y.x,U.x),Z=Vn(Y.y,U.y);return an(an({},U),{},{x:G(T),y:Z(T)})}if(b){var K=Vn(w*2,U.x),ee=Vn(x/2,U.y);return an(an({},U),{},{x:K(T),y:ee(T)})}return an(an({},U),{},{x:U.x,y:U.y})});return a.renderCurveStatically(N,n,i)}var R=Vn(0,A),$=R(T),W;if(u){var z="".concat(u).split(/[,\s]+/gim).map(function(U){return parseFloat(U)});W=a.getStrokeDasharray($,A,z)}else W=a.generateSimpleStrokeDasharray(A,$);return a.renderCurveStatically(c,n,i,{strokeDasharray:W})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,c=a.isAnimationActive,u=this.state,d=u.prevPoints,p=u.totalLength;return c&&o&&o.length&&(!d&&p>0||!Dp(d,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,c=i.points,u=i.className,d=i.xAxis,p=i.yAxis,f=i.top,m=i.left,v=i.width,b=i.height,w=i.isAnimationActive,x=i.id;if(a||!c||!c.length)return null;var k=this.state.isAnimationFinished,S=c.length===1,A=ot("recharts-line",u),C=d&&d.allowDataOverflow,T=p&&p.allowDataOverflow,O=C||T,N=tt(x)?this.id:x,R=(n=at(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},$=R.r,W=$===void 0?3:$,z=R.strokeWidth,U=z===void 0?2:z,F=rF(o)?o:{},X=F.clipDot,Y=X===void 0?!0:X,G=W*2+U;return M.createElement(Xt,{className:A},C||T?M.createElement("defs",null,M.createElement("clipPath",{id:"clipPath-".concat(N)},M.createElement("rect",{x:C?m:m-v/2,y:T?f:f-b/2,width:C?v:v*2,height:T?b:b*2})),!Y&&M.createElement("clipPath",{id:"clipPath-dots-".concat(N)},M.createElement("rect",{x:m-G/2,y:f-G/2,width:v+G,height:b+G}))):null,!S&&this.renderCurve(O,N),this.renderErrorBar(O,N),(S||o)&&this.renderDots(O,Y,N),(!w||k)&&za.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(Os(n),[0]):n,o=[],c=0;c<i;++c)o=[].concat(Os(o),Os(a));return o}},{key:"renderDotItem",value:function(n,i){var a;if(M.isValidElement(n))a=M.cloneElement(n,i);else if(Je(n))a=n(i);else{var o=i.key,c=EN(i,Cre),u=ot("recharts-line-dot",typeof n!="boolean"?n.className:"");a=M.createElement(a_,Bc({key:o},c,{className:u}))}return a}}])})(j.PureComponent);Wn(Gu,"displayName","Line");Wn(Gu,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Sl.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Wn(Gu,"getComposedData",function(t){var e=t.props,r=t.xAxis,n=t.yAxis,i=t.xAxisTicks,a=t.yAxisTicks,o=t.dataKey,c=t.bandSize,u=t.displayedData,d=t.offset,p=e.layout,f=u.map(function(m,v){var b=dn(m,o);return p==="horizontal"?{x:Hj({axis:r,ticks:i,bandSize:c,entry:m,index:v}),y:tt(b)?null:n.scale(b),value:b,payload:m}:{x:tt(b)?null:r.scale(b),y:Hj({axis:n,ticks:a,bandSize:c,entry:m,index:v}),value:b,payload:m}});return an({points:f,layout:p},d)});function cl(t){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cl(t)}function qre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fre(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,AM(n.key),n)}}function Hre(t,e,r){return e&&Fre(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wre(t,e,r){return e=ep(e),Kre(t,kM()?Reflect.construct(e,r||[],ep(t).constructor):e.apply(t,r))}function Kre(t,e){if(e&&(cl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gre(t)}function Gre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kM=function(){return!!t})()}function ep(t){return ep=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ep(t)}function Vre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Sw(t,e)}function Sw(t,e){return Sw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Sw(t,e)}function EM(t,e,r){return e=AM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function AM(t){var e=Xre(t,"string");return cl(e)=="symbol"?e:e+""}function Xre(t,e){if(cl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(cl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function kw(){return kw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kw.apply(this,arguments)}function Yre(t){var e=t.xAxisId,r=c_(),n=u_(),i=uM(e);return i==null?null:j.createElement(Ol,kw({},i,{className:ot("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Ki(o,!0)}}))}var Ua=(function(t){function e(){return qre(this,e),Wre(this,e,arguments)}return Vre(e,t),Hre(e,[{key:"render",value:function(){return j.createElement(Yre,this.props)}}])})(j.Component);EM(Ua,"displayName","XAxis");EM(Ua,"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 ul(t){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ul(t)}function Jre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zre(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,CM(n.key),n)}}function Qre(t,e,r){return e&&Zre(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ene(t,e,r){return e=tp(e),tne(t,OM()?Reflect.construct(e,r||[],tp(t).constructor):e.apply(t,r))}function tne(t,e){if(e&&(ul(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rne(t)}function rne(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OM=function(){return!!t})()}function tp(t){return tp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tp(t)}function nne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ew(t,e)}function Ew(t,e){return Ew=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ew(t,e)}function TM(t,e,r){return e=CM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function CM(t){var e=ine(t,"string");return ul(e)=="symbol"?e:e+""}function ine(t,e){if(ul(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ul(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Aw(){return Aw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Aw.apply(this,arguments)}var ane=function(e){var r=e.yAxisId,n=c_(),i=u_(),a=dM(r);return a==null?null:j.createElement(Ol,Aw({},a,{className:ot("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:i},ticksGenerator:function(c){return Ki(c,!0)}}))},qa=(function(t){function e(){return Jre(this,e),ene(this,e,arguments)}return nne(e,t),Qre(e,[{key:"render",value:function(){return j.createElement(ane,this.props)}}])})(j.Component);TM(qa,"displayName","YAxis");TM(qa,"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 TN(t){return cne(t)||lne(t)||sne(t)||one()}function one(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
515
515
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sne(t,e){if(t){if(typeof t=="string")return Ow(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ow(t,e)}}function lne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function cne(t){if(Array.isArray(t))return Ow(t)}function Ow(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Tw=function(e,r,n,i,a){var o=Tn(e,f_),c=Tn(e,Hp),u=[].concat(TN(o),TN(c)),d=Tn(e,Kp),p="".concat(i,"Id"),f=i[0],m=r;if(u.length&&(m=u.reduce(function(w,x){if(x.props[p]===n&&Si(x.props,"extendDomain")&&ge(x.props[f])){var k=x.props[f];return[Math.min(w[0],k),Math.max(w[1],k)]}return w},m)),d.length){var v="".concat(f,"1"),b="".concat(f,"2");m=d.reduce(function(w,x){if(x.props[p]===n&&Si(x.props,"extendDomain")&&ge(x.props[v])&&ge(x.props[b])){var k=x.props[v],S=x.props[b];return[Math.min(w[0],k,S),Math.max(w[1],k,S)]}return w},m)}return a&&a.length&&(m=a.reduce(function(w,x){return ge(x)?[Math.min(w[0],x),Math.max(w[1],x)]:w},m)),m},qb={exports:{}},CN;function une(){return CN||(CN=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,d,p){this.fn=u,this.context=d,this.once=p||!1}function a(u,d,p,f,m){if(typeof p!="function")throw new TypeError("The listener must be a function");var v=new i(p,f||u,m),b=r?r+d:d;return u._events[b]?u._events[b].fn?u._events[b]=[u._events[b],v]:u._events[b].push(v):(u._events[b]=v,u._eventsCount++),u}function o(u,d){--u._eventsCount===0?u._events=new n:delete u._events[d]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var d=[],p,f;if(this._eventsCount===0)return d;for(f in p=this._events)e.call(p,f)&&d.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(p)):d},c.prototype.listeners=function(d){var p=r?r+d:d,f=this._events[p];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,v=f.length,b=new Array(v);m<v;m++)b[m]=f[m].fn;return b},c.prototype.listenerCount=function(d){var p=r?r+d:d,f=this._events[p];return f?f.fn?1:f.length:0},c.prototype.emit=function(d,p,f,m,v,b){var w=r?r+d:d;if(!this._events[w])return!1;var x=this._events[w],k=arguments.length,S,A;if(x.fn){switch(x.once&&this.removeListener(d,x.fn,void 0,!0),k){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,p),!0;case 3:return x.fn.call(x.context,p,f),!0;case 4:return x.fn.call(x.context,p,f,m),!0;case 5:return x.fn.call(x.context,p,f,m,v),!0;case 6:return x.fn.call(x.context,p,f,m,v,b),!0}for(A=1,S=new Array(k-1);A<k;A++)S[A-1]=arguments[A];x.fn.apply(x.context,S)}else{var C=x.length,T;for(A=0;A<C;A++)switch(x[A].once&&this.removeListener(d,x[A].fn,void 0,!0),k){case 1:x[A].fn.call(x[A].context);break;case 2:x[A].fn.call(x[A].context,p);break;case 3:x[A].fn.call(x[A].context,p,f);break;case 4:x[A].fn.call(x[A].context,p,f,m);break;default:if(!S)for(T=1,S=new Array(k-1);T<k;T++)S[T-1]=arguments[T];x[A].fn.apply(x[A].context,S)}}return!0},c.prototype.on=function(d,p,f){return a(this,d,p,f,!1)},c.prototype.once=function(d,p,f){return a(this,d,p,f,!0)},c.prototype.removeListener=function(d,p,f,m){var v=r?r+d:d;if(!this._events[v])return this;if(!p)return o(this,v),this;var b=this._events[v];if(b.fn)b.fn===p&&(!m||b.once)&&(!f||b.context===f)&&o(this,v);else{for(var w=0,x=[],k=b.length;w<k;w++)(b[w].fn!==p||m&&!b[w].once||f&&b[w].context!==f)&&x.push(b[w]);x.length?this._events[v]=x.length===1?x[0]:x:o(this,v)}return this},c.prototype.removeAllListeners=function(d){var p;return d?(p=r?r+d:d,this._events[p]&&o(this,p)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c})(qb)),qb.exports}var dne=une();const fne=vt(dne);var Fb=new fne,Hb="recharts.syncMouseEvents";function Nu(t){"@babel/helpers - typeof";return Nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nu(t)}function hne(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,jM(n.key),n)}}function mne(t,e,r){return e&&pne(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wb(t,e,r){return e=jM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jM(t){var e=gne(t,"string");return Nu(e)=="symbol"?e:e+""}function gne(t,e){if(Nu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Nu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var yne=(function(){function t(){hne(this,t),Wb(this,"activeIndex",0),Wb(this,"coordinateList",[]),Wb(this,"layout","horizontal")}return mne(t,[{key:"setDetails",value:function(r){var n,i=r.coordinateList,a=i===void 0?null:i,o=r.container,c=o===void 0?null:o,u=r.layout,d=u===void 0?null:u,p=r.offset,f=p===void 0?null:p,m=r.mouseHandlerCallback,v=m===void 0?null:m;this.coordinateList=(n=a??this.coordinateList)!==null&&n!==void 0?n:[],this.container=c??this.container,this.layout=d??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=v??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(r){if(this.coordinateList.length!==0)switch(r.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(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),a=i.x,o=i.y,c=i.height,u=this.coordinateList[this.activeIndex].coordinate,d=((r=window)===null||r===void 0?void 0:r.scrollX)||0,p=((n=window)===null||n===void 0?void 0:n.scrollY)||0,f=a+u+d,m=o+this.offset.top+c/2+p;this.mouseHandlerCallback({pageX:f,pageY:m})}}}])})();function vne(t,e,r){if(r==="number"&&e===!0&&Array.isArray(t)){var n=t==null?void 0:t[0],i=t==null?void 0:t[1];if(n&&i&&ge(n)&&ge(i))return!0}return!1}function bne(t,e,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:r.left+.5,y:t==="horizontal"?r.top+.5:e.y-i,width:t==="horizontal"?n:r.width-1,height:t==="horizontal"?r.height-1:n}}function NM(t){var e=t.cx,r=t.cy,n=t.radius,i=t.startAngle,a=t.endAngle,o=wr(e,r,n,i),c=wr(e,r,n,a);return{points:[o,c],cx:e,cy:r,radius:n,startAngle:i,endAngle:a}}function xne(t,e,r){var n,i,a,o;if(t==="horizontal")n=e.x,a=n,i=r.top,o=r.top+r.height;else if(t==="vertical")i=e.y,o=i,n=r.left,a=r.left+r.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var c=e.cx,u=e.cy,d=e.innerRadius,p=e.outerRadius,f=e.angle,m=wr(c,u,d,f),v=wr(c,u,p,f);n=m.x,i=m.y,a=v.x,o=v.y}else return NM(e);return[{x:n,y:i},{x:a,y:o}]}function Pu(t){"@babel/helpers - typeof";return Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pu(t)}function jN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function jf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jN(Object(r),!0).forEach(function(n){wne(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function wne(t,e,r){return e=_ne(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _ne(t){var e=Sne(t,"string");return Pu(e)=="symbol"?e:e+""}function Sne(t,e){if(Pu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Pu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kne(t){var e,r,n=t.element,i=t.tooltipEventType,a=t.isActive,o=t.activeCoordinate,c=t.activePayload,u=t.offset,d=t.activeTooltipIndex,p=t.tooltipAxisBandSize,f=t.layout,m=t.chartName,v=(e=n.props.cursor)!==null&&e!==void 0?e:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!v||!a||!o||m!=="ScatterChart"&&i!=="axis")return null;var b,w=Qx;if(m==="ScatterChart")b=o,w=_Q;else if(m==="BarChart")b=bne(f,o,u,p),w=i_;else if(f==="radial"){var x=NM(o),k=x.cx,S=x.cy,A=x.radius,C=x.startAngle,T=x.endAngle;b={cx:k,cy:S,startAngle:C,endAngle:T,innerRadius:A,outerRadius:A},w=z$}else b={points:xne(f,o,u)},w=Qx;var O=jf(jf(jf(jf({stroke:"#ccc",pointerEvents:"none"},u),b),at(v,!1)),{},{payload:c,payloadIndex:d,className:ot("recharts-tooltip-cursor",v.className)});return j.isValidElement(v)?j.cloneElement(v,O):j.createElement(w,O)}var Ene=["item"],Ane=["children","className","width","height","style","compact","title","desc"];function dl(t){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dl(t)}function $s(){return $s=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},$s.apply(this,arguments)}function NN(t,e){return Cne(t)||Tne(t,e)||RM(t,e)||One()}function One(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
516
516
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tne(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function Cne(t){if(Array.isArray(t))return t}function PN(t,e){if(t==null)return{};var r=jne(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function jne(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Nne(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,IM(n.key),n)}}function Rne(t,e,r){return e&&Pne(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ine(t,e,r){return e=rp(e),$ne(t,PM()?Reflect.construct(e,r||[],rp(t).constructor):e.apply(t,r))}function $ne(t,e){if(e&&(dl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mne(t)}function Mne(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PM=function(){return!!t})()}function rp(t){return rp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},rp(t)}function Dne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cw(t,e)}function Cw(t,e){return Cw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Cw(t,e)}function fl(t){return Bne(t)||zne(t)||RM(t)||Lne()}function Lne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
517
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RM(t,e){if(t){if(typeof t=="string")return jw(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jw(t,e)}}function zne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Bne(t){if(Array.isArray(t))return jw(t)}function jw(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function RN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?RN(Object(r),!0).forEach(function(n){ze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):RN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ze(t,e,r){return e=IM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function IM(t){var e=Une(t,"string");return dl(e)=="symbol"?e:e+""}function Une(t,e){if(dl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(dl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qne={xAxis:["bottom","top"],yAxis:["left","right"]},Fne={width:"100%",height:"100%"},$M={x:0,y:0};function Nf(t){return t}var Hne=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},Wne=function(e,r,n,i){var a=r.find(function(p){return p&&p.index===n});if(a){if(e==="horizontal")return{x:a.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,c=i.radius;return ie(ie(ie({},i),wr(i.cx,i.cy,c,o)),{},{angle:o,radius:c})}var u=a.coordinate,d=i.angle;return ie(ie(ie({},i),wr(i.cx,i.cy,u,d)),{},{angle:d,radius:u})}return $M},Gp=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(c,u){var d=u.props.data;return d&&d.length?[].concat(fl(c),fl(d)):c},[]);return o.length>0?o:e&&e.length&&ge(i)&&ge(a)?e.slice(i,a+1):[]};function MM(t){return t==="number"?[0,"auto"]:void 0}var Nw=function(e,r,n,i){var a=e.graphicalItems,o=e.tooltipAxis,c=Gp(r,e);return n<0||!a||!a.length||n>=c.length?null:a.reduce(function(u,d){var p,f=(p=d.props.data)!==null&&p!==void 0?p:r;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var m;if(o.dataKey&&!o.allowDuplicatedCategory){var v=f===void 0?c:f;m=ih(v,o.dataKey,i)}else m=f&&f[n]||c[n];return m?[].concat(fl(u),[M$(d,m)]):u},[])},IN=function(e,r,n,i){var a=i||{x:e.chartX,y:e.chartY},o=Hne(a,n),c=e.orderedTooltipTicks,u=e.tooltipAxis,d=e.tooltipTicks,p=tY(o,c,d,u);if(p>=0&&d){var f=d[p]&&d[p].value,m=Nw(e,r,p,f),v=Wne(n,c,p,a);return{activeTooltipIndex:p,activeLabel:f,activePayload:m,activeCoordinate:v}}return null},Kne=function(e,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,m=e.stackOffset,v=R$(p,a);return n.reduce(function(b,w){var x,k=w.type.defaultProps!==void 0?ie(ie({},w.type.defaultProps),w.props):w.props,S=k.type,A=k.dataKey,C=k.allowDataOverflow,T=k.allowDuplicatedCategory,O=k.scale,N=k.ticks,R=k.includeHidden,$=k[o];if(b[$])return b;var W=Gp(e.data,{graphicalItems:i.filter(function(q){var Q,le=o in q.props?q.props[o]:(Q=q.type.defaultProps)===null||Q===void 0?void 0:Q[o];return le===$}),dataStartIndex:u,dataEndIndex:d}),z=W.length,U,F,X;vne(k.domain,C,S)&&(U=Vx(k.domain,null,C),v&&(S==="number"||O!=="auto")&&(X=Lc(W,A,"category")));var Y=MM(S);if(!U||U.length===0){var G,Z=(G=k.domain)!==null&&G!==void 0?G:Y;if(A){if(U=Lc(W,A,S),S==="category"&&v){var K=K9(U);T&&K?(F=U,U=Fh(0,z)):T||(U=Vj(Z,U,w).reduce(function(q,Q){return q.indexOf(Q)>=0?q:[].concat(fl(q),[Q])},[]))}else if(S==="category")T?U=U.filter(function(q){return q!==""&&!tt(q)}):U=Vj(Z,U,w).reduce(function(q,Q){return q.indexOf(Q)>=0||Q===""||tt(Q)?q:[].concat(fl(q),[Q])},[]);else if(S==="number"){var ee=oY(W,i.filter(function(q){var Q,le,fe=o in q.props?q.props[o]:(Q=q.type.defaultProps)===null||Q===void 0?void 0:Q[o],ve="hide"in q.props?q.props.hide:(le=q.type.defaultProps)===null||le===void 0?void 0:le.hide;return fe===$&&(R||!ve)}),A,a,p);ee&&(U=ee)}v&&(S==="number"||O!=="auto")&&(X=Lc(W,A,"category"))}else v?U=Fh(0,z):c&&c[$]&&c[$].hasStack&&S==="number"?U=m==="expand"?[0,1]:$$(c[$].stackGroups,u,d):U=P$(W,i.filter(function(q){var Q=o in q.props?q.props[o]:q.type.defaultProps[o],le="hide"in q.props?q.props.hide:q.type.defaultProps.hide;return Q===$&&(R||!le)}),S,p,!0);if(S==="number")U=Tw(f,U,$,a,N),Z&&(U=Vx(Z,U,C));else if(S==="category"&&Z){var L=Z,I=U.every(function(q){return L.indexOf(q)>=0});I&&(U=L)}}return ie(ie({},b),{},ze({},$,ie(ie({},k),{},{axisType:a,domain:U,categoricalDomain:X,duplicateDomain:F,originalDomain:(x=k.domain)!==null&&x!==void 0?x:Y,isCategorical:v,layout:p})))},{})},Gne=function(e,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,m=Gp(e.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:d}),v=m.length,b=R$(p,a),w=-1;return n.reduce(function(x,k){var S=k.type.defaultProps!==void 0?ie(ie({},k.type.defaultProps),k.props):k.props,A=S[o],C=MM("number");if(!x[A]){w++;var T;return b?T=Fh(0,v):c&&c[A]&&c[A].hasStack?(T=$$(c[A].stackGroups,u,d),T=Tw(f,T,A,a)):(T=Vx(C,P$(m,n.filter(function(O){var N,R,$=o in O.props?O.props[o]:(N=O.type.defaultProps)===null||N===void 0?void 0:N[o],W="hide"in O.props?O.props.hide:(R=O.type.defaultProps)===null||R===void 0?void 0:R.hide;return $===A&&!W}),"number",p),i.defaultProps.allowDataOverflow),T=Tw(f,T,A,a)),ie(ie({},x),{},ze({},A,ie(ie({axisType:a},i.defaultProps),{},{hide:!0,orientation:On(qne,"".concat(a,".").concat(w%2),null),domain:T,originalDomain:C,isCategorical:b,layout:p})))}return x},{})},Vne=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.children,f="".concat(i,"Id"),m=Tn(p,a),v={};return m&&m.length?v=Kne(e,{axes:m,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d}):o&&o.length&&(v=Gne(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d})),v},Xne=function(e){var r=Ra(e),n=Ki(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:N1(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Rh(r,n)}},$N=function(e){var r=e.children,n=e.defaultShowTooltip,i=sn(r,rl),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},Yne=function(e){return!e||!e.length?!1:e.some(function(r){var n=Gi(r&&r.type);return n&&n.indexOf("Bar")>=0})},MN=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Jne=function(e,r){var n=e.props,i=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,c=e.yAxisMap,u=c===void 0?{}:c,d=n.width,p=n.height,f=n.children,m=n.margin||{},v=sn(f,rl),b=sn(f,Bs),w=Object.keys(u).reduce(function(T,O){var N=u[O],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},T),{},ze({},R,T[R]+N.width)):T},{left:m.left||0,right:m.right||0}),x=Object.keys(o).reduce(function(T,O){var N=o[O],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},T),{},ze({},R,On(T,"".concat(R))+N.height)):T},{top:m.top||0,bottom:m.bottom||0}),k=ie(ie({},x),w),S=k.bottom;v&&(k.bottom+=v.props.height||rl.defaultProps.height),b&&r&&(k=iY(k,i,n,r));var A=d-k.left-k.right,C=p-k.top-k.bottom;return ie(ie({brushBottom:S},k),{},{width:Math.max(A,0),height:Math.max(C,0)})},Zne=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},DM=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,o=e.validateTooltipEventTypes,c=o===void 0?["axis"]:o,u=e.axisComponents,d=e.legendContent,p=e.formatAxisMap,f=e.defaultProps,m=function(k,S){var A=S.graphicalItems,C=S.stackGroups,T=S.offset,O=S.updateId,N=S.dataStartIndex,R=S.dataEndIndex,$=k.barSize,W=k.layout,z=k.barGap,U=k.barCategoryGap,F=k.maxBarSize,X=MN(W),Y=X.numericAxisName,G=X.cateAxisName,Z=Yne(A),K=[];return A.forEach(function(ee,L){var I=Gp(k.data,{graphicalItems:[ee],dataStartIndex:N,dataEndIndex:R}),q=ee.type.defaultProps!==void 0?ie(ie({},ee.type.defaultProps),ee.props):ee.props,Q=q.dataKey,le=q.maxBarSize,fe=q["".concat(Y,"Id")],ve=q["".concat(G,"Id")],qe={},xe=u.reduce(function(cr,_t){var Sr=S["".concat(_t.axisType,"Map")],Ir=q["".concat(_t.axisType,"Id")];Sr&&Sr[Ir]||_t.axisType==="zAxis"||Mo();var ni=Sr[Ir];return ie(ie({},cr),{},ze(ze({},_t.axisType,ni),"".concat(_t.axisType,"Ticks"),Ki(ni)))},qe),ae=xe[G],Se=xe["".concat(G,"Ticks")],Me=C&&C[fe]&&C[fe].hasStack&&vY(ee,C[fe].stackGroups),oe=Gi(ee.type).indexOf("Bar")>=0,rt=Rh(ae,Se),Fe=[],kt=Z&&rY({barSize:$,stackGroups:C,totalSize:Zne(xe,G)});if(oe){var wt,Et,_r=tt(le)?F:le,Ut=(wt=(Et=Rh(ae,Se,!0))!==null&&Et!==void 0?Et:_r)!==null&&wt!==void 0?wt:0;Fe=nY({barGap:z,barCategoryGap:U,bandSize:Ut!==rt?Ut:rt,sizeList:kt[ve],maxBarSize:_r}),Ut!==rt&&(Fe=Fe.map(function(cr){return ie(ie({},cr),{},{position:ie(ie({},cr.position),{},{offset:cr.position.offset-Ut/2})})}))}var Rr=ee&&ee.type&&ee.type.getComposedData;Rr&&K.push({props:ie(ie({},Rr(ie(ie({},xe),{},{displayedData:I,props:k,dataKey:Q,item:ee,bandSize:rt,barPosition:Fe,offset:T,stackedData:Me,layout:W,dataStartIndex:N,dataEndIndex:R}))),{},ze(ze(ze({key:ee.key||"item-".concat(L)},Y,xe[Y]),G,xe[G]),"animationId",O)),childIndex:aF(ee,k.children),item:ee})}),K},v=function(k,S){var A=k.props,C=k.dataStartIndex,T=k.dataEndIndex,O=k.updateId;if(!lO({props:A}))return null;var N=A.children,R=A.layout,$=A.stackOffset,W=A.data,z=A.reverseStackOrder,U=MN(R),F=U.numericAxisName,X=U.cateAxisName,Y=Tn(N,n),G=mY(W,Y,"".concat(F,"Id"),"".concat(X,"Id"),$,z),Z=u.reduce(function(q,Q){var le="".concat(Q.axisType,"Map");return ie(ie({},q),{},ze({},le,Vne(A,ie(ie({},Q),{},{graphicalItems:Y,stackGroups:Q.axisType===F&&G,dataStartIndex:C,dataEndIndex:T}))))},{}),K=Jne(ie(ie({},Z),{},{props:A,graphicalItems:Y}),S==null?void 0:S.legendBBox);Object.keys(Z).forEach(function(q){Z[q]=p(A,Z[q],K,q.replace("Map",""),r)});var ee=Z["".concat(X,"Map")],L=Xne(ee),I=m(A,ie(ie({},Z),{},{dataStartIndex:C,dataEndIndex:T,updateId:O,graphicalItems:Y,stackGroups:G,offset:K}));return ie(ie({formattedGraphicalItems:I,graphicalItems:Y,offset:K,stackGroups:G},L),Z)},b=(function(x){function k(S){var A,C,T;return Nne(this,k),T=Ine(this,k,[S]),ze(T,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ze(T,"accessibilityManager",new yne),ze(T,"handleLegendBBoxUpdate",function(O){if(O){var N=T.state,R=N.dataStartIndex,$=N.dataEndIndex,W=N.updateId;T.setState(ie({legendBBox:O},v({props:T.props,dataStartIndex:R,dataEndIndex:$,updateId:W},ie(ie({},T.state),{},{legendBBox:O}))))}}),ze(T,"handleReceiveSyncEvent",function(O,N,R){if(T.props.syncId===O){if(R===T.eventEmitterSymbol&&typeof T.props.syncMethod!="function")return;T.applySyncEvent(N)}}),ze(T,"handleBrushChange",function(O){var N=O.startIndex,R=O.endIndex;if(N!==T.state.dataStartIndex||R!==T.state.dataEndIndex){var $=T.state.updateId;T.setState(function(){return ie({dataStartIndex:N,dataEndIndex:R},v({props:T.props,dataStartIndex:N,dataEndIndex:R,updateId:$},T.state))}),T.triggerSyncEvent({dataStartIndex:N,dataEndIndex:R})}}),ze(T,"handleMouseEnter",function(O){var N=T.getMouseInfo(O);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});T.setState(R),T.triggerSyncEvent(R);var $=T.props.onMouseEnter;Je($)&&$(R,O)}}),ze(T,"triggeredAfterMouseMove",function(O){var N=T.getMouseInfo(O),R=N?ie(ie({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};T.setState(R),T.triggerSyncEvent(R);var $=T.props.onMouseMove;Je($)&&$(R,O)}),ze(T,"handleItemMouseEnter",function(O){T.setState(function(){return{isTooltipActive:!0,activeItem:O,activePayload:O.tooltipPayload,activeCoordinate:O.tooltipPosition||{x:O.cx,y:O.cy}}})}),ze(T,"handleItemMouseLeave",function(){T.setState(function(){return{isTooltipActive:!1}})}),ze(T,"handleMouseMove",function(O){O.persist(),T.throttleTriggeredAfterMouseMove(O)}),ze(T,"handleMouseLeave",function(O){T.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};T.setState(N),T.triggerSyncEvent(N);var R=T.props.onMouseLeave;Je(R)&&R(N,O)}),ze(T,"handleOuterEvent",function(O){var N=iF(O),R=On(T.props,"".concat(N));if(N&&Je(R)){var $,W;/.*touch.*/i.test(N)?W=T.getMouseInfo(O.changedTouches[0]):W=T.getMouseInfo(O),R(($=W)!==null&&$!==void 0?$:{},O)}}),ze(T,"handleClick",function(O){var N=T.getMouseInfo(O);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});T.setState(R),T.triggerSyncEvent(R);var $=T.props.onClick;Je($)&&$(R,O)}}),ze(T,"handleMouseDown",function(O){var N=T.props.onMouseDown;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleMouseUp",function(O){var N=T.props.onMouseUp;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleTouchMove",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.throttleTriggeredAfterMouseMove(O.changedTouches[0])}),ze(T,"handleTouchStart",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.handleMouseDown(O.changedTouches[0])}),ze(T,"handleTouchEnd",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.handleMouseUp(O.changedTouches[0])}),ze(T,"handleDoubleClick",function(O){var N=T.props.onDoubleClick;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleContextMenu",function(O){var N=T.props.onContextMenu;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"triggerSyncEvent",function(O){T.props.syncId!==void 0&&Fb.emit(Hb,T.props.syncId,O,T.eventEmitterSymbol)}),ze(T,"applySyncEvent",function(O){var N=T.props,R=N.layout,$=N.syncMethod,W=T.state.updateId,z=O.dataStartIndex,U=O.dataEndIndex;if(O.dataStartIndex!==void 0||O.dataEndIndex!==void 0)T.setState(ie({dataStartIndex:z,dataEndIndex:U},v({props:T.props,dataStartIndex:z,dataEndIndex:U,updateId:W},T.state)));else if(O.activeTooltipIndex!==void 0){var F=O.chartX,X=O.chartY,Y=O.activeTooltipIndex,G=T.state,Z=G.offset,K=G.tooltipTicks;if(!Z)return;if(typeof $=="function")Y=$(K,O);else if($==="value"){Y=-1;for(var ee=0;ee<K.length;ee++)if(K[ee].value===O.activeLabel){Y=ee;break}}var L=ie(ie({},Z),{},{x:Z.left,y:Z.top}),I=Math.min(F,L.x+L.width),q=Math.min(X,L.y+L.height),Q=K[Y]&&K[Y].value,le=Nw(T.state,T.props.data,Y),fe=K[Y]?{x:R==="horizontal"?K[Y].coordinate:I,y:R==="horizontal"?q:K[Y].coordinate}:$M;T.setState(ie(ie({},O),{},{activeLabel:Q,activeCoordinate:fe,activePayload:le,activeTooltipIndex:Y}))}else T.setState(O)}),ze(T,"renderCursor",function(O){var N,R=T.state,$=R.isTooltipActive,W=R.activeCoordinate,z=R.activePayload,U=R.offset,F=R.activeTooltipIndex,X=R.tooltipAxisBandSize,Y=T.getTooltipEventType(),G=(N=O.props.active)!==null&&N!==void 0?N:$,Z=T.props.layout,K=O.key||"_recharts-cursor";return M.createElement(kne,{key:K,activeCoordinate:W,activePayload:z,activeTooltipIndex:F,chartName:r,element:O,isActive:G,layout:Z,offset:U,tooltipAxisBandSize:X,tooltipEventType:Y})}),ze(T,"renderPolarAxis",function(O,N,R){var $=On(O,"type.axisType"),W=On(T.state,"".concat($,"Map")),z=O.type.defaultProps,U=z!==void 0?ie(ie({},z),O.props):O.props,F=W&&W[U["".concat($,"Id")]];return j.cloneElement(O,ie(ie({},F),{},{className:ot($,F.className),key:O.key||"".concat(N,"-").concat(R),ticks:Ki(F,!0)}))}),ze(T,"renderPolarGrid",function(O){var N=O.props,R=N.radialLines,$=N.polarAngles,W=N.polarRadius,z=T.state,U=z.radiusAxisMap,F=z.angleAxisMap,X=Ra(U),Y=Ra(F),G=Y.cx,Z=Y.cy,K=Y.innerRadius,ee=Y.outerRadius;return j.cloneElement(O,{polarAngles:Array.isArray($)?$:Ki(Y,!0).map(function(L){return L.coordinate}),polarRadius:Array.isArray(W)?W:Ki(X,!0).map(function(L){return L.coordinate}),cx:G,cy:Z,innerRadius:K,outerRadius:ee,key:O.key||"polar-grid",radialLines:R})}),ze(T,"renderLegend",function(){var O=T.state.formattedGraphicalItems,N=T.props,R=N.children,$=N.width,W=N.height,z=T.props.margin||{},U=$-(z.left||0)-(z.right||0),F=j$({children:R,formattedGraphicalItems:O,legendWidth:U,legendContent:d});if(!F)return null;var X=F.item,Y=PN(F,Ene);return j.cloneElement(X,ie(ie({},Y),{},{chartWidth:$,chartHeight:W,margin:z,onBBoxUpdate:T.handleLegendBBoxUpdate}))}),ze(T,"renderTooltip",function(){var O,N=T.props,R=N.children,$=N.accessibilityLayer,W=sn(R,ln);if(!W)return null;var z=T.state,U=z.isTooltipActive,F=z.activeCoordinate,X=z.activePayload,Y=z.activeLabel,G=z.offset,Z=(O=W.props.active)!==null&&O!==void 0?O:U;return j.cloneElement(W,{viewBox:ie(ie({},G),{},{x:G.left,y:G.top}),active:Z,label:Y,payload:Z?X:[],coordinate:F,accessibilityLayer:$})}),ze(T,"renderBrush",function(O){var N=T.props,R=N.margin,$=N.data,W=T.state,z=W.offset,U=W.dataStartIndex,F=W.dataEndIndex,X=W.updateId;return j.cloneElement(O,{key:O.key||"_recharts-brush",onChange:Af(T.handleBrushChange,O.props.onChange),data:$,x:ge(O.props.x)?O.props.x:z.left,y:ge(O.props.y)?O.props.y:z.top+z.height+z.brushBottom-(R.bottom||0),width:ge(O.props.width)?O.props.width:z.width,startIndex:U,endIndex:F,updateId:"brush-".concat(X)})}),ze(T,"renderReferenceElement",function(O,N,R){if(!O)return null;var $=T,W=$.clipPathId,z=T.state,U=z.xAxisMap,F=z.yAxisMap,X=z.offset,Y=O.type.defaultProps||{},G=O.props,Z=G.xAxisId,K=Z===void 0?Y.xAxisId:Z,ee=G.yAxisId,L=ee===void 0?Y.yAxisId:ee;return j.cloneElement(O,{key:O.key||"".concat(N,"-").concat(R),xAxis:U[K],yAxis:F[L],viewBox:{x:X.left,y:X.top,width:X.width,height:X.height},clipPathId:W})}),ze(T,"renderActivePoints",function(O){var N=O.item,R=O.activePoint,$=O.basePoint,W=O.childIndex,z=O.isRange,U=[],F=N.props.key,X=N.item.type.defaultProps!==void 0?ie(ie({},N.item.type.defaultProps),N.item.props):N.item.props,Y=X.activeDot,G=X.dataKey,Z=ie(ie({index:W,dataKey:G,cx:R.x,cy:R.y,r:4,fill:n_(N.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},at(Y,!1)),ah(Y));return U.push(k.renderActiveDot(Y,Z,"".concat(F,"-activePoint-").concat(W))),$?U.push(k.renderActiveDot(Y,ie(ie({},Z),{},{cx:$.x,cy:$.y}),"".concat(F,"-basePoint-").concat(W))):z&&U.push(null),U}),ze(T,"renderGraphicChild",function(O,N,R){var $=T.filterFormatItem(O,N,R);if(!$)return null;var W=T.getTooltipEventType(),z=T.state,U=z.isTooltipActive,F=z.tooltipAxis,X=z.activeTooltipIndex,Y=z.activeLabel,G=T.props.children,Z=sn(G,ln),K=$.props,ee=K.points,L=K.isRange,I=K.baseLine,q=$.item.type.defaultProps!==void 0?ie(ie({},$.item.type.defaultProps),$.item.props):$.item.props,Q=q.activeDot,le=q.hide,fe=q.activeBar,ve=q.activeShape,qe=!!(!le&&U&&Z&&(Q||fe||ve)),xe={};W!=="axis"&&Z&&Z.props.trigger==="click"?xe={onClick:Af(T.handleItemMouseEnter,O.props.onClick)}:W!=="axis"&&(xe={onMouseLeave:Af(T.handleItemMouseLeave,O.props.onMouseLeave),onMouseEnter:Af(T.handleItemMouseEnter,O.props.onMouseEnter)});var ae=j.cloneElement(O,ie(ie({},$.props),xe));function Se(_t){return typeof F.dataKey=="function"?F.dataKey(_t.payload):null}if(qe)if(X>=0){var Me,oe;if(F.dataKey&&!F.allowDuplicatedCategory){var rt=typeof F.dataKey=="function"?Se:"payload.".concat(F.dataKey.toString());Me=ih(ee,rt,Y),oe=L&&I&&ih(I,rt,Y)}else Me=ee==null?void 0:ee[X],oe=L&&I&&I[X];if(ve||fe){var Fe=O.props.activeIndex!==void 0?O.props.activeIndex:X;return[j.cloneElement(O,ie(ie(ie({},$.props),xe),{},{activeIndex:Fe})),null,null]}if(!tt(Me))return[ae].concat(fl(T.renderActivePoints({item:$,activePoint:Me,basePoint:oe,childIndex:X,isRange:L})))}else{var kt,wt=(kt=T.getItemByXY(T.state.activeCoordinate))!==null&&kt!==void 0?kt:{graphicalItem:ae},Et=wt.graphicalItem,_r=Et.item,Ut=_r===void 0?O:_r,Rr=Et.childIndex,cr=ie(ie(ie({},$.props),xe),{},{activeIndex:Rr});return[j.cloneElement(Ut,cr),null,null]}return L?[ae,null,null]:[ae,null]}),ze(T,"renderCustomized",function(O,N,R){return j.cloneElement(O,ie(ie({key:"recharts-customized-".concat(R)},T.props),T.state))}),ze(T,"renderMap",{CartesianGrid:{handler:Nf,once:!0},ReferenceArea:{handler:T.renderReferenceElement},ReferenceLine:{handler:Nf},ReferenceDot:{handler:T.renderReferenceElement},XAxis:{handler:Nf},YAxis:{handler:Nf},Brush:{handler:T.renderBrush,once:!0},Bar:{handler:T.renderGraphicChild},Line:{handler:T.renderGraphicChild},Area:{handler:T.renderGraphicChild},Radar:{handler:T.renderGraphicChild},RadialBar:{handler:T.renderGraphicChild},Scatter:{handler:T.renderGraphicChild},Pie:{handler:T.renderGraphicChild},Funnel:{handler:T.renderGraphicChild},Tooltip:{handler:T.renderCursor,once:!0},PolarGrid:{handler:T.renderPolarGrid,once:!0},PolarAngleAxis:{handler:T.renderPolarAxis},PolarRadiusAxis:{handler:T.renderPolarAxis},Customized:{handler:T.renderCustomized}}),T.clipPathId="".concat((A=S.id)!==null&&A!==void 0?A:Bu("recharts"),"-clip"),T.throttleTriggeredAfterMouseMove=jI(T.triggeredAfterMouseMove,(C=S.throttleDelay)!==null&&C!==void 0?C:1e3/60),T.state={},T}return Dne(k,x),Rne(k,[{key:"componentDidMount",value:function(){var A,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var A=this.props,C=A.children,T=A.data,O=A.height,N=A.layout,R=sn(C,ln);if(R){var $=R.props.defaultIndex;if(!(typeof $!="number"||$<0||$>this.state.tooltipTicks.length-1)){var W=this.state.tooltipTicks[$]&&this.state.tooltipTicks[$].value,z=Nw(this.state,T,$,W),U=this.state.tooltipTicks[$].coordinate,F=(this.state.offset.top+O)/2,X=N==="horizontal",Y=X?{x:U,y:F}:{y:U,x:F},G=this.state.formattedGraphicalItems.find(function(K){var ee=K.item;return ee.type.name==="Scatter"});G&&(Y=ie(ie({},Y),G.props.points[$].tooltipPosition),z=G.props.points[$].tooltipPayload);var Z={activeTooltipIndex:$,isTooltipActive:!0,activeLabel:W,activePayload:z,activeCoordinate:Y};this.setState(Z),this.renderCursor(R),this.accessibilityManager.setIndex($)}}}},{key:"getSnapshotBeforeUpdate",value:function(A,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==A.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==A.margin){var T,O;this.accessibilityManager.setDetails({offset:{left:(T=this.props.margin.left)!==null&&T!==void 0?T:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0}})}return null}},{key:"componentDidUpdate",value:function(A){gx([sn(A.children,ln)],[sn(this.props.children,ln)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var A=sn(this.props.children,ln);if(A&&typeof A.props.shared=="boolean"){var C=A.props.shared?"axis":"item";return c.indexOf(C)>=0?C:a}return a}},{key:"getMouseInfo",value:function(A){if(!this.container)return null;var C=this.container,T=C.getBoundingClientRect(),O=WW(T),N={chartX:Math.round(A.pageX-O.left),chartY:Math.round(A.pageY-O.top)},R=T.width/C.offsetWidth||1,$=this.inRange(N.chartX,N.chartY,R);if(!$)return null;var W=this.state,z=W.xAxisMap,U=W.yAxisMap,F=this.getTooltipEventType(),X=IN(this.state,this.props.data,this.props.layout,$);if(F!=="axis"&&z&&U){var Y=Ra(z).scale,G=Ra(U).scale,Z=Y&&Y.invert?Y.invert(N.chartX):null,K=G&&G.invert?G.invert(N.chartY):null;return ie(ie({},N),{},{xValue:Z,yValue:K},X)}return X?ie(ie({},N),X):null}},{key:"inRange",value:function(A,C){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,O=this.props.layout,N=A/T,R=C/T;if(O==="horizontal"||O==="vertical"){var $=this.state.offset,W=N>=$.left&&N<=$.left+$.width&&R>=$.top&&R<=$.top+$.height;return W?{x:N,y:R}:null}var z=this.state,U=z.angleAxisMap,F=z.radiusAxisMap;if(U&&F){var X=Ra(U);return Jj({x:N,y:R},X)}return null}},{key:"parseEventsOfWrapper",value:function(){var A=this.props.children,C=this.getTooltipEventType(),T=sn(A,ln),O={};T&&C==="axis"&&(T.props.trigger==="click"?O={onClick:this.handleClick}:O={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 N=ah(this.props,this.handleOuterEvent);return ie(ie({},N),O)}},{key:"addListener",value:function(){Fb.on(Hb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Fb.removeListener(Hb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(A,C,T){for(var O=this.state.formattedGraphicalItems,N=0,R=O.length;N<R;N++){var $=O[N];if($.item===A||$.props.key===A.key||C===Gi($.item.type)&&T===$.childIndex)return $}return null}},{key:"renderClipPath",value:function(){var A=this.clipPathId,C=this.state.offset,T=C.left,O=C.top,N=C.height,R=C.width;return M.createElement("defs",null,M.createElement("clipPath",{id:A},M.createElement("rect",{x:T,y:O,height:N,width:R})))}},{key:"getXScales",value:function(){var A=this.state.xAxisMap;return A?Object.entries(A).reduce(function(C,T){var O=NN(T,2),N=O[0],R=O[1];return ie(ie({},C),{},ze({},N,R.scale))},{}):null}},{key:"getYScales",value:function(){var A=this.state.yAxisMap;return A?Object.entries(A).reduce(function(C,T){var O=NN(T,2),N=O[0],R=O[1];return ie(ie({},C),{},ze({},N,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(A){var C;return(C=this.state.xAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getYScaleByAxisId",value:function(A){var C;return(C=this.state.yAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getItemByXY",value:function(A){var C=this.state,T=C.formattedGraphicalItems,O=C.activeItem;if(T&&T.length)for(var N=0,R=T.length;N<R;N++){var $=T[N],W=$.props,z=$.item,U=z.type.defaultProps!==void 0?ie(ie({},z.type.defaultProps),z.props):z.props,F=Gi(z.type);if(F==="Bar"){var X=(W.data||[]).find(function(K){return fQ(A,K)});if(X)return{graphicalItem:$,payload:X}}else if(F==="RadialBar"){var Y=(W.data||[]).find(function(K){return Jj(A,K)});if(Y)return{graphicalItem:$,payload:Y}}else if(Bp($,O)||Up($,O)||Eu($,O)){var G=ree({graphicalItem:$,activeTooltipItem:O,itemData:U.data}),Z=U.activeIndex===void 0?G:U.activeIndex;return{graphicalItem:ie(ie({},$),{},{childIndex:Z}),payload:Eu($,O)?U.data[G]:$.props.data[G]}}}return null}},{key:"render",value:function(){var A=this;if(!lO(this))return null;var C=this.props,T=C.children,O=C.className,N=C.width,R=C.height,$=C.style,W=C.compact,z=C.title,U=C.desc,F=PN(C,Ane),X=at(F,!1);if(W)return M.createElement(fN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},M.createElement(vx,$s({},X,{width:N,height:R,title:z,desc:U}),this.renderClipPath(),uO(T,this.renderMap)));if(this.props.accessibilityLayer){var Y,G;X.tabIndex=(Y=this.props.tabIndex)!==null&&Y!==void 0?Y:0,X.role=(G=this.props.role)!==null&&G!==void 0?G:"application",X.onKeyDown=function(K){A.accessibilityManager.keyboardEvent(K)},X.onFocus=function(){A.accessibilityManager.focus()}}var Z=this.parseEventsOfWrapper();return M.createElement(fN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},M.createElement("div",$s({className:ot("recharts-wrapper",O),style:ie({position:"relative",cursor:"default",width:N,height:R},$)},Z,{ref:function(ee){A.container=ee}}),M.createElement(vx,$s({},X,{width:N,height:R,title:z,desc:U,style:Fne}),this.renderClipPath(),uO(T,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(j.Component);ze(b,"displayName",r),ze(b,"defaultProps",ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ze(b,"getDerivedStateFromProps",function(x,k){var S=x.dataKey,A=x.data,C=x.children,T=x.width,O=x.height,N=x.layout,R=x.stackOffset,$=x.margin,W=k.dataStartIndex,z=k.dataEndIndex;if(k.updateId===void 0){var U=$N(x);return ie(ie(ie({},U),{},{updateId:0},v(ie(ie({props:x},U),{},{updateId:0}),k)),{},{prevDataKey:S,prevData:A,prevWidth:T,prevHeight:O,prevLayout:N,prevStackOffset:R,prevMargin:$,prevChildren:C})}if(S!==k.prevDataKey||A!==k.prevData||T!==k.prevWidth||O!==k.prevHeight||N!==k.prevLayout||R!==k.prevStackOffset||!zs($,k.prevMargin)){var F=$N(x),X={chartX:k.chartX,chartY:k.chartY,isTooltipActive:k.isTooltipActive},Y=ie(ie({},IN(k,A,N)),{},{updateId:k.updateId+1}),G=ie(ie(ie({},F),X),Y);return ie(ie(ie({},G),v(ie({props:x},G),k)),{},{prevDataKey:S,prevData:A,prevWidth:T,prevHeight:O,prevLayout:N,prevStackOffset:R,prevMargin:$,prevChildren:C})}if(!gx(C,k.prevChildren)){var Z,K,ee,L,I=sn(C,rl),q=I&&(Z=(K=I.props)===null||K===void 0?void 0:K.startIndex)!==null&&Z!==void 0?Z:W,Q=I&&(ee=(L=I.props)===null||L===void 0?void 0:L.endIndex)!==null&&ee!==void 0?ee:z,le=q!==W||Q!==z,fe=!tt(A),ve=fe&&!le?k.updateId:k.updateId+1;return ie(ie({updateId:ve},v(ie(ie({props:x},k),{},{updateId:ve,dataStartIndex:q,dataEndIndex:Q}),k)),{},{prevChildren:C,dataStartIndex:q,dataEndIndex:Q})}return null}),ze(b,"renderActiveDot",function(x,k,S){var A;return j.isValidElement(x)?A=j.cloneElement(x,k):Je(x)?A=x(k):A=M.createElement(a_,k),M.createElement(Xt,{className:"recharts-active-dot",key:S},A)});var w=j.forwardRef(function(k,S){return M.createElement(b,$s({},k,{ref:S}))});return w.displayName=b.displayName,w},Qne=DM({chartName:"LineChart",GraphicalChild:Gu,axisComponents:[{axisType:"xAxis",AxisComp:Ua},{axisType:"yAxis",AxisComp:qa}],formatAxisMap:rM}),Pw=DM({chartName:"BarChart",GraphicalChild:ta,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ua},{axisType:"yAxis",AxisComp:qa}],formatAxisMap:rM});const np={backgroundColor:"#1e1e1e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#e4e0dc",fontSize:"11px",fontFamily:"JetBrains Mono, monospace"};function It(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t))}function Zn(t){return`$${t.toFixed(2)}`}function Ma({label:t,value:e,sub:r,accent:n}){return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-5 py-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mb-1",children:t}),y.jsx("p",{className:`text-xl font-mono font-medium ${n?"text-[#E43A9C]":"text-zinc-100"}`,children:e}),r&&y.jsx("p",{className:"text-[10px] font-mono text-zinc-600 mt-0.5",children:r})]})}const eie={summary:"Summary","by squad":"By Squad","by agent":"By Agent",io:"IO",timeline:"Timeline"};function tie({tabs:t,active:e,onChange:r}){return y.jsx("div",{className:"flex gap-0 border-b border-white/[0.06] mb-5",children:t.map(n=>y.jsx("button",{type:"button",onClick:()=>r(n),className:`px-4 py-2 text-[11px] font-mono transition-colors border-b-2 -mb-px cursor-pointer ${e===n?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:eie[n]??n},n))})}function rie({records:t,totals:e}){const r=e.totalInputTokens+e.totalOutputTokens,n=new Map;for(const o of t){const c=o.squadId??"__io__",u=o.squadName??(o.squadId?`${o.squadId.slice(0,8)} (deleted)`:"IO Orchestrator"),d=n.get(c)??{name:u,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=o.inputTokens,d.outputTokens+=o.outputTokens,d.calls+=1,d.cost+=o.estimatedCostUsd??0,n.set(c,d)}const i=Array.from(n.values()).sort((o,c)=>c.cost-o.cost),a=i.map(o=>({name:o.name.length>12?`${o.name.slice(0,12)}…`:o.name,cost:Number.parseFloat(o.cost.toFixed(2)),tokens:Math.round((o.inputTokens+o.outputTokens)/1e3)}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx(Ma,{label:"Total Tokens",value:It(r),sub:`${It(e.totalInputTokens)} in · ${It(e.totalOutputTokens)} out`}),y.jsx(Ma,{label:"Total Cost",value:Zn(e.totalCostUsd),accent:!0}),y.jsx(Ma,{label:"API Calls",value:It(e.callCount),sub:"across all entities"}),y.jsx(Ma,{label:"Avg Cost / Call",value:e.callCount>0?Zn(e.totalCostUsd/e.callCount):"$0.00",sub:`over ${e.callCount} calls`})]}),y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost by entity"}),a.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Pw,{data:a,barCategoryGap:"35%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`$${o}`,width:40}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`$${o.toFixed(2)}`,"Cost"]}),y.jsx(ta,{dataKey:"cost",fill:"url(#costGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens by entity (k)"}),a.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Pw,{data:a,barCategoryGap:"35%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`${o}k`,width:40}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`${o}k`,"Tokens"]}),y.jsx(ta,{dataKey:"tokens",fill:"url(#tokenGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#818cf8"}),y.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Entity","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsxs("tbody",{children:[i.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name)),y.jsxs("tr",{className:"bg-[#1a1a1a]",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-200 font-medium",children:"Total"}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalInputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalOutputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:e.callCount}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C] font-medium",children:Zn(e.totalCostUsd)})]})]})]})})]})}function nie({records:t}){const[e,r]=j.useState([]),[n,i]=j.useState("cost"),[a,o]=j.useState("desc");function c(f){f===n?o(m=>m==="asc"?"desc":"asc"):(i(f),o("desc"))}const u=j.useMemo(()=>{const f=new Map;for(const v of t){if(!v.squadId)continue;const b=f.get(v.squadId)??{id:v.squadId,name:v.squadName??`${v.squadId.slice(0,8)} (deleted)`,agents:new Map,inputTokens:0,outputTokens:0,calls:0,cost:0};b.inputTokens+=v.inputTokens,b.outputTokens+=v.outputTokens,b.calls+=1,b.cost+=v.estimatedCostUsd??0;const w=`${v.agentRole??"unknown"}:${v.model}`,x=b.agents.get(w)??{role:v.agentRole??"unknown",model:v.model,inputTokens:0,outputTokens:0,calls:0,cost:0};x.inputTokens+=v.inputTokens,x.outputTokens+=v.outputTokens,x.calls+=1,x.cost+=v.estimatedCostUsd??0,b.agents.set(w,x),f.set(v.squadId,b)}return[...Array.from(f.values())].sort((v,b)=>{const w=v[n],x=b[n],k=typeof w=="string"?w.localeCompare(x):w-x;return a==="desc"?-k:k})},[t,n,a]),d=f=>r(m=>m.includes(f)?m.filter(v=>v!==f):[...m,f]),p=[{key:"name",label:"Squad"},{key:"inputTokens",label:"In"},{key:"outputTokens",label:"Out"},{key:"calls",label:"Calls"},{key:"cost",label:"Cost"}];return u.length===0?y.jsx("div",{className:"text-center py-12 text-zinc-700 text-[11px] font-mono",children:"No squad usage data"}):y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-1 px-1 mb-1",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 mr-1",children:"sort by"}),p.map(f=>y.jsxs("button",{type:"button",onClick:()=>c(f.key),className:`flex items-center gap-0.5 px-2 py-1 rounded-lg text-[10px] font-mono transition-colors ${n===f.key?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400 hover:bg-white/[0.04]"}`,style:n===f.key?{background:"rgba(228,58,156,0.1)"}:void 0,children:[f.label,n===f.key&&y.jsx("span",{className:"text-[9px]",children:a==="desc"?"↓":"↑"})]},f.key))]}),u.map(f=>{const m=e.includes(f.id),v=Array.from(f.agents.values());return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl overflow-hidden",children:[y.jsxs("button",{type:"button",onClick:()=>d(f.id),className:"w-full flex items-center gap-3 px-4 py-3.5 hover:bg-white/[0.02] transition-colors text-left cursor-pointer",children:[y.jsx("div",{className:`transition-transform ${m?"rotate-90":""}`,children:y.jsx(Qw,{className:"w-3.5 h-3.5 text-zinc-600"})}),y.jsx("span",{className:"text-sm font-mono text-zinc-100 flex-1",children:f.name}),y.jsxs("div",{className:"flex items-center gap-6 text-[11px] font-mono",children:[y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"in"}),It(f.inputTokens)]}),y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"out"}),It(f.outputTokens)]}),y.jsxs("span",{className:"text-zinc-500",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"calls"}),f.calls]}),y.jsx("span",{className:"text-[#E43A9C] font-medium w-16 text-right",children:Zn(f.cost)})]})]}),m&&y.jsx("div",{className:"border-t border-white/[0.05]",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"bg-[#191919]",children:["Agent","Model","Input","Output","Calls","Cost"].map(b=>y.jsx("th",{className:`text-left px-4 py-2 text-zinc-700 font-medium ${b==="Cost"?"text-right":""}`,children:b},b))})}),y.jsx("tbody",{children:v.map(b=>y.jsxs("tr",{className:"border-t border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-2.5 text-zinc-300",children:b.role}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-600",children:b.model}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(b.inputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(b.outputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:b.calls}),y.jsx("td",{className:"px-4 py-2.5 text-right text-[#E43A9C]",children:Zn(b.cost)})]},b.role))})]})})]},f.id)})]})}function iie({records:t}){const e=j.useMemo(()=>{const n=new Map;for(const i of t){const a=`${i.squadId??"io"}:${i.agentRole??"orchestrator"}:${i.model}`,o=n.get(a)??{name:i.agentRole??"orchestrator",squad:i.squadName??(i.squadId?i.squadId.slice(0,8):"IO"),model:i.model,inputTokens:0,outputTokens:0,calls:0,cost:0};o.inputTokens+=i.inputTokens,o.outputTokens+=i.outputTokens,o.calls+=1,o.cost+=i.estimatedCostUsd??0,n.set(a,o)}return Array.from(n.values()).sort((i,a)=>a.cost-i.cost)},[t]),r=e.reduce((n,i)=>n+i.cost,0);return y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Agent","Squad","Model","Input","Output","Calls","Cost","% of total"].map(n=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${n==="Cost"?"text-right":""}`,children:n},n))})}),y.jsx("tbody",{children:e.map(n=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:n.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.squad}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:n.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(n.cost)}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-16 h-1.5 rounded-full bg-[#252525] overflow-hidden",children:y.jsx("div",{className:"h-full bg-[#E43A9C] rounded-full",style:{width:`${r>0?n.cost/r*100:0}%`}})}),y.jsx("span",{className:"text-zinc-600 text-[10px]",children:r>0?`${(n.cost/r*100).toFixed(1)}%`:"0%"})]})})]},`${n.squad}:${n.name}`))})]})})}function aie({records:t}){const e=j.useMemo(()=>t.filter(o=>!o.squadId),[t]),r=j.useMemo(()=>{const o=new Map;for(const c of e){const u=`${c.agentRole??"orchestrator"}:${c.model}`,d=o.get(u)??{name:c.agentRole??"orchestrator",model:c.model,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=c.inputTokens,d.outputTokens+=c.outputTokens,d.calls+=1,d.cost+=c.estimatedCostUsd??0,o.set(u,d)}return Array.from(o.values()).sort((c,u)=>u.cost-c.cost)},[e]),n=e.reduce((o,c)=>o+c.inputTokens,0),i=e.reduce((o,c)=>o+c.outputTokens,0),a=e.reduce((o,c)=>o+(c.estimatedCostUsd??0),0);return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx(Ma,{label:"IO Tokens",value:It(n+i),sub:`${It(n)} in · ${It(i)} out`}),y.jsx(Ma,{label:"IO Cost",value:Zn(a),accent:!0}),y.jsx(Ma,{label:"IO Calls",value:It(e.length)}),y.jsx(Ma,{label:"IO Roles",value:String(r.length)})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Role","Model","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsx("tbody",{children:r.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:o.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name))})]})})]})}function oie({records:t}){const e=Fa(),r=j.useMemo(()=>{const i=new Map;for(const a of t){const o=a.timestamp.slice(0,10),c=i.get(o)??{date:o,inputTokens:0,outputTokens:0,cost:0,calls:0};c.inputTokens+=a.inputTokens,c.outputTokens+=a.outputTokens,c.cost+=a.estimatedCostUsd??0,c.calls+=1,i.set(o,c)}return Array.from(i.values()).sort((a,o)=>a.date.localeCompare(o.date))},[t]),n=r.map(i=>({...i,label:ez(i.date,e),tokens:i.inputTokens+i.outputTokens}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens per day"}),n.length>0?y.jsx(gh,{width:"100%",height:220,children:y.jsxs(Qne,{data:n,children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:It,width:44}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[It(i),"Tokens"]}),y.jsx(Gu,{type:"monotone",dataKey:"tokens",stroke:"#E43A9C",strokeWidth:2,dot:!1})]})}):y.jsx("div",{className:"h-[220px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost per day"}),n.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Pw,{data:n,barCategoryGap:"20%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:i=>`$${i.toFixed(2)}`,width:44}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[Zn(i),"Cost"]}),y.jsx(ta,{dataKey:"cost",fill:"url(#costGradTl)",radius:[4,4,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGradTl",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Date","Input","Output","Calls","Cost"].map(i=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${i==="Cost"?"text-right":""}`,children:i},i))})}),y.jsx("tbody",{children:r.map(i=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:i.date}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:i.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(i.cost)})]},i.date))})]})})]})}function sie(){const[t,e]=j.useState("summary"),[r,n]=j.useState(null),[i,a]=j.useState("14d"),o=["summary","by squad","by agent","io","timeline"];if(j.useEffect(()=>{const u=new Date;i==="7d"?u.setDate(u.getDate()-7):i==="14d"?u.setDate(u.getDate()-14):i==="30d"?u.setDate(u.getDate()-30):u.setDate(u.getDate()-1),Ge.get(`/usage?since=${u.toISOString()}`).then(n).catch(()=>{})},[i]),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600 font-mono text-[11px]",children:"Loading..."});const c=i==="1d"?"Today":`Last ${i}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsxs("div",{className:"flex items-start justify-between mb-5 gap-4 flex-wrap",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Usage"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:c})]}),y.jsx("div",{className:"flex gap-1 p-1 rounded-xl bg-white/[0.03] border border-white/[0.07]",children:["1d","7d","14d","30d"].map(u=>y.jsx("button",{type:"button",onClick:()=>a(u),className:`px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors cursor-pointer ${i===u?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400"}`,style:i===u?{background:"rgba(228,58,156,0.12)"}:void 0,children:u},u))})]}),y.jsx(tie,{tabs:o,active:t,onChange:u=>e(u)}),t==="summary"&&y.jsx(rie,{records:r.records,totals:r.totals}),t==="by squad"&&y.jsx(nie,{records:r.records}),t==="by agent"&&y.jsx(iie,{records:r.records}),t==="io"&&y.jsx(aie,{records:r.records}),t==="timeline"&&y.jsx(oie,{records:r.records})]})}function LM(t){return[...t].sort((e,r)=>e.isDir!==r.isDir?e.isDir?-1:1:e.name.localeCompare(r.name)).map(e=>({...e,children:LM(e.children)}))}function lie(t){const e=[];for(const r of t){const n=r.path.split("/").filter(Boolean);let i=e,a="";if(r.isDir){for(const o of n){a=a?`${a}/${o}`:o;let c=i.find(u=>u.path===a);c||(c={name:o,path:a,isDir:!0,children:[]},i.push(c)),i=c.children}continue}for(const[o,c]of n.entries()){const u=o===n.length-1;a=a?`${a}/${c}`:c;let d=i.find(p=>p.path===a);d||(d={name:u&&r.name||c,path:a,isDir:!u,children:[]},i.push(d)),i=d.children}}return LM(e)}function zM(t,e){return e?t.flatMap(r=>{const n=r.name.toLowerCase().includes(e)||r.path.toLowerCase().includes(e);if(!r.isDir)return n?[r]:[];if(n)return[r];const i=zM(r.children,e);return i.length?[{...r,children:i}]:[]}):t}function Rw(t){const e=new Set;for(const r of t)if(r.isDir){e.add(r.path);for(const n of Rw(r.children))e.add(n)}return e}function cie(t){const e=t.split("/").filter(Boolean),r=[];let n="";for(const i of e.slice(0,-1))n=n?`${n}/${i}`:i,r.push(n);return r}function BM({node:t,depth:e,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u}){const d=r===t.path,p=t.isDir&&(n.has(t.path)||i.has(t.path)),f=12+e*16,m=t.isDir&&["io","shared","squads","templates"].includes(t.path);return t.isDir?y.jsxs("div",{children:[y.jsxs("div",{className:"flex w-full items-center group rounded-lg py-2 pr-3 text-left text-[11px] font-mono text-zinc-400 transition-colors hover:bg-white/[0.04] hover:text-zinc-200",style:{paddingLeft:f},children:[y.jsxs("button",{type:"button",onClick:()=>a(t.path),className:"flex items-center gap-2 flex-1 min-w-0",children:[y.jsx(Qw,{size:14,className:`shrink-0 transition-transform ${p?"rotate-90":""}`}),p?y.jsx(zz,{size:14,className:"shrink-0 text-zinc-500"}):y.jsx(Uz,{size:14,className:"shrink-0 text-zinc-500"}),y.jsx("span",{className:"truncate",children:t.name})]}),y.jsxs("div",{className:"flex items-center gap-0.5",children:[!m&&y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),u(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-red-500/20 transition-opacity text-zinc-600 hover:text-red-400",title:`Delete ${t.name}`,children:y.jsx(Da,{size:12})}),y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),c(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-white/[0.08] transition-opacity text-zinc-600 hover:text-zinc-300",title:`Add page to ${t.name}`,children:y.jsx(i1,{size:12})})]})]}),p&&y.jsx("div",{children:t.children.map(v=>y.jsx(BM,{node:v,depth:e+1,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u},v.path))})]}):y.jsxs("button",{type:"button",onClick:()=>o(t.path),className:`flex w-full items-center gap-2 rounded-lg py-2 pr-3 text-left text-[11px] font-mono transition-colors ${d?"border-l-2 border-[#E43A9C] bg-[#E43A9C]/10 text-[#E43A9C]":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-300"}`,style:{paddingLeft:f},children:[y.jsx(Dz,{size:14,className:"shrink-0"}),y.jsx("span",{className:"truncate",children:t.name})]})}function uie(){const[t,e]=j.useState([]),[r,n]=j.useState(null),[i,a]=j.useState(""),[o,c]=j.useState(!1),[u,d]=j.useState(""),[p,f]=j.useState(""),[m,v]=j.useState(""),[b,w]=j.useState(new Set),[x,k]=j.useState(!1),[S,A]=j.useState(null),C=j.useRef(null),T=j.useCallback(async()=>{try{const L=await Ge.get("/wiki/pages");e(L.map(I=>({name:I.title||I.path.split("/").pop()||I.path,path:I.path,title:I.title,isDir:I.isDir})))}catch{e([])}},[]);j.useEffect(()=>{T()},[T]);const O=j.useMemo(()=>lie(t),[t]),N=m.trim().toLowerCase(),R=j.useMemo(()=>zM(O,N),[O,N]),$=j.useMemo(()=>{const L=N?Rw(R):new Set;if(r)for(const I of cie(r))L.add(I);return L},[R,N,r]),W=r?(function L(I){for(const q of I){if(q.path===r)return q;const Q=L(q.children);if(Q)return Q}return null})(R):null,z=(W==null?void 0:W.name)??(r?r.split("/").pop()??"":"");j.useEffect(()=>{const L=Rw(O);w(I=>new Set([...I,...L]))},[O]);async function U(L){try{const I=await Ge.get(`/wiki/pages/${L}`);a(I.content),d(I.content),n(I.path||L),c(!1)}catch{Qe.error("Failed to load page")}}o1({onEvent:L=>{(L.type==="connected"||L.type===Fc.WIKI_UPDATED)&&T()}});async function F(){if(r)try{await Ge.put(`/wiki/pages/${r}`,{content:u}),a(u),c(!1),Qe.success("Page saved")}catch{Qe.error("Failed to save page")}}async function X(){if(r)try{await Ge.delete(`/wiki/pages/${r}`),Qe.success("Page deleted"),n(null),a(""),d(""),c(!1),await T()}catch{Qe.error("Failed to delete page")}}function Y(L){f(`${L}/`),setTimeout(()=>{const I=C.current;I&&(I.focus(),I.setSelectionRange(I.value.length,I.value.length))},0)}function G(L){A(L)}async function Z(){if(S)try{const L=t.filter(I=>!I.isDir&&I.path.startsWith(`${S}/`));await Promise.all(L.map(I=>Ge.delete(`/wiki/pages/${I.path}`))),Qe.success(`Deleted ${S}`),(r!=null&&r.startsWith(`${S}/`)||r===S)&&(n(null),a(""),d(""),c(!1)),await T()}catch{Qe.error("Failed to delete directory")}finally{A(null)}}async function K(){let L=p.trim().replace(/^\/+|\/+$/g,"");if(!L)return;L=L.replace(/\.md$/i,"");const I=L.startsWith("io/")||L.startsWith("shared/")||L.startsWith("squads/")?L:`shared/${L}`,q=I.split("/").pop()??I;k(!0);try{await Ge.post("/wiki/pages",{path:I,title:q,content:`# ${q}
517
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RM(t,e){if(t){if(typeof t=="string")return jw(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jw(t,e)}}function zne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Bne(t){if(Array.isArray(t))return jw(t)}function jw(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function RN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?RN(Object(r),!0).forEach(function(n){ze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):RN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ze(t,e,r){return e=IM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function IM(t){var e=Une(t,"string");return dl(e)=="symbol"?e:e+""}function Une(t,e){if(dl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(dl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qne={xAxis:["bottom","top"],yAxis:["left","right"]},Fne={width:"100%",height:"100%"},$M={x:0,y:0};function Nf(t){return t}var Hne=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},Wne=function(e,r,n,i){var a=r.find(function(p){return p&&p.index===n});if(a){if(e==="horizontal")return{x:a.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,c=i.radius;return ie(ie(ie({},i),wr(i.cx,i.cy,c,o)),{},{angle:o,radius:c})}var u=a.coordinate,d=i.angle;return ie(ie(ie({},i),wr(i.cx,i.cy,u,d)),{},{angle:d,radius:u})}return $M},Gp=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(c,u){var d=u.props.data;return d&&d.length?[].concat(fl(c),fl(d)):c},[]);return o.length>0?o:e&&e.length&&ge(i)&&ge(a)?e.slice(i,a+1):[]};function MM(t){return t==="number"?[0,"auto"]:void 0}var Nw=function(e,r,n,i){var a=e.graphicalItems,o=e.tooltipAxis,c=Gp(r,e);return n<0||!a||!a.length||n>=c.length?null:a.reduce(function(u,d){var p,f=(p=d.props.data)!==null&&p!==void 0?p:r;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var m;if(o.dataKey&&!o.allowDuplicatedCategory){var v=f===void 0?c:f;m=ih(v,o.dataKey,i)}else m=f&&f[n]||c[n];return m?[].concat(fl(u),[M$(d,m)]):u},[])},IN=function(e,r,n,i){var a=i||{x:e.chartX,y:e.chartY},o=Hne(a,n),c=e.orderedTooltipTicks,u=e.tooltipAxis,d=e.tooltipTicks,p=tY(o,c,d,u);if(p>=0&&d){var f=d[p]&&d[p].value,m=Nw(e,r,p,f),v=Wne(n,c,p,a);return{activeTooltipIndex:p,activeLabel:f,activePayload:m,activeCoordinate:v}}return null},Kne=function(e,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,m=e.stackOffset,v=R$(p,a);return n.reduce(function(b,w){var x,k=w.type.defaultProps!==void 0?ie(ie({},w.type.defaultProps),w.props):w.props,S=k.type,A=k.dataKey,C=k.allowDataOverflow,T=k.allowDuplicatedCategory,O=k.scale,N=k.ticks,R=k.includeHidden,$=k[o];if(b[$])return b;var W=Gp(e.data,{graphicalItems:i.filter(function(q){var Q,le=o in q.props?q.props[o]:(Q=q.type.defaultProps)===null||Q===void 0?void 0:Q[o];return le===$}),dataStartIndex:u,dataEndIndex:d}),z=W.length,U,F,X;vne(k.domain,C,S)&&(U=Vx(k.domain,null,C),v&&(S==="number"||O!=="auto")&&(X=Lc(W,A,"category")));var Y=MM(S);if(!U||U.length===0){var G,Z=(G=k.domain)!==null&&G!==void 0?G:Y;if(A){if(U=Lc(W,A,S),S==="category"&&v){var K=K9(U);T&&K?(F=U,U=Fh(0,z)):T||(U=Vj(Z,U,w).reduce(function(q,Q){return q.indexOf(Q)>=0?q:[].concat(fl(q),[Q])},[]))}else if(S==="category")T?U=U.filter(function(q){return q!==""&&!tt(q)}):U=Vj(Z,U,w).reduce(function(q,Q){return q.indexOf(Q)>=0||Q===""||tt(Q)?q:[].concat(fl(q),[Q])},[]);else if(S==="number"){var ee=oY(W,i.filter(function(q){var Q,le,fe=o in q.props?q.props[o]:(Q=q.type.defaultProps)===null||Q===void 0?void 0:Q[o],ve="hide"in q.props?q.props.hide:(le=q.type.defaultProps)===null||le===void 0?void 0:le.hide;return fe===$&&(R||!ve)}),A,a,p);ee&&(U=ee)}v&&(S==="number"||O!=="auto")&&(X=Lc(W,A,"category"))}else v?U=Fh(0,z):c&&c[$]&&c[$].hasStack&&S==="number"?U=m==="expand"?[0,1]:$$(c[$].stackGroups,u,d):U=P$(W,i.filter(function(q){var Q=o in q.props?q.props[o]:q.type.defaultProps[o],le="hide"in q.props?q.props.hide:q.type.defaultProps.hide;return Q===$&&(R||!le)}),S,p,!0);if(S==="number")U=Tw(f,U,$,a,N),Z&&(U=Vx(Z,U,C));else if(S==="category"&&Z){var L=Z,I=U.every(function(q){return L.indexOf(q)>=0});I&&(U=L)}}return ie(ie({},b),{},ze({},$,ie(ie({},k),{},{axisType:a,domain:U,categoricalDomain:X,duplicateDomain:F,originalDomain:(x=k.domain)!==null&&x!==void 0?x:Y,isCategorical:v,layout:p})))},{})},Gne=function(e,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,m=Gp(e.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:d}),v=m.length,b=R$(p,a),w=-1;return n.reduce(function(x,k){var S=k.type.defaultProps!==void 0?ie(ie({},k.type.defaultProps),k.props):k.props,A=S[o],C=MM("number");if(!x[A]){w++;var T;return b?T=Fh(0,v):c&&c[A]&&c[A].hasStack?(T=$$(c[A].stackGroups,u,d),T=Tw(f,T,A,a)):(T=Vx(C,P$(m,n.filter(function(O){var N,R,$=o in O.props?O.props[o]:(N=O.type.defaultProps)===null||N===void 0?void 0:N[o],W="hide"in O.props?O.props.hide:(R=O.type.defaultProps)===null||R===void 0?void 0:R.hide;return $===A&&!W}),"number",p),i.defaultProps.allowDataOverflow),T=Tw(f,T,A,a)),ie(ie({},x),{},ze({},A,ie(ie({axisType:a},i.defaultProps),{},{hide:!0,orientation:On(qne,"".concat(a,".").concat(w%2),null),domain:T,originalDomain:C,isCategorical:b,layout:p})))}return x},{})},Vne=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.children,f="".concat(i,"Id"),m=Tn(p,a),v={};return m&&m.length?v=Kne(e,{axes:m,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d}):o&&o.length&&(v=Gne(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d})),v},Xne=function(e){var r=Ra(e),n=Ki(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:N1(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Rh(r,n)}},$N=function(e){var r=e.children,n=e.defaultShowTooltip,i=sn(r,rl),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},Yne=function(e){return!e||!e.length?!1:e.some(function(r){var n=Gi(r&&r.type);return n&&n.indexOf("Bar")>=0})},MN=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Jne=function(e,r){var n=e.props,i=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,c=e.yAxisMap,u=c===void 0?{}:c,d=n.width,p=n.height,f=n.children,m=n.margin||{},v=sn(f,rl),b=sn(f,Bs),w=Object.keys(u).reduce(function(T,O){var N=u[O],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},T),{},ze({},R,T[R]+N.width)):T},{left:m.left||0,right:m.right||0}),x=Object.keys(o).reduce(function(T,O){var N=o[O],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},T),{},ze({},R,On(T,"".concat(R))+N.height)):T},{top:m.top||0,bottom:m.bottom||0}),k=ie(ie({},x),w),S=k.bottom;v&&(k.bottom+=v.props.height||rl.defaultProps.height),b&&r&&(k=iY(k,i,n,r));var A=d-k.left-k.right,C=p-k.top-k.bottom;return ie(ie({brushBottom:S},k),{},{width:Math.max(A,0),height:Math.max(C,0)})},Zne=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},DM=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,o=e.validateTooltipEventTypes,c=o===void 0?["axis"]:o,u=e.axisComponents,d=e.legendContent,p=e.formatAxisMap,f=e.defaultProps,m=function(k,S){var A=S.graphicalItems,C=S.stackGroups,T=S.offset,O=S.updateId,N=S.dataStartIndex,R=S.dataEndIndex,$=k.barSize,W=k.layout,z=k.barGap,U=k.barCategoryGap,F=k.maxBarSize,X=MN(W),Y=X.numericAxisName,G=X.cateAxisName,Z=Yne(A),K=[];return A.forEach(function(ee,L){var I=Gp(k.data,{graphicalItems:[ee],dataStartIndex:N,dataEndIndex:R}),q=ee.type.defaultProps!==void 0?ie(ie({},ee.type.defaultProps),ee.props):ee.props,Q=q.dataKey,le=q.maxBarSize,fe=q["".concat(Y,"Id")],ve=q["".concat(G,"Id")],qe={},xe=u.reduce(function(cr,_t){var Sr=S["".concat(_t.axisType,"Map")],Ir=q["".concat(_t.axisType,"Id")];Sr&&Sr[Ir]||_t.axisType==="zAxis"||Mo();var ni=Sr[Ir];return ie(ie({},cr),{},ze(ze({},_t.axisType,ni),"".concat(_t.axisType,"Ticks"),Ki(ni)))},qe),ae=xe[G],Se=xe["".concat(G,"Ticks")],Me=C&&C[fe]&&C[fe].hasStack&&vY(ee,C[fe].stackGroups),oe=Gi(ee.type).indexOf("Bar")>=0,rt=Rh(ae,Se),Fe=[],kt=Z&&rY({barSize:$,stackGroups:C,totalSize:Zne(xe,G)});if(oe){var wt,Et,_r=tt(le)?F:le,Ut=(wt=(Et=Rh(ae,Se,!0))!==null&&Et!==void 0?Et:_r)!==null&&wt!==void 0?wt:0;Fe=nY({barGap:z,barCategoryGap:U,bandSize:Ut!==rt?Ut:rt,sizeList:kt[ve],maxBarSize:_r}),Ut!==rt&&(Fe=Fe.map(function(cr){return ie(ie({},cr),{},{position:ie(ie({},cr.position),{},{offset:cr.position.offset-Ut/2})})}))}var Rr=ee&&ee.type&&ee.type.getComposedData;Rr&&K.push({props:ie(ie({},Rr(ie(ie({},xe),{},{displayedData:I,props:k,dataKey:Q,item:ee,bandSize:rt,barPosition:Fe,offset:T,stackedData:Me,layout:W,dataStartIndex:N,dataEndIndex:R}))),{},ze(ze(ze({key:ee.key||"item-".concat(L)},Y,xe[Y]),G,xe[G]),"animationId",O)),childIndex:aF(ee,k.children),item:ee})}),K},v=function(k,S){var A=k.props,C=k.dataStartIndex,T=k.dataEndIndex,O=k.updateId;if(!lO({props:A}))return null;var N=A.children,R=A.layout,$=A.stackOffset,W=A.data,z=A.reverseStackOrder,U=MN(R),F=U.numericAxisName,X=U.cateAxisName,Y=Tn(N,n),G=mY(W,Y,"".concat(F,"Id"),"".concat(X,"Id"),$,z),Z=u.reduce(function(q,Q){var le="".concat(Q.axisType,"Map");return ie(ie({},q),{},ze({},le,Vne(A,ie(ie({},Q),{},{graphicalItems:Y,stackGroups:Q.axisType===F&&G,dataStartIndex:C,dataEndIndex:T}))))},{}),K=Jne(ie(ie({},Z),{},{props:A,graphicalItems:Y}),S==null?void 0:S.legendBBox);Object.keys(Z).forEach(function(q){Z[q]=p(A,Z[q],K,q.replace("Map",""),r)});var ee=Z["".concat(X,"Map")],L=Xne(ee),I=m(A,ie(ie({},Z),{},{dataStartIndex:C,dataEndIndex:T,updateId:O,graphicalItems:Y,stackGroups:G,offset:K}));return ie(ie({formattedGraphicalItems:I,graphicalItems:Y,offset:K,stackGroups:G},L),Z)},b=(function(x){function k(S){var A,C,T;return Nne(this,k),T=Ine(this,k,[S]),ze(T,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ze(T,"accessibilityManager",new yne),ze(T,"handleLegendBBoxUpdate",function(O){if(O){var N=T.state,R=N.dataStartIndex,$=N.dataEndIndex,W=N.updateId;T.setState(ie({legendBBox:O},v({props:T.props,dataStartIndex:R,dataEndIndex:$,updateId:W},ie(ie({},T.state),{},{legendBBox:O}))))}}),ze(T,"handleReceiveSyncEvent",function(O,N,R){if(T.props.syncId===O){if(R===T.eventEmitterSymbol&&typeof T.props.syncMethod!="function")return;T.applySyncEvent(N)}}),ze(T,"handleBrushChange",function(O){var N=O.startIndex,R=O.endIndex;if(N!==T.state.dataStartIndex||R!==T.state.dataEndIndex){var $=T.state.updateId;T.setState(function(){return ie({dataStartIndex:N,dataEndIndex:R},v({props:T.props,dataStartIndex:N,dataEndIndex:R,updateId:$},T.state))}),T.triggerSyncEvent({dataStartIndex:N,dataEndIndex:R})}}),ze(T,"handleMouseEnter",function(O){var N=T.getMouseInfo(O);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});T.setState(R),T.triggerSyncEvent(R);var $=T.props.onMouseEnter;Je($)&&$(R,O)}}),ze(T,"triggeredAfterMouseMove",function(O){var N=T.getMouseInfo(O),R=N?ie(ie({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};T.setState(R),T.triggerSyncEvent(R);var $=T.props.onMouseMove;Je($)&&$(R,O)}),ze(T,"handleItemMouseEnter",function(O){T.setState(function(){return{isTooltipActive:!0,activeItem:O,activePayload:O.tooltipPayload,activeCoordinate:O.tooltipPosition||{x:O.cx,y:O.cy}}})}),ze(T,"handleItemMouseLeave",function(){T.setState(function(){return{isTooltipActive:!1}})}),ze(T,"handleMouseMove",function(O){O.persist(),T.throttleTriggeredAfterMouseMove(O)}),ze(T,"handleMouseLeave",function(O){T.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};T.setState(N),T.triggerSyncEvent(N);var R=T.props.onMouseLeave;Je(R)&&R(N,O)}),ze(T,"handleOuterEvent",function(O){var N=iF(O),R=On(T.props,"".concat(N));if(N&&Je(R)){var $,W;/.*touch.*/i.test(N)?W=T.getMouseInfo(O.changedTouches[0]):W=T.getMouseInfo(O),R(($=W)!==null&&$!==void 0?$:{},O)}}),ze(T,"handleClick",function(O){var N=T.getMouseInfo(O);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});T.setState(R),T.triggerSyncEvent(R);var $=T.props.onClick;Je($)&&$(R,O)}}),ze(T,"handleMouseDown",function(O){var N=T.props.onMouseDown;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleMouseUp",function(O){var N=T.props.onMouseUp;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleTouchMove",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.throttleTriggeredAfterMouseMove(O.changedTouches[0])}),ze(T,"handleTouchStart",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.handleMouseDown(O.changedTouches[0])}),ze(T,"handleTouchEnd",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.handleMouseUp(O.changedTouches[0])}),ze(T,"handleDoubleClick",function(O){var N=T.props.onDoubleClick;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"handleContextMenu",function(O){var N=T.props.onContextMenu;if(Je(N)){var R=T.getMouseInfo(O);N(R,O)}}),ze(T,"triggerSyncEvent",function(O){T.props.syncId!==void 0&&Fb.emit(Hb,T.props.syncId,O,T.eventEmitterSymbol)}),ze(T,"applySyncEvent",function(O){var N=T.props,R=N.layout,$=N.syncMethod,W=T.state.updateId,z=O.dataStartIndex,U=O.dataEndIndex;if(O.dataStartIndex!==void 0||O.dataEndIndex!==void 0)T.setState(ie({dataStartIndex:z,dataEndIndex:U},v({props:T.props,dataStartIndex:z,dataEndIndex:U,updateId:W},T.state)));else if(O.activeTooltipIndex!==void 0){var F=O.chartX,X=O.chartY,Y=O.activeTooltipIndex,G=T.state,Z=G.offset,K=G.tooltipTicks;if(!Z)return;if(typeof $=="function")Y=$(K,O);else if($==="value"){Y=-1;for(var ee=0;ee<K.length;ee++)if(K[ee].value===O.activeLabel){Y=ee;break}}var L=ie(ie({},Z),{},{x:Z.left,y:Z.top}),I=Math.min(F,L.x+L.width),q=Math.min(X,L.y+L.height),Q=K[Y]&&K[Y].value,le=Nw(T.state,T.props.data,Y),fe=K[Y]?{x:R==="horizontal"?K[Y].coordinate:I,y:R==="horizontal"?q:K[Y].coordinate}:$M;T.setState(ie(ie({},O),{},{activeLabel:Q,activeCoordinate:fe,activePayload:le,activeTooltipIndex:Y}))}else T.setState(O)}),ze(T,"renderCursor",function(O){var N,R=T.state,$=R.isTooltipActive,W=R.activeCoordinate,z=R.activePayload,U=R.offset,F=R.activeTooltipIndex,X=R.tooltipAxisBandSize,Y=T.getTooltipEventType(),G=(N=O.props.active)!==null&&N!==void 0?N:$,Z=T.props.layout,K=O.key||"_recharts-cursor";return M.createElement(kne,{key:K,activeCoordinate:W,activePayload:z,activeTooltipIndex:F,chartName:r,element:O,isActive:G,layout:Z,offset:U,tooltipAxisBandSize:X,tooltipEventType:Y})}),ze(T,"renderPolarAxis",function(O,N,R){var $=On(O,"type.axisType"),W=On(T.state,"".concat($,"Map")),z=O.type.defaultProps,U=z!==void 0?ie(ie({},z),O.props):O.props,F=W&&W[U["".concat($,"Id")]];return j.cloneElement(O,ie(ie({},F),{},{className:ot($,F.className),key:O.key||"".concat(N,"-").concat(R),ticks:Ki(F,!0)}))}),ze(T,"renderPolarGrid",function(O){var N=O.props,R=N.radialLines,$=N.polarAngles,W=N.polarRadius,z=T.state,U=z.radiusAxisMap,F=z.angleAxisMap,X=Ra(U),Y=Ra(F),G=Y.cx,Z=Y.cy,K=Y.innerRadius,ee=Y.outerRadius;return j.cloneElement(O,{polarAngles:Array.isArray($)?$:Ki(Y,!0).map(function(L){return L.coordinate}),polarRadius:Array.isArray(W)?W:Ki(X,!0).map(function(L){return L.coordinate}),cx:G,cy:Z,innerRadius:K,outerRadius:ee,key:O.key||"polar-grid",radialLines:R})}),ze(T,"renderLegend",function(){var O=T.state.formattedGraphicalItems,N=T.props,R=N.children,$=N.width,W=N.height,z=T.props.margin||{},U=$-(z.left||0)-(z.right||0),F=j$({children:R,formattedGraphicalItems:O,legendWidth:U,legendContent:d});if(!F)return null;var X=F.item,Y=PN(F,Ene);return j.cloneElement(X,ie(ie({},Y),{},{chartWidth:$,chartHeight:W,margin:z,onBBoxUpdate:T.handleLegendBBoxUpdate}))}),ze(T,"renderTooltip",function(){var O,N=T.props,R=N.children,$=N.accessibilityLayer,W=sn(R,ln);if(!W)return null;var z=T.state,U=z.isTooltipActive,F=z.activeCoordinate,X=z.activePayload,Y=z.activeLabel,G=z.offset,Z=(O=W.props.active)!==null&&O!==void 0?O:U;return j.cloneElement(W,{viewBox:ie(ie({},G),{},{x:G.left,y:G.top}),active:Z,label:Y,payload:Z?X:[],coordinate:F,accessibilityLayer:$})}),ze(T,"renderBrush",function(O){var N=T.props,R=N.margin,$=N.data,W=T.state,z=W.offset,U=W.dataStartIndex,F=W.dataEndIndex,X=W.updateId;return j.cloneElement(O,{key:O.key||"_recharts-brush",onChange:Af(T.handleBrushChange,O.props.onChange),data:$,x:ge(O.props.x)?O.props.x:z.left,y:ge(O.props.y)?O.props.y:z.top+z.height+z.brushBottom-(R.bottom||0),width:ge(O.props.width)?O.props.width:z.width,startIndex:U,endIndex:F,updateId:"brush-".concat(X)})}),ze(T,"renderReferenceElement",function(O,N,R){if(!O)return null;var $=T,W=$.clipPathId,z=T.state,U=z.xAxisMap,F=z.yAxisMap,X=z.offset,Y=O.type.defaultProps||{},G=O.props,Z=G.xAxisId,K=Z===void 0?Y.xAxisId:Z,ee=G.yAxisId,L=ee===void 0?Y.yAxisId:ee;return j.cloneElement(O,{key:O.key||"".concat(N,"-").concat(R),xAxis:U[K],yAxis:F[L],viewBox:{x:X.left,y:X.top,width:X.width,height:X.height},clipPathId:W})}),ze(T,"renderActivePoints",function(O){var N=O.item,R=O.activePoint,$=O.basePoint,W=O.childIndex,z=O.isRange,U=[],F=N.props.key,X=N.item.type.defaultProps!==void 0?ie(ie({},N.item.type.defaultProps),N.item.props):N.item.props,Y=X.activeDot,G=X.dataKey,Z=ie(ie({index:W,dataKey:G,cx:R.x,cy:R.y,r:4,fill:n_(N.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},at(Y,!1)),ah(Y));return U.push(k.renderActiveDot(Y,Z,"".concat(F,"-activePoint-").concat(W))),$?U.push(k.renderActiveDot(Y,ie(ie({},Z),{},{cx:$.x,cy:$.y}),"".concat(F,"-basePoint-").concat(W))):z&&U.push(null),U}),ze(T,"renderGraphicChild",function(O,N,R){var $=T.filterFormatItem(O,N,R);if(!$)return null;var W=T.getTooltipEventType(),z=T.state,U=z.isTooltipActive,F=z.tooltipAxis,X=z.activeTooltipIndex,Y=z.activeLabel,G=T.props.children,Z=sn(G,ln),K=$.props,ee=K.points,L=K.isRange,I=K.baseLine,q=$.item.type.defaultProps!==void 0?ie(ie({},$.item.type.defaultProps),$.item.props):$.item.props,Q=q.activeDot,le=q.hide,fe=q.activeBar,ve=q.activeShape,qe=!!(!le&&U&&Z&&(Q||fe||ve)),xe={};W!=="axis"&&Z&&Z.props.trigger==="click"?xe={onClick:Af(T.handleItemMouseEnter,O.props.onClick)}:W!=="axis"&&(xe={onMouseLeave:Af(T.handleItemMouseLeave,O.props.onMouseLeave),onMouseEnter:Af(T.handleItemMouseEnter,O.props.onMouseEnter)});var ae=j.cloneElement(O,ie(ie({},$.props),xe));function Se(_t){return typeof F.dataKey=="function"?F.dataKey(_t.payload):null}if(qe)if(X>=0){var Me,oe;if(F.dataKey&&!F.allowDuplicatedCategory){var rt=typeof F.dataKey=="function"?Se:"payload.".concat(F.dataKey.toString());Me=ih(ee,rt,Y),oe=L&&I&&ih(I,rt,Y)}else Me=ee==null?void 0:ee[X],oe=L&&I&&I[X];if(ve||fe){var Fe=O.props.activeIndex!==void 0?O.props.activeIndex:X;return[j.cloneElement(O,ie(ie(ie({},$.props),xe),{},{activeIndex:Fe})),null,null]}if(!tt(Me))return[ae].concat(fl(T.renderActivePoints({item:$,activePoint:Me,basePoint:oe,childIndex:X,isRange:L})))}else{var kt,wt=(kt=T.getItemByXY(T.state.activeCoordinate))!==null&&kt!==void 0?kt:{graphicalItem:ae},Et=wt.graphicalItem,_r=Et.item,Ut=_r===void 0?O:_r,Rr=Et.childIndex,cr=ie(ie(ie({},$.props),xe),{},{activeIndex:Rr});return[j.cloneElement(Ut,cr),null,null]}return L?[ae,null,null]:[ae,null]}),ze(T,"renderCustomized",function(O,N,R){return j.cloneElement(O,ie(ie({key:"recharts-customized-".concat(R)},T.props),T.state))}),ze(T,"renderMap",{CartesianGrid:{handler:Nf,once:!0},ReferenceArea:{handler:T.renderReferenceElement},ReferenceLine:{handler:Nf},ReferenceDot:{handler:T.renderReferenceElement},XAxis:{handler:Nf},YAxis:{handler:Nf},Brush:{handler:T.renderBrush,once:!0},Bar:{handler:T.renderGraphicChild},Line:{handler:T.renderGraphicChild},Area:{handler:T.renderGraphicChild},Radar:{handler:T.renderGraphicChild},RadialBar:{handler:T.renderGraphicChild},Scatter:{handler:T.renderGraphicChild},Pie:{handler:T.renderGraphicChild},Funnel:{handler:T.renderGraphicChild},Tooltip:{handler:T.renderCursor,once:!0},PolarGrid:{handler:T.renderPolarGrid,once:!0},PolarAngleAxis:{handler:T.renderPolarAxis},PolarRadiusAxis:{handler:T.renderPolarAxis},Customized:{handler:T.renderCustomized}}),T.clipPathId="".concat((A=S.id)!==null&&A!==void 0?A:Bu("recharts"),"-clip"),T.throttleTriggeredAfterMouseMove=jI(T.triggeredAfterMouseMove,(C=S.throttleDelay)!==null&&C!==void 0?C:1e3/60),T.state={},T}return Dne(k,x),Rne(k,[{key:"componentDidMount",value:function(){var A,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var A=this.props,C=A.children,T=A.data,O=A.height,N=A.layout,R=sn(C,ln);if(R){var $=R.props.defaultIndex;if(!(typeof $!="number"||$<0||$>this.state.tooltipTicks.length-1)){var W=this.state.tooltipTicks[$]&&this.state.tooltipTicks[$].value,z=Nw(this.state,T,$,W),U=this.state.tooltipTicks[$].coordinate,F=(this.state.offset.top+O)/2,X=N==="horizontal",Y=X?{x:U,y:F}:{y:U,x:F},G=this.state.formattedGraphicalItems.find(function(K){var ee=K.item;return ee.type.name==="Scatter"});G&&(Y=ie(ie({},Y),G.props.points[$].tooltipPosition),z=G.props.points[$].tooltipPayload);var Z={activeTooltipIndex:$,isTooltipActive:!0,activeLabel:W,activePayload:z,activeCoordinate:Y};this.setState(Z),this.renderCursor(R),this.accessibilityManager.setIndex($)}}}},{key:"getSnapshotBeforeUpdate",value:function(A,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==A.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==A.margin){var T,O;this.accessibilityManager.setDetails({offset:{left:(T=this.props.margin.left)!==null&&T!==void 0?T:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0}})}return null}},{key:"componentDidUpdate",value:function(A){gx([sn(A.children,ln)],[sn(this.props.children,ln)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var A=sn(this.props.children,ln);if(A&&typeof A.props.shared=="boolean"){var C=A.props.shared?"axis":"item";return c.indexOf(C)>=0?C:a}return a}},{key:"getMouseInfo",value:function(A){if(!this.container)return null;var C=this.container,T=C.getBoundingClientRect(),O=WW(T),N={chartX:Math.round(A.pageX-O.left),chartY:Math.round(A.pageY-O.top)},R=T.width/C.offsetWidth||1,$=this.inRange(N.chartX,N.chartY,R);if(!$)return null;var W=this.state,z=W.xAxisMap,U=W.yAxisMap,F=this.getTooltipEventType(),X=IN(this.state,this.props.data,this.props.layout,$);if(F!=="axis"&&z&&U){var Y=Ra(z).scale,G=Ra(U).scale,Z=Y&&Y.invert?Y.invert(N.chartX):null,K=G&&G.invert?G.invert(N.chartY):null;return ie(ie({},N),{},{xValue:Z,yValue:K},X)}return X?ie(ie({},N),X):null}},{key:"inRange",value:function(A,C){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,O=this.props.layout,N=A/T,R=C/T;if(O==="horizontal"||O==="vertical"){var $=this.state.offset,W=N>=$.left&&N<=$.left+$.width&&R>=$.top&&R<=$.top+$.height;return W?{x:N,y:R}:null}var z=this.state,U=z.angleAxisMap,F=z.radiusAxisMap;if(U&&F){var X=Ra(U);return Jj({x:N,y:R},X)}return null}},{key:"parseEventsOfWrapper",value:function(){var A=this.props.children,C=this.getTooltipEventType(),T=sn(A,ln),O={};T&&C==="axis"&&(T.props.trigger==="click"?O={onClick:this.handleClick}:O={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 N=ah(this.props,this.handleOuterEvent);return ie(ie({},N),O)}},{key:"addListener",value:function(){Fb.on(Hb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Fb.removeListener(Hb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(A,C,T){for(var O=this.state.formattedGraphicalItems,N=0,R=O.length;N<R;N++){var $=O[N];if($.item===A||$.props.key===A.key||C===Gi($.item.type)&&T===$.childIndex)return $}return null}},{key:"renderClipPath",value:function(){var A=this.clipPathId,C=this.state.offset,T=C.left,O=C.top,N=C.height,R=C.width;return M.createElement("defs",null,M.createElement("clipPath",{id:A},M.createElement("rect",{x:T,y:O,height:N,width:R})))}},{key:"getXScales",value:function(){var A=this.state.xAxisMap;return A?Object.entries(A).reduce(function(C,T){var O=NN(T,2),N=O[0],R=O[1];return ie(ie({},C),{},ze({},N,R.scale))},{}):null}},{key:"getYScales",value:function(){var A=this.state.yAxisMap;return A?Object.entries(A).reduce(function(C,T){var O=NN(T,2),N=O[0],R=O[1];return ie(ie({},C),{},ze({},N,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(A){var C;return(C=this.state.xAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getYScaleByAxisId",value:function(A){var C;return(C=this.state.yAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getItemByXY",value:function(A){var C=this.state,T=C.formattedGraphicalItems,O=C.activeItem;if(T&&T.length)for(var N=0,R=T.length;N<R;N++){var $=T[N],W=$.props,z=$.item,U=z.type.defaultProps!==void 0?ie(ie({},z.type.defaultProps),z.props):z.props,F=Gi(z.type);if(F==="Bar"){var X=(W.data||[]).find(function(K){return fQ(A,K)});if(X)return{graphicalItem:$,payload:X}}else if(F==="RadialBar"){var Y=(W.data||[]).find(function(K){return Jj(A,K)});if(Y)return{graphicalItem:$,payload:Y}}else if(Bp($,O)||Up($,O)||Eu($,O)){var G=ree({graphicalItem:$,activeTooltipItem:O,itemData:U.data}),Z=U.activeIndex===void 0?G:U.activeIndex;return{graphicalItem:ie(ie({},$),{},{childIndex:Z}),payload:Eu($,O)?U.data[G]:$.props.data[G]}}}return null}},{key:"render",value:function(){var A=this;if(!lO(this))return null;var C=this.props,T=C.children,O=C.className,N=C.width,R=C.height,$=C.style,W=C.compact,z=C.title,U=C.desc,F=PN(C,Ane),X=at(F,!1);if(W)return M.createElement(fN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},M.createElement(vx,$s({},X,{width:N,height:R,title:z,desc:U}),this.renderClipPath(),uO(T,this.renderMap)));if(this.props.accessibilityLayer){var Y,G;X.tabIndex=(Y=this.props.tabIndex)!==null&&Y!==void 0?Y:0,X.role=(G=this.props.role)!==null&&G!==void 0?G:"application",X.onKeyDown=function(K){A.accessibilityManager.keyboardEvent(K)},X.onFocus=function(){A.accessibilityManager.focus()}}var Z=this.parseEventsOfWrapper();return M.createElement(fN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},M.createElement("div",$s({className:ot("recharts-wrapper",O),style:ie({position:"relative",cursor:"default",width:N,height:R},$)},Z,{ref:function(ee){A.container=ee}}),M.createElement(vx,$s({},X,{width:N,height:R,title:z,desc:U,style:Fne}),this.renderClipPath(),uO(T,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(j.Component);ze(b,"displayName",r),ze(b,"defaultProps",ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ze(b,"getDerivedStateFromProps",function(x,k){var S=x.dataKey,A=x.data,C=x.children,T=x.width,O=x.height,N=x.layout,R=x.stackOffset,$=x.margin,W=k.dataStartIndex,z=k.dataEndIndex;if(k.updateId===void 0){var U=$N(x);return ie(ie(ie({},U),{},{updateId:0},v(ie(ie({props:x},U),{},{updateId:0}),k)),{},{prevDataKey:S,prevData:A,prevWidth:T,prevHeight:O,prevLayout:N,prevStackOffset:R,prevMargin:$,prevChildren:C})}if(S!==k.prevDataKey||A!==k.prevData||T!==k.prevWidth||O!==k.prevHeight||N!==k.prevLayout||R!==k.prevStackOffset||!zs($,k.prevMargin)){var F=$N(x),X={chartX:k.chartX,chartY:k.chartY,isTooltipActive:k.isTooltipActive},Y=ie(ie({},IN(k,A,N)),{},{updateId:k.updateId+1}),G=ie(ie(ie({},F),X),Y);return ie(ie(ie({},G),v(ie({props:x},G),k)),{},{prevDataKey:S,prevData:A,prevWidth:T,prevHeight:O,prevLayout:N,prevStackOffset:R,prevMargin:$,prevChildren:C})}if(!gx(C,k.prevChildren)){var Z,K,ee,L,I=sn(C,rl),q=I&&(Z=(K=I.props)===null||K===void 0?void 0:K.startIndex)!==null&&Z!==void 0?Z:W,Q=I&&(ee=(L=I.props)===null||L===void 0?void 0:L.endIndex)!==null&&ee!==void 0?ee:z,le=q!==W||Q!==z,fe=!tt(A),ve=fe&&!le?k.updateId:k.updateId+1;return ie(ie({updateId:ve},v(ie(ie({props:x},k),{},{updateId:ve,dataStartIndex:q,dataEndIndex:Q}),k)),{},{prevChildren:C,dataStartIndex:q,dataEndIndex:Q})}return null}),ze(b,"renderActiveDot",function(x,k,S){var A;return j.isValidElement(x)?A=j.cloneElement(x,k):Je(x)?A=x(k):A=M.createElement(a_,k),M.createElement(Xt,{className:"recharts-active-dot",key:S},A)});var w=j.forwardRef(function(k,S){return M.createElement(b,$s({},k,{ref:S}))});return w.displayName=b.displayName,w},Qne=DM({chartName:"LineChart",GraphicalChild:Gu,axisComponents:[{axisType:"xAxis",AxisComp:Ua},{axisType:"yAxis",AxisComp:qa}],formatAxisMap:rM}),Pw=DM({chartName:"BarChart",GraphicalChild:ta,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ua},{axisType:"yAxis",AxisComp:qa}],formatAxisMap:rM});const np={backgroundColor:"#1e1e1e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#e4e0dc",fontSize:"11px",fontFamily:"JetBrains Mono, monospace"};function It(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t))}function Zn(t){return`$${t.toFixed(2)}`}function Ma({label:t,value:e,sub:r,accent:n}){return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-5 py-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mb-1",children:t}),y.jsx("p",{className:`text-xl font-mono font-medium ${n?"text-[#E43A9C]":"text-zinc-100"}`,children:e}),r&&y.jsx("p",{className:"text-[10px] font-mono text-zinc-600 mt-0.5",children:r})]})}const eie={summary:"Summary","by squad":"By Squad","by agent":"By Agent",io:"IO",timeline:"Timeline"};function tie({tabs:t,active:e,onChange:r}){return y.jsx("div",{className:"flex gap-0 border-b border-white/[0.06] mb-5",children:t.map(n=>y.jsx("button",{type:"button",onClick:()=>r(n),className:`px-4 py-2 text-[11px] font-mono transition-colors border-b-2 -mb-px cursor-pointer ${e===n?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:eie[n]??n},n))})}function rie({records:t,totals:e}){const r=e.totalInputTokens+e.totalOutputTokens,n=new Map;for(const o of t){const c=o.squadId??"__io__",u=o.squadName??(o.squadId?`${o.squadId.slice(0,8)} (deleted)`:"IO Orchestrator"),d=n.get(c)??{name:u,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=o.inputTokens,d.outputTokens+=o.outputTokens,d.calls+=1,d.cost+=o.estimatedCostUsd??0,n.set(c,d)}const i=Array.from(n.values()).sort((o,c)=>c.cost-o.cost),a=i.map(o=>({name:o.name.length>12?`${o.name.slice(0,12)}…`:o.name,cost:Number.parseFloat(o.cost.toFixed(2)),tokens:Math.round((o.inputTokens+o.outputTokens)/1e3)}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx(Ma,{label:"Total Tokens",value:It(r),sub:`${It(e.totalInputTokens)} in · ${It(e.totalOutputTokens)} out`}),y.jsx(Ma,{label:"Total Cost",value:Zn(e.totalCostUsd),accent:!0}),y.jsx(Ma,{label:"API Calls",value:It(e.callCount),sub:"across all entities"}),y.jsx(Ma,{label:"Avg Cost / Call",value:e.callCount>0?Zn(e.totalCostUsd/e.callCount):"$0.00",sub:`over ${e.callCount} calls`})]}),y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost by entity"}),a.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Pw,{data:a,barCategoryGap:"35%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`$${o}`,width:40}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`$${o.toFixed(2)}`,"Cost"]}),y.jsx(ta,{dataKey:"cost",fill:"url(#costGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens by entity (k)"}),a.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Pw,{data:a,barCategoryGap:"35%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`${o}k`,width:40}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`${o}k`,"Tokens"]}),y.jsx(ta,{dataKey:"tokens",fill:"url(#tokenGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#818cf8"}),y.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Entity","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsxs("tbody",{children:[i.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name)),y.jsxs("tr",{className:"bg-[#1a1a1a]",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-200 font-medium",children:"Total"}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalInputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalOutputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:e.callCount}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C] font-medium",children:Zn(e.totalCostUsd)})]})]})]})})]})}function nie({records:t}){const[e,r]=j.useState([]),[n,i]=j.useState("cost"),[a,o]=j.useState("desc");function c(f){f===n?o(m=>m==="asc"?"desc":"asc"):(i(f),o("desc"))}const u=j.useMemo(()=>{const f=new Map;for(const v of t){if(!v.squadId)continue;const b=f.get(v.squadId)??{id:v.squadId,name:v.squadName??`${v.squadId.slice(0,8)} (deleted)`,agents:new Map,inputTokens:0,outputTokens:0,calls:0,cost:0};b.inputTokens+=v.inputTokens,b.outputTokens+=v.outputTokens,b.calls+=1,b.cost+=v.estimatedCostUsd??0;const w=`${v.agentRole??"unknown"}:${v.model}`,x=b.agents.get(w)??{role:v.agentRole??"unknown",model:v.model,inputTokens:0,outputTokens:0,calls:0,cost:0};x.inputTokens+=v.inputTokens,x.outputTokens+=v.outputTokens,x.calls+=1,x.cost+=v.estimatedCostUsd??0,b.agents.set(w,x),f.set(v.squadId,b)}return[...Array.from(f.values())].sort((v,b)=>{const w=v[n],x=b[n],k=typeof w=="string"?w.localeCompare(x):w-x;return a==="desc"?-k:k})},[t,n,a]),d=f=>r(m=>m.includes(f)?m.filter(v=>v!==f):[...m,f]),p=[{key:"name",label:"Squad"},{key:"inputTokens",label:"In"},{key:"outputTokens",label:"Out"},{key:"calls",label:"Calls"},{key:"cost",label:"Cost"}];return u.length===0?y.jsx("div",{className:"text-center py-12 text-zinc-700 text-[11px] font-mono",children:"No squad usage data"}):y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-1 px-1 mb-1",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 mr-1",children:"sort by"}),p.map(f=>y.jsxs("button",{type:"button",onClick:()=>c(f.key),className:`flex items-center gap-0.5 px-2 py-1 rounded-lg text-[10px] font-mono transition-colors ${n===f.key?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400 hover:bg-white/[0.04]"}`,style:n===f.key?{background:"rgba(228,58,156,0.1)"}:void 0,children:[f.label,n===f.key&&y.jsx("span",{className:"text-[9px]",children:a==="desc"?"↓":"↑"})]},f.key))]}),u.map(f=>{const m=e.includes(f.id),v=Array.from(f.agents.values());return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl overflow-hidden",children:[y.jsxs("button",{type:"button",onClick:()=>d(f.id),className:"w-full flex items-center gap-3 px-4 py-3.5 hover:bg-white/[0.02] transition-colors text-left cursor-pointer",children:[y.jsx("div",{className:`transition-transform ${m?"rotate-90":""}`,children:y.jsx(Qw,{className:"w-3.5 h-3.5 text-zinc-600"})}),y.jsx("span",{className:"text-sm font-mono text-zinc-100 flex-1",children:f.name}),y.jsxs("div",{className:"flex items-center gap-6 text-[11px] font-mono",children:[y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"in"}),It(f.inputTokens)]}),y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"out"}),It(f.outputTokens)]}),y.jsxs("span",{className:"text-zinc-500",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"calls"}),f.calls]}),y.jsx("span",{className:"text-[#E43A9C] font-medium w-16 text-right",children:Zn(f.cost)})]})]}),m&&y.jsx("div",{className:"border-t border-white/[0.05]",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"bg-[#191919]",children:["Agent","Model","Input","Output","Calls","Cost"].map(b=>y.jsx("th",{className:`text-left px-4 py-2 text-zinc-700 font-medium ${b==="Cost"?"text-right":""}`,children:b},b))})}),y.jsx("tbody",{children:v.map(b=>y.jsxs("tr",{className:"border-t border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-2.5 text-zinc-300",children:b.role}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-600",children:b.model}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(b.inputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(b.outputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:b.calls}),y.jsx("td",{className:"px-4 py-2.5 text-right text-[#E43A9C]",children:Zn(b.cost)})]},b.role))})]})})]},f.id)})]})}function iie({records:t}){const e=j.useMemo(()=>{const n=new Map;for(const i of t){const a=`${i.squadId??"io"}:${i.agentRole??"orchestrator"}:${i.model}`,o=n.get(a)??{name:i.agentRole??"orchestrator",squad:i.squadName??(i.squadId?i.squadId.slice(0,8):"IO"),model:i.model,inputTokens:0,outputTokens:0,calls:0,cost:0};o.inputTokens+=i.inputTokens,o.outputTokens+=i.outputTokens,o.calls+=1,o.cost+=i.estimatedCostUsd??0,n.set(a,o)}return Array.from(n.values()).sort((i,a)=>a.cost-i.cost)},[t]),r=e.reduce((n,i)=>n+i.cost,0);return y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Agent","Squad","Model","Input","Output","Calls","Cost","% of total"].map(n=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${n==="Cost"?"text-right":""}`,children:n},n))})}),y.jsx("tbody",{children:e.map(n=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:n.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.squad}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:n.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(n.cost)}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-16 h-1.5 rounded-full bg-[#252525] overflow-hidden",children:y.jsx("div",{className:"h-full bg-[#E43A9C] rounded-full",style:{width:`${r>0?n.cost/r*100:0}%`}})}),y.jsx("span",{className:"text-zinc-600 text-[10px]",children:r>0?`${(n.cost/r*100).toFixed(1)}%`:"0%"})]})})]},`${n.squad}:${n.name}`))})]})})}function aie({records:t}){const e=j.useMemo(()=>t.filter(o=>!o.squadId),[t]),r=j.useMemo(()=>{const o=new Map;for(const c of e){const u=`${c.agentRole??"orchestrator"}:${c.model}`,d=o.get(u)??{name:c.agentRole??"orchestrator",model:c.model,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=c.inputTokens,d.outputTokens+=c.outputTokens,d.calls+=1,d.cost+=c.estimatedCostUsd??0,o.set(u,d)}return Array.from(o.values()).sort((c,u)=>u.cost-c.cost)},[e]),n=e.reduce((o,c)=>o+c.inputTokens,0),i=e.reduce((o,c)=>o+c.outputTokens,0),a=e.reduce((o,c)=>o+(c.estimatedCostUsd??0),0);return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx(Ma,{label:"IO Tokens",value:It(n+i),sub:`${It(n)} in · ${It(i)} out`}),y.jsx(Ma,{label:"IO Cost",value:Zn(a),accent:!0}),y.jsx(Ma,{label:"IO Calls",value:It(e.length)}),y.jsx(Ma,{label:"IO Roles",value:String(r.length)})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Role","Model","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsx("tbody",{children:r.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:o.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name))})]})})]})}function oie({records:t}){const e=Fa(),r=j.useMemo(()=>{const i=new Map;for(const a of t){const o=a.timestamp.slice(0,10),c=i.get(o)??{date:o,inputTokens:0,outputTokens:0,cost:0,calls:0};c.inputTokens+=a.inputTokens,c.outputTokens+=a.outputTokens,c.cost+=a.estimatedCostUsd??0,c.calls+=1,i.set(o,c)}return Array.from(i.values()).sort((a,o)=>a.date.localeCompare(o.date))},[t]),n=r.map(i=>({...i,label:ez(i.date,e),tokens:i.inputTokens+i.outputTokens}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens per day"}),n.length>0?y.jsx(gh,{width:"100%",height:220,children:y.jsxs(Qne,{data:n,children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:It,width:44}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[It(i),"Tokens"]}),y.jsx(Gu,{type:"monotone",dataKey:"tokens",stroke:"#E43A9C",strokeWidth:2,dot:!1})]})}):y.jsx("div",{className:"h-[220px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost per day"}),n.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Pw,{data:n,barCategoryGap:"20%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:i=>`$${i.toFixed(2)}`,width:44}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[Zn(i),"Cost"]}),y.jsx(ta,{dataKey:"cost",fill:"url(#costGradTl)",radius:[4,4,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGradTl",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Date","Input","Output","Calls","Cost"].map(i=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${i==="Cost"?"text-right":""}`,children:i},i))})}),y.jsx("tbody",{children:r.map(i=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:i.date}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:i.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(i.cost)})]},i.date))})]})})]})}function sie(){const[t,e]=j.useState("summary"),[r,n]=j.useState(null),[i,a]=j.useState("14d"),o=["summary","by squad","by agent","io","timeline"];if(j.useEffect(()=>{const u=new Date;i==="7d"?u.setDate(u.getDate()-7):i==="14d"?u.setDate(u.getDate()-14):i==="30d"?u.setDate(u.getDate()-30):u.setDate(u.getDate()-1),Ge.get(`/usage?since=${u.toISOString()}`).then(n).catch(()=>{})},[i]),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600 font-mono text-[11px]",children:"Loading..."});const c=i==="1d"?"Today":`Last ${i}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsxs("div",{className:"flex items-start justify-between mb-5 gap-4 flex-wrap",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Usage"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:c})]}),y.jsx("div",{className:"flex gap-1 p-1 rounded-xl bg-white/[0.03] border border-white/[0.07]",children:["1d","7d","14d","30d"].map(u=>y.jsx("button",{type:"button",onClick:()=>a(u),className:`px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors cursor-pointer ${i===u?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400"}`,style:i===u?{background:"rgba(228,58,156,0.12)"}:void 0,children:u},u))})]}),y.jsx(tie,{tabs:o,active:t,onChange:u=>e(u)}),t==="summary"&&y.jsx(rie,{records:r.records,totals:r.totals}),t==="by squad"&&y.jsx(nie,{records:r.records}),t==="by agent"&&y.jsx(iie,{records:r.records}),t==="io"&&y.jsx(aie,{records:r.records}),t==="timeline"&&y.jsx(oie,{records:r.records})]})}function LM(t){return[...t].sort((e,r)=>e.isDir!==r.isDir?e.isDir?-1:1:e.name.localeCompare(r.name)).map(e=>({...e,children:LM(e.children)}))}function lie(t){const e=[];for(const r of t){const n=r.path.split("/").filter(Boolean);let i=e,a="";if(r.isDir){for(const o of n){a=a?`${a}/${o}`:o;let c=i.find(u=>u.path===a);c||(c={name:o,path:a,isDir:!0,children:[]},i.push(c)),i=c.children}continue}for(const[o,c]of n.entries()){const u=o===n.length-1;a=a?`${a}/${c}`:c;let d=i.find(p=>p.path===a);d||(d={name:u&&r.name||c,path:a,isDir:!u,children:[]},i.push(d)),i=d.children}}return LM(e)}function zM(t,e){return e?t.flatMap(r=>{const n=r.name.toLowerCase().includes(e)||r.path.toLowerCase().includes(e);if(!r.isDir)return n?[r]:[];if(n)return[r];const i=zM(r.children,e);return i.length?[{...r,children:i}]:[]}):t}function Rw(t){const e=new Set;for(const r of t)if(r.isDir){e.add(r.path);for(const n of Rw(r.children))e.add(n)}return e}function cie(t){const e=t.split("/").filter(Boolean),r=[];let n="";for(const i of e.slice(0,-1))n=n?`${n}/${i}`:i,r.push(n);return r}function BM({node:t,depth:e,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u}){const d=r===t.path,p=t.isDir&&(n.has(t.path)||i.has(t.path)),f=12+e*16,m=t.isDir&&["io","shared","squads","templates"].includes(t.path);return t.isDir?y.jsxs("div",{children:[y.jsxs("div",{className:"flex w-full items-center group rounded-lg py-2 pr-3 text-left text-[11px] font-mono text-zinc-400 transition-colors hover:bg-white/[0.04] hover:text-zinc-200",style:{paddingLeft:f},children:[y.jsxs("button",{type:"button",onClick:()=>a(t.path),className:"flex items-center gap-2 flex-1 min-w-0",children:[y.jsx(Qw,{size:14,className:`shrink-0 transition-transform ${p?"rotate-90":""}`}),p?y.jsx(zz,{size:14,className:"shrink-0 text-zinc-500"}):y.jsx(Uz,{size:14,className:"shrink-0 text-zinc-500"}),y.jsx("span",{className:"truncate",children:t.name})]}),y.jsxs("div",{className:"flex items-center gap-0.5",children:[!m&&y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),u(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-red-500/20 transition-opacity text-zinc-600 hover:text-red-400",title:`Delete ${t.name}`,children:y.jsx(Da,{size:12})}),y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),c(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-white/[0.08] transition-opacity text-zinc-600 hover:text-zinc-300",title:`Add page to ${t.name}`,children:y.jsx(i1,{size:12})})]})]}),p&&y.jsx("div",{children:t.children.map(v=>y.jsx(BM,{node:v,depth:e+1,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u},v.path))})]}):y.jsxs("button",{type:"button",onClick:()=>o(t.path),className:`flex w-full items-center gap-2 rounded-lg py-2 pr-3 text-left text-[11px] font-mono transition-colors ${d?"border-l-2 border-[#E43A9C] bg-[#E43A9C]/10 text-[#E43A9C]":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-300"}`,style:{paddingLeft:f},children:[y.jsx(Dz,{size:14,className:"shrink-0"}),y.jsx("span",{className:"truncate",children:t.name})]})}function uie(){const[t,e]=j.useState([]),[r,n]=j.useState(null),[i,a]=j.useState(""),[o,c]=j.useState(!1),[u,d]=j.useState(""),[p,f]=j.useState(""),[m,v]=j.useState(""),[b,w]=j.useState(new Set),[x,k]=j.useState(!1),[S,A]=j.useState(null),C=j.useRef(null),T=j.useCallback(async()=>{try{const L=await Ge.get("/wiki/pages");e(L.map(I=>({name:I.title||I.path.split("/").pop()||I.path,path:I.path,title:I.title,isDir:I.isDir})))}catch{e([])}},[]);j.useEffect(()=>{T()},[T]);const O=j.useMemo(()=>lie(t),[t]),N=m.trim().toLowerCase(),R=j.useMemo(()=>zM(O,N),[O,N]),$=j.useMemo(()=>{const L=N?Rw(R):new Set;if(r)for(const I of cie(r))L.add(I);return L},[R,N,r]),W=r?(function L(I){for(const q of I){if(q.path===r)return q;const Q=L(q.children);if(Q)return Q}return null})(R):null,z=(W==null?void 0:W.name)??(r?r.split("/").pop()??"":"");j.useEffect(()=>{const L=Rw(O);w(I=>new Set([...I,...L]))},[O]);async function U(L){try{const I=await Ge.get(`/wiki/pages/${L}`);a(I.content),d(I.content),n(I.path||L),c(!1)}catch{Qe.error("Failed to load page")}}o1({onEvent:L=>{(L.type==="connected"||L.type===Fc.WIKI_UPDATED)&&T()}});async function F(){if(r)try{await Ge.put(`/wiki/pages/${r}`,{content:u}),a(u),c(!1),Qe.success("Page saved")}catch{Qe.error("Failed to save page")}}async function X(){if(r)try{await Ge.delete(`/wiki/pages/${r}`),Qe.success("Page deleted"),n(null),a(""),d(""),c(!1),await T()}catch{Qe.error("Failed to delete page")}}function Y(L){f(`${L}/`),setTimeout(()=>{const I=C.current;I&&(I.focus(),I.setSelectionRange(I.value.length,I.value.length))},0)}function G(L){A(L)}async function Z(){if(S)try{await Ge.delete(`/wiki/directories/${S}`),Qe.success(`Deleted ${S}`),(r!=null&&r.startsWith(`${S}/`)||r===S)&&(n(null),a(""),d(""),c(!1)),await T()}catch{Qe.error("Failed to delete directory")}finally{A(null)}}async function K(){let L=p.trim().replace(/^\/+|\/+$/g,"");if(!L)return;L=L.replace(/\.md$/i,"");const I=L.startsWith("io/")||L.startsWith("shared/")||L.startsWith("squads/")?L:`shared/${L}`,q=I.split("/").pop()??I;k(!0);try{await Ge.post("/wiki/pages",{path:I,title:q,content:`# ${q}
518
518
 
519
519
  `,tags:[]}),Qe.success("Page created"),f(""),await T(),await U(I)}catch{Qe.error("Failed to create page")}finally{k(!1)}}function ee(L){w(I=>{const q=new Set(I);return q.has(L)?q.delete(L):q.add(L),q})}return y.jsxs("div",{className:"flex h-full",children:[y.jsxs("div",{className:"flex h-full w-64 flex-col border-r border-white/[0.07] bg-[#181818]",children:[y.jsx("div",{className:"border-b border-white/[0.07] p-3",children:y.jsxs("div",{className:"relative",children:[y.jsx(zP,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-600"}),y.jsx("input",{type:"text",value:m,onChange:L=>v(L.target.value),placeholder:"Search pages...",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] py-2 pl-8 pr-3 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"})]})}),y.jsx("div",{className:"flex-1 overflow-y-auto px-2 py-3",children:R.length>0?R.map(L=>y.jsx(BM,{node:L,depth:0,selectedPage:r,expandedPaths:b,autoExpandedPaths:$,onToggle:ee,onSelect:U,onAddToFolder:Y,onDeleteFolder:G},L.path)):y.jsx("p",{className:"py-4 text-center font-mono text-[11px] text-zinc-700",children:"No pages found"})}),y.jsx("div",{className:"border-t border-white/[0.07] p-3",children:y.jsxs("div",{className:"space-y-2",children:[y.jsx("input",{ref:C,type:"text",value:p,onChange:L=>f(L.target.value),onKeyDown:L=>{L.key==="Enter"&&K(),L.key==="Escape"&&f("")},placeholder:"folder/new-page",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"}),y.jsx(Ba,{onClick:K,disabled:!p.trim()||x,className:"w-full justify-center px-3 py-2",children:x?y.jsxs(y.Fragment,{children:[y.jsx(Ts,{size:13,className:"animate-spin"})," Creating..."]}):y.jsxs(y.Fragment,{children:[y.jsx(i1,{size:13})," Add Page"]})})]})})]}),y.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:r?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-white/[0.07] px-6",children:[y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate font-mono text-sm text-zinc-100",children:z}),y.jsx("p",{className:"truncate font-mono text-[11px] text-zinc-500",children:r})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[o?y.jsxs(y.Fragment,{children:[y.jsxs(Ba,{onClick:F,className:"px-3 py-1.5",children:[y.jsx(up,{size:12})," Save"]}),y.jsx(wi,{onClick:()=>{c(!1),d(i)},className:"px-3 py-1.5",children:"Cancel"})]}):y.jsxs(wi,{onClick:()=>{c(!0),d(i)},className:"px-3 py-1.5",children:[y.jsx(Wf,{size:12})," Edit"]}),y.jsxs(Vf,{onClick:X,className:"px-3 py-1.5",children:[y.jsx(Da,{size:12})," Delete"]})]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o?y.jsx("textarea",{value:u,onChange:L=>d(L.target.value),className:"h-full min-h-[320px] w-full resize-none rounded-xl border border-white/[0.07] bg-[#181818] p-4 font-mono text-sm text-zinc-300 outline-none focus:border-[#E43A9C]/50"}):y.jsx("div",{className:"mx-auto max-w-4xl",children:y.jsx("div",{className:"prose-io text-sm text-zinc-300",dangerouslySetInnerHTML:{__html:it.parse(i)}})})})]}):y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsxs("div",{className:"text-center",children:[y.jsx(RP,{size:48,className:"mx-auto mb-3 text-zinc-800"}),y.jsx("p",{className:"font-mono text-[11px] text-zinc-700",children:"Select a page to view"})]})})}),S&&y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:y.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-white/[0.07] bg-[#1a1a1a] p-6 shadow-2xl",children:[y.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-100",children:"Delete directory?"}),y.jsxs("p",{className:"mb-4 text-xs text-zinc-400",children:["This will permanently delete"," ",y.jsx("span",{className:"font-mono text-zinc-200",children:S})," and all its contents."]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx(wi,{onClick:()=>A(null),className:"px-3 py-1.5",children:"Cancel"}),y.jsxs(Vf,{onClick:Z,className:"px-3 py-1.5",children:[y.jsx(Da,{size:12})," Delete"]})]})]})})]})}function die({children:t}){const{session:e,supabase:r,loading:n}=gp();return n?y.jsx("div",{className:"min-h-screen flex items-center justify-center text-[var(--color-muted-foreground)]",children:"Loading..."}):r?e?y.jsx(y.Fragment,{children:t}):y.jsx(Dq,{}):y.jsx(y.Fragment,{children:t})}function fie(){const{pathname:t}=ti(),e=t==="/"||t==="/chat"||t.startsWith("/chat/");return y.jsxs(y.Fragment,{children:[y.jsx(jL,{children:y.jsxs(Yr,{element:y.jsx(Rq,{}),children:[y.jsx(Yr,{index:!0,element:y.jsx(Iq,{})}),y.jsx(Yr,{path:"squads",element:y.jsx(vf,{})}),y.jsx(Yr,{path:"squads/:name",element:y.jsx(vf,{})}),y.jsx(Yr,{path:"squads/:name/instances/:instanceId",element:y.jsx(vf,{})}),y.jsx(Yr,{path:"squads/:name/agents/:role",element:y.jsx(vf,{})}),y.jsx(Yr,{path:"feed",element:y.jsx(Mq,{})}),y.jsx(Yr,{path:"skills",element:y.jsx(Xq,{})}),y.jsx(Yr,{path:"schedules",element:y.jsx(Bq,{})}),y.jsx(Yr,{path:"wiki",element:y.jsx(uie,{})}),y.jsx(Yr,{path:"settings",element:y.jsx(Hq,{})}),y.jsx(Yr,{path:"usage",element:y.jsx(sie,{})}),y.jsx(Yr,{path:"*",element:y.jsx(OL,{to:"/",replace:!0})})]})}),!e&&y.jsx($B,{})]})}function hie(){return y.jsx(zU,{children:y.jsx(die,{children:y.jsx(Z4,{children:y.jsx(IB,{children:y.jsx(fie,{})})})})})}OD.createRoot(document.getElementById("root")).render(y.jsx(j.StrictMode,{children:y.jsxs(e5,{children:[y.jsx(hie,{}),y.jsx(D5,{theme:"dark",position:"bottom-right"})]})}));
520
- //# sourceMappingURL=index-DuotQGjP.js.map
520
+ //# sourceMappingURL=index-CZ5uBH6R.js.map
@@ -11,7 +11,7 @@
11
11
  href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap"
12
12
  />
13
13
  <title>IO</title>
14
- <script type="module" crossorigin src="/assets/index-DuotQGjP.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-CZ5uBH6R.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-DxpOSxN9.css">
16
16
  </head>
17
17
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyio",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "description": "AI orchestrator daemon with squad-based team delegation",
5
5
  "type": "module",
6
6
  "license": "MIT",