@htmlbricks/hb-chartjs 0.50.0-alpha.25 → 0.50.0-alpha.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.iife.js +0 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/main.iife.js.map +0 -1
package/main.iife.js
CHANGED
|
@@ -16,4 +16,3 @@ var Uf=Object.defineProperty;var Ca=N=>{throw TypeError(N)};var Xf=(N,H,G)=>H in
|
|
|
16
16
|
*/class Rh{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,n,s){const o=e.listeners[s],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(n-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Ro.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Ft=new Rh;const hr="transparent",Fh={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=No(i||hr),s=n.valid&&No(t||hr);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class Ih{constructor(t,e,n,s){const o=e[n];s=qe([t.to,s,o,t.from]);const r=qe([t.from,o,s]);this._active=!0,this._fn=t.fn||Fh[t.type||typeof r],this._easing=je[t.easing]||je.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=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=qe([t.to,e,s,t.from]),this._from=qe([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e<n),!this._active){this._target[s]=a,this._notify(!0);return}if(e<0){this._target[s]=o;return}l=e/n%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;s<n.length;s++)n[s][e]()}}class ur{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!T(t))return;const e=Object.keys(Y.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!T(o))return;const r={};for(const a of e)r[a]=o[a];(V(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!n.has(a))&&n.set(a,r)})})}_animateOptions(t,e){const n=e.options,s=$h(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&zh(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=o[c];const d=n.get(c);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=u=new Ih(d,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return Ft.add(this._chart,n),!0}}function zh(i,t){const e=[],n=Object.keys(t);for(let s=0;s<n.length;s++){const o=i[n[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function $h(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function dr(i,t){const e=i&&i.options||{},n=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:n?o:s,end:n?s:o}}function Bh(i,t,e){if(e===!1)return!1;const n=dr(i,e),s=dr(t,e);return{top:s.end,right:n.end,bottom:s.start,left:n.start}}function Nh(i){let t,e,n,s;return T(i)?(t=i.top,e=i.right,n=i.bottom,s=i.left):t=e=n=s=i,{top:t,right:e,bottom:n,left:s,disabled:i===!1}}function fr(i,t){const e=[],n=i._getSortedDatasetMetas(t);let s,o;for(s=0,o=n.length;s<o;++s)e.push(n[s].index);return e}function gr(i,t,e,n={}){const s=i.keys,o=n.mode==="single";let r,a,l,c;if(t===null)return;let h=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===e){if(h=!0,n.all)continue;break}c=i.values[l],j(c)&&(o||t===0||Pt(t)===Pt(c))&&(t+=c)}return!h&&!n.all?0:t}function Vh(i,t){const{iScale:e,vScale:n}=t,s=e.axis==="x"?"x":"y",o=n.axis==="x"?"x":"y",r=Object.keys(i),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[s]:h,[o]:i[h]};return a}function Gn(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function Wh(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Hh(i){const{min:t,max:e,minDefined:n,maxDefined:s}=i.getUserBounds();return{min:n?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function jh(i,t,e){const n=i[t]||(i[t]={});return n[e]||(n[e]={})}function pr(i,t,e,n){for(const s of t.getMatchingVisibleMetas(n).reverse()){const o=i[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function mr(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,h=Wh(o,r,n),u=t.length;let d;for(let f=0;f<u;++f){const g=t[f],{[l]:p,[c]:m}=g,b=g._stacks||(g._stacks={});d=b[c]=jh(s,h,p),d[a]=m,d._top=pr(d,r,!0,n.type),d._bottom=pr(d,r,!1,n.type);const _=d._visualValues||(d._visualValues={});_[a]=m}}function Zn(i,t){const e=i.scales;return Object.keys(e).filter(n=>e[n].axis===t).shift()}function Yh(i,t){return Zt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Uh(i,t,e){return Zt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ke(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e],o[n]._visualValues!==void 0&&o[n]._visualValues[e]!==void 0&&delete o[n]._visualValues[e]}}}const Jn=i=>i==="reset"||i==="none",br=(i,t)=>t?i:Object.assign({},i),Xh=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:fr(e,!0),values:null};class vt{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.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Gn(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ke(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(u,d,f,g)=>u==="x"?d:u==="r"?g:f,o=e.xAxisID=D(n.xAxisID,Zn(t,"x")),r=e.yAxisID=D(n.yAxisID,Zn(t,"y")),a=e.rAxisID=D(n.rAxisID,Zn(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),h=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),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){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Eo(this._data,this),t._stacked&&Ke(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(T(e)){const s=this._cachedMeta;this._data=Vh(e,s)}else if(n!==e){if(n){Eo(n,this);const s=this._cachedMeta;Ke(s),s._parsed=[]}e&&Object.isExtensible(e)&&Ec(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=Gn(e.vScale,e),e.stack!==n.stack&&(s=!0,Ke(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&(mr(this,e._parsed),e._stacked=Gn(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:r}=n,a=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,u,d;if(this._parsing===!1)n._parsed=s,n._sorted=!0,d=s;else{V(s[t])?d=this.parseArrayData(n,s,t,e):T(s[t])?d=this.parseObjectData(n,s,t,e):d=this.parsePrimitiveData(n,s,t,e);const f=()=>u[a]===null||c&&u[a]<c[a];for(h=0;h<e;++h)n._parsed[h+t]=u=d[h],l&&(f()&&(l=!1),c=u);n._sorted=l}r&&mr(this,d)}parsePrimitiveData(t,e,n,s){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),h=o===r,u=new Array(s);let d,f,g;for(d=0,f=s;d<f;++d)g=d+n,u[d]={[a]:h||o.parse(c[g],g),[l]:r.parse(e[g],g)};return u}parseArrayData(t,e,n,s){const{xScale:o,yScale:r}=t,a=new Array(s);let l,c,h,u;for(l=0,c=s;l<c;++l)h=l+n,u=e[h],a[l]={x:o.parse(u[0],h),y:r.parse(u[1],h)};return a}parseObjectData(t,e,n,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let h,u,d,f;for(h=0,u=s;h<u;++h)d=h+n,f=e[d],c[h]={x:o.parse(qt(f,a),d),y:r.parse(qt(f,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,n){const s=this.chart,o=this._cachedMeta,r=e[t.axis],a={keys:fr(s,!0),values:e._stacks[t.axis]._visualValues};return gr(a,r,o.index,{mode:n})}updateRangeFromParsed(t,e,n,s){const o=n[e.axis];let r=o===null?NaN:o;const a=s&&n._stacks[e.axis];s&&a&&(s.values=a,r=gr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const n=this._cachedMeta,s=n._parsed,o=n._sorted&&t===n.iScale,r=s.length,a=this._getOtherScale(t),l=Xh(e,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:u}=Hh(a);let d,f;function g(){f=s[d];const p=f[a.axis];return!j(f[t.axis])||h>p||u<p}for(d=0;d<r&&!(!g()&&(this.updateRangeFromParsed(c,t,f,l),o));++d);if(o){for(d=r-1;d>=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,r;for(s=0,o=e.length;s<o;++s)r=e[s][t.axis],j(r)&&n.push(r);return n}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,n=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Nh(D(this.options.clip,Bh(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,n=this._cachedMeta,s=n.data||[],o=e.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let h;for(n.dataset&&n.dataset.draw(t,o,a,l),h=a;h<a+l;++h){const u=s[h];u.hidden||(u.active&&c?r.push(u):u.draw(t,o))}for(h=0;h<r.length;++h)r[h].draw(t,o)}getStyle(t,e){const n=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,e,n){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=Uh(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Yh(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=n,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",n){const s=e==="active",o=this._cachedDataOpts,r=t+"-"+e,a=o[r],l=this.enableOptionSharing&&Ve(n);if(a)return br(a,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),u=s?[`${t}Hover`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),h),f=Object.keys(Y.elements[t]),g=()=>this.getContext(n,s,e),p=c.resolveNamedOptions(d,f,g,u);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(br(p,l))),p}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(d,this.getContext(t,n,e))}const c=new ur(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Jn(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:r}}updateElement(t,e,n,s){Jn(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!Jn(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=n.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,n=!0){const s=this._cachedMeta,o=s.data,r=t+e;let a;const l=c=>{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),n&&this.updateElements(o,t,e,"reset")}updateElements(t,e,n,s){}_removeElements(t,e){const n=this._cachedMeta;if(this._parsing){const s=n._parsed.splice(t,e);n._stacked&&Ke(n,s)}n.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,n,s]=t;this[e](n,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}w(vt,"defaults",{}),w(vt,"datasetElementType",null),w(vt,"dataElementType",null);function qh(i,t){if(!i._cache.$bar){const e=i.getMatchingVisibleMetas(t);let n=[];for(let s=0,o=e.length;s<o;s++)n=n.concat(e[s].controller.getAllParsedValues(i));i._cache.$bar=Lo(n.sort((s,o)=>s-o))}return i._cache.$bar}function Kh(i){const t=i.iScale,e=qh(t,i.type);let n=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(Ve(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=e.length;s<o;++s)r=t.getPixelForValue(e[s]),l();for(a=void 0,s=0,o=t.ticks.length;s<o;++s)r=t.getPixelForTick(s),l();return n}function Gh(i,t,e,n){const s=e.barThickness;let o,r;return C(s)?(o=t.min*e.categoryPercentage,r=e.barPercentage):(o=s*n,r=1),{chunk:o/n,ratio:r,start:t.pixels[i]-o/2}}function Zh(i,t,e,n){const s=t.pixels,o=s[i];let r=i>0?s[i-1]:null,a=i<s.length-1?s[i+1]:null;const l=e.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);const c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:e.barPercentage,start:c}}function Jh(i,t,e,n){const s=e.parse(i[0],n),o=e.parse(i[1],n),r=Math.min(s,o),a=Math.max(s,o);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function _r(i,t,e,n){return V(i)?Jh(i,t,e,n):t[e.axis]=e.parse(i,n),t}function xr(i,t,e,n){const s=i.iScale,o=i.vScale,r=s.getLabels(),a=s===o,l=[];let c,h,u,d;for(c=e,h=e+n;c<h;++c)d=t[c],u={},u[s.axis]=a||s.parse(r[c],c),l.push(_r(d,u,o,c));return l}function Qn(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function Qh(i,t,e){return i!==0?Pt(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function tu(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.base<i.y,e="bottom",n="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:n,reverse:t,top:s,bottom:o}}function eu(i,t,e,n){let s=t.borderSkipped;const o={};if(!s){i.borderSkipped=o;return}if(s===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:a,reverse:l,top:c,bottom:h}=tu(i);s==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===n?s=c:(e._bottom||0)===n?s=h:(o[yr(h,r,a,l)]=!0,s=c)),o[yr(s,r,a,l)]=!0,i.borderSkipped=o}function yr(i,t,e,n){return n?(i=iu(i,t,e),i=vr(i,e,t)):i=vr(i,t,e),i}function iu(i,t,e){return i===t?e:i===e?t:i}function vr(i,t,e){return i==="start"?t:i==="end"?e:i}function nu(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}class Ui extends vt{parsePrimitiveData(t,e,n,s){return xr(t,e,n,s)}parseArrayData(t,e,n,s){return xr(t,e,n,s)}parseObjectData(t,e,n,s){const{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,h=r.axis==="x"?a:l,u=[];let d,f,g,p;for(d=n,f=n+s;d<f;++d)p=e[d],g={},g[o.axis]=o.parse(qt(p,c),d),u.push(_r(qt(p,h),g,r,d));return u}updateRangeFromParsed(t,e,n,s){super.updateRangeFromParsed(t,e,n,s);const o=n._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:n,vScale:s}=e,o=this.getParsed(t),r=o._custom,a=Qn(r)?"["+r.start+", "+r.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,n,s){const o=s==="reset",{index:r,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),h=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(e,s);for(let f=e;f<e+n;f++){const g=this.getParsed(f),p=o||C(g[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,h),b=(g._stacks||{})[a.axis],_={horizontal:c,base:p.base,enableBorderRadius:!b||Qn(g._custom)||r===b._top||r===b._bottom,x:c?p.head:m.center,y:c?m.center:p.head,height:c?m.size:Math.abs(p.size),width:c?Math.abs(p.size):m.size};d&&(_.options=u||this.resolveDataElementOptions(f,t[f].active?"active":s));const y=_.options||t[f].options;eu(_,y,b,r),nu(_,y,h.ratio),this.updateElement(t[f],f,_,s)}}_getStacks(t,e){const{iScale:n}=this._cachedMeta,s=n.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=n.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[n.axis],c=h=>{const u=h._parsed.find(f=>f[n.axis]===l),d=u&&u[h.vScale.axis];if(C(d)||isNaN(d))return!0};for(const h of s)if(!(e!==void 0&&c(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o<r;++o)s.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));const a=t.barThickness;return{min:a||Kh(e),pixels:s,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:n,index:s},options:{base:o,minBarLength:r}}=this,a=o||0,l=this.getParsed(t),c=l._custom,h=Qn(c);let u=l[e.axis],d=0,f=n?this.applyStack(e,l,n):u,g,p;f!==u&&(d=f-u,f=u),h&&(u=c.barStart,f=c.barEnd-c.barStart,u!==0&&Pt(u)!==Pt(c.barEnd)&&(d=0),d+=u);const m=!C(o)&&!h?o:d;let b=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(d+f):g=b,p=g-b,Math.abs(p)<r){p=Qh(p,e,a)*r,u===a&&(b-=p/2);const _=e.getPixelForDecimal(0),y=e.getPixelForDecimal(1),v=Math.min(_,y),x=Math.max(_,y);b=Math.max(Math.min(b,x),v),g=b+p,n&&!h&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(g)-e.getValueForPixel(b))}if(b===e.getPixelForValue(a)){const _=Pt(p)*e.getLineWidthForValue(a)/2;b+=_,p-=_}return{size:p,base:b,head:g,center:g+p/2}}_calculateBarIndexPixels(t,e){const n=e.scale,s=this.options,o=s.skipNull,r=D(s.maxBarThickness,1/0);let a,l;if(e.grouped){const c=o?this._getStackCount(t):e.stackCount,h=s.barThickness==="flex"?Zh(t,e,s,c):Gh(t,e,s,c),u=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);a=h.start+h.chunk*u+h.chunk/2,l=Math.min(r,h.chunk*h.ratio)}else a=n.getPixelForValue(this.getParsed(t)[n.axis],t),l=Math.min(r,e.min*e.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,n=t.data,s=n.length;let o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!n[o].hidden&&n[o].draw(this._ctx)}}w(Ui,"id","bar"),w(Ui,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),w(Ui,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class Xi extends vt{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,n,s){const o=super.parsePrimitiveData(t,e,n,s);for(let r=0;r<o.length;r++)o[r]._custom=this.resolveDataElementOptions(r+n).radius;return o}parseArrayData(t,e,n,s){const o=super.parseArrayData(t,e,n,s);for(let r=0;r<o.length;r++){const a=e[n+r];o[r]._custom=D(a[2],this.resolveDataElementOptions(r+n).radius)}return o}parseObjectData(t,e,n,s){const o=super.parseObjectData(t,e,n,s);for(let r=0;r<o.length;r++){const a=e[n+r];o[r]._custom=D(a&&a.r&&+a.r,this.resolveDataElementOptions(r+n).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),a=s.getLabelForValue(r.x),l=o.getLabelForValue(r.y),c=r._custom;return{label:n[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=r.axis,u=a.axis;for(let d=e;d<e+n;d++){const f=t[d],g=!o&&this.getParsed(d),p={},m=p[h]=o?r.getPixelForDecimal(.5):r.getPixelForValue(g[h]),b=p[u]=o?a.getBasePixel():a.getPixelForValue(g[u]);p.skip=isNaN(m)||isNaN(b),c&&(p.options=l||this.resolveDataElementOptions(d,f.active?"active":s),o&&(p.options.radius=0)),this.updateElement(f,d,p,s)}}resolveDataElementOptions(t,e){const n=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const o=s.radius;return e!=="active"&&(s.radius=0),s.radius+=D(n&&n._custom,o),s}}w(Xi,"id","bubble"),w(Xi,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),w(Xi,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function su(i,t,e){let n=1,s=1,o=0,r=0;if(t<B){const a=i,l=a+t,c=Math.cos(a),h=Math.sin(a),u=Math.cos(l),d=Math.sin(l),f=(y,v,x)=>He(y,a,l,!0)?1:Math.max(v,v*e,x,x*e),g=(y,v,x)=>He(y,a,l,!0)?-1:Math.min(v,v*e,x,x*e),p=f(0,c,u),m=f(U,h,d),b=g($,c,u),_=g($+U,h,d);n=(p-b)/2,s=(m-_)/2,o=-(p+b)/2,r=-(m+_)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:r}}class Oe extends vt{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){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(T(n[t])){const{key:l="value"}=this._parsing;o=c=>+qt(n[c],l)}let r,a;for(r=t,a=t+e;r<a;++r)s._parsed[r]=o(r)}}_getRotation(){return yt(this.options.rotation-90)}_getCircumference(){return yt(this.options.circumference)}_getRotationExtents(){let t=B,e=-B;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const s=this.chart.getDatasetMeta(n).controller,o=s._getRotation(),r=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+r)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:n}=e,s=this._cachedMeta,o=s.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(n.width,n.height)-r)/2,0),l=Math.min(bc(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:h,rotation:u}=this._getRotationExtents(),{ratioX:d,ratioY:f,offsetX:g,offsetY:p}=su(u,h,l),m=(n.width-r)/d,b=(n.height-r)/f,_=Math.max(Math.min(m,b)/2,0),y=wo(this.options.radius,_),v=Math.max(y*l,0),x=(y-v)/this._getVisibleDatasetWeightTotal();this.offsetX=g*y,this.offsetY=p*y,s.total=this.calculateTotal(),this.outerRadius=y-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const n=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/B)}updateElements(t,e,n,s){const o=s==="reset",r=this.chart,a=r.chartArea,c=r.options.animation,h=(a.left+a.right)/2,u=(a.top+a.bottom)/2,d=o&&c.animateScale,f=d?0:this.innerRadius,g=d?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,s);let b=this._getRotation(),_;for(_=0;_<e;++_)b+=this._circumference(_,o);for(_=e;_<e+n;++_){const y=this._circumference(_,o),v=t[_],x={x:h+this.offsetX,y:u+this.offsetY,startAngle:b,endAngle:b+y,circumference:y,outerRadius:g,innerRadius:f};m&&(x.options=p||this.resolveDataElementOptions(_,v.active?"active":s)),b+=y,this.updateElement(v,_,x,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let n=0,s;for(s=0;s<e.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?B*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ye(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=n.data.datasets.length;s<o;++s)if(n.isDatasetVisible(s)){r=n.getDatasetMeta(s),t=r.data,a=r.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=a.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let n=0,s=t.length;n<s;++n){const o=this.resolveDataElementOptions(n);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(e+=this._getRingWeight(n));return e}_getRingWeight(t){return Math.max(D(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}w(Oe,"id","doughnut"),w(Oe,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),w(Oe,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),w(Oe,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}});class qi extends vt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=Io(e,s,r);this._drawStart=a,this._drawCount=l,zo(e)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=ke(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",_=e+n,y=t.length;let v=e>0&&this.getParsed(e-1);for(let x=0;x<y;++x){const M=t[x],k=b?M:{};if(x<e||x>=_){k.skip=!0;continue}const S=this.getParsed(x),P=C(S[f]),O=k[d]=r.getPixelForValue(S[d],x),A=k[f]=o||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[f],x);k.skip=isNaN(O)||isNaN(A)||P,k.stop=x>0&&Math.abs(S[d]-v[d])>m,p&&(k.parsed=S,k.raw=c.data[x]),u&&(k.options=h||this.resolveDataElementOptions(x,M.active?"active":s)),b||this.updateElement(M,x,k,s),v=S}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}w(qi,"id","line"),w(qi,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),w(qi,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Ki extends vt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ye(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return Jo.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,d=c.getIndexAngle(0)-.5*$;let f=d,g;const p=360/this.countVisibleElements();for(g=0;g<e;++g)f+=this._computeAngle(g,s,p);for(g=e;g<e+n;g++){const m=t[g];let b=f,_=f+this._computeAngle(g,s,p),y=r.getDataVisibility(g)?c.getDistanceFromCenterForValue(this.getParsed(g).r):0;f=_,o&&(l.animateScale&&(y=0),l.animateRotate&&(b=_=d));const v={x:h,y:u,innerRadius:0,outerRadius:y,startAngle:b,endAngle:_,options:this.resolveDataElementOptions(g,m.active?"active":s)};this.updateElement(m,g,v,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((n,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?yt(this.resolveDataElementOptions(t,e).angle||n):0}}w(Ki,"id","polarArea"),w(Ki,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),w(Ki,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class ts extends Oe{}w(ts,"id","pie"),w(ts,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class Gi extends vt{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return Jo.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(n,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=e;a<e+n;a++){const l=t[a],c=this.resolveDataElementOptions(a,l.active?"active":s),h=o.getPointPositionForValue(a,this.getParsed(a).r),u=r?o.xCenter:h.x,d=r?o.yCenter:h.y,f={x:u,y:d,angle:h.angle,skip:isNaN(u)||isNaN(d),options:c};this.updateElement(l,a,f,s)}}}w(Gi,"id","radar"),w(Gi,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),w(Gi,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class Zi extends vt{getLabelAndValue(t){const e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),a=s.getLabelForValue(r.x),l=o.getLabelForValue(r.y);return{label:n[t]||"",value:"("+a+", "+l+")"}}update(t){const e=this._cachedMeta,{data:n=[]}=e,s=this.chart._animationsDisabled;let{start:o,count:r}=Io(e,n,s);if(this._drawStart=o,this._drawCount=r,zo(e)&&(o=0,r=n.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=e;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=n;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(n,o,r,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,s),u=this.getSharedOptions(h),d=this.includeOptions(s,u),f=r.axis,g=a.axis,{spanGaps:p,segment:m}=this.options,b=ke(p)?p:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none";let y=e>0&&this.getParsed(e-1);for(let v=e;v<e+n;++v){const x=t[v],M=this.getParsed(v),k=_?x:{},S=C(M[g]),P=k[f]=r.getPixelForValue(M[f],v),O=k[g]=o||S?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,M,l):M[g],v);k.skip=isNaN(P)||isNaN(O)||S,k.stop=v>0&&Math.abs(M[f]-y[f])>b,m&&(k.parsed=M,k.raw=c.data[v]),d&&(k.options=u||this.resolveDataElementOptions(v,x.active?"active":s)),_||this.updateElement(x,v,k,s),y=M}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}}w(Zi,"id","scatter"),w(Zi,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),w(Zi,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});function ce(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class es{constructor(t){w(this,"options");this.options=t||{}}static override(t){Object.assign(es.prototype,t)}init(){}formats(){return ce()}parse(){return ce()}format(){return ce()}add(){return ce()}diff(){return ce()}startOf(){return ce()}endOf(){return ce()}}var ou={_date:es};function ru(i,t,e,n){const{controller:s,data:o,_sorted:r}=i,a=s._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?Cc:Lt;if(n){if(s._sharedOptions){const h=o[0],u=typeof h.getRange=="function"&&h.getRange(t);if(u){const d=c(o,t,e-u),f=c(o,t,e+u);return{lo:d.lo,hi:f.hi}}}}else{const h=c(o,t,e);if(l){const{vScale:u}=s._cachedMeta,{_parsed:d}=i,f=d.slice(0,h.lo+1).reverse().findIndex(p=>!C(p[u.axis]));h.lo-=Math.max(0,f);const g=d.slice(h.hi).findIndex(p=>!C(p[u.axis]));h.hi+=Math.max(0,g)}return h}}return{lo:0,hi:o.length-1}}function Ji(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:h}=o[a],{lo:u,hi:d}=ru(o[a],t,r,s);for(let f=u;f<=d;++f){const g=h[f];g.skip||n(g,c,f)}}}function au(i){const t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(n,s){const o=t?Math.abs(n.x-s.x):0,r=e?Math.abs(n.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function is(i,t,e,n,s){const o=[];return!s&&!i.isPointInArea(t)||Ji(i,e,t,function(a,l,c){!s&&!Rt(a,i.chartArea,0)||a.inRange(t.x,t.y,n)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function lu(i,t,e,n){let s=[];function o(r,a,l){const{startAngle:c,endAngle:h}=r.getProps(["startAngle","endAngle"],n),{angle:u}=Co(r,{x:t.x,y:t.y});He(u,c,h)&&s.push({element:r,datasetIndex:a,index:l})}return Ji(i,e,t,o),s}function cu(i,t,e,n,s,o){let r=[];const a=au(e);let l=Number.POSITIVE_INFINITY;function c(h,u,d){const f=h.inRange(t.x,t.y,s);if(n&&!f)return;const g=h.getCenterPoint(s);if(!(!!o||i.isPointInArea(g))&&!f)return;const m=a(t,g);m<l?(r=[{element:h,datasetIndex:u,index:d}],l=m):m===l&&r.push({element:h,datasetIndex:u,index:d})}return Ji(i,e,t,c),r}function ns(i,t,e,n,s,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!n?lu(i,t,e,s):cu(i,t,e,n,s,o)}function wr(i,t,e,n,s){const o=[],r=e==="x"?"inXRange":"inYRange";let a=!1;return Ji(i,e,t,(l,c,h)=>{l[r]&&l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:o}var hu={modes:{index(i,t,e,n){const s=ae(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?is(i,s,o,n,r):ns(i,s,o,!1,n,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=ae(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?is(i,s,o,n,r):ns(i,s,o,!1,n,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;h<c.length;++h)a.push({element:c[h],datasetIndex:l,index:h})}return a},point(i,t,e,n){const s=ae(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return is(i,s,o,n,r)},nearest(i,t,e,n){const s=ae(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return ns(i,s,o,e.intersect,n,r)},x(i,t,e,n){const s=ae(t,i);return wr(i,s,"x",e.intersect,n)},y(i,t,e,n){const s=ae(t,i);return wr(i,s,"y",e.intersect,n)}}};const Mr=["left","top","right","bottom"];function Ge(i,t){return i.filter(e=>e.pos===t)}function kr(i,t){return i.filter(e=>Mr.indexOf(e.pos)===-1&&e.box.axis===t)}function Ze(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function uu(i){const t=[];let e,n,s,o,r,a;for(e=0,n=(i||[]).length;e<n;++e)s=i[e],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:e,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function du(i){const t={};for(const e of i){const{stack:n,pos:s,stackWeight:o}=e;if(!n||!Mr.includes(s))continue;const r=t[n]||(t[n]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function fu(i,t){const e=du(i),{vBoxMaxWidth:n,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=i.length;o<r;++o){a=i[o];const{fullSize:l}=a.box,c=e[a.stack],h=c&&a.stackWeight/c.weight;a.horizontal?(a.width=h?h*n:l&&t.availableWidth,a.height=s):(a.width=n,a.height=h?h*s:l&&t.availableHeight)}return e}function gu(i){const t=uu(i),e=Ze(t.filter(c=>c.box.fullSize),!0),n=Ze(Ge(t,"left"),!0),s=Ze(Ge(t,"right")),o=Ze(Ge(t,"top"),!0),r=Ze(Ge(t,"bottom")),a=kr(t,"x"),l=kr(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:Ge(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Sr(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function Pr(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function pu(i,t,e,n){const{pos:s,box:o}=e,r=i.maxPadding;if(!T(s)){e.size&&(i[s]-=e.size);const u=n[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,i[s]+=e.size}o.getPadding&&Pr(r,o.getPadding());const a=Math.max(0,t.outerWidth-Sr(r,i,"left","right")),l=Math.max(0,t.outerHeight-Sr(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function mu(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function bu(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return n(i?["left","right"]:["top","bottom"])}function Je(i,t,e,n){const s=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o<r;++o){a=i[o],l=a.box,l.update(a.width||t.w,a.height||t.h,bu(a.horizontal,t));const{same:u,other:d}=pu(t,e,a,n);c|=u&&s.length,h=h||d,l.fullSize||s.push(a)}return c&&Je(s,t,e,n)||h}function Qi(i,t,e,n,s){i.top=e,i.left=t,i.right=t+n,i.bottom=e+s,i.width=n,i.height=s}function Dr(i,t,e,n){const s=e.padding;let{x:o,y:r}=t;for(const a of i){const l=a.box,c=n[a.stack]||{placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){const u=t.w*h,d=c.size||l.height;Ve(c.start)&&(r=c.start),l.fullSize?Qi(l,s.left,r,e.outerWidth-s.right-s.left,d):Qi(l,t.left+c.placed,r,u,d),c.start=r,c.placed+=u,r=l.bottom}else{const u=t.h*h,d=c.size||l.width;Ve(c.start)&&(o=c.start),l.fullSize?Qi(l,o,s.top,d,e.outerHeight-s.bottom-s.top):Qi(l,o,t.top+c.placed,d,u),c.start=o,c.placed+=u,o=l.right}}t.x=o,t.y=r}var et={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){const e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,n){if(!i)return;const s=tt(i.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(e-s.height,0),a=gu(i.boxes),l=a.vertical,c=a.horizontal;L(i.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},s);Pr(d,tt(n));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),g=fu(l.concat(c),u);Je(a.fullSize,f,u,g),Je(l,f,u,g),Je(c,f,u,g)&&Je(l,f,u,g),mu(f),Dr(a.leftAndTop,f,u,g),f.x+=f.w,f.y+=f.h,Dr(a.rightAndBottom,f,u,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},L(a.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Or{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}}class _u extends Or{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const tn="$chartjs",xu={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ar=i=>i===null||i==="";function yu(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[tn]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ar(s)){const o=er(i,"width");o!==void 0&&(i.width=o)}if(Ar(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=er(i,"height");o!==void 0&&(i.height=o)}return i}const Cr=Mh?{passive:!0}:!1;function vu(i,t,e){i&&i.addEventListener(t,e,Cr)}function wu(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Cr)}function Mu(i,t){const e=xu[i.type]||i.type,{x:n,y:s}=ae(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function en(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function ku(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||en(a.addedNodes,n),r=r&&!en(a.removedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Su(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||en(a.removedNodes,n),r=r&&!en(a.addedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Qe=new Map;let Tr=0;function Er(){const i=window.devicePixelRatio;i!==Tr&&(Tr=i,Qe.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Pu(i,t){Qe.size||window.addEventListener("resize",Er),Qe.set(i,t)}function Du(i){Qe.delete(i),Qe.size||window.removeEventListener("resize",Er)}function Ou(i,t,e){const n=i.canvas,s=n&&Kn(n);if(!s)return;const o=Fo((a,l)=>{const c=s.clientWidth;e(a,l),c<s.clientWidth&&e()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(s),Pu(i,o),r}function ss(i,t,e){e&&e.disconnect(),t==="resize"&&Du(i)}function Au(i,t,e){const n=i.canvas,s=Fo(o=>{i.ctx!==null&&e(Mu(o,i))},i);return vu(n,t,s),s}class Cu extends Or{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(yu(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[tn])return!1;const n=e[tn].initial;["height","width"].forEach(o=>{const r=n[o];C(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[tn],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:ku,detach:Su,resize:Ou}[e]||Au;s[e]=r(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:ss,detach:ss,resize:ss}[e]||wu)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return wh(t,e,n,s)}isAttached(t){const e=t&&Kn(t);return!!(e&&e.isConnected)}}function Tu(i){return!qn()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?_u:Cu}let It=(mn=class{constructor(){w(this,"x");w(this,"y");w(this,"active",!1);w(this,"options");w(this,"$animations")}tooltipPosition(t){const{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return ke(this.x)&&ke(this.y)}getProps(t,e){const n=this.$animations;if(!e||!n)return this;const s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}},w(mn,"defaults",{}),w(mn,"defaultRoutes"),mn);function Eu(i,t){const e=i.options.ticks,n=Lu(i),s=Math.min(e.maxTicksLimit||n,n),o=e.major.enabled?Fu(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return Iu(t,c,o,r/s),c;const h=Ru(o,t,s);if(r>0){let u,d;const f=r>1?Math.round((l-a)/(r-1)):null;for(nn(t,c,h,C(f)?0:a-f,a),u=0,d=r-1;u<d;u++)nn(t,c,h,o[u],o[u+1]);return nn(t,c,h,l,C(f)?t.length:l+f),c}return nn(t,c,h),c}function Lu(i){const t=i.options.offset,e=i._tickSize(),n=i._length/e+(t?0:1),s=i._maxLength/e;return Math.floor(Math.min(n,s))}function Ru(i,t,e){const n=zu(i),s=t.length/e;if(!n)return Math.max(s,1);const o=Sc(n);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>s)return l}return Math.max(s,1)}function Fu(i){const t=[];let e,n;for(e=0,n=i.length;e<n;e++)i[e].major&&t.push(e);return t}function Iu(i,t,e,n){let s=0,o=e[0],r;for(n=Math.ceil(n),r=0;r<i.length;r++)r===o&&(t.push(i[r]),s++,o=e[s*n])}function nn(i,t,e,n,s){const o=D(n,0),r=Math.min(D(s,i.length),i.length);let a=0,l,c,h;for(e=Math.ceil(e),s&&(l=s-n,e=l/Math.floor(l/e)),h=o;h<0;)a++,h=Math.round(o+a*e);for(c=Math.max(o,0);c<r;c++)c===h&&(t.push(i[c]),a++,h=Math.round(o+a*e))}function zu(i){const t=i.length;let e,n;if(t<2)return!1;for(n=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==n)return!1;return n}const $u=i=>i==="left"?"right":i==="right"?"left":i,Lr=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Rr=(i,t)=>Math.min(t||i,i);function Fr(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;o<s;o+=n)e.push(i[Math.floor(o)]);return e}function Bu(i,t,e){const n=i.ticks.length,s=Math.min(t,n-1),o=i._startPixel,r=i._endPixel,a=1e-6;let l=i.getPixelForTick(s),c;if(!(e&&(n===1?c=Math.max(l-o,r-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>r+a)))return l}function Nu(i,t){L(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;o<s;++o)delete e.data[n[o]];n.splice(0,s)}})}function ti(i){return i.drawTicks?i.tickLength:0}function Ir(i,t){if(!i.display)return 0;const e=q(i.font,t),n=tt(i.padding);return(V(i.text)?i.text.length:1)*e.lineHeight+n.height}function Vu(i,t){return Zt(i,{scale:t,type:"scale"})}function Wu(i,t,e){return Zt(i,{tick:e,index:t,type:"tick"})}function Hu(i,t,e){let n=$n(i);return(e&&t!=="right"||!e&&t==="right")&&(n=$u(n)),n}function ju(i,t,e,n){const{top:s,left:o,bottom:r,right:a,chart:l}=i,{chartArea:c,scales:h}=l;let u=0,d,f,g;const p=r-s,m=a-o;if(i.isHorizontal()){if(f=Q(n,o,a),T(e)){const b=Object.keys(e)[0],_=e[b];g=h[b].getPixelForValue(_)+p-t}else e==="center"?g=(c.bottom+c.top)/2+p-t:g=Lr(i,e,t);d=a-o}else{if(T(e)){const b=Object.keys(e)[0],_=e[b];f=h[b].getPixelForValue(_)-m+t}else e==="center"?f=(c.left+c.right)/2-m+t:f=Lr(i,e,t);g=Q(n,r,s),u=e==="left"?-U:U}return{titleX:f,titleY:g,maxWidth:d,rotation:u}}class he extends It{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:n,_suggestedMax:s}=this;return t=ut(t,Number.POSITIVE_INFINITY),e=ut(e,Number.NEGATIVE_INFINITY),n=ut(n,Number.POSITIVE_INFINITY),s=ut(s,Number.NEGATIVE_INFINITY),{min:ut(t,n),max:ut(e,s),minDefined:j(t),maxDefined:j(e)}}getMinMax(t){let{min:e,max:n,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:e,max:n};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),s||(e=Math.min(e,r.min)),o||(n=Math.max(n,r.max));return e=o&&e>n?n:e,n=s&&e>n?e:n,{min:ut(e,ut(n,e)),max:ut(n,ut(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=th(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Fr(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=Eu(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,n;this.isHorizontal()?(e=this.left,n=this.right):(e=this.top,n=this.bottom,t=!t),this._startPixel=e,this._endPixel=n,this._reversePixels=t,this._length=n-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let n,s,o;for(n=0,s=t.length;n<s;n++)o=t[n],o.label=I(e.callback,[o.value,n,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,n=Rr(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation;let r=s,a,l,c;if(!this._isVisible()||!e.display||s>=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=K(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/n:f/(n-1),u+6>a&&(a=f/(n-(t.offset?.5:1)),l=this.maxHeight-ti(t.grid)-e.padding-Ir(t.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),r=Fn(Math.min(Math.asin(K((h.highest.height+6)/a,-1,1)),Math.asin(K(l/c,-1,1))-Math.asin(K(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Ir(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=ti(o)+l):(t.height=this.maxHeight,t.width=ti(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:d}=this._getLabelSizes(),f=n.padding*2,g=yt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const b=n.mirror?0:m*u.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=n.mirror?0:p*u.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(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,n,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=s*t.width,f=n*e.height):(d=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+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(){I(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e<n;e++)C(t[e].label)&&(t.splice(e,1),n--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let n=this.ticks;e<n.length&&(n=Fr(n,e)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,n){const{ctx:s,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(e/Rr(e,n));let c=0,h=0,u,d,f,g,p,m,b,_,y,v,x;for(u=0;u<e;u+=l){if(g=t[u].label,p=this._resolveTickFontOptions(u),s.font=m=p.string,b=o[m]=o[m]||{data:{},gc:[]},_=p.lineHeight,y=v=0,!C(g)&&!V(g))y=Bi(s,b.data,b.gc,y,g),v=_;else if(V(g))for(d=0,f=g.length;d<f;++d)x=g[d],!C(x)&&!V(x)&&(y=Bi(s,b.data,b.gc,y,x),v+=_);r.push(y),a.push(v),c=Math.max(y,c),h=Math.max(v,h)}Nu(o,e);const M=r.indexOf(c),k=a.indexOf(h),S=P=>({width:r[P]||0,height:a[P]||0});return{first:S(0),last:S(e-1),widest:S(M),highest:S(k),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Ac(this._alignToPixels?ne(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const n=e[t];return n.$context||(n.$context=Wu(this.getContext(),t,n))}return this.$context||(this.$context=Vu(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=yt(this.labelRotation),n=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*n>a*s?a/n:l/s:l*s<a*n?l/n:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),d=ti(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(W){return ne(n,W,p)};let _,y,v,x,M,k,S,P,O,A,E,Z;if(r==="top")_=b(this.bottom),k=this.bottom-d,P=_-m,A=b(t.top)+m,Z=t.bottom;else if(r==="bottom")_=b(this.top),A=t.top,Z=b(t.bottom)-m,k=_+m,P=this.top+d;else if(r==="left")_=b(this.right),M=this.right-d,S=_-m,O=b(t.left)+m,E=t.right;else if(r==="right")_=b(this.left),O=t.left,E=b(t.right)-m,M=_+m,S=this.left+d;else if(e==="x"){if(r==="center")_=b((t.top+t.bottom)/2+.5);else if(T(r)){const W=Object.keys(r)[0],X=r[W];_=b(this.chart.scales[W].getPixelForValue(X))}A=t.top,Z=t.bottom,k=_+m,P=k+d}else if(e==="y"){if(r==="center")_=b((t.left+t.right)/2);else if(T(r)){const W=Object.keys(r)[0],X=r[W];_=b(this.chart.scales[W].getPixelForValue(X))}M=_-m,S=M-d,O=t.left,E=t.right}const ft=D(s.ticks.maxTicksLimit,u),R=Math.max(1,Math.ceil(u/ft));for(y=0;y<u;y+=R){const W=this.getContext(y),X=o.setContext(W),wt=a.setContext(W),it=X.lineWidth,Ce=X.color,bn=wt.dash||[],Te=wt.dashOffset,ai=X.tickWidth,de=X.tickColor,li=X.tickBorderDash||[],fe=X.tickBorderDashOffset;v=Bu(this,y,l),v!==void 0&&(x=ne(n,v,it),c?M=S=O=E=x:k=P=A=Z=x,f.push({tx1:M,ty1:k,tx2:S,ty2:P,x1:O,y1:A,x2:E,y2:Z,width:it,color:Ce,borderDash:bn,borderDashOffset:Te,tickWidth:ai,tickColor:de,tickBorderDash:li,tickBorderDashOffset:fe}))}return this._ticksLength=u,this._borderValue=_,f}_computeLabelItems(t){const e=this.axis,n=this.options,{position:s,ticks:o}=n,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:h,mirror:u}=o,d=ti(n.grid),f=d+h,g=u?-h:f,p=-yt(this.labelRotation),m=[];let b,_,y,v,x,M,k,S,P,O,A,E,Z="middle";if(s==="top")M=this.bottom-g,k=this._getXAxisLabelAlignment();else if(s==="bottom")M=this.top+g,k=this._getXAxisLabelAlignment();else if(s==="left"){const R=this._getYAxisLabelAlignment(d);k=R.textAlign,x=R.x}else if(s==="right"){const R=this._getYAxisLabelAlignment(d);k=R.textAlign,x=R.x}else if(e==="x"){if(s==="center")M=(t.top+t.bottom)/2+f;else if(T(s)){const R=Object.keys(s)[0],W=s[R];M=this.chart.scales[R].getPixelForValue(W)+f}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")x=(t.left+t.right)/2-f;else if(T(s)){const R=Object.keys(s)[0],W=s[R];x=this.chart.scales[R].getPixelForValue(W)}k=this._getYAxisLabelAlignment(d).textAlign}e==="y"&&(l==="start"?Z="top":l==="end"&&(Z="bottom"));const ft=this._getLabelSizes();for(b=0,_=a.length;b<_;++b){y=a[b],v=y.label;const R=o.setContext(this.getContext(b));S=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),O=P.lineHeight,A=V(v)?v.length:1;const W=A/2,X=R.color,wt=R.textStrokeColor,it=R.textStrokeWidth;let Ce=k;r?(x=S,k==="inner"&&(b===_-1?Ce=this.options.reverse?"left":"right":b===0?Ce=this.options.reverse?"right":"left":Ce="center"),s==="top"?c==="near"||p!==0?E=-A*O+O/2:c==="center"?E=-ft.highest.height/2-W*O+O:E=-ft.highest.height+O/2:c==="near"||p!==0?E=O/2:c==="center"?E=ft.highest.height/2-W*O:E=ft.highest.height-A*O,u&&(E*=-1),p!==0&&!R.showLabelBackdrop&&(x+=O/2*Math.sin(p))):(M=S,E=(1-A)*O/2);let bn;if(R.showLabelBackdrop){const Te=tt(R.backdropPadding),ai=ft.heights[b],de=ft.widths[b];let li=E-Te.top,fe=0-Te.left;switch(Z){case"middle":li-=ai/2;break;case"bottom":li-=ai;break}switch(k){case"center":fe-=de/2;break;case"right":fe-=de;break;case"inner":b===_-1?fe-=de:b>0&&(fe-=de/2);break}bn={left:fe,top:li,width:de+Te.width,height:ai+Te.height,color:R.backdropColor}}m.push({label:v,font:P,textOffset:E,options:{rotation:p,color:X,strokeColor:wt,strokeWidth:it,textAlign:Ce,textBaseline:Z,translation:[x,M],backdrop:bn}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-yt(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:n,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return e==="left"?s?(h=this.right+o,n==="near"?c="left":n==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,n==="near"?c="right":n==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?s?(h=this.left+o,n==="near"?c="right":n==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,n==="near"?c="left":n==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:n,top:s,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,s,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,r=s.length;o<r;++o){const l=s[o];e.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:n,grid:s}}=this,o=n.setContext(this.getContext()),r=n.display?o.width:0;if(!r)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,u,d;this.isHorizontal()?(c=ne(t,this.left,r)-r/2,h=ne(t,this.right,a)+a/2,u=d=l):(u=ne(t,this.top,r)-r/2,d=ne(t,this.bottom,a)+a/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,u),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const n=this.ctx,s=this._computeLabelArea();s&&Ni(n,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,h=r.textOffset;se(n,c,0,h,l,a)}s&&Vi(n)}drawTitle(){const{ctx:t,options:{position:e,title:n,reverse:s}}=this;if(!n.display)return;const o=q(n.font),r=tt(n.padding),a=n.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||T(e)?(l+=r.bottom,V(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=r.top;const{titleX:c,titleY:h,maxWidth:u,rotation:d}=ju(this,l,e,a);se(t,n.text,0,0,o,{color:n.color,maxWidth:u,rotation:d,textAlign:Hu(a,e,s),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,n=D(t.grid&&t.grid.z,-1),s=D(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==he.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o<r;++o){const a=e[o];a[n]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return q(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class sn{constructor(t,e,n){this.type=t,this.scope=e,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let n;Xu(e)&&(n=this.register(e));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Yu(t,r,n),this.override&&Y.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const e=this.items,n=t.id,s=this.scope;n in e&&delete e[n],s&&n in Y[s]&&(delete Y[s][n],this.override&&delete ie[n])}}function Yu(i,t,e){const n=Be(Object.create(null),[e?Y.get(e):{},Y.get(t),i.defaults]);Y.set(t,n),i.defaultRoutes&&Uu(t,i.defaultRoutes),i.descriptors&&Y.describe(t,i.descriptors)}function Uu(i,t){Object.keys(t).forEach(e=>{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");Y.route(o,s,l,a)})}function Xu(i){return"id"in i&&"defaults"in i}class qu{constructor(){this.controllers=new sn(vt,"datasets",!0),this.elements=new sn(It,"elements"),this.plugins=new sn(Object,"plugins"),this.scales=new sn(he,"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,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):L(s,r=>{const a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,n){const s=Rn(t);I(n["before"+s],[],n),e[t](n),I(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const n=this._typedRegistries[e];if(n.isForType(t))return n}return this.plugins}_get(t,e,n){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return s}}var Dt=new qu;class Ku{constructor(){this._init=[]}notify(t,e,n,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,e,n);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,n,s){s=s||{};for(const o of t){const r=o.plugin,a=r[n],l=[e,s,o.options];if(I(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){C(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const n=t&&t.config,s=D(n.options&&n.options.plugins,{}),o=Gu(n);return s===!1&&!e?[]:Ju(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],n=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}}function Gu(i){const t={},e=[],n=Object.keys(Dt.plugins.items);for(let o=0;o<n.length;o++)e.push(Dt.getPlugin(n[o]));const s=i.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];e.indexOf(r)===-1&&(e.push(r),t[r.id]=!0)}return{plugins:e,localIds:t}}function Zu(i,t){return!t&&i===!1?null:i===!0?{}:i}function Ju(i,{plugins:t,localIds:e},n,s){const o=[],r=i.getContext();for(const a of t){const l=a.id,c=Zu(n[l],s);c!==null&&o.push({plugin:a,options:Qu(i.config,{plugin:a,local:e[l]},c,r)})}return o}function Qu(i,{plugin:t,local:e},n,s){const o=i.pluginScopeKeys(t),r=i.getOptionScopes(n,o);return e&&t.defaults&&r.push(t.defaults),i.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function os(i,t){const e=Y.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function td(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function ed(i,t){return i===t?"_index_":"_value_"}function zr(i){if(i==="x"||i==="y"||i==="r")return i}function id(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function rs(i,...t){if(zr(i))return i;for(const e of t){const n=e.axis||id(e.position)||i.length>1&&zr(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function $r(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function nd(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(e.length)return $r(i,"x",e[0])||$r(i,"y",e[0])}return{}}function sd(i,t){const e=ie[i.type]||{scales:{}},n=t.scales||{},s=os(i.type,t),o=Object.create(null);return Object.keys(n).forEach(r=>{const a=n[r];if(!T(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=rs(r,a,nd(r,i),Y.scales[a.type]),c=ed(l,s),h=e.scales||{};o[r]=Ne(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||os(a,t),h=(ie[a]||{}).scales||{};Object.keys(h).forEach(u=>{const d=td(u,l),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),Ne(o[f],[{axis:d},n[f],h[u]])})}),Object.keys(o).forEach(r=>{const a=o[r];Ne(a,[Y.scales[a.type],Y.scale])}),o}function Br(i){const t=i.options||(i.options={});t.plugins=D(t.plugins,{}),t.scales=sd(i,t)}function Nr(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function od(i){return i=i||{},i.data=Nr(i.data),Br(i),i}const Vr=new Map,Wr=new Set;function on(i,t){let e=Vr.get(i);return e||(e=t(),Vr.set(i,e),Wr.add(e)),e}const ei=(i,t,e)=>{const n=qt(t,e);n!==void 0&&i.add(n)};class rd{constructor(t){this._config=od(t),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=Nr(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Br(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return on(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return on(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return on(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return on(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,r=this._cachedScopes(t,n),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>ei(l,t,u))),h.forEach(u=>ei(l,s,u)),h.forEach(u=>ei(l,ie[o]||{},u)),h.forEach(u=>ei(l,Y,u)),h.forEach(u=>ei(l,Vn,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Wr.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,ie[e]||{},Y.datasets[e]||{},{type:e},Y,Vn]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Hr(this._resolverCache,t,s);let l=r;if(ld(r,e)){o.$shared=!1,n=Kt(n)?n():n;const c=this.createResolver(t,n,a);l=Se(r,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=Hr(this._resolverCache,t,n);return T(e)?Se(o,e,void 0,s):o}}function Hr(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:Yn(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}const ad=i=>T(i)&&Object.getOwnPropertyNames(i).some(t=>Kt(i[t]));function ld(i,t){const{isScriptable:e,isIndexable:n}=Uo(i);for(const s of t){const o=e(s),r=n(s),a=(r||o)&&i[s];if(o&&(Kt(a)||ad(a))||r&&V(a))return!0}return!1}var cd="4.4.8";const hd=["top","bottom","left","right","chartArea"];function jr(i,t){return i==="top"||i==="bottom"||hd.indexOf(i)===-1&&t==="x"}function Yr(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function Ur(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),I(e&&e.onComplete,[i],t)}function ud(i){const t=i.chart,e=t.options.animation;I(e&&e.onProgress,[i],t)}function Xr(i){return qn()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const rn={},qr=i=>{const t=Xr(i);return Object.values(rn).filter(e=>e.canvas===t).pop()};function dd(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const r=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=r)}}}function fd(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}function an(i,t,e){return i.options.clip?i[e]:t[e]}function gd(i,t){const{xScale:e,yScale:n}=i;return e&&n?{left:an(e,t,"left"),right:an(e,t,"right"),top:an(n,t,"top"),bottom:an(n,t,"bottom")}:t}class zt{static register(...t){Dt.add(...t),Kr()}static unregister(...t){Dt.remove(...t),Kr()}constructor(t,e){const n=this.config=new rd(e),s=Xr(t),o=qr(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Tu(s)),this.platform.updateConfig(n);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=mc(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,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 Ku,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Lc(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],rn[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ft.listen(this,"complete",Ur),Ft.listen(this,"progress",ud),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return C(t)?e&&o?o:s?n/s: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}get registry(){return Dt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():tr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ho(this.canvas,this.ctx),this}stop(){return Ft.stop(this),this}resize(t,e){Ft.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,tr(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),I(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};L(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=rs(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),L(o,r=>{const a=r.options,l=a.id,c=rs(l,a),h=D(a.type,r.dtype);(a.position===void 0||jr(a.position,c)!==jr(r.dposition))&&(a.position=r.dposition),s[l]=!0;let u=null;if(l in n&&n[l].type===h)u=n[l];else{const d=Dt.getScale(h);u=new d({id:l,type:h,ctx:this.ctx,chart:this}),n[u.id]=u}u.init(a,t)}),L(s,(r,a)=>{r||delete n[a]}),L(n,r=>{et.configure(this,r,r.options),et.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;s<n;++s)this._destroyDatasetMeta(s);t.splice(e,n-e)}this._sortedMetasets=t.slice(0).sort(Yr("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n<s;n++){const o=e[n];let r=this.getDatasetMeta(n);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(n),r=this.getDatasetMeta(n)),r.type=a,r.indexAxis=o.indexAxis||os(a,this.options),r.order=o.order||0,r.index=n,r.label=""+o.label,r.visible=this.isDatasetVisible(n),r.controller)r.controller.updateIndex(n),r.controller.linkScales();else{const l=Dt.getController(a),{datasetElementType:c,dataElementType:h}=Y.datasets[a];Object.assign(l,{dataElementType:Dt.getElement(h),datasetElementType:c&&Dt.getElement(c)}),r.controller=new l(this,n),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){L(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:u}=this.getDatasetMeta(c),d=!s&&o.indexOf(u)===-1;u.buildOrUpdateElements(d),r=Math.max(+u.getMaxOverflow(),r)}r=this._minPadding=n.layout.autoPadding?r:0,this._updateLayout(r),s||L(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Yr("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){L(this.scales,t=>{et.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!So(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const r=n==="_removeElements"?-o:o;dd(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=n(0);for(let o=1;o<e;o++)if(!So(s,n(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;et.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],L(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e<n;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,n=this.data.datasets.length;e<n;++e)this._updateDataset(e,Kt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const n=this.getDatasetMeta(t),s={meta:n,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(n.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Ft.has(this)?this.attached&&!Ft.running(this)&&Ft.start(this):(this.draw(),Ur({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:n,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,n=[];let s,o;for(s=0,o=e.length;s<o;++s){const r=e[s];(!t||r.visible)&&n.push(r)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=gd(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Ni(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&Vi(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Rt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=hu.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._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},n.push(s)),s}getContext(){return this.$context||(this.$context=Zt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Ve(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Ft.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ho(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete rn[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,n=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};L(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){L(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},L(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],n=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Ri(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=n?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,n,r),l=wc(t),c=fd(t,this._lastEvent,n,l);n&&(this._lastEvent=null,I(o.onHover,[t,a,this],this),l&&I(o.onClick,[t,a,this],this));const h=!Ri(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}w(zt,"defaults",Y),w(zt,"instances",rn),w(zt,"overrides",ie),w(zt,"registry",Dt),w(zt,"version",cd),w(zt,"getChart",qr);function Kr(){return L(zt.instances,i=>i._plugins.invalidate())}function pd(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;i.beginPath(),i.arc(o,r,a,n-c,e+c),l>s?(c=s/l,i.arc(o,r,l,e+c,n-c,!0)):i.arc(o,r,s,e+U,n-U),i.closePath(),i.clip()}function md(i){return jn(i,["outerStart","outerEnd","innerStart","innerEnd"])}function bd(i,t,e,n){const s=md(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,n*t/2),a=l=>{const c=(e-Math.min(o,l))*n/2;return K(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:K(s.innerStart,0,r),innerEnd:K(s.innerEnd,0,r)}}function Ae(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function ln(i,t,e,n,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+n+e-c,0),d=h>0?h+n+e+c:0;let f=0;const g=s-l;if(n){const R=h>0?h-n:0,W=u>0?u-n:0,X=(R+W)/2,wt=X!==0?g*X/(X+n):g;f=(g-wt)/2}const p=Math.max(.001,g*u-e/$)/u,m=(g-p)/2,b=l+m+f,_=s-m-f,{outerStart:y,outerEnd:v,innerStart:x,innerEnd:M}=bd(t,d,u,_-b),k=u-y,S=u-v,P=b+y/k,O=_-v/S,A=d+x,E=d+M,Z=b+x/A,ft=_-M/E;if(i.beginPath(),o){const R=(P+O)/2;if(i.arc(r,a,u,P,R),i.arc(r,a,u,R,O),v>0){const it=Ae(S,O,r,a);i.arc(it.x,it.y,v,O,_+U)}const W=Ae(E,_,r,a);if(i.lineTo(W.x,W.y),M>0){const it=Ae(E,ft,r,a);i.arc(it.x,it.y,M,_+U,ft+Math.PI)}const X=(_-M/d+(b+x/d))/2;if(i.arc(r,a,d,_-M/d,X,!0),i.arc(r,a,d,X,b+x/d,!0),x>0){const it=Ae(A,Z,r,a);i.arc(it.x,it.y,x,Z+Math.PI,b-U)}const wt=Ae(k,b,r,a);if(i.lineTo(wt.x,wt.y),y>0){const it=Ae(k,P,r,a);i.arc(it.x,it.y,y,b-U,P)}}else{i.moveTo(r,a);const R=Math.cos(P)*u+r,W=Math.sin(P)*u+a;i.lineTo(R,W);const X=Math.cos(O)*u+r,wt=Math.sin(O)*u+a;i.lineTo(X,wt)}i.closePath()}function _d(i,t,e,n,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){ln(i,t,e,n,l,s);for(let c=0;c<o;++c)i.fill();isNaN(a)||(l=r+(a%B||B))}return ln(i,t,e,n,l,s),i.fill(),l}function xd(i,t,e,n,s){const{fullCircles:o,startAngle:r,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:u,borderDashOffset:d}=l,f=l.borderAlign==="inner";if(!c)return;i.setLineDash(u||[]),i.lineDashOffset=d,f?(i.lineWidth=c*2,i.lineJoin=h||"round"):(i.lineWidth=c,i.lineJoin=h||"bevel");let g=t.endAngle;if(o){ln(i,t,e,n,g,s);for(let p=0;p<o;++p)i.stroke();isNaN(a)||(g=r+(a%B||B))}f&&pd(i,t,g),o||(ln(i,t,e,n,g,s),i.stroke())}class ii extends It{constructor(e){super();w(this,"circumference");w(this,"endAngle");w(this,"fullCircles");w(this,"innerRadius");w(this,"outerRadius");w(this,"pixelMargin");w(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,n,s){const o=this.getProps(["x","y"],s),{angle:r,distance:a}=Co(o,{x:e,y:n}),{startAngle:l,endAngle:c,innerRadius:h,outerRadius:u,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),f=(this.options.spacing+this.options.borderWidth)/2,g=D(d,c-l),p=He(r,l,c)&&l!==c,m=g>=B||p,b=Et(a,h+f,u+f);return m&&b}getCenterPoint(e){const{x:n,y:s,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,u=(o+r)/2,d=(a+l+h+c)/2;return{x:n+Math.cos(u)*d,y:s+Math.sin(u)*d}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:n,circumference:s}=this,o=(n.offset||0)/4,r=(n.spacing||0)/2,a=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=s>B?Math.floor(s/B):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min($,s||0)),h=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,_d(e,this,h,r,a),xd(e,this,h,r,a),e.restore()}}w(ii,"id","arc"),w(ii,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),w(ii,"defaultRoutes",{backgroundColor:"backgroundColor"}),w(ii,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function Gr(i,t,e=t){i.lineCap=D(e.borderCapStyle,t.borderCapStyle),i.setLineDash(D(e.borderDash,t.borderDash)),i.lineDashOffset=D(e.borderDashOffset,t.borderDashOffset),i.lineJoin=D(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=D(e.borderWidth,t.borderWidth),i.strokeStyle=D(e.borderColor,t.borderColor)}function yd(i,t,e){i.lineTo(e.x,e.y)}function vd(i){return i.stepped?Yc:i.tension||i.cubicInterpolationMode==="monotone"?Uc:yd}function Zr(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),h=s<r&&o<r||s>a&&o>a;return{count:n,start:l,loop:t.loop,ilen:c<l&&!h?n+c-l:c-l}}function wd(i,t,e,n){const{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=Zr(s,e,n),h=vd(o);let{move:u=!0,reverse:d}=n||{},f,g,p;for(f=0;f<=c;++f)g=s[(a+(d?c-f:f))%r],!g.skip&&(u?(i.moveTo(g.x,g.y),u=!1):h(i,p,g,d,o.stepped),p=g);return l&&(g=s[(a+(d?c:0))%r],h(i,p,g,d,o.stepped)),!!l}function Md(i,t,e,n){const s=t.points,{count:o,start:r,ilen:a}=Zr(s,e,n),{move:l=!0,reverse:c}=n||{};let h=0,u=0,d,f,g,p,m,b;const _=v=>(r+(c?a-v:v))%o,y=()=>{p!==m&&(i.lineTo(h,m),i.lineTo(h,p),i.lineTo(h,b))};for(l&&(f=s[_(0)],i.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[_(d)],f.skip)continue;const v=f.x,x=f.y,M=v|0;M===g?(x<p?p=x:x>m&&(m=x),h=(u*h+v)/++u):(y(),i.lineTo(v,x),g=M,u=0,p=m=x),b=x}y()}function as(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Md:wd}function kd(i){return i.stepped?kh:i.tension||i.cubicInterpolationMode==="monotone"?Sh:le}function Sd(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),Gr(i,t.options),i.stroke(s)}function Pd(i,t,e,n){const{segments:s,options:o}=t,r=as(t);for(const a of s)Gr(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const Dd=typeof Path2D=="function";function Od(i,t,e,n){Dd&&!t.options.segment?Sd(i,t,e,n):Pd(i,t,e,n)}class Jt extends It{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){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;mh(this._points,n,t,s,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=Th(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,r=ar(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=kd(n);let c,h;for(c=0,h=r.length;c<h;++c){const{start:u,end:d}=r[c],f=o[u],g=o[d];if(f===g){a.push(f);continue}const p=Math.abs((s-f[e])/(g[e]-f[e])),m=l(f,g,p,n.stepped);m[e]=t[e],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,e,n){return as(this)(t,this,e,n)}path(t,e,n){const s=this.segments,o=as(this);let r=this._loop;e=e||0,n=n||this.points.length-e;for(const a of s)r&=o(t,this,a,{start:e,end:e+n-1});return!!r}draw(t,e,n,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Od(t,this,n,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}w(Jt,"id","line"),w(Jt,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),w(Jt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),w(Jt,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function Jr(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)<s.radius+s.hitRadius}class cn extends It{constructor(e){super();w(this,"parsed");w(this,"skip");w(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,n,s){const o=this.options,{x:r,y:a}=this.getProps(["x","y"],s);return Math.pow(e-r,2)+Math.pow(n-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,n){return Jr(this,e,"x",n)}inYRange(e,n){return Jr(this,e,"y",n)}getCenterPoint(e){const{x:n,y:s}=this.getProps(["x","y"],e);return{x:n,y:s}}size(e){e=e||this.options||{};let n=e.radius||0;n=Math.max(n,n&&e.hoverRadius||0);const s=n&&e.borderWidth||0;return(n+s)*2}draw(e,n){const s=this.options;this.skip||s.radius<.1||!Rt(this,n,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Hn(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}w(cn,"id","point"),w(cn,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),w(cn,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Qr(i,t){const{x:e,y:n,base:s,width:o,height:r}=i.getProps(["x","y","base","width","height"],t);let a,l,c,h,u;return i.horizontal?(u=r/2,a=Math.min(e,s),l=Math.max(e,s),c=n-u,h=n+u):(u=o/2,a=e-u,l=e+u,c=Math.min(n,s),h=Math.max(n,s)),{left:a,top:c,right:l,bottom:h}}function Qt(i,t,e,n){return i?0:K(t,e,n)}function Ad(i,t,e){const n=i.options.borderWidth,s=i.borderSkipped,o=Yo(n);return{t:Qt(s.top,o.top,0,e),r:Qt(s.right,o.right,0,t),b:Qt(s.bottom,o.bottom,0,e),l:Qt(s.left,o.left,0,t)}}function Cd(i,t,e){const{enableBorderRadius:n}=i.getProps(["enableBorderRadius"]),s=i.options.borderRadius,o=oe(s),r=Math.min(t,e),a=i.borderSkipped,l=n||T(s);return{topLeft:Qt(!l||a.top||a.left,o.topLeft,0,r),topRight:Qt(!l||a.top||a.right,o.topRight,0,r),bottomLeft:Qt(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:Qt(!l||a.bottom||a.right,o.bottomRight,0,r)}}function Td(i){const t=Qr(i),e=t.right-t.left,n=t.bottom-t.top,s=Ad(i,e/2,n/2),o=Cd(i,e/2,n/2);return{outer:{x:t.left,y:t.top,w:e,h:n,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:n-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function ls(i,t,e,n){const s=t===null,o=e===null,a=i&&!(s&&o)&&Qr(i,n);return a&&(s||Et(t,a.left,a.right))&&(o||Et(e,a.top,a.bottom))}function Ed(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function Ld(i,t){i.rect(t.x,t.y,t.w,t.h)}function cs(i,t,e={}){const n=i.x!==e.x?-t:0,s=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-n,r=(i.y+i.h!==e.y+e.h?t:0)-s;return{x:i.x+n,y:i.y+s,w:i.w+o,h:i.h+r,radius:i.radius}}class hn extends It{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:n,backgroundColor:s}}=this,{inner:o,outer:r}=Td(this),a=Ed(r.radius)?Xe:Ld;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,cs(r,e,o)),t.clip(),a(t,cs(o,-e,r)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),a(t,cs(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,n){return ls(this,t,e,n)}inXRange(t,e){return ls(this,t,null,e)}inYRange(t,e){return ls(this,null,t,e)}getCenterPoint(t){const{x:e,y:n,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?n:(n+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}w(hn,"id","bar"),w(hn,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),w(hn,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Rd(i,t,e,n,s){const o=s.samples||n;if(o>=e)return i.slice(t,t+e);const r=[],a=(e-2)/(o-2);let l=0;const c=t+e-1;let h=t,u,d,f,g,p;for(r[l++]=i[h],u=0;u<o-2;u++){let m=0,b=0,_;const y=Math.floor((u+1)*a)+1+t,v=Math.min(Math.floor((u+2)*a)+1,e)+t,x=v-y;for(_=y;_<v;_++)m+=i[_].x,b+=i[_].y;m/=x,b/=x;const M=Math.floor(u*a)+1+t,k=Math.min(Math.floor((u+1)*a)+1,e)+t,{x:S,y:P}=i[h];for(f=g=-1,_=M;_<k;_++)g=.5*Math.abs((S-m)*(i[_].y-P)-(S-i[_].x)*(b-P)),g>f&&(f=g,d=i[_],p=_);r[l++]=d,h=p}return r[l++]=i[c],r}function Fd(i,t,e,n){let s=0,o=0,r,a,l,c,h,u,d,f,g,p;const m=[],b=t+e-1,_=i[t].x,v=i[b].x-_;for(r=t;r<t+e;++r){a=i[r],l=(a.x-_)/v*n,c=a.y;const x=l|0;if(x===h)c<g?(g=c,u=r):c>p&&(p=c,d=r),s=(o*s+a.x)/++o;else{const M=r-1;if(!C(u)&&!C(d)){const k=Math.min(u,d),S=Math.max(u,d);k!==f&&k!==M&&m.push({...i[k],x:s}),S!==f&&S!==M&&m.push({...i[S],x:s})}r>0&&M!==f&&m.push(i[M]),m.push(a),h=x,o=0,g=p=c,u=d=f=r}}return m}function ta(i){if(i._decimated){const t=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function ea(i){i.data.datasets.forEach(t=>{ta(t)})}function Id(i,t){const e=t.length;let n=0,s;const{iScale:o}=i,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(n=K(Lt(t,o.axis,r).lo,0,e-1)),c?s=K(Lt(t,o.axis,a).hi+1,n,e)-n:s=e-n,{start:n,count:s}}var zd={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,e)=>{if(!e.enabled){ea(i);return}const n=i.width;i.data.datasets.forEach((s,o)=>{const{_data:r,indexAxis:a}=s,l=i.getDatasetMeta(o),c=r||s.data;if(qe([a,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=i.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||i.options.parsing)return;let{start:u,count:d}=Id(l,c);const f=e.threshold||4*n;if(d<=f){ta(s);return}C(r)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=Rd(c,u,d,n,e);break;case"min-max":g=Fd(c,u,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(i){ea(i)}};function $d(i,t,e){const n=i.segments,s=i.points,o=t.points,r=[];for(const a of n){let{start:l,end:c}=a;c=us(l,c,s);const h=hs(e,s[l],s[c],a.loop);if(!t.segments){r.push({source:a,target:h,start:s[l],end:s[c]});continue}const u=ar(t,h);for(const d of u){const f=hs(e,o[d.start],o[d.end],d.loop),g=rr(a,s,f);for(const p of g)r.push({source:p,target:d,start:{[e]:ia(h,f,"start",Math.max)},end:{[e]:ia(h,f,"end",Math.min)}})}}return r}function hs(i,t,e,n){if(n)return;let s=t[i],o=e[i];return i==="angle"&&(s=dt(s),o=dt(o)),{property:i,start:s,end:o}}function Bd(i,t){const{x:e=null,y:n=null}=i||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=us(r,a,s);const l=s[r],c=s[a];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function us(i,t,e){for(;t>i;t--){const n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function ia(i,t,e,n){return i&&t?n(i[e],t[e]):i?i[e]:t?t[e]:0}function na(i,t){let e=[],n=!1;return V(i)?(n=!0,e=i):e=Bd(i,t),e.length?new Jt({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function sa(i){return i&&i.fill!==!1}function Nd(i,t,e){let s=i[t].fill;const o=[t];let r;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!j(s))return s;if(r=i[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function Vd(i,t,e){const n=Yd(i);if(T(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return j(s)&&Math.floor(s)===s?Wd(n[0],t,s,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function Wd(i,t,e,n){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function Hd(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:T(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function jd(i,t,e){let n;return i==="start"?n=e:i==="end"?n=t.options.reverse?t.min:t.max:T(i)?n=i.value:n=t.getBaseValue(),n}function Yd(i){const t=i.options,e=t.fill;let n=D(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function Ud(i){const{scale:t,index:e,line:n}=i,s=[],o=n.segments,r=n.points,a=Xd(t,e);a.push(na({x:null,y:t.bottom},n));for(let l=0;l<o.length;l++){const c=o[l];for(let h=c.start;h<=c.end;h++)qd(s,r[h],a)}return new Jt({points:s,options:{}})}function Xd(i,t){const e=[],n=i.getMatchingVisibleMetas("line");for(let s=0;s<n.length;s++){const o=n[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function qd(i,t,e){const n=[];for(let s=0;s<e.length;s++){const o=e[s],{first:r,last:a,point:l}=Kd(o,t,"x");if(!(!l||r&&a)){if(r)n.unshift(l);else if(i.push(l),!a)break}}i.push(...n)}function Kd(i,t,e){const n=i.interpolate(t,e);if(!n)return{};const s=n[e],o=i.segments,r=i.points;let a=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],u=r[h.start][e],d=r[h.end][e];if(Et(s,u,d)){a=s===u,l=s===d;break}}return{first:a,last:l,point:n}}class oa{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,n){const{x:s,y:o,radius:r}=this;return e=e||{start:0,end:B},t.arc(s,o,r,e.end,e.start,!0),!n.bounds}interpolate(t){const{x:e,y:n,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:n+Math.sin(o)*s,angle:o}}}function Gd(i){const{chart:t,fill:e,line:n}=i;if(j(e))return Zd(t,e);if(e==="stack")return Ud(i);if(e==="shape")return!0;const s=Jd(i);return s instanceof oa?s:na(s,n)}function Zd(i,t){const e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function Jd(i){return(i.scale||{}).getPointPositionForValue?tf(i):Qd(i)}function Qd(i){const{scale:t={},fill:e}=i,n=Hd(e,t);if(j(n)){const s=t.isHorizontal();return{x:s?n:null,y:s?null:n}}return null}function tf(i){const{scale:t,fill:e}=i,n=t.options,s=t.getLabels().length,o=n.reverse?t.max:t.min,r=jd(e,t,o),a=[];if(n.grid.circular){const l=t.getPointPositionForValue(0,o);return new oa({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(r)})}for(let l=0;l<s;++l)a.push(t.getPointPositionForValue(l,r));return a}function ds(i,t,e){const n=Gd(t),{line:s,scale:o,axis:r}=t,a=s.options,l=a.fill,c=a.backgroundColor,{above:h=c,below:u=c}=l||{};n&&s.points.length&&(Ni(i,e),ef(i,{line:s,target:n,above:h,below:u,area:e,scale:o,axis:r}),Vi(i))}function ef(i,t){const{line:e,target:n,above:s,below:o,area:r,scale:a}=t,l=e._loop?"angle":t.axis;i.save(),l==="x"&&o!==s&&(ra(i,n,r.top),aa(i,{line:e,target:n,color:s,scale:a,property:l}),i.restore(),i.save(),ra(i,n,r.bottom)),aa(i,{line:e,target:n,color:o,scale:a,property:l}),i.restore()}function ra(i,t,e){const{segments:n,points:s}=t;let o=!0,r=!1;i.beginPath();for(const a of n){const{start:l,end:c}=a,h=s[l],u=s[us(l,c,s)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(h.x,e),i.lineTo(h.x,h.y)),r=!!t.pathSegment(i,a,{move:r}),r?i.closePath():i.lineTo(u.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function aa(i,t){const{line:e,target:n,property:s,color:o,scale:r}=t,a=$d(e,n,s);for(const{source:l,target:c,start:h,end:u}of a){const{style:{backgroundColor:d=o}={}}=l,f=n!==!0;i.save(),i.fillStyle=d,nf(i,r,f&&hs(s,h,u)),i.beginPath();const g=!!e.pathSegment(i,l);let p;if(f){g?i.closePath():la(i,n,u,s);const m=!!n.pathSegment(i,c,{move:g,reverse:!0});p=g&&m,p||la(i,n,h,s)}i.closePath(),i.fill(p?"evenodd":"nonzero"),i.restore()}}function nf(i,t,e){const{top:n,bottom:s}=t.chart.chartArea,{property:o,start:r,end:a}=e||{};o==="x"&&(i.beginPath(),i.rect(r,n,a-r,s-n),i.clip())}function la(i,t,e,n){const s=t.interpolate(e,n);s&&i.lineTo(s.x,s.y)}var sf={id:"filler",afterDatasetsUpdate(i,t,e){const n=(i.data.datasets||[]).length,s=[];let o,r,a,l;for(r=0;r<n;++r)o=i.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof Jt&&(l={visible:i.isDatasetVisible(r),index:r,fill:Vd(a,r,n),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,s.push(l);for(r=0;r<n;++r)l=s[r],!(!l||l.fill===!1)&&(l.fill=Nd(s,r,e.propagate))},beforeDraw(i,t,e){const n=e.drawTime==="beforeDraw",s=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let r=s.length-1;r>=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),n&&a.fill&&ds(i.ctx,a,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){const o=n[s].$filler;sa(o)&&ds(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const n=t.meta.$filler;!sa(n)||e.drawTime!=="beforeDatasetDraw"||ds(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ca=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},of=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class ha extends It{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,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=I(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const n=t.labels,s=q(n.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=ca(n,o);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-h;return this.legendItems.forEach((g,p)=>{const m=n+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(u+=h,c[c.length-(p>0?0:1)]=0,f+=h,d++),l[p]={left:0,top:f,row:d,width:m,height:s},c[c.length-1]+=m+a}),u}_fitCols(t,e,n,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let u=a,d=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:_,itemHeight:y}=rf(n,e,o,m,s);b>0&&f+y+2*a>h&&(u+=d+a,c.push({width:d,height:f}),g+=d+a,p++,d=f=0),l[b]={left:g,top:f,col:p,width:_,height:y},d=Math.max(d,_),f+=y+a}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:o}}=this,r=De(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Q(n,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=Q(n,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=Q(n,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=Q(n,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ni(t,this),this._draw(),Vi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:o,labels:r}=t,a=Y.color,l=De(t.rtl,this.left,this.width),c=q(r.font),{padding:h}=r,u=c.size,d=u/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=ca(r,u),b=function(M,k,S){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const P=D(S.lineWidth,1);if(s.fillStyle=D(S.fillStyle,a),s.lineCap=D(S.lineCap,"butt"),s.lineDashOffset=D(S.lineDashOffset,0),s.lineJoin=D(S.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=D(S.strokeStyle,a),s.setLineDash(D(S.lineDash,[])),r.usePointStyle){const O={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:P},A=l.xPlus(M,g/2),E=k+d;jo(s,O,A,E,r.pointStyleWidth&&g)}else{const O=k+Math.max((u-p)/2,0),A=l.leftForLtr(M,g),E=oe(S.borderRadius);s.beginPath(),Object.values(E).some(Z=>Z!==0)?Xe(s,{x:A,y:O,w:g,h:p,radius:E}):s.rect(A,O,g,p),s.fill(),P!==0&&s.stroke()}s.restore()},_=function(M,k,S){se(s,S.text,M,k+m/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},y=this.isHorizontal(),v=this._computeTitleHeight();y?f={x:Q(o,this.left+h,this.right-n[0]),y:this.top+h+v,line:0}:f={x:this.left+h,y:Q(o,this.top+v+h,this.bottom-e[0].height),line:0},ir(this.ctx,t.textDirection);const x=m+h;this.legendItems.forEach((M,k)=>{s.strokeStyle=M.fontColor,s.fillStyle=M.fontColor;const S=s.measureText(M.text).width,P=l.textAlign(M.textAlign||(M.textAlign=r.textAlign)),O=g+d+S;let A=f.x,E=f.y;l.setWidth(this.width),y?k>0&&A+O+h>this.right&&(E=f.y+=x,f.line++,A=f.x=Q(o,this.left+h,this.right-n[f.line])):k>0&&E+x>this.bottom&&(A=f.x=A+e[f.line].width+h,f.line++,E=f.y=Q(o,this.top+v+h,this.bottom-e[f.line].height));const Z=l.x(A);if(b(Z,E,M),A=Rc(P,A+g+d,y?A+O:this.right,t.rtl),_(l.x(A),E,M),y)f.x+=O+h;else if(typeof M.text!="string"){const ft=c.lineHeight;f.y+=ua(M,ft)+h}else f.y+=x}),nr(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,n=q(e.font),s=tt(e.padding);if(!e.display)return;const o=De(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=n.size/2,c=s.top+l;let h,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+c,u=Q(t.align,u,this.right-d);else{const g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);h=c+Q(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=Q(a,u,u+d);r.textAlign=o.textAlign($n(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=n.string,se(r,e.text,f,h,n)}_computeTitleHeight(){const t=this.options.title,e=q(t.font),n=tt(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,o;if(Et(t,this.left,this.right)&&Et(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(s=o[n],Et(t,s.left,s.left+s.width)&&Et(e,s.top,s.top+s.height))return this.legendItems[n]}return null}handleEvent(t){const e=this.options;if(!cf(t.type,e))return;const n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=of(s,n);s&&!o&&I(e.onLeave,[t,s,this],this),this._hoveredItem=n,n&&!o&&I(e.onHover,[t,n,this],this)}else n&&I(e.onClick,[t,n,this],this)}}function rf(i,t,e,n,s){const o=af(n,i,t,e),r=lf(s,n,t.lineHeight);return{itemWidth:o,itemHeight:r}}function af(i,t,e,n){let s=i.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+e.size/2+n.measureText(s).width}function lf(i,t,e){let n=i;return typeof t.text!="string"&&(n=ua(t,e)),n}function ua(i,t){const e=i.text?i.text.length:0;return t*e}function cf(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var hf={id:"legend",_element:ha,start(i,t,e){const n=i.legend=new ha({ctx:i.ctx,options:e,chart:i});et.configure(i,n,e),et.addBox(i,n)},stop(i){et.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const n=i.legend;et.configure(i,n,e),n.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=tt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class fs extends It{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=V(n.text)?n.text.length:1;this._padding=tt(n.padding);const o=s*q(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:n,bottom:s,right:o,options:r}=this,a=r.align;let l=0,c,h,u;return this.isHorizontal()?(h=Q(a,n,o),u=e+t,c=o-n):(r.position==="left"?(h=n+t,u=Q(a,s,e),l=$*-.5):(h=o-t,u=Q(a,e,s),l=$*.5),c=s-e),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const n=q(e.font),o=n.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);se(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:$n(e.align),textBaseline:"middle",translation:[r,a]})}}function uf(i,t){const e=new fs({ctx:i.ctx,options:t,chart:i});et.configure(i,e,t),et.addBox(i,e),i.titleBlock=e}var df={id:"title",_element:fs,start(i,t,e){uf(i,e)},stop(i){const t=i.titleBlock;et.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const n=i.titleBlock;et.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const un=new WeakMap;var ff={id:"subtitle",start(i,t,e){const n=new fs({ctx:i.ctx,options:e,chart:i});et.configure(i,n,e),et.addBox(i,n),un.set(i,n)},stop(i){et.removeBox(i,un.get(i)),un.delete(i)},beforeUpdate(i,t,e){const n=un.get(i);et.configure(i,n,e),n.options=e},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}};const ni={average(i){if(!i.length)return!1;let t,e,n=new Set,s=0,o=0;for(t=0,e=i.length;t<e;++t){const a=i[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();n.add(l.x),s+=l.y,++o}}return o===0||n.size===0?!1:{x:[...n].reduce((a,l)=>a+l)/n.size,y:s/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,n=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o<r;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=In(t,c);h<s&&(s=h,a=l)}}if(a){const l=a.tooltipPosition();e=l.x,n=l.y}return{x:e,y:n}}};function Ot(i,t){return t&&(V(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function $t(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
|
|
17
17
|
`)>-1?i.split(`
|
|
18
18
|
`):i}function gf(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:i,label:r,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function da(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=q(t.bodyFont),c=q(t.titleFont),h=q(t.footerFont),u=o.length,d=s.length,f=n.length,g=tt(t.padding);let p=g.height,m=0,b=n.reduce((v,x)=>v+x.before.length+x.lines.length+x.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){const v=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*v+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let _=0;const y=function(v){m=Math.max(m,e.measureText(v).width+_)};return e.save(),e.font=c.string,L(i.title,y),e.font=l.string,L(i.beforeBody.concat(i.afterBody),y),_=t.displayColors?r+2+t.boxPadding:0,L(n,v=>{L(v.before,y),L(v.lines,y),L(v.after,y)}),_=0,e.font=h.string,L(i.footer,y),e.restore(),m+=g.width,{width:m,height:p}}function pf(i,t){const{y:e,height:n}=t;return e<n/2?"top":e>i.height-n/2?"bottom":"center"}function mf(i,t,e,n){const{x:s,width:o}=n,r=e.caretSize+e.caretPadding;if(i==="left"&&s+o+r>t.width||i==="right"&&s-o-r<0)return!0}function bf(i,t,e,n){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),mf(c,i,t,e)&&(c="center"),c}function fa(i,t,e){const n=e.yAlign||t.yAlign||pf(i,e);return{xAlign:e.xAlign||t.xAlign||bf(i,t,e,n),yAlign:n}}function _f(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function xf(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function ga(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=oe(r);let g=_f(t,a);const p=xf(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,d)+s:a==="right"&&(g+=Math.max(u,f)+s),{x:K(g,0,n.width-t.width),y:K(p,0,n.height-t.height)}}function dn(i,t,e){const n=tt(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function pa(i){return Ot([],$t(i))}function yf(i,t,e){return Zt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function ma(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const ba={beforeTitle:Tt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return e[t.dataIndex]}return""},afterTitle:Tt,beforeBody:Tt,beforeLabel:Tt,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return C(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Tt,afterBody:Tt,beforeFooter:Tt,footer:Tt,afterFooter:Tt};function rt(i,t,e,n){const s=i[t].call(e,n);return typeof s>"u"?ba[t].call(e,n):s}class gs extends It{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,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(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new ur(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=yf(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=rt(n,"beforeTitle",this,t),o=rt(n,"title",this,t),r=rt(n,"afterTitle",this,t);let a=[];return a=Ot(a,$t(s)),a=Ot(a,$t(o)),a=Ot(a,$t(r)),a}getBeforeBody(t,e){return pa(rt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:n}=e,s=[];return L(t,o=>{const r={before:[],lines:[],after:[]},a=ma(n,o);Ot(r.before,$t(rt(a,"beforeLabel",this,o))),Ot(r.lines,rt(a,"label",this,o)),Ot(r.after,$t(rt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return pa(rt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:n}=e,s=rt(n,"beforeFooter",this,t),o=rt(n,"footer",this,t),r=rt(n,"afterFooter",this,t);let a=[];return a=Ot(a,$t(s)),a=Ot(a,$t(o)),a=Ot(a,$t(r)),a}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;l<c;++l)a.push(gf(this.chart,e[l]));return t.filter&&(a=a.filter((h,u,d)=>t.filter(h,u,d,n))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,n))),L(a,h=>{const u=ma(t.callbacks,h);s.push(rt(u,"labelColor",this,h)),o.push(rt(u,"labelPointStyle",this,h)),r.push(rt(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=ni[n.position].call(this,s,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);const l=this._size=da(this,n),c=Object.assign({},a,l),h=fa(this.chart,n,c),u=ga(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=oe(a),{x:d,y:f}=t,{width:g,height:p}=e;let m,b,_,y,v,x;return o==="center"?(v=f+p/2,s==="left"?(m=d,b=m-r,y=v+r,x=v-r):(m=d+g,b=m+r,y=v-r,x=v+r),_=m):(s==="left"?b=d+Math.max(l,h)+r:s==="right"?b=d+g-Math.max(c,u)-r:b=this.caretX,o==="top"?(y=f,v=y-r,m=b-r,_=b+r):(y=f+p,v=y+r,m=b+r,_=b-r),x=y),{x1:m,x2:b,x3:_,y1:y,y2:v,y3:x}}drawTitle(t,e,n){const s=this.title,o=s.length;let r,a,l;if(o){const c=De(n.rtl,this.x,this.width);for(t.x=dn(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",r=q(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=r.string,l=0;l<o;++l)e.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=n.titleMarginBottom-a)}}_drawColorBox(t,e,n,s,o){const r=this.labelColors[n],a=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,h=q(o.bodyFont),u=dn(this,"left",o),d=s.x(u),f=l<h.lineHeight?(h.lineHeight-l)/2:0,g=e.y+f;if(o.usePointStyle){const p={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=s.leftForLtr(d,c)+c/2,b=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Hn(t,p,m,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Hn(t,p,m,b)}else{t.lineWidth=T(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const p=s.leftForLtr(d,c),m=s.leftForLtr(s.xPlus(d,1),c-2),b=oe(r.borderRadius);Object.values(b).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Xe(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Xe(t,{x:m,y:g+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=n,u=q(n.bodyFont);let d=u.lineHeight,f=0;const g=De(n.rtl,this.x,this.width),p=function(S){e.fillText(S,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r);let b,_,y,v,x,M,k;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=dn(this,m,n),e.fillStyle=n.bodyColor,L(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+h:c+2+h:0,v=0,M=s.length;v<M;++v){for(b=s[v],_=this.labelTextColors[v],e.fillStyle=_,L(b.before,p),y=b.lines,a&&y.length&&(this._drawColorBox(e,t,v,g,n),d=Math.max(u.lineHeight,l)),x=0,k=y.length;x<k;++x)p(y[x]),d=u.lineHeight;L(b.after,p)}f=0,d=u.lineHeight,L(this.afterBody,p),t.y-=o}drawFooter(t,e,n){const s=this.footer,o=s.length;let r,a;if(o){const l=De(n.rtl,this.x,this.width);for(t.x=dn(this,n.footerAlign,n),t.y+=n.footerMarginTop,e.textAlign=l.textAlign(n.footerAlign),e.textBaseline="middle",r=q(n.footerFont),e.fillStyle=n.footerColor,e.font=r.string,a=0;a<o;++a)e.fillText(s[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+n.footerSpacing}}drawBackground(t,e,n,s){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:h}=n,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:g}=oe(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+u,l),r==="top"&&this.drawCaret(t,e,n,s),e.lineTo(a+c-d,l),e.quadraticCurveTo(a+c,l,a+c,l+d),r==="center"&&o==="right"&&this.drawCaret(t,e,n,s),e.lineTo(a+c,l+h-g),e.quadraticCurveTo(a+c,l+h,a+c-g,l+h),r==="bottom"&&this.drawCaret(t,e,n,s),e.lineTo(a+f,l+h),e.quadraticCurveTo(a,l+h,a,l+h-f),r==="center"&&o==="left"&&this.drawCaret(t,e,n,s),e.lineTo(a,l+u),e.quadraticCurveTo(a,l,a+u,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const r=ni[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=da(this,t),l=Object.assign({},r,this._size),c=fa(e,t,l),h=ga(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const r=tt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),ir(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),nr(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Ri(n,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,n),a=this._positionChanged(r,t),l=e||!Ri(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,r=ni[o.position].call(this,t,e);return r!==!1&&(n!==r.x||s!==r.y)}}w(gs,"positioners",ni);var vf={id:"tooltip",_element:gs,positioners:ni,afterInit(i,t,e){e&&(i.tooltip=new gs({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:ba},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const wf=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Mf(i,t,e,n){const s=i.indexOf(t);if(s===-1)return wf(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const kf=(i,t)=>i===null?null:K(Math.round(i),0,t);function _a(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class ps extends he{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const n=this.getLabels();for(const{index:s,label:o}of e)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(C(t))return null;const n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:Mf(n,t,D(e,t),this._addedLabels),kf(e,n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){const t=this.min,e=this.max,n=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let r=t;r<=e;r++)s.push({value:r});return s}getLabelForValue(t){return _a.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}w(ps,"id","category"),w(ps,"defaults",{ticks:{callback:_a}});function Sf(i,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:d}=i,f=o||1,g=h-1,{min:p,max:m}=t,b=!C(r),_=!C(a),y=!C(c),v=(m-p)/(u+1);let x=Do((m-p)/g/f)*f,M,k,S,P;if(x<1e-14&&!b&&!_)return[{value:p},{value:m}];P=Math.ceil(m/x)-Math.floor(p/x),P>g&&(x=Do(P*x/g/f)*f),C(l)||(M=Math.pow(10,l),x=Math.ceil(x*M)/M),s==="ticks"?(k=Math.floor(p/x)*x,S=Math.ceil(m/x)*x):(k=p,S=m),b&&_&&o&&Dc((a-r)/o,x/1e3)?(P=Math.round(Math.min((a-r)/x,h)),x=(a-r)/P,k=r,S=a):y?(k=b?r:k,S=_?a:S,P=c-1,x=(S-k)/P):(P=(S-k)/x,We(P,Math.round(P),x/1e3)?P=Math.round(P):P=Math.ceil(P));const O=Math.max(Ao(x),Ao(k));M=Math.pow(10,C(l)?O:l),k=Math.round(k*M)/M,S=Math.round(S*M)/M;let A=0;for(b&&(d&&k!==r?(e.push({value:r}),k<r&&A++,We(Math.round((k+A*x)*M)/M,r,xa(r,v,i))&&A++):k<r&&A++);A<P;++A){const E=Math.round((k+A*x)*M)/M;if(_&&E>a)break;e.push({value:E})}return _&&d&&S!==a?e.length&&We(e[e.length-1].value,a,xa(a,v,i))?e[e.length-1].value=a:e.push({value:a}):(!_||S===a)&&e.push({value:S}),e}function xa(i,t,{horizontal:e,minRotation:n}){const s=yt(n),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class fn extends he{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 C(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=e?s:l,a=l=>o=n?o:l;if(t){const l=Pt(s),c=Pt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,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:e.includeBounds!==!1},o=this._range||this,r=Sf(s,o);return t.bounds==="ticks"&&Oo(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return Ye(t,this.chart.options.locale,this.options.ticks.format)}}class ms extends fn{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=j(t)?t:0,this.max=j(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=yt(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}w(ms,"id","linear"),w(ms,"defaults",{ticks:{callback:$i.formatters.numeric}});const si=i=>Math.floor(Gt(i)),ue=(i,t)=>Math.pow(10,si(i)+t);function ya(i){return i/Math.pow(10,si(i))===1}function va(i,t,e){const n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function Pf(i,t){const e=t-i;let n=si(e);for(;va(i,t,n)>10;)n++;for(;va(i,t,n)<10;)n--;return Math.min(n,si(i))}function Df(i,{min:t,max:e}){t=ut(i.min,t);const n=[],s=si(t);let o=Pf(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*r)/r,h=Math.floor((t-l)/a/10)*a*10;let u=Math.floor((c-h)/Math.pow(10,o)),d=ut(i.min,Math.round((l+h+u*Math.pow(10,o))*r)/r);for(;d<e;)n.push({value:d,major:ya(d),significand:u}),u>=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,r=o>=0?1:r),d=Math.round((l+h+u*Math.pow(10,o))*r)/r;const f=ut(i.max,d);return n.push({value:f,major:ya(f),significand:u}),n}class bs extends he{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const n=fn.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return j(n)&&n>0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=j(t)?Math.max(0,t):null,this.max=j(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!j(this._userMin)&&(this.min=t===ue(this.min,0)?ue(this.min,-1):ue(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=a=>n=t?n:a,r=a=>s=e?s:a;n===s&&(n<=0?(o(1),r(10)):(o(ue(n,-1)),r(ue(s,1)))),n<=0&&o(ue(s,-1)),s<=0&&r(ue(n,1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=Df(e,this);return t.bounds==="ticks"&&Oo(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":Ye(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Gt(t),this._valueRange=Gt(this.max)-Gt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Gt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}w(bs,"id","logarithmic"),w(bs,"defaults",{ticks:{callback:$i.formatters.logarithmic,major:{enabled:!0}}});function _s(i){const t=i.ticks;if(t.display&&i.display){const e=tt(t.backdropPadding);return D(t.font&&t.font.size,Y.font.size)+e.height}return 0}function Of(i,t,e){return e=V(e)?e:[e],{w:jc(i,t.string,e),h:e.length*t.lineHeight}}function wa(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:i<n||i>s?{start:t-e,end:t}:{start:t,end:t+e}}function Af(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?$/o:0;for(let l=0;l<o;l++){const c=r.setContext(i.getPointLabelContext(l));s[l]=c.padding;const h=i.getPointPosition(l,i.drawingArea+s[l],a),u=q(c.font),d=Of(i.ctx,u,i._pointLabels[l]);n[l]=d;const f=dt(i.getIndexAngle(l)+a),g=Math.round(Fn(f)),p=wa(g,h.x,d.w,0,180),m=wa(g,h.y,d.h,90,270);Cf(e,t,f,p,m)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=Lf(i,n,s)}function Cf(i,t,e,n,s){const o=Math.abs(Math.sin(e)),r=Math.abs(Math.cos(e));let a=0,l=0;n.start<t.l?(a=(t.l-n.start)/o,i.l=Math.min(i.l,t.l-a)):n.end>t.r&&(a=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),s.start<t.t?(l=(t.t-s.start)/r,i.t=Math.min(i.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function Tf(i,t,e){const n=i.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=e,l=i.getPointPosition(t,n+s+r,o),c=Math.round(Fn(dt(l.angle+U))),h=If(l.y,a.h,c),u=Rf(c),d=Ff(l.x,a.w,u);return{visible:!0,x:l.x,y:h,textAlign:u,left:d,top:h,right:d+a.w,bottom:h+a.h}}function Ef(i,t){if(!t)return!0;const{left:e,top:n,right:s,bottom:o}=i;return!(Rt({x:e,y:n},t)||Rt({x:e,y:o},t)||Rt({x:s,y:n},t)||Rt({x:s,y:o},t))}function Lf(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:_s(o)/2,additionalAngle:r?$/s:0};let c;for(let h=0;h<s;h++){l.padding=e[h],l.size=t[h];const u=Tf(i,h,l);n.push(u),a==="auto"&&(u.visible=Ef(u,c),u.visible&&(c=u))}return n}function Rf(i){return i===0||i===180?"center":i<180?"left":"right"}function Ff(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function If(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function zf(i,t,e){const{left:n,top:s,right:o,bottom:r}=e,{backdropColor:a}=t;if(!C(a)){const l=oe(t.borderRadius),c=tt(t.backdropPadding);i.fillStyle=a;const h=n-c.left,u=s-c.top,d=o-n+c.width,f=r-s+c.height;Object.values(l).some(g=>g!==0)?(i.beginPath(),Xe(i,{x:h,y:u,w:d,h:f,radius:l}),i.fill()):i.fillRect(h,u,d,f)}}function $f(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=i._pointLabelItems[s];if(!o.visible)continue;const r=n.setContext(i.getPointLabelContext(s));zf(e,r,o);const a=q(r.font),{x:l,y:c,textAlign:h}=o;se(e,i._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function Ma(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,B);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r<n;r++)o=i.getPointPosition(r,t),s.lineTo(o.x,o.y)}}function Bf(i,t,e,n,s){const o=i.ctx,r=t.circular,{color:a,lineWidth:l}=t;!r&&!n||!a||!l||e<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),Ma(i,e,r,n),o.closePath(),o.stroke(),o.restore())}function Nf(i,t,e){return Zt(i,{label:e,index:t,type:"pointLabel"})}class oi extends fn{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=tt(_s(this.options)/2),e=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(e,n)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=j(t)&&!isNaN(t)?t:0,this.max=j(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/_s(this.options))}generateTickLabels(t){fn.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,n)=>{const s=I(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?Af(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=B/(this._pointLabels.length||1),n=this.options.startAngle||0;return dt(t*e+yt(n))}getDistanceFromCenterForValue(t){if(C(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(C(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const n=e[t];return Nf(this.getContext(),t,n)}}getPointPosition(t,e,n=0){const s=this.getIndexAngle(t)-U+n;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:n,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:n,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const n=this.ctx;n.save(),n.beginPath(),Ma(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),n.closePath(),n.fillStyle=t,n.fill(),n.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:n,grid:s,border:o}=e,r=this._pointLabels.length;let a,l,c;if(e.pointLabels.display&&$f(this,r),s.display&&this.ticks.forEach((h,u)=>{if(u!==0||u===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const d=this.getContext(u),f=s.setContext(d),g=o.setContext(d);Bf(this,f,l,r,g)}}),n.display){for(t.save(),a=r-1;a>=0;a--){const h=n.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:d}=h;!d||!u||(t.lineWidth=d,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=q(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=tt(c.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}se(t,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}w(oi,"id","radialLinear"),w(oi,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:$i.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),w(oi,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),w(oi,"descriptors",{angleLines:{_fallback:"grid"}});const gn={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}},at=Object.keys(gn);function ka(i,t){return i-t}function Sa(i,t){if(C(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let r=t;return typeof n=="function"&&(r=n(r)),j(r)||(r=typeof n=="string"?e.parse(r,n):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(ke(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function Pa(i,t,e,n){const s=at.length;for(let o=at.indexOf(i);o<s-1;++o){const r=gn[at[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(a*r.size))<=n)return at[o]}return at[s-1]}function Vf(i,t,e,n,s){for(let o=at.length-1;o>=at.indexOf(e);o--){const r=at[o];if(gn[r].common&&i._adapter.diff(s,n,r)>=t-1)return r}return at[e?at.indexOf(e):0]}function Wf(i){for(let t=at.indexOf(i)+1,e=at.length;t<e;++t)if(gn[at[t]].common)return at[t]}function Da(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:n,hi:s}=zn(e,t),o=e[n]>=t?e[n]:e[s];i[o]=!0}}function Hf(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function Oa(i,t,e){const n=[],s={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,n.push({value:a,major:!1});return o===0||!e?n:Hf(i,n,s,e)}class ri extends he{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={}){const n=t.time||(t.time={}),s=this._adapter=new ou._date(t.adapters.date);s.init(e),Ne(n.displayFormats,s.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Sa(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,n=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=j(s)&&!isNaN(s)?s:+e.startOf(Date.now(),n),o=j(o)&&!isNaN(o)?o:+e.endOf(Date.now(),n)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){const t=this.options,e=t.time,n=t.ticks,s=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,a=Tc(s,o,r);return this._unit=e.unit||(n.autoSkip?Pa(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Vf(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:Wf(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),Oa(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=K(e,0,r),n=K(n,0,r),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,r=o.unit||Pa(o.minUnit,e,n,this._getLabelCapacity(e)),a=D(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=ke(l)||l===!0,h={};let u=e,d,f;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(n,e,r)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;d<n;d=+t.add(d,a,r),f++)Da(h,d,g);return(d===n||s.bounds==="ticks"||f===1)&&Da(h,d,g),Object.keys(h).sort(ka).map(p=>+p)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,n,s){const o=this.options,r=o.ticks.callback;if(r)return I(r,[t,e,n],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],d=n[e],f=c&&u&&d&&d.major;return this._adapter.format(t,s||(f?u:h))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e<n;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+n)*e.factor)}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,n=this.ctx.measureText(t).width,s=yt(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:n*o+a*r,h:n*r+a*o}}_getLabelCapacity(t){const e=this.options.time,n=e.displayFormats,s=n[e.unit]||n.millisecond,o=this._tickFormatFunction(t,0,Oa(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e<n;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,n;if(t.length)return t;const s=this.getLabels();for(e=0,n=s.length;e<n;++e)t.push(Sa(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Lo(t.sort(ka))}}w(ri,"id","time"),w(ri,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function pn(i,t,e){let n=0,s=i.length-1,o,r,a,l;e?(t>=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=Lt(i,"pos",t)),{pos:o,time:a}=i[n],{pos:r,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=Lt(i,"time",t)),{time:o,pos:a}=i[n],{time:r,pos:l}=i[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class xs extends ri{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=pn(e,this.min),this._tableRange=pn(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r<a;++r)c=t[r],c>=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(r=0,a=s.length;r<a;++r)h=s[r+1],l=s[r-1],c=s[r],Math.round((h+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,e=this.max;let n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(e)||n.length===1)&&n.push(e),n.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(pn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return pn(this._table,n*this._tableRange+this._minPos,!0)}}w(xs,"id","timeseries"),w(xs,"defaults",ri.defaults);var jf=Fl('<div part="container" class="chart-container svelte-18irkjf"><canvas id="canvas"></canvas></div>');const Yf={hash:"svelte-18irkjf",code:".chart-container.svelte-18irkjf {position:relative;margin:auto;}"};function Aa(i,t){so(t,!0),$l(i,Yf);const e=t.$$host;zt.register(ii,Jt,hn,cn,Ui,Xi,Oe,qi,ts,Ki,Gi,Zi,ps,ms,bs,oi,ri,xs,zd,sf,hf,df,vf,ff);function n(f,g){t.$$host.dispatchEvent(new CustomEvent(f,{detail:g}))}let s=uo(t,"id",7,""),o=uo(t,"data",7,void 0),r=!1,a=nl(void 0);Zs(()=>{o()&&typeof o()=="string"&&o(JSON.parse(o())),c()});function l(f){var m,b,_,y,v;const g=(m=J(a))==null?void 0:m.getElementsAtEventForMode(f,"nearest",{intersect:!0},!0);let p={};if(g!=null&&g.length){const x=g[0];p.label=(y=(_=(b=J(a))==null?void 0:b.data)==null?void 0:_.labels)==null?void 0:y[x.index],p.value=(v=J(a))==null?void 0:v.data.datasets[x.datasetIndex].data[x.index]}n("chartClick",p)}function c(){var f,g;r&&o()&&((f=e==null?void 0:e.shadowRoot)!=null&&f.getElementById("canvas"))&&(J(a)&&(J(a).destroy(),mt(a,void 0)),mt(a,be(new zt((g=e==null?void 0:e.shadowRoot)==null?void 0:g.getElementById("canvas"),{type:o().type,data:o().data,options:o().options}))))}Bl(()=>{r=!0,c()});var h=jf(),u=cl(h),d=Ts(()=>Xl(l,200));return u.__click=function(...f){var g;(g=J(d))==null||g.apply(this,f)},ll(h),lo(i,h),oo({get id(){return s()},set id(f=""){s(f),Di()},get data(){return o()},set data(f=void 0){o(f),Di()}})}Ll(["click"]),customElements.define("hb-chartjs",Hl(Aa,{id:{},data:{}},[],[],!0)),N.Component=Aa,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})})(this.chartjs=this.chartjs||{});
|
|
19
|
-
//# sourceMappingURL=main.iife.js.map
|
package/manifest.json
CHANGED