react-frontend-common-components 0.0.56 → 0.0.57

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/index.mjs CHANGED
@@ -41,7 +41,7 @@ import*as e from"react";import t,{version as n,isValidElement as o,useContext as
41
41
  * https://www.chartjs.org
42
42
  * (c) 2024 Chart.js Contributors
43
43
  * Released under the MIT License
44
- */class jR{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,o){const r=t.listeners[o],i=t.duration;r.forEach((o=>o({chart:e,initial:t.initial,numSteps:i,currentStep:Math.min(n-t.start,i)})))}_refresh(){this._request||(this._running=!0,this._request=UD.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(e=Date.now()){let t=0;this._charts.forEach(((n,o)=>{if(!n.running||!n.items.length)return;const r=n.items;let i,a=r.length-1,s=!1;for(;a>=0;--a)i=r[a],i._active?(i._total>n.duration&&(n.duration=i._total),i.tick(e),s=!0):(r[a]=r[r.length-1],r.pop());s&&(o.draw(),this._notify(o,n,e,"progress")),r.length||(n.running=!1,this._notify(o,n,e,"complete"),n.initial=!1),t+=r.length})),this._lastDate=e,0===t&&(this._running=!1)}_getAnims(e){const t=this._charts;let n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){t&&t.length&&this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce(((e,t)=>Math.max(e,t._duration)),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!!(t&&t.running&&t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const n=t.items;let o=n.length-1;for(;o>=0;--o)n[o].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var AR=new jR;const DR="transparent",TR={boolean:(e,t,n)=>n>.5?t:e,color(e,t,n){const o=oT(e||DR),r=o.valid&&oT(t||DR);return r&&r.valid?r.mix(o,n).hexString():t},number:(e,t,n)=>e+(t-e)*n};class RR{constructor(e,t,n,o){const r=t[n];o=BT([e.to,o,r,e.from]);const i=BT([e.from,r,o]);this._active=!0,this._fn=e.fn||TR[e.type||typeof i],this._easing=tT[e.easing]||tT.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=i,this._to=o,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);const o=this._target[this._prop],r=n-this._start,i=this._duration-r;this._start=n,this._duration=Math.floor(Math.max(i,e.duration)),this._total+=r,this._loop=!!e.loop,this._to=BT([e.to,t,o,e.from]),this._from=BT([e.from,o,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,n=this._duration,o=this._prop,r=this._from,i=this._loop,a=this._to;let s;if(this._active=r!==a&&(i||t<n),!this._active)return this._target[o]=a,void this._notify(!0);t<0?this._target[o]=r:(s=t/n%2,s=i&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[o]=this._fn(r,a,s))}wait(){const e=this._promises||(this._promises=[]);return new Promise(((t,n)=>{e.push({res:t,rej:n})}))}_notify(e){const t=e?"res":"rej",n=this._promises||[];for(let e=0;e<n.length;e++)n[e][t]()}}class _R{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!ZA(e))return;const t=Object.keys(mT.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach((o=>{const r=e[o];if(!ZA(r))return;const i={};for(const e of t)i[e]=r[e];(QA(r.properties)&&r.properties||[o]).forEach((e=>{e!==o&&n.has(e)||n.set(e,i)}))}))}_animateOptions(e,t){const n=t.options,o=function(e,t){if(!t)return;let n=e.options;if(!n)return void(e.options=t);n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}}));return n}(e,n);if(!o)return[];const r=this._createAnimations(o,n);return n.$shared&&function(e,t){const n=[],o=Object.keys(t);for(let t=0;t<o.length;t++){const r=e[o[t]];r&&r.active()&&n.push(r.wait())}return Promise.all(n)}(e.options.$animations,n).then((()=>{e.options=n}),(()=>{})),r}_createAnimations(e,t){const n=this._properties,o=[],r=e.$animations||(e.$animations={}),i=Object.keys(t),a=Date.now();let s;for(s=i.length-1;s>=0;--s){const l=i[s];if("$"===l.charAt(0))continue;if("options"===l){o.push(...this._animateOptions(e,t));continue}const c=t[l];let u=r[l];const d=n.get(l);if(u){if(d&&u.active()){u.update(d,c,a);continue}u.cancel()}d&&d.duration?(r[l]=u=new RR(d,e,l,c),o.push(u)):e[l]=c}return o}update(e,t){if(0===this._properties.size)return void Object.assign(e,t);const n=this._createAnimations(e,t);return n.length?(AR.add(this._chart,n),!0):void 0}}function zR(e,t){const n=e&&e.options||{},o=n.reverse,r=void 0===n.min?t:0,i=void 0===n.max?t:0;return{start:o?i:r,end:o?r:i}}function BR(e,t){const n=[],o=e._getSortedDatasetMetas(t);let r,i;for(r=0,i=o.length;r<i;++r)n.push(o[r].index);return n}function HR(e,t,n,o={}){const r=e.keys,i="single"===o.mode;let a,s,l,c;if(null!==t){for(a=0,s=r.length;a<s;++a){if(l=+r[a],l===n){if(o.all)continue;break}c=e.values[l],JA(c)&&(i||0===t||$D(t)===$D(c))&&(t+=c)}return t}}function FR(e,t){const n=e&&e.options.stacked;return n||void 0===n&&void 0!==t.stack}function WR(e,t,n){const o=e[t]||(e[t]={});return o[n]||(o[n]={})}function VR(e,t,n,o){for(const r of t.getMatchingVisibleMetas(o).reverse()){const t=e[r.index];if(n&&t>0||!n&&t<0)return r.index}return null}function KR(e,t){const{chart:n,_cachedMeta:o}=e,r=n._stacks||(n._stacks={}),{iScale:i,vScale:a,index:s}=o,l=i.axis,c=a.axis,u=function(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}(i,a,o),d=t.length;let p;for(let e=0;e<d;++e){const n=t[e],{[l]:i,[c]:d}=n;p=(n._stacks||(n._stacks={}))[c]=WR(r,u,i),p[s]=d,p._top=VR(p,a,!0,o.type),p._bottom=VR(p,a,!1,o.type);(p._visualValues||(p._visualValues={}))[s]=d}}function qR(e,t){const n=e.scales;return Object.keys(n).filter((e=>n[e].axis===t)).shift()}function XR(e,t){const n=e.controller.index,o=e.vScale&&e.vScale.axis;if(o){t=t||e._parsed;for(const e of t){const t=e._stacks;if(!t||void 0===t[o]||void 0===t[o][n])return;delete t[o][n],void 0!==t[o]._visualValues&&void 0!==t[o]._visualValues[n]&&delete t[o]._visualValues[n]}}}const UR=e=>"reset"===e||"none"===e,GR=(e,t)=>t?e:Object.assign({},e);class YR{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=FR(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&XR(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,n=this.getDataset(),o=(e,t,n,o)=>"x"===e?t:"r"===e?o:n,r=t.xAxisID=tD(n.xAxisID,qR(e,"x")),i=t.yAxisID=tD(n.yAxisID,qR(e,"y")),a=t.rAxisID=tD(n.rAxisID,qR(e,"r")),s=t.indexAxis,l=t.iAxisID=o(s,r,i,a),c=t.vAxisID=o(s,i,r,a);t.xScale=this.getScaleForId(r),t.yScale=this.getScaleForId(i),t.rScale=this.getScaleForId(a),t.iScale=this.getScaleForId(l),t.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&qD(this._data,this),e._stacked&&XR(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),n=this._data;if(ZA(t)){const e=this._cachedMeta;this._data=function(e,t){const{iScale:n,vScale:o}=t,r="x"===n.axis?"x":"y",i="x"===o.axis?"x":"y",a=Object.keys(e),s=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],s[l]={[r]:u,[i]:e[u]};return s}(t,e)}else if(n!==t){if(n){qD(n,this);const e=this._cachedMeta;XR(e),e._parsed=[]}t&&Object.isExtensible(t)&&function(e,t){e._chartjs?e._chartjs.listeners.push(t):(Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),KD.forEach((t=>{const n="_onData"+hD(t),o=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){const r=o.apply(this,t);return e._chartjs.listeners.forEach((e=>{"function"==typeof e[n]&&e[n](...t)})),r}})})))}(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,n=this.getDataset();let o=!1;this._dataCheck();const r=t._stacked;t._stacked=FR(t.vScale,t),t.stack!==n.stack&&(o=!0,XR(t),t.stack=n.stack),this._resyncElements(e),(o||r!==t._stacked)&&KR(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:n,_data:o}=this,{iScale:r,_stacked:i}=n,a=r.axis;let s,l,c,u=0===e&&t===o.length||n._sorted,d=e>0&&n._parsed[e-1];if(!1===this._parsing)n._parsed=o,n._sorted=!0,c=o;else{c=QA(o[e])?this.parseArrayData(n,o,e,t):ZA(o[e])?this.parseObjectData(n,o,e,t):this.parsePrimitiveData(n,o,e,t);const r=()=>null===l[a]||d&&l[a]<d[a];for(s=0;s<t;++s)n._parsed[s+e]=l=c[s],u&&(r()&&(u=!1),d=l);n._sorted=u}i&&KR(this,c)}parsePrimitiveData(e,t,n,o){const{iScale:r,vScale:i}=e,a=r.axis,s=i.axis,l=r.getLabels(),c=r===i,u=new Array(o);let d,p,f;for(d=0,p=o;d<p;++d)f=d+n,u[d]={[a]:c||r.parse(l[f],f),[s]:i.parse(t[f],f)};return u}parseArrayData(e,t,n,o){const{xScale:r,yScale:i}=e,a=new Array(o);let s,l,c,u;for(s=0,l=o;s<l;++s)c=s+n,u=t[c],a[s]={x:r.parse(u[0],c),y:i.parse(u[1],c)};return a}parseObjectData(e,t,n,o){const{xScale:r,yScale:i}=e,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l=new Array(o);let c,u,d,p;for(c=0,u=o;c<u;++c)d=c+n,p=t[d],l[c]={x:r.parse(fD(p,a),d),y:i.parse(fD(p,s),d)};return l}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,n){const o=this.chart,r=this._cachedMeta,i=t[e.axis];return HR({keys:BR(o,!0),values:t._stacks[e.axis]._visualValues},i,r.index,{mode:n})}updateRangeFromParsed(e,t,n,o){const r=n[t.axis];let i=null===r?NaN:r;const a=o&&n._stacks[t.axis];o&&a&&(o.values=a,i=HR(o,r,this._cachedMeta.index)),e.min=Math.min(e.min,i),e.max=Math.max(e.max,i)}getMinMax(e,t){const n=this._cachedMeta,o=n._parsed,r=n._sorted&&e===n.iScale,i=o.length,a=this._getOtherScale(e),s=((e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:BR(n,!0),values:null})(t,n,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:u}=function(e){const{min:t,max:n,minDefined:o,maxDefined:r}=e.getUserBounds();return{min:o?t:Number.NEGATIVE_INFINITY,max:r?n:Number.POSITIVE_INFINITY}}(a);let d,p;function f(){p=o[d];const t=p[a.axis];return!JA(p[e.axis])||c>t||u<t}for(d=0;d<i&&(f()||(this.updateRangeFromParsed(l,e,p,s),!r));++d);if(r)for(d=i-1;d>=0;--d)if(!f()){this.updateRangeFromParsed(l,e,p,s);break}return l}getAllParsedValues(e){const t=this._cachedMeta._parsed,n=[];let o,r,i;for(o=0,r=t.length;o<r;++o)i=t[o][e.axis],JA(i)&&n.push(i);return n}getMaxOverflow(){return!1}getLabelAndValue(e){const t=this._cachedMeta,n=t.iScale,o=t.vScale,r=this.getParsed(e);return{label:n?""+n.getLabelForValue(r[n.axis]):"",value:o?""+o.getLabelForValue(r[o.axis]):""}}_update(e){const t=this._cachedMeta;this.update(e||"default"),t._clip=function(e){let t,n,o,r;return ZA(e)?(t=e.top,n=e.right,o=e.bottom,r=e.left):t=n=o=r=e,{top:t,right:n,bottom:o,left:r,disabled:!1===e}}(tD(this.options.clip,function(e,t,n){if(!1===n)return!1;const o=zR(e,n),r=zR(t,n);return{top:r.end,right:o.end,bottom:r.start,left:o.start}}(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,t=this.chart,n=this._cachedMeta,o=n.data||[],r=t.chartArea,i=[],a=this._drawStart||0,s=this._drawCount||o.length-a,l=this.options.drawActiveElementsOnTop;let c;for(n.dataset&&n.dataset.draw(e,r,a,s),c=a;c<a+s;++c){const t=o[c];t.hidden||(t.active&&l?i.push(t):t.draw(e,r))}for(c=0;c<i.length;++c)i[c].draw(e,r)}getStyle(e,t){const n=t?"active":"default";return void 0===e&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,t,n){const o=this.getDataset();let r;if(e>=0&&e<this._cachedMeta.data.length){const t=this._cachedMeta.data[e];r=t.$context||(t.$context=function(e,t,n){return HT(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}(this.getContext(),e,t)),r.parsed=this.getParsed(e),r.raw=o.data[e],r.index=r.dataIndex=e}else r=this.$context||(this.$context=function(e,t){return HT(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),r.dataset=o,r.index=r.datasetIndex=this.index;return r.active=!!t,r.mode=n,r}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",n){const o="active"===t,r=this._cachedDataOpts,i=e+"-"+t,a=r[i],s=this.enableOptionSharing&&gD(n);if(a)return GR(a,s);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,e),u=o?[`${e}Hover`,"hover",e,""]:[e,""],d=l.getOptionScopes(this.getDataset(),c),p=Object.keys(mT.elements[e]),f=l.resolveNamedOptions(d,p,(()=>this.getContext(n,o,t)),u);return f.$shared&&(f.$shared=s,r[i]=Object.freeze(GR(f,s))),f}_resolveAnimations(e,t,n){const o=this.chart,r=this._cachedDataOpts,i=`animation-${t}`,a=r[i];if(a)return a;let s;if(!1!==o.options.animation){const o=this.chart.config,r=o.datasetAnimationScopeKeys(this._type,t),i=o.getOptionScopes(this.getDataset(),r);s=o.createResolver(i,this.getContext(e,n,t))}const l=new _R(o,s&&s.animations);return s&&s._cacheable&&(r[i]=Object.freeze(l)),l}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||UR(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const n=this.resolveDataElementOptions(e,t),o=this._sharedOptions,r=this.getSharedOptions(n),i=this.includeOptions(t,r)||r!==o;return this.updateSharedOptions(r,t,n),{sharedOptions:r,includeOptions:i}}updateElement(e,t,n,o){UR(o)?Object.assign(e,n):this._resolveAnimations(t,o).update(e,n)}updateSharedOptions(e,t,n){e&&!UR(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,o){e.active=o;const r=this.getStyle(t,o);this._resolveAnimations(t,n,o).update(e,{options:!o&&this.getSharedOptions(r)||r})}removeHoverStyle(e,t,n){this._setStyle(e,n,"active",!1)}setHoverStyle(e,t,n){this._setStyle(e,n,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,n=this._cachedMeta.data;for(const[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];const o=n.length,r=t.length,i=Math.min(r,o);i&&this.parse(0,i),r>o?this._insertElements(o,r-o,e):r<o&&this._removeElements(r,o-r)}_insertElements(e,t,n=!0){const o=this._cachedMeta,r=o.data,i=e+t;let a;const s=e=>{for(e.length+=t,a=e.length-1;a>=i;a--)e[a]=e[a-t]};for(s(r),a=e;a<i;++a)r[a]=new this.dataElementType;this._parsing&&s(o._parsed),this.parse(e,t),n&&this.updateElements(r,e,t,"reset")}updateElements(e,t,n,o){}_removeElements(e,t){const n=this._cachedMeta;if(this._parsing){const o=n._parsed.splice(e,t);n._stacked&&XR(n,o)}n.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[t,n,o]=e;this[t](n,o)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);const n=arguments.length-2;n&&this._sync(["_insertElements",e,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function QR(e){const t=e.iScale,n=function(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let o=[];for(let t=0,r=n.length;t<r;t++)o=o.concat(n[t].controller.getAllParsedValues(e));e._cache.$bar=XD(o.sort(((e,t)=>e-t)))}return e._cache.$bar}(t,e.type);let o,r,i,a,s=t._length;const l=()=>{32767!==i&&-32768!==i&&(gD(a)&&(s=Math.min(s,Math.abs(i-a)||s)),a=i)};for(o=0,r=n.length;o<r;++o)i=t.getPixelForValue(n[o]),l();for(a=void 0,o=0,r=t.ticks.length;o<r;++o)i=t.getPixelForTick(o),l();return s}function ZR(e,t,n,o){return QA(e)?function(e,t,n,o){const r=n.parse(e[0],o),i=n.parse(e[1],o),a=Math.min(r,i),s=Math.max(r,i);let l=a,c=s;Math.abs(a)>Math.abs(s)&&(l=s,c=a),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:r,end:i,min:a,max:s}}(e,t,n,o):t[n.axis]=n.parse(e,o),t}function JR(e,t,n,o){const r=e.iScale,i=e.vScale,a=r.getLabels(),s=r===i,l=[];let c,u,d,p;for(c=n,u=n+o;c<u;++c)p=t[c],d={},d[r.axis]=s||r.parse(a[c],c),l.push(ZR(p,d,i,c));return l}function e_(e){return e&&void 0!==e.barStart&&void 0!==e.barEnd}function t_(e,t,n,o){let r=t.borderSkipped;const i={};if(!r)return void(e.borderSkipped=i);if(!0===r)return void(e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:s,reverse:l,top:c,bottom:u}=function(e){let t,n,o,r,i;return e.horizontal?(t=e.base>e.x,n="left",o="right"):(t=e.base<e.y,n="bottom",o="top"),t?(r="end",i="start"):(r="start",i="end"),{start:n,end:o,reverse:t,top:r,bottom:i}}(e);"middle"===r&&n&&(e.enableBorderRadius=!0,(n._top||0)===o?r=c:(n._bottom||0)===o?r=u:(i[n_(u,a,s,l)]=!0,r=c)),i[n_(r,a,s,l)]=!0,e.borderSkipped=i}function n_(e,t,n,o){var r,i,a;return o?(a=n,e=o_(e=(r=e)===(i=t)?a:r===a?i:r,n,t)):e=o_(e,t,n),e}function o_(e,t,n){return"start"===e?t:"end"===e?n:e}function r_(e,{inflateAmount:t},n){e.inflateAmount="auto"===t?1===n?.33:0:t}class i_ extends YR{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(e,t,n,o){return JR(e,t,n,o)}parseArrayData(e,t,n,o){return JR(e,t,n,o)}parseObjectData(e,t,n,o){const{iScale:r,vScale:i}=e,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l="x"===r.axis?a:s,c="x"===i.axis?a:s,u=[];let d,p,f,h;for(d=n,p=n+o;d<p;++d)h=t[d],f={},f[r.axis]=r.parse(fD(h,l),d),u.push(ZR(fD(h,c),f,i,d));return u}updateRangeFromParsed(e,t,n,o){super.updateRangeFromParsed(e,t,n,o);const r=n._custom;r&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,r.min),e.max=Math.max(e.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const t=this._cachedMeta,{iScale:n,vScale:o}=t,r=this.getParsed(e),i=r._custom,a=e_(i)?"["+i.start+", "+i.end+"]":""+o.getLabelForValue(r[o.axis]);return{label:""+n.getLabelForValue(r[n.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(e){const t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,n,o){const r="reset"===o,{index:i,_cachedMeta:{vScale:a}}=this,s=a.getBasePixel(),l=a.isHorizontal(),c=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(t,o);for(let p=t;p<t+n;p++){const t=this.getParsed(p),n=r||YA(t[a.axis])?{base:s,head:s}:this._calculateBarValuePixels(p),f=this._calculateBarIndexPixels(p,c),h=(t._stacks||{})[a.axis],g={horizontal:l,base:n.base,enableBorderRadius:!h||e_(t._custom)||i===h._top||i===h._bottom,x:l?n.head:f.center,y:l?f.center:n.head,height:l?f.size:Math.abs(n.size),width:l?Math.abs(n.size):f.size};d&&(g.options=u||this.resolveDataElementOptions(p,e[p].active?"active":o));const m=g.options||e[p].options;t_(g,m,h,i),r_(g,m,c.ratio),this.updateElement(e[p],p,g,o)}}_getStacks(e,t){const{iScale:n}=this._cachedMeta,o=n.getMatchingVisibleMetas(this._type).filter((e=>e.controller.options.grouped)),r=n.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(t),s=a&&a[n.axis],l=e=>{const t=e._parsed.find((e=>e[n.axis]===s)),o=t&&t[e.vScale.axis];if(YA(o)||isNaN(o))return!0};for(const n of o)if((void 0===t||!l(n))&&((!1===r||-1===i.indexOf(n.stack)||void 0===r&&void 0===n.stack)&&i.push(n.stack),n.index===e))break;return i.length||i.push(void 0),i}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,n){const o=this._getStacks(e,n),r=void 0!==t?o.indexOf(t):-1;return-1===r?o.length-1:r}_getRuler(){const e=this.options,t=this._cachedMeta,n=t.iScale,o=[];let r,i;for(r=0,i=t.data.length;r<i;++r)o.push(n.getPixelForValue(this.getParsed(r)[n.axis],r));const a=e.barThickness;return{min:a||QR(t),pixels:o,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:a?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:t,_stacked:n,index:o},options:{base:r,minBarLength:i}}=this,a=r||0,s=this.getParsed(e),l=s._custom,c=e_(l);let u,d,p=s[t.axis],f=0,h=n?this.applyStack(t,s,n):p;h!==p&&(f=h-p,h=p),c&&(p=l.barStart,h=l.barEnd-l.barStart,0!==p&&$D(p)!==$D(l.barEnd)&&(f=0),f+=p);const g=YA(r)||c?f:r;let m=t.getPixelForValue(g);if(u=this.chart.getDataVisibility(e)?t.getPixelForValue(f+h):m,d=u-m,Math.abs(d)<i){d=function(e,t,n){return 0!==e?$D(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}(d,t,a)*i,p===a&&(m-=d/2);const e=t.getPixelForDecimal(0),r=t.getPixelForDecimal(1),l=Math.min(e,r),f=Math.max(e,r);m=Math.max(Math.min(m,f),l),u=m+d,n&&!c&&(s._stacks[t.axis]._visualValues[o]=t.getValueForPixel(u)-t.getValueForPixel(m))}if(m===t.getPixelForValue(a)){const e=$D(d)*t.getLineWidthForValue(a)/2;m+=e,d-=e}return{size:d,base:m,head:u,center:u+d/2}}_calculateBarIndexPixels(e,t){const n=t.scale,o=this.options,r=o.skipNull,i=tD(o.maxBarThickness,1/0);let a,s;if(t.grouped){const n=r?this._getStackCount(e):t.stackCount,l="flex"===o.barThickness?function(e,t,n,o){const r=t.pixels,i=r[e];let a=e>0?r[e-1]:null,s=e<r.length-1?r[e+1]:null;const l=n.categoryPercentage;null===a&&(a=i-(null===s?t.end-t.start:s-i)),null===s&&(s=i+i-a);const c=i-(i-Math.min(a,s))/2*l;return{chunk:Math.abs(s-a)/2*l/o,ratio:n.barPercentage,start:c}}(e,t,o,n):function(e,t,n,o){const r=n.barThickness;let i,a;return YA(r)?(i=t.min*n.categoryPercentage,a=n.barPercentage):(i=r*o,a=1),{chunk:i/o,ratio:a,start:t.pixels[e]-i/2}}(e,t,o,n),c=this._getStackIndex(this.index,this._cachedMeta.stack,r?e:void 0);a=l.start+l.chunk*c+l.chunk/2,s=Math.min(i,l.chunk*l.ratio)}else a=n.getPixelForValue(this.getParsed(e)[n.axis],e),s=Math.min(i,t.min*t.ratio);return{base:a-s/2,head:a+s/2,center:a,size:s}}draw(){const e=this._cachedMeta,t=e.vScale,n=e.data,o=n.length;let r=0;for(;r<o;++r)null===this.getParsed(r)[t.axis]||n[r].hidden||n[r].draw(this._ctx)}}class a_ extends YR{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:e=>"spacing"!==e,_indexable:e=>"spacing"!==e&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const t=e.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:n,color:o}}=e.legend.options;return t.labels.map(((t,r)=>{const i=e.getDatasetMeta(0).controller.getStyle(r);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,fontColor:o,lineWidth:i.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(r),index:r}}))}return[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){const n=this.getDataset().data,o=this._cachedMeta;if(!1===this._parsing)o._parsed=n;else{let r,i,a=e=>+n[e];if(ZA(n[e])){const{key:e="value"}=this._parsing;a=t=>+fD(n[t],e)}for(r=e,i=e+t;r<i;++r)o._parsed[r]=a(r)}}_getRotation(){return LD(this.options.rotation-90)}_getCircumference(){return LD(this.options.circumference)}_getRotationExtents(){let e=yD,t=-yD;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const o=this.chart.getDatasetMeta(n).controller,r=o._getRotation(),i=o._getCircumference();e=Math.min(e,r),t=Math.max(t,r+i)}return{rotation:e,circumference:t-e}}update(e){const t=this.chart,{chartArea:n}=t,o=this._cachedMeta,r=o.data,i=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(n.width,n.height)-i)/2,0),s=Math.min((l=this.options.cutout,c=a,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const u=this._getRingWeight(this.index),{circumference:d,rotation:p}=this._getRotationExtents(),{ratioX:f,ratioY:h,offsetX:g,offsetY:m}=function(e,t,n){let o=1,r=1,i=0,a=0;if(t<yD){const s=e,l=s+t,c=Math.cos(s),u=Math.sin(s),d=Math.cos(l),p=Math.sin(l),f=(e,t,o)=>zD(e,s,l,!0)?1:Math.max(t,t*n,o,o*n),h=(e,t,o)=>zD(e,s,l,!0)?-1:Math.min(t,t*n,o,o*n),g=f(0,c,d),m=f(SD,u,p),v=h(bD,c,d),b=h(bD+SD,u,p);o=(g-v)/2,r=(m-b)/2,i=-(g+v)/2,a=-(m+b)/2}return{ratioX:o,ratioY:r,offsetX:i,offsetY:a}}(p,d,s),v=(n.width-i)/f,b=(n.height-i)/h,y=Math.max(Math.min(v,b)/2,0),x=nD(this.options.radius,y),C=(x-Math.max(x*s,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=m*x,o.total=this.calculateTotal(),this.outerRadius=x-C*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-C*u,0),this.updateElements(r,0,r.length,e)}_circumference(e,t){const n=this.options,o=this._cachedMeta,r=this._getCircumference();return t&&n.animation.animateRotate||!this.chart.getDataVisibility(e)||null===o._parsed[e]||o.data[e].hidden?0:this.calculateCircumference(o._parsed[e]*r/yD)}updateElements(e,t,n,o){const r="reset"===o,i=this.chart,a=i.chartArea,s=i.options.animation,l=(a.left+a.right)/2,c=(a.top+a.bottom)/2,u=r&&s.animateScale,d=u?0:this.innerRadius,p=u?0:this.outerRadius,{sharedOptions:f,includeOptions:h}=this._getSharedOptions(t,o);let g,m=this._getRotation();for(g=0;g<t;++g)m+=this._circumference(g,r);for(g=t;g<t+n;++g){const t=this._circumference(g,r),n=e[g],i={x:l+this.offsetX,y:c+this.offsetY,startAngle:m,endAngle:m+t,circumference:t,outerRadius:p,innerRadius:d};h&&(i.options=f||this.resolveDataElementOptions(g,n.active?"active":o)),m+=t,this.updateElement(n,g,i,o)}}calculateTotal(){const e=this._cachedMeta,t=e.data;let n,o=0;for(n=0;n<t.length;n++){const r=e._parsed[n];null===r||isNaN(r)||!this.chart.getDataVisibility(n)||t[n].hidden||(o+=Math.abs(r))}return o}calculateCircumference(e){const t=this._cachedMeta.total;return t>0&&!isNaN(e)?yD*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,n=this.chart,o=n.data.labels||[],r=lT(t._parsed[e],n.options.locale);return{label:o[e]||"",value:r}}getMaxBorderWidth(e){let t=0;const n=this.chart;let o,r,i,a,s;if(!e)for(o=0,r=n.data.datasets.length;o<r;++o)if(n.isDatasetVisible(o)){i=n.getDatasetMeta(o),e=i.data,a=i.controller;break}if(!e)return 0;for(o=0,r=e.length;o<r;++o)s=a.resolveDataElementOptions(o),"inner"!==s.borderAlign&&(t=Math.max(t,s.borderWidth||0,s.hoverBorderWidth||0));return t}getMaxOffset(e){let t=0;for(let n=0,o=e.length;n<o;++n){const e=this.resolveDataElementOptions(n);t=Math.max(t,e.offset||0,e.hoverOffset||0)}return t}_getRingWeightOffset(e){let t=0;for(let n=0;n<e;++n)this.chart.isDatasetVisible(n)&&(t+=this._getRingWeight(n));return t}_getRingWeight(e){return Math.max(tD(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class s_ extends YR{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:n,data:o=[],_dataset:r}=t,i=this.chart._animationsDisabled;let{start:a,count:s}=function(e,t,n){const o=t.length;let r=0,i=o;if(e._sorted){const{iScale:a,_parsed:s}=e,l=a.axis,{min:c,max:u,minDefined:d,maxDefined:p}=a.getUserBounds();d&&(r=BD(Math.min(WD(s,l,c).lo,n?o:WD(t,l,a.getPixelForValue(c)).lo),0,o-1)),i=p?BD(Math.max(WD(s,a.axis,u,!0).hi+1,n?0:WD(t,l,a.getPixelForValue(u),!0).hi+1),r,o)-r:o-r}return{start:r,count:i}}(t,o,i);this._drawStart=a,this._drawCount=s,function(e){const{xScale:t,yScale:n,_scaleRanges:o}=e,r={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!o)return e._scaleRanges=r,!0;const i=o.xmin!==t.min||o.xmax!==t.max||o.ymin!==n.min||o.ymax!==n.max;return Object.assign(o,r),i}(t)&&(a=0,s=o.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=o;const l=this.resolveDatasetElementOptions(e);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(n,void 0,{animated:!i,options:l},e),this.updateElements(o,a,s,e)}updateElements(e,t,n,o){const r="reset"===o,{iScale:i,vScale:a,_stacked:s,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:u}=this._getSharedOptions(t,o),d=i.axis,p=a.axis,{spanGaps:f,segment:h}=this.options,g=ID(f)?f:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||r||"none"===o,v=t+n,b=e.length;let y=t>0&&this.getParsed(t-1);for(let n=0;n<b;++n){const f=e[n],b=m?f:{};if(n<t||n>=v){b.skip=!0;continue}const x=this.getParsed(n),C=YA(x[p]),w=b[d]=i.getPixelForValue(x[d],n),S=b[p]=r||C?a.getBasePixel():a.getPixelForValue(s?this.applyStack(a,x,s):x[p],n);b.skip=isNaN(w)||isNaN(S)||C,b.stop=n>0&&Math.abs(x[d]-y[d])>g,h&&(b.parsed=x,b.raw=l.data[n]),u&&(b.options=c||this.resolveDataElementOptions(n,f.active?"active":o)),m||this.updateElement(f,n,b,o),y=x}}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,o=e.data||[];if(!o.length)return n;const r=o[0].size(this.resolveDataElementOptions(0)),i=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(n,r,i)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}class l_ extends a_{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}function c_(e,t,n,o){const{controller:r,data:i,_sorted:a}=e,s=r._cachedMeta.iScale;if(s&&t===s.axis&&"r"!==t&&a&&i.length){const e=s._reversePixels?VD:WD;if(!o)return e(i,t,n);if(r._sharedOptions){const o=i[0],r="function"==typeof o.getRange&&o.getRange(t);if(r){const o=e(i,t,n-r),a=e(i,t,n+r);return{lo:o.lo,hi:a.hi}}}}return{lo:0,hi:i.length-1}}function u_(e,t,n,o,r){const i=e.getSortedVisibleDatasetMetas(),a=n[t];for(let e=0,n=i.length;e<n;++e){const{index:n,data:s}=i[e],{lo:l,hi:c}=c_(i[e],t,a,r);for(let e=l;e<=c;++e){const t=s[e];t.skip||o(t,n,e)}}}function d_(e,t,n,o,r){const i=[];if(!r&&!e.isPointInArea(t))return i;return u_(e,n,t,(function(n,a,s){(r||wT(n,e.chartArea,0))&&n.inRange(t.x,t.y,o)&&i.push({element:n,datasetIndex:a,index:s})}),!0),i}function p_(e,t,n,o,r,i){let a=[];const s=function(e){const t=-1!==e.indexOf("x"),n=-1!==e.indexOf("y");return function(e,o){const r=t?Math.abs(e.x-o.x):0,i=n?Math.abs(e.y-o.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(i,2))}}(n);let l=Number.POSITIVE_INFINITY;return u_(e,n,t,(function(n,c,u){const d=n.inRange(t.x,t.y,r);if(o&&!d)return;const p=n.getCenterPoint(r);if(!(!!i||e.isPointInArea(p))&&!d)return;const f=s(t,p);f<l?(a=[{element:n,datasetIndex:c,index:u}],l=f):f===l&&a.push({element:n,datasetIndex:c,index:u})})),a}function f_(e,t,n,o,r,i){return i||e.isPointInArea(t)?"r"!==n||o?p_(e,t,n,o,r,i):function(e,t,n,o){let r=[];return u_(e,n,t,(function(e,n,i){const{startAngle:a,endAngle:s}=e.getProps(["startAngle","endAngle"],o),{angle:l}=DD(e,{x:t.x,y:t.y});zD(l,a,s)&&r.push({element:e,datasetIndex:n,index:i})})),r}(e,t,n,r):[]}function h_(e,t,n,o,r){const i=[],a="x"===n?"inXRange":"inYRange";let s=!1;return u_(e,n,t,((e,o,l)=>{e[a]&&e[a](t[n],r)&&(i.push({element:e,datasetIndex:o,index:l}),s=s||e.inRange(t.x,t.y,r))})),o&&!s?[]:i}var g_={evaluateInteractionItems:u_,modes:{index(e,t,n,o){const r=gR(t,e),i=n.axis||"x",a=n.includeInvisible||!1,s=n.intersect?d_(e,r,i,o,a):f_(e,r,i,!1,o,a),l=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach((e=>{const t=s[0].index,n=e.data[t];n&&!n.skip&&l.push({element:n,datasetIndex:e.index,index:t})})),l):[]},dataset(e,t,n,o){const r=gR(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;let s=n.intersect?d_(e,r,i,o,a):f_(e,r,i,!1,o,a);if(s.length>0){const t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;e<n.length;++e)s.push({element:n[e],datasetIndex:t,index:e})}return s},point:(e,t,n,o)=>d_(e,gR(t,e),n.axis||"xy",o,n.includeInvisible||!1),nearest(e,t,n,o){const r=gR(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;return f_(e,r,i,n.intersect,o,a)},x:(e,t,n,o)=>h_(e,gR(t,e),"x",n.intersect,o),y:(e,t,n,o)=>h_(e,gR(t,e),"y",n.intersect,o)}};const m_=["left","top","right","bottom"];function v_(e,t){return e.filter((e=>e.pos===t))}function b_(e,t){return e.filter((e=>-1===m_.indexOf(e.pos)&&e.box.axis===t))}function y_(e,t){return e.sort(((e,n)=>{const o=t?n:e,r=t?e:n;return o.weight===r.weight?o.index-r.index:o.weight-r.weight}))}function x_(e,t){const n=function(e){const t={};for(const n of e){const{stack:e,pos:o,stackWeight:r}=n;if(!e||!m_.includes(o))continue;const i=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=r}return t}(e),{vBoxMaxWidth:o,hBoxMaxHeight:r}=t;let i,a,s;for(i=0,a=e.length;i<a;++i){s=e[i];const{fullSize:a}=s.box,l=n[s.stack],c=l&&s.stackWeight/l.weight;s.horizontal?(s.width=c?c*o:a&&t.availableWidth,s.height=r):(s.width=o,s.height=c?c*r:a&&t.availableHeight)}return n}function C_(e,t,n,o){return Math.max(e[n],t[n])+Math.max(e[o],t[o])}function w_(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function S_(e,t,n,o){const{pos:r,box:i}=n,a=e.maxPadding;if(!ZA(r)){n.size&&(e[r]-=n.size);const t=o[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?i.height:i.width),n.size=t.size/t.count,e[r]+=n.size}i.getPadding&&w_(a,i.getPadding());const s=Math.max(0,t.outerWidth-C_(a,e,"left","right")),l=Math.max(0,t.outerHeight-C_(a,e,"top","bottom")),c=s!==e.w,u=l!==e.h;return e.w=s,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function k_(e,t){const n=t.maxPadding;function o(e){const o={left:0,top:0,right:0,bottom:0};return e.forEach((e=>{o[e]=Math.max(t[e],n[e])})),o}return o(e?["left","right"]:["top","bottom"])}function E_(e,t,n,o){const r=[];let i,a,s,l,c,u;for(i=0,a=e.length,c=0;i<a;++i){s=e[i],l=s.box,l.update(s.width||t.w,s.height||t.h,k_(s.horizontal,t));const{same:a,other:d}=S_(t,n,s,o);c|=a&&r.length,u=u||d,l.fullSize||r.push(s)}return c&&E_(r,t,n,o)||u}function O_(e,t,n,o,r){e.top=n,e.left=t,e.right=t+o,e.bottom=n+r,e.width=o,e.height=r}function $_(e,t,n,o){const r=n.padding;let{x:i,y:a}=t;for(const s of e){const e=s.box,l=o[s.stack]||{count:1,placed:0,weight:1},c=s.stackWeight/l.weight||1;if(s.horizontal){const o=t.w*c,i=l.size||e.height;gD(l.start)&&(a=l.start),e.fullSize?O_(e,r.left,a,n.outerWidth-r.right-r.left,i):O_(e,t.left+l.placed,a,o,i),l.start=a,l.placed+=o,a=e.bottom}else{const o=t.h*c,a=l.size||e.width;gD(l.start)&&(i=l.start),e.fullSize?O_(e,i,r.top,a,n.outerHeight-r.bottom-r.top):O_(e,i,t.top+l.placed,a,o),l.start=i,l.placed+=o,i=e.right}}t.x=i,t.y=a}var N_={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;-1!==n&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,o){if(!e)return;const r=_T(e.options.layout.padding),i=Math.max(t-r.width,0),a=Math.max(n-r.height,0),s=function(e){const t=function(e){const t=[];let n,o,r,i,a,s;for(n=0,o=(e||[]).length;n<o;++n)r=e[n],({position:i,options:{stack:a,stackWeight:s=1}}=r),t.push({index:n,box:r,pos:i,horizontal:r.isHorizontal(),weight:r.weight,stack:a&&i+a,stackWeight:s});return t}(e),n=y_(t.filter((e=>e.box.fullSize)),!0),o=y_(v_(t,"left"),!0),r=y_(v_(t,"right")),i=y_(v_(t,"top"),!0),a=y_(v_(t,"bottom")),s=b_(t,"x"),l=b_(t,"y");return{fullSize:n,leftAndTop:o.concat(i),rightAndBottom:r.concat(l).concat(a).concat(s),chartArea:v_(t,"chartArea"),vertical:o.concat(r).concat(l),horizontal:i.concat(a).concat(s)}}(e.boxes),l=s.vertical,c=s.horizontal;rD(e.boxes,(e=>{"function"==typeof e.beforeLayout&&e.beforeLayout()}));const u=l.reduce(((e,t)=>t.box.options&&!1===t.box.options.display?e:e+1),0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:r,availableWidth:i,availableHeight:a,vBoxMaxWidth:i/2/u,hBoxMaxHeight:a/2}),p=Object.assign({},r);w_(p,_T(o));const f=Object.assign({maxPadding:p,w:i,h:a,x:r.left,y:r.top},r),h=x_(l.concat(c),d);E_(s.fullSize,f,d,h),E_(l,f,d,h),E_(c,f,d,h)&&E_(l,f,d,h),function(e){const t=e.maxPadding;function n(n){const o=Math.max(t[n]-e[n],0);return e[n]+=o,o}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}(f),$_(s.leftAndTop,f,d,h),f.x+=f.w,f.y+=f.h,$_(s.rightAndBottom,f,d,h),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},rD(s.chartArea,(t=>{const n=t.box;Object.assign(n,e.chartArea),n.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})}))}};class M_{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,o){return t=Math.max(0,t||e.width),n=n||e.height,{width:t,height:Math.max(0,o?Math.floor(t/o):n)}}isAttached(e){return!0}updateConfig(e){}}class I_ extends M_{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const P_="$chartjs",L_={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},j_=e=>null===e||""===e;const A_=!!yR&&{passive:!0};function D_(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,A_)}function T_(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function R_(e,t,n){const o=e.canvas,r=new MutationObserver((e=>{let t=!1;for(const n of e)t=t||T_(n.addedNodes,o),t=t&&!T_(n.removedNodes,o);t&&n()}));return r.observe(document,{childList:!0,subtree:!0}),r}function __(e,t,n){const o=e.canvas,r=new MutationObserver((e=>{let t=!1;for(const n of e)t=t||T_(n.removedNodes,o),t=t&&!T_(n.addedNodes,o);t&&n()}));return r.observe(document,{childList:!0,subtree:!0}),r}const z_=new Map;let B_=0;function H_(){const e=window.devicePixelRatio;e!==B_&&(B_=e,z_.forEach(((t,n)=>{n.currentDevicePixelRatio!==e&&t()})))}function F_(e,t,n){const o=e.canvas,r=o&&cR(o);if(!r)return;const i=GD(((e,t)=>{const o=r.clientWidth;n(e,t),o<r.clientWidth&&n()}),window),a=new ResizeObserver((e=>{const t=e[0],n=t.contentRect.width,o=t.contentRect.height;0===n&&0===o||i(n,o)}));return a.observe(r),function(e,t){z_.size||window.addEventListener("resize",H_),z_.set(e,t)}(e,i),a}function W_(e,t,n){n&&n.disconnect(),"resize"===t&&function(e){z_.delete(e),z_.size||window.removeEventListener("resize",H_)}(e)}function V_(e,t,n){const o=e.canvas,r=GD((t=>{null!==e.ctx&&n(function(e,t){const n=L_[e.type]||e.type,{x:o,y:r}=gR(e,t);return{type:n,chart:t,native:e,x:void 0!==o?o:null,y:void 0!==r?r:null}}(t,e))}),e);return function(e,t,n){e&&e.addEventListener(t,n,A_)}(o,t,r),r}class K_ extends M_{acquireContext(e,t){const n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(function(e,t){const n=e.style,o=e.getAttribute("height"),r=e.getAttribute("width");if(e[P_]={initial:{height:o,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",j_(r)){const t=xR(e,"width");void 0!==t&&(e.width=t)}if(j_(o))if(""===e.style.height)e.height=e.width/(t||2);else{const t=xR(e,"height");void 0!==t&&(e.height=t)}}(e,t),n):null}releaseContext(e){const t=e.canvas;if(!t[P_])return!1;const n=t[P_].initial;["height","width"].forEach((e=>{const o=n[e];YA(o)?t.removeAttribute(e):t.setAttribute(e,o)}));const o=n.style||{};return Object.keys(o).forEach((e=>{t.style[e]=o[e]})),t.width=t.width,delete t[P_],!0}addEventListener(e,t,n){this.removeEventListener(e,t);const o=e.$proxies||(e.$proxies={}),r={attach:R_,detach:__,resize:F_}[t]||V_;o[t]=r(e,t,n)}removeEventListener(e,t){const n=e.$proxies||(e.$proxies={}),o=n[t];if(!o)return;({attach:W_,detach:W_,resize:W_}[t]||D_)(e,t,o),n[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,o){return vR(e,t,n,o)}isAttached(e){const t=e&&cR(e);return!(!t||!t.isConnected)}}let q_=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){const{x:t,y:n}=this.getProps(["x","y"],e);return{x:t,y:n}}hasValue(){return ID(this.x)&&ID(this.y)}getProps(e,t){const n=this.$animations;if(!t||!n)return this;const o={};return e.forEach((e=>{o[e]=n[e]&&n[e].active()?n[e]._to:this[e]})),o}};function X_(e,t){const n=e.options.ticks,o=function(e){const t=e.options.offset,n=e._tickSize(),o=e._length/n+(t?0:1),r=e._maxLength/n;return Math.floor(Math.min(o,r))}(e),r=Math.min(n.maxTicksLimit||o,o),i=n.major.enabled?function(e){const t=[];let n,o;for(n=0,o=e.length;n<o;n++)e[n].major&&t.push(n);return t}(t):[],a=i.length,s=i[0],l=i[a-1],c=[];if(a>r)return function(e,t,n,o){let r,i=0,a=n[0];for(o=Math.ceil(o),r=0;r<e.length;r++)r===a&&(t.push(e[r]),i++,a=n[i*o])}(t,c,i,a/r),c;const u=function(e,t,n){const o=function(e){const t=e.length;let n,o;if(t<2)return!1;for(o=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==o)return!1;return o}(e),r=t.length/n;if(!o)return Math.max(r,1);const i=function(e){const t=[],n=Math.sqrt(e);let o;for(o=1;o<n;o++)e%o==0&&(t.push(o),t.push(e/o));return n===(0|n)&&t.push(n),t.sort(((e,t)=>e-t)).pop(),t}(o);for(let e=0,t=i.length-1;e<t;e++){const t=i[e];if(t>r)return t}return Math.max(r,1)}(i,t,r);if(a>0){let e,n;const o=a>1?Math.round((l-s)/(a-1)):null;for(U_(t,c,u,YA(o)?0:s-o,s),e=0,n=a-1;e<n;e++)U_(t,c,u,i[e],i[e+1]);return U_(t,c,u,l,YA(o)?t.length:l+o),c}return U_(t,c,u),c}function U_(e,t,n,o,r){const i=tD(o,0),a=Math.min(tD(r,e.length),e.length);let s,l,c,u=0;for(n=Math.ceil(n),r&&(s=r-o,n=s/Math.floor(s/n)),c=i;c<0;)u++,c=Math.round(i+u*n);for(l=Math.max(i,0);l<a;l++)l===c&&(t.push(e[l]),u++,c=Math.round(i+u*n))}const G_=(e,t,n)=>"top"===t||"left"===t?e[t]+n:e[t]-n,Y_=(e,t)=>Math.min(t||e,e);function Q_(e,t){const n=[],o=e.length/t,r=e.length;let i=0;for(;i<r;i+=o)n.push(e[Math.floor(i)]);return n}function Z_(e,t,n){const o=e.ticks.length,r=Math.min(t,o-1),i=e._startPixel,a=e._endPixel,s=1e-6;let l,c=e.getPixelForTick(r);if(!(n&&(l=1===o?Math.max(c-i,a-c):0===t?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(r-1))/2,c+=r<t?l:-l,c<i-s||c>a+s)))return c}function J_(e){return e.drawTicks?e.tickLength:0}function ez(e,t){if(!e.display)return 0;const n=zT(e.font,t),o=_T(e.padding);return(QA(e.text)?e.text.length:1)*n.lineHeight+o.height}function tz(e,t,n){let o=YD(e);return(n&&"right"!==t||!n&&"right"===t)&&(o=(e=>"left"===e?"right":"right"===e?"left":e)(o)),o}class nz extends q_{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:o}=this;return e=eD(e,Number.POSITIVE_INFINITY),t=eD(t,Number.NEGATIVE_INFINITY),n=eD(n,Number.POSITIVE_INFINITY),o=eD(o,Number.NEGATIVE_INFINITY),{min:eD(e,n),max:eD(t,o),minDefined:JA(e),maxDefined:JA(t)}}getMinMax(e){let t,{min:n,max:o,minDefined:r,maxDefined:i}=this.getUserBounds();if(r&&i)return{min:n,max:o};const a=this.getMatchingVisibleMetas();for(let s=0,l=a.length;s<l;++s)t=a[s].controller.getMinMax(this,e),r||(n=Math.min(n,t.min)),i||(o=Math.max(o,t.max));return n=i&&n>o?o:n,o=r&&n>o?n:o,{min:eD(n,eD(o,n)),max:eD(o,eD(n,o))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){oD(this.options.beforeUpdate,[this])}update(e,t,n){const{beginAtZero:o,grace:r,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(e,t,n){const{min:o,max:r}=e,i=nD(t,(r-o)/2),a=(e,t)=>n&&0===e?0:e+t;return{min:a(o,-Math.abs(i)),max:a(r,i)}}(this,r,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const s=a<this.ticks.length;this._convertTicksToLabels(s?Q_(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||"auto"===i.source)&&(this.ticks=X_(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e,t,n=this.options.reverse;this.isHorizontal()?(e=this.left,t=this.right):(e=this.top,t=this.bottom,n=!n),this._startPixel=e,this._endPixel=t,this._reversePixels=n,this._length=t-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){oD(this.options.afterUpdate,[this])}beforeSetDimensions(){oD(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){oD(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),oD(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){oD(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const t=this.options.ticks;let n,o,r;for(n=0,o=e.length;n<o;n++)r=e[n],r.label=oD(t.callback,[r.value,n,e],this)}afterTickToLabelConversion(){oD(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){oD(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,t=e.ticks,n=Y_(this.ticks.length,e.ticks.maxTicksLimit),o=t.minRotation||0,r=t.maxRotation;let i,a,s,l=o;if(!this._isVisible()||!t.display||o>=r||n<=1||!this.isHorizontal())return void(this.labelRotation=o);const c=this._getLabelSizes(),u=c.widest.width,d=c.highest.height,p=BD(this.chart.width-u,0,this.maxWidth);i=e.offset?this.maxWidth/n:p/(n-1),u+6>i&&(i=p/(n-(e.offset?.5:1)),a=this.maxHeight-J_(e.grid)-t.padding-ez(e.title,this.chart.options.font),s=Math.sqrt(u*u+d*d),l=jD(Math.min(Math.asin(BD((c.highest.height+6)/i,-1,1)),Math.asin(BD(a/s,-1,1))-Math.asin(BD(d/s,-1,1)))),l=Math.max(o,Math.min(r,l))),this.labelRotation=l}afterCalculateLabelRotation(){oD(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){oD(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:n,title:o,grid:r}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const i=ez(o,t.options.font);if(a?(e.width=this.maxWidth,e.height=J_(r)+i):(e.height=this.maxHeight,e.width=J_(r)+i),n.display&&this.ticks.length){const{first:t,last:o,widest:r,highest:i}=this._getLabelSizes(),s=2*n.padding,l=LD(this.labelRotation),c=Math.cos(l),u=Math.sin(l);if(a){const t=n.mirror?0:u*r.width+c*i.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{const t=n.mirror?0:c*r.width+u*i.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,o,u,c)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,o){const{ticks:{align:r,padding:i},position:a}=this.options,s=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,d=0;s?l?(u=o*e.width,d=n*t.height):(u=n*e.height,d=o*t.width):"start"===r?d=t.width:"end"===r?u=e.width:"inner"!==r&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-a+i)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-c+i)*this.width/(this.width-c),0)}else{let n=t.height/2,o=e.height/2;"start"===r?(n=0,o=e.height):"end"===r&&(n=t.height,o=0),this.paddingTop=n+i,this.paddingBottom=o+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){oD(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return"top"===t||"bottom"===t||"x"===e}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){let t,n;for(this.beforeTickToLabelConversion(),this.generateTickLabels(e),t=0,n=e.length;t<n;t++)YA(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const t=this.options.ticks.sampleSize;let n=this.ticks;t<n.length&&(n=Q_(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){const{ctx:o,_longestTextCache:r}=this,i=[],a=[],s=Math.floor(t/Y_(t,n));let l,c,u,d,p,f,h,g,m,v,b,y=0,x=0;for(l=0;l<t;l+=s){if(d=e[l].label,p=this._resolveTickFontOptions(l),o.font=f=p.string,h=r[f]=r[f]||{data:{},gc:[]},g=p.lineHeight,m=v=0,YA(d)||QA(d)){if(QA(d))for(c=0,u=d.length;c<u;++c)b=d[c],YA(b)||QA(b)||(m=vT(o,h.data,h.gc,m,b),v+=g)}else m=vT(o,h.data,h.gc,m,d),v=g;i.push(m),a.push(v),y=Math.max(m,y),x=Math.max(v,x)}!function(e,t){rD(e,(e=>{const n=e.gc,o=n.length/2;let r;if(o>t){for(r=0;r<o;++r)delete e.data[n[r]];n.splice(0,o)}}))}(r,t);const C=i.indexOf(y),w=a.indexOf(x),S=e=>({width:i[e]||0,height:a[e]||0});return{first:S(0),last:S(t-1),widest:S(C),highest:S(w),widths:i,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return BD(this._alignToPixels?bT(this.chart,t,0):t,-32768,32767)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&e<t.length){const n=t[e];return n.$context||(n.$context=function(e,t,n){return HT(e,{tick:n,index:t,type:"tick"})}(this.getContext(),e,n))}return this.$context||(this.$context=HT(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const e=this.options.ticks,t=LD(this.labelRotation),n=Math.abs(Math.cos(t)),o=Math.abs(Math.sin(t)),r=this._getLabelSizes(),i=e.autoSkipPadding||0,a=r?r.widest.width+i:0,s=r?r.highest.height+i:0;return this.isHorizontal()?s*n>a*o?a/n:s/o:s*o<a*n?s/n:a/o}_isVisible(){const e=this.options.display;return"auto"!==e?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const t=this.axis,n=this.chart,o=this.options,{grid:r,position:i,border:a}=o,s=r.offset,l=this.isHorizontal(),c=this.ticks.length+(s?1:0),u=J_(r),d=[],p=a.setContext(this.getContext()),f=p.display?p.width:0,h=f/2,g=function(e){return bT(n,e,f)};let m,v,b,y,x,C,w,S,k,E,O,$;if("top"===i)m=g(this.bottom),C=this.bottom-u,S=m-h,E=g(e.top)+h,$=e.bottom;else if("bottom"===i)m=g(this.top),E=e.top,$=g(e.bottom)-h,C=m+h,S=this.top+u;else if("left"===i)m=g(this.right),x=this.right-u,w=m-h,k=g(e.left)+h,O=e.right;else if("right"===i)m=g(this.left),k=e.left,O=g(e.right)-h,x=m+h,w=this.left+u;else if("x"===t){if("center"===i)m=g((e.top+e.bottom)/2+.5);else if(ZA(i)){const e=Object.keys(i)[0],t=i[e];m=g(this.chart.scales[e].getPixelForValue(t))}E=e.top,$=e.bottom,C=m+h,S=C+u}else if("y"===t){if("center"===i)m=g((e.left+e.right)/2);else if(ZA(i)){const e=Object.keys(i)[0],t=i[e];m=g(this.chart.scales[e].getPixelForValue(t))}x=m-h,w=x-u,k=e.left,O=e.right}const N=tD(o.ticks.maxTicksLimit,c),M=Math.max(1,Math.ceil(c/N));for(v=0;v<c;v+=M){const e=this.getContext(v),t=r.setContext(e),o=a.setContext(e),i=t.lineWidth,c=t.color,u=o.dash||[],p=o.dashOffset,f=t.tickWidth,h=t.tickColor,g=t.tickBorderDash||[],m=t.tickBorderDashOffset;b=Z_(this,v,s),void 0!==b&&(y=bT(n,b,i),l?x=w=k=O=y:C=S=E=$=y,d.push({tx1:x,ty1:C,tx2:w,ty2:S,x1:k,y1:E,x2:O,y2:$,width:i,color:c,borderDash:u,borderDashOffset:p,tickWidth:f,tickColor:h,tickBorderDash:g,tickBorderDashOffset:m}))}return this._ticksLength=c,this._borderValue=m,d}_computeLabelItems(e){const t=this.axis,n=this.options,{position:o,ticks:r}=n,i=this.isHorizontal(),a=this.ticks,{align:s,crossAlign:l,padding:c,mirror:u}=r,d=J_(n.grid),p=d+c,f=u?-c:p,h=-LD(this.labelRotation),g=[];let m,v,b,y,x,C,w,S,k,E,O,$,N="middle";if("top"===o)C=this.bottom-f,w=this._getXAxisLabelAlignment();else if("bottom"===o)C=this.top+f,w=this._getXAxisLabelAlignment();else if("left"===o){const e=this._getYAxisLabelAlignment(d);w=e.textAlign,x=e.x}else if("right"===o){const e=this._getYAxisLabelAlignment(d);w=e.textAlign,x=e.x}else if("x"===t){if("center"===o)C=(e.top+e.bottom)/2+p;else if(ZA(o)){const e=Object.keys(o)[0],t=o[e];C=this.chart.scales[e].getPixelForValue(t)+p}w=this._getXAxisLabelAlignment()}else if("y"===t){if("center"===o)x=(e.left+e.right)/2-p;else if(ZA(o)){const e=Object.keys(o)[0],t=o[e];x=this.chart.scales[e].getPixelForValue(t)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===t&&("start"===s?N="top":"end"===s&&(N="bottom"));const M=this._getLabelSizes();for(m=0,v=a.length;m<v;++m){b=a[m],y=b.label;const e=r.setContext(this.getContext(m));S=this.getPixelForTick(m)+r.labelOffset,k=this._resolveTickFontOptions(m),E=k.lineHeight,O=QA(y)?y.length:1;const t=O/2,n=e.color,s=e.textStrokeColor,c=e.textStrokeWidth;let d,p=w;if(i?(x=S,"inner"===w&&(p=m===v-1?this.options.reverse?"left":"right":0===m?this.options.reverse?"right":"left":"center"),$="top"===o?"near"===l||0!==h?-O*E+E/2:"center"===l?-M.highest.height/2-t*E+E:-M.highest.height+E/2:"near"===l||0!==h?E/2:"center"===l?M.highest.height/2-t*E:M.highest.height-O*E,u&&($*=-1),0===h||e.showLabelBackdrop||(x+=E/2*Math.sin(h))):(C=S,$=(1-O)*E/2),e.showLabelBackdrop){const t=_T(e.backdropPadding),n=M.heights[m],o=M.widths[m];let r=$-t.top,i=0-t.left;switch(N){case"middle":r-=n/2;break;case"bottom":r-=n}switch(w){case"center":i-=o/2;break;case"right":i-=o;break;case"inner":m===v-1?i-=o:m>0&&(i-=o/2)}d={left:i,top:r,width:o+t.width,height:n+t.height,color:e.backdropColor}}g.push({label:y,font:k,textOffset:$,options:{rotation:h,color:n,strokeColor:s,strokeWidth:c,textAlign:p,textBaseline:N,translation:[x,C],backdrop:d}})}return g}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-LD(this.labelRotation))return"top"===e?"left":"right";let n="center";return"start"===t.align?n="left":"end"===t.align?n="right":"inner"===t.align&&(n="inner"),n}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:n,mirror:o,padding:r}}=this.options,i=e+r,a=this._getLabelSizes().widest.width;let s,l;return"left"===t?o?(l=this.right+r,"near"===n?s="left":"center"===n?(s="center",l+=a/2):(s="right",l+=a)):(l=this.right-i,"near"===n?s="right":"center"===n?(s="center",l-=a/2):(s="left",l=this.left)):"right"===t?o?(l=this.left+r,"near"===n?s="right":"center"===n?(s="center",l-=a/2):(s="left",l-=a)):(l=this.left+i,"near"===n?s="left":"center"===n?(s="center",l+=a/2):(s="right",l=this.right)):s="right",{textAlign:s,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;return"left"===t||"right"===t?{top:0,left:this.left,bottom:e.height,right:this.right}:"top"===t||"bottom"===t?{top:this.top,left:0,bottom:this.bottom,right:e.width}:void 0}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:n,top:o,width:r,height:i}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,o,r,i),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const n=this.ticks.findIndex((t=>t.value===e));if(n>=0){return t.setContext(this.getContext(n)).lineWidth}return 0}drawGrid(e){const t=this.options.grid,n=this.ctx,o=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let r,i;const a=(e,t,o)=>{o.width&&o.color&&(n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.setLineDash(o.borderDash||[]),n.lineDashOffset=o.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(r=0,i=o.length;r<i;++r){const e=o[r];t.drawOnChartArea&&a({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&a({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:t,options:{border:n,grid:o}}=this,r=n.setContext(this.getContext()),i=n.display?r.width:0;if(!i)return;const a=o.setContext(this.getContext(0)).lineWidth,s=this._borderValue;let l,c,u,d;this.isHorizontal()?(l=bT(e,this.left,i)-i/2,c=bT(e,this.right,a)+a/2,u=d=s):(u=bT(e,this.top,i)-i/2,d=bT(e,this.bottom,a)+a/2,l=c=s),t.save(),t.lineWidth=r.width,t.strokeStyle=r.color,t.beginPath(),t.moveTo(l,u),t.lineTo(c,d),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;const t=this.ctx,n=this._computeLabelArea();n&&ST(t,n);const o=this.getLabelItems(e);for(const e of o){const n=e.options,o=e.font;MT(t,e.label,0,e.textOffset,o,n)}n&&kT(t)}drawTitle(){const{ctx:e,options:{position:t,title:n,reverse:o}}=this;if(!n.display)return;const r=zT(n.font),i=_T(n.padding),a=n.align;let s=r.lineHeight/2;"bottom"===t||"center"===t||ZA(t)?(s+=i.bottom,QA(n.text)&&(s+=r.lineHeight*(n.text.length-1))):s+=i.top;const{titleX:l,titleY:c,maxWidth:u,rotation:d}=function(e,t,n,o){const{top:r,left:i,bottom:a,right:s,chart:l}=e,{chartArea:c,scales:u}=l;let d,p,f,h=0;const g=a-r,m=s-i;if(e.isHorizontal()){if(p=QD(o,i,s),ZA(n)){const e=Object.keys(n)[0],o=n[e];f=u[e].getPixelForValue(o)+g-t}else f="center"===n?(c.bottom+c.top)/2+g-t:G_(e,n,t);d=s-i}else{if(ZA(n)){const e=Object.keys(n)[0],o=n[e];p=u[e].getPixelForValue(o)-m+t}else p="center"===n?(c.left+c.right)/2-m+t:G_(e,n,t);f=QD(o,a,r),h="left"===n?-SD:SD}return{titleX:p,titleY:f,maxWidth:d,rotation:h}}(this,s,t,a);MT(e,n.text,0,0,r,{color:n.color,maxWidth:u,rotation:d,textAlign:tz(a,t,o),textBaseline:"middle",translation:[l,c]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,t=e.ticks&&e.ticks.z||0,n=tD(e.grid&&e.grid.z,-1),o=tD(e.border&&e.border.z,0);return this._isVisible()&&this.draw===nz.prototype.draw?[{z:n,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:o,draw:()=>{this.drawBorder()}},{z:t,draw:e=>{this.drawLabels(e)}}]:[{z:t,draw:e=>{this.draw(e)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",o=[];let r,i;for(r=0,i=t.length;r<i;++r){const i=t[r];i[n]!==this.id||e&&i.type!==e||o.push(i)}return o}_resolveTickFontOptions(e){return zT(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class oz{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const t=Object.getPrototypeOf(e);let n;(function(e){return"id"in e&&"defaults"in e})(t)&&(n=this.register(t));const o=this.items,r=e.id,i=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+e);return r in o||(o[r]=e,function(e,t,n){const o=cD(Object.create(null),[n?mT.get(n):{},mT.get(t),e.defaults]);mT.set(t,o),e.defaultRoutes&&function(e,t){Object.keys(t).forEach((n=>{const o=n.split("."),r=o.pop(),i=[e].concat(o).join("."),a=t[n].split("."),s=a.pop(),l=a.join(".");mT.route(i,r,l,s)}))}(t,e.defaultRoutes);e.descriptors&&mT.describe(t,e.descriptors)}(e,i,n),this.override&&mT.override(e.id,e.overrides)),i}get(e){return this.items[e]}unregister(e){const t=this.items,n=e.id,o=this.scope;n in t&&delete t[n],o&&n in mT[o]&&(delete mT[o][n],this.override&&delete dT[n])}}class rz{constructor(){this.controllers=new oz(YR,"datasets",!0),this.elements=new oz(q_,"elements"),this.plugins=new oz(Object,"plugins"),this.scales=new oz(nz,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,n){[...t].forEach((t=>{const o=n||this._getRegistryForType(t);n||o.isForType(t)||o===this.plugins&&t.id?this._exec(e,o,t):rD(t,(t=>{const o=n||this._getRegistryForType(t);this._exec(e,o,t)}))}))}_exec(e,t,n){const o=hD(e);oD(n["before"+o],[],n),t[e](n),oD(n["after"+o],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){const o=t.get(e);if(void 0===o)throw new Error('"'+e+'" is not a registered '+n+".");return o}}var iz=new rz;class az{constructor(){this._init=[]}notify(e,t,n,o){"beforeInit"===t&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const r=o?this._descriptors(e).filter(o):this._descriptors(e),i=this._notify(r,e,t,n);return"afterDestroy"===t&&(this._notify(r,e,"stop"),this._notify(this._init,e,"uninstall")),i}_notify(e,t,n,o){o=o||{};for(const r of e){const e=r.plugin;if(!1===oD(e[n],[t,o,r.options],e)&&o.cancelable)return!1}return!0}invalidate(){YA(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const n=e&&e.config,o=tD(n.options&&n.options.plugins,{}),r=function(e){const t={},n=[],o=Object.keys(iz.plugins.items);for(let e=0;e<o.length;e++)n.push(iz.getPlugin(o[e]));const r=e.plugins||[];for(let e=0;e<r.length;e++){const o=r[e];-1===n.indexOf(o)&&(n.push(o),t[o.id]=!0)}return{plugins:n,localIds:t}}(n);return!1!==o||t?function(e,{plugins:t,localIds:n},o,r){const i=[],a=e.getContext();for(const s of t){const t=s.id,l=sz(o[t],r);null!==l&&i.push({plugin:s,options:lz(e.config,{plugin:s,local:n[t]},l,a)})}return i}(e,r,o,t):[]}_notifyStateChanges(e){const t=this._oldCache||[],n=this._cache,o=(e,t)=>e.filter((e=>!t.some((t=>e.plugin.id===t.plugin.id))));this._notify(o(t,n),e,"stop"),this._notify(o(n,t),e,"start")}}function sz(e,t){return t||!1!==e?!0===e?{}:e:null}function lz(e,{plugin:t,local:n},o,r){const i=e.pluginScopeKeys(t),a=e.getOptionScopes(o,i);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function cz(e,t){const n=mT.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function uz(e){if("x"===e||"y"===e||"r"===e)return e}function dz(e){return"top"===e||"bottom"===e?"x":"left"===e||"right"===e?"y":void 0}function pz(e,...t){if(uz(e))return e;for(const n of t){const t=n.axis||dz(n.position)||e.length>1&&uz(e[0].toLowerCase());if(t)return t}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function fz(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function hz(e,t){const n=dT[e.type]||{scales:{}},o=t.scales||{},r=cz(e.type,t),i=Object.create(null);return Object.keys(o).forEach((t=>{const a=o[t];if(!ZA(a))return console.error(`Invalid scale configuration for scale: ${t}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const s=pz(t,a,function(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter((t=>t.xAxisID===e||t.yAxisID===e));if(n.length)return fz(e,"x",n[0])||fz(e,"y",n[0])}return{}}(t,e),mT.scales[a.type]),l=function(e,t){return e===t?"_index_":"_value_"}(s,r),c=n.scales||{};i[t]=uD(Object.create(null),[{axis:s},a,c[s],c[l]])})),e.data.datasets.forEach((n=>{const r=n.type||e.type,a=n.indexAxis||cz(r,t),s=(dT[r]||{}).scales||{};Object.keys(s).forEach((e=>{const t=function(e,t){let n=e;return"_index_"===e?n=t:"_value_"===e&&(n="x"===t?"y":"x"),n}(e,a),r=n[t+"AxisID"]||t;i[r]=i[r]||Object.create(null),uD(i[r],[{axis:t},o[r],s[e]])}))})),Object.keys(i).forEach((e=>{const t=i[e];uD(t,[mT.scales[t.type],mT.scale])})),i}function gz(e){const t=e.options||(e.options={});t.plugins=tD(t.plugins,{}),t.scales=hz(e,t)}function mz(e){return(e=e||{}).datasets=e.datasets||[],e.labels=e.labels||[],e}const vz=new Map,bz=new Set;function yz(e,t){let n=vz.get(e);return n||(n=t(),vz.set(e,n),bz.add(n)),n}const xz=(e,t,n)=>{const o=fD(t,n);void 0!==o&&e.add(o)};class Cz{constructor(e){this._config=function(e){return(e=e||{}).data=mz(e.data),gz(e),e}(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=mz(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),gz(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return yz(e,(()=>[[`datasets.${e}`,""]]))}datasetAnimationScopeKeys(e,t){return yz(`${e}.transition.${t}`,(()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]]))}datasetElementScopeKeys(e,t){return yz(`${e}-${t}`,(()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]]))}pluginScopeKeys(e){const t=e.id;return yz(`${this.type}-plugin-${t}`,(()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]]))}_cachedScopes(e,t){const n=this._scopeCache;let o=n.get(e);return o&&!t||(o=new Map,n.set(e,o)),o}getOptionScopes(e,t,n){const{options:o,type:r}=this,i=this._cachedScopes(e,n),a=i.get(t);if(a)return a;const s=new Set;t.forEach((t=>{e&&(s.add(e),t.forEach((t=>xz(s,e,t)))),t.forEach((e=>xz(s,o,e))),t.forEach((e=>xz(s,dT[r]||{},e))),t.forEach((e=>xz(s,mT,e))),t.forEach((e=>xz(s,pT,e)))}));const l=Array.from(s);return 0===l.length&&l.push(Object.create(null)),bz.has(t)&&i.set(t,l),l}chartOptionScopes(){const{options:e,type:t}=this;return[e,dT[t]||{},mT.datasets[t]||{},{type:t},mT,pT]}resolveNamedOptions(e,t,n,o=[""]){const r={$shared:!0},{resolver:i,subPrefixes:a}=wz(this._resolverCache,e,o);let s=i;if(function(e,t){const{isScriptable:n,isIndexable:o}=VT(e);for(const r of t){const t=n(r),i=o(r),a=(i||t)&&e[r];if(t&&(mD(a)||Sz(a))||i&&QA(a))return!0}return!1}(i,t)){r.$shared=!1;s=WT(i,n=mD(n)?n():n,this.createResolver(e,n,a))}for(const e of t)r[e]=s[e];return r}createResolver(e,t,n=[""],o){const{resolver:r}=wz(this._resolverCache,e,n);return ZA(t)?WT(r,t,void 0,o):r}}function wz(e,t,n){let o=e.get(t);o||(o=new Map,e.set(t,o));const r=n.join();let i=o.get(r);if(!i){i={resolver:FT(t,n),subPrefixes:n.filter((e=>!e.toLowerCase().includes("hover")))},o.set(r,i)}return i}const Sz=e=>ZA(e)&&Object.getOwnPropertyNames(e).some((t=>mD(e[t])));const kz=["top","bottom","left","right","chartArea"];function Ez(e,t){return"top"===e||"bottom"===e||-1===kz.indexOf(e)&&"x"===t}function Oz(e,t){return function(n,o){return n[e]===o[e]?n[t]-o[t]:n[e]-o[e]}}function $z(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),oD(n&&n.onComplete,[e],t)}function Nz(e){const t=e.chart,n=t.options.animation;oD(n&&n.onProgress,[e],t)}function Mz(e){return lR()&&"string"==typeof e?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Iz={},Pz=e=>{const t=Mz(e);return Object.values(Iz).filter((e=>e.canvas===t)).pop()};function Lz(e,t,n){const o=Object.keys(e);for(const r of o){const o=+r;if(o>=t){const i=e[r];delete e[r],(n>0||o>t)&&(e[o+n]=i)}}}function jz(e,t,n){return e.options.clip?e[n]:t[n]}let Az=class{static defaults=mT;static instances=Iz;static overrides=dT;static registry=iz;static version="4.4.4";static getChart=Pz;static register(...e){iz.add(...e),Dz()}static unregister(...e){iz.remove(...e),Dz()}constructor(e,t){const n=this.config=new Cz(t),o=Mz(e),r=Pz(o);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const i=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||function(e){return!lR()||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?I_:K_}(o)),this.platform.updateConfig(n);const a=this.platform.acquireContext(o,i.aspectRatio),s=a&&a.canvas,l=s&&s.height,c=s&&s.width;this.id=GA(),this.ctx=a,this.canvas=s,this.width=c,this.height=l,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new az,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(e,t){let n;return function(...o){return t?(clearTimeout(n),n=setTimeout(e,t,o)):e.apply(this,o),t}}((e=>this.update(e)),i.resizeDelay||0),this._dataChanges=[],Iz[this.id]=this,a&&s?(AR.listen(this,"complete",$z),AR.listen(this,"progress",Nz),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:o,_aspectRatio:r}=this;return YA(e)?t&&r?r:o?n/o:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return iz}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():bR(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return yT(this.canvas,this.ctx),this}stop(){return AR.stop(this),this}resize(e,t){AR.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const n=this.options,o=this.canvas,r=n.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(o,e,t,r),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,bR(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),oD(n.onResize,[this,i],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){rD(this.options.scales||{},((e,t)=>{e.id=t}))}buildOrUpdateScales(){const e=this.options,t=e.scales,n=this.scales,o=Object.keys(n).reduce(((e,t)=>(e[t]=!1,e)),{});let r=[];t&&(r=r.concat(Object.keys(t).map((e=>{const n=t[e],o=pz(e,n),r="r"===o,i="x"===o;return{options:n,dposition:r?"chartArea":i?"bottom":"left",dtype:r?"radialLinear":i?"category":"linear"}})))),rD(r,(t=>{const r=t.options,i=r.id,a=pz(i,r),s=tD(r.type,t.dtype);void 0!==r.position&&Ez(r.position,a)===Ez(t.dposition)||(r.position=t.dposition),o[i]=!0;let l=null;if(i in n&&n[i].type===s)l=n[i];else{l=new(iz.getScale(s))({id:i,type:s,ctx:this.ctx,chart:this}),n[l.id]=l}l.init(r,e)})),rD(o,((e,t)=>{e||delete n[t]})),rD(n,(e=>{N_.configure(this,e,e.options),N_.addBox(this,e)}))}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort(((e,t)=>e.index-t.index)),n>t){for(let e=t;e<n;++e)this._destroyDatasetMeta(e);e.splice(t,n-t)}this._sortedMetasets=e.slice(0).sort(Oz("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach(((e,n)=>{0===t.filter((t=>t===e._dataset)).length&&this._destroyDatasetMeta(n)}))}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let n,o;for(this._removeUnreferencedMetasets(),n=0,o=t.length;n<o;n++){const o=t[n];let r=this.getDatasetMeta(n);const i=o.type||this.config.type;if(r.type&&r.type!==i&&(this._destroyDatasetMeta(n),r=this.getDatasetMeta(n)),r.type=i,r.indexAxis=o.indexAxis||cz(i,this.options),r.order=o.order||0,r.index=n,r.label=""+o.label,r.visible=this.isDatasetVisible(n),r.controller)r.controller.updateIndex(n),r.controller.linkScales();else{const t=iz.getController(i),{datasetElementType:o,dataElementType:a}=mT.datasets[i];Object.assign(t,{dataElementType:iz.getElement(a),datasetElementType:o&&iz.getElement(o)}),r.controller=new t(this,n),e.push(r.controller)}}return this._updateMetasets(),e}_resetElements(){rD(this.data.datasets,((e,t)=>{this.getDatasetMeta(t).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0}))return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let e=0,t=this.data.datasets.length;e<t;e++){const{controller:t}=this.getDatasetMeta(e),n=!o&&-1===r.indexOf(t);t.buildOrUpdateElements(n),i=Math.max(+t.getMaxOverflow(),i)}i=this._minPadding=n.layout.autoPadding?i:0,this._updateLayout(i),o||rD(r,(e=>{e.reset()})),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Oz("z","_idx"));const{_active:a,_lastEvent:s}=this;s?this._eventHandler(s,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){rD(this.scales,(e=>{N_.removeBox(this,e)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),n=new Set(e.events);vD(t,n)&&!!this._responsiveListeners===e.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:n,start:o,count:r}of t){Lz(e,o,"_removeElements"===n?-r:r)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,n=t=>new Set(e.filter((e=>e[0]===t)).map(((e,t)=>t+","+e.splice(1).join(",")))),o=n(0);for(let e=1;e<t;e++)if(!vD(o,n(e)))return;return Array.from(o).map((e=>e.split(","))).map((e=>({method:e[1],start:+e[2],count:+e[3]})))}_updateLayout(e){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;N_.update(this,this.width,this.height,e);const t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],rD(this.boxes,(e=>{n&&"chartArea"===e.position||(e.configure&&e.configure(),this._layers.push(...e._layers()))}),this),this._layers.forEach(((e,t)=>{e._idx=t})),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,n=this.data.datasets.length;t<n;++t)this._updateDataset(t,mD(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){const n=this.getDatasetMeta(e),o={meta:n,index:e,mode:t,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",o)&&(n.controller._update(t),o.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",o))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(AR.has(this)?this.attached&&!AR.running(this)&&AR.start(this):(this.draw(),$z({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const t=this._sortedMetasets,n=[];let o,r;for(o=0,r=t.length;o<r;++o){const r=t[o];e&&!r.visible||n.push(r)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,n=e._clip,o=!n.disabled,r=function(e,t){const{xScale:n,yScale:o}=e;return n&&o?{left:jz(n,t,"left"),right:jz(n,t,"right"),top:jz(o,t,"top"),bottom:jz(o,t,"bottom")}:t}(e,this.chartArea),i={meta:e,index:e.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(o&&ST(t,{left:!1===n.left?0:r.left-n.left,right:!1===n.right?this.width:r.right+n.right,top:!1===n.top?0:r.top-n.top,bottom:!1===n.bottom?this.height:r.bottom+n.bottom}),e.controller.draw(),o&&kT(t),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(e){return wT(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,o){const r=g_.modes[t];return"function"==typeof r?r(this,e,n,o):[]}getDatasetMeta(e){const t=this.data.datasets[e],n=this._metasets;let o=n.filter((e=>e&&e._dataset===t)).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(o)),o}getContext(){return this.$context||(this.$context=HT(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const n=this.getDatasetMeta(e);return"boolean"==typeof n.hidden?!n.hidden:!t.hidden}setDatasetVisibility(e,t){this.getDatasetMeta(e).hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){const o=n?"show":"hide",r=this.getDatasetMeta(e),i=r.controller._resolveAnimations(void 0,o);gD(t)?(r.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),i.update(r,{visible:n}),this.update((t=>t.datasetIndex===e?o:void 0)))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),AR.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),yT(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete Iz[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,t=this.platform,n=(n,o)=>{t.addEventListener(this,n,o),e[n]=o},o=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};rD(this.options.events,(e=>n(e,o)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,n=(n,o)=>{t.addEventListener(this,n,o),e[n]=o},o=(n,o)=>{e[n]&&(t.removeEventListener(this,n,o),delete e[n])},r=(e,t)=>{this.canvas&&this.resize(e,t)};let i;const a=()=>{o("attach",a),this.attached=!0,this.resize(),n("resize",r),n("detach",i)};i=()=>{this.attached=!1,o("resize",r),this._stop(),this._resize(0,0),n("attach",a)},t.isAttached(this.canvas)?a():i()}unbindEvents(){rD(this._listeners,((e,t)=>{this.platform.removeEventListener(this,t,e)})),this._listeners={},rD(this._responsiveListeners,((e,t)=>{this.platform.removeEventListener(this,t,e)})),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){const o=n?"set":"remove";let r,i,a,s;for("dataset"===t&&(r=this.getDatasetMeta(e[0].datasetIndex),r.controller["_"+o+"DatasetHoverStyle"]()),a=0,s=e.length;a<s;++a){i=e[a];const t=i&&this.getDatasetMeta(i.datasetIndex).controller;t&&t[o+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const t=this._active||[],n=e.map((({datasetIndex:e,index:t})=>{const n=this.getDatasetMeta(e);if(!n)throw new Error("No dataset found at index "+e);return{datasetIndex:e,element:n.data[t],index:t}}));!iD(n,t)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return 1===this._plugins._cache.filter((t=>t.plugin.id===e)).length}_updateHoverStyles(e,t,n){const o=this.options.hover,r=(e,t)=>e.filter((e=>!t.some((t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)))),i=r(t,e),a=n?e:r(e,t);i.length&&this.updateHoverStyle(i,o.mode,!1),a.length&&o.mode&&this.updateHoverStyle(a,o.mode,!0)}_eventHandler(e,t){const n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},o=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1===this.notifyPlugins("beforeEvent",n,o))return;const r=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,o),(r||n.changed)&&this.render(),this}_handleEvent(e,t,n){const{_active:o=[],options:r}=this,i=t,a=this._getActiveElements(e,o,n,i),s=function(e){return"mouseup"===e.type||"click"===e.type||"contextmenu"===e.type}(e),l=function(e,t,n,o){return n&&"mouseout"!==e.type?o?t:e:null}(e,this._lastEvent,n,s);n&&(this._lastEvent=null,oD(r.onHover,[e,a,this],this),s&&oD(r.onClick,[e,a,this],this));const c=!iD(a,o);return(c||t)&&(this._active=a,this._updateHoverStyles(a,o,t)),this._lastEvent=l,c}_getActiveElements(e,t,n,o){if("mouseout"===e.type)return[];if(!n)return t;const r=this.options.hover;return this.getElementsAtEventForMode(e,r.mode,r,o)}};function Dz(){return rD(Az.instances,(e=>e._plugins.invalidate()))}function Tz(e,t,n,o){const r=DT(e.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const i=(n-t)/2,a=Math.min(i,o*t/2),s=e=>{const t=(n-Math.min(i,e))*o/2;return BD(e,0,Math.min(i,t))};return{outerStart:s(r.outerStart),outerEnd:s(r.outerEnd),innerStart:BD(r.innerStart,0,a),innerEnd:BD(r.innerEnd,0,a)}}function Rz(e,t,n,o){return{x:n+e*Math.cos(t),y:o+e*Math.sin(t)}}function _z(e,t,n,o,r,i){const{x:a,y:s,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+o+n-c,0),p=u>0?u+o+n+c:0;let f=0;const h=r-l;if(o){const e=((u>0?u-o:0)+(d>0?d-o:0))/2;f=(h-(0!==e?h*e/(e+o):h))/2}const g=(h-Math.max(.001,h*d-n/bD)/d)/2,m=l+g+f,v=r-g-f,{outerStart:b,outerEnd:y,innerStart:x,innerEnd:C}=Tz(t,p,d,v-m),w=d-b,S=d-y,k=m+b/w,E=v-y/S,O=p+x,$=p+C,N=m+x/O,M=v-C/$;if(e.beginPath(),i){const t=(k+E)/2;if(e.arc(a,s,d,k,t),e.arc(a,s,d,t,E),y>0){const t=Rz(S,E,a,s);e.arc(t.x,t.y,y,E,v+SD)}const n=Rz($,v,a,s);if(e.lineTo(n.x,n.y),C>0){const t=Rz($,M,a,s);e.arc(t.x,t.y,C,v+SD,M+Math.PI)}const o=(v-C/p+(m+x/p))/2;if(e.arc(a,s,p,v-C/p,o,!0),e.arc(a,s,p,o,m+x/p,!0),x>0){const t=Rz(O,N,a,s);e.arc(t.x,t.y,x,N+Math.PI,m-SD)}const r=Rz(w,m,a,s);if(e.lineTo(r.x,r.y),b>0){const t=Rz(w,k,a,s);e.arc(t.x,t.y,b,m-SD,k)}}else{e.moveTo(a,s);const t=Math.cos(k)*d+a,n=Math.sin(k)*d+s;e.lineTo(t,n);const o=Math.cos(E)*d+a,r=Math.sin(E)*d+s;e.lineTo(o,r)}e.closePath()}function zz(e,t,n,o,r){const{fullCircles:i,startAngle:a,circumference:s,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:p}=l,f="inner"===l.borderAlign;if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=p,f?(e.lineWidth=2*c,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let h=t.endAngle;if(i){_z(e,t,n,o,h,r);for(let t=0;t<i;++t)e.stroke();isNaN(s)||(h=a+(s%yD||yD))}f&&function(e,t,n){const{startAngle:o,pixelMargin:r,x:i,y:a,outerRadius:s,innerRadius:l}=t;let c=r/s;e.beginPath(),e.arc(i,a,s,o-c,n+c),l>r?(c=r/l,e.arc(i,a,l,n+c,o-c,!0)):e.arc(i,a,r,n+SD,o-SD),e.closePath(),e.clip()}(e,t,h),i||(_z(e,t,n,o,h,r),e.stroke())}function Bz(e,t,n=t){e.lineCap=tD(n.borderCapStyle,t.borderCapStyle),e.setLineDash(tD(n.borderDash,t.borderDash)),e.lineDashOffset=tD(n.borderDashOffset,t.borderDashOffset),e.lineJoin=tD(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=tD(n.borderWidth,t.borderWidth),e.strokeStyle=tD(n.borderColor,t.borderColor)}function Hz(e,t,n){e.lineTo(n.x,n.y)}function Fz(e,t,n={}){const o=e.length,{start:r=0,end:i=o-1}=n,{start:a,end:s}=t,l=Math.max(r,a),c=Math.min(i,s),u=r<a&&i<a||r>s&&i>s;return{count:o,start:l,loop:t.loop,ilen:c<l&&!u?o+c-l:c-l}}function Wz(e,t,n,o){const{points:r,options:i}=t,{count:a,start:s,loop:l,ilen:c}=Fz(r,n,o),u=function(e){return e.stepped?ET:e.tension||"monotone"===e.cubicInterpolationMode?OT:Hz}(i);let d,p,f,{move:h=!0,reverse:g}=o||{};for(d=0;d<=c;++d)p=r[(s+(g?c-d:d))%a],p.skip||(h?(e.moveTo(p.x,p.y),h=!1):u(e,f,p,g,i.stepped),f=p);return l&&(p=r[(s+(g?c:0))%a],u(e,f,p,g,i.stepped)),!!l}function Vz(e,t,n,o){const r=t.points,{count:i,start:a,ilen:s}=Fz(r,n,o),{move:l=!0,reverse:c}=o||{};let u,d,p,f,h,g,m=0,v=0;const b=e=>(a+(c?s-e:e))%i,y=()=>{f!==h&&(e.lineTo(m,h),e.lineTo(m,f),e.lineTo(m,g))};for(l&&(d=r[b(0)],e.moveTo(d.x,d.y)),u=0;u<=s;++u){if(d=r[b(u)],d.skip)continue;const t=d.x,n=d.y,o=0|t;o===p?(n<f?f=n:n>h&&(h=n),m=(v*m+t)/++v):(y(),e.lineTo(t,n),p=o,v=0,f=h=n),g=n}y()}function Kz(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!(e._decimated||e._loop||t.tension||"monotone"===t.cubicInterpolationMode||t.stepped||n)?Vz:Wz}const qz="function"==typeof Path2D;function Xz(e,t,n,o){qz&&!t.options.segment?function(e,t,n,o){let r=t._path;r||(r=t._path=new Path2D,t.path(r,n,o)&&r.closePath()),Bz(e,t.options),e.stroke(r)}(e,t,n,o):function(e,t,n,o){const{segments:r,options:i}=t,a=Kz(t);for(const s of r)Bz(e,i,s.style),e.beginPath(),a(e,t,s,{start:n,end:n+o-1})&&e.closePath(),e.stroke()}(e,t,n,o)}function Uz(e,t,n,o){const r=e.options,{[n]:i}=e.getProps([n],o);return Math.abs(t-i)<r.radius+r.hitRadius}function Gz(e,t){const{x:n,y:o,base:r,width:i,height:a}=e.getProps(["x","y","base","width","height"],t);let s,l,c,u,d;return e.horizontal?(d=a/2,s=Math.min(n,r),l=Math.max(n,r),c=o-d,u=o+d):(d=i/2,s=n-d,l=n+d,c=Math.min(o,r),u=Math.max(o,r)),{left:s,top:c,right:l,bottom:u}}function Yz(e,t,n,o){return e?0:BD(t,n,o)}function Qz(e){const t=Gz(e),n=t.right-t.left,o=t.bottom-t.top,r=function(e,t,n){const o=e.options.borderWidth,r=e.borderSkipped,i=TT(o);return{t:Yz(r.top,i.top,0,n),r:Yz(r.right,i.right,0,t),b:Yz(r.bottom,i.bottom,0,n),l:Yz(r.left,i.left,0,t)}}(e,n/2,o/2),i=function(e,t,n){const{enableBorderRadius:o}=e.getProps(["enableBorderRadius"]),r=e.options.borderRadius,i=RT(r),a=Math.min(t,n),s=e.borderSkipped,l=o||ZA(r);return{topLeft:Yz(!l||s.top||s.left,i.topLeft,0,a),topRight:Yz(!l||s.top||s.right,i.topRight,0,a),bottomLeft:Yz(!l||s.bottom||s.left,i.bottomLeft,0,a),bottomRight:Yz(!l||s.bottom||s.right,i.bottomRight,0,a)}}(e,n/2,o/2);return{outer:{x:t.left,y:t.top,w:n,h:o,radius:i},inner:{x:t.left+r.l,y:t.top+r.t,w:n-r.l-r.r,h:o-r.t-r.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(r.t,r.l)),topRight:Math.max(0,i.topRight-Math.max(r.t,r.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(r.b,r.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(r.b,r.r))}}}}function Zz(e,t,n,o){const r=null===t,i=null===n,a=e&&!(r&&i)&&Gz(e,o);return a&&(r||HD(t,a.left,a.right))&&(i||HD(n,a.top,a.bottom))}function Jz(e,t){e.rect(t.x,t.y,t.w,t.h)}function eB(e,t,n={}){const o=e.x!==n.x?-t:0,r=e.y!==n.y?-t:0,i=(e.x+e.w!==n.x+n.w?t:0)-o,a=(e.y+e.h!==n.y+n.h?t:0)-r;return{x:e.x+o,y:e.y+r,w:e.w+i,h:e.h+a,radius:e.radius}}const tB=(e,t)=>{let{boxHeight:n=t,boxWidth:o=t}=e;return e.usePointStyle&&(n=Math.min(n,t),o=e.pointStyleWidth||Math.min(o,t)),{boxWidth:o,boxHeight:n,itemHeight:Math.max(t,n)}};class nB extends q_{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let t=oD(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter((t=>e.filter(t,this.chart.data)))),e.sort&&(t=t.sort(((t,n)=>e.sort(t,n,this.chart.data)))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display)return void(this.width=this.height=0);const n=e.labels,o=zT(n.font),r=o.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:s}=tB(n,r);let l,c;t.font=o.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(i,r,a,s)+10):(c=this.maxHeight,l=this._fitCols(i,o,a,s)+10),this.width=Math.min(l,e.maxWidth||this.maxWidth),this.height=Math.min(c,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,o){const{ctx:r,maxWidth:i,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.lineWidths=[0],c=o+a;let u=e;r.textAlign="left",r.textBaseline="middle";let d=-1,p=-c;return this.legendItems.forEach(((e,f)=>{const h=n+t/2+r.measureText(e.text).width;(0===f||l[l.length-1]+h+2*a>i)&&(u+=c,l[l.length-(f>0?0:1)]=0,p+=c,d++),s[f]={left:0,top:p,row:d,width:h,height:o},l[l.length-1]+=h+a})),u}_fitCols(e,t,n,o){const{ctx:r,maxHeight:i,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.columnSizes=[],c=i-e;let u=a,d=0,p=0,f=0,h=0;return this.legendItems.forEach(((e,i)=>{const{itemWidth:g,itemHeight:m}=function(e,t,n,o,r){const i=function(e,t,n,o){let r=e.text;r&&"string"!=typeof r&&(r=r.reduce(((e,t)=>e.length>t.length?e:t)));return t+n.size/2+o.measureText(r).width}(o,e,t,n),a=function(e,t,n){let o=e;"string"!=typeof t.text&&(o=oB(t,n));return o}(r,o,t.lineHeight);return{itemWidth:i,itemHeight:a}}(n,t,r,e,o);i>0&&p+m+2*a>c&&(u+=d+a,l.push({width:d,height:p}),f+=d+a,h++,d=p=0),s[i]={left:f,top:p,col:h,width:g,height:m},d=Math.max(d,g),p+=m+a})),u+=d,l.push({width:d,height:p}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:o},rtl:r}}=this,i=kR(r,this.left,this.width);if(this.isHorizontal()){let r=0,a=QD(n,this.left+o,this.right-this.lineWidths[r]);for(const s of t)r!==s.row&&(r=s.row,a=QD(n,this.left+o,this.right-this.lineWidths[r])),s.top+=this.top+e+o,s.left=i.leftForLtr(i.x(a),s.width),a+=s.width+o}else{let r=0,a=QD(n,this.top+e+o,this.bottom-this.columnSizes[r].height);for(const s of t)s.col!==r&&(r=s.col,a=QD(n,this.top+e+o,this.bottom-this.columnSizes[r].height)),s.top=a,s.left+=this.left+o,s.left=i.leftForLtr(i.x(s.left),s.width),a+=s.height+o}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const e=this.ctx;ST(e,this),this._draw(),kT(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:n,ctx:o}=this,{align:r,labels:i}=e,a=mT.color,s=kR(e.rtl,this.left,this.width),l=zT(i.font),{padding:c}=i,u=l.size,d=u/2;let p;this.drawTitle(),o.textAlign=s.textAlign("left"),o.textBaseline="middle",o.lineWidth=.5,o.font=l.string;const{boxWidth:f,boxHeight:h,itemHeight:g}=tB(i,u),m=this.isHorizontal(),v=this._computeTitleHeight();p=m?{x:QD(r,this.left+c,this.right-n[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:QD(r,this.top+v+c,this.bottom-t[0].height),line:0},ER(this.ctx,e.textDirection);const b=g+c;this.legendItems.forEach(((y,x)=>{o.strokeStyle=y.fontColor,o.fillStyle=y.fontColor;const C=o.measureText(y.text).width,w=s.textAlign(y.textAlign||(y.textAlign=i.textAlign)),S=f+d+C;let k=p.x,E=p.y;s.setWidth(this.width),m?x>0&&k+S+c>this.right&&(E=p.y+=b,p.line++,k=p.x=QD(r,this.left+c,this.right-n[p.line])):x>0&&E+b>this.bottom&&(k=p.x=k+t[p.line].width+c,p.line++,E=p.y=QD(r,this.top+v+c,this.bottom-t[p.line].height));if(function(e,t,n){if(isNaN(f)||f<=0||isNaN(h)||h<0)return;o.save();const r=tD(n.lineWidth,1);if(o.fillStyle=tD(n.fillStyle,a),o.lineCap=tD(n.lineCap,"butt"),o.lineDashOffset=tD(n.lineDashOffset,0),o.lineJoin=tD(n.lineJoin,"miter"),o.lineWidth=r,o.strokeStyle=tD(n.strokeStyle,a),o.setLineDash(tD(n.lineDash,[])),i.usePointStyle){const a={radius:h*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:r},l=s.xPlus(e,f/2);CT(o,a,l,t+d,i.pointStyleWidth&&f)}else{const i=t+Math.max((u-h)/2,0),a=s.leftForLtr(e,f),l=RT(n.borderRadius);o.beginPath(),Object.values(l).some((e=>0!==e))?IT(o,{x:a,y:i,w:f,h:h,radius:l}):o.rect(a,i,f,h),o.fill(),0!==r&&o.stroke()}o.restore()}(s.x(k),E,y),k=((e,t,n,o)=>e===(o?"left":"right")?n:"center"===e?(t+n)/2:t)(w,k+f+d,m?k+S:this.right,e.rtl),function(e,t,n){MT(o,n.text,e,t+g/2,l,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})}(s.x(k),E,y),m)p.x+=S+c;else if("string"!=typeof y.text){const e=l.lineHeight;p.y+=oB(y,e)+c}else p.y+=b})),OR(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,n=zT(t.font),o=_T(t.padding);if(!t.display)return;const r=kR(e.rtl,this.left,this.width),i=this.ctx,a=t.position,s=n.size/2,l=o.top+s;let c,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,u=QD(e.align,u,this.right-d);else{const t=this.columnSizes.reduce(((e,t)=>Math.max(e,t.height)),0);c=l+QD(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}const p=QD(a,u,u+d);i.textAlign=r.textAlign(YD(a)),i.textBaseline="middle",i.strokeStyle=t.color,i.fillStyle=t.color,i.font=n.string,MT(i,t.text,p,c,n)}_computeTitleHeight(){const e=this.options.title,t=zT(e.font),n=_T(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,o,r;if(HD(e,this.left,this.right)&&HD(t,this.top,this.bottom))for(r=this.legendHitBoxes,n=0;n<r.length;++n)if(o=r[n],HD(e,o.left,o.left+o.width)&&HD(t,o.top,o.top+o.height))return this.legendItems[n];return null}handleEvent(e){const t=this.options;if(!function(e,t){if(("mousemove"===e||"mouseout"===e)&&(t.onHover||t.onLeave))return!0;if(t.onClick&&("click"===e||"mouseup"===e))return!0;return!1}(e.type,t))return;const n=this._getLegendItemAt(e.x,e.y);if("mousemove"===e.type||"mouseout"===e.type){const i=this._hoveredItem,a=(r=n,null!==(o=i)&&null!==r&&o.datasetIndex===r.datasetIndex&&o.index===r.index);i&&!a&&oD(t.onLeave,[e,i,this],this),this._hoveredItem=n,n&&!a&&oD(t.onHover,[e,n,this],this)}else n&&oD(t.onClick,[e,n,this],this);var o,r}}function oB(e,t){return t*(e.text?e.text.length:0)}var rB={id:"legend",_element:nB,start(e,t,n){const o=e.legend=new nB({ctx:e.ctx,options:n,chart:e});N_.configure(e,o,n),N_.addBox(e,o)},stop(e){N_.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const o=e.legend;N_.configure(e,o,n),o.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const o=t.datasetIndex,r=n.chart;r.isDatasetVisible(o)?(r.hide(o),t.hidden=!0):(r.show(o),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:o,textAlign:r,color:i,useBorderRadius:a,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map((e=>{const l=e.controller.getStyle(n?0:void 0),c=_T(l.borderWidth);return{text:t[e.index].label,fillStyle:l.backgroundColor,fontColor:i,hidden:!e.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:o||l.pointStyle,rotation:l.rotation,textAlign:r||l.textAlign,borderRadius:a&&(s||l.borderRadius),datasetIndex:e.index}}),this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};let iB=class extends q_{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){const n=this.options;if(this.left=0,this.top=0,!n.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=e,this.height=this.bottom=t;const o=QA(n.text)?n.text.length:1;this._padding=_T(n.padding);const r=o*zT(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const e=this.options.position;return"top"===e||"bottom"===e}_drawArgs(e){const{top:t,left:n,bottom:o,right:r,options:i}=this,a=i.align;let s,l,c,u=0;return this.isHorizontal()?(l=QD(a,n,r),c=t+e,s=r-n):("left"===i.position?(l=n+e,c=QD(a,o,t),u=-.5*bD):(l=r-e,c=QD(a,t,o),u=.5*bD),s=o-t),{titleX:l,titleY:c,maxWidth:s,rotation:u}}draw(){const e=this.ctx,t=this.options;if(!t.display)return;const n=zT(t.font),o=n.lineHeight/2+this._padding.top,{titleX:r,titleY:i,maxWidth:a,rotation:s}=this._drawArgs(o);MT(e,t.text,0,0,n,{color:t.color,maxWidth:a,rotation:s,textAlign:YD(t.align),textBaseline:"middle",translation:[r,i]})}};var aB={id:"title",_element:iB,start(e,t,n){!function(e,t){const n=new iB({ctx:e.ctx,options:t,chart:e});N_.configure(e,n,t),N_.addBox(e,n),e.titleBlock=n}(e,n)},stop(e){const t=e.titleBlock;N_.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const o=e.titleBlock;N_.configure(e,o,n),o.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const sB={average(e){if(!e.length)return!1;let t,n,o=new Set,r=0,i=0;for(t=0,n=e.length;t<n;++t){const n=e[t].element;if(n&&n.hasValue()){const e=n.tooltipPosition();o.add(e.x),r+=e.y,++i}}if(0===i||0===o.size)return!1;return{x:[...o].reduce(((e,t)=>e+t))/o.size,y:r/i}},nearest(e,t){if(!e.length)return!1;let n,o,r,i=t.x,a=t.y,s=Number.POSITIVE_INFINITY;for(n=0,o=e.length;n<o;++n){const o=e[n].element;if(o&&o.hasValue()){const e=TD(t,o.getCenterPoint());e<s&&(s=e,r=o)}}if(r){const e=r.tooltipPosition();i=e.x,a=e.y}return{x:i,y:a}}};function lB(e,t){return t&&(QA(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function cB(e){return("string"==typeof e||e instanceof String)&&e.indexOf("\n")>-1?e.split("\n"):e}function uB(e,t){const{element:n,datasetIndex:o,index:r}=t,i=e.getDatasetMeta(o).controller,{label:a,value:s}=i.getLabelAndValue(r);return{chart:e,label:a,parsed:i.getParsed(r),raw:e.data.datasets[o].data[r],formattedValue:s,dataset:i.getDataset(),dataIndex:r,datasetIndex:o,element:n}}function dB(e,t){const n=e.chart.ctx,{body:o,footer:r,title:i}=e,{boxWidth:a,boxHeight:s}=t,l=zT(t.bodyFont),c=zT(t.titleFont),u=zT(t.footerFont),d=i.length,p=r.length,f=o.length,h=_T(t.padding);let g=h.height,m=0,v=o.reduce(((e,t)=>e+t.before.length+t.lines.length+t.after.length),0);if(v+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),v){g+=f*(t.displayColors?Math.max(s,l.lineHeight):l.lineHeight)+(v-f)*l.lineHeight+(v-1)*t.bodySpacing}p&&(g+=t.footerMarginTop+p*u.lineHeight+(p-1)*t.footerSpacing);let b=0;const y=function(e){m=Math.max(m,n.measureText(e).width+b)};return n.save(),n.font=c.string,rD(e.title,y),n.font=l.string,rD(e.beforeBody.concat(e.afterBody),y),b=t.displayColors?a+2+t.boxPadding:0,rD(o,(e=>{rD(e.before,y),rD(e.lines,y),rD(e.after,y)})),b=0,n.font=u.string,rD(e.footer,y),n.restore(),m+=h.width,{width:m,height:g}}function pB(e,t,n,o){const{x:r,width:i}=n,{width:a,chartArea:{left:s,right:l}}=e;let c="center";return"center"===o?c=r<=(s+l)/2?"left":"right":r<=i/2?c="left":r>=a-i/2&&(c="right"),function(e,t,n,o){const{x:r,width:i}=o,a=n.caretSize+n.caretPadding;return"left"===e&&r+i+a>t.width||"right"===e&&r-i-a<0||void 0}(c,e,t,n)&&(c="center"),c}function fB(e,t,n){const o=n.yAlign||t.yAlign||function(e,t){const{y:n,height:o}=t;return n<o/2?"top":n>e.height-o/2?"bottom":"center"}(e,n);return{xAlign:n.xAlign||t.xAlign||pB(e,t,n,o),yAlign:o}}function hB(e,t,n,o){const{caretSize:r,caretPadding:i,cornerRadius:a}=e,{xAlign:s,yAlign:l}=n,c=r+i,{topLeft:u,topRight:d,bottomLeft:p,bottomRight:f}=RT(a);let h=function(e,t){let{x:n,width:o}=e;return"right"===t?n-=o:"center"===t&&(n-=o/2),n}(t,s);const g=function(e,t,n){let{y:o,height:r}=e;return"top"===t?o+=n:o-="bottom"===t?r+n:r/2,o}(t,l,c);return"center"===l?"left"===s?h+=c:"right"===s&&(h-=c):"left"===s?h-=Math.max(u,p)+r:"right"===s&&(h+=Math.max(d,f)+r),{x:BD(h,0,o.width-t.width),y:BD(g,0,o.height-t.height)}}function gB(e,t,n){const o=_T(n.padding);return"center"===t?e.x+e.width/2:"right"===t?e.x+e.width-o.right:e.x+o.left}function mB(e){return lB([],cB(e))}function vB(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const bB={beforeTitle:UA,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,o=n?n.length:0;if(this&&this.options&&"dataset"===this.options.mode)return t.dataset.label||"";if(t.label)return t.label;if(o>0&&t.dataIndex<o)return n[t.dataIndex]}return""},afterTitle:UA,beforeBody:UA,beforeLabel:UA,label(e){if(this&&this.options&&"dataset"===this.options.mode)return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return YA(n)||(t+=n),t},labelColor(e){const t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:UA,afterBody:UA,beforeFooter:UA,footer:UA,afterFooter:UA};function yB(e,t,n,o){const r=e[t].call(n,o);return void 0===r?bB[t].call(n,o):r}class xB extends q_{static positioners=sB;constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,n=this.options.setContext(this.getContext()),o=n.enabled&&t.options.animation&&n.animations,r=new _R(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=(e=this.chart.getContext(),t=this,n=this._tooltipItems,HT(e,{tooltip:t,tooltipItems:n,type:"tooltip"})));var e,t,n}getTitle(e,t){const{callbacks:n}=t,o=yB(n,"beforeTitle",this,e),r=yB(n,"title",this,e),i=yB(n,"afterTitle",this,e);let a=[];return a=lB(a,cB(o)),a=lB(a,cB(r)),a=lB(a,cB(i)),a}getBeforeBody(e,t){return mB(yB(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:n}=t,o=[];return rD(e,(e=>{const t={before:[],lines:[],after:[]},r=vB(n,e);lB(t.before,cB(yB(r,"beforeLabel",this,e))),lB(t.lines,yB(r,"label",this,e)),lB(t.after,cB(yB(r,"afterLabel",this,e))),o.push(t)})),o}getAfterBody(e,t){return mB(yB(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:n}=t,o=yB(n,"beforeFooter",this,e),r=yB(n,"footer",this,e),i=yB(n,"afterFooter",this,e);let a=[];return a=lB(a,cB(o)),a=lB(a,cB(r)),a=lB(a,cB(i)),a}_createItems(e){const t=this._active,n=this.chart.data,o=[],r=[],i=[];let a,s,l=[];for(a=0,s=t.length;a<s;++a)l.push(uB(this.chart,t[a]));return e.filter&&(l=l.filter(((t,o,r)=>e.filter(t,o,r,n)))),e.itemSort&&(l=l.sort(((t,o)=>e.itemSort(t,o,n)))),rD(l,(t=>{const n=vB(e.callbacks,t);o.push(yB(n,"labelColor",this,t)),r.push(yB(n,"labelPointStyle",this,t)),i.push(yB(n,"labelTextColor",this,t))})),this.labelColors=o,this.labelPointStyles=r,this.labelTextColors=i,this.dataPoints=l,l}update(e,t){const n=this.options.setContext(this.getContext()),o=this._active;let r,i=[];if(o.length){const e=sB[n.position].call(this,o,this._eventPosition);i=this._createItems(n),this.title=this.getTitle(i,n),this.beforeBody=this.getBeforeBody(i,n),this.body=this.getBody(i,n),this.afterBody=this.getAfterBody(i,n),this.footer=this.getFooter(i,n);const t=this._size=dB(this,n),a=Object.assign({},e,t),s=fB(this.chart,n,a),l=hB(n,a,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,r={opacity:1,x:l.x,y:l.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}else 0!==this.opacity&&(r={opacity:0});this._tooltipItems=i,this.$context=void 0,r&&this._resolveAnimations().update(this,r),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,o){const r=this.getCaretPosition(e,n,o);t.lineTo(r.x1,r.y1),t.lineTo(r.x2,r.y2),t.lineTo(r.x3,r.y3)}getCaretPosition(e,t,n){const{xAlign:o,yAlign:r}=this,{caretSize:i,cornerRadius:a}=n,{topLeft:s,topRight:l,bottomLeft:c,bottomRight:u}=RT(a),{x:d,y:p}=e,{width:f,height:h}=t;let g,m,v,b,y,x;return"center"===r?(y=p+h/2,"left"===o?(g=d,m=g-i,b=y+i,x=y-i):(g=d+f,m=g+i,b=y-i,x=y+i),v=g):(m="left"===o?d+Math.max(s,c)+i:"right"===o?d+f-Math.max(l,u)-i:this.caretX,"top"===r?(b=p,y=b-i,g=m-i,v=m+i):(b=p+h,y=b+i,g=m+i,v=m-i),x=b),{x1:g,x2:m,x3:v,y1:b,y2:y,y3:x}}drawTitle(e,t,n){const o=this.title,r=o.length;let i,a,s;if(r){const l=kR(n.rtl,this.x,this.width);for(e.x=gB(this,n.titleAlign,n),t.textAlign=l.textAlign(n.titleAlign),t.textBaseline="middle",i=zT(n.titleFont),a=n.titleSpacing,t.fillStyle=n.titleColor,t.font=i.string,s=0;s<r;++s)t.fillText(o[s],l.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+a,s+1===r&&(e.y+=n.titleMarginBottom-a)}}_drawColorBox(e,t,n,o,r){const i=this.labelColors[n],a=this.labelPointStyles[n],{boxHeight:s,boxWidth:l}=r,c=zT(r.bodyFont),u=gB(this,"left",r),d=o.x(u),p=s<c.lineHeight?(c.lineHeight-s)/2:0,f=t.y+p;if(r.usePointStyle){const t={radius:Math.min(l,s)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},n=o.leftForLtr(d,l)+l/2,c=f+s/2;e.strokeStyle=r.multiKeyBackground,e.fillStyle=r.multiKeyBackground,xT(e,t,n,c),e.strokeStyle=i.borderColor,e.fillStyle=i.backgroundColor,xT(e,t,n,c)}else{e.lineWidth=ZA(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,e.strokeStyle=i.borderColor,e.setLineDash(i.borderDash||[]),e.lineDashOffset=i.borderDashOffset||0;const t=o.leftForLtr(d,l),n=o.leftForLtr(o.xPlus(d,1),l-2),a=RT(i.borderRadius);Object.values(a).some((e=>0!==e))?(e.beginPath(),e.fillStyle=r.multiKeyBackground,IT(e,{x:t,y:f,w:l,h:s,radius:a}),e.fill(),e.stroke(),e.fillStyle=i.backgroundColor,e.beginPath(),IT(e,{x:n,y:f+1,w:l-2,h:s-2,radius:a}),e.fill()):(e.fillStyle=r.multiKeyBackground,e.fillRect(t,f,l,s),e.strokeRect(t,f,l,s),e.fillStyle=i.backgroundColor,e.fillRect(n,f+1,l-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){const{body:o}=this,{bodySpacing:r,bodyAlign:i,displayColors:a,boxHeight:s,boxWidth:l,boxPadding:c}=n,u=zT(n.bodyFont);let d=u.lineHeight,p=0;const f=kR(n.rtl,this.x,this.width),h=function(n){t.fillText(n,f.x(e.x+p),e.y+d/2),e.y+=d+r},g=f.textAlign(i);let m,v,b,y,x,C,w;for(t.textAlign=i,t.textBaseline="middle",t.font=u.string,e.x=gB(this,g,n),t.fillStyle=n.bodyColor,rD(this.beforeBody,h),p=a&&"right"!==g?"center"===i?l/2+c:l+2+c:0,y=0,C=o.length;y<C;++y){for(m=o[y],v=this.labelTextColors[y],t.fillStyle=v,rD(m.before,h),b=m.lines,a&&b.length&&(this._drawColorBox(t,e,y,f,n),d=Math.max(u.lineHeight,s)),x=0,w=b.length;x<w;++x)h(b[x]),d=u.lineHeight;rD(m.after,h)}p=0,d=u.lineHeight,rD(this.afterBody,h),e.y-=r}drawFooter(e,t,n){const o=this.footer,r=o.length;let i,a;if(r){const s=kR(n.rtl,this.x,this.width);for(e.x=gB(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline="middle",i=zT(n.footerFont),t.fillStyle=n.footerColor,t.font=i.string,a=0;a<r;++a)t.fillText(o[a],s.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+n.footerSpacing}}drawBackground(e,t,n,o){const{xAlign:r,yAlign:i}=this,{x:a,y:s}=e,{width:l,height:c}=n,{topLeft:u,topRight:d,bottomLeft:p,bottomRight:f}=RT(o.cornerRadius);t.fillStyle=o.backgroundColor,t.strokeStyle=o.borderColor,t.lineWidth=o.borderWidth,t.beginPath(),t.moveTo(a+u,s),"top"===i&&this.drawCaret(e,t,n,o),t.lineTo(a+l-d,s),t.quadraticCurveTo(a+l,s,a+l,s+d),"center"===i&&"right"===r&&this.drawCaret(e,t,n,o),t.lineTo(a+l,s+c-f),t.quadraticCurveTo(a+l,s+c,a+l-f,s+c),"bottom"===i&&this.drawCaret(e,t,n,o),t.lineTo(a+p,s+c),t.quadraticCurveTo(a,s+c,a,s+c-p),"center"===i&&"left"===r&&this.drawCaret(e,t,n,o),t.lineTo(a,s+u),t.quadraticCurveTo(a,s,a+u,s),t.closePath(),t.fill(),o.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,n=this.$animations,o=n&&n.x,r=n&&n.y;if(o||r){const n=sB[e.position].call(this,this._active,this._eventPosition);if(!n)return;const i=this._size=dB(this,e),a=Object.assign({},n,this._size),s=fB(t,e,a),l=hB(e,a,s,t);o._to===l.x&&r._to===l.y||(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=i.width,this.height=i.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(t);const o={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const i=_T(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=n,this.drawBackground(r,e,o,t),ER(e,t.textDirection),r.y+=i.top,this.drawTitle(r,e,t),this.drawBody(r,e,t),this.drawFooter(r,e,t),OR(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const n=this._active,o=e.map((({datasetIndex:e,index:t})=>{const n=this.chart.getDatasetMeta(e);if(!n)throw new Error("Cannot find a dataset at index "+e);return{datasetIndex:e,element:n.data[t],index:t}})),r=!iD(n,o),i=this._positionChanged(o,t);(r||i)&&(this._active=o,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,r=this._active||[],i=this._getActiveElements(e,r,t,n),a=this._positionChanged(i,e),s=t||!iD(i,r)||a;return s&&(this._active=i,(o.enabled||o.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,o){const r=this.options;if("mouseout"===e.type)return[];if(!o)return t.filter((e=>this.chart.data.datasets[e.datasetIndex]&&void 0!==this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)));const i=this.chart.getElementsAtEventForMode(e,r.mode,r,n);return r.reverse&&i.reverse(),i}_positionChanged(e,t){const{caretX:n,caretY:o,options:r}=this,i=sB[r.position].call(this,e,t);return!1!==i&&(n!==i.x||o!==i.y)}}var CB={id:"tooltip",_element:xB,positioners:sB,afterInit(e,t,n){n&&(e.tooltip=new xB({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(!1===e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0}))return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:bB},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>"filter"!==e&&"itemSort"!==e&&"external"!==e,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};function wB(e,t,n,o){const r=e.indexOf(t);if(-1===r)return((e,t,n,o)=>("string"==typeof t?(n=e.push(t)-1,o.unshift({index:n,label:t})):isNaN(t)&&(n=null),n))(e,t,n,o);return r!==e.lastIndexOf(t)?n:r}function SB(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}function kB(e,t){const n=[],{bounds:o,step:r,min:i,max:a,precision:s,count:l,maxTicks:c,maxDigits:u,includeBounds:d}=e,p=r||1,f=c-1,{min:h,max:g}=t,m=!YA(i),v=!YA(a),b=!YA(l),y=(g-h)/(u+1);let x,C,w,S,k=MD((g-h)/f/p)*p;if(k<1e-14&&!m&&!v)return[{value:h},{value:g}];S=Math.ceil(g/k)-Math.floor(h/k),S>f&&(k=MD(S*k/f/p)*p),YA(s)||(x=Math.pow(10,s),k=Math.ceil(k*x)/x),"ticks"===o?(C=Math.floor(h/k)*k,w=Math.ceil(g/k)*k):(C=h,w=g),m&&v&&r&&function(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}((a-i)/r,k/1e3)?(S=Math.round(Math.min((a-i)/k,c)),k=(a-i)/S,C=i,w=a):b?(C=m?i:C,w=v?a:w,S=l-1,k=(w-C)/S):(S=(w-C)/k,S=ND(S,Math.round(S),k/1e3)?Math.round(S):Math.ceil(S));const E=Math.max(AD(k),AD(C));x=Math.pow(10,YA(s)?E:s),C=Math.round(C*x)/x,w=Math.round(w*x)/x;let O=0;for(m&&(d&&C!==i?(n.push({value:i}),C<i&&O++,ND(Math.round((C+O*k)*x)/x,i,EB(i,y,e))&&O++):C<i&&O++);O<S;++O){const e=Math.round((C+O*k)*x)/x;if(v&&e>a)break;n.push({value:e})}return v&&d&&w!==a?n.length&&ND(n[n.length-1].value,a,EB(a,y,e))?n[n.length-1].value=a:n.push({value:a}):v&&w!==a||n.push({value:w}),n}function EB(e,t,{horizontal:n,minRotation:o}){const r=LD(o),i=(n?Math.sin(r):Math.cos(r))||.001,a=.75*t*(""+e).length;return Math.min(t/i,a)}class OB extends nz{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return YA(e)||("number"==typeof e||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:o,max:r}=this;const i=e=>o=t?o:e,a=e=>r=n?r:e;if(e){const e=$D(o),t=$D(r);e<0&&t<0?a(0):e>0&&t>0&&i(0)}if(o===r){let t=0===r?1:Math.abs(.05*r);a(r+t),e||i(o-t)}this.min=o,this.max=r}getTickLimit(){const e=this.options.ticks;let t,{maxTicksLimit:n,stepSize:o}=e;return o?(t=Math.ceil(this.max/o)-Math.floor(this.min/o)+1,t>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${o} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3)):(t=this.computeTickLimit(),n=n||11),n&&(t=Math.min(n,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let n=this.getTickLimit();n=Math.max(2,n);const o=kB({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:!1!==t.includeBounds},this._range||this);return"ticks"===e.bounds&&PD(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){const o=(n-t)/Math.max(e.length-1,1)/2;t-=o,n+=o}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return lT(e,this.chart.options.locale,this.options.ticks.format)}}class $B extends OB{static id="linear";static defaults={ticks:{callback:uT.formatters.numeric}};determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=JA(e)?e:0,this.max=JA(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,n=LD(this.options.ticks.minRotation),o=(e?Math.sin(n):Math.cos(n))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,r.lineHeight/o))}getPixelForValue(e){return null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}uT.formatters.logarithmic;uT.formatters.numeric;const NB="label";function MB(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function IB(e,t){e.labels=t}function PB(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:NB;const o=[];e.datasets=t.map((t=>{const r=e.datasets.find((e=>e[n]===t[n]));return r&&t.data&&!o.includes(r)?(o.push(r),Object.assign(r,t),r):{...t}}))}function LB(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NB;const n={labels:[],datasets:[]};return IB(n,e.labels),PB(n,e.datasets,t),n}function jB(e,n){const{height:o=150,width:r=300,redraw:i=!1,datasetIdKey:s,type:c,data:u,options:d,plugins:p=[],fallbackContent:f,updateMode:h,...g}=e,m=a(null),v=a(),b=()=>{m.current&&(v.current=new Az(m.current,{type:c,data:LB(u,s),options:d&&{...d},plugins:p}),MB(n,v.current))},y=()=>{MB(n,null),v.current&&(v.current.destroy(),v.current=null)};return l((()=>{!i&&v.current&&d&&function(e,t){const n=e.options;n&&t&&Object.assign(n,t)}(v.current,d)}),[i,d]),l((()=>{!i&&v.current&&IB(v.current.config.data,u.labels)}),[i,u.labels]),l((()=>{!i&&v.current&&u.datasets&&PB(v.current.config.data,u.datasets,s)}),[i,u.datasets]),l((()=>{v.current&&(i?(y(),setTimeout(b)):v.current.update(h))}),[i,d,u.labels,u.datasets,h]),l((()=>{v.current&&(y(),setTimeout(b))}),[c]),l((()=>(b(),()=>y())),[]),t.createElement("canvas",Object.assign({ref:m,role:"img",height:o,width:r},g),f)}const AB=c(jB);function DB(e,n){return Az.register(n),c(((n,o)=>t.createElement(AB,Object.assign({},n,{ref:o,type:e}))))}const TB=DB("line",s_),RB=DB("bar",i_),_B=DB("doughnut",a_),zB=DB("pie",l_);rA(".appChart {\n & > canvas {\n height: 100% !important;\n width: 100% !important;\n }\n}\n"),Az.register(class extends nz{static id="category";static defaults={ticks:{callback:SB}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const e=this.getLabels();for(const{index:n,label:o}of t)e[n]===o&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(YA(e))return null;const n=this.getLabels();return((e,t)=>null===e?null:BD(Math.round(e),0,t))(t=isFinite(t)&&n[t]===e?t:wB(n,e,tD(t,e),this._addedLabels),n.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:n,max:o}=this.getMinMax(!0);"ticks"===this.options.bounds&&(e||(n=0),t||(o=this.getLabels().length-1)),this.min=n,this.max=o}buildTicks(){const e=this.min,t=this.max,n=this.options.offset,o=[];let r=this.getLabels();r=0===e&&t===r.length-1?r:r.slice(e,t+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)o.push({value:n});return o}getLabelForValue(e){return SB.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return"number"!=typeof e&&(e=this.parse(e)),null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}},$B,class extends q_{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:t,options:{borderColor:n,backgroundColor:o}}=this,{inner:r,outer:i}=Qz(this),a=function(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}(i.radius)?IT:Jz;e.save(),i.w===r.w&&i.h===r.h||(e.beginPath(),a(e,eB(i,t,r)),e.clip(),a(e,eB(r,-t,i)),e.fillStyle=n,e.fill("evenodd")),e.beginPath(),a(e,eB(r,t)),e.fillStyle=o,e.fill(),e.restore()}inRange(e,t,n){return Zz(this,e,t,n)}inXRange(e,t){return Zz(this,e,null,t)}inYRange(e,t){return Zz(this,null,e,t)}getCenterPoint(e){const{x:t,y:n,base:o,horizontal:r}=this.getProps(["x","y","base","horizontal"],e);return{x:r?(t+o)/2:t,y:r?n:(n+o)/2}}getRange(e){return"x"===e?this.width/2:this.height/2}},class extends q_{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:e=>"borderDash"!==e&&"fill"!==e};constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const n=this.options;if((n.tension||"monotone"===n.cubicInterpolationMode)&&!n.stepped&&!this._pointsUpdated){const o=n.spanGaps?this._loop:this._fullLoop;sR(this._points,n,e,o,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(e,t){const n=e.points,o=e.options.spanGaps,r=n.length;if(!r)return[];const i=!!e._loop,{start:a,end:s}=function(e,t,n,o){let r=0,i=t-1;if(n&&!o)for(;r<t&&!e[r].skip;)r++;for(;r<t&&e[r].skip;)r++;for(r%=t,n&&(i+=r);i>r&&e[i%t].skip;)i--;return i%=t,{start:r,end:i}}(n,r,i,o);return IR(e,!0===o?[{start:a,end:s,loop:i}]:function(e,t,n,o){const r=e.length,i=[];let a,s=t,l=e[t];for(a=t+1;a<=n;++a){const n=e[a%r];n.skip||n.stop?l.skip||(o=!1,i.push({start:t%r,end:(a-1)%r,loop:o}),t=s=n.stop?a:null):(s=a,l.skip&&(t=a)),l=n}return null!==s&&i.push({start:t%r,end:s%r,loop:o}),i}(n,a,s<a?s+r:s,!!e._fullLoop&&0===a&&s===r-1),n,t)}(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){const n=this.options,o=e[t],r=this.points,i=function(e,t){const n=[],o=e.segments;for(let r=0;r<o.length;r++){const i=MR(o[r],e.points,t);i.length&&n.push(...i)}return n}(this,{property:t,start:o,end:o});if(!i.length)return;const a=[],s=function(e){return e.stepped?wR:e.tension||"monotone"===e.cubicInterpolationMode?SR:CR}(n);let l,c;for(l=0,c=i.length;l<c;++l){const{start:c,end:u}=i[l],d=r[c],p=r[u];if(d===p){a.push(d);continue}const f=s(d,p,Math.abs((o-d[t])/(p[t]-d[t])),n.stepped);f[t]=e[t],a.push(f)}return 1===a.length?a[0]:a}pathSegment(e,t,n){return Kz(this)(e,this,t,n)}path(e,t,n){const o=this.segments,r=Kz(this);let i=this._loop;t=t||0,n=n||this.points.length-t;for(const a of o)i&=r(e,this,a,{start:t,end:t+n-1});return!!i}draw(e,t,n,o){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(e.save(),Xz(e,this,n,o),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}},class extends q_{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,n){const o=this.options,{x:r,y:i}=this.getProps(["x","y"],n);return Math.pow(e-r,2)+Math.pow(t-i,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,t){return Uz(this,e,"x",t)}inYRange(e,t){return Uz(this,e,"y",t)}getCenterPoint(e){const{x:t,y:n}=this.getProps(["x","y"],e);return{x:t,y:n}}size(e){let t=(e=e||this.options||{}).radius||0;t=Math.max(t,t&&e.hoverRadius||0);return 2*(t+(t&&e.borderWidth||0))}draw(e,t){const n=this.options;this.skip||n.radius<.1||!wT(this,t,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,xT(e,n,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}},class extends q_{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:e=>"borderDash"!==e};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,n){const o=this.getProps(["x","y"],n),{angle:r,distance:i}=DD(o,{x:e,y:t}),{startAngle:a,endAngle:s,innerRadius:l,outerRadius:c,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),d=(this.options.spacing+this.options.borderWidth)/2,p=tD(u,s-a),f=zD(r,a,s)&&a!==s,h=p>=yD||f,g=HD(i,l+d,c+d);return h&&g}getCenterPoint(e){const{x:t,y:n,startAngle:o,endAngle:r,innerRadius:i,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:s,spacing:l}=this.options,c=(o+r)/2,u=(i+a+l+s)/2;return{x:t+Math.cos(c)*u,y:n+Math.sin(c)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:t,circumference:n}=this,o=(t.offset||0)/4,r=(t.spacing||0)/2,i=t.circular;if(this.pixelMargin="inner"===t.borderAlign?.33:0,this.fullCircles=n>yD?Math.floor(n/yD):0,0===n||this.innerRadius<0||this.outerRadius<0)return;e.save();const a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*o,Math.sin(a)*o);const s=o*(1-Math.sin(Math.min(bD,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,function(e,t,n,o,r){const{fullCircles:i,startAngle:a,circumference:s}=t;let l=t.endAngle;if(i){_z(e,t,n,o,l,r);for(let t=0;t<i;++t)e.fill();isNaN(s)||(l=a+(s%yD||yD))}_z(e,t,n,o,l,r),e.fill()}(e,this,s,r,i),zz(e,this,s,r,i),e.restore()}},aB,CB,rB);var BB=function(e){var t=e.type,n=e.data,o=e.options,r=e.className,i=e.height,a=void 0===i?400:i,s=e.width,l=void 0===s?600:s,c=E(e,["type","data","options","className","height","width"]);return L.jsx("div",{style:{height:a,width:l},className:"appChart ".concat(r),children:function(){switch(t){case"bar":return L.jsx(RB,k({data:n,options:o,className:r},c));case"line":return L.jsx(TB,k({data:n,options:o,className:r},c));case"pie":return L.jsx(zB,k({data:n,options:o,className:r},c));case"doughnut":return L.jsx(_B,k({data:n,options:o,className:r},c));default:return null}}()})};rA(".appImageBox {\n width: max-content;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1rem;\n\n .ant-image {\n border-radius: 50%;\n overflow: hidden;\n\n .ant-image-img {\n border-radius: 50%;\n }\n }\n .text {\n font-size: 16px;\n font-weight: 700;\n line-height: normal;\n color: #000000;\n }\n}\n");var HB=function(e){var t=e.width,n=void 0===t?100:t,o=e.height,r=void 0===o?100:o,i=e.text,a=e.image,s=e.className,l=e.handleClick;return L.jsxs("div",{className:"appImageBox ".concat(s),onClick:l,children:[L.jsx(TO,{preview:!1,width:n,height:r,src:a.src,alt:i}),i&&L.jsx("span",{className:"text",dangerouslySetInnerHTML:{__html:i}})]})},FB=function(e){var t=e.src,n=e.fallbackIcon,o=void 0===n?L.jsx(vM,{}):n,r=e.className,i=E(e,["src","fallbackIcon","className"]);return L.jsx("div",{className:r,children:L.jsx(wv,k({src:t,icon:t?void 0:o},i))})};rA(".appCheckboxText {\n .checkboxText {\n & > span:last-child {\n line-height: unset;\n & > span {\n font-size: 15px;\n font-weight: 500;\n text-align: left;\n }\n }\n }\n}\n");var WB=function(e){var t=e.text,n=e.checked,o=e.handleChange,r=e.className;return L.jsx("div",{className:"appCheckboxText ".concat(r),children:L.jsx(WS,{className:"checkboxText",checked:n,onChange:o,children:L.jsx("span",{dangerouslySetInnerHTML:{__html:t}})})})};vk.Panel;var VB=function(e){var t=e.panels,n=void 0===t?[]:t,o=e.defaultActiveKey,r=e.onChange,i=e.expandIconPosition,a=e.ghost,s=e.accordion,l=e.expandIcon,c=e.size,u=e.bordered,d=e.activeKey,p=e.className,f=E(e,["panels","defaultActiveKey","onChange","expandIconPosition","ghost","accordion","expandIcon","size","bordered","activeKey","className"]),h=n.map((function(e){return{key:e.key,label:e.header,children:e.content,collapsible:e.collapsible}}));return L.jsx("div",{className:p,children:L.jsx(vk,k({defaultActiveKey:o,onChange:r,expandIconPosition:i,ghost:a,accordion:s,expandIcon:l,size:c,bordered:u,activeKey:d,items:h},f))})};rA('.wrapper {\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n background-color: (0, 0, 0, 0.3);\n backdrop-filter: blur(10px);\n display: flex;\n z-index: 99;\n}\n\n/*code for custom loading icon*/\n\n.loader {\n position: relative;\n width: 80px;\n margin-left: 45%;\n margin-top: 25%;\n}\n\n.loader span {\n display: block;\n transform-origin: 40px 40px;\n animation: ding 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n}\n\n.loader span::before {\n content: "";\n position: absolute;\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background: rgb(0, 0, 0);\n margin: -4px 0 0 -4px;\n}\n\n.loader span:nth-child(1) {\n animation-delay: -0.36s;\n}\n\n.loader span:nth-child(1):before {\n top: 63px;\n left: 63px;\n}\n\n.loader span:nth-child(2) {\n animation-delay: -0.72s;\n}\n\n.loader span:nth-child(2):before {\n top: 68px;\n left: 56px;\n}\n\n.loader span:nth-child(3) {\n animation-delay: -0.108s;\n}\n\n.loader span:nth-child(3):before {\n top: 71px;\n left: 48px;\n}\n.loader span:nth-child(4) {\n animation-delay: -0.144s;\n}\n\n.loader span:nth-child(4):before {\n top: 72px;\n left: 40px;\n}\n\n.loader span:nth-child(5) {\n animation-delay: -0.18;\n}\n\n.loader span:nth-child(5):before {\n top: 71px;\n left: 32px;\n}\n\n.loader span:nth-child(6) {\n animation-delay: -0.216s;\n}\n\n.loader span:nth-child(6):before {\n top: 68px;\n left: 24px;\n}\n\n.loader span:nth-child(7) {\n animation-delay: -0.252s;\n}\n\n.loader span:nth-child(7):before {\n top: 63px;\n left: 17px;\n}\n\n.loader span:nth-child(8) {\n animation-delay: -0.288s;\n}\n\n.loader span:nth-child(8):before {\n top: 56px;\n left: 12px;\n}\n\n@keyframes ding {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n');var KB=function(e){var t=e.className;return L.jsx("div",{className:"wrapper ".concat(t),children:L.jsxs("div",{className:"loader",children:[L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{})]})})},qB=function(e,t){return qB=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},qB(e,t)};
44
+ */class jR{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,o){const r=t.listeners[o],i=t.duration;r.forEach((o=>o({chart:e,initial:t.initial,numSteps:i,currentStep:Math.min(n-t.start,i)})))}_refresh(){this._request||(this._running=!0,this._request=UD.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(e=Date.now()){let t=0;this._charts.forEach(((n,o)=>{if(!n.running||!n.items.length)return;const r=n.items;let i,a=r.length-1,s=!1;for(;a>=0;--a)i=r[a],i._active?(i._total>n.duration&&(n.duration=i._total),i.tick(e),s=!0):(r[a]=r[r.length-1],r.pop());s&&(o.draw(),this._notify(o,n,e,"progress")),r.length||(n.running=!1,this._notify(o,n,e,"complete"),n.initial=!1),t+=r.length})),this._lastDate=e,0===t&&(this._running=!1)}_getAnims(e){const t=this._charts;let n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){t&&t.length&&this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce(((e,t)=>Math.max(e,t._duration)),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!!(t&&t.running&&t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const n=t.items;let o=n.length-1;for(;o>=0;--o)n[o].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var AR=new jR;const DR="transparent",TR={boolean:(e,t,n)=>n>.5?t:e,color(e,t,n){const o=oT(e||DR),r=o.valid&&oT(t||DR);return r&&r.valid?r.mix(o,n).hexString():t},number:(e,t,n)=>e+(t-e)*n};class RR{constructor(e,t,n,o){const r=t[n];o=BT([e.to,o,r,e.from]);const i=BT([e.from,r,o]);this._active=!0,this._fn=e.fn||TR[e.type||typeof i],this._easing=tT[e.easing]||tT.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=i,this._to=o,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);const o=this._target[this._prop],r=n-this._start,i=this._duration-r;this._start=n,this._duration=Math.floor(Math.max(i,e.duration)),this._total+=r,this._loop=!!e.loop,this._to=BT([e.to,t,o,e.from]),this._from=BT([e.from,o,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,n=this._duration,o=this._prop,r=this._from,i=this._loop,a=this._to;let s;if(this._active=r!==a&&(i||t<n),!this._active)return this._target[o]=a,void this._notify(!0);t<0?this._target[o]=r:(s=t/n%2,s=i&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[o]=this._fn(r,a,s))}wait(){const e=this._promises||(this._promises=[]);return new Promise(((t,n)=>{e.push({res:t,rej:n})}))}_notify(e){const t=e?"res":"rej",n=this._promises||[];for(let e=0;e<n.length;e++)n[e][t]()}}class _R{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!ZA(e))return;const t=Object.keys(mT.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach((o=>{const r=e[o];if(!ZA(r))return;const i={};for(const e of t)i[e]=r[e];(QA(r.properties)&&r.properties||[o]).forEach((e=>{e!==o&&n.has(e)||n.set(e,i)}))}))}_animateOptions(e,t){const n=t.options,o=function(e,t){if(!t)return;let n=e.options;if(!n)return void(e.options=t);n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}}));return n}(e,n);if(!o)return[];const r=this._createAnimations(o,n);return n.$shared&&function(e,t){const n=[],o=Object.keys(t);for(let t=0;t<o.length;t++){const r=e[o[t]];r&&r.active()&&n.push(r.wait())}return Promise.all(n)}(e.options.$animations,n).then((()=>{e.options=n}),(()=>{})),r}_createAnimations(e,t){const n=this._properties,o=[],r=e.$animations||(e.$animations={}),i=Object.keys(t),a=Date.now();let s;for(s=i.length-1;s>=0;--s){const l=i[s];if("$"===l.charAt(0))continue;if("options"===l){o.push(...this._animateOptions(e,t));continue}const c=t[l];let u=r[l];const d=n.get(l);if(u){if(d&&u.active()){u.update(d,c,a);continue}u.cancel()}d&&d.duration?(r[l]=u=new RR(d,e,l,c),o.push(u)):e[l]=c}return o}update(e,t){if(0===this._properties.size)return void Object.assign(e,t);const n=this._createAnimations(e,t);return n.length?(AR.add(this._chart,n),!0):void 0}}function zR(e,t){const n=e&&e.options||{},o=n.reverse,r=void 0===n.min?t:0,i=void 0===n.max?t:0;return{start:o?i:r,end:o?r:i}}function BR(e,t){const n=[],o=e._getSortedDatasetMetas(t);let r,i;for(r=0,i=o.length;r<i;++r)n.push(o[r].index);return n}function HR(e,t,n,o={}){const r=e.keys,i="single"===o.mode;let a,s,l,c;if(null!==t){for(a=0,s=r.length;a<s;++a){if(l=+r[a],l===n){if(o.all)continue;break}c=e.values[l],JA(c)&&(i||0===t||$D(t)===$D(c))&&(t+=c)}return t}}function FR(e,t){const n=e&&e.options.stacked;return n||void 0===n&&void 0!==t.stack}function WR(e,t,n){const o=e[t]||(e[t]={});return o[n]||(o[n]={})}function VR(e,t,n,o){for(const r of t.getMatchingVisibleMetas(o).reverse()){const t=e[r.index];if(n&&t>0||!n&&t<0)return r.index}return null}function KR(e,t){const{chart:n,_cachedMeta:o}=e,r=n._stacks||(n._stacks={}),{iScale:i,vScale:a,index:s}=o,l=i.axis,c=a.axis,u=function(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}(i,a,o),d=t.length;let p;for(let e=0;e<d;++e){const n=t[e],{[l]:i,[c]:d}=n;p=(n._stacks||(n._stacks={}))[c]=WR(r,u,i),p[s]=d,p._top=VR(p,a,!0,o.type),p._bottom=VR(p,a,!1,o.type);(p._visualValues||(p._visualValues={}))[s]=d}}function qR(e,t){const n=e.scales;return Object.keys(n).filter((e=>n[e].axis===t)).shift()}function XR(e,t){const n=e.controller.index,o=e.vScale&&e.vScale.axis;if(o){t=t||e._parsed;for(const e of t){const t=e._stacks;if(!t||void 0===t[o]||void 0===t[o][n])return;delete t[o][n],void 0!==t[o]._visualValues&&void 0!==t[o]._visualValues[n]&&delete t[o]._visualValues[n]}}}const UR=e=>"reset"===e||"none"===e,GR=(e,t)=>t?e:Object.assign({},e);class YR{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=FR(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&XR(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,n=this.getDataset(),o=(e,t,n,o)=>"x"===e?t:"r"===e?o:n,r=t.xAxisID=tD(n.xAxisID,qR(e,"x")),i=t.yAxisID=tD(n.yAxisID,qR(e,"y")),a=t.rAxisID=tD(n.rAxisID,qR(e,"r")),s=t.indexAxis,l=t.iAxisID=o(s,r,i,a),c=t.vAxisID=o(s,i,r,a);t.xScale=this.getScaleForId(r),t.yScale=this.getScaleForId(i),t.rScale=this.getScaleForId(a),t.iScale=this.getScaleForId(l),t.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&qD(this._data,this),e._stacked&&XR(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),n=this._data;if(ZA(t)){const e=this._cachedMeta;this._data=function(e,t){const{iScale:n,vScale:o}=t,r="x"===n.axis?"x":"y",i="x"===o.axis?"x":"y",a=Object.keys(e),s=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],s[l]={[r]:u,[i]:e[u]};return s}(t,e)}else if(n!==t){if(n){qD(n,this);const e=this._cachedMeta;XR(e),e._parsed=[]}t&&Object.isExtensible(t)&&function(e,t){e._chartjs?e._chartjs.listeners.push(t):(Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),KD.forEach((t=>{const n="_onData"+hD(t),o=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){const r=o.apply(this,t);return e._chartjs.listeners.forEach((e=>{"function"==typeof e[n]&&e[n](...t)})),r}})})))}(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,n=this.getDataset();let o=!1;this._dataCheck();const r=t._stacked;t._stacked=FR(t.vScale,t),t.stack!==n.stack&&(o=!0,XR(t),t.stack=n.stack),this._resyncElements(e),(o||r!==t._stacked)&&KR(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:n,_data:o}=this,{iScale:r,_stacked:i}=n,a=r.axis;let s,l,c,u=0===e&&t===o.length||n._sorted,d=e>0&&n._parsed[e-1];if(!1===this._parsing)n._parsed=o,n._sorted=!0,c=o;else{c=QA(o[e])?this.parseArrayData(n,o,e,t):ZA(o[e])?this.parseObjectData(n,o,e,t):this.parsePrimitiveData(n,o,e,t);const r=()=>null===l[a]||d&&l[a]<d[a];for(s=0;s<t;++s)n._parsed[s+e]=l=c[s],u&&(r()&&(u=!1),d=l);n._sorted=u}i&&KR(this,c)}parsePrimitiveData(e,t,n,o){const{iScale:r,vScale:i}=e,a=r.axis,s=i.axis,l=r.getLabels(),c=r===i,u=new Array(o);let d,p,f;for(d=0,p=o;d<p;++d)f=d+n,u[d]={[a]:c||r.parse(l[f],f),[s]:i.parse(t[f],f)};return u}parseArrayData(e,t,n,o){const{xScale:r,yScale:i}=e,a=new Array(o);let s,l,c,u;for(s=0,l=o;s<l;++s)c=s+n,u=t[c],a[s]={x:r.parse(u[0],c),y:i.parse(u[1],c)};return a}parseObjectData(e,t,n,o){const{xScale:r,yScale:i}=e,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l=new Array(o);let c,u,d,p;for(c=0,u=o;c<u;++c)d=c+n,p=t[d],l[c]={x:r.parse(fD(p,a),d),y:i.parse(fD(p,s),d)};return l}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,n){const o=this.chart,r=this._cachedMeta,i=t[e.axis];return HR({keys:BR(o,!0),values:t._stacks[e.axis]._visualValues},i,r.index,{mode:n})}updateRangeFromParsed(e,t,n,o){const r=n[t.axis];let i=null===r?NaN:r;const a=o&&n._stacks[t.axis];o&&a&&(o.values=a,i=HR(o,r,this._cachedMeta.index)),e.min=Math.min(e.min,i),e.max=Math.max(e.max,i)}getMinMax(e,t){const n=this._cachedMeta,o=n._parsed,r=n._sorted&&e===n.iScale,i=o.length,a=this._getOtherScale(e),s=((e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:BR(n,!0),values:null})(t,n,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:u}=function(e){const{min:t,max:n,minDefined:o,maxDefined:r}=e.getUserBounds();return{min:o?t:Number.NEGATIVE_INFINITY,max:r?n:Number.POSITIVE_INFINITY}}(a);let d,p;function f(){p=o[d];const t=p[a.axis];return!JA(p[e.axis])||c>t||u<t}for(d=0;d<i&&(f()||(this.updateRangeFromParsed(l,e,p,s),!r));++d);if(r)for(d=i-1;d>=0;--d)if(!f()){this.updateRangeFromParsed(l,e,p,s);break}return l}getAllParsedValues(e){const t=this._cachedMeta._parsed,n=[];let o,r,i;for(o=0,r=t.length;o<r;++o)i=t[o][e.axis],JA(i)&&n.push(i);return n}getMaxOverflow(){return!1}getLabelAndValue(e){const t=this._cachedMeta,n=t.iScale,o=t.vScale,r=this.getParsed(e);return{label:n?""+n.getLabelForValue(r[n.axis]):"",value:o?""+o.getLabelForValue(r[o.axis]):""}}_update(e){const t=this._cachedMeta;this.update(e||"default"),t._clip=function(e){let t,n,o,r;return ZA(e)?(t=e.top,n=e.right,o=e.bottom,r=e.left):t=n=o=r=e,{top:t,right:n,bottom:o,left:r,disabled:!1===e}}(tD(this.options.clip,function(e,t,n){if(!1===n)return!1;const o=zR(e,n),r=zR(t,n);return{top:r.end,right:o.end,bottom:r.start,left:o.start}}(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,t=this.chart,n=this._cachedMeta,o=n.data||[],r=t.chartArea,i=[],a=this._drawStart||0,s=this._drawCount||o.length-a,l=this.options.drawActiveElementsOnTop;let c;for(n.dataset&&n.dataset.draw(e,r,a,s),c=a;c<a+s;++c){const t=o[c];t.hidden||(t.active&&l?i.push(t):t.draw(e,r))}for(c=0;c<i.length;++c)i[c].draw(e,r)}getStyle(e,t){const n=t?"active":"default";return void 0===e&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,t,n){const o=this.getDataset();let r;if(e>=0&&e<this._cachedMeta.data.length){const t=this._cachedMeta.data[e];r=t.$context||(t.$context=function(e,t,n){return HT(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}(this.getContext(),e,t)),r.parsed=this.getParsed(e),r.raw=o.data[e],r.index=r.dataIndex=e}else r=this.$context||(this.$context=function(e,t){return HT(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),r.dataset=o,r.index=r.datasetIndex=this.index;return r.active=!!t,r.mode=n,r}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",n){const o="active"===t,r=this._cachedDataOpts,i=e+"-"+t,a=r[i],s=this.enableOptionSharing&&gD(n);if(a)return GR(a,s);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,e),u=o?[`${e}Hover`,"hover",e,""]:[e,""],d=l.getOptionScopes(this.getDataset(),c),p=Object.keys(mT.elements[e]),f=l.resolveNamedOptions(d,p,(()=>this.getContext(n,o,t)),u);return f.$shared&&(f.$shared=s,r[i]=Object.freeze(GR(f,s))),f}_resolveAnimations(e,t,n){const o=this.chart,r=this._cachedDataOpts,i=`animation-${t}`,a=r[i];if(a)return a;let s;if(!1!==o.options.animation){const o=this.chart.config,r=o.datasetAnimationScopeKeys(this._type,t),i=o.getOptionScopes(this.getDataset(),r);s=o.createResolver(i,this.getContext(e,n,t))}const l=new _R(o,s&&s.animations);return s&&s._cacheable&&(r[i]=Object.freeze(l)),l}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||UR(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const n=this.resolveDataElementOptions(e,t),o=this._sharedOptions,r=this.getSharedOptions(n),i=this.includeOptions(t,r)||r!==o;return this.updateSharedOptions(r,t,n),{sharedOptions:r,includeOptions:i}}updateElement(e,t,n,o){UR(o)?Object.assign(e,n):this._resolveAnimations(t,o).update(e,n)}updateSharedOptions(e,t,n){e&&!UR(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,o){e.active=o;const r=this.getStyle(t,o);this._resolveAnimations(t,n,o).update(e,{options:!o&&this.getSharedOptions(r)||r})}removeHoverStyle(e,t,n){this._setStyle(e,n,"active",!1)}setHoverStyle(e,t,n){this._setStyle(e,n,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,n=this._cachedMeta.data;for(const[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];const o=n.length,r=t.length,i=Math.min(r,o);i&&this.parse(0,i),r>o?this._insertElements(o,r-o,e):r<o&&this._removeElements(r,o-r)}_insertElements(e,t,n=!0){const o=this._cachedMeta,r=o.data,i=e+t;let a;const s=e=>{for(e.length+=t,a=e.length-1;a>=i;a--)e[a]=e[a-t]};for(s(r),a=e;a<i;++a)r[a]=new this.dataElementType;this._parsing&&s(o._parsed),this.parse(e,t),n&&this.updateElements(r,e,t,"reset")}updateElements(e,t,n,o){}_removeElements(e,t){const n=this._cachedMeta;if(this._parsing){const o=n._parsed.splice(e,t);n._stacked&&XR(n,o)}n.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[t,n,o]=e;this[t](n,o)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);const n=arguments.length-2;n&&this._sync(["_insertElements",e,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function QR(e){const t=e.iScale,n=function(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let o=[];for(let t=0,r=n.length;t<r;t++)o=o.concat(n[t].controller.getAllParsedValues(e));e._cache.$bar=XD(o.sort(((e,t)=>e-t)))}return e._cache.$bar}(t,e.type);let o,r,i,a,s=t._length;const l=()=>{32767!==i&&-32768!==i&&(gD(a)&&(s=Math.min(s,Math.abs(i-a)||s)),a=i)};for(o=0,r=n.length;o<r;++o)i=t.getPixelForValue(n[o]),l();for(a=void 0,o=0,r=t.ticks.length;o<r;++o)i=t.getPixelForTick(o),l();return s}function ZR(e,t,n,o){return QA(e)?function(e,t,n,o){const r=n.parse(e[0],o),i=n.parse(e[1],o),a=Math.min(r,i),s=Math.max(r,i);let l=a,c=s;Math.abs(a)>Math.abs(s)&&(l=s,c=a),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:r,end:i,min:a,max:s}}(e,t,n,o):t[n.axis]=n.parse(e,o),t}function JR(e,t,n,o){const r=e.iScale,i=e.vScale,a=r.getLabels(),s=r===i,l=[];let c,u,d,p;for(c=n,u=n+o;c<u;++c)p=t[c],d={},d[r.axis]=s||r.parse(a[c],c),l.push(ZR(p,d,i,c));return l}function e_(e){return e&&void 0!==e.barStart&&void 0!==e.barEnd}function t_(e,t,n,o){let r=t.borderSkipped;const i={};if(!r)return void(e.borderSkipped=i);if(!0===r)return void(e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:s,reverse:l,top:c,bottom:u}=function(e){let t,n,o,r,i;return e.horizontal?(t=e.base>e.x,n="left",o="right"):(t=e.base<e.y,n="bottom",o="top"),t?(r="end",i="start"):(r="start",i="end"),{start:n,end:o,reverse:t,top:r,bottom:i}}(e);"middle"===r&&n&&(e.enableBorderRadius=!0,(n._top||0)===o?r=c:(n._bottom||0)===o?r=u:(i[n_(u,a,s,l)]=!0,r=c)),i[n_(r,a,s,l)]=!0,e.borderSkipped=i}function n_(e,t,n,o){var r,i,a;return o?(a=n,e=o_(e=(r=e)===(i=t)?a:r===a?i:r,n,t)):e=o_(e,t,n),e}function o_(e,t,n){return"start"===e?t:"end"===e?n:e}function r_(e,{inflateAmount:t},n){e.inflateAmount="auto"===t?1===n?.33:0:t}class i_ extends YR{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(e,t,n,o){return JR(e,t,n,o)}parseArrayData(e,t,n,o){return JR(e,t,n,o)}parseObjectData(e,t,n,o){const{iScale:r,vScale:i}=e,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l="x"===r.axis?a:s,c="x"===i.axis?a:s,u=[];let d,p,f,h;for(d=n,p=n+o;d<p;++d)h=t[d],f={},f[r.axis]=r.parse(fD(h,l),d),u.push(ZR(fD(h,c),f,i,d));return u}updateRangeFromParsed(e,t,n,o){super.updateRangeFromParsed(e,t,n,o);const r=n._custom;r&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,r.min),e.max=Math.max(e.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const t=this._cachedMeta,{iScale:n,vScale:o}=t,r=this.getParsed(e),i=r._custom,a=e_(i)?"["+i.start+", "+i.end+"]":""+o.getLabelForValue(r[o.axis]);return{label:""+n.getLabelForValue(r[n.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(e){const t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,n,o){const r="reset"===o,{index:i,_cachedMeta:{vScale:a}}=this,s=a.getBasePixel(),l=a.isHorizontal(),c=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(t,o);for(let p=t;p<t+n;p++){const t=this.getParsed(p),n=r||YA(t[a.axis])?{base:s,head:s}:this._calculateBarValuePixels(p),f=this._calculateBarIndexPixels(p,c),h=(t._stacks||{})[a.axis],g={horizontal:l,base:n.base,enableBorderRadius:!h||e_(t._custom)||i===h._top||i===h._bottom,x:l?n.head:f.center,y:l?f.center:n.head,height:l?f.size:Math.abs(n.size),width:l?Math.abs(n.size):f.size};d&&(g.options=u||this.resolveDataElementOptions(p,e[p].active?"active":o));const m=g.options||e[p].options;t_(g,m,h,i),r_(g,m,c.ratio),this.updateElement(e[p],p,g,o)}}_getStacks(e,t){const{iScale:n}=this._cachedMeta,o=n.getMatchingVisibleMetas(this._type).filter((e=>e.controller.options.grouped)),r=n.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(t),s=a&&a[n.axis],l=e=>{const t=e._parsed.find((e=>e[n.axis]===s)),o=t&&t[e.vScale.axis];if(YA(o)||isNaN(o))return!0};for(const n of o)if((void 0===t||!l(n))&&((!1===r||-1===i.indexOf(n.stack)||void 0===r&&void 0===n.stack)&&i.push(n.stack),n.index===e))break;return i.length||i.push(void 0),i}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,n){const o=this._getStacks(e,n),r=void 0!==t?o.indexOf(t):-1;return-1===r?o.length-1:r}_getRuler(){const e=this.options,t=this._cachedMeta,n=t.iScale,o=[];let r,i;for(r=0,i=t.data.length;r<i;++r)o.push(n.getPixelForValue(this.getParsed(r)[n.axis],r));const a=e.barThickness;return{min:a||QR(t),pixels:o,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:a?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:t,_stacked:n,index:o},options:{base:r,minBarLength:i}}=this,a=r||0,s=this.getParsed(e),l=s._custom,c=e_(l);let u,d,p=s[t.axis],f=0,h=n?this.applyStack(t,s,n):p;h!==p&&(f=h-p,h=p),c&&(p=l.barStart,h=l.barEnd-l.barStart,0!==p&&$D(p)!==$D(l.barEnd)&&(f=0),f+=p);const g=YA(r)||c?f:r;let m=t.getPixelForValue(g);if(u=this.chart.getDataVisibility(e)?t.getPixelForValue(f+h):m,d=u-m,Math.abs(d)<i){d=function(e,t,n){return 0!==e?$D(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}(d,t,a)*i,p===a&&(m-=d/2);const e=t.getPixelForDecimal(0),r=t.getPixelForDecimal(1),l=Math.min(e,r),f=Math.max(e,r);m=Math.max(Math.min(m,f),l),u=m+d,n&&!c&&(s._stacks[t.axis]._visualValues[o]=t.getValueForPixel(u)-t.getValueForPixel(m))}if(m===t.getPixelForValue(a)){const e=$D(d)*t.getLineWidthForValue(a)/2;m+=e,d-=e}return{size:d,base:m,head:u,center:u+d/2}}_calculateBarIndexPixels(e,t){const n=t.scale,o=this.options,r=o.skipNull,i=tD(o.maxBarThickness,1/0);let a,s;if(t.grouped){const n=r?this._getStackCount(e):t.stackCount,l="flex"===o.barThickness?function(e,t,n,o){const r=t.pixels,i=r[e];let a=e>0?r[e-1]:null,s=e<r.length-1?r[e+1]:null;const l=n.categoryPercentage;null===a&&(a=i-(null===s?t.end-t.start:s-i)),null===s&&(s=i+i-a);const c=i-(i-Math.min(a,s))/2*l;return{chunk:Math.abs(s-a)/2*l/o,ratio:n.barPercentage,start:c}}(e,t,o,n):function(e,t,n,o){const r=n.barThickness;let i,a;return YA(r)?(i=t.min*n.categoryPercentage,a=n.barPercentage):(i=r*o,a=1),{chunk:i/o,ratio:a,start:t.pixels[e]-i/2}}(e,t,o,n),c=this._getStackIndex(this.index,this._cachedMeta.stack,r?e:void 0);a=l.start+l.chunk*c+l.chunk/2,s=Math.min(i,l.chunk*l.ratio)}else a=n.getPixelForValue(this.getParsed(e)[n.axis],e),s=Math.min(i,t.min*t.ratio);return{base:a-s/2,head:a+s/2,center:a,size:s}}draw(){const e=this._cachedMeta,t=e.vScale,n=e.data,o=n.length;let r=0;for(;r<o;++r)null===this.getParsed(r)[t.axis]||n[r].hidden||n[r].draw(this._ctx)}}class a_ extends YR{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:e=>"spacing"!==e,_indexable:e=>"spacing"!==e&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const t=e.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:n,color:o}}=e.legend.options;return t.labels.map(((t,r)=>{const i=e.getDatasetMeta(0).controller.getStyle(r);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,fontColor:o,lineWidth:i.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(r),index:r}}))}return[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){const n=this.getDataset().data,o=this._cachedMeta;if(!1===this._parsing)o._parsed=n;else{let r,i,a=e=>+n[e];if(ZA(n[e])){const{key:e="value"}=this._parsing;a=t=>+fD(n[t],e)}for(r=e,i=e+t;r<i;++r)o._parsed[r]=a(r)}}_getRotation(){return LD(this.options.rotation-90)}_getCircumference(){return LD(this.options.circumference)}_getRotationExtents(){let e=yD,t=-yD;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const o=this.chart.getDatasetMeta(n).controller,r=o._getRotation(),i=o._getCircumference();e=Math.min(e,r),t=Math.max(t,r+i)}return{rotation:e,circumference:t-e}}update(e){const t=this.chart,{chartArea:n}=t,o=this._cachedMeta,r=o.data,i=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(n.width,n.height)-i)/2,0),s=Math.min((l=this.options.cutout,c=a,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const u=this._getRingWeight(this.index),{circumference:d,rotation:p}=this._getRotationExtents(),{ratioX:f,ratioY:h,offsetX:g,offsetY:m}=function(e,t,n){let o=1,r=1,i=0,a=0;if(t<yD){const s=e,l=s+t,c=Math.cos(s),u=Math.sin(s),d=Math.cos(l),p=Math.sin(l),f=(e,t,o)=>zD(e,s,l,!0)?1:Math.max(t,t*n,o,o*n),h=(e,t,o)=>zD(e,s,l,!0)?-1:Math.min(t,t*n,o,o*n),g=f(0,c,d),m=f(SD,u,p),v=h(bD,c,d),b=h(bD+SD,u,p);o=(g-v)/2,r=(m-b)/2,i=-(g+v)/2,a=-(m+b)/2}return{ratioX:o,ratioY:r,offsetX:i,offsetY:a}}(p,d,s),v=(n.width-i)/f,b=(n.height-i)/h,y=Math.max(Math.min(v,b)/2,0),x=nD(this.options.radius,y),C=(x-Math.max(x*s,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=m*x,o.total=this.calculateTotal(),this.outerRadius=x-C*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-C*u,0),this.updateElements(r,0,r.length,e)}_circumference(e,t){const n=this.options,o=this._cachedMeta,r=this._getCircumference();return t&&n.animation.animateRotate||!this.chart.getDataVisibility(e)||null===o._parsed[e]||o.data[e].hidden?0:this.calculateCircumference(o._parsed[e]*r/yD)}updateElements(e,t,n,o){const r="reset"===o,i=this.chart,a=i.chartArea,s=i.options.animation,l=(a.left+a.right)/2,c=(a.top+a.bottom)/2,u=r&&s.animateScale,d=u?0:this.innerRadius,p=u?0:this.outerRadius,{sharedOptions:f,includeOptions:h}=this._getSharedOptions(t,o);let g,m=this._getRotation();for(g=0;g<t;++g)m+=this._circumference(g,r);for(g=t;g<t+n;++g){const t=this._circumference(g,r),n=e[g],i={x:l+this.offsetX,y:c+this.offsetY,startAngle:m,endAngle:m+t,circumference:t,outerRadius:p,innerRadius:d};h&&(i.options=f||this.resolveDataElementOptions(g,n.active?"active":o)),m+=t,this.updateElement(n,g,i,o)}}calculateTotal(){const e=this._cachedMeta,t=e.data;let n,o=0;for(n=0;n<t.length;n++){const r=e._parsed[n];null===r||isNaN(r)||!this.chart.getDataVisibility(n)||t[n].hidden||(o+=Math.abs(r))}return o}calculateCircumference(e){const t=this._cachedMeta.total;return t>0&&!isNaN(e)?yD*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,n=this.chart,o=n.data.labels||[],r=lT(t._parsed[e],n.options.locale);return{label:o[e]||"",value:r}}getMaxBorderWidth(e){let t=0;const n=this.chart;let o,r,i,a,s;if(!e)for(o=0,r=n.data.datasets.length;o<r;++o)if(n.isDatasetVisible(o)){i=n.getDatasetMeta(o),e=i.data,a=i.controller;break}if(!e)return 0;for(o=0,r=e.length;o<r;++o)s=a.resolveDataElementOptions(o),"inner"!==s.borderAlign&&(t=Math.max(t,s.borderWidth||0,s.hoverBorderWidth||0));return t}getMaxOffset(e){let t=0;for(let n=0,o=e.length;n<o;++n){const e=this.resolveDataElementOptions(n);t=Math.max(t,e.offset||0,e.hoverOffset||0)}return t}_getRingWeightOffset(e){let t=0;for(let n=0;n<e;++n)this.chart.isDatasetVisible(n)&&(t+=this._getRingWeight(n));return t}_getRingWeight(e){return Math.max(tD(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class s_ extends YR{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:n,data:o=[],_dataset:r}=t,i=this.chart._animationsDisabled;let{start:a,count:s}=function(e,t,n){const o=t.length;let r=0,i=o;if(e._sorted){const{iScale:a,_parsed:s}=e,l=a.axis,{min:c,max:u,minDefined:d,maxDefined:p}=a.getUserBounds();d&&(r=BD(Math.min(WD(s,l,c).lo,n?o:WD(t,l,a.getPixelForValue(c)).lo),0,o-1)),i=p?BD(Math.max(WD(s,a.axis,u,!0).hi+1,n?0:WD(t,l,a.getPixelForValue(u),!0).hi+1),r,o)-r:o-r}return{start:r,count:i}}(t,o,i);this._drawStart=a,this._drawCount=s,function(e){const{xScale:t,yScale:n,_scaleRanges:o}=e,r={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!o)return e._scaleRanges=r,!0;const i=o.xmin!==t.min||o.xmax!==t.max||o.ymin!==n.min||o.ymax!==n.max;return Object.assign(o,r),i}(t)&&(a=0,s=o.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=o;const l=this.resolveDatasetElementOptions(e);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(n,void 0,{animated:!i,options:l},e),this.updateElements(o,a,s,e)}updateElements(e,t,n,o){const r="reset"===o,{iScale:i,vScale:a,_stacked:s,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:u}=this._getSharedOptions(t,o),d=i.axis,p=a.axis,{spanGaps:f,segment:h}=this.options,g=ID(f)?f:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||r||"none"===o,v=t+n,b=e.length;let y=t>0&&this.getParsed(t-1);for(let n=0;n<b;++n){const f=e[n],b=m?f:{};if(n<t||n>=v){b.skip=!0;continue}const x=this.getParsed(n),C=YA(x[p]),w=b[d]=i.getPixelForValue(x[d],n),S=b[p]=r||C?a.getBasePixel():a.getPixelForValue(s?this.applyStack(a,x,s):x[p],n);b.skip=isNaN(w)||isNaN(S)||C,b.stop=n>0&&Math.abs(x[d]-y[d])>g,h&&(b.parsed=x,b.raw=l.data[n]),u&&(b.options=c||this.resolveDataElementOptions(n,f.active?"active":o)),m||this.updateElement(f,n,b,o),y=x}}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,o=e.data||[];if(!o.length)return n;const r=o[0].size(this.resolveDataElementOptions(0)),i=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(n,r,i)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}class l_ extends a_{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}function c_(e,t,n,o){const{controller:r,data:i,_sorted:a}=e,s=r._cachedMeta.iScale;if(s&&t===s.axis&&"r"!==t&&a&&i.length){const e=s._reversePixels?VD:WD;if(!o)return e(i,t,n);if(r._sharedOptions){const o=i[0],r="function"==typeof o.getRange&&o.getRange(t);if(r){const o=e(i,t,n-r),a=e(i,t,n+r);return{lo:o.lo,hi:a.hi}}}}return{lo:0,hi:i.length-1}}function u_(e,t,n,o,r){const i=e.getSortedVisibleDatasetMetas(),a=n[t];for(let e=0,n=i.length;e<n;++e){const{index:n,data:s}=i[e],{lo:l,hi:c}=c_(i[e],t,a,r);for(let e=l;e<=c;++e){const t=s[e];t.skip||o(t,n,e)}}}function d_(e,t,n,o,r){const i=[];if(!r&&!e.isPointInArea(t))return i;return u_(e,n,t,(function(n,a,s){(r||wT(n,e.chartArea,0))&&n.inRange(t.x,t.y,o)&&i.push({element:n,datasetIndex:a,index:s})}),!0),i}function p_(e,t,n,o,r,i){let a=[];const s=function(e){const t=-1!==e.indexOf("x"),n=-1!==e.indexOf("y");return function(e,o){const r=t?Math.abs(e.x-o.x):0,i=n?Math.abs(e.y-o.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(i,2))}}(n);let l=Number.POSITIVE_INFINITY;return u_(e,n,t,(function(n,c,u){const d=n.inRange(t.x,t.y,r);if(o&&!d)return;const p=n.getCenterPoint(r);if(!(!!i||e.isPointInArea(p))&&!d)return;const f=s(t,p);f<l?(a=[{element:n,datasetIndex:c,index:u}],l=f):f===l&&a.push({element:n,datasetIndex:c,index:u})})),a}function f_(e,t,n,o,r,i){return i||e.isPointInArea(t)?"r"!==n||o?p_(e,t,n,o,r,i):function(e,t,n,o){let r=[];return u_(e,n,t,(function(e,n,i){const{startAngle:a,endAngle:s}=e.getProps(["startAngle","endAngle"],o),{angle:l}=DD(e,{x:t.x,y:t.y});zD(l,a,s)&&r.push({element:e,datasetIndex:n,index:i})})),r}(e,t,n,r):[]}function h_(e,t,n,o,r){const i=[],a="x"===n?"inXRange":"inYRange";let s=!1;return u_(e,n,t,((e,o,l)=>{e[a]&&e[a](t[n],r)&&(i.push({element:e,datasetIndex:o,index:l}),s=s||e.inRange(t.x,t.y,r))})),o&&!s?[]:i}var g_={evaluateInteractionItems:u_,modes:{index(e,t,n,o){const r=gR(t,e),i=n.axis||"x",a=n.includeInvisible||!1,s=n.intersect?d_(e,r,i,o,a):f_(e,r,i,!1,o,a),l=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach((e=>{const t=s[0].index,n=e.data[t];n&&!n.skip&&l.push({element:n,datasetIndex:e.index,index:t})})),l):[]},dataset(e,t,n,o){const r=gR(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;let s=n.intersect?d_(e,r,i,o,a):f_(e,r,i,!1,o,a);if(s.length>0){const t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;e<n.length;++e)s.push({element:n[e],datasetIndex:t,index:e})}return s},point:(e,t,n,o)=>d_(e,gR(t,e),n.axis||"xy",o,n.includeInvisible||!1),nearest(e,t,n,o){const r=gR(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;return f_(e,r,i,n.intersect,o,a)},x:(e,t,n,o)=>h_(e,gR(t,e),"x",n.intersect,o),y:(e,t,n,o)=>h_(e,gR(t,e),"y",n.intersect,o)}};const m_=["left","top","right","bottom"];function v_(e,t){return e.filter((e=>e.pos===t))}function b_(e,t){return e.filter((e=>-1===m_.indexOf(e.pos)&&e.box.axis===t))}function y_(e,t){return e.sort(((e,n)=>{const o=t?n:e,r=t?e:n;return o.weight===r.weight?o.index-r.index:o.weight-r.weight}))}function x_(e,t){const n=function(e){const t={};for(const n of e){const{stack:e,pos:o,stackWeight:r}=n;if(!e||!m_.includes(o))continue;const i=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=r}return t}(e),{vBoxMaxWidth:o,hBoxMaxHeight:r}=t;let i,a,s;for(i=0,a=e.length;i<a;++i){s=e[i];const{fullSize:a}=s.box,l=n[s.stack],c=l&&s.stackWeight/l.weight;s.horizontal?(s.width=c?c*o:a&&t.availableWidth,s.height=r):(s.width=o,s.height=c?c*r:a&&t.availableHeight)}return n}function C_(e,t,n,o){return Math.max(e[n],t[n])+Math.max(e[o],t[o])}function w_(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function S_(e,t,n,o){const{pos:r,box:i}=n,a=e.maxPadding;if(!ZA(r)){n.size&&(e[r]-=n.size);const t=o[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?i.height:i.width),n.size=t.size/t.count,e[r]+=n.size}i.getPadding&&w_(a,i.getPadding());const s=Math.max(0,t.outerWidth-C_(a,e,"left","right")),l=Math.max(0,t.outerHeight-C_(a,e,"top","bottom")),c=s!==e.w,u=l!==e.h;return e.w=s,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function k_(e,t){const n=t.maxPadding;function o(e){const o={left:0,top:0,right:0,bottom:0};return e.forEach((e=>{o[e]=Math.max(t[e],n[e])})),o}return o(e?["left","right"]:["top","bottom"])}function E_(e,t,n,o){const r=[];let i,a,s,l,c,u;for(i=0,a=e.length,c=0;i<a;++i){s=e[i],l=s.box,l.update(s.width||t.w,s.height||t.h,k_(s.horizontal,t));const{same:a,other:d}=S_(t,n,s,o);c|=a&&r.length,u=u||d,l.fullSize||r.push(s)}return c&&E_(r,t,n,o)||u}function O_(e,t,n,o,r){e.top=n,e.left=t,e.right=t+o,e.bottom=n+r,e.width=o,e.height=r}function $_(e,t,n,o){const r=n.padding;let{x:i,y:a}=t;for(const s of e){const e=s.box,l=o[s.stack]||{count:1,placed:0,weight:1},c=s.stackWeight/l.weight||1;if(s.horizontal){const o=t.w*c,i=l.size||e.height;gD(l.start)&&(a=l.start),e.fullSize?O_(e,r.left,a,n.outerWidth-r.right-r.left,i):O_(e,t.left+l.placed,a,o,i),l.start=a,l.placed+=o,a=e.bottom}else{const o=t.h*c,a=l.size||e.width;gD(l.start)&&(i=l.start),e.fullSize?O_(e,i,r.top,a,n.outerHeight-r.bottom-r.top):O_(e,i,t.top+l.placed,a,o),l.start=i,l.placed+=o,i=e.right}}t.x=i,t.y=a}var N_={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;-1!==n&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,o){if(!e)return;const r=_T(e.options.layout.padding),i=Math.max(t-r.width,0),a=Math.max(n-r.height,0),s=function(e){const t=function(e){const t=[];let n,o,r,i,a,s;for(n=0,o=(e||[]).length;n<o;++n)r=e[n],({position:i,options:{stack:a,stackWeight:s=1}}=r),t.push({index:n,box:r,pos:i,horizontal:r.isHorizontal(),weight:r.weight,stack:a&&i+a,stackWeight:s});return t}(e),n=y_(t.filter((e=>e.box.fullSize)),!0),o=y_(v_(t,"left"),!0),r=y_(v_(t,"right")),i=y_(v_(t,"top"),!0),a=y_(v_(t,"bottom")),s=b_(t,"x"),l=b_(t,"y");return{fullSize:n,leftAndTop:o.concat(i),rightAndBottom:r.concat(l).concat(a).concat(s),chartArea:v_(t,"chartArea"),vertical:o.concat(r).concat(l),horizontal:i.concat(a).concat(s)}}(e.boxes),l=s.vertical,c=s.horizontal;rD(e.boxes,(e=>{"function"==typeof e.beforeLayout&&e.beforeLayout()}));const u=l.reduce(((e,t)=>t.box.options&&!1===t.box.options.display?e:e+1),0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:r,availableWidth:i,availableHeight:a,vBoxMaxWidth:i/2/u,hBoxMaxHeight:a/2}),p=Object.assign({},r);w_(p,_T(o));const f=Object.assign({maxPadding:p,w:i,h:a,x:r.left,y:r.top},r),h=x_(l.concat(c),d);E_(s.fullSize,f,d,h),E_(l,f,d,h),E_(c,f,d,h)&&E_(l,f,d,h),function(e){const t=e.maxPadding;function n(n){const o=Math.max(t[n]-e[n],0);return e[n]+=o,o}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}(f),$_(s.leftAndTop,f,d,h),f.x+=f.w,f.y+=f.h,$_(s.rightAndBottom,f,d,h),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},rD(s.chartArea,(t=>{const n=t.box;Object.assign(n,e.chartArea),n.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})}))}};class M_{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,o){return t=Math.max(0,t||e.width),n=n||e.height,{width:t,height:Math.max(0,o?Math.floor(t/o):n)}}isAttached(e){return!0}updateConfig(e){}}class I_ extends M_{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const P_="$chartjs",L_={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},j_=e=>null===e||""===e;const A_=!!yR&&{passive:!0};function D_(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,A_)}function T_(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function R_(e,t,n){const o=e.canvas,r=new MutationObserver((e=>{let t=!1;for(const n of e)t=t||T_(n.addedNodes,o),t=t&&!T_(n.removedNodes,o);t&&n()}));return r.observe(document,{childList:!0,subtree:!0}),r}function __(e,t,n){const o=e.canvas,r=new MutationObserver((e=>{let t=!1;for(const n of e)t=t||T_(n.removedNodes,o),t=t&&!T_(n.addedNodes,o);t&&n()}));return r.observe(document,{childList:!0,subtree:!0}),r}const z_=new Map;let B_=0;function H_(){const e=window.devicePixelRatio;e!==B_&&(B_=e,z_.forEach(((t,n)=>{n.currentDevicePixelRatio!==e&&t()})))}function F_(e,t,n){const o=e.canvas,r=o&&cR(o);if(!r)return;const i=GD(((e,t)=>{const o=r.clientWidth;n(e,t),o<r.clientWidth&&n()}),window),a=new ResizeObserver((e=>{const t=e[0],n=t.contentRect.width,o=t.contentRect.height;0===n&&0===o||i(n,o)}));return a.observe(r),function(e,t){z_.size||window.addEventListener("resize",H_),z_.set(e,t)}(e,i),a}function W_(e,t,n){n&&n.disconnect(),"resize"===t&&function(e){z_.delete(e),z_.size||window.removeEventListener("resize",H_)}(e)}function V_(e,t,n){const o=e.canvas,r=GD((t=>{null!==e.ctx&&n(function(e,t){const n=L_[e.type]||e.type,{x:o,y:r}=gR(e,t);return{type:n,chart:t,native:e,x:void 0!==o?o:null,y:void 0!==r?r:null}}(t,e))}),e);return function(e,t,n){e&&e.addEventListener(t,n,A_)}(o,t,r),r}class K_ extends M_{acquireContext(e,t){const n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(function(e,t){const n=e.style,o=e.getAttribute("height"),r=e.getAttribute("width");if(e[P_]={initial:{height:o,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",j_(r)){const t=xR(e,"width");void 0!==t&&(e.width=t)}if(j_(o))if(""===e.style.height)e.height=e.width/(t||2);else{const t=xR(e,"height");void 0!==t&&(e.height=t)}}(e,t),n):null}releaseContext(e){const t=e.canvas;if(!t[P_])return!1;const n=t[P_].initial;["height","width"].forEach((e=>{const o=n[e];YA(o)?t.removeAttribute(e):t.setAttribute(e,o)}));const o=n.style||{};return Object.keys(o).forEach((e=>{t.style[e]=o[e]})),t.width=t.width,delete t[P_],!0}addEventListener(e,t,n){this.removeEventListener(e,t);const o=e.$proxies||(e.$proxies={}),r={attach:R_,detach:__,resize:F_}[t]||V_;o[t]=r(e,t,n)}removeEventListener(e,t){const n=e.$proxies||(e.$proxies={}),o=n[t];if(!o)return;({attach:W_,detach:W_,resize:W_}[t]||D_)(e,t,o),n[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,o){return vR(e,t,n,o)}isAttached(e){const t=e&&cR(e);return!(!t||!t.isConnected)}}let q_=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){const{x:t,y:n}=this.getProps(["x","y"],e);return{x:t,y:n}}hasValue(){return ID(this.x)&&ID(this.y)}getProps(e,t){const n=this.$animations;if(!t||!n)return this;const o={};return e.forEach((e=>{o[e]=n[e]&&n[e].active()?n[e]._to:this[e]})),o}};function X_(e,t){const n=e.options.ticks,o=function(e){const t=e.options.offset,n=e._tickSize(),o=e._length/n+(t?0:1),r=e._maxLength/n;return Math.floor(Math.min(o,r))}(e),r=Math.min(n.maxTicksLimit||o,o),i=n.major.enabled?function(e){const t=[];let n,o;for(n=0,o=e.length;n<o;n++)e[n].major&&t.push(n);return t}(t):[],a=i.length,s=i[0],l=i[a-1],c=[];if(a>r)return function(e,t,n,o){let r,i=0,a=n[0];for(o=Math.ceil(o),r=0;r<e.length;r++)r===a&&(t.push(e[r]),i++,a=n[i*o])}(t,c,i,a/r),c;const u=function(e,t,n){const o=function(e){const t=e.length;let n,o;if(t<2)return!1;for(o=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==o)return!1;return o}(e),r=t.length/n;if(!o)return Math.max(r,1);const i=function(e){const t=[],n=Math.sqrt(e);let o;for(o=1;o<n;o++)e%o==0&&(t.push(o),t.push(e/o));return n===(0|n)&&t.push(n),t.sort(((e,t)=>e-t)).pop(),t}(o);for(let e=0,t=i.length-1;e<t;e++){const t=i[e];if(t>r)return t}return Math.max(r,1)}(i,t,r);if(a>0){let e,n;const o=a>1?Math.round((l-s)/(a-1)):null;for(U_(t,c,u,YA(o)?0:s-o,s),e=0,n=a-1;e<n;e++)U_(t,c,u,i[e],i[e+1]);return U_(t,c,u,l,YA(o)?t.length:l+o),c}return U_(t,c,u),c}function U_(e,t,n,o,r){const i=tD(o,0),a=Math.min(tD(r,e.length),e.length);let s,l,c,u=0;for(n=Math.ceil(n),r&&(s=r-o,n=s/Math.floor(s/n)),c=i;c<0;)u++,c=Math.round(i+u*n);for(l=Math.max(i,0);l<a;l++)l===c&&(t.push(e[l]),u++,c=Math.round(i+u*n))}const G_=(e,t,n)=>"top"===t||"left"===t?e[t]+n:e[t]-n,Y_=(e,t)=>Math.min(t||e,e);function Q_(e,t){const n=[],o=e.length/t,r=e.length;let i=0;for(;i<r;i+=o)n.push(e[Math.floor(i)]);return n}function Z_(e,t,n){const o=e.ticks.length,r=Math.min(t,o-1),i=e._startPixel,a=e._endPixel,s=1e-6;let l,c=e.getPixelForTick(r);if(!(n&&(l=1===o?Math.max(c-i,a-c):0===t?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(r-1))/2,c+=r<t?l:-l,c<i-s||c>a+s)))return c}function J_(e){return e.drawTicks?e.tickLength:0}function ez(e,t){if(!e.display)return 0;const n=zT(e.font,t),o=_T(e.padding);return(QA(e.text)?e.text.length:1)*n.lineHeight+o.height}function tz(e,t,n){let o=YD(e);return(n&&"right"!==t||!n&&"right"===t)&&(o=(e=>"left"===e?"right":"right"===e?"left":e)(o)),o}class nz extends q_{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:o}=this;return e=eD(e,Number.POSITIVE_INFINITY),t=eD(t,Number.NEGATIVE_INFINITY),n=eD(n,Number.POSITIVE_INFINITY),o=eD(o,Number.NEGATIVE_INFINITY),{min:eD(e,n),max:eD(t,o),minDefined:JA(e),maxDefined:JA(t)}}getMinMax(e){let t,{min:n,max:o,minDefined:r,maxDefined:i}=this.getUserBounds();if(r&&i)return{min:n,max:o};const a=this.getMatchingVisibleMetas();for(let s=0,l=a.length;s<l;++s)t=a[s].controller.getMinMax(this,e),r||(n=Math.min(n,t.min)),i||(o=Math.max(o,t.max));return n=i&&n>o?o:n,o=r&&n>o?n:o,{min:eD(n,eD(o,n)),max:eD(o,eD(n,o))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){oD(this.options.beforeUpdate,[this])}update(e,t,n){const{beginAtZero:o,grace:r,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(e,t,n){const{min:o,max:r}=e,i=nD(t,(r-o)/2),a=(e,t)=>n&&0===e?0:e+t;return{min:a(o,-Math.abs(i)),max:a(r,i)}}(this,r,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const s=a<this.ticks.length;this._convertTicksToLabels(s?Q_(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||"auto"===i.source)&&(this.ticks=X_(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e,t,n=this.options.reverse;this.isHorizontal()?(e=this.left,t=this.right):(e=this.top,t=this.bottom,n=!n),this._startPixel=e,this._endPixel=t,this._reversePixels=n,this._length=t-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){oD(this.options.afterUpdate,[this])}beforeSetDimensions(){oD(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){oD(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),oD(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){oD(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const t=this.options.ticks;let n,o,r;for(n=0,o=e.length;n<o;n++)r=e[n],r.label=oD(t.callback,[r.value,n,e],this)}afterTickToLabelConversion(){oD(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){oD(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,t=e.ticks,n=Y_(this.ticks.length,e.ticks.maxTicksLimit),o=t.minRotation||0,r=t.maxRotation;let i,a,s,l=o;if(!this._isVisible()||!t.display||o>=r||n<=1||!this.isHorizontal())return void(this.labelRotation=o);const c=this._getLabelSizes(),u=c.widest.width,d=c.highest.height,p=BD(this.chart.width-u,0,this.maxWidth);i=e.offset?this.maxWidth/n:p/(n-1),u+6>i&&(i=p/(n-(e.offset?.5:1)),a=this.maxHeight-J_(e.grid)-t.padding-ez(e.title,this.chart.options.font),s=Math.sqrt(u*u+d*d),l=jD(Math.min(Math.asin(BD((c.highest.height+6)/i,-1,1)),Math.asin(BD(a/s,-1,1))-Math.asin(BD(d/s,-1,1)))),l=Math.max(o,Math.min(r,l))),this.labelRotation=l}afterCalculateLabelRotation(){oD(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){oD(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:n,title:o,grid:r}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const i=ez(o,t.options.font);if(a?(e.width=this.maxWidth,e.height=J_(r)+i):(e.height=this.maxHeight,e.width=J_(r)+i),n.display&&this.ticks.length){const{first:t,last:o,widest:r,highest:i}=this._getLabelSizes(),s=2*n.padding,l=LD(this.labelRotation),c=Math.cos(l),u=Math.sin(l);if(a){const t=n.mirror?0:u*r.width+c*i.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{const t=n.mirror?0:c*r.width+u*i.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,o,u,c)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,o){const{ticks:{align:r,padding:i},position:a}=this.options,s=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,d=0;s?l?(u=o*e.width,d=n*t.height):(u=n*e.height,d=o*t.width):"start"===r?d=t.width:"end"===r?u=e.width:"inner"!==r&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-a+i)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-c+i)*this.width/(this.width-c),0)}else{let n=t.height/2,o=e.height/2;"start"===r?(n=0,o=e.height):"end"===r&&(n=t.height,o=0),this.paddingTop=n+i,this.paddingBottom=o+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){oD(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return"top"===t||"bottom"===t||"x"===e}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){let t,n;for(this.beforeTickToLabelConversion(),this.generateTickLabels(e),t=0,n=e.length;t<n;t++)YA(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const t=this.options.ticks.sampleSize;let n=this.ticks;t<n.length&&(n=Q_(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){const{ctx:o,_longestTextCache:r}=this,i=[],a=[],s=Math.floor(t/Y_(t,n));let l,c,u,d,p,f,h,g,m,v,b,y=0,x=0;for(l=0;l<t;l+=s){if(d=e[l].label,p=this._resolveTickFontOptions(l),o.font=f=p.string,h=r[f]=r[f]||{data:{},gc:[]},g=p.lineHeight,m=v=0,YA(d)||QA(d)){if(QA(d))for(c=0,u=d.length;c<u;++c)b=d[c],YA(b)||QA(b)||(m=vT(o,h.data,h.gc,m,b),v+=g)}else m=vT(o,h.data,h.gc,m,d),v=g;i.push(m),a.push(v),y=Math.max(m,y),x=Math.max(v,x)}!function(e,t){rD(e,(e=>{const n=e.gc,o=n.length/2;let r;if(o>t){for(r=0;r<o;++r)delete e.data[n[r]];n.splice(0,o)}}))}(r,t);const C=i.indexOf(y),w=a.indexOf(x),S=e=>({width:i[e]||0,height:a[e]||0});return{first:S(0),last:S(t-1),widest:S(C),highest:S(w),widths:i,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return BD(this._alignToPixels?bT(this.chart,t,0):t,-32768,32767)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&e<t.length){const n=t[e];return n.$context||(n.$context=function(e,t,n){return HT(e,{tick:n,index:t,type:"tick"})}(this.getContext(),e,n))}return this.$context||(this.$context=HT(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const e=this.options.ticks,t=LD(this.labelRotation),n=Math.abs(Math.cos(t)),o=Math.abs(Math.sin(t)),r=this._getLabelSizes(),i=e.autoSkipPadding||0,a=r?r.widest.width+i:0,s=r?r.highest.height+i:0;return this.isHorizontal()?s*n>a*o?a/n:s/o:s*o<a*n?s/n:a/o}_isVisible(){const e=this.options.display;return"auto"!==e?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const t=this.axis,n=this.chart,o=this.options,{grid:r,position:i,border:a}=o,s=r.offset,l=this.isHorizontal(),c=this.ticks.length+(s?1:0),u=J_(r),d=[],p=a.setContext(this.getContext()),f=p.display?p.width:0,h=f/2,g=function(e){return bT(n,e,f)};let m,v,b,y,x,C,w,S,k,E,O,$;if("top"===i)m=g(this.bottom),C=this.bottom-u,S=m-h,E=g(e.top)+h,$=e.bottom;else if("bottom"===i)m=g(this.top),E=e.top,$=g(e.bottom)-h,C=m+h,S=this.top+u;else if("left"===i)m=g(this.right),x=this.right-u,w=m-h,k=g(e.left)+h,O=e.right;else if("right"===i)m=g(this.left),k=e.left,O=g(e.right)-h,x=m+h,w=this.left+u;else if("x"===t){if("center"===i)m=g((e.top+e.bottom)/2+.5);else if(ZA(i)){const e=Object.keys(i)[0],t=i[e];m=g(this.chart.scales[e].getPixelForValue(t))}E=e.top,$=e.bottom,C=m+h,S=C+u}else if("y"===t){if("center"===i)m=g((e.left+e.right)/2);else if(ZA(i)){const e=Object.keys(i)[0],t=i[e];m=g(this.chart.scales[e].getPixelForValue(t))}x=m-h,w=x-u,k=e.left,O=e.right}const N=tD(o.ticks.maxTicksLimit,c),M=Math.max(1,Math.ceil(c/N));for(v=0;v<c;v+=M){const e=this.getContext(v),t=r.setContext(e),o=a.setContext(e),i=t.lineWidth,c=t.color,u=o.dash||[],p=o.dashOffset,f=t.tickWidth,h=t.tickColor,g=t.tickBorderDash||[],m=t.tickBorderDashOffset;b=Z_(this,v,s),void 0!==b&&(y=bT(n,b,i),l?x=w=k=O=y:C=S=E=$=y,d.push({tx1:x,ty1:C,tx2:w,ty2:S,x1:k,y1:E,x2:O,y2:$,width:i,color:c,borderDash:u,borderDashOffset:p,tickWidth:f,tickColor:h,tickBorderDash:g,tickBorderDashOffset:m}))}return this._ticksLength=c,this._borderValue=m,d}_computeLabelItems(e){const t=this.axis,n=this.options,{position:o,ticks:r}=n,i=this.isHorizontal(),a=this.ticks,{align:s,crossAlign:l,padding:c,mirror:u}=r,d=J_(n.grid),p=d+c,f=u?-c:p,h=-LD(this.labelRotation),g=[];let m,v,b,y,x,C,w,S,k,E,O,$,N="middle";if("top"===o)C=this.bottom-f,w=this._getXAxisLabelAlignment();else if("bottom"===o)C=this.top+f,w=this._getXAxisLabelAlignment();else if("left"===o){const e=this._getYAxisLabelAlignment(d);w=e.textAlign,x=e.x}else if("right"===o){const e=this._getYAxisLabelAlignment(d);w=e.textAlign,x=e.x}else if("x"===t){if("center"===o)C=(e.top+e.bottom)/2+p;else if(ZA(o)){const e=Object.keys(o)[0],t=o[e];C=this.chart.scales[e].getPixelForValue(t)+p}w=this._getXAxisLabelAlignment()}else if("y"===t){if("center"===o)x=(e.left+e.right)/2-p;else if(ZA(o)){const e=Object.keys(o)[0],t=o[e];x=this.chart.scales[e].getPixelForValue(t)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===t&&("start"===s?N="top":"end"===s&&(N="bottom"));const M=this._getLabelSizes();for(m=0,v=a.length;m<v;++m){b=a[m],y=b.label;const e=r.setContext(this.getContext(m));S=this.getPixelForTick(m)+r.labelOffset,k=this._resolveTickFontOptions(m),E=k.lineHeight,O=QA(y)?y.length:1;const t=O/2,n=e.color,s=e.textStrokeColor,c=e.textStrokeWidth;let d,p=w;if(i?(x=S,"inner"===w&&(p=m===v-1?this.options.reverse?"left":"right":0===m?this.options.reverse?"right":"left":"center"),$="top"===o?"near"===l||0!==h?-O*E+E/2:"center"===l?-M.highest.height/2-t*E+E:-M.highest.height+E/2:"near"===l||0!==h?E/2:"center"===l?M.highest.height/2-t*E:M.highest.height-O*E,u&&($*=-1),0===h||e.showLabelBackdrop||(x+=E/2*Math.sin(h))):(C=S,$=(1-O)*E/2),e.showLabelBackdrop){const t=_T(e.backdropPadding),n=M.heights[m],o=M.widths[m];let r=$-t.top,i=0-t.left;switch(N){case"middle":r-=n/2;break;case"bottom":r-=n}switch(w){case"center":i-=o/2;break;case"right":i-=o;break;case"inner":m===v-1?i-=o:m>0&&(i-=o/2)}d={left:i,top:r,width:o+t.width,height:n+t.height,color:e.backdropColor}}g.push({label:y,font:k,textOffset:$,options:{rotation:h,color:n,strokeColor:s,strokeWidth:c,textAlign:p,textBaseline:N,translation:[x,C],backdrop:d}})}return g}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-LD(this.labelRotation))return"top"===e?"left":"right";let n="center";return"start"===t.align?n="left":"end"===t.align?n="right":"inner"===t.align&&(n="inner"),n}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:n,mirror:o,padding:r}}=this.options,i=e+r,a=this._getLabelSizes().widest.width;let s,l;return"left"===t?o?(l=this.right+r,"near"===n?s="left":"center"===n?(s="center",l+=a/2):(s="right",l+=a)):(l=this.right-i,"near"===n?s="right":"center"===n?(s="center",l-=a/2):(s="left",l=this.left)):"right"===t?o?(l=this.left+r,"near"===n?s="right":"center"===n?(s="center",l-=a/2):(s="left",l-=a)):(l=this.left+i,"near"===n?s="left":"center"===n?(s="center",l+=a/2):(s="right",l=this.right)):s="right",{textAlign:s,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;return"left"===t||"right"===t?{top:0,left:this.left,bottom:e.height,right:this.right}:"top"===t||"bottom"===t?{top:this.top,left:0,bottom:this.bottom,right:e.width}:void 0}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:n,top:o,width:r,height:i}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,o,r,i),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const n=this.ticks.findIndex((t=>t.value===e));if(n>=0){return t.setContext(this.getContext(n)).lineWidth}return 0}drawGrid(e){const t=this.options.grid,n=this.ctx,o=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let r,i;const a=(e,t,o)=>{o.width&&o.color&&(n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.setLineDash(o.borderDash||[]),n.lineDashOffset=o.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(r=0,i=o.length;r<i;++r){const e=o[r];t.drawOnChartArea&&a({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&a({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:t,options:{border:n,grid:o}}=this,r=n.setContext(this.getContext()),i=n.display?r.width:0;if(!i)return;const a=o.setContext(this.getContext(0)).lineWidth,s=this._borderValue;let l,c,u,d;this.isHorizontal()?(l=bT(e,this.left,i)-i/2,c=bT(e,this.right,a)+a/2,u=d=s):(u=bT(e,this.top,i)-i/2,d=bT(e,this.bottom,a)+a/2,l=c=s),t.save(),t.lineWidth=r.width,t.strokeStyle=r.color,t.beginPath(),t.moveTo(l,u),t.lineTo(c,d),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;const t=this.ctx,n=this._computeLabelArea();n&&ST(t,n);const o=this.getLabelItems(e);for(const e of o){const n=e.options,o=e.font;MT(t,e.label,0,e.textOffset,o,n)}n&&kT(t)}drawTitle(){const{ctx:e,options:{position:t,title:n,reverse:o}}=this;if(!n.display)return;const r=zT(n.font),i=_T(n.padding),a=n.align;let s=r.lineHeight/2;"bottom"===t||"center"===t||ZA(t)?(s+=i.bottom,QA(n.text)&&(s+=r.lineHeight*(n.text.length-1))):s+=i.top;const{titleX:l,titleY:c,maxWidth:u,rotation:d}=function(e,t,n,o){const{top:r,left:i,bottom:a,right:s,chart:l}=e,{chartArea:c,scales:u}=l;let d,p,f,h=0;const g=a-r,m=s-i;if(e.isHorizontal()){if(p=QD(o,i,s),ZA(n)){const e=Object.keys(n)[0],o=n[e];f=u[e].getPixelForValue(o)+g-t}else f="center"===n?(c.bottom+c.top)/2+g-t:G_(e,n,t);d=s-i}else{if(ZA(n)){const e=Object.keys(n)[0],o=n[e];p=u[e].getPixelForValue(o)-m+t}else p="center"===n?(c.left+c.right)/2-m+t:G_(e,n,t);f=QD(o,a,r),h="left"===n?-SD:SD}return{titleX:p,titleY:f,maxWidth:d,rotation:h}}(this,s,t,a);MT(e,n.text,0,0,r,{color:n.color,maxWidth:u,rotation:d,textAlign:tz(a,t,o),textBaseline:"middle",translation:[l,c]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,t=e.ticks&&e.ticks.z||0,n=tD(e.grid&&e.grid.z,-1),o=tD(e.border&&e.border.z,0);return this._isVisible()&&this.draw===nz.prototype.draw?[{z:n,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:o,draw:()=>{this.drawBorder()}},{z:t,draw:e=>{this.drawLabels(e)}}]:[{z:t,draw:e=>{this.draw(e)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",o=[];let r,i;for(r=0,i=t.length;r<i;++r){const i=t[r];i[n]!==this.id||e&&i.type!==e||o.push(i)}return o}_resolveTickFontOptions(e){return zT(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class oz{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const t=Object.getPrototypeOf(e);let n;(function(e){return"id"in e&&"defaults"in e})(t)&&(n=this.register(t));const o=this.items,r=e.id,i=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+e);return r in o||(o[r]=e,function(e,t,n){const o=cD(Object.create(null),[n?mT.get(n):{},mT.get(t),e.defaults]);mT.set(t,o),e.defaultRoutes&&function(e,t){Object.keys(t).forEach((n=>{const o=n.split("."),r=o.pop(),i=[e].concat(o).join("."),a=t[n].split("."),s=a.pop(),l=a.join(".");mT.route(i,r,l,s)}))}(t,e.defaultRoutes);e.descriptors&&mT.describe(t,e.descriptors)}(e,i,n),this.override&&mT.override(e.id,e.overrides)),i}get(e){return this.items[e]}unregister(e){const t=this.items,n=e.id,o=this.scope;n in t&&delete t[n],o&&n in mT[o]&&(delete mT[o][n],this.override&&delete dT[n])}}class rz{constructor(){this.controllers=new oz(YR,"datasets",!0),this.elements=new oz(q_,"elements"),this.plugins=new oz(Object,"plugins"),this.scales=new oz(nz,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,n){[...t].forEach((t=>{const o=n||this._getRegistryForType(t);n||o.isForType(t)||o===this.plugins&&t.id?this._exec(e,o,t):rD(t,(t=>{const o=n||this._getRegistryForType(t);this._exec(e,o,t)}))}))}_exec(e,t,n){const o=hD(e);oD(n["before"+o],[],n),t[e](n),oD(n["after"+o],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){const o=t.get(e);if(void 0===o)throw new Error('"'+e+'" is not a registered '+n+".");return o}}var iz=new rz;class az{constructor(){this._init=[]}notify(e,t,n,o){"beforeInit"===t&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const r=o?this._descriptors(e).filter(o):this._descriptors(e),i=this._notify(r,e,t,n);return"afterDestroy"===t&&(this._notify(r,e,"stop"),this._notify(this._init,e,"uninstall")),i}_notify(e,t,n,o){o=o||{};for(const r of e){const e=r.plugin;if(!1===oD(e[n],[t,o,r.options],e)&&o.cancelable)return!1}return!0}invalidate(){YA(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const n=e&&e.config,o=tD(n.options&&n.options.plugins,{}),r=function(e){const t={},n=[],o=Object.keys(iz.plugins.items);for(let e=0;e<o.length;e++)n.push(iz.getPlugin(o[e]));const r=e.plugins||[];for(let e=0;e<r.length;e++){const o=r[e];-1===n.indexOf(o)&&(n.push(o),t[o.id]=!0)}return{plugins:n,localIds:t}}(n);return!1!==o||t?function(e,{plugins:t,localIds:n},o,r){const i=[],a=e.getContext();for(const s of t){const t=s.id,l=sz(o[t],r);null!==l&&i.push({plugin:s,options:lz(e.config,{plugin:s,local:n[t]},l,a)})}return i}(e,r,o,t):[]}_notifyStateChanges(e){const t=this._oldCache||[],n=this._cache,o=(e,t)=>e.filter((e=>!t.some((t=>e.plugin.id===t.plugin.id))));this._notify(o(t,n),e,"stop"),this._notify(o(n,t),e,"start")}}function sz(e,t){return t||!1!==e?!0===e?{}:e:null}function lz(e,{plugin:t,local:n},o,r){const i=e.pluginScopeKeys(t),a=e.getOptionScopes(o,i);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function cz(e,t){const n=mT.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function uz(e){if("x"===e||"y"===e||"r"===e)return e}function dz(e){return"top"===e||"bottom"===e?"x":"left"===e||"right"===e?"y":void 0}function pz(e,...t){if(uz(e))return e;for(const n of t){const t=n.axis||dz(n.position)||e.length>1&&uz(e[0].toLowerCase());if(t)return t}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function fz(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function hz(e,t){const n=dT[e.type]||{scales:{}},o=t.scales||{},r=cz(e.type,t),i=Object.create(null);return Object.keys(o).forEach((t=>{const a=o[t];if(!ZA(a))return console.error(`Invalid scale configuration for scale: ${t}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const s=pz(t,a,function(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter((t=>t.xAxisID===e||t.yAxisID===e));if(n.length)return fz(e,"x",n[0])||fz(e,"y",n[0])}return{}}(t,e),mT.scales[a.type]),l=function(e,t){return e===t?"_index_":"_value_"}(s,r),c=n.scales||{};i[t]=uD(Object.create(null),[{axis:s},a,c[s],c[l]])})),e.data.datasets.forEach((n=>{const r=n.type||e.type,a=n.indexAxis||cz(r,t),s=(dT[r]||{}).scales||{};Object.keys(s).forEach((e=>{const t=function(e,t){let n=e;return"_index_"===e?n=t:"_value_"===e&&(n="x"===t?"y":"x"),n}(e,a),r=n[t+"AxisID"]||t;i[r]=i[r]||Object.create(null),uD(i[r],[{axis:t},o[r],s[e]])}))})),Object.keys(i).forEach((e=>{const t=i[e];uD(t,[mT.scales[t.type],mT.scale])})),i}function gz(e){const t=e.options||(e.options={});t.plugins=tD(t.plugins,{}),t.scales=hz(e,t)}function mz(e){return(e=e||{}).datasets=e.datasets||[],e.labels=e.labels||[],e}const vz=new Map,bz=new Set;function yz(e,t){let n=vz.get(e);return n||(n=t(),vz.set(e,n),bz.add(n)),n}const xz=(e,t,n)=>{const o=fD(t,n);void 0!==o&&e.add(o)};class Cz{constructor(e){this._config=function(e){return(e=e||{}).data=mz(e.data),gz(e),e}(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=mz(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),gz(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return yz(e,(()=>[[`datasets.${e}`,""]]))}datasetAnimationScopeKeys(e,t){return yz(`${e}.transition.${t}`,(()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]]))}datasetElementScopeKeys(e,t){return yz(`${e}-${t}`,(()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]]))}pluginScopeKeys(e){const t=e.id;return yz(`${this.type}-plugin-${t}`,(()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]]))}_cachedScopes(e,t){const n=this._scopeCache;let o=n.get(e);return o&&!t||(o=new Map,n.set(e,o)),o}getOptionScopes(e,t,n){const{options:o,type:r}=this,i=this._cachedScopes(e,n),a=i.get(t);if(a)return a;const s=new Set;t.forEach((t=>{e&&(s.add(e),t.forEach((t=>xz(s,e,t)))),t.forEach((e=>xz(s,o,e))),t.forEach((e=>xz(s,dT[r]||{},e))),t.forEach((e=>xz(s,mT,e))),t.forEach((e=>xz(s,pT,e)))}));const l=Array.from(s);return 0===l.length&&l.push(Object.create(null)),bz.has(t)&&i.set(t,l),l}chartOptionScopes(){const{options:e,type:t}=this;return[e,dT[t]||{},mT.datasets[t]||{},{type:t},mT,pT]}resolveNamedOptions(e,t,n,o=[""]){const r={$shared:!0},{resolver:i,subPrefixes:a}=wz(this._resolverCache,e,o);let s=i;if(function(e,t){const{isScriptable:n,isIndexable:o}=VT(e);for(const r of t){const t=n(r),i=o(r),a=(i||t)&&e[r];if(t&&(mD(a)||Sz(a))||i&&QA(a))return!0}return!1}(i,t)){r.$shared=!1;s=WT(i,n=mD(n)?n():n,this.createResolver(e,n,a))}for(const e of t)r[e]=s[e];return r}createResolver(e,t,n=[""],o){const{resolver:r}=wz(this._resolverCache,e,n);return ZA(t)?WT(r,t,void 0,o):r}}function wz(e,t,n){let o=e.get(t);o||(o=new Map,e.set(t,o));const r=n.join();let i=o.get(r);if(!i){i={resolver:FT(t,n),subPrefixes:n.filter((e=>!e.toLowerCase().includes("hover")))},o.set(r,i)}return i}const Sz=e=>ZA(e)&&Object.getOwnPropertyNames(e).some((t=>mD(e[t])));const kz=["top","bottom","left","right","chartArea"];function Ez(e,t){return"top"===e||"bottom"===e||-1===kz.indexOf(e)&&"x"===t}function Oz(e,t){return function(n,o){return n[e]===o[e]?n[t]-o[t]:n[e]-o[e]}}function $z(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),oD(n&&n.onComplete,[e],t)}function Nz(e){const t=e.chart,n=t.options.animation;oD(n&&n.onProgress,[e],t)}function Mz(e){return lR()&&"string"==typeof e?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Iz={},Pz=e=>{const t=Mz(e);return Object.values(Iz).filter((e=>e.canvas===t)).pop()};function Lz(e,t,n){const o=Object.keys(e);for(const r of o){const o=+r;if(o>=t){const i=e[r];delete e[r],(n>0||o>t)&&(e[o+n]=i)}}}function jz(e,t,n){return e.options.clip?e[n]:t[n]}let Az=class{static defaults=mT;static instances=Iz;static overrides=dT;static registry=iz;static version="4.4.4";static getChart=Pz;static register(...e){iz.add(...e),Dz()}static unregister(...e){iz.remove(...e),Dz()}constructor(e,t){const n=this.config=new Cz(t),o=Mz(e),r=Pz(o);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const i=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||function(e){return!lR()||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?I_:K_}(o)),this.platform.updateConfig(n);const a=this.platform.acquireContext(o,i.aspectRatio),s=a&&a.canvas,l=s&&s.height,c=s&&s.width;this.id=GA(),this.ctx=a,this.canvas=s,this.width=c,this.height=l,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new az,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(e,t){let n;return function(...o){return t?(clearTimeout(n),n=setTimeout(e,t,o)):e.apply(this,o),t}}((e=>this.update(e)),i.resizeDelay||0),this._dataChanges=[],Iz[this.id]=this,a&&s?(AR.listen(this,"complete",$z),AR.listen(this,"progress",Nz),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:o,_aspectRatio:r}=this;return YA(e)?t&&r?r:o?n/o:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return iz}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():bR(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return yT(this.canvas,this.ctx),this}stop(){return AR.stop(this),this}resize(e,t){AR.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const n=this.options,o=this.canvas,r=n.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(o,e,t,r),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,bR(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),oD(n.onResize,[this,i],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){rD(this.options.scales||{},((e,t)=>{e.id=t}))}buildOrUpdateScales(){const e=this.options,t=e.scales,n=this.scales,o=Object.keys(n).reduce(((e,t)=>(e[t]=!1,e)),{});let r=[];t&&(r=r.concat(Object.keys(t).map((e=>{const n=t[e],o=pz(e,n),r="r"===o,i="x"===o;return{options:n,dposition:r?"chartArea":i?"bottom":"left",dtype:r?"radialLinear":i?"category":"linear"}})))),rD(r,(t=>{const r=t.options,i=r.id,a=pz(i,r),s=tD(r.type,t.dtype);void 0!==r.position&&Ez(r.position,a)===Ez(t.dposition)||(r.position=t.dposition),o[i]=!0;let l=null;if(i in n&&n[i].type===s)l=n[i];else{l=new(iz.getScale(s))({id:i,type:s,ctx:this.ctx,chart:this}),n[l.id]=l}l.init(r,e)})),rD(o,((e,t)=>{e||delete n[t]})),rD(n,(e=>{N_.configure(this,e,e.options),N_.addBox(this,e)}))}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort(((e,t)=>e.index-t.index)),n>t){for(let e=t;e<n;++e)this._destroyDatasetMeta(e);e.splice(t,n-t)}this._sortedMetasets=e.slice(0).sort(Oz("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach(((e,n)=>{0===t.filter((t=>t===e._dataset)).length&&this._destroyDatasetMeta(n)}))}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let n,o;for(this._removeUnreferencedMetasets(),n=0,o=t.length;n<o;n++){const o=t[n];let r=this.getDatasetMeta(n);const i=o.type||this.config.type;if(r.type&&r.type!==i&&(this._destroyDatasetMeta(n),r=this.getDatasetMeta(n)),r.type=i,r.indexAxis=o.indexAxis||cz(i,this.options),r.order=o.order||0,r.index=n,r.label=""+o.label,r.visible=this.isDatasetVisible(n),r.controller)r.controller.updateIndex(n),r.controller.linkScales();else{const t=iz.getController(i),{datasetElementType:o,dataElementType:a}=mT.datasets[i];Object.assign(t,{dataElementType:iz.getElement(a),datasetElementType:o&&iz.getElement(o)}),r.controller=new t(this,n),e.push(r.controller)}}return this._updateMetasets(),e}_resetElements(){rD(this.data.datasets,((e,t)=>{this.getDatasetMeta(t).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0}))return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let e=0,t=this.data.datasets.length;e<t;e++){const{controller:t}=this.getDatasetMeta(e),n=!o&&-1===r.indexOf(t);t.buildOrUpdateElements(n),i=Math.max(+t.getMaxOverflow(),i)}i=this._minPadding=n.layout.autoPadding?i:0,this._updateLayout(i),o||rD(r,(e=>{e.reset()})),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Oz("z","_idx"));const{_active:a,_lastEvent:s}=this;s?this._eventHandler(s,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){rD(this.scales,(e=>{N_.removeBox(this,e)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),n=new Set(e.events);vD(t,n)&&!!this._responsiveListeners===e.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:n,start:o,count:r}of t){Lz(e,o,"_removeElements"===n?-r:r)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,n=t=>new Set(e.filter((e=>e[0]===t)).map(((e,t)=>t+","+e.splice(1).join(",")))),o=n(0);for(let e=1;e<t;e++)if(!vD(o,n(e)))return;return Array.from(o).map((e=>e.split(","))).map((e=>({method:e[1],start:+e[2],count:+e[3]})))}_updateLayout(e){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;N_.update(this,this.width,this.height,e);const t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],rD(this.boxes,(e=>{n&&"chartArea"===e.position||(e.configure&&e.configure(),this._layers.push(...e._layers()))}),this),this._layers.forEach(((e,t)=>{e._idx=t})),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,n=this.data.datasets.length;t<n;++t)this._updateDataset(t,mD(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){const n=this.getDatasetMeta(e),o={meta:n,index:e,mode:t,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",o)&&(n.controller._update(t),o.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",o))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(AR.has(this)?this.attached&&!AR.running(this)&&AR.start(this):(this.draw(),$z({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const t=this._sortedMetasets,n=[];let o,r;for(o=0,r=t.length;o<r;++o){const r=t[o];e&&!r.visible||n.push(r)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,n=e._clip,o=!n.disabled,r=function(e,t){const{xScale:n,yScale:o}=e;return n&&o?{left:jz(n,t,"left"),right:jz(n,t,"right"),top:jz(o,t,"top"),bottom:jz(o,t,"bottom")}:t}(e,this.chartArea),i={meta:e,index:e.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(o&&ST(t,{left:!1===n.left?0:r.left-n.left,right:!1===n.right?this.width:r.right+n.right,top:!1===n.top?0:r.top-n.top,bottom:!1===n.bottom?this.height:r.bottom+n.bottom}),e.controller.draw(),o&&kT(t),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(e){return wT(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,o){const r=g_.modes[t];return"function"==typeof r?r(this,e,n,o):[]}getDatasetMeta(e){const t=this.data.datasets[e],n=this._metasets;let o=n.filter((e=>e&&e._dataset===t)).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(o)),o}getContext(){return this.$context||(this.$context=HT(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const n=this.getDatasetMeta(e);return"boolean"==typeof n.hidden?!n.hidden:!t.hidden}setDatasetVisibility(e,t){this.getDatasetMeta(e).hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){const o=n?"show":"hide",r=this.getDatasetMeta(e),i=r.controller._resolveAnimations(void 0,o);gD(t)?(r.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),i.update(r,{visible:n}),this.update((t=>t.datasetIndex===e?o:void 0)))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),AR.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),yT(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete Iz[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,t=this.platform,n=(n,o)=>{t.addEventListener(this,n,o),e[n]=o},o=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};rD(this.options.events,(e=>n(e,o)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,n=(n,o)=>{t.addEventListener(this,n,o),e[n]=o},o=(n,o)=>{e[n]&&(t.removeEventListener(this,n,o),delete e[n])},r=(e,t)=>{this.canvas&&this.resize(e,t)};let i;const a=()=>{o("attach",a),this.attached=!0,this.resize(),n("resize",r),n("detach",i)};i=()=>{this.attached=!1,o("resize",r),this._stop(),this._resize(0,0),n("attach",a)},t.isAttached(this.canvas)?a():i()}unbindEvents(){rD(this._listeners,((e,t)=>{this.platform.removeEventListener(this,t,e)})),this._listeners={},rD(this._responsiveListeners,((e,t)=>{this.platform.removeEventListener(this,t,e)})),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){const o=n?"set":"remove";let r,i,a,s;for("dataset"===t&&(r=this.getDatasetMeta(e[0].datasetIndex),r.controller["_"+o+"DatasetHoverStyle"]()),a=0,s=e.length;a<s;++a){i=e[a];const t=i&&this.getDatasetMeta(i.datasetIndex).controller;t&&t[o+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const t=this._active||[],n=e.map((({datasetIndex:e,index:t})=>{const n=this.getDatasetMeta(e);if(!n)throw new Error("No dataset found at index "+e);return{datasetIndex:e,element:n.data[t],index:t}}));!iD(n,t)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return 1===this._plugins._cache.filter((t=>t.plugin.id===e)).length}_updateHoverStyles(e,t,n){const o=this.options.hover,r=(e,t)=>e.filter((e=>!t.some((t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)))),i=r(t,e),a=n?e:r(e,t);i.length&&this.updateHoverStyle(i,o.mode,!1),a.length&&o.mode&&this.updateHoverStyle(a,o.mode,!0)}_eventHandler(e,t){const n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},o=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1===this.notifyPlugins("beforeEvent",n,o))return;const r=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,o),(r||n.changed)&&this.render(),this}_handleEvent(e,t,n){const{_active:o=[],options:r}=this,i=t,a=this._getActiveElements(e,o,n,i),s=function(e){return"mouseup"===e.type||"click"===e.type||"contextmenu"===e.type}(e),l=function(e,t,n,o){return n&&"mouseout"!==e.type?o?t:e:null}(e,this._lastEvent,n,s);n&&(this._lastEvent=null,oD(r.onHover,[e,a,this],this),s&&oD(r.onClick,[e,a,this],this));const c=!iD(a,o);return(c||t)&&(this._active=a,this._updateHoverStyles(a,o,t)),this._lastEvent=l,c}_getActiveElements(e,t,n,o){if("mouseout"===e.type)return[];if(!n)return t;const r=this.options.hover;return this.getElementsAtEventForMode(e,r.mode,r,o)}};function Dz(){return rD(Az.instances,(e=>e._plugins.invalidate()))}function Tz(e,t,n,o){const r=DT(e.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const i=(n-t)/2,a=Math.min(i,o*t/2),s=e=>{const t=(n-Math.min(i,e))*o/2;return BD(e,0,Math.min(i,t))};return{outerStart:s(r.outerStart),outerEnd:s(r.outerEnd),innerStart:BD(r.innerStart,0,a),innerEnd:BD(r.innerEnd,0,a)}}function Rz(e,t,n,o){return{x:n+e*Math.cos(t),y:o+e*Math.sin(t)}}function _z(e,t,n,o,r,i){const{x:a,y:s,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+o+n-c,0),p=u>0?u+o+n+c:0;let f=0;const h=r-l;if(o){const e=((u>0?u-o:0)+(d>0?d-o:0))/2;f=(h-(0!==e?h*e/(e+o):h))/2}const g=(h-Math.max(.001,h*d-n/bD)/d)/2,m=l+g+f,v=r-g-f,{outerStart:b,outerEnd:y,innerStart:x,innerEnd:C}=Tz(t,p,d,v-m),w=d-b,S=d-y,k=m+b/w,E=v-y/S,O=p+x,$=p+C,N=m+x/O,M=v-C/$;if(e.beginPath(),i){const t=(k+E)/2;if(e.arc(a,s,d,k,t),e.arc(a,s,d,t,E),y>0){const t=Rz(S,E,a,s);e.arc(t.x,t.y,y,E,v+SD)}const n=Rz($,v,a,s);if(e.lineTo(n.x,n.y),C>0){const t=Rz($,M,a,s);e.arc(t.x,t.y,C,v+SD,M+Math.PI)}const o=(v-C/p+(m+x/p))/2;if(e.arc(a,s,p,v-C/p,o,!0),e.arc(a,s,p,o,m+x/p,!0),x>0){const t=Rz(O,N,a,s);e.arc(t.x,t.y,x,N+Math.PI,m-SD)}const r=Rz(w,m,a,s);if(e.lineTo(r.x,r.y),b>0){const t=Rz(w,k,a,s);e.arc(t.x,t.y,b,m-SD,k)}}else{e.moveTo(a,s);const t=Math.cos(k)*d+a,n=Math.sin(k)*d+s;e.lineTo(t,n);const o=Math.cos(E)*d+a,r=Math.sin(E)*d+s;e.lineTo(o,r)}e.closePath()}function zz(e,t,n,o,r){const{fullCircles:i,startAngle:a,circumference:s,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:p}=l,f="inner"===l.borderAlign;if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=p,f?(e.lineWidth=2*c,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let h=t.endAngle;if(i){_z(e,t,n,o,h,r);for(let t=0;t<i;++t)e.stroke();isNaN(s)||(h=a+(s%yD||yD))}f&&function(e,t,n){const{startAngle:o,pixelMargin:r,x:i,y:a,outerRadius:s,innerRadius:l}=t;let c=r/s;e.beginPath(),e.arc(i,a,s,o-c,n+c),l>r?(c=r/l,e.arc(i,a,l,n+c,o-c,!0)):e.arc(i,a,r,n+SD,o-SD),e.closePath(),e.clip()}(e,t,h),i||(_z(e,t,n,o,h,r),e.stroke())}function Bz(e,t,n=t){e.lineCap=tD(n.borderCapStyle,t.borderCapStyle),e.setLineDash(tD(n.borderDash,t.borderDash)),e.lineDashOffset=tD(n.borderDashOffset,t.borderDashOffset),e.lineJoin=tD(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=tD(n.borderWidth,t.borderWidth),e.strokeStyle=tD(n.borderColor,t.borderColor)}function Hz(e,t,n){e.lineTo(n.x,n.y)}function Fz(e,t,n={}){const o=e.length,{start:r=0,end:i=o-1}=n,{start:a,end:s}=t,l=Math.max(r,a),c=Math.min(i,s),u=r<a&&i<a||r>s&&i>s;return{count:o,start:l,loop:t.loop,ilen:c<l&&!u?o+c-l:c-l}}function Wz(e,t,n,o){const{points:r,options:i}=t,{count:a,start:s,loop:l,ilen:c}=Fz(r,n,o),u=function(e){return e.stepped?ET:e.tension||"monotone"===e.cubicInterpolationMode?OT:Hz}(i);let d,p,f,{move:h=!0,reverse:g}=o||{};for(d=0;d<=c;++d)p=r[(s+(g?c-d:d))%a],p.skip||(h?(e.moveTo(p.x,p.y),h=!1):u(e,f,p,g,i.stepped),f=p);return l&&(p=r[(s+(g?c:0))%a],u(e,f,p,g,i.stepped)),!!l}function Vz(e,t,n,o){const r=t.points,{count:i,start:a,ilen:s}=Fz(r,n,o),{move:l=!0,reverse:c}=o||{};let u,d,p,f,h,g,m=0,v=0;const b=e=>(a+(c?s-e:e))%i,y=()=>{f!==h&&(e.lineTo(m,h),e.lineTo(m,f),e.lineTo(m,g))};for(l&&(d=r[b(0)],e.moveTo(d.x,d.y)),u=0;u<=s;++u){if(d=r[b(u)],d.skip)continue;const t=d.x,n=d.y,o=0|t;o===p?(n<f?f=n:n>h&&(h=n),m=(v*m+t)/++v):(y(),e.lineTo(t,n),p=o,v=0,f=h=n),g=n}y()}function Kz(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!(e._decimated||e._loop||t.tension||"monotone"===t.cubicInterpolationMode||t.stepped||n)?Vz:Wz}const qz="function"==typeof Path2D;function Xz(e,t,n,o){qz&&!t.options.segment?function(e,t,n,o){let r=t._path;r||(r=t._path=new Path2D,t.path(r,n,o)&&r.closePath()),Bz(e,t.options),e.stroke(r)}(e,t,n,o):function(e,t,n,o){const{segments:r,options:i}=t,a=Kz(t);for(const s of r)Bz(e,i,s.style),e.beginPath(),a(e,t,s,{start:n,end:n+o-1})&&e.closePath(),e.stroke()}(e,t,n,o)}function Uz(e,t,n,o){const r=e.options,{[n]:i}=e.getProps([n],o);return Math.abs(t-i)<r.radius+r.hitRadius}function Gz(e,t){const{x:n,y:o,base:r,width:i,height:a}=e.getProps(["x","y","base","width","height"],t);let s,l,c,u,d;return e.horizontal?(d=a/2,s=Math.min(n,r),l=Math.max(n,r),c=o-d,u=o+d):(d=i/2,s=n-d,l=n+d,c=Math.min(o,r),u=Math.max(o,r)),{left:s,top:c,right:l,bottom:u}}function Yz(e,t,n,o){return e?0:BD(t,n,o)}function Qz(e){const t=Gz(e),n=t.right-t.left,o=t.bottom-t.top,r=function(e,t,n){const o=e.options.borderWidth,r=e.borderSkipped,i=TT(o);return{t:Yz(r.top,i.top,0,n),r:Yz(r.right,i.right,0,t),b:Yz(r.bottom,i.bottom,0,n),l:Yz(r.left,i.left,0,t)}}(e,n/2,o/2),i=function(e,t,n){const{enableBorderRadius:o}=e.getProps(["enableBorderRadius"]),r=e.options.borderRadius,i=RT(r),a=Math.min(t,n),s=e.borderSkipped,l=o||ZA(r);return{topLeft:Yz(!l||s.top||s.left,i.topLeft,0,a),topRight:Yz(!l||s.top||s.right,i.topRight,0,a),bottomLeft:Yz(!l||s.bottom||s.left,i.bottomLeft,0,a),bottomRight:Yz(!l||s.bottom||s.right,i.bottomRight,0,a)}}(e,n/2,o/2);return{outer:{x:t.left,y:t.top,w:n,h:o,radius:i},inner:{x:t.left+r.l,y:t.top+r.t,w:n-r.l-r.r,h:o-r.t-r.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(r.t,r.l)),topRight:Math.max(0,i.topRight-Math.max(r.t,r.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(r.b,r.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(r.b,r.r))}}}}function Zz(e,t,n,o){const r=null===t,i=null===n,a=e&&!(r&&i)&&Gz(e,o);return a&&(r||HD(t,a.left,a.right))&&(i||HD(n,a.top,a.bottom))}function Jz(e,t){e.rect(t.x,t.y,t.w,t.h)}function eB(e,t,n={}){const o=e.x!==n.x?-t:0,r=e.y!==n.y?-t:0,i=(e.x+e.w!==n.x+n.w?t:0)-o,a=(e.y+e.h!==n.y+n.h?t:0)-r;return{x:e.x+o,y:e.y+r,w:e.w+i,h:e.h+a,radius:e.radius}}const tB=(e,t)=>{let{boxHeight:n=t,boxWidth:o=t}=e;return e.usePointStyle&&(n=Math.min(n,t),o=e.pointStyleWidth||Math.min(o,t)),{boxWidth:o,boxHeight:n,itemHeight:Math.max(t,n)}};class nB extends q_{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let t=oD(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter((t=>e.filter(t,this.chart.data)))),e.sort&&(t=t.sort(((t,n)=>e.sort(t,n,this.chart.data)))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display)return void(this.width=this.height=0);const n=e.labels,o=zT(n.font),r=o.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:s}=tB(n,r);let l,c;t.font=o.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(i,r,a,s)+10):(c=this.maxHeight,l=this._fitCols(i,o,a,s)+10),this.width=Math.min(l,e.maxWidth||this.maxWidth),this.height=Math.min(c,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,o){const{ctx:r,maxWidth:i,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.lineWidths=[0],c=o+a;let u=e;r.textAlign="left",r.textBaseline="middle";let d=-1,p=-c;return this.legendItems.forEach(((e,f)=>{const h=n+t/2+r.measureText(e.text).width;(0===f||l[l.length-1]+h+2*a>i)&&(u+=c,l[l.length-(f>0?0:1)]=0,p+=c,d++),s[f]={left:0,top:p,row:d,width:h,height:o},l[l.length-1]+=h+a})),u}_fitCols(e,t,n,o){const{ctx:r,maxHeight:i,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.columnSizes=[],c=i-e;let u=a,d=0,p=0,f=0,h=0;return this.legendItems.forEach(((e,i)=>{const{itemWidth:g,itemHeight:m}=function(e,t,n,o,r){const i=function(e,t,n,o){let r=e.text;r&&"string"!=typeof r&&(r=r.reduce(((e,t)=>e.length>t.length?e:t)));return t+n.size/2+o.measureText(r).width}(o,e,t,n),a=function(e,t,n){let o=e;"string"!=typeof t.text&&(o=oB(t,n));return o}(r,o,t.lineHeight);return{itemWidth:i,itemHeight:a}}(n,t,r,e,o);i>0&&p+m+2*a>c&&(u+=d+a,l.push({width:d,height:p}),f+=d+a,h++,d=p=0),s[i]={left:f,top:p,col:h,width:g,height:m},d=Math.max(d,g),p+=m+a})),u+=d,l.push({width:d,height:p}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:o},rtl:r}}=this,i=kR(r,this.left,this.width);if(this.isHorizontal()){let r=0,a=QD(n,this.left+o,this.right-this.lineWidths[r]);for(const s of t)r!==s.row&&(r=s.row,a=QD(n,this.left+o,this.right-this.lineWidths[r])),s.top+=this.top+e+o,s.left=i.leftForLtr(i.x(a),s.width),a+=s.width+o}else{let r=0,a=QD(n,this.top+e+o,this.bottom-this.columnSizes[r].height);for(const s of t)s.col!==r&&(r=s.col,a=QD(n,this.top+e+o,this.bottom-this.columnSizes[r].height)),s.top=a,s.left+=this.left+o,s.left=i.leftForLtr(i.x(s.left),s.width),a+=s.height+o}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const e=this.ctx;ST(e,this),this._draw(),kT(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:n,ctx:o}=this,{align:r,labels:i}=e,a=mT.color,s=kR(e.rtl,this.left,this.width),l=zT(i.font),{padding:c}=i,u=l.size,d=u/2;let p;this.drawTitle(),o.textAlign=s.textAlign("left"),o.textBaseline="middle",o.lineWidth=.5,o.font=l.string;const{boxWidth:f,boxHeight:h,itemHeight:g}=tB(i,u),m=this.isHorizontal(),v=this._computeTitleHeight();p=m?{x:QD(r,this.left+c,this.right-n[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:QD(r,this.top+v+c,this.bottom-t[0].height),line:0},ER(this.ctx,e.textDirection);const b=g+c;this.legendItems.forEach(((y,x)=>{o.strokeStyle=y.fontColor,o.fillStyle=y.fontColor;const C=o.measureText(y.text).width,w=s.textAlign(y.textAlign||(y.textAlign=i.textAlign)),S=f+d+C;let k=p.x,E=p.y;s.setWidth(this.width),m?x>0&&k+S+c>this.right&&(E=p.y+=b,p.line++,k=p.x=QD(r,this.left+c,this.right-n[p.line])):x>0&&E+b>this.bottom&&(k=p.x=k+t[p.line].width+c,p.line++,E=p.y=QD(r,this.top+v+c,this.bottom-t[p.line].height));if(function(e,t,n){if(isNaN(f)||f<=0||isNaN(h)||h<0)return;o.save();const r=tD(n.lineWidth,1);if(o.fillStyle=tD(n.fillStyle,a),o.lineCap=tD(n.lineCap,"butt"),o.lineDashOffset=tD(n.lineDashOffset,0),o.lineJoin=tD(n.lineJoin,"miter"),o.lineWidth=r,o.strokeStyle=tD(n.strokeStyle,a),o.setLineDash(tD(n.lineDash,[])),i.usePointStyle){const a={radius:h*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:r},l=s.xPlus(e,f/2);CT(o,a,l,t+d,i.pointStyleWidth&&f)}else{const i=t+Math.max((u-h)/2,0),a=s.leftForLtr(e,f),l=RT(n.borderRadius);o.beginPath(),Object.values(l).some((e=>0!==e))?IT(o,{x:a,y:i,w:f,h:h,radius:l}):o.rect(a,i,f,h),o.fill(),0!==r&&o.stroke()}o.restore()}(s.x(k),E,y),k=((e,t,n,o)=>e===(o?"left":"right")?n:"center"===e?(t+n)/2:t)(w,k+f+d,m?k+S:this.right,e.rtl),function(e,t,n){MT(o,n.text,e,t+g/2,l,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})}(s.x(k),E,y),m)p.x+=S+c;else if("string"!=typeof y.text){const e=l.lineHeight;p.y+=oB(y,e)+c}else p.y+=b})),OR(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,n=zT(t.font),o=_T(t.padding);if(!t.display)return;const r=kR(e.rtl,this.left,this.width),i=this.ctx,a=t.position,s=n.size/2,l=o.top+s;let c,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,u=QD(e.align,u,this.right-d);else{const t=this.columnSizes.reduce(((e,t)=>Math.max(e,t.height)),0);c=l+QD(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}const p=QD(a,u,u+d);i.textAlign=r.textAlign(YD(a)),i.textBaseline="middle",i.strokeStyle=t.color,i.fillStyle=t.color,i.font=n.string,MT(i,t.text,p,c,n)}_computeTitleHeight(){const e=this.options.title,t=zT(e.font),n=_T(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,o,r;if(HD(e,this.left,this.right)&&HD(t,this.top,this.bottom))for(r=this.legendHitBoxes,n=0;n<r.length;++n)if(o=r[n],HD(e,o.left,o.left+o.width)&&HD(t,o.top,o.top+o.height))return this.legendItems[n];return null}handleEvent(e){const t=this.options;if(!function(e,t){if(("mousemove"===e||"mouseout"===e)&&(t.onHover||t.onLeave))return!0;if(t.onClick&&("click"===e||"mouseup"===e))return!0;return!1}(e.type,t))return;const n=this._getLegendItemAt(e.x,e.y);if("mousemove"===e.type||"mouseout"===e.type){const i=this._hoveredItem,a=(r=n,null!==(o=i)&&null!==r&&o.datasetIndex===r.datasetIndex&&o.index===r.index);i&&!a&&oD(t.onLeave,[e,i,this],this),this._hoveredItem=n,n&&!a&&oD(t.onHover,[e,n,this],this)}else n&&oD(t.onClick,[e,n,this],this);var o,r}}function oB(e,t){return t*(e.text?e.text.length:0)}var rB={id:"legend",_element:nB,start(e,t,n){const o=e.legend=new nB({ctx:e.ctx,options:n,chart:e});N_.configure(e,o,n),N_.addBox(e,o)},stop(e){N_.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const o=e.legend;N_.configure(e,o,n),o.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const o=t.datasetIndex,r=n.chart;r.isDatasetVisible(o)?(r.hide(o),t.hidden=!0):(r.show(o),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:o,textAlign:r,color:i,useBorderRadius:a,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map((e=>{const l=e.controller.getStyle(n?0:void 0),c=_T(l.borderWidth);return{text:t[e.index].label,fillStyle:l.backgroundColor,fontColor:i,hidden:!e.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:o||l.pointStyle,rotation:l.rotation,textAlign:r||l.textAlign,borderRadius:a&&(s||l.borderRadius),datasetIndex:e.index}}),this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};let iB=class extends q_{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){const n=this.options;if(this.left=0,this.top=0,!n.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=e,this.height=this.bottom=t;const o=QA(n.text)?n.text.length:1;this._padding=_T(n.padding);const r=o*zT(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const e=this.options.position;return"top"===e||"bottom"===e}_drawArgs(e){const{top:t,left:n,bottom:o,right:r,options:i}=this,a=i.align;let s,l,c,u=0;return this.isHorizontal()?(l=QD(a,n,r),c=t+e,s=r-n):("left"===i.position?(l=n+e,c=QD(a,o,t),u=-.5*bD):(l=r-e,c=QD(a,t,o),u=.5*bD),s=o-t),{titleX:l,titleY:c,maxWidth:s,rotation:u}}draw(){const e=this.ctx,t=this.options;if(!t.display)return;const n=zT(t.font),o=n.lineHeight/2+this._padding.top,{titleX:r,titleY:i,maxWidth:a,rotation:s}=this._drawArgs(o);MT(e,t.text,0,0,n,{color:t.color,maxWidth:a,rotation:s,textAlign:YD(t.align),textBaseline:"middle",translation:[r,i]})}};var aB={id:"title",_element:iB,start(e,t,n){!function(e,t){const n=new iB({ctx:e.ctx,options:t,chart:e});N_.configure(e,n,t),N_.addBox(e,n),e.titleBlock=n}(e,n)},stop(e){const t=e.titleBlock;N_.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const o=e.titleBlock;N_.configure(e,o,n),o.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const sB={average(e){if(!e.length)return!1;let t,n,o=new Set,r=0,i=0;for(t=0,n=e.length;t<n;++t){const n=e[t].element;if(n&&n.hasValue()){const e=n.tooltipPosition();o.add(e.x),r+=e.y,++i}}if(0===i||0===o.size)return!1;return{x:[...o].reduce(((e,t)=>e+t))/o.size,y:r/i}},nearest(e,t){if(!e.length)return!1;let n,o,r,i=t.x,a=t.y,s=Number.POSITIVE_INFINITY;for(n=0,o=e.length;n<o;++n){const o=e[n].element;if(o&&o.hasValue()){const e=TD(t,o.getCenterPoint());e<s&&(s=e,r=o)}}if(r){const e=r.tooltipPosition();i=e.x,a=e.y}return{x:i,y:a}}};function lB(e,t){return t&&(QA(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function cB(e){return("string"==typeof e||e instanceof String)&&e.indexOf("\n")>-1?e.split("\n"):e}function uB(e,t){const{element:n,datasetIndex:o,index:r}=t,i=e.getDatasetMeta(o).controller,{label:a,value:s}=i.getLabelAndValue(r);return{chart:e,label:a,parsed:i.getParsed(r),raw:e.data.datasets[o].data[r],formattedValue:s,dataset:i.getDataset(),dataIndex:r,datasetIndex:o,element:n}}function dB(e,t){const n=e.chart.ctx,{body:o,footer:r,title:i}=e,{boxWidth:a,boxHeight:s}=t,l=zT(t.bodyFont),c=zT(t.titleFont),u=zT(t.footerFont),d=i.length,p=r.length,f=o.length,h=_T(t.padding);let g=h.height,m=0,v=o.reduce(((e,t)=>e+t.before.length+t.lines.length+t.after.length),0);if(v+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),v){g+=f*(t.displayColors?Math.max(s,l.lineHeight):l.lineHeight)+(v-f)*l.lineHeight+(v-1)*t.bodySpacing}p&&(g+=t.footerMarginTop+p*u.lineHeight+(p-1)*t.footerSpacing);let b=0;const y=function(e){m=Math.max(m,n.measureText(e).width+b)};return n.save(),n.font=c.string,rD(e.title,y),n.font=l.string,rD(e.beforeBody.concat(e.afterBody),y),b=t.displayColors?a+2+t.boxPadding:0,rD(o,(e=>{rD(e.before,y),rD(e.lines,y),rD(e.after,y)})),b=0,n.font=u.string,rD(e.footer,y),n.restore(),m+=h.width,{width:m,height:g}}function pB(e,t,n,o){const{x:r,width:i}=n,{width:a,chartArea:{left:s,right:l}}=e;let c="center";return"center"===o?c=r<=(s+l)/2?"left":"right":r<=i/2?c="left":r>=a-i/2&&(c="right"),function(e,t,n,o){const{x:r,width:i}=o,a=n.caretSize+n.caretPadding;return"left"===e&&r+i+a>t.width||"right"===e&&r-i-a<0||void 0}(c,e,t,n)&&(c="center"),c}function fB(e,t,n){const o=n.yAlign||t.yAlign||function(e,t){const{y:n,height:o}=t;return n<o/2?"top":n>e.height-o/2?"bottom":"center"}(e,n);return{xAlign:n.xAlign||t.xAlign||pB(e,t,n,o),yAlign:o}}function hB(e,t,n,o){const{caretSize:r,caretPadding:i,cornerRadius:a}=e,{xAlign:s,yAlign:l}=n,c=r+i,{topLeft:u,topRight:d,bottomLeft:p,bottomRight:f}=RT(a);let h=function(e,t){let{x:n,width:o}=e;return"right"===t?n-=o:"center"===t&&(n-=o/2),n}(t,s);const g=function(e,t,n){let{y:o,height:r}=e;return"top"===t?o+=n:o-="bottom"===t?r+n:r/2,o}(t,l,c);return"center"===l?"left"===s?h+=c:"right"===s&&(h-=c):"left"===s?h-=Math.max(u,p)+r:"right"===s&&(h+=Math.max(d,f)+r),{x:BD(h,0,o.width-t.width),y:BD(g,0,o.height-t.height)}}function gB(e,t,n){const o=_T(n.padding);return"center"===t?e.x+e.width/2:"right"===t?e.x+e.width-o.right:e.x+o.left}function mB(e){return lB([],cB(e))}function vB(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const bB={beforeTitle:UA,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,o=n?n.length:0;if(this&&this.options&&"dataset"===this.options.mode)return t.dataset.label||"";if(t.label)return t.label;if(o>0&&t.dataIndex<o)return n[t.dataIndex]}return""},afterTitle:UA,beforeBody:UA,beforeLabel:UA,label(e){if(this&&this.options&&"dataset"===this.options.mode)return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return YA(n)||(t+=n),t},labelColor(e){const t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:UA,afterBody:UA,beforeFooter:UA,footer:UA,afterFooter:UA};function yB(e,t,n,o){const r=e[t].call(n,o);return void 0===r?bB[t].call(n,o):r}class xB extends q_{static positioners=sB;constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,n=this.options.setContext(this.getContext()),o=n.enabled&&t.options.animation&&n.animations,r=new _R(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=(e=this.chart.getContext(),t=this,n=this._tooltipItems,HT(e,{tooltip:t,tooltipItems:n,type:"tooltip"})));var e,t,n}getTitle(e,t){const{callbacks:n}=t,o=yB(n,"beforeTitle",this,e),r=yB(n,"title",this,e),i=yB(n,"afterTitle",this,e);let a=[];return a=lB(a,cB(o)),a=lB(a,cB(r)),a=lB(a,cB(i)),a}getBeforeBody(e,t){return mB(yB(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:n}=t,o=[];return rD(e,(e=>{const t={before:[],lines:[],after:[]},r=vB(n,e);lB(t.before,cB(yB(r,"beforeLabel",this,e))),lB(t.lines,yB(r,"label",this,e)),lB(t.after,cB(yB(r,"afterLabel",this,e))),o.push(t)})),o}getAfterBody(e,t){return mB(yB(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:n}=t,o=yB(n,"beforeFooter",this,e),r=yB(n,"footer",this,e),i=yB(n,"afterFooter",this,e);let a=[];return a=lB(a,cB(o)),a=lB(a,cB(r)),a=lB(a,cB(i)),a}_createItems(e){const t=this._active,n=this.chart.data,o=[],r=[],i=[];let a,s,l=[];for(a=0,s=t.length;a<s;++a)l.push(uB(this.chart,t[a]));return e.filter&&(l=l.filter(((t,o,r)=>e.filter(t,o,r,n)))),e.itemSort&&(l=l.sort(((t,o)=>e.itemSort(t,o,n)))),rD(l,(t=>{const n=vB(e.callbacks,t);o.push(yB(n,"labelColor",this,t)),r.push(yB(n,"labelPointStyle",this,t)),i.push(yB(n,"labelTextColor",this,t))})),this.labelColors=o,this.labelPointStyles=r,this.labelTextColors=i,this.dataPoints=l,l}update(e,t){const n=this.options.setContext(this.getContext()),o=this._active;let r,i=[];if(o.length){const e=sB[n.position].call(this,o,this._eventPosition);i=this._createItems(n),this.title=this.getTitle(i,n),this.beforeBody=this.getBeforeBody(i,n),this.body=this.getBody(i,n),this.afterBody=this.getAfterBody(i,n),this.footer=this.getFooter(i,n);const t=this._size=dB(this,n),a=Object.assign({},e,t),s=fB(this.chart,n,a),l=hB(n,a,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,r={opacity:1,x:l.x,y:l.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}else 0!==this.opacity&&(r={opacity:0});this._tooltipItems=i,this.$context=void 0,r&&this._resolveAnimations().update(this,r),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,o){const r=this.getCaretPosition(e,n,o);t.lineTo(r.x1,r.y1),t.lineTo(r.x2,r.y2),t.lineTo(r.x3,r.y3)}getCaretPosition(e,t,n){const{xAlign:o,yAlign:r}=this,{caretSize:i,cornerRadius:a}=n,{topLeft:s,topRight:l,bottomLeft:c,bottomRight:u}=RT(a),{x:d,y:p}=e,{width:f,height:h}=t;let g,m,v,b,y,x;return"center"===r?(y=p+h/2,"left"===o?(g=d,m=g-i,b=y+i,x=y-i):(g=d+f,m=g+i,b=y-i,x=y+i),v=g):(m="left"===o?d+Math.max(s,c)+i:"right"===o?d+f-Math.max(l,u)-i:this.caretX,"top"===r?(b=p,y=b-i,g=m-i,v=m+i):(b=p+h,y=b+i,g=m+i,v=m-i),x=b),{x1:g,x2:m,x3:v,y1:b,y2:y,y3:x}}drawTitle(e,t,n){const o=this.title,r=o.length;let i,a,s;if(r){const l=kR(n.rtl,this.x,this.width);for(e.x=gB(this,n.titleAlign,n),t.textAlign=l.textAlign(n.titleAlign),t.textBaseline="middle",i=zT(n.titleFont),a=n.titleSpacing,t.fillStyle=n.titleColor,t.font=i.string,s=0;s<r;++s)t.fillText(o[s],l.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+a,s+1===r&&(e.y+=n.titleMarginBottom-a)}}_drawColorBox(e,t,n,o,r){const i=this.labelColors[n],a=this.labelPointStyles[n],{boxHeight:s,boxWidth:l}=r,c=zT(r.bodyFont),u=gB(this,"left",r),d=o.x(u),p=s<c.lineHeight?(c.lineHeight-s)/2:0,f=t.y+p;if(r.usePointStyle){const t={radius:Math.min(l,s)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},n=o.leftForLtr(d,l)+l/2,c=f+s/2;e.strokeStyle=r.multiKeyBackground,e.fillStyle=r.multiKeyBackground,xT(e,t,n,c),e.strokeStyle=i.borderColor,e.fillStyle=i.backgroundColor,xT(e,t,n,c)}else{e.lineWidth=ZA(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,e.strokeStyle=i.borderColor,e.setLineDash(i.borderDash||[]),e.lineDashOffset=i.borderDashOffset||0;const t=o.leftForLtr(d,l),n=o.leftForLtr(o.xPlus(d,1),l-2),a=RT(i.borderRadius);Object.values(a).some((e=>0!==e))?(e.beginPath(),e.fillStyle=r.multiKeyBackground,IT(e,{x:t,y:f,w:l,h:s,radius:a}),e.fill(),e.stroke(),e.fillStyle=i.backgroundColor,e.beginPath(),IT(e,{x:n,y:f+1,w:l-2,h:s-2,radius:a}),e.fill()):(e.fillStyle=r.multiKeyBackground,e.fillRect(t,f,l,s),e.strokeRect(t,f,l,s),e.fillStyle=i.backgroundColor,e.fillRect(n,f+1,l-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){const{body:o}=this,{bodySpacing:r,bodyAlign:i,displayColors:a,boxHeight:s,boxWidth:l,boxPadding:c}=n,u=zT(n.bodyFont);let d=u.lineHeight,p=0;const f=kR(n.rtl,this.x,this.width),h=function(n){t.fillText(n,f.x(e.x+p),e.y+d/2),e.y+=d+r},g=f.textAlign(i);let m,v,b,y,x,C,w;for(t.textAlign=i,t.textBaseline="middle",t.font=u.string,e.x=gB(this,g,n),t.fillStyle=n.bodyColor,rD(this.beforeBody,h),p=a&&"right"!==g?"center"===i?l/2+c:l+2+c:0,y=0,C=o.length;y<C;++y){for(m=o[y],v=this.labelTextColors[y],t.fillStyle=v,rD(m.before,h),b=m.lines,a&&b.length&&(this._drawColorBox(t,e,y,f,n),d=Math.max(u.lineHeight,s)),x=0,w=b.length;x<w;++x)h(b[x]),d=u.lineHeight;rD(m.after,h)}p=0,d=u.lineHeight,rD(this.afterBody,h),e.y-=r}drawFooter(e,t,n){const o=this.footer,r=o.length;let i,a;if(r){const s=kR(n.rtl,this.x,this.width);for(e.x=gB(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline="middle",i=zT(n.footerFont),t.fillStyle=n.footerColor,t.font=i.string,a=0;a<r;++a)t.fillText(o[a],s.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+n.footerSpacing}}drawBackground(e,t,n,o){const{xAlign:r,yAlign:i}=this,{x:a,y:s}=e,{width:l,height:c}=n,{topLeft:u,topRight:d,bottomLeft:p,bottomRight:f}=RT(o.cornerRadius);t.fillStyle=o.backgroundColor,t.strokeStyle=o.borderColor,t.lineWidth=o.borderWidth,t.beginPath(),t.moveTo(a+u,s),"top"===i&&this.drawCaret(e,t,n,o),t.lineTo(a+l-d,s),t.quadraticCurveTo(a+l,s,a+l,s+d),"center"===i&&"right"===r&&this.drawCaret(e,t,n,o),t.lineTo(a+l,s+c-f),t.quadraticCurveTo(a+l,s+c,a+l-f,s+c),"bottom"===i&&this.drawCaret(e,t,n,o),t.lineTo(a+p,s+c),t.quadraticCurveTo(a,s+c,a,s+c-p),"center"===i&&"left"===r&&this.drawCaret(e,t,n,o),t.lineTo(a,s+u),t.quadraticCurveTo(a,s,a+u,s),t.closePath(),t.fill(),o.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,n=this.$animations,o=n&&n.x,r=n&&n.y;if(o||r){const n=sB[e.position].call(this,this._active,this._eventPosition);if(!n)return;const i=this._size=dB(this,e),a=Object.assign({},n,this._size),s=fB(t,e,a),l=hB(e,a,s,t);o._to===l.x&&r._to===l.y||(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=i.width,this.height=i.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(t);const o={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const i=_T(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=n,this.drawBackground(r,e,o,t),ER(e,t.textDirection),r.y+=i.top,this.drawTitle(r,e,t),this.drawBody(r,e,t),this.drawFooter(r,e,t),OR(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const n=this._active,o=e.map((({datasetIndex:e,index:t})=>{const n=this.chart.getDatasetMeta(e);if(!n)throw new Error("Cannot find a dataset at index "+e);return{datasetIndex:e,element:n.data[t],index:t}})),r=!iD(n,o),i=this._positionChanged(o,t);(r||i)&&(this._active=o,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,r=this._active||[],i=this._getActiveElements(e,r,t,n),a=this._positionChanged(i,e),s=t||!iD(i,r)||a;return s&&(this._active=i,(o.enabled||o.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,o){const r=this.options;if("mouseout"===e.type)return[];if(!o)return t.filter((e=>this.chart.data.datasets[e.datasetIndex]&&void 0!==this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)));const i=this.chart.getElementsAtEventForMode(e,r.mode,r,n);return r.reverse&&i.reverse(),i}_positionChanged(e,t){const{caretX:n,caretY:o,options:r}=this,i=sB[r.position].call(this,e,t);return!1!==i&&(n!==i.x||o!==i.y)}}var CB={id:"tooltip",_element:xB,positioners:sB,afterInit(e,t,n){n&&(e.tooltip=new xB({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(!1===e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0}))return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:bB},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>"filter"!==e&&"itemSort"!==e&&"external"!==e,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};function wB(e,t,n,o){const r=e.indexOf(t);if(-1===r)return((e,t,n,o)=>("string"==typeof t?(n=e.push(t)-1,o.unshift({index:n,label:t})):isNaN(t)&&(n=null),n))(e,t,n,o);return r!==e.lastIndexOf(t)?n:r}function SB(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}function kB(e,t){const n=[],{bounds:o,step:r,min:i,max:a,precision:s,count:l,maxTicks:c,maxDigits:u,includeBounds:d}=e,p=r||1,f=c-1,{min:h,max:g}=t,m=!YA(i),v=!YA(a),b=!YA(l),y=(g-h)/(u+1);let x,C,w,S,k=MD((g-h)/f/p)*p;if(k<1e-14&&!m&&!v)return[{value:h},{value:g}];S=Math.ceil(g/k)-Math.floor(h/k),S>f&&(k=MD(S*k/f/p)*p),YA(s)||(x=Math.pow(10,s),k=Math.ceil(k*x)/x),"ticks"===o?(C=Math.floor(h/k)*k,w=Math.ceil(g/k)*k):(C=h,w=g),m&&v&&r&&function(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}((a-i)/r,k/1e3)?(S=Math.round(Math.min((a-i)/k,c)),k=(a-i)/S,C=i,w=a):b?(C=m?i:C,w=v?a:w,S=l-1,k=(w-C)/S):(S=(w-C)/k,S=ND(S,Math.round(S),k/1e3)?Math.round(S):Math.ceil(S));const E=Math.max(AD(k),AD(C));x=Math.pow(10,YA(s)?E:s),C=Math.round(C*x)/x,w=Math.round(w*x)/x;let O=0;for(m&&(d&&C!==i?(n.push({value:i}),C<i&&O++,ND(Math.round((C+O*k)*x)/x,i,EB(i,y,e))&&O++):C<i&&O++);O<S;++O){const e=Math.round((C+O*k)*x)/x;if(v&&e>a)break;n.push({value:e})}return v&&d&&w!==a?n.length&&ND(n[n.length-1].value,a,EB(a,y,e))?n[n.length-1].value=a:n.push({value:a}):v&&w!==a||n.push({value:w}),n}function EB(e,t,{horizontal:n,minRotation:o}){const r=LD(o),i=(n?Math.sin(r):Math.cos(r))||.001,a=.75*t*(""+e).length;return Math.min(t/i,a)}class OB extends nz{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return YA(e)||("number"==typeof e||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:o,max:r}=this;const i=e=>o=t?o:e,a=e=>r=n?r:e;if(e){const e=$D(o),t=$D(r);e<0&&t<0?a(0):e>0&&t>0&&i(0)}if(o===r){let t=0===r?1:Math.abs(.05*r);a(r+t),e||i(o-t)}this.min=o,this.max=r}getTickLimit(){const e=this.options.ticks;let t,{maxTicksLimit:n,stepSize:o}=e;return o?(t=Math.ceil(this.max/o)-Math.floor(this.min/o)+1,t>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${o} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3)):(t=this.computeTickLimit(),n=n||11),n&&(t=Math.min(n,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let n=this.getTickLimit();n=Math.max(2,n);const o=kB({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:!1!==t.includeBounds},this._range||this);return"ticks"===e.bounds&&PD(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){const o=(n-t)/Math.max(e.length-1,1)/2;t-=o,n+=o}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return lT(e,this.chart.options.locale,this.options.ticks.format)}}class $B extends OB{static id="linear";static defaults={ticks:{callback:uT.formatters.numeric}};determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=JA(e)?e:0,this.max=JA(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,n=LD(this.options.ticks.minRotation),o=(e?Math.sin(n):Math.cos(n))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,r.lineHeight/o))}getPixelForValue(e){return null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}uT.formatters.logarithmic;uT.formatters.numeric;const NB="label";function MB(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function IB(e,t){e.labels=t}function PB(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:NB;const o=[];e.datasets=t.map((t=>{const r=e.datasets.find((e=>e[n]===t[n]));return r&&t.data&&!o.includes(r)?(o.push(r),Object.assign(r,t),r):{...t}}))}function LB(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NB;const n={labels:[],datasets:[]};return IB(n,e.labels),PB(n,e.datasets,t),n}function jB(e,n){const{height:o=150,width:r=300,redraw:i=!1,datasetIdKey:s,type:c,data:u,options:d,plugins:p=[],fallbackContent:f,updateMode:h,...g}=e,m=a(null),v=a(),b=()=>{m.current&&(v.current=new Az(m.current,{type:c,data:LB(u,s),options:d&&{...d},plugins:p}),MB(n,v.current))},y=()=>{MB(n,null),v.current&&(v.current.destroy(),v.current=null)};return l((()=>{!i&&v.current&&d&&function(e,t){const n=e.options;n&&t&&Object.assign(n,t)}(v.current,d)}),[i,d]),l((()=>{!i&&v.current&&IB(v.current.config.data,u.labels)}),[i,u.labels]),l((()=>{!i&&v.current&&u.datasets&&PB(v.current.config.data,u.datasets,s)}),[i,u.datasets]),l((()=>{v.current&&(i?(y(),setTimeout(b)):v.current.update(h))}),[i,d,u.labels,u.datasets,h]),l((()=>{v.current&&(y(),setTimeout(b))}),[c]),l((()=>(b(),()=>y())),[]),t.createElement("canvas",Object.assign({ref:m,role:"img",height:o,width:r},g),f)}const AB=c(jB);function DB(e,n){return Az.register(n),c(((n,o)=>t.createElement(AB,Object.assign({},n,{ref:o,type:e}))))}const TB=DB("line",s_),RB=DB("bar",i_),_B=DB("doughnut",a_),zB=DB("pie",l_);rA(".appChart {\n & > canvas {\n height: 100% !important;\n width: 100% !important;\n }\n}\n"),Az.register(class extends nz{static id="category";static defaults={ticks:{callback:SB}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const e=this.getLabels();for(const{index:n,label:o}of t)e[n]===o&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(YA(e))return null;const n=this.getLabels();return((e,t)=>null===e?null:BD(Math.round(e),0,t))(t=isFinite(t)&&n[t]===e?t:wB(n,e,tD(t,e),this._addedLabels),n.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:n,max:o}=this.getMinMax(!0);"ticks"===this.options.bounds&&(e||(n=0),t||(o=this.getLabels().length-1)),this.min=n,this.max=o}buildTicks(){const e=this.min,t=this.max,n=this.options.offset,o=[];let r=this.getLabels();r=0===e&&t===r.length-1?r:r.slice(e,t+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)o.push({value:n});return o}getLabelForValue(e){return SB.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return"number"!=typeof e&&(e=this.parse(e)),null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}},$B,class extends q_{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:t,options:{borderColor:n,backgroundColor:o}}=this,{inner:r,outer:i}=Qz(this),a=function(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}(i.radius)?IT:Jz;e.save(),i.w===r.w&&i.h===r.h||(e.beginPath(),a(e,eB(i,t,r)),e.clip(),a(e,eB(r,-t,i)),e.fillStyle=n,e.fill("evenodd")),e.beginPath(),a(e,eB(r,t)),e.fillStyle=o,e.fill(),e.restore()}inRange(e,t,n){return Zz(this,e,t,n)}inXRange(e,t){return Zz(this,e,null,t)}inYRange(e,t){return Zz(this,null,e,t)}getCenterPoint(e){const{x:t,y:n,base:o,horizontal:r}=this.getProps(["x","y","base","horizontal"],e);return{x:r?(t+o)/2:t,y:r?n:(n+o)/2}}getRange(e){return"x"===e?this.width/2:this.height/2}},class extends q_{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:e=>"borderDash"!==e&&"fill"!==e};constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const n=this.options;if((n.tension||"monotone"===n.cubicInterpolationMode)&&!n.stepped&&!this._pointsUpdated){const o=n.spanGaps?this._loop:this._fullLoop;sR(this._points,n,e,o,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(e,t){const n=e.points,o=e.options.spanGaps,r=n.length;if(!r)return[];const i=!!e._loop,{start:a,end:s}=function(e,t,n,o){let r=0,i=t-1;if(n&&!o)for(;r<t&&!e[r].skip;)r++;for(;r<t&&e[r].skip;)r++;for(r%=t,n&&(i+=r);i>r&&e[i%t].skip;)i--;return i%=t,{start:r,end:i}}(n,r,i,o);return IR(e,!0===o?[{start:a,end:s,loop:i}]:function(e,t,n,o){const r=e.length,i=[];let a,s=t,l=e[t];for(a=t+1;a<=n;++a){const n=e[a%r];n.skip||n.stop?l.skip||(o=!1,i.push({start:t%r,end:(a-1)%r,loop:o}),t=s=n.stop?a:null):(s=a,l.skip&&(t=a)),l=n}return null!==s&&i.push({start:t%r,end:s%r,loop:o}),i}(n,a,s<a?s+r:s,!!e._fullLoop&&0===a&&s===r-1),n,t)}(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){const n=this.options,o=e[t],r=this.points,i=function(e,t){const n=[],o=e.segments;for(let r=0;r<o.length;r++){const i=MR(o[r],e.points,t);i.length&&n.push(...i)}return n}(this,{property:t,start:o,end:o});if(!i.length)return;const a=[],s=function(e){return e.stepped?wR:e.tension||"monotone"===e.cubicInterpolationMode?SR:CR}(n);let l,c;for(l=0,c=i.length;l<c;++l){const{start:c,end:u}=i[l],d=r[c],p=r[u];if(d===p){a.push(d);continue}const f=s(d,p,Math.abs((o-d[t])/(p[t]-d[t])),n.stepped);f[t]=e[t],a.push(f)}return 1===a.length?a[0]:a}pathSegment(e,t,n){return Kz(this)(e,this,t,n)}path(e,t,n){const o=this.segments,r=Kz(this);let i=this._loop;t=t||0,n=n||this.points.length-t;for(const a of o)i&=r(e,this,a,{start:t,end:t+n-1});return!!i}draw(e,t,n,o){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(e.save(),Xz(e,this,n,o),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}},class extends q_{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,n){const o=this.options,{x:r,y:i}=this.getProps(["x","y"],n);return Math.pow(e-r,2)+Math.pow(t-i,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,t){return Uz(this,e,"x",t)}inYRange(e,t){return Uz(this,e,"y",t)}getCenterPoint(e){const{x:t,y:n}=this.getProps(["x","y"],e);return{x:t,y:n}}size(e){let t=(e=e||this.options||{}).radius||0;t=Math.max(t,t&&e.hoverRadius||0);return 2*(t+(t&&e.borderWidth||0))}draw(e,t){const n=this.options;this.skip||n.radius<.1||!wT(this,t,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,xT(e,n,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}},class extends q_{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:e=>"borderDash"!==e};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,n){const o=this.getProps(["x","y"],n),{angle:r,distance:i}=DD(o,{x:e,y:t}),{startAngle:a,endAngle:s,innerRadius:l,outerRadius:c,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),d=(this.options.spacing+this.options.borderWidth)/2,p=tD(u,s-a),f=zD(r,a,s)&&a!==s,h=p>=yD||f,g=HD(i,l+d,c+d);return h&&g}getCenterPoint(e){const{x:t,y:n,startAngle:o,endAngle:r,innerRadius:i,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:s,spacing:l}=this.options,c=(o+r)/2,u=(i+a+l+s)/2;return{x:t+Math.cos(c)*u,y:n+Math.sin(c)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:t,circumference:n}=this,o=(t.offset||0)/4,r=(t.spacing||0)/2,i=t.circular;if(this.pixelMargin="inner"===t.borderAlign?.33:0,this.fullCircles=n>yD?Math.floor(n/yD):0,0===n||this.innerRadius<0||this.outerRadius<0)return;e.save();const a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*o,Math.sin(a)*o);const s=o*(1-Math.sin(Math.min(bD,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,function(e,t,n,o,r){const{fullCircles:i,startAngle:a,circumference:s}=t;let l=t.endAngle;if(i){_z(e,t,n,o,l,r);for(let t=0;t<i;++t)e.fill();isNaN(s)||(l=a+(s%yD||yD))}_z(e,t,n,o,l,r),e.fill()}(e,this,s,r,i),zz(e,this,s,r,i),e.restore()}},aB,CB,rB);var BB=function(e){var t=e.type,n=e.data,o=e.options,r=e.className,i=e.height,a=void 0===i?400:i,s=e.width,l=void 0===s?600:s;E(e,["type","data","options","className","height","width"]);return L.jsx("div",{style:{height:a,width:l},className:"appChart ".concat(r),children:function(){switch(t){case"bar":return L.jsx(RB,{data:n,options:o,className:r});case"line":return L.jsx(TB,{data:n,options:o,className:r});case"pie":return L.jsx(zB,{data:n,options:o,className:r});case"doughnut":return L.jsx(_B,{data:n,options:o,className:r});default:return null}}()})};rA(".appImageBox {\n width: max-content;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1rem;\n\n .ant-image {\n border-radius: 50%;\n overflow: hidden;\n\n .ant-image-img {\n border-radius: 50%;\n }\n }\n .text {\n font-size: 16px;\n font-weight: 700;\n line-height: normal;\n color: #000000;\n }\n}\n");var HB=function(e){var t=e.width,n=void 0===t?100:t,o=e.height,r=void 0===o?100:o,i=e.text,a=e.image,s=e.className,l=e.handleClick;return L.jsxs("div",{className:"appImageBox ".concat(s),onClick:l,children:[L.jsx(TO,{preview:!1,width:n,height:r,src:a.src,alt:i}),i&&L.jsx("span",{className:"text",dangerouslySetInnerHTML:{__html:i}})]})},FB=function(e){var t=e.src,n=e.fallbackIcon,o=void 0===n?L.jsx(vM,{}):n,r=e.className,i=E(e,["src","fallbackIcon","className"]);return L.jsx("div",{className:r,children:L.jsx(wv,k({src:t,icon:t?void 0:o},i))})};rA(".appCheckboxText {\n .checkboxText {\n & > span:last-child {\n line-height: unset;\n & > span {\n font-size: 15px;\n font-weight: 500;\n text-align: left;\n }\n }\n }\n}\n");var WB=function(e){var t=e.text,n=e.checked,o=e.handleChange,r=e.className;return L.jsx("div",{className:"appCheckboxText ".concat(r),children:L.jsx(WS,{className:"checkboxText",checked:n,onChange:o,children:L.jsx("span",{dangerouslySetInnerHTML:{__html:t}})})})};vk.Panel;var VB=function(e){var t=e.panels,n=void 0===t?[]:t,o=e.defaultActiveKey,r=e.onChange,i=e.expandIconPosition,a=e.ghost,s=e.accordion,l=e.expandIcon,c=e.size,u=e.bordered,d=e.activeKey,p=e.className,f=E(e,["panels","defaultActiveKey","onChange","expandIconPosition","ghost","accordion","expandIcon","size","bordered","activeKey","className"]),h=n.map((function(e){return{key:e.key,label:e.header,children:e.content,collapsible:e.collapsible}}));return L.jsx("div",{className:p,children:L.jsx(vk,k({defaultActiveKey:o,onChange:r,expandIconPosition:i,ghost:a,accordion:s,expandIcon:l,size:c,bordered:u,activeKey:d,items:h},f))})};rA('.wrapper {\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n background-color: (0, 0, 0, 0.3);\n backdrop-filter: blur(10px);\n display: flex;\n z-index: 99;\n}\n\n/*code for custom loading icon*/\n\n.loader {\n position: relative;\n width: 80px;\n margin-left: 45%;\n margin-top: 25%;\n}\n\n.loader span {\n display: block;\n transform-origin: 40px 40px;\n animation: ding 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n}\n\n.loader span::before {\n content: "";\n position: absolute;\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background: rgb(0, 0, 0);\n margin: -4px 0 0 -4px;\n}\n\n.loader span:nth-child(1) {\n animation-delay: -0.36s;\n}\n\n.loader span:nth-child(1):before {\n top: 63px;\n left: 63px;\n}\n\n.loader span:nth-child(2) {\n animation-delay: -0.72s;\n}\n\n.loader span:nth-child(2):before {\n top: 68px;\n left: 56px;\n}\n\n.loader span:nth-child(3) {\n animation-delay: -0.108s;\n}\n\n.loader span:nth-child(3):before {\n top: 71px;\n left: 48px;\n}\n.loader span:nth-child(4) {\n animation-delay: -0.144s;\n}\n\n.loader span:nth-child(4):before {\n top: 72px;\n left: 40px;\n}\n\n.loader span:nth-child(5) {\n animation-delay: -0.18;\n}\n\n.loader span:nth-child(5):before {\n top: 71px;\n left: 32px;\n}\n\n.loader span:nth-child(6) {\n animation-delay: -0.216s;\n}\n\n.loader span:nth-child(6):before {\n top: 68px;\n left: 24px;\n}\n\n.loader span:nth-child(7) {\n animation-delay: -0.252s;\n}\n\n.loader span:nth-child(7):before {\n top: 63px;\n left: 17px;\n}\n\n.loader span:nth-child(8) {\n animation-delay: -0.288s;\n}\n\n.loader span:nth-child(8):before {\n top: 56px;\n left: 12px;\n}\n\n@keyframes ding {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n');var KB=function(e){var t=e.className;return L.jsx("div",{className:"wrapper ".concat(t),children:L.jsxs("div",{className:"loader",children:[L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{})]})})},qB=function(e,t){return qB=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},qB(e,t)};
45
45
  /*! *****************************************************************************
46
46
  Copyright (c) Microsoft Corporation.
47
47