codexmeter 1.0.16 → 1.0.17
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.
|
@@ -24,11 +24,11 @@ yyyy`);var r=Os(t),i=n?`getUTC`:`get`,a=r[i+`FullYear`](),o=r[i+`Month`]()+1,s=r
|
|
|
24
24
|
|
|
25
25
|
`:`<br/>`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=ad(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=GP([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(!(m!=null&&m!==`item`)){var h=s.getDataParams(c,l),g=new eb;h.marker=g.makeTooltipMarker(`item`,Sg(h.color),d);var _=ty(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?Gy(y?L({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=ad(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(U(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=it(a),a.content=In(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=GP(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new eb;this._showOrMove(d,function(){var n=it(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,!(!e.get(`showContent`)||!e.get(`show`))){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o||=e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`),e.get(`defaultBorderColor`,!0)).color;if(u)if(U(u)){var p=e.ecModel.get(`useUTC`),m=V(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=qh(m.axisValue,d,p)),d=vg(d,n,!0)}else if(H(u)){var g=B(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u;l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r,i){if(n===`axis`||V(t))return{color:r||i};if(!V(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t||=e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),H(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),V(t))n=ps(t[0],s),r=ps(t[1],c);else if(W(t)){var p=t;p.width=l[0],p.height=l[1];var m=Ug(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(U(t)&&o){var h=YP(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=qP(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=XP(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=XP(d)?l[1]/2:d===`bottom`?l[1]:0),SP(e)){var h=JP(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&R(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i&&=o.length===s.length,i&&R(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&R(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&R(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){Ne.node||!t.getDom()||(kb(this,`_updatePosition`),this._tooltipContent.dispose(),xN(`itemTooltip`,t))},t.type=`tooltip`,t}(mb);function GP(e,t,n){var r=t.ecModel,i;n?(i=new lh(n,r,r),i=new lh(t.option,i,r)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof lh&&(o=o.get(`tooltip`,!0)),U(o)&&(o={formatter:o}),o&&(i=new lh(o,i,r)))}return i}function KP(e,t){return e.dispatchAction||B(t.dispatchAction,t)}function qP(e,t,n,r,i,a,o){var s=n.getSize(),c=s[0],l=s[1];return a!=null&&(e+c+a+2>r?e-=c+a:e+=a),o!=null&&(t+l+o>i?t-=l+o:t+=o),[e,t]}function JP(e,t,n,r,i){var a=n.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,r)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function YP(e,t,n,r){var i=n[0],a=n[1],o=Math.ceil(Math.SQRT2*r)+8,s=0,c=0,l=t.width,u=t.height;switch(e){case`inside`:s=t.x+l/2-i/2,c=t.y+u/2-a/2;break;case`top`:s=t.x+l/2-i/2,c=t.y-a-o;break;case`bottom`:s=t.x+l/2-i/2,c=t.y+u+o;break;case`left`:s=t.x-i-o,c=t.y+u/2-a/2;break;case`right`:s=t.x+l+o,c=t.y+u/2-a/2}return[s,c]}function XP(e){return e===`center`||e===`middle`}function ZP(e,t,n){var r=_c(e).queryOptionMap,i=r.keys()[0];if(!(!i||i===`series`)){var a=bc(t,i,r.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a){var o=n.getViewOfComponentModel(a),s;if(o.group.traverse(function(t){var n=ad(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:i,componentIndex:a.componentIndex,el:s}}}}function QP(e){BE(IN),e.registerComponentModel(xP),e.registerComponentView(WP),e.registerAction({type:`showTip`,event:`showTip`,update:`tooltip:manuallyShowTip`},Wt),e.registerAction({type:`hideTip`,event:`hideTip`,update:`tooltip:manuallyHideTip`},Wt)}I();var $P=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode={type:`box`,ignoreSize:!0},n}return t.type=`title`,t.defaultOption={z:6,show:!0,text:``,target:`blank`,subtext:``,subtarget:`blank`,left:`center`,top:Z.size.m,backgroundColor:Z.color.transparent,borderColor:Z.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:`bold`,color:Z.color.primary},subtextStyle:{fontSize:12,color:Z.color.quaternary}},t}(Qg),eF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){if(this.group.removeAll(),e.get(`show`)){var r=this.group,i=e.getModel(`textStyle`),a=e.getModel(`subtextStyle`),o=e.get(`textAlign`),s=G(e.get(`textBaseline`),e.get(`textVerticalAlign`)),c=new X({style:Vm(i,{text:e.get(`text`),fill:i.getTextColor()},{disableBox:!0}),z2:10}),l=c.getBoundingRect(),u=e.get(`subtext`),d=new X({style:Vm(a,{text:u,fill:a.getTextColor(),y:l.height+e.get(`itemGap`),verticalAlign:`top`},{disableBox:!0}),z2:10}),f=e.get(`link`),p=e.get(`sublink`),m=e.get(`triggerEvent`,!0);c.silent=!f&&!m,d.silent=!p&&!m,f&&c.on(`click`,function(){Cg(f,`_`+e.get(`target`))}),p&&d.on(`click`,function(){Cg(p,`_`+e.get(`subtarget`))}),ad(c).eventData=ad(d).eventData=m?{componentType:`title`,componentIndex:e.componentIndex}:null,r.add(c),u&&r.add(d);var h=r.getBoundingRect(),g=e.getBoxLayoutParams();g.width=h.width,g.height=h.height;var _=Ug(g,Gg(e,n).refContainer,e.get(`padding`));o||(o=e.get(`left`)||e.get(`right`),o===`middle`&&(o=`center`),o===`right`?_.x+=_.width:o===`center`&&(_.x+=_.width/2)),s||(s=e.get(`top`)||e.get(`bottom`),s===`center`&&(s=`middle`),s===`bottom`?_.y+=_.height:s===`middle`&&(_.y+=_.height/2),s||=`top`),r.x=_.x,r.y=_.y,r.markRedraw();var v={align:o,verticalAlign:s};c.setStyle(v),d.setStyle(v),h=r.getBoundingRect();var y=_.margin,b=e.getItemStyle([`color`,`opacity`]);b.fill=e.get(`backgroundColor`);var x=new Vu({shape:{x:h.x-y[3],y:h.y-y[0],width:h.width+y[1]+y[3],height:h.height+y[0]+y[2],r:e.get(`borderRadius`)},style:b,subPixelOptimize:!0,silent:!0});r.add(x)}},t.type=`title`,t}(mb);function tF(e){e.registerComponentModel($P),e.registerComponentView(eF)}I();var nF=function(e,t){if(t===`all`)return{type:`all`,title:e.getLocaleModel().get([`legend`,`selector`,`all`])};if(t===`inverse`)return{type:`inverse`,title:e.getLocaleModel().get([`legend`,`selector`,`inverse`])}},rF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode={type:`box`,ignoreSize:!0},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n),e.selected=e.selected||{},this._updateSelector(e)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),this._updateSelector(t)},t.prototype._updateSelector=function(e){var t=e.selector,n=this.ecModel;t===!0&&(t=e.selector=[`all`,`inverse`]),V(t)&&R(t,function(e,r){U(e)&&(e={type:e}),t[r]=at(e,nF(n,e.type))})},t.prototype.optionUpdated=function(){this._updateData(this.ecModel);var e=this._data;if(e[0]&&this.get(`selectedMode`)===`single`){for(var t=!1,n=0;n<e.length;n++){var r=e[n].get(`name`);if(this.isSelected(r)){this.select(r),t=!0;break}}!t&&this.select(e[0].get(`name`))}},t.prototype._updateData=function(e){var t=[],n=[];e.eachRawSeries(function(r){var i=r.name;n.push(i);var a;if(r.legendVisualProvider){var o=r.legendVisualProvider.getAllNames();e.isSeriesFiltered(r)||(n=n.concat(o)),o.length?t=t.concat(o):a=!0}else a=!0;a&&lc(r)&&t.push(r.name)}),this._availableNames=n;var r=this.get(`data`)||t,i=K();this._data=mt(z(r,function(e){return(U(e)||bt(e))&&(e={name:e}),i.get(e.name)?null:(i.set(e.name,!0),new lh(e,this,this.ecModel))},this),function(e){return!!e})},t.prototype.getData=function(){return this._data},t.prototype.select=function(e){var t=this.option.selected;if(this.get(`selectedMode`)===`single`){var n=this._data;R(n,function(e){t[e.get(`name`)]=!1})}t[e]=!0},t.prototype.unSelect=function(e){this.get(`selectedMode`)!==`single`&&(this.option.selected[e]=!1)},t.prototype.toggleSelected=function(e){var t=this.option.selected;t.hasOwnProperty(e)||(t[e]=!0),this[t[e]?`unSelect`:`select`](e)},t.prototype.allSelect=function(){var e=this._data,t=this.option.selected;R(e,function(e){t[e.get(`name`,!0)]=!0})},t.prototype.inverseSelect=function(){var e=this._data,t=this.option.selected;R(e,function(e){var n=e.get(`name`,!0);t.hasOwnProperty(n)||(t[n]=!0),t[n]=!t[n]})},t.prototype.isSelected=function(e){var t=this.option.selected;return!(t.hasOwnProperty(e)&&!t[e])&<(this._availableNames,e)>=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,bottom:Z.size.m,align:`auto`,backgroundColor:Z.color.transparent,borderColor:Z.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:Z.color.disabled,inactiveBorderColor:Z.color.disabled,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:Z.color.disabled,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:Z.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:Z.color.tertiary,borderWidth:1,borderColor:Z.color.border},emphasis:{selectorLabel:{show:!0,color:Z.color.quaternary}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(Qg);I();var iF=vt,aF=R,oF=Wo,sF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new oF),this.group.add(this._selectorGroup=new oF),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);(!i||i===`auto`)&&(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=Gg(e,n).refContainer,l=e.getBoxLayoutParams(),u=e.get(`padding`),d=Ug(l,c,u),f=this.layoutInner(e,i,d,r,o,s),p=Ug(st({width:f.width,height:f.height},l),c,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=bP(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=K(),l=t.get(`selectedMode`),u=t.get(`triggerEvent`),d=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&d.push(e.id)}),aF(t.getData(),function(i,a){var o=this,f=i.get(`name`);if(!this.newlineDisabled&&(f===``||f===`
|
|
26
26
|
`)){var p=new oF;p.newline=!0,s.add(p);return}var m=n.getSeriesByName(f)[0];if(!c.get(f))if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,iF(uF,f,null,r,d)).on(`mouseover`,iF(fF,m.name,null,r,d)).on(`mouseout`,iF(pF,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=ad(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=Gi(h.fill);_&&_[3]===0&&(_[3]=.2,h=L(L({},h),{fill:na(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,iF(uF,null,f,r,d)).on(`mouseover`,iF(fF,null,f,r,d)).on(`mouseout`,iF(pF,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=ad(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};ad(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();aF(e,function(e){var r=e.type,i=new X({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),zm(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),tf(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=cF(c,r,o,s,d,m,u),y=new oF,b=r.getModel(`textStyle`);if(H(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(lF({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;U(w)&&w?T=w.replace(`{name}`,t??``):H(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new X({style:Vm(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new Vu({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&Tm({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),tf(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();zg(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){zg(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}else return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(mb);function cF(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),aF(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:gS(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function lF(e){var t=e.icon||`roundRect`,n=Dx(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=Z.color.neutral00,n.style.lineWidth=2),n}function uF(e,t,n,r){pF(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),fF(e,t,n,r)}function dF(e){for(var t=e.getZr().storage.getDisplayList(),n,r=0,i=t.length;r<i&&!(n=t[r].states.emphasis);)r++;return n&&n.hoverLayer}function fF(e,t,n,r){dF(n)||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function pF(e,t,n,r){dF(n)||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function mF(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;n<t.length;n++)if(!t[n].isSelected(e.name))return!1;return!0})}function hF(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),gF(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){R(i,function(t,n){e[t?`select`:`unSelect`](n)}),gF(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function gF(e,t){var n=t||{};return R(e.getData(),function(t){var r=t.get(`name`);if(!(r===`
|
|
27
|
-
`||r===``)){var i=e.isSelected(r);q(n,r)?n[r]=n[r]&&i:n[r]=i}}),n}function _F(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,vt(hF,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,vt(hF,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,vt(hF,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,vt(hF,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,vt(hF,`unSelect`))}function vF(e){e.registerComponentModel(rF),e.registerComponentView(sF),e.registerProcessor(e.PRIORITY.PROCESSOR.SERIES_FILTER,mF),e.registerSubTypeDefaulter(`legend`,function(){return`plain`}),_F(e)}I();var yF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.setScrollDataIndex=function(e){this.option.scrollDataIndex=e},t.prototype.init=function(t,n,r){var i=Yg(t);e.prototype.init.call(this,t,n,r),bF(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),bF(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=mh(rF.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:`end`,pageFormatter:`{current}/{total}`,pageIcons:{horizontal:[`M0,0L12,-10L12,10z`,`M0,0L-12,-10L-12,10z`],vertical:[`M0,0L20,0L10,-20z`,`M0,0L20,0L10,20z`]},pageIconColor:Z.color.accent50,pageIconInactiveColor:Z.color.accent10,pageIconSize:15,pageTextStyle:{color:Z.color.tertiary},animationDurationUpdate:800}),t}(rF);function bF(e,t,n){var r=e.getOrient(),i=[1,1];i[r.index]=0,Jg(t,n,{type:`box`,ignoreSize:!!i})}I();var xF=Wo,SF=[`width`,`height`],CF=[`x`,`y`],wF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!0,n._currentIndex=0,n}return t.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new xF),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new xF)},t.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(t,n,r,i,a,o,s){var c=this;e.prototype.renderInner.call(this,t,n,r,i,a,o,s);var l=this._controllerGroup,u=n.get(`pageIconSize`,!0),d=V(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new X({name:`pageText`,style:{text:`xx/xx`,fill:f.getTextColor(),font:f.getFont(),verticalAlign:`middle`,align:`center`},silent:!0})),p(`pageNext`,1);function p(e,t){var r=e+`DataIndex`,a=_m(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:B(c._pageGo,c,r,n,i)},{x:-d[0]/2,y:-d[1]/2,width:d[0],height:d[1]});a.name=e,l.add(a)}},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getSelectorGroup(),s=e.getOrient().index,c=SF[s],l=CF[s],u=SF[1-s],d=CF[1-s];i&&zg(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=it(n);i&&(h[c]=n[c]-p[c]-f);var g=this._layoutContentAndController(e,r,h,s,c,u,d,l);if(i){if(a===`end`)m[s]+=g[c]+f;else{var _=p[c]+f;m[s]-=_,g[l]-=_}g[c]+=p[c]+f,m[1-s]+=g[d]+g[u]/2-p[u]/2,g[u]=Math.max(g[u],p[u]),g[d]=Math.min(g[d],p[d]+m[1-s]),o.x=m[0],o.y=m[1],o.markRedraw()}return g},t.prototype._layoutContentAndController=function(e,t,n,r,i,a,o,s){var c=this.getContentGroup(),l=this._containerGroup,u=this._controllerGroup;zg(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),zg(`horizontal`,u,e.get(`pageButtonItemGap`,!0));var d=c.getBoundingRect(),f=u.getBoundingRect(),p=this._showController=d[i]>n[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=G(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new Vu({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&zp(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;R([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,U(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=SF[i],o=CF[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=u?1:0,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i<g.i&&(g=h,f.pagePrevDataIndex??=h.i,++f.pageCount,++f.pageIndex),h=_;return f;function v(e){if(e){var t=e.getBoundingRect(),n=t[o]+e[o];return{s:n,e:n+t[a],i:e.__legendDataIndex}}}function y(e,t){return e.e>=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(sF);function TF(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function EF(e){BE(vF),e.registerComponentModel(yF),e.registerComponentView(wF),TF(e)}function DF(e){BE(vF),BE(EF)}I();var OF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=mh(lP.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(lP),kF=mc();function AF(e,t,n){kF(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function jF(e,t){for(var n=kF(e).coordSysRecordMap,r=n.keys(),i=0;i<r.length;i++){var a=r[i],o=n.get(a),s=o.dataZoomInfoMap;if(s){var c=t.uid;s.get(c)&&(s.removeKey(c),s.keys().length||MF(n,o))}}}function MF(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function NF(e,t){var n={model:t,containsPoint:vt(FF,t),dispatchAction:vt(PF,e),dataZoomInfoMap:null,controller:null},r=n.controller=new iM(e.getZr());return R([`pan`,`zoom`,`scrollMove`],function(e){r.on(e,function(t){var r=[];n.dataZoomInfoMap.each(function(i){if(t.isAvailableBehavior(i.model.option)){var a=(i.getRange||{})[e],o=a&&a(i.dzReferCoordSysInfo,n.model.mainType,n.controller,t);!i.model.get(`disabled`,!0)&&o&&r.push({dataZoomId:i.model.id,start:o[0],end:o[1]})}}),r.length&&n.dispatchAction(r)})}),n}function PF(e,t){e.isDisposed()||e.dispatchAction({type:`dataZoom`,animation:{easing:`cubicOut`,duration:100},batch:t})}function FF(e,t,n,r){return e.coordinateSystem.containPoint([n,r])}function IF(e,t,n){var r,i=`type_`,a={type_true:2,type_move:1,type_false:0,type_undefined:-1},o=!0;return e.each(function(e){var t=e.model,n=t.get(`disabled`,!0)?!1:t.get(`zoomLock`,!0)?`move`:!0;a[i+n]>a[i+r]&&(r=n),o&&=t.get(`preventDefaultMouseMove`,!0)}),{controlType:r,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:n,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint}}}}function LF(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,function(e,t){var n=kF(t),r=n.coordSysRecordMap||=K();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){R(sP(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,NF(t,n.model));(a.dataZoomInfoMap||=K()).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var n=e.controller,i,a=e.dataZoomInfoMap;if(a){var o=a.keys()[0];o!=null&&(i=a.get(o))}if(!i){MF(r,e);return}var s=IF(a,e,t);n.enable(s.controlType,s.opt),Ob(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)})})}I();var RF=function(e){D(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){if(e.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),AF(r,t,{pan:B(zF.pan,this),zoom:B(zF.zoom,this),scrollMove:B(zF.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){jF(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(dP),zF={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=VF[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(mM(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:BF(function(e,t,n,r,i,a){var o=VF[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:BF(function(e,t,n,r,i,a){return VF[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function BF(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(mM(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var VF={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function HF(e){yP(e),e.registerComponentModel(OF),e.registerComponentView(RF),LF(e)}I();var UF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=mh(lP.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:Z.color.accent10,borderRadius:0,backgroundColor:Z.color.transparent,dataBackground:{lineStyle:{color:Z.color.accent30,width:.5},areaStyle:{color:Z.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:Z.color.accent40,width:.5},areaStyle:{color:Z.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:Z.color.neutral00,borderColor:Z.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:Z.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:Z.color.tertiary},brushSelect:!0,brushStyle:{color:Z.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:Z.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(lP);I();var WF=Vu,GF=1,KF=30,qF=7,JF=`horizontal`,YF=`vertical`,XF=5,ZF=[`line`,`bar`,`candlestick`,`scatter`],QF={easing:`cubicOut`,duration:100,delay:0},$F=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=B(this._onBrush,this),this._onBrushEnd=B(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){if(e.prototype.render.apply(this,arguments),Ob(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!==`dataZoom`||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){kb(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new Wo;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?qF:0,r=Gg(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===JF?{right:r.width-i.x-i.width,top:r.height-KF-a-n,width:i.width,height:KF}:{right:a,top:i.y,width:KF,height:i.height},s=Yg(e.option);R([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=Ug(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===YF&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===JF&&!i?{scaleY:o?1:-1,scaleX:1}:n===JF&&i?{scaleY:o?1:-1,scaleX:-1}:n===YF&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]);e.x=t.x-s.x,e.y=t.y-s.y,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new WF({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new WF({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:B(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b){v||(y+=g);return}y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:fs(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new Wo,r=new lp({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new dp({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){R(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&<(ZF,e.get(`type`))<0)){var o=r.getComponent(aP(i),a).axis,s=eI(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new WF({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new WF({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:GF,fill:Z.color.transparent}})),R([0,1],function(t){var a=o.get(`handleIcon`);!Cx[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=Dx(a,-1,0,2,2,null,!0);s.attr({cursor:tI(this._orient),draggable:!0,drift:B(this._onDragMove,this,t),ondragend:B(this._onDragEnd,this),onmouseover:B(this._showDataInfo,this,!0),onmouseout:B(this._showDataInfo,this,!1),z2:5});var c=s.getBoundingRect();this._handleHeight=ps(o.get(`handleSize`),this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),tf(s);var l=o.get(`handleColor`);l!=null&&(s.style.fill=l),i.add(n[t]=s);var u=o.getModel(`textStyle`),d=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new X({silent:!0,invisible:!d,style:Vm(u,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:u.getTextColor(),font:u.getFont()}),z2:10}))},this);var d=u;if(l){var f=ps(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new Vu({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=Dx(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,Z.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new Vu({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`default`,drift:B(this._onDragMove,this,`all`),ondragstart:B(this._showDataInfo,this,!0),ondragend:B(this._onDragEnd,this),onmouseover:B(this._showDataInfo,this,!0),onmouseout:B(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[fs(e[0],[0,100],t,!0),fs(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];mM(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:fs(a.minSpan,o,i,!0),a.maxSpan==null?null:fs(a.maxSpan,o,i,!0));var s=this._range,c=this._range=_s([fs(r[0],i,o,!0),fs(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=_s(n.slice()),i=this._size;R([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;c<o.length;c++){var l=o[c],u=l.getClipPath();u||(u=new Vu,l.setClipPath(u)),u.setShape({x:s[c],y:0,width:s[c+1]-s[c],height:i[1]})}this._updateDataInfo(e)},t.prototype._updateDataInfo=function(e){var t=this.dataZoomModel,n=this._displayables,r=n.handleLabels,i=this._orient,a=[``,``];if(t.get(`showDetail`)){var o=t.findRepresentativeAxisProxy();if(o){var s=o.getAxisModel().axis,c=this._range,l=e?o.calculateDataWindow({start:c[0],end:c[1]}).valueWindow:o.getDataValueWindow();a=[this._formatLabel(l[0],s),this._formatLabel(l[1],s)]}}var u=_s(this._handleEnds.slice());d.call(this,0),d.call(this,1);function d(e){var t=lm(n.handles[e].parent,this.group),o=dm(e===0?`right`:`left`,t),s=this._handleWidth/2+XF,c=um([u[e]+(e===0?-s:s),this._size[1]/2],t);r[e].setStyle({x:c[0],y:c[1],verticalAlign:i===JF?`middle`:o,align:i===JF?o:`center`,text:a[e]})}},t.prototype._formatLabel=function(e,t){var n=this.dataZoomModel,r=n.get(`labelFormatter`),i=n.get(`labelPrecision`);(i==null||i===`auto`)&&(i=t.getPixelPrecision());var a=e==null||isNaN(e)?``:t.type===`category`||t.type===`time`?t.scale.getLabel({value:Math.round(e)}):e.toFixed(Math.min(i,20));return H(r)?r(e,a):U(r)?r.replace(`{value}`,a):a},t.prototype._showDataInfo=function(e){var t=(this.dataZoomModel.get(`handleLabel`)||{}).show||!1,n=this.dataZoomModel.getModel([`emphasis`,`handleLabel`]).get(`show`)||!1,r=e||this._dragging?n:t,i=this._displayables,a=i.handleLabels;a[0].attr(`invisible`,!r),a[1].attr(`invisible`,!r),i.moveHandle&&this.api[r?`enterEmphasis`:`leaveEmphasis`](i.moveHandle,1)},t.prototype._onDragMove=function(e,t,n,r){this._dragging=!0,qn(r.event);var i=this._displayables.sliderGroup.getLocalTransform(),a=um([t,n],i,!0),o=this._updateInterval(e,a[0]),s=this.dataZoomModel.get(`realtime`);this._updateView(!s),o&&s&&this._dispatchZoomAction(!0)},t.prototype._onDragEnd=function(){this._dragging=!1,this._showDataInfo(!1),!this.dataZoomModel.get(`realtime`)&&this._dispatchZoomAction(!1)},t.prototype._onClickPanel=function(e){var t=this._size,n=this._displayables.sliderGroup.transformCoordToLocal(e.offsetX,e.offsetY);if(!(n[0]<0||n[0]>t[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new lr(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();mM(0,a,r,0,o.minSpan==null?null:fs(o.minSpan,i,r,!0),o.maxSpan==null?null:fs(o.maxSpan,i,r,!0)),this._range=_s([fs(a[0],r,i,!0),fs(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(qn(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new WF({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?QF:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=sP(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(dP);function eI(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function tI(e){return e===`vertical`?`ns-resize`:`ew-resize`}function nI(e){e.registerComponentModel(UF),e.registerComponentView($F),yP(e)}function rI(e){BE(HF),BE(nI)}I();function iI(e,t,n){var r=Ve.createCanvas(),i=t.getWidth(),a=t.getHeight(),o=r.style;return o&&(o.position=`absolute`,o.left=`0`,o.top=`0`,o.width=i+`px`,o.height=a+`px`,r.setAttribute(`data-zr-dom-id`,e)),r.width=i*n,r.height=a*n,r}var aI=function(e){D(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.incremental=!1,i.zlevel=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__used=!1,i.__drawIndex=0,i.__startIndex=0,i.__endIndex=0,i.__prevStartIndex=null,i.__prevEndIndex=null;var a;r||=eo,typeof t==`string`?a=iI(t,n,r):W(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(Ut(a),a.onselectstart=function(){return!1},o.padding=`0`,o.margin=`0`,o.borderWidth=`0`),i.painter=n,i.dpr=r,i}return t.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},t.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},t.prototype.initContext=function(){this.ctx=this.dom.getContext(`2d`),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=iI(`back-`+this.id,this.painter,e),this.ctxBack=this.domBack.getContext(`2d`),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,t,n,r){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var i=[],a=this.maxRepaintRectCount,o=!1,s=new J(0,0,0,0);function c(e){if(!(!e.isFinite()||e.isZero()))if(i.length===0){var t=new J(0,0,0,0);t.copy(e),i.push(t)}else{for(var n=!1,r=1/0,c=0,l=0;l<i.length;++l){var u=i[l];if(u.intersect(e)){var d=new J(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}else if(o){s.copy(e),s.union(u);var f=e.width*e.height,p=u.width*u.height,m=s.width*s.height-f-p;m<r&&(r=m,c=l)}}if(o&&(i[c].union(e),n=!0),!n){var t=new J(0,0,0,0);t.copy(e),i.push(t)}o||=i.length>=a}}for(var l=this.__startIndex;l<this.__endIndex;++l){var u=e[l];if(u){var d=u.shouldBePainted(n,r,!0,!0),f=u.__isRendered&&(u.__dirty&1||!d)?u.getPrevPaintRect():null;f&&c(f);var p=d&&(u.__dirty&1||!u.__isRendered)?u.getPaintRect():null;p&&c(p)}}for(var l=this.__prevStartIndex;l<this.__prevEndIndex;++l){var u=t[l],d=u&&u.shouldBePainted(n,r,!0,!0);if(u&&(!d||!u.__zr)&&u.__isRendered){var f=u.getPrevPaintRect();f&&c(f)}}var m;do{m=!1;for(var l=0;l<i.length;){if(i[l].isZero()){i.splice(l,1);continue}for(var h=l+1;h<i.length;)i[l].intersect(i[h])?(m=!0,i[l].union(i[h]),i.splice(h,1)):h++;l++}}while(m);return this._paintRects=i,i},t.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},t.prototype.resize=function(e,t){var n=this.dpr,r=this.dom,i=r.style,a=this.domBack;i&&(i.width=e+`px`,i.height=t+`px`),r.width=e*n,r.height=t*n,a&&(a.width=e*n,a.height=t*n,n!==1&&this.ctxBack.scale(n,n))},t.prototype.clear=function(e,t,n){var r=this.dom,i=this.ctx,a=r.width,o=r.height;t||=this.clearColor;var s=this.motionBlur&&!e,c=this.lastFrameAlpha,l=this.dpr,u=this;s&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation=`copy`,this.ctxBack.drawImage(r,0,0,a/l,o/l));var d=this.domBack;function f(e,n,r,a){if(i.clearRect(e,n,r,a),t&&t!==`transparent`){var o=void 0;wt(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||Nx(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):Tt(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=Gx(i,t,{dirty:function(){u.setUnpainted(),u.painter.refresh()}})),i.save(),i.fillStyle=o||t,i.fillRect(e,n,r,a),i.restore()}s&&(i.save(),i.globalAlpha=c,i.drawImage(d,e,n,r,a),i.restore())}!n||s?f(0,0,a,o):n.length&&R(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(Sn),oI=1e5,sI=314159,cI=.01,lI=.001;function uI(e){return e?e.__builtin__?!0:!(typeof e.resize!=`function`||typeof e.refresh!=`function`):!1}function dI(e,t){var n=document.createElement(`div`);return n.style.cssText=[`position:relative`,`width:`+e+`px`,`height:`+t+`px`,`padding:0`,`margin:0`,`border-width:0`].join(`;`)+`;`,n}var fI=function(){function e(e,t,n,r){this.type=`canvas`,this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type=`canvas`;var i=!e.nodeName||e.nodeName.toUpperCase()===`CANVAS`;this._opts=n=L({},n||{}),this.dpr=n.devicePixelRatio||eo,this._singleCanvas=i,this.root=e,e.style&&(Ut(e),e.innerHTML=``),this.storage=t;var a=this._zlevelList;this._prevDisplayList=[];var o=this._layers;if(i){var s=e,c=s.width,l=s.height;n.width!=null&&(c=n.width),n.height!=null&&(l=n.height),this.dpr=n.devicePixelRatio||1,s.width=c*this.dpr,s.height=l*this.dpr,this._width=c,this._height=l;var u=new aI(s,this,this.dpr);u.__builtin__=!0,u.initContext(),o[sI]=u,u.zlevel=sI,a.push(sI),this._domRoot=e}else{this._width=Ix(e,0,n),this._height=Ix(e,1,n);var d=this._domRoot=dI(this._width,this._height);e.appendChild(d)}}return e.prototype.getType=function(){return`canvas`},e.prototype.isSingleCanvas=function(){return this._singleCanvas},e.prototype.getViewportRoot=function(){return this._domRoot},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.refresh=function(e){var t=this.storage.getDisplayList(!0),n=this._prevDisplayList,r=this._zlevelList;this._redrawId=Math.random(),this._paintList(t,n,e,this._redrawId);for(var i=0;i<r.length;i++){var a=r[i],o=this._layers[a];if(!o.__builtin__&&o.refresh){var s=i===0?this._backgroundColor:null;o.refresh(s)}}return this._opts.useDirtyRect&&(this._prevDisplayList=t.slice()),this},e.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},e.prototype._paintHoverList=function(e){var t=e.length,n=this._hoverlayer;if(n&&n.clear(),t){for(var r={inHover:!0,viewWidth:this._width,viewHeight:this._height},i,a=0;a<t;a++){var o=e[a];o.__inHover&&(n||=this._hoverlayer=this.getLayer(oI),i||(i=n.ctx,i.save()),dS(i,o,r,a===t-1))}i&&i.restore()}},e.prototype.getHoverLayer=function(){return this.getLayer(oI)},e.prototype.paintOne=function(e,t){uS(e,t)},e.prototype._paintList=function(e,t,n,r){if(this._redrawId===r){n||=!1,this._updateLayerStatus(e);var i=this._doPaintList(e,t,n),a=i.finished,o=i.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),o&&this._paintHoverList(e),a)this.eachLayer(function(e){e.afterBrush&&e.afterBrush()});else{var s=this;Qr(function(){s._paintList(e,t,n,r)})}}},e.prototype._compositeManually=function(){var e=this.getLayer(sI).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),this.eachBuiltinLayer(function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)})},e.prototype._doPaintList=function(e,t,n){for(var r=this,i=[],a=this._opts.useDirtyRect,o=0;o<this._zlevelList.length;o++){var s=this._zlevelList[o],c=this._layers[s];c.__builtin__&&c!==this._hoverlayer&&(c.__dirty||n)&&i.push(c)}for(var l=!0,u=!1,d=function(o){var s=i[o],c=s.ctx,d=a&&s.createRepaintRects(e,t,f._width,f._height),p=n?s.__startIndex:s.__drawIndex,m=!n&&s.incremental&&Date.now,h=m&&Date.now(),g=s.zlevel===f._zlevelList[0]?f._backgroundColor:null;if(s.__startIndex===s.__endIndex)s.clear(!1,g,d);else if(p===s.__startIndex){var _=e[p];(!_.incremental||!_.notClear||n)&&s.clear(!1,g,d)}p===-1&&(console.error(`For some unknown reason. drawIndex is -1`),p=s.__startIndex);var v,y=function(t){var n={inHover:!1,allClipped:!1,prevEl:null,viewWidth:r._width,viewHeight:r._height};for(v=p;v<s.__endIndex;v++){var i=e[v];if(i.__inHover&&(u=!0),r._doPaintEl(i,s,a,t,n,v===s.__endIndex-1),m&&Date.now()-h>15)break}n.prevElClipPaths&&c.restore()};if(d)if(d.length===0)v=s.__endIndex;else for(var b=f.dpr,x=0;x<d.length;++x){var S=d[x];c.save(),c.beginPath(),c.rect(S.x*b,S.y*b,S.width*b,S.height*b),c.clip(),y(S),c.restore()}else c.save(),y(),c.restore();s.__drawIndex=v,s.__drawIndex<s.__endIndex&&(l=!1)},f=this,p=0;p<i.length;p++)d(p);return Ne.wxa&&R(this._layers,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),{finished:l,needsRefreshHover:u}},e.prototype._doPaintEl=function(e,t,n,r,i,a){var o=t.ctx;if(n){var s=e.getPaintRect();(!r||s&&s.intersect(r))&&(dS(o,e,i,a),e.setPrevPaintRect(s))}else dS(o,e,i,a)},e.prototype.getLayer=function(e,t){this._singleCanvas&&!this._needsManuallyCompositing&&(e=sI);var n=this._layers[e];return n||(n=new aI(`zr_`+e,this,this.dpr),n.zlevel=e,n.__builtin__=!0,this._layerConfig[e]?at(n,this._layerConfig[e],!0):this._layerConfig[e-cI]&&at(n,this._layerConfig[e-cI],!0),t&&(n.virtual=t),this.insertLayer(e,n),n.initContext()),n},e.prototype.insertLayer=function(e,t){var n=this._layers,r=this._zlevelList,i=r.length,a=this._domRoot,o=null,s=-1;if(!n[e]&&uI(t)){if(i>0&&e>r[0]){for(s=0;s<i-1&&!(r[s]<e&&r[s+1]>e);s++);o=n[r[s]]}if(r.splice(s+1,0,e),n[e]=t,!t.virtual)if(o){var c=o.dom;c.nextSibling?a.insertBefore(t.dom,c.nextSibling):a.appendChild(t.dom)}else a.firstChild?a.insertBefore(t.dom,a.firstChild):a.appendChild(t.dom);t.painter||=this}},e.prototype.eachLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r];e.call(t,this._layers[i],i)}},e.prototype.eachBuiltinLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r],a=this._layers[i];a.__builtin__&&e.call(t,a,i)}},e.prototype.eachOtherLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r],a=this._layers[i];a.__builtin__||e.call(t,a,i)}},e.prototype.getLayers=function(){return this._layers},e.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(e,t){e.__dirty=e.__used=!1});function t(e){i&&(i.__endIndex!==e&&(i.__dirty=!0),i.__endIndex=e)}if(this._singleCanvas)for(var n=1;n<e.length;n++){var r=e[n];if(r.zlevel!==e[n-1].zlevel||r.incremental){this._needsManuallyCompositing=!0;break}}var i=null,a=0,o,s;for(s=0;s<e.length;s++){var r=e[s],c=r.zlevel,l=void 0;o!==c&&(o=c,a=0),r.incremental?(l=this.getLayer(c+lI,this._needsManuallyCompositing),l.incremental=!0,a=1):l=this.getLayer(c+(a>0?cI:0),this._needsManuallyCompositing),l.__builtin__||rt(`ZLevel `+c+` has been used by unkown layer `+l.id),l!==i&&(l.__used=!0,l.__startIndex!==s&&(l.__dirty=!0),l.__startIndex=s,l.incremental?l.__drawIndex=-1:l.__drawIndex=s,t(s),i=l),r.__dirty&1&&!r.__inHover&&(l.__dirty=!0,l.incremental&&l.__drawIndex<0&&(l.__drawIndex=s))}t(s),this.eachBuiltinLayer(function(e,t){!e.__used&&e.getElementCount()>0&&(e.__dirty=!0,e.__startIndex=e.__endIndex=e.__drawIndex=0),e.__dirty&&e.__drawIndex<0&&(e.__drawIndex=e.__startIndex)})},e.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},e.prototype._clearLayer=function(e){e.clear()},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,R(this._layers,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?at(n[e],t,!0):n[e]=t;for(var r=0;r<this._zlevelList.length;r++){var i=this._zlevelList[r];if(i===e||i===e+cI){var a=this._layers[i];at(a,n[e],!0)}}}},e.prototype.delLayer=function(e){var t=this._layers,n=this._zlevelList,r=t[e];r&&(r.dom.parentNode.removeChild(r.dom),delete t[e],n.splice(lt(n,e),1))},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;if(e!=null&&(r.width=e),t!=null&&(r.height=t),e=Ix(i,0,r),t=Ix(i,1,r),n.style.display=``,this._width!==e||t!==this._height){for(var a in n.style.width=e+`px`,n.style.height=t+`px`,this._layers)this._layers.hasOwnProperty(a)&&this._layers[a].resize(e,t);this.refresh(!0)}this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this.getLayer(sI).resize(e,t)}return this},e.prototype.clearLayer=function(e){var t=this._layers[e];t&&t.clear()},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._layers=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._layers[sI].dom;var t=new aI(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;this.eachLayer(function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height},o=this.storage.getDisplayList(!0),s=0,c=o.length;s<c;s++){var l=o[s];dS(n,l,a,s===c-1)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}();function pI(e){e.registerPainter(`canvas`,fI)}function mI(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}var hI=[`#6366f1`,`#f59e0b`,`#10b981`,`#ef4444`,`#8b5cf6`,`#ec4899`,`#06b6d4`,`#f97316`,`#14b8a6`,`#a855f7`,`#84cc16`,`#e879f9`,`#22d3ee`,`#fb923c`,`#34d399`,`#c084fc`,`#fbbf24`,`#2dd4bf`,`#f472b6`,`#a3e635`],gI={"gpt-5.4":`#f472b6`,"gpt-5-mini":`#fb7185`,"gpt-5.4-mini":`#fb7185`,"gpt-5-nano":`#fda4af`,"gpt-5.4-nano":`#fda4af`,"gpt-5.3-codex":`#f59e0b`,"gpt-5.3-codex-spark":`#fbbf24`,"gpt-5.2-codex":`#6366f1`,"gpt-5.2":`#818cf8`,"gpt-5.1-codex-mini":`#a78bfa`,"gpt-4.1":`#06b6d4`,"gpt-4.1-mini":`#14b8a6`,"gpt-4.1-nano":`#2dd4bf`,o3:`#a855f7`,"o3-mini":`#c084fc`,"o4-mini":`#e879f9`,"gpt-4o":`#ec4899`,"gpt-4o-mini":`#22d3ee`,"gpt-4-turbo":`#ef4444`,"gpt-4":`#f97316`,"gpt-3.5-turbo":`#84cc16`,unknown:`#475569`},_I={review:`#06b6d4`,exploration:`#f97316`,planning:`#eab308`,memory:`#ec4899`,generic:`#64748b`},vI={low:`#10b981`,medium:`#06b6d4`,high:`#f59e0b`,xhigh:`#a855f7`,"x-high":`#a855f7`,unknown:`#64748b`};function yI(e){if(!e)return`unknown`;let t=String(e).toLowerCase().trim().replace(/-/g,``);return t===`low`?`low`:t===`medium`?`medium`:t===`high`?`high`:t===`xhigh`?`xhigh`:t===`unknown`?`unknown`:t}function bI(e){return hI[mI(e)%hI.length]}function xI(e){let t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return`#ffffff`;let n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,i=parseInt(t[3],16)/255;return .2126*n+.7152*r+.0722*i>.5?`#1f2937`:`#ffffff`}function SI(e,t,n){t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o=0,s=0,c=0;e<60?(o=r,s=i):e<120?(o=i,s=r):e<180?(s=r,c=i):e<240?(s=i,c=r):e<300?(o=i,c=r):(o=r,c=i);let l=e=>Math.round((e+a)*255).toString(16).padStart(2,`0`);return`#`+l(o)+l(s)+l(c)}function CI(e){return gI[e]?gI[e]:SI(mI(e)%300,72,62)}function wI(e){return _I[e]||`#64748b`}function TI(e){return vI[yI(e)]??`#64748b`}function EI(e){if(e==null||!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e9?DI(e,1e9,`B`):t>=1e6?DI(e,1e6,`M`):t>=1e3?DI(e,1e3,`K`):Math.round(e).toLocaleString()}function DI(e,t,n){let r=e/t,i=Math.abs(r)>=100?0:1;return`${r.toFixed(i)}${n}`}var OI=`auto`,kI={speed:1,live:{frameIntervalMs:33,overviewHz:20,dayKeysPerEmit:1},main:{presentationDurationMs:220,chartAppearDurationMs:0,chartUpdateDurationMs:200,easing:`linear`,easingUpdate:`linear`},tail:{enabled:!0,startPercent:.5,durationMs:OI,durationScale:10,easing:`cubicOut`,overviewHz:10},daily:{chartAppearDurationMs:OI,chartUpdateDurationMs:60,easing:OI,easingUpdate:OI},bars:{chartAppearDurationMs:OI,chartUpdateDurationMs:20,easing:OI,easingUpdate:OI},donuts:{chartAppearDurationMs:OI,chartUpdateDurationMs:OI,easing:OI,easingUpdate:`linear`,seriesAnimation:!1},heatmap:{popDurationMs:380,settleThreshold:.998,intensityRiseThreshold:.08,whiteThreshold:.88,nearMaxRatio:.985},videoExport:{width:1080,height:864,fps:60,frontloadSettledFrameCount:1,introFadeEnabled:!0,introFadeStartOpacity:.95,introContentStartOpacity:.05,introFadeDurationMs:400,introFadeDelayMs:0,introFadeEasing:`cubicOut`,startHoldDurationMs:100,replayDurationMs:1e4,tailDurationMs:5e3,replayEasing:`cubicInOut`,tailSourceFraction:.55,tailEasing:`cubicOut`,finalHoldDurationMs:5e3,finalFlashDurationMs:1e3,finalFlashMaxOpacity:.35,displayTweenStartMs:200,displayTweenBaseMs:240,displayTweenLateMs:420,displayTweenLateWindowMs:2200,chartIntroWindowMs:2200,barsChartIntroUpdateDurationMs:320,barsChartUpdateDurationMs:50,barsChartTailUpdateDurationMs:240,donutsChartIntroUpdateDurationMs:360,donutsChartUpdateDurationMs:50,donutsChartTailUpdateDurationMs:240,supersampleScale:2,captureFormat:`png`,jpegQuality:92,crf:5,encoderPreset:`veryfast`}},AI={animationDuration:750,animationDurationUpdate:220,animationEasing:`cubicOut`,animationEasingUpdate:`cubicOut`},jI={show:!0,animationDuration:250,animationDurationUpdate:220,animationDelay:250,animationDelayUpdate:180,animationEasing:`cubicOut`,animationEasingUpdate:`cubicOut`},MI={...AI,animationDurationUpdate:200,animationDelayUpdate:0,animationEasingUpdate:`cubicOut`},NI={animationDuration:700,animationDurationUpdate:220,animationDelay:250,animationDelayUpdate:140,animationEasing:`cubicOut`,animationEasingUpdate:`cubicOut`},PI={...jI,animationDelay:950,animationDelayUpdate:360};function FI(e){return Number.isFinite(e)&&e>0?e:1}function II(e){return Math.max(0,Math.round(e/FI(kI.speed)))}function LI(e,t){return e===`auto`?II(t):e}function RI(e,t){return e===`auto`?t:e}function zI(e){return{animation:!0,animationDuration:LI(e.chartAppearDurationMs,kI.main.chartAppearDurationMs),animationDurationUpdate:LI(e.chartUpdateDurationMs,kI.main.chartUpdateDurationMs),animationEasing:RI(e.easing,kI.main.easing),animationEasingUpdate:RI(e.easingUpdate,kI.main.easingUpdate)}}var BI=II(kI.main.presentationDurationMs);function VI(e=0,t=!1){let n=BI,r=kI.tail;if(!t||!r?.enabled)return n;let i=Math.min(Math.max(r.startPercent??.9,0),.999),a=Math.min(Math.max(e||0,0),1);if(a<=i)return n;let o=(a-i)/Math.max(1-i,.001),s=r.durationMs===`auto`?Math.round(n*Math.max(r.durationScale||1,1)):r.durationMs;return Math.round(n+(s-n)*JI(o))}function HI(e=0,t=!1){let n=kI.tail;if(!t||!n?.enabled)return`linear`;let r=Math.min(Math.max(n.startPercent??.9,0),.999);return Math.min(Math.max(e||0,0),1)<=r?`linear`:n.easing||`cubicOut`}function UI(e=0,t=!1){let n=kI.tail;if(!t||!n?.enabled)return!1;let r=Math.min(Math.max(n.startPercent??.9,0),.999);return Math.min(Math.max(e||0,0),1)>r}zI({chartAppearDurationMs:OI,chartUpdateDurationMs:OI,easing:OI,easingUpdate:OI});var WI=zI(kI.daily),GI=zI(kI.bars),KI=zI(kI.donuts),qI=kI.donuts.seriesAnimation;function JI(e){return 1-(1-Math.min(Math.max(e,0),1))**3}function YI(e,t,n){return e+(t-e)*n}function XI(e){return Number.isFinite(e)?e:0}function ZI(e,t){return Array.isArray(e?.data)?e.data:Array.isArray(e)?e:e?.data?.[t]||e?.data?.total||[]}function QI(e,t){return t?.length?e===`d7`?t.slice(-7):e===`d30`?t.slice(-30):t:[]}function $I(e,t,n){return e.map(e=>({key:e?.[t]||``,label:e?.[n]||``,tokens:XI(e?.tokens)})).filter(e=>e.key)}function eL(e,t){let n=Array.isArray(e?.data)?e.data:Array.isArray(e)?e:[];if(!n.length)return{dates:[],series:[]};let r=QI(t,n.map(e=>e.date)),i=new Map(n.map(e=>[e.date,e])),a=new Set;for(let e of r){let t=i.get(e);for(let e of Object.keys(t?.by_model||{}))a.add(e)}return{dates:r,series:[...a].map(e=>({key:e,label:e,data:r.map(t=>XI(i.get(t)?.by_model?.[e]?.tokens))}))}}function tL(e){let t=e?.data&&typeof e.data==`object`?e.data:{},n={};for(let[e,r]of Object.entries(t))n[e]={tokens:XI(r?.tokens),elapsed:XI(r?.elapsed),cost:XI(r?.cost)};return n}function nL({overview:e,heatmap:t,daily:n,families:r,repos:i,models:a,range:o}){let s=e?.data;if(!s)return{ready:!0,stats:{tokens:0,elapsed:0,cost:0,sessions:0,enriched:0,priced:0,exactPriced:0,fallbackPriced:0,unpriced:0,days:1},topRepos:[],topFamilies:[],topModels:[],daily:{dates:[],series:[]},heatmap:{}};let c=s?.[o]||s?.total||{},l=c.coverage||{},u=XI(l.thread_rows??l.total),d=XI(l.root_sessions??c.total_sessions),f=XI(l.priced),p=XI(l.priced_exact),m=XI(l.priced_fallback),h=XI(l.unpriced??Math.max(u-f,0)),g=c.date_range,_=g?.from!=null&&g?.to!=null?Math.max(1,Math.ceil((g.to-g.from)/86400)):1;return{ready:!0,stats:{tokens:XI(c.total_tokens),elapsed:XI(c.total_elapsed_seconds),cost:XI(c.total_cost),sessions:d,enriched:XI(l.enriched),priced:f,exactPriced:p,fallbackPriced:m,unpriced:h,days:_},topRepos:$I(ZI(i,o).slice(0,6),`repo_label`,`repo_label`),topFamilies:$I(ZI(r,o),`family`,`family`),topModels:$I(ZI(a,o).slice(0,6),`model_name`,`model_name`),daily:eL(n,o),heatmap:tL(t)}}function rL(e,t,n){let r=new Map((e||[]).map(e=>[e.key,e])),i=new Map((t||[]).map(e=>[e.key,e])),a=[],o=new Set;for(let e of t||[])o.has(e.key)||(o.add(e.key),a.push(e.key));for(let t of e||[])o.has(t.key)||(o.add(t.key),a.push(t.key));let s=[];for(let e of a){let t=r.get(e),a=i.get(e),o=a?.label||t?.label||e,c=YI(XI(t?.tokens),XI(a?.tokens),n);c<=.001&&!a||s.push({key:e,label:o,tokens:c})}return s}function iL(e,t,n){let r=(t?.dates?.length?t.dates:e?.dates||[]).slice(),i=new Map((e?.series||[]).map(e=>[e.key,e])),a=new Map((t?.series||[]).map(e=>[e.key,e])),o=new Set([...i.keys(),...a.keys()]),s=[];for(let c of o){let o=i.get(c),l=a.get(c),u=new Map((o?.data||[]).map((t,n)=>[e?.dates?.[n],t])),d=new Map((l?.data||[]).map((e,n)=>[t?.dates?.[n],e])),f=r.map(e=>YI(XI(u.get(e)),XI(d.get(e)),n));f.every(e=>e<=.001)&&!l||s.push({key:c,label:l?.label||o?.label||c,data:f})}return{dates:r,series:s}}function aL(e){return{dates:e.dates,series:(e.series||[]).map(e=>({key:e.key,label:e.label,data:e.data.map(()=>0)}))}}function oL(e,t,n){let r=new Set([...Object.keys(e||{}),...Object.keys(t||{})]),i={};for(let a of r){let r=e?.[a],o=t?.[a];i[a]={tokens:YI(XI(r?.tokens),XI(o?.tokens),n),elapsed:YI(XI(r?.elapsed),XI(o?.elapsed),n),cost:YI(XI(r?.cost),XI(o?.cost),n)}}return i}function sL(e,t,n){return{ready:t.ready,stats:{tokens:YI(XI(e?.stats?.tokens),XI(t?.stats?.tokens),n),elapsed:YI(XI(e?.stats?.elapsed),XI(t?.stats?.elapsed),n),cost:YI(XI(e?.stats?.cost),XI(t?.stats?.cost),n),sessions:YI(XI(e?.stats?.sessions),XI(t?.stats?.sessions),n),enriched:YI(XI(e?.stats?.enriched),XI(t?.stats?.enriched),n),priced:YI(XI(e?.stats?.priced),XI(t?.stats?.priced),n),exactPriced:YI(XI(e?.stats?.exactPriced),XI(t?.stats?.exactPriced),n),fallbackPriced:YI(XI(e?.stats?.fallbackPriced),XI(t?.stats?.fallbackPriced),n),unpriced:YI(XI(e?.stats?.unpriced),XI(t?.stats?.unpriced),n),days:XI(t?.stats?.days)||1},topRepos:rL(e?.topRepos,t?.topRepos,n),topFamilies:rL(e?.topFamilies,t?.topFamilies,n),topModels:rL(e?.topModels,t?.topModels,n),daily:iL(e?.daily,t?.daily,n),heatmap:oL(e?.heatmap,t?.heatmap,n)}}function cL(e,{duration:t=BI,onSettledChange:n,ingestProgress:r=0,isIngestActive:i=!1,clockNowMs:a=null}={}){let o=(0,b.useMemo)(()=>nL(e),[e.overview,e.heatmap,e.daily,e.families,e.repos,e.models,e.range]),[s,c]=(0,b.useState)(o),l=(0,b.useRef)(o),u=(0,b.useRef)(o),d=(0,b.useRef)(0),f=(0,b.useRef)(0),p=(0,b.useRef)(s),m=(0,b.useRef)(!0),h=(0,b.useRef)(n),g=(0,b.useRef)(0),_=(0,b.useRef)(o),v=(0,b.useRef)(o),y=(0,b.useRef)(`smooth`);(0,b.useEffect)(()=>{h.current=n},[n]);let x=e=>{m.current!==e&&(m.current=e,h.current?.(e))};(0,b.useEffect)(()=>{p.current=s},[s]);let S=e=>{l.current=e,u.current=e,p.current=e,c(e),x(!0),f.current=0,g.current=0,_.current=e,v.current=e},C=e=>{u.current=e,x(!1);let t=UI(r,i)?`tail`:`smooth`;y.current!==t&&(y.current=t,g.current=0),t===`tail`&&(_.current=l.current,v.current=e,g.current=0)},w=(e,n)=>{e<f.current&&(f.current=0,g.current=0,_.current=l.current,v.current=n),f.current||=e;let a=Math.max(1,e-f.current);f.current=e;let o=VI(r,i)||t,s=l.current,u=UI(r,i)?`tail`:`smooth`;y.current!==u&&(y.current=u,g.current=0);let d,m;if(u===`tail`){v.current!==n&&(_.current=s,v.current=n,g.current=e),g.current||=e;let t=Math.max(0,e-g.current),a=Math.min(1,t/Math.max(o,1)),c=lL(a,HI(r,i));d=sL(_.current,v.current,c),m=a>=1||uL(d,n)<=.002}else{let e=lL(1-Math.exp(-a/Math.max(o,1)),HI(r,i));d=sL(s,n,e),m=e>=.999||uL(d,n)<=.002}return l.current=d,m?(l.current=n,p.current=n,c(n),x(!0),g.current=0,_.current=n,v.current=n,n):(p.current=d,c(d),d)};return(0,b.useLayoutEffect)(()=>{if(a!=null){if(t<=0){S(o);return}C(o),w(a,o)}},[o,t,r,i,a]),(0,b.useEffect)(()=>{if(a!=null)return;if(u.current=o,t<=0){S(o);return}if(C(o),d.current)return;let e=t=>{if(w(t,u.current)===u.current&&m.current){d.current=0,f.current=0;return}d.current=requestAnimationFrame(e)};d.current=requestAnimationFrame(e)},[o,t,r,i,a]),(0,b.useEffect)(()=>()=>{d.current&&cancelAnimationFrame(d.current),d.current=0,f.current=0},[]),s}function lL(e,t){let n=Math.min(Math.max(e,0),1);return t===`cubicOut`?1-(1-n)**3:n}function uL(e,t){if(!e||!t)return 0;let n=Math.max(Math.abs((e.stats?.tokens||0)-(t.stats?.tokens||0)),Math.abs((e.stats?.elapsed||0)-(t.stats?.elapsed||0)),Math.abs((e.stats?.cost||0)-(t.stats?.cost||0)),Math.abs((e.stats?.sessions||0)-(t.stats?.sessions||0))),r=dL(e.topRepos,t.topRepos),i=dL(e.topFamilies,t.topFamilies),a=dL(e.topModels,t.topModels),o=fL(e.daily,t.daily);return Math.max(n,r,i,a,o)/Math.max(1,t.stats?.tokens||1)}function dL(e=[],t=[]){let n=new Map(e.map(e=>[e.key,e.tokens||0])),r=0;for(let e of t)r=Math.max(r,Math.abs((n.get(e.key)||0)-(e.tokens||0)));return r}function fL(e,t){let n=new Map((e?.series||[]).map(e=>[e.key,e])),r=0;for(let e of t?.series||[]){let t=n.get(e.key);for(let n=0;n<e.data.length;n+=1)r=Math.max(r,Math.abs((t?.data?.[n]||0)-(e.data[n]||0)))}return r}function pL(e,t){let n=new Map((e?.series||[]).map(e=>[e.key,e])),r=0;for(let e of t?.series||[]){let t=n.get(e.key);for(let n=0;n<(e.data?.length||0);n+=1)r=Math.max(r,Math.abs((t?.data?.[n]||0)-(e.data[n]||0)))}return r}function mL(e){let t=0;for(let n of e?.series||[])for(let e of n.data||[])t=Math.max(t,Math.abs(e||0));return t}function hL(e,t,n=``){let[r,i]=(0,b.useState)(e),a=(0,b.useRef)(e),o=(0,b.useRef)(e),s=(0,b.useRef)(0),c=(0,b.useRef)(0),l=(0,b.useRef)(n),u=(0,b.useRef)(t),d=t&&l.current!==n;return(0,b.useLayoutEffect)(()=>{o.current=e;let r=!u.current&&t;if(u.current=t,!t){s.current&&cancelAnimationFrame(s.current),s.current=0,c.current=0,a.current=e,l.current=n;return}if(l.current!==n){s.current&&cancelAnimationFrame(s.current),s.current=0,c.current=0;let t=aL(e);a.current=t,i(t),l.current=n;return}r&&(a.current=e,i(e))},[e,t,n]),(0,b.useEffect)(()=>{if(o.current=e,!t)return;let n=BI,r=e=>{let t=o.current;c.current||=e;let l=Math.max(1,e-c.current);c.current=e;let u=1-Math.exp(-l/Math.max(n,1)),d=iL(a.current,t,u);a.current=d,i(d);let f=Math.max(1,mL(t));if(pL(d,t)<=f*.002||u>=.999){a.current=t,i(t),s.current=0,c.current=0;return}s.current=requestAnimationFrame(r)};s.current||=(c.current=0,requestAnimationFrame(r))},[e,t,n]),(0,b.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current),s.current=0,c.current=0},[]),t?d?aL(e):r:e}var gL=s((e=>{var t=Symbol.for(`react.transitional.element`);function n(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.jsx=n,e.jsxs=n})),$=s(((e,t)=>{t.exports=gL()}))();BE([Uk,dA,LN,QP,tF,DF,pI]);function _L(e){return EI(e)}function vL(e){return e==null?`—`:e>=1e3?`$`+(e/1e3).toFixed(1)+`K`:`$`+e.toFixed(2)}function yL(e){return e?(e/3600).toFixed(1)+`h`:`0h`}function bL(e,t=16){if(!e)return``;let n=String(e).split(/([-/])/).filter(Boolean),r=[``];for(let e of n){let n=r[r.length-1];if(!n.length||(n+e).length<=t){r[r.length-1]=n+e;continue}if(r.length===2){r[1]+=e;break}r.push(e)}return r.join(`
|
|
28
|
-
`)}function xL(e){return e<=7?{barWidth:`72%`,barMaxWidth:28}:e<=30?{barWidth:`54%`,barMaxWidth:18}:{barWidth:null,barMaxWidth:12}}function SL(e){let t=Array.isArray(e?.data)?e.data:Array.isArray(e)?e:[];if(!t.length)return{dates:[],series:[]};let n=t.map(e=>e.date),r=new Map(t.map(e=>[e.date,e])),i=new Set;for(let e of t)for(let t of Object.keys(e?.by_model||{}))i.add(t);return{dates:n,series:[...i].map(e=>({key:e,label:e,data:n.map(t=>{let n=r.get(t)?.by_model?.[e]?.tokens;return Number.isFinite(n)?n:0})}))}}function CL(e,t){if(!t)return{startValue:0,endValue:0};let n=t;return e===`d7`&&(n=7),e===`d30`&&(n=30),{startValue:t-Math.max(1,Math.min(n,t)),endValue:t-1}}function wL(e,t,n,r,i){if(cancelAnimationFrame(r.current),r.current=0,Math.round(e.startValue)===Math.round(t.startValue)&&Math.round(e.endValue)===Math.round(t.endValue))return;let a=0,o=s=>{a||=s;let c=Math.min(1,(s-a)/i),l=1-(1-c)**3;n({startValue:Math.round(e.startValue+(t.startValue-e.startValue)*l),endValue:Math.round(e.endValue+(t.endValue-e.endValue)*l)}),r.current=c<1?requestAnimationFrame(o):0};return r.current=requestAnimationFrame(o),()=>{cancelAnimationFrame(r.current),r.current=0}}function TL(e,t){return e.map(e=>{let n=t(e.key);return{name:e.label,value:e.tokens,itemStyle:{color:n},label:{show:!0,color:n},labelLine:{show:!0}}})}function EL(e,t){return e.map(e=>({...e,tokens:Math.max(0,(e.tokens||0)*t)}))}function DL(e,t){let n=new Map((t||[]).map(e=>[e.key,e])),r=[],i=new Set;for(let t of e||[]){if(!t?.key||i.has(t.key))continue;i.add(t.key);let e=n.get(t.key);r.push({key:t.key,label:e?.label||t.label,tokens:Math.max(0,e?.tokens??t.tokens??0)})}for(let e of t||[])!e?.key||i.has(e.key)||(i.add(e.key),r.push({key:e.key,label:e.label,tokens:Math.max(0,e.tokens||0)}));return r}function OL(e){return e.length===1?e=>{let t=e.rect||{x:0,y:0,width:0,height:0},n=e.labelRect||{width:0,height:0};return{x:t.x+t.width+14,y:t.y+t.height/2-n.height/2,align:`left`,verticalAlign:`middle`,moveOverlap:`shiftY`,hideOverlap:!1}}:null}function kL({daily:e,fullDaily:t=null,range:n=`total`,exportMode:r=!1,exportPlayback:i=!1,onDayClick:a}){let o=i&&e?.dates?.length?e:t;if(!o?.dates?.length)return(0,$.jsxs)(`div`,{className:`overview-daily-spark overview-daily-spark-empty`,children:[(0,$.jsx)(`span`,{className:`overview-daily-spark-title`,children:`Daily Usage`}),(0,$.jsx)(`span`,{className:`overview-daily-spark-empty-text`,children:`No daily data`})]});let[s,c]=(0,b.useState)(()=>CL(n,o.dates.length)),l=(0,b.useRef)(s);l.current=s;let u=(0,b.useRef)(0);(0,b.useMemo)(()=>CL(n,o.dates.length),[n,o.dates.length]);let d=hL(o,!r&&!i,`overview-daily-spark`);(0,b.useEffect)(()=>{let e=CL(n,o.dates.length);return wL(l.current,e,c,u,220)},[n,o.dates.length]),(0,b.useEffect)(()=>()=>{cancelAnimationFrame(u.current),u.current=0},[]);let{startValue:f,endValue:p}=s,{barWidth:m,barMaxWidth:h}=xL(Math.max(1,p-f+1||o.dates.length)),g={backgroundColor:`transparent`,...WI,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{if(!e?.length)return``;let t=`<b>${e[0].axisValue}</b><br/>`,n=0,r=[...e].filter(e=>e.value>0).sort((e,t)=>(t.value||0)-(e.value||0));for(let e of r)t+=`${e.marker} ${e.seriesName}: ${_L(e.value)}<br/>`,n+=e.value;return t+=`<b>Total: ${_L(n)}</b>`,t}},grid:{left:4,right:4,top:4,bottom:4},xAxis:{type:`category`,data:o.dates,show:!1},yAxis:{type:`value`,show:!1,scale:!1,min:0},dataZoom:[{type:`inside`,filterMode:`filter`,zoomLock:!0,startValue:s.startValue,endValue:s.endValue,disabled:!0}],series:d.series.map(e=>({name:e.label,type:`bar`,stack:`total`,data:e.data,itemStyle:{color:CI(e.key)},...m?{barWidth:m}:{},barMaxWidth:h}))},_=a&&!r&&!i?{click:e=>{let t=e?.axisValue||e?.name;t&&a(t)}}:void 0;return(0,$.jsxs)(`div`,{className:`overview-daily-spark`,children:[(0,$.jsx)(`span`,{className:`overview-daily-spark-title`,children:`Daily Usage`}),(0,$.jsx)(`div`,{className:`overview-daily-spark-chart`,style:_?{cursor:`pointer`}:void 0,children:(0,$.jsx)(je,{echarts:mO,option:g,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!1,notMerge:r,onEvents:_})})]})}var AL=[{key:`tokens`,label:`Tokens`,fmt:_L},{key:`elapsed`,label:`Time`,fmt:e=>yL(e)},{key:`cost`,label:`Cost`,fmt:vL}],jL=kI.heatmap?.popDurationMs??380,ML=kI.heatmap?.settleThreshold??.998;function NL({heatmapData:e,isIngestActive:t=!1,ingestProgress:n=0,onDayClick:r,interactive:i=!0}){let[a,o]=(0,b.useState)(`tokens`),[s,c]=(0,b.useState)(new Set),[l,u]=(0,b.useState)(new Set),d=(0,b.useRef)({}),f=(0,b.useRef)(1),p=e||{},m=new Date,h=[],g=[];for(let e=364;e>=0;e--){let t=new Date(m);t.setDate(t.getDate()-e);let n=t.toLocaleDateString(`en-CA`),r=p[n]&&p[n][a]||0;h.push({key:n,val:r,date:t}),t.getDate()===1&&g.push({idx:364-e,label:t.toLocaleDateString(`en-US`,{month:`short`})})}let _=Math.max(...h.map(e=>e.val),1);(0,b.useEffect)(()=>{if(!t||n>=ML){d.current={},f.current=1;return}let e=new Date,r=d.current,i=f.current,o=new Set,s=new Set,l=Math.max(.05,Math.min(i,_)*.002),m=kI.heatmap?.intensityRiseThreshold??.08,h=kI.heatmap?.whiteThreshold??.88,g=kI.heatmap?.nearMaxRatio??.985;for(let t=364;t>=0;t--){let n=new Date(e);n.setDate(n.getDate()-t);let c=n.toLocaleDateString(`en-CA`),u=p[c]&&p[c][a]||0,d=r[c]??0,f=i>0?d/i:0,v=_>0?u/_:0,y=_>i+l&&u>=_*g&&(d<_*g||d===void 0),b=v>=h&&f<h,x=u>d+l,S=v>f+m;y||b||x||S?o.add(c):(u<d-l||u>0&&i>0&&_>i+l&&f>=.85&&v<f-.02)&&s.add(c),r[c]=u}if(f.current=_,o.size>0||s.size>0){c(o),u(s);let e=setTimeout(()=>{c(new Set),u(new Set)},jL);return()=>clearTimeout(e)}},[p,a,t,n,_]);function v(e){if(e===0)return`var(--bg-elevated)`;let t=e/_,n=1/4;return t<n?`rgba(99, 102, 241, 0.14)`:t<2*n?`rgba(99, 102, 241, 0.38)`:t<3*n?`rgba(99, 102, 241, 0.62)`:t<1?`rgba(99, 102, 241, 0.88)`:`#fff`}let y=h[0]?.date.getDay()||0,x=Array(y).fill(null).concat(h);return(0,$.jsxs)(`div`,{className:`heatmap-wrap`,children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`0.75rem`},children:[(0,$.jsx)(`span`,{className:`chart-title`,children:`Activity`}),(0,$.jsx)(`div`,{className:`btn-group`,children:AL.map(e=>(0,$.jsx)(`button`,{className:`btn ${a===e.key?`active`:``}`,onClick:()=>o(e.key),children:e.label},e.key))})]}),(0,$.jsx)(`div`,{className:`heatmap-grid`,style:{gridTemplateRows:`repeat(7, 1fr)`},children:x.map((e,t)=>e?(0,$.jsx)(`div`,{role:r&&i?`button`:void 0,tabIndex:r&&i?0:void 0,onClick:r&&i?()=>r(e.key):void 0,onKeyDown:r&&i?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e.key))}:void 0,className:`heatmap-cell ${e.val>0?`active`:``} ${s.has(e.key)?`heatmap-cell-pop`:``} ${l.has(e.key)?`heatmap-cell-pop-dim`:``}`,style:{background:v(e.val),cursor:r&&i?`pointer`:void 0},title:`${e.key}: ${AL.find(e=>e.key===a).fmt(e.val)}`},e.key):(0,$.jsx)(`div`,{className:`heatmap-cell`,style:{visibility:`hidden`}},`pad-${t}`))}),(0,$.jsx)(`div`,{className:`heatmap-labels`,children:g.slice(-12).map((e,t)=>(0,$.jsx)(`span`,{children:e.label},t))})]})}function PL({presentation:e,rawPresentation:t=null,fullDaily:n=null,range:r=`total`,ingestProgress:i=0,isIngestActive:a=!1,exportMode:o=!1,exportPlayback:s=!1,exportPhase:c=null,exportSeekMs:l=0,onNavigateToDailyDay:u,onNavigateToRepo:d,onNavigateToModel:f}){if(!e?.ready)return null;let p=s?zL(l):1,m=s&&c===`replay`&&t?.ready?t:e,h=a&&t?.heatmap?t.heatmap:e.heatmap,{stats:g,topRepos:_,topFamilies:v,topModels:y}=e,b=s&&c===`replay`?EL(DL(t?.topRepos||m.topRepos||[],e.topRepos||m.topRepos||[]),p):m.topRepos||[],x=s&&c===`replay`?EL(DL(t?.topFamilies||m.topFamilies||[],e.topFamilies||m.topFamilies||[]),p):m.topFamilies||[],S=s&&c===`replay`?EL(DL(t?.topModels||m.topModels||[],e.topModels||m.topModels||[]),p):m.topModels||[],C=[...b.slice(0,6)].reverse(),w=Math.max(...b.slice(0,6).map(e=>e.tokens||0),1),T=[...x].sort((e,t)=>String(e.label).localeCompare(String(t.label))),E=[...S.slice(0,6)].sort((e,t)=>String(e.label).localeCompare(String(t.label))),D=c===`tail`||c===`final_hold`?kI.videoExport?.barsChartTailUpdateDurationMs??kI.videoExport?.barsChartUpdateDurationMs??240:RL(l,kI.videoExport?.barsChartIntroUpdateDurationMs,kI.videoExport?.barsChartUpdateDurationMs??30),O=c===`tail`||c===`final_hold`?kI.videoExport?.donutsChartTailUpdateDurationMs??kI.videoExport?.donutsChartUpdateDurationMs??240:RL(l,kI.videoExport?.donutsChartIntroUpdateDurationMs,kI.videoExport?.donutsChartUpdateDurationMs??30),k=!o&&!s,A={backgroundColor:`transparent`,...GI,...o?{animation:!1}:{},...s?{animationDurationUpdate:D,animationEasingUpdate:`cubicOut`}:{},tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>e?.length?`${e[0].axisValue}: ${_L(e[0].value)} tokens`:``},grid:{left:100,right:5,top:5,bottom:5},xAxis:{type:`value`,show:!1,max:w||1},yAxis:{type:`category`,data:C.map(e=>e.label),axisLabel:{color:`#8b949e`,fontSize:11,formatter:e=>bL(e)},axisTick:{show:!1},axisLine:{show:!1}},series:[{type:`bar`,data:C.map(e=>{let t=e.tokens||0,n=t/w>=.7,r=bI(e.label);return{value:t,itemStyle:{color:r,borderRadius:[0,3,3,0]},label:{show:!0,position:n?`insideRight`:`right`,distance:5,offset:[0,1.5],formatter:()=>_L(t),color:n?xI(r):`#8b949e`,fontSize:10}}}),barWidth:`80%`}]},j=k&&d?{click:e=>{if(e?.componentType!==`series`||e?.dataIndex==null)return;let t=C[e.dataIndex];t?.label&&d(t.label)}}:void 0,ee=T.reduce((e,t)=>e+(t.tokens||0),0),M=T.filter(e=>ee>0?(e.tokens||0)/ee>=.01:!1),te=OL(M),ne={backgroundColor:`transparent`,...KI,...o?{animation:!1}:{},...s?{animationDurationUpdate:O,animationEasingUpdate:`cubicOut`}:{},tooltip:{trigger:`item`,appendToBody:!0,confine:!0,formatter:e=>`${e.name}: ${_L(e.value)} tokens (${e.percent}%)`},series:[{type:`pie`,animation:o?!1:qI,avoidLabelOverlap:!te,radius:[`48%`,`72%`],center:[`50%`,`50%`],label:{show:!0,color:`#8b949e`,fontSize:11,formatter:`{b}`,alignTo:`edge`,edgeDistance:5,bleedMargin:5,distanceToLabelLine:5},labelLine:{lineStyle:{color:`#30363d`},length:8,length2:6},itemStyle:{borderColor:`#161b22`,borderWidth:2},...te?{labelLayout:te}:{},data:TL(M,wI)}]},N=E.reduce((e,t)=>e+(t.tokens||0),0),P=E.filter(e=>N>0?(e.tokens||0)/N>=.01:!1),re=OL(P),ie={backgroundColor:`transparent`,...KI,...o?{animation:!1}:{},...s?{animationDurationUpdate:O,animationEasingUpdate:`cubicOut`}:{},tooltip:{trigger:`item`,appendToBody:!0,confine:!0,formatter:e=>`${e.name}: ${_L(e.value)} tokens (${e.percent}%)`},series:[{type:`pie`,animation:o?!1:qI,avoidLabelOverlap:!re,radius:[`48%`,`72%`],center:[`50%`,`50%`],label:{show:!0,color:`#8b949e`,fontSize:11,formatter:`{b}`,alignTo:`edge`,edgeDistance:5,bleedMargin:5,distanceToLabelLine:5},labelLine:{lineStyle:{color:`#30363d`},length:8,length2:6},itemStyle:{borderColor:`#161b22`,borderWidth:2},...re?{labelLayout:re}:{},data:TL(P,CI)}]},ae=k&&f?{click:e=>{if(e?.componentType!==`series`||e?.dataIndex==null)return;let t=P[e.dataIndex]?.label||e?.name;t&&f(t)}}:void 0;return(0,$.jsxs)(`div`,{className:`animate-in`,children:[(0,$.jsxs)(`div`,{className:`stat-row`,children:[(0,$.jsxs)(`div`,{className:`stat-cards`,children:[(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:`Tokens`}),(0,$.jsx)(`div`,{className:`stat-value`,children:_L(g.tokens)}),(0,$.jsxs)(`div`,{className:`stat-per-day`,children:[(0,$.jsx)(`span`,{className:`stat-per-day-value`,children:_L(g.tokens/g.days)}),` per day`]})]}),(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:`Agent Time`}),(0,$.jsx)(`div`,{className:`stat-value`,children:yL(g.elapsed)}),(0,$.jsxs)(`div`,{className:`stat-per-day`,children:[(0,$.jsx)(`span`,{className:`stat-per-day-value`,children:yL(g.elapsed/g.days)}),` per day`]})]}),(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:`Est. API Cost`}),(0,$.jsx)(`div`,{className:`stat-value`,children:vL(g.cost)}),(0,$.jsxs)(`div`,{className:`stat-per-day`,children:[(0,$.jsx)(`span`,{className:`stat-per-day-value`,children:vL(g.cost/g.days)}),` per day`]})]}),(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:`Sessions`}),(0,$.jsx)(`div`,{className:`stat-value`,children:Math.round(g.sessions).toLocaleString()}),(0,$.jsxs)(`div`,{className:`stat-per-day`,children:[(0,$.jsx)(`span`,{className:`stat-per-day-value`,children:(g.sessions/g.days).toFixed(1)}),` per day`]})]})]}),(0,$.jsx)(kL,{daily:s&&t?.daily||e.daily,fullDaily:n,range:r,exportMode:o,exportPlayback:s,onDayClick:k?u:void 0})]}),(0,$.jsx)(NL,{heatmapData:h,isIngestActive:a,ingestProgress:i,onDayClick:k?u:void 0,interactive:k}),(0,$.jsxs)(`div`,{className:`grid-3`,children:[(0,$.jsxs)(`div`,{className:`chart-card overview-donut-card`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Top Repos`}),_.length>0?(0,$.jsx)(je,{echarts:mO,option:A,style:{height:180,cursor:j?`pointer`:void 0},theme:`dark`,lazyUpdate:!1,notMerge:o,onEvents:j}):(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem 0`,textAlign:`center`},children:`No data`})]}),(0,$.jsxs)(`div`,{className:`chart-card overview-donut-card`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Work Type`}),v.length>0?(0,$.jsx)(je,{echarts:mO,option:ne,style:{height:180},theme:`dark`,lazyUpdate:!1,notMerge:o}):(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem 0`,textAlign:`center`},children:`No data`})]}),(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Models`}),y.length>0?(0,$.jsx)(je,{echarts:mO,option:ie,style:{height:180,cursor:ae?`pointer`:void 0},theme:`dark`,lazyUpdate:!1,notMerge:o,onEvents:ae}):(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem 0`,textAlign:`center`},children:`No data`})]})]}),(0,$.jsxs)(`div`,{className:`coverage-subtle`,children:[(0,$.jsx)(`span`,{style:{fontWeight:500},children:`Session coverage:`}),(0,$.jsxs)(`span`,{className:`coverage-item`,children:[(0,$.jsx)(`span`,{className:`coverage-dot`,style:{background:`#22c55e`}}),(0,$.jsx)(`span`,{className:`coverage-nums`,children:Math.round(g.exactPriced)}),` `,`exact-priced`]}),(0,$.jsxs)(`span`,{className:`coverage-item`,children:[(0,$.jsx)(`span`,{className:`coverage-dot`,style:{background:`#c084fc`}}),(0,$.jsx)(`span`,{className:`coverage-nums`,children:Math.round(g.fallbackPriced)}),` `,`fallback-priced`]}),(0,$.jsxs)(`span`,{className:`coverage-item`,children:[(0,$.jsx)(`span`,{className:`coverage-dot`,style:{background:`#64748b`}}),(0,$.jsx)(`span`,{className:`coverage-nums`,children:Math.round(g.unpriced)}),` `,`unpriced`]})]})]})}function FL({data:e,heatmap:t,daily:n,families:r,repos:i,models:a,range:o=`total`,onPresentationSettledChange:s=null,ingestProgress:c=0,isIngestActive:l=!1,clockNowMs:u=null,onNavigateToDailyDay:d,onNavigateToRepo:f,onNavigateToModel:p}){return(0,$.jsx)(PL,{presentation:cL({overview:e,heatmap:t,daily:n,families:r,repos:i,models:a,range:o},{duration:BI,onSettledChange:s,ingestProgress:c,isIngestActive:l,clockNowMs:u}),rawPresentation:b.useMemo(()=>nL({overview:e,heatmap:t,daily:n,families:r,repos:i,models:a,range:o}),[e,t,n,r,i,a,o]),fullDaily:b.useMemo(()=>SL(n),[n]),range:o,ingestProgress:c,isIngestActive:l,onNavigateToDailyDay:d,onNavigateToRepo:f,onNavigateToModel:p})}function IL(e,t){return e.data===t.data&&e.heatmap===t.heatmap&&e.daily===t.daily&&e.families===t.families&&e.repos===t.repos&&e.models===t.models&&e.range===t.range&&e.onPresentationSettledChange===t.onPresentationSettledChange&&e.ingestProgress===t.ingestProgress&&e.isIngestActive===t.isIngestActive&&e.clockNowMs===t.clockNowMs&&e.onNavigateToDailyDay===t.onNavigateToDailyDay&&e.onNavigateToRepo===t.onNavigateToRepo&&e.onNavigateToModel===t.onNavigateToModel}var LL=(0,b.memo)(FL,IL);function RL(e,t,n){let r=Math.max(t??n??0,n??0),i=Math.max(n??0,0),a=BL(e);return Math.round(r+(i-r)*a)}function zL(e){return BL(e)}function BL(e){let t=Math.max(kI.videoExport?.chartIntroWindowMs??2200,1),n=Math.max(e||0,0),r=t/3;return Math.min(1,1-Math.exp(-n/Math.max(r,1)))}function VL(e,t){return e===`default`?t:e}function HL(e,t=`tokens`){return Object.entries(e||{}).map(([e,t])=>({key:e,...t})).sort((e,n)=>(n[t]||0)-(e[t]||0))}function UL({title:e,rows:t,valueKey:n=`tokens`,colorForKey:r,valueFormatter:i,chartMode:a=`default`,defaultMode:o=`bar`,emptyLabel:s=`No data`,renderTitleInChart:c=!0,barLabelProgress:l=1}){let u=VL(a,o),d=(t||[]).map((e,t)=>{let n=e?.key??e?.repo_label??e?.model_name??e?.family??null;return n?{...e,key:String(n),_idx:t}:null}).filter(Boolean),f={xAxis:{show:!1},yAxis:{show:!1},series:[],graphic:{type:`text`,left:`center`,top:`60%`,style:{text:s,fill:`#484f58`,fontSize:11}}};if(c&&(f.title={text:e,left:`center`,top:`middle`,textStyle:{fontSize:12,color:`#484f58`,fontWeight:`normal`}}),!d.length)return f;if(u===`donut`){let t=d.reduce((e,t)=>e+(t[n]||0),0),a={backgroundColor:`transparent`,...MI,tooltip:{trigger:`item`,appendToBody:!0,confine:!0,formatter:e=>`${e.name}: ${i(e.value)} (${e.percent}%)`},series:[{type:`pie`,...MI,radius:[`40%`,`62%`],center:[`50%`,`52%`],label:{show:!0,color:`#8b949e`,fontSize:10,formatter:`{b}`,overflow:`truncate`,width:90,...jI},labelLine:{lineStyle:{color:`#30363d`}},itemStyle:{borderColor:`#161b22`,borderWidth:2},data:d.map(e=>{let i=e[n]||0,a=(t>0?i/t:0)>=.01;return{name:e.key,value:i,itemStyle:{color:r(e.key)},label:{show:a,color:r(e.key)},labelLine:{show:a}}})}]};return c&&(a.title={text:e,left:`center`,top:8,textStyle:{fontSize:11,color:`#8b949e`,fontWeight:`normal`}}),a}let p=[...d].reverse(),m=Math.max(...d.map(e=>e[n]||0),0),h={backgroundColor:`transparent`,...NI,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{let t=p[e?.[0]?.dataIndex];return t?`${t.key}: ${i(t[n]||0)}`:``}},grid:{left:65,right:50,top:c?35:20,bottom:20},xAxis:{type:`value`,splitNumber:4,max:m||1,axisLabel:{formatter:e=>i(e),color:`#484f58`,fontSize:10,showMinLabel:!0,showMaxLabel:!0},splitLine:{lineStyle:{color:[`transparent`,`#21262d`,`#21262d`,`#21262d`,`transparent`]}}},yAxis:{type:`category`,data:p.map(e=>e.key),axisLabel:{color:`#8b949e`,fontSize:10,overflow:`truncate`,width:55},axisTick:{show:!1},axisLine:{show:!1}},series:[{type:`bar`,data:p.map(e=>({value:e[n]||0,itemStyle:{color:r(e.key),borderRadius:[0,3,3,0]}})),barMaxWidth:14,label:{show:!0,position:`right`,formatter:e=>i((e.value??0)*l),color:`#8b949e`,fontSize:9,...PI}}]};return c&&(h.title={text:e,left:`center`,top:8,textStyle:{fontSize:11,color:`#8b949e`,fontWeight:`normal`}}),h}BE([Uk,dA,LN,QP,tF,pI]);function WL(e){return EI(e)}function GL(e){return e==null||e===0?`—`:e>=1e3?`$`+(e/1e3).toFixed(1)+`K`:`$`+e.toFixed(2)}var KL=[`all`,`review`,`exploration`,`planning`,`memory`,`generic`],qL=[`review`,`exploration`,`planning`,`memory`,`generic`];function JL(e){if(!e.current)return;let t=e.current.getEchartsInstance().getDataURL({type:`png`,pixelRatio:2,backgroundColor:`#06080f`});Object.assign(document.createElement(`a`),{href:t,download:`codexmeter-repos.png`}).click()}function YL(e,t=`total`){let n=e?.data;return Array.isArray(n)?n:n?.[t]||n?.total||[]}function XL({repo:e,chartMode:t}){let[n,r]=(0,b.useState)(!1),i=(0,b.useMemo)(()=>HL(e.by_model),[e.by_model]),a=(0,b.useMemo)(()=>HL(e.by_family),[e.by_family]),o=UL({title:`Models in repo`,rows:i,valueKey:`tokens`,colorForKey:CI,valueFormatter:WL,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1}),s=UL({title:`Work type in repo`,rows:a,valueKey:`tokens`,colorForKey:wI,valueFormatter:WL,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1}),c=[...i.slice(0,4).map(e=>({...e,scope:`model`})),...a.slice(0,4).map(e=>({...e,scope:`family`}))];return(0,$.jsxs)(`div`,{className:`model-detail-wrap`,children:[(0,$.jsxs)(`div`,{className:`model-detail-charts`,children:[(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Models in repo`}),(0,$.jsx)(je,{echarts:mO,option:o,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Work type in repo`}),(0,$.jsx)(je,{echarts:mO,option:s,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]})]}),(0,$.jsx)(`div`,{className:`model-detail-footer`,children:(0,$.jsxs)(`button`,{type:`button`,className:`model-detail-toggle`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,$.jsx)(`span`,{className:`model-detail-toggle-text`,children:n?`Hide details`:`Show details`}),(0,$.jsx)(`span`,{className:`model-detail-toggle-arrow ${n?`expanded`:``}`,"aria-hidden":!0,children:`▼`})]})}),(0,$.jsx)(`div`,{className:`model-detail-summary-wrap ${n?`expanded`:``}`,children:(0,$.jsx)(`div`,{className:`model-detail-summary`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`model-detail-summary-card`,children:[(0,$.jsxs)(`div`,{className:`model-detail-summary-head`,children:[(0,$.jsx)(`span`,{className:`model-detail-swatch`,style:{background:e.scope===`model`?CI(e.key):wI(e.key)}}),(0,$.jsx)(`span`,{className:`model-detail-summary-name`,title:e.key,children:e.key})]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[WL(e.tokens),` tokens`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[e.sessions||0,` sessions`]}),(0,$.jsx)(`div`,{className:`model-detail-summary-line`,children:GL(e.cost)})]},`${e.scope}-${e.key}`))})})]})}function ZL({data:e,range:t=`total`,chartMode:n=`default`,focusRequest:r=null,onFocusRequestConsumed:i}){let[a,o]=(0,b.useState)(`all`),[s,c]=(0,b.useState)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(null),d=(0,b.useMemo)(()=>YL(e,t),[e,t]),f=(0,b.useMemo)(()=>d?.length?a===`all`?d:d.map(e=>{let t=e.by_family?.[a];return t?{...e,tokens:t.tokens,cost:t.cost,sessions:t.sessions}:null}).filter(Boolean).sort((e,t)=>t.tokens-e.tokens):[],[d,a]);if((0,b.useEffect)(()=>{s&&(f.some(e=>e.repo_key===s)||c(null))},[s,f]),(0,b.useEffect)(()=>{if(!r){u.current=null;return}let{id:e,repoLabel:t}=r;if(!t||u.current===e)return;let n=d.find(e=>e.repo_label===t||e.repo_key===t);u.current=e,n&&c(n.repo_key),i?.()},[r,d,i]),!d?.length)return(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem`},children:`No data`});let p=f.slice(0,15),m=[...p].reverse(),h=Math.max(...p.map(e=>e.tokens||0),0),g=Math.max(250,p.length*28),_=(0,b.useMemo)(()=>({backgroundColor:`transparent`,...AI,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{let t=p[p.length-1-e[0].dataIndex];return t?`<b>${t.repo_label}</b><br/>Tokens: ${WL(t.tokens)}<br/>Cost: ${GL(t.cost)}<br/>Sessions: ${t.sessions}`:``}},grid:{left:150,right:50,top:8,bottom:8},xAxis:{type:`value`,splitNumber:4,max:h||1,axisLabel:{formatter:e=>WL(e),color:`#484f58`,showMinLabel:!0,showMaxLabel:!0},splitLine:{lineStyle:{color:[`transparent`,`#21262d`,`#21262d`,`#21262d`,`transparent`]}}},yAxis:{type:`category`,data:m.map(e=>e.repo_label),axisLabel:{color:`#8b949e`,fontSize:11},axisTick:{show:!1},axisLine:{show:!1}},series:[{id:`repos-range-bars`,type:`bar`,universalTransition:!0,data:m.map(e=>({id:e.repo_key,name:e.repo_label,value:e.tokens,itemStyle:{color:bI(e.repo_label),borderRadius:[0,3,3,0]}})),barMaxWidth:16,label:{show:!0,position:`right`,formatter:e=>WL(e.value??0),color:`#8b949e`,fontSize:10,...jI}}]}),[h,m,p]),v=(0,b.useMemo)(()=>({click:e=>{if(e?.componentType===`series`&&e?.dataIndex!=null){let t=p[p.length-1-e.dataIndex];t&&c(e=>e===t.repo_key?null:t.repo_key)}}}),[p]);return(0,$.jsxs)(`div`,{className:`animate-in`,children:[(0,$.jsxs)(`div`,{className:`section-header`,children:[(0,$.jsx)(`span`,{className:`section-title`,children:`Repos`}),(0,$.jsx)(`div`,{className:`btn-group`,children:KL.map(e=>(0,$.jsx)(`button`,{className:`btn ${a===e?`active`:``}`,onClick:()=>o(e),children:e},e))})]}),(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`button`,{className:`export-btn`,onClick:()=>JL(l),children:`PNG`}),(0,$.jsx)(`div`,{style:{height:g,transition:`height 220ms cubic-bezier(0.22, 1, 0.36, 1)`},children:(0,$.jsx)(je,{ref:l,echarts:mO,option:_,style:{height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1,onEvents:v})})]}),(0,$.jsx)(`div`,{className:`table-wrap`,children:(0,$.jsxs)(`table`,{children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Repo`}),(0,$.jsx)(`th`,{children:`Tokens`}),(0,$.jsx)(`th`,{children:`Cost`}),(0,$.jsx)(`th`,{children:`Sessions`}),(0,$.jsx)(`th`,{style:{width:200},children:`Families`})]})}),(0,$.jsx)(`tbody`,{children:f.map(e=>(0,$.jsxs)(b.Fragment,{children:[(0,$.jsxs)(`tr`,{onClick:()=>c(s===e.repo_key?null:e.repo_key),style:{cursor:`pointer`},children:[(0,$.jsxs)(`td`,{style:{fontWeight:500,color:`var(--text-primary)`},children:[(0,$.jsx)(`span`,{style:{display:`inline-block`,width:8,height:8,borderRadius:2,background:bI(e.repo_label),marginRight:8}}),e.repo_label]}),(0,$.jsx)(`td`,{style:{fontFamily:`var(--font-mono)`},children:WL(e.tokens)}),(0,$.jsx)(`td`,{style:{fontFamily:`var(--font-mono)`},children:GL(e.cost)}),(0,$.jsx)(`td`,{children:e.sessions}),(0,$.jsx)(`td`,{children:Object.entries(e.by_family||{}).sort(([e],[t])=>{let n=qL.indexOf(e),r=qL.indexOf(t);return(n===-1?999:n)-(r===-1?999:r)}).slice(0,3).map(([e])=>(0,$.jsx)(`span`,{className:`tag tag-${e}`,style:{marginRight:3},children:e},e))})]}),s===e.repo_key&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,style:{background:`var(--bg-surface)`,padding:`0.75rem 1rem`},children:(0,$.jsx)(XL,{repo:e,chartMode:n})})})]},e.repo_key))})]})})]})}BE([Uk,dA,LN,QP,tF,pI]);function QL(e){return EI(e)}function $L(e){return e==null||e===0?`—`:e>=1e3?`$`+(e/1e3).toFixed(1)+`K`:`$`+e.toFixed(2)}var eR=[`low`,`medium`,`high`,`xhigh`,`unknown`];function tR(e){return[...e].sort(([e],[t])=>{let n=eR.indexOf((e||``).toLowerCase()),r=eR.indexOf((t||``).toLowerCase());return(n===-1?999:n)-(r===-1?999:r)})}function nR({model:e,fmt:t,chartMode:n}){let[r,i]=(0,b.useState)(!1),a=(0,b.useMemo)(()=>tR(Object.entries(e.by_effort||{})),[e.by_effort]);if(!a.length)return null;let o=a.map(([e,t])=>({effort:e,sessions:t.sessions,tokens:t.tokens,avgTokens:t.sessions?Math.round(t.tokens/t.sessions):0,cost:t.cost,exactPriced:t.exact_priced||0,fallbackPriced:t.heuristic_priced||0})),s=o.map(e=>({key:e.effort,sessions:e.sessions,tokens:e.tokens,avgTokens:e.avgTokens})),c=UL({title:`Sessions by effort`,rows:s,valueKey:`sessions`,colorForKey:TI,valueFormatter:e=>Math.round(e).toLocaleString(),chartMode:n,defaultMode:`donut`,renderTitleInChart:!1}),l=UL({title:`Tokens by effort`,rows:s,valueKey:`tokens`,colorForKey:TI,valueFormatter:t,chartMode:n,defaultMode:`donut`,renderTitleInChart:!1}),u=UL({title:`Avg tokens per session`,rows:s,valueKey:`avgTokens`,colorForKey:TI,valueFormatter:t,chartMode:n,defaultMode:`bar`,renderTitleInChart:!1});return(0,$.jsxs)(`div`,{className:`model-detail-wrap`,children:[(0,$.jsxs)(`div`,{className:`model-detail-charts`,children:[(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Sessions by effort`}),(0,$.jsx)(je,{echarts:mO,option:c,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Tokens by effort`}),(0,$.jsx)(je,{echarts:mO,option:l,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-bar`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Avg tokens per session`}),(0,$.jsx)(je,{echarts:mO,option:u,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]})]}),(0,$.jsx)(`div`,{className:`model-detail-footer`,children:(0,$.jsxs)(`button`,{type:`button`,className:`model-detail-toggle`,onClick:()=>i(e=>!e),"aria-expanded":r,children:[(0,$.jsx)(`span`,{className:`model-detail-toggle-text`,children:r?`Hide details`:`Show details`}),(0,$.jsx)(`span`,{className:`model-detail-toggle-arrow ${r?`expanded`:``}`,"aria-hidden":!0,children:`▼`})]})}),(0,$.jsx)(`div`,{className:`model-detail-summary-wrap ${r?`expanded`:``}`,children:(0,$.jsx)(`div`,{className:`model-detail-summary`,children:o.map(e=>(0,$.jsxs)(`div`,{className:`model-detail-summary-card`,children:[(0,$.jsxs)(`div`,{className:`model-detail-summary-head`,children:[(0,$.jsx)(`span`,{className:`model-detail-swatch`,style:{background:TI(e.effort)}}),(0,$.jsx)(`span`,{className:`model-detail-summary-name`,title:e.effort,children:e.effort})]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[e.sessions,` sessions`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[t(e.tokens),` tokens`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[t(e.avgTokens),` avg/session`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[$L(e.cost),` cost`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[e.exactPriced,` exact · `,e.fallbackPriced,` fallback`]})]},e.effort))})})]})}function rR(e){if(!e.current)return;let t=e.current.getEchartsInstance().getDataURL({type:`png`,pixelRatio:2,backgroundColor:`#06080f`});Object.assign(document.createElement(`a`),{href:t,download:`codexmeter-models.png`}).click()}function iR(e,t=`total`){let n=e?.data;return Array.isArray(n)?n:n?.[t]||n?.total||[]}function aR({data:e,range:t=`total`,chartMode:n=`default`,focusRequest:r=null,onFocusRequestConsumed:i}){let[a,o]=(0,b.useState)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useMemo)(()=>iR(e,t),[e,t]);if((0,b.useEffect)(()=>{a&&(l.some(e=>e.model_name===a)||o(null))},[a,l]),(0,b.useEffect)(()=>{if(!r){c.current=null;return}let{id:e,modelName:t}=r;if(!t||c.current===e)return;let n=l.find(e=>e.model_name===t);c.current=e,n&&o(n.model_name),i?.()},[r,l,i]),!l?.length)return(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem`},children:`No data`});let u=[...l].reverse(),d=Math.max(...l.map(e=>e.tokens||0),0),f=Math.max(180,l.length*34),p=(0,b.useMemo)(()=>({backgroundColor:`transparent`,...AI,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{let t=l[l.length-1-e[0].dataIndex];return`<b>${t.model_name}</b><br/>Tokens: ${QL(t.tokens)}<br/>Cost: ${$L(t.cost)}<br/>Sessions: ${t.sessions}`}},grid:{left:160,right:50,top:8,bottom:8},xAxis:{type:`value`,splitNumber:4,max:d||1,axisLabel:{formatter:e=>QL(e),color:`#484f58`,fontSize:10,showMinLabel:!0,showMaxLabel:!0},splitLine:{lineStyle:{color:[`transparent`,`#21262d`,`#21262d`,`#21262d`,`transparent`]}}},yAxis:{type:`category`,data:u.map(e=>e.model_name),axisLabel:{color:`#8b949e`,fontSize:11},axisTick:{show:!1},axisLine:{show:!1}},series:[{id:`models-range-bars`,type:`bar`,universalTransition:!0,data:u.map(e=>({id:e.model_name,name:e.model_name,value:e.tokens,itemStyle:{color:CI(e.model_name),borderRadius:[0,3,3,0]}})),barMaxWidth:18,label:{show:!0,position:`right`,formatter:e=>QL(e.value??0),color:`#8b949e`,fontSize:10,...jI}}]}),[d,l,u]),m=(0,b.useMemo)(()=>({click:e=>{if(e?.componentType===`series`&&e?.dataIndex!=null){let t=l[l.length-1-e.dataIndex];t&&o(e=>e===t.model_name?null:t.model_name)}}}),[l]);return(0,$.jsxs)(`div`,{className:`animate-in`,children:[(0,$.jsx)(`div`,{className:`section-header`,children:(0,$.jsx)(`span`,{className:`section-title`,children:`Models`})}),(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`button`,{className:`export-btn`,onClick:()=>rR(s),children:`PNG`}),(0,$.jsx)(`div`,{style:{height:f,transition:`height 220ms cubic-bezier(0.22, 1, 0.36, 1)`},children:(0,$.jsx)(je,{ref:s,echarts:mO,option:p,style:{height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1,onEvents:m})})]}),(0,$.jsx)(`div`,{className:`table-wrap`,children:(0,$.jsxs)(`table`,{children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Model`}),(0,$.jsx)(`th`,{children:`Tokens`}),(0,$.jsx)(`th`,{children:`Cost`}),(0,$.jsx)(`th`,{children:`Sessions`}),(0,$.jsx)(`th`,{children:`Effort Levels`})]})}),(0,$.jsx)(`tbody`,{children:l.map(e=>(0,$.jsxs)(b.Fragment,{children:[(0,$.jsxs)(`tr`,{onClick:()=>o(a===e.model_name?null:e.model_name),style:{cursor:`pointer`},children:[(0,$.jsxs)(`td`,{style:{fontWeight:500,color:`var(--text-primary)`,fontFamily:`var(--font-mono)`},children:[(0,$.jsx)(`span`,{style:{display:`inline-block`,width:8,height:8,borderRadius:2,background:CI(e.model_name),marginRight:8}}),e.model_name]}),(0,$.jsx)(`td`,{style:{fontFamily:`var(--font-mono)`},children:QL(e.tokens)}),(0,$.jsx)(`td`,{style:{fontFamily:`var(--font-mono)`},children:$L(e.cost)}),(0,$.jsx)(`td`,{children:e.sessions}),(0,$.jsx)(`td`,{children:Object.keys(e.by_effort).length})]}),a===e.model_name&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,style:{background:`var(--bg-surface)`,padding:`0.75rem 1rem`},children:(0,$.jsx)(nR,{model:e,fmt:QL,chartMode:n})})})]},e.model_name))})]})})]})}BE([Uk,lk,dA,LN,QP,tF,DF,rI,tP,pI]);function oR(e){return EI(e)}function sR(e){return e==null||e===0?`$0`:`$`+e.toFixed(2)}function cR(e){return e?(e/3600).toFixed(1)+`h`:`0h`}var lR=[{key:`tokens`,label:`Tokens`,fn:oR},{key:`elapsed_seconds`,label:`Time`,fn:cR},{key:`cost`,label:`Cost`,fn:sR}],uR=[{key:`model`,label:`By Model`},{key:`family`,label:`By Work`}],dR=[{key:`absolute`,label:`Absolute`},{key:`relative`,label:`Relative`}];function fR(e){if(!e.current)return;let t=e.current.getEchartsInstance().getDataURL({type:`png`,pixelRatio:2,backgroundColor:`#06080f`});Object.assign(document.createElement(`a`),{href:t,download:`codexmeter-daily.png`}).click()}function pR(e,t){if(!t)return{startValue:0,endValue:0};let n=t;return e===`d7`&&(n=7),e===`d30`&&(n=30),{startValue:t-Math.max(1,Math.min(n,t)),endValue:t-1}}var mR=280,hR={left:70,right:20,bottom:12,height:24};function gR(e,t,n){let r=e?.batch?.[0]??e,i=Math.max(0,t.length-1),a,o;return r&&typeof r.startValue==`number`&&typeof r.endValue==`number`?(a=r.startValue,o=r.endValue):r&&typeof r.start==`number`&&typeof r.end==`number`&&t.length?(a=Math.round(r.start/100*i),o=Math.round(r.end/100*i)):r&&typeof r.startValue==`string`&&typeof r.endValue==`string`&&t.length?(a=t.indexOf(r.startValue),o=t.indexOf(r.endValue),a<0&&(a=n.startValue),o<0&&(o=n.endValue)):(a=n.startValue,o=n.endValue),a=Math.max(0,Math.min(i,Math.floor(a))),o=Math.max(0,Math.min(i,Math.floor(o))),a>o?{startValue:o,endValue:a}:{startValue:a,endValue:o}}function _R(e,t,n,r,i){if(cancelAnimationFrame(r.current),r.current=0,Math.round(e.startValue)===Math.round(t.startValue)&&Math.round(e.endValue)===Math.round(t.endValue))return;let a=0,o=s=>{a||=s;let c=Math.min(1,(s-a)/i),l=1-(1-c)**3;n({startValue:Math.round(e.startValue+(t.startValue-e.startValue)*l),endValue:Math.round(e.endValue+(t.endValue-e.endValue)*l)}),r.current=c<1?requestAnimationFrame(o):0};return r.current=requestAnimationFrame(o),()=>{cancelAnimationFrame(r.current),r.current=0}}function vR(e,t){return{left:hR.left,right:e-hR.right,top:t-hR.bottom-hR.height,bottom:t-hR.bottom}}function yR(e,t,n,r){let i=vR(e,t),a=Math.max(n-1,1),o=Math.max(0,Math.min(1,(r?.startValue??0)/a)),s=Math.max(0,Math.min(1,(r?.endValue??a)/a)),c=Math.max(0,i.right-i.left);return{...i,selectionLeft:i.left+c*Math.min(o,s),selectionRight:i.left+c*Math.max(o,s)}}function bR(e,t){return e===`d7`?44:e===`d30`?22:t<=14?36:t<=31?18:14}function xR(e,t){return e===`d7`?`72%`:e===`d30`?`54%`:t<=14?`64%`:t<=31?`48%`:`36%`}function SR(e,t){return e?t===`elapsed_seconds`?e.elapsed_seconds||0:t===`cost`?e.cost||0:e.tokens||0:0}function CR(e,t){if(!e)return`Day detail`;let n=lR.find(e=>e.key===t)||lR[0],r=new Date(`${e.date}T00:00:00`).toLocaleDateString(`en-US`,{weekday:`long`}),i=n.fn(SR(e,t));return`Day detail: ${r} - ${e.date} - ${n.label}: ${i}`}function wR(e,t){let n=e.length;if(n===0)return null;let r=Array(n),i=Array(n),a=[];for(let t=0;t<n;t++){for(;a.length&&e[a[a.length-1]]>=e[t];)a.pop();r[t]=a.length?a[a.length-1]:-1,a.push(t)}a.length=0;for(let t=n-1;t>=0;t--){for(;a.length&&e[a[a.length-1]]>=e[t];)a.pop();i[t]=a.length?a[a.length-1]:n,a.push(t)}let o=0,s=0;for(let t=0;t<n;t++){let n=(i[t]-r[t]-1)*e[t];n>o&&(o=n,s=t)}return[(r[s]+i[s])/2,t[s]+e[s]/2]}function TR({day:e,chartMode:t}){let n=(0,b.useMemo)(()=>HL(e.by_model),[e.by_model]),r=(0,b.useMemo)(()=>HL(e.by_repo),[e.by_repo]),i=(0,b.useMemo)(()=>HL(e.by_family),[e.by_family]),a=UL({title:`Models`,rows:n,valueKey:`tokens`,colorForKey:CI,valueFormatter:oR,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1}),o=UL({title:`Repos`,rows:r,valueKey:`tokens`,colorForKey:bI,valueFormatter:oR,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1}),s=UL({title:`Work Type`,rows:i,valueKey:`tokens`,colorForKey:wI,valueFormatter:oR,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1});return(0,$.jsx)(`div`,{className:`model-detail-wrap`,children:(0,$.jsxs)(`div`,{className:`model-detail-charts`,children:[(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Repos`}),(0,$.jsx)(je,{echarts:mO,option:o,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Models`}),(0,$.jsx)(je,{echarts:mO,option:a,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Work Type`}),(0,$.jsx)(je,{echarts:mO,option:s,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]})]})})}var ER=b.memo(function({daily:e,range:t,metric:n,split:r,displayMode:i,onSelectDate:a,navigateToDayRequest:o,onNavigateToDayConsumed:s}){let[c,l]=(0,b.useState)({startValue:0,endValue:0}),u=(0,b.useRef)(null),d=(0,b.useRef)(c);d.current=c;let f=(0,b.useRef)(0),p=(0,b.useRef)(null),m=(0,b.useRef)(0),h=(0,b.useRef)(!1),g=(0,b.useRef)(null),_=(0,b.useRef)(null),v=(0,b.useRef)(0),y=(0,b.useMemo)(()=>e.map(e=>e.date),[e]),x=lR.find(e=>e.key===n),S=(0,b.useMemo)(()=>pR(t,y.length),[t,y.length]);(0,b.useEffect)(()=>{if(!y.length)return;let e=pR(t,y.length),n=_.current===null,r=!n&&_.current!==t,i=!n&&v.current!==y.length;if(_.current=t,v.current=y.length,cancelAnimationFrame(m.current),m.current=0,n){l(e);return}if(r)return _R(d.current,e,l,m,mR);i&&l(e)},[t,y.length]),(0,b.useEffect)(()=>()=>{cancelAnimationFrame(f.current),f.current=0,g.current?.(),g.current=null},[]);let C=(0,b.useCallback)(()=>{let e=u.current?.getEchartsInstance?.();if(!e)return;g.current?.();let t=e.getZr(),n=n=>{let r=n?.offsetX??n?.zrX,i=n?.offsetY??n?.zrY;if(!Number.isFinite(r)||!Number.isFinite(i)){t.setCursorStyle(`default`);return}let a=yR(e.getWidth(),e.getHeight(),y.length,d.current);if(!(r>=a.left&&r<=a.right&&i>=a.top&&i<=a.bottom)){t.setCursorStyle(`default`);return}if(r>=a.selectionLeft&&r<=a.selectionRight){t.setCursorStyle(h.current?`grabbing`:`grab`);return}t.setCursorStyle(`ew-resize`)},r=e=>n(e),i=t=>{let r=t?.offsetX??t?.zrX,i=t?.offsetY??t?.zrY;if(!Number.isFinite(r)||!Number.isFinite(i))return;let a=yR(e.getWidth(),e.getHeight(),y.length,d.current);h.current=r>=a.selectionLeft&&r<=a.selectionRight&&i>=a.top&&i<=a.bottom,n(t)},a=e=>{h.current=!1,n(e)},o=()=>{h.current=!1,t.setCursorStyle(`default`)};t.on(`mousemove`,r),t.on(`mousedown`,i),t.on(`mouseup`,a),t.on(`globalout`,o),g.current=()=>{t.off(`mousemove`,r),t.off(`mousedown`,i),t.off(`mouseup`,a),t.off(`globalout`,o),t.setCursorStyle(`default`)}},[y.length]),w=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(!o){w.current=null;return}let{id:t,centerDate:n}=o;if(!n||!e.length||w.current===t)return;let r=e.map(e=>e.date),i=r.indexOf(n);if(i<0){s?.();return}w.current=t;let c=Math.max(0,i-3),u=Math.min(r.length-1,i+3);cancelAnimationFrame(m.current),m.current=0,l({startValue:c,endValue:u}),a(n),s?.()},[o,e,a,s]);let T=(0,b.useMemo)(()=>{if(!y.length)return 0;let e=Math.max(0,Math.min(y.length-1,Math.floor(c.startValue??S.startValue??0))),t=Math.max(e,Math.min(y.length-1,Math.floor(c.endValue??S.endValue??y.length-1)));return Math.max(1,t-e+1)},[y.length,c,S]),E=(0,b.useMemo)(()=>{if(!y.length)return{startIdx:0,endIdx:-1};let e=Math.max(0,Math.min(y.length-1,Math.floor(c.startValue??S.startValue??0)));return{startIdx:e,endIdx:Math.max(e,Math.min(y.length-1,Math.floor(c.endValue??S.endValue??y.length-1)))}},[y.length,c,S]),D=(0,b.useMemo)(()=>bR(t,T),[t,T]),O=(0,b.useMemo)(()=>xR(t,T),[t,T]),k=(0,b.useMemo)(()=>{let t=new Set;for(let i=0;i<e.length;i++){let a=e[i];if(!a)continue;let o=r===`model`?a.by_model:a.by_family||{};for(let[e,r]of Object.entries(o))r&&(n===`elapsed_seconds`?r.elapsed_seconds||0:n===`cost`?r.cost||0:r.tokens||0)>0&&t.add(e)}return[...t]},[e,r,n]),A=(0,b.useMemo)(()=>k.map(t=>({name:t,values:e.map(e=>{let i=(r===`model`?e.by_model:e.by_family||{})[t];return i?n===`elapsed_seconds`?i.elapsed_seconds||0:n===`cost`?i.cost||0:i.tokens||0:0})})),[k,e,r,n]),j=(0,b.useMemo)(()=>e.map((e,t)=>{let n=0;for(let e of A)n+=e.values[t]||0;return n}),[e,A]),ee=(0,b.useMemo)(()=>{if(!j.length||E.endIdx<E.startIdx)return 0;let e=0;for(let t=E.startIdx;t<=E.endIdx;t++)e=Math.max(e,j[t]||0);return e},[j,E]),M=i===`relative`,te=(0,b.useMemo)(()=>({dates:y,series:A.map(e=>({key:e.name,label:e.name,data:e.values}))}),[y,A]),ne=`${n}\0${r}`,N=hL(te,!M,ne),P=(0,b.useMemo)(()=>new Map((N?.series||[]).map(e=>[e.key,e])),[N]),re=(0,b.useMemo)(()=>{if(M)return j;let e=y.length,t=Array(e).fill(0);for(let n of N?.series||[])for(let r=0;r<e;r++)t[r]+=n.data[r]||0;return t},[M,j,N,y.length]),ie=(0,b.useMemo)(()=>{if(i===`relative`)return 100;if(ee)return Math.ceil(ee*1.1)},[i,ee]),ae=(0,b.useMemo)(()=>{if(!M)return null;if(!A.length)return[];let e=A.map(e=>{let t=e.values.map((e,t)=>j[t]>0?e/j[t]*100:0);for(let e=1;e<t.length;e++)j[e]===0&&(t[e]=t[e-1]);return t}),t=e[0].map(()=>0);return e.map((e,n)=>{let r=[...t];return t=t.map((t,n)=>t+e[n]),{values:e,prevStack:r}})},[M,A,j]),oe=(0,b.useMemo)(()=>M?k.map((e,t)=>{let n=r===`model`?CI(e):wI(e);if(!A[t])return null;let i=ae[t];return i?{name:e,type:`line`,stack:`total`,smooth:.2,areaStyle:{opacity:1},lineStyle:{width:0},symbol:`none`,data:i.values,itemStyle:{color:n}}:null}).filter(Boolean):k.map(e=>{let t=r===`model`?CI(e):wI(e);return{name:e,type:`bar`,stack:`total`,data:P.get(e)?.data??y.map(()=>0),itemStyle:{color:t},barWidth:O,barMaxWidth:D,barMinWidth:Math.min(10,D)}}),[M,k,r,ae,A,P,y,O,D]),se=(0,b.useMemo)(()=>!M||!ae?[]:ae.map((e,t)=>{let n=A[t],i=xI(r===`model`?CI(n.name):wI(n.name)),a=wR(e.values,e.prevStack);return!a||Math.max(...e.values)<8?null:{name:n.name,labelColor:i,coord:a}}).filter(Boolean),[M,ae,A,r]),ce=(0,b.useCallback)(()=>{if(!u.current)return;let e=u.current.getEchartsInstance();if(!M||se.length===0){e.setOption({graphic:{elements:[]}},{notMerge:!1});return}let t=se.map(t=>{let[n,r]=e.convertToPixel({xAxisIndex:0,yAxisIndex:0},t.coord);return{type:`text`,left:n,top:r,style:{text:t.name,fill:t.labelColor,fontSize:10,fontWeight:500,textAlign:`center`,textVerticalAlign:`middle`},z:10,silent:!0}});e.setOption({graphic:{elements:t}},{notMerge:!1})},[M,se]);(0,b.useEffect)(()=>{let e=setTimeout(ce,150);return()=>clearTimeout(e)},[M,se,ce]),(0,b.useEffect)(()=>{let e=()=>ce();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[ce]),(0,b.useEffect)(()=>{C()},[C,c]);let le={backgroundColor:`transparent`,tooltip:{trigger:`axis`,axisPointer:{type:M?`line`:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{if(!e?.length)return``;let t=e[0]?.dataIndex,n=re,r=t==null?0:n[t],a=t;if(i===`relative`&&r===0&&t!=null){for(let e=t-1;e>=0;e--)if(n[e]>0){a=e;break}}let o=i===`relative`&&r===0?n[a]??0:r,s=`<b>${e[0]?.axisValue??``}</b><br/>`,c=[...e].filter(e=>e.value>0).sort((e,t)=>(t.value||0)-(e.value||0));for(let e of c){let t=i===`relative`?A.find(t=>t.name===e.seriesName)?.values[a]??0:e.value;i===`relative`?s+=`${e.marker} ${e.seriesName}: ${e.value.toFixed(1)}% (${x.fn(t)})<br/>`:s+=`${e.marker} ${e.seriesName}: ${x.fn(e.value)}<br/>`}return s+=i===`relative`?`<b>Total: 100% (${x.fn(o)})</b>`:`<b>Total: ${x.fn(r)}</b>`,s}},legend:{data:k,textStyle:{color:`#8b949e`,fontSize:10},top:0,itemWidth:10,itemHeight:10},grid:{left:hR.left,right:hR.right,top:35,bottom:55},dataZoom:[{type:`slider`,startValue:c.startValue,endValue:c.endValue,left:hR.left,right:hR.right,bottom:hR.bottom,height:hR.height,borderColor:`#30363d`,fillerColor:`rgba(99, 102, 241, 0.08)`,handleStyle:{color:`#6366f1`},textStyle:{color:`#484f58`}}],xAxis:{type:`category`,data:y,boundaryGap:i!==`relative`,axisLabel:{color:`#484f58`,fontSize:10,rotate:45},axisTick:{show:!1},axisLine:{lineStyle:{color:`#30363d`}}},yAxis:{type:`value`,min:0,max:i===`relative`?100:ie,scale:!1,axisLabel:{formatter:i===`relative`?e=>e+`%`:e=>x.fn(e),color:`#484f58`},splitLine:{lineStyle:{color:`#21262d`}}},series:oe,...M?AI:WI};return(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`button`,{className:`export-btn`,onClick:()=>fR(u),children:`PNG`}),(0,$.jsx)(je,{ref:u,echarts:mO,option:le,style:{height:400},theme:`dark`,notMerge:!1,replaceMerge:[`series`,`legend`,`graphic`],lazyUpdate:!1,onChartReady:()=>{ce(),C()},onEvents:{click:e=>{let t=e?.axisValue||e?.name;t&&a(t)},datazoom:e=>{p.current=gR(e,y,d.current),f.current||=requestAnimationFrame(()=>{f.current=0,p.current&&=(l(p.current),null),M&&ce()})}}})]})});function DR({data:e,range:t=`total`,chartMode:n=`default`,navigateToDayRequest:r=null,onNavigateToDayConsumed:i}){let[a,o]=(0,b.useState)(`tokens`),[s,c]=(0,b.useState)(`model`),[l,u]=(0,b.useState)(`absolute`),[d,f]=(0,b.useState)(null);if(!e?.data?.length)return(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem`},children:`No data`});let p=e.data;(0,b.useEffect)(()=>{!d&&p[0]&&f(p[p.length-1]?.date||p[0]?.date)},[p,d]);let m=(0,b.useCallback)(e=>{e&&f(e)},[]),h=p.find(e=>e.date===d)||null;return(0,$.jsxs)(`div`,{className:`animate-in`,children:[(0,$.jsxs)(`div`,{className:`section-header`,children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`},children:(0,$.jsx)(`span`,{className:`section-title`,children:`Daily Usage`})}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`},children:[(0,$.jsx)(`div`,{className:`btn-group`,children:lR.map(e=>(0,$.jsx)(`button`,{className:`btn ${a===e.key?`active`:``}`,onClick:()=>o(e.key),children:e.label},e.key))}),(0,$.jsx)(`div`,{className:`btn-group`,children:uR.map(e=>(0,$.jsx)(`button`,{className:`btn ${s===e.key?`active`:``}`,onClick:()=>c(e.key),children:e.label},e.key))}),(0,$.jsx)(`div`,{className:`btn-group`,children:dR.map(e=>(0,$.jsx)(`button`,{className:`btn ${l===e.key?`active`:``}`,onClick:()=>u(e.key),children:e.label},e.key))})]})]}),(0,$.jsx)(ER,{daily:p,range:t,metric:a,split:s,displayMode:l,onSelectDate:m,navigateToDayRequest:r,onNavigateToDayConsumed:i}),h&&(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.75rem`},children:CR(h,a)}),(0,$.jsx)(TR,{day:h,chartMode:n})]})]})}function OR(){return{accessor:(e,t)=>typeof e==`function`?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function kR(e,t){return typeof e==`function`?e(t):e}function AR(e,t){return n=>{t.setState(t=>({...t,[e]:kR(n,t[e])}))}}function jR(e){return e instanceof Function}function MR(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function NR(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function PR(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
27
|
+
`||r===``)){var i=e.isSelected(r);q(n,r)?n[r]=n[r]&&i:n[r]=i}}),n}function _F(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,vt(hF,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,vt(hF,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,vt(hF,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,vt(hF,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,vt(hF,`unSelect`))}function vF(e){e.registerComponentModel(rF),e.registerComponentView(sF),e.registerProcessor(e.PRIORITY.PROCESSOR.SERIES_FILTER,mF),e.registerSubTypeDefaulter(`legend`,function(){return`plain`}),_F(e)}I();var yF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.setScrollDataIndex=function(e){this.option.scrollDataIndex=e},t.prototype.init=function(t,n,r){var i=Yg(t);e.prototype.init.call(this,t,n,r),bF(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),bF(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=mh(rF.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:`end`,pageFormatter:`{current}/{total}`,pageIcons:{horizontal:[`M0,0L12,-10L12,10z`,`M0,0L-12,-10L-12,10z`],vertical:[`M0,0L20,0L10,-20z`,`M0,0L20,0L10,20z`]},pageIconColor:Z.color.accent50,pageIconInactiveColor:Z.color.accent10,pageIconSize:15,pageTextStyle:{color:Z.color.tertiary},animationDurationUpdate:800}),t}(rF);function bF(e,t,n){var r=e.getOrient(),i=[1,1];i[r.index]=0,Jg(t,n,{type:`box`,ignoreSize:!!i})}I();var xF=Wo,SF=[`width`,`height`],CF=[`x`,`y`],wF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!0,n._currentIndex=0,n}return t.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new xF),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new xF)},t.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(t,n,r,i,a,o,s){var c=this;e.prototype.renderInner.call(this,t,n,r,i,a,o,s);var l=this._controllerGroup,u=n.get(`pageIconSize`,!0),d=V(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new X({name:`pageText`,style:{text:`xx/xx`,fill:f.getTextColor(),font:f.getFont(),verticalAlign:`middle`,align:`center`},silent:!0})),p(`pageNext`,1);function p(e,t){var r=e+`DataIndex`,a=_m(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:B(c._pageGo,c,r,n,i)},{x:-d[0]/2,y:-d[1]/2,width:d[0],height:d[1]});a.name=e,l.add(a)}},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getSelectorGroup(),s=e.getOrient().index,c=SF[s],l=CF[s],u=SF[1-s],d=CF[1-s];i&&zg(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=it(n);i&&(h[c]=n[c]-p[c]-f);var g=this._layoutContentAndController(e,r,h,s,c,u,d,l);if(i){if(a===`end`)m[s]+=g[c]+f;else{var _=p[c]+f;m[s]-=_,g[l]-=_}g[c]+=p[c]+f,m[1-s]+=g[d]+g[u]/2-p[u]/2,g[u]=Math.max(g[u],p[u]),g[d]=Math.min(g[d],p[d]+m[1-s]),o.x=m[0],o.y=m[1],o.markRedraw()}return g},t.prototype._layoutContentAndController=function(e,t,n,r,i,a,o,s){var c=this.getContentGroup(),l=this._containerGroup,u=this._controllerGroup;zg(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),zg(`horizontal`,u,e.get(`pageButtonItemGap`,!0));var d=c.getBoundingRect(),f=u.getBoundingRect(),p=this._showController=d[i]>n[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=G(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new Vu({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&zp(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;R([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,U(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=SF[i],o=CF[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=u?1:0,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i<g.i&&(g=h,f.pagePrevDataIndex??=h.i,++f.pageCount,++f.pageIndex),h=_;return f;function v(e){if(e){var t=e.getBoundingRect(),n=t[o]+e[o];return{s:n,e:n+t[a],i:e.__legendDataIndex}}}function y(e,t){return e.e>=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(sF);function TF(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function EF(e){BE(vF),e.registerComponentModel(yF),e.registerComponentView(wF),TF(e)}function DF(e){BE(vF),BE(EF)}I();var OF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=mh(lP.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(lP),kF=mc();function AF(e,t,n){kF(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function jF(e,t){for(var n=kF(e).coordSysRecordMap,r=n.keys(),i=0;i<r.length;i++){var a=r[i],o=n.get(a),s=o.dataZoomInfoMap;if(s){var c=t.uid;s.get(c)&&(s.removeKey(c),s.keys().length||MF(n,o))}}}function MF(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function NF(e,t){var n={model:t,containsPoint:vt(FF,t),dispatchAction:vt(PF,e),dataZoomInfoMap:null,controller:null},r=n.controller=new iM(e.getZr());return R([`pan`,`zoom`,`scrollMove`],function(e){r.on(e,function(t){var r=[];n.dataZoomInfoMap.each(function(i){if(t.isAvailableBehavior(i.model.option)){var a=(i.getRange||{})[e],o=a&&a(i.dzReferCoordSysInfo,n.model.mainType,n.controller,t);!i.model.get(`disabled`,!0)&&o&&r.push({dataZoomId:i.model.id,start:o[0],end:o[1]})}}),r.length&&n.dispatchAction(r)})}),n}function PF(e,t){e.isDisposed()||e.dispatchAction({type:`dataZoom`,animation:{easing:`cubicOut`,duration:100},batch:t})}function FF(e,t,n,r){return e.coordinateSystem.containPoint([n,r])}function IF(e,t,n){var r,i=`type_`,a={type_true:2,type_move:1,type_false:0,type_undefined:-1},o=!0;return e.each(function(e){var t=e.model,n=t.get(`disabled`,!0)?!1:t.get(`zoomLock`,!0)?`move`:!0;a[i+n]>a[i+r]&&(r=n),o&&=t.get(`preventDefaultMouseMove`,!0)}),{controlType:r,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:n,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint}}}}function LF(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,function(e,t){var n=kF(t),r=n.coordSysRecordMap||=K();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){R(sP(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,NF(t,n.model));(a.dataZoomInfoMap||=K()).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var n=e.controller,i,a=e.dataZoomInfoMap;if(a){var o=a.keys()[0];o!=null&&(i=a.get(o))}if(!i){MF(r,e);return}var s=IF(a,e,t);n.enable(s.controlType,s.opt),Ob(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)})})}I();var RF=function(e){D(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){if(e.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),AF(r,t,{pan:B(zF.pan,this),zoom:B(zF.zoom,this),scrollMove:B(zF.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){jF(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(dP),zF={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=VF[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(mM(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:BF(function(e,t,n,r,i,a){var o=VF[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:BF(function(e,t,n,r,i,a){return VF[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function BF(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(mM(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var VF={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function HF(e){yP(e),e.registerComponentModel(OF),e.registerComponentView(RF),LF(e)}I();var UF=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=mh(lP.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:Z.color.accent10,borderRadius:0,backgroundColor:Z.color.transparent,dataBackground:{lineStyle:{color:Z.color.accent30,width:.5},areaStyle:{color:Z.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:Z.color.accent40,width:.5},areaStyle:{color:Z.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:Z.color.neutral00,borderColor:Z.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:Z.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:Z.color.tertiary},brushSelect:!0,brushStyle:{color:Z.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:Z.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(lP);I();var WF=Vu,GF=1,KF=30,qF=7,JF=`horizontal`,YF=`vertical`,XF=5,ZF=[`line`,`bar`,`candlestick`,`scatter`],QF={easing:`cubicOut`,duration:100,delay:0},$F=function(e){D(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=B(this._onBrush,this),this._onBrushEnd=B(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){if(e.prototype.render.apply(this,arguments),Ob(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!==`dataZoom`||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){kb(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new Wo;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?qF:0,r=Gg(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===JF?{right:r.width-i.x-i.width,top:r.height-KF-a-n,width:i.width,height:KF}:{right:a,top:i.y,width:KF,height:i.height},s=Yg(e.option);R([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=Ug(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===YF&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===JF&&!i?{scaleY:o?1:-1,scaleX:1}:n===JF&&i?{scaleY:o?1:-1,scaleX:-1}:n===YF&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]);e.x=t.x-s.x,e.y=t.y-s.y,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new WF({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new WF({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:B(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b){v||(y+=g);return}y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:fs(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new Wo,r=new lp({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new dp({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){R(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&<(ZF,e.get(`type`))<0)){var o=r.getComponent(aP(i),a).axis,s=eI(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new WF({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new WF({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:GF,fill:Z.color.transparent}})),R([0,1],function(t){var a=o.get(`handleIcon`);!Cx[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=Dx(a,-1,0,2,2,null,!0);s.attr({cursor:tI(this._orient),draggable:!0,drift:B(this._onDragMove,this,t),ondragend:B(this._onDragEnd,this),onmouseover:B(this._showDataInfo,this,!0),onmouseout:B(this._showDataInfo,this,!1),z2:5});var c=s.getBoundingRect();this._handleHeight=ps(o.get(`handleSize`),this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),tf(s);var l=o.get(`handleColor`);l!=null&&(s.style.fill=l),i.add(n[t]=s);var u=o.getModel(`textStyle`),d=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new X({silent:!0,invisible:!d,style:Vm(u,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:u.getTextColor(),font:u.getFont()}),z2:10}))},this);var d=u;if(l){var f=ps(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new Vu({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=Dx(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,Z.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new Vu({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`default`,drift:B(this._onDragMove,this,`all`),ondragstart:B(this._showDataInfo,this,!0),ondragend:B(this._onDragEnd,this),onmouseover:B(this._showDataInfo,this,!0),onmouseout:B(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[fs(e[0],[0,100],t,!0),fs(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];mM(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:fs(a.minSpan,o,i,!0),a.maxSpan==null?null:fs(a.maxSpan,o,i,!0));var s=this._range,c=this._range=_s([fs(r[0],i,o,!0),fs(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=_s(n.slice()),i=this._size;R([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;c<o.length;c++){var l=o[c],u=l.getClipPath();u||(u=new Vu,l.setClipPath(u)),u.setShape({x:s[c],y:0,width:s[c+1]-s[c],height:i[1]})}this._updateDataInfo(e)},t.prototype._updateDataInfo=function(e){var t=this.dataZoomModel,n=this._displayables,r=n.handleLabels,i=this._orient,a=[``,``];if(t.get(`showDetail`)){var o=t.findRepresentativeAxisProxy();if(o){var s=o.getAxisModel().axis,c=this._range,l=e?o.calculateDataWindow({start:c[0],end:c[1]}).valueWindow:o.getDataValueWindow();a=[this._formatLabel(l[0],s),this._formatLabel(l[1],s)]}}var u=_s(this._handleEnds.slice());d.call(this,0),d.call(this,1);function d(e){var t=lm(n.handles[e].parent,this.group),o=dm(e===0?`right`:`left`,t),s=this._handleWidth/2+XF,c=um([u[e]+(e===0?-s:s),this._size[1]/2],t);r[e].setStyle({x:c[0],y:c[1],verticalAlign:i===JF?`middle`:o,align:i===JF?o:`center`,text:a[e]})}},t.prototype._formatLabel=function(e,t){var n=this.dataZoomModel,r=n.get(`labelFormatter`),i=n.get(`labelPrecision`);(i==null||i===`auto`)&&(i=t.getPixelPrecision());var a=e==null||isNaN(e)?``:t.type===`category`||t.type===`time`?t.scale.getLabel({value:Math.round(e)}):e.toFixed(Math.min(i,20));return H(r)?r(e,a):U(r)?r.replace(`{value}`,a):a},t.prototype._showDataInfo=function(e){var t=(this.dataZoomModel.get(`handleLabel`)||{}).show||!1,n=this.dataZoomModel.getModel([`emphasis`,`handleLabel`]).get(`show`)||!1,r=e||this._dragging?n:t,i=this._displayables,a=i.handleLabels;a[0].attr(`invisible`,!r),a[1].attr(`invisible`,!r),i.moveHandle&&this.api[r?`enterEmphasis`:`leaveEmphasis`](i.moveHandle,1)},t.prototype._onDragMove=function(e,t,n,r){this._dragging=!0,qn(r.event);var i=this._displayables.sliderGroup.getLocalTransform(),a=um([t,n],i,!0),o=this._updateInterval(e,a[0]),s=this.dataZoomModel.get(`realtime`);this._updateView(!s),o&&s&&this._dispatchZoomAction(!0)},t.prototype._onDragEnd=function(){this._dragging=!1,this._showDataInfo(!1),!this.dataZoomModel.get(`realtime`)&&this._dispatchZoomAction(!1)},t.prototype._onClickPanel=function(e){var t=this._size,n=this._displayables.sliderGroup.transformCoordToLocal(e.offsetX,e.offsetY);if(!(n[0]<0||n[0]>t[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new lr(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();mM(0,a,r,0,o.minSpan==null?null:fs(o.minSpan,i,r,!0),o.maxSpan==null?null:fs(o.maxSpan,i,r,!0)),this._range=_s([fs(a[0],r,i,!0),fs(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(qn(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new WF({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?QF:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=sP(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(dP);function eI(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function tI(e){return e===`vertical`?`ns-resize`:`ew-resize`}function nI(e){e.registerComponentModel(UF),e.registerComponentView($F),yP(e)}function rI(e){BE(HF),BE(nI)}I();function iI(e,t,n){var r=Ve.createCanvas(),i=t.getWidth(),a=t.getHeight(),o=r.style;return o&&(o.position=`absolute`,o.left=`0`,o.top=`0`,o.width=i+`px`,o.height=a+`px`,r.setAttribute(`data-zr-dom-id`,e)),r.width=i*n,r.height=a*n,r}var aI=function(e){D(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.incremental=!1,i.zlevel=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__used=!1,i.__drawIndex=0,i.__startIndex=0,i.__endIndex=0,i.__prevStartIndex=null,i.__prevEndIndex=null;var a;r||=eo,typeof t==`string`?a=iI(t,n,r):W(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(Ut(a),a.onselectstart=function(){return!1},o.padding=`0`,o.margin=`0`,o.borderWidth=`0`),i.painter=n,i.dpr=r,i}return t.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},t.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},t.prototype.initContext=function(){this.ctx=this.dom.getContext(`2d`),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=iI(`back-`+this.id,this.painter,e),this.ctxBack=this.domBack.getContext(`2d`),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,t,n,r){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var i=[],a=this.maxRepaintRectCount,o=!1,s=new J(0,0,0,0);function c(e){if(!(!e.isFinite()||e.isZero()))if(i.length===0){var t=new J(0,0,0,0);t.copy(e),i.push(t)}else{for(var n=!1,r=1/0,c=0,l=0;l<i.length;++l){var u=i[l];if(u.intersect(e)){var d=new J(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}else if(o){s.copy(e),s.union(u);var f=e.width*e.height,p=u.width*u.height,m=s.width*s.height-f-p;m<r&&(r=m,c=l)}}if(o&&(i[c].union(e),n=!0),!n){var t=new J(0,0,0,0);t.copy(e),i.push(t)}o||=i.length>=a}}for(var l=this.__startIndex;l<this.__endIndex;++l){var u=e[l];if(u){var d=u.shouldBePainted(n,r,!0,!0),f=u.__isRendered&&(u.__dirty&1||!d)?u.getPrevPaintRect():null;f&&c(f);var p=d&&(u.__dirty&1||!u.__isRendered)?u.getPaintRect():null;p&&c(p)}}for(var l=this.__prevStartIndex;l<this.__prevEndIndex;++l){var u=t[l],d=u&&u.shouldBePainted(n,r,!0,!0);if(u&&(!d||!u.__zr)&&u.__isRendered){var f=u.getPrevPaintRect();f&&c(f)}}var m;do{m=!1;for(var l=0;l<i.length;){if(i[l].isZero()){i.splice(l,1);continue}for(var h=l+1;h<i.length;)i[l].intersect(i[h])?(m=!0,i[l].union(i[h]),i.splice(h,1)):h++;l++}}while(m);return this._paintRects=i,i},t.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},t.prototype.resize=function(e,t){var n=this.dpr,r=this.dom,i=r.style,a=this.domBack;i&&(i.width=e+`px`,i.height=t+`px`),r.width=e*n,r.height=t*n,a&&(a.width=e*n,a.height=t*n,n!==1&&this.ctxBack.scale(n,n))},t.prototype.clear=function(e,t,n){var r=this.dom,i=this.ctx,a=r.width,o=r.height;t||=this.clearColor;var s=this.motionBlur&&!e,c=this.lastFrameAlpha,l=this.dpr,u=this;s&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation=`copy`,this.ctxBack.drawImage(r,0,0,a/l,o/l));var d=this.domBack;function f(e,n,r,a){if(i.clearRect(e,n,r,a),t&&t!==`transparent`){var o=void 0;wt(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||Nx(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):Tt(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=Gx(i,t,{dirty:function(){u.setUnpainted(),u.painter.refresh()}})),i.save(),i.fillStyle=o||t,i.fillRect(e,n,r,a),i.restore()}s&&(i.save(),i.globalAlpha=c,i.drawImage(d,e,n,r,a),i.restore())}!n||s?f(0,0,a,o):n.length&&R(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(Sn),oI=1e5,sI=314159,cI=.01,lI=.001;function uI(e){return e?e.__builtin__?!0:!(typeof e.resize!=`function`||typeof e.refresh!=`function`):!1}function dI(e,t){var n=document.createElement(`div`);return n.style.cssText=[`position:relative`,`width:`+e+`px`,`height:`+t+`px`,`padding:0`,`margin:0`,`border-width:0`].join(`;`)+`;`,n}var fI=function(){function e(e,t,n,r){this.type=`canvas`,this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type=`canvas`;var i=!e.nodeName||e.nodeName.toUpperCase()===`CANVAS`;this._opts=n=L({},n||{}),this.dpr=n.devicePixelRatio||eo,this._singleCanvas=i,this.root=e,e.style&&(Ut(e),e.innerHTML=``),this.storage=t;var a=this._zlevelList;this._prevDisplayList=[];var o=this._layers;if(i){var s=e,c=s.width,l=s.height;n.width!=null&&(c=n.width),n.height!=null&&(l=n.height),this.dpr=n.devicePixelRatio||1,s.width=c*this.dpr,s.height=l*this.dpr,this._width=c,this._height=l;var u=new aI(s,this,this.dpr);u.__builtin__=!0,u.initContext(),o[sI]=u,u.zlevel=sI,a.push(sI),this._domRoot=e}else{this._width=Ix(e,0,n),this._height=Ix(e,1,n);var d=this._domRoot=dI(this._width,this._height);e.appendChild(d)}}return e.prototype.getType=function(){return`canvas`},e.prototype.isSingleCanvas=function(){return this._singleCanvas},e.prototype.getViewportRoot=function(){return this._domRoot},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.refresh=function(e){var t=this.storage.getDisplayList(!0),n=this._prevDisplayList,r=this._zlevelList;this._redrawId=Math.random(),this._paintList(t,n,e,this._redrawId);for(var i=0;i<r.length;i++){var a=r[i],o=this._layers[a];if(!o.__builtin__&&o.refresh){var s=i===0?this._backgroundColor:null;o.refresh(s)}}return this._opts.useDirtyRect&&(this._prevDisplayList=t.slice()),this},e.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},e.prototype._paintHoverList=function(e){var t=e.length,n=this._hoverlayer;if(n&&n.clear(),t){for(var r={inHover:!0,viewWidth:this._width,viewHeight:this._height},i,a=0;a<t;a++){var o=e[a];o.__inHover&&(n||=this._hoverlayer=this.getLayer(oI),i||(i=n.ctx,i.save()),dS(i,o,r,a===t-1))}i&&i.restore()}},e.prototype.getHoverLayer=function(){return this.getLayer(oI)},e.prototype.paintOne=function(e,t){uS(e,t)},e.prototype._paintList=function(e,t,n,r){if(this._redrawId===r){n||=!1,this._updateLayerStatus(e);var i=this._doPaintList(e,t,n),a=i.finished,o=i.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),o&&this._paintHoverList(e),a)this.eachLayer(function(e){e.afterBrush&&e.afterBrush()});else{var s=this;Qr(function(){s._paintList(e,t,n,r)})}}},e.prototype._compositeManually=function(){var e=this.getLayer(sI).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),this.eachBuiltinLayer(function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)})},e.prototype._doPaintList=function(e,t,n){for(var r=this,i=[],a=this._opts.useDirtyRect,o=0;o<this._zlevelList.length;o++){var s=this._zlevelList[o],c=this._layers[s];c.__builtin__&&c!==this._hoverlayer&&(c.__dirty||n)&&i.push(c)}for(var l=!0,u=!1,d=function(o){var s=i[o],c=s.ctx,d=a&&s.createRepaintRects(e,t,f._width,f._height),p=n?s.__startIndex:s.__drawIndex,m=!n&&s.incremental&&Date.now,h=m&&Date.now(),g=s.zlevel===f._zlevelList[0]?f._backgroundColor:null;if(s.__startIndex===s.__endIndex)s.clear(!1,g,d);else if(p===s.__startIndex){var _=e[p];(!_.incremental||!_.notClear||n)&&s.clear(!1,g,d)}p===-1&&(console.error(`For some unknown reason. drawIndex is -1`),p=s.__startIndex);var v,y=function(t){var n={inHover:!1,allClipped:!1,prevEl:null,viewWidth:r._width,viewHeight:r._height};for(v=p;v<s.__endIndex;v++){var i=e[v];if(i.__inHover&&(u=!0),r._doPaintEl(i,s,a,t,n,v===s.__endIndex-1),m&&Date.now()-h>15)break}n.prevElClipPaths&&c.restore()};if(d)if(d.length===0)v=s.__endIndex;else for(var b=f.dpr,x=0;x<d.length;++x){var S=d[x];c.save(),c.beginPath(),c.rect(S.x*b,S.y*b,S.width*b,S.height*b),c.clip(),y(S),c.restore()}else c.save(),y(),c.restore();s.__drawIndex=v,s.__drawIndex<s.__endIndex&&(l=!1)},f=this,p=0;p<i.length;p++)d(p);return Ne.wxa&&R(this._layers,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),{finished:l,needsRefreshHover:u}},e.prototype._doPaintEl=function(e,t,n,r,i,a){var o=t.ctx;if(n){var s=e.getPaintRect();(!r||s&&s.intersect(r))&&(dS(o,e,i,a),e.setPrevPaintRect(s))}else dS(o,e,i,a)},e.prototype.getLayer=function(e,t){this._singleCanvas&&!this._needsManuallyCompositing&&(e=sI);var n=this._layers[e];return n||(n=new aI(`zr_`+e,this,this.dpr),n.zlevel=e,n.__builtin__=!0,this._layerConfig[e]?at(n,this._layerConfig[e],!0):this._layerConfig[e-cI]&&at(n,this._layerConfig[e-cI],!0),t&&(n.virtual=t),this.insertLayer(e,n),n.initContext()),n},e.prototype.insertLayer=function(e,t){var n=this._layers,r=this._zlevelList,i=r.length,a=this._domRoot,o=null,s=-1;if(!n[e]&&uI(t)){if(i>0&&e>r[0]){for(s=0;s<i-1&&!(r[s]<e&&r[s+1]>e);s++);o=n[r[s]]}if(r.splice(s+1,0,e),n[e]=t,!t.virtual)if(o){var c=o.dom;c.nextSibling?a.insertBefore(t.dom,c.nextSibling):a.appendChild(t.dom)}else a.firstChild?a.insertBefore(t.dom,a.firstChild):a.appendChild(t.dom);t.painter||=this}},e.prototype.eachLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r];e.call(t,this._layers[i],i)}},e.prototype.eachBuiltinLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r],a=this._layers[i];a.__builtin__&&e.call(t,a,i)}},e.prototype.eachOtherLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r],a=this._layers[i];a.__builtin__||e.call(t,a,i)}},e.prototype.getLayers=function(){return this._layers},e.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(e,t){e.__dirty=e.__used=!1});function t(e){i&&(i.__endIndex!==e&&(i.__dirty=!0),i.__endIndex=e)}if(this._singleCanvas)for(var n=1;n<e.length;n++){var r=e[n];if(r.zlevel!==e[n-1].zlevel||r.incremental){this._needsManuallyCompositing=!0;break}}var i=null,a=0,o,s;for(s=0;s<e.length;s++){var r=e[s],c=r.zlevel,l=void 0;o!==c&&(o=c,a=0),r.incremental?(l=this.getLayer(c+lI,this._needsManuallyCompositing),l.incremental=!0,a=1):l=this.getLayer(c+(a>0?cI:0),this._needsManuallyCompositing),l.__builtin__||rt(`ZLevel `+c+` has been used by unkown layer `+l.id),l!==i&&(l.__used=!0,l.__startIndex!==s&&(l.__dirty=!0),l.__startIndex=s,l.incremental?l.__drawIndex=-1:l.__drawIndex=s,t(s),i=l),r.__dirty&1&&!r.__inHover&&(l.__dirty=!0,l.incremental&&l.__drawIndex<0&&(l.__drawIndex=s))}t(s),this.eachBuiltinLayer(function(e,t){!e.__used&&e.getElementCount()>0&&(e.__dirty=!0,e.__startIndex=e.__endIndex=e.__drawIndex=0),e.__dirty&&e.__drawIndex<0&&(e.__drawIndex=e.__startIndex)})},e.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},e.prototype._clearLayer=function(e){e.clear()},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,R(this._layers,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?at(n[e],t,!0):n[e]=t;for(var r=0;r<this._zlevelList.length;r++){var i=this._zlevelList[r];if(i===e||i===e+cI){var a=this._layers[i];at(a,n[e],!0)}}}},e.prototype.delLayer=function(e){var t=this._layers,n=this._zlevelList,r=t[e];r&&(r.dom.parentNode.removeChild(r.dom),delete t[e],n.splice(lt(n,e),1))},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;if(e!=null&&(r.width=e),t!=null&&(r.height=t),e=Ix(i,0,r),t=Ix(i,1,r),n.style.display=``,this._width!==e||t!==this._height){for(var a in n.style.width=e+`px`,n.style.height=t+`px`,this._layers)this._layers.hasOwnProperty(a)&&this._layers[a].resize(e,t);this.refresh(!0)}this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this.getLayer(sI).resize(e,t)}return this},e.prototype.clearLayer=function(e){var t=this._layers[e];t&&t.clear()},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._layers=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._layers[sI].dom;var t=new aI(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;this.eachLayer(function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height},o=this.storage.getDisplayList(!0),s=0,c=o.length;s<c;s++){var l=o[s];dS(n,l,a,s===c-1)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}();function pI(e){e.registerPainter(`canvas`,fI)}function mI(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}var hI=[`#6366f1`,`#f59e0b`,`#10b981`,`#ef4444`,`#8b5cf6`,`#ec4899`,`#06b6d4`,`#f97316`,`#14b8a6`,`#a855f7`,`#84cc16`,`#e879f9`,`#22d3ee`,`#fb923c`,`#34d399`,`#c084fc`,`#fbbf24`,`#2dd4bf`,`#f472b6`,`#a3e635`],gI={"gpt-5.5":`#cf5a43`,"gpt-5.4":`#f472b6`,"gpt-5-mini":`#fb7185`,"gpt-5.4-mini":`#fb7185`,"gpt-5-nano":`#fda4af`,"gpt-5.4-nano":`#fda4af`,"gpt-5.3-codex":`#f59e0b`,"gpt-5.3-codex-spark":`#fbbf24`,"gpt-5.2-codex":`#6366f1`,"gpt-5.2":`#818cf8`,"gpt-5.1-codex-mini":`#a78bfa`,"gpt-4.1":`#06b6d4`,"gpt-4.1-mini":`#14b8a6`,"gpt-4.1-nano":`#2dd4bf`,o3:`#a855f7`,"o3-mini":`#c084fc`,"o4-mini":`#e879f9`,"gpt-4o":`#ec4899`,"gpt-4o-mini":`#22d3ee`,"gpt-4-turbo":`#ef4444`,"gpt-4":`#f97316`,"gpt-3.5-turbo":`#84cc16`,unknown:`#475569`},_I={review:`#06b6d4`,exploration:`#f97316`,planning:`#eab308`,memory:`#ec4899`,generic:`#64748b`},vI={low:`#10b981`,medium:`#06b6d4`,high:`#f59e0b`,xhigh:`#a855f7`,"x-high":`#a855f7`,unknown:`#64748b`};function yI(e){if(!e)return`unknown`;let t=String(e).toLowerCase().trim().replace(/-/g,``);return t===`low`?`low`:t===`medium`?`medium`:t===`high`?`high`:t===`xhigh`?`xhigh`:t===`unknown`?`unknown`:t}function bI(e){return hI[mI(e)%hI.length]}function xI(e){let t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return`#ffffff`;let n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,i=parseInt(t[3],16)/255;return .2126*n+.7152*r+.0722*i>.5?`#1f2937`:`#ffffff`}function SI(e,t,n){t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o=0,s=0,c=0;e<60?(o=r,s=i):e<120?(o=i,s=r):e<180?(s=r,c=i):e<240?(s=i,c=r):e<300?(o=i,c=r):(o=r,c=i);let l=e=>Math.round((e+a)*255).toString(16).padStart(2,`0`);return`#`+l(o)+l(s)+l(c)}function CI(e){return gI[e]?gI[e]:SI(mI(e)%300,72,62)}function wI(e){return _I[e]||`#64748b`}function TI(e){return vI[yI(e)]??`#64748b`}function EI(e){if(e==null||!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e9?DI(e,1e9,`B`):t>=1e6?DI(e,1e6,`M`):t>=1e3?DI(e,1e3,`K`):Math.round(e).toLocaleString()}function DI(e,t,n){let r=e/t,i=Math.abs(r)>=100?0:1;return`${r.toFixed(i)}${n}`}var OI=`auto`,kI={speed:1,live:{frameIntervalMs:33,overviewHz:20,dayKeysPerEmit:1},main:{presentationDurationMs:220,chartAppearDurationMs:0,chartUpdateDurationMs:200,easing:`linear`,easingUpdate:`linear`},tail:{enabled:!0,startPercent:.5,durationMs:OI,durationScale:10,easing:`cubicOut`,overviewHz:10},daily:{chartAppearDurationMs:OI,chartUpdateDurationMs:60,easing:OI,easingUpdate:OI},bars:{chartAppearDurationMs:OI,chartUpdateDurationMs:20,easing:OI,easingUpdate:OI},donuts:{chartAppearDurationMs:OI,chartUpdateDurationMs:OI,easing:OI,easingUpdate:`linear`,seriesAnimation:!1},heatmap:{popDurationMs:380,settleThreshold:.998,intensityRiseThreshold:.08,whiteThreshold:.88,nearMaxRatio:.985},videoExport:{width:1080,height:864,fps:60,frontloadSettledFrameCount:1,introFadeEnabled:!0,introFadeStartOpacity:.95,introContentStartOpacity:.05,introFadeDurationMs:400,introFadeDelayMs:0,introFadeEasing:`cubicOut`,startHoldDurationMs:100,replayDurationMs:1e4,tailDurationMs:5e3,replayEasing:`cubicInOut`,tailSourceFraction:.55,tailEasing:`cubicOut`,finalHoldDurationMs:5e3,finalFlashDurationMs:1e3,finalFlashMaxOpacity:.35,displayTweenStartMs:200,displayTweenBaseMs:240,displayTweenLateMs:420,displayTweenLateWindowMs:2200,chartIntroWindowMs:2200,barsChartIntroUpdateDurationMs:320,barsChartUpdateDurationMs:50,barsChartTailUpdateDurationMs:240,donutsChartIntroUpdateDurationMs:360,donutsChartUpdateDurationMs:50,donutsChartTailUpdateDurationMs:240,supersampleScale:2,captureFormat:`png`,jpegQuality:92,crf:5,encoderPreset:`veryfast`}},AI={animationDuration:750,animationDurationUpdate:220,animationEasing:`cubicOut`,animationEasingUpdate:`cubicOut`},jI={show:!0,animationDuration:250,animationDurationUpdate:220,animationDelay:250,animationDelayUpdate:180,animationEasing:`cubicOut`,animationEasingUpdate:`cubicOut`},MI={...AI,animationDurationUpdate:200,animationDelayUpdate:0,animationEasingUpdate:`cubicOut`},NI={animationDuration:700,animationDurationUpdate:220,animationDelay:250,animationDelayUpdate:140,animationEasing:`cubicOut`,animationEasingUpdate:`cubicOut`},PI={...jI,animationDelay:950,animationDelayUpdate:360};function FI(e){return Number.isFinite(e)&&e>0?e:1}function II(e){return Math.max(0,Math.round(e/FI(kI.speed)))}function LI(e,t){return e===`auto`?II(t):e}function RI(e,t){return e===`auto`?t:e}function zI(e){return{animation:!0,animationDuration:LI(e.chartAppearDurationMs,kI.main.chartAppearDurationMs),animationDurationUpdate:LI(e.chartUpdateDurationMs,kI.main.chartUpdateDurationMs),animationEasing:RI(e.easing,kI.main.easing),animationEasingUpdate:RI(e.easingUpdate,kI.main.easingUpdate)}}var BI=II(kI.main.presentationDurationMs);function VI(e=0,t=!1){let n=BI,r=kI.tail;if(!t||!r?.enabled)return n;let i=Math.min(Math.max(r.startPercent??.9,0),.999),a=Math.min(Math.max(e||0,0),1);if(a<=i)return n;let o=(a-i)/Math.max(1-i,.001),s=r.durationMs===`auto`?Math.round(n*Math.max(r.durationScale||1,1)):r.durationMs;return Math.round(n+(s-n)*JI(o))}function HI(e=0,t=!1){let n=kI.tail;if(!t||!n?.enabled)return`linear`;let r=Math.min(Math.max(n.startPercent??.9,0),.999);return Math.min(Math.max(e||0,0),1)<=r?`linear`:n.easing||`cubicOut`}function UI(e=0,t=!1){let n=kI.tail;if(!t||!n?.enabled)return!1;let r=Math.min(Math.max(n.startPercent??.9,0),.999);return Math.min(Math.max(e||0,0),1)>r}zI({chartAppearDurationMs:OI,chartUpdateDurationMs:OI,easing:OI,easingUpdate:OI});var WI=zI(kI.daily),GI=zI(kI.bars),KI=zI(kI.donuts),qI=kI.donuts.seriesAnimation;function JI(e){return 1-(1-Math.min(Math.max(e,0),1))**3}function YI(e,t,n){return e+(t-e)*n}function XI(e){return Number.isFinite(e)?e:0}function ZI(e,t){return Array.isArray(e?.data)?e.data:Array.isArray(e)?e:e?.data?.[t]||e?.data?.total||[]}function QI(e,t){return t?.length?e===`d7`?t.slice(-7):e===`d30`?t.slice(-30):t:[]}function $I(e,t,n){return e.map(e=>({key:e?.[t]||``,label:e?.[n]||``,tokens:XI(e?.tokens)})).filter(e=>e.key)}function eL(e,t){let n=Array.isArray(e?.data)?e.data:Array.isArray(e)?e:[];if(!n.length)return{dates:[],series:[]};let r=QI(t,n.map(e=>e.date)),i=new Map(n.map(e=>[e.date,e])),a=new Set;for(let e of r){let t=i.get(e);for(let e of Object.keys(t?.by_model||{}))a.add(e)}return{dates:r,series:[...a].map(e=>({key:e,label:e,data:r.map(t=>XI(i.get(t)?.by_model?.[e]?.tokens))}))}}function tL(e,t){let n=Array.isArray(e?.data)?e.data:Array.isArray(e)?e:[];if(!n.length)return[];let r=new Set(QI(t,n.map(e=>e.date)));return n.filter(e=>r.has(e.date))}function nL(e,t){let n=tL(e,t);return{tokens:n.reduce((e,t)=>e+XI(t?.tokens),0),elapsed:n.reduce((e,t)=>e+XI(t?.elapsed_seconds),0),cost:n.reduce((e,t)=>e+XI(t?.cost),0),days:n.length||1}}function rL(e){let t=e?.data&&typeof e.data==`object`?e.data:{},n={};for(let[e,r]of Object.entries(t))n[e]={tokens:XI(r?.tokens),elapsed:XI(r?.elapsed),cost:XI(r?.cost)};return n}function iL({overview:e,heatmap:t,daily:n,families:r,repos:i,models:a,range:o}){let s=e?.data;if(!s)return{ready:!0,stats:{tokens:0,elapsed:0,cost:0,sessions:0,enriched:0,priced:0,exactPriced:0,fallbackPriced:0,unpriced:0,days:1},topRepos:[],topFamilies:[],topModels:[],daily:{dates:[],series:[]},heatmap:{}};let c=s?.[o]||s?.total||{},l=c.coverage||{},u=XI(l.thread_rows??l.total),d=XI(l.root_sessions??c.total_sessions),f=XI(l.priced),p=XI(l.priced_exact),m=XI(l.priced_fallback),h=XI(l.unpriced??Math.max(u-f,0)),g=c.date_range,_=g?.from!=null&&g?.to!=null?Math.max(1,Math.ceil((g.to-g.from)/86400)):1,v=nL(n,o),y=o===`d7`||o===`d30`;return{ready:!0,stats:{tokens:y?v.tokens:XI(c.total_tokens),elapsed:y?v.elapsed:XI(c.total_elapsed_seconds),cost:y?v.cost:XI(c.total_cost),sessions:d,enriched:XI(l.enriched),priced:f,exactPriced:p,fallbackPriced:m,unpriced:h,days:y?v.days:_},topRepos:$I(ZI(i,o).slice(0,6),`repo_label`,`repo_label`),topFamilies:$I(ZI(r,o),`family`,`family`),topModels:$I(ZI(a,o).slice(0,6),`model_name`,`model_name`),daily:eL(n,o),heatmap:rL(t)}}function aL(e,t,n){let r=new Map((e||[]).map(e=>[e.key,e])),i=new Map((t||[]).map(e=>[e.key,e])),a=[],o=new Set;for(let e of t||[])o.has(e.key)||(o.add(e.key),a.push(e.key));for(let t of e||[])o.has(t.key)||(o.add(t.key),a.push(t.key));let s=[];for(let e of a){let t=r.get(e),a=i.get(e),o=a?.label||t?.label||e,c=YI(XI(t?.tokens),XI(a?.tokens),n);c<=.001&&!a||s.push({key:e,label:o,tokens:c})}return s}function oL(e,t,n){let r=(t?.dates?.length?t.dates:e?.dates||[]).slice(),i=new Map((e?.series||[]).map(e=>[e.key,e])),a=new Map((t?.series||[]).map(e=>[e.key,e])),o=new Set([...i.keys(),...a.keys()]),s=[];for(let c of o){let o=i.get(c),l=a.get(c),u=new Map((o?.data||[]).map((t,n)=>[e?.dates?.[n],t])),d=new Map((l?.data||[]).map((e,n)=>[t?.dates?.[n],e])),f=r.map(e=>YI(XI(u.get(e)),XI(d.get(e)),n));f.every(e=>e<=.001)&&!l||s.push({key:c,label:l?.label||o?.label||c,data:f})}return{dates:r,series:s}}function sL(e){return{dates:e.dates,series:(e.series||[]).map(e=>({key:e.key,label:e.label,data:e.data.map(()=>0)}))}}function cL(e,t,n){let r=new Set([...Object.keys(e||{}),...Object.keys(t||{})]),i={};for(let a of r){let r=e?.[a],o=t?.[a];i[a]={tokens:YI(XI(r?.tokens),XI(o?.tokens),n),elapsed:YI(XI(r?.elapsed),XI(o?.elapsed),n),cost:YI(XI(r?.cost),XI(o?.cost),n)}}return i}function lL(e,t,n){return{ready:t.ready,stats:{tokens:YI(XI(e?.stats?.tokens),XI(t?.stats?.tokens),n),elapsed:YI(XI(e?.stats?.elapsed),XI(t?.stats?.elapsed),n),cost:YI(XI(e?.stats?.cost),XI(t?.stats?.cost),n),sessions:YI(XI(e?.stats?.sessions),XI(t?.stats?.sessions),n),enriched:YI(XI(e?.stats?.enriched),XI(t?.stats?.enriched),n),priced:YI(XI(e?.stats?.priced),XI(t?.stats?.priced),n),exactPriced:YI(XI(e?.stats?.exactPriced),XI(t?.stats?.exactPriced),n),fallbackPriced:YI(XI(e?.stats?.fallbackPriced),XI(t?.stats?.fallbackPriced),n),unpriced:YI(XI(e?.stats?.unpriced),XI(t?.stats?.unpriced),n),days:XI(t?.stats?.days)||1},topRepos:aL(e?.topRepos,t?.topRepos,n),topFamilies:aL(e?.topFamilies,t?.topFamilies,n),topModels:aL(e?.topModels,t?.topModels,n),daily:oL(e?.daily,t?.daily,n),heatmap:cL(e?.heatmap,t?.heatmap,n)}}function uL(e,{duration:t=BI,onSettledChange:n,ingestProgress:r=0,isIngestActive:i=!1,clockNowMs:a=null}={}){let o=(0,b.useMemo)(()=>iL(e),[e.overview,e.heatmap,e.daily,e.families,e.repos,e.models,e.range]),[s,c]=(0,b.useState)(o),l=(0,b.useRef)(o),u=(0,b.useRef)(o),d=(0,b.useRef)(0),f=(0,b.useRef)(0),p=(0,b.useRef)(s),m=(0,b.useRef)(!0),h=(0,b.useRef)(n),g=(0,b.useRef)(0),_=(0,b.useRef)(o),v=(0,b.useRef)(o),y=(0,b.useRef)(`smooth`);(0,b.useEffect)(()=>{h.current=n},[n]);let x=e=>{m.current!==e&&(m.current=e,h.current?.(e))};(0,b.useEffect)(()=>{p.current=s},[s]);let S=e=>{l.current=e,u.current=e,p.current=e,c(e),x(!0),f.current=0,g.current=0,_.current=e,v.current=e},C=e=>{u.current=e,x(!1);let t=UI(r,i)?`tail`:`smooth`;y.current!==t&&(y.current=t,g.current=0),t===`tail`&&(_.current=l.current,v.current=e,g.current=0)},w=(e,n)=>{e<f.current&&(f.current=0,g.current=0,_.current=l.current,v.current=n),f.current||=e;let a=Math.max(1,e-f.current);f.current=e;let o=VI(r,i)||t,s=l.current,u=UI(r,i)?`tail`:`smooth`;y.current!==u&&(y.current=u,g.current=0);let d,m;if(u===`tail`){v.current!==n&&(_.current=s,v.current=n,g.current=e),g.current||=e;let t=Math.max(0,e-g.current),a=Math.min(1,t/Math.max(o,1)),c=dL(a,HI(r,i));d=lL(_.current,v.current,c),m=a>=1||fL(d,n)<=.002}else{let e=dL(1-Math.exp(-a/Math.max(o,1)),HI(r,i));d=lL(s,n,e),m=e>=.999||fL(d,n)<=.002}return l.current=d,m?(l.current=n,p.current=n,c(n),x(!0),g.current=0,_.current=n,v.current=n,n):(p.current=d,c(d),d)};return(0,b.useLayoutEffect)(()=>{if(a!=null){if(t<=0){S(o);return}C(o),w(a,o)}},[o,t,r,i,a]),(0,b.useEffect)(()=>{if(a!=null)return;if(u.current=o,t<=0){S(o);return}if(C(o),d.current)return;let e=t=>{if(w(t,u.current)===u.current&&m.current){d.current=0,f.current=0;return}d.current=requestAnimationFrame(e)};d.current=requestAnimationFrame(e)},[o,t,r,i,a]),(0,b.useEffect)(()=>()=>{d.current&&cancelAnimationFrame(d.current),d.current=0,f.current=0},[]),s}function dL(e,t){let n=Math.min(Math.max(e,0),1);return t===`cubicOut`?1-(1-n)**3:n}function fL(e,t){if(!e||!t)return 0;let n=Math.max(Math.abs((e.stats?.tokens||0)-(t.stats?.tokens||0)),Math.abs((e.stats?.elapsed||0)-(t.stats?.elapsed||0)),Math.abs((e.stats?.cost||0)-(t.stats?.cost||0)),Math.abs((e.stats?.sessions||0)-(t.stats?.sessions||0))),r=pL(e.topRepos,t.topRepos),i=pL(e.topFamilies,t.topFamilies),a=pL(e.topModels,t.topModels),o=mL(e.daily,t.daily);return Math.max(n,r,i,a,o)/Math.max(1,t.stats?.tokens||1)}function pL(e=[],t=[]){let n=new Map(e.map(e=>[e.key,e.tokens||0])),r=0;for(let e of t)r=Math.max(r,Math.abs((n.get(e.key)||0)-(e.tokens||0)));return r}function mL(e,t){let n=new Map((e?.series||[]).map(e=>[e.key,e])),r=0;for(let e of t?.series||[]){let t=n.get(e.key);for(let n=0;n<e.data.length;n+=1)r=Math.max(r,Math.abs((t?.data?.[n]||0)-(e.data[n]||0)))}return r}function hL(e,t){let n=new Map((e?.series||[]).map(e=>[e.key,e])),r=0;for(let e of t?.series||[]){let t=n.get(e.key);for(let n=0;n<(e.data?.length||0);n+=1)r=Math.max(r,Math.abs((t?.data?.[n]||0)-(e.data[n]||0)))}return r}function gL(e){let t=0;for(let n of e?.series||[])for(let e of n.data||[])t=Math.max(t,Math.abs(e||0));return t}function _L(e,t,n=``){let[r,i]=(0,b.useState)(e),a=(0,b.useRef)(e),o=(0,b.useRef)(e),s=(0,b.useRef)(0),c=(0,b.useRef)(0),l=(0,b.useRef)(n),u=(0,b.useRef)(t),d=t&&l.current!==n;return(0,b.useLayoutEffect)(()=>{o.current=e;let r=!u.current&&t;if(u.current=t,!t){s.current&&cancelAnimationFrame(s.current),s.current=0,c.current=0,a.current=e,l.current=n;return}if(l.current!==n){s.current&&cancelAnimationFrame(s.current),s.current=0,c.current=0;let t=sL(e);a.current=t,i(t),l.current=n;return}r&&(a.current=e,i(e))},[e,t,n]),(0,b.useEffect)(()=>{if(o.current=e,!t)return;let n=BI,r=e=>{let t=o.current;c.current||=e;let l=Math.max(1,e-c.current);c.current=e;let u=1-Math.exp(-l/Math.max(n,1)),d=oL(a.current,t,u);a.current=d,i(d);let f=Math.max(1,gL(t));if(hL(d,t)<=f*.002||u>=.999){a.current=t,i(t),s.current=0,c.current=0;return}s.current=requestAnimationFrame(r)};s.current||=(c.current=0,requestAnimationFrame(r))},[e,t,n]),(0,b.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current),s.current=0,c.current=0},[]),t?d?sL(e):r:e}var vL=s((e=>{var t=Symbol.for(`react.transitional.element`);function n(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.jsx=n,e.jsxs=n})),$=s(((e,t)=>{t.exports=vL()}))();BE([Uk,dA,LN,QP,tF,DF,pI]);function yL(e){return EI(e)}function bL(e){return e==null?`—`:e>=1e3?`$`+(e/1e3).toFixed(1)+`K`:`$`+e.toFixed(2)}function xL(e){return e?(e/3600).toFixed(1)+`h`:`0h`}function SL(e,t=16){if(!e)return``;let n=String(e).split(/([-/])/).filter(Boolean),r=[``];for(let e of n){let n=r[r.length-1];if(!n.length||(n+e).length<=t){r[r.length-1]=n+e;continue}if(r.length===2){r[1]+=e;break}r.push(e)}return r.join(`
|
|
28
|
+
`)}function CL(e){return e<=7?{barWidth:`72%`,barMaxWidth:28}:e<=30?{barWidth:`54%`,barMaxWidth:18}:{barWidth:null,barMaxWidth:12}}function wL(e){let t=Array.isArray(e?.data)?e.data:Array.isArray(e)?e:[];if(!t.length)return{dates:[],series:[]};let n=t.map(e=>e.date),r=new Map(t.map(e=>[e.date,e])),i=new Set;for(let e of t)for(let t of Object.keys(e?.by_model||{}))i.add(t);return{dates:n,series:[...i].map(e=>({key:e,label:e,data:n.map(t=>{let n=r.get(t)?.by_model?.[e]?.tokens;return Number.isFinite(n)?n:0})}))}}function TL(e,t){if(!t)return{startValue:0,endValue:0};let n=t;return e===`d7`&&(n=7),e===`d30`&&(n=30),{startValue:t-Math.max(1,Math.min(n,t)),endValue:t-1}}function EL(e,t,n,r,i){if(cancelAnimationFrame(r.current),r.current=0,Math.round(e.startValue)===Math.round(t.startValue)&&Math.round(e.endValue)===Math.round(t.endValue))return;let a=0,o=s=>{a||=s;let c=Math.min(1,(s-a)/i),l=1-(1-c)**3;n({startValue:Math.round(e.startValue+(t.startValue-e.startValue)*l),endValue:Math.round(e.endValue+(t.endValue-e.endValue)*l)}),r.current=c<1?requestAnimationFrame(o):0};return r.current=requestAnimationFrame(o),()=>{cancelAnimationFrame(r.current),r.current=0}}function DL(e,t){return e.map(e=>{let n=t(e.key);return{name:e.label,value:e.tokens,itemStyle:{color:n},label:{show:!0,color:n},labelLine:{show:!0}}})}function OL(e,t){return e.map(e=>({...e,tokens:Math.max(0,(e.tokens||0)*t)}))}function kL(e,t){let n=new Map((t||[]).map(e=>[e.key,e])),r=[],i=new Set;for(let t of e||[]){if(!t?.key||i.has(t.key))continue;i.add(t.key);let e=n.get(t.key);r.push({key:t.key,label:e?.label||t.label,tokens:Math.max(0,e?.tokens??t.tokens??0)})}for(let e of t||[])!e?.key||i.has(e.key)||(i.add(e.key),r.push({key:e.key,label:e.label,tokens:Math.max(0,e.tokens||0)}));return r}function AL(e){return e.length===1?e=>{let t=e.rect||{x:0,y:0,width:0,height:0},n=e.labelRect||{width:0,height:0};return{x:t.x+t.width+14,y:t.y+t.height/2-n.height/2,align:`left`,verticalAlign:`middle`,moveOverlap:`shiftY`,hideOverlap:!1}}:null}function jL({daily:e,fullDaily:t=null,range:n=`total`,exportMode:r=!1,exportPlayback:i=!1,onDayClick:a}){let o=i&&e?.dates?.length?e:t;if(!o?.dates?.length)return(0,$.jsxs)(`div`,{className:`overview-daily-spark overview-daily-spark-empty`,children:[(0,$.jsx)(`span`,{className:`overview-daily-spark-title`,children:`Daily Usage`}),(0,$.jsx)(`span`,{className:`overview-daily-spark-empty-text`,children:`No daily data`})]});let[s,c]=(0,b.useState)(()=>TL(n,o.dates.length)),l=(0,b.useRef)(s);l.current=s;let u=(0,b.useRef)(0);(0,b.useMemo)(()=>TL(n,o.dates.length),[n,o.dates.length]);let d=_L(o,!r&&!i,`overview-daily-spark`);(0,b.useEffect)(()=>{let e=TL(n,o.dates.length);return EL(l.current,e,c,u,220)},[n,o.dates.length]),(0,b.useEffect)(()=>()=>{cancelAnimationFrame(u.current),u.current=0},[]);let{startValue:f,endValue:p}=s,{barWidth:m,barMaxWidth:h}=CL(Math.max(1,p-f+1||o.dates.length)),g={backgroundColor:`transparent`,...WI,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{if(!e?.length)return``;let t=`<b>${e[0].axisValue}</b><br/>`,n=0,r=[...e].filter(e=>e.value>0).sort((e,t)=>(t.value||0)-(e.value||0));for(let e of r)t+=`${e.marker} ${e.seriesName}: ${yL(e.value)}<br/>`,n+=e.value;return t+=`<b>Total: ${yL(n)}</b>`,t}},grid:{left:4,right:4,top:4,bottom:4},xAxis:{type:`category`,data:o.dates,show:!1},yAxis:{type:`value`,show:!1,scale:!1,min:0},dataZoom:[{type:`inside`,filterMode:`filter`,zoomLock:!0,startValue:s.startValue,endValue:s.endValue,disabled:!0}],series:d.series.map(e=>({name:e.label,type:`bar`,stack:`total`,data:e.data,itemStyle:{color:CI(e.key)},...m?{barWidth:m}:{},barMaxWidth:h}))},_=a&&!r&&!i?{click:e=>{let t=e?.axisValue||e?.name;t&&a(t)}}:void 0;return(0,$.jsxs)(`div`,{className:`overview-daily-spark`,children:[(0,$.jsx)(`span`,{className:`overview-daily-spark-title`,children:`Daily Usage`}),(0,$.jsx)(`div`,{className:`overview-daily-spark-chart`,style:_?{cursor:`pointer`}:void 0,children:(0,$.jsx)(je,{echarts:mO,option:g,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!1,notMerge:r,onEvents:_})})]})}var ML=[{key:`tokens`,label:`Tokens`,fmt:yL},{key:`elapsed`,label:`Time`,fmt:e=>xL(e)},{key:`cost`,label:`Cost`,fmt:bL}],NL=kI.heatmap?.popDurationMs??380,PL=kI.heatmap?.settleThreshold??.998;function FL({heatmapData:e,isIngestActive:t=!1,ingestProgress:n=0,onDayClick:r,interactive:i=!0}){let[a,o]=(0,b.useState)(`tokens`),[s,c]=(0,b.useState)(new Set),[l,u]=(0,b.useState)(new Set),d=(0,b.useRef)({}),f=(0,b.useRef)(1),p=e||{},m=new Date,h=[],g=[];for(let e=364;e>=0;e--){let t=new Date(m);t.setDate(t.getDate()-e);let n=t.toLocaleDateString(`en-CA`),r=p[n]&&p[n][a]||0;h.push({key:n,val:r,date:t}),t.getDate()===1&&g.push({idx:364-e,label:t.toLocaleDateString(`en-US`,{month:`short`})})}let _=Math.max(...h.map(e=>e.val),1);(0,b.useEffect)(()=>{if(!t||n>=PL){d.current={},f.current=1;return}let e=new Date,r=d.current,i=f.current,o=new Set,s=new Set,l=Math.max(.05,Math.min(i,_)*.002),m=kI.heatmap?.intensityRiseThreshold??.08,h=kI.heatmap?.whiteThreshold??.88,g=kI.heatmap?.nearMaxRatio??.985;for(let t=364;t>=0;t--){let n=new Date(e);n.setDate(n.getDate()-t);let c=n.toLocaleDateString(`en-CA`),u=p[c]&&p[c][a]||0,d=r[c]??0,f=i>0?d/i:0,v=_>0?u/_:0,y=_>i+l&&u>=_*g&&(d<_*g||d===void 0),b=v>=h&&f<h,x=u>d+l,S=v>f+m;y||b||x||S?o.add(c):(u<d-l||u>0&&i>0&&_>i+l&&f>=.85&&v<f-.02)&&s.add(c),r[c]=u}if(f.current=_,o.size>0||s.size>0){c(o),u(s);let e=setTimeout(()=>{c(new Set),u(new Set)},NL);return()=>clearTimeout(e)}},[p,a,t,n,_]);function v(e){if(e===0)return`var(--bg-elevated)`;let t=e/_,n=1/4;return t<n?`rgba(99, 102, 241, 0.14)`:t<2*n?`rgba(99, 102, 241, 0.38)`:t<3*n?`rgba(99, 102, 241, 0.62)`:t<1?`rgba(99, 102, 241, 0.88)`:`#fff`}let y=h[0]?.date.getDay()||0,x=Array(y).fill(null).concat(h);return(0,$.jsxs)(`div`,{className:`heatmap-wrap`,children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`0.75rem`},children:[(0,$.jsx)(`span`,{className:`chart-title`,children:`Activity`}),(0,$.jsx)(`div`,{className:`btn-group`,children:ML.map(e=>(0,$.jsx)(`button`,{className:`btn ${a===e.key?`active`:``}`,onClick:()=>o(e.key),children:e.label},e.key))})]}),(0,$.jsx)(`div`,{className:`heatmap-grid`,style:{gridTemplateRows:`repeat(7, 1fr)`},children:x.map((e,t)=>e?(0,$.jsx)(`div`,{role:r&&i?`button`:void 0,tabIndex:r&&i?0:void 0,onClick:r&&i?()=>r(e.key):void 0,onKeyDown:r&&i?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e.key))}:void 0,className:`heatmap-cell ${e.val>0?`active`:``} ${s.has(e.key)?`heatmap-cell-pop`:``} ${l.has(e.key)?`heatmap-cell-pop-dim`:``}`,style:{background:v(e.val),cursor:r&&i?`pointer`:void 0},title:`${e.key}: ${ML.find(e=>e.key===a).fmt(e.val)}`},e.key):(0,$.jsx)(`div`,{className:`heatmap-cell`,style:{visibility:`hidden`}},`pad-${t}`))}),(0,$.jsx)(`div`,{className:`heatmap-labels`,children:g.slice(-12).map((e,t)=>(0,$.jsx)(`span`,{children:e.label},t))})]})}function IL({presentation:e,rawPresentation:t=null,fullDaily:n=null,range:r=`total`,ingestProgress:i=0,isIngestActive:a=!1,exportMode:o=!1,exportPlayback:s=!1,exportPhase:c=null,exportSeekMs:l=0,onNavigateToDailyDay:u,onNavigateToRepo:d,onNavigateToModel:f}){if(!e?.ready)return null;let p=s?VL(l):1,m=s&&c===`replay`&&t?.ready?t:e,h=a&&t?.heatmap?t.heatmap:e.heatmap,{stats:g,topRepos:_,topFamilies:v,topModels:y}=e,b=s&&c===`replay`?OL(kL(t?.topRepos||m.topRepos||[],e.topRepos||m.topRepos||[]),p):m.topRepos||[],x=s&&c===`replay`?OL(kL(t?.topFamilies||m.topFamilies||[],e.topFamilies||m.topFamilies||[]),p):m.topFamilies||[],S=s&&c===`replay`?OL(kL(t?.topModels||m.topModels||[],e.topModels||m.topModels||[]),p):m.topModels||[],C=[...b.slice(0,6)].reverse(),w=Math.max(...b.slice(0,6).map(e=>e.tokens||0),1),T=[...x].sort((e,t)=>String(e.label).localeCompare(String(t.label))),E=[...S.slice(0,6)].sort((e,t)=>String(e.label).localeCompare(String(t.label))),D=c===`tail`||c===`final_hold`?kI.videoExport?.barsChartTailUpdateDurationMs??kI.videoExport?.barsChartUpdateDurationMs??240:BL(l,kI.videoExport?.barsChartIntroUpdateDurationMs,kI.videoExport?.barsChartUpdateDurationMs??30),O=c===`tail`||c===`final_hold`?kI.videoExport?.donutsChartTailUpdateDurationMs??kI.videoExport?.donutsChartUpdateDurationMs??240:BL(l,kI.videoExport?.donutsChartIntroUpdateDurationMs,kI.videoExport?.donutsChartUpdateDurationMs??30),k=!o&&!s,A={backgroundColor:`transparent`,...GI,...o?{animation:!1}:{},...s?{animationDurationUpdate:D,animationEasingUpdate:`cubicOut`}:{},tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>e?.length?`${e[0].axisValue}: ${yL(e[0].value)} tokens`:``},grid:{left:100,right:5,top:5,bottom:5},xAxis:{type:`value`,show:!1,max:w||1},yAxis:{type:`category`,data:C.map(e=>e.label),axisLabel:{color:`#8b949e`,fontSize:11,formatter:e=>SL(e)},axisTick:{show:!1},axisLine:{show:!1}},series:[{type:`bar`,data:C.map(e=>{let t=e.tokens||0,n=t/w>=.7,r=bI(e.label);return{value:t,itemStyle:{color:r,borderRadius:[0,3,3,0]},label:{show:!0,position:n?`insideRight`:`right`,distance:5,offset:[0,1.5],formatter:()=>yL(t),color:n?xI(r):`#8b949e`,fontSize:10}}}),barWidth:`80%`}]},j=k&&d?{click:e=>{if(e?.componentType!==`series`||e?.dataIndex==null)return;let t=C[e.dataIndex];t?.label&&d(t.label)}}:void 0,ee=T.reduce((e,t)=>e+(t.tokens||0),0),M=T.filter(e=>ee>0?(e.tokens||0)/ee>=.01:!1),te=AL(M),ne={backgroundColor:`transparent`,...KI,...o?{animation:!1}:{},...s?{animationDurationUpdate:O,animationEasingUpdate:`cubicOut`}:{},tooltip:{trigger:`item`,appendToBody:!0,confine:!0,formatter:e=>`${e.name}: ${yL(e.value)} tokens (${e.percent}%)`},series:[{type:`pie`,animation:o?!1:qI,avoidLabelOverlap:!te,radius:[`48%`,`72%`],center:[`50%`,`50%`],label:{show:!0,color:`#8b949e`,fontSize:11,formatter:`{b}`,alignTo:`edge`,edgeDistance:5,bleedMargin:5,distanceToLabelLine:5},labelLine:{lineStyle:{color:`#30363d`},length:8,length2:6},itemStyle:{borderColor:`#161b22`,borderWidth:2},...te?{labelLayout:te}:{},data:DL(M,wI)}]},N=E.reduce((e,t)=>e+(t.tokens||0),0),P=E.filter(e=>N>0?(e.tokens||0)/N>=.01:!1),re=AL(P),ie={backgroundColor:`transparent`,...KI,...o?{animation:!1}:{},...s?{animationDurationUpdate:O,animationEasingUpdate:`cubicOut`}:{},tooltip:{trigger:`item`,appendToBody:!0,confine:!0,formatter:e=>`${e.name}: ${yL(e.value)} tokens (${e.percent}%)`},series:[{type:`pie`,animation:o?!1:qI,avoidLabelOverlap:!re,radius:[`48%`,`72%`],center:[`50%`,`50%`],label:{show:!0,color:`#8b949e`,fontSize:11,formatter:`{b}`,alignTo:`edge`,edgeDistance:5,bleedMargin:5,distanceToLabelLine:5},labelLine:{lineStyle:{color:`#30363d`},length:8,length2:6},itemStyle:{borderColor:`#161b22`,borderWidth:2},...re?{labelLayout:re}:{},data:DL(P,CI)}]},ae=k&&f?{click:e=>{if(e?.componentType!==`series`||e?.dataIndex==null)return;let t=P[e.dataIndex]?.label||e?.name;t&&f(t)}}:void 0;return(0,$.jsxs)(`div`,{className:`animate-in`,children:[(0,$.jsxs)(`div`,{className:`stat-row`,children:[(0,$.jsxs)(`div`,{className:`stat-cards`,children:[(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:`Tokens`}),(0,$.jsx)(`div`,{className:`stat-value`,children:yL(g.tokens)}),(0,$.jsxs)(`div`,{className:`stat-per-day`,children:[(0,$.jsx)(`span`,{className:`stat-per-day-value`,children:yL(g.tokens/g.days)}),` per day`]})]}),(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:`Agent Time`}),(0,$.jsx)(`div`,{className:`stat-value`,children:xL(g.elapsed)}),(0,$.jsxs)(`div`,{className:`stat-per-day`,children:[(0,$.jsx)(`span`,{className:`stat-per-day-value`,children:xL(g.elapsed/g.days)}),` per day`]})]}),(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:`Est. API Cost`}),(0,$.jsx)(`div`,{className:`stat-value`,children:bL(g.cost)}),(0,$.jsxs)(`div`,{className:`stat-per-day`,children:[(0,$.jsx)(`span`,{className:`stat-per-day-value`,children:bL(g.cost/g.days)}),` per day`]})]}),(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:`Sessions`}),(0,$.jsx)(`div`,{className:`stat-value`,children:Math.round(g.sessions).toLocaleString()}),(0,$.jsxs)(`div`,{className:`stat-per-day`,children:[(0,$.jsx)(`span`,{className:`stat-per-day-value`,children:(g.sessions/g.days).toFixed(1)}),` per day`]})]})]}),(0,$.jsx)(jL,{daily:s&&t?.daily||e.daily,fullDaily:n,range:r,exportMode:o,exportPlayback:s,onDayClick:k?u:void 0})]}),(0,$.jsx)(FL,{heatmapData:h,isIngestActive:a,ingestProgress:i,onDayClick:k?u:void 0,interactive:k}),(0,$.jsxs)(`div`,{className:`grid-3`,children:[(0,$.jsxs)(`div`,{className:`chart-card overview-donut-card`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Top Repos`}),_.length>0?(0,$.jsx)(je,{echarts:mO,option:A,style:{height:180,cursor:j?`pointer`:void 0},theme:`dark`,lazyUpdate:!1,notMerge:o,onEvents:j}):(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem 0`,textAlign:`center`},children:`No data`})]}),(0,$.jsxs)(`div`,{className:`chart-card overview-donut-card`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Work Type`}),v.length>0?(0,$.jsx)(je,{echarts:mO,option:ne,style:{height:180},theme:`dark`,lazyUpdate:!1,notMerge:o}):(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem 0`,textAlign:`center`},children:`No data`})]}),(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Models`}),y.length>0?(0,$.jsx)(je,{echarts:mO,option:ie,style:{height:180,cursor:ae?`pointer`:void 0},theme:`dark`,lazyUpdate:!1,notMerge:o,onEvents:ae}):(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem 0`,textAlign:`center`},children:`No data`})]})]}),(0,$.jsxs)(`div`,{className:`coverage-subtle`,children:[(0,$.jsx)(`span`,{style:{fontWeight:500},children:`Session coverage:`}),(0,$.jsxs)(`span`,{className:`coverage-item`,children:[(0,$.jsx)(`span`,{className:`coverage-dot`,style:{background:`#22c55e`}}),(0,$.jsx)(`span`,{className:`coverage-nums`,children:Math.round(g.exactPriced)}),` `,`exact-priced`]}),(0,$.jsxs)(`span`,{className:`coverage-item`,children:[(0,$.jsx)(`span`,{className:`coverage-dot`,style:{background:`#c084fc`}}),(0,$.jsx)(`span`,{className:`coverage-nums`,children:Math.round(g.fallbackPriced)}),` `,`fallback-priced`]}),(0,$.jsxs)(`span`,{className:`coverage-item`,children:[(0,$.jsx)(`span`,{className:`coverage-dot`,style:{background:`#64748b`}}),(0,$.jsx)(`span`,{className:`coverage-nums`,children:Math.round(g.unpriced)}),` `,`unpriced`]})]})]})}function LL({data:e,heatmap:t,daily:n,families:r,repos:i,models:a,range:o=`total`,onPresentationSettledChange:s=null,ingestProgress:c=0,isIngestActive:l=!1,clockNowMs:u=null,onNavigateToDailyDay:d,onNavigateToRepo:f,onNavigateToModel:p}){return(0,$.jsx)(IL,{presentation:uL({overview:e,heatmap:t,daily:n,families:r,repos:i,models:a,range:o},{duration:BI,onSettledChange:s,ingestProgress:c,isIngestActive:l,clockNowMs:u}),rawPresentation:b.useMemo(()=>iL({overview:e,heatmap:t,daily:n,families:r,repos:i,models:a,range:o}),[e,t,n,r,i,a,o]),fullDaily:b.useMemo(()=>wL(n),[n]),range:o,ingestProgress:c,isIngestActive:l,onNavigateToDailyDay:d,onNavigateToRepo:f,onNavigateToModel:p})}function RL(e,t){return e.data===t.data&&e.heatmap===t.heatmap&&e.daily===t.daily&&e.families===t.families&&e.repos===t.repos&&e.models===t.models&&e.range===t.range&&e.onPresentationSettledChange===t.onPresentationSettledChange&&e.ingestProgress===t.ingestProgress&&e.isIngestActive===t.isIngestActive&&e.clockNowMs===t.clockNowMs&&e.onNavigateToDailyDay===t.onNavigateToDailyDay&&e.onNavigateToRepo===t.onNavigateToRepo&&e.onNavigateToModel===t.onNavigateToModel}var zL=(0,b.memo)(LL,RL);function BL(e,t,n){let r=Math.max(t??n??0,n??0),i=Math.max(n??0,0),a=HL(e);return Math.round(r+(i-r)*a)}function VL(e){return HL(e)}function HL(e){let t=Math.max(kI.videoExport?.chartIntroWindowMs??2200,1),n=Math.max(e||0,0),r=t/3;return Math.min(1,1-Math.exp(-n/Math.max(r,1)))}function UL(e,t){return e===`default`?t:e}function WL(e,t=`tokens`){return Object.entries(e||{}).map(([e,t])=>({key:e,...t})).sort((e,n)=>(n[t]||0)-(e[t]||0))}function GL({title:e,rows:t,valueKey:n=`tokens`,colorForKey:r,valueFormatter:i,chartMode:a=`default`,defaultMode:o=`bar`,emptyLabel:s=`No data`,renderTitleInChart:c=!0,barLabelProgress:l=1}){let u=UL(a,o),d=(t||[]).map((e,t)=>{let n=e?.key??e?.repo_label??e?.model_name??e?.family??null;return n?{...e,key:String(n),_idx:t}:null}).filter(Boolean),f={xAxis:{show:!1},yAxis:{show:!1},series:[],graphic:{type:`text`,left:`center`,top:`60%`,style:{text:s,fill:`#484f58`,fontSize:11}}};if(c&&(f.title={text:e,left:`center`,top:`middle`,textStyle:{fontSize:12,color:`#484f58`,fontWeight:`normal`}}),!d.length)return f;if(u===`donut`){let t=d.reduce((e,t)=>e+(t[n]||0),0),a={backgroundColor:`transparent`,...MI,tooltip:{trigger:`item`,appendToBody:!0,confine:!0,formatter:e=>`${e.name}: ${i(e.value)} (${e.percent}%)`},series:[{type:`pie`,...MI,radius:[`40%`,`62%`],center:[`50%`,`52%`],label:{show:!0,color:`#8b949e`,fontSize:10,formatter:`{b}`,overflow:`truncate`,width:90,...jI},labelLine:{lineStyle:{color:`#30363d`}},itemStyle:{borderColor:`#161b22`,borderWidth:2},data:d.map(e=>{let i=e[n]||0,a=(t>0?i/t:0)>=.01;return{name:e.key,value:i,itemStyle:{color:r(e.key)},label:{show:a,color:r(e.key)},labelLine:{show:a}}})}]};return c&&(a.title={text:e,left:`center`,top:8,textStyle:{fontSize:11,color:`#8b949e`,fontWeight:`normal`}}),a}let p=[...d].reverse(),m=Math.max(...d.map(e=>e[n]||0),0),h={backgroundColor:`transparent`,...NI,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{let t=p[e?.[0]?.dataIndex];return t?`${t.key}: ${i(t[n]||0)}`:``}},grid:{left:65,right:50,top:c?35:20,bottom:20},xAxis:{type:`value`,splitNumber:4,max:m||1,axisLabel:{formatter:e=>i(e),color:`#484f58`,fontSize:10,showMinLabel:!0,showMaxLabel:!0},splitLine:{lineStyle:{color:[`transparent`,`#21262d`,`#21262d`,`#21262d`,`transparent`]}}},yAxis:{type:`category`,data:p.map(e=>e.key),axisLabel:{color:`#8b949e`,fontSize:10,overflow:`truncate`,width:55},axisTick:{show:!1},axisLine:{show:!1}},series:[{type:`bar`,data:p.map(e=>({value:e[n]||0,itemStyle:{color:r(e.key),borderRadius:[0,3,3,0]}})),barMaxWidth:14,label:{show:!0,position:`right`,formatter:e=>i((e.value??0)*l),color:`#8b949e`,fontSize:9,...PI}}]};return c&&(h.title={text:e,left:`center`,top:8,textStyle:{fontSize:11,color:`#8b949e`,fontWeight:`normal`}}),h}BE([Uk,dA,LN,QP,tF,pI]);function KL(e){return EI(e)}function qL(e){return e==null||e===0?`—`:e>=1e3?`$`+(e/1e3).toFixed(1)+`K`:`$`+e.toFixed(2)}var JL=[`all`,`review`,`exploration`,`planning`,`memory`,`generic`],YL=[`review`,`exploration`,`planning`,`memory`,`generic`];function XL(e){if(!e.current)return;let t=e.current.getEchartsInstance().getDataURL({type:`png`,pixelRatio:2,backgroundColor:`#06080f`});Object.assign(document.createElement(`a`),{href:t,download:`codexmeter-repos.png`}).click()}function ZL(e,t=`total`){let n=e?.data;return Array.isArray(n)?n:n?.[t]||n?.total||[]}function QL({repo:e,chartMode:t}){let[n,r]=(0,b.useState)(!1),i=(0,b.useMemo)(()=>WL(e.by_model),[e.by_model]),a=(0,b.useMemo)(()=>WL(e.by_family),[e.by_family]),o=GL({title:`Models in repo`,rows:i,valueKey:`tokens`,colorForKey:CI,valueFormatter:KL,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1}),s=GL({title:`Work type in repo`,rows:a,valueKey:`tokens`,colorForKey:wI,valueFormatter:KL,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1}),c=[...i.slice(0,4).map(e=>({...e,scope:`model`})),...a.slice(0,4).map(e=>({...e,scope:`family`}))];return(0,$.jsxs)(`div`,{className:`model-detail-wrap`,children:[(0,$.jsxs)(`div`,{className:`model-detail-charts`,children:[(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Models in repo`}),(0,$.jsx)(je,{echarts:mO,option:o,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Work type in repo`}),(0,$.jsx)(je,{echarts:mO,option:s,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]})]}),(0,$.jsx)(`div`,{className:`model-detail-footer`,children:(0,$.jsxs)(`button`,{type:`button`,className:`model-detail-toggle`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,$.jsx)(`span`,{className:`model-detail-toggle-text`,children:n?`Hide details`:`Show details`}),(0,$.jsx)(`span`,{className:`model-detail-toggle-arrow ${n?`expanded`:``}`,"aria-hidden":!0,children:`▼`})]})}),(0,$.jsx)(`div`,{className:`model-detail-summary-wrap ${n?`expanded`:``}`,children:(0,$.jsx)(`div`,{className:`model-detail-summary`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`model-detail-summary-card`,children:[(0,$.jsxs)(`div`,{className:`model-detail-summary-head`,children:[(0,$.jsx)(`span`,{className:`model-detail-swatch`,style:{background:e.scope===`model`?CI(e.key):wI(e.key)}}),(0,$.jsx)(`span`,{className:`model-detail-summary-name`,title:e.key,children:e.key})]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[KL(e.tokens),` tokens`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[e.sessions||0,` sessions`]}),(0,$.jsx)(`div`,{className:`model-detail-summary-line`,children:qL(e.cost)})]},`${e.scope}-${e.key}`))})})]})}function $L({data:e,range:t=`total`,chartMode:n=`default`,focusRequest:r=null,onFocusRequestConsumed:i}){let[a,o]=(0,b.useState)(`all`),[s,c]=(0,b.useState)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(null),d=(0,b.useMemo)(()=>ZL(e,t),[e,t]),f=(0,b.useMemo)(()=>d?.length?a===`all`?d:d.map(e=>{let t=e.by_family?.[a];return t?{...e,tokens:t.tokens,cost:t.cost,sessions:t.sessions}:null}).filter(Boolean).sort((e,t)=>t.tokens-e.tokens):[],[d,a]);if((0,b.useEffect)(()=>{s&&(f.some(e=>e.repo_key===s)||c(null))},[s,f]),(0,b.useEffect)(()=>{if(!r){u.current=null;return}let{id:e,repoLabel:t}=r;if(!t||u.current===e)return;let n=d.find(e=>e.repo_label===t||e.repo_key===t);u.current=e,n&&c(n.repo_key),i?.()},[r,d,i]),!d?.length)return(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem`},children:`No data`});let p=f.slice(0,15),m=[...p].reverse(),h=Math.max(...p.map(e=>e.tokens||0),0),g=Math.max(250,p.length*28),_=(0,b.useMemo)(()=>({backgroundColor:`transparent`,...AI,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{let t=p[p.length-1-e[0].dataIndex];return t?`<b>${t.repo_label}</b><br/>Tokens: ${KL(t.tokens)}<br/>Cost: ${qL(t.cost)}<br/>Sessions: ${t.sessions}`:``}},grid:{left:150,right:50,top:8,bottom:8},xAxis:{type:`value`,splitNumber:4,max:h||1,axisLabel:{formatter:e=>KL(e),color:`#484f58`,showMinLabel:!0,showMaxLabel:!0},splitLine:{lineStyle:{color:[`transparent`,`#21262d`,`#21262d`,`#21262d`,`transparent`]}}},yAxis:{type:`category`,data:m.map(e=>e.repo_label),axisLabel:{color:`#8b949e`,fontSize:11},axisTick:{show:!1},axisLine:{show:!1}},series:[{id:`repos-range-bars`,type:`bar`,universalTransition:!0,data:m.map(e=>({id:e.repo_key,name:e.repo_label,value:e.tokens,itemStyle:{color:bI(e.repo_label),borderRadius:[0,3,3,0]}})),barMaxWidth:16,label:{show:!0,position:`right`,formatter:e=>KL(e.value??0),color:`#8b949e`,fontSize:10,...jI}}]}),[h,m,p]),v=(0,b.useMemo)(()=>({click:e=>{if(e?.componentType===`series`&&e?.dataIndex!=null){let t=p[p.length-1-e.dataIndex];t&&c(e=>e===t.repo_key?null:t.repo_key)}}}),[p]);return(0,$.jsxs)(`div`,{className:`animate-in`,children:[(0,$.jsxs)(`div`,{className:`section-header`,children:[(0,$.jsx)(`span`,{className:`section-title`,children:`Repos`}),(0,$.jsx)(`div`,{className:`btn-group`,children:JL.map(e=>(0,$.jsx)(`button`,{className:`btn ${a===e?`active`:``}`,onClick:()=>o(e),children:e},e))})]}),(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`button`,{className:`export-btn`,onClick:()=>XL(l),children:`PNG`}),(0,$.jsx)(`div`,{style:{height:g,transition:`height 220ms cubic-bezier(0.22, 1, 0.36, 1)`},children:(0,$.jsx)(je,{ref:l,echarts:mO,option:_,style:{height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1,onEvents:v})})]}),(0,$.jsx)(`div`,{className:`table-wrap`,children:(0,$.jsxs)(`table`,{children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Repo`}),(0,$.jsx)(`th`,{children:`Tokens`}),(0,$.jsx)(`th`,{children:`Cost`}),(0,$.jsx)(`th`,{children:`Sessions`}),(0,$.jsx)(`th`,{style:{width:200},children:`Families`})]})}),(0,$.jsx)(`tbody`,{children:f.map(e=>(0,$.jsxs)(b.Fragment,{children:[(0,$.jsxs)(`tr`,{onClick:()=>c(s===e.repo_key?null:e.repo_key),style:{cursor:`pointer`},children:[(0,$.jsxs)(`td`,{style:{fontWeight:500,color:`var(--text-primary)`},children:[(0,$.jsx)(`span`,{style:{display:`inline-block`,width:8,height:8,borderRadius:2,background:bI(e.repo_label),marginRight:8}}),e.repo_label]}),(0,$.jsx)(`td`,{style:{fontFamily:`var(--font-mono)`},children:KL(e.tokens)}),(0,$.jsx)(`td`,{style:{fontFamily:`var(--font-mono)`},children:qL(e.cost)}),(0,$.jsx)(`td`,{children:e.sessions}),(0,$.jsx)(`td`,{children:Object.entries(e.by_family||{}).sort(([e],[t])=>{let n=YL.indexOf(e),r=YL.indexOf(t);return(n===-1?999:n)-(r===-1?999:r)}).slice(0,3).map(([e])=>(0,$.jsx)(`span`,{className:`tag tag-${e}`,style:{marginRight:3},children:e},e))})]}),s===e.repo_key&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,style:{background:`var(--bg-surface)`,padding:`0.75rem 1rem`},children:(0,$.jsx)(QL,{repo:e,chartMode:n})})})]},e.repo_key))})]})})]})}BE([Uk,dA,LN,QP,tF,pI]);function eR(e){return EI(e)}function tR(e){return e==null||e===0?`—`:e>=1e3?`$`+(e/1e3).toFixed(1)+`K`:`$`+e.toFixed(2)}var nR=[`low`,`medium`,`high`,`xhigh`,`unknown`];function rR(e){return[...e].sort(([e],[t])=>{let n=nR.indexOf((e||``).toLowerCase()),r=nR.indexOf((t||``).toLowerCase());return(n===-1?999:n)-(r===-1?999:r)})}function iR({model:e,fmt:t,chartMode:n}){let[r,i]=(0,b.useState)(!1),a=(0,b.useMemo)(()=>rR(Object.entries(e.by_effort||{})),[e.by_effort]);if(!a.length)return null;let o=a.map(([e,t])=>({effort:e,sessions:t.sessions,tokens:t.tokens,avgTokens:t.sessions?Math.round(t.tokens/t.sessions):0,cost:t.cost,exactPriced:t.exact_priced||0,fallbackPriced:t.heuristic_priced||0})),s=o.map(e=>({key:e.effort,sessions:e.sessions,tokens:e.tokens,avgTokens:e.avgTokens})),c=GL({title:`Sessions by effort`,rows:s,valueKey:`sessions`,colorForKey:TI,valueFormatter:e=>Math.round(e).toLocaleString(),chartMode:n,defaultMode:`donut`,renderTitleInChart:!1}),l=GL({title:`Tokens by effort`,rows:s,valueKey:`tokens`,colorForKey:TI,valueFormatter:t,chartMode:n,defaultMode:`donut`,renderTitleInChart:!1}),u=GL({title:`Avg tokens per session`,rows:s,valueKey:`avgTokens`,colorForKey:TI,valueFormatter:t,chartMode:n,defaultMode:`bar`,renderTitleInChart:!1});return(0,$.jsxs)(`div`,{className:`model-detail-wrap`,children:[(0,$.jsxs)(`div`,{className:`model-detail-charts`,children:[(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Sessions by effort`}),(0,$.jsx)(je,{echarts:mO,option:c,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Tokens by effort`}),(0,$.jsx)(je,{echarts:mO,option:l,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-bar`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Avg tokens per session`}),(0,$.jsx)(je,{echarts:mO,option:u,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]})]}),(0,$.jsx)(`div`,{className:`model-detail-footer`,children:(0,$.jsxs)(`button`,{type:`button`,className:`model-detail-toggle`,onClick:()=>i(e=>!e),"aria-expanded":r,children:[(0,$.jsx)(`span`,{className:`model-detail-toggle-text`,children:r?`Hide details`:`Show details`}),(0,$.jsx)(`span`,{className:`model-detail-toggle-arrow ${r?`expanded`:``}`,"aria-hidden":!0,children:`▼`})]})}),(0,$.jsx)(`div`,{className:`model-detail-summary-wrap ${r?`expanded`:``}`,children:(0,$.jsx)(`div`,{className:`model-detail-summary`,children:o.map(e=>(0,$.jsxs)(`div`,{className:`model-detail-summary-card`,children:[(0,$.jsxs)(`div`,{className:`model-detail-summary-head`,children:[(0,$.jsx)(`span`,{className:`model-detail-swatch`,style:{background:TI(e.effort)}}),(0,$.jsx)(`span`,{className:`model-detail-summary-name`,title:e.effort,children:e.effort})]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[e.sessions,` sessions`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[t(e.tokens),` tokens`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[t(e.avgTokens),` avg/session`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[tR(e.cost),` cost`]}),(0,$.jsxs)(`div`,{className:`model-detail-summary-line`,children:[e.exactPriced,` exact · `,e.fallbackPriced,` fallback`]})]},e.effort))})})]})}function aR(e){if(!e.current)return;let t=e.current.getEchartsInstance().getDataURL({type:`png`,pixelRatio:2,backgroundColor:`#06080f`});Object.assign(document.createElement(`a`),{href:t,download:`codexmeter-models.png`}).click()}function oR(e,t=`total`){let n=e?.data;return Array.isArray(n)?n:n?.[t]||n?.total||[]}function sR({data:e,range:t=`total`,chartMode:n=`default`,focusRequest:r=null,onFocusRequestConsumed:i}){let[a,o]=(0,b.useState)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useMemo)(()=>oR(e,t),[e,t]);if((0,b.useEffect)(()=>{a&&(l.some(e=>e.model_name===a)||o(null))},[a,l]),(0,b.useEffect)(()=>{if(!r){c.current=null;return}let{id:e,modelName:t}=r;if(!t||c.current===e)return;let n=l.find(e=>e.model_name===t);c.current=e,n&&o(n.model_name),i?.()},[r,l,i]),!l?.length)return(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem`},children:`No data`});let u=[...l].reverse(),d=Math.max(...l.map(e=>e.tokens||0),0),f=Math.max(180,l.length*34),p=(0,b.useMemo)(()=>({backgroundColor:`transparent`,...AI,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{let t=l[l.length-1-e[0].dataIndex];return`<b>${t.model_name}</b><br/>Tokens: ${eR(t.tokens)}<br/>Cost: ${tR(t.cost)}<br/>Sessions: ${t.sessions}`}},grid:{left:160,right:50,top:8,bottom:8},xAxis:{type:`value`,splitNumber:4,max:d||1,axisLabel:{formatter:e=>eR(e),color:`#484f58`,fontSize:10,showMinLabel:!0,showMaxLabel:!0},splitLine:{lineStyle:{color:[`transparent`,`#21262d`,`#21262d`,`#21262d`,`transparent`]}}},yAxis:{type:`category`,data:u.map(e=>e.model_name),axisLabel:{color:`#8b949e`,fontSize:11},axisTick:{show:!1},axisLine:{show:!1}},series:[{id:`models-range-bars`,type:`bar`,universalTransition:!0,data:u.map(e=>({id:e.model_name,name:e.model_name,value:e.tokens,itemStyle:{color:CI(e.model_name),borderRadius:[0,3,3,0]}})),barMaxWidth:18,label:{show:!0,position:`right`,formatter:e=>eR(e.value??0),color:`#8b949e`,fontSize:10,...jI}}]}),[d,l,u]),m=(0,b.useMemo)(()=>({click:e=>{if(e?.componentType===`series`&&e?.dataIndex!=null){let t=l[l.length-1-e.dataIndex];t&&o(e=>e===t.model_name?null:t.model_name)}}}),[l]);return(0,$.jsxs)(`div`,{className:`animate-in`,children:[(0,$.jsx)(`div`,{className:`section-header`,children:(0,$.jsx)(`span`,{className:`section-title`,children:`Models`})}),(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`button`,{className:`export-btn`,onClick:()=>aR(s),children:`PNG`}),(0,$.jsx)(`div`,{style:{height:f,transition:`height 220ms cubic-bezier(0.22, 1, 0.36, 1)`},children:(0,$.jsx)(je,{ref:s,echarts:mO,option:p,style:{height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1,onEvents:m})})]}),(0,$.jsx)(`div`,{className:`table-wrap`,children:(0,$.jsxs)(`table`,{children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Model`}),(0,$.jsx)(`th`,{children:`Tokens`}),(0,$.jsx)(`th`,{children:`Cost`}),(0,$.jsx)(`th`,{children:`Sessions`}),(0,$.jsx)(`th`,{children:`Effort Levels`})]})}),(0,$.jsx)(`tbody`,{children:l.map(e=>(0,$.jsxs)(b.Fragment,{children:[(0,$.jsxs)(`tr`,{onClick:()=>o(a===e.model_name?null:e.model_name),style:{cursor:`pointer`},children:[(0,$.jsxs)(`td`,{style:{fontWeight:500,color:`var(--text-primary)`,fontFamily:`var(--font-mono)`},children:[(0,$.jsx)(`span`,{style:{display:`inline-block`,width:8,height:8,borderRadius:2,background:CI(e.model_name),marginRight:8}}),e.model_name]}),(0,$.jsx)(`td`,{style:{fontFamily:`var(--font-mono)`},children:eR(e.tokens)}),(0,$.jsx)(`td`,{style:{fontFamily:`var(--font-mono)`},children:tR(e.cost)}),(0,$.jsx)(`td`,{children:e.sessions}),(0,$.jsx)(`td`,{children:Object.keys(e.by_effort).length})]}),a===e.model_name&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,style:{background:`var(--bg-surface)`,padding:`0.75rem 1rem`},children:(0,$.jsx)(iR,{model:e,fmt:eR,chartMode:n})})})]},e.model_name))})]})})]})}BE([Uk,lk,dA,LN,QP,tF,DF,rI,tP,pI]);function cR(e){return EI(e)}function lR(e){return e==null||e===0?`$0`:`$`+e.toFixed(2)}function uR(e){return e?(e/3600).toFixed(1)+`h`:`0h`}var dR=[{key:`tokens`,label:`Tokens`,fn:cR},{key:`elapsed_seconds`,label:`Time`,fn:uR},{key:`cost`,label:`Cost`,fn:lR}],fR=[{key:`model`,label:`By Model`},{key:`family`,label:`By Work`}],pR=[{key:`absolute`,label:`Absolute`},{key:`relative`,label:`Relative`}];function mR(e){if(!e.current)return;let t=e.current.getEchartsInstance().getDataURL({type:`png`,pixelRatio:2,backgroundColor:`#06080f`});Object.assign(document.createElement(`a`),{href:t,download:`codexmeter-daily.png`}).click()}function hR(e,t){if(!t)return{startValue:0,endValue:0};let n=t;return e===`d7`&&(n=7),e===`d30`&&(n=30),{startValue:t-Math.max(1,Math.min(n,t)),endValue:t-1}}var gR=280,_R={left:70,right:20,bottom:12,height:24};function vR(e,t,n){let r=e?.batch?.[0]??e,i=Math.max(0,t.length-1),a,o;return r&&typeof r.startValue==`number`&&typeof r.endValue==`number`?(a=r.startValue,o=r.endValue):r&&typeof r.start==`number`&&typeof r.end==`number`&&t.length?(a=Math.round(r.start/100*i),o=Math.round(r.end/100*i)):r&&typeof r.startValue==`string`&&typeof r.endValue==`string`&&t.length?(a=t.indexOf(r.startValue),o=t.indexOf(r.endValue),a<0&&(a=n.startValue),o<0&&(o=n.endValue)):(a=n.startValue,o=n.endValue),a=Math.max(0,Math.min(i,Math.floor(a))),o=Math.max(0,Math.min(i,Math.floor(o))),a>o?{startValue:o,endValue:a}:{startValue:a,endValue:o}}function yR(e,t,n,r,i){if(cancelAnimationFrame(r.current),r.current=0,Math.round(e.startValue)===Math.round(t.startValue)&&Math.round(e.endValue)===Math.round(t.endValue))return;let a=0,o=s=>{a||=s;let c=Math.min(1,(s-a)/i),l=1-(1-c)**3;n({startValue:Math.round(e.startValue+(t.startValue-e.startValue)*l),endValue:Math.round(e.endValue+(t.endValue-e.endValue)*l)}),r.current=c<1?requestAnimationFrame(o):0};return r.current=requestAnimationFrame(o),()=>{cancelAnimationFrame(r.current),r.current=0}}function bR(e,t){return{left:_R.left,right:e-_R.right,top:t-_R.bottom-_R.height,bottom:t-_R.bottom}}function xR(e,t,n,r){let i=bR(e,t),a=Math.max(n-1,1),o=Math.max(0,Math.min(1,(r?.startValue??0)/a)),s=Math.max(0,Math.min(1,(r?.endValue??a)/a)),c=Math.max(0,i.right-i.left);return{...i,selectionLeft:i.left+c*Math.min(o,s),selectionRight:i.left+c*Math.max(o,s)}}function SR(e,t){return e===`d7`?44:e===`d30`?22:t<=14?36:t<=31?18:14}function CR(e,t){return e===`d7`?`72%`:e===`d30`?`54%`:t<=14?`64%`:t<=31?`48%`:`36%`}function wR(e,t){return e?t===`elapsed_seconds`?e.elapsed_seconds||0:t===`cost`?e.cost||0:e.tokens||0:0}function TR(e,t){if(!e)return`Day detail`;let n=dR.find(e=>e.key===t)||dR[0],r=new Date(`${e.date}T00:00:00`).toLocaleDateString(`en-US`,{weekday:`long`}),i=n.fn(wR(e,t));return`Day detail: ${r} - ${e.date} - ${n.label}: ${i}`}function ER(e,t){let n=e.length;if(n===0)return null;let r=Array(n),i=Array(n),a=[];for(let t=0;t<n;t++){for(;a.length&&e[a[a.length-1]]>=e[t];)a.pop();r[t]=a.length?a[a.length-1]:-1,a.push(t)}a.length=0;for(let t=n-1;t>=0;t--){for(;a.length&&e[a[a.length-1]]>=e[t];)a.pop();i[t]=a.length?a[a.length-1]:n,a.push(t)}let o=0,s=0;for(let t=0;t<n;t++){let n=(i[t]-r[t]-1)*e[t];n>o&&(o=n,s=t)}return[(r[s]+i[s])/2,t[s]+e[s]/2]}function DR({day:e,chartMode:t}){let n=(0,b.useMemo)(()=>WL(e.by_model),[e.by_model]),r=(0,b.useMemo)(()=>WL(e.by_repo),[e.by_repo]),i=(0,b.useMemo)(()=>WL(e.by_family),[e.by_family]),a=GL({title:`Models`,rows:n,valueKey:`tokens`,colorForKey:CI,valueFormatter:cR,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1}),o=GL({title:`Repos`,rows:r,valueKey:`tokens`,colorForKey:bI,valueFormatter:cR,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1}),s=GL({title:`Work Type`,rows:i,valueKey:`tokens`,colorForKey:wI,valueFormatter:cR,chartMode:t,defaultMode:`donut`,renderTitleInChart:!1});return(0,$.jsx)(`div`,{className:`model-detail-wrap`,children:(0,$.jsxs)(`div`,{className:`model-detail-charts`,children:[(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Repos`}),(0,$.jsx)(je,{echarts:mO,option:o,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Models`}),(0,$.jsx)(je,{echarts:mO,option:a,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]}),(0,$.jsxs)(`div`,{className:`model-detail-donut`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.5rem`},children:`Work Type`}),(0,$.jsx)(je,{echarts:mO,option:s,style:{width:`100%`,height:`100%`},theme:`dark`,lazyUpdate:!0,notMerge:!1})]})]})})}var OR=b.memo(function({daily:e,range:t,metric:n,split:r,displayMode:i,onSelectDate:a,navigateToDayRequest:o,onNavigateToDayConsumed:s}){let[c,l]=(0,b.useState)({startValue:0,endValue:0}),u=(0,b.useRef)(null),d=(0,b.useRef)(c);d.current=c;let f=(0,b.useRef)(0),p=(0,b.useRef)(null),m=(0,b.useRef)(0),h=(0,b.useRef)(!1),g=(0,b.useRef)(null),_=(0,b.useRef)(null),v=(0,b.useRef)(0),y=(0,b.useMemo)(()=>e.map(e=>e.date),[e]),x=dR.find(e=>e.key===n),S=(0,b.useMemo)(()=>hR(t,y.length),[t,y.length]);(0,b.useEffect)(()=>{if(!y.length)return;let e=hR(t,y.length),n=_.current===null,r=!n&&_.current!==t,i=!n&&v.current!==y.length;if(_.current=t,v.current=y.length,cancelAnimationFrame(m.current),m.current=0,n){l(e);return}if(r)return yR(d.current,e,l,m,gR);i&&l(e)},[t,y.length]),(0,b.useEffect)(()=>()=>{cancelAnimationFrame(f.current),f.current=0,g.current?.(),g.current=null},[]);let C=(0,b.useCallback)(()=>{let e=u.current?.getEchartsInstance?.();if(!e)return;g.current?.();let t=e.getZr(),n=n=>{let r=n?.offsetX??n?.zrX,i=n?.offsetY??n?.zrY;if(!Number.isFinite(r)||!Number.isFinite(i)){t.setCursorStyle(`default`);return}let a=xR(e.getWidth(),e.getHeight(),y.length,d.current);if(!(r>=a.left&&r<=a.right&&i>=a.top&&i<=a.bottom)){t.setCursorStyle(`default`);return}if(r>=a.selectionLeft&&r<=a.selectionRight){t.setCursorStyle(h.current?`grabbing`:`grab`);return}t.setCursorStyle(`ew-resize`)},r=e=>n(e),i=t=>{let r=t?.offsetX??t?.zrX,i=t?.offsetY??t?.zrY;if(!Number.isFinite(r)||!Number.isFinite(i))return;let a=xR(e.getWidth(),e.getHeight(),y.length,d.current);h.current=r>=a.selectionLeft&&r<=a.selectionRight&&i>=a.top&&i<=a.bottom,n(t)},a=e=>{h.current=!1,n(e)},o=()=>{h.current=!1,t.setCursorStyle(`default`)};t.on(`mousemove`,r),t.on(`mousedown`,i),t.on(`mouseup`,a),t.on(`globalout`,o),g.current=()=>{t.off(`mousemove`,r),t.off(`mousedown`,i),t.off(`mouseup`,a),t.off(`globalout`,o),t.setCursorStyle(`default`)}},[y.length]),w=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(!o){w.current=null;return}let{id:t,centerDate:n}=o;if(!n||!e.length||w.current===t)return;let r=e.map(e=>e.date),i=r.indexOf(n);if(i<0){s?.();return}w.current=t;let c=Math.max(0,i-3),u=Math.min(r.length-1,i+3);cancelAnimationFrame(m.current),m.current=0,l({startValue:c,endValue:u}),a(n),s?.()},[o,e,a,s]);let T=(0,b.useMemo)(()=>{if(!y.length)return 0;let e=Math.max(0,Math.min(y.length-1,Math.floor(c.startValue??S.startValue??0))),t=Math.max(e,Math.min(y.length-1,Math.floor(c.endValue??S.endValue??y.length-1)));return Math.max(1,t-e+1)},[y.length,c,S]),E=(0,b.useMemo)(()=>{if(!y.length)return{startIdx:0,endIdx:-1};let e=Math.max(0,Math.min(y.length-1,Math.floor(c.startValue??S.startValue??0)));return{startIdx:e,endIdx:Math.max(e,Math.min(y.length-1,Math.floor(c.endValue??S.endValue??y.length-1)))}},[y.length,c,S]),D=(0,b.useMemo)(()=>SR(t,T),[t,T]),O=(0,b.useMemo)(()=>CR(t,T),[t,T]),k=(0,b.useMemo)(()=>{let t=new Set;for(let i=0;i<e.length;i++){let a=e[i];if(!a)continue;let o=r===`model`?a.by_model:a.by_family||{};for(let[e,r]of Object.entries(o))r&&(n===`elapsed_seconds`?r.elapsed_seconds||0:n===`cost`?r.cost||0:r.tokens||0)>0&&t.add(e)}return[...t]},[e,r,n]),A=(0,b.useMemo)(()=>k.map(t=>({name:t,values:e.map(e=>{let i=(r===`model`?e.by_model:e.by_family||{})[t];return i?n===`elapsed_seconds`?i.elapsed_seconds||0:n===`cost`?i.cost||0:i.tokens||0:0})})),[k,e,r,n]),j=(0,b.useMemo)(()=>e.map((e,t)=>{let n=0;for(let e of A)n+=e.values[t]||0;return n}),[e,A]),ee=(0,b.useMemo)(()=>{if(!j.length||E.endIdx<E.startIdx)return 0;let e=0;for(let t=E.startIdx;t<=E.endIdx;t++)e=Math.max(e,j[t]||0);return e},[j,E]),M=i===`relative`,te=(0,b.useMemo)(()=>({dates:y,series:A.map(e=>({key:e.name,label:e.name,data:e.values}))}),[y,A]),ne=`${n}\0${r}`,N=_L(te,!M,ne),P=(0,b.useMemo)(()=>new Map((N?.series||[]).map(e=>[e.key,e])),[N]),re=(0,b.useMemo)(()=>{if(M)return j;let e=y.length,t=Array(e).fill(0);for(let n of N?.series||[])for(let r=0;r<e;r++)t[r]+=n.data[r]||0;return t},[M,j,N,y.length]),ie=(0,b.useMemo)(()=>{if(i===`relative`)return 100;if(ee)return Math.ceil(ee*1.1)},[i,ee]),ae=(0,b.useMemo)(()=>{if(!M)return null;if(!A.length)return[];let e=A.map(e=>{let t=e.values.map((e,t)=>j[t]>0?e/j[t]*100:0);for(let e=1;e<t.length;e++)j[e]===0&&(t[e]=t[e-1]);return t}),t=e[0].map(()=>0);return e.map((e,n)=>{let r=[...t];return t=t.map((t,n)=>t+e[n]),{values:e,prevStack:r}})},[M,A,j]),oe=(0,b.useMemo)(()=>M?k.map((e,t)=>{let n=r===`model`?CI(e):wI(e);if(!A[t])return null;let i=ae[t];return i?{name:e,type:`line`,stack:`total`,smooth:.2,areaStyle:{opacity:1},lineStyle:{width:0},symbol:`none`,data:i.values,itemStyle:{color:n}}:null}).filter(Boolean):k.map(e=>{let t=r===`model`?CI(e):wI(e);return{name:e,type:`bar`,stack:`total`,data:P.get(e)?.data??y.map(()=>0),itemStyle:{color:t},barWidth:O,barMaxWidth:D,barMinWidth:Math.min(10,D)}}),[M,k,r,ae,A,P,y,O,D]),se=(0,b.useMemo)(()=>!M||!ae?[]:ae.map((e,t)=>{let n=A[t],i=xI(r===`model`?CI(n.name):wI(n.name)),a=ER(e.values,e.prevStack);return!a||Math.max(...e.values)<8?null:{name:n.name,labelColor:i,coord:a}}).filter(Boolean),[M,ae,A,r]),ce=(0,b.useCallback)(()=>{if(!u.current)return;let e=u.current.getEchartsInstance();if(!M||se.length===0){e.setOption({graphic:{elements:[]}},{notMerge:!1});return}let t=se.map(t=>{let[n,r]=e.convertToPixel({xAxisIndex:0,yAxisIndex:0},t.coord);return{type:`text`,left:n,top:r,style:{text:t.name,fill:t.labelColor,fontSize:10,fontWeight:500,textAlign:`center`,textVerticalAlign:`middle`},z:10,silent:!0}});e.setOption({graphic:{elements:t}},{notMerge:!1})},[M,se]);(0,b.useEffect)(()=>{let e=setTimeout(ce,150);return()=>clearTimeout(e)},[M,se,ce]),(0,b.useEffect)(()=>{let e=()=>ce();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[ce]),(0,b.useEffect)(()=>{C()},[C,c]);let le={backgroundColor:`transparent`,tooltip:{trigger:`axis`,axisPointer:{type:M?`line`:`shadow`},appendToBody:!0,confine:!0,formatter:e=>{if(!e?.length)return``;let t=e[0]?.dataIndex,n=re,r=t==null?0:n[t],a=t;if(i===`relative`&&r===0&&t!=null){for(let e=t-1;e>=0;e--)if(n[e]>0){a=e;break}}let o=i===`relative`&&r===0?n[a]??0:r,s=`<b>${e[0]?.axisValue??``}</b><br/>`,c=[...e].filter(e=>e.value>0).sort((e,t)=>(t.value||0)-(e.value||0));for(let e of c){let t=i===`relative`?A.find(t=>t.name===e.seriesName)?.values[a]??0:e.value;i===`relative`?s+=`${e.marker} ${e.seriesName}: ${e.value.toFixed(1)}% (${x.fn(t)})<br/>`:s+=`${e.marker} ${e.seriesName}: ${x.fn(e.value)}<br/>`}return s+=i===`relative`?`<b>Total: 100% (${x.fn(o)})</b>`:`<b>Total: ${x.fn(r)}</b>`,s}},legend:{data:k,textStyle:{color:`#8b949e`,fontSize:10},top:0,itemWidth:10,itemHeight:10},grid:{left:_R.left,right:_R.right,top:35,bottom:55},dataZoom:[{type:`slider`,startValue:c.startValue,endValue:c.endValue,left:_R.left,right:_R.right,bottom:_R.bottom,height:_R.height,borderColor:`#30363d`,fillerColor:`rgba(99, 102, 241, 0.08)`,handleStyle:{color:`#6366f1`},textStyle:{color:`#484f58`}}],xAxis:{type:`category`,data:y,boundaryGap:i!==`relative`,axisLabel:{color:`#484f58`,fontSize:10,rotate:45},axisTick:{show:!1},axisLine:{lineStyle:{color:`#30363d`}}},yAxis:{type:`value`,min:0,max:i===`relative`?100:ie,scale:!1,axisLabel:{formatter:i===`relative`?e=>e+`%`:e=>x.fn(e),color:`#484f58`},splitLine:{lineStyle:{color:`#21262d`}}},series:oe,...M?AI:WI};return(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`button`,{className:`export-btn`,onClick:()=>mR(u),children:`PNG`}),(0,$.jsx)(je,{ref:u,echarts:mO,option:le,style:{height:400},theme:`dark`,notMerge:!1,replaceMerge:[`series`,`legend`,`graphic`],lazyUpdate:!1,onChartReady:()=>{ce(),C()},onEvents:{click:e=>{let t=e?.axisValue||e?.name;t&&a(t)},datazoom:e=>{p.current=vR(e,y,d.current),f.current||=requestAnimationFrame(()=>{f.current=0,p.current&&=(l(p.current),null),M&&ce()})}}})]})});function kR({data:e,range:t=`total`,chartMode:n=`default`,navigateToDayRequest:r=null,onNavigateToDayConsumed:i}){let[a,o]=(0,b.useState)(`tokens`),[s,c]=(0,b.useState)(`model`),[l,u]=(0,b.useState)(`absolute`),[d,f]=(0,b.useState)(null);if(!e?.data?.length)return(0,$.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`2rem`},children:`No data`});let p=e.data;(0,b.useEffect)(()=>{!d&&p[0]&&f(p[p.length-1]?.date||p[0]?.date)},[p,d]);let m=(0,b.useCallback)(e=>{e&&f(e)},[]),h=p.find(e=>e.date===d)||null;return(0,$.jsxs)(`div`,{className:`animate-in`,children:[(0,$.jsxs)(`div`,{className:`section-header`,children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`},children:(0,$.jsx)(`span`,{className:`section-title`,children:`Daily Usage`})}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`},children:[(0,$.jsx)(`div`,{className:`btn-group`,children:dR.map(e=>(0,$.jsx)(`button`,{className:`btn ${a===e.key?`active`:``}`,onClick:()=>o(e.key),children:e.label},e.key))}),(0,$.jsx)(`div`,{className:`btn-group`,children:fR.map(e=>(0,$.jsx)(`button`,{className:`btn ${s===e.key?`active`:``}`,onClick:()=>c(e.key),children:e.label},e.key))}),(0,$.jsx)(`div`,{className:`btn-group`,children:pR.map(e=>(0,$.jsx)(`button`,{className:`btn ${l===e.key?`active`:``}`,onClick:()=>u(e.key),children:e.label},e.key))})]})]}),(0,$.jsx)(OR,{daily:p,range:t,metric:a,split:s,displayMode:l,onSelectDate:m,navigateToDayRequest:r,onNavigateToDayConsumed:i}),h&&(0,$.jsxs)(`div`,{className:`chart-card`,children:[(0,$.jsx)(`div`,{className:`chart-title`,style:{marginBottom:`0.75rem`},children:TR(h,a)}),(0,$.jsx)(DR,{day:h,chartMode:n})]})]})}function AR(){return{accessor:(e,t)=>typeof e==`function`?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function jR(e,t){return typeof e==`function`?e(t):e}function MR(e,t){return n=>{t.setState(t=>({...t,[e]:jR(n,t[e])}))}}function NR(e){return e instanceof Function}function PR(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function FR(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function IR(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
29
29
|
font-size: .6rem;
|
|
30
30
|
font-weight: bold;
|
|
31
|
-
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function FR(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function IR(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:PR(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),FR(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function LR(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:PR(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],FR(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:PR(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},FR(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var RR=`debugHeaders`;function zR(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var BR={createTable:e=>{e.getHeaderGroups=PR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return VR(t,[...a,...s,...o],e)},FR(e.options,RR,`getHeaderGroups`)),e.getCenterHeaderGroups=PR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),VR(t,n,e,`center`)),FR(e.options,RR,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=PR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>VR(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),FR(e.options,RR,`getLeftHeaderGroups`)),e.getRightHeaderGroups=PR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>VR(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),FR(e.options,RR,`getRightHeaderGroups`)),e.getFooterGroups=PR(()=>[e.getHeaderGroups()],e=>[...e].reverse(),FR(e.options,RR,`getFooterGroups`)),e.getLeftFooterGroups=PR(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),FR(e.options,RR,`getLeftFooterGroups`)),e.getCenterFooterGroups=PR(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),FR(e.options,RR,`getCenterFooterGroups`)),e.getRightFooterGroups=PR(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),FR(e.options,RR,`getRightFooterGroups`)),e.getFlatHeaders=PR(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),FR(e.options,RR,`getFlatHeaders`)),e.getLeftFlatHeaders=PR(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),FR(e.options,RR,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=PR(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),FR(e.options,RR,`getCenterFlatHeaders`)),e.getRightFlatHeaders=PR(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),FR(e.options,RR,`getRightFlatHeaders`)),e.getCenterLeafHeaders=PR(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),FR(e.options,RR,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=PR(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),FR(e.options,RR,`getLeftLeafHeaders`)),e.getRightLeafHeaders=PR(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),FR(e.options,RR,`getRightLeafHeaders`)),e.getLeafHeaders=PR(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),FR(e.options,RR,`getLeafHeaders`))}};function VR(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=zR(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>zR(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var HR=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>NR(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:PR(()=>[e.getAllLeafColumns()],t=>t.map(t=>IR(e,s,t,t.id)),FR(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:PR(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),FR(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},UR={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},WR=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};WR.autoRemove=e=>ez(e);var GR=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};GR.autoRemove=e=>ez(e);var KR=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};KR.autoRemove=e=>ez(e);var qR=(e,t,n)=>e.getValue(t)?.includes(n);qR.autoRemove=e=>ez(e);var JR=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});JR.autoRemove=e=>ez(e)||!(e!=null&&e.length);var YR=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));YR.autoRemove=e=>ez(e)||!(e!=null&&e.length);var XR=(e,t,n)=>e.getValue(t)===n;XR.autoRemove=e=>ez(e);var ZR=(e,t,n)=>e.getValue(t)==n;ZR.autoRemove=e=>ez(e);var QR=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};QR.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},QR.autoRemove=e=>ez(e)||ez(e[0])&&ez(e[1]);var $R={includesString:WR,includesStringSensitive:GR,equalsString:KR,arrIncludes:qR,arrIncludesAll:JR,arrIncludesSome:YR,equals:XR,weakEquals:ZR,inNumberRange:QR};function ez(e){return e==null||e===``}var tz={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:AR(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?$R.includesString:typeof n==`number`?$R.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?$R.equals:Array.isArray(n)?$R.arrIncludes:$R.weakEquals},e.getFilterFn=()=>jR(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??$R[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=kR(n,i?i.value:void 0);if(nz(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>kR(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&nz(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function nz(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var rz={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!MR(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},iz={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:AR(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return rz.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return rz.extent},e.getAggregationFn=()=>{if(!e)throw Error();return jR(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??rz[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function az(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var oz={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:AR(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=PR(e=>[_z(t,e)],t=>t.findIndex(t=>t.id===e.id),FR(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>_z(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=_z(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=PR(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return az(i,t,n)},FR(e.options,`debugTable`,`_getOrderColumnsFn`))}},sz=()=>({left:[],right:[]}),cz={getInitialState:e=>({columnPinning:sz(),...e}),getDefaultOptions:e=>({onColumnPinningChange:AR(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=PR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},FR(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=PR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),FR(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=PR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),FR(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?sz():e.initialState?.columnPinning??sz()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=PR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),FR(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=PR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),FR(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=PR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},FR(e.options,`debugColumns`,`getCenterLeafColumns`))}};function lz(e){return e||(typeof document<`u`?document:null)}var uz={size:150,minSize:20,maxSize:2**53-1},dz=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),fz={getDefaultColumnDef:()=>uz,getInitialState:e=>({columnSizing:{},columnSizingInfo:dz(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:AR(`columnSizing`,e),onColumnSizingInfoChange:AR(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??uz.minSize,n??e.columnDef.size??uz.size),e.columnDef.maxSize??uz.maxSize)},e.getStart=PR(e=>[e,_z(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),FR(t.options,`debugColumns`,`getStart`)),e.getAfter=PR(e=>[e,_z(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),FR(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),hz(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=hz(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=lz(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=mz()?{passive:!1}:!1;hz(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?dz():e.initialState.columnSizingInfo??dz())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},pz=null;function mz(){if(typeof pz==`boolean`)return pz;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return pz=e,pz}function hz(e){return e.type===`touchstart`}var gz={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:AR(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=PR(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),FR(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=PR(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],FR(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>PR(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),FR(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function _z(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var vz={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},yz={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:AR(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>$R.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return jR(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??$R[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},bz={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:AR(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0?!0:!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},xz=0,Sz=10,Cz=()=>({pageIndex:xz,pageSize:Sz}),wz={getInitialState:e=>({...e,pagination:{...Cz(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:AR(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>kR(t,e)),e.resetPagination=t=>{e.setPagination(t?Cz():e.initialState.pagination??Cz())},e.setPageIndex=t=>{e.setPagination(n=>{let r=kR(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?xz:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??xz)},e.resetPageSize=t=>{var n;e.setPageSize(t?Sz:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??Sz)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,kR(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=kR(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=PR(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},FR(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},Tz=()=>({top:[],bottom:[]}),Ez={getInitialState:e=>({rowPinning:Tz(),...e}),getDefaultOptions:e=>({onRowPinningChange:AR(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?Tz():e.initialState?.rowPinning??Tz()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=PR(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),FR(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=PR(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),FR(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=PR(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},FR(e.options,`debugRows`,`getCenterRows`))}},Dz={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:AR(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{Oz(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=PR(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?kz(e,n):{rows:[],flatRows:[],rowsById:{}},FR(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=PR(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?kz(e,n):{rows:[],flatRows:[],rowsById:{}},FR(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=PR(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?kz(e,n):{rows:[],flatRows:[],rowsById:{}},FR(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return Oz(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return Az(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return jz(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return jz(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},Oz=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>Oz(e,t.id,n,r,i))};function kz(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=Az(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function Az(e,t){return t[e.id]??!1}function jz(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if(!(a&&!i)&&(e.getCanSelect()&&(Az(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=jz(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var Mz=/([0-9]+)/gm,Nz=(e,t,n)=>Vz(Bz(e.getValue(n)).toLowerCase(),Bz(t.getValue(n)).toLowerCase()),Pz=(e,t,n)=>Vz(Bz(e.getValue(n)),Bz(t.getValue(n))),Fz=(e,t,n)=>zz(Bz(e.getValue(n)).toLowerCase(),Bz(t.getValue(n)).toLowerCase()),Iz=(e,t,n)=>zz(Bz(e.getValue(n)),Bz(t.getValue(n))),Lz=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},Rz=(e,t,n)=>zz(e.getValue(n),t.getValue(n));function zz(e,t){return e===t?0:e>t?1:-1}function Bz(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function Vz(e,t){let n=e.split(Mz).filter(Boolean),r=t.split(Mz).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}var Hz={alphanumeric:Nz,alphanumericCaseSensitive:Pz,text:Fz,textCaseSensitive:Iz,datetime:Lz,basic:Rz},Uz=[BR,gz,oz,cz,UR,tz,vz,yz,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:AR(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return Hz.datetime;if(typeof n==`string`&&(r=!0,n.split(Mz).length>1))return Hz.alphanumeric}return r?Hz.text:Hz.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return jR(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??Hz[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},iz,bz,wz,Ez,Dz,fz];function Wz(e){let t=[...Uz,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{n.options=i(kR(e,n.options))},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:PR(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),FR(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:PR(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=LR(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},FR(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:PR(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),FR(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:PR(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),FR(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:PR(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),FR(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function Gz(){return e=>PR(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=HR(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},FR(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function Kz(){return e=>PR(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;let r=e.getState().sorting,i=[],a=r.filter(t=>e.getColumn(t.id)?.getCanSort()),o={};a.forEach(t=>{let n=e.getColumn(t.id);n&&(o[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});let s=e=>{let t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let n=0;n<a.length;n+=1){let r=a[n],i=o[r.id],s=i.sortUndefined,c=r?.desc??!1,l=0;if(s){let n=e.getValue(r.id),i=t.getValue(r.id),a=n===void 0,o=i===void 0;if(a||o){if(s===`first`)return a?-1:1;if(s===`last`)return a?1:-1;l=a&&o?0:a?s:-s}}if(l===0&&(l=i.sortingFn(e,t,r.id)),l!==0)return c&&(l*=-1),i.invertSorting&&(l*=-1),l}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),(t=e.subRows)!=null&&t.length&&(e.subRows=s(e.subRows))}),t};return{rows:s(n.rows),flatRows:i,rowsById:n.rowsById}},FR(e.options,`debugTable`,`getSortedRowModel`,()=>e._autoResetPageIndex()))}function qz(e,t){return e?Jz(e)?b.createElement(e,t):e:null}function Jz(e){return Yz(e)||typeof e==`function`||Xz(e)}function Yz(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Xz(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function Zz(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=b.useState(()=>({current:Wz(t)})),[r,i]=b.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var Qz=_();function $z(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o;n.key&&n.debug?.call(n)&&(o=Date.now());let s=e();if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug?.call(n)&&(c=Date.now()),i=t(...s),n.key&&n.debug?.call(n)){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
31
|
+
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function LR(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function RR(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:IR(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),LR(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function zR(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:IR(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],LR(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:IR(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},LR(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var BR=`debugHeaders`;function VR(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var HR={createTable:e=>{e.getHeaderGroups=IR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return UR(t,[...a,...s,...o],e)},LR(e.options,BR,`getHeaderGroups`)),e.getCenterHeaderGroups=IR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),UR(t,n,e,`center`)),LR(e.options,BR,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=IR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>UR(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),LR(e.options,BR,`getLeftHeaderGroups`)),e.getRightHeaderGroups=IR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>UR(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),LR(e.options,BR,`getRightHeaderGroups`)),e.getFooterGroups=IR(()=>[e.getHeaderGroups()],e=>[...e].reverse(),LR(e.options,BR,`getFooterGroups`)),e.getLeftFooterGroups=IR(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),LR(e.options,BR,`getLeftFooterGroups`)),e.getCenterFooterGroups=IR(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),LR(e.options,BR,`getCenterFooterGroups`)),e.getRightFooterGroups=IR(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),LR(e.options,BR,`getRightFooterGroups`)),e.getFlatHeaders=IR(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),LR(e.options,BR,`getFlatHeaders`)),e.getLeftFlatHeaders=IR(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),LR(e.options,BR,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=IR(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),LR(e.options,BR,`getCenterFlatHeaders`)),e.getRightFlatHeaders=IR(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),LR(e.options,BR,`getRightFlatHeaders`)),e.getCenterLeafHeaders=IR(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),LR(e.options,BR,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=IR(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),LR(e.options,BR,`getLeftLeafHeaders`)),e.getRightLeafHeaders=IR(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),LR(e.options,BR,`getRightLeafHeaders`)),e.getLeafHeaders=IR(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),LR(e.options,BR,`getLeafHeaders`))}};function UR(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=VR(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>VR(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var WR=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>FR(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:IR(()=>[e.getAllLeafColumns()],t=>t.map(t=>RR(e,s,t,t.id)),LR(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:IR(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),LR(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},GR={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},KR=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};KR.autoRemove=e=>nz(e);var qR=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};qR.autoRemove=e=>nz(e);var JR=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};JR.autoRemove=e=>nz(e);var YR=(e,t,n)=>e.getValue(t)?.includes(n);YR.autoRemove=e=>nz(e);var XR=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});XR.autoRemove=e=>nz(e)||!(e!=null&&e.length);var ZR=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));ZR.autoRemove=e=>nz(e)||!(e!=null&&e.length);var QR=(e,t,n)=>e.getValue(t)===n;QR.autoRemove=e=>nz(e);var $R=(e,t,n)=>e.getValue(t)==n;$R.autoRemove=e=>nz(e);var ez=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};ez.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},ez.autoRemove=e=>nz(e)||nz(e[0])&&nz(e[1]);var tz={includesString:KR,includesStringSensitive:qR,equalsString:JR,arrIncludes:YR,arrIncludesAll:XR,arrIncludesSome:ZR,equals:QR,weakEquals:$R,inNumberRange:ez};function nz(e){return e==null||e===``}var rz={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:MR(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?tz.includesString:typeof n==`number`?tz.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?tz.equals:Array.isArray(n)?tz.arrIncludes:tz.weakEquals},e.getFilterFn=()=>NR(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??tz[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=jR(n,i?i.value:void 0);if(iz(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>jR(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&iz(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function iz(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var az={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!PR(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},oz={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:MR(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return az.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return az.extent},e.getAggregationFn=()=>{if(!e)throw Error();return NR(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??az[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function sz(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var cz={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:MR(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=IR(e=>[yz(t,e)],t=>t.findIndex(t=>t.id===e.id),LR(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>yz(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=yz(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=IR(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return sz(i,t,n)},LR(e.options,`debugTable`,`_getOrderColumnsFn`))}},lz=()=>({left:[],right:[]}),uz={getInitialState:e=>({columnPinning:lz(),...e}),getDefaultOptions:e=>({onColumnPinningChange:MR(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=IR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},LR(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=IR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),LR(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=IR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),LR(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?lz():e.initialState?.columnPinning??lz()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=IR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),LR(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=IR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),LR(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=IR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},LR(e.options,`debugColumns`,`getCenterLeafColumns`))}};function dz(e){return e||(typeof document<`u`?document:null)}var fz={size:150,minSize:20,maxSize:2**53-1},pz=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),mz={getDefaultColumnDef:()=>fz,getInitialState:e=>({columnSizing:{},columnSizingInfo:pz(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:MR(`columnSizing`,e),onColumnSizingInfoChange:MR(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??fz.minSize,n??e.columnDef.size??fz.size),e.columnDef.maxSize??fz.maxSize)},e.getStart=IR(e=>[e,yz(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),LR(t.options,`debugColumns`,`getStart`)),e.getAfter=IR(e=>[e,yz(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),LR(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),_z(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=_z(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=dz(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=gz()?{passive:!1}:!1;_z(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?pz():e.initialState.columnSizingInfo??pz())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},hz=null;function gz(){if(typeof hz==`boolean`)return hz;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return hz=e,hz}function _z(e){return e.type===`touchstart`}var vz={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:MR(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=IR(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),LR(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=IR(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],LR(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>IR(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),LR(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function yz(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var bz={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},xz={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:MR(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>tz.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return NR(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??tz[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Sz={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:MR(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0?!0:!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Cz=0,wz=10,Tz=()=>({pageIndex:Cz,pageSize:wz}),Ez={getInitialState:e=>({...e,pagination:{...Tz(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:MR(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>jR(t,e)),e.resetPagination=t=>{e.setPagination(t?Tz():e.initialState.pagination??Tz())},e.setPageIndex=t=>{e.setPagination(n=>{let r=jR(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?Cz:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??Cz)},e.resetPageSize=t=>{var n;e.setPageSize(t?wz:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??wz)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,jR(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=jR(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=IR(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},LR(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},Dz=()=>({top:[],bottom:[]}),Oz={getInitialState:e=>({rowPinning:Dz(),...e}),getDefaultOptions:e=>({onRowPinningChange:MR(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?Dz():e.initialState?.rowPinning??Dz()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=IR(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),LR(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=IR(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),LR(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=IR(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},LR(e.options,`debugRows`,`getCenterRows`))}},kz={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:MR(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{Az(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=IR(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?jz(e,n):{rows:[],flatRows:[],rowsById:{}},LR(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=IR(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?jz(e,n):{rows:[],flatRows:[],rowsById:{}},LR(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=IR(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?jz(e,n):{rows:[],flatRows:[],rowsById:{}},LR(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return Az(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return Mz(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return Nz(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return Nz(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},Az=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>Az(e,t.id,n,r,i))};function jz(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=Mz(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function Mz(e,t){return t[e.id]??!1}function Nz(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if(!(a&&!i)&&(e.getCanSelect()&&(Mz(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=Nz(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var Pz=/([0-9]+)/gm,Fz=(e,t,n)=>Uz(Hz(e.getValue(n)).toLowerCase(),Hz(t.getValue(n)).toLowerCase()),Iz=(e,t,n)=>Uz(Hz(e.getValue(n)),Hz(t.getValue(n))),Lz=(e,t,n)=>Vz(Hz(e.getValue(n)).toLowerCase(),Hz(t.getValue(n)).toLowerCase()),Rz=(e,t,n)=>Vz(Hz(e.getValue(n)),Hz(t.getValue(n))),zz=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},Bz=(e,t,n)=>Vz(e.getValue(n),t.getValue(n));function Vz(e,t){return e===t?0:e>t?1:-1}function Hz(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function Uz(e,t){let n=e.split(Pz).filter(Boolean),r=t.split(Pz).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}var Wz={alphanumeric:Fz,alphanumericCaseSensitive:Iz,text:Lz,textCaseSensitive:Rz,datetime:zz,basic:Bz},Gz=[HR,vz,cz,uz,GR,rz,bz,xz,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:MR(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return Wz.datetime;if(typeof n==`string`&&(r=!0,n.split(Pz).length>1))return Wz.alphanumeric}return r?Wz.text:Wz.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return NR(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??Wz[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},oz,Sz,Ez,Oz,kz,mz];function Kz(e){let t=[...Gz,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{n.options=i(jR(e,n.options))},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:IR(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),LR(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:IR(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=zR(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},LR(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:IR(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),LR(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:IR(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),LR(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:IR(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),LR(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function qz(){return e=>IR(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=WR(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},LR(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function Jz(){return e=>IR(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;let r=e.getState().sorting,i=[],a=r.filter(t=>e.getColumn(t.id)?.getCanSort()),o={};a.forEach(t=>{let n=e.getColumn(t.id);n&&(o[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});let s=e=>{let t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let n=0;n<a.length;n+=1){let r=a[n],i=o[r.id],s=i.sortUndefined,c=r?.desc??!1,l=0;if(s){let n=e.getValue(r.id),i=t.getValue(r.id),a=n===void 0,o=i===void 0;if(a||o){if(s===`first`)return a?-1:1;if(s===`last`)return a?1:-1;l=a&&o?0:a?s:-s}}if(l===0&&(l=i.sortingFn(e,t,r.id)),l!==0)return c&&(l*=-1),i.invertSorting&&(l*=-1),l}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),(t=e.subRows)!=null&&t.length&&(e.subRows=s(e.subRows))}),t};return{rows:s(n.rows),flatRows:i,rowsById:n.rowsById}},LR(e.options,`debugTable`,`getSortedRowModel`,()=>e._autoResetPageIndex()))}function Yz(e,t){return e?Xz(e)?b.createElement(e,t):e:null}function Xz(e){return Zz(e)||typeof e==`function`||Qz(e)}function Zz(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Qz(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function $z(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=b.useState(()=>({current:Kz(t)})),[r,i]=b.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var eB=_();function tB(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o;n.key&&n.debug?.call(n)&&(o=Date.now());let s=e();if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug?.call(n)&&(c=Date.now()),i=t(...s),n.key&&n.debug?.call(n)){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
32
32
|
font-size: .6rem;
|
|
33
33
|
font-weight: bold;
|
|
34
|
-
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return o.updateDeps=e=>{r=e},o}function eB(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var tB=(e,t)=>Math.abs(e-t)<1.01,nB=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},rB=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},iB=e=>e,aB=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},oB=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(rB(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(rB(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},sB={passive:!0},cB=typeof window>`u`?!0:`onscrollend`in window,lB=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&cB?()=>void 0:nB(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{let{horizontal:o,isRtl:s}=e.options;i=o?n.scrollLeft*(s&&-1||1):n.scrollTop,a(),t(i,r)},s=o(!0),c=o(!1);n.addEventListener(`scroll`,s,sB);let l=e.options.useScrollendEvent&&cB;return l&&n.addEventListener(`scrollend`,c,sB),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},uB=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},dB=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},fB=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:iB,rangeExtractor:aB,onChange:()=>{},measureElement:uB,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=$z(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=$z(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,t,n,r,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=$z(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a},o)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let s=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let c=this.measurementsCache.slice(0,s),l=Array(a).fill(void 0);for(let e=0;e<s;e++){let t=c[e];t&&(l[t.lane]=e)}for(let i=s;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,u;if(a!==void 0&&this.options.lanes>1){s=a;let e=l[s],r=e===void 0?void 0:c[e];u=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?c[i-1]:this.getFurthestMeasurement(c,i);u=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(i,s)}let d=o.get(e),f=typeof d==`number`?d:this.options.estimateSize(i),p=u+f;c[i]={index:i,start:u,size:f,end:p,key:e,lane:s},l[s]=i}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=$z(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?mB({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=$z(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{let n=this.measurementsCache[e];if(!n)return;let r=t-(this.itemSizeCache.get(n.key)??n.size);r!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?n.start<this.getScrollOffset()+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this))&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.getVirtualItems=$z(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length!==0)return eB(t[pB(0,t.length-1,e=>eB(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=e[e.length-1]?.end??0;else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&tB(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,n&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior=`auto`,this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}));this.scheduleScrollReconcile()}},pB=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function mB({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){let i=e.length-1,a=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let o=pB(0,i,a,n),s=o;if(r===1)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){let a=Array(r).fill(0);for(;s<i&&a.some(e=>e<n+t);){let t=e[s];a[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(i,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var hB=typeof document<`u`?b.useLayoutEffect:b.useEffect;function gB({useFlushSync:e=!0,...t}){let n=b.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,Qz.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=b.useState(()=>new fB(r));return i.setOptions(r),hB(()=>i._didMount(),[]),hB(()=>i._willUpdate()),i}function _B(e){return gB({observeElementRect:oB,observeElementOffset:lB,scrollToFn:dB,...e})}function vB(e){return EI(e)}function yB(e){return e==null?`—`:`$`+e.toFixed(2)}function bB(e){if(!e||e<=0)return`—`;let t=Math.floor(e/60),n=Math.floor(t/60);return n>0?`${n}h ${t%60}m`:`${t}m`}function xB(e){return e?new Date(e*1e3).toLocaleString(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`—`}var SB=OR(),CB={review:`tag-review`,exploration:`tag-exploration`,planning:`tag-planning`,memory:`tag-memory`,generic:`tag-generic`};function wB({data:e}){let[t,n]=(0,b.useState)(``),[r,i]=(0,b.useState)([{id:`started_at`,desc:!0}]),a=(0,b.useRef)(null),o=(0,b.useMemo)(()=>{if(!e?.data)return[];let n=t.toLowerCase();return n?e.data.filter(e=>(e.repo_label||``).toLowerCase().includes(n)||(e.model_name||``).toLowerCase().includes(n)||(e.agent_role||``).toLowerCase().includes(n)||(e.agent_nickname||``).toLowerCase().includes(n)||(e.title||``).toLowerCase().includes(n)||(e.descendant_models||[]).some(e=>(e||``).toLowerCase().includes(n))||(e.descendant_families||[]).some(e=>(e||``).toLowerCase().includes(n))||(e.descendant_roles||[]).some(e=>(e||``).toLowerCase().includes(n))||(e.descendant_nicknames||[]).some(e=>(e||``).toLowerCase().includes(n))||(e.related_titles||[]).some(e=>(e||``).toLowerCase().includes(n))):e.data},[e,t]),s=(0,b.useMemo)(()=>[SB.accessor(`started_at`,{header:`Time`,cell:e=>xB(e.getValue()),size:130}),SB.accessor(`repo_label`,{header:`Repo`,cell:e=>e.getValue()||`—`,size:140}),SB.accessor(`model_name`,{header:`Model`,cell:e=>(0,$.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.72rem`},children:e.getValue()||`?`}),size:130}),SB.accessor(`thread_count`,{header:`Threads`,cell:e=>{let t=e.getValue()||1,n=e.row.original;return t>1?`${t} (${n.subagent_count||0} sub)`:`1`},size:92}),SB.accessor(`agent_family`,{header:`Root`,cell:e=>(0,$.jsx)(`span`,{className:`tag ${CB[e.getValue()]||`tag-generic`}`,children:e.getValue()}),size:100}),SB.accessor(`agent_nickname`,{header:`Agent`,cell:e=>e.getValue()||`—`,size:85}),SB.accessor(`reasoning_effort`,{header:`Effort`,cell:e=>e.getValue()||`—`,size:70}),SB.accessor(`elapsed_seconds`,{header:`Duration`,cell:e=>bB(e.getValue()),size:85}),SB.accessor(`tokens_used`,{header:`Tokens`,cell:e=>(0,$.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`},children:vB(e.getValue())}),size:90}),SB.accessor(`cost`,{header:`Cost`,cell:e=>(0,$.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`},children:e.getValue()==null?`—`:yB(e.getValue())}),size:80}),SB.accessor(`title`,{header:`Title`,cell:e=>(0,$.jsx)(`span`,{title:e.getValue(),style:{opacity:.6},children:(e.getValue()||``).slice(0,55)}),size:240})],[]),c=Zz({data:o,columns:s,state:{sorting:r},onSortingChange:i,getCoreRowModel:Gz(),getSortedRowModel:Kz()}),l=c.getRowModel().rows,u=(0,b.useMemo)(()=>o.reduce((e,t)=>(e.sessions+=1,e.tokens+=t.tokens_used||0,e.cost+=t.cost||0,e.elapsed+=t.elapsed_seconds||0,e),{sessions:0,tokens:0,cost:0,elapsed:0}),[o]),d=_B({count:l.length,getScrollElement:()=>a.current,estimateSize:()=>36,overscan:10,getItemKey:e=>l[e]?.id??e}),f=d.getVirtualItems(),p=f.length>0?f[0].start:0,m=f.length>0?d.getTotalSize()-f[f.length-1].end:0;return(0,$.jsx)(`div`,{className:`animate-in`,children:(0,$.jsxs)(`div`,{className:`table-wrap`,children:[(0,$.jsx)(`div`,{className:`table-search`,children:(0,$.jsx)(`input`,{placeholder:`Search sessions...`,value:t,onChange:e=>n(e.target.value)})}),(0,$.jsxs)(`div`,{style:{fontSize:`0.7rem`,color:`var(--text-muted)`,padding:`0.4rem 1rem`,borderBottom:`1px solid var(--border)`},children:[o.length.toLocaleString(),` root sessions`,e&&!e.complete&&(0,$.jsx)(`span`,{className:`incomplete-badge`,style:{marginLeft:`0.5rem`},children:`partial`})]}),(0,$.jsxs)(`div`,{style:{fontSize:`0.7rem`,color:`var(--text-muted)`,padding:`0.45rem 1rem`,borderBottom:`1px solid var(--border)`,display:`flex`,gap:`1rem`,flexWrap:`wrap`},children:[(0,$.jsxs)(`span`,{children:[`Filtered sessions: `,(0,$.jsx)(`strong`,{style:{color:`var(--text-secondary)`},children:u.sessions.toLocaleString()})]}),(0,$.jsxs)(`span`,{children:[`Tokens: `,(0,$.jsx)(`strong`,{style:{color:`var(--text-secondary)`},children:vB(u.tokens)})]}),(0,$.jsxs)(`span`,{children:[`Cost: `,(0,$.jsx)(`strong`,{style:{color:`var(--text-secondary)`},children:yB(u.cost)})]}),(0,$.jsxs)(`span`,{children:[`Time: `,(0,$.jsx)(`strong`,{style:{color:`var(--text-secondary)`},children:bB(u.elapsed)})]})]}),(0,$.jsx)(`div`,{ref:a,style:{height:`600px`,overflow:`auto`},children:(0,$.jsxs)(`table`,{style:{tableLayout:`fixed`,width:`100%`},children:[(0,$.jsx)(`thead`,{style:{position:`sticky`,top:0,background:`var(--bg-card)`,zIndex:1},children:c.getHeaderGroups().map(e=>(0,$.jsx)(`tr`,{children:e.headers.map(e=>(0,$.jsxs)(`th`,{style:{width:e.getSize()},onClick:e.column.getToggleSortingHandler(),children:[qz(e.column.columnDef.header,e.getContext()),{asc:` ↑`,desc:` ↓`}[e.column.getIsSorted()]||``]},e.id))},e.id))}),(0,$.jsxs)(`tbody`,{children:[f.length===0&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:s.length,style:{textAlign:`center`,padding:`2rem`,color:`var(--text-muted)`},children:`No sessions`})}),p>0&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:s.length,style:{height:`${p}px`,padding:0,borderBottom:`none`}})}),f.map(e=>{let t=l[e.index];return(0,$.jsx)(`tr`,{style:{height:e.size},children:t.getVisibleCells().map(e=>(0,$.jsx)(`td`,{style:{width:e.column.getSize()},children:qz(e.column.columnDef.cell,e.getContext())},e.id))},t.id)}),m>0&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:s.length,style:{height:`${m}px`,padding:0,borderBottom:`none`}})})]})]})})]})})}function TB(){return{ingest_id:null,seq:0,overview:{total:{},d7:{},d30:{},cost_assumptions:null},repos:{total:[],d7:[],d30:[]},models:{total:[],d7:[],d30:[]},families:{total:[],d7:[],d30:[]},daily:{},heatmap:{}}}function EB(e,t,n){let r=n===`bootstrap`||!e||e.ingest_id!==t.ingest_id?TB():{...e};return r.ingest_id=t.ingest_id,r.seq=t.seq,t.data?.overview?r.overview={...r.overview,...t.data.overview,total:t.data.overview.total?{...r.overview.total,...t.data.overview.total}:r.overview.total,d7:t.data.overview.d7?{...r.overview.d7,...t.data.overview.d7}:r.overview.d7,d30:t.data.overview.d30?{...r.overview.d30,...t.data.overview.d30}:r.overview.d30}:e&&(r.overview=e.overview),r.repos=DB(e?.repos,t.data?.repos,r.repos),r.models=DB(e?.models,t.data?.models,r.models),r.families=DB(e?.families,t.data?.families,r.families),r.daily=t.data?.daily?{...e?.daily||{},...t.data.daily}:e?.daily||r.daily,r.heatmap=t.data?.heatmap?{...e?.heatmap||{},...t.data.heatmap}:e?.heatmap||r.heatmap,r}function DB(e,t,n){if(!t)return e||n;let r={total:e?e.total:n.total,d7:e?e.d7:n.d7,d30:e?e.d30:n.d30};for(let e of[`total`,`d7`,`d30`])t[e]&&(r[e]=t[e]);return r}function OB(e){return e?{overview:{data:e.overview,coverage:e.overview?.total?.coverage||{total:0,enriched:0,priced:0,time_valid:0}},repos:{data:e.repos},models:{data:e.models},families:{data:e.families},daily:{data:Object.entries(e.daily).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({date:e,...t}))},heatmap:{data:e.heatmap}}:null}function kB(e){let t=e.replay?.bootstrap?.payload||{},n=LB(t.progress||{percent:0,complete:!1}),r=EB(null,t,`bootstrap`),i=e.replay?.events||[],a=i.findIndex(e=>e.event===`patch`),o=a>=0&&i[a].at_ms||0,s=RB(e,r,i),c=s[0]?.presentation||WB(),l=LB(a>=0&&i[a].payload?.progress||n),u=Math.max(e.startHoldDurationMs||0,0),d=Math.max(e.replayDurationMs||e.replay?.duration_ms||1,1),f=Math.max(e.tailDurationMs||0,0),p=Math.max(e.finalHoldDurationMs||0,0),m=Math.max(e.durationMs||u+d+f+p||1,1),h=Math.max(e.replay?.duration_ms||0,0),g=Math.min(Math.max(o,0),h),_=Math.max(1,h-g),v=GB(e.tailSourceFraction??.035),y=Math.max(1,Math.round(_*v)),b=Math.max(0,_-y),x=Math.max(g,h-y),S=e.replayEasing||`cubicInOut`,C=e.tailEasing||`cubicInOut`,w=s[s.length-1]?.presentation||c,T=UB(s,x),E=Math.min(3600,Math.max(1800,Math.round(d*.32))),D=Math.max(0+u,0+u+d-E),O=GB((D-(0+u))/Math.max(d,1)),k=Math.round(g+b*QB(S,O)),A=HB({keyframes:s,startSourceMs:k,endSourceMs:x,startPresentation:UB(s,k),endPresentation:T,durationMs:E,startSmoothing:.05,endSmoothing:.14}),j=VB({keyframes:s,tailSourceStartMs:x,sourceDurationMs:h,tailStartPresentation:T,finalPresentation:w,tailDurationMs:f});return{renderData:e,totalDurationMs:m,frontloadSettledDurationMs:0,startHoldDurationMs:u,replayDurationMs:d,tailDurationMs:f,finalHoldDurationMs:p,sourceDurationMs:h,sourceStartMs:g,effectiveSourceDurationMs:_,tailSourceDurationMs:y,tailSourceStartMs:x,mainReplaySourceDurationMs:b,replayStartMs:u,lateReplayStartMs:D,lateReplayDurationMs:E,lateReplaySourceStartMs:k,tailStartMs:u+d,finalHoldStartMs:u+d+f,currentSeekMs:0,started:!1,finished:!1,startWallClockMs:0,initialPresentation:c,presentation:c,keyframes:s,keyframeIndex:0,lateReplayFrames:A,tailStartPresentation:T,tailFrames:j,finalPresentation:w,progress:l||{...n,percent:0,complete:!1},bootstrapProgress:n,replayEasing:S,tailEasing:C,debugState:null,debugTrace:[]}}function AB(e){return{liveData:{ready:!0},presentation:e.presentation,rawPresentation:e.presentation,progress:e.progress,phase:e.debugState?.phase||`replay`,seekMs:e.currentSeekMs||0}}function jB(e,t){let n=Math.min(Math.max(Number(t)||0,0),e.totalDurationMs);e.currentSeekMs=n;let r=`replay`,i=0,a=null;if(n<e.startHoldDurationMs)r=`start_hold`,e.presentation=e.initialPresentation||WB();else if(n<e.tailStartMs)if(n<e.lateReplayStartMs)i=MB(e,n),e.presentation=zB(e,i);else{let t=GB((n-e.lateReplayStartMs)/Math.max(e.lateReplayDurationMs,1));i=KB(e.lateReplaySourceStartMs,e.tailSourceStartMs,t),e.presentation=BB(e.lateReplayFrames,YB(t))}else n<e.finalHoldStartMs?(r=`tail`,a=GB((n-e.tailStartMs)/Math.max(e.tailDurationMs,1)),e.presentation=BB(e.tailFrames,QB(e.tailEasing,a))):(r=`final_hold`,e.presentation=e.finalPresentation);n>=e.finalHoldStartMs?((n-e.finalHoldStartMs)/Math.max(e.finalHoldDurationMs||1,1),e.progress={...e.progress||{},percent:1,complete:!0,phase:`complete`}):e.progress={...e.progress||{},complete:!1},n>=e.totalDurationMs&&(e.finished=!0);let o={frame:e.debugTrace.length,seekMs:n,phase:r,sourceMs:i,tailProgress:a,progress:e.progress?.percent??0,complete:!!e.progress?.complete,signature:qB(e.presentation)};return e.debugState=o,e.debugTrace.push(o),AB(e)}function MB(e,t){if(t<=e.replayStartMs)return 0;let n=t-e.replayStartMs;if(n<=e.replayDurationMs){let t=GB(n/Math.max(e.replayDurationMs,1));return e.sourceStartMs+e.mainReplaySourceDurationMs*QB(e.replayEasing,t)}return e.sourceDurationMs}function NB(e,t,n,r){if(!e)return t;let i=kI.videoExport||{};if(r<(i.displayTweenStartMs??200))return t;let a=(i.startHoldDurationMs??0)+(i.replayDurationMs??0)+(i.tailDurationMs??0)+(i.finalHoldDurationMs??0)||19e3,o=i.displayTweenLateWindowMs??2200,s=GB((r-(a-o))/Math.max(o,1)),c=Math.round(KB(i.displayTweenBaseMs??240,i.displayTweenLateMs??420,XB(s))),l=XB(1-Math.exp(-n/Math.max(c,1))),u=e.progress||{},d=t.progress||{};return{liveData:t.liveData,presentation:sL(e.presentation,t.presentation,l),rawPresentation:t.rawPresentation||t.presentation,progress:{...d,percent:KB(u.percent||0,d.percent||0,l),complete:d.complete},phase:t.phase,seekMs:t.seekMs||0}}function PB(e,t){let n=kI.videoExport||{},r=Math.max(n.finalFlashDurationMs??280,0),i=Math.max(n.finalFlashMaxOpacity??.22,0);if(!r||!i||t==null)return{opacity:0,boxShadow:`none`};let a=e-t;if(a<0||a>r)return{opacity:0,boxShadow:`none`};let o=i*(1-XB(GB(a/r)));return{opacity:o,boxShadow:`0 0 120px 50px rgba(255, 255, 255, ${Math.min(1,o*.7)}) inset`}}function FB(e){let t=kI.videoExport||{};if(!t.introFadeEnabled)return 0;let n=Math.max(0,Math.min(1,t.introFadeStartOpacity??.2)),r=Math.max(0,t.introFadeDelayMs??0),i=Math.max(0,t.introFadeDurationMs??900);if(!n)return 0;if(e<=r)return n;if(!i)return 0;let a=GB((e-r)/i);return n*(1-QB(t.introFadeEasing||`cubicOut`,a))}function IB(e){let t=kI.videoExport||{};if(!t.introFadeEnabled)return 1;let n=Math.max(0,Math.min(1,t.introContentStartOpacity??.35)),r=Math.max(0,t.introFadeDelayMs??0),i=Math.max(0,t.introFadeDurationMs??900);if(e<=r)return n;if(!i)return 1;let a=GB((e-r)/i);return KB(n,1,QB(t.introFadeEasing||`cubicOut`,a))}function LB(e){return e?{...e}:null}function RB(e,t,n){let r=[],i=t;for(let e of n)e.event===`patch`&&(i=EB(i,e.payload,`patch`),r.push({at_ms:Math.max(0,e.at_ms||0),presentation:nL({overview:{data:i.overview},heatmap:{data:i.heatmap},daily:{data:Object.entries(i.daily).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({date:e,...t}))},families:{data:i.families},repos:{data:i.repos},models:{data:i.models},range:`total`})}));return r.length||r.push({at_ms:0,presentation:WB()}),r}function zB(e,t){return UB(e.keyframes,t,e)}function BB(e,t){if(!e?.length)return WB();if(t<=e[0].u)return e[0].presentation;for(let n=0;n<e.length-1;n+=1){let r=e[n],i=e[n+1];if(t<=i.u){let e=GB((t-r.u)/Math.max(i.u-r.u,1e-6));return sL(r.presentation,i.presentation,e)}}return e[e.length-1].presentation}function VB({keyframes:e,tailSourceStartMs:t,sourceDurationMs:n,tailStartPresentation:r,finalPresentation:i,tailDurationMs:a}){return HB({keyframes:e,startSourceMs:t,endSourceMs:n,startPresentation:r,endPresentation:i,durationMs:a,startSmoothing:.08,endSmoothing:.2,bidirectional:!0})}function HB({keyframes:e,startSourceMs:t,endSourceMs:n,startPresentation:r,endPresentation:i,durationMs:a,startSmoothing:o,endSmoothing:s,bidirectional:c=!1}){let l=Math.max(36,Math.min(96,Math.round(a/80))),u=[{u:0,presentation:r}];for(let r=1;r<l-1;r+=1){let i=r/(l-1),a=KB(t,n,i);u.push({u:i,presentation:UB(e,a)})}u.push({u:1,presentation:i});let d=[{u:0,presentation:r}],f=r;for(let e=1;e<u.length-1;e+=1){let t=u[e],n=KB(o,s,t.u);f=sL(f,t.presentation,n),d.push({u:t.u,presentation:f})}if(d.push({u:1,presentation:i}),!c)return d;let p=Array(u.length);p[u.length-1]={u:1,presentation:i};let m=i;for(let e=u.length-2;e>0;--e){let t=u[e],n=KB(s,o,1-t.u);m=sL(m,t.presentation,n),p[e]={u:t.u,presentation:m}}return p[0]={u:0,presentation:r},u.map((e,t)=>t===0?{u:0,presentation:r}:t===u.length-1?{u:1,presentation:i}:{u:e.u,presentation:sL(d[t].presentation,p[t].presentation,YB(e.u))})}function UB(e,t,n=null){if(!e.length)return WB();if(t<=e[0].at_ms)return e[0].presentation;let r=n?.keyframeIndex||0;for(;r+1<e.length&&e[r+1].at_ms<=t;)r+=1;n&&(n.keyframeIndex=r);let i=e[r],a=e[Math.min(r+1,e.length-1)];if(!a||a.at_ms<=i.at_ms)return i.presentation;let o=GB((t-i.at_ms)/Math.max(a.at_ms-i.at_ms,1));return sL(i.presentation,a.presentation,o)}function WB(){return nL({overview:{data:null},heatmap:{data:{}},daily:{data:[]},families:{data:{total:[],d7:[],d30:[]}},repos:{data:{total:[],d7:[],d30:[]}},models:{data:{total:[],d7:[],d30:[]}},range:`total`})}function GB(e){return Math.min(Math.max(e||0,0),1)}function KB(e,t,n){return e+(t-e)*n}function qB(e){if(!e)return null;let t=e.stats||{},n=e.daily||{dates:[],series:[]},r=Array.isArray(e.topRepos)?e.topRepos:[],i=Array.isArray(e.topModels)?e.topModels:[],a=Math.max(0,(n.dates?.length||0)-1),o=n.dates?.[a]||null,s=(n.series||[]).reduce((e,t)=>e+(Number(t?.data?.[a])||0),0),c=r[0]||null,l=i[0]||null;return{totalTokens:Math.round(Number(t.tokens)||0),totalCost:Number((Number(t.cost)||0).toFixed(4)),totalSessions:Math.round(Number(t.sessions)||0),dailyPoints:n.dates?.length||0,lastDailyDate:o,lastDailyTotal:Math.round(s),topRepo:c?.label||null,topRepoValue:Math.round(Number(c?.tokens)||0),topModel:l?.label||null,topModelValue:Math.round(Number(l?.tokens)||0)}}function JB(e){let t=GB(e);return t*t*t}function YB(e){let t=GB(e);return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function XB(e){return 1-(1-GB(e))**3}function ZB(e){let t=GB(e),n=[[0,0],[.12,.03],[.24,.09],[.4,.22],[.58,.42],[.74,.62],[.86,.77],[.93,.86],[.975,.93],[.992,.975],[1,1]];for(let e=0;e<n.length-1;e+=1){let[r,i]=n[e],[a,o]=n[e+1];if(t<=a)return KB(i,o,YB(GB((t-r)/Math.max(a-r,1e-6))))}return 1}function QB(e,t){switch(e){case`trainBrake`:return ZB(t);case`cubicOut`:return XB(t);case`cubicInOut`:return YB(t);case`linear`:return GB(t);default:return JB(t)}}function $B({jobId:e}){let[t,n]=(0,b.useState)(null),[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(!1),l=(0,b.useRef)(null),u=(0,b.useRef)(0),d=(0,b.useRef)(null),f=(0,b.useRef)(0),p=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let t=!0;return(async()=>{try{let r=await fetch(T.url(`/api/export/${encodeURIComponent(e)}/render-data`));if(!r.ok)throw Error(`API error: ${r.status}`);let i=await r.json();if(!t)return;n(i),l.current=kB(i);let a=AB(l.current);d.current=a,f.current=0,o(a),c(!1),p.current=null}catch(e){if(!t)return;i(e.message||String(e))}})(),()=>{t=!1,u.current&&cancelAnimationFrame(u.current)}},[e]),(0,b.useEffect)(()=>{if(!a?.liveData||r)return;let e=!1,t=0,n=0,i=0,o=0,s=0,l=()=>{let t=Array.from(document.querySelectorAll(`.stat-card .stat-value`)),n=Array.from(document.querySelectorAll(`canvas`)),r=t.length>=4&&t.every(e=>String(e.textContent||``).trim().length>0),i=n.length>=4&&n.every(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0}),a=document.querySelectorAll(`.heatmap-cell`).length>=300;if(!(r&&i&&a)){o=requestAnimationFrame(l);return}s=window.setTimeout(()=>{e||c(!0)},180)};return t=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>{i=requestAnimationFrame(()=>{o=requestAnimationFrame(l)})})}),()=>{e=!0,t&&cancelAnimationFrame(t),n&&cancelAnimationFrame(n),i&&cancelAnimationFrame(i),o&&cancelAnimationFrame(o),s&&window.clearTimeout(s)}},[r,a]),(0,b.useEffect)(()=>{if(a){if(a.phase===`final_hold`){p.current??=a.seekMs||0;return}p.current=null}},[a?.phase,a?.seekMs]),(0,b.useEffect)(()=>{let n=()=>{let e=l.current;if(!e||e.started)return;e.started=!0,e.startWallClockMs=Date.now();let t=()=>{let e=l.current;if(!e)return;let n=Date.now(),r=Math.min(e.totalDurationMs,n-e.startWallClockMs),i=jB(e,r),a=f.current?Math.max(1,n-f.current):16;f.current=n;let s=NB(d.current,i,a,r);if(d.current=s,o(s),r>=e.totalDurationMs){e.finished=!0,u.current=0;return}u.current=requestAnimationFrame(t)};u.current=requestAnimationFrame(t)};return window.__CODEXMETER_EXPORT__={ready:!!(t&&!r&&s),jobId:e,start(){n()},get currentTimeMs(){return l.current?.currentSeekMs||0},get finished(){return!!l.current?.finished},getDebugState(){return l.current?.debugState||null},getDebugTrace(){return l.current?.debugTrace||[]}},()=>{delete window.__CODEXMETER_EXPORT__}},[s,r,e,t]),r?(0,$.jsx)(`div`,{style:eV,children:(0,$.jsxs)(`div`,{style:nV,children:[`Export error: `,r]})}):a?.liveData?(0,$.jsx)(`div`,{style:eV,children:(0,$.jsxs)(`div`,{style:tV,children:[(0,$.jsxs)(`div`,{style:{...sV,opacity:IB(a.seekMs)},children:[(0,$.jsx)(PL,{presentation:a.presentation,rawPresentation:a.rawPresentation,ingestProgress:Math.min(Math.max(a.progress?.percent||0,0),1),isIngestActive:!!(a.progress&&!a.progress.complete),exportMode:!1,exportPlayback:!0,exportPhase:a.phase,exportSeekMs:a.seekMs}),(0,$.jsxs)(`div`,{style:rV,children:[`Made with `,(0,$.jsx)(`span`,{style:iV,children:`♥`}),` by JJ`]})]}),(0,$.jsx)(`div`,{style:{...oV,opacity:FB(a.seekMs)}}),(0,$.jsx)(`div`,{style:{...aV,...PB(a.seekMs,p.current)}})]})}):(0,$.jsx)(`div`,{style:eV,children:(0,$.jsx)(`div`,{style:nV,children:`CodexMeter exporting…`})})}var eV={width:`100vw`,minHeight:`100vh`,background:`#06080f`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`},tV={position:`relative`,width:1080,height:864,padding:`24px 28px 20px`,background:`#06080f`,overflow:`hidden`},nV={color:`#8b949e`,fontFamily:`'JetBrains Mono', 'Fira Code', monospace`,fontSize:18},rV={position:`absolute`,right:18,bottom:10,color:`rgba(139, 148, 158, 0.58)`,fontSize:10,fontFamily:`'JetBrains Mono', 'Fira Code', monospace`,letterSpacing:`0.02em`,opacity:.62,pointerEvents:`none`},iV={color:`rgba(244, 63, 94, 0.52)`},aV={position:`absolute`,inset:0,background:`linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(248,250,255,1) 100%)`,pointerEvents:`none`,zIndex:20,mixBlendMode:`screen`},oV={position:`absolute`,inset:0,background:`#000000`,pointerEvents:`none`,zIndex:30},sV={position:`relative`,zIndex:1},cV=[`Overview`,`Repos`,`Models`,`Daily`,`Sessions`],lV=[{key:`d7`,label:`7d`},{key:`d30`,label:`30d`},{key:`total`,label:`All`}];function uV(e){return e?new Date(e*1e3).toLocaleDateString(`en-US`,{month:`short`,day:`2-digit`}):`—`}function dV(e){return!Number.isFinite(e)||e<=0?0:Math.floor(e/86400)*86400}var fV={idle:`Starting...`,inventory:`Reading threads`,normalizing:`Normalizing`,enrichment:`Enriching rollouts`,aggregation:`Building aggregates`,finalizing:`Finalizing view`,complete:`Complete`,error:`Error`};function pV(){let e=typeof window<`u`?new URLSearchParams(window.location.search):null,t=e?.get(`export`),n=e?.get(`job`);if(t===`overview-video`&&n)return(0,$.jsx)($B,{jobId:n});let[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(`Overview`),[s,c]=(0,b.useState)(`total`),[l,u]=(0,b.useState)({}),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(!0),[h,g]=(0,b.useState)(!1),[_,v]=(0,b.useState)(!1),[y,x]=(0,b.useState)(!1),[S,C]=(0,b.useState)(!1),[w,E]=(0,b.useState)(!0),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(null),[j,ee]=(0,b.useState)(!1),[M,te]=(0,b.useState)(!1),[ne,N]=(0,b.useState)({available:!0,reason:null,portable_download:null}),[P,re]=(0,b.useState)(null),[ie,ae]=(0,b.useState)(null),[oe,se]=(0,b.useState)(null),[ce,le]=(0,b.useState)(null),ue=(0,b.useRef)(!1),F=(0,b.useRef)(0),de=(0,b.useRef)(null),fe=(0,b.useCallback)(async()=>{try{let[e,t,n,r,i,a,o]=await Promise.all([T.overview(),T.repos(),T.models(),T.daily(),T.sessions(),T.heatmap(),T.families()]),s={overview:e,repos:t,models:n,daily:r,sessions:i,heatmap:a,families:o};return u(s),s}catch(e){throw console.error(`Fetch error:`,e),e}},[]),pe=(0,b.useCallback)(async()=>{if(!S)try{C(!0),o(`Overview`),await T.rerun(),window.location.reload()}catch(e){console.error(`Rerun error:`,e),C(!1)}},[S]),me=(0,b.useCallback)(async()=>{if(!(j||[`queued`,`running`].includes(k?.status)))try{ee(!0);let e=!ne?.available&&ne?.portable_download?.available,t=!1;if(e){let e=ne.portable_download.approx_size_mb?`about ${ne.portable_download.approx_size_mb} MB`:`a fairly large download`;if(!window.confirm(`No supported browser was found for video export.\n\nCodexMeter can download a single-use portable Chromium bundle (${e}) for this export only, then delete it afterward.\n\nDo you want to continue?`))return;t=!0,te(!0)}A(await T.startOverviewVideoExport(t?{install_portable_browser:!0}:{}))}catch(e){console.error(`Video export error:`,e)}finally{ee(!1)}},[k?.status,ne,j]);(0,b.useEffect)(()=>{M&&k&&k.phase!==`downloading_browser`&&(k.phase===`rendering`||k.phase===`encoding`||k.status===`complete`||k.status===`failed`)&&te(!1)},[k,M]);let he=(0,b.useCallback)(()=>{!k?.id||k.status!==`complete`||(window.location.href=T.url(`/api/export/${encodeURIComponent(k.id)}/file`))},[k]);(0,b.useEffect)(()=>{!k?.id||k.status!==`complete`||de.current!==k.id&&(de.current=k.id,window.location.href=T.url(`/api/export/${encodeURIComponent(k.id)}/file`))},[k]),(0,b.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await T.exportSupport();e&&N(t)}catch(t){console.error(`Export support probe error:`,t),e&&N({available:!1,reason:`Video export availability could not be detected.`,portable_download:null})}})(),()=>{e=!1}},[]),(0,b.useEffect)(()=>{let e=!0,t=null,n=null,r=!1,a=!1,o=!1,s=[],c=0,l=null,u=null,d=null,p=()=>{d&&=(clearTimeout(d),null)},m=()=>{if(c=0,!e||s.length===0)return;let t=l,n=u;for(let e of s){let{payload:r,mode:i,progressOnly:a}=e;if(n=r.progress,!a){if(t&&r.ingest_id===t.ingest_id&&r.seq<=t.seq)continue;t=EB(t,r,i)}}s=[],n!==u&&(u=n,i(n)),t!==l&&(l=t,f(t))},h=(e,t,n=!1)=>{s.push({payload:e,mode:t,progressOnly:n}),p(),c||=requestAnimationFrame(m)},g=async(t,n=null)=>{!e||!t?.complete||o||(o=!0,await fe())},_=()=>{if(r||!e)return;r=!0;let n=async()=>{try{let n=await T.progress();if(!e)return;if(i(n),n.percent>.1&&await fe(),n.complete){await fe(),clearInterval(t);return}(n.error||n.phase===`error`)&&clearInterval(t)}catch(e){console.error(`Polling fallback error:`,e)}};n(),t=setInterval(n,1200)};return(()=>{if(typeof EventSource>`u`){_();return}n=T.live(),n.addEventListener(`bootstrap`,t=>{if(!e)return;let n=JSON.parse(t.data);h(n,`bootstrap`),g(n.progress,n.ingest_id).catch(e=>{console.error(`Settled fetch error:`,e),o=!1})}),n.addEventListener(`progress`,t=>{if(!e)return;let n=JSON.parse(t.data);h(n,`progress`,!0),g(n.progress,n.ingest_id).catch(e=>{console.error(`Settled fetch error:`,e),o=!1})}),n.addEventListener(`patch`,t=>{e&&h(JSON.parse(t.data),`patch`)}),n.addEventListener(`complete`,async t=>{if(!e)return;let r=JSON.parse(t.data);a=!0,h(r,`progress`,!0),await g(r.progress,r.ingest_id),e&&n?.close()}),n.addEventListener(`ingest-error`,t=>{if(!e)return;let r=JSON.parse(t.data);a=!0,h(r,`progress`,!0),n?.close()}),n.addEventListener(`error`,t=>{if(e&&!a){if(n?.readyState===EventSource.CLOSED){console.warn(`SSE stream closed, falling back to polling:`,t),_();return}n?.readyState===EventSource.CONNECTING&&!r&&!d&&(d=setTimeout(()=>{d=null,!(!e||a||r)&&n?.readyState!==EventSource.OPEN&&(console.warn(`SSE stream stalled during reconnect, falling back to polling:`,t),n?.close(),_())},4e3))}})})(),()=>{e=!1,clearInterval(t),p(),c&&cancelAnimationFrame(c),n?.close()}},[fe]),(0,b.useEffect)(()=>{if(r){if(r.percent>.1&&p&&!h){g(!0);let e=setTimeout(()=>m(!1),600);return()=>clearTimeout(e)}if(r.complete&&p&&!h){g(!0);let e=setTimeout(()=>m(!1),600);return()=>clearTimeout(e)}}},[r,p,h]);let ge=!!r?.complete,I=Math.round((r?.percent||0)*100),_e=Math.min(Math.max(r?.percent||0,0),1),ve=!ge||D,ye=!!(r&&ve&&r.phase!==`error`);(0,b.useEffect)(()=>{r?.complete||E(!1)},[r?.complete]),(0,b.useEffect)(()=>{let e=ge&&!ue.current;if(ue.current=ge,!ge){O(!1);return}if(e&&!w){O(!0);return}D&&w&&O(!1)},[ge,w,D]),(0,b.useEffect)(()=>{let e=!0,t=null,n=async()=>{try{let r=!!k?.id,i=r?await T.exportStatus(k.id):await T.activeExport();if(!e)return;let a=r?i:i.job;if(!a){k?.id||A(null);return}A(a),[`complete`,`failed`].includes(a.status)||(t=setTimeout(n,900))}catch(t){if(!e)return;console.error(`Export status error:`,t)}};return ge&&n(),()=>{e=!1,t&&clearTimeout(t)}},[ge,k?.id]),(0,b.useEffect)(()=>{!ve&&!_&&v(!0),ve&&(v(!1),x(!1))},[ve,_]),(0,b.useEffect)(()=>{if(!_)return;let e=setTimeout(()=>x(!0),350);return()=>clearTimeout(e)},[_]);let be=(0,b.useMemo)(()=>d?OB(d):null,[d]),xe=be?be.overview:l.overview,Se=be?be.heatmap:l.heatmap,Ce=be?be.daily:l.daily,we=be?be.families:l.families,Te=be?be.repos:l.repos,Ee=be?be.models:l.models,De=xe?.data,Oe=(De?.[s]||De?.total||{})?.date_range;(0,b.useEffect)(()=>{if(F.current&&=(cancelAnimationFrame(F.current),0),!Oe?.from||!Oe?.to){re(null);return}let e={from:dV(Oe.from),to:dV(Oe.to)};return re(t=>{if(!t||ge||t.from!==e.from||e.to<=t.to)return e;let n=t.to,r=e.to,i=Math.max(1,Math.round((r-n)/86400)),a=Math.min(1400,Math.max(320,i*110)),o=performance.now(),s=t=>{let i=Math.min(1,(t-o)/a),c=dV(n+(r-n)*i);re(t=>!t||t.from!==e.from||c<=t.to?t:{...t,to:c}),i<1?F.current=requestAnimationFrame(s):(F.current=0,re(e))};return F.current=requestAnimationFrame(s),t}),()=>{F.current&&=(cancelAnimationFrame(F.current),0)}},[ge,Oe?.from,Oe?.to]);let ke=j||[`queued`,`running`].includes(k?.status),Ae=!ne?.available&&ne?.portable_download?.available,je=M||Ae&&j||Ae&&k?.phase===`downloading_browser`?`Downloading single-use portable Chromium for this export.`:!ne?.available&&!Ae?ne.reason||`Video export requires Chrome, Chromium, or Edge.`:Ae?`No supported browser found. Click to download a single-use portable Chromium for this export.`:ge?ke?`Video export is already running.`:`Render Overview ingest replay video`:`Finish ingest to render the replay video.`,Me=(0,b.useCallback)(e=>{e&&(c(`d7`),o(`Daily`),ae({id:Date.now(),centerDate:e}))},[]),Ne=(0,b.useCallback)(e=>{e&&(o(`Repos`),se({id:Date.now(),repoLabel:String(e)}))},[]),Pe=(0,b.useCallback)(e=>{e&&(o(`Models`),le({id:Date.now(),modelName:String(e)}))},[]),Fe=k?.status===`complete`?`Download MP4`:M||ke&&(j&&Ae||k?.phase===`downloading_browser`)?`Downloading ${Math.max(1,Math.round((k?.progress||.03)*100))}%`:ke?`Rendering ${Math.max(1,Math.round((k?.progress||0)*100))}%`:`Render Video`;return(0,$.jsxs)(`div`,{className:`app`,children:[p&&(0,$.jsxs)(`div`,{className:`loading-overlay ${h?`fading`:``}`,children:[(0,$.jsx)(`div`,{className:`loading-logo`,children:`CodexMeter`}),(0,$.jsx)(`div`,{className:`loading-bar-wrap`,children:(0,$.jsx)(`div`,{className:`loading-bar`,style:{width:`${I}%`}})}),(0,$.jsx)(`div`,{className:`loading-phase`,children:fV[r?.phase]||`Starting...`}),r?.phase===`enrichment`&&(0,$.jsxs)(`div`,{className:`loading-detail`,children:[r.enriched,`/`,r.needs_enrichment,` rollouts`,r.current_date_bucket&&` — ${r.current_date_bucket}`]}),r?.phase===`error`&&r?.error&&(0,$.jsx)(`div`,{className:`loading-detail`,children:r.error}),(0,$.jsxs)(`div`,{className:`loading-footer`,children:[`Made with `,(0,$.jsx)(`span`,{className:`loading-heart`,children:`♥`}),` by JJ`]})]}),(0,$.jsxs)(`div`,{className:`app-content ${h||!p?`app-content-revealed`:``}`,children:[(0,$.jsx)(`nav`,{className:`navbar`,children:(0,$.jsxs)(`div`,{className:`navbar-inner`,children:[(0,$.jsx)(`span`,{className:`navbar-brand`,children:`CodexMeter`}),(0,$.jsx)(`div`,{className:`navbar-tabs`,children:cV.map(e=>(0,$.jsx)(`button`,{className:`navbar-tab ${a===e?`active`:``} ${!(ge&&y)&&e!==`Overview`?`navbar-tab-dimmed`:``}`,onClick:()=>o(e),disabled:!ge&&e!==`Overview`,children:e},e))}),(0,$.jsx)(`div`,{className:`navbar-meta`,children:Oe&&(0,$.jsxs)(`div`,{className:`navbar-date-wrap ${ge?``:`navbar-date-wrap-dimmed`}`,children:[(0,$.jsxs)(`span`,{className:`navbar-date`,style:{fontSize:`0.78rem`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`},children:[uV(P?.from||Oe.from),` — `,uV(P?.to||Oe.to)]}),(0,$.jsx)(`div`,{className:`range-toggle`,children:lV.map(e=>(0,$.jsx)(`button`,{className:`range-btn ${s===e.key?`active`:``}`,onClick:()=>c(e.key),disabled:!ge,children:e.label},e.key))}),(0,$.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`Rerun ingest`,title:`Rerun ingest`,onClick:pe,disabled:S||!ge,children:`↻`}),(0,$.jsx)(`button`,{type:`button`,className:`navbar-tab active export-video-btn ${ne?.available?``:`range-btn-unsupported`}`,onClick:k?.status===`complete`?he:me,disabled:!ne?.available&&!Ae||!ge||ke,style:{minWidth:110},title:k?.status===`complete`?`Download rendered Overview video`:je,children:Fe})]})})]})}),(0,$.jsxs)(`div`,{className:`main-content`,children:[a===`Overview`&&(0,$.jsx)(LL,{data:xe,heatmap:Se,daily:Ce,families:we,repos:Te,models:Ee,range:s,onPresentationSettledChange:E,ingestProgress:_e,isIngestActive:ye,onNavigateToDailyDay:Me,onNavigateToRepo:Ne,onNavigateToModel:Pe}),a===`Repos`&&(0,$.jsx)(ZL,{data:l.repos,range:s,focusRequest:oe,onFocusRequestConsumed:()=>se(null)}),a===`Models`&&(0,$.jsx)(aR,{data:l.models,range:s,focusRequest:ce,onFocusRequestConsumed:()=>le(null)}),a===`Daily`&&(0,$.jsx)(DR,{data:l.daily,range:s,navigateToDayRequest:ie,onNavigateToDayConsumed:()=>ae(null)}),a===`Sessions`&&(0,$.jsx)(wB,{data:l.sessions})]}),(0,$.jsxs)(`div`,{className:`app-footer`,children:[`Made with `,(0,$.jsx)(`span`,{className:`loading-heart`,children:`♥`}),` by JJ`]})]})]})}y.createRoot(document.getElementById(`root`)).render((0,$.jsx)(pV,{}));
|
|
34
|
+
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return o.updateDeps=e=>{r=e},o}function nB(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var rB=(e,t)=>Math.abs(e-t)<1.01,iB=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},aB=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},oB=e=>e,sB=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},cB=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(aB(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(aB(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},lB={passive:!0},uB=typeof window>`u`?!0:`onscrollend`in window,dB=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&uB?()=>void 0:iB(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{let{horizontal:o,isRtl:s}=e.options;i=o?n.scrollLeft*(s&&-1||1):n.scrollTop,a(),t(i,r)},s=o(!0),c=o(!1);n.addEventListener(`scroll`,s,lB);let l=e.options.useScrollendEvent&&uB;return l&&n.addEventListener(`scrollend`,c,lB),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},fB=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},pB=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},mB=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:oB,rangeExtractor:sB,onChange:()=>{},measureElement:fB,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=tB(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=tB(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,t,n,r,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=tB(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a},o)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let s=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let c=this.measurementsCache.slice(0,s),l=Array(a).fill(void 0);for(let e=0;e<s;e++){let t=c[e];t&&(l[t.lane]=e)}for(let i=s;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,u;if(a!==void 0&&this.options.lanes>1){s=a;let e=l[s],r=e===void 0?void 0:c[e];u=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?c[i-1]:this.getFurthestMeasurement(c,i);u=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(i,s)}let d=o.get(e),f=typeof d==`number`?d:this.options.estimateSize(i),p=u+f;c[i]={index:i,start:u,size:f,end:p,key:e,lane:s},l[s]=i}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=tB(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?gB({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=tB(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{let n=this.measurementsCache[e];if(!n)return;let r=t-(this.itemSizeCache.get(n.key)??n.size);r!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?n.start<this.getScrollOffset()+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this))&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.getVirtualItems=tB(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length!==0)return nB(t[hB(0,t.length-1,e=>nB(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=e[e.length-1]?.end??0;else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&rB(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,n&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior=`auto`,this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}));this.scheduleScrollReconcile()}},hB=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function gB({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){let i=e.length-1,a=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let o=hB(0,i,a,n),s=o;if(r===1)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){let a=Array(r).fill(0);for(;s<i&&a.some(e=>e<n+t);){let t=e[s];a[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(i,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var _B=typeof document<`u`?b.useLayoutEffect:b.useEffect;function vB({useFlushSync:e=!0,...t}){let n=b.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,eB.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=b.useState(()=>new mB(r));return i.setOptions(r),_B(()=>i._didMount(),[]),_B(()=>i._willUpdate()),i}function yB(e){return vB({observeElementRect:cB,observeElementOffset:dB,scrollToFn:pB,...e})}function bB(e){return EI(e)}function xB(e){return e==null?`—`:`$`+e.toFixed(2)}function SB(e){if(!e||e<=0)return`—`;let t=Math.floor(e/60),n=Math.floor(t/60);return n>0?`${n}h ${t%60}m`:`${t}m`}function CB(e){return e?new Date(e*1e3).toLocaleString(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`—`}var wB=AR(),TB={review:`tag-review`,exploration:`tag-exploration`,planning:`tag-planning`,memory:`tag-memory`,generic:`tag-generic`};function EB({data:e}){let[t,n]=(0,b.useState)(``),[r,i]=(0,b.useState)([{id:`started_at`,desc:!0}]),a=(0,b.useRef)(null),o=(0,b.useMemo)(()=>{if(!e?.data)return[];let n=t.toLowerCase();return n?e.data.filter(e=>(e.repo_label||``).toLowerCase().includes(n)||(e.model_name||``).toLowerCase().includes(n)||(e.agent_role||``).toLowerCase().includes(n)||(e.agent_nickname||``).toLowerCase().includes(n)||(e.title||``).toLowerCase().includes(n)||(e.descendant_models||[]).some(e=>(e||``).toLowerCase().includes(n))||(e.descendant_families||[]).some(e=>(e||``).toLowerCase().includes(n))||(e.descendant_roles||[]).some(e=>(e||``).toLowerCase().includes(n))||(e.descendant_nicknames||[]).some(e=>(e||``).toLowerCase().includes(n))||(e.related_titles||[]).some(e=>(e||``).toLowerCase().includes(n))):e.data},[e,t]),s=(0,b.useMemo)(()=>[wB.accessor(`started_at`,{header:`Time`,cell:e=>CB(e.getValue()),size:130}),wB.accessor(`repo_label`,{header:`Repo`,cell:e=>e.getValue()||`—`,size:140}),wB.accessor(`model_name`,{header:`Model`,cell:e=>(0,$.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.72rem`},children:e.getValue()||`?`}),size:130}),wB.accessor(`thread_count`,{header:`Threads`,cell:e=>{let t=e.getValue()||1,n=e.row.original;return t>1?`${t} (${n.subagent_count||0} sub)`:`1`},size:92}),wB.accessor(`agent_family`,{header:`Root`,cell:e=>(0,$.jsx)(`span`,{className:`tag ${TB[e.getValue()]||`tag-generic`}`,children:e.getValue()}),size:100}),wB.accessor(`agent_nickname`,{header:`Agent`,cell:e=>e.getValue()||`—`,size:85}),wB.accessor(`reasoning_effort`,{header:`Effort`,cell:e=>e.getValue()||`—`,size:70}),wB.accessor(`elapsed_seconds`,{header:`Duration`,cell:e=>SB(e.getValue()),size:85}),wB.accessor(`tokens_used`,{header:`Tokens`,cell:e=>(0,$.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`},children:bB(e.getValue())}),size:90}),wB.accessor(`cost`,{header:`Cost`,cell:e=>(0,$.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`},children:e.getValue()==null?`—`:xB(e.getValue())}),size:80}),wB.accessor(`title`,{header:`Title`,cell:e=>(0,$.jsx)(`span`,{title:e.getValue(),style:{opacity:.6},children:(e.getValue()||``).slice(0,55)}),size:240})],[]),c=$z({data:o,columns:s,state:{sorting:r},onSortingChange:i,getCoreRowModel:qz(),getSortedRowModel:Jz()}),l=c.getRowModel().rows,u=(0,b.useMemo)(()=>o.reduce((e,t)=>(e.sessions+=1,e.tokens+=t.tokens_used||0,e.cost+=t.cost||0,e.elapsed+=t.elapsed_seconds||0,e),{sessions:0,tokens:0,cost:0,elapsed:0}),[o]),d=yB({count:l.length,getScrollElement:()=>a.current,estimateSize:()=>36,overscan:10,getItemKey:e=>l[e]?.id??e}),f=d.getVirtualItems(),p=f.length>0?f[0].start:0,m=f.length>0?d.getTotalSize()-f[f.length-1].end:0;return(0,$.jsx)(`div`,{className:`animate-in`,children:(0,$.jsxs)(`div`,{className:`table-wrap`,children:[(0,$.jsx)(`div`,{className:`table-search`,children:(0,$.jsx)(`input`,{placeholder:`Search sessions...`,value:t,onChange:e=>n(e.target.value)})}),(0,$.jsxs)(`div`,{style:{fontSize:`0.7rem`,color:`var(--text-muted)`,padding:`0.4rem 1rem`,borderBottom:`1px solid var(--border)`},children:[o.length.toLocaleString(),` root sessions`,e&&!e.complete&&(0,$.jsx)(`span`,{className:`incomplete-badge`,style:{marginLeft:`0.5rem`},children:`partial`})]}),(0,$.jsxs)(`div`,{style:{fontSize:`0.7rem`,color:`var(--text-muted)`,padding:`0.45rem 1rem`,borderBottom:`1px solid var(--border)`,display:`flex`,gap:`1rem`,flexWrap:`wrap`},children:[(0,$.jsxs)(`span`,{children:[`Filtered sessions: `,(0,$.jsx)(`strong`,{style:{color:`var(--text-secondary)`},children:u.sessions.toLocaleString()})]}),(0,$.jsxs)(`span`,{children:[`Tokens: `,(0,$.jsx)(`strong`,{style:{color:`var(--text-secondary)`},children:bB(u.tokens)})]}),(0,$.jsxs)(`span`,{children:[`Cost: `,(0,$.jsx)(`strong`,{style:{color:`var(--text-secondary)`},children:xB(u.cost)})]}),(0,$.jsxs)(`span`,{children:[`Time: `,(0,$.jsx)(`strong`,{style:{color:`var(--text-secondary)`},children:SB(u.elapsed)})]})]}),(0,$.jsx)(`div`,{ref:a,style:{height:`600px`,overflow:`auto`},children:(0,$.jsxs)(`table`,{style:{tableLayout:`fixed`,width:`100%`},children:[(0,$.jsx)(`thead`,{style:{position:`sticky`,top:0,background:`var(--bg-card)`,zIndex:1},children:c.getHeaderGroups().map(e=>(0,$.jsx)(`tr`,{children:e.headers.map(e=>(0,$.jsxs)(`th`,{style:{width:e.getSize()},onClick:e.column.getToggleSortingHandler(),children:[Yz(e.column.columnDef.header,e.getContext()),{asc:` ↑`,desc:` ↓`}[e.column.getIsSorted()]||``]},e.id))},e.id))}),(0,$.jsxs)(`tbody`,{children:[f.length===0&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:s.length,style:{textAlign:`center`,padding:`2rem`,color:`var(--text-muted)`},children:`No sessions`})}),p>0&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:s.length,style:{height:`${p}px`,padding:0,borderBottom:`none`}})}),f.map(e=>{let t=l[e.index];return(0,$.jsx)(`tr`,{style:{height:e.size},children:t.getVisibleCells().map(e=>(0,$.jsx)(`td`,{style:{width:e.column.getSize()},children:Yz(e.column.columnDef.cell,e.getContext())},e.id))},t.id)}),m>0&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:s.length,style:{height:`${m}px`,padding:0,borderBottom:`none`}})})]})]})})]})})}function DB(){return{ingest_id:null,seq:0,overview:{total:{},d7:{},d30:{},cost_assumptions:null},repos:{total:[],d7:[],d30:[]},models:{total:[],d7:[],d30:[]},families:{total:[],d7:[],d30:[]},daily:{},heatmap:{}}}function OB(e,t,n){let r=n===`bootstrap`||!e||e.ingest_id!==t.ingest_id?DB():{...e};return r.ingest_id=t.ingest_id,r.seq=t.seq,t.data?.overview?r.overview={...r.overview,...t.data.overview,total:t.data.overview.total?{...r.overview.total,...t.data.overview.total}:r.overview.total,d7:t.data.overview.d7?{...r.overview.d7,...t.data.overview.d7}:r.overview.d7,d30:t.data.overview.d30?{...r.overview.d30,...t.data.overview.d30}:r.overview.d30}:e&&(r.overview=e.overview),r.repos=kB(e?.repos,t.data?.repos,r.repos),r.models=kB(e?.models,t.data?.models,r.models),r.families=kB(e?.families,t.data?.families,r.families),r.daily=t.data?.daily?{...e?.daily||{},...t.data.daily}:e?.daily||r.daily,r.heatmap=t.data?.heatmap?{...e?.heatmap||{},...t.data.heatmap}:e?.heatmap||r.heatmap,r}function kB(e,t,n){if(!t)return e||n;let r={total:e?e.total:n.total,d7:e?e.d7:n.d7,d30:e?e.d30:n.d30};for(let e of[`total`,`d7`,`d30`])t[e]&&(r[e]=t[e]);return r}function AB(e){return e?{overview:{data:e.overview,coverage:e.overview?.total?.coverage||{total:0,enriched:0,priced:0,time_valid:0}},repos:{data:e.repos},models:{data:e.models},families:{data:e.families},daily:{data:Object.entries(e.daily).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({date:e,...t}))},heatmap:{data:e.heatmap}}:null}function jB(e){let t=e.replay?.bootstrap?.payload||{},n=zB(t.progress||{percent:0,complete:!1}),r=OB(null,t,`bootstrap`),i=e.replay?.events||[],a=i.findIndex(e=>e.event===`patch`),o=a>=0&&i[a].at_ms||0,s=BB(e,r,i),c=s[0]?.presentation||KB(),l=zB(a>=0&&i[a].payload?.progress||n),u=Math.max(e.startHoldDurationMs||0,0),d=Math.max(e.replayDurationMs||e.replay?.duration_ms||1,1),f=Math.max(e.tailDurationMs||0,0),p=Math.max(e.finalHoldDurationMs||0,0),m=Math.max(e.durationMs||u+d+f+p||1,1),h=Math.max(e.replay?.duration_ms||0,0),g=Math.min(Math.max(o,0),h),_=Math.max(1,h-g),v=qB(e.tailSourceFraction??.035),y=Math.max(1,Math.round(_*v)),b=Math.max(0,_-y),x=Math.max(g,h-y),S=e.replayEasing||`cubicInOut`,C=e.tailEasing||`cubicInOut`,w=s[s.length-1]?.presentation||c,T=GB(s,x),E=Math.min(3600,Math.max(1800,Math.round(d*.32))),D=Math.max(0+u,0+u+d-E),O=qB((D-(0+u))/Math.max(d,1)),k=Math.round(g+b*eV(S,O)),A=WB({keyframes:s,startSourceMs:k,endSourceMs:x,startPresentation:GB(s,k),endPresentation:T,durationMs:E,startSmoothing:.05,endSmoothing:.14}),j=UB({keyframes:s,tailSourceStartMs:x,sourceDurationMs:h,tailStartPresentation:T,finalPresentation:w,tailDurationMs:f});return{renderData:e,totalDurationMs:m,frontloadSettledDurationMs:0,startHoldDurationMs:u,replayDurationMs:d,tailDurationMs:f,finalHoldDurationMs:p,sourceDurationMs:h,sourceStartMs:g,effectiveSourceDurationMs:_,tailSourceDurationMs:y,tailSourceStartMs:x,mainReplaySourceDurationMs:b,replayStartMs:u,lateReplayStartMs:D,lateReplayDurationMs:E,lateReplaySourceStartMs:k,tailStartMs:u+d,finalHoldStartMs:u+d+f,currentSeekMs:0,started:!1,finished:!1,startWallClockMs:0,initialPresentation:c,presentation:c,keyframes:s,keyframeIndex:0,lateReplayFrames:A,tailStartPresentation:T,tailFrames:j,finalPresentation:w,progress:l||{...n,percent:0,complete:!1},bootstrapProgress:n,replayEasing:S,tailEasing:C,debugState:null,debugTrace:[]}}function MB(e){return{liveData:{ready:!0},presentation:e.presentation,rawPresentation:e.presentation,progress:e.progress,phase:e.debugState?.phase||`replay`,seekMs:e.currentSeekMs||0}}function NB(e,t){let n=Math.min(Math.max(Number(t)||0,0),e.totalDurationMs);e.currentSeekMs=n;let r=`replay`,i=0,a=null;if(n<e.startHoldDurationMs)r=`start_hold`,e.presentation=e.initialPresentation||KB();else if(n<e.tailStartMs)if(n<e.lateReplayStartMs)i=PB(e,n),e.presentation=VB(e,i);else{let t=qB((n-e.lateReplayStartMs)/Math.max(e.lateReplayDurationMs,1));i=JB(e.lateReplaySourceStartMs,e.tailSourceStartMs,t),e.presentation=HB(e.lateReplayFrames,ZB(t))}else n<e.finalHoldStartMs?(r=`tail`,a=qB((n-e.tailStartMs)/Math.max(e.tailDurationMs,1)),e.presentation=HB(e.tailFrames,eV(e.tailEasing,a))):(r=`final_hold`,e.presentation=e.finalPresentation);n>=e.finalHoldStartMs?((n-e.finalHoldStartMs)/Math.max(e.finalHoldDurationMs||1,1),e.progress={...e.progress||{},percent:1,complete:!0,phase:`complete`}):e.progress={...e.progress||{},complete:!1},n>=e.totalDurationMs&&(e.finished=!0);let o={frame:e.debugTrace.length,seekMs:n,phase:r,sourceMs:i,tailProgress:a,progress:e.progress?.percent??0,complete:!!e.progress?.complete,signature:YB(e.presentation)};return e.debugState=o,e.debugTrace.push(o),MB(e)}function PB(e,t){if(t<=e.replayStartMs)return 0;let n=t-e.replayStartMs;if(n<=e.replayDurationMs){let t=qB(n/Math.max(e.replayDurationMs,1));return e.sourceStartMs+e.mainReplaySourceDurationMs*eV(e.replayEasing,t)}return e.sourceDurationMs}function FB(e,t,n,r){if(!e)return t;let i=kI.videoExport||{};if(r<(i.displayTweenStartMs??200))return t;let a=(i.startHoldDurationMs??0)+(i.replayDurationMs??0)+(i.tailDurationMs??0)+(i.finalHoldDurationMs??0)||19e3,o=i.displayTweenLateWindowMs??2200,s=qB((r-(a-o))/Math.max(o,1)),c=Math.round(JB(i.displayTweenBaseMs??240,i.displayTweenLateMs??420,QB(s))),l=QB(1-Math.exp(-n/Math.max(c,1))),u=e.progress||{},d=t.progress||{};return{liveData:t.liveData,presentation:lL(e.presentation,t.presentation,l),rawPresentation:t.rawPresentation||t.presentation,progress:{...d,percent:JB(u.percent||0,d.percent||0,l),complete:d.complete},phase:t.phase,seekMs:t.seekMs||0}}function IB(e,t){let n=kI.videoExport||{},r=Math.max(n.finalFlashDurationMs??280,0),i=Math.max(n.finalFlashMaxOpacity??.22,0);if(!r||!i||t==null)return{opacity:0,boxShadow:`none`};let a=e-t;if(a<0||a>r)return{opacity:0,boxShadow:`none`};let o=i*(1-QB(qB(a/r)));return{opacity:o,boxShadow:`0 0 120px 50px rgba(255, 255, 255, ${Math.min(1,o*.7)}) inset`}}function LB(e){let t=kI.videoExport||{};if(!t.introFadeEnabled)return 0;let n=Math.max(0,Math.min(1,t.introFadeStartOpacity??.2)),r=Math.max(0,t.introFadeDelayMs??0),i=Math.max(0,t.introFadeDurationMs??900);if(!n)return 0;if(e<=r)return n;if(!i)return 0;let a=qB((e-r)/i);return n*(1-eV(t.introFadeEasing||`cubicOut`,a))}function RB(e){let t=kI.videoExport||{};if(!t.introFadeEnabled)return 1;let n=Math.max(0,Math.min(1,t.introContentStartOpacity??.35)),r=Math.max(0,t.introFadeDelayMs??0),i=Math.max(0,t.introFadeDurationMs??900);if(e<=r)return n;if(!i)return 1;let a=qB((e-r)/i);return JB(n,1,eV(t.introFadeEasing||`cubicOut`,a))}function zB(e){return e?{...e}:null}function BB(e,t,n){let r=[],i=t;for(let e of n)e.event===`patch`&&(i=OB(i,e.payload,`patch`),r.push({at_ms:Math.max(0,e.at_ms||0),presentation:iL({overview:{data:i.overview},heatmap:{data:i.heatmap},daily:{data:Object.entries(i.daily).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({date:e,...t}))},families:{data:i.families},repos:{data:i.repos},models:{data:i.models},range:`total`})}));return r.length||r.push({at_ms:0,presentation:KB()}),r}function VB(e,t){return GB(e.keyframes,t,e)}function HB(e,t){if(!e?.length)return KB();if(t<=e[0].u)return e[0].presentation;for(let n=0;n<e.length-1;n+=1){let r=e[n],i=e[n+1];if(t<=i.u){let e=qB((t-r.u)/Math.max(i.u-r.u,1e-6));return lL(r.presentation,i.presentation,e)}}return e[e.length-1].presentation}function UB({keyframes:e,tailSourceStartMs:t,sourceDurationMs:n,tailStartPresentation:r,finalPresentation:i,tailDurationMs:a}){return WB({keyframes:e,startSourceMs:t,endSourceMs:n,startPresentation:r,endPresentation:i,durationMs:a,startSmoothing:.08,endSmoothing:.2,bidirectional:!0})}function WB({keyframes:e,startSourceMs:t,endSourceMs:n,startPresentation:r,endPresentation:i,durationMs:a,startSmoothing:o,endSmoothing:s,bidirectional:c=!1}){let l=Math.max(36,Math.min(96,Math.round(a/80))),u=[{u:0,presentation:r}];for(let r=1;r<l-1;r+=1){let i=r/(l-1),a=JB(t,n,i);u.push({u:i,presentation:GB(e,a)})}u.push({u:1,presentation:i});let d=[{u:0,presentation:r}],f=r;for(let e=1;e<u.length-1;e+=1){let t=u[e],n=JB(o,s,t.u);f=lL(f,t.presentation,n),d.push({u:t.u,presentation:f})}if(d.push({u:1,presentation:i}),!c)return d;let p=Array(u.length);p[u.length-1]={u:1,presentation:i};let m=i;for(let e=u.length-2;e>0;--e){let t=u[e],n=JB(s,o,1-t.u);m=lL(m,t.presentation,n),p[e]={u:t.u,presentation:m}}return p[0]={u:0,presentation:r},u.map((e,t)=>t===0?{u:0,presentation:r}:t===u.length-1?{u:1,presentation:i}:{u:e.u,presentation:lL(d[t].presentation,p[t].presentation,ZB(e.u))})}function GB(e,t,n=null){if(!e.length)return KB();if(t<=e[0].at_ms)return e[0].presentation;let r=n?.keyframeIndex||0;for(;r+1<e.length&&e[r+1].at_ms<=t;)r+=1;n&&(n.keyframeIndex=r);let i=e[r],a=e[Math.min(r+1,e.length-1)];if(!a||a.at_ms<=i.at_ms)return i.presentation;let o=qB((t-i.at_ms)/Math.max(a.at_ms-i.at_ms,1));return lL(i.presentation,a.presentation,o)}function KB(){return iL({overview:{data:null},heatmap:{data:{}},daily:{data:[]},families:{data:{total:[],d7:[],d30:[]}},repos:{data:{total:[],d7:[],d30:[]}},models:{data:{total:[],d7:[],d30:[]}},range:`total`})}function qB(e){return Math.min(Math.max(e||0,0),1)}function JB(e,t,n){return e+(t-e)*n}function YB(e){if(!e)return null;let t=e.stats||{},n=e.daily||{dates:[],series:[]},r=Array.isArray(e.topRepos)?e.topRepos:[],i=Array.isArray(e.topModels)?e.topModels:[],a=Math.max(0,(n.dates?.length||0)-1),o=n.dates?.[a]||null,s=(n.series||[]).reduce((e,t)=>e+(Number(t?.data?.[a])||0),0),c=r[0]||null,l=i[0]||null;return{totalTokens:Math.round(Number(t.tokens)||0),totalCost:Number((Number(t.cost)||0).toFixed(4)),totalSessions:Math.round(Number(t.sessions)||0),dailyPoints:n.dates?.length||0,lastDailyDate:o,lastDailyTotal:Math.round(s),topRepo:c?.label||null,topRepoValue:Math.round(Number(c?.tokens)||0),topModel:l?.label||null,topModelValue:Math.round(Number(l?.tokens)||0)}}function XB(e){let t=qB(e);return t*t*t}function ZB(e){let t=qB(e);return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function QB(e){return 1-(1-qB(e))**3}function $B(e){let t=qB(e),n=[[0,0],[.12,.03],[.24,.09],[.4,.22],[.58,.42],[.74,.62],[.86,.77],[.93,.86],[.975,.93],[.992,.975],[1,1]];for(let e=0;e<n.length-1;e+=1){let[r,i]=n[e],[a,o]=n[e+1];if(t<=a)return JB(i,o,ZB(qB((t-r)/Math.max(a-r,1e-6))))}return 1}function eV(e,t){switch(e){case`trainBrake`:return $B(t);case`cubicOut`:return QB(t);case`cubicInOut`:return ZB(t);case`linear`:return qB(t);default:return XB(t)}}function tV({jobId:e}){let[t,n]=(0,b.useState)(null),[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(!1),l=(0,b.useRef)(null),u=(0,b.useRef)(0),d=(0,b.useRef)(null),f=(0,b.useRef)(0),p=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let t=!0;return(async()=>{try{let r=await fetch(T.url(`/api/export/${encodeURIComponent(e)}/render-data`));if(!r.ok)throw Error(`API error: ${r.status}`);let i=await r.json();if(!t)return;n(i),l.current=jB(i);let a=MB(l.current);d.current=a,f.current=0,o(a),c(!1),p.current=null}catch(e){if(!t)return;i(e.message||String(e))}})(),()=>{t=!1,u.current&&cancelAnimationFrame(u.current)}},[e]),(0,b.useEffect)(()=>{if(!a?.liveData||r)return;let e=!1,t=0,n=0,i=0,o=0,s=0,l=()=>{let t=Array.from(document.querySelectorAll(`.stat-card .stat-value`)),n=Array.from(document.querySelectorAll(`canvas`)),r=t.length>=4&&t.every(e=>String(e.textContent||``).trim().length>0),i=n.length>=4&&n.every(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0}),a=document.querySelectorAll(`.heatmap-cell`).length>=300;if(!(r&&i&&a)){o=requestAnimationFrame(l);return}s=window.setTimeout(()=>{e||c(!0)},180)};return t=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>{i=requestAnimationFrame(()=>{o=requestAnimationFrame(l)})})}),()=>{e=!0,t&&cancelAnimationFrame(t),n&&cancelAnimationFrame(n),i&&cancelAnimationFrame(i),o&&cancelAnimationFrame(o),s&&window.clearTimeout(s)}},[r,a]),(0,b.useEffect)(()=>{if(a){if(a.phase===`final_hold`){p.current??=a.seekMs||0;return}p.current=null}},[a?.phase,a?.seekMs]),(0,b.useEffect)(()=>{let n=()=>{let e=l.current;if(!e||e.started)return;e.started=!0,e.startWallClockMs=Date.now();let t=()=>{let e=l.current;if(!e)return;let n=Date.now(),r=Math.min(e.totalDurationMs,n-e.startWallClockMs),i=NB(e,r),a=f.current?Math.max(1,n-f.current):16;f.current=n;let s=FB(d.current,i,a,r);if(d.current=s,o(s),r>=e.totalDurationMs){e.finished=!0,u.current=0;return}u.current=requestAnimationFrame(t)};u.current=requestAnimationFrame(t)};return window.__CODEXMETER_EXPORT__={ready:!!(t&&!r&&s),jobId:e,start(){n()},get currentTimeMs(){return l.current?.currentSeekMs||0},get finished(){return!!l.current?.finished},getDebugState(){return l.current?.debugState||null},getDebugTrace(){return l.current?.debugTrace||[]}},()=>{delete window.__CODEXMETER_EXPORT__}},[s,r,e,t]),r?(0,$.jsx)(`div`,{style:nV,children:(0,$.jsxs)(`div`,{style:iV,children:[`Export error: `,r]})}):a?.liveData?(0,$.jsx)(`div`,{style:nV,children:(0,$.jsxs)(`div`,{style:rV,children:[(0,$.jsxs)(`div`,{style:{...lV,opacity:RB(a.seekMs)},children:[(0,$.jsx)(IL,{presentation:a.presentation,rawPresentation:a.rawPresentation,ingestProgress:Math.min(Math.max(a.progress?.percent||0,0),1),isIngestActive:!!(a.progress&&!a.progress.complete),exportMode:!1,exportPlayback:!0,exportPhase:a.phase,exportSeekMs:a.seekMs}),(0,$.jsxs)(`div`,{style:aV,children:[`Made with `,(0,$.jsx)(`span`,{style:oV,children:`♥`}),` by JJ`]})]}),(0,$.jsx)(`div`,{style:{...cV,opacity:LB(a.seekMs)}}),(0,$.jsx)(`div`,{style:{...sV,...IB(a.seekMs,p.current)}})]})}):(0,$.jsx)(`div`,{style:nV,children:(0,$.jsx)(`div`,{style:iV,children:`CodexMeter exporting…`})})}var nV={width:`100vw`,minHeight:`100vh`,background:`#06080f`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`},rV={position:`relative`,width:1080,height:864,padding:`24px 28px 20px`,background:`#06080f`,overflow:`hidden`},iV={color:`#8b949e`,fontFamily:`'JetBrains Mono', 'Fira Code', monospace`,fontSize:18},aV={position:`absolute`,right:18,bottom:10,color:`rgba(139, 148, 158, 0.58)`,fontSize:10,fontFamily:`'JetBrains Mono', 'Fira Code', monospace`,letterSpacing:`0.02em`,opacity:.62,pointerEvents:`none`},oV={color:`rgba(244, 63, 94, 0.52)`},sV={position:`absolute`,inset:0,background:`linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(248,250,255,1) 100%)`,pointerEvents:`none`,zIndex:20,mixBlendMode:`screen`},cV={position:`absolute`,inset:0,background:`#000000`,pointerEvents:`none`,zIndex:30},lV={position:`relative`,zIndex:1},uV=[`Overview`,`Repos`,`Models`,`Daily`,`Sessions`],dV=[{key:`d7`,label:`7d`},{key:`d30`,label:`30d`},{key:`total`,label:`All`}];function fV(e){return e?new Date(e*1e3).toLocaleDateString(`en-US`,{month:`short`,day:`2-digit`}):`—`}function pV(e){return!Number.isFinite(e)||e<=0?0:Math.floor(e/86400)*86400}var mV={idle:`Starting...`,inventory:`Reading threads`,normalizing:`Normalizing`,enrichment:`Enriching rollouts`,aggregation:`Building aggregates`,finalizing:`Finalizing view`,complete:`Complete`,error:`Error`};function hV(){let e=typeof window<`u`?new URLSearchParams(window.location.search):null,t=e?.get(`export`),n=e?.get(`job`);if(t===`overview-video`&&n)return(0,$.jsx)(tV,{jobId:n});let[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(`Overview`),[s,c]=(0,b.useState)(`total`),[l,u]=(0,b.useState)({}),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(!0),[h,g]=(0,b.useState)(!1),[_,v]=(0,b.useState)(!1),[y,x]=(0,b.useState)(!1),[S,C]=(0,b.useState)(!1),[w,E]=(0,b.useState)(!0),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(null),[j,ee]=(0,b.useState)(!1),[M,te]=(0,b.useState)(!1),[ne,N]=(0,b.useState)({available:!0,reason:null,portable_download:null}),[P,re]=(0,b.useState)(null),[ie,ae]=(0,b.useState)(null),[oe,se]=(0,b.useState)(null),[ce,le]=(0,b.useState)(null),ue=(0,b.useRef)(!1),F=(0,b.useRef)(0),de=(0,b.useRef)(null),fe=(0,b.useCallback)(async()=>{try{let[e,t,n,r,i,a,o]=await Promise.all([T.overview(),T.repos(),T.models(),T.daily(),T.sessions(),T.heatmap(),T.families()]),s={overview:e,repos:t,models:n,daily:r,sessions:i,heatmap:a,families:o};return u(s),s}catch(e){throw console.error(`Fetch error:`,e),e}},[]),pe=(0,b.useCallback)(async()=>{if(!S)try{C(!0),o(`Overview`),await T.rerun(),window.location.reload()}catch(e){console.error(`Rerun error:`,e),C(!1)}},[S]),me=(0,b.useCallback)(async()=>{if(!(j||[`queued`,`running`].includes(k?.status)))try{ee(!0);let e=!ne?.available&&ne?.portable_download?.available,t=!1;if(e){let e=ne.portable_download.approx_size_mb?`about ${ne.portable_download.approx_size_mb} MB`:`a fairly large download`;if(!window.confirm(`No supported browser was found for video export.\n\nCodexMeter can download a single-use portable Chromium bundle (${e}) for this export only, then delete it afterward.\n\nDo you want to continue?`))return;t=!0,te(!0)}A(await T.startOverviewVideoExport(t?{install_portable_browser:!0}:{}))}catch(e){console.error(`Video export error:`,e)}finally{ee(!1)}},[k?.status,ne,j]);(0,b.useEffect)(()=>{M&&k&&k.phase!==`downloading_browser`&&(k.phase===`rendering`||k.phase===`encoding`||k.status===`complete`||k.status===`failed`)&&te(!1)},[k,M]);let he=(0,b.useCallback)(()=>{!k?.id||k.status!==`complete`||(window.location.href=T.url(`/api/export/${encodeURIComponent(k.id)}/file`))},[k]);(0,b.useEffect)(()=>{!k?.id||k.status!==`complete`||de.current!==k.id&&(de.current=k.id,window.location.href=T.url(`/api/export/${encodeURIComponent(k.id)}/file`))},[k]),(0,b.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await T.exportSupport();e&&N(t)}catch(t){console.error(`Export support probe error:`,t),e&&N({available:!1,reason:`Video export availability could not be detected.`,portable_download:null})}})(),()=>{e=!1}},[]),(0,b.useEffect)(()=>{let e=!0,t=null,n=null,r=!1,a=!1,o=!1,s=[],c=0,l=null,u=null,d=null,p=()=>{d&&=(clearTimeout(d),null)},m=()=>{if(c=0,!e||s.length===0)return;let t=l,n=u;for(let e of s){let{payload:r,mode:i,progressOnly:a}=e;if(n=r.progress,!a){if(t&&r.ingest_id===t.ingest_id&&r.seq<=t.seq)continue;t=OB(t,r,i)}}s=[],n!==u&&(u=n,i(n)),t!==l&&(l=t,f(t))},h=(e,t,n=!1)=>{s.push({payload:e,mode:t,progressOnly:n}),p(),c||=requestAnimationFrame(m)},g=async(t,n=null)=>{!e||!t?.complete||o||(o=!0,await fe())},_=()=>{if(r||!e)return;r=!0;let n=async()=>{try{let n=await T.progress();if(!e)return;if(i(n),n.percent>.1&&await fe(),n.complete){await fe(),clearInterval(t);return}(n.error||n.phase===`error`)&&clearInterval(t)}catch(e){console.error(`Polling fallback error:`,e)}};n(),t=setInterval(n,1200)};return(()=>{if(typeof EventSource>`u`){_();return}n=T.live(),n.addEventListener(`bootstrap`,t=>{if(!e)return;let n=JSON.parse(t.data);h(n,`bootstrap`),g(n.progress,n.ingest_id).catch(e=>{console.error(`Settled fetch error:`,e),o=!1})}),n.addEventListener(`progress`,t=>{if(!e)return;let n=JSON.parse(t.data);h(n,`progress`,!0),g(n.progress,n.ingest_id).catch(e=>{console.error(`Settled fetch error:`,e),o=!1})}),n.addEventListener(`patch`,t=>{e&&h(JSON.parse(t.data),`patch`)}),n.addEventListener(`complete`,async t=>{if(!e)return;let r=JSON.parse(t.data);a=!0,h(r,`progress`,!0),await g(r.progress,r.ingest_id),e&&n?.close()}),n.addEventListener(`ingest-error`,t=>{if(!e)return;let r=JSON.parse(t.data);a=!0,h(r,`progress`,!0),n?.close()}),n.addEventListener(`error`,t=>{if(e&&!a){if(n?.readyState===EventSource.CLOSED){console.warn(`SSE stream closed, falling back to polling:`,t),_();return}n?.readyState===EventSource.CONNECTING&&!r&&!d&&(d=setTimeout(()=>{d=null,!(!e||a||r)&&n?.readyState!==EventSource.OPEN&&(console.warn(`SSE stream stalled during reconnect, falling back to polling:`,t),n?.close(),_())},4e3))}})})(),()=>{e=!1,clearInterval(t),p(),c&&cancelAnimationFrame(c),n?.close()}},[fe]),(0,b.useEffect)(()=>{if(r){if(r.percent>.1&&p&&!h){g(!0);let e=setTimeout(()=>m(!1),600);return()=>clearTimeout(e)}if(r.complete&&p&&!h){g(!0);let e=setTimeout(()=>m(!1),600);return()=>clearTimeout(e)}}},[r,p,h]);let ge=!!r?.complete,I=Math.round((r?.percent||0)*100),_e=Math.min(Math.max(r?.percent||0,0),1),ve=!ge||D,ye=!!(r&&ve&&r.phase!==`error`);(0,b.useEffect)(()=>{r?.complete||E(!1)},[r?.complete]),(0,b.useEffect)(()=>{let e=ge&&!ue.current;if(ue.current=ge,!ge){O(!1);return}if(e&&!w){O(!0);return}D&&w&&O(!1)},[ge,w,D]),(0,b.useEffect)(()=>{let e=!0,t=null,n=async()=>{try{let r=!!k?.id,i=r?await T.exportStatus(k.id):await T.activeExport();if(!e)return;let a=r?i:i.job;if(!a){k?.id||A(null);return}A(a),[`complete`,`failed`].includes(a.status)||(t=setTimeout(n,900))}catch(t){if(!e)return;console.error(`Export status error:`,t)}};return ge&&n(),()=>{e=!1,t&&clearTimeout(t)}},[ge,k?.id]),(0,b.useEffect)(()=>{!ve&&!_&&v(!0),ve&&(v(!1),x(!1))},[ve,_]),(0,b.useEffect)(()=>{if(!_)return;let e=setTimeout(()=>x(!0),350);return()=>clearTimeout(e)},[_]);let be=(0,b.useMemo)(()=>d?AB(d):null,[d]),xe=be?be.overview:l.overview,Se=be?be.heatmap:l.heatmap,Ce=be?be.daily:l.daily,we=be?be.families:l.families,Te=be?be.repos:l.repos,Ee=be?be.models:l.models,De=xe?.data,Oe=(De?.[s]||De?.total||{})?.date_range;(0,b.useEffect)(()=>{if(F.current&&=(cancelAnimationFrame(F.current),0),!Oe?.from||!Oe?.to){re(null);return}let e={from:pV(Oe.from),to:pV(Oe.to)};return re(t=>{if(!t||ge||t.from!==e.from||e.to<=t.to)return e;let n=t.to,r=e.to,i=Math.max(1,Math.round((r-n)/86400)),a=Math.min(1400,Math.max(320,i*110)),o=performance.now(),s=t=>{let i=Math.min(1,(t-o)/a),c=pV(n+(r-n)*i);re(t=>!t||t.from!==e.from||c<=t.to?t:{...t,to:c}),i<1?F.current=requestAnimationFrame(s):(F.current=0,re(e))};return F.current=requestAnimationFrame(s),t}),()=>{F.current&&=(cancelAnimationFrame(F.current),0)}},[ge,Oe?.from,Oe?.to]);let ke=j||[`queued`,`running`].includes(k?.status),Ae=!ne?.available&&ne?.portable_download?.available,je=M||Ae&&j||Ae&&k?.phase===`downloading_browser`?`Downloading single-use portable Chromium for this export.`:!ne?.available&&!Ae?ne.reason||`Video export requires Chrome, Chromium, or Edge.`:Ae?`No supported browser found. Click to download a single-use portable Chromium for this export.`:ge?ke?`Video export is already running.`:`Render Overview ingest replay video`:`Finish ingest to render the replay video.`,Me=(0,b.useCallback)(e=>{e&&(c(`d7`),o(`Daily`),ae({id:Date.now(),centerDate:e}))},[]),Ne=(0,b.useCallback)(e=>{e&&(o(`Repos`),se({id:Date.now(),repoLabel:String(e)}))},[]),Pe=(0,b.useCallback)(e=>{e&&(o(`Models`),le({id:Date.now(),modelName:String(e)}))},[]),Fe=k?.status===`complete`?`Download MP4`:M||ke&&(j&&Ae||k?.phase===`downloading_browser`)?`Downloading ${Math.max(1,Math.round((k?.progress||.03)*100))}%`:ke?`Rendering ${Math.max(1,Math.round((k?.progress||0)*100))}%`:`Render Video`;return(0,$.jsxs)(`div`,{className:`app`,children:[p&&(0,$.jsxs)(`div`,{className:`loading-overlay ${h?`fading`:``}`,children:[(0,$.jsx)(`div`,{className:`loading-logo`,children:`CodexMeter`}),(0,$.jsx)(`div`,{className:`loading-bar-wrap`,children:(0,$.jsx)(`div`,{className:`loading-bar`,style:{width:`${I}%`}})}),(0,$.jsx)(`div`,{className:`loading-phase`,children:mV[r?.phase]||`Starting...`}),r?.phase===`enrichment`&&(0,$.jsxs)(`div`,{className:`loading-detail`,children:[r.enriched,`/`,r.needs_enrichment,` rollouts`,r.current_date_bucket&&` — ${r.current_date_bucket}`]}),r?.phase===`error`&&r?.error&&(0,$.jsx)(`div`,{className:`loading-detail`,children:r.error}),(0,$.jsxs)(`div`,{className:`loading-footer`,children:[`Made with `,(0,$.jsx)(`span`,{className:`loading-heart`,children:`♥`}),` by JJ`]})]}),(0,$.jsxs)(`div`,{className:`app-content ${h||!p?`app-content-revealed`:``}`,children:[(0,$.jsx)(`nav`,{className:`navbar`,children:(0,$.jsxs)(`div`,{className:`navbar-inner`,children:[(0,$.jsx)(`span`,{className:`navbar-brand`,children:`CodexMeter`}),(0,$.jsx)(`div`,{className:`navbar-tabs`,children:uV.map(e=>(0,$.jsx)(`button`,{className:`navbar-tab ${a===e?`active`:``} ${!(ge&&y)&&e!==`Overview`?`navbar-tab-dimmed`:``}`,onClick:()=>o(e),disabled:!ge&&e!==`Overview`,children:e},e))}),(0,$.jsx)(`div`,{className:`navbar-meta`,children:Oe&&(0,$.jsxs)(`div`,{className:`navbar-date-wrap ${ge?``:`navbar-date-wrap-dimmed`}`,children:[(0,$.jsxs)(`span`,{className:`navbar-date`,style:{fontSize:`0.78rem`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`},children:[fV(P?.from||Oe.from),` — `,fV(P?.to||Oe.to)]}),(0,$.jsx)(`div`,{className:`range-toggle`,children:dV.map(e=>(0,$.jsx)(`button`,{className:`range-btn ${s===e.key?`active`:``}`,onClick:()=>c(e.key),disabled:!ge,children:e.label},e.key))}),(0,$.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`Rerun ingest`,title:`Rerun ingest`,onClick:pe,disabled:S||!ge,children:`↻`}),(0,$.jsx)(`button`,{type:`button`,className:`navbar-tab active export-video-btn ${ne?.available?``:`range-btn-unsupported`}`,onClick:k?.status===`complete`?he:me,disabled:!ne?.available&&!Ae||!ge||ke,style:{minWidth:110},title:k?.status===`complete`?`Download rendered Overview video`:je,children:Fe})]})})]})}),(0,$.jsxs)(`div`,{className:`main-content`,children:[a===`Overview`&&(0,$.jsx)(zL,{data:xe,heatmap:Se,daily:Ce,families:we,repos:Te,models:Ee,range:s,onPresentationSettledChange:E,ingestProgress:_e,isIngestActive:ye,onNavigateToDailyDay:Me,onNavigateToRepo:Ne,onNavigateToModel:Pe}),a===`Repos`&&(0,$.jsx)($L,{data:l.repos,range:s,focusRequest:oe,onFocusRequestConsumed:()=>se(null)}),a===`Models`&&(0,$.jsx)(sR,{data:l.models,range:s,focusRequest:ce,onFocusRequestConsumed:()=>le(null)}),a===`Daily`&&(0,$.jsx)(kR,{data:l.daily,range:s,navigateToDayRequest:ie,onNavigateToDayConsumed:()=>ae(null)}),a===`Sessions`&&(0,$.jsx)(EB,{data:l.sessions})]}),(0,$.jsxs)(`div`,{className:`app-footer`,children:[`Made with `,(0,$.jsx)(`span`,{className:`loading-heart`,children:`♥`}),` by JJ`]})]})]})}y.createRoot(document.getElementById(`root`)).render((0,$.jsx)(hV,{}));
|
package/dist/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-TtJfgZiv.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-CVvcsIkn.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
package/package.json
CHANGED
package/server/cost-catalog.js
CHANGED
|
@@ -77,7 +77,7 @@ export function getModelPricing(modelName) {
|
|
|
77
77
|
return getPricing()[modelName] || null;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export const CATALOG_VERSION = '2026-
|
|
80
|
+
export const CATALOG_VERSION = '2026-04-23';
|
|
81
81
|
export const CACHE_ASSUMPTIONS = {
|
|
82
82
|
input_fraction: INPUT_FRACTION,
|
|
83
83
|
output_fraction: OUTPUT_FRACTION,
|
package/server/normalize.js
CHANGED
|
@@ -124,6 +124,8 @@ function isLauncherSourceKind(sourceKind) {
|
|
|
124
124
|
|
|
125
125
|
const MODEL_ALIASES = {
|
|
126
126
|
'codex-mini-latest': 'o4-mini',
|
|
127
|
+
'gpt 5.5': 'gpt-5.5',
|
|
128
|
+
'gpt-5.5': 'gpt-5.5',
|
|
127
129
|
'gpt-5 mini': 'gpt-5-mini',
|
|
128
130
|
'gpt-5.4 mini': 'gpt-5.4-mini',
|
|
129
131
|
'gpt-5 nano': 'gpt-5-nano',
|
package/server/pricing-fetch.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Local pricing catalog for models used in codex-cli/codex app lifetime.
|
|
2
2
|
const FALLBACK = {
|
|
3
|
+
'gpt-5.5': { input: 5.00, output: 30.00, cached_input: 0.50 },
|
|
3
4
|
'gpt-5.4': { input: 2.50, output: 15.00, cached_input: 0.25 },
|
|
4
5
|
'gpt-5-mini': { input: 0.75, output: 4.50, cached_input: 0.075},
|
|
5
6
|
'gpt-5.4-mini': { input: 0.75, output: 4.50, cached_input: 0.075},
|