@capagents/forgeqe 2.3.1 → 2.3.2

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.
@@ -96,7 +96,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
96
96
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IU(e,t){if(e){if(typeof e==`string`)return LU(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?LU(e,t):void 0}}function LU(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function RU(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function zU(e){if(Array.isArray(e))return e}function BU(e,t){if(e==null)return{};var n,r,i=VU(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function VU(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function HU(){return HU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},HU.apply(null,arguments)}function UU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function WU(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?UU(Object(n),!0).forEach(function(t){GU(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function GU(e,t,n){return(t=KU(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KU(e){var t=qU(e,`string`);return typeof t==`symbol`?t:t+``}function qU(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var JU={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`,zIndex:NT.axis};function YU(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.orientation,o=e.mirror,s=e.axisLine,c=e.otherSvgProps;if(!s)return null;var l=WU(WU(WU({},c),df(s)),{},{fill:`none`});if(a===`top`||a===`bottom`){var u=+(a===`top`&&!o||a===`bottom`&&o);l=WU(WU({},l),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+(a===`left`&&!o||a===`right`&&o);l=WU(WU({},l),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return v.createElement(`line`,HU({},l,{className:af(`recharts-cartesian-axis-line`,Nf(s,`className`))}))}function XU(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h=s?-1:1,g=e.tickSize||o,_=Z(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case`top`:l=u=e.coordinate,f=n+ +!s*i,d=f-h*g,m=d-h*c,p=_;break;case`left`:d=f=e.coordinate,u=t+ +!s*r,l=u-h*g,p=l-h*c,m=_;break;case`right`:d=f=e.coordinate,u=t+ +s*r,l=u+h*g,p=l+h*c,m=_;break;default:l=u=e.coordinate,f=n+ +s*i,d=f+h*g,m=d+h*c,p=_}return{line:{x1:l,y1:d,x2:u,y2:f},tick:{x:p,y:m}}}function ZU(e,t){switch(e){case`left`:return t?`start`:`end`;case`right`:return t?`end`:`start`;default:return`middle`}}function QU(e,t){switch(e){case`left`:case`right`:return`middle`;case`top`:return t?`start`:`end`;default:return t?`end`:`start`}}function $U(e){var t=e.option,n=e.tickProps,r=e.value,i,a=af(n.className,`recharts-cartesian-axis-tick-value`);if(v.isValidElement(t))i=v.cloneElement(t,WU(WU({},n),{},{className:a}));else if(typeof t==`function`)i=t(WU(WU({},n),{},{className:a}));else{var o=`recharts-cartesian-axis-tick-value`;typeof t!=`boolean`&&(o=af(o,Jz(t))),i=v.createElement(rz,HU({},n,{className:o}),r)}return i}function eW(e){var t=e.ticks,n=e.axisType,r=e.axisId,i=Ph(),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(r!=null&&n!=null){var e=t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),o=a.current;o!=null&&o.axisId===r&&o.axisType===n&&uU(o.ticks,e)||(a.current={ticks:e,axisId:r,axisType:n},i(AU({ticks:e,axisId:r,axisType:n})))}},[i,t,r,n]),(0,v.useEffect)(()=>r==null||n==null?Zf:()=>{i(jU({axisId:r,axisType:n}))},[i,r,n]),null}var tW=(0,v.forwardRef)((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,i=e.tick,a=e.tickLine,o=e.stroke,s=e.tickFormatter,c=e.unit,l=e.padding,u=e.tickTextProps,d=e.orientation,f=e.mirror,p=e.x,m=e.y,h=e.width,g=e.height,_=e.tickSize,y=e.tickMargin,b=e.fontSize,x=e.letterSpacing,S=e.getTicksConfig,C=e.events,w=e.axisType,T=e.axisId,E=TU(WU(WU({},S),{},{ticks:r}),b,x),D=df(S),O=ff(i),k=KR(D.textAnchor)?D.textAnchor:ZU(d,f),A=QU(d,f),j={};typeof a==`object`&&(j=a);var M=WU(WU({},D),{},{fill:`none`},j),N=E.map(e=>WU({entry:e},XU(e,p,m,h,g,d,_,f,y))),P=N.map(e=>{var t=e.entry,n=e.line;return v.createElement(wf,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},a&&v.createElement(`line`,HU({},M,n,{className:af(`recharts-cartesian-axis-tick-line`,Nf(a,`className`))})))}),F=N.map((e,t)=>{var n=e.entry,r=e.tick,a=WU(WU({},WU(WU(WU(WU({verticalAnchor:A},D),{},{textAnchor:k,stroke:`none`,fill:o},r),{},{index:t,payload:n,visibleTicksCount:E.length,tickFormatter:s,padding:l},u),{},{angle:u?.angle??D.angle??0})),O);return v.createElement(wf,HU({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},um(C,n,t)),i&&v.createElement($U,{option:i,tickProps:a,value:`${typeof s==`function`?s(n.value,t):n.value}${c||``}`}))});return v.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${w}-ticks`},v.createElement(eW,{ticks:E,axisId:T,axisType:w}),F.length>0&&v.createElement(WI,{zIndex:NT.label},v.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${w}-tick-labels`,ref:t},F)),P.length>0&&v.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${w}-tick-lines`},P))}),nW=(0,v.forwardRef)((e,t)=>{var n=e.axisLine,r=e.width,i=e.height,a=e.className,o=e.hide,s=e.ticks,c=e.axisType,l=e.axisId,u=BU(e,NU),d=PU((0,v.useState)(``),2),f=d[0],p=d[1],m=PU((0,v.useState)(``),2),h=m[0],g=m[1],_=(0,v.useRef)(null);(0,v.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>EU({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin}),getCalculatedHeight:()=>DU({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var y=(0,v.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);_.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==f||a!==h)&&(p(i),g(a))}}},[f,h]);return o||r!=null&&r<=0||i!=null&&i<=0?null:v.createElement(WI,{zIndex:e.zIndex},v.createElement(wf,{className:af(`recharts-cartesian-axis`,a)},v.createElement(YU,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:df(e)}),v.createElement(tW,{ref:y,axisType:c,events:u,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:l}),v.createElement(hz,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},v.createElement(kz,{label:e.label,labelRef:e.labelRef}),e.children)))}),rW=v.forwardRef((e,t)=>{var n=gm(e,JU);return v.createElement(nW,HU({},n,{ref:t}))});rW.displayName=`CartesianAxis`;var iW=(0,v.createContext)({grid:{stroke:`#ccc`,fill:`none`}});iW.Provider;var aW=()=>(0,v.useContext)(iW),oW=[`x1`,`y1`,`x2`,`y2`,`key`],sW=[`offset`],cW=[`xAxisId`,`yAxisId`],lW=[`xAxisId`,`yAxisId`];function uW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dW(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?uW(Object(n),!0).forEach(function(t){fW(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uW(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fW(e,t,n){return(t=pW(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pW(e){var t=mW(e,`string`);return typeof t==`symbol`?t:t+``}function mW(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function hW(){return hW=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hW.apply(null,arguments)}function gW(e,t){if(e==null)return{};var n,r,i=_W(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _W(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var vW=e=>{var t=e.fill;if(!t||t===`none`)return null;var n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.ry;return v.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function yW(e){var t=e.option,n=e.lineItemProps,r;if(v.isValidElement(t))r=v.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var i=n.x1,a=n.y1,o=n.x2,s=n.y2,c=n.key,l=df(gW(n,oW))??{};l.offset;var u=gW(l,sW),d=Array.isArray(u.strokeDasharray)?u.strokeDasharray.join(`,`):u.strokeDasharray;r=v.createElement(`line`,hW({},u,{strokeDasharray:d,x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function bW(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0||r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=gW(e,cW),s=a.map((e,r)=>{var a=dW(dW({},o),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${r}`,index:r});return v.createElement(yW,{key:`line-${r}`,option:i,lineItemProps:a})});return v.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},s)}function xW(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0||r,a=e.verticalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=gW(e,lW),s=a.map((e,r)=>{var a=dW(dW({},o),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${r}`,index:r});return v.createElement(yW,{option:i,lineItemProps:a,key:`line-${r}`})});return v.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},s)}function SW(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.horizontalPoints,c=e.horizontal;if(!(c===void 0||c)||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return v.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return v.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function CW(e){var t=e.vertical,n=t===void 0||t,r=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,s=e.width,c=e.height,l=e.verticalPoints;if(!n||!r||!r.length)return null;var u=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==u[0]&&u.unshift(0);var d=u.map((e,t)=>{var n=u[t+1],l=n==null?a+s-e:n-e;if(l<=0)return null;var d=t%r.length;return v.createElement(`rect`,{key:`react-${t}`,x:e,y:o,width:l,height:c,stroke:`none`,fill:r[d],fillOpacity:i,className:`recharts-cartesian-grid-bg`})});return v.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var wW=(e,t)=>{var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return Ay(TU(dW(dW(dW({},JU),n),{},{ticks:jy(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},TW=(e,t)=>{var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return Ay(TU(dW(dW(dW({},JU),n),{},{ticks:jy(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},EW={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:NT.grid};function DW(e){var t=tx(),n=nx(),r=ex(),i=dW(dW({},gm(e,EW)),{},{x:Z(e.x)?e.x:r.left,y:Z(e.y)?e.y:r.top,width:Z(e.width)?e.width:r.width,height:Z(e.height)?e.height:r.height}),a=i.xAxisId,o=i.yAxisId,s=i.x,c=i.y,l=i.width,u=i.height,d=i.syncWithTicks,f=i.horizontalValues,p=i.verticalValues,m=gb(),h=Q(e=>mP(e,`xAxis`,a,m)),g=Q(e=>mP(e,`yAxis`,o,m)),_=aW(),y={stroke:i.stroke??_.grid.stroke,strokeWidth:i.strokeWidth??_.grid.strokeWidth,strokeOpacity:i.strokeOpacity??_.grid.strokeOpacity,strokeDasharray:i.strokeDasharray??_.grid.strokeDasharray};if(!xy(l)||!xy(u)||!Z(s)||!Z(c))return null;var b=i.verticalCoordinatesGenerator||wW,x=i.horizontalCoordinatesGenerator||TW,S=i.horizontalPoints,C=i.verticalPoints;if((!S||!S.length)&&typeof x==`function`){var w=f&&f.length,T=x({yAxis:g?dW(dW({},g),{},{ticks:w?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},w?!0:d);Sb(Array.isArray(T),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof T}]`),Array.isArray(T)&&(S=T)}if((!C||!C.length)&&typeof b==`function`){var E=p&&p.length,D=b({xAxis:h?dW(dW({},h),{},{ticks:E?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},E?!0:d);Sb(Array.isArray(D),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof D}]`),Array.isArray(D)&&(C=D)}return v.createElement(WI,{zIndex:i.zIndex},v.createElement(`g`,{className:`recharts-cartesian-grid`},v.createElement(vW,{fill:i.fill??_.grid.fill,fillOpacity:i.fillOpacity??_.grid.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),v.createElement(SW,hW({},i,{horizontalPoints:S})),v.createElement(CW,hW({},i,{verticalPoints:C})),v.createElement(bW,hW({},i,y,{offset:r,horizontalPoints:S,xAxis:h,yAxis:g})),v.createElement(xW,hW({},i,y,{offset:r,verticalPoints:C,xAxis:h,yAxis:g}))))}DW.displayName=`CartesianGrid`;var OW=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function kW(){return kW=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kW.apply(null,arguments)}function AW(e,t){if(e==null)return{};var n,r,i=jW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function jW(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function MW(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function NW(e,t){return`${t}px ${e}px`}function PW(e){return e.length%2==0?e:[...e,...e]}function FW(e,t){for(var n=[],r=0;r<t;++r)n.push(...e);return n}function IW(e,t,n){var r=PW(n),i=r.reduce((e,t)=>e+t,0);if(!i)return NW(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;c<r.length;l+=(u=r[c])??0,++c){var u,d=r[c];if(d!=null&&l+d>o){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...FW(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function LW(e,t,n){return e?IW(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):NW(t,n)}function RW(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=AW(e,OW),a=r??!1,o;if(t!=null){var s=i.pathRef;o=LW(n,MW(s?.current??null),t)}else n!=null&&(o=String(n));return v.createElement(zS,kW({},i,{connectNulls:a,strokeDasharray:o}))}function zW(e){var t=(0,v.useRef)(0),n=(0,v.useRef)(0),r=(0,v.useRef)(!1),i=(0,v.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,v.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(If(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var BW=wv({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]||(e[r]=[]),e[r].push(i)},replaceErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.prev,a=n.next;e[r]&&(e[r]=e[r].map(e=>e.dataKey===i.dataKey&&e.direction===i.direction?a:e))},removeErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]&&(e[r]=e[r].filter(e=>e.dataKey!==i.dataKey||e.direction!==i.direction))}}}),VW=BW.actions;VW.addErrorBar,VW.replaceErrorBar,VW.removeErrorBar;var HW=BW.reducer,UW=[`children`];function WW(e,t){if(e==null)return{};var n,r,i=GW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function GW(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var KW=(0,v.createContext)({data:[],xAxisId:`xAxis-0`,yAxisId:`yAxis-0`,dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function qW(e){var t=e.children,n=WW(e,UW);return v.createElement(KW.Provider,{value:n},t)}function JW(e,t){var n=Q(t=>hM(t,e)),r=Q(e=>vM(e,t)),i=n?.allowDataOverflow??pM.allowDataOverflow,a=r?.allowDataOverflow??gM.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function YW(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,i=PV(),a=JW(t,n),o=a.needClipX,s=a.needClipY,c=a.needClip,l=Q(e=>HN(e,t,!1)),u=Q(e=>UN(e,n,!1));if(!c||!i)return null;var d=i.x,f=i.y,p=i.width,m=i.height,h=o&&l?Math.min(l[0],l[1]):d-p/2,g=s&&u?Math.min(u[0],u[1]):f-m/2,_=o&&l?Math.abs(l[1]-l[0]):p*2,y=s&&u?Math.abs(u[1]-u[0]):m*2;return v.createElement(`clipPath`,{id:`clipPath-${r}`},v.createElement(`rect`,{x:h,y:g,width:_,height:y}))}var XW=(e,t,n,r)=>_P(e,`xAxis`,t,r),ZW=(e,t,n,r)=>gP(e,`xAxis`,t,r),QW=(e,t,n,r)=>_P(e,`yAxis`,n,r),$W=(e,t,n,r)=>gP(e,`yAxis`,n,r),eG=$([rx,XW,QW,ZW,$W],(e,t,n,r,i)=>ky(e,`xAxis`)?Wy(t,r,!1):Wy(n,i,!1)),tG=(e,t,n,r,i)=>i;function nG(e){return e.type===`line`}var rG=$([rx,XW,QW,ZW,$W,$([EM,tG],(e,t)=>e.filter(nG).find(e=>e.id===t)),eG,Kw],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return kG({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}});function iG(e){var t=ff(e),n=3,r=2;if(t!=null){var i=t.r,a=t.strokeWidth,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var aG=[`id`],oG=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],sG=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function cG(){return cG=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cG.apply(null,arguments)}function lG(e,t){if(e==null)return{};var n,r,i=uG(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function uG(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function dG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fG(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?dG(Object(n),!0).forEach(function(t){pG(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pG(e,t,n){return(t=mG(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mG(e){var t=hG(e,`string`);return typeof t==`symbol`?t:t+``}function hG(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function gG(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function _G(e){var t=0,n=0;for(var r of e)r.status===`matched`&&r.prev.x!=null&&r.next.x!=null&&(t+=r.next.x-r.prev.x,n++);return n>0?t/n:0}var vG={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=_G(e),r=[];for(var i of e)if(i.status===`matched`)r.push(fG(fG({},i.next),{},{x:Kf(i.prev.x,i.next.x,t),y:Kf(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(fG(fG({},i.next),{},{x:Kf(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(fG(fG({},i.prev),{},{x:Kf(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:TB,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:RW,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:NT.line,type:`linear`},yG=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:Ky(n,t),payload:e}]},bG=v.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:Zf,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Ky(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return v.createElement(_B,{tooltipEntrySettings:f})});function xG(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=df(lG(r,aG));return v.createElement(gV,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:s,needClip:o,clipPathId:t})}function SG(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,v.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return fG(fG({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return v.createElement(Lz,{value:t?i:void 0},n)}function CG(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,u=i.layout,d=i.connectNulls,f=i.needClip,p=i.shape,m=i.strokeDasharray,h=fG(fG({},pf(lG(i,oG))),{},{fill:`none`,className:`recharts-line-curve`,clipPath:f?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:u,connectNulls:d,strokeDasharray:m??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return v.createElement(v.Fragment,null,r?.length>1&&v.createElement(pB,{option:p,DefaultShape:vG.shape,shapeProps:h}),v.createElement(xG,{points:r,clipPathId:t,props:i}))}function wG(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,f=n.layout,p=gG(r.current),m=BB(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,g=m.handleAnimationStart,_=m.handleAnimationEnd,y=!h,b=zW(a),x=(0,v.useCallback)(e=>e>0&&p>0,[p]);return v.createElement(SG,{points:a,showLabels:y},n.children,v.createElement(VB,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:g,onAnimationEnd:_,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:x,layout:f},(e,i,a)=>{var o=h||i<1,s=o?b(i,p):null;return v.createElement(CG,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),v.createElement(Hz,{label:n.label}))}function TG(e){var t=e.clipPathId,n=e.props,r=(0,v.useRef)(null),i=(0,v.useRef)(null);return v.createElement(wG,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var EG=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:Dy(e.payload,t)}),DG=class extends v.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.top,c=e.left,l=e.width,u=e.height,d=e.id,f=e.needClip,p=e.zIndex;if(t)return null;var m=af(`recharts-line`,i),h=d,g=iG(n),_=g.r,y=g.strokeWidth,b=nB(n),x=_*2+y,S=f?`url(#clipPath-${b?``:`dots-`}${h})`:void 0;return v.createElement(WI,{zIndex:p},v.createElement(wf,{className:m},f&&v.createElement(`defs`,null,v.createElement(YW,{clipPathId:h,xAxisId:a,yAxisId:o}),!b&&v.createElement(`clipPath`,{id:`clipPath-dots-${h}`},v.createElement(`rect`,{x:c-x/2,y:s-x/2,width:l+x,height:u+x}))),v.createElement(qW,{xAxisId:a,yAxisId:o,data:r,dataPointFormatter:EG,errorBarOffset:0},v.createElement(TG,{props:this.props,clipPathId:h}))),v.createElement(HV,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:S}))}};function OG(e){var t=gm(e,vG),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=lG(t,sG),_=JW(p,m).needClip,y=PV(),b=ix(),x=gb(),S=Q(e=>rG(e,p,m,x,h));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,E=y.y;return v.createElement(DG,cG({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:E,needClip:_}))}function kG(e){var t=e.layout,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize;return e.displayedData.map((e,c)=>{var l=Dy(e,o);if(t===`horizontal`)return{x:Iy({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(Jf(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=Jf(l)?null:n.scale.map(l),d=Iy({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function AG(e){var t=gm(e,vG),n=gb();return v.createElement(ZB,{id:t.id,type:`line`},e=>v.createElement(v.Fragment,null,v.createElement(vB,{legendPayload:yG(t)}),v.createElement(bG,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),v.createElement(iV,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),v.createElement(OG,cG({},t,{id:e}))))}var jG=v.memo(AG,Nx);jG.displayName=`Line`;function MG(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function NG(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var PG=(e,t,n)=>_P(e,`xAxis`,MG(e,t),n),FG=(e,t,n)=>gP(e,`xAxis`,MG(e,t),n),IG=(e,t,n)=>_P(e,`yAxis`,NG(e,t),n),LG=(e,t,n)=>gP(e,`yAxis`,NG(e,t),n),RG=$([rx,PG,IG,FG,LG],(e,t,n,r,i)=>ky(e,`xAxis`)?Wy(t,r,!1):Wy(n,i,!1)),zG=$([EM,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),BG=e=>ky(rx(e),`xAxis`)?`yAxis`:`xAxis`,VG=(e,t)=>BG(e)===`yAxis`?NG(e,t):MG(e,t),HG=(e,t,n)=>QM(e,BG(e),VG(e,t),n),UG=$([rx,PG,IG,FG,LG,$([zG,HG],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=nE(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),qw,RG,zG,MT,$([zG,HG],(e,t)=>{if(e!=null&&e.stackId!=null&&t!=null){var n=t[e.stackId];if(n!=null)return n.graphicalItems.map(e=>e.dataKey).filter(Xf)}})],(e,t,n,r,i,a,o,s,c,l,u)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var m=c.data,h=m&&m.length>0?m:d?.slice(f,p+1);if(h!=null)return SK({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),WG=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],GG=[`id`,`baseLine`];function KG(){return KG=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KG.apply(null,arguments)}function qG(e,t){if(e==null)return{};var n,r,i=JG(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function JG(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function YG(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.x,o=r[r.length-1]?.x;if(!by(a)||!by(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.y||0));return Z(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),Z(c)?v.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}function XG(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.y,o=r[r.length-1]?.y;if(!by(a)||!by(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return Z(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),Z(c)?v.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}function ZG(e){var t=e.alpha,n=e.layout,r=e.points,i=e.baseLine,a=e.strokeWidth;return n===`vertical`?v.createElement(XG,{alpha:t,points:r,baseLine:i,strokeWidth:a}):v.createElement(YG,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function QG(e){var t=e.animationElapsedTime,n=t===void 0?1:t,r=e.isAnimating,i=r!==void 0&&r,a=e.isEntrance,o=a!==void 0&&a,s=e.layout,c=e.isRange,l=e.stroke,u=e.connectNulls,d=qG(e,WG),f=s===`vertical`?`vertical`:`horizontal`,p=u??!1,m=JB(),h=d.id,g=d.baseLine,_=df(qG(d,GG)),y=v.createElement(zS,KG({},d,{id:h,baseLine:g,connectNulls:p,stroke:`none`,className:`recharts-area-area`,layout:f})),b=l!==`none`&&v.createElement(zS,KG({},_,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:p,fill:`none`,stroke:l,points:d.points})),x=l!==`none`&&c&&Array.isArray(g)&&v.createElement(zS,KG({},_,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:p,fill:`none`,stroke:l,points:g}));return o&&(i||n<1)?v.createElement(wf,null,v.createElement(`defs`,null,v.createElement(`clipPath`,{id:m},v.createElement(ZG,{alpha:n,points:d.points??[],baseLine:g,layout:f,strokeWidth:d.strokeWidth}))),v.createElement(wf,{clipPath:`url(#${m})`},y,b,x)):v.createElement(v.Fragment,null,y,b,x)}var $G=[`id`],eK=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function tK(){return tK=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tK.apply(null,arguments)}function nK(e,t){if(e==null)return{};var n,r,i=rK(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function rK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function iK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?iK(Object(n),!0).forEach(function(t){oK(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iK(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oK(e,t,n){return(t=sK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sK(e){var t=cK(e,`string`);return typeof t==`symbol`?t:t+``}function cK(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var lK={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationMatchBy:TB,animationInterpolateFn:(e,t)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[aK(aK({},e.next),{},{x:Kf(e.prev.x,e.next.x,t),y:Kf(e.prev.y,e.next.y,t)})]:e.status===`added`?[e.next]:[]),connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,shape:QG,xAxisId:0,yAxisId:0,zIndex:NT.area};function uK(e,t){return e&&e!==`none`?e:t}var dK=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.fill,a=e.legendType;return[{inactive:e.hide,dataKey:t,type:a,color:uK(r,i),value:Ky(n,t),payload:e}]},fK=v.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:Zf,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Ky(o,t),hide:s,type:u,color:uK(r,a),unit:c,formatter:l,graphicalItemId:d}};return v.createElement(_B,{tooltipEntrySettings:f})});function pK(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,s=df(r);return v.createElement(gV,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function mK(e){var t=e.showLabels,n=e.children,r=e.points.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return aK(aK({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return v.createElement(Lz,{value:t?r:void 0},n)}function hK(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,s=e.isAnimating,c=e.isEntrance,l=a.layout,u=a.type,d=a.stroke,f=a.connectNulls,p=a.isRange,m=a.shape,h=a.id,g=nK(a,$G),_=aK(aK({},pf(g)),{},{id:h,points:t,connectNulls:f,type:u,baseLine:n,layout:l,stroke:d,isRange:p,animationElapsedTime:o,isAnimating:s,isEntrance:c});return v.createElement(v.Fragment,null,t?.length>1&&v.createElement(wf,{clipPath:r?`url(#clipPath-${i})`:void 0},v.createElement(pB,{option:m,DefaultShape:lK.shape,shapeProps:_})),v.createElement(pK,{points:t,props:g,clipPathId:i}))}function gK(e,t,n){return Z(e)?Kf(Z(t)?t:void 0,e,n):Jf(e)||zf(e)?Kf(Z(t)?t:void 0,0,n):e}function _K(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,s=r.baseLine,c=r.isAnimationActive,l=r.animationBegin,u=r.animationDuration,d=r.animationEasing,f=r.animationMatchBy,p=r.animationInterpolateFn,m=(0,v.useMemo)(()=>({points:o,baseLine:s}),[o,s]),h=NB(m,a),g=ax(),_=BB(r.onAnimationStart,r.onAnimationEnd),y=_.isAnimating,b=_.handleAnimationStart,x=_.handleAnimationEnd,S=h.startValue;if(g==null)return null;var C=Array.isArray(s)&&Array.isArray(S)?MB(S,s,f):Array.isArray(s)?MB(null,s,f):null;return v.createElement(VB,{animationInput:m,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,onAnimationStart:b,onAnimationEnd:x,animationInterpolateFn:p,animationMatchBy:f,layout:g},(e,i,a)=>{var c=i===1?s:Array.isArray(s)?p(C,i,g):a?s:gK(s,S,i);return h.syncStepValue(c,i),v.createElement(mK,{showLabels:!y,points:o},r.children,v.createElement(hK,{points:e,baseLine:c,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:y||i<1,isEntrance:a}),v.createElement(Hz,{label:r.label}))})}function vK(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=(0,v.useRef)(null),a=(0,v.useRef)();return v.createElement(_K,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var yK=class extends v.PureComponent{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,o=e.left,s=e.needClip,c=e.xAxisId,l=e.yAxisId,u=e.width,d=e.height,f=e.id,p=e.baseLine,m=e.zIndex;if(t)return null;var h=af(`recharts-area`,i),g=f,_=iG(n),y=_.r,b=_.strokeWidth,x=nB(n),S=y*2+b,C=s?`url(#clipPath-${x?``:`dots-`}${g})`:void 0;return v.createElement(WI,{zIndex:m},v.createElement(wf,{className:h},s&&v.createElement(`defs`,null,v.createElement(YW,{clipPathId:g,xAxisId:c,yAxisId:l}),!x&&v.createElement(`clipPath`,{id:`clipPath-dots-${g}`},v.createElement(`rect`,{x:o-S/2,y:a-S/2,width:u+S,height:d+S}))),v.createElement(vK,{needClip:s,clipPathId:g,props:this.props})),v.createElement(HV,{points:r,mainColor:uK(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(p)&&v.createElement(HV,{points:p,mainColor:uK(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}};function bK(e){var t=e.activeDot,n=e.animationBegin,r=e.animationDuration,i=e.animationEasing,a=e.connectNulls,o=e.dot,s=e.fill,c=e.fillOpacity,l=e.hide,u=e.isAnimationActive,d=e.legendType,f=e.stroke,p=e.xAxisId,m=e.yAxisId,h=nK(e,eK),g=ix(),_=uI(),y=JW(p,m).needClip,b=gb(),x=Q(t=>UG(t,e.id,b))??{},S=x.points,C=x.isRange,w=x.baseLine,T=PV();if(g!==`horizontal`&&g!==`vertical`||T==null||_!==`AreaChart`&&_!==`ComposedChart`)return null;var E=T.height,D=T.width,O=T.x,k=T.y;return!S||!S.length?null:v.createElement(yK,tK({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:w,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:E,hide:l,layout:g,isAnimationActive:u,isRange:C,legendType:d,needClip:y,points:S,stroke:f,width:D,left:O,top:k,xAxisId:p,yAxisId:m}))}var xK=(e,t,n,r,i)=>{var a=n??t;if(Z(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function SK(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,i=t.dataKey,a=e.stackedData,o=e.layout,s=e.chartBaseValue,c=e.xAxis,l=e.yAxis,u=e.displayedData,d=e.dataStartIndex,f=e.xAxisTicks,p=e.yAxisTicks,m=e.bandSize,h=e.stackDataKeys,g=a&&a.length,_=xK(o,s,r,c,l),v=o===`horizontal`,y=!1,b=u.map((e,t)=>{var r;if(g)r=a[d+t];else{var o=Dy(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=Dy(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>Dy(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:Iy({axis:c,ticks:f,bandSize:m,entry:e,index:t}),y:x?null:l.scale.map(s)??null,value:r,payload:e}:{x:x?null:c.scale.map(s)??null,y:Iy({axis:l,ticks:p,bandSize:m,entry:e,index:t}),value:r,payload:e}});return{points:b,baseLine:(g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:t!=null&&e.y!=null?l.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:c.scale.map(t)??null,y:e.y,payload:e.payload}}):v?l.scale.map(_):c.scale.map(_))??0,isRange:y}}function CK(e){var t=gm(e,lK),n=gb();return v.createElement(ZB,{id:t.id,type:`area`},e=>v.createElement(v.Fragment,null,v.createElement(vB,{legendPayload:dK(t)}),v.createElement(fK,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),v.createElement(iV,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:Fy(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),v.createElement(bK,tK({},t,{id:e}))))}var wK=v.memo(CK,Nx);wK.displayName=`Area`;var TK=`Invariant failed`;function EK(e,t){if(!e)throw Error(TK)}var DK=[`option`];function OK(e,t){if(e==null)return{};var n,r,i=kK(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function kK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var AK=lw;function jK(e){var t=e.option,n=OK(e,DK);return v.createElement(pB,{option:t,DefaultShape:AK,shapeProps:n,activeClassName:`recharts-active-bar`,inActiveClassName:`recharts-inactive-bar`})}var MK=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,r)=>{if(Z(e))return e;var i=Z(n)||Jf(n);return i?e(n,r):(!i&&EK(!1,`minPointSize callback function received a value with type of ${typeof n}. Currently only numbers or null/undefined are supported.`),t)}},NK=(e,t,n)=>n,PK=$([EM,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`bar`).find(e=>e.id===t)),FK=$([PK],e=>e?.maxBarSize),IK=(e,t,n,r)=>r,LK=$([rx,EM,MG,NG,NK],(e,t,n,r,i)=>t.filter(t=>e===`horizontal`?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>e.hide===!1).filter(e=>e.type===`bar`)),RK=(e,t,n)=>{var r=rx(e),i=MG(e,t),a=NG(e,t);if(i!=null&&a!=null)return r===`horizontal`?QM(e,`yAxis`,a,n):QM(e,`xAxis`,i,n)},zK=$([LK,TT,(e,t)=>{var n=rx(e),r=MG(e,t),i=NG(e,t);if(r!=null&&i!=null)return n===`horizontal`?dP(e,`xAxis`,r):dP(e,`yAxis`,i)}],XV),BK=(e,t,n)=>{var r=PK(e,t);if(r==null)return 0;var i=MG(e,t),a=NG(e,t);if(i==null||a==null)return 0;var o=rx(e),s=ST(e),c=r.maxBarSize,l=Jf(c)?s:c,u,d;return o===`horizontal`?(u=_P(e,`xAxis`,i,n),d=gP(e,`xAxis`,i,n)):(u=_P(e,`yAxis`,a,n),d=gP(e,`yAxis`,a,n)),Wy(u,d,!0)??l??0},VK=(e,t,n)=>{var r=rx(e),i=MG(e,t),a=NG(e,t);if(i!=null&&a!=null){var o,s;return r===`horizontal`?(o=_P(e,`xAxis`,i,n),s=gP(e,`xAxis`,i,n)):(o=_P(e,`yAxis`,a,n),s=gP(e,`yAxis`,a,n)),Wy(o,s)}},HK=$([fb,mb,(e,t,n)=>{var r=MG(e,t);if(r!=null)return _P(e,`xAxis`,r,n)},(e,t,n)=>{var r=NG(e,t);if(r!=null)return _P(e,`yAxis`,r,n)},(e,t,n)=>{var r=MG(e,t);if(r!=null)return gP(e,`xAxis`,r,n)},(e,t,n)=>{var r=NG(e,t);if(r!=null)return gP(e,`yAxis`,r,n)},$([$([zK,ST,CT,wT,BK,VK,FK],rH),PK],aH),rx,qw,VK,$([RK,PK],iH),PK,IK],(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{var p=c.chartData,m=c.dataStartIndex,h=c.dataEndIndex;if(!(d==null||o==null||t==null||s!==`horizontal`&&s!==`vertical`||n==null||r==null||i==null||a==null||l==null)){var g=d.data,_=g!=null&&g.length>0?g:p?.slice(m,h+1);if(_!=null)return jq({layout:s,barSettings:d,pos:o,parentViewBox:t,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:_,offset:e,cells:f,dataStartIndex:m})}}),UK=[`index`];function WK(){return WK=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},WK.apply(null,arguments)}function GK(e,t){if(e==null)return{};var n,r,i=KK(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function KK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var qK=(0,v.createContext)(void 0),JK=e=>{var t=(0,v.useContext)(qK);if(t!=null)return t.stackId;if(e!=null)return Fy(e)},YK=(e,t)=>`recharts-bar-stack-clip-path-${e}-${t}`,XK=e=>{var t=(0,v.useContext)(qK);if(t!=null){var n=t.stackId;return`url(#${YK(n,e)})`}},ZK=e=>{var t=e.index,n=GK(e,UK),r=XK(t);return v.createElement(wf,WK({className:`recharts-bar-stack-layer`,clipPath:r},n))},QK=[`onMouseEnter`,`onMouseLeave`,`onClick`],$K=[`value`,`background`,`tooltipPosition`],eq=[`id`],tq=[`onMouseEnter`,`onClick`,`onMouseLeave`];function nq(e,t){return sq(e)||oq(e,t)||iq(e,t)||rq()}function rq(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
97
97
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iq(e,t){if(e){if(typeof e==`string`)return aq(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?aq(e,t):void 0}}function aq(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function oq(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function sq(e){if(Array.isArray(e))return e}function cq(){return cq=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cq.apply(null,arguments)}function lq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function uq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?lq(Object(n),!0).forEach(function(t){dq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function dq(e,t,n){return(t=fq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fq(e){var t=pq(e,`string`);return typeof t==`symbol`?t:t+``}function pq(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function mq(e,t){if(e==null)return{};var n,r,i=hq(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function hq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var gq=e=>{var t=e.dataKey,n=e.name,r=e.fill,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:Ky(n,t),payload:e}]},_q=v.memo(e=>{var t=e.dataKey,n=e.stroke,r=e.strokeWidth,i=e.fill,a=e.name,o=e.hide,s=e.unit,c=e.formatter,l=e.tooltipType,u=e.id,d={dataDefinedOnItem:void 0,getPosition:Zf,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Ky(a,t),hide:o,type:l,color:i,unit:s,formatter:c,graphicalItemId:u}};return v.createElement(_B,{tooltipEntrySettings:d})});function vq(e){var t=Q(BF),n=e.data,r=e.dataKey,i=e.background,a=e.allOtherBarProps,o=a.onMouseEnter,s=a.onMouseLeave,c=a.onClick,l=mq(a,QK),u=mB(o,r,a.id),d=hB(s),f=gB(c,r,a.id);if(!i||n==null)return null;var p=ff(i);return v.createElement(WI,{zIndex:oH(i,NT.barBackground)},n.map((e,n)=>{e.value;var a=e.background;e.tooltipPosition;var o=mq(e,$K);if(!a)return null;var s=u(e,e.originalDataIndex),c=d(e,e.originalDataIndex),m=f(e,e.originalDataIndex),h=uq(uq(uq(uq(uq({option:i,isActive:String(e.originalDataIndex)===t},o),{},{fill:`#eee`},a),p),um(l,e,n)),{},{onMouseEnter:s,onMouseLeave:c,onClick:m,dataKey:r,index:n,className:`recharts-bar-background-rectangle`});return v.createElement(jK,cq({key:`background-bar-${n}`},h))}))}function yq(e){var t=e.showLabels,n=e.children,r=e.rects?.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return uq(uq({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return v.createElement(Lz,{value:t?r:void 0},n)}function bq(e){var t=e.shape,n=e.activeBar,r=e.baseProps,i=e.entry,a=e.index,o=e.dataKey,s=Q(BF),c=Q(HF),l=n&&String(i.originalDataIndex)===s&&(c==null||o===c),u=s!=null&&(String(i.originalDataIndex)!==s||c!=null&&o!==c),d=nq((0,v.useState)(!1),2),f=d[0],p=d[1],m=nq((0,v.useState)(!1),2),h=m[0],g=m[1];(0,v.useEffect)(()=>{var e;return l?(p(!0),e=requestAnimationFrame(()=>{g(!0)})):(g(!1),u&&p(!1)),()=>{cancelAnimationFrame(e)}},[l,u]);var _=(0,v.useCallback)(()=>{l||p(!1)},[l]),y=l&&h,b=l||f,x=l?n===!0?t:n:t,S=v.createElement(jK,cq({},r,{name:String(r.name)},i,{isActive:y,option:x,index:a,dataKey:o,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance,onTransitionEnd:_}));return b?v.createElement(WI,{zIndex:NT.activeBar},v.createElement(ZK,{index:i.originalDataIndex},S)):S}function xq(e){var t=e.shape,n=e.baseProps,r=e.entry,i=e.index,a=e.dataKey;return v.createElement(jK,cq({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance}))}function Sq(e){var t=e.data,n=e.props,r=e.animationElapsedTime,i=e.isAnimating,a=e.isEntrance,o=df(n)??{},s=o.id,c=mq(o,eq),l=n.shape,u=n.dataKey,d=n.activeBar,f=n.onMouseEnter,p=n.onClick,m=n.onMouseLeave,h=mq(n,tq),g=mB(f,u,s),_=hB(m),y=gB(p,u,s);return t?v.createElement(v.Fragment,null,t.map((e,t)=>v.createElement(ZK,cq({index:e.originalDataIndex,key:`rectangle-${e?.x}-${e?.y}-${e?.value}-${t}`,className:`recharts-bar-rectangle`},um(h,e,t),{onMouseEnter:g(e,e.originalDataIndex),onMouseLeave:_(e,e.originalDataIndex),onClick:y(e,e.originalDataIndex)}),d?v.createElement(bq,{shape:l,activeBar:d,baseProps:c,entry:e,index:t,dataKey:u,animationElapsedTime:r,isAnimating:i,isEntrance:a}):v.createElement(xq,{shape:l,baseProps:c,entry:e,index:t,dataKey:u,animationElapsedTime:r,isAnimating:i,isEntrance:a})))):null}var Cq=(e,t,n)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>{if(e.status===`removed`)return n===`horizontal`?[uq(uq({},e.prev),{},{height:Kf(e.prev.height,0,t),y:Kf(e.prev.y,e.prev.y+e.prev.height,t)})]:[uq(uq({},e.prev),{},{width:Kf(e.prev.width,0,t)})];if(e.status===`matched`)return[uq(uq({},e.next),{},{x:Kf(e.prev.x,e.next.x,t),y:Kf(e.prev.y,e.next.y,t),width:Kf(e.prev.width,e.next.width,t),height:Kf(e.prev.height,e.next.height,t)})];var r=e.next;return n===`horizontal`?[uq(uq({},r),{},{height:Kf(0,r.height,t),y:Kf(r.stackedBarStart,r.y,t)})]:[uq(uq({},r),{},{width:Kf(0,r.width,t),x:Kf(r.stackedBarStart,r.x,t)})]});function wq(e){var t=e.props,n=e.previousRectanglesRef,r=t.data,i=t.isAnimationActive,a=t.animationBegin,o=t.animationDuration,s=t.animationEasing,c=t.animationInterpolateFn,l=t.layout,u=BB(t.onAnimationStart,t.onAnimationEnd),d=u.isAnimating,f=u.handleAnimationStart,p=u.handleAnimationEnd;return v.createElement(yq,{showLabels:!d,rects:r},v.createElement(VB,{animationInput:r,animationIdPrefix:`recharts-bar-`,items:r,previousItemsRef:n,isAnimationActive:i,animationBegin:a,animationDuration:o,animationEasing:s,onAnimationStart:f,onAnimationEnd:p,animationInterpolateFn:c,animationMatchBy:t.animationMatchBy,layout:l},(e,n,r)=>v.createElement(wf,null,v.createElement(Sq,{props:t,data:e,animationElapsedTime:n,isAnimating:d||n<1,isEntrance:r}))),v.createElement(Hz,{label:t.label}),t.children)}function Tq(e){var t=(0,v.useRef)(null);return v.createElement(wq,{previousRectanglesRef:t,props:e})}var Eq=0,Dq=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:Dy(e,t)}},Oq=class extends v.PureComponent{render(){var e=this.props,t=e.hide,n=e.data,r=e.dataKey,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.needClip,c=e.background,l=e.id;if(t||n==null)return null;var u=af(`recharts-bar`,i),d=l;return v.createElement(wf,{className:u,id:l},s&&v.createElement(`defs`,null,v.createElement(YW,{clipPathId:d,xAxisId:a,yAxisId:o})),v.createElement(wf,{className:`recharts-bar-rectangles`,clipPath:s?`url(#clipPath-${d})`:void 0},v.createElement(vq,{data:n,dataKey:r,background:c,allOtherBarProps:this.props}),v.createElement(Tq,this.props)))}},kq={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:`ease`,animationInterpolateFn:Cq,animationMatchBy:EB,background:!1,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`rect`,minPointSize:Eq,shape:AK,xAxisId:0,yAxisId:0,zIndex:NT.bar};function Aq(e){var t=e.xAxisId,n=e.yAxisId,r=e.hide,i=e.legendType,a=e.minPointSize,o=e.activeBar,s=e.animationBegin,c=e.animationDuration,l=e.animationEasing,u=e.isAnimationActive,d=JW(t,n).needClip,f=ix(),p=gb(),m=tB(e.children,WL),h=Q(t=>HK(t,e.id,p,m));if(f!==`vertical`&&f!==`horizontal`)return null;var g,_=h?.[0];return g=_==null||_.height==null||_.width==null?0:f===`vertical`?_.height/2:_.width/2,v.createElement(qW,{xAxisId:t,yAxisId:n,data:h,dataPointFormatter:Dq,errorBarOffset:g},v.createElement(Oq,cq({},e,{layout:f,needClip:d,data:h,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u})))}function jq(e){var t=e.layout,n=e.barSettings,r=n.dataKey,i=n.minPointSize,a=n.hasCustomShape,o=e.pos,s=e.bandSize,c=e.xAxis,l=e.yAxis,u=e.xAxisTicks,d=e.yAxisTicks,f=e.stackedData,p=e.displayedData,m=e.offset,h=e.cells,g=e.parentViewBox,_=e.dataStartIndex,v=t===`horizontal`?l:c,y=f?v.scale.domain():null,b=Ry({numericAxis:v}),x=v.scale.map(b);return p.map((e,n)=>{var p,v,S,C,w,T;if(f){var E=f[n+_];if(E==null)return null;p=My(E,y)}else p=Dy(e,r),Array.isArray(p)||(p=[b,p]);var D=MK(i,Eq)(p[1],n);if(t===`horizontal`){var O=l.scale.map(p[0]),k=l.scale.map(p[1]);if(O==null||k==null)return null;v=Ly({axis:c,ticks:u,bandSize:s,offset:o.offset,entry:e,index:n}),S=k??O??void 0,C=o.size;var A=O-k;if(w=zf(A)?0:A,T={x:v,y:m.top,width:C,height:m.height},Math.abs(D)>0&&Math.abs(w)<Math.abs(D)){var j=Rf(w||D)*(Math.abs(D)-Math.abs(w));S-=j,w+=j}}else{var M=c.scale.map(p[0]),N=c.scale.map(p[1]);if(M==null||N==null)return null;if(v=M,S=Ly({axis:l,ticks:d,bandSize:s,offset:o.offset,entry:e,index:n}),C=N-M,w=o.size,T={x:m.left,y:S,width:m.width,height:w},Math.abs(D)>0&&Math.abs(C)<Math.abs(D)){var P=Rf(C||D)*(Math.abs(D)-Math.abs(C));C+=P}}return v==null||S==null||C==null||w==null||!a&&(C===0||w===0)?null:uq(uq({},e),{},{stackedBarStart:x,x:v,y:S,width:C,height:w,value:f?p:p[1],payload:e,background:T,tooltipPosition:{x:v+C/2,y:S+w/2},parentViewBox:g,originalDataIndex:n},h&&h[n]&&h[n].props)}).filter(Boolean)}function Mq(e){var t=gm(e,kq),n=JK(t.stackId),r=gb();return v.createElement(ZB,{id:t.id,type:`bar`},e=>v.createElement(v.Fragment,null,v.createElement(vB,{legendPayload:gq(t)}),v.createElement(_q,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),v.createElement(iV,{type:`bar`,id:e,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null&&t.shape!==AK}),v.createElement(WI,{zIndex:t.zIndex},v.createElement(Aq,cq({},t,{id:e})))))}var Nq=v.memo(Mq,Nx);Nq.displayName=`Bar`;var Pq=[`domain`,`range`],Fq=[`domain`,`range`];function Iq(e,t){if(e==null)return{};var n,r,i=Lq(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Lq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Rq(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function zq(e,t){if(e===t)return!0;var n=e.domain,r=e.range,i=Iq(e,Pq),a=t.domain,o=t.range,s=Iq(t,Fq);return!Rq(n,a)||!Rq(r,o)?!1:Nx(i,s)}var Bq=[`type`],Vq=[`dangerouslySetInnerHTML`,`ticks`,`scale`],Hq=[`id`,`scale`];function Uq(){return Uq=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uq.apply(null,arguments)}function Wq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Wq(Object(n),!0).forEach(function(t){Kq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Kq(e,t,n){return(t=qq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qq(e){var t=Jq(e,`string`);return typeof t==`symbol`?t:t+``}function Jq(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Yq(e,t){if(e==null)return{};var n,r,i=Xq(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Xq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Zq(e){var t=Ph(),n=(0,v.useRef)(null),r=ax(),i=e.type,a=Yq(e,Bq),o=LT(r,`xAxis`,i),s=(0,v.useMemo)(()=>{if(o!=null)return Gq(Gq({},a),{},{type:o})},[a,o]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(wV(s)):n.current!==s&&t(TV({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(EV(n.current)),null)},[t]),null}var Qq=e=>{var t=e.xAxisId,n=e.className,r=e.height,i=e.label,a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=Q(mb),c=gb(),l=Ph(),u=`xAxis`,d=Q(e=>hP(e,u,t,c)),f=Q(e=>rP(e,t)),p=Q(e=>cP(e,t)),m=Q(e=>mM(e,t));if((0,v.useLayoutEffect)(()=>{if(!(r!==`auto`||!f||bz(i)||(0,v.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedHeight();Math.round(f.height)!==Math.round(n)&&l(jV({id:t,height:n}))}}},[d,f,l,i,t,r,m]),f==null||p==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=Yq(e,Vq);m.id,m.scale;var g=Yq(m,Hq);return v.createElement(rW,Uq({},h,g,{ref:a,labelRef:o,x:p.x,y:p.y,width:f.width,height:f.height,className:af(`recharts-${u} ${u}`,n),viewBox:s,ticks:d,axisType:u,axisId:t}))},$q={allowDataOverflow:pM.allowDataOverflow,allowDecimals:pM.allowDecimals,allowDuplicatedCategory:pM.allowDuplicatedCategory,angle:pM.angle,axisLine:JU.axisLine,height:pM.height,hide:!1,includeHidden:pM.includeHidden,interval:pM.interval,label:!1,minTickGap:pM.minTickGap,mirror:pM.mirror,orientation:pM.orientation,padding:pM.padding,reversed:pM.reversed,scale:pM.scale,tick:pM.tick,tickCount:pM.tickCount,tickLine:JU.tickLine,tickSize:JU.tickSize,type:pM.type,niceTicks:pM.niceTicks,xAxisId:0},eJ=v.memo(e=>{var t=gm(e,$q);return v.createElement(v.Fragment,null,v.createElement(Zq,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),v.createElement(Qq,t))},zq);eJ.displayName=`XAxis`;var tJ=[`type`],nJ=[`dangerouslySetInnerHTML`,`ticks`,`scale`],rJ=[`id`,`scale`];function iJ(){return iJ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iJ.apply(null,arguments)}function aJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?aJ(Object(n),!0).forEach(function(t){sJ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sJ(e,t,n){return(t=cJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cJ(e){var t=lJ(e,`string`);return typeof t==`symbol`?t:t+``}function lJ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function uJ(e,t){if(e==null)return{};var n,r,i=dJ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function dJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function fJ(e){var t=Ph(),n=(0,v.useRef)(null),r=ax(),i=e.type,a=uJ(e,tJ),o=LT(r,`yAxis`,i),s=(0,v.useMemo)(()=>{if(o!=null)return oJ(oJ({},a),{},{type:o})},[o,a]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(DV(s)):n.current!==s&&t(OV({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(kV(n.current)),null)},[t]),null}function pJ(e){var t=e.yAxisId,n=e.className,r=e.width,i=e.label,a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=Q(mb),c=gb(),l=Ph(),u=`yAxis`,d=Q(e=>uP(e,t)),f=Q(e=>lP(e,t)),p=Q(e=>hP(e,u,t,c)),m=Q(e=>_M(e,t));if((0,v.useLayoutEffect)(()=>{if(!(r!==`auto`||!d||bz(i)||(0,v.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&l(AV({id:t,width:n}))}}},[p,d,l,i,t,r,m]),d==null||f==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=uJ(e,nJ);m.id,m.scale;var g=uJ(m,rJ);return v.createElement(rW,iJ({},h,g,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:d.width,height:d.height,className:af(`recharts-${u} ${u}`,n),viewBox:s,ticks:p,axisType:u,axisId:t}))}var mJ={allowDataOverflow:gM.allowDataOverflow,allowDecimals:gM.allowDecimals,allowDuplicatedCategory:gM.allowDuplicatedCategory,angle:gM.angle,axisLine:JU.axisLine,hide:!1,includeHidden:gM.includeHidden,interval:gM.interval,label:!1,minTickGap:gM.minTickGap,mirror:gM.mirror,orientation:gM.orientation,padding:gM.padding,reversed:gM.reversed,scale:gM.scale,tick:gM.tick,tickCount:gM.tickCount,tickLine:JU.tickLine,tickSize:JU.tickSize,type:gM.type,niceTicks:gM.niceTicks,width:gM.width,yAxisId:0},hJ=v.memo(e=>{var t=gm(e,mJ);return v.createElement(v.Fragment,null,v.createElement(fJ,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),v.createElement(pJ,t))},zq);hJ.displayName=`YAxis`;var gJ=$([(e,t)=>t,rx,$T,cE,NF,FF,mI,fb],EI);function _J(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function vJ(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(_J(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var yJ=nv(`mouseClick`),bJ=uy();bJ.startListening({actionCreator:yJ,effect:(e,t)=>{var n=e.payload,r=gJ(t.getState(),vJ(n));r?.activeIndex!=null&&t.dispatch(RP({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var xJ=nv(`mouseMove`),SJ=uy(),CJ=null,wJ=null,TJ=null;SJ.startListening({actionCreator:xJ,effect:(e,t)=>{var n=e.payload,r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a?.includes(`mousemove`);CJ!==null&&(cancelAnimationFrame(CJ),CJ=null),wJ!==null&&(typeof i!=`number`||!o)&&(clearTimeout(wJ),wJ=null),TJ=vJ(n);var s=()=>{var e=t.getState(),n=SP(e,e.tooltip.settings.shared);if(!TJ){CJ=null,wJ=null;return}if(n===`axis`){var r=gJ(e,TJ);r?.activeIndex==null?t.dispatch(FP()):t.dispatch(LP({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}CJ=null,wJ=null};if(!o){s();return}i===`raf`?CJ=requestAnimationFrame(s):typeof i==`number`&&wJ===null&&(wJ=setTimeout(s,i))}});function EJ(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<<CHILDREN>>`:t}var DJ={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},OJ=wv({name:`rootProps`,initialState:DJ,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??DJ.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),kJ=OJ.reducer,AJ=OJ.actions.updateOptions,jJ=wv({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}});jJ.actions.updatePolarOptions;var MJ=jJ.reducer,NJ=nv(`keyDown`),PJ=nv(`focus`),FJ=nv(`blur`),IJ=uy(),LJ=null,RJ=null,zJ=null;IJ.startListening({actionCreator:NJ,effect:(e,t)=>{zJ=e.payload,LJ!==null&&(cancelAnimationFrame(LJ),LJ=null);var n=t.getState().eventSettings,r=n.throttleDelay,i=n.throttledEvents,a=i===`all`||i.includes(`keydown`);RJ!==null&&(typeof r!=`number`||!a)&&(clearTimeout(RJ),RJ=null);var o=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var n=e.tooltip.keyboardInteraction,r=zJ;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=$P(n,xF(e),YM(e),AF(e)),a=i==null?-1:Number(i),o=!Number.isFinite(a)||a<0,s=FF(e),c=xF(e),l=SP(e,e.tooltip.settings.shared);if(r===`Enter`){if(o)return;var u=yI(e,l,`hover`,String(n.index));t.dispatch(BP({active:!n.active,activeIndex:n.index,activeCoordinate:u}));return}var d=vP(e)===`left-to-right`?1:-1,f=r===`ArrowRight`?1:-1,p;if(o){var m=YM(e),h=AF(e),g=f*d,_=e=>({active:!1,index:String(e),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(p=-1,g>0){for(var v=0;v<c.length;v++)if($P(_(v),c,m,h)!=null){p=v;break}}else for(var y=c.length-1;y>=0;y--)if($P(_(y),c,m,h)!=null){p=y;break}if(p<0)return}else{p=a+f*d;var b=s?.length||c.length;if(b===0||p>=b||p<0)return}var x=yI(e,l,`hover`,String(p));t.dispatch(BP({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}finally{LJ=null,RJ=null}};if(!a){o();return}r===`raf`?LJ=requestAnimationFrame(o):typeof r==`number`&&RJ===null&&(o(),zJ=null,RJ=setTimeout(()=>{zJ?o():(RJ=null,LJ=null)},r))}}),IJ.startListening({actionCreator:PJ,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;if(!r.active&&r.index==null){var i=`0`,a=yI(n,SP(n,n.tooltip.settings.shared),`hover`,String(i));t.dispatch(BP({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),IJ.startListening({actionCreator:FJ,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch(BP({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function BJ(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var VJ=nv(`externalEvent`),HJ=uy(),UJ=new Map,WJ=new Map,GJ=new Map;HJ.startListening({actionCreator:VJ,effect:(e,t)=>{var n=e.payload,r=n.handler,i=n.reactEvent;if(r!=null){var a=i.type,o=BJ(i);GJ.set(a,{handler:r,reactEvent:o});var s=UJ.get(a);s!==void 0&&(cancelAnimationFrame(s),UJ.delete(a));var c=t.getState().eventSettings,l=c.throttleDelay,u=c.throttledEvents,d=u===`all`||u?.includes(a),f=WJ.get(a);f!==void 0&&(typeof l!=`number`||!d)&&(clearTimeout(f),WJ.delete(a));var p=()=>{var e=GJ.get(a);try{if(!e)return;var n=e.handler,r=e.reactEvent,i=t.getState(),o={activeCoordinate:GF(i),activeDataKey:HF(i),activeIndex:BF(i),activeLabel:VF(i),activeTooltipIndex:BF(i),isTooltipActive:KF(i)};n&&n(o,r)}finally{UJ.delete(a),WJ.delete(a),GJ.delete(a)}};if(!d){p();return}if(l===`raf`){var m=requestAnimationFrame(p);UJ.set(a,m)}else if(typeof l==`number`){if(!WJ.has(a)){p();var h=setTimeout(p,l);WJ.set(a,h)}}else p()}}});var KJ=$([$([rF],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(t)}}}),qJ=nv(`touchMove`),JJ=uy(),YJ=null,XJ=null,ZJ=null,QJ=null;JJ.startListening({actionCreator:qJ,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){QJ=BJ(n);var r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a.includes(`touchmove`);YJ!==null&&(cancelAnimationFrame(YJ),YJ=null),XJ!==null&&(typeof i!=`number`||!o)&&(clearTimeout(XJ),XJ=null),ZJ=Array.from(n.touches).map(e=>vJ({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var s=()=>{if(QJ!=null){var e=t.getState(),n=SP(e,e.tooltip.settings.shared);if(n===`axis`){var r=ZJ?.[0];if(r==null){YJ=null,XJ=null;return}var i=gJ(e,r);i?.activeIndex!=null&&t.dispatch(LP({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=QJ.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute(tb),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=_F(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var u=l.dataKey,d=KJ(e,s,c);t.dispatch(NP({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}YJ=null,XJ=null}};if(!o){s();return}i===`raf`?YJ=requestAnimationFrame(s):typeof i==`number`&&XJ===null&&(s(),QJ=null,XJ=setTimeout(()=>{QJ?s():(XJ=null,YJ=null)},i))}}});var $J={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},eY=wv({name:`eventSettings`,initialState:$J,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=Z_(t.payload.throttledEvents))}}}),tY=eY.actions.setEventSettings,nY=eY.reducer,rY=Tg({brush:uH,cartesianAxis:MV,chartData:hL,errorBars:HW,eventSettings:nY,graphicalItems:rV,layout:vy,legend:mx,options:cL,polarAxis:qz,polarOptions:MJ,referenceElements:xH,renderedTicks:MU,rootProps:kJ,tooltip:VP,zIndex:UI}),iY=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return mv({reducer:rY,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([bJ.middleware,SJ.middleware,IJ.middleware,HJ.middleware,JJ.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(fv({type:`raf`}))},devTools:nS.devToolsEnabled&&{serialize:{replacer:EJ},name:`recharts-${t}`}})};function aY(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,i=gb(),a=(0,v.useRef)(null);if(i)return n;a.current??=iY(t,r);var o=jh;return v.createElement(Ax,{context:o,store:a.current},n)}function oY(e){var t=e.layout,n=e.margin,r=Ph(),i=gb();return(0,v.useEffect)(()=>{i||(r(hy(t)),r(my(n)))},[r,i,t,n]),null}var sY=(0,v.memo)(oY,Nx);function cY(e){var t=Ph();return(0,v.useEffect)(()=>{t(AJ(e))},[t,e]),null}var lY=(0,v.memo)(e=>{var t=Ph();return(0,v.useEffect)(()=>{t(tY(e))},[t,e]),null},Nx);function uY(e){var t=e.zIndex,n=e.isPanorama,r=(0,v.useRef)(null),i=Ph();return(0,v.useLayoutEffect)(()=>(r.current&&i(VI({zIndex:t,element:r.current,isPanorama:n})),()=>{i(HI({zIndex:t,isPanorama:n}))}),[i,t,n]),v.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function dY(e){var t=e.children,n=e.isPanorama,r=Q(OI);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return v.createElement(v.Fragment,null,i.map(e=>v.createElement(uY,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>v.createElement(uY,{key:e,zIndex:e,isPanorama:n})))}var fY=[`children`];function pY(e,t){if(e==null)return{};var n,r,i=mY(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function mY(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function hY(){return hY=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hY.apply(null,arguments)}var gY={width:`100%`,height:`100%`,display:`block`},_Y=(0,v.forwardRef)((e,t)=>{var n=tx(),r=nx(),i=wS();if(!xy(n)||!xy(r))return null;var a=e.children,o=e.otherAttributes,s=e.title,c=e.desc,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),v.createElement(yf,hY({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:gY,ref:t}),a)}),vY=e=>{var t=e.children,n=Q(vb);if(!n)return null;var r=n.width,i=n.height,a=n.y,o=n.x;return v.createElement(yf,{width:r,height:i,x:o,y:a},t)},yY=(0,v.forwardRef)((e,t)=>{var n=e.children,r=pY(e,fY);return gb()?v.createElement(vY,null,v.createElement(dY,{isPanorama:!0},n)):v.createElement(_Y,hY({ref:t},r),v.createElement(dY,{isPanorama:!1},n))});function bY(e,t){return TY(e)||wY(e,t)||SY(e,t)||xY()}function xY(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
98
98
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SY(e,t){if(e){if(typeof e==`string`)return CY(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?CY(e,t):void 0}}function CY(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wY(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function TY(e){if(Array.isArray(e))return e}function EY(){var e=Ph(),t=bY((0,v.useState)(null),2),n=t[0],r=t[1],i=Q(Zy);return(0,v.useEffect)(()=>{if(n!=null){var t=n.getBoundingClientRect().width/n.offsetWidth;by(t)&&t!==i&&e(_y(t))}},[n,e,i]),r}function DY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?DY(Object(n),!0).forEach(function(t){kY(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function kY(e,t,n){return(t=AY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AY(e){var t=jY(e,`string`);return typeof t==`symbol`?t:t+``}function jY(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function MY(){return MY=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},MY.apply(null,arguments)}function NY(e,t){return RY(e)||LY(e,t)||FY(e,t)||PY()}function PY(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
99
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FY(e,t){if(e){if(typeof e==`string`)return IY(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?IY(e,t):void 0}}function IY(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function LY(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function RY(e){if(Array.isArray(e))return e}var zY=()=>(EL(),null);function BY(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var VY=(0,v.forwardRef)((e,t)=>{var n=(0,v.useRef)(null),r=NY((0,v.useState)({containerWidth:BY(e.style?.width),containerHeight:BY(e.style?.height)}),2),i=r[0],a=r[1],o=(0,v.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,v.useEffect)(()=>()=>{n.current?.disconnect()},[o]),v.createElement(v.Fragment,null,v.createElement(cx,{width:i.containerWidth,height:i.containerHeight}),v.createElement(`div`,MY({ref:s},e)))}),HY=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=NY((0,v.useState)({containerWidth:BY(n),containerHeight:BY(r)}),2),a=i[0],o=i[1],s=(0,v.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;s(r,i)}},[t,s]);return v.createElement(v.Fragment,null,v.createElement(cx,{width:a.containerWidth,height:a.containerHeight}),v.createElement(`div`,MY({ref:c},e)))}),UY=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return v.createElement(v.Fragment,null,v.createElement(cx,{width:n,height:r}),v.createElement(`div`,MY({ref:t},e)))}),WY=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?v.createElement(HY,MY({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?v.createElement(UY,MY({},e,{width:n,height:r,ref:t})):v.createElement(v.Fragment,null,v.createElement(cx,{width:n,height:r}),v.createElement(`div`,MY({ref:t},e)))});function GY(e){return e?VY:WY}var KY=(0,v.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,o=e.onContextMenu,s=e.onDoubleClick,c=e.onMouseDown,l=e.onMouseEnter,u=e.onMouseLeave,d=e.onMouseMove,f=e.onMouseUp,p=e.onTouchEnd,m=e.onTouchMove,h=e.onTouchStart,g=e.style,_=e.width,y=e.responsive,b=e.dispatchTouchEvents,x=b===void 0||b,S=(0,v.useRef)(null),C=Ph(),w=NY((0,v.useState)(null),2),T=w[0],E=w[1],D=NY((0,v.useState)(null),2),O=D[0],k=D[1],A=EY(),j=Yb(),M=j?.width>0?j.width:_,N=j?.height>0?j.height:i,P=(0,v.useCallback)(e=>{A(e),typeof t==`function`&&t(e),E(e),k(e),e!=null&&(S.current=e)},[A,t,E,k]),F=(0,v.useCallback)(e=>{C(yJ(e)),C(VJ({handler:a,reactEvent:e}))},[C,a]),ee=(0,v.useCallback)(e=>{C(xJ(e)),C(VJ({handler:l,reactEvent:e}))},[C,l]),te=(0,v.useCallback)(e=>{C(FP()),C(VJ({handler:u,reactEvent:e}))},[C,u]),I=(0,v.useCallback)(e=>{C(xJ(e)),C(VJ({handler:d,reactEvent:e}))},[C,d]),ne=(0,v.useCallback)(()=>{C(PJ())},[C]),L=(0,v.useCallback)(()=>{C(FJ())},[C]),R=(0,v.useCallback)(e=>{C(NJ(e.key))},[C]),re=(0,v.useCallback)(e=>{C(VJ({handler:o,reactEvent:e}))},[C,o]),ie=(0,v.useCallback)(e=>{C(VJ({handler:s,reactEvent:e}))},[C,s]),ae=(0,v.useCallback)(e=>{C(VJ({handler:c,reactEvent:e}))},[C,c]),oe=(0,v.useCallback)(e=>{C(VJ({handler:f,reactEvent:e}))},[C,f]),se=(0,v.useCallback)(e=>{C(VJ({handler:h,reactEvent:e}))},[C,h]),ce=(0,v.useCallback)(e=>{x&&C(qJ(e)),C(VJ({handler:m,reactEvent:e}))},[C,x,m]),le=(0,v.useCallback)(e=>{C(VJ({handler:p,reactEvent:e}))},[C,p]),ue=GY(y);return v.createElement(eL.Provider,{value:T},v.createElement(sp.Provider,{value:O},v.createElement(ue,{width:M??g?.width,height:N??g?.height,className:af(`recharts-wrapper`,r),style:OY({position:`relative`,cursor:`default`,width:M,height:N},g),onClick:F,onContextMenu:re,onDoubleClick:ie,onFocus:ne,onBlur:L,onKeyDown:R,onMouseDown:ae,onMouseEnter:ee,onMouseLeave:te,onMouseMove:I,onMouseUp:oe,onTouchEnd:le,onTouchMove:ce,onTouchStart:se,ref:P},v.createElement(zY,null),n)))}),qY=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function JY(e,t){if(e==null)return{};var n,r,i=YY(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function YY(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var XY=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,s=e.style,c=e.compact,l=e.title,u=e.desc,d=df(JY(e,qY));return c?v.createElement(v.Fragment,null,v.createElement(cx,{width:n,height:r}),v.createElement(yY,{otherAttributes:d,title:l,desc:u},a)):v.createElement(KY,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},v.createElement(yY,{otherAttributes:d,title:l,desc:u,ref:t},v.createElement(kH,null,a)))});function ZY(){return ZY=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ZY.apply(null,arguments)}function QY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $Y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?QY(Object(n),!0).forEach(function(t){eX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function eX(e,t,n){return(t=tX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tX(e){var t=nX(e,`string`);return typeof t==`symbol`?t:t+``}function nX(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var rX=$Y({accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,layout:`horizontal`,margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:`none`,syncMethod:`index`},$J),iX=(0,v.forwardRef)(function(e,t){var n=gm(e.categoricalChartProps,rX),r=e.chartName,i=e.defaultTooltipEventType,a=e.validateTooltipEventTypes,o=e.tooltipPayloadSearcher,s=e.categoricalChartProps,c={chartName:r,defaultTooltipEventType:i,validateTooltipEventTypes:a,tooltipPayloadSearcher:o,eventEmitter:void 0};return v.createElement(aY,{preloadedState:{options:c},reduxStoreName:s.id??r},v.createElement(sH,{chartData:s.data}),v.createElement(sY,{layout:n.layout,margin:n.margin}),v.createElement(lY,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),v.createElement(cY,{baseValue:n.baseValue,accessibilityLayer:n.accessibilityLayer,barCategoryGap:n.barCategoryGap,maxBarSize:n.maxBarSize,stackOffset:n.stackOffset,barGap:n.barGap,barSize:n.barSize,syncId:n.syncId,syncMethod:n.syncMethod,className:n.className,reverseStackOrder:n.reverseStackOrder}),v.createElement(XY,ZY({},n,{ref:t})))}),aX=[`axis`,`item`],oX=(0,v.forwardRef)((e,t)=>v.createElement(iX,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:aX,tooltipPayloadSearcher:oL,categoricalChartProps:e,ref:t})),sX=[`axis`],cX=(0,v.forwardRef)((e,t)=>v.createElement(iX,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:sX,tooltipPayloadSearcher:oL,categoricalChartProps:e,ref:t})),lX={fill:`#5a6478`,fontSize:10},uX=`#e6e9ee`,dX={fill:`rgba(13, 24, 70, 0.04)`},fX={fontSize:12,borderRadius:8,border:`1px solid #d6dbe3`,boxShadow:`0 10px 28px -10px rgba(13, 24, 70, 0.28)`,padding:`8px 12px`},pX={brand:`#1c5cab`,sky:`#3ec4ff`,pass:`#1a7f45`,fail:`#c0262d`,warn:`#b25e09`,purple:`#5b4dc7`,navy:`#0f1b3d`,faint:`#7d8698`};pX.navy,pX.brand,pX.purple,pX.sky,pX.warn,pX.pass,pX.fail;var mX=[`#1c5cab`,`#05b8b5`,`#5b4dc7`,`#c45c12`,`#1b883c`,`#8a6cff`,`#d6336c`,`#495057`],hX=`(none)`,gX=200,_X=new Set([`ID`,`Key`,`Title`,`Name`,`State`,`Status`,`Priority`]),vX=e=>e==null||e===``?hX:String(e);function yX(e,t){let n=new Map;for(let r of e)n.set(vX(r[t]),(n.get(vX(r[t]))||0)+1);return[...n].map(([e,t])=>({name:e,value:t})).sort((e,t)=>t.value-e.value||e.name.localeCompare(t.name))}function bX(e,t){return e===t?0:e==null||e===``?1:t==null||t===``?-1:typeof e==`number`&&typeof t==`number`?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0})}function xX(e,t){let n=e=>{let t=e==null?``:String(e);return/[",\n]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t};return[e.columns.map(e=>n(e.label)).join(`,`),...t.map(t=>e.columns.map(e=>n(t[e.key])).join(`,`))].join(`
99
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FY(e,t){if(e){if(typeof e==`string`)return IY(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?IY(e,t):void 0}}function IY(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function LY(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function RY(e){if(Array.isArray(e))return e}var zY=()=>(EL(),null);function BY(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var VY=(0,v.forwardRef)((e,t)=>{var n=(0,v.useRef)(null),r=NY((0,v.useState)({containerWidth:BY(e.style?.width),containerHeight:BY(e.style?.height)}),2),i=r[0],a=r[1],o=(0,v.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,v.useEffect)(()=>()=>{n.current?.disconnect()},[o]),v.createElement(v.Fragment,null,v.createElement(cx,{width:i.containerWidth,height:i.containerHeight}),v.createElement(`div`,MY({ref:s},e)))}),HY=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=NY((0,v.useState)({containerWidth:BY(n),containerHeight:BY(r)}),2),a=i[0],o=i[1],s=(0,v.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;s(r,i)}},[t,s]);return v.createElement(v.Fragment,null,v.createElement(cx,{width:a.containerWidth,height:a.containerHeight}),v.createElement(`div`,MY({ref:c},e)))}),UY=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return v.createElement(v.Fragment,null,v.createElement(cx,{width:n,height:r}),v.createElement(`div`,MY({ref:t},e)))}),WY=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?v.createElement(HY,MY({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?v.createElement(UY,MY({},e,{width:n,height:r,ref:t})):v.createElement(v.Fragment,null,v.createElement(cx,{width:n,height:r}),v.createElement(`div`,MY({ref:t},e)))});function GY(e){return e?VY:WY}var KY=(0,v.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,o=e.onContextMenu,s=e.onDoubleClick,c=e.onMouseDown,l=e.onMouseEnter,u=e.onMouseLeave,d=e.onMouseMove,f=e.onMouseUp,p=e.onTouchEnd,m=e.onTouchMove,h=e.onTouchStart,g=e.style,_=e.width,y=e.responsive,b=e.dispatchTouchEvents,x=b===void 0||b,S=(0,v.useRef)(null),C=Ph(),w=NY((0,v.useState)(null),2),T=w[0],E=w[1],D=NY((0,v.useState)(null),2),O=D[0],k=D[1],A=EY(),j=Yb(),M=j?.width>0?j.width:_,N=j?.height>0?j.height:i,P=(0,v.useCallback)(e=>{A(e),typeof t==`function`&&t(e),E(e),k(e),e!=null&&(S.current=e)},[A,t,E,k]),F=(0,v.useCallback)(e=>{C(yJ(e)),C(VJ({handler:a,reactEvent:e}))},[C,a]),ee=(0,v.useCallback)(e=>{C(xJ(e)),C(VJ({handler:l,reactEvent:e}))},[C,l]),te=(0,v.useCallback)(e=>{C(FP()),C(VJ({handler:u,reactEvent:e}))},[C,u]),I=(0,v.useCallback)(e=>{C(xJ(e)),C(VJ({handler:d,reactEvent:e}))},[C,d]),ne=(0,v.useCallback)(()=>{C(PJ())},[C]),L=(0,v.useCallback)(()=>{C(FJ())},[C]),R=(0,v.useCallback)(e=>{C(NJ(e.key))},[C]),re=(0,v.useCallback)(e=>{C(VJ({handler:o,reactEvent:e}))},[C,o]),ie=(0,v.useCallback)(e=>{C(VJ({handler:s,reactEvent:e}))},[C,s]),ae=(0,v.useCallback)(e=>{C(VJ({handler:c,reactEvent:e}))},[C,c]),oe=(0,v.useCallback)(e=>{C(VJ({handler:f,reactEvent:e}))},[C,f]),se=(0,v.useCallback)(e=>{C(VJ({handler:h,reactEvent:e}))},[C,h]),ce=(0,v.useCallback)(e=>{x&&C(qJ(e)),C(VJ({handler:m,reactEvent:e}))},[C,x,m]),le=(0,v.useCallback)(e=>{C(VJ({handler:p,reactEvent:e}))},[C,p]),ue=GY(y);return v.createElement(eL.Provider,{value:T},v.createElement(sp.Provider,{value:O},v.createElement(ue,{width:M??g?.width,height:N??g?.height,className:af(`recharts-wrapper`,r),style:OY({position:`relative`,cursor:`default`,width:M,height:N},g),onClick:F,onContextMenu:re,onDoubleClick:ie,onFocus:ne,onBlur:L,onKeyDown:R,onMouseDown:ae,onMouseEnter:ee,onMouseLeave:te,onMouseMove:I,onMouseUp:oe,onTouchEnd:le,onTouchMove:ce,onTouchStart:se,ref:P},v.createElement(zY,null),n)))}),qY=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function JY(e,t){if(e==null)return{};var n,r,i=YY(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function YY(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var XY=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,s=e.style,c=e.compact,l=e.title,u=e.desc,d=df(JY(e,qY));return c?v.createElement(v.Fragment,null,v.createElement(cx,{width:n,height:r}),v.createElement(yY,{otherAttributes:d,title:l,desc:u},a)):v.createElement(KY,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},v.createElement(yY,{otherAttributes:d,title:l,desc:u,ref:t},v.createElement(kH,null,a)))});function ZY(){return ZY=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ZY.apply(null,arguments)}function QY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $Y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?QY(Object(n),!0).forEach(function(t){eX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function eX(e,t,n){return(t=tX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tX(e){var t=nX(e,`string`);return typeof t==`symbol`?t:t+``}function nX(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var rX=$Y({accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,layout:`horizontal`,margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:`none`,syncMethod:`index`},$J),iX=(0,v.forwardRef)(function(e,t){var n=gm(e.categoricalChartProps,rX),r=e.chartName,i=e.defaultTooltipEventType,a=e.validateTooltipEventTypes,o=e.tooltipPayloadSearcher,s=e.categoricalChartProps,c={chartName:r,defaultTooltipEventType:i,validateTooltipEventTypes:a,tooltipPayloadSearcher:o,eventEmitter:void 0};return v.createElement(aY,{preloadedState:{options:c},reduxStoreName:s.id??r},v.createElement(sH,{chartData:s.data}),v.createElement(sY,{layout:n.layout,margin:n.margin}),v.createElement(lY,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),v.createElement(cY,{baseValue:n.baseValue,accessibilityLayer:n.accessibilityLayer,barCategoryGap:n.barCategoryGap,maxBarSize:n.maxBarSize,stackOffset:n.stackOffset,barGap:n.barGap,barSize:n.barSize,syncId:n.syncId,syncMethod:n.syncMethod,className:n.className,reverseStackOrder:n.reverseStackOrder}),v.createElement(XY,ZY({},n,{ref:t})))}),aX=[`axis`,`item`],oX=(0,v.forwardRef)((e,t)=>v.createElement(iX,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:aX,tooltipPayloadSearcher:oL,categoricalChartProps:e,ref:t})),sX=[`axis`],cX=(0,v.forwardRef)((e,t)=>v.createElement(iX,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:sX,tooltipPayloadSearcher:oL,categoricalChartProps:e,ref:t})),lX={fill:`#5a6478`,fontSize:10},uX=`#e6e9ee`,dX={fill:`rgba(13, 24, 70, 0.04)`},fX={fontSize:12,borderRadius:8,border:`1px solid #d6dbe3`,boxShadow:`0 10px 28px -10px rgba(13, 24, 70, 0.28)`,padding:`8px 12px`},pX={brand:`#1c5cab`,sky:`#3ec4ff`,pass:`#1a7f45`,fail:`#c0262d`,warn:`#b25e09`,purple:`#5b4dc7`,navy:`#0f1b3d`,faint:`#7d8698`},mX=[`#1c5cab`,`#05b8b5`,`#5b4dc7`,`#c45c12`,`#1b883c`,`#8a6cff`,`#d6336c`,`#495057`],hX=`(none)`,gX=200,_X=new Set([`ID`,`Key`,`Title`,`Name`,`State`,`Status`,`Priority`]),vX=e=>e==null||e===``?hX:String(e);function yX(e,t){let n=new Map;for(let r of e)n.set(vX(r[t]),(n.get(vX(r[t]))||0)+1);return[...n].map(([e,t])=>({name:e,value:t})).sort((e,t)=>t.value-e.value||e.name.localeCompare(t.name))}function bX(e,t){return e===t?0:e==null||e===``?1:t==null||t===``?-1:typeof e==`number`&&typeof t==`number`?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0})}function xX(e,t){let n=e=>{let t=e==null?``:String(e);return/[",\n]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t};return[e.columns.map(e=>n(e.label)).join(`,`),...t.map(t=>e.columns.map(e=>n(t[e.key])).join(`,`))].join(`
100
100
  `)}function SX({c:e,row:t}){let n=t[e.key];if(n==null||n===``)return(0,V.jsx)(`span`,{className:`dim`,children:`—`});if(e.kind===`link`)return(0,V.jsxs)(`a`,{href:K(String(n)),target:`_blank`,rel:`noreferrer`,title:String(n),children:[(0,V.jsx)(jt,{size:12}),` Open`]});if((e.key===`ID`||e.key===`Key`)&&typeof t.Link==`string`)return(0,V.jsx)(`a`,{href:K(t.Link),target:`_blank`,rel:`noreferrer`,children:(0,V.jsx)(`strong`,{children:String(n)})});if(e.kind===`date`)return(0,V.jsx)(`span`,{title:Wi(String(n)),children:Ui(String(n))});if(e.key===`Title`||e.key===`Name`)return(0,V.jsx)(`div`,{className:`cell-name`,children:String(n)});let r=String(n).split(/(?<=[\\/])/);return(0,V.jsx)(V.Fragment,{children:r.map((e,t)=>t?[(0,V.jsx)(`wbr`,{},t),e]:e)})}function CX({d:e}){let[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(gX),l=e.columns.filter(t=>t.key!==`Link`||!e.columns.some(e=>e.key===`ID`||e.key===`Key`)),u=l.some(e=>_X.has(e.key))?e=>_X.has(e.key):e=>l.indexOf(e)<3,d=e=>[e.key===`Title`||e.key===`Name`?`col-title`:``,u(e)?``:`col-more`].filter(Boolean).join(` `)||void 0,f=(n,i)=>{for(let[e,t]of Object.entries(r))if(e!==i&&t&&vX(n[e])!==t)return!1;if(!t.trim())return!0;let a=t.trim().toLowerCase();return e.columns.some(e=>String(n[e.key]??``).toLowerCase().includes(a))},p=(0,v.useMemo)(()=>{let t=e.rows.filter(e=>f(e));return a?[...t].sort((e,t)=>bX(e[a.key],t[a.key])*(a.desc?-1:1)):t},[e.rows,r,t,a]),m=Object.values(r).some(Boolean)||t.trim()!==``,h=(e,t)=>{i(n=>({...n,[e]:n[e]===t?``:t})),c(gX)},g=e=>o(t=>t?.key===e?t.desc?null:{key:e,desc:!0}:{key:e,desc:!1});return e.rows.length?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid metrics`,children:[(0,V.jsx)(co,{label:`Rows`,value:m?(0,V.jsxs)(V.Fragment,{children:[p.length,(0,V.jsxs)(`small`,{children:[` / `,e.rows.length]})]}):e.rows.length,sub:e.total>e.rows.length?`${e.total} matched; ${e.rows.length} read`:m?`match the filters`:`from ${e.sources.join(`, `)}`,icon:dn,color:`blue`}),e.filters.slice(0,3).map((e,t)=>{let n=yX(p,e)[0];return(0,V.jsx)(co,{label:e,value:yX(p,e).length,sub:n?`most: ${n.name} (${n.value})`:void 0,icon:t===0?Dn:Xt,color:[`purple`,`amber`,`green`][t]},e)})]}),e.filters.length?(0,V.jsxs)(`div`,{className:`card cat-bar data-filters`,children:[(0,V.jsxs)(`div`,{className:`suite-search`,children:[(0,V.jsx)(Lr,{size:12,className:`suite-search-icon`}),(0,V.jsx)(`input`,{className:`field`,placeholder:`Search every column…`,value:t,onChange:e=>n(e.target.value)})]}),e.filters.map(t=>(0,V.jsxs)(`select`,{className:`field`,value:r[t]||``,onChange:e=>h(t,e.target.value),"aria-label":t,children:[(0,V.jsxs)(`option`,{value:``,children:[t,` (all)`]}),yX(e.rows.filter(e=>f(e,t)),t).map(e=>(0,V.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.value,`)`]},e.name))]},t)),m?(0,V.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>(i({}),n(``)),children:[(0,V.jsx)(ji,{size:13}),` Clear`]}):null]}):null,e.filters.length?(0,V.jsx)(`div`,{className:`grid cols-2`,children:e.filters.slice(0,4).map((e,t)=>{let n=yX(p,e).slice(0,10);return(0,V.jsxs)(`div`,{className:`card`,children:[(0,V.jsxs)(`h3`,{className:`card-cap`,children:[`By `,e]}),(0,V.jsx)(Zb,{width:`100%`,height:Math.max(120,n.length*26+20),children:(0,V.jsxs)(oX,{data:n,layout:`vertical`,margin:{top:4,right:16,left:8,bottom:0},children:[(0,V.jsx)(DW,{stroke:`#edf0f5`,horizontal:!1}),(0,V.jsx)(eJ,{type:`number`,allowDecimals:!1,tick:lX,axisLine:!1,tickLine:!1}),(0,V.jsx)(hJ,{type:`category`,dataKey:`name`,width:130,tick:lX,axisLine:!1,tickLine:!1}),(0,V.jsx)(UL,{cursor:{fill:`rgba(13, 24, 70, 0.04)`},contentStyle:fX,formatter:e=>[e,`Rows`]}),(0,V.jsx)(Nq,{dataKey:`value`,name:`Rows`,radius:[0,3,3,0],isAnimationActive:!1,cursor:`pointer`,onClick:t=>t?.name&&h(e,t.name),children:n.map(n=>(0,V.jsx)(WL,{fill:mX[t%mX.length],fillOpacity:r[e]&&r[e]!==n.name?.35:1},n.name))})]})})]},e)})}):null,(0,V.jsxs)(`div`,{className:`section-title`,style:{marginTop:18},children:[(0,V.jsx)(`h2`,{children:e.name}),(0,V.jsxs)(`span`,{className:`dim`,children:[p.length===e.rows.length?W(e.rows.length,`row`):`${p.length} of ${W(e.rows.length,`row`)}`,e.note?` · ${e.note}`:``]})]}),p.length===0?(0,V.jsxs)(`div`,{className:`card empty-state`,children:[(0,V.jsx)(Xt,{size:26}),(0,V.jsx)(`h3`,{children:`Nothing matches`}),(0,V.jsx)(`p`,{children:`No row matches the search and filters. Clear one to see more.`})]}):(0,V.jsxs)(`div`,{className:`card`,children:[(0,V.jsx)(`div`,{className:`table-wrap`,children:(0,V.jsxs)(`table`,{className:`data data-grid`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:l.map(e=>{let t=a?.key===e.key?a.desc?ne:oe:ie;return(0,V.jsx)(`th`,{className:d(e),"aria-sort":a?.key===e.key?a.desc?`descending`:`ascending`:void 0,children:(0,V.jsxs)(`button`,{type:`button`,className:`th-sort`,onClick:()=>g(e.key),children:[e.label,(0,V.jsx)(t,{size:11})]})},e.key)})})}),(0,V.jsx)(`tbody`,{children:p.slice(0,s).map((e,t)=>(0,V.jsx)(`tr`,{children:l.map(t=>(0,V.jsx)(`td`,{className:u(t)?void 0:`col-more`,children:(0,V.jsx)(SX,{c:t,row:e})},t.key))},String(e.Key??e.ID??t)))})]})}),p.length>s?(0,V.jsxs)(`p`,{className:`foot-note`,children:[`Showing `,s,` of `,p.length,`.`,` `,(0,V.jsxs)(`button`,{type:`button`,className:`link-btn`,onClick:()=>c(e=>e+gX),children:[`Show `,Math.min(gX,p.length-s),` more`]})]}):null]}),(0,V.jsx)(`div`,{className:`data-actions`,children:(0,V.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>ya(`${e.csv||`data.csv`}`.replace(/\.csv$/,m?`-filtered.csv`:`.csv`),xX(e,p),`text/csv`),children:[(0,V.jsx)(Ut,{size:14}),`Export CSV`,m?` (filtered)`:``]})})]}):(0,V.jsxs)(`div`,{className:`card empty-state`,children:[(0,V.jsx)(yn,{size:26}),(0,V.jsx)(`h3`,{children:`No rows`}),(0,V.jsx)(`p`,{children:`The source returned an empty list: nothing matched its query when the report was written.`})]})}function wX({data:e}){let t=e.report,[n,r]=(0,v.useState)(`0`),i=t.datasets[Number(n)]||t.datasets[0];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(eo,{title:e.title,subtitle:`Built by ForgeQE from ${W(t.sources.length,`tool result`)} on ${Wi(e.generatedAt)}, not written by the model`,actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>window.print(),children:[(0,V.jsx)(xr,{size:14}),`Print`]}),(0,V.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>ya(`${e.id||`report`}.json`,JSON.stringify(t,null,2),`application/json`),children:[(0,V.jsx)(Lt,{size:14}),`Export JSON`]})]})}),t.summaryHtml?(0,V.jsxs)(`div`,{className:`card report-summary`,children:[(0,V.jsx)(`h3`,{className:`card-cap`,children:`Summary`}),(0,V.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t.summaryHtml}})]}):null,t.datasets.length>1?(0,V.jsx)(to,{items:t.datasets.map((e,t)=>({id:String(t),label:e.name,icon:Ct,count:e.rows.length})),value:n,onChange:r}):null,i?(0,V.jsx)(CX,{d:i},n):null]})}function TX({data:e}){let t=e.report;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(eo,{title:`Sources`,subtitle:`The tool calls the report's rows came from, each with its raw result`}),t.sources.length===0?(0,V.jsxs)(`div`,{className:`card empty-state`,children:[(0,V.jsx)(Vt,{size:26}),(0,V.jsx)(`h3`,{children:`No sources`}),(0,V.jsx)(`p`,{children:`This report has no tool results behind it.`})]}):(0,V.jsx)(`div`,{className:`card`,children:(0,V.jsx)(`div`,{className:`table-wrap`,children:(0,V.jsxs)(`table`,{className:`data`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{children:`Evidence`}),(0,V.jsx)(`th`,{className:`col-call`,children:`Call`}),(0,V.jsx)(`th`,{children:`When`}),(0,V.jsx)(`th`,{children:`Rows`}),(0,V.jsx)(`th`,{children:`Used in`}),(0,V.jsx)(`th`,{})]})}),(0,V.jsx)(`tbody`,{children:t.sources.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`div`,{className:`cell-name`,children:e.id})}),(0,V.jsx)(`td`,{children:(0,V.jsx)(`code`,{children:e.call})}),(0,V.jsx)(`td`,{children:Wi(e.at)}),(0,V.jsx)(`td`,{children:e.rows===null?`—`:e.rows}),(0,V.jsx)(`td`,{children:t.datasets.filter(t=>t.sources.includes(e.id)).map(e=>e.name).join(`, `)||`—`}),(0,V.jsx)(`td`,{children:(0,V.jsxs)(`a`,{href:K(e.file),target:`_blank`,rel:`noreferrer`,children:[(0,V.jsx)(Lt,{size:12}),` Raw result`]})})]},e.id))})]})})})]})}function EX({title:e,kicker:t,badges:n,position:r,onPrev:i,onNext:a,onClose:o,children:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=e=>{document.querySelector(`.lightbox`)||(e.key===`Escape`&&o(),e.key===`ArrowLeft`&&i&&i(),e.key===`ArrowRight`&&a&&a())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o,i,a]),(0,v.useEffect)(()=>{c.current?.focus()},[]),(0,v.useEffect)(()=>{l.current?.scrollTo({top:0})},[e]),(0,V.jsx)(`div`,{className:`side-layer`,onMouseDown:e=>e.target===e.currentTarget&&o(),children:(0,V.jsxs)(`aside`,{className:`side-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":typeof e==`string`?e:`Details`,tabIndex:-1,ref:c,children:[(0,V.jsxs)(`header`,{className:`sp-head`,children:[(0,V.jsxs)(`div`,{className:`sp-titles`,children:[t?(0,V.jsx)(`p`,{className:`sp-kicker`,children:t}):null,(0,V.jsx)(`h2`,{className:`sp-title`,children:e}),n?(0,V.jsx)(`div`,{className:`sp-badges`,children:n}):null]}),(0,V.jsxs)(`div`,{className:`sp-tools`,children:[r?(0,V.jsx)(`span`,{className:`sp-pos`,children:r}):null,(0,V.jsx)(`button`,{type:`button`,className:`sp-btn`,onClick:i,disabled:!i,"aria-label":`Previous`,children:(0,V.jsx)(qe,{size:16})}),(0,V.jsx)(`button`,{type:`button`,className:`sp-btn`,onClick:a,disabled:!a,"aria-label":`Next`,children:(0,V.jsx)(Ye,{size:16})}),(0,V.jsx)(`button`,{type:`button`,className:`sp-btn`,onClick:o,"aria-label":`Close`,children:(0,V.jsx)(ji,{size:16})})]})]}),(0,V.jsx)(`div`,{className:`sp-body`,ref:l,children:s})]})})}var DX=e=>e?.count||0,OX=e=>e.late?DX(e.late):DX(e.missing),kX=e=>e==null?`null`:typeof e==`string`?e:JSON.stringify(e);function AX(e){return e.error||!e.ok?`fail`:e.ready?.stale||DX(e.in_flight)?`warn`:`pass`}var jX={fail:`Broken`,warn:`Check`,pass:`Healthy`,brand:``};function MX(e){if(e.error)return[e.error];let t=[];return!e.late&&DX(e.missing)&&t.push(`${DX(e.missing)} missing`),DX(e.late)&&t.push(`${DX(e.late)} late${e.late?.sla_seconds?` past the ${NX(e.late.sla_seconds)} SLA`:``}`),e.wrong?.rows&&t.push(`${W(e.wrong.rows,`row`)} with wrong values (${so(Object.keys(e.wrong.by_column),3)})`),DX(e.duplicates)&&t.push(`${DX(e.duplicates)} duplicated`),DX(e.extra)&&t.push(`${DX(e.extra)} not in the source`),t}function NX(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function PX(e){let t=new Map(e.results.map(e=>[e.flow,e])),n=e.flows.map(e=>({...e,result:t.get(e.name)})).filter(e=>e.result),r=[...new Set(n.flatMap(e=>[e.from,e.to]))],i=new Map(r.map(e=>[e,n.filter(t=>t.to===e)])),a=new Set,o=new Map,s=e=>{o.set(e,`open`);for(let t of n.filter(t=>t.from===e))o.get(t.to)===`open`?a.add(t.name):o.has(t.to)||s(t.to);o.set(e,`done`)};for(let e of[...r.filter(e=>!i.get(e).length),...r])o.has(e)||s(e);let c=new Map(r.map(e=>[e,0]));for(let e=0;e<r.length;e++)for(let e of n)a.has(e.name)||c.set(e.to,Math.max(c.get(e.to),c.get(e.from)+1));let l=Math.max(0,...c.values()),u=Array.from({length:l+1},(e,t)=>r.filter(e=>c.get(e)===t).sort()),d=e=>({fail:0,warn:1,pass:2,brand:3})[e],f=e=>n.filter(t=>c.get(t.from)===e).sort((e,t)=>d(AX(e.result))-d(AX(t.result))||e.name.localeCompare(t.name));return{hops:n,nodes:r,into:i,columns:u,hopColumns:Array.from({length:n.some(e=>c.get(e.from)===l)?l+1:l},(e,t)=>f(t))}}function FX({data:e}){let t=e.flows,[n,r]=(0,v.useState)(`all`),[i,a]=(0,v.useState)(null),o=(0,v.useMemo)(()=>PX(t),[t]),s=t.results,c=s.filter(e=>AX(e)===`fail`),l=e=>n===`all`||(n===`broken`?AX(e)===`fail`:AX(e)!==`fail`),u=o.hopColumns.flat().filter(e=>l(e.result)),d=u.findIndex(e=>e.name===i),f=d>=0?u[d]:null,p=(0,V.jsx)(eo,{title:`Data flows`,subtitle:(0,V.jsxs)(V.Fragment,{children:[`Checked `,Wi(t.checkedAt),`: `,W(s.length,`flow`),` between `,W(o.nodes.length,`system`),t.azureDevOps?(0,V.jsxs)(V.Fragment,{children:[` · recorded as Azure DevOps test run `,K(t.azureDevOps.url)?(0,V.jsx)(`a`,{href:K(t.azureDevOps.url),target:`_blank`,rel:`noreferrer`,children:t.azureDevOps.id}):t.azureDevOps.id]}):null]}),actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>window.print(),children:[(0,V.jsx)(xr,{size:14}),`Print`]}),(0,V.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>ya(`${e.id||`flows`}.json`,JSON.stringify(t,null,2),`application/json`),children:[(0,V.jsx)(Lt,{size:14}),`Export JSON`]})]})});if(!s.length)return(0,V.jsxs)(V.Fragment,{children:[p,(0,V.jsxs)(`div`,{className:`card empty-state`,children:[(0,V.jsx)(Di,{size:26}),(0,V.jsx)(`h3`,{children:`No flows`}),(0,V.jsx)(`p`,{children:`No flows were checked.`})]})]});let m=s.reduce((e,t)=>e+(t.source_rows||0),0),h=s.reduce((e,t)=>e+OX(t),0),g=s.reduce((e,t)=>e+(t.wrong?.rows||0),0),_=s.reduce((e,t)=>e+DX(t.duplicates),0),y=c.length?`${c.length} of ${W(s.length,`flow`)} ${c.length===1?`is`:`are`} broken: ${so(c.map(e=>e.flow),3)}.`:`All ${W(s.length,`flow`)} are healthy: every row arrived, on time, with the values the mappings expect.`,b=[...c.slice(0,5).map(e=>({tone:`fail`,text:`${e.flow}: ${oo(MX(e))}.`})),...c.length>5?[{tone:`fail`,text:`And ${W(c.length-5,`more broken flow`)}: open them on the map.`}]:[],...s.filter(e=>e.ready?.stale).map(e=>({tone:`warn`,text:`${e.flow}: no run of the job finished after the check began, so its rows are from the last run.`})),...s.filter(e=>DX(e.in_flight)).map(e=>({tone:`warn`,text:`${e.flow}: ${DX(e.in_flight)} still within the SLA, not counted as late.`})),...s.filter(e=>e.truncated).map(e=>({tone:`warn`,text:`${e.flow}: ${e.truncated}.`}))],x=[{label:`Flows`,value:s.length},{label:`Healthy`,value:s.length-c.length,tone:c.length?void 0:`pass`},{label:`Rows compared`,value:m.toLocaleString()},{label:`Missing or late`,value:h,tone:h?`fail`:void 0},{label:`Wrong`,value:g,tone:g?`fail`:void 0},{label:`Duplicated`,value:_,tone:_?`fail`:void 0}],S=o.columns.length+o.hopColumns.length;return(0,V.jsxs)(V.Fragment,{children:[p,(0,V.jsx)(no,{lead:y,findings:b,figures:x}),(0,V.jsxs)(`section`,{className:`panel`,children:[(0,V.jsx)(Y,{icon:Di,tone:`brand`,title:`Flow map`,note:`Systems from left to right in the order data reaches them; a hop opens its details`}),(0,V.jsx)(ro,{items:[{id:`all`,label:`All`,count:s.length},{id:`broken`,label:`Broken`,count:c.length},{id:`healthy`,label:`Healthy`,count:s.length-c.length}],value:n,onChange:r}),(0,V.jsx)(`div`,{className:`flow-map`,style:{"--fm-cols":S},children:Array.from({length:S},(e,t)=>t%2==0?(0,V.jsx)(`div`,{className:`fm-col`,children:o.columns[t/2].map(e=>{let t=o.into.get(e).map(e=>AX(e.result));return(0,V.jsx)(IX,{node:e,tone:t.includes(`fail`)?`fail`:t.includes(`warn`)?`warn`:`pass`,feeds:o.hops.filter(t=>t.from===e).length,fedBy:t.length},e)})},t):(0,V.jsx)(`div`,{className:`fm-col fm-hops`,children:o.hopColumns[(t-1)/2].filter(e=>l(e.result)).map(e=>(0,V.jsx)(LX,{r:e.result,sla:e.sla,onOpen:()=>a(e.name)},e.name))},t))})]}),f?(0,V.jsx)(EX,{kicker:`${f.from} → ${f.to}`,title:f.name,badges:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`status-pill ${AX(f.result)}`,children:jX[AX(f.result)]}),(0,V.jsx)(`span`,{className:`status-pill brand`,children:f.mode}),f.sla?(0,V.jsxs)(`span`,{className:`status-pill brand`,children:[`SLA `,f.sla]}):null]}),position:`${d+1} of ${u.length}`,onPrev:d>0?()=>a(u[d-1].name):void 0,onNext:d<u.length-1?()=>a(u[d+1].name):void 0,onClose:()=>a(null),children:(0,V.jsx)(zX,{r:f.result,columns:f.columns})}):null]})}function IX({node:e,tone:t,feeds:n,fedBy:r}){let i=/^api:([^/]+)(\/.*)?$/.exec(e),[a,...o]=e.split(`.`),s=i?i[2]||i[1]:o.length?o.join(`.`):e,c=i?`${i[1]} API`:o.length?a:``;return(0,V.jsxs)(`div`,{className:`fm-card ${t}`,children:[(0,V.jsx)(`div`,{className:`fm-top`,children:(0,V.jsx)(`strong`,{children:s})}),c?(0,V.jsx)(`span`,{className:`fm-meta`,children:c}):null,(0,V.jsx)(`span`,{className:`fm-meta`,children:[r?`fed by ${r}`:`source`,n?`feeds ${n}`:``].filter(Boolean).join(` · `)})]})}function LX({r:e,sla:t,onOpen:n}){let r=AX(e);return(0,V.jsxs)(`button`,{type:`button`,className:`fm-card fm-hop ${r}`,onClick:n,title:`${e.flow}: ${e.from} → ${e.to}`,children:[(0,V.jsxs)(`div`,{className:`fm-top`,children:[(0,V.jsx)(`strong`,{children:e.flow}),(0,V.jsx)(`span`,{className:`fm-state`,children:jX[r]})]}),(0,V.jsxs)(`span`,{className:`fm-meta`,children:[(0,V.jsxs)(`span`,{className:`fm-to`,children:[(0,V.jsx)(R,{size:11}),` `,e.to]}),` `,`· `,e.mode,t?` · SLA ${t}`:``]}),e.error?(0,V.jsx)(`span`,{className:`fm-nums`,children:`Could not check`}):(0,V.jsxs)(`span`,{className:`fm-nums`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{children:(e.matched??0).toLocaleString()}),`/`,(e.source_rows??0).toLocaleString(),` arrived`]}),!e.late&&DX(e.missing)?(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`fail`,children:DX(e.missing)}),` missing`]}):null,DX(e.late)?(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`fail`,children:DX(e.late)}),` late`]}):null,e.wrong?.rows?(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`fail`,children:e.wrong.rows}),` wrong`]}):null,DX(e.duplicates)?(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`fail`,children:DX(e.duplicates)}),` duplicated`]}):null]})]})}var RX=(e,t)=>`${e.map(String).join(`, `)}${t>e.length?` and ${t-e.length} more`:``}`;function zX({r:e,columns:t}){return(0,V.jsxs)(`div`,{className:`sp-content`,children:[e.error?(0,V.jsx)(ko,{tone:`fail`,title:`Could not check`,children:(0,V.jsx)(`p`,{children:e.error})}):null,e.note||e.truncated||e.window?(0,V.jsx)(ko,{tone:`warn`,title:`Read this first`,children:[e.note,e.truncated,e.window].filter(Boolean).map(e=>(0,V.jsx)(`p`,{children:e},e))}):null,(0,V.jsx)(Do,{icon:dn,title:`Rows`,children:(0,V.jsx)(Oo,{items:[[`In the source`,e.source_rows?.toLocaleString()],[`Arrived`,e.matched?.toLocaleString()],[`Missing`,!e.late&&DX(e.missing)||void 0],[`Late`,DX(e.late)||void 0],[`In flight`,DX(e.in_flight)||void 0],[`Wrong`,e.wrong?.rows||void 0],[`Duplicated`,DX(e.duplicates)||void 0],[`Not in the source`,DX(e.extra)||void 0],[`Columns compared`,t],[`Batch run finished`,e.ready?e.ready.finished?`${Wi(e.ready.finished)}${e.ready.stale?` (before the check)`:``}`:`never`:void 0]]})}),DX(e.missing)||DX(e.late)||DX(e.in_flight)||DX(e.extra)?(0,V.jsx)(Do,{icon:Cn,title:`Keys`,children:(0,V.jsx)(Oo,{items:[[`Missing`,!e.late&&DX(e.missing)?RX(e.missing.keys,DX(e.missing)):void 0],[`Late`,DX(e.late)?RX(e.late.keys,DX(e.late)):void 0],[`In flight`,DX(e.in_flight)?RX(e.in_flight.keys,DX(e.in_flight)):void 0],[`Not in the source`,DX(e.extra)?RX(e.extra.keys,DX(e.extra)):void 0]]})}):null,e.wrong?.rows?(0,V.jsx)(Do,{icon:_i,title:`Wrong values`,aside:Object.entries(e.wrong.by_column).map(([e,t])=>`${e} ${t}`).join(` · `),children:(0,V.jsx)(`div`,{className:`table-wrap`,children:(0,V.jsxs)(`table`,{className:`data`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{children:`Key`}),(0,V.jsx)(`th`,{children:`Column`}),(0,V.jsx)(`th`,{children:`Expected`}),(0,V.jsx)(`th`,{children:`Found`})]})}),(0,V.jsx)(`tbody`,{children:e.wrong.examples.map((e,t)=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:String(e.key)}),(0,V.jsx)(`td`,{children:e.column}),(0,V.jsx)(`td`,{children:(0,V.jsx)(`code`,{children:kX(e.expected)})}),(0,V.jsx)(`td`,{children:(0,V.jsx)(`code`,{children:kX(e.target)})})]},t))})]})})}):null,DX(e.duplicates)?(0,V.jsx)(Do,{icon:yt,title:`Duplicates`,children:(0,V.jsx)(Oo,{items:e.duplicates.keys.map(e=>[`Key ${e.key}`,`${e.times} copies`])})}):null]})}function BX(e){return e.kind===`flows`?e.flows?.traces||[]:e.cases.filter(e=>e.trace).map(e=>({...e.trace,caseId:e.id}))}function VX({data:e,onOpenCase:t}){let n=BX(e);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(eo,{title:`Records followed`,subtitle:e.kind===`flows`?`Followed ${Wi(e.flows.checkedAt)}: ${W(n.length,`record`)} through the data flows`:`${W(n.length,`record`)} the cases made, followed through the data flows`,actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>window.print(),children:[(0,V.jsx)(xr,{size:14}),`Print`]}),(0,V.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>ya(`${e.id||`traces`}.json`,JSON.stringify(n,null,2),`application/json`),children:[(0,V.jsx)(Lt,{size:14}),`Export JSON`]})]})}),n.length===0?(0,V.jsxs)(`div`,{className:`card empty-state`,children:[(0,V.jsx)(Nr,{size:26}),(0,V.jsx)(`h3`,{children:`No records`}),(0,V.jsx)(`p`,{children:`No record was followed through the flows.`})]}):n.map((e,n)=>(0,V.jsx)(HX,{t:e,onOpenCase:t},n))]})}function HX({t:e,onOpenCase:t}){let n=e.hops[0],r=e.hops.find(e=>!e.ok),i=r&&(r.arrived===!1||r.found_in_source===!1),a=e.error&&!e.hops.length?e.error:r?`${i?`Stopped`:`Different`} at ${r.to}: ${UX(r)}`:`Arrived at every hop as the mappings expect`;return(0,V.jsxs)(`section`,{className:`panel`,children:[(0,V.jsx)(Y,{icon:Nr,tone:e.ok?`pass`:`fail`,title:n?`Key ${n.key} from ${n.from}`:`Key ${kX(e.key)}`,note:e.caseId?(0,V.jsxs)(V.Fragment,{children:[t?(0,V.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>t(e.caseId),children:e.caseId}):e.caseId,` · ${a}`]}):a}),e.hops.length?(0,V.jsxs)(`div`,{className:`fm-track`,children:[n?(0,V.jsx)(IX,{node:n.from,tone:`pass`,feeds:1,fedBy:0}):null,e.hops.map((e,t)=>(0,V.jsx)(WX,{h:e},t))]}):null]})}function UX(e){if(e.found_in_source===!1)return`not in the source`;if(e.arrived===!1)return`did not arrive${e.waited?` within ${e.waited}s`:``}`;let t=[e.differences?.length?`${W(e.differences.length,`column`)} ${e.differences.length===1?`differs`:`differ`}`:``,Number(e.copies)>1?`${e.copies} copies`:``].filter(Boolean);return t.length?`arrived; ${t.join(`, `)}`:`arrived`}function WX({h:e}){let t=e.ok?`pass`:`fail`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`fm-card fm-hop ${t}`,children:[(0,V.jsxs)(`div`,{className:`fm-top`,children:[(0,V.jsx)(`strong`,{children:e.flow}),(0,V.jsx)(`span`,{className:`fm-state`,children:e.ok?`Arrived`:e.arrived===!1||e.found_in_source===!1?`Stopped`:`Different`})]}),(0,V.jsxs)(`span`,{className:`fm-meta`,children:[(0,V.jsxs)(`span`,{className:`fm-to`,children:[(0,V.jsx)(R,{size:11}),` `,e.to]}),` `,`· key `,String(e.key)]}),(0,V.jsx)(`span`,{className:`fm-nums`,children:UX(e)}),e.differences?.length?(0,V.jsx)(`ul`,{className:`fm-diffs`,children:e.differences.map(e=>(0,V.jsxs)(`li`,{children:[e.column,`: expected `,(0,V.jsx)(`code`,{children:kX(e.expected)}),`, found `,(0,V.jsx)(`code`,{children:kX(e.target)})]},e.column))}):null]}),e.arrived!==!1&&e.found_in_source!==!1?(0,V.jsx)(IX,{node:e.to,tone:t,feeds:0,fedBy:1}):null]})}var GX=10,KX=10,qX=40;function JX({r:e,max:t,failed:n}){let r=Pa(e),i=r.fresh+r.cached+r.write+r.output;return(0,V.jsx)(`span`,{className:`ug-track`,children:(0,V.jsx)(`span`,{className:`split-bar ug-bar${n?` ug-failed`:``}`,style:{width:`${t?Math.max(1,100*i/t):0}%`},children:n?(0,V.jsx)(`i`,{className:`ug-fail`,style:{flexGrow:1}}):(0,V.jsxs)(V.Fragment,{children:[r.fresh?(0,V.jsx)(`i`,{className:`fresh`,style:{flexGrow:r.fresh}}):null,r.cached?(0,V.jsx)(`i`,{className:`cached`,style:{flexGrow:r.cached}}):null,r.write?(0,V.jsx)(`i`,{className:`write`,style:{flexGrow:r.write}}):null,r.output?(0,V.jsx)(`i`,{className:`output`,style:{flexGrow:r.output}}):null]})})})}function YX({k:e,total:t}){let n=(e,n,r)=>(0,V.jsxs)(`span`,{title:`${n}: ${r.toLocaleString()} tokens, ${q(r,t)}%`,children:[(0,V.jsx)(`i`,{className:`sw ${e}`}),n,` `,(0,V.jsx)(`b`,{children:U(r)})]},e);return(0,V.jsxs)(`span`,{className:`ug-legend`,children:[n(`fresh`,`New input`,e.fresh),n(`cached`,`From cache`,e.cached),e.write?n(`write`,`Written to cache`,e.write):null,n(`output`,`Output`,e.output)]})}function XX({title:e,icon:t,note:n,rows:r}){let i=Math.max(...r.map(e=>e.tokens)),a=Math.min(22,Math.max(6,...r.slice(0,12).map(e=>(e.name||`unnamed`).length)));return(0,V.jsxs)(`section`,{className:`panel ug-group`,style:{"--ug-name":`${a+1}ch`},children:[(0,V.jsx)(Y,{icon:t,tone:`brand`,title:e,note:n}),(0,V.jsx)(`div`,{className:`hbar-list`,children:r.slice(0,12).map(e=>(0,V.jsxs)(`div`,{className:`hbar-row`,title:`${e.name||`unnamed`}: ${X(e.calls,`call`)}, ${U(e.input)} in (${U(e.cached)} cached), ${U(e.output)} out`,children:[(0,V.jsx)(`span`,{className:`hbar-name`,children:e.name||`unnamed`}),(0,V.jsx)(JX,{r:e,max:i}),(0,V.jsxs)(`span`,{className:`hbar-n`,children:[(0,V.jsx)(`b`,{title:Zi(La(e)),children:Xi(La(e))}),(0,V.jsx)(`small`,{children:U(e.tokens)})]})]},e.name))}),r.length>12?(0,V.jsxs)(`p`,{className:`ov-caption ug-more`,children:[`and `,X(r.length-12,`more`),`, on the Breakdown page`]}):null]})}var ZX=e=>e>=100?`fail`:e>=80?`warn`:`pass`;function QX(e,t){let n=e.usage?.budget;if(!n)return[];let r=(e.generatedAt||new Date().toISOString()).slice(0,10),i=e.usage.history,a=[];if(n.run&&t.some(e=>e.runId&&e.amount!==void 0)){let r=new Map;for(let e of t)e.runId&&e.amount!==void 0&&r.set(e.runId,(r.get(e.runId)||0)+e.amount);let i=Math.max(0,...r.values());a.push({period:`run`,label:e.kind===`run`?`This run`:`Largest run`,spent:i,limit:n.run})}return n.day&&a.push({period:`day`,label:`Today`,spent:i.filter(e=>e.day===r).reduce((e,t)=>e+t.amount,0),limit:n.day}),n.month&&a.push({period:`month`,label:`This month`,spent:i.filter(e=>e.day.slice(0,7)===r.slice(0,7)).reduce((e,t)=>e+t.amount,0),limit:n.month}),a}function $X({budgets:e,currency:t}){return(0,V.jsxs)(`section`,{className:`panel ug-budget`,children:[(0,V.jsx)(Y,{icon:ht,tone:ZX(Math.max(...e.map(e=>q(e.spent,e.limit)))),title:`Budgets`,note:`in forgeqe.yaml`}),(0,V.jsx)(`div`,{className:`hbar-list`,children:e.map(e=>{let n=q(e.spent,e.limit);return(0,V.jsxs)(`div`,{className:`hbar-row`,title:`${e.label}: ${G(e.spent,t)} of the ${G(e.limit,t)} ${e.period} budget`,children:[(0,V.jsxs)(`span`,{className:`hbar-name`,children:[e.label,` `,(0,V.jsx)(`b`,{children:G(e.spent,t)})]}),(0,V.jsx)(`span`,{className:`hbar-track`,children:(0,V.jsx)(`span`,{className:`hbar-fill`,style:{width:`${Math.min(100,n)}%`},children:(0,V.jsx)(`i`,{className:ZX(n),style:{flexGrow:1}})})}),(0,V.jsxs)(`span`,{className:`hbar-n`,children:[(0,V.jsxs)(`b`,{className:n>=100?`fail-text`:void 0,children:[Math.round(n),`%`]}),(0,V.jsxs)(`small`,{children:[`of `,G(e.limit,t)]})]})]},e.period)})}),(0,V.jsx)(`p`,{className:`ov-caption ug-more`,children:`ForgeQE warns at 80%, 90% and 100% and stops nothing.`})]})}function eZ({groups:e,idle:t,k:n,kTotal:r,wide:i}){let a=io(e,GX),o=e[0]?.tokens||0;return(0,V.jsxs)(`section`,{className:`panel ${i?`ov-s12`:`ov-s7`} ug-cases`,"aria-labelledby":`ug-cases-h`,children:[(0,V.jsxs)(`div`,{className:`ug-head`,children:[(0,V.jsx)(Y,{icon:Ct,tone:`brand`,title:(0,V.jsx)(`span`,{id:`ug-cases-h`,children:`Tokens by case`})}),(0,V.jsx)(YX,{k:n,total:r})]}),(0,V.jsx)(`div`,{className:`ug-rows`,children:a.shown.map(e=>(0,V.jsxs)(`div`,{className:`ug-row`,title:`${e.name}: ${e.tokens.toLocaleString()} tokens in ${X(e.calls,`call`)}${e.priced?`, ${Xi(La(e))}`:``}${e.failed?`; ${X(e.failed,`call`)} failed`:``}`,children:[(0,V.jsx)(`span`,{className:`ug-name`,children:e.name}),(0,V.jsx)(JX,{r:e,max:o}),(0,V.jsx)(`span`,{className:`ug-n`,children:U(e.tokens)})]},e.key))}),(0,V.jsx)(ao,{...a,label:`Tokens by case pages`}),t.length?(0,V.jsx)(`p`,{className:`ov-caption`,title:t.length>3?t.join(`, `):void 0,children:t.length===1?`${t[0]} used no tokens.`:`${t.length.toLocaleString()} cases used no tokens: ${so(t,3)}.`}):null]})}function tZ(e){let t=Math.round(e/1e3);return t<60?`${t} seconds`:t<3600?t===60?`minute`:`${Math.round(t/60)} minutes`:t===3600?`hour`:`${Math.round(t/3600)} hours`}function nZ(e,t){if(!e.map(e=>Date.parse(e.ts)).filter(e=>!Number.isNaN(e)).length)return null;let n=1/0,r=-1/0;for(let t of e){let e=Date.parse(t.ts);Number.isNaN(e)||(n=Math.min(n,e-(t.ms||0)),r=Math.max(r,e))}let i=Math.max(1,r-n),a=_o.find(e=>i/e<=qX)||Math.ceil(i/qX/36e5)*36e5,o=Math.max(1,Math.ceil(i/a)),s=Array.from({length:o},(e,t)=>({at:t*a,tokens:0,calls:0,failed:0,who:[]})),c=s.map(()=>new Map);for(let r of e){let e=Date.parse(r.ts);if(Number.isNaN(e))continue;let i=Math.min(o-1,Math.floor((e-n)/a)),l=s[i];l.tokens+=r.input+r.output,l.calls+=1,r.outcome===`error`&&(l.failed+=1);let u=t(r);c[i].set(u,(c[i].get(u)||0)+r.input+r.output)}return s.forEach((e,t)=>e.who=[...c[t].entries()].sort((e,t)=>t[1]-e[1]).map(([e])=>e)),{buckets:s,step:a,span:i}}function rZ({run:e}){let[t,n]=(0,v.useState)(null),{buckets:r,step:i,span:a}=e,o=Math.max(...r.map(e=>e.tokens)),s=tZ(i),c=e=>`${go(e.at)}–${go(Math.min(a,e.at+i))}`,l=e=>`${U(e.tokens)} tokens in ${X(e.calls,`call`)}${e.who.length?`, ${so(e.who,2)}`:``}${e.failed?`; ${X(e.failed,`call`)} failed`:``}`,u=t===null?void 0:r[t],d=r.length>1?[0,Math.round((r.length-1)/3),Math.round(2*(r.length-1)/3),r.length-1]:[0];return(0,V.jsxs)(`section`,{className:`panel ov-s5 ug-run`,"aria-labelledby":`ug-run-h`,children:[(0,V.jsx)(Y,{icon:Fe,tone:`brand`,title:(0,V.jsx)(`span`,{id:`ug-run-h`,children:`Tokens over the run`}),note:`${H(a)} of calls`}),(0,V.jsx)(`p`,{className:`ug-note`,"aria-live":`polite`,children:u?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`b`,{children:c(u)}),`: `,l(u)]}):`Tokens used in each ${s} of the run, from the first call to the last`}),(0,V.jsx)(`div`,{className:`ug-cols`,role:`img`,"aria-label":`Tokens in each ${s} of the run; the most was ${U(o)}`,onMouseLeave:()=>n(null),children:r.map((e,r)=>(0,V.jsx)(`span`,{className:`ug-col`,onMouseEnter:()=>n(r),title:`${c(e)}: ${l(e)}`,children:(0,V.jsx)(`i`,{className:`${t===r?`on`:``}${e.failed?` bad`:``}`,style:{height:`${o?Math.max(e.tokens?2:0,100*e.tokens/o):0}%`}})},r))}),(0,V.jsx)(`div`,{className:`ug-axis`,"aria-hidden":`true`,children:d.map(e=>(0,V.jsx)(`span`,{children:go(r[e].at)},e))}),(0,V.jsx)(`p`,{className:`ov-caption`,children:`Hover a bar to see what was running. A darker cap marks a span with a failed call.`})]})}function iZ({data:e,onNavigate:t,onOpenCall:n}){let r=e.usage?.calls||[],i=e.kind===`run`?`run`:`suite`,a=(0,V.jsx)(eo,{title:`Usage`,subtitle:(0,V.jsxs)(`span`,{className:`ug-sub`,children:[(0,V.jsxs)(`span`,{children:[`This `,i,`, `,X(e.cases.length,`case`)]}),e.env?.model?(0,V.jsxs)(`span`,{children:[`Model `,(0,V.jsx)(`code`,{children:e.env.model})]}):null,e.id?(0,V.jsxs)(`span`,{children:[`Run `,(0,V.jsx)(`code`,{children:e.id})]}):null]}),actions:r.length?(0,V.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(`breakdown`),children:`See what the tokens paid for`}):void 0}),o=(0,v.useMemo)(()=>r.length?aZ(e,r):null,[e,r]);if(!o)return(0,V.jsxs)(`div`,{className:`ug`,children:[a,(0,V.jsxs)(`div`,{className:`panel empty-state`,children:[(0,V.jsx)(ht,{size:26}),(0,V.jsx)(`h3`,{children:`No model calls in this report`}),(0,V.jsx)(`p`,{children:e.usage?.history.length?`The Breakdown page has the last ${W(e.usage.historyDays,`day`)} of calls on this machine.`:`Calls are kept from this version of ForgeQE on.`})]})]});let{t:s,k:c,kTotal:l,byAgent:u,byPurpose:d,caseGroups:f,idle:p,top:m,nameOf:h,failed:g,unpriced:_,unattributed:y,timed:b,budgets:x,passed:S,span:C,perCase:w,run:T}=o,E=Math.round(Ra(s)),D=(e,t)=>Math.round(q(e,t)),O=$a(s.currency),k=D(s.input,s.tokens),A=f.find(e=>e.key.startsWith(`case:`)),j=Math.max(...m.map(e=>e.input+e.output)),M=m.filter(e=>e.outcome===`error`),N=[],P=[],F=(e,t)=>e.push((0,V.jsx)(v.Fragment,{children:t},e.length));F(N,(0,V.jsxs)(V.Fragment,{children:[`This `,i,` used `,(0,V.jsxs)(`strong`,{children:[U(s.tokens),` tokens in `,X(s.calls,`model call`)]}),s.priced?(0,V.jsxs)(V.Fragment,{children:[`, costing `,(0,V.jsx)(`span`,{title:Zi(La(s)),children:Xi(La(s))})]}):null,`.`]})),s.tokens&&F(N,(0,V.jsxs)(V.Fragment,{children:[` `,k,`% were prompt tokens, the context sent with each call, and `,E>=50?`${E}%`:E?`only ${E}%`:`none`,` of those `,E===1?`was`:`were`,` served from the cache.`]})),A&&f.length>1&&F(N,(0,V.jsxs)(V.Fragment,{children:[` Of the cases, `,A.name,` used the most, `,U(A.tokens),` tokens or `,q(A.tokens,s.tokens)<1?`under 1`:D(A.tokens,s.tokens),`% of the `,i,`.`]})),C>=12e4&&F(P,(0,V.jsxs)(V.Fragment,{children:[`Usage averaged about `,U(Math.round(s.tokens/(C/6e4))),` tokens a minute over `,H(C),` of calls. `]})),u.length>1&&F(P,(0,V.jsxs)(V.Fragment,{children:[u[0].name,` made `,X(u[0].calls,`call`),` and used `,s.priced?`${D(u[0].amount,s.amount)}% of the cost`:`${D(u[0].tokens,s.tokens)}% of the tokens`,`. `]})),E<50&&s.input>5e4&&F(P,(0,V.jsx)(V.Fragment,{children:`A prompt that starts the same way every call is cached; one that changes near its start is paid in full each time. `})),g.length&&F(P,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`strong`,{className:`ug-bad`,children:[X(g.length,`call`),` failed`]}),` and spent `,U(Math.round(Fa(g.map(Ma)).tokens)),` tokens with nothing to show. `]})),_&&F(P,(0,V.jsxs)(V.Fragment,{children:[X(_,`call`),` `,_===1?`has`:`have`,` no price, so the cost leaves `,_===1?`it`:`them`,` out: add a price for the model to llms.json. `]})),y.length&&F(P,(0,V.jsxs)(V.Fragment,{children:[U(Math.round(Fa(y.map(Ma)).tokens)),` tokens the browser engine counted without saying which call used them are shown as one unattributed call. `]}));for(let e of x){let t=q(e.spent,e.limit);t>=80&&F(P,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`strong`,{className:t>=100?`ug-bad`:`ug-warn`,children:`Budget:`}),` `,e.label.toLowerCase(),` `,t>=100?`is over`:`is close to`,` its `,e.period,` budget, at `,G(e.spent,s.currency),` of `,G(e.limit,s.currency),` (`,Math.round(t),`%). `]}))}let ee=La(s),te=[{label:`Tokens`,value:U(s.tokens),sub:`${U(s.input)} in, ${U(s.output)} out, ${U(s.cached)} cached`,icon:Ct},{label:`Cost`,value:Xi(ee),sub:s.priced?_?`${X(_,`call`)} unpriced`:S?`${G(s.amount/S,s.currency)} per passed test`:Zi(ee)?`part estimated`:`at the prices in llms.json`:`no price in llms.json`,icon:O,title:Zi(ee)},{label:`Model calls`,value:s.calls.toLocaleString(),sub:g.length?`${X(g.length,`call`)} failed`:w?`about ${w} per case`:`none failed`,icon:Vn},{label:`Served from cache`,value:`${E}%`,sub:`of prompt tokens`,icon:Tr,tone:E>=50?`pass`:s.input>5e4?`warn`:void 0},{label:`Tokens per call`,value:U(Math.round(s.tokens/s.calls)),sub:b?`${H(b)} model time a call`:`average across all calls`,icon:Qt}];return(0,V.jsxs)(`div`,{className:`ug`,children:[a,(0,V.jsxs)(`section`,{className:`panel ug-brief`,"aria-labelledby":`ug-brief-h`,children:[(0,V.jsxs)(`div`,{className:`ug-brief-text`,children:[(0,V.jsxs)(`header`,{className:`panel-head`,children:[(0,V.jsx)(`span`,{className:`ph-icon brand`,children:(0,V.jsx)(B,{size:15})}),(0,V.jsx)(`h2`,{id:`ug-brief-h`,children:`Usage summary`}),(0,V.jsxs)(`span`,{className:`fl-note`,children:[`written by ForgeQE from this `,i]})]}),(0,V.jsx)(`p`,{className:`fl-p`,children:N}),P.length?(0,V.jsx)(`p`,{className:`fl-p fl-dim`,children:P}):null]}),(0,V.jsx)(po,{items:te})]}),(0,V.jsxs)(`div`,{className:`ov-grid ug-grid`,children:[(0,V.jsx)(eZ,{groups:f,idle:p,k:c,kTotal:l,wide:!T}),T?(0,V.jsx)(rZ,{run:T}):null,(0,V.jsxs)(`section`,{className:`panel ov-s12 ov-flush ug-top`,"aria-labelledby":`ug-top-h`,children:[(0,V.jsx)(Y,{icon:Cr,tone:`brand`,title:(0,V.jsx)(`span`,{id:`ug-top-h`,children:`Calls that used the most tokens`}),action:s.calls>KX?{label:`All ${s.calls.toLocaleString()} calls`,onClick:()=>t(`calls`)}:void 0}),(0,V.jsx)(`div`,{className:`table-wrap ug-table-wrap`,children:(0,V.jsxs)(`table`,{className:`data ug-table`,children:[(0,V.jsxs)(`colgroup`,{children:[(0,V.jsx)(`col`,{className:`ug-c-call`}),(0,V.jsx)(`col`,{className:`ug-c-case`}),(0,V.jsx)(`col`,{className:`col-model ug-c-model`}),(0,V.jsx)(`col`,{className:`ug-c-tok`}),(0,V.jsx)(`col`,{className:`ug-c-cost`}),(0,V.jsx)(`col`,{className:`col-time ug-c-time`})]}),(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`col`,children:`Call`}),(0,V.jsx)(`th`,{scope:`col`,children:`Case`}),(0,V.jsx)(`th`,{scope:`col`,className:`col-model`,children:`Model`}),(0,V.jsx)(`th`,{scope:`col`,className:`ug-tok-h`,children:`Tokens`}),(0,V.jsx)(`th`,{scope:`col`,className:`num`,children:`Cost`}),(0,V.jsx)(`th`,{scope:`col`,className:`num col-time`,children:`Time`})]})}),(0,V.jsx)(`tbody`,{children:m.map(e=>{let t=Ma(e),r=e.outcome===`error`,i=`${e.task||e.job}${r?` · failed`:e.outcome===`cancelled`?` · cancelled`:``}`;return(0,V.jsxs)(`tr`,{className:r?`ug-row-bad`:void 0,children:[(0,V.jsx)(`td`,{className:`ug-call`,title:`${e.agent} · ${e.purpose} · ${e.job}${e.task?` · ${e.task}`:``} · ${Hi(e.ts)}`,children:(0,V.jsxs)(`span`,{className:`ug-clamp`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`link-btn`,onClick:()=>n(e.id),children:[e.agent,` · `,e.purpose]}),` `,(0,V.jsx)(`small`,{children:i})]})}),(0,V.jsx)(`td`,{className:`ug-case`,title:`${h(e)}${e.step===void 0?``:`, step ${e.step}`}`,children:(0,V.jsxs)(`span`,{className:`ug-clamp`,children:[(0,V.jsx)(`span`,{className:e.caseId?void 0:`dim`,children:h(e)}),e.step===void 0?null:(0,V.jsxs)(`small`,{children:[` · step `,e.step]})]})}),(0,V.jsx)(`td`,{className:`col-model ug-model`,title:e.model,children:(0,V.jsx)(`code`,{children:e.model})}),(0,V.jsxs)(`td`,{className:`ug-tok`,children:[(0,V.jsx)(JX,{r:t,max:j,failed:r}),(0,V.jsx)(`b`,{children:U(e.input+e.output)})]}),(0,V.jsx)(`td`,{className:`num`,title:Zi(La(t)),children:Xi(La(t))}),(0,V.jsx)(`td`,{className:`num col-time`,children:e.ms?H(e.ms):`—`})]},e.id)})})]})}),(0,V.jsx)(`p`,{className:`ov-caption ug-foot`,children:M.length?`Red bars are calls that failed: ${U(Math.round(Fa(M.map(Ma)).tokens))} tokens spent with nothing to show.`:`Open a call for its run, case, tools and timing.`})]}),(0,V.jsxs)(`div`,{className:`ov-s12 ug-groups${x.length?` three`:``}`,children:[(0,V.jsx)(XX,{title:`By agent`,icon:xe,note:s.priced?`Most expensive first`:`Most tokens first`,rows:u}),(0,V.jsx)(XX,{title:`By purpose`,icon:Qt,note:`From the tools each call asked for`,rows:d}),x.length?(0,V.jsx)($X,{budgets:x,currency:s.currency}):null]})]})]})}function aZ(e,t){let n=t.map(Ma),r=Fa(n),i=Pa(r),a=i.fresh+i.cached+i.write+i.output,o=new Map(e.cases.map(e=>[e.id,e.title||e.id])),s=e=>e.caseId?o.get(e.caseId)||e.caseId:`${e.agent} (no case)`,c=new Map;t.forEach((e,t)=>{let r=e.caseId?`case:${e.caseId}`:`agent:${e.agent}`,i=c.get(r);i||c.set(r,i={name:s(e),rows:[],failed:0}),i.rows.push(n[t]),e.outcome===`error`&&(i.failed+=1)});let l=[...c.entries()].map(([e,t])=>({...Fa(t.rows),key:e,name:t.name,failed:t.failed})).sort((e,t)=>t.tokens-e.tokens),u=new Set(t.map(e=>e.caseId).filter(Boolean)),d=e.cases.filter(e=>!u.has(e.id)).map(e=>e.title||e.id),f=[...t].sort((e,t)=>t.input+t.output-(e.input+e.output)||(t.amount||0)-(e.amount||0)).slice(0,KX),p=t.filter(e=>e.ms),m=1/0,h=-1/0;for(let e of t){let t=Date.parse(e.ts);Number.isNaN(t)||(m=Math.min(m,t-(e.ms||0)),h=Math.max(h,t))}let g=t.filter(e=>e.caseId).length,_=nZ(t,s);return{t:r,k:i,kTotal:a,byAgent:Ia(n,`agent`),byPurpose:Ia(n,`purpose`),caseGroups:l,idle:d,top:f,nameOf:s,failed:t.filter(e=>e.outcome===`error`),unpriced:t.filter(e=>e.amount===void 0).length,unattributed:t.filter(e=>e.purpose===`unattributed`),timed:p.length?Math.round(p.reduce((e,t)=>e+(t.ms||0),0)/p.length):0,budgets:QX(e,t),passed:e.cases.filter(e=>e.status===`passed`).length,span:h>m?h-m:0,run:_&&_.buckets.length>=3?_:null,perCase:u.size>1?(g/u.size).toFixed(1).replace(/\.0$/,``):void 0}}var oZ=e=>U(Math.round(e)),sZ=e=>Math.min(100,Ra(e)),cZ=[{id:`agent`,label:`Agent`},{id:`job`,label:`Job`},{id:`task`,label:`Task`},{id:`purpose`,label:`Purpose`},{id:`model`,label:`Model`},{id:`caseId`,label:`Test case`},{id:`user`,label:`User`},{id:`machine`,label:`Machine`}],lZ={agent:`job`,job:`purpose`,task:`purpose`,purpose:`agent`,model:`agent`,caseId:`agent`,user:`agent`,machine:`user`},uZ={browser:{label:`Browser steps`,hint:`Driving the browser: each step sends the page so the model can see it`},reasoning:{label:`Reasoning`,hint:`The model working out what to do, with no tool asked for`},planning:{label:`Planning`,hint:`Keeping the to-do list of a task`},search:{label:`Search`,hint:`Searching code, the web, test cases and docs`},"file read":{label:`Reading files`,hint:`Reading and listing files, and loading skills`},edit:{label:`Editing files`,hint:`Writing and changing files`},shell:{label:`Shell commands`,hint:`Running commands`},desktop:{label:`Desktop steps`,hint:`Driving a desktop app`},mobile:{label:`Mobile steps`,hint:`Driving a mobile app`},integration:{label:`Integrations`,hint:`Other tools: trackers, MCP servers and the like`},delegation:{label:`Delegation`,hint:`Handing work to another agent`},unattributed:{label:`Unattributed`,hint:`Tokens the browser engine counted without naming the call`}},dZ=e=>uZ[e]?.label||e||`none`,fZ=[{id:`cached`,label:`From cache`,hint:`The start of the prompt the provider already had; billed at a lower price`},{id:`write`,label:`Written to cache`,hint:`Prompt stored in the cache so the calls after it can reuse it`},{id:`fresh`,label:`New input`,hint:`The rest of the prompt, paid at the full input price`},{id:`output`,label:`Output`,hint:`The model’s reply, its reasoning included`}],pZ=6,mZ=6,hZ=10,gZ=15;function _Z({r:e}){let t=Pa(e);return(0,V.jsxs)(`span`,{className:`split-bar`,title:`${oZ(t.fresh)} new input, ${oZ(t.cached)} from cache${t.write?`, ${oZ(t.write)} written to cache`:``}, ${oZ(t.output)} output`,children:[(0,V.jsx)(`i`,{className:`fresh`,style:{flexGrow:t.fresh||(e.input+e.output?0:1)}}),(0,V.jsx)(`i`,{className:`cached`,style:{flexGrow:t.cached}}),(0,V.jsx)(`i`,{className:`write`,style:{flexGrow:t.write}}),(0,V.jsx)(`i`,{className:`output`,style:{flexGrow:t.output}})]})}function vZ({groups:e,total:t}){let n=e[0]?Math.max(...e.map(e=>e.tokens)):0,r=e.slice(0,mZ);return(0,V.jsxs)(`section`,{className:`panel ov-s5 bk-uses`,"aria-labelledby":`bk-uses-h`,children:[(0,V.jsx)(Y,{icon:Ve,tone:`brand`,title:(0,V.jsx)(`span`,{id:`bk-uses-h`,children:`What the tokens paid for`})}),(0,V.jsx)(`div`,{className:`bk-use-list`,children:r.map(e=>(0,V.jsxs)(`div`,{className:`bk-use`,title:`${dZ(e.name)} (purpose “${e.name||`none`}”): ${e.tokens.toLocaleString()} tokens in ${X(e.calls,`call`)}`,children:[(0,V.jsxs)(`div`,{className:`bk-use-top`,children:[(0,V.jsx)(`span`,{className:`bk-use-name`,children:dZ(e.name)}),(0,V.jsxs)(`span`,{className:`bk-use-n`,children:[Math.round(q(e.tokens,t)),`%`,` `,(0,V.jsxs)(`small`,{children:[oZ(e.tokens),e.priced?(0,V.jsxs)(V.Fragment,{children:[`, `,(0,V.jsx)(`span`,{title:Zi(La(e)),children:Xi(La(e))})]}):null]})]})]}),(0,V.jsx)(`span`,{className:`bk-use-bar`,style:{width:`${n?Math.max(1,100*e.tokens/n):0}%`}}),uZ[e.name]?(0,V.jsx)(`span`,{className:`bk-use-hint`,children:uZ[e.name].hint}):null]},e.name))}),e.length>r.length?(0,V.jsxs)(`p`,{className:`ov-caption`,children:[`and `,X(e.length-r.length,`more purpose`),`, in the table below`]}):null]})}var yZ=e=>e>=1e3?`${(e/1e3).toLocaleString(void 0,{maximumFractionDigits:e>=1e5?0:1})}K`:Math.round(e).toLocaleString();function bZ({t:e,sizes:t,outputCost:n,reasoning:r,largest:i}){let a=Pa(e),o=Math.max(1,e.calls),s=e.tokens/o,c=fZ.map(e=>({...e,n:a[e.id]/o})).filter(e=>e.n>0),[l,u]=(0,v.useState)(null),d=c.some(e=>e.id===l)?l:c[0]?.id,f=Math.round(sZ(e)),p=t=>Math.round(q(t,e.tokens)),m=[];t&&e.calls>2&&(m.push({label:`Median call`,value:yZ(t.p50),sub:`half the calls are smaller`}),m.push({label:`90th percentile`,value:yZ(t.p90),sub:`one call in ten is bigger`})),a.cached+a.write+a.fresh&&m.push({label:`From cache`,value:`${f}%`,sub:`of the prompt tokens`}),n!==void 0&&a.output?m.push({label:`Output`,value:`${Math.round(n)}%`,sub:`of the cost, ${p(a.output)}% of the tokens`}):a.output&&m.push({label:`Output`,value:`${p(a.output)}%`,sub:`of the tokens`}),i&&e.calls>1&&m.push({label:`Largest call`,value:yZ(i.tokens),sub:`${dZ(i.purpose).toLowerCase()}, ${i.where}`,title:`${i.tokens.toLocaleString()} tokens: ${dZ(i.purpose)}, ${i.where}`});let h=a.cached+a.write;return(0,V.jsxs)(`section`,{className:`panel ov-s7 bk-call`,"aria-labelledby":`bk-call-h`,children:[(0,V.jsx)(Y,{icon:Dn,tone:`brand`,title:(0,V.jsx)(`span`,{id:`bk-call-h`,children:`Inside a typical model call`})}),(0,V.jsxs)(`p`,{className:`bk-call-lead`,children:[`An average call is `,yZ(s),` tokens`,c.length>1?`. Point at a part to see what it is.`:`.`]}),c.length?(0,V.jsx)(`div`,{className:`bk-seg`,role:`img`,"aria-label":`A typical call: ${c.map(e=>`${e.label} ${yZ(e.n)} tokens`).join(`, `)}`,children:c.map(e=>(0,V.jsx)(`span`,{className:`bk-k-${e.id}${d===e.id?` on`:``}`,style:{flexGrow:e.n},title:`${e.label}: ${yZ(e.n)} tokens a call`,onMouseEnter:()=>u(e.id),children:e.n/s>=.1?(0,V.jsx)(`b`,{children:yZ(e.n)}):null},e.id))}):null,(0,V.jsx)(`div`,{className:`bk-parts`,children:c.map(e=>(0,V.jsxs)(`div`,{className:`bk-part${d===e.id?` on`:``}`,onMouseEnter:()=>u(e.id),children:[(0,V.jsx)(`i`,{className:`bk-sw bk-k-${e.id}`}),(0,V.jsx)(`span`,{className:`bk-part-name`,children:e.label}),(0,V.jsx)(`b`,{children:yZ(e.n)}),(0,V.jsxs)(`span`,{className:`bk-part-hint`,children:[e.hint,e.id===`output`&&r&&a.output?`; ${Math.round(q(r,a.output))}% of it reasoning`:``]})]},e.id))}),m.length?(0,V.jsx)(`dl`,{className:`bk-figs`,children:m.map(e=>(0,V.jsxs)(`div`,{title:e.title,children:[(0,V.jsx)(`dt`,{children:e.label}),(0,V.jsx)(`dd`,{children:e.value}),(0,V.jsx)(`dd`,{className:`bk-fig-sub`,children:e.sub})]},e.label))}):null,(0,V.jsxs)(`p`,{className:`ov-caption`,children:[`Split by how the tokens were billed: the calls do not record what the prompt held (instructions, tools, the page).`,` `,h&&a.fresh?`The dark parts are the start of the prompt, reused or kept for reuse; the light part was paid in full.`:a.fresh?`None of the prompt came from the cache: a prompt that starts the same way on every call could be served from it at a lower price.`:``]})]})}function xZ({rows:e,cols:t,rowLabel:n,max:r}){let i=io(e,hZ),a=e=>e&&r?Math.min(6,1+Math.floor(Math.sqrt(e/r)*5.99)):0,o=e[0],s=o?o.cells.indexOf(Math.max(...o.cells)):-1;return(0,V.jsxs)(`section`,{className:`panel ov-s12 bk-heat`,"aria-labelledby":`bk-heat-h`,children:[(0,V.jsx)(Y,{icon:sn,tone:`brand`,title:(0,V.jsxs)(`span`,{id:`bk-heat-h`,children:[`By `,n.toLowerCase(),` and purpose`]}),note:`Darker cells used more tokens`}),(0,V.jsx)(`div`,{className:`heatmap-wrap`,children:(0,V.jsxs)(`table`,{className:`bk-hm`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`bk-hm-name`,children:n}),t.map(e=>(0,V.jsx)(`th`,{scope:`col`,title:e?`purpose “${e}”`:void 0,children:e===`\0other`?`Other`:dZ(e)},e)),(0,V.jsx)(`th`,{scope:`col`,className:`bk-hm-total`,children:`Total`})]})}),(0,V.jsx)(`tbody`,{children:i.shown.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`row`,className:`bk-hm-name`,title:`${e.name}: ${e.tokens.toLocaleString()} tokens in ${X(e.calls,`call`)}`,children:(0,V.jsx)(`span`,{children:e.name})}),e.cells.map((n,r)=>(0,V.jsx)(`td`,{className:`bk-h${a(n)}`,title:`${e.name}, ${t[r]===`\0other`?`other purposes`:dZ(t[r])}: ${n.toLocaleString()} tokens`,children:n?oZ(n):`—`},r)),(0,V.jsx)(`td`,{className:`bk-hm-total`,children:oZ(e.tokens)})]},e.key))})]})}),(0,V.jsx)(ao,{...i,label:`${n} pages`}),o&&e.length>1&&s>=0?(0,V.jsxs)(`p`,{className:`ov-caption`,children:[`Most tokens: `,o.name,`, `,oZ(o.tokens),`, `,Math.round(q(o.cells[s],o.tokens)),`% of them on`,` `,t[s]===`\0other`?`other purposes`:dZ(t[s]).toLowerCase(),`.`]}):null]})}function SZ({rows:e,total:t,scope:n,days:r}){let[i,a]=(0,v.useState)(`agent`),[o,s]=(0,v.useState)(lZ.agent),[c,l]=(0,v.useState)(null),u=n===`history`&&(i===`task`||i===`caseId`)?`agent`:i,d=io((0,v.useMemo)(()=>Ia(e,u),[e,u]),gZ),f=t=>new Set(e.map(e=>e[t]).filter(Boolean)).size,p=e=>t.priced?q(e.amount,t.amount):q(e.tokens,t.tokens),m=cZ.find(e=>e.id===u).label,h=o===u?lZ[u]===u?`agent`:lZ[u]:o,g=e=>{a(e),s(lZ[e]===e?`agent`:lZ[e]),l(null),d.setPage(0)},_=cZ.filter(e=>e.id!==u&&f(e.id));return(0,V.jsxs)(`section`,{className:`panel ov-s12 ov-flush bk-split`,"aria-labelledby":`bk-split-h`,children:[(0,V.jsxs)(`div`,{className:`bk-split-head`,children:[(0,V.jsx)(Y,{icon:$r,tone:`brand`,title:(0,V.jsxs)(`span`,{id:`bk-split-h`,children:[`By `,m.toLowerCase()]}),note:`Click a row to split it`}),_.length?(0,V.jsx)(`select`,{className:`field bk-then`,"aria-label":`Split each by`,value:_.some(e=>e.id===h)?h:_[0].id,onChange:e=>{s(e.target.value),l(null)},children:_.map(e=>(0,V.jsxs)(`option`,{value:e.id,children:[`Split each by `,e.label.toLowerCase()]},e.id))}):null]}),(0,V.jsx)(`div`,{className:`bk-chips`,children:(0,V.jsx)(ro,{value:u,onChange:g,items:cZ.map(e=>({id:e.id,label:e.label,count:f(e.id)}))})}),(0,V.jsx)(`div`,{className:`table-wrap bk-table-wrap`,children:(0,V.jsxs)(`table`,{className:`data rows`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{className:`col-x`}),(0,V.jsx)(`th`,{children:m}),(0,V.jsx)(`th`,{children:`Tokens`}),(0,V.jsx)(`th`,{children:`Cost`}),(0,V.jsx)(`th`,{className:`col-share`,children:`Share`}),(0,V.jsx)(`th`,{className:`col-percall`,children:`Per call`}),(0,V.jsx)(`th`,{className:`col-cache`,children:`From cache`})]})}),(0,V.jsx)(`tbody`,{children:d.shown.map(e=>{let t=c===e.name,n=_.some(e=>e.id===h)?h:_[0]?.id||`agent`,r=t?Ia(e.rows,n):[],i=()=>l(t?null:e.name);return(0,V.jsxs)(v.Fragment,{children:[(0,V.jsxs)(`tr`,{className:`row-main${t?` open`:``}`,tabIndex:0,"aria-expanded":t,onClick:i,onKeyDown:e=>(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i()),children:[(0,V.jsx)(`td`,{className:`col-x`,children:t?(0,V.jsx)(Ge,{size:15}):(0,V.jsx)(Ye,{size:15})}),(0,V.jsxs)(`td`,{className:`bk-split-name`,children:[(0,V.jsx)(`span`,{className:`row-title strong`,title:e.name||void 0,children:e.name||(0,V.jsx)(`span`,{className:`dim`,children:`none`})}),(0,V.jsxs)(`span`,{className:`cell-sub`,children:[X(e.calls,`call`),e.errors?`, ${e.errors.toLocaleString()} failed`:``]})]}),(0,V.jsxs)(`td`,{children:[(0,V.jsxs)(`span`,{className:`cell-bar`,children:[(0,V.jsx)(_Z,{r:e}),(0,V.jsx)(`b`,{children:oZ(e.tokens)})]}),(0,V.jsxs)(`span`,{className:`cell-sub`,children:[oZ(e.input),` in, `,oZ(e.output),` out`]})]}),(0,V.jsx)(`td`,{title:Zi(La(e)),children:Xi(La(e))}),(0,V.jsxs)(`td`,{className:`col-share`,children:[p(e),`%`]}),(0,V.jsx)(`td`,{className:`col-percall`,children:e.priced?G(e.amount/e.priced,e.currency):`${oZ(e.tokens/Math.max(1,e.calls))} tokens`}),(0,V.jsx)(`td`,{className:`col-cache`,children:e.input?`${sZ(e)}%`:`—`})]}),t?(0,V.jsx)(`tr`,{className:`row-detail`,children:(0,V.jsx)(`td`,{colSpan:7,children:(0,V.jsxs)(`div`,{className:`hbar-list`,"aria-label":`${e.name||`none`} by ${n}`,children:[r.slice(0,30).map(t=>(0,V.jsxs)(`div`,{className:`hbar-row`,title:`${t.name||`none`}: ${X(t.calls,`call`)}, ${oZ(t.tokens)} tokens`,children:[(0,V.jsx)(`span`,{className:`hbar-name`,children:t.name||`none`}),(0,V.jsx)(`span`,{className:`hbar-track`,children:(0,V.jsx)(`span`,{className:`hbar-fill`,style:{width:`${e.tokens?100*t.tokens/e.tokens:0}%`},children:[`fresh`,`cached`,`write`,`output`].map(e=>{let n=Pa(t)[e];return n?(0,V.jsx)(`i`,{className:e,style:{flexGrow:n}},e):null})})}),(0,V.jsxs)(`span`,{className:`hbar-n`,children:[(0,V.jsx)(`b`,{title:Zi(La(t)),children:Xi(La(t))}),(0,V.jsx)(`small`,{children:X(t.calls,`call`)})]})]},t.name)),r.length>30?(0,V.jsxs)(`p`,{className:`ov-caption`,children:[`and `,X(r.length-30,`more`)]}):null]})})}):null]},e.name)})})]})}),(0,V.jsxs)(`div`,{className:`bk-split-foot`,children:[(0,V.jsx)(ao,{...d,label:`By ${m.toLowerCase()} pages`}),(0,V.jsx)(`p`,{className:`ov-caption`,children:n===`history`?`Every ForgeQE process on this machine over the last ${W(r,`day`)}, from the usage ledger (days are UTC). ${t.calls-t.priced?`${X(t.calls-t.priced,`call`)} without a price ${t.calls-t.priced===1?`is`:`are`} left out of the cost.`:``}`:`${X(t.calls,`call`)}, ${oZ(t.tokens)} tokens${t.priced?`, ${Xi(La(t))}`:``}. Share is of the ${t.priced?`cost`:`tokens`}.`})]})]})}function CZ(e,t){let n=t===`report`&&e.usage?.calls||[],r=t===`report`?n.map(Ma):(e.usage?.history||[]).map(Na);if(!r.length)return null;let i=Fa(r),a=Ia(r,`purpose`).sort((e,t)=>t.tokens-e.tokens),o=Ia(r,`agent`),s=Ia(r,`model`),c=new Map(e.cases.map(e=>[e.id,e.title||e.id])),l=a.map(e=>e.name),u=l.length>pZ?[...l.slice(0,5),`\0other`]:l,d=new Map(l.map((e,t)=>[e,Math.min(t,u.length-1)])),f=new Map;r.forEach(e=>{let n=t===`report`&&e.caseId?`case:${e.caseId}`:`agent:${e.agent}`,r=f.get(n);r||f.set(n,r={key:n,name:t===`report`&&e.caseId?c.get(e.caseId)||e.caseId:t===`report`?`${e.agent||`unnamed`} (no case)`:e.agent||`unnamed`,cells:u.map(()=>0),tokens:0,calls:0});let i=e.input+e.output;r.cells[d.get(e.purpose)??u.length-1]+=i,r.tokens+=i,r.calls+=e.calls});let p=[...f.values()].sort((e,t)=>t.tokens-e.tokens),m=0;for(let e of p)for(let t of e.cells)m=Math.max(m,t);let h=Pa(i),g=s.length===1?Ka(s[0].name,e,i.currency):void 0,_=g?Wa(h,g):0,v=g&&_?100*h.output*g.output/1e6/_:void 0,y=g&&g.input?g.output/g.input:void 0,b=n.length?{p50:za(n.map(e=>e.input+e.output),.5),p90:za(n.map(e=>e.input+e.output),.9)}:void 0,x=n.reduce((e,t)=>e+(t.reasoning||0),0),S;for(let e of n)(!S||e.input+e.output>S.input+S.output)&&(S=e);let C=S?{tokens:S.input+S.output,purpose:S.purpose,where:S.caseId?c.get(S.caseId)||S.caseId:`${S.agent||`unnamed agent`}, no case`}:void 0,w=r.reduce((e,t)=>e+t.errors,0),T=n.filter(e=>e.outcome===`error`).reduce((e,t)=>e+t.input+t.output,0);return{rows:r,t:i,k:h,byPurpose:a,byAgent:o,byModel:s,cols:u,heatRows:p,heatMax:m,outputCost:v,outputTimes:y,sizes:b,reasoning:x,largest:C,failed:w,failedTokens:T}}function wZ({data:e,onNavigate:t}){let n=e.usage,r=!!n?.calls.length,[i,a]=(0,v.useState)(r?`report`:`history`),o=(0,v.useMemo)(()=>CZ(e,i),[e,i]),s=e.kind===`run`?`run`:`suite`,c=n?.historyDays||30,l=i===`report`?`This ${s}’s`:`The last ${W(c,`day`)}’`,u=(0,V.jsx)(eo,{title:`Breakdown`,subtitle:(0,V.jsxs)(`span`,{className:`ug-sub`,children:[(0,V.jsx)(`span`,{children:o?`What ${l.charAt(0).toLowerCase()}${l.slice(1)} ${oZ(o.t.tokens)} tokens paid for`:`What the tokens paid for, by agent, job, task, purpose, model, user and machine`}),o&&o.byModel.length===1&&o.byModel[0].name?(0,V.jsxs)(`span`,{children:[`Model `,(0,V.jsx)(`code`,{children:o.byModel[0].name})]}):e.env?.model?(0,V.jsxs)(`span`,{children:[`Model `,(0,V.jsx)(`code`,{children:e.env.model})]}):null]}),actions:r&&t?(0,V.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(`optimise`),children:`See ways to cut this in Optimise`}):void 0});if(!o)return(0,V.jsxs)(`div`,{className:`ug`,children:[u,(0,V.jsxs)(`div`,{className:`panel empty-state`,children:[(0,V.jsx)(Ve,{size:26}),(0,V.jsx)(`h3`,{children:`No model calls to break down`}),(0,V.jsx)(`p`,{children:`Calls are kept from this version of ForgeQE on.`})]})]});let{rows:d,t:f,k:p,byPurpose:m,byAgent:h,cols:g,heatRows:_,heatMax:y,outputCost:b,outputTimes:x,sizes:S,reasoning:C,largest:w,failed:T,failedTokens:E}=o,D=e=>Math.round(q(e,f.tokens)),[O,k]=m,A=Math.round(sZ(f)),j=i===`report`?`this ${s}`:`the last ${W(c,`day`)}`,M=[],N=[],P=(e,t)=>e.push((0,V.jsx)(v.Fragment,{children:t},e.length));P(M,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`strong`,{children:[D(O.tokens),`% of tokens went to `,dZ(O.name).toLowerCase()]}),uZ[O.name]?`: ${uZ[O.name].hint.charAt(0).toLowerCase()}${uZ[O.name].hint.slice(1)}.`:`.`]})),k&&P(M,(0,V.jsxs)(V.Fragment,{children:[` `,dZ(k.name),` `,k.tokens===O.tokens?`is level`:`is next`,` at `,D(k.tokens),`%.`]})),f.input&&P(N,(0,V.jsxs)(V.Fragment,{children:[D(f.input),`% of all tokens were prompt, the context sent with each call, and `,A>=50?`${A}%`:A?`only ${A}%`:`none`,` of it was served from the cache.`,` `]})),b!==void 0&&p.output&&P(N,(0,V.jsxs)(V.Fragment,{children:[`Output was `,D(p.output),`% of the tokens but `,Math.round(b),`% of the cost`,x&&x>1.05?`: it is ${x.toFixed(+(x<10)).replace(/\.0$/,``)}× the input price`:``,`. `]})),h.length>1&&P(N,(0,V.jsxs)(V.Fragment,{children:[`Of the agents, `,h[0].name||`an unnamed one`,` used `,f.priced?`${Math.round(q(h[0].amount,f.amount))}% of the cost`:`${D(h[0].tokens)}% of the tokens`,`. `]})),T&&P(N,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`strong`,{className:`ug-bad`,children:[X(T,`call`),` failed`]}),E?` and spent ${oZ(E)} tokens with nothing to show`:``,`. `]})),f.calls-f.priced&&f.priced&&P(N,(0,V.jsxs)(V.Fragment,{children:[X(f.calls-f.priced,`call`),` `,f.calls-f.priced===1?`has`:`have`,` no price, so the cost leaves `,f.calls-f.priced===1?`it`:`them`,` out. `]}));let F=e=>e.priced?`, ${Xi(La(e))}`:``,ee=[{label:dZ(O.name),value:`${D(O.tokens)}%`,sub:`${oZ(O.tokens)} tokens${F(O)}`,icon:Dn},...k?[{label:dZ(k.name),value:`${D(k.tokens)}%`,sub:`${oZ(k.tokens)} tokens${F(k)}`,icon:Zr}]:[],{label:`Largest agent`,value:h[0].name||`unnamed`,sub:`${D(h[0].tokens)}% of tokens, ${X(h[0].calls,`call`)}`,icon:xe,title:h[0].name||void 0},{label:`Served from cache`,value:`${A}%`,sub:`of prompt tokens`,icon:Tr,tone:A>=50?`pass`:f.input>5e4?`warn`:void 0},{label:`Output`,value:`${D(p.output)}%`,sub:b===void 0?`${oZ(p.output)} tokens of ${oZ(f.tokens)}`:`but ${Math.round(b)}% of the cost${x&&x>1.05?`: ${x.toFixed(+(x<10)).replace(/\.0$/,``)}× the price`:``}`,icon:zr}];return(0,V.jsxs)(`div`,{className:`ug bk`,children:[u,r&&n?.history.length?(0,V.jsx)(to,{value:i,onChange:a,items:[{id:`report`,label:`This ${s}`,icon:B,count:n.calls.length},{id:`history`,label:`Last ${W(c,`day`)}`,icon:je,count:n.history.reduce((e,t)=>e+t.calls,0)}]}):null,(0,V.jsxs)(`section`,{className:`panel ug-brief`,"aria-labelledby":`bk-brief-h`,children:[(0,V.jsxs)(`div`,{className:`ug-brief-text`,children:[(0,V.jsxs)(`header`,{className:`panel-head`,children:[(0,V.jsx)(`span`,{className:`ph-icon brand`,children:(0,V.jsx)(B,{size:15})}),(0,V.jsx)(`h2`,{id:`bk-brief-h`,children:`Breakdown summary`}),(0,V.jsxs)(`span`,{className:`fl-note`,children:[`written by ForgeQE from `,j]})]}),(0,V.jsx)(`p`,{className:`fl-p`,children:M}),N.length?(0,V.jsx)(`p`,{className:`fl-p fl-dim`,children:N}):null]}),(0,V.jsx)(po,{items:ee})]}),(0,V.jsxs)(`div`,{className:`ov-grid ug-grid`,children:[(0,V.jsx)(vZ,{groups:m,total:f.tokens}),(0,V.jsx)(bZ,{t:f,sizes:S,reasoning:C,outputCost:b,largest:w}),_.length>1||g.length>1?(0,V.jsx)(xZ,{rows:_,cols:g,rowLabel:i===`report`?`Case`:`Agent`,max:y},`heat-${i}`):null,(0,V.jsx)(SZ,{rows:d,total:f,scope:i,days:c},`split-${i}`)]})]})}var TZ=15,EZ=8,DZ=[0,500,1e3,1500,2e3,3e3,5e3,1e4,2e4,3e4,6e4],OZ={ok:{label:`Answered`,tone:`pass`},error:{label:`Failed`,tone:`fail`},cancelled:{label:`Stopped`,tone:`warn`}},kZ=e=>Math.round(e||0),AZ=e=>U(kZ(e)),jZ=e=>String(e/1e3),MZ=e=>e===DZ.length-1?`${jZ(DZ[e])}+`:`${jZ(DZ[e])}–${jZ(DZ[e+1])}`,NZ=e=>e===DZ.length-1?`over ${jZ(DZ[e])} s`:`${jZ(DZ[e])} to ${jZ(DZ[e+1])} s`;function PZ(e,t){let n=new Map(e.cases.map(e=>[e.id,e])),r=new Map,i=(e,t)=>{if(!e||t===void 0)return;let n=r.get(e.id);return n||r.set(e.id,n=new Map((e.timeline||[]).map(e=>[e.n,e]))),n.get(t)},a=[...t].sort((e,t)=>e.ts.localeCompare(t.ts)),o=1/0,s=-1/0;for(let e of a){let t=Date.parse(e.ts);Number.isNaN(t)||(o=Math.min(o,t-(e.ms||0)),s=Math.max(s,t))}let c=a.map((e,t)=>{let r=e.caseId?n.get(e.caseId):void 0,a=i(r,e.step),s=a?.goal||a?.title,c=e.step===void 0?e.task||e.job:`Step ${e.step}${s?`: ${s}`:``}`,l=e.caseId?r?.title||e.caseId:`${e.agent} (no case)`,u=Date.parse(e.ts);return{c:e,n:t+1,at:Number.isNaN(u)||o===1/0?0:u-o,caseName:l,kase:r,step:a,what:c,hay:`${l} ${e.caseId||``} ${c} ${e.purpose} ${e.agent} ${e.job} ${e.task||``} ${e.model}`.toLowerCase()}}),l=t.filter(e=>e.ms),u=l.map(e=>e.ms),d=DZ.map((e,t)=>({i:t,n:0,failed:0}));for(let e of l){let t=DZ.length-1;for(;t>0&&e.ms<DZ[t];)t--;d[t].n+=1,e.outcome!==`ok`&&(d[t].failed+=1)}let f=d.findIndex(e=>e.n),p=d.length-1-[...d].reverse().findIndex(e=>e.n),m=l.reduce((e,t)=>!e||t.ms>e.ms?t:e,void 0),h=new Map;for(let e of t){let t=h.get(e.purpose);t?t.push(e):h.set(e.purpose,[e])}let g=[...h.entries()].map(([e,t])=>({name:e,n:t.length,avg:Math.round(t.reduce((e,t)=>e+t.input+t.output,0)/t.length),p50:za(t.map(e=>e.ms||0).filter(Boolean),.5)})).sort((e,t)=>t.n-e.n),_;if(l.length>=8){let e=[...l].sort((e,t)=>t.input-e.input),t=Math.ceil(e.length/4),n=za(e.slice(0,t).map(e=>e.ms),.5),r=za(e.slice(t).map(e=>e.ms),.5);r&&n>=r*1.5&&e[t-1].input>e[t].input&&(_={over:e[t].input,big:n,rest:r})}return{rows:c,span:s>o?s-o:0,timed:l.length,p50:za(u,.5),p95:za(u,.95),wait:u.reduce((e,t)=>e+t,0),slowest:m,slowestRow:m?c.find(e=>e.c===m):void 0,bins:f<0?[]:d.slice(f,p+1),purposes:g,size:_,failed:t.filter(e=>e.outcome===`error`),stopped:t.filter(e=>e.outcome===`cancelled`),unpriced:t.filter(e=>e.amount===void 0).length,agents:[...new Set(t.map(e=>e.agent))].sort()}}function FZ({v:e}){let t=Math.max(...e.bins.map(e=>e.n));return(0,V.jsxs)(`section`,{className:`panel ov-s7 mc-lat`,"aria-labelledby":`mc-lat-h`,children:[(0,V.jsx)(Y,{icon:di,tone:`brand`,title:(0,V.jsx)(`span`,{id:`mc-lat-h`,children:`How long calls took`}),note:`median ${H(e.p50)} · 95th percentile ${H(e.p95)}`}),(0,V.jsx)(`div`,{className:`mc-hist`,role:`img`,"aria-label":e.bins.map(e=>`${e.n.toLocaleString()} took ${NZ(e.i)}`).join(`, `),children:e.bins.map(e=>(0,V.jsxs)(`span`,{className:`mc-bin`,title:`${X(e.n,`call`)} took ${NZ(e.i)}${e.failed?`; ${e.failed.toLocaleString()} failed or stopped`:``}`,children:[(0,V.jsx)(`b`,{children:e.n?e.n.toLocaleString():``}),(0,V.jsx)(`i`,{style:{height:`${t?Math.max(e.n?2:0,100*e.n/t):0}%`},children:e.failed?(0,V.jsx)(`u`,{style:{height:`${Math.max(2,100*e.failed/e.n)}%`}}):null})]},e.i))}),(0,V.jsx)(`div`,{className:`mc-axis${e.bins.length>7?` dense`:``}`,"aria-hidden":`true`,children:e.bins.map(e=>(0,V.jsx)(`span`,{children:MZ(e.i)},e.i))}),(0,V.jsxs)(`p`,{className:`ov-caption`,children:[`Seconds from sending a call to its answer`,e.timed<e.rows.length?`; ${X(e.rows.length-e.timed,`call`)} with no time recorded ${e.rows.length-e.timed===1?`is`:`are`} left out`:``,`. In red, the calls that failed or were stopped.`]})]})}function IZ({v:e}){let t=e.purposes[0]?.n||0,n=e.purposes.slice(EZ);return(0,V.jsxs)(`section`,{className:`panel ov-s5 mc-purp`,"aria-labelledby":`mc-purp-h`,children:[(0,V.jsx)(Y,{icon:Gn,tone:`brand`,title:(0,V.jsx)(`span`,{id:`mc-purp-h`,children:`What the calls were for`})}),(0,V.jsx)(`div`,{className:`hbar-list`,children:e.purposes.slice(0,EZ).map(e=>(0,V.jsxs)(`div`,{className:`hbar-row`,title:`${e.name||`unnamed`}: ${X(e.n,`call`)}, ${U(e.avg)} tokens a call on average${e.p50?`, median ${H(e.p50)}`:``}`,children:[(0,V.jsx)(`span`,{className:`hbar-name`,children:e.name||`unnamed`}),(0,V.jsx)(`span`,{className:`hbar-track`,children:(0,V.jsx)(`span`,{className:`hbar-fill mc-fill`,style:{width:`${t?Math.max(1,100*e.n/t):0}%`},children:(0,V.jsx)(`i`,{style:{flexGrow:1}})})}),(0,V.jsxs)(`span`,{className:`hbar-n`,children:[(0,V.jsx)(`b`,{children:e.n.toLocaleString()}),(0,V.jsx)(`small`,{children:U(e.avg)})]})]},e.name))}),(0,V.jsxs)(`p`,{className:`ov-caption mc-purp-foot`,children:[`Right: number of calls and average tokens a call.`,n.length?` Also ${so(n.map(e=>`${e.name||`unnamed`} (${e.n.toLocaleString()})`),3)}.`:``]})]})}function LZ(e,t){let n=t.env?.price;if(!n||e.amount===void 0||e.estimate||n.currency!==e.currency||!t.env?.model.includes(`/${e.model})`))return[];let r=Pa(e),i=(e,t)=>`${AZ(e)} × ${G(t,n.currency)} per million = ${G(e*t/1e6,n.currency)}`;return[[`New input`,i(r.fresh,n.input)],...r.cached?[[`Read from cache`,i(r.cached,n.cachedInput??n.input)]]:[],...r.write?[[`Written to cache`,i(r.write,n.input)]]:[],[`Output`,i(r.output,n.output)]]}function RZ({r:e,data:t,at:n,total:r,onPrev:i,onNext:a,onOpenCase:o,panel:s}){let{c}=e,l=Pa(c),u=OZ[c.outcome]||OZ.ok,d=La(Ma(c)),f=LZ(c,t),p=[[`fresh`,`New input`,l.fresh],[`cached`,`From cache`,l.cached],[`write`,`Written to cache`,l.write],[`output`,`Output`,l.output]].filter(([,,e])=>e),m=K(e.kase?.url),h=K(e.step?.url),g=`${c.purpose}: ${e.what}`;return(0,V.jsxs)(`section`,{className:`panel mc-call`,"aria-labelledby":`mc-call-h`,ref:s,children:[(0,V.jsxs)(`div`,{className:`mc-call-top`,children:[(0,V.jsxs)(`span`,{className:`mc-kicker`,children:[`Call `,e.n.toLocaleString(),` · at `,go(e.at)]}),(0,V.jsx)(`span`,{className:`status-pill ${u.tone}`,children:u.label}),(0,V.jsxs)(`span`,{className:`mc-step`,children:[n>=0?(0,V.jsx)(`span`,{className:`mc-pos`,children:`${(n+1).toLocaleString()} of ${r.toLocaleString()}`}):null,(0,V.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:!i,onClick:i,"aria-label":`Previous call`,children:(0,V.jsx)(qe,{size:15})}),(0,V.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:!a,onClick:a,"aria-label":`Next call`,children:(0,V.jsx)(Ye,{size:15})})]})]}),(0,V.jsx)(`h2`,{id:`mc-call-h`,className:`mc-call-title`,title:g,children:g}),(0,V.jsxs)(`span`,{className:`mc-call-case`,title:e.caseName,children:[c.caseId&&e.kase?(0,V.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>o(c.caseId),children:e.caseName}):e.caseName,m?(0,V.jsx)(`a`,{className:`text-btn`,href:m,target:`_blank`,rel:`noreferrer`,children:qi(e.kase.source)}):null]}),(0,V.jsxs)(`dl`,{className:`mc-nums`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Input tokens`}),(0,V.jsx)(`dd`,{children:kZ(c.input).toLocaleString()})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Output tokens`}),(0,V.jsx)(`dd`,{children:kZ(c.output).toLocaleString()})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Took`}),(0,V.jsx)(`dd`,{children:c.ms?H(c.ms):`—`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Cost`}),(0,V.jsx)(`dd`,{title:Zi(d),children:c.amount===void 0?`No price`:Xi(d)})]})]}),(0,V.jsxs)(`div`,{className:`mc-sent`,children:[(0,V.jsx)(`span`,{className:`mc-label`,children:`What the call was billed for`}),(0,V.jsx)(`span`,{className:`split-bar mc-strip`,role:`img`,"aria-label":p.map(([,e,t])=>`${e} ${AZ(t)}`).join(`, `),children:p.map(([e,t,n])=>(0,V.jsx)(`i`,{className:e,style:{flexGrow:n},title:`${t}: ${kZ(n).toLocaleString()} tokens`},e))}),(0,V.jsx)(`span`,{className:`mc-legend`,children:p.map(([e,t,n])=>(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`i`,{className:`sw ${e}`}),t,` `,(0,V.jsx)(`b`,{children:AZ(n)})]},e))})]}),c.outcome===`ok`?null:(0,V.jsx)(`p`,{className:`mc-note ${u.tone}`,children:c.outcome===`error`?`The call failed: no answer came back, and its tokens were spent with nothing to show.`:`The call was stopped before the model answered.`}),c.tools?.length?(0,V.jsxs)(`div`,{className:`mc-sent`,children:[(0,V.jsxs)(`span`,{className:`mc-label`,children:[(0,V.jsx)(ki,{size:13}),` Tools it asked for`]}),(0,V.jsx)(`span`,{className:`code-list`,children:c.tools.map(e=>(0,V.jsx)(`code`,{children:e},e))})]}):null,(0,V.jsx)(Oo,{items:[[`Agent`,c.agent],[`Job`,c.job],[`Task`,c.task],[`Model`,(0,V.jsx)(`code`,{children:c.provider?`${c.provider}/${c.model}`:c.model})],[`Page`,h?(0,V.jsx)(`a`,{href:h,target:`_blank`,rel:`noreferrer`,children:Gi(h)||h}):void 0],[`Run`,c.runId?(0,V.jsx)(`code`,{children:c.runId}):void 0],[`Attempt`,c.attempt?String(c.attempt):void 0],[`Finished`,Wi(c.ts)],[`Reasoning`,c.reasoning?`${AZ(c.reasoning)} of the output`:void 0],...f,[`Cost`,c.amount===void 0?`No price is known for this model: add one to llms.json`:c.estimate?`${Xi(d)}: ${Zi(d)}`:void 0],[`Started by`,c.trigger],[`User`,`${c.user} on ${c.machine}`],[`Session`,c.session?(0,V.jsx)(`code`,{children:c.session}):void 0]]}),(0,V.jsx)(`p`,{className:`ov-caption`,children:`ForgeQE keeps each call's tokens, time and cost, never what was sent or answered.`})]})}function zZ({data:e,callId:t,onSelect:n,onOpenCase:r}){let i=e.usage?.calls||[],a=e.kind===`run`?`run`:`suite`,o=(0,v.useMemo)(()=>i.length?PZ(e,i):null,[e,i]),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(`all`),[d,f]=(0,v.useState)(`all`),[p,m]=(0,v.useState)(`time`),h=s.trim().toLowerCase(),g=(0,v.useMemo)(()=>{if(!o)return[];let e=o.rows.filter(e=>(l===`all`||e.c.outcome===l)&&(d===`all`||e.c.agent===d)&&(!h||e.hay.includes(h)));return p===`slow`?e.sort((e,t)=>(t.c.ms||0)-(e.c.ms||0)||e.n-t.n):p===`tokens`?e.sort((e,t)=>t.c.input+t.c.output-(e.c.input+e.c.output)||e.n-t.n):p===`cost`&&e.sort((e,t)=>(t.c.amount||0)-(e.c.amount||0)||t.c.input+t.c.output-(e.c.input+e.c.output)||e.n-t.n),e},[o,l,d,h,p]),_=io(g,TZ),y=(0,v.useRef)(null),b=(0,v.useMemo)(()=>o&&t?o.rows.find(e=>e.c.id===t):void 0,[o,t]),x=(0,v.useMemo)(()=>b?g.indexOf(b):-1,[g,b]),{setPage:S,size:C}=_;(0,v.useEffect)(()=>{x>=0&&S(Math.floor(x/C))},[t]);let w=(0,V.jsx)(eo,{title:`Model calls`,subtitle:(0,V.jsxs)(`span`,{className:`ug-sub`,children:[(0,V.jsxs)(`span`,{children:[`Every request the agents sent to a model in this `,a]}),e.env?.model?(0,V.jsxs)(`span`,{children:[`Model `,(0,V.jsx)(`code`,{children:e.env.model})]}):null]})});if(!o)return(0,V.jsxs)(`div`,{className:`ug mc`,children:[w,(0,V.jsxs)(`div`,{className:`panel empty-state`,children:[(0,V.jsx)(Gn,{size:26}),(0,V.jsx)(`h3`,{children:`No model calls in this report`}),(0,V.jsx)(`p`,{children:`Calls are kept from this version of ForgeQE on.`})]})]});let T=b||_.shown[0]||o.rows[0],E=g.indexOf(T),D=(e,t)=>{n(e),t&&typeof window<`u`&&window.matchMedia?.(`(max-width: 1100px)`).matches&&y.current?.scrollIntoView({behavior:`smooth`,block:`start`})},O=()=>{S(0),n(void 0)},k=i.length,A=[],j=[],M=(e,t)=>e.push((0,V.jsx)(v.Fragment,{children:t},e.length));M(A,(0,V.jsxs)(V.Fragment,{children:[`This `,a,` made `,(0,V.jsx)(`strong`,{children:X(k,`model call`)}),o.span&&k>1?(0,V.jsxs)(V.Fragment,{children:[` over `,H(o.span),`, about one every `,H(Math.round(o.span/k))]}):null,`.`]})),o.timed&&(M(A,(0,V.jsxs)(V.Fragment,{children:[` Half came back within `,(0,V.jsx)(`strong`,{children:H(o.p50)}),` and 95% within `,H(o.p95)]})),o.slowest&&o.slowestRow&&o.timed>1&&M(A,(0,V.jsxs)(V.Fragment,{children:[`; the slowest took `,H(o.slowest.ms),`, a `,o.slowest.purpose,` call `,o.slowest.caseId?(0,V.jsxs)(V.Fragment,{children:[`in `,o.slowestRow.caseName]}):(0,V.jsxs)(V.Fragment,{children:[`by the `,o.slowest.agent]})]})),M(A,(0,V.jsx)(V.Fragment,{children:`.`}))),o.size&&M(A,(0,V.jsxs)(V.Fragment,{children:[` Calls with the largest prompts, over `,AZ(o.size.over),` tokens, took a median `,H(o.size.big),` against `,H(o.size.rest),` for the rest.`]})),o.failed.length&&M(j,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`strong`,{className:`ug-bad`,children:[X(o.failed.length,`call`),` failed`]}),` and spent `,AZ(Fa(o.failed.map(Ma)).tokens),` tokens with nothing to show. `]})),o.stopped.length&&M(j,(0,V.jsxs)(V.Fragment,{children:[X(o.stopped.length,`call`),` `,o.stopped.length===1?`was`:`were`,` stopped before the model answered. `]})),!o.failed.length&&!o.stopped.length&&M(j,(0,V.jsx)(V.Fragment,{children:`Every call was answered. `})),o.timed<k&&M(j,(0,V.jsxs)(V.Fragment,{children:[X(k-o.timed,`call`),` `,k-o.timed===1?`has`:`have`,` no model time recorded and `,k-o.timed===1?`is`:`are`,` left out of the times. `]})),o.unpriced&&M(j,(0,V.jsxs)(V.Fragment,{children:[X(o.unpriced,`call`),` `,o.unpriced===1?`has`:`have`,` no price: add one for the model to llms.json. `]}));let N=e.kind===`run`&&e.ms&&o.wait<=e.ms?Math.round(100*o.wait/e.ms):void 0,P=[{label:`Calls`,value:k.toLocaleString(),sub:o.span&&k>1?`one every ${H(Math.round(o.span/k))}`:`in this ${a}`,icon:Vn},{label:`Median time`,value:o.timed?H(o.p50):`—`,sub:o.timed?`95th percentile ${H(o.p95)}`:`no times recorded`,icon:pt},{label:`Model wait`,value:H(o.wait),sub:N===void 0?`summed over every call`:`${N}% of the ${H(e.ms)} run`,icon:pn},{label:`Failed`,value:o.failed.length.toLocaleString(),sub:o.failed.length?`${AZ(Fa(o.failed.map(Ma)).tokens)} tokens with no answer`:`every call came back`,icon:st,tone:o.failed.length?`fail`:void 0},{label:`Stopped`,value:o.stopped.length.toLocaleString(),sub:`before the model answered`,icon:at,tone:o.stopped.length?`warn`:void 0}],F={all:k,error:o.failed.length,cancelled:o.stopped.length};return(0,V.jsxs)(`div`,{className:`ug mc`,children:[w,(0,V.jsxs)(`section`,{className:`panel ug-brief`,"aria-labelledby":`mc-brief-h`,children:[(0,V.jsxs)(`div`,{className:`ug-brief-text`,children:[(0,V.jsxs)(`header`,{className:`panel-head`,children:[(0,V.jsx)(`span`,{className:`ph-icon brand`,children:(0,V.jsx)(B,{size:15})}),(0,V.jsx)(`h2`,{id:`mc-brief-h`,children:`Model call summary`}),(0,V.jsxs)(`span`,{className:`fl-note`,children:[`written by ForgeQE from this `,a]})]}),(0,V.jsx)(`p`,{className:`fl-p`,children:A}),j.length?(0,V.jsx)(`p`,{className:`fl-p fl-dim`,children:j}):null]}),(0,V.jsx)(po,{items:P})]}),(0,V.jsxs)(`div`,{className:`ov-grid ug-grid`,children:[o.bins.length?(0,V.jsx)(FZ,{v:o}):null,(0,V.jsx)(IZ,{v:o})]}),(0,V.jsxs)(`div`,{className:`mc-work`,children:[(0,V.jsxs)(`section`,{className:`panel ov-flush mc-log`,"aria-labelledby":`mc-log-h`,children:[(0,V.jsxs)(`div`,{className:`mc-log-head`,children:[(0,V.jsxs)(`h2`,{id:`mc-log-h`,children:[`Call log `,(0,V.jsx)(`span`,{className:`fl-count`,children:g.length.toLocaleString()})]}),(0,V.jsxs)(`label`,{className:`table-search mc-search`,children:[(0,V.jsx)(Lr,{size:15}),(0,V.jsx)(`input`,{type:`search`,value:s,placeholder:`Search case, step or purpose`,"aria-label":`Search calls`,onChange:e=>{c(e.target.value),O()}})]})]}),(0,V.jsxs)(`div`,{className:`mc-tools`,children:[(0,V.jsx)(`div`,{className:`mc-chips`,role:`group`,"aria-label":`Status`,children:[[`all`,`All`],[`error`,`Failed`],[`cancelled`,`Stopped`]].filter(([e])=>e===`all`||F[e]||l===e).map(([e,t])=>(0,V.jsxs)(`button`,{type:`button`,"aria-pressed":l===e,className:`chip-btn${l===e?` active`:``}`,onClick:()=>{u(e),O()},children:[t,(0,V.jsx)(`span`,{className:`chip-count`,children:F[e].toLocaleString()})]},e))}),(0,V.jsxs)(`span`,{className:`mc-selects`,children:[o.agents.length>1?(0,V.jsxs)(`select`,{className:`field`,"aria-label":`Agent`,value:d,onChange:e=>{f(e.target.value),O()},children:[(0,V.jsx)(`option`,{value:`all`,children:`All agents`}),o.agents.map(e=>(0,V.jsx)(`option`,{value:e,children:e},e))]}):null,(0,V.jsxs)(`select`,{className:`field`,"aria-label":`Order`,value:p,onChange:e=>{m(e.target.value),O()},children:[(0,V.jsx)(`option`,{value:`time`,children:`In the order they were made`}),(0,V.jsx)(`option`,{value:`slow`,children:`Slowest first`}),(0,V.jsx)(`option`,{value:`tokens`,children:`Most tokens first`}),(0,V.jsx)(`option`,{value:`cost`,children:`Most expensive first`})]})]})]}),(0,V.jsx)(`div`,{className:`table-wrap mc-table-wrap`,children:(0,V.jsxs)(`table`,{className:`data mc-table`,children:[(0,V.jsxs)(`colgroup`,{children:[(0,V.jsx)(`col`,{className:`mc-c-n`}),(0,V.jsx)(`col`,{className:`mc-col-at mc-c-at`}),(0,V.jsx)(`col`,{}),(0,V.jsx)(`col`,{className:`mc-col-purpose mc-c-purpose`}),(0,V.jsx)(`col`,{className:`mc-c-in`}),(0,V.jsx)(`col`,{className:`mc-col-out mc-c-out`}),(0,V.jsx)(`col`,{className:`mc-c-took`}),(0,V.jsx)(`col`,{className:`mc-c-status`})]}),(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`mc-n`,children:`#`}),(0,V.jsx)(`th`,{scope:`col`,className:`mc-col-at`,children:`At`}),(0,V.jsx)(`th`,{scope:`col`,children:`Case and step`}),(0,V.jsx)(`th`,{scope:`col`,className:`mc-col-purpose`,children:`Purpose`}),(0,V.jsx)(`th`,{scope:`col`,className:`num`,children:`In`}),(0,V.jsx)(`th`,{scope:`col`,className:`num mc-col-out`,children:`Out`}),(0,V.jsx)(`th`,{scope:`col`,className:`num`,children:`Took`}),(0,V.jsx)(`th`,{scope:`col`,className:`mc-status`,children:`Status`})]})}),(0,V.jsxs)(`tbody`,{children:[_.shown.map(e=>{let t=e.c,n=OZ[t.outcome]||OZ.ok,r=e===T;return(0,V.jsxs)(`tr`,{className:r?`mc-on`:void 0,"aria-current":r?`true`:void 0,onClick:()=>D(t.id,!0),children:[(0,V.jsx)(`td`,{className:`mc-n`,children:(0,V.jsx)(`button`,{type:`button`,className:`link-btn`,"aria-label":`Open call ${e.n}`,onClick:e=>{e.stopPropagation(),D(t.id,!0)},children:e.n.toLocaleString()})}),(0,V.jsx)(`td`,{className:`mc-col-at`,title:Wi(t.ts),children:go(e.at)}),(0,V.jsxs)(`td`,{className:`mc-what`,children:[(0,V.jsx)(`span`,{className:`mc-clamp`,title:e.what,children:e.what}),(0,V.jsx)(`small`,{title:e.caseName,children:e.caseName})]}),(0,V.jsxs)(`td`,{className:`mc-col-purpose`,children:[t.purpose,(0,V.jsx)(`small`,{children:t.agent})]}),(0,V.jsx)(`td`,{className:`num`,title:`${kZ(t.input).toLocaleString()} prompt tokens${t.cached?`, ${kZ(t.cached).toLocaleString()} from cache`:``}`,children:AZ(t.input)}),(0,V.jsx)(`td`,{className:`num mc-col-out`,children:AZ(t.output)}),(0,V.jsx)(`td`,{className:`num${t.ms&&o.timed>1&&t.ms>o.p95?` mc-slow`:``}`,children:t.ms?H(t.ms):`—`}),(0,V.jsx)(`td`,{className:`mc-status`,children:(0,V.jsx)(`span`,{className:`status-pill ${n.tone}`,children:n.label})})]},t.id)}),g.length?null:(0,V.jsx)(`tr`,{children:(0,V.jsx)(`td`,{colSpan:8,className:`table-empty`,children:`No calls match`})})]})]})}),(0,V.jsx)(`div`,{className:`mc-foot`,children:_.pages>1?(0,V.jsx)(ao,{..._,label:`Call log pages`}):(0,V.jsx)(`span`,{className:`ov-caption`,children:g.length?`${X(g.length,`call`)}`:``})})]}),(0,V.jsx)(RZ,{r:T,data:e,at:E,total:g.length,panel:y,onPrev:E>0?()=>D(g[E-1].c.id):void 0,onNext:E>=0&&E<g.length-1?()=>D(g[E+1].c.id):void 0,onOpenCase:r})]})]})}var BZ=10,VZ=10,HZ=6;function UZ({r:e}){let t=Pa(e);return(0,V.jsxs)(`span`,{className:`split-bar`,title:`${U(t.fresh)} new input, ${U(t.cached)} from cache${t.write?`, ${U(t.write)} written to cache`:``}, ${U(t.output)} output`,children:[(0,V.jsx)(`i`,{className:`fresh`,style:{flexGrow:t.fresh||(e.input+e.output?0:1)}}),(0,V.jsx)(`i`,{className:`cached`,style:{flexGrow:t.cached}}),(0,V.jsx)(`i`,{className:`write`,style:{flexGrow:t.write}}),(0,V.jsx)(`i`,{className:`output`,style:{flexGrow:t.output}})]})}function WZ(e,t){let n=t===`report`&&e.usage?.calls||[],r=t===`report`?n.map(Ma):(e.usage?.history||[]).map(Na);if(!r.length)return null;let i=Fa(r),a=t===`report`?Ba(n):Ia(r,`model`).map(e=>({...e,p50:0,p95:0,timed:0,perMillion:e.priced&&e.tokens?e.amount/e.tokens*1e6:void 0})),o=new Map(a.map(e=>[e.name,e])),s=Pa(i),c=i.currency||e.env?.price?.currency||e.env?.profiles?.[0]?.price.currency,l=[];for(let t of e.env?.profiles||[])c&&t.price.currency!==c||l.push({key:`p:${t.name}`,name:t.name,model:t.provider?`${t.provider}/${t.model}`:t.model,rate:t.price,inUse:o.get(t.model),note:t.price.note,estimate:t.price.estimate,cost:Wa(s,t.price)});for(let t of a){if(l.some(e=>e.inUse===t))continue;let n=Ka(t.name,e,c);n&&l.push({key:`m:${t.name}`,name:t.name,model:t.provider?`${t.provider}/${t.name}`:t.name,rate:n,inUse:t,note:e.env?.price?.note,estimate:e.env?.price?.estimate,cost:Wa(s,n)})}l.sort((e,t)=>Number(!!t.inUse)-Number(!!e.inUse)||(t.inUse?.calls||0)-(e.inUse?.calls||0)||e.cost-t.cost);let u=i.priced&&i.priced===i.calls?i.amount:void 0,d=n.filter(e=>e.ms).map(e=>e.ms),f,p;for(let e of n)(!f||e.input>f.input)&&(f=e),(!p||e.output>p.output)&&(p=e);let m=Ia(r,`agent`).map(e=>({name:e.name,calls:e.calls,models:Ia(e.rows,`model`).map(e=>e.name)})),h=n.filter(e=>e.outcome===`cancelled`).length,g=n.reduce((e,t)=>e+(t.reasoning||0),0);return{rows:r,t:i,k:s,models:a,options:l,now:u,currency:c,timed:d,biggest:f,longest:p,byAgent:m,cancelled:h,reasoning:g}}function GZ({view:e,scopeName:t,onCalculator:n}){let{options:r,now:i,t:a}=e,o=io(r,VZ),s=Math.max(...r.map(e=>e.cost),i||0),c=e.models.length>1,l=r.some(e=>e.inUse?.timed);return(0,V.jsxs)(`section`,{className:`panel ov-s12 ov-flush mdl-cmp`,"aria-labelledby":`mdl-cmp-h`,children:[(0,V.jsx)(Y,{icon:Fr,tone:`brand`,title:(0,V.jsx)(`span`,{id:`mdl-cmp-h`,children:`How the listed prices compare`}),note:`${U(a.tokens)} tokens of ${t}, priced at each`,action:n?{label:`Try one in Calculator`,onClick:n}:void 0}),(0,V.jsx)(`div`,{className:`table-wrap mdl-table-wrap`,children:(0,V.jsxs)(`table`,{className:`data mdl-table mdl-cmp-table`,children:[(0,V.jsxs)(`colgroup`,{children:[(0,V.jsx)(`col`,{}),(0,V.jsx)(`col`,{className:`mdl-c-calls`}),l?(0,V.jsx)(`col`,{className:`col-time mdl-c-time`}):null,(0,V.jsx)(`col`,{className:`mdl-c-cost`}),(0,V.jsx)(`col`,{className:`mdl-c-diff`})]}),(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`col`,children:`Option`}),(0,V.jsx)(`th`,{scope:`col`,className:`mdl-col-calls`,children:`Calls made`}),l?(0,V.jsx)(`th`,{scope:`col`,className:`num col-time`,children:`Median time`}):null,(0,V.jsx)(`th`,{scope:`col`,className:`mdl-col-cost`,children:`Cost of these tokens`}),(0,V.jsx)(`th`,{scope:`col`,className:`num`,children:`Against now`})]})}),(0,V.jsx)(`tbody`,{children:o.shown.map(e=>{let t=i!==void 0&&i>0?100*(e.cost-i)/i:void 0,n=t!==void 0&&Math.abs(t)<.5;return(0,V.jsxs)(`tr`,{className:e.inUse?`mdl-now`:void 0,children:[(0,V.jsxs)(`th`,{scope:`row`,className:`mdl-opt`,children:[(0,V.jsxs)(`span`,{className:`mdl-opt-top`,children:[(0,V.jsx)(`span`,{className:`mdl-name`,title:e.name,children:e.name}),e.inUse?(0,V.jsx)(`span`,{className:`mdl-tag`,children:`In use`}):null]}),(0,V.jsx)(`code`,{className:`mdl-code`,title:e.model,children:e.model}),(0,V.jsxs)(`small`,{title:e.note,children:[G(e.rate.input,e.rate.currency),` in`,e.rate.cachedInput===void 0?``:`, ${G(e.rate.cachedInput,e.rate.currency)} cached`,`, `,G(e.rate.output,e.rate.currency),` out per million`,e.estimate?`, part estimated`:``]})]}),(0,V.jsxs)(`td`,{className:`mdl-col-calls`,children:[e.inUse?(0,V.jsxs)(`span`,{className:`mdl-barcell`,children:[(0,V.jsx)(`span`,{className:`bar-track`,children:(0,V.jsx)(`i`,{style:{width:`${Math.max(1,q(e.inUse.calls,a.calls))}%`}})}),(0,V.jsx)(`b`,{children:e.inUse.calls.toLocaleString()})]}):(0,V.jsx)(`span`,{className:`dim`,children:`none`}),e.inUse?(0,V.jsx)(`span`,{className:`cell-sub`,children:c?`${Math.round(q(e.inUse.calls,a.calls))}% of the calls`:`every call`}):null]}),l?(0,V.jsxs)(`td`,{className:`num col-time`,children:[e.inUse?.timed?H(e.inUse.p50):`—`,e.inUse?.timed?(0,V.jsxs)(`span`,{className:`cell-sub`,children:[`95% within `,H(e.inUse.p95)]}):null]}):null,(0,V.jsx)(`td`,{className:`mdl-col-cost`,children:(0,V.jsxs)(`span`,{className:`mdl-barcell`,children:[(0,V.jsx)(`span`,{className:`mdl-costbar`,children:(0,V.jsx)(`span`,{style:{width:`${s?Math.max(1,100*e.cost/s):0}%`}})}),(0,V.jsx)(`b`,{children:G(e.cost,e.rate.currency)})]})}),(0,V.jsx)(`td`,{className:`num mdl-diff${t!==void 0&&!n?t<0?` less`:` more`:``}`,children:t===void 0?`—`:n?`same`:`${t<0?`−`:`+`}${Math.abs(Math.round(t))}%`})]},e.key)})})]})}),(0,V.jsxs)(`div`,{className:`mdl-foot`,children:[(0,V.jsx)(ao,{...o,label:`Price options pages`}),(0,V.jsxs)(`p`,{className:`ov-caption`,children:[i===void 0?a.priced?`${X(a.calls-a.priced,`call`)} without a price leave nothing to compare against. `:`No call has a price, so there is nothing to compare against. `:`Now is what the calls cost: ${Xi(La(a))}. `,`This is the same tokens at another price only: another model would not send exactly the same tokens, and nothing here checked that it reaches the same verdicts.`]})]})]})}function KZ({view:e,scope:t}){let{models:n,t:r}=e,i=io(n,BZ);return(0,V.jsxs)(`section`,{className:`panel ov-s12 ov-flush mdl-used`,"aria-labelledby":`mdl-used-h`,children:[(0,V.jsx)(Y,{icon:xt,tone:`brand`,title:(0,V.jsx)(`span`,{id:`mdl-used-h`,children:`Models used`}),note:r.priced?`Most expensive first`:`Most tokens first`}),(0,V.jsx)(`div`,{className:`table-wrap mdl-table-wrap`,children:(0,V.jsxs)(`table`,{className:`data mdl-table mdl-used-table`,children:[(0,V.jsxs)(`colgroup`,{children:[(0,V.jsx)(`col`,{}),(0,V.jsx)(`col`,{className:`mdl-c-tokens`}),(0,V.jsx)(`col`,{className:`mdl-c-num`}),(0,V.jsx)(`col`,{className:`col-percall mdl-c-num`}),(0,V.jsx)(`col`,{className:`col-permillion mdl-c-num`}),t===`report`?(0,V.jsx)(`col`,{className:`col-time mdl-c-time`}):null,(0,V.jsx)(`col`,{className:`col-cache mdl-c-num`})]}),(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`col`,children:`Model`}),(0,V.jsx)(`th`,{scope:`col`,className:`col-tokens`,children:`Tokens`}),(0,V.jsx)(`th`,{scope:`col`,className:`num`,children:`Cost`}),(0,V.jsx)(`th`,{scope:`col`,className:`num col-percall`,children:`Per call`}),(0,V.jsx)(`th`,{scope:`col`,className:`num col-permillion`,children:`Per million`}),t===`report`?(0,V.jsx)(`th`,{scope:`col`,className:`num col-time`,children:`Model time`}):null,(0,V.jsx)(`th`,{scope:`col`,className:`num col-cache`,children:`From cache`})]})}),(0,V.jsx)(`tbody`,{children:i.shown.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`th`,{scope:`row`,className:`mdl-opt`,children:[(0,V.jsx)(`span`,{className:`mdl-name`,title:e.name,children:e.name||`unnamed`}),(0,V.jsxs)(`span`,{className:`cell-sub`,children:[X(e.calls,`call`),e.provider?` · ${e.provider}`:``,e.errors?`, ${e.errors.toLocaleString()} failed`:``]})]}),(0,V.jsxs)(`td`,{className:`col-tokens`,children:[(0,V.jsxs)(`span`,{className:`mdl-barcell`,children:[(0,V.jsx)(UZ,{r:e}),(0,V.jsx)(`b`,{children:U(e.tokens)})]}),(0,V.jsxs)(`span`,{className:`cell-sub`,children:[U(e.input),` in, `,U(e.output),` out`]})]}),(0,V.jsxs)(`td`,{className:`num`,title:Zi(La(e)),children:[Xi(La(e)),e.calls-e.priced?(0,V.jsxs)(`span`,{className:`cell-sub mdl-warn`,children:[X(e.calls-e.priced,`call`),` unpriced`]}):null]}),(0,V.jsx)(`td`,{className:`num col-percall`,children:e.priced?G(e.amount/e.priced,e.currency):`—`}),(0,V.jsx)(`td`,{className:`num col-permillion`,children:e.perMillion===void 0?`—`:G(e.perMillion,e.currency)}),t===`report`?(0,V.jsxs)(`td`,{className:`num col-time`,children:[e.timed?H(e.p50):`—`,e.timed?(0,V.jsxs)(`span`,{className:`cell-sub`,children:[`95% within `,H(e.p95)]}):null]}):null,(0,V.jsx)(`td`,{className:`num col-cache`,children:e.input?`${Ra(e)}%`:`—`})]},e.name))})]})}),(0,V.jsxs)(`div`,{className:`mdl-foot`,children:[(0,V.jsx)(ao,{...i,label:`Models pages`}),(0,V.jsxs)(`p`,{className:`ov-caption`,children:[`Per million is what the calls cost per million tokens, cached ones included.`,t===`report`?` Model time is half the answers within it, and 95% within the time under it.`:``]})]})]})}function qZ({data:e,view:t,what:n,wide:r}){let{biggest:i,longest:a,byAgent:o,t:s,cancelled:c,reasoning:l}=t,u=new Map(e.cases.map(e=>[e.id,e.title||e.id])),d=e=>e?.caseId?u.get(e.caseId)||e.caseId:void 0,f=Math.round(Ra(s)),p=e.usage?.budget?.run===void 0?e.env?.budget:e.usage.budget,m=p?.currency||s.currency,h=[];if(e.env?.model&&h.push([`Model`,(0,V.jsx)(`code`,{children:e.env.model},`m`),`set for the browser agent`]),o.length){let e=o.slice(0,HZ);h.push([o.length===1?`Agent`:`Agents`,(0,V.jsxs)(`span`,{className:`mdl-agents`,children:[e.map(e=>(0,V.jsxs)(`span`,{title:`${e.name||`unnamed`}: ${e.models.join(`, `)}, ${X(e.calls,`call`)}`,children:[e.name||`unnamed`,` `,(0,V.jsx)(`span`,{className:`dim`,children:`on`}),` `,(0,V.jsxs)(`code`,{children:[e.models.slice(0,2).join(`, `),e.models.length>2?` +${e.models.length-2}`:``]})]},e.name)),o.length>e.length?(0,V.jsxs)(`span`,{className:`dim`,children:[`and `,X(o.length-e.length,`more agent`)]}):null]},`a`)])}if(i&&h.push([`Largest prompt`,`${i.input.toLocaleString()} tokens`,`average ${U(Math.round(s.input/Math.max(1,s.calls)))}${d(i)?`; in ${d(i)}`:``}`]),a&&h.push([`Longest reply`,`${a.output.toLocaleString()} tokens`,`average ${U(Math.round(s.output/Math.max(1,s.calls)))}${l?`; ${Math.round(q(l,s.output))}% of all output was reasoning`:``}`]),s.input&&h.push([`Prompt cache`,f?`${f}% of prompt tokens`:`Not used`,f?`${U(s.cached)} tokens read from it`:`no prompt token came from the cache`,f<20&&s.input>5e4]),h.push([`Failed calls`,s.errors||c?`${(s.errors+c).toLocaleString()} of ${s.calls.toLocaleString()}`:`None`,s.errors||c?`${s.errors.toLocaleString()} failed, ${c.toLocaleString()} stopped`:void 0,!!s.errors]),p?.run!==void 0&&(!m||!s.currency||m===s.currency)){let e=s.priced?q(s.amount,p.run):void 0;h.push([`Budget per run`,G(p.run,m),e===void 0?void 0:`this ${n} used ${Math.round(e)}%`,e!==void 0&&e>100])}return(0,V.jsxs)(`section`,{className:`panel ${r?`ov-s12`:`mdl-s6`} mdl-set`,"aria-labelledby":`mdl-set-h`,children:[(0,V.jsx)(Y,{icon:Fn,tone:`brand`,title:(0,V.jsxs)(`span`,{id:`mdl-set-h`,children:[`Settings used in this `,n]})}),(0,V.jsx)(`dl`,{className:`mdl-dl`,children:h.map(([e,t,n,r])=>(0,V.jsxs)(v.Fragment,{children:[(0,V.jsx)(`dt`,{children:e}),(0,V.jsxs)(`dd`,{children:[(0,V.jsx)(`span`,{className:`mdl-v`,children:t}),n?(0,V.jsx)(`span`,{className:`mdl-note${r?` warn`:``}`,children:n}):null]})]},e))}),(0,V.jsx)(`p`,{className:`ov-caption`,children:`The report keeps counts and names of each call, not the model's temperature, limits or retries.`})]})}function JZ({data:e,used:t,wide:n,onCalculator:r}){let i=e.env?.profiles||[],a=i.length?i.map(e=>({key:e.name,name:e.name,model:e.provider?`${e.provider}/${e.model}`:e.model,price:e.price,inUse:t.has(e.model)})):e.env?.price?[{key:`env`,name:e.env.model,model:``,price:e.env.price,inUse:!0}]:[],o=io(a,VZ);if(!a.length)return null;let s=[...new Set(a.map(e=>e.price.note).filter(Boolean))];return(0,V.jsxs)(`section`,{className:`panel ${n?`ov-s12`:`mdl-s6`} mdl-price`,"aria-labelledby":`mdl-price-h`,children:[(0,V.jsx)(Y,{icon:ht,tone:`brand`,title:(0,V.jsx)(`span`,{id:`mdl-price-h`,children:`Prices used for cost estimates`}),action:r?{label:`Change in Calculator`,onClick:r}:void 0}),(0,V.jsx)(`div`,{className:`mdl-price-wrap`,children:(0,V.jsxs)(`table`,{className:`mdl-ptable`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`col`,children:`Per million tokens`}),(0,V.jsx)(`th`,{scope:`col`,children:`Input`}),(0,V.jsx)(`th`,{scope:`col`,children:`Cached input`}),(0,V.jsx)(`th`,{scope:`col`,children:`Output`})]})}),(0,V.jsx)(`tbody`,{children:o.shown.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`th`,{scope:`row`,title:e.model?`${e.name}: ${e.model}`:e.name,children:[(0,V.jsxs)(`span`,{className:`mdl-opt-top`,children:[(0,V.jsx)(`span`,{className:`mdl-name`,children:e.name}),e.inUse?(0,V.jsx)(`span`,{className:`mdl-tag`,children:`In use`}):null]}),e.model?(0,V.jsx)(`code`,{className:`mdl-code`,children:e.model}):null]}),(0,V.jsx)(`td`,{children:G(e.price.input,e.price.currency)}),(0,V.jsx)(`td`,{title:e.price.cachedInput===void 0?`No cached-input price: cached input is priced at the input price`:void 0,children:e.price.cachedInput===void 0?(0,V.jsx)(`span`,{className:`dim`,children:`as input`}):G(e.price.cachedInput,e.price.currency)}),(0,V.jsx)(`td`,{children:G(e.price.output,e.price.currency)})]},e.key))})]})}),(0,V.jsx)(ao,{...o,label:`Prices pages`}),(0,V.jsxs)(`p`,{className:`ov-caption`,children:[i.length?`From the profiles in llms.json. `:`The browser agent’s own price. `,s.length?`${s.slice(0,2).join(`; `)}. `:``,`Set your contracted rates there so every cost in this report matches your invoice.`]})]})}function YZ({data:e,onNavigate:t}){let n=e.usage,r=!!n?.calls.length,[i,a]=(0,v.useState)(r?`report`:`history`),o=(0,v.useMemo)(()=>WZ(e,i),[e,i]),s=e.kind===`run`?`run`:`suite`,c=n?.historyDays||30,l=i===`report`?`this ${s}`:`the last ${W(c,`day`)}`,u=r&&t?()=>t(`calculator`):void 0,d=(0,V.jsx)(eo,{title:`Models`,subtitle:(0,V.jsxs)(`span`,{className:`ug-sub`,children:[(0,V.jsx)(`span`,{children:o&&o.models.length===1?`The model behind ${l}, and what the listed alternatives would cost`:`The models behind ${o?l:`the calls`}, and what the listed alternatives would cost`}),e.env?.model?(0,V.jsxs)(`span`,{children:[`Model `,(0,V.jsx)(`code`,{children:e.env.model})]}):null]})});if(!o)return(0,V.jsxs)(`div`,{className:`ug mdl`,children:[d,(0,V.jsxs)(`div`,{className:`panel empty-state`,children:[(0,V.jsx)(xt,{size:26}),(0,V.jsx)(`h3`,{children:`No model calls in this report`}),(0,V.jsx)(`p`,{children:`Calls are kept from this version of ForgeQE on.`})]})]});let{t:f,models:p,options:m,now:h,timed:g,biggest:_}=o,y=[...p].sort((e,t)=>t.calls-e.calls||t.amount-e.amount)[0],b=new Set(p.map(e=>e.name)),x=p.length===1?m.filter(e=>!e.inUse):m,S=[...x].sort((e,t)=>e.cost-t.cost)[0],C=[...x].sort((e,t)=>t.cost-e.cost)[0],w=S&&h?100*(h-S.cost)/h:void 0,T=g.length?za(g,.5):void 0,E=g.length?za(g,.95):void 0,D=p.filter(e=>e.calls-e.priced),O=[],k=[],A=(e,t)=>e.push((0,V.jsx)(v.Fragment,{children:t},e.length));p.length===1?A(O,(0,V.jsxs)(V.Fragment,{children:[`Every call in `,l,` went to `,(0,V.jsx)(`code`,{children:y.provider?`${y.provider}/${y.name}`:y.name}),f.priced?(0,V.jsxs)(V.Fragment,{children:[`, for `,(0,V.jsx)(`strong`,{title:Zi(La(f)),children:Xi(La(f))}),` over `,X(f.calls,`call`)]}):(0,V.jsxs)(V.Fragment,{children:[` over `,X(f.calls,`call`)]}),`.`,` `]})):A(O,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`strong`,{children:[p.length.toLocaleString(),` models`]}),` answered `,X(f.calls,`call`),` in `,l,`; `,(0,V.jsx)(`code`,{children:y.name||`unnamed`}),` made `,Math.round(q(y.calls,f.calls)),`% of them`,f.priced?` and ${Math.round(q(y.amount,f.amount))}% of the ${Xi(La(f))}`:``,`.`,` `]})),T!==void 0&&E!==void 0&&A(O,(0,V.jsxs)(V.Fragment,{children:[`Half the answers came within `,H(T),`, 95% within `,H(E),`. `]})),S&&w!==void 0&&w>=1?A(k,(0,V.jsxs)(V.Fragment,{children:[`At the prices in llms.json the same tokens would cost `,(0,V.jsx)(`strong`,{children:G(S.cost,S.rate.currency)}),` on `,(0,V.jsx)(`code`,{children:S.name}),`, `,Math.round(w),`% less`,C&&C!==S?(0,V.jsxs)(V.Fragment,{children:[`, and `,G(C.cost,C.rate.currency),` on `,(0,V.jsx)(`code`,{children:C.name})]}):null,`. That is the price alone: nothing in this report checked that a cheaper model reaches the same verdicts.`,` `]})):x.length&&h!==void 0?A(k,(0,V.jsx)(V.Fragment,{children:`None of the other prices in llms.json would make the same tokens cheaper. `})):S&&h===void 0&&C&&C!==S&&A(k,(0,V.jsxs)(V.Fragment,{children:[`At the prices in llms.json the same tokens would cost from `,G(S.cost,S.rate.currency),` on `,(0,V.jsx)(`code`,{children:S.name}),` to `,G(C.cost,C.rate.currency),` on `,(0,V.jsx)(`code`,{children:C.name}),`; that is the price alone, not a check that a cheaper model reaches the same verdicts.`,` `]})),f.errors&&A(k,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`strong`,{className:`ug-bad`,children:[X(f.errors,`call`),` failed`]}),`. `]}));for(let e of D.slice(0,3))A(k,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`code`,{children:e.name||`unnamed`}),` has no price for `,X(e.calls-e.priced,`call`),`: add one to its profile in llms.json. `]}));let j=[{label:p.length===1?`Model in use`:`Main model`,value:y.name||`unnamed`,sub:p.length===1?`${y.provider?`via ${y.provider}, `:``}for all ${X(f.calls,`call`)}`:`${Math.round(q(y.calls,f.calls))}% of calls, and ${X(p.length-1,`other`)}`,icon:xt,title:y.name},{label:i===`report`?`Cost this ${s}`:`Cost, ${W(c,`day`)}`,value:Xi(La(f)),sub:f.priced?`${G(f.amount/Math.max(1,f.priced),f.currency)} a call`:`no call has a price`,icon:ht},...S?[{label:`Cheapest listed`,value:G(S.cost,S.rate.currency),sub:w===void 0?`${S.name}, at its price`:`${S.name}: ${w>=.5?`${Math.round(w)}% less`:w<=-.5?`${Math.round(-w)}% more`:`the same`}, at its price`,icon:Fr,tone:w!==void 0&&w>=1?`pass`:void 0,title:`${S.name} (${S.model}): the same tokens at its price`}]:[],..._?[{label:`Largest prompt`,value:U(_.input),sub:`tokens; ${U(Math.round(f.input/Math.max(1,f.calls)))} on average`,icon:li}]:[{label:`Tokens`,value:U(f.tokens),sub:`${U(f.input)} in, ${U(f.output)} out`,icon:li}],...T===void 0?[{label:`From cache`,value:`${Math.round(Ra(f))}%`,sub:`of prompt tokens`,icon:Qt}]:[{label:`Median time`,value:H(T),sub:`95% within ${H(E)}`,icon:di}]],M=i===`report`,N=!!(e.env?.profiles?.length||e.env?.price),P=M&&N;return(0,V.jsxs)(`div`,{className:`ug mdl`,children:[d,r&&n?.history.length?(0,V.jsx)(to,{value:i,onChange:a,items:[{id:`report`,label:`This ${s}`,icon:B,count:n.calls.length},{id:`history`,label:`Last ${W(c,`day`)}`,icon:je,count:n.history.reduce((e,t)=>e+t.calls,0)}]}):null,(0,V.jsxs)(`section`,{className:`panel ug-brief mdl-brief`,"aria-labelledby":`mdl-brief-h`,children:[(0,V.jsxs)(`div`,{className:`ug-brief-text`,children:[(0,V.jsxs)(`header`,{className:`panel-head`,children:[(0,V.jsx)(`span`,{className:`ph-icon brand`,children:(0,V.jsx)(B,{size:15})}),(0,V.jsx)(`h2`,{id:`mdl-brief-h`,children:`Model summary`}),(0,V.jsxs)(`span`,{className:`fl-note`,children:[`written by ForgeQE from `,l]})]}),(0,V.jsx)(`p`,{className:`fl-p`,children:O}),k.length?(0,V.jsx)(`p`,{className:`fl-p fl-dim`,children:k}):null]}),(0,V.jsx)(po,{items:j})]}),(0,V.jsxs)(`div`,{className:`ov-grid ug-grid`,children:[m.length?(0,V.jsx)(GZ,{view:o,scopeName:l,onCalculator:u},`cmp-${i}`):null,(0,V.jsx)(KZ,{view:o,scope:i},`used-${i}`),M?(0,V.jsx)(qZ,{data:e,view:o,what:s,wide:!P}):null,N?(0,V.jsx)(JZ,{data:e,used:b,wide:!P,onCalculator:u}):null]})]})}var XZ=30,ZZ=3,QZ=30,$Z=4,eQ=7,tQ=864e5,nQ=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(void 0,{day:`numeric`,month:`short`,timeZone:`UTC`}),rQ=(e,t)=>new Date(Date.parse(`${e}T00:00:00Z`)+t*tQ).toISOString().slice(0,10),iQ=e=>{if(!(e>0))return 1;let t=10**Math.floor(Math.log10(e));return([1,2,2.5,5,10].find(n=>e<=n*t)||10)*t},aQ=e=>e.length?e.reduce((e,t)=>e+t,0)/e.length:0;function oQ(e){let t=e.usage,n=t.history,r=e.generatedAt||new Date().toISOString(),i=r.slice(0,10),a=n.find(e=>e.currency)?.currency||t.budget?.currency,{days:o}=Ha(n,t.historyDays,r),s=o.findIndex(e=>e.calls>0),c=s<0?[]:o.slice(s),l=Ua(c,r),u=c.filter(e=>e.day<=i).slice(-l.basedOn),d=c.filter(e=>e.day<=i).slice(-2*l.basedOn,-l.basedOn),f=new Map;for(let e of n){let t=f.get(e.day)||new Map;t.set(e.agent,(t.get(e.agent)||0)+e.amount),f.set(e.day,t)}let p=(e,t)=>t.filter(t=>t.agent===e).reduce((e,t)=>e+t.amount,0),m=new Map;for(let e of n)m.set(e.agent,(m.get(e.agent)||0)+e.amount);let h=n.reduce((e,t)=>e+t.amount,0),g=[];for(let t of Ja(e)){if(!t.monthly||!t.area||t.currency!==a)continue;let e=p(t.area,n);if(!e)continue;let r=Math.min(1,Math.max(0,t.monthly/e));if(r<.005)continue;let i=t.id.split(`-`)[0],o=i===`cache`?`${t.area}: cache more of the prompt`:i===`model`?`${t.area}: a cheaper model`:i===`replay`?`Trust page memory for replayed tests`:t.title;g.push({id:t.id,label:o,hint:t.title,agent:t.area,share:r})}let _=l.unusual.filter(e=>u.some(t=>t.day===e));return _.length&&u.length-_.length>=ZZ&&g.push({id:`unusual`,label:`Leave out the unusual ${_.length===1?`day`:`days`}`,hint:`${oo(_.map(nQ))}, well above the usual day`,unusual:!0}),{until:r,today:i,currency:a,since:c,f:l,basis:u,prior:d,byDay:f,periodByAgent:m,period:h,levers:g,unusualInBasis:_,budget:t.budget,historyDays:t.historyDays}}function sQ(e,t){let n=t.has(`unusual`)?new Set(e.unusualInBasis):new Set,r=e.basis.filter(e=>!n.has(e.day)),i=aQ(r.map(e=>e.amount)),a=new Map;for(let n of e.levers)n.agent&&n.share&&t.has(n.id)&&a.set(n.agent,(a.get(n.agent)??1)*(1-n.share));let o=0;for(let[t,n]of a)o+=aQ(r.map(n=>e.byDay.get(n.day)?.get(t)||0))*(1-n);return Math.max(0,i-o)}function cQ({data:e,onNavigate:t}){let n=e.usage?.history||[],r=(0,v.useMemo)(()=>n.length?oQ(e):null,[e,n.length]),[i,a]=(0,v.useState)(()=>new Set),o=e.usage?.budget,s=e=>G(e,r?.currency||o?.currency),c=(0,V.jsx)(eo,{title:`Trends and forecast`,subtitle:(0,V.jsxs)(`span`,{className:`ug-sub`,children:[(0,V.jsxs)(`span`,{children:[`Model spend on this machine so far, and the next `,XZ,` days at the recent pace`]}),o?.month?(0,V.jsxs)(`span`,{children:[`Budget `,(0,V.jsxs)(`b`,{className:`fc-budget-sub`,children:[s(o.month),` a month`]})]}):o?.day?(0,V.jsxs)(`span`,{children:[`Budget `,(0,V.jsxs)(`b`,{className:`fc-budget-sub`,children:[s(o.day),` a day`]})]}):null]}),actions:t?(0,V.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(`trends`),children:`Cost history in Trends`}):void 0});if(!r||!r.since.length)return(0,V.jsxs)(`div`,{className:`ug fc`,children:[c,(0,V.jsxs)(`div`,{className:`panel empty-state`,children:[(0,V.jsx)(hi,{size:26}),(0,V.jsx)(`h3`,{children:`No usage history yet`}),(0,V.jsx)(`p`,{children:n.length?`The ledger has no calls in the last ${W(e.usage.historyDays,`day`)}.`:`Every model call is kept in the usage ledger; the forecast appears here once it has a few days of calls.`})]})]});let{f:l,basis:u,prior:d,since:f,levers:p,periodByAgent:m,period:h,today:g}=r,_=l.basedOn>=ZZ,y=l.perDay,b=y*XZ,x=Math.max(0,y-l.sd)*XZ,S=(y+l.sd)*XZ,C=d.length>=7?aQ(d.map(e=>e.amount)):void 0,w=C?q(y-C,C):void 0,T=u.slice(-7).reduce((e,t)=>e+t.amount,0),E=p.map(e=>({...e,effect:y-sQ(r,new Set([e.id]))})).sort((e,t)=>Number(!!e.unusual)-Number(!!t.unusual)||t.effect-e.effect),D=E.filter(e=>!e.unusual),O=[...D.slice(0,$Z),...E.filter(e=>e.unusual)],k=D.length-Math.min(D.length,$Z),A=[...i].some(e=>O.some(t=>t.id===e)),j=A?sQ(r,i):y,M=j*XZ,N=o?.month?{amount:o.month,label:`Month budget`}:o?.day?{amount:o.day*XZ,label:`${XZ} days at the day budget`}:void 0,P=l.spent+y*l.left,F=new Date(`${l.month}-01T00:00:00Z`).toLocaleDateString(void 0,{month:`long`,timeZone:`UTC`}),ee=[...m.entries()].sort((e,t)=>t[1]-e[1]),te=o?.day?f.filter(e=>e.amount>o.day).length:0,I=[],ne=[],L=(e,t)=>e.push((0,V.jsx)(v.Fragment,{children:t},e.length));_?y?(L(I,(0,V.jsxs)(V.Fragment,{children:[`At the recent pace, model spend will be about `,(0,V.jsxs)(`strong`,{children:[s(b),` over the next `,XZ,` days`]}),l.sd?` (likely between ${s(x)} and ${s(S)})`:``,N?b>N.amount?`, over the ${s(N.amount)} ${N.label.toLowerCase()}`:`, inside the ${s(N.amount)} ${N.label.toLowerCase()}`:``,`.`]})),L(I,(0,V.jsxs)(V.Fragment,{children:[` `,F,` so far: `,s(l.spent),l.left?`, heading for ${s(P)} by the month's end`:``,`.`]})),w!==void 0&&Math.abs(w)>=10?L(I,(0,V.jsxs)(V.Fragment,{children:[` The average day is `,Math.abs(Math.round(w)),`% `,w>0?`higher`:`lower`,` than in the `,W(d.length,`day`),` before.`]})):w!==void 0&&L(I,(0,V.jsxs)(V.Fragment,{children:[` The pace is about the same as in the `,W(d.length,`day`),` before.`]}))):L(I,(0,V.jsxs)(V.Fragment,{children:[`There were `,(0,V.jsxs)(`strong`,{children:[`no priced calls in the last `,W(l.basedOn,`day`)]}),`, so at the recent pace nothing more will be spent. This month so far: `,s(l.spent),`.`]})):L(I,(0,V.jsxs)(V.Fragment,{children:[`The ledger has `,(0,V.jsxs)(`strong`,{children:[W(l.basedOn,`day`),` of calls`]}),` so far, costing `,s(u.reduce((e,t)=>e+t.amount,0)),`: too few to tell a pace from one busy day, so there is no forecast yet. It needs `,ZZ,` days.`]})),o?.month&&_&&y&&(l.spent>=o.month?L(ne,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`strong`,{className:`ug-bad`,children:[F,` is over its budget already:`]}),` `,s(l.spent),` of `,s(o.month),`, with `,W(l.left,`day`),` to go. `]})):P>o.month&&L(ne,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`strong`,{className:`ug-bad`,children:[F,` passes its budget at this pace`]}),`: `,s(P),` of `,s(o.month),` by the month's end; `,s(Math.max(0,(o.month-l.spent)/Math.max(1,l.left))),` a day or less from here keeps it inside. `]}))),te&&L(ne,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`strong`,{className:`ug-warn`,children:X(te,`day`)}),` of the ledger went over the `,s(o.day),` day budget. `]})),l.unusual.length&&L(ne,(0,V.jsxs)(V.Fragment,{children:[`Unusual `,l.unusual.length===1?`day`:`days`,`: `,oo(l.unusual.slice(-4).map(e=>`${nQ(e)} (${s(f.find(t=>t.day===e).amount)})`)),l.unusual.length>4?` and ${l.unusual.length-4} more`:``,`, more than twice the usual spread above the average day. `]})),ee.length>1&&h&&L(ne,(0,V.jsxs)(V.Fragment,{children:[`Of the ledger's spend, `,oo(ee.slice(0,3).map(([e,t])=>`${e} ${Math.round(q(t,h))}%`)),`. `]})),_&&L(ne,(0,V.jsxs)(V.Fragment,{children:[`This is an estimate: the average of the last `,W(l.basedOn,`day`),` (`,s(y),` a day; days with no calls count as nothing, today so far as a whole day) carried forward`,l.sd?`, with one standard deviation of those days either side as the range`:``,`. It knows nothing of runs to come.`]}));let R=[_?{label:`Next ${XZ} days`,value:s(b),sub:l.sd?`${s(x)} to ${s(S)}`:`${s(y)} a day, every day the same`,icon:Ne,tone:N&&b>N.amount?`fail`:void 0}:{label:`Next ${XZ} days`,value:`—`,sub:`needs ${ZZ} days of calls`,icon:Ne},{label:`${F} so far`,value:s(l.spent),sub:_&&l.left?`heading for ${s(P)}`:l.left?`${W(l.left,`day`)} to go`:`the last day`,icon:je}];return o?.month?R.push({label:`Month budget`,value:s(o.month),sub:_?P>o.month?`${s(P)} by ${F}'s end`:`${Math.round(q(P,o.month))}% used by ${F}'s end`:`${Math.round(q(l.spent,o.month))}% used so far`,icon:Ci,tone:l.spent>=o.month||_&&P>o.month?`fail`:_&&l.left&&l.spent+(y+l.sd)*l.left>o.month?`warn`:void 0}):o?.day&&R.push({label:`Day budget`,value:s(o.day),sub:te?`${X(te,`day`)} over it`:`no day over it`,icon:Ci,tone:te?`warn`:void 0}),R.push({label:`Per day`,value:_?s(y):`—`,sub:_?w===void 0?`average of the last ${W(l.basedOn,`day`)}`:`${w>=0?`up`:`down`} ${Math.abs(Math.round(w))}% on the ${W(d.length,`day`)} before`:`${W(l.basedOn,`day`)} of calls so far`,icon:hi}),R.push({label:`Last 7 days`,value:s(T),sub:X(u.slice(-7).reduce((e,t)=>e+t.calls,0),`call`),icon:Fe}),(0,V.jsxs)(`div`,{className:`ug fc`,children:[c,(0,V.jsxs)(`section`,{className:`panel ug-brief`,"aria-labelledby":`fc-brief-h`,children:[(0,V.jsxs)(`div`,{className:`ug-brief-text`,children:[(0,V.jsxs)(`header`,{className:`panel-head`,children:[(0,V.jsx)(`span`,{className:`ph-icon brand`,children:(0,V.jsx)(B,{size:15})}),(0,V.jsx)(`h2`,{id:`fc-brief-h`,children:`Forecast summary`}),(0,V.jsx)(`span`,{className:`fl-note`,children:`written by ForgeQE from the usage ledger`})]}),(0,V.jsx)(`p`,{className:`fl-p`,children:I}),ne.length?(0,V.jsx)(`p`,{className:`fl-p fl-dim`,children:ne}):null]}),(0,V.jsx)(po,{items:R})]}),(0,V.jsxs)(`div`,{className:`ov-grid ug-grid`,children:[_&&y?(0,V.jsx)(lQ,{perDay:y,sd:l.sd,scnPerDay:A?j:void 0,limit:N,today:g,money:s,basedOn:l.basedOn,wide:!p.length}):null,_&&y&&p.length?(0,V.jsxs)(`section`,{className:`panel fc-s4 fc-scn`,"aria-labelledby":`fc-scn-h`,children:[(0,V.jsx)(Y,{icon:Yr,tone:`brand`,title:(0,V.jsx)(`span`,{id:`fc-scn-h`,children:`Scenario`})}),(0,V.jsxs)(`p`,{className:`ov-caption`,children:[`Turn changes on to see their effect on the next `,XZ,` days. Savings are the ones the Optimise page priced on this report's calls, carried to the same agent's other days.`]}),(0,V.jsx)(`div`,{className:`fc-levers`,children:O.map(({effect:e,...t})=>{let n=i.has(t.id);return(0,V.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":n,className:`fc-lever${n?` on`:``}`,onClick:()=>a(e=>{let n=new Set(e);return n.has(t.id)?n.delete(t.id):n.add(t.id),n}),title:t.hint,children:[(0,V.jsx)(`span`,{className:`fc-switch`,"aria-hidden":`true`,children:(0,V.jsx)(`i`,{})}),(0,V.jsx)(`span`,{className:`fc-lever-label`,children:t.label}),(0,V.jsx)(`span`,{className:`fc-lever-eff${e>0?` less`:``}`,children:e>0?`−${s(e*XZ)}`:`—`}),(0,V.jsx)(`span`,{className:`fc-lever-hint`,children:t.hint})]},t.id)})}),k?(0,V.jsxs)(`p`,{className:`ov-caption fc-more`,children:[X(k,`smaller saving`),` on the`,` `,t?(0,V.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(`optimise`),children:`Optimise page`}):`Optimise page`,`.`]}):null,(0,V.jsxs)(`dl`,{className:`fc-dl`,children:[(0,V.jsx)(`dt`,{children:`Per day`}),(0,V.jsx)(`dd`,{children:s(j)}),(0,V.jsx)(`dt`,{children:`Days ahead`}),(0,V.jsx)(`dd`,{children:XZ}),(0,V.jsxs)(`dt`,{children:[`Next `,XZ,` days`]}),(0,V.jsx)(`dd`,{className:`fc-total${N?M>N.amount?` over`:` inside`:``}`,children:s(M)})]})]}):null,(0,V.jsx)(uQ,{view:r,perDay:_?y:void 0,money:s})]})]})}function lQ({perDay:e,sd:t,scnPerDay:n,limit:r,today:i,money:a,basedOn:o,wide:s}){let c=Array.from({length:31},(r,a)=>({i:a,label:nQ(rQ(i,a)),current:e*a,band:[Math.max(0,e-t)*a,(e+t)*a],...n===void 0?{}:{scenario:n*a}})),l=n??e,u=r&&l>0?Math.ceil(r.amount/l):void 0,d=u!==void 0&&u<=XZ?u:void 0,f=l*XZ,p=e=>m>=8?a(Math.round(e)).replace(/[.,]00(?=\D*$)/,``):a(e),m=iQ(Math.max((e+t)*XZ,f,r?r.amount*1.05:0));return(0,V.jsxs)(`section`,{className:`panel ${s?`ov-s12`:`fc-s8`} fc-ahead`,"aria-labelledby":`fc-ahead-h`,children:[(0,V.jsxs)(`div`,{className:`ug-head`,children:[(0,V.jsx)(Y,{icon:hi,tone:`brand`,title:(0,V.jsxs)(`span`,{id:`fc-ahead-h`,children:[`Spend over the next `,XZ,` days`]})}),(0,V.jsxs)(`span`,{className:`ug-legend`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`i`,{className:`sw fc-sw-cur`}),`At the recent pace`]}),n===void 0?null:(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`i`,{className:`sw fc-sw-scn`}),`Your scenario`]}),r?(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`i`,{className:`sw fc-sw-bud`}),r.label]}):null]})]}),(0,V.jsxs)(`p`,{className:`fc-note`,children:[`Recent pace: `,a(e*XZ),`.`,n===void 0?``:` Your scenario: ${a(f)}.`,r?f>r.amount?` Over the ${a(r.amount)} ${r.label.toLowerCase()}${d?` on ${nQ(rQ(i,d))}`:``}.`:` Inside the ${a(r.amount)} ${r.label.toLowerCase()}.`:``]}),(0,V.jsx)(`div`,{className:`fc-chart`,role:`img`,"aria-label":`Spend added up over the next ${XZ} days: ${a(e*XZ)} at the recent pace${n===void 0?``:`, ${a(f)} in the scenario`}${r?`, against ${a(r.amount)}`:``}`,children:(0,V.jsx)(Zb,{width:`100%`,height:`100%`,minHeight:230,children:(0,V.jsxs)(cX,{data:c,margin:{top:22,right:12,left:0,bottom:0},children:[(0,V.jsx)(DW,{stroke:uX,vertical:!1}),(0,V.jsx)(eJ,{dataKey:`label`,tick:lX,axisLine:!1,tickLine:!1,interval:`preserveStartEnd`,minTickGap:28}),(0,V.jsx)(hJ,{tick:lX,axisLine:!1,tickLine:!1,width:60,domain:[0,m],ticks:[0,m/4,m/2,3*m/4,m],tickFormatter:e=>p(Number(e))}),(0,V.jsx)(UL,{cursor:dX,contentStyle:fX,formatter:(e,t)=>[Array.isArray(e)?`${a(Number(e[0]))} to ${a(Number(e[1]))}`:a(Number(e)),t]}),(0,V.jsx)(wK,{dataKey:`band`,name:`Likely range`,stroke:`none`,fill:pX.brand,fillOpacity:.12,isAnimationActive:!1}),(0,V.jsx)(jG,{type:`linear`,dataKey:`current`,name:`At the recent pace`,stroke:pX.brand,strokeWidth:2,dot:!1,isAnimationActive:!1}),n===void 0?null:(0,V.jsx)(jG,{type:`linear`,dataKey:`scenario`,name:`Your scenario`,stroke:pX.warn,strokeWidth:2.5,dot:!1,isAnimationActive:!1}),r?(0,V.jsx)(KH,{y:r.amount,stroke:pX.fail,strokeDasharray:`5 4`,strokeWidth:1.5}):null,r&&d?(0,V.jsx)(iU,{x:c[d].label,y:r.amount,r:5,fill:pX.fail,stroke:`#fff`,strokeWidth:2,label:e=>(0,V.jsxs)(`text`,{x:(e.viewBox?.x??0)+5,y:(e.viewBox?.y??0)-8,textAnchor:d>XZ*.7?`end`:d<XZ*.2?`start`:`middle`,fill:pX.fail,fontSize:11,fontWeight:600,children:[`Over on `,c[d].label]})}):null]})})}),(0,V.jsxs)(`p`,{className:`ov-caption fc-foot`,children:[t?`The shaded band is the likely range at the recent pace: the average day of the last ${W(o,`day`)}, one standard deviation of those days either side.`:`Every day of the last ${W(o,`day`)} cost the same, so there is no range.`,r&&r.label===`Month budget`?` The month budget counts calendar months; it is drawn here as the budget for 30 days.`:``]})]})}function uQ({view:e,perDay:t,money:n}){let{since:r,today:i,byDay:a,budget:o,historyDays:s}=e,c=r.filter(e=>e.day<=i).slice(-30),l=t===void 0?[]:Array.from({length:eQ},(e,t)=>rQ(i,t+1)),u=o?.day,d=Math.max(...c.map(e=>e.amount),t||0,u||0)||1,f=c.length+l.length,p=Math.max(1,Math.ceil(f/10)),m=f<=20,h=e=>[...a.get(e)?.entries()||[]].filter(([,e])=>e>0).sort((e,t)=>t[1]-e[1]).slice(0,3).map(([e,t])=>`${e} ${n(t)}`);return(0,V.jsxs)(`section`,{className:`panel ov-s12 fc-days`,"aria-labelledby":`fc-days-h`,children:[(0,V.jsxs)(`div`,{className:`ug-head`,children:[(0,V.jsx)(Y,{icon:Fe,tone:`brand`,title:(0,V.jsxs)(`span`,{id:`fc-days-h`,children:[`Spend per day: last `,W(c.length,`day`),l.length?` and next ${eQ}`:``]})}),(0,V.jsxs)(`span`,{className:`ug-legend`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`i`,{className:`sw fc-sw-act`}),`Actual`]}),l.length?(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`i`,{className:`sw fc-sw-next`}),`Forecast, recent pace`]}):null,u?(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`i`,{className:`sw fc-sw-over`}),`Over the `,n(u),` day budget`]}):null]})]}),(0,V.jsxs)(`div`,{className:`fc-bars${m?``:` dense`}`,children:[u?(0,V.jsx)(`span`,{className:`fc-budget`,style:{bottom:`${100*u/d}%`},"aria-hidden":`true`}):null,c.map(e=>{let t=u!==void 0&&e.amount>u,r=h(e.day);return(0,V.jsxs)(`span`,{className:`fc-bar`,title:`${nQ(e.day)}: ${n(e.amount)}, ${X(e.calls,`call`)}, ${U(e.tokens)} tokens${r.length?`; ${r.join(`, `)}`:``}${t?`; over the day budget`:``}${e.day===i?`; today so far`:``}`,children:[m?(0,V.jsx)(`b`,{children:n(e.amount)}):null,(0,V.jsx)(`i`,{className:t?`over`:e.day===i?`today`:void 0,style:{height:`${100*e.amount/d}%`}})]},e.day)}),l.map(e=>(0,V.jsxs)(`span`,{className:`fc-bar next`,title:`${nQ(e)} forecast: about ${n(t)}`,children:[m?(0,V.jsx)(`b`,{children:n(t)}):null,(0,V.jsx)(`i`,{style:{height:`${100*t/d}%`}})]},e))]}),(0,V.jsx)(`div`,{className:`fc-axis`,"aria-hidden":`true`,children:[...c.map(e=>e.day),...l].map((e,t)=>(0,V.jsx)(`span`,{className:t%(p*2)==0?`major`:void 0,children:t%p===0?nQ(e):``},e))}),(0,V.jsxs)(`p`,{className:`ov-caption fc-foot`,children:[r.length>c.length?`The ledger keeps ${W(s,`day`)}; the bars show the last ${QZ}. `:``,`Days are UTC; hover a bar for its calls, tokens and the agents that spent the most.`]})]})}var dQ=10,fQ=1e7,pQ=e=>e===void 0||!Number.isFinite(e)?``:String(Number(e.toFixed(4))),mQ=(e,t)=>t>=1?Math.round(e):Math.round(e/t)*t,hQ=e=>{let t=mQ(e.base,e.step);return String(Number(t.toFixed(e.step>=1?0:String(e.step).split(`.`)[1]?.length||1)))};function gQ(e,t){let n=e.trim(),r=hQ(t),i=Math.min(t.max,Math.max(t.min,Number.isFinite(t.base)?t.base:t.min));if(n===r)return{value:i,changed:!1};if(n===``)return{value:i,changed:!1,note:`Empty: using ${r}${t.unit||``}`};let a=Number(n);return Number.isFinite(a)?a<t.min?{value:t.min,changed:!0,note:`At least ${t.min.toLocaleString()}${t.unit||``}`}:a>t.max?{value:t.max,changed:!0,note:`At most ${t.max.toLocaleString()}${t.unit||``}`}:{value:t.int?Math.round(a):a,changed:!0}:{value:i,changed:!1,note:`Not a number: using ${r}${t.unit||``}`}}function _Q(e){let t=e.usage?.calls||[],n=Math.max(1,e.cases.length),r=Ga(t,n),i=Fa(t.map(Ma)),a=i.currency||e.env?.price?.currency,o=r.reduce((e,t)=>e+t.calls,0),s=r.reduce((e,t)=>e+t.kinds.fresh+t.kinds.cached+t.kinds.write+t.kinds.output,0),c=(e.env?.profiles||[]).filter(e=>!a||e.price.currency===a),l=r.map(t=>{let n=t.kinds.fresh+t.kinds.cached+t.kinds.write+t.kinds.output,r=Ka(t.model,e,a),i=!r&&t.amount!==void 0&&n?t.amount/n*1e6:void 0,o=r||(i===void 0?void 0:{input:i,cachedInput:i,output:i,currency:a||``});return{...t,tokens:n,rate:o,averaged:!r&&i!==void 0}}),u=e=>e.rate&&!e.averaged?1:0,d=[...l].sort((e,t)=>u(t)-u(e)||(t.amount||0)-(e.amount||0)||t.tokens-e.tokens)[0];return{tests:n,calls:t.length,agents:l,currency:a,profiles:c,callsPerTest:o,tokensPerCall:o?s/o:0,cache:Ra(i),perRunNow:i.priced?i.amount:void 0,estimate:i.estimate,main:d,budget:e.usage?.budget}}var vQ=e=>Number.isFinite(e)&&e>0?e:0;function yQ(e,t,n){let r=t.calls.changed?e.callsPerTest?t.calls.value/e.callsPerTest:0:1,i=t.tokens.changed?e.tokensPerCall?t.tokens.value/e.tokensPerCall:0:1,a={input:n.custom.input,cachedInput:n.custom.cached,output:n.custom.output,currency:e.currency||``},o=t=>e.profiles.find(e=>e.name===t),s=e.agents.map(e=>{let s={fresh:e.kinds.fresh*r*i,cached:e.kinds.cached*r*i,write:e.kinds.write*r*i,output:e.kinds.output*r*i};if(t.cache.changed){let e=s.fresh+s.cached;s.cached=e*t.cache.value/100,s.fresh=e-s.cached}let c=n.perAgent[e.agent],l=c?o(c):n.mode!==`now`&&n.mode!==`custom`?o(n.mode):void 0,u=n.mode===`custom`&&!c?a:l?l.price:e.rate,d=n.mode===`custom`&&!c?`your prices`:l?l.model:e.model,f=u?{input:vQ((s.fresh+s.write)*u.input/1e6),cached:vQ(s.cached*(u.cachedInput??u.input)/1e6),output:vQ(s.output*u.output/1e6)}:void 0,p=u?vQ(Wa(s,u)):void 0;return{...e,k:s,choice:c||``,model:d,rate:u,parts:f,perTest:p,tokensPerTest:vQ(s.fresh+s.cached+s.write+s.output),callsPerTest:vQ(e.calls*r),averaged:e.averaged&&!l&&!(n.mode===`custom`&&!c)}}),c=t.tests.value,l=s.reduce((e,t)=>e+(t.perTest||0),0),u=vQ(l*c),d=vQ(u*t.runs.value),f=vQ(d*t.days.value),p=s.reduce((e,t)=>t.parts?{input:e.input+t.parts.input*c,cached:e.cached+t.parts.cached*c,output:e.output+t.parts.output*c}:e,{input:0,cached:0,output:0}),m=e.perRunNow===void 0?void 0:vQ(e.perRunNow*t.runs.value*t.days.value),h=0;for(let e of s){if(!e.rate)continue;let t=e.k.fresh+e.k.cached;h+=Math.min(t*.1,e.k.fresh)*(e.rate.input-(e.rate.cachedInput??e.rate.input))/1e6}return{rows:s,unpriced:s.filter(e=>e.perTest===void 0),perTest:l,perRun:u,perDay:d,perMonth:f,perYear:vQ(f*12),tokensPerRun:vQ(s.reduce((e,t)=>e+t.tokensPerTest,0)*c),callsPerRun:vQ(s.reduce((e,t)=>e+t.callsPerTest,0)*c),split:p,nowMonth:m,cacheSaving:vQ(h*c*t.runs.value*t.days.value),cacheShare:(()=>{let e=s.reduce((e,t)=>e+t.k.fresh+t.k.cached,0);return e?Math.round(100*s.reduce((e,t)=>e+t.k.cached,0)/e):0})()}}var bQ=[`tests`,`calls`,`tokens`,`cache`,`runs`,`days`],xQ=(e,t)=>({label:t,min:0,max:1e4,step:.01,base:e,hint:``});function SQ(e){let t=e.callsPerTest>=10?Math.round(e.callsPerTest).toLocaleString():e.callsPerTest.toFixed(1);return{tests:{label:`Tests per run`,min:1,max:1e5,step:1,int:!0,base:e.tests,hint:`This run had ${e.tests.toLocaleString()}`},calls:{label:`Model calls per test`,min:0,max:1e4,step:.1,base:e.callsPerTest,hint:`This run averaged ${t}; retries and waits push it up`},tokens:{label:`Tokens per call`,min:0,max:2e6,step:1,int:!0,base:e.tokensPerCall,hint:`This run averaged ${U(Math.round(e.tokensPerCall))}; smaller snapshots cut it`},cache:{label:`Prompt read from cache`,min:0,max:100,step:1,base:e.cache,unit:`%`,hint:`This run read ${e.cache}% from the provider's cache`},runs:{label:`Runs per day`,min:0,max:1e3,step:1,int:!0,base:1,hint:`Scheduled runs plus runs on each deploy`},days:{label:`Days per month`,min:1,max:31,step:1,int:!0,base:30,hint:`22 for weekdays only`}}}var CQ=e=>{if(e.unit===`%`||e.max<=31)return e.max;let t=Math.max(e.base*4,e.int?10:1),n=10**Math.floor(Math.log10(t));return Math.min(e.max,Math.ceil(t/n)*n)};function wQ({data:e,onNavigate:t}){let n=e.usage?.calls||[],r=(0,v.useMemo)(()=>_Q(e),[e]),i=(0,v.useMemo)(()=>SQ(r),[r]),a=()=>Object.fromEntries(bQ.map(e=>[e,hQ(i[e])])),o=()=>{let e=r.main?.rate;return{input:pQ(e?.input),cached:pQ(e?e.cachedInput??e.input:void 0),output:pQ(e?.output)}},[s,c]=(0,v.useState)(a),[l,u]=(0,v.useState)(`now`),[d,f]=(0,v.useState)(o),[p,m]=(0,v.useState)({}),h=(0,V.jsx)(eo,{title:`Calculator`,subtitle:(0,V.jsxs)(`span`,{className:`ug-sub`,children:[(0,V.jsx)(`span`,{children:`Estimate what a suite will cost before you run it`}),n.length?(0,V.jsxs)(`span`,{children:[`Starts from this run's real numbers: `,X(n.length,`model call`),` over `,X(r.tests,`test`)]}):null]})});if(!n.length)return(0,V.jsxs)(`div`,{className:`ug cc`,children:[h,(0,V.jsxs)(`div`,{className:`panel empty-state`,children:[(0,V.jsx)(De,{size:26}),(0,V.jsx)(`h3`,{children:`No model calls to start from`}),(0,V.jsx)(`p`,{children:`The calculator scales the calls of a report; this one has none.`})]})]});let g=Object.fromEntries(bQ.map(e=>[e,gQ(s[e],i[e])])),_=l===`custom`?void 0:l===`now`?r.main?.rate:r.profiles.find(e=>e.name===l)?.price,y={input:xQ(_?.input??0,`Input`),cached:xQ(_?_.cachedInput??_.input:0,`Cached input`),output:xQ(_?.output??0,`Output`)},b=l===`custom`?d:{input:pQ(_?.input),cached:pQ(_?_.cachedInput??_.input:void 0),output:pQ(_?.output)},x=e=>{let t={...y[e],base:0};return l===`custom`?gQ(d[e],t):{value:y[e].base,changed:!1}},S=yQ(r,g,{mode:l,custom:{input:x(`input`).value,cached:x(`cached`).value,output:x(`output`).value},perAgent:p}),C=r.currency,w=e=>e>=fQ?DQ(e,C):G(e,C),T=e=>e>=fQ?G(e,C):void 0,E=bQ.some(e=>s[e]!==hQ(i[e]))||l!==`now`||Object.keys(p).length>0,D=()=>{c(a()),u(`now`),f(o()),m({})},O=e=>{e===`custom`&&l!==`custom`&&f(b),u(e),m({})},k=(e,t)=>{f({...l===`custom`?d:b,[e]:t}),l!==`custom`&&(u(`custom`),m({}))},A=new Set(S.rows.map(e=>e.model)).size>1,j=S.unpriced.length===r.agents.length,M=S.nowMonth!==void 0&&!j?S.perMonth-S.nowMonth:void 0,N=M!==void 0&&Math.abs(M)<=Math.max(.005,(S.nowMonth||0)*.005),P=S.split.input+S.split.cached+S.split.output,F=e=>P?Math.round(100*e/P):0,ee=r.budget,te=[[`run`,`A run`,S.perRun],[`day`,`A day`,S.perDay],[`month`,`A month`,S.perMonth]].filter(([e])=>ee?.[e]),I=F(S.split.output),ne=j?null:S.cacheSaving>=.01&&S.cacheShare<=90?(0,V.jsxs)(V.Fragment,{children:[`Reading 10 more points of the prompt from the cache (`,Math.min(100,S.cacheShare+10),`% instead of `,S.cacheShare,`%) would save about `,(0,V.jsxs)(`strong`,{children:[w(S.cacheSaving),` a month`]}),` at these prices.`]}):I>=25?(0,V.jsxs)(V.Fragment,{children:[`Output is `,I,`% of a run's cost here, so shorter agent replies help more than you would expect.`]}):null;return(0,V.jsxs)(`div`,{className:`ug cc`,children:[h,(0,V.jsxs)(`div`,{className:`ov-grid ug-grid`,children:[(0,V.jsxs)(`section`,{className:`panel ov-s7 cc-in`,"aria-labelledby":`cc-in-h`,children:[(0,V.jsxs)(`div`,{className:`ug-head`,children:[(0,V.jsx)(Y,{icon:De,tone:`brand`,title:(0,V.jsx)(`span`,{id:`cc-in-h`,children:`Your suite`})}),(0,V.jsxs)(`button`,{type:`button`,className:`chip-btn cc-reset`,onClick:D,disabled:!E,children:[(0,V.jsx)(jr,{size:13,"aria-hidden":`true`}),`Back to this run`]})]}),(0,V.jsx)(`div`,{className:`cc-fields`,children:bQ.map(e=>{let t=i[e],n=g[e],r=`cc-f-${e}`,a=CQ(t);return(0,V.jsxs)(`div`,{className:`cc-field`,children:[(0,V.jsxs)(`label`,{className:`cc-label`,htmlFor:r,children:[t.label,t.unit?`, ${t.unit}`:``]}),(0,V.jsx)(`input`,{id:r,className:`field cc-num${n.note?` bad`:``}`,type:`number`,inputMode:`decimal`,min:t.min,max:t.max,step:t.step,value:s[e],"aria-invalid":n.note?!0:void 0,"aria-describedby":`${r}-hint`,onChange:t=>c({...s,[e]:t.target.value})}),(0,V.jsx)(`input`,{className:`cc-range`,type:`range`,"aria-label":`${t.label}, slider`,min:t.min,max:a,step:t.step,value:Math.min(a,n.value),onChange:t=>c({...s,[e]:t.target.value})}),(0,V.jsx)(`span`,{id:`${r}-hint`,className:`cc-hint${n.note?` bad`:``}`,children:n.note||t.hint})]},e)})}),(0,V.jsxs)(`div`,{className:`cc-prices`,children:[(0,V.jsxs)(`div`,{className:`cc-prices-head`,children:[(0,V.jsx)(`span`,{className:`cc-sub-h`,id:`cc-model-h`,children:`Model and prices`}),(0,V.jsxs)(`span`,{className:`fl-seg`,role:`group`,"aria-labelledby":`cc-model-h`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-pressed":l===`now`,className:l===`now`?`active`:void 0,onClick:()=>O(`now`),children:`As in this run`}),r.profiles.map(e=>(0,V.jsx)(`button`,{type:`button`,"aria-pressed":l===e.name,className:l===e.name?`active`:void 0,onClick:()=>O(e.name),title:`${e.provider}/${e.model}`,children:e.name},e.name)),(0,V.jsx)(`button`,{type:`button`,"aria-pressed":l===`custom`,className:l===`custom`?`active`:void 0,onClick:()=>O(`custom`),children:`Your prices`})]})]}),(0,V.jsx)(`div`,{className:`cc-price-row`,children:[`input`,`cached`,`output`].map(e=>{let t=x(e),n=`cc-p-${e}`;return(0,V.jsxs)(`div`,{className:`cc-price`,children:[(0,V.jsx)(`label`,{className:`cc-label`,htmlFor:n,children:y[e].label}),(0,V.jsxs)(`span`,{className:`cc-price-box${t.note?` bad`:``}`,children:[(0,V.jsx)(`span`,{className:`cc-cur`,title:C||void 0,children:EQ(C)}),(0,V.jsx)(`input`,{id:n,type:`number`,inputMode:`decimal`,min:0,max:1e4,step:.01,value:b[e],placeholder:l===`custom`?`0`:`no price`,"aria-invalid":t.note?!0:void 0,"aria-describedby":`cc-p-note`,onChange:t=>k(e,t.target.value)}),(0,V.jsx)(`span`,{className:`cc-per`,children:`per 1M`})]}),t.note?(0,V.jsx)(`span`,{className:`cc-hint bad`,children:t.note.replace(/using 0$/,`priced at 0`)}):null]},e)})}),(0,V.jsx)(`p`,{className:`ov-caption`,id:`cc-p-note`,children:l===`custom`?`Every agent is priced at these prices, per million tokens; cache writes at the input price.`:l===`now`?A?`Showing ${r.main?.model||`the main model`}'s prices; each agent keeps its own model's price until you pick another or type one.`:_?`The prices of this run’s model from llms.json, per million tokens. Type a price to use your own.`:`No price is known for this run’s model. Type prices per million tokens to estimate the cost.`:`Every agent on this profile from llms.json, per million tokens. Type a price to use your own.`})]})]}),(0,V.jsxs)(`section`,{className:`panel ov-s5 cc-out`,"aria-labelledby":`cc-out-h`,"aria-live":`polite`,children:[(0,V.jsx)(Y,{icon:$e,tone:`brand`,title:(0,V.jsx)(`span`,{id:`cc-out-h`,children:`Estimated cost`})}),(0,V.jsxs)(`div`,{className:`cc-big`,children:[(0,V.jsx)(`span`,{className:`cc-k`,children:`Per month`}),(0,V.jsx)(`span`,{className:`cc-month`,title:T(S.perMonth),children:j?`—`:w(S.perMonth)}),(0,V.jsx)(`span`,{className:`cc-delta${M===void 0||N?``:M>0?` more`:` less`}`,children:j?r.profiles.length?`No price is known for these models: pick a profile or type your prices.`:`No price is known for this model: type your prices.`:M===void 0?`${W(g.tests.value,`test`)}, ${W(g.runs.value,`run`)} a day, ${W(g.days.value,`day`)} a month`:N?`Same as this run's suite on that schedule (${w(S.nowMonth)} a month)`:`${w(Math.abs(M))} ${M>0?`more`:`less`} than this run's suite on that schedule (${w(S.nowMonth)} a month)`})]}),(0,V.jsxs)(`dl`,{className:`cc-dl`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Per run`}),(0,V.jsx)(`dd`,{title:T(S.perRun),children:j?`—`:w(S.perRun)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Per day`}),(0,V.jsx)(`dd`,{title:T(S.perDay),children:j?`—`:w(S.perDay)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Per year`}),(0,V.jsx)(`dd`,{title:T(S.perYear),children:j?`—`:w(S.perYear)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Tokens per run`}),(0,V.jsx)(`dd`,{children:TQ(S.tokensPerRun)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Calls per run`}),(0,V.jsx)(`dd`,{children:S.callsPerRun>=1e9?TQ(S.callsPerRun):Math.round(S.callsPerRun).toLocaleString()})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Per test`}),(0,V.jsx)(`dd`,{children:j?`—`:w(S.perTest)})]})]}),P>0?(0,V.jsxs)(`div`,{className:`cc-split`,children:[(0,V.jsx)(`span`,{className:`cc-k`,id:`cc-split-h`,children:`Where a run's cost goes`}),(0,V.jsxs)(`span`,{className:`split-bar cc-bar`,role:`img`,"aria-label":`Input ${F(S.split.input)}%, cached input ${F(S.split.cached)}%, output ${F(S.split.output)}%`,children:[(0,V.jsx)(`i`,{className:`fresh`,style:{flexGrow:100*S.split.input/P}}),(0,V.jsx)(`i`,{className:`cached`,style:{flexGrow:100*S.split.cached/P}}),(0,V.jsx)(`i`,{className:`output`,style:{flexGrow:100*S.split.output/P}})]}),(0,V.jsx)(`ul`,{className:`cc-legend`,"aria-labelledby":`cc-split-h`,children:[[`fresh`,`Input`,S.split.input],[`cached`,`Cached input`,S.split.cached],[`output`,`Output`,S.split.output]].map(([e,t,n])=>(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`i`,{className:`sw ${e}`}),(0,V.jsx)(`span`,{children:t}),(0,V.jsxs)(`b`,{children:[w(n),` `,(0,V.jsxs)(`small`,{children:[`(`,F(n),`%)`]})]})]},e))})]}):null,te.length&&!j?(0,V.jsx)(`ul`,{className:`cc-budgets`,"aria-label":`Against the budgets`,children:te.map(([e,t,n])=>{let r=ee[e],i=n>r?`over`:n>r*.8?`near`:`ok`;return(0,V.jsxs)(`li`,{className:i,children:[(0,V.jsxs)(`span`,{children:[t,` against the `,w(r),` `,e,` budget`]}),(0,V.jsx)(`b`,{children:100*n/r>9999?`over 9,999%`:`${Math.round(100*n/r).toLocaleString()}%`})]},e)})}):null,S.unpriced.length&&!j?(0,V.jsxs)(`p`,{className:`cc-warn`,children:[(0,V.jsx)(`strong`,{children:`Not priced:`}),` `,S.unpriced.map(e=>e.agent).join(`, `),`, as no price is known for `,S.unpriced.length===1?`its`:`their`,` model in this currency; the totals leave `,S.unpriced.length===1?`it`:`them`,` out.`]}):null,ne?(0,V.jsx)(`p`,{className:`cc-tip`,children:ne}):null,(0,V.jsxs)(`p`,{className:`ov-caption cc-foot`,children:[`Each test is taken to use what one test used in this run, with calls and tokens scaled alike for every agent; calls not tied to a test are shared out over its `,X(r.tests,`test`),`.`,r.estimate?` Part of this run’s cost was itself an estimate.`:``,t?(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(`optimise`),children:`Changes priced on this run`})]}):null]})]}),(0,V.jsx)(OQ,{rows:S.rows,base:r,perAgent:p,setPerAgent:m,times:g.tests.value*g.runs.value*g.days.value,money:w})]})]})}var TQ=e=>e>=1e9?new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}).format(e):U(Math.round(e));function EQ(e){if(!e)return``;try{return new Intl.NumberFormat(void 0,{style:`currency`,currency:e.toUpperCase(),currencyDisplay:`narrowSymbol`}).formatToParts(0).find(e=>e.type===`currency`)?.value||``}catch{return``}}function DQ(e,t){try{return new Intl.NumberFormat(void 0,{style:`currency`,currency:(t||`USD`).toUpperCase(),notation:`compact`,maximumFractionDigits:1}).format(e)}catch{return G(e,t)}}function OQ({rows:e,base:t,perAgent:n,setPerAgent:r,times:i,money:a}){let o=io(e,dQ);return(0,V.jsxs)(`section`,{className:`panel ov-s12 ov-flush ug-top cc-agents`,"aria-labelledby":`cc-agents-h`,children:[(0,V.jsx)(Y,{icon:yi,tone:`brand`,title:(0,V.jsx)(`span`,{id:`cc-agents-h`,children:`By agent`}),note:t.profiles.length?`Pick another model from llms.json for any agent`:`Add prices to the profiles in llms.json to compare models`}),(0,V.jsx)(`div`,{className:`table-wrap ug-table-wrap`,children:(0,V.jsxs)(`table`,{className:`data ug-table cc-table`,children:[(0,V.jsxs)(`colgroup`,{children:[(0,V.jsx)(`col`,{}),(0,V.jsx)(`col`,{className:`cc-c-model`}),(0,V.jsx)(`col`,{className:`col-pertest cc-c-num`}),(0,V.jsx)(`col`,{className:`col-now cc-c-num`}),(0,V.jsx)(`col`,{className:`cc-c-num`}),(0,V.jsx)(`col`,{className:`col-month cc-c-num`})]}),(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`col`,children:`Agent`}),(0,V.jsx)(`th`,{scope:`col`,children:`Model`}),(0,V.jsx)(`th`,{scope:`col`,className:`num col-pertest`,children:`Tokens per test`}),(0,V.jsx)(`th`,{scope:`col`,className:`num col-now`,children:`This run`}),(0,V.jsx)(`th`,{scope:`col`,className:`num`,children:`Per test`}),(0,V.jsx)(`th`,{scope:`col`,className:`num col-month`,children:`Per month`})]})}),(0,V.jsx)(`tbody`,{children:o.shown.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{className:`cc-agent`,children:[(0,V.jsx)(`span`,{className:`row-title strong`,title:e.agent,children:e.agent}),(0,V.jsxs)(`span`,{className:`cell-sub`,children:[e.callsPerTest<.1?`under 0.1`:e.callsPerTest>=10?e.callsPerTest>=1e9?TQ(e.callsPerTest):Math.round(e.callsPerTest).toLocaleString():e.callsPerTest.toFixed(1),` calls per test`]})]}),(0,V.jsxs)(`td`,{className:`cc-model`,children:[t.profiles.length?(0,V.jsxs)(`select`,{className:`field`,"aria-label":`Model for ${e.agent}`,value:e.choice,onChange:t=>{let i={...n};t.target.value?i[e.agent]=t.target.value:delete i[e.agent],r(i)},children:[(0,V.jsx)(`option`,{value:``,children:e.choice?`As above`:`${e.model} (as above)`}),t.profiles.map(e=>(0,V.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.model,`, `,G(e.price.input,e.price.currency),` in, `,G(e.price.output,e.price.currency),` out)`]},e.name))]}):(0,V.jsx)(`code`,{title:e.model,children:e.model}),e.averaged?(0,V.jsx)(`span`,{className:`cell-sub`,children:`at this run's average price per token`}):null]}),(0,V.jsx)(`td`,{className:`num col-pertest`,children:TQ(e.tokensPerTest)}),(0,V.jsx)(`td`,{className:`num col-now`,children:e.amount===void 0?`—`:G(e.amount,t.currency)}),(0,V.jsx)(`td`,{className:`num`,children:e.perTest===void 0?(0,V.jsx)(`span`,{className:`dim`,children:`no price`}):(0,V.jsx)(`b`,{children:a(e.perTest)})}),(0,V.jsx)(`td`,{className:`num col-month`,children:e.perTest===void 0?`—`:a(e.perTest*i)})]},e.agent))})]})}),(0,V.jsxs)(`div`,{className:`ug-foot`,children:[(0,V.jsx)(ao,{...o,label:`Agents`}),(0,V.jsx)(`p`,{className:`ov-caption`,children:`Prices are per million tokens: new input and cache writes at the input price, cached input at the cached price, output at the output price. “This run” is what one test cost here.`})]})]})}var kQ=`Where this report could have spent less on models, by how much, and what to change`,AQ=10,jQ={fail:`Wasted`,warn:`Worth a look`,brand:`Option`},MQ=e=>e.saving===void 0?void 0:`${e.upTo?`up to `:``}${G(e.saving,e.currency)}`,NQ=/^[A-Za-z0-9._-]{1,64}$/;function PQ(e){if(e.id===`replay`)return{effort:`Setting`,snippet:{label:`Setting in forgeqe.yaml`,text:`memory:
101
101
  replay: trust # verify | trust | off`,note:`The saving is the most it could be: what the checks of fully replayed tests cost in this report.`},link:{page:`usage`,label:`See it in Usage`}};if(e.id===`memory`)return{effort:`Setting`,snippet:{label:`Setting in forgeqe.yaml`,text:`memory:
102
102
  enabled: true
@@ -290,7 +290,7 @@ test command ──► baseline run (testrun.ts) ── passes ──► clean,
290
290
 
291
291
  | Module | Contents |
292
292
  |--------|----------|
293
- | `prompt.ts` | `HEAL_BRIEF`, the heal agent's procedure: failing tests only; re-run each one's flow with `browser_run` as a plain-language goal; a passing run means the test is out of date, so read `run_details` and update the locators where they live (page objects); a run that fails at the same step means an app bug, and the test is left alone; never delete, skip, loosen, or slow down a test; verify with `run_test`. `HEAL_SCHEMA`: `{tests: [{name, file, status, command, reason, run_dir}], changed, notes, suite_command}`. The find-command, first, still-failing, remaining, and missing-tests prompts |
293
+ | `prompt.ts` | The heal agent's procedure (`prompts/heal.md`): failing tests only; re-run each one's flow with `browser_run` as a plain-language goal; a passing run means the test is out of date, so read `run_details` and update the locators where they live (page objects); a run that fails at the same step means an app bug, and the test is left alone; never delete, skip, loosen, or slow down a test; verify with `run_test`. `HEAL_SCHEMA`: `{tests: [{name, file, status, command, reason, run_dir}], changed, notes, suite_command}`. The find-command, first, still-failing, remaining, and missing-tests prompts |
294
294
  | `loop.ts` | `runHeal`. The command is the argument, `code.test_command`, or `suite_command` from a first prompt that asks the agent to find it. The heal session gets its own `localToolServer` with only the four tools above; browser runs are written inside the heal folder (`export.out_dir` is pointed there) and their folders are recorded from `run-done` events. Tests are merged by name across replies. A healed test counts only after ForgeQE runs its command; a healed test with no command is sent back. The whole command runs after every attempt whose tests all pass, and once more at the end if tests were confirmed since. The loop ends when the whole command passes (`passed`), when a reply heals nothing new (`failed` if the command still fails), after `max_attempts`, on the same fatal errors as the coding loop, or on stop. `heal.json` and `heal.md` are written in every case |
295
295
  | `report.ts` | `healMarkdown` (verdict table, files changed, browser runs, test output before and after) and `formatHeal`, the terminal summary (✓ confirmed, ? healed but not confirmed, ! app bug, ✗ not healed) |
296
296