@kubit-ui-web/react-charts 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts +3 -0
- package/dist/cjs/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/context/customBackgroundChartContext.js +3 -0
- package/dist/cjs/charts/customBackgroundChart/context/index.d.ts +2 -0
- package/dist/cjs/charts/customBackgroundChart/context/index.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/context/index.js +1 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.d.ts +6 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.js +7 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.type.d.ts +50 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.type.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.type.js +1 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChartStructure.d.ts +4 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChartStructure.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/customBackgroundChartStructure.js +41 -0
- package/dist/cjs/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts +4 -0
- package/dist/cjs/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/fragments/customBackgroundChartPlot.js +49 -0
- package/dist/cjs/charts/customBackgroundChart/fragments/index.d.ts +2 -0
- package/dist/cjs/charts/customBackgroundChart/fragments/index.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/fragments/index.js +1 -0
- package/dist/cjs/charts/customBackgroundChart/index.d.ts +2 -0
- package/dist/cjs/charts/customBackgroundChart/index.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/index.js +1 -0
- package/dist/cjs/charts/customBackgroundChart/utils/accessibility.d.ts +19 -0
- package/dist/cjs/charts/customBackgroundChart/utils/accessibility.d.ts.map +1 -0
- package/dist/cjs/charts/customBackgroundChart/utils/accessibility.js +32 -0
- package/dist/cjs/charts/index.d.ts +1 -0
- package/dist/cjs/charts/index.d.ts.map +1 -1
- package/dist/cjs/charts/index.js +1 -0
- package/dist/cjs/components/plot/plot.d.ts.map +1 -1
- package/dist/cjs/components/plot/plot.js +21 -3
- package/dist/cjs/types/errors.type.d.ts +2 -0
- package/dist/cjs/types/errors.type.d.ts.map +1 -1
- package/dist/cjs/types/errors.type.js +3 -0
- package/dist/esm/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts +3 -0
- package/dist/esm/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/context/customBackgroundChartContext.js +3 -0
- package/dist/esm/charts/customBackgroundChart/context/index.d.ts +2 -0
- package/dist/esm/charts/customBackgroundChart/context/index.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/context/index.js +1 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChart.d.ts +6 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChart.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChart.js +7 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChart.type.d.ts +50 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChart.type.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChart.type.js +1 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChartStructure.d.ts +4 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChartStructure.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/customBackgroundChartStructure.js +41 -0
- package/dist/esm/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts +4 -0
- package/dist/esm/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/fragments/customBackgroundChartPlot.js +49 -0
- package/dist/esm/charts/customBackgroundChart/fragments/index.d.ts +2 -0
- package/dist/esm/charts/customBackgroundChart/fragments/index.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/fragments/index.js +1 -0
- package/dist/esm/charts/customBackgroundChart/index.d.ts +2 -0
- package/dist/esm/charts/customBackgroundChart/index.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/index.js +1 -0
- package/dist/esm/charts/customBackgroundChart/utils/accessibility.d.ts +19 -0
- package/dist/esm/charts/customBackgroundChart/utils/accessibility.d.ts.map +1 -0
- package/dist/esm/charts/customBackgroundChart/utils/accessibility.js +32 -0
- package/dist/esm/charts/index.d.ts +1 -0
- package/dist/esm/charts/index.d.ts.map +1 -1
- package/dist/esm/charts/index.js +1 -0
- package/dist/esm/components/plot/plot.d.ts.map +1 -1
- package/dist/esm/components/plot/plot.js +21 -3
- package/dist/esm/types/errors.type.d.ts +2 -0
- package/dist/esm/types/errors.type.d.ts.map +1 -1
- package/dist/esm/types/errors.type.js +3 -0
- package/dist/kubit-ui-web-react-charts.cjs.js +1 -1
- package/dist/kubit-ui-web-react-charts.es.js +1 -1
- package/dist/kubit-ui-web-react-charts.umd.js +1 -1
- package/dist/react-charts.css +1 -1
- package/dist/types/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts +3 -0
- package/dist/types/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts.map +1 -0
- package/dist/types/charts/customBackgroundChart/context/index.d.ts +2 -0
- package/dist/types/charts/customBackgroundChart/context/index.d.ts.map +1 -0
- package/dist/types/charts/customBackgroundChart/customBackgroundChart.d.ts +6 -0
- package/dist/types/charts/customBackgroundChart/customBackgroundChart.d.ts.map +1 -0
- package/dist/types/charts/customBackgroundChart/customBackgroundChart.type.d.ts +50 -0
- package/dist/types/charts/customBackgroundChart/customBackgroundChart.type.d.ts.map +1 -0
- package/dist/types/charts/customBackgroundChart/customBackgroundChartStructure.d.ts +4 -0
- package/dist/types/charts/customBackgroundChart/customBackgroundChartStructure.d.ts.map +1 -0
- package/dist/types/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts +4 -0
- package/dist/types/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts.map +1 -0
- package/dist/types/charts/customBackgroundChart/fragments/index.d.ts +2 -0
- package/dist/types/charts/customBackgroundChart/fragments/index.d.ts.map +1 -0
- package/dist/types/charts/customBackgroundChart/index.d.ts +2 -0
- package/dist/types/charts/customBackgroundChart/index.d.ts.map +1 -0
- package/dist/types/charts/customBackgroundChart/utils/accessibility.d.ts +19 -0
- package/dist/types/charts/customBackgroundChart/utils/accessibility.d.ts.map +1 -0
- package/dist/types/charts/index.d.ts +1 -0
- package/dist/types/charts/index.d.ts.map +1 -1
- package/dist/types/components/plot/plot.d.ts.map +1 -1
- package/dist/types/types/errors.type.d.ts +2 -0
- package/dist/types/types/errors.type.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e,t,r,a,n={exports:{}},i={},o={exports:{}},s={};function c(){return t||(t=1,o.exports=function(){if(e)return s;e=1;var t=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),h=Symbol.iterator,p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},f=Object.assign,g={};function R(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}function A(){}function E(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}R.prototype.isReactComponent={},R.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},R.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},A.prototype=R.prototype;var _=E.prototype=new A;_.constructor=E,f(_,R.prototype),_.isPureReactComponent=!0;var T=Array.isArray,y=Object.prototype.hasOwnProperty,v={current:null},m={key:!0,ref:!0,__self:!0,__source:!0};function C(e,r,a){var n,i={},o=null,s=null;if(null!=r)for(n in void 0!==r.ref&&(s=r.ref),void 0!==r.key&&(o=""+r.key),r)y.call(r,n)&&!m.hasOwnProperty(n)&&(i[n]=r[n]);var c=arguments.length-2;if(1===c)i.children=a;else if(1<c){for(var d=Array(c),l=0;l<c;l++)d[l]=arguments[l+2];i.children=d}if(e&&e.defaultProps)for(n in c=e.defaultProps)void 0===i[n]&&(i[n]=c[n]);return{$$typeof:t,type:e,key:o,ref:s,props:i,_owner:v.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var I=/\/+/g;function N(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function $(e,a,n,i,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case t:case r:c=!0}}if(c)return o=o(c=e),e=""===i?"."+N(c,0):i,T(o)?(n="",null!=e&&(n=e.replace(I,"$&/")+"/"),$(o,a,n,"",function(e){return e})):null!=o&&(S(o)&&(o=function(e,r){return{$$typeof:t,type:e.type,key:r,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(I,"$&/")+"/")+e)),a.push(o)),1;if(c=0,i=""===i?".":i+":",T(e))for(var d=0;d<e.length;d++){var l=i+N(s=e[d],d);c+=$(s,a,n,l,o)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=h&&e[h]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),d=0;!(s=e.next()).done;)c+=$(s=s.value,a,n,l=i+N(s,d++),o);else if("object"===s)throw a=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===a?"object with keys {"+Object.keys(e).join(", ")+"}":a)+"). If you meant to render a collection of children, use an array instead.");return c}function k(e,t,r){if(null==e)return e;var a=[],n=0;return $(e,a,"","",function(e){return t.call(r,e,n++)}),a}function b(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var L={current:null},O={transition:null},H={ReactCurrentDispatcher:L,ReactCurrentBatchConfig:O,ReactCurrentOwner:v};function w(){throw Error("act(...) is not supported in production builds of React.")}return s.Children={map:k,forEach:function(e,t,r){k(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return k(e,function(){t++}),t},toArray:function(e){return k(e,function(e){return e})||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},s.Component=R,s.Fragment=a,s.Profiler=i,s.PureComponent=E,s.StrictMode=n,s.Suspense=l,s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,s.act=w,s.cloneElement=function(e,r,a){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=f({},e.props),i=e.key,o=e.ref,s=e._owner;if(null!=r){if(void 0!==r.ref&&(o=r.ref,s=v.current),void 0!==r.key&&(i=""+r.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(d in r)y.call(r,d)&&!m.hasOwnProperty(d)&&(n[d]=void 0===r[d]&&void 0!==c?c[d]:r[d])}var d=arguments.length-2;if(1===d)n.children=a;else if(1<d){c=Array(d);for(var l=0;l<d;l++)c[l]=arguments[l+2];n.children=c}return{$$typeof:t,type:e.type,key:i,ref:o,props:n,_owner:s}},s.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},s.createElement=C,s.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},s.createRef=function(){return{current:null}},s.forwardRef=function(e){return{$$typeof:d,render:e}},s.isValidElement=S,s.lazy=function(e){return{$$typeof:x,_payload:{_status:-1,_result:e},_init:b}},s.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},s.startTransition=function(e){var t=O.transition;O.transition={};try{e()}finally{O.transition=t}},s.unstable_act=w,s.useCallback=function(e,t){return L.current.useCallback(e,t)},s.useContext=function(e){return L.current.useContext(e)},s.useDebugValue=function(){},s.useDeferredValue=function(e){return L.current.useDeferredValue(e)},s.useEffect=function(e,t){return L.current.useEffect(e,t)},s.useId=function(){return L.current.useId()},s.useImperativeHandle=function(e,t,r){return L.current.useImperativeHandle(e,t,r)},s.useInsertionEffect=function(e,t){return L.current.useInsertionEffect(e,t)},s.useLayoutEffect=function(e,t){return L.current.useLayoutEffect(e,t)},s.useMemo=function(e,t){return L.current.useMemo(e,t)},s.useReducer=function(e,t,r){return L.current.useReducer(e,t,r)},s.useRef=function(e){return L.current.useRef(e)},s.useState=function(e){return L.current.useState(e)},s.useSyncExternalStore=function(e,t,r){return L.current.useSyncExternalStore(e,t,r)},s.useTransition=function(){return L.current.useTransition()},s.version="18.3.1",s}()),o.exports}var d=(a||(a=1,n.exports=function(){if(r)return i;r=1;var e=c(),t=Symbol.for("react.element"),a=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(e,r,a){var i,c={},d=null,l=null;for(i in void 0!==a&&(d=""+a),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(l=r.ref),r)n.call(r,i)&&!s.hasOwnProperty(i)&&(c[i]=r[i]);if(e&&e.defaultProps)for(i in r=e.defaultProps)void 0===c[i]&&(c[i]=r[i]);return{$$typeof:t,type:e,key:d,ref:l,props:c,_owner:o.current}}return i.Fragment=a,i.jsx=d,i.jsxs=d,i}()),n.exports),l=c();const u=l.forwardRef(({ariaHidden:e,ariaLabel:t,backgroundColor:r,caption:a,children:n,className:i,dataTestId:o,height:s,imageSrc:c,overflow:l,radius:u="0px",role:x,tabIndex:h,viewBox:p,width:f,...g},R)=>d.jsxs("svg",{ref:R,"aria-hidden":e,"aria-label":t,className:i,"data-testid":o,height:s,role:x,style:{backgroundColor:r,borderRadius:u,overflow:l},tabIndex:h,viewBox:p,width:f,onMouseDown:e=>e.preventDefault(),...g,children:[a&&d.jsx("title",{children:a}),c&&d.jsx("image",{height:s,href:c,width:f,x:"0",y:"0"}),n]})),x={},h=e=>{const[t]=l.useState(()=>(e=>(x[e]||(x[e]=0),x[e]++))(e||"$component$"));return`${e}${t}`},p=()=>"undefined"!=typeof window&&"undefined"!=typeof document,f=()=>p()?document:void 0,g=e=>{const t=f();if(t)return t.createElementNS("http://www.w3.org/2000/svg",e)},R="%",A="rem",E={[R]:R,[A]:A},_="WIDTH",T=/^(\d+(\.\d+)?)(px|rem|%)?$/,y=e=>{if("number"==typeof e)return{unit:void 0,value:e};const t=e.match(T);if(!t)throw new Error(`Invalid string format: "${e}"`);const r=parseFloat(t[1]),a=t[3];return{unit:E[a],value:r}},v=(e,t,r)=>{const a=r.parentElement;return a?e/100*(t===_?a.clientWidth:a.clientHeight):0},m=e=>{const t=f();if(!t)return 16*e;const r=(e=>{const t=p()?window:void 0;if(t)return t.getComputedStyle(e)})(t.documentElement);return r?e*(parseFloat(r.fontSize)||16):16*e},C=/^(\d+(\.\d+)?)(px|rem|%)?$/,S=e=>{if("number"==typeof e)return e;const t=e.match(C);if(!t)throw new Error(`Invalid string format: "${e}"`);const r=t[1];return t[3]===A?16*parseFloat(r):parseFloat(r)},I=({canvasConfig:e,dataTestId:t,extraSpace:r=0,height:a,width:n})=>{const[i,o]=l.useState({height:0,width:0}),s=l.useMemo(()=>e||{extraSpace:r,height:a,width:n},[e,n,a,r]),{extraSpace:c,height:d,width:u}=s,x=c?S(c):void 0;l.useEffect(()=>{if(!p())return;const e=(e=>{const t=f();return t?t.querySelector(e):null})(`[data-testid="${t}"]`);if(!e)return;const r=()=>{const{parsedCanvasHeight:t,parsedCanvasWidth:r}=(({canvasHeight:e,canvasWidth:t,svgElement:r})=>{const{unit:a,value:n}=y(t),i=a===R?v(n,_,r):a===A?m(n):n,{unit:o,value:s}=y(e);return{parsedCanvasHeight:o===R?v(s,"HEIGHT",r):o===A?m(s):s,parsedCanvasWidth:i}})({canvasHeight:d,canvasWidth:u,svgElement:e});o({height:t,width:r})};r();const a=new ResizeObserver(()=>{r()});return a.observe(e),()=>{a.disconnect()}},[u,d,t]);const h=l.useMemo(()=>{const e=((e,t,r=0)=>`${-r} ${-r} ${e} ${t}`)(i.width,i.height,x);return e},[i.width,i.height,x]);return{parsedCanvas:i,parsedCanvasExtraSpace:x,viewBox:h}},N={extraSpace:0,height:80,width:100},$=e=>{const t=new Map,r=()=>{const e={};return t.forEach((t,r)=>{e[r]=t}),e};return{addError:(a,n)=>{if(!n)return;const i={...n,type:a},o=t.get(a)||[];if(o.push(i),t.set(a,o),e){const t=r(),a={};Object.entries(t).forEach(([e,t])=>{const r=e;Array.isArray(t)&&t.length,a[r]=t}),e(a)}},clearErrors:()=>{t.clear(),e&&e({})},getAccumulatedErrors:r}},k=e=>JSON.stringify(e),b=l.createContext({}),L={HORIZONTAL:"HORIZONTAL",VERTICAL:"VERTICAL"},O={BAR_CHART_CONTEXT_ERROR:"BAR_CHART_CONTEXT_ERROR",BAR_CHART_PATH_ERROR:"BAR_CHART_PATH_ERROR",BAR_CHART_SEPARATOR_ERROR:"BAR_CHART_SEPARATOR_ERROR",BAR_CHART_X_AXIS_ERROR:"BAR_CHART_X_AXIS_ERROR",BAR_CHART_Y_AXIS_ERROR:"BAR_CHART_Y_AXIS_ERROR",GENERIC:"GENERIC",LINE_CHART_CONTEXT_ERROR:"LINE_CHART_CONTEXT_ERROR",LINE_CHART_PATH_ERROR:"LINE_CHART_PATH_ERROR",LINE_CHART_PROJECTION_ERROR:"LINE_CHART_PROJECTION_ERROR",LINE_CHART_SEPARATOR_ERROR:"LINE_CHART_SEPARATOR_ERROR",LINE_CHART_X_AXIS_ERROR:"LINE_CHART_X_AXIS_ERROR",LINE_CHART_Y_AXIS_ERROR:"LINE_CHART_Y_AXIS_ERROR",PIE_CHART_CONTEXT_ERROR:"PIE_CHART_CONTEXT_ERROR",PIE_CHART_PATH_ERROR:"PIE_CHART_PATH_ERROR",PIE_CHART_SEGMENT_ERROR:"PIE_CHART_SEGMENT_ERROR"},H={BOTTOM:"BOTTOM",CENTER:"CENTER",CUSTOM:"CUSTOM",LEFT:"LEFT",RIGHT:"RIGHT",TOP:"TOP"},w=Object.entries({BAR_CHART_AXIS_INSUFFICIENT_TICKS:"Axis requires at least two ticks for proper bar scaling",BAR_CHART_AXIS_INVALID_SCALE:"Invalid axis scale for current bar values",BAR_CHART_DISTRIBUTION_INSUFFICIENT_SPACE:"Insufficient space for bar distribution with current configuration",BAR_CHART_DISTRIBUTION_INVALID_GAP:"Invalid gap between bars - must be >= 0 and allow bar rendering",BAR_CHART_DISTRIBUTION_OVERLAP:"Bar distribution results in overlapping bars",BAR_CHART_EMPTY_DATA:"No valid data entries found for bar chart rendering",BAR_CHART_INSUFFICIENT_SPACE_HEIGHT:"Insufficient height to render bars. Consider reducing bar count or increasing chart height",BAR_CHART_INSUFFICIENT_SPACE_WIDTH:"Insufficient width to render bars. Consider reducing bar width or increasing chart width",BAR_CHART_INVALID_VALUE:"Bar value must be a valid number for rendering",BAR_CHART_NEGATIVE_VALUE:"Negative values are not supported in this bar configuration",BAR_CHART_NO_DATA:"Data validation failed: no data provided for bar chart rendering",BAR_CHART_OVERLAP:"Bars are overlapping due to insufficient spacing",BAR_CHART_SEPARATOR_X_OUT_OF_RANGE:"Separator X position is outside valid bar range",BAR_CHART_SEPARATOR_Y_OUT_OF_RANGE:"Separator Y position is outside valid bar range",BAR_CHART_STACK_INVALID:"Invalid stacking configuration - all bars in stack must have consistent configuration",BAR_CHART_STACK_MISSING_VALUES:"Stack is incomplete - all bars in stack must have valid values"}).reduce((e,[t,r])=>(e[t]=new Error(r),e),{}),P=Object.entries({LINE_CHART_INVALID_CANVAS:"Canvas dimensions validation failed: both width and height must be > 0",LINE_CHART_NO_DATA:"Data validation failed: no data provided for chart rendering",LINE_CHART_PATH_ALL_VALUES_NULL:"Path data cannot be generated - all Y values are null or undefined",LINE_CHART_PATH_INSUFFICIENT_POINTS:"Unable to calculate curved path with insufficient points (minimum 2 required)",LINE_CHART_PATH_INVALID_DATAKEY:"DataKey must be a valid string",LINE_CHART_PROJECTION_INVALID_BOUNDS:"Invalid projection bounds - upper projection must be below lower projection",LINE_CHART_PROJECTION_LOWER_X_OUT_OF_RANGE:"Lower projection X coordinate is outside valid range (0-100)",LINE_CHART_PROJECTION_LOWER_Y_OUT_OF_RANGE:"Lower projection Y coordinate is outside chart area",LINE_CHART_PROJECTION_UPPER_X_OUT_OF_RANGE:"Upper projection X coordinate is outside valid range (0-100)",LINE_CHART_PROJECTION_UPPER_Y_OUT_OF_RANGE:"Upper projection Y coordinate is outside chart area",LINE_CHART_SEPARATOR_INVALID_COORDINATES:"Invalid separator position - coordinates overlap, cannot render separator",LINE_CHART_SEPARATOR_INVALID_X_BREAK_AXIS:"Invalid xBreakAxis value: cannot be parsed as number",LINE_CHART_SEPARATOR_INVALID_Y_BREAK_AXIS:"Invalid yBreakAxis value: cannot be parsed as number",LINE_CHART_SEPARATOR_X_OUT_OF_RANGE:"xBreakAxis value is outside data range",LINE_CHART_SEPARATOR_Y_OUT_OF_RANGE:"yBreakAxis value is outside data range",LINE_CHART_SINGLE_POINT:"Data validation failed: single data point provided, minimum 2 required for line chart",LINE_CHART_X_AXIS_IDENTICAL_VALUES:"X-axis range validation failed: minimum and maximum values are identical, cannot render chart line",LINE_CHART_X_AXIS_INSUFFICIENT_TICKS:"X-axis tick calculation: insufficient data points (1/2 minimum required)",LINE_CHART_X_AXIS_ZERO_LENGTH:"X-axis geometry validation failed: start and end X coordinates are identical (x1=x2), axis has zero length",LINE_CHART_Y_AXIS_IDENTICAL_VALUES:"Y-axis range validation failed: minimum and maximum values are identical, cannot render chart line",LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS:"Y-axis tick calculation: insufficient data points (1/2 minimum required)",LINE_CHART_Y_AXIS_ZERO_LENGTH:"Y-axis geometry validation failed: start and end Y coordinates are identical (y1=y2), axis has zero length"}).reduce((e,[t,r])=>(e[t]=new Error(r),e),{}),B=Object.entries({PIE_CHART_EMPTY_DATA:"PieChart data is empty or undefined",PIE_CHART_INNER_RADIUS_OUT_OF_RANGE:"Inner radius must be less than radius",PIE_CHART_INVALID_CANVAS_DIMENSIONS:"Invalid canvas dimensions for PieChart",PIE_CHART_INVALID_DATA_KEY:"Invalid or missing dataKey in PieChart data",PIE_CHART_INVALID_INNER_RADIUS:"Invalid innerRadius value",PIE_CHART_INVALID_RADIUS:"Invalid radius value",PIE_CHART_INVALID_SEGMENT_VALUE:"Invalid segment value (non-numeric)",PIE_CHART_INVALID_TOTAL:"PieChart total value is zero or invalid",PIE_CHART_MISSING_SEGMENT_NAME:"Segment is missing required name property",PIE_CHART_NEGATIVE_SEGMENT_VALUE:"Segment value cannot be negative"}).reduce((e,[t,r])=>(e[t]=new Error(r),e),{}),M=(e,t)=>new Error(`Invalid value "${e}" for bar with dataKey "${t}". Must be a valid number.`),D=(e,t)=>new Error(`Negative value ${e} not allowed for bar with dataKey "${t}" in current configuration`),j=(e,t)=>new Error(`Invalid segment value for "${t}": "${e}" is not a valid number`),F=(e,t)=>new Error(`Negative segment value for "${t}": ${e} (values must be >= 0)`),V=e=>new Error(`DataKey "${e}" not found in PieChart dataset`),X=e=>new Error(`Data array for key "${e}" is empty`),W=(e,t)=>new Error(`Invalid total value for "${e}": ${t} (must be > 0)`),K=(e,t,r)=>new Error(`Invalid group at index ${t} in "${e}": missing required property "${r}"`),Y=e=>new Error(`Invalid radius value: "${e}" (must be a positive number)`),U=e=>new Error(`Invalid innerRadius value: "${e}" (must be a positive number or zero)`),G=(e,t)=>new Error(`innerRadius (${e}) must be less than radius (${t}) for donut chart rendering`),z="INVALID_X_TICK",Z="BAR_CHART_NO_DATA",q="LINE_CHART_NO_DATA",J="LINE_CHART_PATH_ALL_VALUES_NULL",Q="LINE_CHART_PATH_INSUFFICIENT_POINTS",ee="LINE_CHART_PATH_INVALID_DATAKEY",te="LINE_CHART_SEPARATOR_INVALID_COORDINATES",re="LINE_CHART_SINGLE_POINT",ae="LINE_CHART_X_AXIS_IDENTICAL_VALUES",ne="LINE_CHART_X_AXIS_INSUFFICIENT_TICKS",ie="LINE_CHART_X_AXIS_ZERO_LENGTH",oe="LINE_CHART_Y_AXIS_IDENTICAL_VALUES",se="LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS",ce="LINE_CHART_Y_AXIS_ZERO_LENGTH",de={...w,...P,...B,INVALID_X_TICK:new Error("[getXTicks] Invalid X tick values calculated")},le=e=>de[e],ue=e=>new Error(`DataKey "${e}" not found in dataset`),xe=(e,t)=>new Error(`Canvas dimensions validation failed: width=${e}, height=${t} (both must be > 0)`),he=e=>new Error(`Invalid xBreakAxis value: '${e}' cannot be parsed as number`),pe=e=>new Error(`Invalid yBreakAxis value: '${e}' cannot be parsed as number`),fe=(e,t,r)=>new Error(`xBreakAxis value ${e} is outside data range (${t} - ${r})`),ge=(e,t,r)=>new Error(`yBreakAxis value ${e} is outside data range (${t} - ${r})`),Re=(e,t,r)=>t.map(t=>{if(isNaN(Number(t))){const r=e.find(e=>String(e.value)===String(t));return r?r.position:0}const{index:a,tick:n}=e.reduce((e,r,a)=>Math.abs(Number(r.value)-Number(t))<=Math.abs(Number(e.tick.value)-Number(t))?{index:a,tick:r}:e,{index:0,tick:e[0]}),i=Number(t),o=Number(n.value);if(i!==o){const t=e.map(e=>Number(e.value)),s=Math.min(...t),c=Math.max(...t);if(i<s)return e.at(0)?.position;if(i>c)return e.at(-1)?.position;const d=Math.abs(o-i),l=i>o,u=l?e[a+1]:e[a-1],x=100*d/Math.abs(Number(u.value)-o),h=Math.abs(n.position-u.position)*x/100;return r?l?n.position+h:n.position-h:l?n.position-h:n.position+h}return n.position}),Ae="0",Ee="1",_e="fallbackData",Te={FOCUS_COLOR:"#0078D4",FOCUS_INNER:"#ffffff",INNER_FOCUS_STROKE_WIDTH:2,OUTER_FOCUS_STROKE_WIDTH:2,OUTLINES_GAP:0,VARIANT:"adaptive"},ye=e=>({gap:e?.gap??Te.OUTLINES_GAP,innerColor:e?.innerColor??Te.FOCUS_INNER,innerStrokeWidth:e?.innerStrokeWidth??Te.INNER_FOCUS_STROKE_WIDTH,outlineColor:e?.outlineColor??Te.FOCUS_COLOR,outlineStrokeWidth:e?.outlineStrokeWidth??Te.OUTER_FOCUS_STROKE_WIDTH,variant:e?.variant??Te.VARIANT}),ve=["cx","cy","r","x","y","width","height","rx","ry","d","points","x1","y1","x2","y2"],me=["stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity"],Ce=["circle","rect","ellipse","path","polygon","polyline","line"];function Se({elementRef:e,focusConfig:t,isFocused:r}){const a=l.useMemo(()=>ye(t),[t]),[n,i]=l.useState(void 0);return l.useEffect(()=>{if(!e?.current||!r)return void i(void 0);const t=e.current,n=()=>{if("adaptive"===a.variant){const e=function(e,t){const r=e.tagName.toLowerCase();if(!Ce.includes(r))return;const a=e.getAttribute("stroke-width")||e.getAttribute("strokeWidth"),n=parseFloat(a||"0"),i=e.getAttribute("fill"),o="line"===r||"polyline"===r||"path"===r&&"none"===i,s=n+2*(t.outlineStrokeWidth+t.innerStrokeWidth),c=n+2*t.innerStrokeWidth,d=o?e.getAttribute("stroke-linecap")||"round":void 0,l=o?e.getAttribute("stroke-linejoin")||"round":"miter",u=o?void 0:"10",x=function(e){const t={},r=new Set([...ve,...me]);for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];r.has(n.name)&&(t[n.name]=n.value)}return t}(e);return{innerRing:{props:{...x,className:"focus-ring-inner",fill:"none",stroke:t.innerColor,strokeLinecap:d,strokeLinejoin:l,strokeMiterlimit:u,strokeWidth:c},type:r},outerRing:{props:{...x,className:"focus-ring-outer",fill:"none",stroke:t.outlineColor,strokeLinecap:d,strokeLinejoin:l,strokeMiterlimit:u,strokeWidth:s},type:r}}}(t,a);i(e)}if("bounding-box"===a.variant){const e=function(e,t){const r=function(e){try{const t=e.getBBox();if(t.width<=0||t.height<=0)return null;const r=window.getComputedStyle(e),a=parseFloat(r.strokeWidth||"0");return{elementHeight:t.height,elementPosition:{x:t.x+t.width/2,y:t.y+t.height/2},elementStrokeWidth:a,elementWidth:t.width}}catch{return null}}(e);if(!r)return;const a=((e,t)=>{const{elementHeight:r,elementPosition:a,elementStrokeWidth:n,elementWidth:i}=e,{gap:o,innerStrokeWidth:s,outlineStrokeWidth:c}=t,d=i+n+s+2*o,l=r+n+s+2*o,u=d+s+c,x=l+s+c;return{inner:{height:l,width:d,x:a.x-d/2,y:a.y-l/2},outer:{height:x,width:u,x:a.x-u/2,y:a.y-x/2}}})(r,{gap:t.gap,innerStrokeWidth:t.innerStrokeWidth,outlineStrokeWidth:t.outlineStrokeWidth});return{innerRing:{props:{className:"focus-ring-inner",fill:"none",height:a.inner.height,stroke:t.innerColor,strokeWidth:t.innerStrokeWidth,width:a.inner.width,x:a.inner.x,y:a.inner.y},type:"rect"},outerRing:{props:{className:"focus-ring-outer",fill:"none",height:a.outer.height,stroke:t.outlineColor,strokeWidth:t.outlineStrokeWidth,width:a.outer.width,x:a.outer.x,y:a.outer.y},type:"rect"}}}(t,a);i(e)}};n();const o=new MutationObserver(e=>{e.some(e=>"attributes"===e.type&&ve.includes(e.attributeName??""))&&n()});return o.observe(t,{attributeFilter:[...ve],attributes:!0}),()=>o.disconnect()},[r,a]),{layers:n,resolvedConfig:a}}const Ie=({dataTestId:e,layers:t})=>t?d.jsxs("g",{className:"focus-ring-container",pointerEvents:"none",children:[l.createElement(t.outerRing.type,{...t.outerRing.props,"data-testid":`${e}-focus-outer`}),l.createElement(t.innerRing.type,{...t.innerRing.props,"data-testid":`${e}-focus-inner`})]}):null,Ne=({children:e,dataTestId:t="focus-ring",disabled:r=!1,focusConfig:a,isFocused:n})=>{const i=l.useRef(null),{layers:o}=Se({elementRef:i,focusConfig:a,isFocused:n}),s=function(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}(i,e.ref),c=l.cloneElement(e,{ref:s});return d.jsxs(d.Fragment,{children:[n&&!r&&d.jsx(Ie,{dataTestId:t,layers:o??void 0}),c]})},$e=({dataTestId:e="focus-ring",disabled:t=!1,focusConfig:r,isFocused:a,targetRef:n})=>{const{layers:i}=Se({elementRef:n,focusConfig:r,isFocused:a});return!a||t?null:d.jsx(Ie,{dataTestId:e,layers:i})},ke=({children:e,dataTestId:t="focus-ring",disabled:r=!1,focusConfig:a,isFocused:n,targetRef:i})=>e?d.jsx(Ne,{dataTestId:t,disabled:r,focusConfig:a,isFocused:n,children:e}):i?d.jsx($e,{dataTestId:t,disabled:r,focusConfig:a,isFocused:n,targetRef:i}):null;(()=>{if("undefined"!=typeof globalThis&&"process"in globalThis){const e=globalThis.process;return"production"===e?.env?.NODE_ENV}})();const be=e=>e?Object.entries(e).reduce((e,[t,r])=>((t.startsWith("aria-")||t.startsWith("data-")||"role"===t)&&null!=r&&(e[t]=String(r)),e),{}):{},Le=({height:e="140%",width:t="140%",x:r="-20%",y:a="-20%",...n})=>d.jsx("defs",{children:d.jsx("filter",{height:e,id:n.id,width:t,x:r,y:a,children:d.jsx("feDropShadow",{...n.shadowSvgConfig})})}),Oe=-1/0,He=l.forwardRef(({dataTestId:e,position:t,size:r=1,...a},n)=>d.jsx("circle",{...a,ref:n,cx:t?.x,cy:t?.y,"data-testid":`${e}-circle`,r:r/2})),we=(e,t,r,a,n)=>{let i="";const o=a===n,s=o?r:2*r;for(let r=0;r<s;r++){const c=o||r%2==0?a:n,d=2*Math.PI/s*r-Math.PI/2;i+=`${e+Math.cos(d)*c},${t+Math.sin(d)*c} `}return i.trim()},Pe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=we(t.x,t.y,6,r/2,r/2);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-hexagon`,points:i})}),Be=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=we(t.x,t.y,5,r/2,r/2);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-pentagon`,points:i})}),Me=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>d.jsx("rect",{...a,ref:n,"data-testid":`${e}-square`,height:r,width:r,x:t.x-r/2,y:t.y-r/2})),De=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=r/2,o=i/2,s=we(t.x,t.y,5,i,o);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-star`,points:s})}),je=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=`M ${t.x-r/2} ${t.y} H ${t.x+r/2} M ${t.x} ${t.y-r/2} V ${t.y+r/2}`;return d.jsx("path",{...a,ref:n,d:i,"data-testid":`${e}-straight`,strokeWidth:2})}),Fe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=[`${t.x},${t.y-r/2}`,`${t.x-r/2},${t.y+r/2}`,`${t.x+r/2},${t.y+r/2}`].join(" ");return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-triangle`,points:i})}),Ve={Circle:"circle",Hexagon:"hexagon",Pentagon:"pentagon",Square:"square",Star:"star",Straight:"straight",Triangle:"triangle"},Xe={[Ve.Circle]:He,[Ve.Hexagon]:Pe,[Ve.Pentagon]:Be,[Ve.Square]:Me,[Ve.Star]:De,[Ve.Straight]:je,[Ve.Triangle]:Fe},We=l.forwardRef(({dataTestId:e="node",haloConfig:t,hasHalo:r=!1,onBlur:a,onClick:n,onDoubleClick:i,onFocus:o,onKeyDown:s,onMouseEnter:c,onMouseLeave:u,position:x={x:0,y:0},size:h=1,type:p=Ve.Circle,...f},g)=>{const[R,A]=(e=>{const t=l.useRef(!1),r=l.useRef(null);l.useImperativeHandle(e,()=>r.current,[]);const a=e=>{t.current=!!e.autoClick};return l.useEffect(()=>{if(!r.current)return;const e=r.current;return e.addEventListener("click",a),()=>e.removeEventListener("click",a)},[]),[r,t]})(g),E={...f,className:`node ${f.className}`,onBlur:e=>{a?.(e)},onClick:e=>{n?.(e,{...f.data,nodePosition:x},A.current)},onDoubleClick:e=>{i?.(e,f.data)},onFocus:e=>{o?.(e,f.data)},onKeyDown:e=>{"Enter"===e.key&&s?.(e,f.data)},onMouseEnter:e=>{c?.(e,f.data)},onMouseLeave:e=>{u?.(e)}},_={className:f.className,fill:t?.fill||f.fill,fillOpacity:t?.fillOpacity||.25,opacity:t?.opacity||.3,stroke:t?.stroke||f.stroke,strokeWidth:t?.strokeWidth||f.strokeWidth},T=Xe[p];return d.jsxs(d.Fragment,{children:[r&&d.jsx(T,{..._,"aria-hidden":"true",dataTestId:`${e}-halo`,position:x,size:h+h/2}),d.jsx(T,{...E,ref:R,dataTestId:e,position:x,size:h})]})}),Ke=l.forwardRef(({data:e,nodeConfig:t,tabIndex:r=0,x:a,y:n},i)=>{const o=t?be(t):{};if(o["aria-label"]&&e&&"string"==typeof o["aria-label"]){const t=o["aria-label"];if(t.includes("{{")){const r=((e,t,r)=>{if(!e)return;const a=r??t.dataValue,n=Array.isArray(a)?a[t.index]:void 0,{xValue:i,yValue:o}=((e,t)=>({xValue:e&&t.xKey?e[t.xKey]?.toString()??"":"",yValue:e&&t.dataKey?e[t.dataKey]?.toString()??"":""}))(n,t);return((e,t,r,a)=>{let n=e;return void 0!==t.dataKey&&(n=n.replace(new RegExp("{{dataKey}}","g"),t.dataKey)),n=n.replace(new RegExp("{{xValue}}","g"),r),n=n.replace(new RegExp("{{yValue}}","g"),a),void 0!==t.index&&(n=n.replace(new RegExp("{{index}}","g"),(t.index+1).toString())),n})(e,t,i,o)})(t,{dataKey:e.dataKey,dataValue:e.dataValue,index:e.index??0,xKey:e.xKey},e.dataValue);r&&(o["aria-label"]=r)}}return d.jsx(d.Fragment,{children:t&&d.jsx(We,{...t,ref:i,...o,className:"node-path-focus-border",data:e,hasHalo:t.hasHalo,position:{x:a,y:n},tabIndex:r})})}),Ye=l.forwardRef(({classNames:e="",fill:t="transparent",stroke:r="#0000FF",strokeWidth:a="1",focusConfig:n,hoverConfig:i={stroke:"#0000FF",strokeWidth:"0.5"},role:o="img",tabIndex:s=0,...c},u)=>{const{handleBlur:x,handleFocus:h,isFocused:p}=((e,t)=>{const[r,a]=l.useState(!1),n=l.useCallback(t=>{a(!0),e?.(t)},[e]);return{handleBlur:l.useCallback(e=>{a(!1),t?.(e)},[t]),handleFocus:n,isFocused:r}})(c.onFocus,c.onBlur),f=(e=>{if(!e)return;const t=e.strokeWidth?Number(e.strokeWidth):void 0;return{innerStrokeWidth:t,outlineColor:e.stroke,outlineStrokeWidth:t}})(n),{handleMouseEnter:g,handleMouseLeave:R,isHovered:A}=((e,t)=>{const[r,a]=l.useState(!1);return{handleMouseEnter:l.useCallback(t=>{a(!0),e?.(t)},[e]),handleMouseLeave:l.useCallback(e=>{a(!1),t?.(e)},[t]),isHovered:r}})(c.onMouseEnter,c.onMouseLeave),E=l.useRef(null),_=l.useRef([]),T=l.useRef(null);l.useImperativeHandle(u,()=>({get main(){return T.current},get node(){return _.current},get path(){return E.current}}));const y=c.gradient&&((e,t="gradientePath")=>{const r=e.split(",").map(e=>e.trim()),a=parseInt(r[0],10),n=r.slice(1).map(e=>{const[t,r]=e.split(" ");return{color:t,offset:r}});let i="0%",o="0%",s="0%";switch(a){case 180:s="100%";break;case 90:o="100%";break;case 270:i="100%";break;default:return d.jsx(d.Fragment,{})}return d.jsx("defs",{children:d.jsx("linearGradient",{id:t,x1:i,x2:o,y1:"0%",y2:s,children:n.map((e,t)=>d.jsx("stop",{offset:e.offset,stopColor:e.color},`${t}-${e.offset}`.toString()))})})})(c.gradient),v=be(c),m={...{...c,classNames:`path ${e}`,fill:y?"url(#gradientePath)":t,filter:"url(#shadow)",role:o,stroke:r,strokeWidth:a,tabIndex:s},...A&&i};return d.jsxs("g",{ref:T,children:[y&&y,m.shadowSvgConfig&&d.jsx(Le,{id:"shadow",shadowSvgConfig:m.shadowSvgConfig}),d.jsx(ke,{dataTestId:`${m.dataTestId}-focus-ring`,focusConfig:f,isFocused:p,targetRef:E}),d.jsxs("g",{"aria-label":m.ariaLabel,className:m.classNames,"data-draw":!0,filter:m.shadowSvgConfig&&m.filter,opacity:m.opacity,orientation:m.orientation,role:m.role,rotate:m.rotate,tabIndex:m.tabIndex,transform:m.transform,visibility:m.visibility,...v,onBlur:x,onClick:()=>{c.onClick?.(c.dataValue)},onDoubleClick:e=>{c.onDoubleClick?.(e,c.dataValue)},onFocus:h,onKeyDown:e=>{"Enter"===e.key&&c.onKeyDown?.(c.dataValue)},onMouseDown:e=>{e.preventDefault()},onMouseEnter:g,onMouseLeave:R,children:[d.jsx("path",{ref:E,d:m.d,"data-testid":m.dataTestId,fill:m.dFill?"transparent":m.fill,fillOpacity:m.fillOpacity,fillRule:m.fillRule,stroke:m.stroke,strokeDasharray:m.strokeDasharray,strokeDashoffset:m.strokeDashoffset,strokeLinecap:m.strokeLinecap,strokeLinejoin:m.strokeLinejoin,strokeMiterlimit:m.strokeMiterlimit,strokeOpacity:m.strokeOpacity,strokeWidth:m.strokeWidth,children:m.title&&d.jsx("title",{children:m.title})}),m.dFill&&d.jsx("path",{d:m.dFill,fill:m.fill,fillOpacity:m.fillOpacity,fillRule:m.fillRule})]}),m.points&&m.nodeConfig&&m.points.map(([e,t],r)=>{const a={dataKey:m.dataKey,dataValue:m.dataValue,index:r,xKey:m?.xKey};return d.jsx(Ke,{ref:e=>_.current[r]=e,data:a,nodeConfig:m.nodeConfig,tabIndex:-1,x:e,y:t},`${r.toString()}`)})]})}),Ue=({ariaLabel:e,dataKey:t,xKey:r,yKey:a,xData:n,yData:i,coverage:o,index:s})=>{if(!e)return;const c=new RegExp("{{dataKey}}","g"),d=new RegExp("{{xKey}}","g"),l=new RegExp("{{yKey}}","g"),u=new RegExp("{{xData}}","g"),x=new RegExp("{{yData}}","g"),h=new RegExp("{{coverage}}","g"),p=new RegExp("{{index}}","g");return e.replace(c,t??"").replace(d,r??"").replace(l,a??"").replace(u,String(n??"")).replace(x,String(i??"")).replace(h,String(o)).replace(p,String(s))},Ge=(e,t,r)=>e?t+r/2:t-r/2,ze=({barConfig:e,currentBars:t,endRounded:r,extraSpacing:a=0,focusConfig:n={stroke:"#0078D4",strokeWidth:.2},onBlur:i,onFocus:o,order:s=1,orientation:c,startRounded:l,tabIndex:u=0,x1:x,x2:h,y1:p,y2:f,dataKey:g,xKey:R,yKey:A,xData:E,yData:_})=>{const{barWidth:T,singleConfig:y}=e,v=(({barConfig:e,orientation:t,x1:r,x2:a,y1:n,y2:i})=>{const{gap:o=0,singleConfig:s}=e,c=t===L.HORIZONTAL,d=c?r:n,l=c?a:i,u={end:l<d,start:l>d};return s.reduce((e,t,r)=>{const{coverage:a}=t,n=((e,t)=>e/100*t)(a,l-d),i=0===r?d:Ge(u.start,e[r-1][1],o),c=r+1===s.length?l:Ge(u.end,i+n,o);return e.push([i,c]),e},[])})({barConfig:e,orientation:c,x1:x,x2:h,y1:p,y2:f});return d.jsx("g",{children:y.map(({color:e,"aria-label":m,...C},S)=>{const[I,N]="HORIZONTAL"===c?v[S]:[x,h],[$,k]="VERTICAL"===c?v[S]:[p,f],b=(({barWidth:e,currentBars:t,endRounded:r=0,extraSpacing:a,order:n,orientation:i,startRounded:o=0,x1:s,x2:c,y1:d,y2:l})=>{let u,x,h,p,f="Z";const g=(({barWidth:e,currentBars:t,extraSpacing:r,order:a,orientation:n})=>{const i=e/2,o=r/2,s=t%2==0,c=s?o:o+i,d=a-Math.ceil(t/2);let l=0;return 0===d?l=s?-o:i:d<0?l=n===L.HORIZONTAL?d*-c+e:d*c:d>0&&(l=n===L.HORIZONTAL?d*-c:d*c+e),l})({barWidth:e,currentBars:t,extraSpacing:a,order:n,orientation:i});if(i===L.HORIZONTAL){const t=s+o,a=c-r;o&&r?(u=`M ${t},${d+g}`,x=`L${a},${l+g}`,h=`Q${c+r} ${l+g-e/2}, ${a} ${l+g-e}`,p=`L${t},${d+g-e}`,f=`Q${s-o} ${d+g-e/2}, ${t} ${d+g}`):o?(u=`M ${t},${d+g}`,x=`L${c},${l+g}`,h=`L${c},${l+g-e}`,p=`L${t},${d+g-e}`,f=`Q${s-o} ${d+g-e/2}, ${t} ${d+g}`):r?(u=`M${s},${d+g}`,x=`L${a},${l+g}`,h=`Q${c+r} ${l+g-e/2}, ${a} ${l+g-e}`,p=`L${s},${d+g-e}`):(u=`M${s},${d+g}`,x=`L${c},${l+g}`,h=`L${c},${l+g-e}`,p=`L${s},${d+g-e}`)}else{const t=d-o,a=l+r;o&&r?(u=`M${s+g}, ${t}`,x=`L${c+g},${a}`,h=`Q${c+g-e/2} ${l-r}, ${c+g-e} ${a}`,p=`L${s+g-e},${t}`,f=`Q${s+g-e/2} ${d+o}, ${s+g} ${t}`):o?(u=`M${s+g}, ${t}`,x=`L${c+g},${l}`,h=`L${c+g-e},${l}`,p=`L${s+g-e},${t}`,f=`Q${s+g-e/2} ${d+o}, ${s+g} ${t}`):r?(u=`M${s+g},${d}`,x=`L${c+g},${a}`,h=`Q${c+g-e/2} ${l-r}, ${c+g-e} ${a}`,p=`L${c+g-e},${d}`):(u=`M${s+g},${d}`,x=`L${c+g},${l}`,h=`L${c+g-e},${l}`,p=`L${s+g-e},${d}`)}return`${u} ${x} ${h} ${p} ${f}`})({barWidth:T,currentBars:t,endRounded:S===y.length-1&&r?r:void 0,extraSpacing:a,order:s,orientation:c,startRounded:0===S&&l?l:void 0,x1:I,x2:N,y1:$,y2:k});return d.jsx(Ye,{"aria-label":Ue({ariaLabel:m,dataKey:g,xKey:R,yKey:A,xData:E,yData:_,coverage:C.coverage,index:S}),d:b,fill:e,focusConfig:n,hoverConfig:{stroke:"transparent",strokeWidth:"0"},stroke:"transparent",tabIndex:u,onBlur:i,onFocus:o,...C},`${S.toString()}`)})})},Ze=({barConfig:e,dataIdx:t,dataKey:r,focusConfig:a,onBlur:n,onFocus:i,order:o,tabIndex:s,...c})=>{const{addError:u,xAxisCoordinates:x,yAxisCoordinates:h,...p}=l.useContext(b),{coordinates:f,tickValues:g}=x,{coordinates:R,tickValues:A}=h,E=p.orientation===L.VERTICAL,_=E?p.pKey:r,T=E?r:p.pKey,y=p.data[t],v=y?.[_],m=y?.[T],C=p.data[0],S=!!C&&Object.prototype.hasOwnProperty.call(C,r),I=p.data.length>0,N=Number(m);l.useEffect(()=>{!I||S?isNaN(N)?u?.("BAR_CHART_PATH_ERROR",{error:M(m,r)}):N<0&&u?.("BAR_CHART_PATH_ERROR",{error:D(N,r)}):u?.("BAR_CHART_PATH_ERROR",{error:ue(r)})},[r,I,S,N,m]);const $=Re(g,[String(v)],!0)[0],k=Re(A,[String(m)])[0],O=E?{x1:$,x2:$,y1:f.y1,y2:k}:{x1:R.x1,x2:$,y1:k,y2:k};return d.jsx(ze,{barConfig:e,currentBars:p.barChildrenCount,dataKey:r,extraSpacing:p.gapBetweenBars,focusConfig:a,order:o,orientation:p.orientation,tabIndex:s,xData:v,xKey:_,yData:m,yKey:T,onBlur:n,onFocus:i,...O,...c})},qe=e=>{let t=0;return l.Children.toArray(e).forEach(e=>{l.isValidElement(e)&&e.type===Ze&&e.props.order>t&&(t=e.props.order)}),t},Je=e=>{if(0===e.length)return{numeric:{max:2,min:0,step:1}};const t=Math.min(...e.map(e=>parseFloat(e))),r=Math.max(...e.map(e=>parseFloat(e)));return{numeric:{max:r,min:t,step:Math.abs(r-t)/2}}},Qe=({bound:e,data:t,fontSize:r,svgHeight:a,svgWidth:n,viewBox:i})=>{if(!p()||!t.length)return 0;const o=f();if(!o)return 0;const s=g("svg");if(!s)return 0;s.setAttribute("style","position: absolute; visibility: hidden; top: -9999px; left: -9999px;"),s.setAttribute("viewBox",i),s.setAttribute("width",n),s.setAttribute("height",a),o.body.appendChild(s);const c=t.map(t=>{const a=g("text");if(!a)return 0;a.setAttribute("font-size",r),a.textContent=t,s.appendChild(a);const n=a.getBBox()[e];return a.remove(),n});return s.remove(),Math.max(...c,0)},et=({ariaLabel:e,className:t="line",dataTestId:r,...a})=>d.jsx("line",{...a,"aria-label":e,className:t,"data-testid":r}),tt=({children:e,className:t="circle",...r})=>d.jsx("text",{className:t,...r,children:e}),rt=({showTickLines:e,tick:t,tickLine:r,tickText:a})=>d.jsxs("g",{children:[e&&d.jsx(et,{...r}),a&&d.jsx(tt,{...a,children:t.value})]}),at=(e,t,r=1)=>e>=t-r&&e<=t+r,nt=e=>{const{ariaLabel:t,className:r,dataTestId:a,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:x,tabIndex:h,transform:p,x1:f,x2:g,y1:R,y2:A}=e;return{ariaLabel:t,className:r,dataTestId:a,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:x,tabIndex:h,transform:p,x1:f,x2:g,y1:R,y2:A}},it=({canvasHeight:e=N.height,canvasWidth:t=N.width,cursor:r=0,extraSpace:a={bottom:0,left:0,right:0,top:0},position:n=H.BOTTOM,showTickLines:i=!1,tickLine:o,tickLineHover:s,tickText:c,tickValues:l=[],...u})=>{const x=be(u);return d.jsxs("g",{...x,children:[d.jsx(et,{...nt(u)}),l&&l.length>0&&l.map((e,t)=>{const a=at(r,e.position)&&s?{...o,...s}:o,n="rotate"===c?.transform?`rotate(-30, ${e.position}, ${c.y})`:void 0;return d.jsx(rt,{showTickLines:i,tick:e,tickLine:{...a,x1:e.position,x2:e.position},tickText:{...c,transform:n,x:e.position}},`${t.toString()}`)})]})},ot=(e,t,r)=>e===H.RIGHT?t+r:t-r,st=(e,t,r,a)=>e===H.TOP?r:t+r+a,ct=({position:e=H.BOTTOM,tickLine:t,tickText:r,...a})=>{const{xAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(b),s=st(e,n.y1,Number(r?.fontSize),r?.top??0),c=o.extraSpaceTopY,u=Number(o.canvasHeight)-o.extraSpaceBottomY;return d.jsx(it,{...n,...a,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}xAxis`,extraSpace:{left:o.extraSpaceLeftX,right:o.extraSpaceRightX},tickLine:{...t,y1:c,y2:u},tickText:{...r,y:s},tickValues:r?i:void 0})},dt=({canvasWidth:e,cursor:t=0,extraSpace:r={bottom:0,left:0,right:0,top:0},position:a=H.LEFT,showTickLines:n=!0,tickLine:i,tickLineHover:o,tickText:s,tickValues:c=[],...l})=>{const u=be(l);return d.jsxs("g",{...u,children:[d.jsx(et,{...nt(l)}),c&&c.length>0&&c.map((e,r)=>{const a=at(t,e.position)&&o?{...i,...o}:i,c="rotate"===s?.transform?`rotate(-30, ${s.x}, ${e.position})`:void 0;return d.jsx(rt,{showTickLines:n,tick:e,tickLine:{...a,y1:e.position,y2:e.position},tickText:{...s,transform:c,y:e.position}},`${r.toString()}`)})]})},lt=(e,t,r)=>{let a=0;switch(e){case"middle":a=t/2+r;break;case"end":a=t+r;break;default:a=0}return a},ut=({position:e=H.LEFT,tickLine:t,tickText:r,...a})=>{const{yAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(b),s=r?.textAnchor||"middle",c=(e===H.RIGHT?r?.right:r?.left)??0,u=lt(s,o.yAxisText,c),x=ot(e,n.x1,u);return d.jsx(dt,{...n,...a,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}yAxis`,tickLine:{...t,x1:o.extraSpaceLeftX,x2:Number(o.canvasWidth)-o.extraSpaceRightX},tickText:{...r,x:x},tickValues:r?i:void 0})},xt=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:r=0,step:a}=e.numeric;if(a>=Math.abs(t-r)||a<=0)return[r.toString()];const n=[];for(let e=r;e<=t;e+=a)n.push(e.toString());return n}},ht=(e,t)=>e.flatMap(e=>Object.keys(e).filter(r=>r!==t&&"number"==typeof e[r]).map(t=>Number(e[t]))),pt=(e,t,r,a,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,x=u*a,h=l?xt(l):t.map(e=>e[r]),p=Qe({bound:"width",data:h,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),f=n>p?n:p,g=c===H.BOTTOM?x+(d?.top??0):0,R=c===H.TOP?x+(d?.bottom??0):0;return{barChartXPosition:c||H.BOTTOM,extraSpaceBottomY:g,extraSpaceTopY:R,securityXSpace:f,xBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,xData:h}},ft=(e,t,r,a,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,x=u*a,h=l||Je([...new Set(ht(t,r))]),p=xt(h),f=n>x?n:x,g=Qe({bound:"width",data:p,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),R=c===H.LEFT?g+(d?.right??0):0,A=c===H.RIGHT?g+(d?.left??0):0;return{barChartYPosition:c||H.LEFT,extraSpaceLeftX:R,extraSpaceRightX:A,securityYSpace:f,yAxisText:g,yBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,yData:p}},gt=({addError:e,ajustedX:t,ajustedY:r,canvasHeight:a,canvasWidth:n,children:i,data:o,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u})=>{let x;if(!o||0===o.length){const t={error:le(Z)};e?.("BAR_CHART_CONTEXT_ERROR",t),x=t}if(n<=0||a<=0){const t={error:xe(n,a)};e?.("BAR_CHART_CONTEXT_ERROR",t),x=t}const h=qe(i),p=20*h,f=(h-1)*s,g=c===L.VERTICAL?n:a;if(p+f>g){const t={error:(R=`Insufficient space: requires ${p+f}px but only ${g}px available`,new Error(`Invalid bar distribution for "all": ${R}`))};e?.("BAR_CHART_CONTEXT_ERROR",t),x=t}var R;const A=o&&o.length>0?o:[{[_e]:0,[d]:Ae},{[_e]:0,[d]:Ee}],E=n>0?n:100,_=a>0?a:100,{barChartXPosition:T,barChartYPosition:y,extraSpaceBottomY:v,extraSpaceLeftX:m,extraSpaceRightX:C,extraSpaceTopY:S,securityXSpace:I,securityYSpace:N,xAxisText:$,xBreakAxis:k,xData:b,yAxisText:w,yBreakAxis:P,yData:B}=(({ajustedX:e,ajustedY:t,canvasHeight:r,canvasWidth:a,children:n,data:i,gapBetweenBars:o,orientation:s,pKey:c,viewBox:d})=>{let u={barChartXPosition:H.BOTTOM,barChartYPosition:H.LEFT,extraSpaceBottomY:0,extraSpaceLeftX:0,extraSpaceRightX:0,extraSpaceTopY:0,securityXSpace:0,securityYSpace:0,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]},x=o;const h=[];return l.Children.forEach(n,n=>{if(l.isValidElement(n))if(n.type!==Ze||h.includes(n.props.order)||(h.push(n.props.order),x+=n.props.barConfig.barWidth??0),n.type===ct){const t=s===L.VERTICAL?x:0;u={...u,...pt(n,i,c,e,t,d,r,a)}}else if(n.type===ut){const e=s===L.HORIZONTAL?x:0;u={...u,...ft(n,i,c,t,e,d,r,a)}}}),u})({ajustedX:t,ajustedY:r,canvasHeight:_,canvasWidth:E,children:i,data:A,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u}),M=T!==H.TOP&&T!==H.BOTTOM,D=(({initPos:e,maxSpaceAvailable:t,otherAxisSpace:r,securitySpace:a,tickValues:n})=>{const i=n.length-1,o=(t-r-a)/i;return n.map((t,r)=>({position:e+r*o+a/2,value:t}))})({initPos:m,maxSpaceAvailable:E,otherAxisSpace:m+C,securitySpace:I,tickValues:b});if((D??[]).some(({position:e})=>isNaN(e))){const t={error:le(z)};e?.("BAR_CHART_CONTEXT_ERROR",t),x=t}if(D){const t=D.length<2,r=D.length>=2&&1===new Set(D.map(e=>e.value)).size;if(t){const t={error:le(ne)};e?.("BAR_CHART_X_AXIS_ERROR",t),x||(x=t)}if(r){const t={error:le(ae)};e?.("BAR_CHART_X_AXIS_ERROR",t),x||(x=t)}}const j=y!==H.LEFT&&y!==H.RIGHT,F=(({initPos:e,maxSpaceAvailable:t,needAjusted:r,otherAxisSpace:a,securitySpace:n,tickValues:i})=>{const o=(t-a-n)/(i.length-1),s=r?n/2:0;return i.map((t,r)=>({position:e-r*o-s,value:t}))})({initPos:_-v,maxSpaceAvailable:_,needAjusted:c===L.HORIZONTAL,otherAxisSpace:S+v,securitySpace:N,tickValues:B});if(F){const t=F.length<2,r=F.length>=2&&1===new Set(F.map(e=>e.value)).size;if(t){const t={error:le(se)};e?.("BAR_CHART_Y_AXIS_ERROR",t),x||(x=t)}if(r){const t={error:le(oe)};e?.("BAR_CHART_Y_AXIS_ERROR",t),x||(x=t)}}const V=M?Re(F||[],[String(k)])[0]:0,X=j?Re(D||[],[String(P)])[0]:0,W=(({canvasHeight:e,canvasWidth:t,customBreakAxis:r,extraSpaceBottomY:a,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===H.TOP?{x1:n,x2:t-i,y1:o,y2:o}:s===H.CENTER?{x1:n,x2:t-i,y1:e/2,y2:e/2}:s===H.CUSTOM?{x1:n,x2:t-i,y1:r,y2:r}:{x1:n,x2:t-i,y1:e-a,y2:e-a})({canvasHeight:_,canvasWidth:E,customBreakAxis:Number(V),extraSpaceBottomY:v,extraSpaceLeftX:m,extraSpaceRightX:C,extraSpaceTopY:S,position:T}),K=(({canvasHeight:e,canvasWidth:t,customBreakAxis:r,extraSpaceBottomY:a,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===H.RIGHT?{x1:t-i,x2:t-i,y1:o,y2:e-a}:s===H.CENTER?{x1:t/2,x2:t/2,y1:o,y2:e-a}:s===H.CUSTOM?{x1:r,x2:r,y1:o,y2:e-a}:{x1:n,x2:n,y1:o,y2:e-a})({canvasHeight:_,canvasWidth:E,customBreakAxis:Number(X),extraSpaceBottomY:v,extraSpaceLeftX:m,extraSpaceRightX:C,extraSpaceTopY:S,position:y});if(W.x1===W.x2){const t={error:le(ie)};e?.("BAR_CHART_X_AXIS_ERROR",t),x||(x=t)}if(K.y1===K.y2){const t={error:le(ce)};e?.("BAR_CHART_Y_AXIS_ERROR",t),x||(x=t)}const Y={addError:e,crossXAxis:M,crossYAxis:j,data:A,extraSpaceBottomY:v,extraSpaceLeftX:m,extraSpaceRightX:C,extraSpaceTopY:S,securityXSpace:I,securityYSpace:N,xAxisCoordinates:{coordinates:W,tickValues:D||(x?[{position:0,value:Ae},{position:E,value:Ee}]:[])},xAxisText:$,yAxisCoordinates:{coordinates:K,tickValues:F||(x?[{position:_,value:Ae},{position:0,value:Ee}]:[])},yAxisText:w};return x?{...Y,error:{...x,type:O.BAR_CHART_CONTEXT_ERROR}}:Y},Rt=Object.assign(({canvasConfig:e=N,caption:t,children:r,classNames:a,data:n,dataTestId:i="bar-chart",gapBetweenBars:o=0,height:s="100%",onErrors:c,orientation:x,pKey:p,role:f,tabIndex:g,width:R="100%",...A})=>{const E=h(i),{parsedCanvas:_,parsedCanvasExtraSpace:T,viewBox:y}=I({canvasConfig:e,dataTestId:E,height:s,width:R}),v=_.width,m=_.height,C=qe(r),S=2*o,L=[d.jsx(ct,{},"default-x-axis"),d.jsx(ut,{},"default-y-axis")],O=l.Children.toArray(r)||[],H=L.concat(O),w=Math.max(v,m,T??0),P=v/w,B=m/w,M=l.useMemo(()=>$(c),[c]),D=k(n),j=l.useMemo(()=>(M.clearErrors(),gt({addError:(e,t)=>{M.addError(e,t)},ajustedX:P,ajustedY:B,canvasHeight:m,canvasWidth:v,children:H,data:n,gapBetweenBars:S,orientation:x,pKey:p,viewBox:y})),[m,v,D,p,x,M.addError]);return d.jsx(u,{caption:t,className:a,dataTestId:E,height:s,role:f,tabIndex:g,viewBox:y,width:R,...A,children:d.jsx(b.Provider,{value:{...j,barChildrenCount:C,canvasExtraSpace:T,canvasHeight:m,canvasWidth:v,data:n,dataTestId:E,gapBetweenBars:o,orientation:x,pKey:p},children:r})})},{Path:Ze,Separator:({areaSeparator:e,dataTestId:t,rightSeparator:r,topSeparator:a,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:x}=l.useContext(b),h=u.tickValues,p=x.tickValues,f=void 0!==n?"string"==typeof n?parseFloat(n):n:void 0,g=void 0!==i?"string"==typeof i?parseFloat(i):i:void 0;if(l.useEffect(()=>{if(void 0!==n){const e=h.map(e=>e.value);if(void 0===f||isNaN(f))o?.("BAR_CHART_SEPARATOR_ERROR",{error:he(n)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(f<t||f>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:fe(f,t,r)})}}if(void 0!==i){const e=p.map(e=>e.value);if(void 0===g||isNaN(g))o?.("BAR_CHART_SEPARATOR_ERROR",{error:pe(i)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(g<t||g>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:ge(g,t,r)})}}},[n,f,h,i,g,p]),!a&&!r&&!e)return d.jsx(d.Fragment,{});const R=n&&Re(u.tickValues,[n],!0)[0],A=i&&Re(x.tickValues,[i])[0],E=c?x.coordinates.x1:u.coordinates.x2,_=s?u.coordinates.y1:x.coordinates.y1,T=u.coordinates.x1,y=R??E,v=x.coordinates.y2,m=A??_;l.useEffect(()=>{T===y&&v===m&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:le(te)})},[T,y,v,m]);const C=`M${T} ${v} H ${y} V ${m} H ${T} Z`,S=`M${T} ${m} H ${y}`,I=`M${y} ${v} V ${m}`;return d.jsxs("g",{children:[d.jsx("path",{d:C,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:S,"data-testid":`${t}Top`,...a}),d.jsx("path",{d:I,"data-testid":`${t}Right`,...r})]})},XAxis:ct,YAxis:ut}),At=l.createContext({}),Et=({curved:e=!1,extendToBottom:t=!1,points:r,svgHeight:a})=>{if(0===r.length)return"";const[n,...i]=r;let o=`M ${n[0]} ${n[1]}`;return o+=e?i.reduce((e,t,a)=>{const[n,i]=r[a],[o,s]=t,c=.3*(o-n),d=[n+c,i],l=[o-c,s];return`${e} C ${d[0]} ${d[1]}, ${l[0]} ${l[1]}, ${o} ${s}`},""):i.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""),t&&(o+=` L ${i[i.length-1][0]} ${a} L ${n[0]} ${a} Z`),o},_t=(e,t)=>new Error(`Invalid projection bounds - upper projection (${e}) must be below lower projection (${t})`),Tt=(e,t)=>new Error(`${t?"Upper":"Lower"} projection X coordinate (${e}) is outside valid range (0-100)`),yt=(e,t,r)=>new Error(`${r?"Upper":"Lower"} projection Y coordinate (${e}) is outside chart area (0-${t})`),vt=(e,t)=>{if(!t)return e;const r=t<0,a=e*Math.abs(t)/100;return r?e-a:e+a},mt=(e,t,r)=>{if(!r)return e;const a=r<0,n=(0===e?t:e)*Math.abs(r)/100;return a?e+n:e-n},Ct=({curved:e,lineProjection:t,points:r,svgHeight:a})=>{const{addError:n}=l.useContext(At),{lower:i,shapeColor:o,upper:s}=t,{xProjection:c,yProjection:u,...x}=s||{},{xProjection:h,yProjection:p,...f}=i||{},g=c||u?{x:c,y:u}:void 0,R=h||p?{x:h,y:p}:void 0,A=g?.y,E=R?.y,_=g?.x,T=R?.x;l.useEffect(()=>{if(g&&R){const e=A||0,t=E||0;e>=t&&n?.("LINE_CHART_PROJECTION_ERROR",{error:_t(e,t)})}g&&(void 0!==_&&(_<0||_>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Tt(_,!0)}),void 0!==A&&(A<0||A>a)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:yt(A,a,!0)})),R&&(void 0!==T&&(T<0||T>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Tt(T,!1)}),void 0!==E&&(E<0||E>a)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:yt(E,a,!1)}))},[R,T,E,a,g,_,A]);const{downPath:y,shapePath:v,upPath:m}=(({curved:e,lowerProjection:t,points:r,svgHeight:a,upperProjection:n})=>{const i=n||t;if(0===r.length&&!i)return{shapePath:""};const[o,...s]=r,c=`M ${o[0]} ${o[1]}`;let d=c,l=n?c:void 0,u=t?c:void 0;const x=[],h=[];s.forEach(([e,r])=>{const i=n?[vt(e,n.x),mt(r,a,n.y)]:[e,r],o=t?[vt(e,-(t.x??0)),mt(r,a,-(t.y??0))]:[e,r];x.push(i),h.push(o)});const p=n&&t?[...x,s.at(-1),...h.reverse(),o]:[...x,...h.reverse(),o];return e?(d+=p.reduce((e,t,r)=>{const a=0===r?o:p[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},""),l&&(l+=x.reduce((e,t,r)=>{const a=0===r?o:x[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},"")),u&&(u+=h.reverse().reduce((e,t,r)=>{const a=0===r?o:h[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},""))):(d+=p.reduce((e,t)=>`${e} L ${t?.[0]} ${t?.[1]}`,""),l&&(l+=x.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,"")),u&&(u+=h.reverse().reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""))),{downPath:u,shapePath:d,upPath:l}})({curved:e,lowerProjection:R,points:r,svgHeight:a,upperProjection:g});return d.jsxs("g",{className:"pointer-events-none",children:[d.jsx("path",{d:v,fill:o,stroke:"transparent",strokeWidth:"0.1"}),";",m&&d.jsx("path",{d:m,...x}),y&&d.jsx("path",{d:y,...f})]})},St=(e,t)=>e.map(e=>e[t]),It={formatTicksValues:(e,t)=>e.map(e=>({...e,value:t(e.value)}))},Nt=({ariaLabel:e,position:t=H.BOTTOM,tickLine:r,tickText:a,valueFormatter:n=e=>e,...i})=>{const{xAxisCoordinates:{coordinates:o,tickValues:s},xCursor:c,...u}=l.useContext(At),x=st(t,o.y1,Number(a?.fontSize),a?.top??0),h=a?It.formatTicksValues(s,n):void 0,p=be(i),f=e||i["aria-label"],g={...i,...p,...f&&{"aria-label":f}};return d.jsx(it,{...o,...g,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}xAxis`,tickLine:{...r,y1:u.yAxisCoordinates.coordinates.y1,y2:u.yAxisCoordinates.coordinates.y2},tickText:{...a,y:x},tickValues:h})},$t=({tickText:e,textWidth:t,yAxisPosition:r})=>{if(r!==H.LEFT)return 0;if(e?.useAxisAsOrigin){const{textAnchor:r="start"}=e;let a=0;return"end"===r&&(a=t),"middle"===r&&(a=t/2),a+=e.left??0,a-=e.right??0,Math.max(0,a)}const a=e?.textAnchor,n=e?.left??0;return"start"===a?0:"middle"===a?t+n:"end"===a?2*t+n:t/2+n},kt=({tickText:e,textWidth:t,yAxisPosition:r})=>{if(r!==H.RIGHT)return 0;if(e?.useAxisAsOrigin){const{textAnchor:r="start"}=e;let a=t;return"end"===r&&(a=0),"middle"===r&&(a=t/2),a-=e.left??0,a+=e.right??0,Math.max(0,a)}const a=e?.textAnchor,n=e?.right??0;return"start"===a?t:"middle"===a||"end"===a?t+n:2*t-t/2+n},bt=({tickText:e,textWidth:t})=>{const r=e?.textAnchor??"start";return"start"===r?0:"middle"===r?t/2:t},Lt=({tickText:e,textWidth:t})=>{const r=e?.textAnchor??"start";return"end"===r?0:"middle"===r?t/2:t},Ot=({ariaLabel:e,position:t=H.LEFT,tickLine:r,tickText:a,valueFormatter:n=e=>e,...i})=>{const{yAxisCoordinates:{coordinates:o,tickValues:s},yCursor:c,...u}=l.useContext(At),x=(({tickText:e,yAxisPosition:t,textWidth:r,yAxisX1:a})=>{if(e?.useAxisAsOrigin){let t=a;return t+=e.right??0,t-=e.left??0,t}const n=e?.textAnchor||"middle";let i=0;t===H.RIGHT?i=e?.right??0:t===H.LEFT&&(i=e?.left??0);const o=lt(n,r,i);return ot(t,a,o)})({tickText:a,yAxisPosition:t,textWidth:u.yAxisText,yAxisX1:o.x1}),h=a?It.formatTicksValues(s,n):void 0,p=be(i),f=e||i["aria-label"],g={...i,...p,...f&&{"aria-label":f}};return d.jsx(dt,{...o,...g,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}yAxis`,tickLine:{...r,x1:u.xAxisCoordinates.coordinates.x1,x2:u.xAxisCoordinates.coordinates.x2},tickText:{...a,x:x},tickValues:h})},Ht=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:r=0,step:a}=e.numeric;if(a>=Math.abs(t-r)||a<=0)return[r.toString(),t.toString()];const n=[];for(let e=r;e<=t;e+=a)n.push(e.toString());return n}},wt=(e,t)=>e.flatMap(e=>Object.keys(e).filter(r=>r!==t&&"number"==typeof e[r]).map(t=>e[t])),Pt=({tickValues:e,tickText:t})=>e?.numeric?e.numeric.breakAxis??0:t?.custom?.breakAxis??0,Bt=(e,t,r,a,n,i)=>{const{position:o=H.BOTTOM,tickText:s,tickValues:c,valueFormatter:d}=e.props,l=s?.fontSize??0,u=c?Ht(c):t.map(e=>e[r]),x=d?u.map(d):u,h=Qe({bound:"width",data:x,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),p=Qe({bound:"height",data:x,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),f=o===H.BOTTOM?p+(s?.top??0):0,g=o===H.TOP?p+(s?.bottom??0):0,R=Pt({tickValues:c,tickText:s});return{xAxisLeftSpacing:bt({textWidth:h,tickText:s}),xAxisTopSpacing:g,xAxisRightSpacing:Lt({textWidth:h,tickText:s}),xAxisBottomSpacing:f,lineChartXPosition:o,xBreakAxis:R,xData:u}},Mt=(e,t,r,a,n,i)=>{const{position:o=H.LEFT,tickText:s,tickValues:c,valueFormatter:d}=e.props,l=s?.fontSize??0,u=c||Je([...new Set(wt(t,r))]),x=Ht(u),h=d?x.map(d):x,p=Qe({bound:"width",data:h,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),f=Qe({bound:"height",data:h,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a});return{yAxisLeftSpacing:$t({tickText:s,textWidth:p,yAxisPosition:o}),yAxisTopSpacing:f,yAxisRightSpacing:kt({tickText:s,textWidth:p,yAxisPosition:o}),yAxisBottomSpacing:0,lineChartYPosition:o,yAxisText:p,yBreakAxis:Pt({tickValues:c,tickText:s}),yData:x}},Dt=({addError:e,canvasHeight:t,canvasWidth:r,children:a,data:n,viewBox:i,xKey:o})=>{let s;const{error:c}=(({data:e,addError:t})=>{let r;if(!e||0===e.length){const e={error:le(q)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}if(e&&1===e.length){const e={error:le(re)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}return{error:r}})({data:n,addError:e});c&&(s=c);const{error:d}=(({canvasWidth:e,canvasHeight:t,addError:r})=>{let a;if(e<=0||t<=0){const n={error:xe(e,t)};r?.("LINE_CHART_CONTEXT_ERROR",n),a=n}return{error:a}})({canvasWidth:r,canvasHeight:t,addError:e});d&&(s=d);const u=n&&n.length>0?n:[{[o]:"0",y:0},{[o]:"1",y:1}],x=r>0?r:100,h=t>0?t:100,{xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:g,xAxisBottomSpacing:R,yAxisLeftSpacing:A,yAxisTopSpacing:E,yAxisRightSpacing:_,yAxisBottomSpacing:T,lineChartXPosition:y,lineChartYPosition:v,xAxisText:m,xBreakAxis:C,xData:S,yAxisText:I,yBreakAxis:N,yData:$}=(({canvasHeight:e,canvasWidth:t,children:r,data:a,viewBox:n,xKey:i})=>{let o={xAxisLeftSpacing:0,xAxisTopSpacing:0,xAxisRightSpacing:0,xAxisBottomSpacing:0,yAxisLeftSpacing:0,yAxisTopSpacing:0,yAxisRightSpacing:0,yAxisBottomSpacing:0,lineChartXPosition:H.BOTTOM,lineChartYPosition:H.LEFT,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]};return l.Children.forEach(r,r=>{l.isValidElement(r)&&(r.type===Nt?o={...o,...Bt(r,a,i,n,e,t)}:r.type===Ot&&(o={...o,...Mt(r,a,i,n,e,t)}))}),o})({canvasHeight:h,canvasWidth:x,children:a,data:u,viewBox:i,xKey:o}),k=(({tickValues:e,maxSpaceAvailable:t,xAxisLeftSpacing:r,xAxisRightSpacing:a,yAxisLeftSpacing:n,yAxisRightSpacing:i})=>{const o=Math.max(n,r),s=t-Math.max(a,i);if(e.length<=1)return[{position:o,value:e[0]}];const c=(s-o)/(e.length-1);return e.map((e,t)=>({position:o+c*t,value:e}))})({tickValues:S,maxSpaceAvailable:x,xAxisLeftSpacing:p,xAxisRightSpacing:g,yAxisLeftSpacing:A,yAxisRightSpacing:_}),{error:b}=(({xTickValues:e,addError:t})=>{let r;if(e){if((e??[]).some(({position:e})=>isNaN(e))){const e={error:le(z)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}const a=e.length<2,n=e.length>=2&&1===new Set(e.map(e=>e.value)).size;if(a){const e={error:le(ne)};t?.("LINE_CHART_X_AXIS_ERROR",e),r||(r=e)}if(n){const e={error:le(ae)};t?.("LINE_CHART_X_AXIS_ERROR",e),r||(r=e)}}return{error:r}})({xTickValues:k,addError:e});!s&&b&&(s=b);const L=(({maxSpaceAvailable:e,tickValues:t,xAxisTopSpacing:r,xAxisBottomSpacing:a,yAxisTopSpacing:n,yAxisBottomSpacing:i})=>{const o=e-Math.max(a,i),s=Math.max(n,r);if(t.length<=1)return[{position:o,value:t[0]}];const c=(o-s)/(t.length-1);return t.map((e,t)=>({position:o-c*t,value:e}))})({maxSpaceAvailable:h,tickValues:$,xAxisTopSpacing:f,xAxisBottomSpacing:R,yAxisTopSpacing:E,yAxisBottomSpacing:T}),{error:w}=(({yTickValues:e,addError:t})=>{let r;if(e){const a=e.length<2,n=e.length>=2&&1===new Set(e.map(e=>e.value)).size;if(a){const e={error:le(se)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}if(n){const e={error:le(oe)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}}return{error:r}})({yTickValues:L,addError:e});!s&&w&&(s=w);const P=y!==H.TOP&&y!==H.BOTTOM,B=v!==H.LEFT&&v!==H.RIGHT,M=P?Re(L||[],[String(C)])[0]:0,D=B?Re(k||[],[String(N)])[0]:0,j=(({lineChartXPosition:e,lineChartYPosition:t,canvasHeight:r,canvasWidth:a,customBreakAxis:n,xAxisLeftSpacing:i,xAxisTopSpacing:o,xAxisRightSpacing:s,xAxisBottomSpacing:c,yAxisLeftSpacing:d,yAxisTopSpacing:l,yAxisRightSpacing:u,yAxisBottomSpacing:x})=>{const h=t===H.LEFT?Math.max(d,i):0,p=t===H.RIGHT?a-Math.max(u,s):a;return e===H.TOP?{x1:h,x2:p,y1:Math.max(l,o),y2:Math.max(l,o)}:e===H.CENTER?{x1:h,x2:p,y1:r/2,y2:r/2}:e===H.CUSTOM?{x1:h,x2:p,y1:n,y2:n}:{x1:h,x2:p,y1:r-Math.max(x,c),y2:r-Math.max(x,c)}})({canvasHeight:h,canvasWidth:x,customBreakAxis:Number(M),lineChartXPosition:y,lineChartYPosition:v,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:g,xAxisBottomSpacing:R,yAxisLeftSpacing:A,yAxisTopSpacing:E,yAxisRightSpacing:_,yAxisBottomSpacing:T}),F=(({lineChartXPosition:e,lineChartYPosition:t,canvasHeight:r,canvasWidth:a,customBreakAxis:n,xAxisLeftSpacing:i,xAxisTopSpacing:o,xAxisRightSpacing:s,xAxisBottomSpacing:c,yAxisLeftSpacing:d,yAxisTopSpacing:l,yAxisRightSpacing:u,yAxisBottomSpacing:x})=>{const h=e===H.TOP?Math.max(l,o):0,p=e===H.BOTTOM?r-Math.max(x,c):r;return t===H.RIGHT?{x1:a-Math.max(u,s),x2:a-Math.max(u,s),y1:h,y2:p}:t===H.CENTER?{x1:a/2,x2:a/2,y1:h,y2:p}:t===H.CUSTOM?{x1:n,x2:n,y1:h,y2:p}:{x1:Math.max(d,i),x2:Math.max(d,i),y1:h,y2:p}})({canvasHeight:h,canvasWidth:x,customBreakAxis:Number(D),lineChartXPosition:y,lineChartYPosition:v,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:g,xAxisBottomSpacing:R,yAxisLeftSpacing:A,yAxisTopSpacing:E,yAxisRightSpacing:_,yAxisBottomSpacing:T}),{error:V}=(({xCoordinates:e,addError:t})=>{let r;if(e.x1===e.x2){const e={error:le(ie)};t?.("LINE_CHART_X_AXIS_ERROR",e),r=e}return{error:r}})({xCoordinates:j,addError:e});!s&&V&&(s=V);const{error:X}=(({yCoordinates:e,addError:t})=>{let r;if(e.y1===e.y2){const e={error:le(ce)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}return{error:r}})({yCoordinates:F,addError:e});!s&&X&&(s=X);const W={addError:e,crossXAxis:P,crossYAxis:B,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:g,xAxisBottomSpacing:R,yAxisLeftSpacing:A,yAxisTopSpacing:E,yAxisRightSpacing:_,yAxisBottomSpacing:T,xAxisCoordinates:{coordinates:j,tickValues:k||(s?[{position:0,value:"0"},{position:x,value:"1"}]:[])},xAxisText:m,yAxisCoordinates:{coordinates:F,tickValues:L||(s?[{position:h,value:Ae},{position:0,value:Ee}]:[])},yAxisText:I};return s?{...W,error:{...s,type:O.LINE_CHART_CONTEXT_ERROR}}:W},jt=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:r=N,caption:a,children:n,classNames:i,data:o,dataTestId:s="line-chart",getPathArea:c,height:x="100%",onErrors:p,role:f,tabIndex:g,width:R="100%",xKey:A,...E})=>{const _=h(s),[T,y]=l.useState(""),{parsedCanvas:v,parsedCanvasExtraSpace:m,viewBox:C}=I({canvasConfig:r,dataTestId:_,height:x,width:R}),S=[d.jsx(Nt,{},"default-x-axis"),d.jsx(Ot,{},"default-y-axis")],b=l.Children.toArray(n)||[],L=S.concat(b);(({attrName:e,children:t,originalValue:r,updateValue:a})=>{let n="";l.Children.toArray(t).forEach(t=>{if(l.isValidElement(t)){const r=t.props[e];r&&(n+=r)}}),n!==r&&a(n)})({attrName:"dataKey",children:L,originalValue:T,updateValue:y});const O=l.useMemo(()=>$(p),[p]),H=k(o),w=l.useMemo(()=>(O.clearErrors(),Dt({addError:(e,t)=>{O.addError(e,t)},canvasHeight:v.height,canvasWidth:v.width,children:L,data:o,viewBox:C,xKey:A})),[v.width,v.height,H,A,T,O.addError]),{svgRef:P,xCursor:B,yCursor:M}=(({canvasHeight:e,canvasWidth:t})=>{const[[r,a],n]=l.useState([Oe,Oe]),i=l.useCallback((r,a)=>{const{height:i,left:o,top:s,width:c}=a.getBoundingClientRect(),d=r.clientX-o,l=r.clientY-s;n([d*t/c,l*e/i])},[t,e]),o=e=>{e.preventDefault()};return{svgRef:l.useCallback(e=>{e&&(e.addEventListener("touchstart",o),e.addEventListener("touchmove",t=>i(t.touches[0],e)),e.addEventListener("mousemove",t=>i(t,e))),e?.removeEventListener("touchstart",o),e?.removeEventListener("touchmove",t=>i(t.touches[0],e)),e?.removeEventListener("mousemove",t=>i(t,e))},[e,t]),xCursor:r,yCursor:a}})({canvasHeight:v.height,canvasWidth:v.width});return l.useEffect(()=>{c?.({x1:w.xAxisCoordinates.coordinates.x1,y1:w.yAxisCoordinates.coordinates.y1,x2:w.xAxisCoordinates.coordinates.x2,y2:w.yAxisCoordinates.coordinates.y2})},[w.xAxisCoordinates.coordinates.x1,w.yAxisCoordinates.coordinates.y1,w.xAxisCoordinates.coordinates.x2,w.yAxisCoordinates.coordinates.y2,c]),d.jsx(u,{ref:P,ariaHidden:e,ariaLabel:t,caption:a,className:i,"data-kbt-svg":!0,dataTestId:_,height:x,role:f,tabIndex:g,viewBox:C,width:R,...E,children:d.jsx(At.Provider,{value:{...w,canvasExtraSpace:m,canvasHeight:v.height,canvasWidth:v.width,data:o,dataTestId:_,xCursor:B,xKey:A,yCursor:M},children:n})})},{Path:({ariaLabel:e,closestClick:t,curved:r,getNodeFocusInfo:a,getNodesCoords:n,indicatorConfig:i,lineProjection:o,onClick:s,...c})=>{const{addError:u,xAxisCoordinates:x,yAxisCoordinates:h,...p}=l.useContext(At),f=c.dataKey,g=p.data.length>0,R=p.data[0],A=!!R&&Object.prototype.hasOwnProperty.call(R,f),E=p.data.length;l.useEffect(()=>{if(!f||"string"!=typeof f)return void u?.("LINE_CHART_PATH_ERROR",{error:le(ee)});if(g&&!A)return void u?.("LINE_CHART_PATH_ERROR",{error:ue(f)});if(r&&E<2)return void u?.("LINE_CHART_PATH_ERROR",{error:le(Q)});const e=St(p.data,f);e.length>0&&e.every(e=>null==e)&&u?.("LINE_CHART_PATH_ERROR",{error:le(J)})},[u,r,f,E,g,A,p.data]);const{indicatorRef:_,pathRef:T}=((e,t)=>{const r=l.useRef(null),a=l.useRef(null);return l.useEffect(()=>{if(!t||!r.current||!a.current)return;const n=r.current,i=a.current;let o,s,c=0,d=n.getTotalLength();for(;d-c>.01;)o=(c+d)/2,s=n.getPointAtLength(o),s.x<e?c=o:d=o;const l=n.getPointAtLength(d);i.setAttribute("transform",`translate(${l.x}, ${l.y})`),i.setAttribute("pointer-events","none")},[e]),{indicatorRef:a,pathRef:r}})(p.xCursor,!!i),y=!!i&&p.xCursor!==-1/0,v=l.useRef(null),m=l.useRef(null),{autoClick:C,lineIndicator:S,...I}=i||{},{y1:N,y2:$}=h.coordinates,{x1:k,x2:b}=x.coordinates,L=p.xCursor>=k&&p.xCursor<=b,{tickValues:O}=x,{tickValues:H}=h,w=St(p.data,p.xKey),P=St(p.data,f),B=Re(O,w,!0),M=Re(H,P),D=B.map((e,t)=>[e,M[t]]),j=Et({curved:r,extendToBottom:!1,points:D,svgHeight:h.coordinates.y2}),F=Et({curved:r,extendToBottom:!!c.fill||!!c.gradient,points:D,svgHeight:h.coordinates.y2});l.useEffect(()=>{if(!v.current?.path)return;T.current=v.current.path;const e=v.current.main,t=v.current.node,r=w.map((e,t)=>({x:e,y:P[t]})),{mount:n,unmount:i}=(({data:e,getNodeFocusInfo:t,nodes:r,ref:a})=>{let n;const i=a.querySelector("[data-draw]"),o=a=>{let i;"ArrowRight"===a.key?i=void 0===n||n===r.length-1?0:n+1:"ArrowLeft"===a.key&&(i=void 0===n||0===n?r.length-1:n-1),void 0!==i&&(n=i,r[n]&&(r[n].focus(),t?.(e[n])))},s=()=>{n=void 0};return{mount:()=>{i?.addEventListener("focus",s),a.addEventListener("keydown",e=>o(e))},unmount:()=>{i?.removeEventListener("focus",s),a.removeEventListener("keydown",e=>o(e))}}})({data:r,getNodeFocusInfo:a,nodes:t,ref:e});return n(),()=>i()},[]),l.useEffect(()=>{if(c.nodeConfig&&y&&C){const{idx:e,match:t}=((e,t)=>{let r=0,a=!1;for(let n=0;n<e.length;n++)if(Math.round(e[n])===Math.round(t)){a=!0,r=n;break}return{idx:r,match:a}})(B,p.xCursor);if(t&&e!==m.current){m.current=e;const t=new MouseEvent("click",{bubbles:!0});t.autoClick=!0,v.current?.node?.[e]?.dispatchEvent(t),navigator?.vibrate?.(200)}else m.current=null}},[p.xCursor]),l.useEffect(()=>{n?.(D)},[D]);const V=be(c),X={...c,...V,...e&&{"aria-label":e}};return d.jsxs(d.Fragment,{children:[d.jsx(Ye,{ref:v,d:j,dFill:F,dataTestId:`${p.dataTestId}path`,dataValue:p.data,points:D,xKey:p.xKey,onClick:e=>{if(s?.(e),t){const e=((e,t)=>{let r=0,a=Math.abs(e[0]-t);for(let n=1;n<e.length;n++){const i=Math.abs(e[n]-t);i<a&&(r=n,a=i)}return r})(B,p.xCursor),t=new MouseEvent("click",{bubbles:!0});t.autoClick=!1,v.current?.node?.[e]?.dispatchEvent(t)}},...X}),o&&d.jsx(Ct,{curved:r,dataKey:c.dataKey,lineProjection:o,points:D,svgHeight:h.coordinates.y2}),y&&d.jsxs(d.Fragment,{children:[!!S&&L&&d.jsx(et,{...S,className:"pointer-events-none",x1:p.xCursor,x2:p.xCursor,y1:N,y2:$}),d.jsx("g",{ref:_,className:"pointer-events-none",children:d.jsx(We,{...I})})]})]})},Separator:({areaSeparator:e,dataTestId:t,rightSeparator:r,topSeparator:a,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:x}=l.useContext(At),h=u.tickValues,p=x.tickValues,f=void 0!==n?"string"==typeof n?parseFloat(n):n:void 0,g=void 0!==i?"string"==typeof i?parseFloat(i):i:void 0;if(l.useEffect(()=>{if(void 0!==n){const e=h.map(e=>e.value);if(void 0===f||isNaN(f))o?.("LINE_CHART_SEPARATOR_ERROR",{error:he(n)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(f<t||f>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:fe(f,t,r)})}}if(void 0!==i){const e=p.map(e=>e.value);if(void 0===g||isNaN(g))o?.("LINE_CHART_SEPARATOR_ERROR",{error:pe(i)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(g<t||g>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:ge(g,t,r)})}}},[n,f,h,i,g,p]),!a&&!r&&!e)return d.jsx(d.Fragment,{});const R=n&&Re(u.tickValues,[n],!0)[0],A=i&&Re(x.tickValues,[i])[0],E=c?x.coordinates.x1:u.coordinates.x2,_=s?u.coordinates.y1:x.coordinates.y1,T=u.coordinates.x1,y=R??E,v=x.coordinates.y2,m=A??_;l.useEffect(()=>{T===y&&v===m&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:le(te)})},[T,y,v,m]);const C=`M${T} ${v} H ${y} V ${m} H ${T} Z`,S=`M${T} ${m} H ${y}`,I=`M${y} ${v} V ${m}`;return d.jsxs("g",{children:[d.jsx("path",{d:C,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:S,"data-testid":`${t}Top`,...a}),d.jsx("path",{d:I,"data-testid":`${t}Right`,...r})]})},XAxis:Nt,YAxis:Ot}),Ft=({children:e,dataTestId:t,height:r,width:a,x:n,y:i})=>d.jsx("foreignObject",{"data-testid":t,height:r,width:a,x:n,y:i,children:e}),Vt=l.createContext({}),Xt=({ariaLabel:e,dataKey:t,index:r,groupName:a,groupValue:n})=>{if(!e)return;const i=new RegExp("{{dataKey}}","g"),o=new RegExp("{{index}}","g"),s=new RegExp("{{groupName}}","g"),c=new RegExp("{{groupValue}}","g");return e.replace(i,t).replace(o,String(r)).replace(s,a).replace(c,String(n))},Wt=(e,t,r)=>({x:e.x+t*Math.cos(r),y:e.y+t*Math.sin(r)}),Kt=({center:e,innerEnd:t,innerRadius:r,singleStroke:a})=>{if(!a)return r>0?`L ${t.x},${t.y}`:`L ${e.x},${e.y}`},Yt="CLOCKWISE",Ut=({canvasHeight:e,canvasWidth:t,color:r="blue",dataKey:a,gap:n,halfChart:i,index:o,innerRadius:s,name:c,radius:u,singleStroke:x,startAngle:h,total:p,value:f,...g})=>{const{addError:R}=l.useContext(Vt),A=Number(f),E=void 0!==u?Number(u):void 0,_=void 0!==s?Number(s):void 0,T=c?.trim()||"";l.useEffect(()=>{T||R?.("PIE_CHART_SEGMENT_ERROR",{error:K(a||"unknown",o||0,"name")}),isNaN(A)?R?.("PIE_CHART_SEGMENT_ERROR",{error:j(f,T||`segment-${o}`)}):(A<0&&R?.("PIE_CHART_SEGMENT_ERROR",{error:F(A,T||`segment-${o}`)}),void 0!==E&&(isNaN(E)||E<=0)&&R?.("PIE_CHART_SEGMENT_ERROR",{error:Y(u)}),void 0!==_&&((isNaN(_)||_<0)&&R?.("PIE_CHART_SEGMENT_ERROR",{error:U(s)}),void 0!==E&&(isNaN(E)||isNaN(_)||_>=E&&R?.("PIE_CHART_SEGMENT_ERROR",{error:G(_,E)}))))},[a,o,_,E,A,T]);const y=(({canvasHeight:e,canvasWidth:t,customRadius:r,gap:a,halfChart:n,innerRadius:i,rotateDirection:o,singleStroke:s,startAngle:c,total:d,value:l})=>{const u=n?2*e:e,x=Math.min(t,u)/2,h=r&&r<x?r:x,p=n?Math.PI:2*Math.PI,f={x:t/2,y:n?e:e/2},g=s?2*d:d,R=100*l/g*p/100,A=a/h,{carryAngle:E,finalAngle:_,initialAngle:T}=(({angleEquivalent:e,direction:t,gapAngle:r,startAngle:a})=>{const n=t===Yt;return{carryAngle:n?a+e:a-e,finalAngle:n?a+e-r/2:a-e+r/2,initialAngle:n?a+r/2:a-r/2}})({angleEquivalent:R,direction:o,gapAngle:A,startAngle:c.current});c.current=E;const y=p*l/g-A<=Math.PI?"0":"1",v=Wt(f,i,T),m=Wt(f,i,_),C=Wt(f,h,T);return(({center:e,innerEnd:t,innerRadius:r,innerStart:a,largeArcFlag:n,outerEnd:i,outerStart:o,radius:s,rotateDirection:c,singleStroke:d})=>{let l,u,x,h,p,f,g,R,A,E;return c===Yt?(l=`M ${o.x},${o.y}`,u=`A ${s},${s} 0 ${n} 1 ${i.x}, ${i.y}`,x=Kt({center:e,innerEnd:t,innerRadius:r,singleStroke:d}),h=d?`M ${t.x},${t.y}`:void 0,p=r>0?`A ${r},${r} 0 ${n} 0 ${a.x},${a.y}`:void 0,f=`M ${o.x},${o.y}`,R=`M ${t.x},${t.y}`,g=`A ${s},${s} 0 ${n} 0 ${i.x},${i.y}`,A=`A ${r},${r} 0 ${n} 1 ${a.x},${a.y}`,E=d?void 0:"Z"):(l=`M ${o.x} ${o.y}`,u=`A ${s},${s} 0 ${n},0 ${i.x}, ${i.y}`,x=Kt({center:e,innerEnd:t,innerRadius:r,singleStroke:d}),h=d?`M ${t.x},${t.y}`:void 0,p=r>0?`A ${r}, ${r} 0 ${n},1 ${a.x},${a.y}`:void 0,f=`M ${o.x},${o.y}`,R=`M ${t.x},${t.y}`,g=`A ${s},${s} 0 ${n} 1 ${i.x},${i.y}`,A=`A ${r},${r} 0 ${n} 0 ${a.x},${a.y}`,E=d?void 0:"Z"),[l,u,x,h,p,E].concat(d?[f,g,R,A]:[]).filter(Boolean).join(" ")})({center:f,innerEnd:m,innerRadius:i,innerStart:v,largeArcFlag:y,outerEnd:Wt(f,h,_),outerStart:C,radius:h,rotateDirection:o,singleStroke:s})})({canvasHeight:e,canvasWidth:t,customRadius:u,gap:n,halfChart:i,innerRadius:s,singleStroke:x,startAngle:h,total:p,value:f});return d.jsx(Ye,{...g,d:y,dataValue:f,fill:r})},Gt=({ariaLabel:e,"aria-label":t,dataKey:r,fill:a,gap:n,innerRadius:i,radius:o,...s})=>{const c=String(r),{addError:u,canvasHeight:x,canvasWidth:h,data:p,dataTestId:f,halfChart:g}=l.useContext(Vt),R=g?0:-Math.PI/2,A=l.useRef(R),E=p[c],_=Object.prototype.hasOwnProperty.call(p,c);l.useEffect(()=>{if(!_)return void u?.("PIE_CHART_PATH_ERROR",{error:V(c)});if(!E||0===E.length)return void u?.("PIE_CHART_PATH_ERROR",{error:X(c)});const e=E.reduce((e,t)=>e+t.value,0);(e<=0||isNaN(e))&&u?.("PIE_CHART_PATH_ERROR",{error:W(c,e)})},[E,_,c]);const T=p[c]?.reduce((e,t)=>e+t.value,0),y=1===p[c]?.length,v=i?S(i):void 0,m=o?S(o):void 0;return p[c]?.length?d.jsx("g",{children:p[c].map((r,i)=>l.createElement(Ut,{...s,...r,key:`${i.toString()}`,ariaLabel:Xt({ariaLabel:t||e,dataKey:c,index:i,groupName:r.name,groupValue:r.value}),canvasHeight:x,canvasWidth:h,color:r.color||a,dataKey:c,dataTestId:`${f}path-${i}`,gap:n,halfChart:g,index:i,innerRadius:v,radius:m,singleStroke:y,startAngle:A,total:T}))}):d.jsx(d.Fragment,{})},zt=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:r=N,caption:a,children:n,classNames:i,data:o,dataTestId:s="pie-chart",halfChart:c,height:x="100%",onErrors:p,radius:f="50%",role:g,tabIndex:R,width:A="100%",...E})=>{const _=h(s),{parsedCanvas:T,viewBox:y}=I({canvasConfig:r,dataTestId:_,height:x,width:A}),v=T.width,m=T.height,C=l.useMemo(()=>$(p),[p]),b=k(o),L=l.useMemo(()=>(C.clearErrors(),(({addError:e,canvasHeight:t,canvasWidth:r,children:a,halfChart:n})=>{(r<=0||t<=0)&&e?.("PIE_CHART_CONTEXT_ERROR",{error:xe(r,t)});const i=r>0?r:100,o=t>0?t:100;let s,c;l.Children.forEach(a,e=>{if(l.isValidElement(e)&&e.type===Gt){const{innerRadius:t}=e.props;if(!t)return;const r=S(t);(!s||r<s)&&(s=r)}}),s&&(c=2*s);const d=c??0,u=n?d/2:d,x=n?o:o/2;return{addError:e,foreignObject:{height:u,width:d,x:i/2-d/2,y:n?x-u:x-u/2}}})({addError:(e,t)=>{C.addError(e,t)},canvasHeight:m,canvasWidth:v,children:n,halfChart:c})),[m,v,c,b,C]);return d.jsx(u,{ariaHidden:e,ariaLabel:t,caption:a,className:i,dataTestId:_,height:x,radius:f,role:g,tabIndex:R,viewBox:y,width:A,...E,children:d.jsx(Vt.Provider,{value:{...L,canvasHeight:m,canvasWidth:v,data:o,dataTestId:_,halfChart:c},children:n})})},{Foreign:({children:e,dataTestId:t,height:r,width:a,x:n,y:i,...o})=>{const{dataTestId:s,foreignObject:c}=l.useContext(Vt),u=!a&&c?.width?c.width:a,x=!r&&c?.height?c.height:r,h=!n&&c?.x?c.x:n,p=!i&&c?.y?c.y:i,f=!t&&s?`${s}-foreign-object`:t;return d.jsx(Ft,{...o,dataTestId:f,height:x,width:u,x:h,y:p,children:e})},Path:Gt}),Zt=({fill:e="#8f8f8f",x:t,y:r})=>d.jsxs("g",{fill:e,pointerEvents:"none",transform:`translate(${t-5}, ${r-5})`,children:[d.jsx("path",{d:"M4.99948 9.99802C4.47168 9.99802 4.04419 9.64335 4.04419 9.20547V0.79255C4.04419 0.354666 4.47168 0 4.99948 0C5.52728 0 5.95477 0.354666 5.95477 0.79255V9.20745C5.95477 9.64533 5.52728 10 4.99948 10V9.99802Z"}),d.jsx("path",{d:"M0.955289 8.78839C0.427492 8.78839 0 8.43372 0 7.99584V2.00416C0 1.56628 0.427492 1.21161 0.955289 1.21161C1.48309 1.21161 1.91058 1.56628 1.91058 2.00416V7.99584C1.91058 8.43372 1.48309 8.78839 0.955289 8.78839Z"}),d.jsx("path",{d:"M8.08936 7.99584C8.08936 8.43372 8.51685 8.78839 9.04464 8.78839C9.57244 8.78839 9.99993 8.43372 9.99993 7.99584V2.00416C9.99993 1.56628 9.57244 1.21161 9.04464 1.21161C8.51685 1.21161 8.08936 1.56628 8.08936 2.00416V7.99584Z"})]}),qt=({linesData:e})=>d.jsx(d.Fragment,{children:e.map((e,t)=>d.jsxs("g",{children:[e.config.fill&&e.fillPath&&d.jsx("path",{d:e.fillPath,fill:e.config.fill,fillOpacity:e.config.fillOpacity||.2,stroke:"none"}),d.jsx("path",{d:e.linePath,fill:"none",stroke:e.config.stroke||"#0078D4",strokeWidth:e.config.strokeWidth||1})]},e.config.dataKey||e.config.yKey||t))}),Jt=(e,t,r)=>{const a=e.start/Math.max(1,t-1)*r;return{endX:e.end/Math.max(1,t-1)*r,startX:a}},Qt=(e,t,r)=>{const a=Math.max(0,Math.min(t,e))/t;return Math.round(a*(r-1))},er=(e,t,r=.1)=>{const a=Math.max(0,Math.min(e.start,t-1-r));return{end:Math.min(t-1,Math.max(e.end,a+r)),start:a}},tr=e=>({end:Math.max(0,e-1),start:0}),rr=(e,t)=>0===e.start&&e.end===t-1,ar=l.forwardRef(({currentRange:e,dataLength:t,dataTestId:r,endX:a,height:n,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l,screenReaderText:u,selectionConfig:x,startX:h},p)=>{const f=x.hideOverlayOnFullRange&&rr(e,t);return d.jsx(d.Fragment,{children:d.jsx("rect",{ref:p,"aria-label":u,"aria-valuemax":t-1,"aria-valuemin":0,"aria-valuetext":u,cursor:"grab","data-testid":r,fill:x.fill,fillOpacity:x.fillOpacity,height:n,role:"slider",stroke:x.stroke,strokeWidth:x.strokeWidth,style:{outline:"none",visibility:f?"hidden":"visible"},tabIndex:0,width:a-h,x:h,y:0,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l})})});ar.displayName="SelectionArea";const nr="#8f8f8f",ir=({dataTestId:e,focusConfig:t,handlerConfig:r,height:a,isFocused:n,max:i,min:o,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:x,screenReaderText:h,x:p})=>{const f=a/2,g=(e=>({fill:e?.fill||"#ffffff",iconColor:e?.iconColor||nr,radius:e?.radius||17,stroke:e?.stroke||nr,strokeWidth:e?.strokeWidth||1,verticalLineStroke:e?.verticalLineStroke||nr,verticalLineStrokeWidth:e?.verticalLineStrokeWidth||2}))(r);return d.jsxs("g",{"data-testid":`${e}-group`,children:[d.jsx("line",{pointerEvents:"none",stroke:g.verticalLineStroke,strokeWidth:g.verticalLineStrokeWidth,x1:p,x2:p,y1:0,y2:a}),d.jsx(ke,{dataTestId:e,focusConfig:t,isFocused:n,children:d.jsx("circle",{"aria-label":h,"aria-valuemax":i,"aria-valuemin":o,"aria-valuetext":h,cursor:"ew-resize",cx:p,cy:f,"data-testid":e,fill:g.fill,r:g.radius,role:"slider",stroke:g.stroke,strokeWidth:g.strokeWidth,style:{outline:"none"},tabIndex:0,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:x})}),d.jsx(Zt,{fill:g.iconColor,x:p,y:f})]})},or={END_HANDLER:"END_HANDLER",SELECTION_AREA:"SELECTION_AREA",START_HANDLER:"START_HANDLER"},sr=e=>{const{currentRange:t,dataLength:r,interactionConfig:a,onRangeChange:n,width:i}=e,o=l.useRef(null),[s,c]=l.useState(null),d=l.useCallback(e=>()=>{c(e)},[]),u=l.useCallback(e=>()=>{c(e)},[]),x=l.useCallback(e=>{if(!s||!o.current)return;const c=o.current;if(!c)return;const d=e-c.getBoundingClientRect().left,l=Qt(d,i,r),u=((e,t,r,a,n)=>{const i={...t};if(e===or.START_HANDLER)i.start=Math.max(0,Math.min(r,t.end-n.minHandlerDistance));else if(e===or.END_HANDLER)i.end=Math.min(a-1,Math.max(r,t.start+n.minHandlerDistance));else if(e===or.SELECTION_AREA){const e=t.end-t.start,n=Math.max(0,Math.min(a-1-e,r-e/2));i.start=n,i.end=n+e}return i})(s,t,l,r,a),x=er(u,r,a.minHandlerDistance);n(x)},[s,i,r,t,n,a]),h=l.useCallback(e=>{x(e.clientX)},[x]),p=l.useCallback(e=>{0!==e.touches.length&&(e.preventDefault(),x(e.touches[0].clientX))},[x]),f=l.useCallback(()=>{c(null)},[]),g=l.useCallback(()=>{c(null)},[]);return l.useEffect(()=>{if(s)return document.addEventListener("mousemove",h),document.addEventListener("mouseup",f),document.addEventListener("touchmove",p,{passive:!1}),document.addEventListener("touchend",g),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",f),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",g)}},[s,h,f,p,g]),{groupRef:o,handleMouseDown:d,handleTouchStart:u,isDragging:s}},cr=e=>{const{currentRange:t,dataLength:r,interactionConfig:a,onRangeChange:n}=e;return{handleKeyDown:l.useCallback(e=>i=>{const o=i.shiftKey?a.keyboardFastStep:a.keyboardStep;let s={...t};switch(i.key){case"ArrowLeft":case"ArrowDown":i.preventDefault(),s=((e,t,r,a)=>{const n={...t};if(e===or.START_HANDLER)n.start=Math.max(0,t.start-r);else if(e===or.END_HANDLER)n.end=Math.max(t.start+a.minHandlerDistance,t.end-r);else if(e===or.SELECTION_AREA){const e=t.end-t.start,a=Math.max(0,t.start-r);n.start=a,n.end=a+e}return n})(e,t,o,a);break;case"ArrowRight":case"ArrowUp":i.preventDefault(),s=((e,t,r,a,n)=>{const i={...t};if(e===or.START_HANDLER)i.start=Math.min(t.end-n.minHandlerDistance,t.start+r);else if(e===or.END_HANDLER)i.end=Math.min(a-1,t.end+r);else if(e===or.SELECTION_AREA){const e=t.end-t.start,n=Math.min(a-1-e,t.start+r);i.start=n,i.end=n+e}return i})(e,t,o,r,a);break;case"Home":i.preventDefault(),s=((e,t,r)=>{const a={...t};if(e===or.START_HANDLER)a.start=0;else if(e===or.END_HANDLER)a.end=r-1;else if(e===or.SELECTION_AREA){const e=t.end-t.start;a.start=0,a.end=e}return a})(e,t,r);break;case"End":i.preventDefault(),s=((e,t,r,a)=>{const n={...t};if(e===or.START_HANDLER)n.start=t.end-a.minHandlerDistance;else if(e===or.END_HANDLER)n.end=r-1;else if(e===or.SELECTION_AREA){const e=t.end-t.start;n.start=r-1-e,n.end=r-1}return n})(e,t,r,a);break;default:return}const c=er(s,r,a.minHandlerDistance);n(c)},[t,r,n,a])}},dr=()=>{const[e,t]=l.useState(null),r=l.useCallback(e=>()=>t(e),[]);return{handleBlur:l.useCallback(()=>{t(null)},[]),handleFocus:r,isFocused:l.useCallback(t=>e===t,[e])}},lr=(e,t)=>{const r=Math.floor(e);return Math.max(0,Math.min(t,r))},ur=(e,t)=>{const r=Math.ceil(e);return Math.max(0,Math.min(t,r))},xr=(e,t)=>{const r=Math.max(0,t-1);return{endIndex:ur(e.end,r),startIndex:lr(e.start,r)}},hr=({data:e,initialRange:t,onDataChange:r})=>{const a=t||tr(e.length),[n,i]=l.useState(a),o=t=>{if(!r||0===e.length)return;const{endIndex:a,startIndex:n}=xr(t,e.length),i=e.slice(n,a+1);r(i)};return l.useEffect(()=>{o(n)},[]),{currentRange:n,handleRangeChange:e=>{i(e),o(e)}}},pr=e=>({keyboardFastStep:e?.keyboardFastStep??2,keyboardStep:e?.keyboardStep??1,minHandlerDistance:e?.minHandlerDistance??1}),fr=e=>{if(0===e.length)return"";if(1===e.length)return`M ${e[0][0]} ${e[0][1]}`;const[t,...r]=e;let a=`M ${t[0]} ${t[1]}`;return r.forEach((e,n)=>{const i=0===n?t:r[n-1],[o,s]=i,[c,d]=e,l=.3*(c-o),u=[o+l,s],x=[c-l,d];a+=` C ${u[0]} ${u[1]}, ${x[0]} ${x[1]}, ${c} ${d}`}),a},gr=(e,t,r,a)=>{if(0===e.length||0===t.length)return[];const n=.05*a,i=a-2*n,o=t.flatMap(t=>e.map(e=>Number(e[t.yKey]))),s=Math.min(...o),c=Math.max(...o)-s||1;return t.map(t=>{const o=e.map((a,o)=>[o/Math.max(1,e.length-1)*r,n+i-(Number(a[t.yKey])-s)/c*i]),d=t.curved?fr(o):`M ${o.map(([e,t])=>`${e},${t}`).join(" L ")}`;let l="";return t.fill&&(l=t.curved?`${fr(o)} L ${r} ${a} L 0 ${a} Z`:`${d} L ${r},${a} L 0,${a} Z`),{config:t,fillPath:l,linePath:d}})},Rr=(e,t,r)=>e[r]?.[t]?.toString()||`${r}`,Ar=(e,t,r)=>{if(!e)return e;const a=new RegExp("{{startValue}}","g"),n=new RegExp("{{endValue}}","g");return e.replace(a,t).replace(n,r)};exports.Bar=ze,exports.BarChart=Rt,exports.BarOrientation=L,exports.ChartText=tt,exports.DefaultCanvasConfig=N,exports.ErrorType=O,exports.FOCUS_DEFAULT=Te,exports.FocusRing=ke,exports.ForeignObject=Ft,exports.HandlerIcon=Zt,exports.Line=et,exports.LineChart=jt,exports.LineRenderer=qt,exports.Node=We,exports.NodeType=Ve,exports.Path=Ye,exports.PieChart=zt,exports.Positions=H,exports.SelectionArea=ar,exports.SvgContainer=u,exports.Tick=rt,exports.TickDataUtils=It,exports.XAxis=it,exports.YAxis=dt,exports.ZoomArea=({ariaHidden:e,ariaLabel:t,backgroundColor:r,canvasConfig:a,caption:n,classNames:i,data:o,focusConfig:s,handlerConfig:c,height:x="40px",initialRange:h,interactionConfig:p,lines:f,onDataChange:g,role:R,screenReaderTextConfig:A,selectionConfig:E,width:_="100%",xKey:T,...y})=>{const v="zoom-area",m=pr(p),C=(S=E,{fill:S?.fill??"#0078d4",fillOpacity:S?.fillOpacity??.5,hideOverlayOnFullRange:S?.hideOverlayOnFullRange??true,stroke:S?.stroke??"#0078d4",strokeWidth:S?.strokeWidth??0});var S;const{currentRange:N,handleRangeChange:$}=hr({data:o,initialRange:h,onDataChange:g}),{parsedCanvas:b,viewBox:L}=I({canvasConfig:a,dataTestId:v,height:x,width:_}),O=k(o),H=JSON.stringify(f),w=l.useRef(null),P=((e,t,r,a)=>{const{endIndex:n,startIndex:i}=xr(r,e.length),o=Rr(e,t,i),s=Rr(e,t,n),c=Ar(a?.startHandler,o,s)??o;return{endHandler:Ar(a?.endHandler,o,s)??s,selectionArea:Ar(a?.selectionArea,o,s)??`${o} - ${s}`,startHandler:c}})(o,T,N,A),B=l.useMemo(()=>gr(o,f,b.width,b.height),[O,H,b.width,b.height]),{endX:M,startX:D}=l.useMemo(()=>Jt(N,o.length,b.width),[N,O,b.width]),{handleBlur:j,handleFocus:F,isFocused:V}=dr(),{handleKeyDown:X}=cr({currentRange:N,dataLength:o.length,interactionConfig:m,onRangeChange:$}),{groupRef:W,handleMouseDown:K,handleTouchStart:Y}=sr({currentRange:N,dataLength:o.length,interactionConfig:m,onRangeChange:$,width:b.width});return d.jsxs(u,{ref:W,ariaHidden:e,ariaLabel:t,backgroundColor:r,caption:n,className:i,"data-testid":v,height:x,overflow:"visible",role:R,viewBox:L,width:_,...y,children:[d.jsx(qt,{linesData:B}),d.jsx(ar,{ref:w,currentRange:N,dataLength:o.length,dataTestId:`${v}-selection-area`,endX:M,height:b.height,screenReaderText:P.selectionArea,selectionConfig:C,startX:D,onBlur:j,onFocus:F(or.SELECTION_AREA),onKeyDown:X(or.SELECTION_AREA),onMouseDown:K(or.SELECTION_AREA),onTouchStart:Y(or.SELECTION_AREA)}),d.jsx(ir,{dataTestId:`${v}-start-handler`,focusConfig:s,handlerConfig:c,height:b.height,isFocused:V(or.START_HANDLER),max:N.end-m.minHandlerDistance,min:0,screenReaderText:P.startHandler,type:or.START_HANDLER,value:N.start,x:D,onBlur:j,onFocus:F(or.START_HANDLER),onKeyDown:X(or.START_HANDLER),onMouseDown:K(or.START_HANDLER),onTouchStart:Y(or.START_HANDLER)}),d.jsx(ir,{dataTestId:`${v}-end-handler`,focusConfig:s,handlerConfig:c,height:b.height,isFocused:V(or.END_HANDLER),max:o.length-1,min:N.start+m.minHandlerDistance,screenReaderText:P.endHandler,type:or.END_HANDLER,value:N.end,x:M,onBlur:j,onFocus:F(or.END_HANDLER),onKeyDown:X(or.END_HANDLER),onMouseDown:K(or.END_HANDLER),onTouchStart:Y(or.END_HANDLER)}),d.jsx(ke,{dataTestId:"selection-area-focus",focusConfig:{...s,variant:"bounding-box"},isFocused:V(or.SELECTION_AREA),targetRef:w})]})},exports.ZoomAreaElements=or,exports.ZoomHandler=ir,exports.calculateHandlerPositions=Jt,exports.calculateLinesPathData=gr,exports.clampRange=er,exports.createDefaultRange=tr,exports.generateCurvedPath=fr,exports.getFocusConfig=ye,exports.getInteractionConfig=pr,exports.isFullRange=rr,exports.mouseToDataIndex=Qt,exports.normalizeToArray=e=>Array.isArray(e)?e:[e],exports.useDragInteraction=sr,exports.useKeyboardNavigation=cr,exports.useZoomAreaFocus=dr,exports.useZoomData=hr;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e,t,r,a,n={exports:{}},i={},o={exports:{}},s={};function c(){return t||(t=1,o.exports=function(){if(e)return s;e=1;var t=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),h=Symbol.iterator,p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},f=Object.assign,g={};function R(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}function A(){}function E(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}R.prototype.isReactComponent={},R.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},R.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},A.prototype=R.prototype;var T=E.prototype=new A;T.constructor=E,f(T,R.prototype),T.isPureReactComponent=!0;var _=Array.isArray,y=Object.prototype.hasOwnProperty,v={current:null},C={key:!0,ref:!0,__self:!0,__source:!0};function m(e,r,a){var n,i={},o=null,s=null;if(null!=r)for(n in void 0!==r.ref&&(s=r.ref),void 0!==r.key&&(o=""+r.key),r)y.call(r,n)&&!C.hasOwnProperty(n)&&(i[n]=r[n]);var c=arguments.length-2;if(1===c)i.children=a;else if(1<c){for(var d=Array(c),l=0;l<c;l++)d[l]=arguments[l+2];i.children=d}if(e&&e.defaultProps)for(n in c=e.defaultProps)void 0===i[n]&&(i[n]=c[n]);return{$$typeof:t,type:e,key:o,ref:s,props:i,_owner:v.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var I=/\/+/g;function $(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function N(e,a,n,i,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case t:case r:c=!0}}if(c)return o=o(c=e),e=""===i?"."+$(c,0):i,_(o)?(n="",null!=e&&(n=e.replace(I,"$&/")+"/"),N(o,a,n,"",function(e){return e})):null!=o&&(S(o)&&(o=function(e,r){return{$$typeof:t,type:e.type,key:r,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(I,"$&/")+"/")+e)),a.push(o)),1;if(c=0,i=""===i?".":i+":",_(e))for(var d=0;d<e.length;d++){var l=i+$(s=e[d],d);c+=N(s,a,n,l,o)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=h&&e[h]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),d=0;!(s=e.next()).done;)c+=N(s=s.value,a,n,l=i+$(s,d++),o);else if("object"===s)throw a=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===a?"object with keys {"+Object.keys(e).join(", ")+"}":a)+"). If you meant to render a collection of children, use an array instead.");return c}function b(e,t,r){if(null==e)return e;var a=[],n=0;return N(e,a,"","",function(e){return t.call(r,e,n++)}),a}function k(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var O={current:null},L={transition:null},H={ReactCurrentDispatcher:O,ReactCurrentBatchConfig:L,ReactCurrentOwner:v};function w(){throw Error("act(...) is not supported in production builds of React.")}return s.Children={map:b,forEach:function(e,t,r){b(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return b(e,function(){t++}),t},toArray:function(e){return b(e,function(e){return e})||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},s.Component=R,s.Fragment=a,s.Profiler=i,s.PureComponent=E,s.StrictMode=n,s.Suspense=l,s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,s.act=w,s.cloneElement=function(e,r,a){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=f({},e.props),i=e.key,o=e.ref,s=e._owner;if(null!=r){if(void 0!==r.ref&&(o=r.ref,s=v.current),void 0!==r.key&&(i=""+r.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(d in r)y.call(r,d)&&!C.hasOwnProperty(d)&&(n[d]=void 0===r[d]&&void 0!==c?c[d]:r[d])}var d=arguments.length-2;if(1===d)n.children=a;else if(1<d){c=Array(d);for(var l=0;l<d;l++)c[l]=arguments[l+2];n.children=c}return{$$typeof:t,type:e.type,key:i,ref:o,props:n,_owner:s}},s.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},s.createElement=m,s.createFactory=function(e){var t=m.bind(null,e);return t.type=e,t},s.createRef=function(){return{current:null}},s.forwardRef=function(e){return{$$typeof:d,render:e}},s.isValidElement=S,s.lazy=function(e){return{$$typeof:x,_payload:{_status:-1,_result:e},_init:k}},s.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},s.startTransition=function(e){var t=L.transition;L.transition={};try{e()}finally{L.transition=t}},s.unstable_act=w,s.useCallback=function(e,t){return O.current.useCallback(e,t)},s.useContext=function(e){return O.current.useContext(e)},s.useDebugValue=function(){},s.useDeferredValue=function(e){return O.current.useDeferredValue(e)},s.useEffect=function(e,t){return O.current.useEffect(e,t)},s.useId=function(){return O.current.useId()},s.useImperativeHandle=function(e,t,r){return O.current.useImperativeHandle(e,t,r)},s.useInsertionEffect=function(e,t){return O.current.useInsertionEffect(e,t)},s.useLayoutEffect=function(e,t){return O.current.useLayoutEffect(e,t)},s.useMemo=function(e,t){return O.current.useMemo(e,t)},s.useReducer=function(e,t,r){return O.current.useReducer(e,t,r)},s.useRef=function(e){return O.current.useRef(e)},s.useState=function(e){return O.current.useState(e)},s.useSyncExternalStore=function(e,t,r){return O.current.useSyncExternalStore(e,t,r)},s.useTransition=function(){return O.current.useTransition()},s.version="18.3.1",s}()),o.exports}var d=(a||(a=1,n.exports=function(){if(r)return i;r=1;var e=c(),t=Symbol.for("react.element"),a=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(e,r,a){var i,c={},d=null,l=null;for(i in void 0!==a&&(d=""+a),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(l=r.ref),r)n.call(r,i)&&!s.hasOwnProperty(i)&&(c[i]=r[i]);if(e&&e.defaultProps)for(i in r=e.defaultProps)void 0===c[i]&&(c[i]=r[i]);return{$$typeof:t,type:e,key:d,ref:l,props:c,_owner:o.current}}return i.Fragment=a,i.jsx=d,i.jsxs=d,i}()),n.exports),l=c();const u=l.forwardRef(({ariaHidden:e,ariaLabel:t,backgroundColor:r,caption:a,children:n,className:i,dataTestId:o,height:s,imageSrc:c,overflow:l,radius:u="0px",role:x,tabIndex:h,viewBox:p,width:f,...g},R)=>d.jsxs("svg",{ref:R,"aria-hidden":e,"aria-label":t,className:i,"data-testid":o,height:s,role:x,style:{backgroundColor:r,borderRadius:u,overflow:l},tabIndex:h,viewBox:p,width:f,onMouseDown:e=>e.preventDefault(),...g,children:[a&&d.jsx("title",{children:a}),c&&d.jsx("image",{height:s,href:c,width:f,x:"0",y:"0"}),n]})),x={},h=e=>{const[t]=l.useState(()=>(e=>(x[e]||(x[e]=0),x[e]++))(e||"$component$"));return`${e}${t}`},p=()=>"undefined"!=typeof window&&"undefined"!=typeof document,f=()=>p()?document:void 0,g=e=>{const t=f();if(t)return t.createElementNS("http://www.w3.org/2000/svg",e)},R="%",A="rem",E={[R]:R,[A]:A},T="WIDTH",_=/^(\d+(\.\d+)?)(px|rem|%)?$/,y=e=>{if("number"==typeof e)return{unit:void 0,value:e};const t=e.match(_);if(!t)throw new Error(`Invalid string format: "${e}"`);const r=parseFloat(t[1]),a=t[3];return{unit:E[a],value:r}},v=(e,t,r)=>{const a=r.parentElement;return a?e/100*(t===T?a.clientWidth:a.clientHeight):0},C=e=>{const t=f();if(!t)return 16*e;const r=(e=>{const t=p()?window:void 0;if(t)return t.getComputedStyle(e)})(t.documentElement);return r?e*(parseFloat(r.fontSize)||16):16*e},m=/^(\d+(\.\d+)?)(px|rem|%)?$/,S=e=>{if("number"==typeof e)return e;const t=e.match(m);if(!t)throw new Error(`Invalid string format: "${e}"`);const r=t[1];return t[3]===A?16*parseFloat(r):parseFloat(r)},I=({canvasConfig:e,dataTestId:t,extraSpace:r=0,height:a,width:n})=>{const[i,o]=l.useState({height:0,width:0}),s=l.useMemo(()=>e||{extraSpace:r,height:a,width:n},[e,n,a,r]),{extraSpace:c,height:d,width:u}=s,x=c?S(c):void 0;l.useEffect(()=>{if(!p())return;const e=(e=>{const t=f();return t?t.querySelector(e):null})(`[data-testid="${t}"]`);if(!e)return;const r=()=>{const{parsedCanvasHeight:t,parsedCanvasWidth:r}=(({canvasHeight:e,canvasWidth:t,svgElement:r})=>{const{unit:a,value:n}=y(t),i=a===R?v(n,T,r):a===A?C(n):n,{unit:o,value:s}=y(e);return{parsedCanvasHeight:o===R?v(s,"HEIGHT",r):o===A?C(s):s,parsedCanvasWidth:i}})({canvasHeight:d,canvasWidth:u,svgElement:e});o({height:t,width:r})};r();const a=new ResizeObserver(()=>{r()});return a.observe(e),()=>{a.disconnect()}},[u,d,t]);const h=l.useMemo(()=>{const e=((e,t,r=0)=>`${-r} ${-r} ${e} ${t}`)(i.width,i.height,x);return e},[i.width,i.height,x]);return{parsedCanvas:i,parsedCanvasExtraSpace:x,viewBox:h}},$={extraSpace:0,height:80,width:100},N=e=>{const t=new Map,r=()=>{const e={};return t.forEach((t,r)=>{e[r]=t}),e};return{addError:(a,n)=>{if(!n)return;const i={...n,type:a},o=t.get(a)||[];if(o.push(i),t.set(a,o),e){const t=r(),a={};Object.entries(t).forEach(([e,t])=>{const r=e;Array.isArray(t)&&t.length,a[r]=t}),e(a)}},clearErrors:()=>{t.clear(),e&&e({})},getAccumulatedErrors:r}},b=e=>JSON.stringify(e),k=l.createContext({}),O={HORIZONTAL:"HORIZONTAL",VERTICAL:"VERTICAL"},L={BAR_CHART_CONTEXT_ERROR:"BAR_CHART_CONTEXT_ERROR",BAR_CHART_PATH_ERROR:"BAR_CHART_PATH_ERROR",BAR_CHART_SEPARATOR_ERROR:"BAR_CHART_SEPARATOR_ERROR",BAR_CHART_X_AXIS_ERROR:"BAR_CHART_X_AXIS_ERROR",BAR_CHART_Y_AXIS_ERROR:"BAR_CHART_Y_AXIS_ERROR",CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR:"CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR",CUSTOM_BACKGROUND_CHART_PLOT_ERROR:"CUSTOM_BACKGROUND_CHART_PLOT_ERROR",GENERIC:"GENERIC",LINE_CHART_CONTEXT_ERROR:"LINE_CHART_CONTEXT_ERROR",LINE_CHART_PATH_ERROR:"LINE_CHART_PATH_ERROR",LINE_CHART_PROJECTION_ERROR:"LINE_CHART_PROJECTION_ERROR",LINE_CHART_SEPARATOR_ERROR:"LINE_CHART_SEPARATOR_ERROR",LINE_CHART_X_AXIS_ERROR:"LINE_CHART_X_AXIS_ERROR",LINE_CHART_Y_AXIS_ERROR:"LINE_CHART_Y_AXIS_ERROR",PIE_CHART_CONTEXT_ERROR:"PIE_CHART_CONTEXT_ERROR",PIE_CHART_PATH_ERROR:"PIE_CHART_PATH_ERROR",PIE_CHART_SEGMENT_ERROR:"PIE_CHART_SEGMENT_ERROR"},H={BOTTOM:"BOTTOM",CENTER:"CENTER",CUSTOM:"CUSTOM",LEFT:"LEFT",RIGHT:"RIGHT",TOP:"TOP"},w=Object.entries({BAR_CHART_AXIS_INSUFFICIENT_TICKS:"Axis requires at least two ticks for proper bar scaling",BAR_CHART_AXIS_INVALID_SCALE:"Invalid axis scale for current bar values",BAR_CHART_DISTRIBUTION_INSUFFICIENT_SPACE:"Insufficient space for bar distribution with current configuration",BAR_CHART_DISTRIBUTION_INVALID_GAP:"Invalid gap between bars - must be >= 0 and allow bar rendering",BAR_CHART_DISTRIBUTION_OVERLAP:"Bar distribution results in overlapping bars",BAR_CHART_EMPTY_DATA:"No valid data entries found for bar chart rendering",BAR_CHART_INSUFFICIENT_SPACE_HEIGHT:"Insufficient height to render bars. Consider reducing bar count or increasing chart height",BAR_CHART_INSUFFICIENT_SPACE_WIDTH:"Insufficient width to render bars. Consider reducing bar width or increasing chart width",BAR_CHART_INVALID_VALUE:"Bar value must be a valid number for rendering",BAR_CHART_NEGATIVE_VALUE:"Negative values are not supported in this bar configuration",BAR_CHART_NO_DATA:"Data validation failed: no data provided for bar chart rendering",BAR_CHART_OVERLAP:"Bars are overlapping due to insufficient spacing",BAR_CHART_SEPARATOR_X_OUT_OF_RANGE:"Separator X position is outside valid bar range",BAR_CHART_SEPARATOR_Y_OUT_OF_RANGE:"Separator Y position is outside valid bar range",BAR_CHART_STACK_INVALID:"Invalid stacking configuration - all bars in stack must have consistent configuration",BAR_CHART_STACK_MISSING_VALUES:"Stack is incomplete - all bars in stack must have valid values"}).reduce((e,[t,r])=>(e[t]=new Error(r),e),{}),M=Object.entries({LINE_CHART_INVALID_CANVAS:"Canvas dimensions validation failed: both width and height must be > 0",LINE_CHART_NO_DATA:"Data validation failed: no data provided for chart rendering",LINE_CHART_PATH_ALL_VALUES_NULL:"Path data cannot be generated - all Y values are null or undefined",LINE_CHART_PATH_INSUFFICIENT_POINTS:"Unable to calculate curved path with insufficient points (minimum 2 required)",LINE_CHART_PATH_INVALID_DATAKEY:"DataKey must be a valid string",LINE_CHART_PROJECTION_INVALID_BOUNDS:"Invalid projection bounds - upper projection must be below lower projection",LINE_CHART_PROJECTION_LOWER_X_OUT_OF_RANGE:"Lower projection X coordinate is outside valid range (0-100)",LINE_CHART_PROJECTION_LOWER_Y_OUT_OF_RANGE:"Lower projection Y coordinate is outside chart area",LINE_CHART_PROJECTION_UPPER_X_OUT_OF_RANGE:"Upper projection X coordinate is outside valid range (0-100)",LINE_CHART_PROJECTION_UPPER_Y_OUT_OF_RANGE:"Upper projection Y coordinate is outside chart area",LINE_CHART_SEPARATOR_INVALID_COORDINATES:"Invalid separator position - coordinates overlap, cannot render separator",LINE_CHART_SEPARATOR_INVALID_X_BREAK_AXIS:"Invalid xBreakAxis value: cannot be parsed as number",LINE_CHART_SEPARATOR_INVALID_Y_BREAK_AXIS:"Invalid yBreakAxis value: cannot be parsed as number",LINE_CHART_SEPARATOR_X_OUT_OF_RANGE:"xBreakAxis value is outside data range",LINE_CHART_SEPARATOR_Y_OUT_OF_RANGE:"yBreakAxis value is outside data range",LINE_CHART_SINGLE_POINT:"Data validation failed: single data point provided, minimum 2 required for line chart",LINE_CHART_X_AXIS_IDENTICAL_VALUES:"X-axis range validation failed: minimum and maximum values are identical, cannot render chart line",LINE_CHART_X_AXIS_INSUFFICIENT_TICKS:"X-axis tick calculation: insufficient data points (1/2 minimum required)",LINE_CHART_X_AXIS_ZERO_LENGTH:"X-axis geometry validation failed: start and end X coordinates are identical (x1=x2), axis has zero length",LINE_CHART_Y_AXIS_IDENTICAL_VALUES:"Y-axis range validation failed: minimum and maximum values are identical, cannot render chart line",LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS:"Y-axis tick calculation: insufficient data points (1/2 minimum required)",LINE_CHART_Y_AXIS_ZERO_LENGTH:"Y-axis geometry validation failed: start and end Y coordinates are identical (y1=y2), axis has zero length"}).reduce((e,[t,r])=>(e[t]=new Error(r),e),{}),B=Object.entries({PIE_CHART_EMPTY_DATA:"PieChart data is empty or undefined",PIE_CHART_INNER_RADIUS_OUT_OF_RANGE:"Inner radius must be less than radius",PIE_CHART_INVALID_CANVAS_DIMENSIONS:"Invalid canvas dimensions for PieChart",PIE_CHART_INVALID_DATA_KEY:"Invalid or missing dataKey in PieChart data",PIE_CHART_INVALID_INNER_RADIUS:"Invalid innerRadius value",PIE_CHART_INVALID_RADIUS:"Invalid radius value",PIE_CHART_INVALID_SEGMENT_VALUE:"Invalid segment value (non-numeric)",PIE_CHART_INVALID_TOTAL:"PieChart total value is zero or invalid",PIE_CHART_MISSING_SEGMENT_NAME:"Segment is missing required name property",PIE_CHART_NEGATIVE_SEGMENT_VALUE:"Segment value cannot be negative"}).reduce((e,[t,r])=>(e[t]=new Error(r),e),{}),P=(e,t)=>new Error(`Invalid value "${e}" for bar with dataKey "${t}". Must be a valid number.`),D=(e,t)=>new Error(`Negative value ${e} not allowed for bar with dataKey "${t}" in current configuration`),j=(e,t)=>new Error(`Invalid segment value for "${t}": "${e}" is not a valid number`),F=(e,t)=>new Error(`Negative segment value for "${t}": ${e} (values must be >= 0)`),X=e=>new Error(`DataKey "${e}" not found in PieChart dataset`),V=e=>new Error(`Data array for key "${e}" is empty`),W=(e,t)=>new Error(`Invalid total value for "${e}": ${t} (must be > 0)`),K=(e,t,r)=>new Error(`Invalid group at index ${t} in "${e}": missing required property "${r}"`),U=e=>new Error(`Invalid radius value: "${e}" (must be a positive number)`),Y=e=>new Error(`Invalid innerRadius value: "${e}" (must be a positive number or zero)`),G=(e,t)=>new Error(`innerRadius (${e}) must be less than radius (${t}) for donut chart rendering`),z="INVALID_X_TICK",Z="BAR_CHART_NO_DATA",q="LINE_CHART_NO_DATA",J="LINE_CHART_PATH_ALL_VALUES_NULL",Q="LINE_CHART_PATH_INSUFFICIENT_POINTS",ee="LINE_CHART_PATH_INVALID_DATAKEY",te="LINE_CHART_SEPARATOR_INVALID_COORDINATES",re="LINE_CHART_SINGLE_POINT",ae="LINE_CHART_X_AXIS_IDENTICAL_VALUES",ne="LINE_CHART_X_AXIS_INSUFFICIENT_TICKS",ie="LINE_CHART_X_AXIS_ZERO_LENGTH",oe="LINE_CHART_Y_AXIS_IDENTICAL_VALUES",se="LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS",ce="LINE_CHART_Y_AXIS_ZERO_LENGTH",de={...w,...M,...B,INVALID_X_TICK:new Error("[getXTicks] Invalid X tick values calculated")},le=e=>de[e],ue=e=>new Error(`DataKey "${e}" not found in dataset`),xe=(e,t)=>new Error(`Canvas dimensions validation failed: width=${e}, height=${t} (both must be > 0)`),he=e=>new Error(`Invalid xBreakAxis value: '${e}' cannot be parsed as number`),pe=e=>new Error(`Invalid yBreakAxis value: '${e}' cannot be parsed as number`),fe=(e,t,r)=>new Error(`xBreakAxis value ${e} is outside data range (${t} - ${r})`),ge=(e,t,r)=>new Error(`yBreakAxis value ${e} is outside data range (${t} - ${r})`),Re=(e,t,r)=>t.map(t=>{if(isNaN(Number(t))){const r=e.find(e=>String(e.value)===String(t));return r?r.position:0}const{index:a,tick:n}=e.reduce((e,r,a)=>Math.abs(Number(r.value)-Number(t))<=Math.abs(Number(e.tick.value)-Number(t))?{index:a,tick:r}:e,{index:0,tick:e[0]}),i=Number(t),o=Number(n.value);if(i!==o){const t=e.map(e=>Number(e.value)),s=Math.min(...t),c=Math.max(...t);if(i<s)return e.at(0)?.position;if(i>c)return e.at(-1)?.position;const d=Math.abs(o-i),l=i>o,u=l?e[a+1]:e[a-1],x=100*d/Math.abs(Number(u.value)-o),h=Math.abs(n.position-u.position)*x/100;return r?l?n.position+h:n.position-h:l?n.position-h:n.position+h}return n.position}),Ae="0",Ee="1",Te="fallbackData",_e={FOCUS_COLOR:"#0078D4",FOCUS_INNER:"#ffffff",INNER_FOCUS_STROKE_WIDTH:2,OUTER_FOCUS_STROKE_WIDTH:2,OUTLINES_GAP:0,VARIANT:"adaptive"},ye=e=>({gap:e?.gap??_e.OUTLINES_GAP,innerColor:e?.innerColor??_e.FOCUS_INNER,innerStrokeWidth:e?.innerStrokeWidth??_e.INNER_FOCUS_STROKE_WIDTH,outlineColor:e?.outlineColor??_e.FOCUS_COLOR,outlineStrokeWidth:e?.outlineStrokeWidth??_e.OUTER_FOCUS_STROKE_WIDTH,variant:e?.variant??_e.VARIANT}),ve=["cx","cy","r","x","y","width","height","rx","ry","d","points","x1","y1","x2","y2"],Ce=["stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity"],me=["circle","rect","ellipse","path","polygon","polyline","line"];function Se({elementRef:e,focusConfig:t,isFocused:r}){const a=l.useMemo(()=>ye(t),[t]),[n,i]=l.useState(void 0);return l.useEffect(()=>{if(!e?.current||!r)return void i(void 0);const t=e.current,n=()=>{if("adaptive"===a.variant){const e=function(e,t){const r=e.tagName.toLowerCase();if(!me.includes(r))return;const a=e.getAttribute("stroke-width")||e.getAttribute("strokeWidth"),n=parseFloat(a||"0"),i=e.getAttribute("fill"),o="line"===r||"polyline"===r||"path"===r&&"none"===i,s=n+2*(t.outlineStrokeWidth+t.innerStrokeWidth),c=n+2*t.innerStrokeWidth,d=o?e.getAttribute("stroke-linecap")||"round":void 0,l=o?e.getAttribute("stroke-linejoin")||"round":"miter",u=o?void 0:"10",x=function(e){const t={},r=new Set([...ve,...Ce]);for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];r.has(n.name)&&(t[n.name]=n.value)}return t}(e);return{innerRing:{props:{...x,className:"focus-ring-inner",fill:"none",stroke:t.innerColor,strokeLinecap:d,strokeLinejoin:l,strokeMiterlimit:u,strokeWidth:c},type:r},outerRing:{props:{...x,className:"focus-ring-outer",fill:"none",stroke:t.outlineColor,strokeLinecap:d,strokeLinejoin:l,strokeMiterlimit:u,strokeWidth:s},type:r}}}(t,a);i(e)}if("bounding-box"===a.variant){const e=function(e,t){const r=function(e){try{const t=e.getBBox();if(t.width<=0||t.height<=0)return null;const r=window.getComputedStyle(e),a=parseFloat(r.strokeWidth||"0");return{elementHeight:t.height,elementPosition:{x:t.x+t.width/2,y:t.y+t.height/2},elementStrokeWidth:a,elementWidth:t.width}}catch{return null}}(e);if(!r)return;const a=((e,t)=>{const{elementHeight:r,elementPosition:a,elementStrokeWidth:n,elementWidth:i}=e,{gap:o,innerStrokeWidth:s,outlineStrokeWidth:c}=t,d=i+n+s+2*o,l=r+n+s+2*o,u=d+s+c,x=l+s+c;return{inner:{height:l,width:d,x:a.x-d/2,y:a.y-l/2},outer:{height:x,width:u,x:a.x-u/2,y:a.y-x/2}}})(r,{gap:t.gap,innerStrokeWidth:t.innerStrokeWidth,outlineStrokeWidth:t.outlineStrokeWidth});return{innerRing:{props:{className:"focus-ring-inner",fill:"none",height:a.inner.height,stroke:t.innerColor,strokeWidth:t.innerStrokeWidth,width:a.inner.width,x:a.inner.x,y:a.inner.y},type:"rect"},outerRing:{props:{className:"focus-ring-outer",fill:"none",height:a.outer.height,stroke:t.outlineColor,strokeWidth:t.outlineStrokeWidth,width:a.outer.width,x:a.outer.x,y:a.outer.y},type:"rect"}}}(t,a);i(e)}};n();const o=new MutationObserver(e=>{e.some(e=>"attributes"===e.type&&ve.includes(e.attributeName??""))&&n()});return o.observe(t,{attributeFilter:[...ve],attributes:!0}),()=>o.disconnect()},[r,a]),{layers:n,resolvedConfig:a}}const Ie=({dataTestId:e,layers:t})=>t?d.jsxs("g",{className:"focus-ring-container",pointerEvents:"none",children:[l.createElement(t.outerRing.type,{...t.outerRing.props,"data-testid":`${e}-focus-outer`}),l.createElement(t.innerRing.type,{...t.innerRing.props,"data-testid":`${e}-focus-inner`})]}):null,$e=({children:e,dataTestId:t="focus-ring",disabled:r=!1,focusConfig:a,isFocused:n})=>{const i=l.useRef(null),{layers:o}=Se({elementRef:i,focusConfig:a,isFocused:n}),s=function(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}(i,e.ref),c=l.cloneElement(e,{ref:s});return d.jsxs(d.Fragment,{children:[n&&!r&&d.jsx(Ie,{dataTestId:t,layers:o??void 0}),c]})},Ne=({dataTestId:e="focus-ring",disabled:t=!1,focusConfig:r,isFocused:a,targetRef:n})=>{const{layers:i}=Se({elementRef:n,focusConfig:r,isFocused:a});return!a||t?null:d.jsx(Ie,{dataTestId:e,layers:i})},be=({children:e,dataTestId:t="focus-ring",disabled:r=!1,focusConfig:a,isFocused:n,targetRef:i})=>e?d.jsx($e,{dataTestId:t,disabled:r,focusConfig:a,isFocused:n,children:e}):i?d.jsx(Ne,{dataTestId:t,disabled:r,focusConfig:a,isFocused:n,targetRef:i}):null,ke=(e,t)=>{const[r,a]=l.useState(!1),n=l.useCallback(t=>{a(!0),e?.(t)},[e]);return{handleBlur:l.useCallback(e=>{a(!1),t?.(e)},[t]),handleFocus:n,isFocused:r}},Oe=(e,t)=>{const[r,a]=l.useState(!1);return{handleMouseEnter:l.useCallback(t=>{a(!0),e?.(t)},[e]),handleMouseLeave:l.useCallback(e=>{a(!1),t?.(e)},[t]),isHovered:r}};(()=>{if("undefined"!=typeof globalThis&&"process"in globalThis){const e=globalThis.process;return"production"===e?.env?.NODE_ENV}})();const Le=e=>e?Object.entries(e).reduce((e,[t,r])=>((t.startsWith("aria-")||t.startsWith("data-")||"role"===t)&&null!=r&&(e[t]=String(r)),e),{}):{},He=({height:e="140%",width:t="140%",x:r="-20%",y:a="-20%",...n})=>d.jsx("defs",{children:d.jsx("filter",{height:e,id:n.id,width:t,x:r,y:a,children:d.jsx("feDropShadow",{...n.shadowSvgConfig})})}),we=-1/0,Me=l.forwardRef(({dataTestId:e,position:t,size:r=1,...a},n)=>d.jsx("circle",{...a,ref:n,cx:t?.x,cy:t?.y,"data-testid":`${e}-circle`,r:r/2})),Be=(e,t,r,a,n)=>{let i="";const o=a===n,s=o?r:2*r;for(let r=0;r<s;r++){const c=o||r%2==0?a:n,d=2*Math.PI/s*r-Math.PI/2;i+=`${e+Math.cos(d)*c},${t+Math.sin(d)*c} `}return i.trim()},Pe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=Be(t.x,t.y,6,r/2,r/2);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-hexagon`,points:i})}),De=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=Be(t.x,t.y,5,r/2,r/2);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-pentagon`,points:i})}),je=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>d.jsx("rect",{...a,ref:n,"data-testid":`${e}-square`,height:r,width:r,x:t.x-r/2,y:t.y-r/2})),Fe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=r/2,o=i/2,s=Be(t.x,t.y,5,i,o);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-star`,points:s})}),Xe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=`M ${t.x-r/2} ${t.y} H ${t.x+r/2} M ${t.x} ${t.y-r/2} V ${t.y+r/2}`;return d.jsx("path",{...a,ref:n,d:i,"data-testid":`${e}-straight`,strokeWidth:2})}),Ve=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=[`${t.x},${t.y-r/2}`,`${t.x-r/2},${t.y+r/2}`,`${t.x+r/2},${t.y+r/2}`].join(" ");return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-triangle`,points:i})}),We={Circle:"circle",Hexagon:"hexagon",Pentagon:"pentagon",Square:"square",Star:"star",Straight:"straight",Triangle:"triangle"},Ke={[We.Circle]:Me,[We.Hexagon]:Pe,[We.Pentagon]:De,[We.Square]:je,[We.Star]:Fe,[We.Straight]:Xe,[We.Triangle]:Ve},Ue=l.forwardRef(({dataTestId:e="node",haloConfig:t,hasHalo:r=!1,onBlur:a,onClick:n,onDoubleClick:i,onFocus:o,onKeyDown:s,onMouseEnter:c,onMouseLeave:u,position:x={x:0,y:0},size:h=1,type:p=We.Circle,...f},g)=>{const[R,A]=(e=>{const t=l.useRef(!1),r=l.useRef(null);l.useImperativeHandle(e,()=>r.current,[]);const a=e=>{t.current=!!e.autoClick};return l.useEffect(()=>{if(!r.current)return;const e=r.current;return e.addEventListener("click",a),()=>e.removeEventListener("click",a)},[]),[r,t]})(g),E={...f,className:`node ${f.className}`,onBlur:e=>{a?.(e)},onClick:e=>{n?.(e,{...f.data,nodePosition:x},A.current)},onDoubleClick:e=>{i?.(e,f.data)},onFocus:e=>{o?.(e,f.data)},onKeyDown:e=>{"Enter"===e.key&&s?.(e,f.data)},onMouseEnter:e=>{c?.(e,f.data)},onMouseLeave:e=>{u?.(e)}},T={className:f.className,fill:t?.fill||f.fill,fillOpacity:t?.fillOpacity||.25,opacity:t?.opacity||.3,stroke:t?.stroke||f.stroke,strokeWidth:t?.strokeWidth||f.strokeWidth},_=Ke[p];return d.jsxs(d.Fragment,{children:[r&&d.jsx(_,{...T,"aria-hidden":"true",dataTestId:`${e}-halo`,position:x,size:h+h/2}),d.jsx(_,{...E,ref:R,dataTestId:e,position:x,size:h})]})}),Ye=l.forwardRef(({data:e,nodeConfig:t,tabIndex:r=0,x:a,y:n},i)=>{const o=t?Le(t):{};if(o["aria-label"]&&e&&"string"==typeof o["aria-label"]){const t=o["aria-label"];if(t.includes("{{")){const r=((e,t,r)=>{if(!e)return;const a=r??t.dataValue,n=Array.isArray(a)?a[t.index]:void 0,{xValue:i,yValue:o}=((e,t)=>({xValue:e&&t.xKey?e[t.xKey]?.toString()??"":"",yValue:e&&t.dataKey?e[t.dataKey]?.toString()??"":""}))(n,t);return((e,t,r,a)=>{let n=e;return void 0!==t.dataKey&&(n=n.replace(new RegExp("{{dataKey}}","g"),t.dataKey)),n=n.replace(new RegExp("{{xValue}}","g"),r),n=n.replace(new RegExp("{{yValue}}","g"),a),void 0!==t.index&&(n=n.replace(new RegExp("{{index}}","g"),(t.index+1).toString())),n})(e,t,i,o)})(t,{dataKey:e.dataKey,dataValue:e.dataValue,index:e.index??0,xKey:e.xKey},e.dataValue);r&&(o["aria-label"]=r)}}return d.jsx(d.Fragment,{children:t&&d.jsx(Ue,{...t,ref:i,...o,className:"node-path-focus-border",data:e,hasHalo:t.hasHalo,position:{x:a,y:n},tabIndex:r})})}),Ge=l.forwardRef(({classNames:e="",fill:t="transparent",stroke:r="#0000FF",strokeWidth:a="1",focusConfig:n,hoverConfig:i={stroke:"#0000FF",strokeWidth:"0.5"},role:o="img",tabIndex:s=0,...c},u)=>{const{handleBlur:x,handleFocus:h,isFocused:p}=ke(c.onFocus,c.onBlur),f=(e=>{if(!e)return;const t=e.strokeWidth?Number(e.strokeWidth):void 0;return{innerStrokeWidth:t,outlineColor:e.stroke,outlineStrokeWidth:t}})(n),{handleMouseEnter:g,handleMouseLeave:R,isHovered:A}=Oe(c.onMouseEnter,c.onMouseLeave),E=l.useRef(null),T=l.useRef([]),_=l.useRef(null);l.useImperativeHandle(u,()=>({get main(){return _.current},get node(){return T.current},get path(){return E.current}}));const y=c.gradient&&((e,t="gradientePath")=>{const r=e.split(",").map(e=>e.trim()),a=parseInt(r[0],10),n=r.slice(1).map(e=>{const[t,r]=e.split(" ");return{color:t,offset:r}});let i="0%",o="0%",s="0%";switch(a){case 180:s="100%";break;case 90:o="100%";break;case 270:i="100%";break;default:return d.jsx(d.Fragment,{})}return d.jsx("defs",{children:d.jsx("linearGradient",{id:t,x1:i,x2:o,y1:"0%",y2:s,children:n.map((e,t)=>d.jsx("stop",{offset:e.offset,stopColor:e.color},`${t}-${e.offset}`.toString()))})})})(c.gradient),v=Le(c),C={...{...c,classNames:`path ${e}`,fill:y?"url(#gradientePath)":t,filter:"url(#shadow)",role:o,stroke:r,strokeWidth:a,tabIndex:s},...A&&i};return d.jsxs("g",{ref:_,children:[y&&y,C.shadowSvgConfig&&d.jsx(He,{id:"shadow",shadowSvgConfig:C.shadowSvgConfig}),d.jsx(be,{dataTestId:`${C.dataTestId}-focus-ring`,focusConfig:f,isFocused:p,targetRef:E}),d.jsxs("g",{"aria-label":C.ariaLabel,className:C.classNames,"data-draw":!0,filter:C.shadowSvgConfig&&C.filter,opacity:C.opacity,orientation:C.orientation,role:C.role,rotate:C.rotate,tabIndex:C.tabIndex,transform:C.transform,visibility:C.visibility,...v,onBlur:x,onClick:()=>{c.onClick?.(c.dataValue)},onDoubleClick:e=>{c.onDoubleClick?.(e,c.dataValue)},onFocus:h,onKeyDown:e=>{"Enter"===e.key&&c.onKeyDown?.(c.dataValue)},onMouseDown:e=>{e.preventDefault()},onMouseEnter:g,onMouseLeave:R,children:[d.jsx("path",{ref:E,d:C.d,"data-testid":C.dataTestId,fill:C.dFill?"transparent":C.fill,fillOpacity:C.fillOpacity,fillRule:C.fillRule,stroke:C.stroke,strokeDasharray:C.strokeDasharray,strokeDashoffset:C.strokeDashoffset,strokeLinecap:C.strokeLinecap,strokeLinejoin:C.strokeLinejoin,strokeMiterlimit:C.strokeMiterlimit,strokeOpacity:C.strokeOpacity,strokeWidth:C.strokeWidth,children:C.title&&d.jsx("title",{children:C.title})}),C.dFill&&d.jsx("path",{d:C.dFill,fill:C.fill,fillOpacity:C.fillOpacity,fillRule:C.fillRule})]}),C.points&&C.nodeConfig&&C.points.map(([e,t],r)=>{const a={dataKey:C.dataKey,dataValue:C.dataValue,index:r,xKey:C?.xKey};return d.jsx(Ye,{ref:e=>T.current[r]=e,data:a,nodeConfig:C.nodeConfig,tabIndex:-1,x:e,y:t},`${r.toString()}`)})]})}),ze=({ariaLabel:e,dataKey:t,xKey:r,yKey:a,xData:n,yData:i,coverage:o,index:s})=>{if(!e)return;const c=new RegExp("{{dataKey}}","g"),d=new RegExp("{{xKey}}","g"),l=new RegExp("{{yKey}}","g"),u=new RegExp("{{xData}}","g"),x=new RegExp("{{yData}}","g"),h=new RegExp("{{coverage}}","g"),p=new RegExp("{{index}}","g");return e.replace(c,t??"").replace(d,r??"").replace(l,a??"").replace(u,String(n??"")).replace(x,String(i??"")).replace(h,String(o)).replace(p,String(s))},Ze=(e,t,r)=>e?t+r/2:t-r/2,qe=({barConfig:e,currentBars:t,endRounded:r,extraSpacing:a=0,focusConfig:n={stroke:"#0078D4",strokeWidth:.2},onBlur:i,onFocus:o,order:s=1,orientation:c,startRounded:l,tabIndex:u=0,x1:x,x2:h,y1:p,y2:f,dataKey:g,xKey:R,yKey:A,xData:E,yData:T})=>{const{barWidth:_,singleConfig:y}=e,v=(({barConfig:e,orientation:t,x1:r,x2:a,y1:n,y2:i})=>{const{gap:o=0,singleConfig:s}=e,c=t===O.HORIZONTAL,d=c?r:n,l=c?a:i,u={end:l<d,start:l>d};return s.reduce((e,t,r)=>{const{coverage:a}=t,n=((e,t)=>e/100*t)(a,l-d),i=0===r?d:Ze(u.start,e[r-1][1],o),c=r+1===s.length?l:Ze(u.end,i+n,o);return e.push([i,c]),e},[])})({barConfig:e,orientation:c,x1:x,x2:h,y1:p,y2:f});return d.jsx("g",{children:y.map(({color:e,"aria-label":C,...m},S)=>{const[I,$]="HORIZONTAL"===c?v[S]:[x,h],[N,b]="VERTICAL"===c?v[S]:[p,f],k=(({barWidth:e,currentBars:t,endRounded:r=0,extraSpacing:a,order:n,orientation:i,startRounded:o=0,x1:s,x2:c,y1:d,y2:l})=>{let u,x,h,p,f="Z";const g=(({barWidth:e,currentBars:t,extraSpacing:r,order:a,orientation:n})=>{const i=e/2,o=r/2,s=t%2==0,c=s?o:o+i,d=a-Math.ceil(t/2);let l=0;return 0===d?l=s?-o:i:d<0?l=n===O.HORIZONTAL?d*-c+e:d*c:d>0&&(l=n===O.HORIZONTAL?d*-c:d*c+e),l})({barWidth:e,currentBars:t,extraSpacing:a,order:n,orientation:i});if(i===O.HORIZONTAL){const t=s+o,a=c-r;o&&r?(u=`M ${t},${d+g}`,x=`L${a},${l+g}`,h=`Q${c+r} ${l+g-e/2}, ${a} ${l+g-e}`,p=`L${t},${d+g-e}`,f=`Q${s-o} ${d+g-e/2}, ${t} ${d+g}`):o?(u=`M ${t},${d+g}`,x=`L${c},${l+g}`,h=`L${c},${l+g-e}`,p=`L${t},${d+g-e}`,f=`Q${s-o} ${d+g-e/2}, ${t} ${d+g}`):r?(u=`M${s},${d+g}`,x=`L${a},${l+g}`,h=`Q${c+r} ${l+g-e/2}, ${a} ${l+g-e}`,p=`L${s},${d+g-e}`):(u=`M${s},${d+g}`,x=`L${c},${l+g}`,h=`L${c},${l+g-e}`,p=`L${s},${d+g-e}`)}else{const t=d-o,a=l+r;o&&r?(u=`M${s+g}, ${t}`,x=`L${c+g},${a}`,h=`Q${c+g-e/2} ${l-r}, ${c+g-e} ${a}`,p=`L${s+g-e},${t}`,f=`Q${s+g-e/2} ${d+o}, ${s+g} ${t}`):o?(u=`M${s+g}, ${t}`,x=`L${c+g},${l}`,h=`L${c+g-e},${l}`,p=`L${s+g-e},${t}`,f=`Q${s+g-e/2} ${d+o}, ${s+g} ${t}`):r?(u=`M${s+g},${d}`,x=`L${c+g},${a}`,h=`Q${c+g-e/2} ${l-r}, ${c+g-e} ${a}`,p=`L${c+g-e},${d}`):(u=`M${s+g},${d}`,x=`L${c+g},${l}`,h=`L${c+g-e},${l}`,p=`L${s+g-e},${d}`)}return`${u} ${x} ${h} ${p} ${f}`})({barWidth:_,currentBars:t,endRounded:S===y.length-1&&r?r:void 0,extraSpacing:a,order:s,orientation:c,startRounded:0===S&&l?l:void 0,x1:I,x2:$,y1:N,y2:b});return d.jsx(Ge,{"aria-label":ze({ariaLabel:C,dataKey:g,xKey:R,yKey:A,xData:E,yData:T,coverage:m.coverage,index:S}),d:k,fill:e,focusConfig:n,hoverConfig:{stroke:"transparent",strokeWidth:"0"},stroke:"transparent",tabIndex:u,onBlur:i,onFocus:o,...m},`${S.toString()}`)})})},Je=({barConfig:e,dataIdx:t,dataKey:r,focusConfig:a,onBlur:n,onFocus:i,order:o,tabIndex:s,...c})=>{const{addError:u,xAxisCoordinates:x,yAxisCoordinates:h,...p}=l.useContext(k),{coordinates:f,tickValues:g}=x,{coordinates:R,tickValues:A}=h,E=p.orientation===O.VERTICAL,T=E?p.pKey:r,_=E?r:p.pKey,y=p.data[t],v=y?.[T],C=y?.[_],m=p.data[0],S=!!m&&Object.prototype.hasOwnProperty.call(m,r),I=p.data.length>0,$=Number(C);l.useEffect(()=>{!I||S?isNaN($)?u?.("BAR_CHART_PATH_ERROR",{error:P(C,r)}):$<0&&u?.("BAR_CHART_PATH_ERROR",{error:D($,r)}):u?.("BAR_CHART_PATH_ERROR",{error:ue(r)})},[r,I,S,$,C]);const N=Re(g,[String(v)],!0)[0],b=Re(A,[String(C)])[0],L=E?{x1:N,x2:N,y1:f.y1,y2:b}:{x1:R.x1,x2:N,y1:b,y2:b};return d.jsx(qe,{barConfig:e,currentBars:p.barChildrenCount,dataKey:r,extraSpacing:p.gapBetweenBars,focusConfig:a,order:o,orientation:p.orientation,tabIndex:s,xData:v,xKey:T,yData:C,yKey:_,onBlur:n,onFocus:i,...L,...c})},Qe=e=>{let t=0;return l.Children.toArray(e).forEach(e=>{l.isValidElement(e)&&e.type===Je&&e.props.order>t&&(t=e.props.order)}),t},et=e=>{if(0===e.length)return{numeric:{max:2,min:0,step:1}};const t=Math.min(...e.map(e=>parseFloat(e))),r=Math.max(...e.map(e=>parseFloat(e)));return{numeric:{max:r,min:t,step:Math.abs(r-t)/2}}},tt=({bound:e,data:t,fontSize:r,svgHeight:a,svgWidth:n,viewBox:i})=>{if(!p()||!t.length)return 0;const o=f();if(!o)return 0;const s=g("svg");if(!s)return 0;s.setAttribute("style","position: absolute; visibility: hidden; top: -9999px; left: -9999px;"),s.setAttribute("viewBox",i),s.setAttribute("width",n),s.setAttribute("height",a),o.body.appendChild(s);const c=t.map(t=>{const a=g("text");if(!a)return 0;a.setAttribute("font-size",r),a.textContent=t,s.appendChild(a);const n=a.getBBox()[e];return a.remove(),n});return s.remove(),Math.max(...c,0)},rt=({ariaLabel:e,className:t="line",dataTestId:r,...a})=>d.jsx("line",{...a,"aria-label":e,className:t,"data-testid":r}),at=({children:e,className:t="circle",...r})=>d.jsx("text",{className:t,...r,children:e}),nt=({showTickLines:e,tick:t,tickLine:r,tickText:a})=>d.jsxs("g",{children:[e&&d.jsx(rt,{...r}),a&&d.jsx(at,{...a,children:t.value})]}),it=(e,t,r=1)=>e>=t-r&&e<=t+r,ot=e=>{const{ariaLabel:t,className:r,dataTestId:a,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:x,tabIndex:h,transform:p,x1:f,x2:g,y1:R,y2:A}=e;return{ariaLabel:t,className:r,dataTestId:a,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:x,tabIndex:h,transform:p,x1:f,x2:g,y1:R,y2:A}},st=({canvasHeight:e=$.height,canvasWidth:t=$.width,cursor:r=0,extraSpace:a={bottom:0,left:0,right:0,top:0},position:n=H.BOTTOM,showTickLines:i=!1,tickLine:o,tickLineHover:s,tickText:c,tickValues:l=[],...u})=>{const x=Le(u);return d.jsxs("g",{...x,children:[d.jsx(rt,{...ot(u)}),l&&l.length>0&&l.map((e,t)=>{const a=it(r,e.position)&&s?{...o,...s}:o,n="rotate"===c?.transform?`rotate(-30, ${e.position}, ${c.y})`:void 0;return d.jsx(nt,{showTickLines:i,tick:e,tickLine:{...a,x1:e.position,x2:e.position},tickText:{...c,transform:n,x:e.position}},`${t.toString()}`)})]})},ct=(e,t,r)=>e===H.RIGHT?t+r:t-r,dt=(e,t,r,a)=>e===H.TOP?r:t+r+a,lt=({position:e=H.BOTTOM,tickLine:t,tickText:r,...a})=>{const{xAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(k),s=dt(e,n.y1,Number(r?.fontSize),r?.top??0),c=o.extraSpaceTopY,u=Number(o.canvasHeight)-o.extraSpaceBottomY;return d.jsx(st,{...n,...a,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}xAxis`,extraSpace:{left:o.extraSpaceLeftX,right:o.extraSpaceRightX},tickLine:{...t,y1:c,y2:u},tickText:{...r,y:s},tickValues:r?i:void 0})},ut=({canvasWidth:e,cursor:t=0,extraSpace:r={bottom:0,left:0,right:0,top:0},position:a=H.LEFT,showTickLines:n=!0,tickLine:i,tickLineHover:o,tickText:s,tickValues:c=[],...l})=>{const u=Le(l);return d.jsxs("g",{...u,children:[d.jsx(rt,{...ot(l)}),c&&c.length>0&&c.map((e,r)=>{const a=it(t,e.position)&&o?{...i,...o}:i,c="rotate"===s?.transform?`rotate(-30, ${s.x}, ${e.position})`:void 0;return d.jsx(nt,{showTickLines:n,tick:e,tickLine:{...a,y1:e.position,y2:e.position},tickText:{...s,transform:c,y:e.position}},`${r.toString()}`)})]})},xt=(e,t,r)=>{let a=0;switch(e){case"middle":a=t/2+r;break;case"end":a=t+r;break;default:a=0}return a},ht=({position:e=H.LEFT,tickLine:t,tickText:r,...a})=>{const{yAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(k),s=r?.textAnchor||"middle",c=(e===H.RIGHT?r?.right:r?.left)??0,u=xt(s,o.yAxisText,c),x=ct(e,n.x1,u);return d.jsx(ut,{...n,...a,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}yAxis`,tickLine:{...t,x1:o.extraSpaceLeftX,x2:Number(o.canvasWidth)-o.extraSpaceRightX},tickText:{...r,x:x},tickValues:r?i:void 0})},pt=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:r=0,step:a}=e.numeric;if(a>=Math.abs(t-r)||a<=0)return[r.toString()];const n=[];for(let e=r;e<=t;e+=a)n.push(e.toString());return n}},ft=(e,t)=>e.flatMap(e=>Object.keys(e).filter(r=>r!==t&&"number"==typeof e[r]).map(t=>Number(e[t]))),gt=(e,t,r,a,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,x=u*a,h=l?pt(l):t.map(e=>e[r]),p=tt({bound:"width",data:h,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),f=n>p?n:p,g=c===H.BOTTOM?x+(d?.top??0):0,R=c===H.TOP?x+(d?.bottom??0):0;return{barChartXPosition:c||H.BOTTOM,extraSpaceBottomY:g,extraSpaceTopY:R,securityXSpace:f,xBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,xData:h}},Rt=(e,t,r,a,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,x=u*a,h=l||et([...new Set(ft(t,r))]),p=pt(h),f=n>x?n:x,g=tt({bound:"width",data:p,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),R=c===H.LEFT?g+(d?.right??0):0,A=c===H.RIGHT?g+(d?.left??0):0;return{barChartYPosition:c||H.LEFT,extraSpaceLeftX:R,extraSpaceRightX:A,securityYSpace:f,yAxisText:g,yBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,yData:p}},At=({addError:e,ajustedX:t,ajustedY:r,canvasHeight:a,canvasWidth:n,children:i,data:o,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u})=>{let x;if(!o||0===o.length){const t={error:le(Z)};e?.("BAR_CHART_CONTEXT_ERROR",t),x=t}if(n<=0||a<=0){const t={error:xe(n,a)};e?.("BAR_CHART_CONTEXT_ERROR",t),x=t}const h=Qe(i),p=20*h,f=(h-1)*s,g=c===O.VERTICAL?n:a;if(p+f>g){const t={error:(R=`Insufficient space: requires ${p+f}px but only ${g}px available`,new Error(`Invalid bar distribution for "all": ${R}`))};e?.("BAR_CHART_CONTEXT_ERROR",t),x=t}var R;const A=o&&o.length>0?o:[{[Te]:0,[d]:Ae},{[Te]:0,[d]:Ee}],E=n>0?n:100,T=a>0?a:100,{barChartXPosition:_,barChartYPosition:y,extraSpaceBottomY:v,extraSpaceLeftX:C,extraSpaceRightX:m,extraSpaceTopY:S,securityXSpace:I,securityYSpace:$,xAxisText:N,xBreakAxis:b,xData:k,yAxisText:w,yBreakAxis:M,yData:B}=(({ajustedX:e,ajustedY:t,canvasHeight:r,canvasWidth:a,children:n,data:i,gapBetweenBars:o,orientation:s,pKey:c,viewBox:d})=>{let u={barChartXPosition:H.BOTTOM,barChartYPosition:H.LEFT,extraSpaceBottomY:0,extraSpaceLeftX:0,extraSpaceRightX:0,extraSpaceTopY:0,securityXSpace:0,securityYSpace:0,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]},x=o;const h=[];return l.Children.forEach(n,n=>{if(l.isValidElement(n))if(n.type!==Je||h.includes(n.props.order)||(h.push(n.props.order),x+=n.props.barConfig.barWidth??0),n.type===lt){const t=s===O.VERTICAL?x:0;u={...u,...gt(n,i,c,e,t,d,r,a)}}else if(n.type===ht){const e=s===O.HORIZONTAL?x:0;u={...u,...Rt(n,i,c,t,e,d,r,a)}}}),u})({ajustedX:t,ajustedY:r,canvasHeight:T,canvasWidth:E,children:i,data:A,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u}),P=_!==H.TOP&&_!==H.BOTTOM,D=(({initPos:e,maxSpaceAvailable:t,otherAxisSpace:r,securitySpace:a,tickValues:n})=>{const i=n.length-1,o=(t-r-a)/i;return n.map((t,r)=>({position:e+r*o+a/2,value:t}))})({initPos:C,maxSpaceAvailable:E,otherAxisSpace:C+m,securitySpace:I,tickValues:k});if((D??[]).some(({position:e})=>isNaN(e))){const t={error:le(z)};e?.("BAR_CHART_CONTEXT_ERROR",t),x=t}if(D){const t=D.length<2,r=D.length>=2&&1===new Set(D.map(e=>e.value)).size;if(t){const t={error:le(ne)};e?.("BAR_CHART_X_AXIS_ERROR",t),x||(x=t)}if(r){const t={error:le(ae)};e?.("BAR_CHART_X_AXIS_ERROR",t),x||(x=t)}}const j=y!==H.LEFT&&y!==H.RIGHT,F=(({initPos:e,maxSpaceAvailable:t,needAjusted:r,otherAxisSpace:a,securitySpace:n,tickValues:i})=>{const o=(t-a-n)/(i.length-1),s=r?n/2:0;return i.map((t,r)=>({position:e-r*o-s,value:t}))})({initPos:T-v,maxSpaceAvailable:T,needAjusted:c===O.HORIZONTAL,otherAxisSpace:S+v,securitySpace:$,tickValues:B});if(F){const t=F.length<2,r=F.length>=2&&1===new Set(F.map(e=>e.value)).size;if(t){const t={error:le(se)};e?.("BAR_CHART_Y_AXIS_ERROR",t),x||(x=t)}if(r){const t={error:le(oe)};e?.("BAR_CHART_Y_AXIS_ERROR",t),x||(x=t)}}const X=P?Re(F||[],[String(b)])[0]:0,V=j?Re(D||[],[String(M)])[0]:0,W=(({canvasHeight:e,canvasWidth:t,customBreakAxis:r,extraSpaceBottomY:a,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===H.TOP?{x1:n,x2:t-i,y1:o,y2:o}:s===H.CENTER?{x1:n,x2:t-i,y1:e/2,y2:e/2}:s===H.CUSTOM?{x1:n,x2:t-i,y1:r,y2:r}:{x1:n,x2:t-i,y1:e-a,y2:e-a})({canvasHeight:T,canvasWidth:E,customBreakAxis:Number(X),extraSpaceBottomY:v,extraSpaceLeftX:C,extraSpaceRightX:m,extraSpaceTopY:S,position:_}),K=(({canvasHeight:e,canvasWidth:t,customBreakAxis:r,extraSpaceBottomY:a,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===H.RIGHT?{x1:t-i,x2:t-i,y1:o,y2:e-a}:s===H.CENTER?{x1:t/2,x2:t/2,y1:o,y2:e-a}:s===H.CUSTOM?{x1:r,x2:r,y1:o,y2:e-a}:{x1:n,x2:n,y1:o,y2:e-a})({canvasHeight:T,canvasWidth:E,customBreakAxis:Number(V),extraSpaceBottomY:v,extraSpaceLeftX:C,extraSpaceRightX:m,extraSpaceTopY:S,position:y});if(W.x1===W.x2){const t={error:le(ie)};e?.("BAR_CHART_X_AXIS_ERROR",t),x||(x=t)}if(K.y1===K.y2){const t={error:le(ce)};e?.("BAR_CHART_Y_AXIS_ERROR",t),x||(x=t)}const U={addError:e,crossXAxis:P,crossYAxis:j,data:A,extraSpaceBottomY:v,extraSpaceLeftX:C,extraSpaceRightX:m,extraSpaceTopY:S,securityXSpace:I,securityYSpace:$,xAxisCoordinates:{coordinates:W,tickValues:D||(x?[{position:0,value:Ae},{position:E,value:Ee}]:[])},xAxisText:N,yAxisCoordinates:{coordinates:K,tickValues:F||(x?[{position:T,value:Ae},{position:0,value:Ee}]:[])},yAxisText:w};return x?{...U,error:{...x,type:L.BAR_CHART_CONTEXT_ERROR}}:U},Et=Object.assign(({canvasConfig:e=$,caption:t,children:r,classNames:a,data:n,dataTestId:i="bar-chart",gapBetweenBars:o=0,height:s="100%",onErrors:c,orientation:x,pKey:p,role:f,tabIndex:g,width:R="100%",...A})=>{const E=h(i),{parsedCanvas:T,parsedCanvasExtraSpace:_,viewBox:y}=I({canvasConfig:e,dataTestId:E,height:s,width:R}),v=T.width,C=T.height,m=Qe(r),S=2*o,O=[d.jsx(lt,{},"default-x-axis"),d.jsx(ht,{},"default-y-axis")],L=l.Children.toArray(r)||[],H=O.concat(L),w=Math.max(v,C,_??0),M=v/w,B=C/w,P=l.useMemo(()=>N(c),[c]),D=b(n),j=l.useMemo(()=>(P.clearErrors(),At({addError:(e,t)=>{P.addError(e,t)},ajustedX:M,ajustedY:B,canvasHeight:C,canvasWidth:v,children:H,data:n,gapBetweenBars:S,orientation:x,pKey:p,viewBox:y})),[C,v,D,p,x,P.addError]);return d.jsx(u,{caption:t,className:a,dataTestId:E,height:s,role:f,tabIndex:g,viewBox:y,width:R,...A,children:d.jsx(k.Provider,{value:{...j,barChildrenCount:m,canvasExtraSpace:_,canvasHeight:C,canvasWidth:v,data:n,dataTestId:E,gapBetweenBars:o,orientation:x,pKey:p},children:r})})},{Path:Je,Separator:({areaSeparator:e,dataTestId:t,rightSeparator:r,topSeparator:a,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:x}=l.useContext(k),h=u.tickValues,p=x.tickValues,f=void 0!==n?"string"==typeof n?parseFloat(n):n:void 0,g=void 0!==i?"string"==typeof i?parseFloat(i):i:void 0;if(l.useEffect(()=>{if(void 0!==n){const e=h.map(e=>e.value);if(void 0===f||isNaN(f))o?.("BAR_CHART_SEPARATOR_ERROR",{error:he(n)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(f<t||f>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:fe(f,t,r)})}}if(void 0!==i){const e=p.map(e=>e.value);if(void 0===g||isNaN(g))o?.("BAR_CHART_SEPARATOR_ERROR",{error:pe(i)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(g<t||g>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:ge(g,t,r)})}}},[n,f,h,i,g,p]),!a&&!r&&!e)return d.jsx(d.Fragment,{});const R=n&&Re(u.tickValues,[n],!0)[0],A=i&&Re(x.tickValues,[i])[0],E=c?x.coordinates.x1:u.coordinates.x2,T=s?u.coordinates.y1:x.coordinates.y1,_=u.coordinates.x1,y=R??E,v=x.coordinates.y2,C=A??T;l.useEffect(()=>{_===y&&v===C&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:le(te)})},[_,y,v,C]);const m=`M${_} ${v} H ${y} V ${C} H ${_} Z`,S=`M${_} ${C} H ${y}`,I=`M${y} ${v} V ${C}`;return d.jsxs("g",{children:[d.jsx("path",{d:m,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:S,"data-testid":`${t}Top`,...a}),d.jsx("path",{d:I,"data-testid":`${t}Right`,...r})]})},XAxis:lt,YAxis:ht}),Tt=l.createContext({}),_t=l.forwardRef(({dataTestId:e,position:t,size:r,...a},n)=>d.jsx("circle",{...a,ref:n,cx:t.x,cy:t.y,"data-testid":`${e}-circle`,r:r/2})),yt=l.forwardRef(({dataTestId:e,position:t,size:r,...a},n)=>d.jsx("rect",{...a,ref:n,"data-testid":`${e}-square`,height:r,width:r,x:t.x-r/2,y:t.y-r/2})),vt=l.forwardRef(({dataTestId:e,position:t,size:r,...a},n)=>{const i=r/2,o=r,s=`${t.x},${t.y-o/2} ${t.x-i},${t.y+o/2} ${t.x+i},${t.y+o/2}`;return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-triangle`,points:s})}),Ct="CIRCLE",mt="SQUARE",St="TRIANGLE",It="EXTRA_LARGE",$t="EXTRA_SMALL",Nt="LARGE",bt="MEDIUM",kt="SMALL",Ot={[It]:40,[$t]:8,[Nt]:32,[bt]:24,[kt]:16},Lt={[Ct]:_t,[mt]:yt,[St]:vt},Ht=l.forwardRef(({className:e,data:t,dataTestId:r="plot",fill:a,fillOpacity:n,focusConfig:i,hasHoverEffect:o,hoverConfig:s,id:c,label:l,onBlur:u,onClick:x,onFocus:h,onKeyDown:p,onMouseEnter:f,onMouseLeave:g,opacity:R,position:A={x:0,y:0},size:E=bt,stroke:T,strokeWidth:_,tabIndex:y,type:v=Ct,...C},m)=>{const{handleMouseEnter:S,handleMouseLeave:I,isHovered:$}=Oe(f,g),{handleBlur:N,handleFocus:b,isFocused:k}=ke(h,u),{fill:O=a,opacity:L=.3,scale:H=1.3,stroke:w=a,strokeWidth:M=0}=s||{},B="number"==typeof E?E:Ot[E],P={...C,"aria-label":l,className:`plot ${e||""}`,dataTestId:r,fill:a,fillOpacity:n,id:c,onBlur:N,onClick:x,onFocus:b,onKeyDown:e=>{!x||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(e)),p?.(e)},onMouseEnter:S,onMouseLeave:I,opacity:R,position:A,role:"button",size:B,stroke:T,strokeWidth:o&&$&&!k?0:_,tabIndex:y},D=Lt[v],j=v===St?{x:A.x,y:A.y-B*(H-1)/6}:A;return d.jsxs(d.Fragment,{children:[o&&$&&!k&&d.jsx(D,{dataTestId:`${r}-hover`,fill:O,opacity:L,position:j,size:B*H,stroke:w,strokeWidth:M}),d.jsx(be,{dataTestId:r,focusConfig:{...i,variant:i?.variant??"bounding-box"},isFocused:k,children:d.jsx(D,{ref:m,...P})})]})}),wt="{{name}}",Mt="{{value}}",Bt=`${wt}, ${Mt}`,Pt=new RegExp("{{dataKey}}","g"),Dt=new RegExp(wt,"g"),jt=new RegExp(Mt,"g"),Ft=new RegExp("{{x}}","g"),Xt=new RegExp("{{y}}","g"),Vt=Object.assign(({ariaHidden:e,ariaLabel:t,backgroundUrl:r,caption:a,children:n,className:i,data:o,dataTestId:s="custom-background-chart",height:c="100%",onBlur:x,onClick:p,onDoubleClick:f,onErrors:g,onFocus:R,onKeyDown:A,onKeyUp:E,onMouseEnter:T,onMouseLeave:_,role:y="img",tabIndex:v,viewBox:C,width:m="100%",...S})=>{const I=h(s),$=`0 0 ${C.width} ${C.height}`,b=l.useMemo(()=>N(g),[g]);l.useEffect(()=>{0===Object.keys(o).length&&b.addError("CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR",{error:new Error("Data object is empty. At least one data point is required.")}),r&&""!==r.trim()||b.addError("CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR",{error:new Error("backgroundUrl is required and cannot be empty.")}),(C.width<=0||C.height<=0)&&b.addError("CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR",{error:new Error(`Invalid viewBox dimensions: width=${C.width}, height=${C.height} (both must be > 0)`)})},[o,r,C,b]);const k=l.useMemo(()=>({addError:(e,t)=>{b.addError(e,t)},data:o,dataTestId:I,viewBox:C}),[C,o,I,b]);return d.jsx(u,{ariaHidden:e,ariaLabel:t,caption:a,className:i,dataTestId:I,height:c,role:y,tabIndex:v,viewBox:$,width:m,onBlur:x,onClick:p,onDoubleClick:f,onFocus:R,onKeyDown:A,onKeyUp:E,onMouseEnter:T,onMouseLeave:_,...S,children:d.jsxs(Tt.Provider,{value:k,children:[d.jsx("image",{"data-testid":`${I}-background`,height:C.height,href:r,preserveAspectRatio:"xMidYMid meet",width:C.width,x:0,y:0}),d.jsx("g",{"data-testid":`${I}-plots`,children:n})]})})},{Plot:({ariaLabel:e,dataKey:t,formatAriaValue:r,...a})=>{const{addError:n,data:i,dataTestId:o,viewBox:s}=l.useContext(Tt),c=l.useMemo(()=>i[t],[i,t]);l.useEffect(()=>{if(!c)return void n?.("CUSTOM_BACKGROUND_CHART_PLOT_ERROR",{error:new Error(`dataKey "${t}" not found in data object.`)});const{x:e,y:r}=c;(e<0||e>s.width||r<0||r>s.height)&&n?.("CUSTOM_BACKGROUND_CHART_PLOT_ERROR",{error:new Error(`Plot "${t}" coordinates (${e}, ${r}) are outside viewBox bounds (0-${s.width}, 0-${s.height})`)})},[c,t,n,s.width,s.height]);const u=l.useMemo(()=>{if(!c)return t;const a=r?r(c.value):"number"==typeof(n=c.value)?n.toLocaleString():"string"==typeof n?n:JSON.stringify(n);var n;return(({ariaLabel:e,dataKey:t,name:r,formattedValue:a,x:n,y:i})=>{const o=r??t;return(e??Bt).replace(Pt,t).replace(Dt,o).replace(jt,a).replace(Ft,String(n)).replace(Xt,String(i))})({ariaLabel:e,dataKey:t,formattedValue:a,name:c.name,x:c.x,y:c.y})},[e,c,t,r]),x=l.useMemo(()=>({x:c?.x??0,y:c?.y??0}),[c?.x,c?.y]);return c?d.jsx(Ht,{...a,data:{value:c.value},dataTestId:`${o}-plot-${t}`,label:u,position:x}):null}}),Wt=l.createContext({}),Kt=({curved:e=!1,extendToBottom:t=!1,points:r,svgHeight:a})=>{if(0===r.length)return"";const[n,...i]=r;let o=`M ${n[0]} ${n[1]}`;return o+=e?i.reduce((e,t,a)=>{const[n,i]=r[a],[o,s]=t,c=.3*(o-n),d=[n+c,i],l=[o-c,s];return`${e} C ${d[0]} ${d[1]}, ${l[0]} ${l[1]}, ${o} ${s}`},""):i.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""),t&&(o+=` L ${i[i.length-1][0]} ${a} L ${n[0]} ${a} Z`),o},Ut=(e,t)=>new Error(`Invalid projection bounds - upper projection (${e}) must be below lower projection (${t})`),Yt=(e,t)=>new Error(`${t?"Upper":"Lower"} projection X coordinate (${e}) is outside valid range (0-100)`),Gt=(e,t,r)=>new Error(`${r?"Upper":"Lower"} projection Y coordinate (${e}) is outside chart area (0-${t})`),zt=(e,t)=>{if(!t)return e;const r=t<0,a=e*Math.abs(t)/100;return r?e-a:e+a},Zt=(e,t,r)=>{if(!r)return e;const a=r<0,n=(0===e?t:e)*Math.abs(r)/100;return a?e+n:e-n},qt=({curved:e,lineProjection:t,points:r,svgHeight:a})=>{const{addError:n}=l.useContext(Wt),{lower:i,shapeColor:o,upper:s}=t,{xProjection:c,yProjection:u,...x}=s||{},{xProjection:h,yProjection:p,...f}=i||{},g=c||u?{x:c,y:u}:void 0,R=h||p?{x:h,y:p}:void 0,A=g?.y,E=R?.y,T=g?.x,_=R?.x;l.useEffect(()=>{if(g&&R){const e=A||0,t=E||0;e>=t&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Ut(e,t)})}g&&(void 0!==T&&(T<0||T>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Yt(T,!0)}),void 0!==A&&(A<0||A>a)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Gt(A,a,!0)})),R&&(void 0!==_&&(_<0||_>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Yt(_,!1)}),void 0!==E&&(E<0||E>a)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Gt(E,a,!1)}))},[R,_,E,a,g,T,A]);const{downPath:y,shapePath:v,upPath:C}=(({curved:e,lowerProjection:t,points:r,svgHeight:a,upperProjection:n})=>{const i=n||t;if(0===r.length&&!i)return{shapePath:""};const[o,...s]=r,c=`M ${o[0]} ${o[1]}`;let d=c,l=n?c:void 0,u=t?c:void 0;const x=[],h=[];s.forEach(([e,r])=>{const i=n?[zt(e,n.x),Zt(r,a,n.y)]:[e,r],o=t?[zt(e,-(t.x??0)),Zt(r,a,-(t.y??0))]:[e,r];x.push(i),h.push(o)});const p=n&&t?[...x,s.at(-1),...h.reverse(),o]:[...x,...h.reverse(),o];return e?(d+=p.reduce((e,t,r)=>{const a=0===r?o:p[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},""),l&&(l+=x.reduce((e,t,r)=>{const a=0===r?o:x[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},"")),u&&(u+=h.reverse().reduce((e,t,r)=>{const a=0===r?o:h[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},""))):(d+=p.reduce((e,t)=>`${e} L ${t?.[0]} ${t?.[1]}`,""),l&&(l+=x.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,"")),u&&(u+=h.reverse().reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""))),{downPath:u,shapePath:d,upPath:l}})({curved:e,lowerProjection:R,points:r,svgHeight:a,upperProjection:g});return d.jsxs("g",{className:"pointer-events-none",children:[d.jsx("path",{d:v,fill:o,stroke:"transparent",strokeWidth:"0.1"}),";",C&&d.jsx("path",{d:C,...x}),y&&d.jsx("path",{d:y,...f})]})},Jt=(e,t)=>e.map(e=>e[t]),Qt={formatTicksValues:(e,t)=>e.map(e=>({...e,value:t(e.value)}))},er=({ariaLabel:e,position:t=H.BOTTOM,tickLine:r,tickText:a,valueFormatter:n=e=>e,...i})=>{const{xAxisCoordinates:{coordinates:o,tickValues:s},xCursor:c,...u}=l.useContext(Wt),x=dt(t,o.y1,Number(a?.fontSize),a?.top??0),h=a?Qt.formatTicksValues(s,n):void 0,p=Le(i),f=e||i["aria-label"],g={...i,...p,...f&&{"aria-label":f}};return d.jsx(st,{...o,...g,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}xAxis`,tickLine:{...r,y1:u.yAxisCoordinates.coordinates.y1,y2:u.yAxisCoordinates.coordinates.y2},tickText:{...a,y:x},tickValues:h})},tr=({tickText:e,textWidth:t,yAxisPosition:r})=>{if(r!==H.LEFT)return 0;if(e?.useAxisAsOrigin){const{textAnchor:r="start"}=e;let a=0;return"end"===r&&(a=t),"middle"===r&&(a=t/2),a+=e.left??0,a-=e.right??0,Math.max(0,a)}const a=e?.textAnchor,n=e?.left??0;return"start"===a?0:"middle"===a?t+n:"end"===a?2*t+n:t/2+n},rr=({tickText:e,textWidth:t,yAxisPosition:r})=>{if(r!==H.RIGHT)return 0;if(e?.useAxisAsOrigin){const{textAnchor:r="start"}=e;let a=t;return"end"===r&&(a=0),"middle"===r&&(a=t/2),a-=e.left??0,a+=e.right??0,Math.max(0,a)}const a=e?.textAnchor,n=e?.right??0;return"start"===a?t:"middle"===a||"end"===a?t+n:2*t-t/2+n},ar=({tickText:e,textWidth:t})=>{const r=e?.textAnchor??"start";return"start"===r?0:"middle"===r?t/2:t},nr=({tickText:e,textWidth:t})=>{const r=e?.textAnchor??"start";return"end"===r?0:"middle"===r?t/2:t},ir=({ariaLabel:e,position:t=H.LEFT,tickLine:r,tickText:a,valueFormatter:n=e=>e,...i})=>{const{yAxisCoordinates:{coordinates:o,tickValues:s},yCursor:c,...u}=l.useContext(Wt),x=(({tickText:e,yAxisPosition:t,textWidth:r,yAxisX1:a})=>{if(e?.useAxisAsOrigin){let t=a;return t+=e.right??0,t-=e.left??0,t}const n=e?.textAnchor||"middle";let i=0;t===H.RIGHT?i=e?.right??0:t===H.LEFT&&(i=e?.left??0);const o=xt(n,r,i);return ct(t,a,o)})({tickText:a,yAxisPosition:t,textWidth:u.yAxisText,yAxisX1:o.x1}),h=a?Qt.formatTicksValues(s,n):void 0,p=Le(i),f=e||i["aria-label"],g={...i,...p,...f&&{"aria-label":f}};return d.jsx(ut,{...o,...g,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}yAxis`,tickLine:{...r,x1:u.xAxisCoordinates.coordinates.x1,x2:u.xAxisCoordinates.coordinates.x2},tickText:{...a,x:x},tickValues:h})},or=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:r=0,step:a}=e.numeric;if(a>=Math.abs(t-r)||a<=0)return[r.toString(),t.toString()];const n=[];for(let e=r;e<=t;e+=a)n.push(e.toString());return n}},sr=(e,t)=>e.flatMap(e=>Object.keys(e).filter(r=>r!==t&&"number"==typeof e[r]).map(t=>e[t])),cr=({tickValues:e,tickText:t})=>e?.numeric?e.numeric.breakAxis??0:t?.custom?.breakAxis??0,dr=(e,t,r,a,n,i)=>{const{position:o=H.BOTTOM,tickText:s,tickValues:c,valueFormatter:d}=e.props,l=s?.fontSize??0,u=c?or(c):t.map(e=>e[r]),x=d?u.map(d):u,h=tt({bound:"width",data:x,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),p=tt({bound:"height",data:x,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),f=o===H.BOTTOM?p+(s?.top??0):0,g=o===H.TOP?p+(s?.bottom??0):0,R=cr({tickValues:c,tickText:s});return{xAxisLeftSpacing:ar({textWidth:h,tickText:s}),xAxisTopSpacing:g,xAxisRightSpacing:nr({textWidth:h,tickText:s}),xAxisBottomSpacing:f,lineChartXPosition:o,xBreakAxis:R,xData:u}},lr=(e,t,r,a,n,i)=>{const{position:o=H.LEFT,tickText:s,tickValues:c,valueFormatter:d}=e.props,l=s?.fontSize??0,u=c||et([...new Set(sr(t,r))]),x=or(u),h=d?x.map(d):x,p=tt({bound:"width",data:h,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),f=tt({bound:"height",data:h,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a});return{yAxisLeftSpacing:tr({tickText:s,textWidth:p,yAxisPosition:o}),yAxisTopSpacing:f,yAxisRightSpacing:rr({tickText:s,textWidth:p,yAxisPosition:o}),yAxisBottomSpacing:0,lineChartYPosition:o,yAxisText:p,yBreakAxis:cr({tickValues:c,tickText:s}),yData:x}},ur=({addError:e,canvasHeight:t,canvasWidth:r,children:a,data:n,viewBox:i,xKey:o})=>{let s;const{error:c}=(({data:e,addError:t})=>{let r;if(!e||0===e.length){const e={error:le(q)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}if(e&&1===e.length){const e={error:le(re)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}return{error:r}})({data:n,addError:e});c&&(s=c);const{error:d}=(({canvasWidth:e,canvasHeight:t,addError:r})=>{let a;if(e<=0||t<=0){const n={error:xe(e,t)};r?.("LINE_CHART_CONTEXT_ERROR",n),a=n}return{error:a}})({canvasWidth:r,canvasHeight:t,addError:e});d&&(s=d);const u=n&&n.length>0?n:[{[o]:"0",y:0},{[o]:"1",y:1}],x=r>0?r:100,h=t>0?t:100,{xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:g,xAxisBottomSpacing:R,yAxisLeftSpacing:A,yAxisTopSpacing:E,yAxisRightSpacing:T,yAxisBottomSpacing:_,lineChartXPosition:y,lineChartYPosition:v,xAxisText:C,xBreakAxis:m,xData:S,yAxisText:I,yBreakAxis:$,yData:N}=(({canvasHeight:e,canvasWidth:t,children:r,data:a,viewBox:n,xKey:i})=>{let o={xAxisLeftSpacing:0,xAxisTopSpacing:0,xAxisRightSpacing:0,xAxisBottomSpacing:0,yAxisLeftSpacing:0,yAxisTopSpacing:0,yAxisRightSpacing:0,yAxisBottomSpacing:0,lineChartXPosition:H.BOTTOM,lineChartYPosition:H.LEFT,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]};return l.Children.forEach(r,r=>{l.isValidElement(r)&&(r.type===er?o={...o,...dr(r,a,i,n,e,t)}:r.type===ir&&(o={...o,...lr(r,a,i,n,e,t)}))}),o})({canvasHeight:h,canvasWidth:x,children:a,data:u,viewBox:i,xKey:o}),b=(({tickValues:e,maxSpaceAvailable:t,xAxisLeftSpacing:r,xAxisRightSpacing:a,yAxisLeftSpacing:n,yAxisRightSpacing:i})=>{const o=Math.max(n,r),s=t-Math.max(a,i);if(e.length<=1)return[{position:o,value:e[0]}];const c=(s-o)/(e.length-1);return e.map((e,t)=>({position:o+c*t,value:e}))})({tickValues:S,maxSpaceAvailable:x,xAxisLeftSpacing:p,xAxisRightSpacing:g,yAxisLeftSpacing:A,yAxisRightSpacing:T}),{error:k}=(({xTickValues:e,addError:t})=>{let r;if(e){if((e??[]).some(({position:e})=>isNaN(e))){const e={error:le(z)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}const a=e.length<2,n=e.length>=2&&1===new Set(e.map(e=>e.value)).size;if(a){const e={error:le(ne)};t?.("LINE_CHART_X_AXIS_ERROR",e),r||(r=e)}if(n){const e={error:le(ae)};t?.("LINE_CHART_X_AXIS_ERROR",e),r||(r=e)}}return{error:r}})({xTickValues:b,addError:e});!s&&k&&(s=k);const O=(({maxSpaceAvailable:e,tickValues:t,xAxisTopSpacing:r,xAxisBottomSpacing:a,yAxisTopSpacing:n,yAxisBottomSpacing:i})=>{const o=e-Math.max(a,i),s=Math.max(n,r);if(t.length<=1)return[{position:o,value:t[0]}];const c=(o-s)/(t.length-1);return t.map((e,t)=>({position:o-c*t,value:e}))})({maxSpaceAvailable:h,tickValues:N,xAxisTopSpacing:f,xAxisBottomSpacing:R,yAxisTopSpacing:E,yAxisBottomSpacing:_}),{error:w}=(({yTickValues:e,addError:t})=>{let r;if(e){const a=e.length<2,n=e.length>=2&&1===new Set(e.map(e=>e.value)).size;if(a){const e={error:le(se)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}if(n){const e={error:le(oe)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}}return{error:r}})({yTickValues:O,addError:e});!s&&w&&(s=w);const M=y!==H.TOP&&y!==H.BOTTOM,B=v!==H.LEFT&&v!==H.RIGHT,P=M?Re(O||[],[String(m)])[0]:0,D=B?Re(b||[],[String($)])[0]:0,j=(({lineChartXPosition:e,lineChartYPosition:t,canvasHeight:r,canvasWidth:a,customBreakAxis:n,xAxisLeftSpacing:i,xAxisTopSpacing:o,xAxisRightSpacing:s,xAxisBottomSpacing:c,yAxisLeftSpacing:d,yAxisTopSpacing:l,yAxisRightSpacing:u,yAxisBottomSpacing:x})=>{const h=t===H.LEFT?Math.max(d,i):0,p=t===H.RIGHT?a-Math.max(u,s):a;return e===H.TOP?{x1:h,x2:p,y1:Math.max(l,o),y2:Math.max(l,o)}:e===H.CENTER?{x1:h,x2:p,y1:r/2,y2:r/2}:e===H.CUSTOM?{x1:h,x2:p,y1:n,y2:n}:{x1:h,x2:p,y1:r-Math.max(x,c),y2:r-Math.max(x,c)}})({canvasHeight:h,canvasWidth:x,customBreakAxis:Number(P),lineChartXPosition:y,lineChartYPosition:v,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:g,xAxisBottomSpacing:R,yAxisLeftSpacing:A,yAxisTopSpacing:E,yAxisRightSpacing:T,yAxisBottomSpacing:_}),F=(({lineChartXPosition:e,lineChartYPosition:t,canvasHeight:r,canvasWidth:a,customBreakAxis:n,xAxisLeftSpacing:i,xAxisTopSpacing:o,xAxisRightSpacing:s,xAxisBottomSpacing:c,yAxisLeftSpacing:d,yAxisTopSpacing:l,yAxisRightSpacing:u,yAxisBottomSpacing:x})=>{const h=e===H.TOP?Math.max(l,o):0,p=e===H.BOTTOM?r-Math.max(x,c):r;return t===H.RIGHT?{x1:a-Math.max(u,s),x2:a-Math.max(u,s),y1:h,y2:p}:t===H.CENTER?{x1:a/2,x2:a/2,y1:h,y2:p}:t===H.CUSTOM?{x1:n,x2:n,y1:h,y2:p}:{x1:Math.max(d,i),x2:Math.max(d,i),y1:h,y2:p}})({canvasHeight:h,canvasWidth:x,customBreakAxis:Number(D),lineChartXPosition:y,lineChartYPosition:v,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:g,xAxisBottomSpacing:R,yAxisLeftSpacing:A,yAxisTopSpacing:E,yAxisRightSpacing:T,yAxisBottomSpacing:_}),{error:X}=(({xCoordinates:e,addError:t})=>{let r;if(e.x1===e.x2){const e={error:le(ie)};t?.("LINE_CHART_X_AXIS_ERROR",e),r=e}return{error:r}})({xCoordinates:j,addError:e});!s&&X&&(s=X);const{error:V}=(({yCoordinates:e,addError:t})=>{let r;if(e.y1===e.y2){const e={error:le(ce)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}return{error:r}})({yCoordinates:F,addError:e});!s&&V&&(s=V);const W={addError:e,crossXAxis:M,crossYAxis:B,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:g,xAxisBottomSpacing:R,yAxisLeftSpacing:A,yAxisTopSpacing:E,yAxisRightSpacing:T,yAxisBottomSpacing:_,xAxisCoordinates:{coordinates:j,tickValues:b||(s?[{position:0,value:"0"},{position:x,value:"1"}]:[])},xAxisText:C,yAxisCoordinates:{coordinates:F,tickValues:O||(s?[{position:h,value:Ae},{position:0,value:Ee}]:[])},yAxisText:I};return s?{...W,error:{...s,type:L.LINE_CHART_CONTEXT_ERROR}}:W},xr=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:r=$,caption:a,children:n,classNames:i,data:o,dataTestId:s="line-chart",getPathArea:c,height:x="100%",onErrors:p,role:f,tabIndex:g,width:R="100%",xKey:A,...E})=>{const T=h(s),[_,y]=l.useState(""),{parsedCanvas:v,parsedCanvasExtraSpace:C,viewBox:m}=I({canvasConfig:r,dataTestId:T,height:x,width:R}),S=[d.jsx(er,{},"default-x-axis"),d.jsx(ir,{},"default-y-axis")],k=l.Children.toArray(n)||[],O=S.concat(k);(({attrName:e,children:t,originalValue:r,updateValue:a})=>{let n="";l.Children.toArray(t).forEach(t=>{if(l.isValidElement(t)){const r=t.props[e];r&&(n+=r)}}),n!==r&&a(n)})({attrName:"dataKey",children:O,originalValue:_,updateValue:y});const L=l.useMemo(()=>N(p),[p]),H=b(o),w=l.useMemo(()=>(L.clearErrors(),ur({addError:(e,t)=>{L.addError(e,t)},canvasHeight:v.height,canvasWidth:v.width,children:O,data:o,viewBox:m,xKey:A})),[v.width,v.height,H,A,_,L.addError]),{svgRef:M,xCursor:B,yCursor:P}=(({canvasHeight:e,canvasWidth:t})=>{const[[r,a],n]=l.useState([we,we]),i=l.useCallback((r,a)=>{const{height:i,left:o,top:s,width:c}=a.getBoundingClientRect(),d=r.clientX-o,l=r.clientY-s;n([d*t/c,l*e/i])},[t,e]),o=e=>{e.preventDefault()};return{svgRef:l.useCallback(e=>{e&&(e.addEventListener("touchstart",o),e.addEventListener("touchmove",t=>i(t.touches[0],e)),e.addEventListener("mousemove",t=>i(t,e))),e?.removeEventListener("touchstart",o),e?.removeEventListener("touchmove",t=>i(t.touches[0],e)),e?.removeEventListener("mousemove",t=>i(t,e))},[e,t]),xCursor:r,yCursor:a}})({canvasHeight:v.height,canvasWidth:v.width});return l.useEffect(()=>{c?.({x1:w.xAxisCoordinates.coordinates.x1,y1:w.yAxisCoordinates.coordinates.y1,x2:w.xAxisCoordinates.coordinates.x2,y2:w.yAxisCoordinates.coordinates.y2})},[w.xAxisCoordinates.coordinates.x1,w.yAxisCoordinates.coordinates.y1,w.xAxisCoordinates.coordinates.x2,w.yAxisCoordinates.coordinates.y2,c]),d.jsx(u,{ref:M,ariaHidden:e,ariaLabel:t,caption:a,className:i,"data-kbt-svg":!0,dataTestId:T,height:x,role:f,tabIndex:g,viewBox:m,width:R,...E,children:d.jsx(Wt.Provider,{value:{...w,canvasExtraSpace:C,canvasHeight:v.height,canvasWidth:v.width,data:o,dataTestId:T,xCursor:B,xKey:A,yCursor:P},children:n})})},{Path:({ariaLabel:e,closestClick:t,curved:r,getNodeFocusInfo:a,getNodesCoords:n,indicatorConfig:i,lineProjection:o,onClick:s,...c})=>{const{addError:u,xAxisCoordinates:x,yAxisCoordinates:h,...p}=l.useContext(Wt),f=c.dataKey,g=p.data.length>0,R=p.data[0],A=!!R&&Object.prototype.hasOwnProperty.call(R,f),E=p.data.length;l.useEffect(()=>{if(!f||"string"!=typeof f)return void u?.("LINE_CHART_PATH_ERROR",{error:le(ee)});if(g&&!A)return void u?.("LINE_CHART_PATH_ERROR",{error:ue(f)});if(r&&E<2)return void u?.("LINE_CHART_PATH_ERROR",{error:le(Q)});const e=Jt(p.data,f);e.length>0&&e.every(e=>null==e)&&u?.("LINE_CHART_PATH_ERROR",{error:le(J)})},[u,r,f,E,g,A,p.data]);const{indicatorRef:T,pathRef:_}=((e,t)=>{const r=l.useRef(null),a=l.useRef(null);return l.useEffect(()=>{if(!t||!r.current||!a.current)return;const n=r.current,i=a.current;let o,s,c=0,d=n.getTotalLength();for(;d-c>.01;)o=(c+d)/2,s=n.getPointAtLength(o),s.x<e?c=o:d=o;const l=n.getPointAtLength(d);i.setAttribute("transform",`translate(${l.x}, ${l.y})`),i.setAttribute("pointer-events","none")},[e]),{indicatorRef:a,pathRef:r}})(p.xCursor,!!i),y=!!i&&p.xCursor!==-1/0,v=l.useRef(null),C=l.useRef(null),{autoClick:m,lineIndicator:S,...I}=i||{},{y1:$,y2:N}=h.coordinates,{x1:b,x2:k}=x.coordinates,O=p.xCursor>=b&&p.xCursor<=k,{tickValues:L}=x,{tickValues:H}=h,w=Jt(p.data,p.xKey),M=Jt(p.data,f),B=Re(L,w,!0),P=Re(H,M),D=B.map((e,t)=>[e,P[t]]),j=Kt({curved:r,extendToBottom:!1,points:D,svgHeight:h.coordinates.y2}),F=Kt({curved:r,extendToBottom:!!c.fill||!!c.gradient,points:D,svgHeight:h.coordinates.y2});l.useEffect(()=>{if(!v.current?.path)return;_.current=v.current.path;const e=v.current.main,t=v.current.node,r=w.map((e,t)=>({x:e,y:M[t]})),{mount:n,unmount:i}=(({data:e,getNodeFocusInfo:t,nodes:r,ref:a})=>{let n;const i=a.querySelector("[data-draw]"),o=a=>{let i;"ArrowRight"===a.key?i=void 0===n||n===r.length-1?0:n+1:"ArrowLeft"===a.key&&(i=void 0===n||0===n?r.length-1:n-1),void 0!==i&&(n=i,r[n]&&(r[n].focus(),t?.(e[n])))},s=()=>{n=void 0};return{mount:()=>{i?.addEventListener("focus",s),a.addEventListener("keydown",e=>o(e))},unmount:()=>{i?.removeEventListener("focus",s),a.removeEventListener("keydown",e=>o(e))}}})({data:r,getNodeFocusInfo:a,nodes:t,ref:e});return n(),()=>i()},[]),l.useEffect(()=>{if(c.nodeConfig&&y&&m){const{idx:e,match:t}=((e,t)=>{let r=0,a=!1;for(let n=0;n<e.length;n++)if(Math.round(e[n])===Math.round(t)){a=!0,r=n;break}return{idx:r,match:a}})(B,p.xCursor);if(t&&e!==C.current){C.current=e;const t=new MouseEvent("click",{bubbles:!0});t.autoClick=!0,v.current?.node?.[e]?.dispatchEvent(t),navigator?.vibrate?.(200)}else C.current=null}},[p.xCursor]),l.useEffect(()=>{n?.(D)},[D]);const X=Le(c),V={...c,...X,...e&&{"aria-label":e}};return d.jsxs(d.Fragment,{children:[d.jsx(Ge,{ref:v,d:j,dFill:F,dataTestId:`${p.dataTestId}path`,dataValue:p.data,points:D,xKey:p.xKey,onClick:e=>{if(s?.(e),t){const e=((e,t)=>{let r=0,a=Math.abs(e[0]-t);for(let n=1;n<e.length;n++){const i=Math.abs(e[n]-t);i<a&&(r=n,a=i)}return r})(B,p.xCursor),t=new MouseEvent("click",{bubbles:!0});t.autoClick=!1,v.current?.node?.[e]?.dispatchEvent(t)}},...V}),o&&d.jsx(qt,{curved:r,dataKey:c.dataKey,lineProjection:o,points:D,svgHeight:h.coordinates.y2}),y&&d.jsxs(d.Fragment,{children:[!!S&&O&&d.jsx(rt,{...S,className:"pointer-events-none",x1:p.xCursor,x2:p.xCursor,y1:$,y2:N}),d.jsx("g",{ref:T,className:"pointer-events-none",children:d.jsx(Ue,{...I})})]})]})},Separator:({areaSeparator:e,dataTestId:t,rightSeparator:r,topSeparator:a,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:x}=l.useContext(Wt),h=u.tickValues,p=x.tickValues,f=void 0!==n?"string"==typeof n?parseFloat(n):n:void 0,g=void 0!==i?"string"==typeof i?parseFloat(i):i:void 0;if(l.useEffect(()=>{if(void 0!==n){const e=h.map(e=>e.value);if(void 0===f||isNaN(f))o?.("LINE_CHART_SEPARATOR_ERROR",{error:he(n)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(f<t||f>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:fe(f,t,r)})}}if(void 0!==i){const e=p.map(e=>e.value);if(void 0===g||isNaN(g))o?.("LINE_CHART_SEPARATOR_ERROR",{error:pe(i)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(g<t||g>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:ge(g,t,r)})}}},[n,f,h,i,g,p]),!a&&!r&&!e)return d.jsx(d.Fragment,{});const R=n&&Re(u.tickValues,[n],!0)[0],A=i&&Re(x.tickValues,[i])[0],E=c?x.coordinates.x1:u.coordinates.x2,T=s?u.coordinates.y1:x.coordinates.y1,_=u.coordinates.x1,y=R??E,v=x.coordinates.y2,C=A??T;l.useEffect(()=>{_===y&&v===C&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:le(te)})},[_,y,v,C]);const m=`M${_} ${v} H ${y} V ${C} H ${_} Z`,S=`M${_} ${C} H ${y}`,I=`M${y} ${v} V ${C}`;return d.jsxs("g",{children:[d.jsx("path",{d:m,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:S,"data-testid":`${t}Top`,...a}),d.jsx("path",{d:I,"data-testid":`${t}Right`,...r})]})},XAxis:er,YAxis:ir}),hr=({children:e,dataTestId:t,height:r,width:a,x:n,y:i})=>d.jsx("foreignObject",{"data-testid":t,height:r,width:a,x:n,y:i,children:e}),pr=l.createContext({}),fr=({ariaLabel:e,dataKey:t,index:r,groupName:a,groupValue:n})=>{if(!e)return;const i=new RegExp("{{dataKey}}","g"),o=new RegExp("{{index}}","g"),s=new RegExp("{{groupName}}","g"),c=new RegExp("{{groupValue}}","g");return e.replace(i,t).replace(o,String(r)).replace(s,a).replace(c,String(n))},gr=(e,t,r)=>({x:e.x+t*Math.cos(r),y:e.y+t*Math.sin(r)}),Rr=({center:e,innerEnd:t,innerRadius:r,singleStroke:a})=>{if(!a)return r>0?`L ${t.x},${t.y}`:`L ${e.x},${e.y}`},Ar="CLOCKWISE",Er=({canvasHeight:e,canvasWidth:t,color:r="blue",dataKey:a,gap:n,halfChart:i,index:o,innerRadius:s,name:c,radius:u,singleStroke:x,startAngle:h,total:p,value:f,...g})=>{const{addError:R}=l.useContext(pr),A=Number(f),E=void 0!==u?Number(u):void 0,T=void 0!==s?Number(s):void 0,_=c?.trim()||"";l.useEffect(()=>{_||R?.("PIE_CHART_SEGMENT_ERROR",{error:K(a||"unknown",o||0,"name")}),isNaN(A)?R?.("PIE_CHART_SEGMENT_ERROR",{error:j(f,_||`segment-${o}`)}):(A<0&&R?.("PIE_CHART_SEGMENT_ERROR",{error:F(A,_||`segment-${o}`)}),void 0!==E&&(isNaN(E)||E<=0)&&R?.("PIE_CHART_SEGMENT_ERROR",{error:U(u)}),void 0!==T&&((isNaN(T)||T<0)&&R?.("PIE_CHART_SEGMENT_ERROR",{error:Y(s)}),void 0!==E&&(isNaN(E)||isNaN(T)||T>=E&&R?.("PIE_CHART_SEGMENT_ERROR",{error:G(T,E)}))))},[a,o,T,E,A,_]);const y=(({canvasHeight:e,canvasWidth:t,customRadius:r,gap:a,halfChart:n,innerRadius:i,rotateDirection:o,singleStroke:s,startAngle:c,total:d,value:l})=>{const u=n?2*e:e,x=Math.min(t,u)/2,h=r&&r<x?r:x,p=n?Math.PI:2*Math.PI,f={x:t/2,y:n?e:e/2},g=s?2*d:d,R=100*l/g*p/100,A=a/h,{carryAngle:E,finalAngle:T,initialAngle:_}=(({angleEquivalent:e,direction:t,gapAngle:r,startAngle:a})=>{const n=t===Ar;return{carryAngle:n?a+e:a-e,finalAngle:n?a+e-r/2:a-e+r/2,initialAngle:n?a+r/2:a-r/2}})({angleEquivalent:R,direction:o,gapAngle:A,startAngle:c.current});c.current=E;const y=p*l/g-A<=Math.PI?"0":"1",v=gr(f,i,_),C=gr(f,i,T),m=gr(f,h,_);return(({center:e,innerEnd:t,innerRadius:r,innerStart:a,largeArcFlag:n,outerEnd:i,outerStart:o,radius:s,rotateDirection:c,singleStroke:d})=>{let l,u,x,h,p,f,g,R,A,E;return c===Ar?(l=`M ${o.x},${o.y}`,u=`A ${s},${s} 0 ${n} 1 ${i.x}, ${i.y}`,x=Rr({center:e,innerEnd:t,innerRadius:r,singleStroke:d}),h=d?`M ${t.x},${t.y}`:void 0,p=r>0?`A ${r},${r} 0 ${n} 0 ${a.x},${a.y}`:void 0,f=`M ${o.x},${o.y}`,R=`M ${t.x},${t.y}`,g=`A ${s},${s} 0 ${n} 0 ${i.x},${i.y}`,A=`A ${r},${r} 0 ${n} 1 ${a.x},${a.y}`,E=d?void 0:"Z"):(l=`M ${o.x} ${o.y}`,u=`A ${s},${s} 0 ${n},0 ${i.x}, ${i.y}`,x=Rr({center:e,innerEnd:t,innerRadius:r,singleStroke:d}),h=d?`M ${t.x},${t.y}`:void 0,p=r>0?`A ${r}, ${r} 0 ${n},1 ${a.x},${a.y}`:void 0,f=`M ${o.x},${o.y}`,R=`M ${t.x},${t.y}`,g=`A ${s},${s} 0 ${n} 1 ${i.x},${i.y}`,A=`A ${r},${r} 0 ${n} 0 ${a.x},${a.y}`,E=d?void 0:"Z"),[l,u,x,h,p,E].concat(d?[f,g,R,A]:[]).filter(Boolean).join(" ")})({center:f,innerEnd:C,innerRadius:i,innerStart:v,largeArcFlag:y,outerEnd:gr(f,h,T),outerStart:m,radius:h,rotateDirection:o,singleStroke:s})})({canvasHeight:e,canvasWidth:t,customRadius:u,gap:n,halfChart:i,innerRadius:s,singleStroke:x,startAngle:h,total:p,value:f});return d.jsx(Ge,{...g,d:y,dataValue:f,fill:r})},Tr=({ariaLabel:e,"aria-label":t,dataKey:r,fill:a,gap:n,innerRadius:i,radius:o,...s})=>{const c=String(r),{addError:u,canvasHeight:x,canvasWidth:h,data:p,dataTestId:f,halfChart:g}=l.useContext(pr),R=g?0:-Math.PI/2,A=l.useRef(R),E=p[c],T=Object.prototype.hasOwnProperty.call(p,c);l.useEffect(()=>{if(!T)return void u?.("PIE_CHART_PATH_ERROR",{error:X(c)});if(!E||0===E.length)return void u?.("PIE_CHART_PATH_ERROR",{error:V(c)});const e=E.reduce((e,t)=>e+t.value,0);(e<=0||isNaN(e))&&u?.("PIE_CHART_PATH_ERROR",{error:W(c,e)})},[E,T,c]);const _=p[c]?.reduce((e,t)=>e+t.value,0),y=1===p[c]?.length,v=i?S(i):void 0,C=o?S(o):void 0;return p[c]?.length?d.jsx("g",{children:p[c].map((r,i)=>l.createElement(Er,{...s,...r,key:`${i.toString()}`,ariaLabel:fr({ariaLabel:t||e,dataKey:c,index:i,groupName:r.name,groupValue:r.value}),canvasHeight:x,canvasWidth:h,color:r.color||a,dataKey:c,dataTestId:`${f}path-${i}`,gap:n,halfChart:g,index:i,innerRadius:v,radius:C,singleStroke:y,startAngle:A,total:_}))}):d.jsx(d.Fragment,{})},_r=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:r=$,caption:a,children:n,classNames:i,data:o,dataTestId:s="pie-chart",halfChart:c,height:x="100%",onErrors:p,radius:f="50%",role:g,tabIndex:R,width:A="100%",...E})=>{const T=h(s),{parsedCanvas:_,viewBox:y}=I({canvasConfig:r,dataTestId:T,height:x,width:A}),v=_.width,C=_.height,m=l.useMemo(()=>N(p),[p]),k=b(o),O=l.useMemo(()=>(m.clearErrors(),(({addError:e,canvasHeight:t,canvasWidth:r,children:a,halfChart:n})=>{(r<=0||t<=0)&&e?.("PIE_CHART_CONTEXT_ERROR",{error:xe(r,t)});const i=r>0?r:100,o=t>0?t:100;let s,c;l.Children.forEach(a,e=>{if(l.isValidElement(e)&&e.type===Tr){const{innerRadius:t}=e.props;if(!t)return;const r=S(t);(!s||r<s)&&(s=r)}}),s&&(c=2*s);const d=c??0,u=n?d/2:d,x=n?o:o/2;return{addError:e,foreignObject:{height:u,width:d,x:i/2-d/2,y:n?x-u:x-u/2}}})({addError:(e,t)=>{m.addError(e,t)},canvasHeight:C,canvasWidth:v,children:n,halfChart:c})),[C,v,c,k,m]);return d.jsx(u,{ariaHidden:e,ariaLabel:t,caption:a,className:i,dataTestId:T,height:x,radius:f,role:g,tabIndex:R,viewBox:y,width:A,...E,children:d.jsx(pr.Provider,{value:{...O,canvasHeight:C,canvasWidth:v,data:o,dataTestId:T,halfChart:c},children:n})})},{Foreign:({children:e,dataTestId:t,height:r,width:a,x:n,y:i,...o})=>{const{dataTestId:s,foreignObject:c}=l.useContext(pr),u=!a&&c?.width?c.width:a,x=!r&&c?.height?c.height:r,h=!n&&c?.x?c.x:n,p=!i&&c?.y?c.y:i,f=!t&&s?`${s}-foreign-object`:t;return d.jsx(hr,{...o,dataTestId:f,height:x,width:u,x:h,y:p,children:e})},Path:Tr}),yr=({fill:e="#8f8f8f",x:t,y:r})=>d.jsxs("g",{fill:e,pointerEvents:"none",transform:`translate(${t-5}, ${r-5})`,children:[d.jsx("path",{d:"M4.99948 9.99802C4.47168 9.99802 4.04419 9.64335 4.04419 9.20547V0.79255C4.04419 0.354666 4.47168 0 4.99948 0C5.52728 0 5.95477 0.354666 5.95477 0.79255V9.20745C5.95477 9.64533 5.52728 10 4.99948 10V9.99802Z"}),d.jsx("path",{d:"M0.955289 8.78839C0.427492 8.78839 0 8.43372 0 7.99584V2.00416C0 1.56628 0.427492 1.21161 0.955289 1.21161C1.48309 1.21161 1.91058 1.56628 1.91058 2.00416V7.99584C1.91058 8.43372 1.48309 8.78839 0.955289 8.78839Z"}),d.jsx("path",{d:"M8.08936 7.99584C8.08936 8.43372 8.51685 8.78839 9.04464 8.78839C9.57244 8.78839 9.99993 8.43372 9.99993 7.99584V2.00416C9.99993 1.56628 9.57244 1.21161 9.04464 1.21161C8.51685 1.21161 8.08936 1.56628 8.08936 2.00416V7.99584Z"})]}),vr=({linesData:e})=>d.jsx(d.Fragment,{children:e.map((e,t)=>d.jsxs("g",{children:[e.config.fill&&e.fillPath&&d.jsx("path",{d:e.fillPath,fill:e.config.fill,fillOpacity:e.config.fillOpacity||.2,stroke:"none"}),d.jsx("path",{d:e.linePath,fill:"none",stroke:e.config.stroke||"#0078D4",strokeWidth:e.config.strokeWidth||1})]},e.config.dataKey||e.config.yKey||t))}),Cr=(e,t,r)=>{const a=e.start/Math.max(1,t-1)*r;return{endX:e.end/Math.max(1,t-1)*r,startX:a}},mr=(e,t,r)=>{const a=Math.max(0,Math.min(t,e))/t;return Math.round(a*(r-1))},Sr=(e,t,r=.1)=>{const a=Math.max(0,Math.min(e.start,t-1-r));return{end:Math.min(t-1,Math.max(e.end,a+r)),start:a}},Ir=e=>({end:Math.max(0,e-1),start:0}),$r=(e,t)=>0===e.start&&e.end===t-1,Nr=l.forwardRef(({currentRange:e,dataLength:t,dataTestId:r,endX:a,height:n,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l,screenReaderText:u,selectionConfig:x,startX:h},p)=>{const f=x.hideOverlayOnFullRange&&$r(e,t);return d.jsx(d.Fragment,{children:d.jsx("rect",{ref:p,"aria-label":u,"aria-valuemax":t-1,"aria-valuemin":0,"aria-valuetext":u,cursor:"grab","data-testid":r,fill:x.fill,fillOpacity:x.fillOpacity,height:n,role:"slider",stroke:x.stroke,strokeWidth:x.strokeWidth,style:{outline:"none",visibility:f?"hidden":"visible"},tabIndex:0,width:a-h,x:h,y:0,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l})})});Nr.displayName="SelectionArea";const br="#8f8f8f",kr=({dataTestId:e,focusConfig:t,handlerConfig:r,height:a,isFocused:n,max:i,min:o,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:x,screenReaderText:h,x:p})=>{const f=a/2,g=(e=>({fill:e?.fill||"#ffffff",iconColor:e?.iconColor||br,radius:e?.radius||17,stroke:e?.stroke||br,strokeWidth:e?.strokeWidth||1,verticalLineStroke:e?.verticalLineStroke||br,verticalLineStrokeWidth:e?.verticalLineStrokeWidth||2}))(r);return d.jsxs("g",{"data-testid":`${e}-group`,children:[d.jsx("line",{pointerEvents:"none",stroke:g.verticalLineStroke,strokeWidth:g.verticalLineStrokeWidth,x1:p,x2:p,y1:0,y2:a}),d.jsx(be,{dataTestId:e,focusConfig:t,isFocused:n,children:d.jsx("circle",{"aria-label":h,"aria-valuemax":i,"aria-valuemin":o,"aria-valuetext":h,cursor:"ew-resize",cx:p,cy:f,"data-testid":e,fill:g.fill,r:g.radius,role:"slider",stroke:g.stroke,strokeWidth:g.strokeWidth,style:{outline:"none"},tabIndex:0,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:x})}),d.jsx(yr,{fill:g.iconColor,x:p,y:f})]})},Or={END_HANDLER:"END_HANDLER",SELECTION_AREA:"SELECTION_AREA",START_HANDLER:"START_HANDLER"},Lr=e=>{const{currentRange:t,dataLength:r,interactionConfig:a,onRangeChange:n,width:i}=e,o=l.useRef(null),[s,c]=l.useState(null),d=l.useCallback(e=>()=>{c(e)},[]),u=l.useCallback(e=>()=>{c(e)},[]),x=l.useCallback(e=>{if(!s||!o.current)return;const c=o.current;if(!c)return;const d=e-c.getBoundingClientRect().left,l=mr(d,i,r),u=((e,t,r,a,n)=>{const i={...t};if(e===Or.START_HANDLER)i.start=Math.max(0,Math.min(r,t.end-n.minHandlerDistance));else if(e===Or.END_HANDLER)i.end=Math.min(a-1,Math.max(r,t.start+n.minHandlerDistance));else if(e===Or.SELECTION_AREA){const e=t.end-t.start,n=Math.max(0,Math.min(a-1-e,r-e/2));i.start=n,i.end=n+e}return i})(s,t,l,r,a),x=Sr(u,r,a.minHandlerDistance);n(x)},[s,i,r,t,n,a]),h=l.useCallback(e=>{x(e.clientX)},[x]),p=l.useCallback(e=>{0!==e.touches.length&&(e.preventDefault(),x(e.touches[0].clientX))},[x]),f=l.useCallback(()=>{c(null)},[]),g=l.useCallback(()=>{c(null)},[]);return l.useEffect(()=>{if(s)return document.addEventListener("mousemove",h),document.addEventListener("mouseup",f),document.addEventListener("touchmove",p,{passive:!1}),document.addEventListener("touchend",g),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",f),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",g)}},[s,h,f,p,g]),{groupRef:o,handleMouseDown:d,handleTouchStart:u,isDragging:s}},Hr=e=>{const{currentRange:t,dataLength:r,interactionConfig:a,onRangeChange:n}=e;return{handleKeyDown:l.useCallback(e=>i=>{const o=i.shiftKey?a.keyboardFastStep:a.keyboardStep;let s={...t};switch(i.key){case"ArrowLeft":case"ArrowDown":i.preventDefault(),s=((e,t,r,a)=>{const n={...t};if(e===Or.START_HANDLER)n.start=Math.max(0,t.start-r);else if(e===Or.END_HANDLER)n.end=Math.max(t.start+a.minHandlerDistance,t.end-r);else if(e===Or.SELECTION_AREA){const e=t.end-t.start,a=Math.max(0,t.start-r);n.start=a,n.end=a+e}return n})(e,t,o,a);break;case"ArrowRight":case"ArrowUp":i.preventDefault(),s=((e,t,r,a,n)=>{const i={...t};if(e===Or.START_HANDLER)i.start=Math.min(t.end-n.minHandlerDistance,t.start+r);else if(e===Or.END_HANDLER)i.end=Math.min(a-1,t.end+r);else if(e===Or.SELECTION_AREA){const e=t.end-t.start,n=Math.min(a-1-e,t.start+r);i.start=n,i.end=n+e}return i})(e,t,o,r,a);break;case"Home":i.preventDefault(),s=((e,t,r)=>{const a={...t};if(e===Or.START_HANDLER)a.start=0;else if(e===Or.END_HANDLER)a.end=r-1;else if(e===Or.SELECTION_AREA){const e=t.end-t.start;a.start=0,a.end=e}return a})(e,t,r);break;case"End":i.preventDefault(),s=((e,t,r,a)=>{const n={...t};if(e===Or.START_HANDLER)n.start=t.end-a.minHandlerDistance;else if(e===Or.END_HANDLER)n.end=r-1;else if(e===Or.SELECTION_AREA){const e=t.end-t.start;n.start=r-1-e,n.end=r-1}return n})(e,t,r,a);break;default:return}const c=Sr(s,r,a.minHandlerDistance);n(c)},[t,r,n,a])}},wr=()=>{const[e,t]=l.useState(null),r=l.useCallback(e=>()=>t(e),[]);return{handleBlur:l.useCallback(()=>{t(null)},[]),handleFocus:r,isFocused:l.useCallback(t=>e===t,[e])}},Mr=(e,t)=>{const r=Math.floor(e);return Math.max(0,Math.min(t,r))},Br=(e,t)=>{const r=Math.ceil(e);return Math.max(0,Math.min(t,r))},Pr=(e,t)=>{const r=Math.max(0,t-1);return{endIndex:Br(e.end,r),startIndex:Mr(e.start,r)}},Dr=({data:e,initialRange:t,onDataChange:r})=>{const a=t||Ir(e.length),[n,i]=l.useState(a),o=t=>{if(!r||0===e.length)return;const{endIndex:a,startIndex:n}=Pr(t,e.length),i=e.slice(n,a+1);r(i)};return l.useEffect(()=>{o(n)},[]),{currentRange:n,handleRangeChange:e=>{i(e),o(e)}}},jr=e=>({keyboardFastStep:e?.keyboardFastStep??2,keyboardStep:e?.keyboardStep??1,minHandlerDistance:e?.minHandlerDistance??1}),Fr=e=>{if(0===e.length)return"";if(1===e.length)return`M ${e[0][0]} ${e[0][1]}`;const[t,...r]=e;let a=`M ${t[0]} ${t[1]}`;return r.forEach((e,n)=>{const i=0===n?t:r[n-1],[o,s]=i,[c,d]=e,l=.3*(c-o),u=[o+l,s],x=[c-l,d];a+=` C ${u[0]} ${u[1]}, ${x[0]} ${x[1]}, ${c} ${d}`}),a},Xr=(e,t,r,a)=>{if(0===e.length||0===t.length)return[];const n=.05*a,i=a-2*n,o=t.flatMap(t=>e.map(e=>Number(e[t.yKey]))),s=Math.min(...o),c=Math.max(...o)-s||1;return t.map(t=>{const o=e.map((a,o)=>[o/Math.max(1,e.length-1)*r,n+i-(Number(a[t.yKey])-s)/c*i]),d=t.curved?Fr(o):`M ${o.map(([e,t])=>`${e},${t}`).join(" L ")}`;let l="";return t.fill&&(l=t.curved?`${Fr(o)} L ${r} ${a} L 0 ${a} Z`:`${d} L ${r},${a} L 0,${a} Z`),{config:t,fillPath:l,linePath:d}})},Vr=(e,t,r)=>e[r]?.[t]?.toString()||`${r}`,Wr=(e,t,r)=>{if(!e)return e;const a=new RegExp("{{startValue}}","g"),n=new RegExp("{{endValue}}","g");return e.replace(a,t).replace(n,r)};exports.Bar=qe,exports.BarChart=Et,exports.BarOrientation=O,exports.ChartText=at,exports.CustomBackgroundChart=Vt,exports.DefaultCanvasConfig=$,exports.ErrorType=L,exports.FOCUS_DEFAULT=_e,exports.FocusRing=be,exports.ForeignObject=hr,exports.HandlerIcon=yr,exports.Line=rt,exports.LineChart=xr,exports.LineRenderer=vr,exports.Node=Ue,exports.NodeType=We,exports.Path=Ge,exports.PieChart=_r,exports.Positions=H,exports.SelectionArea=Nr,exports.SvgContainer=u,exports.Tick=nt,exports.TickDataUtils=Qt,exports.XAxis=st,exports.YAxis=ut,exports.ZoomArea=({ariaHidden:e,ariaLabel:t,backgroundColor:r,canvasConfig:a,caption:n,classNames:i,data:o,focusConfig:s,handlerConfig:c,height:x="40px",initialRange:h,interactionConfig:p,lines:f,onDataChange:g,role:R,screenReaderTextConfig:A,selectionConfig:E,width:T="100%",xKey:_,...y})=>{const v="zoom-area",C=jr(p),m=(S=E,{fill:S?.fill??"#0078d4",fillOpacity:S?.fillOpacity??.5,hideOverlayOnFullRange:S?.hideOverlayOnFullRange??true,stroke:S?.stroke??"#0078d4",strokeWidth:S?.strokeWidth??0});var S;const{currentRange:$,handleRangeChange:N}=Dr({data:o,initialRange:h,onDataChange:g}),{parsedCanvas:k,viewBox:O}=I({canvasConfig:a,dataTestId:v,height:x,width:T}),L=b(o),H=JSON.stringify(f),w=l.useRef(null),M=((e,t,r,a)=>{const{endIndex:n,startIndex:i}=Pr(r,e.length),o=Vr(e,t,i),s=Vr(e,t,n),c=Wr(a?.startHandler,o,s)??o;return{endHandler:Wr(a?.endHandler,o,s)??s,selectionArea:Wr(a?.selectionArea,o,s)??`${o} - ${s}`,startHandler:c}})(o,_,$,A),B=l.useMemo(()=>Xr(o,f,k.width,k.height),[L,H,k.width,k.height]),{endX:P,startX:D}=l.useMemo(()=>Cr($,o.length,k.width),[$,L,k.width]),{handleBlur:j,handleFocus:F,isFocused:X}=wr(),{handleKeyDown:V}=Hr({currentRange:$,dataLength:o.length,interactionConfig:C,onRangeChange:N}),{groupRef:W,handleMouseDown:K,handleTouchStart:U}=Lr({currentRange:$,dataLength:o.length,interactionConfig:C,onRangeChange:N,width:k.width});return d.jsxs(u,{ref:W,ariaHidden:e,ariaLabel:t,backgroundColor:r,caption:n,className:i,"data-testid":v,height:x,overflow:"visible",role:R,viewBox:O,width:T,...y,children:[d.jsx(vr,{linesData:B}),d.jsx(Nr,{ref:w,currentRange:$,dataLength:o.length,dataTestId:`${v}-selection-area`,endX:P,height:k.height,screenReaderText:M.selectionArea,selectionConfig:m,startX:D,onBlur:j,onFocus:F(Or.SELECTION_AREA),onKeyDown:V(Or.SELECTION_AREA),onMouseDown:K(Or.SELECTION_AREA),onTouchStart:U(Or.SELECTION_AREA)}),d.jsx(kr,{dataTestId:`${v}-start-handler`,focusConfig:s,handlerConfig:c,height:k.height,isFocused:X(Or.START_HANDLER),max:$.end-C.minHandlerDistance,min:0,screenReaderText:M.startHandler,type:Or.START_HANDLER,value:$.start,x:D,onBlur:j,onFocus:F(Or.START_HANDLER),onKeyDown:V(Or.START_HANDLER),onMouseDown:K(Or.START_HANDLER),onTouchStart:U(Or.START_HANDLER)}),d.jsx(kr,{dataTestId:`${v}-end-handler`,focusConfig:s,handlerConfig:c,height:k.height,isFocused:X(Or.END_HANDLER),max:o.length-1,min:$.start+C.minHandlerDistance,screenReaderText:M.endHandler,type:Or.END_HANDLER,value:$.end,x:P,onBlur:j,onFocus:F(Or.END_HANDLER),onKeyDown:V(Or.END_HANDLER),onMouseDown:K(Or.END_HANDLER),onTouchStart:U(Or.END_HANDLER)}),d.jsx(be,{dataTestId:"selection-area-focus",focusConfig:{...s,variant:"bounding-box"},isFocused:X(Or.SELECTION_AREA),targetRef:w})]})},exports.ZoomAreaElements=Or,exports.ZoomHandler=kr,exports.calculateHandlerPositions=Cr,exports.calculateLinesPathData=Xr,exports.clampRange=Sr,exports.createDefaultRange=Ir,exports.generateCurvedPath=Fr,exports.getFocusConfig=ye,exports.getInteractionConfig=jr,exports.isFullRange=$r,exports.mouseToDataIndex=mr,exports.normalizeToArray=e=>Array.isArray(e)?e:[e],exports.useDragInteraction=Lr,exports.useKeyboardNavigation=Hr,exports.useZoomAreaFocus=wr,exports.useZoomData=Dr;
|