"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2757],{uaMf:function(t,e,i){i.d(e,{ZL:function(){return BarElement},ce:function(){return s.d},kL:function(){return Chart},od:function(){return PointElement},qi:function(){return ArcElement},zX:function(){return I}});var s=i("pxuU"),a=new /*! * Chart.js v3.9.1 * https://www.chartjs.org * (c) 2022 Chart.js Contributors * Released under the MIT License */class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let a=e.listeners[s],r=e.duration;a.forEach(s=>s({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=s.r.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{let a;if(!i.running||!i.items.length)return;let r=i.items,n=r.length-1,o=!1;for(;n>=0;--n)(a=r[n])._active?(a._total>i.duration&&(i.duration=a._total),a.tick(t),o=!0):(r[n]=r[r.length-1],r.pop());o&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!!e&&!!e.running&&!!e.items.length}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};let r="transparent",n={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){let a=(0,s.c)(t||r),n=a.valid&&(0,s.c)(e||r);return n&&n.valid?n.mix(a,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};let Animation=class Animation{constructor(t,e,i,a){let r=e[i];a=(0,s.a)([t.to,a,r,t.from]);let o=(0,s.a)([t.from,r,a]);this._active=!0,this._fn=t.fn||n[t.type||typeof o],this._easing=s.e[t.easing]||s.e.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=a,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let a=this._target[this._prop],r=i-this._start,n=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(n,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=(0,s.a)([t.to,e,a,t.from]),this._from=(0,s.a)([t.from,a,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e;let i=t-this._start,s=this._duration,a=this._prop,r=this._from,n=this._loop,o=this._to;if(this._active=r!==o&&(n||i1?2-e:e,e=this._easing(Math.min(1,Math.max(0,e))),this._target[a]=this._fn(r,o,e)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let t=0;t"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),s.d.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),s.d.describe("animations",{_fallback:"animation"}),s.d.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}});let Animations=class Animations{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!(0,s.i)(t))return;let e=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{let a=t[i];if(!(0,s.i)(a))return;let r={};for(let t of o)r[t]=a[t];((0,s.b)(a.properties)&&a.properties||[i]).forEach(t=>{t!==i&&e.has(t)||e.set(t,r)})})}_animateOptions(t,e){let i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i){t.options=e;return}return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i}(t,i);if(!s)return[];let a=this._createAnimations(s,i);return i.$shared&&(function(t,e){let i=[],s=Object.keys(e);for(let e=0;e{t.options=i},()=>{}),a}_createAnimations(t,e){let i;let s=this._properties,a=[],r=t.$animations||(t.$animations={}),n=Object.keys(e),o=Date.now();for(i=n.length-1;i>=0;--i){let l=n[i];if("$"===l.charAt(0))continue;if("options"===l){a.push(...this._animateOptions(t,e));continue}let h=e[l],d=r[l],c=s.get(l);if(d){if(c&&d.active()){d.update(c,h,o);continue}d.cancel()}if(!c||!c.duration){t[l]=h;continue}r[l]=d=new Animation(c,t,l,h),a.push(d)}return a}update(t,e){if(0===this._properties.size){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return a.add(this._chart,i),!0}};function scaleClip(t,e){let i=t&&t.options||{},s=i.reverse,a=void 0===i.min?e:0,r=void 0===i.max?e:0;return{start:s?r:a,end:s?a:r}}function getSortedDatasetIndices(t,e){let i,s;let a=[],r=t._getSortedDatasetMetas(e);for(i=0,s=r.length;i0||!i&&e<0)return a.index}return null}function updateStacks(t,e){let i;let{chart:s,_cachedMeta:a}=t,r=s._stacks||(s._stacks={}),{iScale:n,vScale:o,index:l}=a,h=n.axis,d=o.axis,c=`${n.id}.${o.id}.${a.stack||a.type}`,u=e.length;for(let t=0;ti[t].axis===e).shift()}function clearStacks(t,e){let i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s)for(let a of e=e||t._parsed){let t=a._stacks;if(!t||void 0===t[s]||void 0===t[s][i])return;delete t[s][i]}}let isDirectUpdateMode=t=>"reset"===t||"none"===t,cloneIfNotShared=(t,e)=>e?t:Object.assign({},t),createStack=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:getSortedDatasetIndices(i,!0),values:null};let DatasetController=class DatasetController{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,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.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=isStacked(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&clearStacks(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),chooseId=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,a=e.xAxisID=(0,s.v)(i.xAxisID,getFirstScaleId(t,"x")),r=e.yAxisID=(0,s.v)(i.yAxisID,getFirstScaleId(t,"y")),n=e.rAxisID=(0,s.v)(i.rAxisID,getFirstScaleId(t,"r")),o=e.indexAxis,l=e.iAxisID=chooseId(o,a,r,n),h=e.vAxisID=chooseId(o,r,a,n);e.xScale=this.getScaleForId(a),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(n),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&(0,s.u)(this._data,this),t._stacked&&clearStacks(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if((0,s.i)(e))this._data=function(t){let e,i,s;let a=Object.keys(t),r=Array(a.length);for(e=0,i=a.length;e0&&n._parsed[t-1];if(!1===this._parsing)n._parsed=o,n._sorted=!0,r=o;else{r=(0,s.b)(o[t])?this.parseArrayData(n,o,t,e):(0,s.i)(o[t])?this.parseObjectData(n,o,t,e):this.parsePrimitiveData(n,o,t,e);let isNotInOrderComparedToPrev=()=>null===a[d]||u&&a[d]e||g=0;--i)if(!_skip()){this.updateRangeFromParsed(c,t,a,d);break}}return c}getAllParsedValues(t){let e,i,a;let r=this._cachedMeta._parsed,n=[];for(e=0,i=r.length;e=0&&tthis.getContext(i,a),c);return p.$shared&&(p.$shared=l,r[n]=Object.freeze(cloneIfNotShared(p,l))),p}_resolveAnimations(t,e,i){let s;let a=this.chart,r=this._cachedDataOpts,n=`animation-${e}`,o=r[n];if(o)return o;if(!1!==a.options.animation){let a=this.chart.config,r=a.datasetAnimationScopeKeys(this._type,e),n=a.getOptionScopes(this.getDataset(),r);s=a.createResolver(n,this.getContext(t,i,e))}let l=new Animations(a,s&&s.animations);return s&&s._cacheable&&(r[n]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||isDirectUpdateMode(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,a=this.getSharedOptions(i),r=this.includeOptions(e,a)||a!==s;return this.updateSharedOptions(a,e,i),{sharedOptions:a,includeOptions:r}}updateElement(t,e,i,s){isDirectUpdateMode(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!isDirectUpdateMode(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let a=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(a)||a})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];let s=i.length,a=e.length,r=Math.min(a,s);r&&this.parse(0,r),a>s?this._insertElements(s,a-s,t):a{for(t.length+=e,s=t.length-1;s>=n;s--)t[s]=t[s-e]};for(move(r),s=t;sMath.abs(o)&&(l=o,h=n),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:a,end:r,min:n,max:o}}(t,e,i,a):e[i.axis]=i.parse(t,a),e}function parseArrayOrPrimitive(t,e,i,s){let a,r,n,o;let l=t.iScale,h=t.vScale,d=l.getLabels(),c=l===h,u=[];for(a=i,r=i+s;at.x,r="left",n="right"):(a=t.baset.controller.options.grouped),r=i.options.stacked,n=[],skipNull=t=>{let i=t.controller.getParsed(e),a=i&&i[t.vScale.axis];if((0,s.k)(a)||isNaN(a))return!0};for(let i of a)if(!(void 0!==e&&skipNull(i))&&((!1===r||-1===n.indexOf(i.stack)||void 0===r&&void 0===i.stack)&&n.push(i.stack),i.index===t))break;return n.length||n.push(void 0),n}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){let s=this._getStacks(t,i),a=void 0!==e?s.indexOf(e):-1;return -1===a?s.length-1:a}_getRuler(){let t,e;let i=this.options,a=this._cachedMeta,r=a.iScale,n=[];for(t=0,e=a.data.length;tt-e))}return t._cache.$bar}(n,t.type),l=n._length,updateMinAndPrev=()=>{32767!==a&&-32768!==a&&((0,s.j)(r)&&(l=Math.min(l,Math.abs(a-r)||l)),r=a)};for(e=0,i=o.length;e=l?1:-1))*o,u===l&&(m-=i/2);let t=a.getPixelForDecimal(0),r=a.getPixelForDecimal(1);e=(m=Math.max(Math.min(m,Math.max(t,r)),Math.min(t,r)))+i}if(m===a.getPixelForValue(l)){let t=(0,s.s)(i)*a.getLineWidthForValue(l)/2;m+=t,i-=t}return{size:i,base:m,head:e,center:e+i/2}}_calculateBarIndexPixels(t,e){let i,a;let r=e.scale,n=this.options,o=n.skipNull,l=(0,s.v)(n.maxBarThickness,1/0);if(e.grouped){let r=o?this._getStackCount(t):e.stackCount,h="flex"===n.barThickness?function(t,e,i,s){let a=e.pixels,r=a[t],n=t>0?a[t-1]:null,o=t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,{xScale:i,yScale:s}=e,a=this.getParsed(t),r=i.getLabelForValue(a.x),n=s.getLabelForValue(a.y),o=a._custom;return{label:e.label,value:"("+r+", "+n+(o?", "+o:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){let a="reset"===s,{iScale:r,vScale:n}=this._cachedMeta,{sharedOptions:o,includeOptions:l}=this._getSharedOptions(e,s),h=r.axis,d=n.axis;for(let c=e;c""}}}};let DoughnutController=class DoughnutController extends DatasetController{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,a=this._cachedMeta;if(!1===this._parsing)a._parsed=i;else{let r,n,getter=t=>+i[t];if((0,s.i)(i[t])){let{key:t="value"}=this._parsing;getter=e=>+(0,s.f)(i[e],t)}for(r=t,n=t+e;r(0,s.p)(e,t,l,!0)?1:Math.max(a,a*i,r,r*i),calcMin=(e,a,r)=>(0,s.p)(e,t,l,!0)?-1:Math.min(a,a*i,r,r*i),g=calcMax(0,h,c),p=calcMax(s.H,d,u),f=calcMin(s.P,h,c),m=calcMin(s.P+s.H,d,u);a=(g-f)/2,r=(p-m)/2,n=-(g+f)/2,o=-(p+m)/2}return{ratioX:a,ratioY:r,offsetX:n,offsetY:o}}(c,d,l),m=(i.width-n)/u,x=(i.height-n)/g,b=(0,s.n)(this.options.radius,Math.max(Math.min(m,x)/2,0)),_=Math.max(b*l,0),v=(b-_)/this._getVisibleDatasetWeightTotal();this.offsetX=p*b,this.offsetY=f*b,a.total=this.calculateTotal(),this.outerRadius=b-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*h,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){let i=this.options,a=this._cachedMeta,r=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===a._parsed[t]||a.data[t].hidden?0:this.calculateCircumference(a._parsed[t]*r/s.T)}updateElements(t,e,i,s){let a;let r="reset"===s,n=this.chart,o=n.chartArea,l=n.options,h=l.animation,d=(o.left+o.right)/2,c=(o.top+o.bottom)/2,u=r&&h.animateScale,g=u?0:this.innerRadius,p=u?0:this.outerRadius,{sharedOptions:f,includeOptions:m}=this._getSharedOptions(e,s),x=this._getRotation();for(a=0;a0&&!isNaN(t)?s.T*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,a=i.data.labels||[],r=(0,s.o)(e._parsed[t],i.options.locale);return{label:a[t]||"",value:r}}getMaxBorderWidth(t){let e,i,s,a,r,n=0,o=this.chart;if(!t){for(e=0,i=o.data.datasets.length;e"spacing"!==t,_indexable:t=>"spacing"!==t},DoughnutController.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i}}=t.legend.options;return e.labels.map((e,s)=>{let a=t.getDatasetMeta(0),r=a.controller.getStyle(s);return{text:e,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label,i=": "+t.formattedValue;return(0,s.b)(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};let LineController=class LineController extends DatasetController{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:a=[],_dataset:r}=e,n=this.chart._animationsDisabled,{start:o,count:l}=(0,s.q)(e,a,n);this._drawStart=o,this._drawCount=l,(0,s.w)(e)&&(o=0,l=a.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=a;let h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(i,void 0,{animated:!n,options:h},t),this.updateElements(a,o,l,t)}updateElements(t,e,i,a){let r="reset"===a,{iScale:n,vScale:o,_stacked:l,_dataset:h}=this._cachedMeta,{sharedOptions:d,includeOptions:c}=this._getSharedOptions(e,a),u=n.axis,g=o.axis,{spanGaps:p,segment:f}=this.options,m=(0,s.x)(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||"none"===a,b=e>0&&this.getParsed(e-1);for(let p=e;p0&&Math.abs(i[u]-b[u])>m,f&&(_.parsed=i,_.raw=h.data[p]),c&&(_.options=d||this.resolveDataElementOptions(p,e.active?"active":a)),x||this.updateElement(e,p,_,a),b=i}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let a=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,a,r)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};LineController.id="line",LineController.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},LineController.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};let PolarAreaController=class PolarAreaController extends DatasetController{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,a=i.data.labels||[],r=(0,s.o)(e._parsed[t].r,i.options.locale);return{label:a[t]||"",value:r}}parseObjectData(t,e,i,a){return s.y.bind(this)(t,e,i,a)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,i)=>{let s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),a=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?a/100*i.cutoutPercentage:1,0),n=(a-r)/t.getVisibleDatasetCount();this.outerRadius=a-n*this.index,this.innerRadius=this.outerRadius-n}updateElements(t,e,i,a){let r;let n="reset"===a,o=this.chart,l=o.options,h=l.animation,d=this._cachedMeta.rScale,c=d.xCenter,u=d.yCenter,g=d.getIndexAngle(0)-.5*s.P,p=g,f=360/this.countVisibleElements();for(r=0;r{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?(0,s.t)(this.resolveDataElementOptions(t,e).angle||i):0}};PolarAreaController.id="polarArea",PolarAreaController.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},PolarAreaController.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i}}=t.legend.options;return e.labels.map((e,s)=>{let a=t.getDatasetMeta(0),r=a.controller.getStyle(s);return{text:e,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};let PieController=class PieController extends DoughnutController{};PieController.id="pie",PieController.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};let RadarController=class RadarController extends DatasetController{getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,a){return s.y.bind(this)(t,e,i,a)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],a=e.iScale.getLabels();if(i.points=s,"resize"!==t){let e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);let r={_loop:!0,_fullLoop:a.length===s.length,options:e};this.updateElement(i,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let a=this._cachedMeta.rScale,r="reset"===s;for(let n=e;n{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),s}};Element.defaults={},Element.defaultRoutes=void 0;let l={values:t=>(0,s.b)(t)?t:""+t,numeric(t,e,i){let a;if(0===t)return"0";let r=this.chart.options.locale,n=t;if(i.length>1){let e;let s=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(s<1e-4||s>1e15)&&(a="scientific"),Math.abs(e=i.length>3?i[2].value-i[1].value:i[1].value-i[0].value)>=1&&t!==Math.floor(t)&&(e=t-Math.floor(t)),n=e}let o=(0,s.z)(Math.abs(n)),l=Math.max(Math.min(-1*Math.floor(o),20),0),h={notation:a,minimumFractionDigits:l,maximumFractionDigits:l};return Object.assign(h,this.options.ticks.format),(0,s.o)(t,r,h)},logarithmic(t,e,i){if(0===t)return"0";let a=t/Math.pow(10,Math.floor((0,s.z)(t)));return 1===a||2===a||5===a?l.numeric.call(this,t,e,i):""}};var h={formatters:l};function skip(t,e,i,a,r){let n,o,l;let h=(0,s.v)(a,0),d=Math.min((0,s.v)(r,t.length),t.length),c=0;for(i=Math.ceil(i),r&&(i=(n=r-a)/Math.floor(n/i)),l=h;l<0;)l=Math.round(h+ ++c*i);for(o=Math.max(h,0);oe.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:h.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.d.route("scale.ticks","color","","color"),s.d.route("scale.grid","color","","borderColor"),s.d.route("scale.grid","borderColor","","borderColor"),s.d.route("scale.title","color","","color"),s.d.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),s.d.describe("scales",{_fallback:"scale"}),s.d.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});let reverseAlign=t=>"left"===t?"right":"right"===t?"left":t,offsetFromEdge=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function sample(t,e){let i=[],s=t.length/e,a=t.length,r=0;for(;ra?a:i,a=r&&i>a?i:a,{min:(0,s.B)(i,(0,s.B)(a,i)),max:(0,s.B)(a,(0,s.B)(i,a))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){(0,s.C)(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:a,grace:r,ticks:n}=this.options,o=n.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=(0,s.D)(this,r,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=oa)return function(t,e,i,s){let a,r=0,n=i[0];for(a=0,s=Math.ceil(s);ar)return e}return Math.max(r,1)}(r,e,a);if(n>0){let t,i;let a=n>1?Math.round((l-o)/(n-1)):null;for(skip(e,h,d,(0,s.k)(a)?0:o-a,o),t=0,i=n-1;t=l||n<=1||!this.isHorizontal()){this.labelRotation=o;return}let d=this._getLabelSizes(),c=d.widest.width,u=d.highest.height,g=(0,s.E)(this.chart.width-c,0,this.maxWidth);c+6>(t=a.offset?this.maxWidth/n:g/(n-1))&&(t=g/(n-(a.offset?.5:1)),e=this.maxHeight-getTickMarkLength(a.grid)-r.padding-getTitleHeight(a.title,this.chart.options.font),i=Math.sqrt(c*c+u*u),h=Math.max(o,Math.min(l,h=(0,s.F)(Math.min(Math.asin((0,s.E)((d.highest.height+6)/t,-1,1)),Math.asin((0,s.E)(e/i,-1,1))-Math.asin((0,s.E)(u/i,-1,1))))))),this.labelRotation=h}afterCalculateLabelRotation(){(0,s.C)(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){(0,s.C)(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:a,grid:r}}=this,n=this._isVisible(),o=this.isHorizontal();if(n){let n=getTitleHeight(a,e.options.font);if(o?(t.width=this.maxWidth,t.height=getTickMarkLength(r)+n):(t.height=this.maxHeight,t.width=getTickMarkLength(r)+n),i.display&&this.ticks.length){let{first:e,last:a,widest:r,highest:n}=this._getLabelSizes(),l=2*i.padding,h=(0,s.t)(this.labelRotation),d=Math.cos(h),c=Math.sin(h);if(o){let e=i.mirror?0:c*r.width+d*n.height;t.height=Math.min(this.maxHeight,t.height+e+l)}else{let e=i.mirror?0:d*r.width+c*n.height;t.width=Math.min(this.maxWidth,t.width+e+l)}this._calculatePadding(e,a,c,d)}}this._handleMargins(),o?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){let{ticks:{align:a,padding:r},position:n}=this.options,o=0!==this.labelRotation,l="top"!==n&&"x"===this.axis;if(this.isHorizontal()){let n=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),d=0,c=0;o?l?(d=s*t.width,c=i*e.height):(d=i*t.height,c=s*e.width):"start"===a?c=e.width:"end"===a?d=t.width:"inner"!==a&&(d=t.width/2,c=e.width/2),this.paddingLeft=Math.max((d-n+r)*this.width/(this.width-n),0),this.paddingRight=Math.max((c-h+r)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===a?(i=0,s=t.height):"end"===a&&(i=e.height,s=0),this.paddingTop=i+r,this.paddingBottom=s+r}}_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(){(0,s.C)(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e{let i;let s=t.gc,a=s.length/2;if(a>e){for(i=0;i({width:m[t]||0,height:x[t]||0});return{first:valueAt(0),last:valueAt(e-1),widest:valueAt(v),highest:valueAt(y),widths:m,heights:x}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return(0,s.I)(this._alignToPixels?(0,s.J)(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){var e,i;let a=this.ticks||[];if(t>=0&&to*a?o/i:l/a:l*a0}_computeGridLineItems(t){let e,i,a,r,n,o,l,h,d,c,u,g;let p=this.axis,f=this.chart,m=this.options,{grid:x,position:b}=m,_=x.offset,v=this.isHorizontal(),y=this.ticks,k=y.length+(_?1:0),M=getTickMarkLength(x),S=[],w=x.setContext(this.getContext()),C=w.drawBorder?w.borderWidth:0,P=C/2,alignBorderValue=function(t){return(0,s.J)(f,t,C)};if("top"===b)e=alignBorderValue(this.bottom),o=this.bottom-M,h=e-P,c=alignBorderValue(t.top)+P,g=t.bottom;else if("bottom"===b)e=alignBorderValue(this.top),c=t.top,g=alignBorderValue(t.bottom)-P,o=e+P,h=this.top+M;else if("left"===b)e=alignBorderValue(this.right),n=this.right-M,l=e-P,d=alignBorderValue(t.left)+P,u=t.right;else if("right"===b)e=alignBorderValue(this.left),d=t.left,u=alignBorderValue(t.right)-P,n=e+P,l=this.left+M;else if("x"===p){if("center"===b)e=alignBorderValue((t.top+t.bottom)/2+.5);else if((0,s.i)(b)){let t=Object.keys(b)[0],i=b[t];e=alignBorderValue(this.chart.scales[t].getPixelForValue(i))}c=t.top,g=t.bottom,h=(o=e+P)+M}else if("y"===p){if("center"===b)e=alignBorderValue((t.left+t.right)/2);else if((0,s.i)(b)){let t=Object.keys(b)[0],i=b[t];e=alignBorderValue(this.chart.scales[t].getPixelForValue(i))}l=(n=e-P)-M,d=t.left,u=t.right}let D=(0,s.v)(m.ticks.maxTicksLimit,k),L=Math.max(1,Math.ceil(k/D));for(i=0;io+1e-6)))return l}(this,i,_))&&(r=(0,s.J)(f,a,e),v?n=l=d=u=r:o=h=c=g=r,S.push({tx1:n,ty1:o,tx2:l,ty2:h,x1:d,y1:c,x2:u,y2:g,width:e,color:p,borderDash:m,borderDashOffset:b,tickWidth:y,tickColor:k,tickBorderDash:M,tickBorderDashOffset:w}))}return this._ticksLength=k,this._borderValue=e,S}_computeLabelItems(t){let e,i,a,r,n,o,l,h,d,c,u;let g=this.axis,p=this.options,{position:f,ticks:m}=p,x=this.isHorizontal(),b=this.ticks,{align:_,crossAlign:v,padding:y,mirror:k}=m,M=getTickMarkLength(p.grid),S=M+y,w=k?-y:S,C=-(0,s.t)(this.labelRotation),P=[],D="middle";if("top"===f)n=this.bottom-w,o=this._getXAxisLabelAlignment();else if("bottom"===f)n=this.top+w,o=this._getXAxisLabelAlignment();else if("left"===f){let t=this._getYAxisLabelAlignment(M);o=t.textAlign,r=t.x}else if("right"===f){let t=this._getYAxisLabelAlignment(M);o=t.textAlign,r=t.x}else if("x"===g){if("center"===f)n=(t.top+t.bottom)/2+S;else if((0,s.i)(f)){let t=Object.keys(f)[0],e=f[t];n=this.chart.scales[t].getPixelForValue(e)+S}o=this._getXAxisLabelAlignment()}else if("y"===g){if("center"===f)r=(t.left+t.right)/2-S;else if((0,s.i)(f)){let t=Object.keys(f)[0],e=f[t];r=this.chart.scales[t].getPixelForValue(e)}o=this._getYAxisLabelAlignment(M).textAlign}"y"===g&&("start"===_?D="top":"end"===_&&(D="bottom"));let L=this._getLabelSizes();for(e=0,i=b.length;ee.value===t);if(s>=0){let t=e.setContext(this.getContext(s));return t.lineWidth}return 0}drawGrid(t){let e,i;let s=this.options.grid,a=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),drawLine=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(s.display)for(e=0,i=r.length;e{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){let e,i;let s=this.chart.getSortedVisibleDatasetMetas(),a=this.axis+"AxisID",r=[];for(e=0,i=s.length;e{let a=i.split("."),r=a.pop(),n=[t].concat(a).join("."),o=e[i].split("."),l=o.pop(),h=o.join(".");s.d.route(n,r,h,l)})}(e,t.defaultRoutes),t.descriptors&&s.d.describe(e,t.descriptors)}(t,n,e),this.override&&s.d.override(t.id,t.overrides)),n}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,a=this.scope;i in e&&delete e[i],a&&i in s.d[a]&&(delete s.d[a][i],this.override&&delete s.U[i])}};var d=new class{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(e=>{let a=i||this._getRegistryForType(e);i||a.isForType(e)||a===this.plugins&&e.id?this._exec(t,a,e):(0,s.Q)(e,e=>{let s=i||this._getRegistryForType(e);this._exec(t,s,e)})})}_exec(t,e,i){let a=(0,s.W)(t);(0,s.C)(i["before"+a],[],i),e[t](i),(0,s.C)(i["after"+a],[],i)}_getRegistryForType(t){for(let e=0;e0&&this.getParsed(e-1);for(let d=e;d0&&Math.abs(i[g]-_[g])>x,m&&(f.parsed=i,f.raw=h.data[d]),u&&(f.options=c||this.resolveDataElementOptions(d,e.active?"active":a)),b||this.updateElement(e,d,f,a),_=i}this.updateSharedOptions(c,a,d)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}let i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;let a=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,a,r)/2}};ScatterController.id="scatter",ScatterController.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1},ScatterController.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var c=Object.freeze({__proto__:null,BarController:BarController,BubbleController:BubbleController,DoughnutController:DoughnutController,LineController:LineController,PolarAreaController:PolarAreaController,PieController:PieController,RadarController:RadarController,ScatterController:ScatterController});function abstract(){throw Error("This method is not implemented: Check that a complete date adapter is provided.")}let DateAdapter=class DateAdapter{constructor(t){this.options=t||{}}init(t){}formats(){return abstract()}parse(t,e){return abstract()}format(t,e){return abstract()}add(t,e,i){return abstract()}diff(t,e,i){return abstract()}startOf(t,e,i){return abstract()}endOf(t,e){return abstract()}};DateAdapter.override=function(t){Object.assign(DateAdapter.prototype,t)};var u={_date:DateAdapter};function evaluateInteractionItems(t,e,i,a,r){let n=t.getSortedVisibleDatasetMetas(),o=i[e];for(let t=0,i=n.length;t{t[n](e[i],a)&&(r.push({element:t,datasetIndex:s,index:l}),o=o||t.inRange(e.x,e.y,a))}),s&&!o)?[]:r}var g={modes:{index(t,e,i,a){let r=(0,s.X)(e,t),n=i.axis||"x",o=i.includeInvisible||!1,l=i.intersect?getIntersectItems(t,r,n,a,o):getNearestItems(t,r,n,!1,a,o),h=[];return l.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{let e=l[0].index,i=t.data[e];i&&!i.skip&&h.push({element:i,datasetIndex:t.index,index:e})}),h):[]},dataset(t,e,i,a){let r=(0,s.X)(e,t),n=i.axis||"xy",o=i.includeInvisible||!1,l=i.intersect?getIntersectItems(t,r,n,a,o):getNearestItems(t,r,n,!1,a,o);if(l.length>0){let e=l[0].datasetIndex,i=t.getDatasetMeta(e).data;l=[];for(let t=0;tt.pos===e)}function filterDynamicPositionByAxis(t,e){return t.filter(t=>-1===p.indexOf(t.pos)&&t.box.axis===e)}function sortByWeight(t,e){return t.sort((t,i)=>{let s=e?i:t,a=e?t:i;return s.weight===a.weight?s.index-a.index:s.weight-a.weight})}function getCombinedMax(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function updateMaxPadding(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function fitBoxes(t,e,i,a){let r,n,o,l,h,d;let c=[];for(r=0,n=t.length,h=0;r{s[t]=Math.max(e[t],i[t])}),s}(t?["left","right"]:["top","bottom"])}(o.horizontal,e));let{same:n,other:u}=function(t,e,i,a){let{pos:r,box:n}=i,o=t.maxPadding;if(!(0,s.i)(r)){i.size&&(t[r]-=i.size);let e=a[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?n.height:n.width),i.size=e.size/e.count,t[r]+=i.size}n.getPadding&&updateMaxPadding(o,n.getPadding());let l=Math.max(0,e.outerWidth-getCombinedMax(o,t,"left","right")),h=Math.max(0,e.outerHeight-getCombinedMax(o,t,"top","bottom")),d=l!==t.w,c=h!==t.h;return t.w=l,t.h=h,i.horizontal?{same:d,other:c}:{same:c,other:d}}(e,i,o,a);h|=n&&c.length,d=d||u,l.fullSize||c.push(o)}return h&&fitBoxes(c,e,i,a)||d}function setBoxDims(t,e,i,s,a){t.top=i,t.left=e,t.right=e+s,t.bottom=i+a,t.width=s,t.height=a}function placeBoxes(t,e,i,a){let r=i.padding,{x:n,y:o}=e;for(let l of t){let t=l.box,h=a[l.stack]||{count:1,placed:0,weight:1},d=l.stackWeight/h.weight||1;if(l.horizontal){let a=e.w*d,n=h.size||t.height;(0,s.j)(h.start)&&(o=h.start),t.fullSize?setBoxDims(t,r.left,o,i.outerWidth-r.right-r.left,n):setBoxDims(t,e.left+h.placed,o,a,n),h.start=o,h.placed+=a,o=t.bottom}else{let a=e.h*d,o=h.size||t.width;(0,s.j)(h.start)&&(n=h.start),t.fullSize?setBoxDims(t,n,r.top,o,i.outerHeight-r.bottom-r.top):setBoxDims(t,n,e.top+h.placed,o,a),h.start=n,h.placed+=a,n=t.right}}e.x=n,e.y=o}s.d.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var f={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){let i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,a){if(!t)return;let r=(0,s.K)(t.options.layout.padding),n=Math.max(e-r.width,0),o=Math.max(i-r.height,0),l=function(t){let e=function(t){let e,i,s,a,r,n;let o=[];for(e=0,i=(t||[]).length;et.box.fullSize),!0),s=sortByWeight(filterByPosition(e,"left"),!0),a=sortByWeight(filterByPosition(e,"right")),r=sortByWeight(filterByPosition(e,"top"),!0),n=sortByWeight(filterByPosition(e,"bottom")),o=filterDynamicPositionByAxis(e,"x"),l=filterDynamicPositionByAxis(e,"y");return{fullSize:i,leftAndTop:s.concat(r),rightAndBottom:a.concat(l).concat(n).concat(o),chartArea:filterByPosition(e,"chartArea"),vertical:s.concat(a).concat(l),horizontal:r.concat(n).concat(o)}}(t.boxes),h=l.vertical,d=l.horizontal;(0,s.Q)(t.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});let c=h.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:r,availableWidth:n,availableHeight:o,vBoxMaxWidth:n/2/c,hBoxMaxHeight:o/2}),g=Object.assign({},r);updateMaxPadding(g,(0,s.K)(a));let f=Object.assign({maxPadding:g,w:n,h:o,x:r.left,y:r.top},r),m=function(t,e){let i,s,a;let r=function(t){let e={};for(let i of t){let{stack:t,pos:s,stackWeight:a}=i;if(!t||!p.includes(s))continue;let r=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=a}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;for(i=0,s=t.length;i{let i=e.box;Object.assign(i,t.chartArea),i.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};let BasePlatform=class BasePlatform{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}};let BasicPlatform=class BasicPlatform extends BasePlatform{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};let m="$chartjs",x={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=t=>null===t||""===t,b=!!s.a5&&{passive:!0};function removeListener(t,e,i){t.canvas.removeEventListener(e,i,b)}function nodeListContains(t,e){for(let i of t)if(i===e||i.contains(e))return!0}function createAttachObserver(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||nodeListContains(i.addedNodes,s))&&!nodeListContains(i.removedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}function createDetachObserver(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||nodeListContains(i.removedNodes,s))&&!nodeListContains(i.addedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}let _=new Map,v=0;function onWindowResize(){let t=window.devicePixelRatio;t!==v&&(v=t,_.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function createResizeObserver(t,e,i){let a=t.canvas,r=a&&(0,s.a2)(a);if(!r)return;let n=(0,s.a4)((t,e)=>{let s=r.clientWidth;i(t,e),s{let e=t[0],i=e.contentRect.width,s=e.contentRect.height;(0!==i||0!==s)&&n(i,s)});return o.observe(r),_.size||window.addEventListener("resize",onWindowResize),_.set(t,n),o}function releaseObserver(t,e,i){i&&i.disconnect(),"resize"===e&&(_.delete(t),_.size||window.removeEventListener("resize",onWindowResize))}function createProxyAndListen(t,e,i){let a=t.canvas,r=(0,s.a4)(e=>{null!==t.ctx&&i(function(t,e){let i=x[t.type]||t.type,{x:a,y:r}=(0,s.X)(t,e);return{type:i,chart:e,native:t,x:void 0!==a?a:null,y:void 0!==r?r:null}}(e,t))},t,t=>{let e=t[0];return[e,e.offsetX,e.offsetY]});return!function(t,e,i){t.addEventListener(e,i,b)}(a,e,r),r}let DomPlatform=class DomPlatform extends BasePlatform{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(!function(t,e){let i=t.style,a=t.getAttribute("height"),r=t.getAttribute("width");if(t[m]={initial:{height:a,width:r,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",isNullOrEmpty(r)){let e=(0,s.a3)(t,"width");void 0!==e&&(t.width=e)}if(isNullOrEmpty(a)){if(""===t.style.height)t.height=t.width/(e||2);else{let e=(0,s.a3)(t,"height");void 0!==e&&(t.height=e)}}}(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[m])return!1;let i=e[m].initial;["height","width"].forEach(t=>{let a=i[t];(0,s.k)(a)?e.removeAttribute(t):e.setAttribute(t,a)});let a=i.style||{};return Object.keys(a).forEach(t=>{e.style[t]=a[t]}),e.width=e.width,delete e[m],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[e]||createProxyAndListen;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;let a={attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[e]||removeListener;a(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,a){return(0,s.a1)(t,e,i,a)}isAttached(t){let e=(0,s.a2)(t);return!!(e&&e.isConnected)}};let PluginService=class PluginService{constructor(){this._init=[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));let a=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(a,t,e,i);return"afterDestroy"===e&&(this._notify(a,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,i,a){for(let r of(a=a||{},t)){let t=r.plugin,n=t[i],o=[e,a,r.options];if(!1===(0,s.C)(n,o,t)&&a.cancelable)return!1}return!0}invalidate(){(0,s.k)(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let i=t&&t.config,a=(0,s.v)(i.options&&i.options.plugins,{}),r=function(t){let e={},i=[],s=Object.keys(d.plugins.items);for(let t=0;tt.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(diff(e,i),t,"stop"),this._notify(diff(i,e),t,"start")}};function getIndexAxis(t,e){let i=s.d.datasets[t]||{},a=(e.datasets||{})[t]||{};return a.indexAxis||e.indexAxis||i.indexAxis||"x"}function determineAxis(t,e){var i;return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase()}function initOptions(t){let e=t.options||(t.options={});e.plugins=(0,s.v)(e.plugins,{}),e.scales=function(t,e){let i=s.U[t.type]||{scales:{}},a=e.scales||{},r=getIndexAxis(t.type,e),n=Object.create(null),o=Object.create(null);return Object.keys(a).forEach(t=>{let e=a[t];if(!(0,s.i)(e))return console.error(`Invalid scale configuration for scale: ${t}`);if(e._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let l=determineAxis(t,e),h=l===r?"_index_":"_value_",d=i.scales||{};n[l]=n[l]||t,o[t]=(0,s.ac)(Object.create(null),[{axis:l},e,d[l],d[h]])}),t.data.datasets.forEach(i=>{let r=i.type||t.type,l=i.indexAxis||getIndexAxis(r,e),h=s.U[r]||{},d=h.scales||{};Object.keys(d).forEach(t=>{let e;let r=(e=t,"_index_"===t?e=l:"_value_"===t&&(e="x"===l?"y":"x"),e),h=i[r+"AxisID"]||n[r]||r;o[h]=o[h]||Object.create(null),(0,s.ac)(o[h],[{axis:r},a[h],d[t]])})}),Object.keys(o).forEach(t=>{let e=o[t];(0,s.ac)(e,[s.d.scales[e.type],s.d.scale])}),o}(t,e)}function initData(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}let y=new Map,k=new Set;function cachedKeys(t,e){let i=y.get(t);return i||(i=e(),y.set(t,i),k.add(i)),i}let addIfFound=(t,e,i)=>{let a=(0,s.f)(e,i);void 0!==a&&t.add(a)};let Config=class Config{constructor(t){var e;this._config=((e=(e=t)||{}).data=initData(e.data),initOptions(e),e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=initData(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),initOptions(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return cachedKeys(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return cachedKeys(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return cachedKeys(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return cachedKeys(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:a,type:r}=this,n=this._cachedScopes(t,i),o=n.get(e);if(o)return o;let l=new Set;e.forEach(e=>{t&&(l.add(t),e.forEach(e=>addIfFound(l,t,e))),e.forEach(t=>addIfFound(l,a,t)),e.forEach(t=>addIfFound(l,s.U[r]||{},t)),e.forEach(t=>addIfFound(l,s.d,t)),e.forEach(t=>addIfFound(l,s.a7,t))});let h=Array.from(l);return 0===h.length&&h.push(Object.create(null)),k.has(e)&&n.set(e,h),h}chartOptionScopes(){let{options:t,type:e}=this;return[t,s.U[e]||{},s.d.datasets[e]||{},{type:e},s.d,s.a7]}resolveNamedOptions(t,e,i,a=[""]){let r={$shared:!0},{resolver:n,subPrefixes:o}=getResolver(this._resolverCache,t,a),l=n;if(function(t,e){let{isScriptable:i,isIndexable:a}=(0,s.ab)(t);for(let r of e){let e=i(r),n=a(r),o=(n||e)&&t[r];if(e&&((0,s.a8)(o)||hasFunction(o))||n&&(0,s.b)(o))return!0}return!1}(n,e)){r.$shared=!1,i=(0,s.a8)(i)?i():i;let e=this.createResolver(t,i,o);l=(0,s.a9)(n,i,e)}for(let t of e)r[t]=l[t];return r}createResolver(t,e,i=[""],a){let{resolver:r}=getResolver(this._resolverCache,t,i);return(0,s.i)(e)?(0,s.a9)(r,e,void 0,a):r}};function getResolver(t,e,i){let a=t.get(e);a||(a=new Map,t.set(e,a));let r=i.join(),n=a.get(r);if(!n){let t=(0,s.aa)(e,i);n={resolver:t,subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},a.set(r,n)}return n}let hasFunction=t=>(0,s.i)(t)&&Object.getOwnPropertyNames(t).reduce((e,i)=>e||(0,s.a8)(t[i]),!1),M=["top","bottom","left","right","chartArea"];function positionIsHorizontal(t,e){return"top"===t||"bottom"===t||-1===M.indexOf(t)&&"x"===e}function compare2Level(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function onAnimationsComplete(t){let e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),(0,s.C)(i&&i.onComplete,[t],e)}function onAnimationProgress(t){let e=t.chart,i=e.options.animation;(0,s.C)(i&&i.onProgress,[t],e)}function getCanvas(t){return(0,s.a6)()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}let S={},getChart=t=>{let e=getCanvas(t);return Object.values(S).filter(t=>t.canvas===e).pop()};let Chart=class Chart{constructor(t,e){let i=this.config=new Config(e),r=getCanvas(t),n=getChart(r);if(n)throw Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");let o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||(!(0,s.a6)()||"undefined"!=typeof OffscreenCanvas&&r instanceof OffscreenCanvas?BasicPlatform:DomPlatform)),this.platform.updateConfig(i);let l=this.platform.acquireContext(r,o.aspectRatio),h=l&&l.canvas,d=h&&h.height,c=h&&h.width;if(this.id=(0,s.ad)(),this.ctx=l,this.canvas=h,this.width=c,this.height=d,this._options=o,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 PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=(0,s.ae)(t=>this.update(t),o.resizeDelay||0),this._dataChanges=[],S[this.id]=this,!l||!h){console.error("Failed to create chart: can't acquire context from the given item");return}a.listen(this,"complete",onAnimationsComplete),a.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:a,_aspectRatio:r}=this;return(0,s.k)(t)?e&&r?r:a?i/a:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():(0,s.af)(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return(0,s.ag)(this.canvas,this.ctx),this}stop(){return a.stop(this),this}resize(t,e){a.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,a=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,n=this.platform.getMaximumSize(a,t,e,r),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=n.width,this.height=n.height,this._aspectRatio=this.aspectRatio,(0,s.af)(this,o,!0)&&(this.notifyPlugins("resize",{size:n}),(0,s.C)(i.onResize,[this,n],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let t=this.options,e=t.scales||{};(0,s.Q)(e,(t,e)=>{t.id=e})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,a=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{}),r=[];e&&(r=r.concat(Object.keys(e).map(t=>{let i=e[t],s=determineAxis(t,i),a="r"===s,r="x"===s;return{options:i,dposition:a?"chartArea":r?"bottom":"left",dtype:a?"radialLinear":r?"category":"linear"}}))),(0,s.Q)(r,e=>{let r=e.options,n=r.id,o=determineAxis(n,r),l=(0,s.v)(r.type,e.dtype);(void 0===r.position||positionIsHorizontal(r.position,o)!==positionIsHorizontal(e.dposition))&&(r.position=e.dposition),a[n]=!0;let h=null;if(n in i&&i[n].type===l)h=i[n];else{let t=d.getScale(l);i[(h=new t({id:n,type:l,ctx:this.ctx,chart:this})).id]=h}h.init(r,t)}),(0,s.Q)(a,(t,e)=>{t||delete i[e]}),(0,s.Q)(i,t=>{f.configure(this,t,t.options),f.addBox(this,t)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){let t,e;let i=[],a=this.data.datasets;for(this._removeUnreferencedMetasets(),t=0,e=a.length;t{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),a=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;let r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let n=0;for(let t=0,e=this.data.datasets.length;t{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(compare2Level("z","_idx"));let{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){(0,s.Q)(this.scales,t=>{f.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(0,s.ah)(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:a}of e){let e="_removeElements"===i?-a:a;!function(t,e,i){let s=Object.keys(t);for(let a of s){let s=+a;if(s>=e){let r=t[a];delete t[a],(i>0||s>e)&&(t[s+i]=r)}}}(t,s,e)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,makeSet=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),i=makeSet(0);for(let t=1;tt.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;f.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],(0,s.Q)(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i=t._clip,a=!i.disabled,r=this.chartArea,n={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",n)&&(a&&(0,s.L)(e,{left:!1===i.left?0:r.left-i.left,right:!1===i.right?this.width:r.right+i.right,top:!1===i.top?0:r.top-i.top,bottom:!1===i.bottom?this.height:r.bottom+i.bottom}),t.controller.draw(),a&&(0,s.N)(e),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return(0,s.$)(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let a=g.modes[e];return"function"==typeof a?a(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.filter(t=>t&&t._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=(0,s.h)(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let a=i?"show":"hide",r=this.getDatasetMeta(t),n=r.controller._resolveAnimations(void 0,a);(0,s.j)(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),n.update(r,{visible:i}),this.update(e=>e.datasetIndex===t?a:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),a.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},listener=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};(0,s.Q)(this.options.events,t=>_add(t,listener))}bindResponsiveEvents(){let t;this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,i=this.platform,_add=(t,s)=>{i.addEventListener(this,t,s),e[t]=s},_remove=(t,s)=>{e[t]&&(i.removeEventListener(this,t,s),delete e[t])},listener=(t,e)=>{this.canvas&&this.resize(t,e)},attached=()=>{_remove("attach",attached),this.attached=!0,this.resize(),_add("resize",listener),_add("detach",t)};t=()=>{this.attached=!1,_remove("resize",listener),this._stop(),this._resize(0,0),_add("attach",attached)},i.isAttached(this.canvas)?attached():t()}unbindEvents(){(0,s.Q)(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},(0,s.Q)(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s,a,r;let n=i?"set":"remove";for("dataset"===e&&this.getDatasetMeta(t[0].datasetIndex).controller["_"+n+"DatasetHoverStyle"](),a=0,r=t.length;a{let i=this.getDatasetMeta(t);if(!i)throw Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),a=!(0,s.ai)(i,e);a&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){let s=this.options.hover,diff=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),a=diff(e,t),r=i?t:diff(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},eventFilter=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,eventFilter))return;let s=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,eventFilter),(s||i.changed)&&this.render(),this}_handleEvent(t,e,i){var a;let{_active:r=[],options:n}=this,o=this._getActiveElements(t,r,i,e),l=(0,s.aj)(t),h=(a=this._lastEvent,i&&"mouseout"!==t.type?l?a:t:null);i&&(this._lastEvent=null,(0,s.C)(n.onHover,[t,o,this],this),l&&(0,s.C)(n.onClick,[t,o,this],this));let d=!(0,s.ai)(o,r);return(d||e)&&(this._active=o,this._updateHoverStyles(o,r,e)),this._lastEvent=h,d}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;let a=this.options.hover;return this.getElementsAtEventForMode(t,a.mode,a,s)}};let invalidatePlugins=()=>(0,s.Q)(Chart.instances,t=>t._plugins.invalidate());function clipArc(t,e,i){let{startAngle:a,pixelMargin:r,x:n,y:o,outerRadius:l,innerRadius:h}=e,d=r/l;t.beginPath(),t.arc(n,o,l,a-d,i+d),h>r?(d=r/h,t.arc(n,o,h,i+d,a-d,!0)):t.arc(n,o,r,i+s.H,a-s.H),t.closePath(),t.clip()}function rThetaToXY(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function pathArc(t,e,i,a,r,n){let{x:o,y:l,startAngle:h,pixelMargin:d,innerRadius:c}=e,u=Math.max(e.outerRadius+a+i-d,0),g=c>0?c+a+i+d:0,p=0,f=r-h;if(a){let t=u>0?u-a:0,e=((c>0?c-a:0)+t)/2;p=(f-(0!==e?f*e/(e+a):f))/2}let m=Math.max(.001,f*u-i/s.P)/u,x=(f-m)/2,b=h+x+p,_=r-x-p,{outerStart:v,outerEnd:y,innerStart:k,innerEnd:M}=function(t,e,i,a){var r;let n=(r=t.options.borderRadius,(0,s.al)(r,["outerStart","outerEnd","innerStart","innerEnd"])),o=(i-e)/2,l=Math.min(o,a*e/2),computeOuterLimit=t=>{let e=(i-Math.min(o,t))*a/2;return(0,s.E)(t,0,Math.min(o,e))};return{outerStart:computeOuterLimit(n.outerStart),outerEnd:computeOuterLimit(n.outerEnd),innerStart:(0,s.E)(n.innerStart,0,l),innerEnd:(0,s.E)(n.innerEnd,0,l)}}(e,g,u,_-b),S=u-v,w=u-y,C=b+v/S,P=_-y/w,D=g+k,L=g+M,A=b+k/D,T=_-M/L;if(t.beginPath(),n){if(t.arc(o,l,u,C,P),y>0){let e=rThetaToXY(w,P,o,l);t.arc(e.x,e.y,y,P,_+s.H)}let e=rThetaToXY(L,_,o,l);if(t.lineTo(e.x,e.y),M>0){let e=rThetaToXY(L,T,o,l);t.arc(e.x,e.y,M,_+s.H,T+Math.PI)}if(t.arc(o,l,g,_-M/g,b+k/g,!0),k>0){let e=rThetaToXY(D,A,o,l);t.arc(e.x,e.y,k,A+Math.PI,b-s.H)}let i=rThetaToXY(S,b,o,l);if(t.lineTo(i.x,i.y),v>0){let e=rThetaToXY(S,C,o,l);t.arc(e.x,e.y,v,b-s.H,C)}}else{t.moveTo(o,l);let e=Math.cos(C)*u+o,i=Math.sin(C)*u+l;t.lineTo(e,i);let s=Math.cos(P)*u+o,a=Math.sin(P)*u+l;t.lineTo(s,a)}t.closePath()}Object.defineProperties(Chart,{defaults:{enumerable:!0,value:s.d},instances:{enumerable:!0,value:S},overrides:{enumerable:!0,value:s.U},registry:{enumerable:!0,value:d},version:{enumerable:!0,value:"3.9.1"},getChart:{enumerable:!0,value:getChart},register:{enumerable:!0,value:(...t)=>{d.add(...t),invalidatePlugins()}},unregister:{enumerable:!0,value:(...t)=>{d.remove(...t),invalidatePlugins()}}});let ArcElement=class ArcElement extends Element{constructor(t){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,t&&Object.assign(this,t)}inRange(t,e,i){let a=this.getProps(["x","y"],i),{angle:r,distance:n}=(0,s.a0)(a,{x:t,y:e}),{startAngle:o,endAngle:l,innerRadius:h,outerRadius:d,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=this.options.spacing/2,g=(0,s.v)(c,l-o),p=g>=s.T||(0,s.p)(r,o,l),f=(0,s.ak)(n,h+u,d+u);return p&&f}getCenterPoint(t){let{x:e,y:i,startAngle:s,endAngle:a,innerRadius:r,outerRadius:n}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:o,spacing:l}=this.options,h=(s+a)/2,d=(r+n+l+o)/2;return{x:e+Math.cos(h)*d,y:i+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,a=(e.offset||0)/2,r=(e.spacing||0)/2,n=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>s.T?Math.floor(i/s.T):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=0;if(a){o=a/2;let e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*o,Math.sin(e)*o),this.circumference>=s.P&&(o=a)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;let l=function(t,e,i,a,r){let{fullCircles:n,startAngle:o,circumference:l}=e,h=e.endAngle;if(n){pathArc(t,e,i,a,o+s.T,r);for(let e=0;eo&&r>o)?s+h-l:h-l}}function pathSegment(t,e,i,a){let r,n,o;let{points:l,options:h}=e,{count:d,start:c,loop:u,ilen:g}=pathVars(l,i,a),p=h.stepped?s.as:h.tension||"monotone"===h.cubicInterpolationMode?s.at:lineTo,{move:f=!0,reverse:m}=a||{};for(r=0;r<=g;++r)(n=l[(c+(m?g-r:r))%d]).skip||(f?(t.moveTo(n.x,n.y),f=!1):p(t,o,n,m,h.stepped),o=n);return u&&p(t,o,n=l[(c+(m?g:0))%d],m,h.stepped),!!u}function fastPathSegment(t,e,i,s){let a,r,n,o,l,h;let d=e.points,{count:c,start:u,ilen:g}=pathVars(d,i,s),{move:p=!0,reverse:f}=s||{},m=0,x=0,pointIndex=t=>(u+(f?g-t:t))%c,drawX=()=>{o!==l&&(t.lineTo(m,l),t.lineTo(m,o),t.lineTo(m,h))};for(p&&(r=d[pointIndex(0)],t.moveTo(r.x,r.y)),a=0;a<=g;++a){if((r=d[pointIndex(a)]).skip)continue;let e=r.x,i=r.y,s=0|e;s===n?(il&&(l=i),m=(x*m+e)/++x):(drawX(),t.lineTo(e,i),n=s,x=0,o=l=i),h=i}drawX()}function _getSegmentMethod(t){let e=t.options,i=e.borderDash&&e.borderDash.length,s=!t._decimated&&!t._loop&&!e.tension&&"monotone"!==e.cubicInterpolationMode&&!e.stepped&&!i;return s?fastPathSegment:pathSegment}ArcElement.id="arc",ArcElement.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0},ArcElement.defaultRoutes={backgroundColor:"backgroundColor"};let w="function"==typeof Path2D;let LineElement=class LineElement extends Element{constructor(t){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,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){let a=i.spanGaps?this._loop:this._fullLoop;(0,s.am)(this._points,i,t,a,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=(0,s.an)(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i,a;let r=this.options,n=t[e],o=this.points,l=(0,s.ao)(this,{property:e,start:n,end:n});if(!l.length)return;let h=[],d=r.stepped?s.ap:r.tension||"monotone"===r.cubicInterpolationMode?s.aq:s.ar;for(i=0,a=l.length;i"borderDash"!==t&&"fill"!==t};let PointElement=class PointElement extends Element{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.options,{x:a,y:r}=this.getProps(["x","y"],i);return Math.pow(t-a,2)+Math.pow(e-r,2){cleanDecimatedDataset(t)})}function _getBounds(t,e,i,a){if(a)return;let r=e[t],n=i[t];return"angle"===t&&(r=(0,s.az)(r),n=(0,s.az)(n)),{property:t,start:r,end:n}}function _findSegmentEnd(t,e,i){for(;e>t;e--){let t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function _getEdge(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function _createBoundaryLine(t,e){let i=[],a=!1;return(0,s.b)(t)?(a=!0,i=t):i=function(t,e){let{x:i=null,y:s=null}=t||{},a=e.points,r=[];return e.segments.forEach(({start:t,end:e})=>{e=_findSegmentEnd(t,e,a);let n=a[t],o=a[e];null!==s?(r.push({x:n.x,y:s}),r.push({x:o.x,y:s})):null!==i&&(r.push({x:i,y:n.y}),r.push({x:i,y:o.y}))}),r}(t,e),i.length?new LineElement({points:i,options:{tension:0},_loop:a,_fullLoop:a}):null}function _shouldApplyFill(t){return t&&!1!==t.fill}let simpleArc=class simpleArc{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:a,y:r,radius:n}=this;return e=e||{start:0,end:s.T},t.arc(a,r,n,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:s}=this,a=t.angle;return{x:e+Math.cos(a)*s,y:i+Math.sin(a)*s,angle:a}}};function _drawfill(t,e,i){let a=function(t){let{chart:e,fill:i,line:a}=t;if((0,s.g)(i))return function(t,e){let i=t.getDatasetMeta(e),s=i&&t.isDatasetVisible(e);return s?i.dataset:null}(e,i);if("stack"===i)return function(t){let{scale:e,index:i,line:a}=t,r=[],n=a.segments,o=a.points,l=function(t,e){let i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}},itemsEqual=(t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index;let Legend=class Legend extends Element{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.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(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,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(){let t=this.options.labels||{},e=(0,s.C)(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,i)=>t.sort(e,i,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let t,e;let{options:i,ctx:a}=this;if(!i.display){this.width=this.height=0;return}let r=i.labels,n=(0,s.O)(r.font),o=n.size,l=this._computeTitleHeight(),{boxWidth:h,itemHeight:d}=getBoxSize(r,o);a.font=n.string,this.isHorizontal()?(t=this.maxWidth,e=this._fitRows(l,o,h,d)+10):(e=this.maxHeight,t=this._fitCols(l,o,h,d)+10),this.width=Math.min(t,i.maxWidth||this.maxWidth),this.height=Math.min(e,i.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){let{ctx:a,maxWidth:r,options:{labels:{padding:n}}}=this,o=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+n,d=t;a.textAlign="left",a.textBaseline="middle";let c=-1,u=-h;return this.legendItems.forEach((t,g)=>{let p=i+e/2+a.measureText(t.text).width;(0===g||l[l.length-1]+p+2*n>r)&&(d+=h,l[l.length-(g>0?0:1)]=0,u+=h,c++),o[g]={left:0,top:u,row:c,width:p,height:s},l[l.length-1]+=p+n}),d}_fitCols(t,e,i,s){let{ctx:a,maxHeight:r,options:{labels:{padding:n}}}=this,o=this.legendHitBoxes=[],l=this.columnSizes=[],h=r-t,d=n,c=0,u=0,g=0,p=0;return this.legendItems.forEach((t,r)=>{let f=i+e/2+a.measureText(t.text).width;r>0&&u+s+2*n>h&&(d+=c+n,l.push({width:c,height:u}),g+=c+n,p++,c=u=0),o[r]={left:g,top:u,col:p,width:f,height:s},c=Math.max(c,f),u+=s+n}),d+=c,l.push({width:c,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:a},rtl:r}}=this,n=(0,s.aA)(r,this.left,this.width);if(this.isHorizontal()){let r=0,o=(0,s.S)(i,this.left+a,this.right-this.lineWidths[r]);for(let l of e)r!==l.row&&(r=l.row,o=(0,s.S)(i,this.left+a,this.right-this.lineWidths[r])),l.top+=this.top+t+a,l.left=n.leftForLtr(n.x(o),l.width),o+=l.width+a}else{let r=0,o=(0,s.S)(i,this.top+t+a,this.bottom-this.columnSizes[r].height);for(let l of e)l.col!==r&&(r=l.col,o=(0,s.S)(i,this.top+t+a,this.bottom-this.columnSizes[r].height)),l.top=o,l.left+=this.left+a,l.left=n.leftForLtr(n.x(l.left),l.width),o+=l.height+a}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){let t=this.ctx;(0,s.L)(t,this),this._draw(),(0,s.N)(t)}}_draw(){let t;let{options:e,columnSizes:i,lineWidths:a,ctx:r}=this,{align:n,labels:o}=e,l=s.d.color,h=(0,s.aA)(e.rtl,this.left,this.width),d=(0,s.O)(o.font),{color:c,padding:u}=o,g=d.size,p=g/2;this.drawTitle(),r.textAlign=h.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=d.string;let{boxWidth:f,boxHeight:m,itemHeight:x}=getBoxSize(o,g),drawLegendBox=function(t,e,i){if(isNaN(f)||f<=0||isNaN(m)||m<0)return;r.save();let a=(0,s.v)(i.lineWidth,1);if(r.fillStyle=(0,s.v)(i.fillStyle,l),r.lineCap=(0,s.v)(i.lineCap,"butt"),r.lineDashOffset=(0,s.v)(i.lineDashOffset,0),r.lineJoin=(0,s.v)(i.lineJoin,"miter"),r.lineWidth=a,r.strokeStyle=(0,s.v)(i.strokeStyle,l),r.setLineDash((0,s.v)(i.lineDash,[])),o.usePointStyle){let n={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:a},l=h.xPlus(t,f/2),d=e+p;(0,s.aE)(r,n,l,d,o.pointStyleWidth&&f)}else{let n=e+Math.max((g-m)/2,0),o=h.leftForLtr(t,f),l=(0,s.ax)(i.borderRadius);r.beginPath(),Object.values(l).some(t=>0!==t)?(0,s.av)(r,{x:o,y:n,w:f,h:m,radius:l}):r.rect(o,n,f,m),r.fill(),0!==a&&r.stroke()}r.restore()},fillText=function(t,e,i){(0,s.M)(r,i.text,t,e+x/2,d,{strikethrough:i.hidden,textAlign:h.textAlign(i.textAlign)})},b=this.isHorizontal(),_=this._computeTitleHeight();t=b?{x:(0,s.S)(n,this.left+u,this.right-a[0]),y:this.top+u+_,line:0}:{x:this.left+u,y:(0,s.S)(n,this.top+_+u,this.bottom-i[0].height),line:0},(0,s.aB)(this.ctx,e.textDirection);let v=x+u;this.legendItems.forEach((l,d)=>{r.strokeStyle=l.fontColor||c,r.fillStyle=l.fontColor||c;let g=r.measureText(l.text).width,m=h.textAlign(l.textAlign||(l.textAlign=o.textAlign)),x=f+p+g,y=t.x,k=t.y;h.setWidth(this.width),b?d>0&&y+x+u>this.right&&(k=t.y+=v,t.line++,y=t.x=(0,s.S)(n,this.left+u,this.right-a[t.line])):d>0&&k+v>this.bottom&&(y=t.x=y+i[t.line].width+u,t.line++,k=t.y=(0,s.S)(n,this.top+_+u,this.bottom-i[t.line].height));let M=h.x(y);drawLegendBox(M,k,l),y=(0,s.aC)(m,y+f+p,b?y+x:this.right,e.rtl),fillText(h.x(y),k,l),b?t.x+=x+u:t.y+=v}),(0,s.aD)(this.ctx,e.textDirection)}drawTitle(){let t;let e=this.options,i=e.title,a=(0,s.O)(i.font),r=(0,s.K)(i.padding);if(!i.display)return;let n=(0,s.aA)(e.rtl,this.left,this.width),o=this.ctx,l=i.position,h=a.size/2,d=r.top+h,c=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),t=this.top+d,c=(0,s.S)(e.align,c,this.right-u);else{let i=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);t=d+(0,s.S)(e.align,this.top,this.bottom-i-e.labels.padding-this._computeTitleHeight())}let g=(0,s.S)(l,c,c+u);o.textAlign=n.textAlign((0,s.R)(l)),o.textBaseline="middle",o.strokeStyle=i.color,o.fillStyle=i.color,o.font=a.string,(0,s.M)(o,i.text,g,t,a)}_computeTitleHeight(){let t=this.options.title,e=(0,s.O)(t.font),i=(0,s.K)(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,a,r;if((0,s.ak)(t,this.left,this.right)&&(0,s.ak)(e,this.top,this.bottom)){for(i=0,r=this.legendHitBoxes;i-1?t.split("\n"):t}function getTooltipSize(t,e){let i=t.chart.ctx,{body:a,footer:r,title:n}=t,{boxWidth:o,boxHeight:l}=e,h=(0,s.O)(e.bodyFont),d=(0,s.O)(e.titleFont),c=(0,s.O)(e.footerFont),u=n.length,g=r.length,p=a.length,f=(0,s.K)(e.padding),m=f.height,x=0,b=a.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*d.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){let t=e.displayColors?Math.max(l,h.lineHeight):h.lineHeight;m+=p*t+(b-p)*h.lineHeight+(b-1)*e.bodySpacing}g&&(m+=e.footerMarginTop+g*c.lineHeight+(g-1)*e.footerSpacing);let _=0,maxLineWidth=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=d.string,(0,s.Q)(t.title,maxLineWidth),i.font=h.string,(0,s.Q)(t.beforeBody.concat(t.afterBody),maxLineWidth),_=e.displayColors?o+2+e.boxPadding:0,(0,s.Q)(a,t=>{(0,s.Q)(t.before,maxLineWidth),(0,s.Q)(t.lines,maxLineWidth),(0,s.Q)(t.after,maxLineWidth)}),_=0,i.font=c.string,(0,s.Q)(t.footer,maxLineWidth),i.restore(),{width:x+=f.width,height:m}}function determineAlignment(t,e,i){let s=i.yAlign||e.yAlign||function(t,e){let{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||function(t,e,i,s){let{x:a,width:r}=i,{width:n,chartArea:{left:o,right:l}}=t,h="center";return"center"===s?h=a<=(o+l)/2?"left":"right":a<=r/2?h="left":a>=n-r/2&&(h="right"),function(t,e,i,s){let{x:a,width:r}=s,n=i.caretSize+i.caretPadding;if("left"===t&&a+r+n>e.width||"right"===t&&a-r-n<0)return!0}(h,t,e,i)&&(h="center"),h}(t,e,i,s),yAlign:s}}function getBackgroundPoint(t,e,i,a){let{caretSize:r,caretPadding:n,cornerRadius:o}=t,{xAlign:l,yAlign:h}=i,d=r+n,{topLeft:c,topRight:u,bottomLeft:g,bottomRight:p}=(0,s.ax)(o),f=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,l),m=function(t,e,i){let{y:s,height:a}=t;return"top"===e?s+=i:"bottom"===e?s-=a+i:s-=a/2,s}(e,h,d);return"center"===h?"left"===l?f+=d:"right"===l&&(f-=d):"left"===l?f-=Math.max(c,g)+r:"right"===l&&(f+=Math.max(u,p)+r),{x:(0,s.E)(f,0,a.width-e.width),y:(0,s.E)(m,0,a.height-e.height)}}function getAlignedX(t,e,i){let a=(0,s.K)(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-a.right:t.x+a.left}function overrideCallbacks(t,e){let i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}let Tooltip=class Tooltip extends Element{constructor(t){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=t.chart||t._chart,this._chart=this.chart,this.options=t.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(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,a=new Animations(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){var t,e;return this.$context||(this.$context=(t=this.chart.getContext(),e=this._tooltipItems,(0,s.h)(t,{tooltip:this,tooltipItems:e,type:"tooltip"})))}getTitle(t,e){let{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),a=i.title.apply(this,[t]),r=i.afterTitle.apply(this,[t]),n=[];return n=pushOrConcat(n,splitNewlines(s)),n=pushOrConcat(n,splitNewlines(a)),n=pushOrConcat(n,splitNewlines(r))}getBeforeBody(t,e){return pushOrConcat([],splitNewlines(e.callbacks.beforeBody.apply(this,[t])))}getBody(t,e){let{callbacks:i}=e,a=[];return(0,s.Q)(t,t=>{let e={before:[],lines:[],after:[]},s=overrideCallbacks(i,t);pushOrConcat(e.before,splitNewlines(s.beforeLabel.call(this,t))),pushOrConcat(e.lines,s.label.call(this,t)),pushOrConcat(e.after,splitNewlines(s.afterLabel.call(this,t))),a.push(e)}),a}getAfterBody(t,e){return pushOrConcat([],splitNewlines(e.callbacks.afterBody.apply(this,[t])))}getFooter(t,e){let{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),a=i.footer.apply(this,[t]),r=i.afterFooter.apply(this,[t]),n=[];return n=pushOrConcat(n,splitNewlines(s)),n=pushOrConcat(n,splitNewlines(a)),n=pushOrConcat(n,splitNewlines(r))}_createItems(t){let e,i;let a=this._active,r=this.chart.data,n=[],o=[],l=[],h=[];for(e=0,i=a.length;et.filter(e,i,s,r))),t.itemSort&&(h=h.sort((e,i)=>t.itemSort(e,i,r))),(0,s.Q)(h,e=>{let i=overrideCallbacks(t.callbacks,e);n.push(i.labelColor.call(this,e)),o.push(i.labelPointStyle.call(this,e)),l.push(i.labelTextColor.call(this,e))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=l,this.dataPoints=h,h}update(t,e){let i;let s=this.options.setContext(this.getContext()),a=this._active,r=[];if(a.length){let t=D[s.position].call(this,a,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);let e=this._size=getTooltipSize(this,s),n=Object.assign({},t,e),o=determineAlignment(this.chart,s,n),l=getBackgroundPoint(s,n,o,this.chart);this.xAlign=o.xAlign,this.yAlign=o.yAlign,i={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(i={opacity:0});this._tooltipItems=r,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let a=this.getCaretPosition(t,i,s);e.lineTo(a.x1,a.y1),e.lineTo(a.x2,a.y2),e.lineTo(a.x3,a.y3)}getCaretPosition(t,e,i){let a,r,n,o,l,h;let{xAlign:d,yAlign:c}=this,{caretSize:u,cornerRadius:g}=i,{topLeft:p,topRight:f,bottomLeft:m,bottomRight:x}=(0,s.ax)(g),{x:b,y:_}=t,{width:v,height:y}=e;return"center"===c?(l=_+y/2,"left"===d?(r=(a=b)-u,o=l+u,h=l-u):(r=(a=b+v)+u,o=l-u,h=l+u),n=a):(r="left"===d?b+Math.max(p,m)+u:"right"===d?b+v-Math.max(f,x)-u:this.caretX,"top"===c?(l=(o=_)-u,a=r-u,n=r+u):(l=(o=_+y)+u,a=r+u,n=r-u),h=o),{x1:a,x2:r,x3:n,y1:o,y2:l,y3:h}}drawTitle(t,e,i){let a,r,n;let o=this.title,l=o.length;if(l){let h=(0,s.aA)(i.rtl,this.x,this.width);for(n=0,t.x=getAlignedX(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",a=(0,s.O)(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string;n0!==t)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,(0,s.av)(t,{x:e,y:f,w:h,h:l,radius:o}),t.fill(),t.stroke(),t.fillStyle=n.backgroundColor,t.beginPath(),(0,s.av)(t,{x:i,y:f+1,w:h-2,h:l-2,radius:o}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(e,f,h,l),t.strokeRect(e,f,h,l),t.fillStyle=n.backgroundColor,t.fillRect(i,f+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let a,r,n,o,l,h,d;let{body:c}=this,{bodySpacing:u,bodyAlign:g,displayColors:p,boxHeight:f,boxWidth:m,boxPadding:x}=i,b=(0,s.O)(i.bodyFont),_=b.lineHeight,v=0,y=(0,s.aA)(i.rtl,this.x,this.width),fillLineOfText=function(i){e.fillText(i,y.x(t.x+v),t.y+_/2),t.y+=_+u},k=y.textAlign(g);for(e.textAlign=g,e.textBaseline="middle",e.font=b.string,t.x=getAlignedX(this,k,i),e.fillStyle=i.bodyColor,(0,s.Q)(this.beforeBody,fillLineOfText),v=p&&"right"!==k?"center"===g?m/2+x:m+2+x:0,o=0,h=c.length;o0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,a=i&&i.y;if(s||a){let i=D[t.position].call(this,this._active,this._eventPosition);if(!i)return;let r=this._size=getTooltipSize(this,t),n=Object.assign({},i,this._size),o=determineAlignment(e,t,n),l=getBackgroundPoint(t,n,o,e);(s._to!==l.x||a._to!==l.y)&&(this.xAlign=o.xAlign,this.yAlign=o.yAlign,this.width=r.width,this.height=r.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let a={width:this.width,height:this.height},r={x:this.x,y:this.y};i=.001>Math.abs(i)?0:i;let n=(0,s.K)(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,a,e),(0,s.aB)(t,e.textDirection),r.y+=n.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),(0,s.aD)(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,a=t.map(({datasetIndex:t,index:e})=>{let i=this.chart.getDatasetMeta(t);if(!i)throw Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),r=!(0,s.ai)(i,a),n=this._positionChanged(a,e);(r||n)&&(this._active=a,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let a=this.options,r=this._active||[],n=this._getActiveElements(t,r,e,i),o=this._positionChanged(n,t),l=e||!(0,s.ai)(n,r)||o;return l&&(this._active=n,(a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){let a=this.options;if("mouseout"===t.type)return[];if(!s)return e;let r=this.chart.getElementsAtEventForMode(t,a.mode,a,i);return a.reverse&&r.reverse(),r}_positionChanged(t,e){let{caretX:i,caretY:s,options:a}=this,r=D[a.position].call(this,t,e);return!1!==r&&(i!==r.x||s!==r.y)}};Tooltip.positioners=D;var L={id:"tooltip",_element:Tooltip,positioners:D,afterInit(t,e,i){i&&(t.tooltip=new Tooltip({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){let e=t.tooltip;if(e&&e._willRender()){let i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",i))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){let i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:{beforeTitle:s.aF,title(t){if(t.length>0){let e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},A=Object.freeze({__proto__:null,Decimation:{id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled){cleanDecimatedData(t);return}let a=t.width;t.data.datasets.forEach((e,r)=>{let n;let{_data:o,indexAxis:l}=e,h=t.getDatasetMeta(r),d=o||e.data;if("y"===(0,s.a)([l,t.options.indexAxis])||!h.controller.supportsDecimation)return;let c=t.scales[h.xAxisID];if("linear"!==c.type&&"time"!==c.type||t.options.parsing)return;let{start:u,count:g}=function(t,e){let i=e.length,a=0,{iScale:r}=t,{min:n,max:o,minDefined:l,maxDefined:h}=r.getUserBounds();return l&&(a=(0,s.E)((0,s.Z)(e,r.axis,n).lo,0,i-1)),{start:a,count:h?(0,s.E)((0,s.Z)(e,r.axis,o).hi+1,a,i)-a:i-a}}(h,d),p=i.threshold||4*a;if(g<=p){cleanDecimatedDataset(e);return}switch((0,s.k)(o)&&(e._data=d,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":n=function(t,e,i,s,a){let r,n,o,l,h;let d=a.samples||s;if(d>=i)return t.slice(e,e+i);let c=[],u=(i-2)/(d-2),g=0,p=e+i-1,f=e;for(r=0,c[g++]=t[f];ro&&(o=l,n=t[s],h=s);c[g++]=n,f=h}return c[g++]=t[p],c}(d,u,g,a,i);break;case"min-max":n=function(t,e,i,a){let r,n,o,l,h,d,c,u,g,p,f=0,m=0,x=[],b=t[e].x,_=t[e+i-1].x,v=_-b;for(r=e;rp&&(p=l,c=r),f=(m*f+n.x)/++m;else{let i=r-1;if(!(0,s.k)(d)&&!(0,s.k)(c)){let e=Math.min(d,c),s=Math.max(d,c);e!==u&&e!==i&&x.push({...t[e],x:f}),s!==u&&s!==i&&x.push({...t[s],x:f})}r>0&&i!==u&&x.push(t[i]),x.push(n),h=e,m=0,g=p=l,d=c=u=r}}return x}(d,u,g,a);break;default:throw Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=n})},destroy(t){cleanDecimatedData(t)}},Filler:{id:"filler",afterDatasetsUpdate(t,e,i){let a,r,n,o;let l=(t.data.datasets||[]).length,h=[];for(r=0;r=i)&&r):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}(n,r,l),chart:t,axis:a.controller.options.indexAxis,scale:a.vScale,line:n}),a.$filler=o,h.push(o);for(r=0;r=0;--e){let i=a[e].$filler;i&&(i.line.updateControlPoints(r,i.axis),s&&i.fill&&_drawfill(t.ctx,i,r))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;let s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){let i=s[e].$filler;_shouldApplyFill(i)&&_drawfill(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){let s=e.meta.$filler;_shouldApplyFill(s)&&"beforeDatasetDraw"===i.drawTime&&_drawfill(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},Legend:{id:"legend",_element:Legend,start(t,e,i){let s=t.legend=new Legend({ctx:t.ctx,options:i,chart:t});f.configure(t,s,i),f.addBox(t,s)},stop(t){f.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){let s=t.legend;f.configure(t,s,i),s.options=i},afterUpdate(t){let e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){let s=e.datasetIndex,a=i.chart;a.isDatasetVisible(s)?(a.hide(s),e.hidden=!0):(a.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){let e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:a,textAlign:r,color:n}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{let o=t.controller.getStyle(i?0:void 0),l=(0,s.K)(o.borderWidth);return{text:e[t.index].label,fillStyle:o.backgroundColor,fontColor:n,hidden:!t.visible,lineCap:o.borderCapStyle,lineDash:o.borderDash,lineDashOffset:o.borderDashOffset,lineJoin:o.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:o.borderColor,pointStyle:a||o.pointStyle,rotation:o.rotation,textAlign:r||o.textAlign,borderRadius:0,datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}},SubTitle:{id:"subtitle",start(t,e,i){let s=new Title({ctx:t.ctx,options:i,chart:t});f.configure(t,s,i),f.addBox(t,s),P.set(t,s)},stop(t){f.removeBox(t,P.get(t)),P.delete(t)},beforeUpdate(t,e,i){let s=P.get(t);f.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Title:{id:"title",_element:Title,start(t,e,i){!function(t,e){let i=new Title({ctx:t.ctx,options:e,chart:t});f.configure(t,i,e),f.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){let e=t.titleBlock;f.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){let s=t.titleBlock;f.configure(t,s,i),s.options=i},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}},Tooltip:L});let addIfString=(t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i),validIndex=(t,e)=>null===t?null:(0,s.E)(Math.round(t),0,e);let CategoryScale=class CategoryScale extends Scale{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let t=this.getLabels();for(let{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if((0,s.k)(t))return null;let i=this.getLabels();return validIndex(e=isFinite(e)&&i[e]===t?e:function(t,e,i,s){let a=t.indexOf(e);if(-1===a)return addIfString(t,e,i,s);let r=t.lastIndexOf(e);return a!==r?i:a}(i,t,(0,s.v)(e,t),this._addedLabels),i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);"ticks"!==this.options.bounds||(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,s=[],a=this.getLabels();a=0===t&&e===a.length-1?a:a.slice(t,e+1),this._valueRange=Math.max(a.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){let e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function relativeLabelSize(t,e,{horizontal:i,minRotation:a}){let r=(0,s.t)(a),n=.75*e*(""+t).length;return Math.min(e/((i?Math.sin(r):Math.cos(r))||.001),n)}CategoryScale.id="category",CategoryScale.defaults={ticks:{callback:CategoryScale.prototype.getLabelForValue}};let LinearScaleBase=class LinearScaleBase extends Scale{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return(0,s.k)(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:a,max:r}=this,setMin=t=>a=e?a:t,setMax=t=>r=i?r:t;if(t){let t=(0,s.s)(a),e=(0,s.s)(r);t<0&&e<0?setMax(0):t>0&&e>0&&setMin(0)}if(a===r){let e=1;(r>=Number.MAX_SAFE_INTEGER||a<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*r)),setMax(r+e),t||setMin(a-e)}this.min=a,this.max=r}getTickLimit(){let t;let e=this.options.ticks,{maxTicksLimit:i,stepSize:s}=e;return s?(t=Math.ceil(this.max/s)-Math.floor(this.min/s)+1)>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3):(t=this.computeTickLimit(),i=i||11),i&&(t=Math.min(i,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let a={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},r=this._range||this,n=function(t,e){let i,a,r,n;let o=[],{bounds:l,step:h,min:d,max:c,precision:u,count:g,maxTicks:p,maxDigits:f,includeBounds:m}=t,x=h||1,b=p-1,{min:_,max:v}=e,y=!(0,s.k)(d),k=!(0,s.k)(c),M=!(0,s.k)(g),S=(v-_)/(f+1),w=(0,s.aI)((v-_)/b/x)*x;if(w<1e-14&&!y&&!k)return[{value:_},{value:v}];(n=Math.ceil(v/w)-Math.floor(_/w))>b&&(w=(0,s.aI)(n*w/b/x)*x),(0,s.k)(u)||(w=Math.ceil(w*(i=Math.pow(10,u)))/i),"ticks"===l?(a=Math.floor(_/w)*w,r=Math.ceil(v/w)*w):(a=_,r=v),y&&k&&h&&(0,s.aJ)((c-d)/h,w/1e3)?(n=Math.round(Math.min((c-d)/w,p)),w=(c-d)/n,a=d,r=c):M?(a=y?d:a,w=((r=k?c:r)-a)/(n=g-1)):(n=(r-a)/w,n=(0,s.aK)(n,Math.round(n),w/1e3)?Math.round(n):Math.ceil(n));let C=Math.max((0,s.aL)(w),(0,s.aL)(a));a=Math.round(a*(i=Math.pow(10,(0,s.k)(u)?C:u)))/i,r=Math.round(r*i)/i;let P=0;for(y&&(m&&a!==d?(o.push({value:d}),a0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=(0,s.g)(t)?Math.max(0,t):null,this.max=(0,s.g)(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,a=this.max,setMin=e=>i=t?i:e,setMax=t=>a=e?a:t,exp=(t,e)=>Math.pow(10,Math.floor((0,s.z)(t))+e);i===a&&(i<=0?(setMin(1),setMax(10)):(setMin(exp(i,-1)),setMax(exp(a,1)))),i<=0&&setMin(exp(a,-1)),a<=0&&setMax(exp(i,1)),this._zero&&this.min!==this._suggestedMin&&i===exp(this.min,0)&&setMin(exp(i,-1)),this.min=i,this.max=a}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=function(t,e){let i=Math.floor((0,s.z)(e.max)),a=Math.ceil(e.max/Math.pow(10,i)),r=[],n=(0,s.B)(t.min,Math.pow(10,Math.floor((0,s.z)(e.min)))),o=Math.floor((0,s.z)(n)),l=Math.floor(n/Math.pow(10,o)),h=o<0?Math.pow(10,Math.abs(o)):1;do r.push({value:n,major:isMajor(n)}),10==++l&&(l=1,h=++o>=0?1:h),n=Math.round(l*Math.pow(10,o)*h)/h;while(oa?{start:e-i,end:e}:{start:e,end:e+i}}function pathRadiusLine(t,e,i,a){let{ctx:r}=t;if(i)r.arc(t.xCenter,t.yCenter,e,0,s.T);else{let i=t.getPointPosition(0,e);r.moveTo(i.x,i.y);for(let s=1;s{let i=(0,s.C)(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){let t=this.options;t.display&&t.pointLabels.display?function(t){let e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),a=[],r=[],n=t._pointLabels.length,o=t.options.pointLabels,l=o.centerPointLabels?s.P/n:0;for(let c=0;ce.r&&(o=(s.end-e.r)/r,t.r=Math.max(t.r,e.r+o)),a.starte.b&&(l=(a.end-e.b)/n,t.b=Math.max(t.b,e.b+l))}(i,e,f,x,b)}t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){let a=[],r=t._pointLabels.length,n=t.options,o=getTickBackdropHeight(n)/2,l=t.drawingArea,h=n.pointLabels.centerPointLabels?s.P/r:0;for(let n=0;n270||p<90)&&(d-=c),d),x=0===p||180===p?"center":p<180?"left":"right",b=(u=r.x,g=f.w,"right"===x?u-=g:"center"===x&&(u-=g/2),u);a.push({x:r.x,y:m,textAlign:x,left:b,top:m,right:b+f.w,bottom:m+f.h})}return a}(t,a,r)}(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=s.T/(this._pointLabels.length||1),i=this.options.startAngle||0;return(0,s.az)(t*e+(0,s.t)(i))}getDistanceFromCenterForValue(t){if((0,s.k)(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if((0,s.k)(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t=0;r--){let e=a.setContext(t.getPointLabelContext(r)),n=(0,s.O)(e.font),{x:o,y:l,textAlign:h,left:d,top:c,right:u,bottom:g}=t._pointLabelItems[r],{backdropColor:p}=e;if(!(0,s.k)(p)){let t=(0,s.ax)(e.borderRadius),a=(0,s.K)(e.backdropPadding);i.fillStyle=p;let r=d-a.left,n=c-a.top,o=u-d+a.width,l=g-c+a.height;Object.values(t).some(t=>0!==t)?(i.beginPath(),(0,s.av)(i,{x:r,y:n,w:o,h:l,radius:t}),i.fill()):i.fillRect(r,n,o,l)}(0,s.M)(i,t._pointLabels[r],o,l+n.lineHeight/2,n,{color:e.color,textAlign:h,textBaseline:"middle"})}}(this,l),o.display&&this.ticks.forEach((t,i)=>{if(0!==i){e=this.getDistanceFromCenterForValue(t.value);let s=o.setContext(this.getContext(i-1));!function(t,e,i,s){let a=t.ctx,r=e.circular,{color:n,lineWidth:o}=e;(r||s)&&n&&o&&!(i<0)&&(a.save(),a.strokeStyle=n,a.lineWidth=o,a.setLineDash(e.borderDash),a.lineDashOffset=e.borderDashOffset,a.beginPath(),pathRadiusLine(t,i,r,s),a.closePath(),a.stroke(),a.restore())}(this,s,e,l)}}),n.display){for(a.save(),t=l-1;t>=0;t--){let s=n.setContext(this.getPointLabelContext(t)),{color:o,lineWidth:l}=s;l&&o&&(a.lineWidth=l,a.strokeStyle=o,a.setLineDash(s.borderDash),a.lineDashOffset=s.borderDashOffset,e=this.getDistanceFromCenterForValue(r.ticks.reverse?this.min:this.max),i=this.getPointPosition(t,e),a.beginPath(),a.moveTo(this.xCenter,this.yCenter),a.lineTo(i.x,i.y),a.stroke())}a.restore()}}drawBorder(){}drawLabels(){let t,e;let i=this.ctx,a=this.options,r=a.ticks;if(!r.display)return;let n=this.getIndexAngle(0);i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(n),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((n,o)=>{if(0===o&&!a.reverse)return;let l=r.setContext(this.getContext(o)),h=(0,s.O)(l.font);if(t=this.getDistanceFromCenterForValue(this.ticks[o].value),l.showLabelBackdrop){i.font=h.string,e=i.measureText(n.label).width,i.fillStyle=l.backdropColor;let a=(0,s.K)(l.backdropPadding);i.fillRect(-e/2-a.left,-t-h.size/2-a.top,e+a.width,h.size+a.height)}(0,s.M)(i,n.label,0,-t,h,{color:l.color})}),i.restore()}drawTitle(){}};RadialLinearScale.id="radialLinear",RadialLinearScale.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:h.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}},RadialLinearScale.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},RadialLinearScale.descriptors={angleLines:{_fallback:"grid"}};let T={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},O=Object.keys(T);function sorter(t,e){return t-e}function parse(t,e){if((0,s.k)(e))return null;let i=t._adapter,{parser:a,round:r,isoWeekday:n}=t._parseOpts,o=e;return("function"==typeof a&&(o=a(o)),(0,s.g)(o)||(o="string"==typeof a?i.parse(o,a):i.parse(o)),null===o)?null:(r&&(o="week"===r&&((0,s.x)(n)||!0===n)?i.startOf(o,"isoWeek",n):i.startOf(o,r)),+o)}function determineUnitForAutoTicks(t,e,i,s){let a=O.length;for(let r=O.indexOf(t);r=e?i[a]:i[r];t[n]=!0}}else t[e]=!0}function ticksFromTimestamps(t,e,i){let s,a;let r=[],n={},o=e.length;for(s=0;s=0&&(e[r].major=!0);return e}(t,r,n,i):r}let TimeScale=class TimeScale extends Scale{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){let i=t.time||(t.time={}),a=this._adapter=new u._date(t.adapters.date);a.init(e),(0,s.ac)(i.displayFormats,a.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:parse(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:a,max:r,minDefined:n,maxDefined:o}=this.getUserBounds();function _applyBounds(t){n||isNaN(t.min)||(a=Math.min(a,t.min)),o||isNaN(t.max)||(r=Math.max(r,t.max))}n&&o||(_applyBounds(this._getLabelBounds()),("ticks"!==t.bounds||"labels"!==t.ticks.source)&&_applyBounds(this.getMinMax(!1))),a=(0,s.g)(a)&&!isNaN(a)?a:+e.startOf(Date.now(),i),r=(0,s.g)(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(a,r-1),this.max=Math.max(a+1,r)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,a="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&a.length&&(this.min=this._userMin||a[0],this.max=this._userMax||a[a.length-1]);let r=this.min,n=this.max,o=(0,s.aN)(a,r,n);return this._unit=e.unit||(i.autoSkip?determineUnitForAutoTicks(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):function(t,e,i,s,a){for(let r=O.length-1;r>=O.indexOf(i);r--){let i=O[r];if(T[i].common&&t._adapter.diff(a,s,i)>=e-1)return i}return O[i?O.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=O.indexOf(t)+1,i=O.length;e+t.value))}initOffsets(t){let e,i,a=0,r=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),a=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),r=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);let n=t.length<3?.5:.25;a=(0,s.E)(a,0,n),r=(0,s.E)(r,0,n),this._offsets={start:a,end:r,factor:1/(a+1+r)}}_generate(){let t,e;let i=this._adapter,a=this.min,r=this.max,n=this.options,o=n.time,l=o.unit||determineUnitForAutoTicks(o.minUnit,a,r,this._getLabelCapacity(a)),h=(0,s.v)(o.stepSize,1),d="week"===l&&o.isoWeekday,c=(0,s.x)(d)||!0===d,u={},g=a;if(c&&(g=+i.startOf(g,"isoWeek",d)),g=+i.startOf(g,c?"day":l),i.diff(r,a,l)>1e5*h)throw Error(a+" and "+r+" are too far apart with stepSize of "+h+" "+l);let p="data"===n.ticks.source&&this.getDataTimestamps();for(t=g,e=0;tt-e).map(t=>+t)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,a){let r=this.options,n=r.time.displayFormats,o=this._unit,l=this._majorUnit,h=o&&n[o],d=l&&n[l],c=i[e],u=l&&d&&c&&c.major,g=this._adapter.format(t,a||(u?d:h)),p=r.ticks.callback;return p?(0,s.C)(p,[g,e,i],this):g}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?n:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[l].pos&&e<=t[h].pos&&({lo:l,hi:h}=(0,s.Z)(t,"pos",e)),{pos:a,time:n}=t[l],{pos:r,time:o}=t[h]):(e>=t[l].time&&e<=t[h].time&&({lo:l,hi:h}=(0,s.Z)(t,"time",e)),{time:a,pos:n}=t[l],{time:r,pos:o}=t[h]);let d=r-a;return d?n+(o-n)*(e-a)/d:n}TimeScale.id="time",TimeScale.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};let TimeSeriesScale=class TimeSeriesScale extends TimeScale{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=interpolate(e,this.min),this._tableRange=interpolate(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let e,i,s;let{min:a,max:r}=this,n=[],o=[];for(e=0,i=t.length;e=a&&s<=r&&n.push(s);if(n.length<2)return[{time:a,pos:0},{time:r,pos:1}];for(e=0,i=n.length;e