mirror of
https://github.com/bewcloud/bewcloud.git
synced 2026-03-11 08:54:49 +00:00
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components. The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those. This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno! All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see. Closes #141 Closes #132
15 lines
No EOL
163 KiB
JavaScript
15 lines
No EOL
163 KiB
JavaScript
/* esm.sh - chart.js@4.5.1 */
|
|
import{r as ln,a as Wt,e as bi,c as xi,i as z,d as I,b as G,v as A,u as _i,l as hn,f as Ct,g as V,h as Yt,s as dt,j as kt,k as O,_ as As,t as et,m as cn,n as dn,T as U,o as ye,p as ce,H as Q,P as j,q as Cs,w as Os,x as Ot,y as Ls,z as xt,A as un,B as Ut,C as _t,D as Ts,E as Y,F as L,G as fn,I as Es,J as yi,K as gn,L as Rs,M as Is,N as pn,O as Z,Q as E,R as mn,S as X,U as gi,V as vi,W as bn,X as pt,Y as ve,Z as vt,$ as Me,a0 as B,a1 as pi,a2 as H,a3 as Lt,a4 as xn,a5 as _n,a6 as Mi,a7 as ke,a8 as ki,a9 as yn,aa as vn,ab as re,ac as Mn,ad as kn,ae as Si,af as wi,ag as Di,ah as zs,ai as de,aj as Sn,ak as ht,al as ut,am as wn,an as Dn,ao as Pn,ap as Fs,aq as An,ar as Cn,as as On,at as Ln,au as Tn,av as Ve,aw as Xt,ax as En,ay as yt,az as Rn,aA as At,aB as Vs,aC as In,aD as Bs,aE as zn,aF as Fn,aG as at,aH as Ns,aI as Pi,aJ as Vn,aK as De,aL as Ai,aM as mi,aN as Ht,aO as Bn,aP as Nn,aQ as Wn}from"./dist/chunks/helpers.dataset.mjs";import"/public/js/@kurkle/color@^0.3.0?target=denonext";var Be=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let o=e.listeners[s],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=ln.call(globalThis,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;let o=i.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},rt=new Be,Ci="transparent",Hn={boolean(n,t,e){return e>.5?t:n},color(n,t,e){let i=xi(n||Ci),s=i.valid&&xi(t||Ci);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}},Ne=class{constructor(t,e,i,s){let o=e[i];s=Wt([t.to,s,o,t.from]);let a=Wt([t.from,o,s]);this._active=!0,this._fn=t.fn||Hn[t.type||typeof a],this._easing=bi[t.easing]||bi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let s=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Wt([t.to,e,s,t.from]),this._from=Wt([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e<i),!this._active){this._target[s]=r,this._notify(!0);return}if(e<0){this._target[s]=o;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}},ue=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!z(t))return;let e=Object.keys(I.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let o=t[s];if(!z(o))return;let a={};for(let r of e)a[r]=o[r];(G(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){let i=e.options,s=$n(t,i);if(!s)return[];let o=this._createAnimations(s,i);return i.$shared&&jn(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let h=a[l];if(h.charAt(0)==="$")continue;if(h==="options"){s.push(...this._animateOptions(t,e));continue}let c=e[h],d=o[h],u=i.get(h);if(d)if(u&&d.active()){d.update(u,c,r);continue}else d.cancel();if(!u||!u.duration){t[h]=c;continue}o[h]=d=new Ne(u,t,h,c),s.push(d)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return rt.add(this._chart,i),!0}};function jn(n,t){let e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){let o=n[i[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function $n(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Oi(n,t){let e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function Yn(n,t,e){if(e===!1)return!1;let i=Oi(n,e),s=Oi(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Un(n){let t,e,i,s;return z(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function Ws(n,t){let e=[],i=n._getSortedDatasetMetas(t),s,o;for(s=0,o=i.length;s<o;++s)e.push(i[s].index);return e}function Li(n,t,e,i={}){let s=n.keys,o=i.mode==="single",a,r,l,h;if(t===null)return;let c=!1;for(a=0,r=s.length;a<r;++a){if(l=+s[a],l===e){if(c=!0,i.all)continue;break}h=n.values[l],V(h)&&(o||t===0||dt(t)===dt(h))&&(t+=h)}return!c&&!i.all?0:t}function Xn(n,t){let{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",a=Object.keys(n),r=new Array(a.length),l,h,c;for(l=0,h=a.length;l<h;++l)c=a[l],r[l]={[s]:c,[o]:n[c]};return r}function Pe(n,t){let e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function Kn(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function Gn(n){let{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function qn(n,t,e){let i=n[t]||(n[t]={});return i[e]||(i[e]={})}function Ti(n,t,e,i){for(let s of t.getMatchingVisibleMetas(i).reverse()){let o=n[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function Ei(n,t){let{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,h=a.axis,c=Kn(o,a,i),d=t.length,u;for(let f=0;f<d;++f){let g=t[f],{[l]:p,[h]:b}=g,m=g._stacks||(g._stacks={});u=m[h]=qn(s,c,p),u[r]=b,u._top=Ti(u,a,!0,i.type),u._bottom=Ti(u,a,!1,i.type);let x=u._visualValues||(u._visualValues={});x[r]=b}}function Ae(n,t){let e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function Jn(n,t){return kt(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Zn(n,t,e){return kt(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function zt(n,t){let e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(let s of t){let o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}var Ce=n=>n==="reset"||n==="none",Ri=(n,t)=>t?n:Object.assign({},n),Qn=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:Ws(e,!0),values:null},ot=class{static defaults={};static datasetElementType=null;static dataElementType=null;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(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Pe(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&&zt(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(d,u,f,g)=>d==="x"?u:d==="r"?g:f,o=e.xAxisID=A(i.xAxisID,Ae(t,"x")),a=e.yAxisID=A(i.yAxisID,Ae(t,"y")),r=e.rAxisID=A(i.rAxisID,Ae(t,"r")),l=e.indexAxis,h=e.iAxisID=s(l,o,a,r),c=e.vAxisID=s(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&_i(this._data,this),t._stacked&&zt(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(z(e)){let s=this._cachedMeta;this._data=Xn(e,s)}else if(i!==e){if(i){_i(i,this);let s=this._cachedMeta;zt(s),s._parsed=[]}e&&Object.isExtensible(e)&&hn(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let o=e._stacked;e._stacked=Pe(e.vScale,e),e.stack!==i.stack&&(s=!0,zt(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&(Ei(this,e._parsed),e._stacked=Pe(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:a}=i,r=o.axis,l=t===0&&e===s.length?!0:i._sorted,h=t>0&&i._parsed[t-1],c,d,u;if(this._parsing===!1)i._parsed=s,i._sorted=!0,u=s;else{G(s[t])?u=this.parseArrayData(i,s,t,e):z(s[t])?u=this.parseObjectData(i,s,t,e):u=this.parsePrimitiveData(i,s,t,e);let f=()=>d[r]===null||h&&d[r]<h[r];for(c=0;c<e;++c)i._parsed[c+t]=d=u[c],l&&(f()&&(l=!1),h=d);i._sorted=l}a&&Ei(this,u)}parsePrimitiveData(t,e,i,s){let{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,h=o.getLabels(),c=o===a,d=new Array(s),u,f,g;for(u=0,f=s;u<f;++u)g=u+i,d[u]={[r]:c||o.parse(h[g],g),[l]:a.parse(e[g],g)};return d}parseArrayData(t,e,i,s){let{xScale:o,yScale:a}=t,r=new Array(s),l,h,c,d;for(l=0,h=s;l<h;++l)c=l+i,d=e[c],r[l]={x:o.parse(d[0],c),y:a.parse(d[1],c)};return r}parseObjectData(t,e,i,s){let{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,h=new Array(s),c,d,u,f;for(c=0,d=s;c<d;++c)u=c+i,f=e[u],h[c]={x:o.parse(Ct(f,r),u),y:a.parse(Ct(f,l),u)};return h}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let s=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:Ws(s,!0),values:e._stacks[t.axis]._visualValues};return Li(r,a,o.index,{mode:i})}updateRangeFromParsed(t,e,i,s){let o=i[e.axis],a=o===null?NaN:o,r=s&&i._stacks[e.axis];s&&r&&(s.values=r,a=Li(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,a=s.length,r=this._getOtherScale(t),l=Qn(e,i,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=Gn(r),u,f;function g(){f=s[u];let p=f[r.axis];return!V(f[t.axis])||c>p||d<p}for(u=0;u<a&&!(!g()&&(this.updateRangeFromParsed(h,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!g()){this.updateRangeFromParsed(h,t,f,l);break}}return h}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],s,o,a;for(s=0,o=e.length;s<o;++s)a=e[s][t.axis],V(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=Un(A(this.options.clip,Yn(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,h=this.options.drawActiveElementsOnTop,c;for(i.dataset&&i.dataset.draw(t,o,r,l),c=r;c<r+l;++c){let d=s[c];d.hidden||(d.active&&h?a.push(d):d.draw(t,o))}for(c=0;c<a.length;++c)a[c].draw(t,o)}getStyle(t,e){let i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){let s=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];o=a.$context||(a.$context=Zn(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Jn(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,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",i){let s=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&Yt(i);if(r)return Ri(r,l);let h=this.chart.config,c=h.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],u=h.getOptionScopes(this.getDataset(),c),f=Object.keys(I.elements[t]),g=()=>this.getContext(i,s,e),p=h.resolveNamedOptions(u,f,g,d);return p.$shared&&(p.$shared=l,o[a]=Object.freeze(Ri(p,l))),p}_resolveAnimations(t,e,i){let s=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(s.options.animation!==!1){let c=this.chart.config,d=c.datasetAnimationScopeKeys(this._type,e),u=c.getOptionScopes(this.getDataset(),d);l=c.createResolver(u,this.getContext(t,i,e))}let h=new ue(s,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ce(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,s){Ce(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ce(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[r,l,h]of this._syncList)this[r](l,h);this._syncList=[];let s=i.length,o=e.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,i=!0){let s=this._cachedMeta,o=s.data,a=t+e,r,l=h=>{for(h.length+=e,r=h.length-1;r>=a;r--)h[r]=h[r-e]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let s=i._parsed.splice(t,e);i._stacked&&zt(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let 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]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};function to(n,t){if(!n._cache.$bar){let e=n.getMatchingVisibleMetas(t),i=[];for(let s=0,o=e.length;s<o;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=As(i.sort((s,o)=>s-o))}return n._cache.$bar}function eo(n){let t=n.iScale,e=to(t,n.type),i=t._length,s,o,a,r,l=()=>{a===32767||a===-32768||(Yt(r)&&(i=Math.min(i,Math.abs(a-r)||i)),r=a)};for(s=0,o=e.length;s<o;++s)a=t.getPixelForValue(e[s]),l();for(r=void 0,s=0,o=t.ticks.length;s<o;++s)a=t.getPixelForTick(s),l();return i}function io(n,t,e,i){let s=e.barThickness,o,a;return O(s)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=s*i,a=1),{chunk:o/i,ratio:a,start:t.pixels[n]-o/2}}function so(n,t,e,i){let s=t.pixels,o=s[n],a=n>0?s[n-1]:null,r=n<s.length-1?s[n+1]:null,l=e.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);let h=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/i,ratio:e.barPercentage,start:h}}function no(n,t,e,i){let s=e.parse(n[0],i),o=e.parse(n[1],i),a=Math.min(s,o),r=Math.max(s,o),l=a,h=r;Math.abs(a)>Math.abs(r)&&(l=r,h=a),t[e.axis]=h,t._custom={barStart:l,barEnd:h,start:s,end:o,min:a,max:r}}function Hs(n,t,e,i){return G(n)?no(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Ii(n,t,e,i){let s=n.iScale,o=n.vScale,a=s.getLabels(),r=s===o,l=[],h,c,d,u;for(h=e,c=e+i;h<c;++h)u=t[h],d={},d[s.axis]=r||s.parse(a[h],h),l.push(Hs(u,d,o,h));return l}function Oe(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function oo(n,t,e){return n!==0?dt(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function ao(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:i,reverse:t,top:s,bottom:o}}function ro(n,t,e,i){let s=t.borderSkipped,o={};if(!s){n.borderSkipped=o;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:a,end:r,reverse:l,top:h,bottom:c}=ao(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=h:(e._bottom||0)===i?s=c:(o[zi(c,a,r,l)]=!0,s=h)),o[zi(s,a,r,l)]=!0,n.borderSkipped=o}function zi(n,t,e,i){return i?(n=lo(n,t,e),n=Fi(n,e,t)):n=Fi(n,t,e),n}function lo(n,t,e){return n===t?e:n===e?t:n}function Fi(n,t,e){return n==="start"?t:n==="end"?e:n}function ho(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}var We=class extends ot{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return Ii(t,e,i,s)}parseArrayData(t,e,i,s){return Ii(t,e,i,s)}parseObjectData(t,e,i,s){let{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,h=o.axis==="x"?r:l,c=a.axis==="x"?r:l,d=[],u,f,g,p;for(u=i,f=i+s;u<f;++u)p=e[u],g={},g[o.axis]=o.parse(Ct(p,h),u),d.push(Hs(Ct(p,c),g,a,u));return d}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);let o=i._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){let e=this._cachedMeta,{iScale:i,vScale:s}=e,o=this.getParsed(t),a=o._custom,r=Oe(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){let o=s==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),h=r.isHorizontal(),c=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,s);for(let f=e;f<e+i;f++){let g=this.getParsed(f),p=o||O(g[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),b=this._calculateBarIndexPixels(f,c),m=(g._stacks||{})[r.axis],x={horizontal:h,base:p.base,enableBorderRadius:!m||Oe(g._custom)||a===m._top||a===m._bottom,x:h?p.head:b.center,y:h?b.center:p.head,height:h?b.size:Math.abs(p.size),width:h?Math.abs(p.size):b.size};u&&(x.options=d||this.resolveDataElementOptions(f,t[f].active?"active":s));let v=x.options||t[f].options;ro(x,v,m,a),ho(x,v,c.ratio),this.updateElement(t[f],f,x,s)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(c=>c.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],h=c=>{let d=c._parsed.find(f=>f[i.axis]===l),u=d&&d[c.vScale.axis];if(O(u)||isNaN(u))return!0};for(let c of s)if(!(e!==void 0&&h(c))&&((o===!1||a.indexOf(c.stack)===-1||o===void 0&&c.stack===void 0)&&a.push(c.stack),c.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[A(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,s=[],o,a;for(o=0,a=e.data.length;o<a;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));let r=t.barThickness;return{min:r||eo(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),h=l._custom,c=Oe(h),d=l[e.axis],u=0,f=i?this.applyStack(e,l,i):d,g,p;f!==d&&(u=f-d,f=d),c&&(d=h.barStart,f=h.barEnd-h.barStart,d!==0&&dt(d)!==dt(h.barEnd)&&(u=0),u+=d);let b=!O(o)&&!c?o:u,m=e.getPixelForValue(b);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(u+f):g=m,p=g-m,Math.abs(p)<a){p=oo(p,e,r)*a,d===r&&(m-=p/2);let x=e.getPixelForDecimal(0),v=e.getPixelForDecimal(1),y=Math.min(x,v),_=Math.max(x,v);m=Math.max(Math.min(m,_),y),g=m+p,i&&!c&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(g)-e.getValueForPixel(m))}if(m===e.getPixelForValue(r)){let x=dt(p)*e.getLineWidthForValue(r)/2;m+=x,p-=x}return{size:p,base:m,head:g,center:g+p/2}}_calculateBarIndexPixels(t,e){let i=e.scale,s=this.options,o=s.skipNull,a=A(s.maxBarThickness,1/0),r,l,h=this._getAxisCount();if(e.grouped){let c=o?this._getStackCount(t):e.stackCount,d=s.barThickness==="flex"?so(t,e,s,c*h):io(t,e,s,c*h),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(A(u,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=d.start+d.chunk*g+d.chunk/2,l=Math.min(a,d.chunk*d.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){let t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length,o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}},He=class extends ot{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){let o=super.parsePrimitiveData(t,e,i,s);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+i).radius;return o}parseArrayData(t,e,i,s){let o=super.parseArrayData(t,e,i,s);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=A(r[2],this.resolveDataElementOptions(a+i).radius)}return o}parseObjectData(t,e,i,s){let o=super.parseObjectData(t,e,i,s);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=A(r&&r.r&&+r.r,this.resolveDataElementOptions(a+i).radius)}return o}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=e,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y),h=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(h?", "+h:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){let o=s==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:h}=this._getSharedOptions(e,s),c=a.axis,d=r.axis;for(let u=e;u<e+i;u++){let f=t[u],g=!o&&this.getParsed(u),p={},b=p[c]=o?a.getPixelForDecimal(.5):a.getPixelForValue(g[c]),m=p[d]=o?r.getBasePixel():r.getPixelForValue(g[d]);p.skip=isNaN(b)||isNaN(m),h&&(p.options=l||this.resolveDataElementOptions(u,f.active?"active":s),o&&(p.options.radius=0)),this.updateElement(f,u,p,s)}}resolveDataElementOptions(t,e){let i=this.getParsed(t),s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));let o=s.radius;return e!=="active"&&(s.radius=0),s.radius+=A(i&&i._custom,o),s}};function co(n,t,e){let i=1,s=1,o=0,a=0;if(t<U){let r=n,l=r+t,h=Math.cos(r),c=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(v,y,_)=>ce(v,r,l,!0)?1:Math.max(y,y*e,_,_*e),g=(v,y,_)=>ce(v,r,l,!0)?-1:Math.min(y,y*e,_,_*e),p=f(0,h,d),b=f(Q,c,u),m=g(j,h,d),x=g(j+Q,c,u);i=(p-m)/2,s=(b-x)/2,o=-(p+m)/2,a=-(b+x)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:a}}var Kt=class extends ot{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,h)=>{let d=t.getDatasetMeta(0).controller.getStyle(h);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(h),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:s,pointStyle:i,borderRadius:a&&(r||d.borderRadius),index:h}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(z(i[t])){let{key:l="value"}=this._parsing;o=h=>+Ct(i[h],l)}let a,r;for(a=t,r=t+e;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return et(this.options.rotation-90)}_getCircumference(){return et(this.options.circumference)}_getRotationExtents(){let t=U,e=-U;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){let s=this.chart.getDatasetMeta(i).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){let e=this.chart,{chartArea:i}=e,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(cn(this.options.cutout,r),1),h=this._getRingWeight(this.index),{circumference:c,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:g,offsetY:p}=co(d,c,l),b=(i.width-a)/u,m=(i.height-a)/f,x=Math.max(Math.min(b,m)/2,0),v=dn(this.options.radius,x),y=Math.max(v*l,0),_=(v-y)/this._getVisibleDatasetWeightTotal();this.offsetX=g*v,this.offsetY=p*v,s.total=this.calculateTotal(),this.outerRadius=v-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*h,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){let i=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/U)}updateElements(t,e,i,s){let o=s==="reset",a=this.chart,r=a.chartArea,h=a.options.animation,c=(r.left+r.right)/2,d=(r.top+r.bottom)/2,u=o&&h.animateScale,f=u?0:this.innerRadius,g=u?0:this.outerRadius,{sharedOptions:p,includeOptions:b}=this._getSharedOptions(e,s),m=this._getRotation(),x;for(x=0;x<e;++x)m+=this._circumference(x,o);for(x=e;x<e+i;++x){let v=this._circumference(x,o),y=t[x],_={x:c+this.offsetX,y:d+this.offsetY,startAngle:m,endAngle:m+v,circumference:v,outerRadius:g,innerRadius:f};b&&(_.options=p||this.resolveDataElementOptions(x,y.active?"active":s)),m+=v,this.updateElement(y,x,_,s)}}calculateTotal(){let t=this._cachedMeta,e=t.data,i=0,s;for(s=0;s<e.length;s++){let o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?U*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=ye(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,s,o,a,r,l;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,r=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=r.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){let o=this.resolveDataElementOptions(i);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(A(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},je=class extends ot{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=Cs(e,s,a);this._drawStart=r,this._drawCount=l,Os(e)&&(r=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;let h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:h},t),this.updateElements(s,r,l,t)}updateElements(t,e,i,s){let o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:h}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,s),u=a.axis,f=r.axis,{spanGaps:g,segment:p}=this.options,b=Ot(g)?g:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||o||s==="none",x=e+i,v=t.length,y=e>0&&this.getParsed(e-1);for(let _=0;_<v;++_){let M=t[_],k=m?M:{};if(_<e||_>=x){k.skip=!0;continue}let S=this.getParsed(_),w=O(S[f]),D=k[u]=a.getPixelForValue(S[u],_),P=k[f]=o||w?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,S,l):S[f],_);k.skip=isNaN(D)||isNaN(P)||w,k.stop=_>0&&Math.abs(S[u]-y[u])>b,p&&(k.parsed=S,k.raw=h.data[_]),d&&(k.options=c||this.resolveDataElementOptions(_,M.active?"active":s)),m||this.updateElement(M,_,k,s),y=S}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},fe=class extends ot{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,a)=>{let l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=ye(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return Ls.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{let 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(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,s){let o=s==="reset",a=this.chart,l=a.options.animation,h=this._cachedMeta.rScale,c=h.xCenter,d=h.yCenter,u=h.getIndexAngle(0)-.5*j,f=u,g,p=360/this.countVisibleElements();for(g=0;g<e;++g)f+=this._computeAngle(g,s,p);for(g=e;g<e+i;g++){let b=t[g],m=f,x=f+this._computeAngle(g,s,p),v=a.getDataVisibility(g)?h.getDistanceFromCenterForValue(this.getParsed(g).r):0;f=x,o&&(l.animateScale&&(v=0),l.animateRotate&&(m=x=u));let y={x:c,y:d,innerRadius:0,outerRadius:v,startAngle:m,endAngle:x,options:this.resolveDataElementOptions(g,b.active?"active":s)};this.updateElement(b,g,y,s)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?et(this.resolveDataElementOptions(t,e).angle||i):0}},$e=class extends Kt{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},Ye=class extends ot{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return Ls.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(i.points=s,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let r={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let o=this._cachedMeta.rScale,a=s==="reset";for(let r=e;r<e+i;r++){let l=t[r],h=this.resolveDataElementOptions(r,l.active?"active":s),c=o.getPointPositionForValue(r,this.getParsed(r).r),d=a?o.xCenter:c.x,u=a?o.yCenter:c.y,f={x:d,y:u,angle:c.angle,skip:isNaN(d)||isNaN(u),options:h};this.updateElement(l,r,f,s)}}},Ue=class extends ot{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=e,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:i[t]||"",value:"("+r+", "+l+")"}}update(t){let e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled,{start:o,count:a}=Cs(e,i,s);if(this._drawStart=o,this._drawCount=a,Os(e)&&(o=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:r,_dataset:l}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=i;let h=this.resolveDatasetElementOptions(t);h.segment=this.options.segment,this.updateElement(r,void 0,{animated:!s,options:h},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){let o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:h}=this._cachedMeta,c=this.resolveDataElementOptions(e,s),d=this.getSharedOptions(c),u=this.includeOptions(s,d),f=a.axis,g=r.axis,{spanGaps:p,segment:b}=this.options,m=Ot(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",v=e>0&&this.getParsed(e-1);for(let y=e;y<e+i;++y){let _=t[y],M=this.getParsed(y),k=x?_:{},S=O(M[g]),w=k[f]=a.getPixelForValue(M[f],y),D=k[g]=o||S?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,M,l):M[g],y);k.skip=isNaN(w)||isNaN(D)||S,k.stop=y>0&&Math.abs(M[f]-v[f])>m,b&&(k.parsed=M,k.raw=h.data[y]),u&&(k.options=d||this.resolveDataElementOptions(y,_.active?"active":s)),x||this.updateElement(_,y,k,s),v=M}this.updateSharedOptions(d,s,c)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}let i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;let o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,a)/2}},uo=Object.freeze({__proto__:null,BarController:We,BubbleController:He,DoughnutController:Kt,LineController:je,PieController:$e,PolarAreaController:fe,RadarController:Ye,ScatterController:Ue});function mt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Xe=class n{static override(t){Object.assign(n.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return mt()}parse(){return mt()}format(){return mt()}add(){return mt()}diff(){return mt()}startOf(){return mt()}endOf(){return mt()}},fo={_date:Xe};function go(n,t,e,i){let{controller:s,data:o,_sorted:a}=n,r=s._cachedMeta.iScale,l=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){let h=r._reversePixels?un:Ut;if(i){if(s._sharedOptions){let c=o[0],d=typeof c.getRange=="function"&&c.getRange(t);if(d){let u=h(o,t,e-d),f=h(o,t,e+d);return{lo:u.lo,hi:f.hi}}}}else{let c=h(o,t,e);if(l){let{vScale:d}=s._cachedMeta,{_parsed:u}=n,f=u.slice(0,c.lo+1).reverse().findIndex(p=>!O(p[d.axis]));c.lo-=Math.max(0,f);let g=u.slice(c.hi).findIndex(p=>!O(p[d.axis]));c.hi+=Math.max(0,g)}return c}}return{lo:0,hi:o.length-1}}function Qt(n,t,e,i,s){let o=n.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r<l;++r){let{index:h,data:c}=o[r],{lo:d,hi:u}=go(o[r],t,a,s);for(let f=d;f<=u;++f){let g=c[f];g.skip||i(g,h,f)}}}function po(n){let t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){let o=t?Math.abs(i.x-s.x):0,a=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Le(n,t,e,i,s){let o=[];return!s&&!n.isPointInArea(t)||Qt(n,e,t,function(r,l,h){!s&&!_t(r,n.chartArea,0)||r.inRange(t.x,t.y,i)&&o.push({element:r,datasetIndex:l,index:h})},!0),o}function mo(n,t,e,i){let s=[];function o(a,r,l){let{startAngle:h,endAngle:c}=a.getProps(["startAngle","endAngle"],i),{angle:d}=Ts(a,{x:t.x,y:t.y});ce(d,h,c)&&s.push({element:a,datasetIndex:r,index:l})}return Qt(n,e,t,o),s}function bo(n,t,e,i,s,o){let a=[],r=po(e),l=Number.POSITIVE_INFINITY;function h(c,d,u){let f=c.inRange(t.x,t.y,s);if(i&&!f)return;let g=c.getCenterPoint(s);if(!(!!o||n.isPointInArea(g))&&!f)return;let b=r(t,g);b<l?(a=[{element:c,datasetIndex:d,index:u}],l=b):b===l&&a.push({element:c,datasetIndex:d,index:u})}return Qt(n,e,t,h),a}function Te(n,t,e,i,s,o){return!o&&!n.isPointInArea(t)?[]:e==="r"&&!i?mo(n,t,e,s):bo(n,t,e,i,s,o)}function Vi(n,t,e,i,s){let o=[],a=e==="x"?"inXRange":"inYRange",r=!1;return Qt(n,e,t,(l,h,c)=>{l[a]&&l[a](t[e],s)&&(o.push({element:l,datasetIndex:h,index:c}),r=r||l.inRange(t.x,t.y,s))}),i&&!r?[]:o}var xo={evaluateInteractionItems:Qt,modes:{index(n,t,e,i){let s=xt(t,n),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?Le(n,s,o,i,a):Te(n,s,o,!1,i,a),l=[];return r.length?(n.getSortedVisibleDatasetMetas().forEach(h=>{let c=r[0].index,d=h.data[c];d&&!d.skip&&l.push({element:d,datasetIndex:h.index,index:c})}),l):[]},dataset(n,t,e,i){let s=xt(t,n),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?Le(n,s,o,i,a):Te(n,s,o,!1,i,a);if(r.length>0){let l=r[0].datasetIndex,h=n.getDatasetMeta(l).data;r=[];for(let c=0;c<h.length;++c)r.push({element:h[c],datasetIndex:l,index:c})}return r},point(n,t,e,i){let s=xt(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;return Le(n,s,o,i,a)},nearest(n,t,e,i){let s=xt(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;return Te(n,s,o,e.intersect,i,a)},x(n,t,e,i){let s=xt(t,n);return Vi(n,s,"x",e.intersect,i)},y(n,t,e,i){let s=xt(t,n);return Vi(n,s,"y",e.intersect,i)}}},js=["left","top","right","bottom"];function Ft(n,t){return n.filter(e=>e.pos===t)}function Bi(n,t){return n.filter(e=>js.indexOf(e.pos)===-1&&e.box.axis===t)}function Vt(n,t){return n.sort((e,i)=>{let s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function _o(n){let t=[],e,i,s,o,a,r;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:o,options:{stack:a,stackWeight:r=1}}=s,t.push({index:e,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&o+a,stackWeight:r});return t}function yo(n){let t={};for(let e of n){let{stack:i,pos:s,stackWeight:o}=e;if(!i||!js.includes(s))continue;let a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function vo(n,t){let e=yo(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t,o,a,r;for(o=0,a=n.length;o<a;++o){r=n[o];let{fullSize:l}=r.box,h=e[r.stack],c=h&&r.stackWeight/h.weight;r.horizontal?(r.width=c?c*i:l&&t.availableWidth,r.height=s):(r.width=i,r.height=c?c*s:l&&t.availableHeight)}return e}function Mo(n){let t=_o(n),e=Vt(t.filter(h=>h.box.fullSize),!0),i=Vt(Ft(t,"left"),!0),s=Vt(Ft(t,"right")),o=Vt(Ft(t,"top"),!0),a=Vt(Ft(t,"bottom")),r=Bi(t,"x"),l=Bi(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:Ft(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function Ni(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function $s(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function ko(n,t,e,i){let{pos:s,box:o}=e,a=n.maxPadding;if(!z(s)){e.size&&(n[s]-=e.size);let d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,n[s]+=e.size}o.getPadding&&$s(a,o.getPadding());let r=Math.max(0,t.outerWidth-Ni(a,n,"left","right")),l=Math.max(0,t.outerHeight-Ni(a,n,"top","bottom")),h=r!==n.w,c=l!==n.h;return n.w=r,n.h=l,e.horizontal?{same:h,other:c}:{same:c,other:h}}function So(n){let t=n.maxPadding;function e(i){let s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function wo(n,t){let e=t.maxPadding;function i(s){let o={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return i(n?["left","right"]:["top","bottom"])}function jt(n,t,e,i){let s=[],o,a,r,l,h,c;for(o=0,a=n.length,h=0;o<a;++o){r=n[o],l=r.box,l.update(r.width||t.w,r.height||t.h,wo(r.horizontal,t));let{same:d,other:u}=ko(t,e,r,i);h|=d&&s.length,c=c||u,l.fullSize||s.push(r)}return h&&jt(s,t,e,i)||c}function ee(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Wi(n,t,e,i){let s=e.padding,{x:o,y:a}=t;for(let r of n){let l=r.box,h=i[r.stack]||{count:1,placed:0,weight:1},c=r.stackWeight/h.weight||1;if(r.horizontal){let d=t.w*c,u=h.size||l.height;Yt(h.start)&&(a=h.start),l.fullSize?ee(l,s.left,a,e.outerWidth-s.right-s.left,u):ee(l,t.left+h.placed,a,d,u),h.start=a,h.placed+=d,a=l.bottom}else{let d=t.h*c,u=h.size||l.width;Yt(h.start)&&(o=h.start),l.fullSize?ee(l,o,s.top,u,e.outerHeight-s.bottom-s.top):ee(l,o,t.top+h.placed,u,d),h.start=o,h.placed+=d,o=l.right}}t.x=o,t.y=a}var $={addBox(n,t){n.boxes||(n.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)}}]},n.boxes.push(t)},removeBox(n,t){let e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;let s=Y(n.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(e-s.height,0),r=Mo(n.boxes),l=r.vertical,h=r.horizontal;L(n.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});let c=l.reduce((p,b)=>b.box.options&&b.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),u=Object.assign({},s);$s(u,Y(i));let f=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),g=vo(l.concat(h),d);jt(r.fullSize,f,d,g),jt(l,f,d,g),jt(h,f,d,g)&&jt(l,f,d,g),So(f),Wi(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,Wi(r.rightAndBottom,f,d,g),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},L(r.chartArea,p=>{let b=p.box;Object.assign(b,n.chartArea),b.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},ge=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},Ke=class extends ge{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},le="$chartjs",Do={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Hi=n=>n===null||n==="";function Po(n,t){let e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[le]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Hi(s)){let o=yi(n,"width");o!==void 0&&(n.width=o)}if(Hi(i))if(n.style.height==="")n.height=n.width/(t||2);else{let o=yi(n,"height");o!==void 0&&(n.height=o)}return n}var Ys=gn?{passive:!0}:!1;function Ao(n,t,e){n&&n.addEventListener(t,e,Ys)}function Co(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,Ys)}function Oo(n,t){let e=Do[n.type]||n.type,{x:i,y:s}=xt(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function pe(n,t){for(let e of n)if(e===t||e.contains(t))return!0}function Lo(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||pe(r.addedNodes,i),a=a&&!pe(r.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function To(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||pe(r.removedNodes,i),a=a&&!pe(r.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}var Gt=new Map,ji=0;function Us(){let n=globalThis.devicePixelRatio;n!==ji&&(ji=n,Gt.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function Eo(n,t){Gt.size||globalThis.addEventListener("resize",Us),Gt.set(n,t)}function Ro(n){Gt.delete(n),Gt.size||globalThis.removeEventListener("resize",Us)}function Io(n,t,e){let i=n.canvas,s=i&&Es(i);if(!s)return;let o=Rs((r,l)=>{let h=s.clientWidth;e(r,l),h<s.clientWidth&&e()},globalThis),a=new ResizeObserver(r=>{let l=r[0],h=l.contentRect.width,c=l.contentRect.height;h===0&&c===0||o(h,c)});return a.observe(s),Eo(n,o),a}function Ee(n,t,e){e&&e.disconnect(),t==="resize"&&Ro(n)}function zo(n,t,e){let i=n.canvas,s=Rs(o=>{n.ctx!==null&&e(Oo(o,n))},n);return Ao(i,t,s),s}var Ge=class extends ge{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Po(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[le])return!1;let i=e[le].initial;["height","width"].forEach(o=>{let a=i[o];O(a)?e.removeAttribute(o):e.setAttribute(o,a)});let s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[le],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:Lo,detach:To,resize:Io}[e]||zo;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Ee,detach:Ee,resize:Ee}[e]||Co)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return globalThis.devicePixelRatio}getMaximumSize(t,e,i,s){return fn(t,e,i,s)}isAttached(t){let e=t&&Es(t);return!!(e&&e.isConnected)}};function Fo(n){return!Is()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?Ke:Ge}var it=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ot(this.x)&&Ot(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}};function Vo(n,t){let e=n.options.ticks,i=Bo(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Wo(t):[],a=o.length,r=o[0],l=o[a-1],h=[];if(a>s)return Ho(t,h,o,a/s),h;let c=No(o,t,s);if(a>0){let d,u,f=a>1?Math.round((l-r)/(a-1)):null;for(ie(t,h,c,O(f)?0:r-f,r),d=0,u=a-1;d<u;d++)ie(t,h,c,o[d],o[d+1]);return ie(t,h,c,l,O(f)?t.length:l+f),h}return ie(t,h,c),h}function Bo(n){let t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function No(n,t,e){let i=jo(n),s=t.length/e;if(!i)return Math.max(s,1);let o=pn(i);for(let a=0,r=o.length-1;a<r;a++){let l=o[a];if(l>s)return l}return Math.max(s,1)}function Wo(n){let t=[],e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function Ho(n,t,e,i){let s=0,o=e[0],a;for(i=Math.ceil(i),a=0;a<n.length;a++)a===o&&(t.push(n[a]),s++,o=e[s*i])}function ie(n,t,e,i,s){let o=A(i,0),a=Math.min(A(s,n.length),n.length),r=0,l,h,c;for(e=Math.ceil(e),s&&(l=s-i,e=l/Math.floor(l/e)),c=o;c<0;)r++,c=Math.round(o+r*e);for(h=Math.max(o,0);h<a;h++)h===c&&(t.push(n[h]),r++,c=Math.round(o+r*e))}function jo(n){let t=n.length,e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}var $o=n=>n==="left"?"right":n==="right"?"left":n,$i=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,Yi=(n,t)=>Math.min(t||n,n);function Ui(n,t){let e=[],i=n.length/t,s=n.length,o=0;for(;o<s;o+=i)e.push(n[Math.floor(o)]);return e}function Yo(n,t,e){let i=n.ticks.length,s=Math.min(t,i-1),o=n._startPixel,a=n._endPixel,r=1e-6,l=n.getPixelForTick(s),h;if(!(e&&(i===1?h=Math.max(l-o,a-l):t===0?h=(n.getPixelForTick(1)-l)/2:h=(l-n.getPixelForTick(s-1))/2,l+=s<t?h:-h,l<o-r||l>a+r)))return l}function Uo(n,t){L(n,e=>{let i=e.gc,s=i.length/2,o;if(s>t){for(o=0;o<s;++o)delete e.data[i[o]];i.splice(0,s)}})}function Bt(n){return n.drawTicks?n.tickLength:0}function Xi(n,t){if(!n.display)return 0;let e=B(n.font,t),i=Y(n.padding);return(G(n.text)?n.text.length:1)*e.lineHeight+i.height}function Xo(n,t){return kt(n,{scale:t,type:"scale"})}function Ko(n,t,e){return kt(n,{tick:e,index:t,type:"tick"})}function Go(n,t,e){let i=pi(n);return(e&&t!=="right"||!e&&t==="right")&&(i=$o(i)),i}function qo(n,t,e,i){let{top:s,left:o,bottom:a,right:r,chart:l}=n,{chartArea:h,scales:c}=l,d=0,u,f,g,p=a-s,b=r-o;if(n.isHorizontal()){if(f=H(i,o,r),z(e)){let m=Object.keys(e)[0],x=e[m];g=c[m].getPixelForValue(x)+p-t}else e==="center"?g=(h.bottom+h.top)/2+p-t:g=$i(n,e,t);u=r-o}else{if(z(e)){let m=Object.keys(e)[0],x=e[m];f=c[m].getPixelForValue(x)-b+t}else e==="center"?f=(h.left+h.right)/2-b+t:f=$i(n,e,t);g=H(i,a,s),d=e==="left"?-Q:Q}return{titleX:f,titleY:g,maxWidth:u,rotation:d}}var Mt=class n 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:i,_suggestedMax:s}=this;return t=Z(t,Number.POSITIVE_INFINITY),e=Z(e,Number.NEGATIVE_INFINITY),i=Z(i,Number.POSITIVE_INFINITY),s=Z(s,Number.NEGATIVE_INFINITY),{min:Z(t,i),max:Z(e,s),minDefined:V(t),maxDefined:V(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:e,max:i};let r=this.getMatchingVisibleMetas();for(let l=0,h=r.length;l<h;++l)a=r[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),o||(i=Math.max(i,a.max));return e=o&&e>i?i:e,i=s&&e>i?e:i,{min:Z(e,Z(i,e)),max:Z(i,Z(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){E(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=mn(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r<this.ticks.length;this._convertTicksToLabels(l?Ui(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Vo(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,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){E(this.options.afterUpdate,[this])}beforeSetDimensions(){E(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(){E(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),E(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){E(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=E(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){E(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){E(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,i=Yi(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation,a=s,r,l,h;if(!this._isVisible()||!e.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}let c=this._getLabelSizes(),d=c.widest.width,u=c.highest.height,f=X(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/i:f/(i-1),d+6>r&&(r=f/(i-(t.offset?.5:1)),l=this.maxHeight-Bt(t.grid)-e.padding-Xi(t.title,this.chart.options.font),h=Math.sqrt(d*d+u*u),a=gi(Math.min(Math.asin(X((c.highest.height+6)/r,-1,1)),Math.asin(X(l/h,-1,1))-Math.asin(X(u/h,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){E(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){E(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=Xi(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=Bt(o)+l):(t.height=this.maxHeight,t.width=Bt(o)+l),i.display&&this.ticks.length){let{first:h,last:c,widest:d,highest:u}=this._getLabelSizes(),f=i.padding*2,g=et(this.labelRotation),p=Math.cos(g),b=Math.sin(g);if(r){let m=i.mirror?0:b*d.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+m+f)}else{let m=i.mirror?0:p*d.width+b*u.height;t.width=Math.min(this.maxWidth,t.width+m+f)}this._calculatePadding(h,c,b,p)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,h=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let c=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?h?(u=s*t.width,f=i*e.height):(u=i*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-c+a)*this.width/(this.width-c),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let c=e.height/2,d=t.height/2;o==="start"?(c=0,d=t.height):o==="end"&&(c=e.height,d=0),this.paddingTop=c+a,this.paddingBottom=d+a}}_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(){E(this.options.afterFit,[this])}isHorizontal(){let{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,i;for(e=0,i=t.length;e<i;e++)O(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=Ui(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){let{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/Yi(e,i)),h=0,c=0,d,u,f,g,p,b,m,x,v,y,_;for(d=0;d<e;d+=l){if(g=t[d].label,p=this._resolveTickFontOptions(d),s.font=b=p.string,m=o[b]=o[b]||{data:{},gc:[]},x=p.lineHeight,v=y=0,!O(g)&&!G(g))v=vi(s,m.data,m.gc,v,g),y=x;else if(G(g))for(u=0,f=g.length;u<f;++u)_=g[u],!O(_)&&!G(_)&&(v=vi(s,m.data,m.gc,v,_),y+=x);a.push(v),r.push(y),h=Math.max(v,h),c=Math.max(y,c)}Uo(o,e);let M=a.indexOf(h),k=r.indexOf(c),S=w=>({width:a[w]||0,height:r[w]||0});return{first:S(0),last:S(e-1),widest:S(M),highest:S(k),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return bn(this._alignToPixels?pt(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&t<e.length){let i=e[t];return i.$context||(i.$context=Ko(this.getContext(),t,i))}return this.$context||(this.$context=Xo(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=et(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*i>r*s?r/i:l/s:l*s<r*i?l/i:r/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,i=this.chart,s=this.options,{grid:o,position:a,border:r}=s,l=o.offset,h=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=Bt(o),f=[],g=r.setContext(this.getContext()),p=g.display?g.width:0,b=p/2,m=function(R){return pt(i,R,p)},x,v,y,_,M,k,S,w,D,P,C,N;if(a==="top")x=m(this.bottom),k=this.bottom-u,w=x-b,P=m(t.top)+b,N=t.bottom;else if(a==="bottom")x=m(this.top),P=t.top,N=m(t.bottom)-b,k=x+b,w=this.top+u;else if(a==="left")x=m(this.right),M=this.right-u,S=x-b,D=m(t.left)+b,C=t.right;else if(a==="right")x=m(this.left),D=t.left,C=m(t.right)-b,M=x+b,S=this.left+u;else if(e==="x"){if(a==="center")x=m((t.top+t.bottom)/2+.5);else if(z(a)){let R=Object.keys(a)[0],F=a[R];x=m(this.chart.scales[R].getPixelForValue(F))}P=t.top,N=t.bottom,k=x+b,w=k+u}else if(e==="y"){if(a==="center")x=m((t.left+t.right)/2);else if(z(a)){let R=Object.keys(a)[0],F=a[R];x=m(this.chart.scales[R].getPixelForValue(F))}M=x-b,S=M-u,D=t.left,C=t.right}let J=A(s.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/J));for(v=0;v<d;v+=T){let R=this.getContext(v),F=o.setContext(R),tt=r.setContext(R),W=F.lineWidth,St=F.color,te=tt.dash||[],wt=tt.dashOffset,Rt=F.tickWidth,ft=F.tickColor,It=F.tickBorderDash||[],gt=F.tickBorderDashOffset;y=Yo(this,v,l),y!==void 0&&(_=pt(i,y,W),h?M=S=D=C=_:k=w=P=N=_,f.push({tx1:M,ty1:k,tx2:S,ty2:w,x1:D,y1:P,x2:C,y2:N,width:W,color:St,borderDash:te,borderDashOffset:wt,tickWidth:Rt,tickColor:ft,tickBorderDash:It,tickBorderDashOffset:gt}))}return this._ticksLength=d,this._borderValue=x,f}_computeLabelItems(t){let e=this.axis,i=this.options,{position:s,ticks:o}=i,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:h,padding:c,mirror:d}=o,u=Bt(i.grid),f=u+c,g=d?-c:f,p=-et(this.labelRotation),b=[],m,x,v,y,_,M,k,S,w,D,P,C,N="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"){let T=this._getYAxisLabelAlignment(u);k=T.textAlign,_=T.x}else if(s==="right"){let T=this._getYAxisLabelAlignment(u);k=T.textAlign,_=T.x}else if(e==="x"){if(s==="center")M=(t.top+t.bottom)/2+f;else if(z(s)){let T=Object.keys(s)[0],R=s[T];M=this.chart.scales[T].getPixelForValue(R)+f}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")_=(t.left+t.right)/2-f;else if(z(s)){let T=Object.keys(s)[0],R=s[T];_=this.chart.scales[T].getPixelForValue(R)}k=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?N="top":l==="end"&&(N="bottom"));let J=this._getLabelSizes();for(m=0,x=r.length;m<x;++m){v=r[m],y=v.label;let T=o.setContext(this.getContext(m));S=this.getPixelForTick(m)+o.labelOffset,w=this._resolveTickFontOptions(m),D=w.lineHeight,P=G(y)?y.length:1;let R=P/2,F=T.color,tt=T.textStrokeColor,W=T.textStrokeWidth,St=k;a?(_=S,k==="inner"&&(m===x-1?St=this.options.reverse?"left":"right":m===0?St=this.options.reverse?"right":"left":St="center"),s==="top"?h==="near"||p!==0?C=-P*D+D/2:h==="center"?C=-J.highest.height/2-R*D+D:C=-J.highest.height+D/2:h==="near"||p!==0?C=D/2:h==="center"?C=J.highest.height/2-R*D:C=J.highest.height-P*D,d&&(C*=-1),p!==0&&!T.showLabelBackdrop&&(_+=D/2*Math.sin(p))):(M=S,C=(1-P)*D/2);let te;if(T.showLabelBackdrop){let wt=Y(T.backdropPadding),Rt=J.heights[m],ft=J.widths[m],It=C-wt.top,gt=0-wt.left;switch(N){case"middle":It-=Rt/2;break;case"bottom":It-=Rt;break}switch(k){case"center":gt-=ft/2;break;case"right":gt-=ft;break;case"inner":m===x-1?gt-=ft:m>0&&(gt-=ft/2);break}te={left:gt,top:It,width:ft+wt.width,height:Rt+wt.height,color:T.backdropColor}}b.push({label:y,font:w,textOffset:C,options:{rotation:p,color:F,strokeColor:tt,strokeWidth:W,textAlign:St,textBaseline:N,translation:[_,M],backdrop:te}})}return b}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-et(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){let{position:e,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width,h,c;return e==="left"?s?(c=this.right+o,i==="near"?h="left":i==="center"?(h="center",c+=l/2):(h="right",c+=l)):(c=this.right-r,i==="near"?h="right":i==="center"?(h="center",c-=l/2):(h="left",c=this.left)):e==="right"?s?(c=this.left+o,i==="near"?h="right":i==="center"?(h="center",c-=l/2):(h="left",c-=l)):(c=this.left+r,i==="near"?h="left":i==="center"?(h="center",c+=l/2):(h="right",c=this.right)):h="right",{textAlign:h,x:c}}_computeLabelArea(){if(this.options.ticks.mirror)return;let 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(){let{ctx:t,options:{backgroundColor:e},left:i,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,o,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,h,c)=>{!c.width||!c.color||(i.save(),i.lineWidth=c.width,i.strokeStyle=c.color,i.setLineDash(c.borderDash||[]),i.lineDashOffset=c.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(h.x,h.y),i.stroke(),i.restore())};if(e.display)for(o=0,a=s.length;o<a;++o){let l=s[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({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(){let{chart:t,ctx:e,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),a=i.display?o.width:0;if(!a)return;let r=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue,h,c,d,u;this.isHorizontal()?(h=pt(t,this.left,a)-a/2,c=pt(t,this.right,r)+r/2,d=u=l):(d=pt(t,this.top,a)-a/2,u=pt(t,this.bottom,r)+r/2,h=c=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(h,d),e.lineTo(c,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;let i=this.ctx,s=this._computeLabelArea();s&&ve(i,s);let o=this.getLabelItems(t);for(let a of o){let r=a.options,l=a.font,h=a.label,c=a.textOffset;vt(i,h,0,c,l,r)}s&&Me(i)}drawTitle(){let{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;let o=B(i.font),a=Y(i.padding),r=i.align,l=o.lineHeight/2;e==="bottom"||e==="center"||z(e)?(l+=a.bottom,G(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=a.top;let{titleX:h,titleY:c,maxWidth:d,rotation:u}=qo(this,l,e,r);vt(t,i.text,0,0,o,{color:i.color,maxWidth:d,rotation:u,textAlign:Go(r,e,s),textBaseline:"middle",translation:[h,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,i=A(t.grid&&t.grid.z,-1),s=A(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==n.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[],o,a;for(o=0,a=e.length;o<a;++o){let r=e[o];r[i]===this.id&&(!t||r.type===t)&&s.push(r)}return s}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return B(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},Pt=class{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),i;Qo(e)&&(i=this.register(e));let s=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Jo(t,a,i),this.override&&I.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in I[s]&&(delete I[s][i],this.override&&delete Lt[i])}};function Jo(n,t,e){let i=xn(Object.create(null),[e?I.get(e):{},I.get(t),n.defaults]);I.set(t,i),n.defaultRoutes&&Zo(t,n.defaultRoutes),n.descriptors&&I.describe(t,n.descriptors)}function Zo(n,t){Object.keys(t).forEach(e=>{let i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");I.route(o,s,l,r)})}function Qo(n){return"id"in n&&"defaults"in n}var qe=class{constructor(){this.controllers=new Pt(ot,"datasets",!0),this.elements=new Pt(it,"elements"),this.plugins=new Pt(Object,"plugins"),this.scales=new Pt(Mt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{let o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):L(s,a=>{let r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){let s=_n(t);E(i["before"+s],[],i),e[t](i),E(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}},nt=new qe,Je=class{constructor(){this._init=void 0}notify(t,e,i,s){if(e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;let o=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(o,t,e,i);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,i,s){s=s||{};for(let o of t){let a=o.plugin,r=a[i],l=[e,s,o.options];if(E(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){O(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let i=t&&t.config,s=A(i.options&&i.options.plugins,{}),o=ta(i);return s===!1&&!e?[]:ia(t,o,s,e)}_notifyStateChanges(t){let e=this._oldCache||[],i=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};function ta(n){let t={},e=[],i=Object.keys(nt.plugins.items);for(let o=0;o<i.length;o++)e.push(nt.getPlugin(i[o]));let s=n.plugins||[];for(let o=0;o<s.length;o++){let a=s[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function ea(n,t){return!t&&n===!1?null:n===!0?{}:n}function ia(n,{plugins:t,localIds:e},i,s){let o=[],a=n.getContext();for(let r of t){let l=r.id,h=ea(i[l],s);h!==null&&o.push({plugin:r,options:sa(n.config,{plugin:r,local:e[l]},h,a)})}return o}function sa(n,{plugin:t,local:e},i,s){let o=n.pluginScopeKeys(t),a=n.getOptionScopes(i,o);return e&&t.defaults&&a.push(t.defaults),n.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ze(n,t){let e=I.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function na(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function oa(n,t){return n===t?"_index_":"_value_"}function Ki(n){if(n==="x"||n==="y"||n==="r")return n}function aa(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Qe(n,...t){if(Ki(n))return n;for(let e of t){let i=e.axis||aa(e.position)||n.length>1&&Ki(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function Gi(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function ra(n,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return Gi(n,"x",e[0])||Gi(n,"y",e[0])}return{}}function la(n,t){let e=Lt[n.type]||{scales:{}},i=t.scales||{},s=Ze(n.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{let r=i[a];if(!z(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);let l=Qe(a,r,ra(a,n),I.scales[r.type]),h=oa(l,s),c=e.scales||{};o[a]=re(Object.create(null),[{axis:l},r,c[l],c[h]])}),n.data.datasets.forEach(a=>{let r=a.type||n.type,l=a.indexAxis||Ze(r,t),c=(Lt[r]||{}).scales||{};Object.keys(c).forEach(d=>{let u=na(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),re(o[f],[{axis:u},i[f],c[d]])})}),Object.keys(o).forEach(a=>{let r=o[a];re(r,[I.scales[r.type],I.scale])}),o}function Xs(n){let t=n.options||(n.options={});t.plugins=A(t.plugins,{}),t.scales=la(n,t)}function Ks(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function ha(n){return n=n||{},n.data=Ks(n.data),Xs(n),n}var qi=new Map,Gs=new Set;function se(n,t){let e=qi.get(n);return e||(e=t(),qi.set(n,e),Gs.add(e)),e}var Nt=(n,t,e)=>{let i=Ct(t,e);i!==void 0&&n.add(i)},ti=class{constructor(t){this._config=ha(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=Ks(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),Xs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return se(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return se(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return se(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return se(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:s,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;let l=new Set;e.forEach(c=>{t&&(l.add(t),c.forEach(d=>Nt(l,t,d))),c.forEach(d=>Nt(l,s,d)),c.forEach(d=>Nt(l,Lt[o]||{},d)),c.forEach(d=>Nt(l,I,d)),c.forEach(d=>Nt(l,Mi,d))});let h=Array.from(l);return h.length===0&&h.push(Object.create(null)),Gs.has(e)&&a.set(e,h),h}chartOptionScopes(){let{options:t,type:e}=this;return[t,Lt[e]||{},I.datasets[e]||{},{type:e},I,Mi]}resolveNamedOptions(t,e,i,s=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=Ji(this._resolverCache,t,s),l=a;if(da(a,e)){o.$shared=!1,i=ke(i)?i():i;let h=this.createResolver(t,i,r);l=ki(a,i,h)}for(let h of e)o[h]=l[h];return o}createResolver(t,e,i=[""],s){let{resolver:o}=Ji(this._resolverCache,t,i);return z(e)?ki(o,e,void 0,s):o}};function Ji(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));let s=e.join(),o=i.get(s);return o||(o={resolver:yn(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,o)),o}var ca=n=>z(n)&&Object.getOwnPropertyNames(n).some(t=>ke(n[t]));function da(n,t){let{isScriptable:e,isIndexable:i}=vn(n);for(let s of t){let o=e(s),a=i(s),r=(a||o)&&n[s];if(o&&(ke(r)||ca(r))||a&&G(r))return!0}return!1}var ua="4.5.1",fa=["top","bottom","left","right","chartArea"];function Zi(n,t){return n==="top"||n==="bottom"||fa.indexOf(n)===-1&&t==="x"}function Qi(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function ts(n){let t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),E(e&&e.onComplete,[n],t)}function ga(n){let t=n.chart,e=t.options.animation;E(e&&e.onProgress,[n],t)}function qs(n){return Is()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}var he={},es=n=>{let t=qs(n);return Object.values(he).filter(e=>e.canvas===t).pop()};function pa(n,t,e){let i=Object.keys(n);for(let s of i){let o=+s;if(o>=t){let a=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=a)}}}function ma(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}var ei=class{static defaults=I;static instances=he;static overrides=Lt;static registry=nt;static version=ua;static getChart=es;static register(...t){nt.add(...t),is()}static unregister(...t){nt.remove(...t),is()}constructor(t,e){let i=this.config=new ti(e),s=qs(t),o=es(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.");let a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Fo(s)),this.platform.updateConfig(i);let r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,h=l&&l.height,c=l&&l.width;if(this.id=Mn(),this.ctx=r,this.canvas=l,this.width=c,this.height=h,this._options=a,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 Je,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=kn(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],he[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}rt.listen(this,"complete",ts),rt.listen(this,"progress",ga),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return O(t)?e&&o?o:s?i/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 nt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Si(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return wi(this.canvas,this.ctx),this}stop(){return rt.stop(this),this}resize(t,e){rt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Si(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),E(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};L(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=Qe(a,r),h=l==="r",c=l==="x";return{options:r,dposition:h?"chartArea":c?"bottom":"left",dtype:h?"radialLinear":c?"category":"linear"}}))),L(o,a=>{let r=a.options,l=r.id,h=Qe(l,r),c=A(r.type,a.dtype);(r.position===void 0||Zi(r.position,h)!==Zi(a.dposition))&&(r.position=a.dposition),s[l]=!0;let d=null;if(l in i&&i[l].type===c)d=i[l];else{let u=nt.getScale(c);d=new u({id:l,type:c,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(r,t)}),L(s,(a,r)=>{a||delete i[r]}),L(i,a=>{$.configure(this,a,a.options),$.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Qi("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){let o=e[i],a=this.getDatasetMeta(i),r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=r,a.indexAxis=o.indexAxis||Ze(r,this.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{let l=nt.getController(r),{datasetElementType:h,dataElementType:c}=I.datasets[r];Object.assign(l,{dataElementType:nt.getElement(c),datasetElementType:h&&nt.getElement(h)}),a.controller=new l(this,i),t.push(a.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){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let h=0,c=this.data.datasets.length;h<c;h++){let{controller:d}=this.getDatasetMeta(h),u=!s&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||L(o,h=>{h.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Qi("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){L(this.scales,t=>{$.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Di(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:o}of e){let a=i==="_removeElements"?-o:o;pa(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=i(0);for(let o=1;o<e;o++)if(!Di(s,i(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;$.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],L(this.boxes,s=>{i&&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,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,ke(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(rt.has(this)?this.attached&&!rt.running(this)&&rt.start(this):(this.draw(),ts({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let 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){let e=this._sortedMetasets,i=[],s,o;for(s=0,o=e.length;s<o;++s){let a=e[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=zs(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&ve(e,s),t.controller.draw(),s&&Me(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return _t(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let o=xo.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.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},i.push(s)),s}getContext(){return this.$context||(this.$context=kt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let s=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Yt(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),rt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),wi(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete he[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,e=this.platform,i=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};L(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,h)=>{e.addEventListener(this,l,h),t[l]=h},s=(l,h)=>{t[l]&&(e.removeEventListener(this,l,h),delete t[l])},o=(l,h)=>{this.canvas&&this.resize(l,h)},a,r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}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,i){let s=i?"set":"remove",o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];let h=a&&this.getDatasetMeta(a.datasetIndex).controller;h&&h[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],i=t.map(({datasetIndex:o,index:a})=>{let r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!de(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){let s=this.options.hover,o=(l,h)=>l.filter(c=>!h.some(d=>c.datasetIndex===d.datasetIndex&&c.index===d.index)),a=o(e,t),r=i?t:o(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:s=[],options:o}=this,a=e,r=this._getActiveElements(t,s,i,a),l=Sn(t),h=ma(t,this._lastEvent,i,l);i&&(this._lastEvent=null,E(o.onHover,[t,r,this],this),l&&E(o.onClick,[t,r,this],this));let c=!de(r,s);return(c||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=h,c}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function is(){return L(ei.instances,n=>n._plugins.invalidate())}function ba(n,t,e){let{startAngle:i,x:s,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:h,borderJoinStyle:c}=l,d=Math.min(h/a,ut(i-e));if(n.beginPath(),n.arc(s,o,a-h/2,i+d/2,e-d/2),r>0){let u=Math.min(h/r,ut(i-e));n.arc(s,o,r+h/2,e-u/2,i+u/2,!0)}else{let u=Math.min(h/2,a*ut(i-e));if(c==="round")n.arc(s,o,u,e-j/2,i+j/2,!0);else if(c==="bevel"){let f=2*u*u,g=-f*Math.cos(e+j/2)+s,p=-f*Math.sin(e+j/2)+o,b=f*Math.cos(i+j/2)+s,m=f*Math.sin(i+j/2)+o;n.lineTo(g,p),n.lineTo(b,m)}}n.closePath(),n.moveTo(0,0),n.rect(0,0,n.canvas.width,n.canvas.height),n.clip("evenodd")}function xa(n,t,e){let{startAngle:i,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t,h=s/r;n.beginPath(),n.arc(o,a,r,i-h,e+h),l>s?(h=s/l,n.arc(o,a,l,e+h,i-h,!0)):n.arc(o,a,s,e+Q,i-Q),n.closePath(),n.clip()}function _a(n){return wn(n,["outerStart","outerEnd","innerStart","innerEnd"])}function ya(n,t,e,i){let s=_a(n.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),r=l=>{let h=(e-Math.min(o,l))*i/2;return X(l,0,Math.min(o,h))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:X(s.innerStart,0,a),innerEnd:X(s.innerEnd,0,a)}}function Dt(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function me(n,t,e,i,s,o){let{x:a,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=t,d=Math.max(t.outerRadius+i+e-h,0),u=c>0?c+i+e+h:0,f=0,g=s-l;if(i){let T=c>0?c-i:0,R=d>0?d-i:0,F=(T+R)/2,tt=F!==0?g*F/(F+i):g;f=(g-tt)/2}let p=Math.max(.001,g*d-e/j)/d,b=(g-p)/2,m=l+b+f,x=s-b-f,{outerStart:v,outerEnd:y,innerStart:_,innerEnd:M}=ya(t,u,d,x-m),k=d-v,S=d-y,w=m+v/k,D=x-y/S,P=u+_,C=u+M,N=m+_/P,J=x-M/C;if(n.beginPath(),o){let T=(w+D)/2;if(n.arc(a,r,d,w,T),n.arc(a,r,d,T,D),y>0){let W=Dt(S,D,a,r);n.arc(W.x,W.y,y,D,x+Q)}let R=Dt(C,x,a,r);if(n.lineTo(R.x,R.y),M>0){let W=Dt(C,J,a,r);n.arc(W.x,W.y,M,x+Q,J+Math.PI)}let F=(x-M/u+(m+_/u))/2;if(n.arc(a,r,u,x-M/u,F,!0),n.arc(a,r,u,F,m+_/u,!0),_>0){let W=Dt(P,N,a,r);n.arc(W.x,W.y,_,N+Math.PI,m-Q)}let tt=Dt(k,m,a,r);if(n.lineTo(tt.x,tt.y),v>0){let W=Dt(k,w,a,r);n.arc(W.x,W.y,v,m-Q,w)}}else{n.moveTo(a,r);let T=Math.cos(w)*d+a,R=Math.sin(w)*d+r;n.lineTo(T,R);let F=Math.cos(D)*d+a,tt=Math.sin(D)*d+r;n.lineTo(F,tt)}n.closePath()}function va(n,t,e,i,s){let{fullCircles:o,startAngle:a,circumference:r}=t,l=t.endAngle;if(o){me(n,t,e,i,l,s);for(let h=0;h<o;++h)n.fill();isNaN(r)||(l=a+(r%U||U))}return me(n,t,e,i,l,s),n.fill(),l}function Ma(n,t,e,i,s){let{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:h,borderJoinStyle:c,borderDash:d,borderDashOffset:u,borderRadius:f}=l,g=l.borderAlign==="inner";if(!h)return;n.setLineDash(d||[]),n.lineDashOffset=u,g?(n.lineWidth=h*2,n.lineJoin=c||"round"):(n.lineWidth=h,n.lineJoin=c||"bevel");let p=t.endAngle;if(o){me(n,t,e,i,p,s);for(let b=0;b<o;++b)n.stroke();isNaN(r)||(p=a+(r%U||U))}g&&xa(n,t,p),l.selfJoin&&p-a>=j&&f===0&&c!=="miter"&&ba(n,t,p),o||(me(n,t,e,i,p,s),n.stroke())}var ii=class extends it{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.getProps(["x","y"],i),{angle:o,distance:a}=Ts(s,{x:t,y:e}),{startAngle:r,endAngle:l,innerRadius:h,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,f=A(d,l-r),g=ce(o,r,l)&&r!==l,p=f>=U||g,b=ht(a,h+u,c+u);return p&&b}getCenterPoint(t){let{x:e,y:i,startAngle:s,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:h}=this.options,c=(s+o)/2,d=(a+r+h+l)/2;return{x:e+Math.cos(c)*d,y:i+Math.sin(c)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,s=(e.offset||0)/4,o=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>U?Math.floor(i/U):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*s,Math.sin(r)*s);let l=1-Math.sin(Math.min(j,i||0)),h=s*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,va(t,this,h,o,a),Ma(t,this,h,o,a),t.restore()}};function Js(n,t,e=t){n.lineCap=A(e.borderCapStyle,t.borderCapStyle),n.setLineDash(A(e.borderDash,t.borderDash)),n.lineDashOffset=A(e.borderDashOffset,t.borderDashOffset),n.lineJoin=A(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=A(e.borderWidth,t.borderWidth),n.strokeStyle=A(e.borderColor,t.borderColor)}function ka(n,t,e){n.lineTo(e.x,e.y)}function Sa(n){return n.stepped?Ln:n.tension||n.cubicInterpolationMode==="monotone"?Tn:ka}function Zs(n,t,e={}){let i=n.length,{start:s=0,end:o=i-1}=e,{start:a,end:r}=t,l=Math.max(s,a),h=Math.min(o,r),c=s<a&&o<a||s>r&&o>r;return{count:i,start:l,loop:t.loop,ilen:h<l&&!c?i+h-l:h-l}}function wa(n,t,e,i){let{points:s,options:o}=t,{count:a,start:r,loop:l,ilen:h}=Zs(s,e,i),c=Sa(o),{move:d=!0,reverse:u}=i||{},f,g,p;for(f=0;f<=h;++f)g=s[(r+(u?h-f:f))%a],!g.skip&&(d?(n.moveTo(g.x,g.y),d=!1):c(n,p,g,u,o.stepped),p=g);return l&&(g=s[(r+(u?h:0))%a],c(n,p,g,u,o.stepped)),!!l}function Da(n,t,e,i){let s=t.points,{count:o,start:a,ilen:r}=Zs(s,e,i),{move:l=!0,reverse:h}=i||{},c=0,d=0,u,f,g,p,b,m,x=y=>(a+(h?r-y:y))%o,v=()=>{p!==b&&(n.lineTo(c,b),n.lineTo(c,p),n.lineTo(c,m))};for(l&&(f=s[x(0)],n.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=s[x(u)],f.skip)continue;let y=f.x,_=f.y,M=y|0;M===g?(_<p?p=_:_>b&&(b=_),c=(d*c+y)/++d):(v(),n.lineTo(y,_),g=M,d=0,p=b=_),m=_}v()}function si(n){let t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Da:wa}function Pa(n){return n.stepped?An:n.tension||n.cubicInterpolationMode==="monotone"?Cn:On}function Aa(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Js(n,t.options),n.stroke(s)}function Ca(n,t,e,i){let{segments:s,options:o}=t,a=si(t);for(let r of s)Js(n,o,r.style),n.beginPath(),a(n,t,r,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}var Oa=typeof Path2D=="function";function La(n,t,e,i){Oa&&!t.options.segment?Aa(n,t,e,i):Ca(n,t,e,i)}var Tt=class extends it{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let s=i.spanGaps?this._loop:this._fullLoop;Dn(this._points,i,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=Pn(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,s=t[e],o=this.points,a=Fs(this,{property:e,start:s,end:s});if(!a.length)return;let r=[],l=Pa(i),h,c;for(h=0,c=a.length;h<c;++h){let{start:d,end:u}=a[h],f=o[d],g=o[u];if(f===g){r.push(f);continue}let p=Math.abs((s-f[e])/(g[e]-f[e])),b=l(f,g,p,i.stepped);b[e]=t[e],r.push(b)}return r.length===1?r[0]:r}pathSegment(t,e,i){return si(this)(t,this,e,i)}path(t,e,i){let s=this.segments,o=si(this),a=this._loop;e=e||0,i=i||this.points.length-e;for(let r of s)a&=o(t,this,r,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),La(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function ss(n,t,e,i){let s=n.options,{[e]:o}=n.getProps([e],i);return Math.abs(t-o)<s.radius+s.hitRadius}var ni=class extends it{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.options,{x:o,y:a}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return ss(this,t,"x",e)}inYRange(t,e){return ss(this,t,"y",e)}getCenterPoint(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);let i=e&&t.borderWidth||0;return(e+i)*2}draw(t,e){let i=this.options;this.skip||i.radius<.1||!_t(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Ve(t,i,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}};function Qs(n,t){let{x:e,y:i,base:s,width:o,height:a}=n.getProps(["x","y","base","width","height"],t),r,l,h,c,d;return n.horizontal?(d=a/2,r=Math.min(e,s),l=Math.max(e,s),h=i-d,c=i+d):(d=o/2,r=e-d,l=e+d,h=Math.min(i,s),c=Math.max(i,s)),{left:r,top:h,right:l,bottom:c}}function ct(n,t,e,i){return n?0:X(t,e,i)}function Ta(n,t,e){let i=n.options.borderWidth,s=n.borderSkipped,o=En(i);return{t:ct(s.top,o.top,0,e),r:ct(s.right,o.right,0,t),b:ct(s.bottom,o.bottom,0,e),l:ct(s.left,o.left,0,t)}}function Ea(n,t,e){let{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,o=yt(s),a=Math.min(t,e),r=n.borderSkipped,l=i||z(s);return{topLeft:ct(!l||r.top||r.left,o.topLeft,0,a),topRight:ct(!l||r.top||r.right,o.topRight,0,a),bottomLeft:ct(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:ct(!l||r.bottom||r.right,o.bottomRight,0,a)}}function Ra(n){let t=Qs(n),e=t.right-t.left,i=t.bottom-t.top,s=Ta(n,e/2,i/2),o=Ea(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-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 Re(n,t,e,i){let s=t===null,o=e===null,r=n&&!(s&&o)&&Qs(n,i);return r&&(s||ht(t,r.left,r.right))&&(o||ht(e,r.top,r.bottom))}function Ia(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function za(n,t){n.rect(t.x,t.y,t.w,t.h)}function Ie(n,t,e={}){let i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,o=(n.x+n.w!==e.x+e.w?t:0)-i,a=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+o,h:n.h+a,radius:n.radius}}var oi=class extends it{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};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){let{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:o,outer:a}=Ra(this),r=Ia(a.radius)?Xt:za;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,Ie(a,e,o)),t.clip(),r(t,Ie(o,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,Ie(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Re(this,t,e,i)}inXRange(t,e){return Re(this,t,null,e)}inYRange(t,e){return Re(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}},Fa=Object.freeze({__proto__:null,ArcElement:ii,BarElement:oi,LineElement:Tt,PointElement:ni}),ai=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],ns=ai.map(n=>n.replace("rgb(","rgba(").replace(")",", 0.5)"));function tn(n){return ai[n%ai.length]}function en(n){return ns[n%ns.length]}function Va(n,t){return n.borderColor=tn(t),n.backgroundColor=en(t),++t}function Ba(n,t){return n.backgroundColor=n.data.map(()=>tn(t++)),t}function Na(n,t){return n.backgroundColor=n.data.map(()=>en(t++)),t}function Wa(n){let t=0;return(e,i)=>{let s=n.getDatasetMeta(i).controller;s instanceof Kt?t=Ba(e,t):s instanceof fe?t=Na(e,t):s&&(t=Va(e,t))}}function os(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Ha(n){return n&&(n.borderColor||n.backgroundColor)}function ja(){return I.borderColor!=="rgba(0,0,0,0.1)"||I.backgroundColor!=="rgba(0,0,0,0.1)"}var $a={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;let{data:{datasets:i},options:s}=n.config,{elements:o}=s,a=os(i)||Ha(s)||o&&os(o)||ja();if(!e.forceOverride&&a)return;let r=Wa(n);i.forEach(r)}};function Ya(n,t,e,i,s){let o=s.samples||i;if(o>=e)return n.slice(t,t+e);let a=[],r=(e-2)/(o-2),l=0,h=t+e-1,c=t,d,u,f,g,p;for(a[l++]=n[c],d=0;d<o-2;d++){let b=0,m=0,x,v=Math.floor((d+1)*r)+1+t,y=Math.min(Math.floor((d+2)*r)+1,e)+t,_=y-v;for(x=v;x<y;x++)b+=n[x].x,m+=n[x].y;b/=_,m/=_;let M=Math.floor(d*r)+1+t,k=Math.min(Math.floor((d+1)*r)+1,e)+t,{x:S,y:w}=n[c];for(f=g=-1,x=M;x<k;x++)g=.5*Math.abs((S-b)*(n[x].y-w)-(S-n[x].x)*(m-w)),g>f&&(f=g,u=n[x],p=x);a[l++]=u,c=p}return a[l++]=n[h],a}function Ua(n,t,e,i){let s=0,o=0,a,r,l,h,c,d,u,f,g,p,b=[],m=t+e-1,x=n[t].x,y=n[m].x-x;for(a=t;a<t+e;++a){r=n[a],l=(r.x-x)/y*i,h=r.y;let _=l|0;if(_===c)h<g?(g=h,d=a):h>p&&(p=h,u=a),s=(o*s+r.x)/++o;else{let M=a-1;if(!O(d)&&!O(u)){let k=Math.min(d,u),S=Math.max(d,u);k!==f&&k!==M&&b.push({...n[k],x:s}),S!==f&&S!==M&&b.push({...n[S],x:s})}a>0&&M!==f&&b.push(n[M]),b.push(r),c=_,o=0,g=p=h,d=u=f=a}}return b}function sn(n){if(n._decimated){let t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function as(n){n.data.datasets.forEach(t=>{sn(t)})}function Xa(n,t){let e=t.length,i=0,s,{iScale:o}=n,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(i=X(Ut(t,o.axis,a).lo,0,e-1)),h?s=X(Ut(t,o.axis,r).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var Ka={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){as(n);return}let i=n.width;n.data.datasets.forEach((s,o)=>{let{_data:a,indexAxis:r}=s,l=n.getDatasetMeta(o),h=a||s.data;if(Wt([r,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let c=n.scales[l.xAxisID];if(c.type!=="linear"&&c.type!=="time"||n.options.parsing)return;let{start:d,count:u}=Xa(l,h),f=e.threshold||4*i;if(u<=f){sn(s);return}O(a)&&(s._data=h,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=Ya(h,d,u,i,e);break;case"min-max":g=Ua(h,d,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(n){as(n)}};function Ga(n,t,e){let i=n.segments,s=n.points,o=t.points,a=[];for(let r of i){let{start:l,end:h}=r;h=Se(l,h,s);let c=ri(e,s[l],s[h],r.loop);if(!t.segments){a.push({source:r,target:c,start:s[l],end:s[h]});continue}let d=Fs(t,c);for(let u of d){let f=ri(e,o[u.start],o[u.end],u.loop),g=Rn(r,s,f);for(let p of g)a.push({source:p,target:u,start:{[e]:rs(c,f,"start",Math.max)},end:{[e]:rs(c,f,"end",Math.min)}})}}return a}function ri(n,t,e,i){if(i)return;let s=t[n],o=e[n];return n==="angle"&&(s=ut(s),o=ut(o)),{property:n,start:s,end:o}}function qa(n,t){let{x:e=null,y:i=null}=n||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Se(a,r,s);let l=s[a],h=s[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:h.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:h.y}))}),o}function Se(n,t,e){for(;t>n;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function rs(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function nn(n,t){let e=[],i=!1;return G(n)?(i=!0,e=n):e=qa(n,t),e.length?new Tt({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function ls(n){return n&&n.fill!==!1}function Ja(n,t,e){let s=n[t].fill,o=[t],a;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!V(s))return s;if(a=n[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function Za(n,t,e){let i=ir(n);if(z(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return V(s)&&Math.floor(s)===s?Qa(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Qa(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function tr(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:z(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function er(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:z(n)?i=n.value:i=t.getBaseValue(),i}function ir(n){let t=n.options,e=t.fill,i=A(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function sr(n){let{scale:t,index:e,line:i}=n,s=[],o=i.segments,a=i.points,r=nr(t,e);r.push(nn({x:null,y:t.bottom},i));for(let l=0;l<o.length;l++){let h=o[l];for(let c=h.start;c<=h.end;c++)or(s,a[c],r)}return new Tt({points:s,options:{}})}function nr(n,t){let e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){let o=i[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function or(n,t,e){let i=[];for(let s=0;s<e.length;s++){let o=e[s],{first:a,last:r,point:l}=ar(o,t,"x");if(!(!l||a&&r)){if(a)i.unshift(l);else if(n.push(l),!r)break}}n.push(...i)}function ar(n,t,e){let i=n.interpolate(t,e);if(!i)return{};let s=i[e],o=n.segments,a=n.points,r=!1,l=!1;for(let h=0;h<o.length;h++){let c=o[h],d=a[c.start][e],u=a[c.end][e];if(ht(s,d,u)){r=s===d,l=s===u;break}}return{first:r,last:l,point:i}}var be=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:s,y:o,radius:a}=this;return e=e||{start:0,end:U},t.arc(s,o,a,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}};function rr(n){let{chart:t,fill:e,line:i}=n;if(V(e))return lr(t,e);if(e==="stack")return sr(n);if(e==="shape")return!0;let s=hr(n);return s instanceof be?s:nn(s,i)}function lr(n,t){let e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function hr(n){return(n.scale||{}).getPointPositionForValue?dr(n):cr(n)}function cr(n){let{scale:t={},fill:e}=n,i=tr(e,t);if(V(i)){let s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function dr(n){let{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,a=er(e,t,o),r=[];if(i.grid.circular){let l=t.getPointPositionForValue(0,o);return new be({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)r.push(t.getPointPositionForValue(l,a));return r}function ze(n,t,e){let i=rr(t),{chart:s,index:o,line:a,scale:r,axis:l}=t,h=a.options,c=h.fill,d=h.backgroundColor,{above:u=d,below:f=d}=c||{},g=s.getDatasetMeta(o),p=zs(s,g);i&&a.points.length&&(ve(n,e),ur(n,{line:a,target:i,above:u,below:f,area:e,scale:r,axis:l,clip:p}),Me(n))}function ur(n,t){let{line:e,target:i,above:s,below:o,area:a,scale:r,clip:l}=t,h=e._loop?"angle":t.axis;n.save();let c=o;o!==s&&(h==="x"?(hs(n,i,a.top),Fe(n,{line:e,target:i,color:s,scale:r,property:h,clip:l}),n.restore(),n.save(),hs(n,i,a.bottom)):h==="y"&&(cs(n,i,a.left),Fe(n,{line:e,target:i,color:o,scale:r,property:h,clip:l}),n.restore(),n.save(),cs(n,i,a.right),c=s)),Fe(n,{line:e,target:i,color:c,scale:r,property:h,clip:l}),n.restore()}function hs(n,t,e){let{segments:i,points:s}=t,o=!0,a=!1;n.beginPath();for(let r of i){let{start:l,end:h}=r,c=s[l],d=s[Se(l,h,s)];o?(n.moveTo(c.x,c.y),o=!1):(n.lineTo(c.x,e),n.lineTo(c.x,c.y)),a=!!t.pathSegment(n,r,{move:a}),a?n.closePath():n.lineTo(d.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function cs(n,t,e){let{segments:i,points:s}=t,o=!0,a=!1;n.beginPath();for(let r of i){let{start:l,end:h}=r,c=s[l],d=s[Se(l,h,s)];o?(n.moveTo(c.x,c.y),o=!1):(n.lineTo(e,c.y),n.lineTo(c.x,c.y)),a=!!t.pathSegment(n,r,{move:a}),a?n.closePath():n.lineTo(e,d.y)}n.lineTo(e,t.first().y),n.closePath(),n.clip()}function Fe(n,t){let{line:e,target:i,property:s,color:o,scale:a,clip:r}=t,l=Ga(e,i,s);for(let{source:h,target:c,start:d,end:u}of l){let{style:{backgroundColor:f=o}={}}=h,g=i!==!0;n.save(),n.fillStyle=f,fr(n,a,r,g&&ri(s,d,u)),n.beginPath();let p=!!e.pathSegment(n,h),b;if(g){p?n.closePath():ds(n,i,u,s);let m=!!i.pathSegment(n,c,{move:p,reverse:!0});b=p&&m,b||ds(n,i,d,s)}n.closePath(),n.fill(b?"evenodd":"nonzero"),n.restore()}}function fr(n,t,e,i){let s=t.chart.chartArea,{property:o,start:a,end:r}=i||{};if(o==="x"||o==="y"){let l,h,c,d;o==="x"?(l=a,h=s.top,c=r,d=s.bottom):(l=s.left,h=a,c=s.right,d=r),n.beginPath(),e&&(l=Math.max(l,e.left),c=Math.min(c,e.right),h=Math.max(h,e.top),d=Math.min(d,e.bottom)),n.rect(l,h,c-l,d-h),n.clip()}}function ds(n,t,e,i){let s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}var gr={id:"filler",afterDatasetsUpdate(n,t,e){let i=(n.data.datasets||[]).length,s=[],o,a,r,l;for(a=0;a<i;++a)o=n.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof Tt&&(l={visible:n.isDatasetVisible(a),index:a,fill:Za(r,a,i),chart:n,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=Ja(s,a,e.propagate))},beforeDraw(n,t,e){let i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),o=n.chartArea;for(let a=s.length-1;a>=0;--a){let r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&ze(n.ctx,r,o))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){let o=i[s].$filler;ls(o)&&ze(n.ctx,o,n.chartArea)}},beforeDatasetDraw(n,t,e){let i=t.meta.$filler;!ls(i)||e.drawTime!=="beforeDatasetDraw"||ze(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},us=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},pr=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index,xe=class 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,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=E(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,s=B(i.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=us(i,o),h,c;e.font=s.string,this.isHorizontal()?(h=this.maxWidth,c=this._fitRows(a,o,r,l)+10):(c=this.maxHeight,h=this._fitCols(a,s,r,l)+10),this.width=Math.min(h,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],h=this.lineWidths=[0],c=s+r,d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-c;return this.legendItems.forEach((g,p)=>{let b=i+e/2+o.measureText(g.text).width;(p===0||h[h.length-1]+b+2*r>a)&&(d+=c,h[h.length-(p>0?0:1)]=0,f+=c,u++),l[p]={left:0,top:f,row:u,width:b,height:s},h[h.length-1]+=b+r}),d}_fitCols(t,e,i,s){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],h=this.columnSizes=[],c=a-t,d=r,u=0,f=0,g=0,p=0;return this.legendItems.forEach((b,m)=>{let{itemWidth:x,itemHeight:v}=mr(i,e,o,b,s);m>0&&f+v+2*r>c&&(d+=u+r,h.push({width:u,height:f}),g+=u+r,p++,u=f=0),l[m]={left:g,top:f,col:p,width:x,height:v},u=Math.max(u,x),f+=v+r}),d+=u,h.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,a=At(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=H(i,this.left+s,this.right-this.lineWidths[r]);for(let h of e)r!==h.row&&(r=h.row,l=H(i,this.left+s,this.right-this.lineWidths[r])),h.top+=this.top+t+s,h.left=a.leftForLtr(a.x(l),h.width),l+=h.width+s}else{let r=0,l=H(i,this.top+t+s,this.bottom-this.columnSizes[r].height);for(let h of e)h.col!==r&&(r=h.col,l=H(i,this.top+t+s,this.bottom-this.columnSizes[r].height)),h.top=l,h.left+=this.left+s,h.left=a.leftForLtr(a.x(h.left),h.width),l+=h.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;ve(t,this),this._draw(),Me(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:a}=t,r=I.color,l=At(t.rtl,this.left,this.width),h=B(a.font),{padding:c}=a,d=h.size,u=d/2,f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=h.string;let{boxWidth:g,boxHeight:p,itemHeight:b}=us(a,d),m=function(M,k,S){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();let w=A(S.lineWidth,1);if(s.fillStyle=A(S.fillStyle,r),s.lineCap=A(S.lineCap,"butt"),s.lineDashOffset=A(S.lineDashOffset,0),s.lineJoin=A(S.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=A(S.strokeStyle,r),s.setLineDash(A(S.lineDash,[])),a.usePointStyle){let D={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:w},P=l.xPlus(M,g/2),C=k+u;zn(s,D,P,C,a.pointStyleWidth&&g)}else{let D=k+Math.max((d-p)/2,0),P=l.leftForLtr(M,g),C=yt(S.borderRadius);s.beginPath(),Object.values(C).some(N=>N!==0)?Xt(s,{x:P,y:D,w:g,h:p,radius:C}):s.rect(P,D,g,p),s.fill(),w!==0&&s.stroke()}s.restore()},x=function(M,k,S){vt(s,S.text,M,k+b/2,h,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();v?f={x:H(o,this.left+c,this.right-i[0]),y:this.top+c+y,line:0}:f={x:this.left+c,y:H(o,this.top+y+c,this.bottom-e[0].height),line:0},Vs(this.ctx,t.textDirection);let _=b+c;this.legendItems.forEach((M,k)=>{s.strokeStyle=M.fontColor,s.fillStyle=M.fontColor;let S=s.measureText(M.text).width,w=l.textAlign(M.textAlign||(M.textAlign=a.textAlign)),D=g+u+S,P=f.x,C=f.y;l.setWidth(this.width),v?k>0&&P+D+c>this.right&&(C=f.y+=_,f.line++,P=f.x=H(o,this.left+c,this.right-i[f.line])):k>0&&C+_>this.bottom&&(P=f.x=P+e[f.line].width+c,f.line++,C=f.y=H(o,this.top+y+c,this.bottom-e[f.line].height));let N=l.x(P);if(m(N,C,M),P=In(w,P+g+u,v?P+D:this.right,t.rtl),x(l.x(P),C,M),v)f.x+=D+c;else if(typeof M.text!="string"){let J=h.lineHeight;f.y+=on(M,J)+c}else f.y+=_}),Bs(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=B(e.font),s=Y(e.padding);if(!e.display)return;let o=At(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.size/2,h=s.top+l,c,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),c=this.top+h,d=H(t.align,d,this.right-u);else{let g=this.columnSizes.reduce((p,b)=>Math.max(p,b.height),0);c=h+H(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}let f=H(r,d,d+u);a.textAlign=o.textAlign(pi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,vt(a,e.text,f,c,i)}_computeTitleHeight(){let t=this.options.title,e=B(t.font),i=Y(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if(ht(t,this.left,this.right)&&ht(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],ht(t,s.left,s.left+s.width)&&ht(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){let e=this.options;if(!_r(t.type,e))return;let i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,o=pr(s,i);s&&!o&&E(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&E(e.onHover,[t,i,this],this)}else i&&E(e.onClick,[t,i,this],this)}};function mr(n,t,e,i,s){let o=br(i,n,t,e),a=xr(s,i,t.lineHeight);return{itemWidth:o,itemHeight:a}}function br(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+i.measureText(s).width}function xr(n,t,e){let i=n;return typeof t.text!="string"&&(i=on(t,e)),i}function on(n,t){let e=n.text?n.text.length:0;return t*e}function _r(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var yr={id:"legend",_element:xe,start(n,t,e){let i=n.legend=new xe({ctx:n.ctx,options:e,chart:n});$.configure(n,i,e),$.addBox(n,i)},stop(n){$.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){let i=n.legend;$.configure(n,i,e),i.options=e},afterUpdate(n){let t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){let i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){let t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{let h=l.controller.getStyle(e?0:void 0),c=Y(h.borderWidth);return{text:t[l.index].label,fillStyle:h.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:h.borderCapStyle,lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:h.borderColor,pointStyle:i||h.pointStyle,rotation:h.rotation,textAlign:s||h.textAlign,borderRadius:a&&(r||h.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}},qt=class 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){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let s=G(i.text)?i.text.length:1;this._padding=Y(i.padding);let o=s*B(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:i,bottom:s,right:o,options:a}=this,r=a.align,l=0,h,c,d;return this.isHorizontal()?(c=H(r,i,o),d=e+t,h=o-i):(a.position==="left"?(c=i+t,d=H(r,s,e),l=j*-.5):(c=o-t,d=H(r,e,s),l=j*.5),h=s-e),{titleX:c,titleY:d,maxWidth:h,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=B(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:h}=this._drawArgs(o);vt(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:h,textAlign:pi(e.align),textBaseline:"middle",translation:[a,r]})}};function vr(n,t){let e=new qt({ctx:n.ctx,options:t,chart:n});$.configure(n,e,t),$.addBox(n,e),n.titleBlock=e}var Mr={id:"title",_element:qt,start(n,t,e){vr(n,e)},stop(n){let t=n.titleBlock;$.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){let i=n.titleBlock;$.configure(n,i,e),i.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}},ne=new WeakMap,kr={id:"subtitle",start(n,t,e){let i=new qt({ctx:n.ctx,options:e,chart:n});$.configure(n,i,e),$.addBox(n,i),ne.set(n,i)},stop(n){$.removeBox(n,ne.get(n)),ne.delete(n)},beforeUpdate(n,t,e){let i=ne.get(n);$.configure(n,i,e),i.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}},$t={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,o=0;for(t=0,e=n.length;t<e;++t){let r=n[t].element;if(r&&r.hasValue()){let l=r.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((r,l)=>r+l)/i.size,y:s/o}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=n.length;o<a;++o){let l=n[o].element;if(l&&l.hasValue()){let h=l.getCenterPoint(),c=Fn(t,h);c<s&&(s=c,r=l)}}if(r){let l=r.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function st(n,t){return t&&(G(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function lt(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
|
|
`)>-1?n.split(`
|
|
`):n}function Sr(n,t){let{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:n,label:a,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function fs(n,t){let e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:a,boxHeight:r}=t,l=B(t.bodyFont),h=B(t.titleFont),c=B(t.footerFont),d=o.length,u=s.length,f=i.length,g=Y(t.padding),p=g.height,b=0,m=i.reduce((y,_)=>y+_.before.length+_.lines.length+_.after.length,0);if(m+=n.beforeBody.length+n.afterBody.length,d&&(p+=d*h.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),m){let y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;p+=f*y+(m-f)*l.lineHeight+(m-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*c.lineHeight+(u-1)*t.footerSpacing);let x=0,v=function(y){b=Math.max(b,e.measureText(y).width+x)};return e.save(),e.font=h.string,L(n.title,v),e.font=l.string,L(n.beforeBody.concat(n.afterBody),v),x=t.displayColors?a+2+t.boxPadding:0,L(i,y=>{L(y.before,v),L(y.lines,v),L(y.after,v)}),x=0,e.font=c.string,L(n.footer,v),e.restore(),b+=g.width,{width:b,height:p}}function wr(n,t){let{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function Dr(n,t,e,i){let{x:s,width:o}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+o+a>t.width||n==="right"&&s-o-a<0)return!0}function Pr(n,t,e,i){let{x:s,width:o}=e,{width:a,chartArea:{left:r,right:l}}=n,h="center";return i==="center"?h=s<=(r+l)/2?"left":"right":s<=o/2?h="left":s>=a-o/2&&(h="right"),Dr(h,n,t,e)&&(h="center"),h}function gs(n,t,e){let i=e.yAlign||t.yAlign||wr(n,e);return{xAlign:e.xAlign||t.xAlign||Pr(n,t,e,i),yAlign:i}}function Ar(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Cr(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function ps(n,t,e,i){let{caretSize:s,caretPadding:o,cornerRadius:a}=n,{xAlign:r,yAlign:l}=e,h=s+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=yt(a),g=Ar(t,r),p=Cr(t,l,h);return l==="center"?r==="left"?g+=h:r==="right"&&(g-=h):r==="left"?g-=Math.max(c,u)+s:r==="right"&&(g+=Math.max(d,f)+s),{x:X(g,0,i.width-t.width),y:X(p,0,i.height-t.height)}}function oe(n,t,e){let i=Y(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function ms(n){return st([],lt(n))}function Or(n,t,e){return kt(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function bs(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}var an={beforeTitle:at,title(n){if(n.length>0){let t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:at,beforeBody:at,beforeLabel:at,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");let e=n.formattedValue;return O(e)||(t+=e),t},labelColor(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.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(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:at,afterBody:at,beforeFooter:at,footer:at,afterFooter:at};function K(n,t,e,i){let s=n[t].call(e,i);return typeof s>"u"?an[t].call(e,i):s}var _e=class extends it{static positioners=$t;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(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new ue(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Or(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,s=K(i,"beforeTitle",this,t),o=K(i,"title",this,t),a=K(i,"afterTitle",this,t),r=[];return r=st(r,lt(s)),r=st(r,lt(o)),r=st(r,lt(a)),r}getBeforeBody(t,e){return ms(K(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:i}=e,s=[];return L(t,o=>{let a={before:[],lines:[],after:[]},r=bs(i,o);st(a.before,lt(K(r,"beforeLabel",this,o))),st(a.lines,K(r,"label",this,o)),st(a.after,lt(K(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return ms(K(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,s=K(i,"beforeFooter",this,t),o=K(i,"footer",this,t),a=K(i,"afterFooter",this,t),r=[];return r=st(r,lt(s)),r=st(r,lt(o)),r=st(r,lt(a)),r}_createItems(t){let e=this._active,i=this.chart.data,s=[],o=[],a=[],r=[],l,h;for(l=0,h=e.length;l<h;++l)r.push(Sr(this.chart,e[l]));return t.filter&&(r=r.filter((c,d,u)=>t.filter(c,d,u,i))),t.itemSort&&(r=r.sort((c,d)=>t.itemSort(c,d,i))),L(r,c=>{let d=bs(t.callbacks,c);s.push(K(d,"labelColor",this,c)),o.push(K(d,"labelPointStyle",this,c)),a.push(K(d,"labelTextColor",this,c))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){let i=this.options.setContext(this.getContext()),s=this._active,o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let r=$t[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=fs(this,i),h=Object.assign({},r,l),c=gs(this.chart,i,h),d=ps(i,h,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:h,bottomLeft:c,bottomRight:d}=yt(r),{x:u,y:f}=t,{width:g,height:p}=e,b,m,x,v,y,_;return o==="center"?(y=f+p/2,s==="left"?(b=u,m=b-a,v=y+a,_=y-a):(b=u+g,m=b+a,v=y-a,_=y+a),x=b):(s==="left"?m=u+Math.max(l,c)+a:s==="right"?m=u+g-Math.max(h,d)-a:m=this.caretX,o==="top"?(v=f,y=v-a,b=m-a,x=m+a):(v=f+p,y=v+a,b=m+a,x=m-a),_=v),{x1:b,x2:m,x3:x,y1:v,y2:y,y3:_}}drawTitle(t,e,i){let s=this.title,o=s.length,a,r,l;if(o){let h=At(i.rtl,this.x,this.width);for(t.x=oe(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",a=B(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(s[l],h.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,s,o){let a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:h}=o,c=B(o.bodyFont),d=oe(this,"left",o),u=s.x(d),f=l<c.lineHeight?(c.lineHeight-l)/2:0,g=e.y+f;if(o.usePointStyle){let p={radius:Math.min(h,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},b=s.leftForLtr(u,h)+h/2,m=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ve(t,p,b,m),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Ve(t,p,b,m)}else{t.lineWidth=z(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let p=s.leftForLtr(u,h),b=s.leftForLtr(s.xPlus(u,1),h-2),m=yt(a.borderRadius);Object.values(m).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Xt(t,{x:p,y:g,w:h,h:l,radius:m}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Xt(t,{x:b,y:g+1,w:h-2,h:l-2,radius:m}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,h,l),t.strokeRect(p,g,h,l),t.fillStyle=a.backgroundColor,t.fillRect(b,g+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:h,boxPadding:c}=i,d=B(i.bodyFont),u=d.lineHeight,f=0,g=At(i.rtl,this.x,this.width),p=function(S){e.fillText(S,g.x(t.x+f),t.y+u/2),t.y+=u+o},b=g.textAlign(a),m,x,v,y,_,M,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=oe(this,b,i),e.fillStyle=i.bodyColor,L(this.beforeBody,p),f=r&&b!=="right"?a==="center"?h/2+c:h+2+c:0,y=0,M=s.length;y<M;++y){for(m=s[y],x=this.labelTextColors[y],e.fillStyle=x,L(m.before,p),v=m.lines,r&&v.length&&(this._drawColorBox(e,t,y,g,i),u=Math.max(d.lineHeight,l)),_=0,k=v.length;_<k;++_)p(v[_]),u=d.lineHeight;L(m.after,p)}f=0,u=d.lineHeight,L(this.afterBody,p),t.y-=o}drawFooter(t,e,i){let s=this.footer,o=s.length,a,r;if(o){let l=At(i.rtl,this.x,this.width);for(t.x=oe(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=B(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){let{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:h,height:c}=i,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=yt(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(r+d,l),a==="top"&&this.drawCaret(t,e,i,s),e.lineTo(r+h-u,l),e.quadraticCurveTo(r+h,l,r+h,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,i,s),e.lineTo(r+h,l+c-g),e.quadraticCurveTo(r+h,l+c,r+h-g,l+c),a==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(r+f,l+c),e.quadraticCurveTo(r,l+c,r,l+c-f),a==="center"&&o==="left"&&this.drawCaret(t,e,i,s),e.lineTo(r,l+d),e.quadraticCurveTo(r,l,r+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){let a=$t[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=fs(this,t),l=Object.assign({},a,this._size),h=gs(e,t,l),c=ps(t,l,h,e);(s._to!==c.x||o._to!==c.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let a=Y(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,e),Vs(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Bs(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,s=t.map(({datasetIndex:r,index:l})=>{let h=this.chart.getDatasetMeta(r);if(!h)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:h.data[l],index:l}}),o=!de(i,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!de(a,o)||r;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){let o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:s,options:o}=this,a=$t[o.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}},Lr={id:"tooltip",_element:_e,positioners:$t,afterInit(n,t,e){e&&(n.tooltip=new _e({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){let t=n.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){let e=t.replay;n.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:(n,t)=>t.bodyFont.size,boxWidth:(n,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:an},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Tr=Object.freeze({__proto__:null,Colors:$a,Decimation:Ka,Filler:gr,Legend:yr,SubTitle:kr,Title:Mr,Tooltip:Lr}),Er=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Rr(n,t,e,i){let s=n.indexOf(t);if(s===-1)return Er(n,t,e,i);let o=n.lastIndexOf(t);return s!==o?e:s}var Ir=(n,t)=>n===null?null:X(Math.round(n),0,t);function xs(n){let t=this.getLabels();return n>=0&&n<t.length?t[n]:n}var li=class extends Mt{static id="category";static defaults={ticks:{callback:xs}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:s,label:o}of e)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(O(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:Rr(i,t,A(e,t),this._addedLabels),Ir(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,s=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return xs.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){let 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}};function zr(n,t){let e=[],{bounds:s,step:o,min:a,max:r,precision:l,count:h,maxTicks:c,maxDigits:d,includeBounds:u}=n,f=o||1,g=c-1,{min:p,max:b}=t,m=!O(a),x=!O(r),v=!O(h),y=(b-p)/(d+1),_=Pi((b-p)/g/f)*f,M,k,S,w;if(_<1e-14&&!m&&!x)return[{value:p},{value:b}];w=Math.ceil(b/_)-Math.floor(p/_),w>g&&(_=Pi(w*_/g/f)*f),O(l)||(M=Math.pow(10,l),_=Math.ceil(_*M)/M),s==="ticks"?(k=Math.floor(p/_)*_,S=Math.ceil(b/_)*_):(k=p,S=b),m&&x&&o&&Vn((r-a)/o,_/1e3)?(w=Math.round(Math.min((r-a)/_,c)),_=(r-a)/w,k=a,S=r):v?(k=m?a:k,S=x?r:S,w=h-1,_=(S-k)/w):(w=(S-k)/_,De(w,Math.round(w),_/1e3)?w=Math.round(w):w=Math.ceil(w));let D=Math.max(Ai(_),Ai(k));M=Math.pow(10,O(l)?D:l),k=Math.round(k*M)/M,S=Math.round(S*M)/M;let P=0;for(m&&(u&&k!==a?(e.push({value:a}),k<a&&P++,De(Math.round((k+P*_)*M)/M,a,_s(a,y,n))&&P++):k<a&&P++);P<w;++P){let C=Math.round((k+P*_)*M)/M;if(x&&C>r)break;e.push({value:C})}return x&&u&&S!==r?e.length&&De(e[e.length-1].value,r,_s(r,y,n))?e[e.length-1].value=r:e.push({value:r}):(!x||S===r)&&e.push({value:S}),e}function _s(n,t,{horizontal:e,minRotation:i}){let s=et(i),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/o,a)}var Et=class extends Mt{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 O(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:s,max:o}=this,a=l=>s=e?s:l,r=l=>o=i?o:l;if(t){let l=dt(s),h=dt(o);l<0&&h<0?r(0):l>0&&h>0&&a(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(s-l)}this.min=s,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} 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(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=zr(s,o);return t.bounds==="ticks"&&Ns(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ye(t,this.chart.options.locale,this.options.ticks.format)}},hi=class extends Et{static id="linear";static defaults={ticks:{callback:mi.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=et(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.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}},Jt=n=>Math.floor(Ht(n)),bt=(n,t)=>Math.pow(10,Jt(n)+t);function ys(n){return n/Math.pow(10,Jt(n))===1}function vs(n,t,e){let i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function Fr(n,t){let e=t-n,i=Jt(e);for(;vs(n,t,i)>10;)i++;for(;vs(n,t,i)<10;)i--;return Math.min(i,Jt(n))}function Vr(n,{min:t,max:e}){t=Z(n.min,t);let i=[],s=Jt(t),o=Fr(t,e),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=s>o?Math.pow(10,s):0,h=Math.round((t-l)*a)/a,c=Math.floor((t-l)/r/10)*r*10,d=Math.floor((h-c)/Math.pow(10,o)),u=Z(n.min,Math.round((l+c+d*Math.pow(10,o))*a)/a);for(;u<e;)i.push({value:u,major:ys(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+c+d*Math.pow(10,o))*a)/a;let f=Z(n.max,u);return i.push({value:f,major:ys(f),significand:d}),i}var ci=class extends Mt{static id="logarithmic";static defaults={ticks:{callback:mi.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=Et.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return V(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?Math.max(0,t):null,this.max=V(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!V(this._userMin)&&(this.min=t===bt(this.min,0)?bt(this.min,-1):bt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,s=this.max,o=r=>i=t?i:r,a=r=>s=e?s:r;i===s&&(i<=0?(o(1),a(10)):(o(bt(i,-1)),a(bt(s,1)))),i<=0&&o(bt(s,-1)),s<=0&&a(bt(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=Vr(e,this);return t.bounds==="ticks"&&Ns(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":ye(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=Ht(t),this._valueRange=Ht(this.max)-Ht(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ht(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function di(n){let t=n.ticks;if(t.display&&n.display){let e=Y(t.backdropPadding);return A(t.font&&t.font.size,I.font.size)+e.height}return 0}function Br(n,t,e){return e=G(e)?e:[e],{w:Bn(n,t.string,e),h:e.length*t.lineHeight}}function Ms(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function Nr(n){let t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,a=n.options.pointLabels,r=a.centerPointLabels?j/o:0;for(let l=0;l<o;l++){let h=a.setContext(n.getPointLabelContext(l));s[l]=h.padding;let c=n.getPointPosition(l,n.drawingArea+s[l],r),d=B(h.font),u=Br(n.ctx,d,n._pointLabels[l]);i[l]=u;let f=ut(n.getIndexAngle(l)+r),g=Math.round(gi(f)),p=Ms(g,c.x,u.w,0,180),b=Ms(g,c.y,u.h,90,270);Wr(e,t,f,p,b)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=$r(n,i,s)}function Wr(n,t,e,i,s){let o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),r=0,l=0;i.start<t.l?(r=(t.l-i.start)/o,n.l=Math.min(n.l,t.l-r)):i.end>t.r&&(r=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,n.b=Math.max(n.b,t.b+l))}function Hr(n,t,e){let i=n.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=e,l=n.getPointPosition(t,i+s+a,o),h=Math.round(gi(ut(l.angle+Q))),c=Xr(l.y,r.h,h),d=Yr(h),u=Ur(l.x,r.w,d);return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+r.w,bottom:c+r.h}}function jr(n,t){if(!t)return!0;let{left:e,top:i,right:s,bottom:o}=n;return!(_t({x:e,y:i},t)||_t({x:e,y:o},t)||_t({x:s,y:i},t)||_t({x:s,y:o},t))}function $r(n,t,e){let i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:di(o)/2,additionalAngle:a?j/s:0},h;for(let c=0;c<s;c++){l.padding=e[c],l.size=t[c];let d=Hr(n,c,l);i.push(d),r==="auto"&&(d.visible=jr(d,h),d.visible&&(h=d))}return i}function Yr(n){return n===0||n===180?"center":n<180?"left":"right"}function Ur(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function Xr(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function Kr(n,t,e){let{left:i,top:s,right:o,bottom:a}=e,{backdropColor:r}=t;if(!O(r)){let l=yt(t.borderRadius),h=Y(t.backdropPadding);n.fillStyle=r;let c=i-h.left,d=s-h.top,u=o-i+h.width,f=a-s+h.height;Object.values(l).some(g=>g!==0)?(n.beginPath(),Xt(n,{x:c,y:d,w:u,h:f,radius:l}),n.fill()):n.fillRect(c,d,u,f)}}function Gr(n,t){let{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){let o=n._pointLabelItems[s];if(!o.visible)continue;let a=i.setContext(n.getPointLabelContext(s));Kr(e,a,o);let r=B(a.font),{x:l,y:h,textAlign:c}=o;vt(e,n._pointLabels[s],l,h+r.lineHeight/2,r,{color:a.color,textAlign:c,textBaseline:"middle"})}}function rn(n,t,e,i){let{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,U);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<i;a++)o=n.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function qr(n,t,e,i,s){let o=n.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!i||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),rn(n,e,a,i),o.closePath(),o.stroke(),o.restore())}function Jr(n,t,e){return kt(n,{label:e,index:t,type:"pointLabel"})}var ui=class extends Et{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:mi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=Y(di(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=V(t)&&!isNaN(t)?t:0,this.max=V(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/di(this.options))}generateTickLabels(t){Et.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let s=E(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?Nr(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=U/(this._pointLabels.length||1),i=this.options.startAngle||0;return ut(t*e+et(i))}getDistanceFromCenterForValue(t){if(O(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(O(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){let i=e[t];return Jr(this.getContext(),t,i)}}getPointPosition(t,e,i=0){let s=this.getIndexAngle(t)-Q+i;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){let{left:e,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),rn(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:i,grid:s,border:o}=e,a=this._pointLabels.length,r,l,h;if(e.pointLabels.display&&Gr(this,a),s.display&&this.ticks.forEach((c,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(c.value);let u=this.getContext(d),f=s.setContext(u),g=o.setContext(u);qr(this,f,l,a,g)}}),i.display){for(t.save(),r=a-1;r>=0;r--){let c=i.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=c;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),h=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(h.x,h.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let s=this.getIndexAngle(0),o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let h=i.setContext(this.getContext(l)),c=B(h.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),h.showLabelBackdrop){t.font=c.string,a=t.measureText(r.label).width,t.fillStyle=h.backdropColor;let d=Y(h.backdropPadding);t.fillRect(-a/2-d.left,-o-c.size/2-d.top,a+d.width,c.size+d.height)}vt(t,r.label,0,-o,c,{color:h.color,strokeColor:h.textStrokeColor,strokeWidth:h.textStrokeWidth})}),t.restore()}drawTitle(){}},we={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}},q=Object.keys(we);function ks(n,t){return n-t}function Ss(n,t){if(O(t))return null;let e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts,a=t;return typeof i=="function"&&(a=i(a)),V(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Ot(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function ws(n,t,e,i){let s=q.length;for(let o=q.indexOf(n);o<s-1;++o){let a=we[q[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=i)return q[o]}return q[s-1]}function Zr(n,t,e,i,s){for(let o=q.length-1;o>=q.indexOf(e);o--){let a=q[o];if(we[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return q[e?q.indexOf(e):0]}function Qr(n){for(let t=q.indexOf(n)+1,e=q.length;t<e;++t)if(we[q[t]].common)return q[t]}function Ds(n,t,e){if(!e)n[t]=!0;else if(e.length){let{lo:i,hi:s}=Wn(e,t),o=e[i]>=t?e[i]:e[s];n[o]=!0}}function tl(n,t,e,i){let s=n._adapter,o=+s.startOf(t[0].value,i),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+s.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function Ps(n,t,e){let i=[],s={},o=t.length,a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,i.push({value:r,major:!1});return o===0||!e?i:tl(n,i,s,e)}var Zt=class extends Mt{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let i=t.time||(t.time={}),s=this._adapter=new fo._date(t.adapters.date);s.init(e),re(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Ss(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:s,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(h){!a&&!isNaN(h.min)&&(s=Math.min(s,h.min)),!r&&!isNaN(h.max)&&(o=Math.max(o,h.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=V(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),o=V(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,s=i.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]);let o=this.min,a=this.max,r=Nn(s,o,a);return this._unit=e.unit||(i.autoSkip?ws(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Zr(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Qr(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),Ps(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=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?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=X(e,0,a),i=X(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,a=o.unit||ws(o.minUnit,e,i,this._getLabelCapacity(e)),r=A(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,h=Ot(l)||l===!0,c={},d=e,u,f;if(h&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,h?"day":a),t.diff(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);let g=s.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<i;u=+t.add(u,r,a),f++)Ds(c,u,g);return(u===i||s.bounds==="ticks"||f===1)&&Ds(c,u,g),Object.keys(c).sort(ks).map(p=>+p)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let s=this.options.time.displayFormats,o=this._unit,a=e||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,s){let o=this.options,a=o.ticks.callback;if(a)return E(a,[t,e,i],this);let r=o.time.displayFormats,l=this._unit,h=this._majorUnit,c=l&&r[l],d=h&&r[h],u=i[e],f=h&&d&&u&&u.major;return this._adapter.format(t,s||(f?d:c))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++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){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,s=et(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*a,h:i*a+r*o}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,Ps(this,[t],this._majorUnit),s),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,i;if(t.length)return t;let s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Ss(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return As(t.sort(ks))}};function ae(n,t,e){let i=0,s=n.length-1,o,a,r,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ut(n,"pos",t)),{pos:o,time:r}=n[i],{pos:a,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ut(n,"time",t)),{time:o,pos:r}=n[i],{time:a,pos:l}=n[s]);let h=a-o;return h?r+(l-r)*(t-o)/h:r}var fi=class extends Zt{static id="timeseries";static defaults=Zt.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=ae(e,this.min),this._tableRange=ae(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,s=[],o=[],a,r,l,h,c;for(a=0,r=t.length;a<r;++a)h=t[a],h>=e&&h<=i&&s.push(h);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,r=s.length;a<r;++a)c=s[a+1],l=s[a-1],h=s[a],Math.round((c+l)/2)!==h&&o.push({time:h,pos:a/(r-1)});return o}_generate(){let t=this.min,e=this.max,i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(ae(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return ae(this._table,i*this._tableRange+this._minPos,!0)}},el=Object.freeze({__proto__:null,CategoryScale:li,LinearScale:hi,LogarithmicScale:ci,RadialLinearScale:ui,TimeScale:Zt,TimeSeriesScale:fi}),nl=[uo,Fa,Tr,el];export{Ne as Animation,ue as Animations,ii as ArcElement,We as BarController,oi as BarElement,ge as BasePlatform,Ke as BasicPlatform,He as BubbleController,li as CategoryScale,ei as Chart,$a as Colors,ot as DatasetController,Ka as Decimation,Ge as DomPlatform,Kt as DoughnutController,it as Element,gr as Filler,xo as Interaction,yr as Legend,je as LineController,Tt as LineElement,hi as LinearScale,ci as LogarithmicScale,$e as PieController,ni as PointElement,fe as PolarAreaController,Ye as RadarController,ui as RadialLinearScale,Mt as Scale,Ue as ScatterController,kr as SubTitle,mi as Ticks,Zt as TimeScale,fi as TimeSeriesScale,Mr as Title,Lr as Tooltip,fo as _adapters,Fo as _detectPlatform,rt as animator,uo as controllers,I as defaults,Fa as elements,$ as layouts,Tr as plugins,nl as registerables,nt as registry,el as scales};
|
|
/*! Bundled license information:
|
|
|
|
chart.js/dist/chart.js:
|
|
(*!
|
|
* Chart.js v4.5.1
|
|
* https://www.chartjs.org
|
|
* (c) 2025 Chart.js Contributors
|
|
* Released under the MIT License
|
|
*)
|
|
*/
|
|
//chart.mjs.map
|