!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,function(){var a=Object.freeze({__proto__:null,get Colors(){return hr},get Decimation(){return ur},get Filler(){return Sr},get Legend(){return Or},get SubTitle(){return Er},get Title(){return Tr},get Tooltip(){return Yr}});function t(){}let F=(()=>{let t=0;return()=>t++})();function P(t){return null==t}function O(t){return!(!Array.isArray||!Array.isArray(t))||"[object"===(t=Object.prototype.toString.call(t)).slice(0,7)&&"Array]"===t.slice(-6)}function A(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function p(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function u(t,e){return p(t)?t:e}function T(t,e){return void 0===t?e:t}let V=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,B=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function c(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function k(t,e,i,a){let s,r,n;if(O(t))if(r=t.length,a)for(s=r-1;0<=s;s--)e.call(i,t[s],s);else for(s=0;st,x:t=>t.x,y:t=>t.y};function q(t){var e=t.split("."),i=[];let a="";for(let t of e)a+=t,a=a.endsWith("\\")?a.slice(0,-1)+".":(i.push(a),"");return i}function f(t,e){return(X[e]||(X[e]=function(){let i=q(e);return t=>{for(var e of i){if(""===e)break;t=t&&t[e]}return t}}()))(t)}function K(t){return t.charAt(0).toUpperCase()+t.slice(1)}let G=t=>void 0!==t,g=t=>"function"==typeof t,Z=(t,e)=>{if(t.size!==e.size)return!1;for(var i of t)if(!e.has(i))return!1;return!0};function J(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}let S=Math.PI,v=2*S,Q=v+S,tt=Number.POSITIVE_INFINITY,et=S/180,D=S/2,it=S/4,at=2*S/3,o=Math.log10,_=Math.sign;function st(t,e,i){return Math.abs(t-e)t-e).pop(),e}function ot(t){return!isNaN(parseFloat(t))&&isFinite(t)}function lt(t,e){var i=Math.round(t);return i-e<=t&&t<=i+e}function ht(t,e,i){let a,s,r;for(a=0,s=t.length;a=Math.min(e,i)-a&&t<=Math.max(e,i)+a}function bt(e,i,t){t=t||(t=>e[t]>1)?r=a:s=a;return{lo:r,hi:s}}let m=(i,a,s,t)=>bt(i,s,t?t=>{var e=i[t][a];return ei[t][a]bt(e,a,t=>e[t][i]>=a);function vt(t,e,i){let a=0,s=t.length;for(;aa&&t[s-1]>i;)s--;return 0{let i="_onData"+K(t),a=s[t];Object.defineProperty(s,t,{configurable:!0,enumerable:!1,value(...e){var t=a.apply(this,e);return s._chartjs.listeners.forEach(t=>{"function"==typeof t[i]&&t[i](...e)}),t}})}))}function Mt(e,t){var i=e._chartjs;i&&(-1!==(t=(i=i.listeners).indexOf(t))&&i.splice(t,1),0{delete e[t]}),delete e._chartjs))}function wt(t){var e=new Set(t);return e.size===t.length?t:Array.from(e)}let kt="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function St(e,i){let a,s=!1;return function(...t){a=t,s||(s=!0,kt.call(window,()=>{s=!1,e.apply(i,a)}))}}function Pt(e,i){let a;return function(...t){return i?(clearTimeout(a),a=setTimeout(e,i,t)):e.apply(this,t),i}}let Dt=t=>"start"===t?"left":"end"===t?"right":"center",E=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,Ct=(t,e,i,a)=>t===(a?"left":"right")?i:"center"===t?(e+i)/2:e;function Ot(t,e,i){var a,s,r,n,o,l,h=e.length;let d=0,c=h;return t._sorted&&({iScale:t,_parsed:a}=t,s=t.axis,{min:r,max:n,minDefined:o,maxDefined:l}=t.getUserBounds(),o&&(d=C(Math.min(m(a,s,r).lo,i?h:m(e,s,t.getPixelForValue(r)).lo),0,h-1)),c=l?C(Math.max(m(a,t.axis,n,!0).hi+1,i?0:m(e,s,t.getPixelForValue(n),!0).hi+1),d,h)-d:h-d),{start:d,count:c}}function At(t){var{xScale:e,yScale:i,_scaleRanges:a}=t,s={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};return a?(e=a.xmin!==e.min||a.xmax!==e.max||a.ymin!==i.min||a.ymax!==i.max,Object.assign(a,s),e):(t._scaleRanges=s,!0)}var r=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,i,a,t){let s=i.listeners[t],r=i.duration;s.forEach(t=>t({chart:e,initial:i.initial,numSteps:r,currentStep:Math.min(a-i.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=kt.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(n=Date.now()){let o=0;this._charts.forEach((a,s)=>{if(a.running&&a.items.length){var r=a.items;let t,e=r.length-1,i=!1;for(;0<=e;--e)(t=r[e])._active?(t._total>a.duration&&(a.duration=t._total),t.tick(n),i=!0):(r[e]=r[r.length-1],r.pop());i&&(s.draw(),this._notify(s,a,n,"progress")),r.length||(a.running=!1,this._notify(s,a,n,"complete"),a.initial=!1),o+=r.length}}),this._lastDate=n,0===o&&(this._running=!1)}_getAnims(t){var e=this._charts;let 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 0Math.max(t,e._duration),0),this._refresh())}running(t){return!!this._running&&!!((t=this._charts.get(t))&&t.running&&t.items.length)}stop(e){var i=this._charts.get(e);if(i&&i.items.length){var a=i.items;let t=a.length-1;for(;0<=t;--t)a[t].cancel();i.items=[],this._notify(e,i,Date.now(),"complete")}}remove(t){return this._charts.delete(t)}};function Tt(t){return t+.5|0}let Lt=(t,e,i)=>Math.max(Math.min(t,i),e);function Et(t){return Lt(Tt(2.55*t),0,255)}function Rt(t){return Lt(Tt(255*t),0,255)}function n(t){return Lt(Tt(t/2.55)/100,0,1)}function It(t){return Lt(Tt(100*t),0,100)}let l={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},zt=[..."0123456789ABCDEF"],Ft=t=>zt[15&t],Vt=t=>zt[(240&t)>>4]+zt[15&t],Bt=t=>(240&t)>>4==(15&t);let Wt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Nt(i,t,a){let s=t*Math.min(a,1-a),e=(t,e=(t+i/30)%12)=>a-s*Math.max(Math.min(e-3,9-e,1),-1);return[e(0),e(8),e(4)]}function Ht(i,a,s){var t=(t,e=(t+i/60)%6)=>s-s*a*Math.max(Math.min(e,4-e,1),0);return[t(5),t(3),t(1)]}function jt(t,e,i){var a=Nt(t,1,.5);let s;for(1t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Qt=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function te(e,i,a){if(e){let t=Yt(e);t[i]=Math.max(0,Math.min(t[i]+t[i]*a,0===i?360:1)),t=Ut(t),e.r=t[0],e.g=t[1],e.b=t[2]}}function ee(t,e){return t&&Object.assign(e||{},t)}function ie(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?3<=t.length&&(e={r:t[0],g:t[1],b:t[2],a:255},3>16&255,r>>8&255,255&r]}return t}()).transparent=[0,0,0,0]),(i=Gt[i.toLowerCase()])&&{r:i[0],g:i[1],b:i[2],a:4===i.length?i[3]:255})||ae(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=ee(this._rgb);return t&&(t.a=n(t.a)),t}set rgb(t){this._rgb=ie(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${n(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid&&(t=this._rgb,e=t,e=Bt(e.r)&&Bt(e.g)&&Bt(e.b)&&Bt(e.a)?Ft:Vt,t)?"#"+e(t.r)+e(t.g)+e(t.b)+((t=t.a)<255?e(t):""):void 0;var t,e}hslString(){if(this._valid){var t,e,i,a=this._rgb;if(a)return t=(i=Yt(a))[0],e=It(i[1]),i=It(i[2]),a.a<255?`hsla(${t}, ${e}%, ${i}%, ${n(a.a)})`:`hsl(${t}, ${e}%, ${i}%)`}}mix(t,e){var i,a,s;return t&&(i=this.rgb,t=t.rgb,s=i.a-t.a,i.r=255&(a=(1+((a=2*(e=void 0===e?.5:e)-1)*s==-1?a:(a+s)/(1+a*s)))/2)*i.r+(s=1-a)*t.r+.5,i.g=255&a*i.g+s*t.g+.5,i.b=255&a*i.b+s*t.b+.5,i.a=e*i.a+(1-e)*t.a,this.rgb=i),this}interpolate(t,e){return t&&(this._rgb=(i=this._rgb,t=t._rgb,e=e,a=Qt(n(i.r)),s=Qt(n(i.g)),r=Qt(n(i.b)),{r:Rt(Jt(a+e*(Qt(n(t.r))-a))),g:Rt(Jt(s+e*(Qt(n(t.g))-s))),b:Rt(Jt(r+e*(Qt(n(t.b))-r))),a:i.a+e*(t.a-i.a)})),this;var i,a,s,r}clone(){return new se(this.rgb)}alpha(t){return this._rgb.a=Rt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){var t=this._rgb,e=Tt(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){var t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return te(this._rgb,2,t),this}darken(t){return te(this._rgb,2,-t),this}saturate(t){return te(this._rgb,1,t),this}desaturate(t){return te(this._rgb,1,-t),this}rotate(t){return e=this._rgb,t=t,(i=Yt(e))[0]=Xt(i[0]+t),i=Ut(i),e.r=i[0],e.g=i[1],e.b=i[2],this;var e,i}}function re(t){return!(!t||"object"!=typeof t||"[object CanvasPattern]"!==(t=t.toString())&&"[object CanvasGradient]"!==t)}function ne(t){return re(t)?t:new se(t)}function oe(t){return re(t)?t:new se(t).saturate(.5).darken(.1).hexString()}let le=["x","y","borderWidth","radius","tension"],he=["color","borderColor","backgroundColor"],de=new Map;function ce(t,e,s){return function(t,e){e=s||{};var i=t+JSON.stringify(e);let a=de.get(i);return a||(a=new Intl.NumberFormat(t,e),de.set(i,a)),a}(e).format(t)}let ue={values:t=>O(t)?t:""+t,numeric(e,t,i){if(0===e)return"0";var a=this.chart.options.locale;let s,r=e;if(1.8*i.length?ue.numeric.call(this,t,e,i):"")}};var ge={formatters:ue};let fe=Object.create(null),pe=Object.create(null);function me(i,t){if(t){var a=t.split(".");for(let t=0,e=a.length;tt.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>oe(e.backgroundColor),this.hoverBorderColor=(t,e)=>oe(e.borderColor),this.hoverColor=(t,e)=>oe(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return be(this,t,e)}get(t){return me(this,t)}describe(t,e){return be(pe,t,e)}override(t,e){return be(fe,t,e)}route(t,e,i,a){let s=me(this,t),r=me(this,i),n="_"+e;Object.defineProperties(s,{[n]:{value:s[e],writable:!0},[e]:{enumerable:!0,get(){var t=this[n],e=r[a];return A(t)?Object.assign({},e,t):T(t,e)},set(t){this[n]=t}}})}apply(t){t.forEach(t=>t(this))}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:he},numbers:{type:"number",properties:le}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ge.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function xe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ve(t){let e=t.parentNode;return e=e&&"[object ShadowRoot]"===e.toString()?e.host:e}function _e(t,e,i){let a;return"string"==typeof t?(a=parseInt(t,10),-1!==t.indexOf("%")&&(a=a/100*e.parentNode[i])):a=t,a}let ye=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function Me(t,e){return ye(t).getPropertyValue(e)}let we=["top","right","bottom","left"];function ke(e,i,a){var s={};a=a?"-"+a:"";for(let t=0;t<4;t++){var r=we[t];s[r]=parseFloat(e[i+"-"+r+a])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function Se(t,e){if("native"in t)return t;var{canvas:i,currentDevicePixelRatio:a}=e,s=ye(i),r="border-box"===s.boxSizing,n=ke(s,"padding"),s=ke(s,"border","width"),{x:t,y:o,box:l}=function(t,e){var i,a=t.touches,a=a&&a.length?a[0]:t,{offsetX:s,offsetY:r}=a;let n,o,l=!1;if(i=r,t=t.target,!(0Math.round(10*t)/10;function De(t,e,i,a){var s=ye(t),r=ke(s,"margin"),n=_e(s.maxWidth,t,"clientWidth")||tt,o=_e(s.maxHeight,t,"clientHeight")||tt,t=function(t,s,r){let n,o;if(void 0===s||void 0===r){var l=ve(t);if(l){let t=l.getBoundingClientRect(),e=ye(l),i=ke(e,"border","width"),a=ke(e,"padding");s=t.width-a.width-i.width,r=t.height-a.height-i.height,n=_e(e.maxWidth,l,"clientWidth"),o=_e(e.maxHeight,l,"clientHeight")}else s=t.clientWidth,r=t.clientHeight}return{width:s,height:r,maxWidth:n||tt,maxHeight:o||tt}}(t,e,i);let{width:l,height:h}=t;if("content-box"===s.boxSizing){let t=ke(s,"border","width"),e=ke(s,"padding");l-=e.width+t.width,h-=e.height+t.height}return l=Math.max(0,l-r.width),h=Math.max(0,a?l/a:h-r.height),l=Pe(Math.min(l,n,t.maxWidth)),h=Pe(Math.min(h,o,t.maxHeight)),l&&!h&&(h=Pe(l/2)),(void 0!==e||void 0!==i)&&a&&t.height&&h>t.height&&(h=t.height,l=Pe(Math.floor(h*a))),{width:l,height:h}}function Ce(t,e,i){var e=e||1,a=Math.floor(t.height*e),s=Math.floor(t.width*e),r=(t.height=Math.floor(t.height),t.width=Math.floor(t.width),t.canvas);return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=t.height+"px",r.style.width=t.width+"px"),(t.currentDevicePixelRatio!==e||r.height!==a||r.width!==s)&&(t.currentDevicePixelRatio=e,r.height=a,r.width=s,t.ctx.setTransform(e,0,0,e,0,0),!0)}var Oe=function(){let t=!1;try{var e={get passive(){return!(t=!0)}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function Ae(t,e){t=Me(t,e),e=t&&t.match(/^(\d+)(\.\d+)?px$/);return e?+e[1]:void 0}function Te(t){return!t||P(t.size)||P(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Le(t,e,i,a,s){let r=e[s];return r||(r=e[s]=t.measureText(s).width,i.push(s)),a=r>a?r:a}function Ee(t,e,i,a){let s=(a=a||{}).data=a.data||{},r=a.garbageCollect=a.garbageCollect||[],n=(a.font!==e&&(s=a.data={},r=a.garbageCollect=[],a.font=e),t.save(),t.font=e,0);var o=i.length;let l,h,d,c,u;for(l=0;li.length){for(l=0;le.left-i&&t.xe.top-i&&t.yo[0]){let i=t||o;void 0===e&&(e=ti("_fallback",o));t={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:o,_rootScopes:i,_fallback:e,_getTarget:s,override:t=>Ye([t,...o],l,i,e)};return new Proxy(t,{deleteProperty:(t,e)=>(delete t[e],delete t._keys,delete o[0][e],!0),get:(r,n)=>Ke(r,n,()=>{var t,e,i=n,a=o,s=r;for(e of l)if(t=ti(Xe(e,i),a),void 0!==t)return qe(i,t)?Je(a,s,i,t):t}),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(o[0]),has:(t,e)=>ei(t).includes(e),ownKeys:t=>ei(t),set(t,e,i){var a=t._storage||(t._storage=s());return t[e]=a[e]=i,delete t._keys,!0}})}function $e(a,e,i,s){var t={_cacheable:!1,_proxy:a,_context:e,_subProxy:i,_stack:new Set,_descriptors:Ue(a,s),setContext:t=>$e(a,t,i,s),override:t=>$e(a.override(t),e,i,s)};return new Proxy(t,{deleteProperty:(t,e)=>(delete t[e],delete a[e],!0),get:(o,h,d)=>Ke(o,h,()=>{{var l=o,e=h,i=d,{_proxy:a,_context:s,_subProxy:r,_descriptors:n}=l;let t=a[e];return O(t=g(t)&&n.isScriptable(e)?function(t,e,i){var{_proxy:a,_context:s,_subProxy:r,_stack:n}=l;if(n.has(t))throw new Error("Recursion detected: "+Array.from(n).join("->")+"->"+t);n.add(t);let o=e(s,r||i);return n.delete(t),o=qe(t,o)?Je(a._scopes,a,t,o):o}(e,t,i):t)&&t.length&&(t=function(s,r,t,e){var{_proxy:n,_context:o,_subProxy:l,_descriptors:h}=t;if(void 0!==o.index&&e(s))return r[o.index%r.length];if(A(r[0])){let i=r,a=n._scopes.filter(t=>t!==i);r=[];for(let e of i){let t=Je(a,n,s,e);r.push($e(t,o,l&&l[s],h))}}return r}(e,t,l,n.isIndexable)),t=qe(e,t)?$e(t,s,r&&r[e],n):t}}),getOwnPropertyDescriptor:(t,e)=>t._descriptors.allKeys?Reflect.has(a,e)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(a,e),getPrototypeOf:()=>Reflect.getPrototypeOf(a),has:(t,e)=>Reflect.has(a,e),ownKeys:()=>Reflect.ownKeys(a),set:(t,e,i)=>(a[e]=i,delete t[e],!0)})}function Ue(t,e={scriptable:!0,indexable:!0}){let{_scriptable:i=e.scriptable,_indexable:a=e.indexable,_allKeys:s=e.allKeys}=t;return{allKeys:s,scriptable:i,indexable:a,isScriptable:g(i)?i:()=>i,isIndexable:g(a)?a:()=>a}}let Xe=(t,e)=>t?t+K(e):e,qe=(t,e)=>A(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Ke(t,e,i){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:(i=i(),t[e]=i)}function Ge(t,e,i){return g(t)?t(e,i):t}let Ze=(t,e)=>!0===t?e:"string"==typeof t?f(e,t):void 0;function Je(t,a,s,r){var e=a._rootScopes,i=Ge(a._fallback,s,r),t=[...t,...e],n=new Set,o=(n.add(r),Qe(n,t,s,i||s,r));return null!==o&&(void 0===i||i===s||null!==(o=Qe(n,t,i,o,r)))&&Ye(Array.from(n),[""],e,i,()=>{return t=s,e=r,i=a._getTarget(),t in i||(i[t]={}),O(i=i[t])&&A(e)?e:i||{};var t,e,i})}function Qe(t,e,i,a,s){for(;i;)i=function(e,t,i,a,s){for(var r of t){let t=Ze(i,r);if(t){e.add(t);r=Ge(t._fallback,i,s);if(void 0!==r&&r!==i&&r!==a)return r}else if(!1===t&&void 0!==a&&i!==a)return null}return!1}(t,e,i,a,s);return i}function ti(e,t){for(var i of t)if(i){let t=i[e];if(void 0!==t)return t}}function ei(t){let e=t._keys;return e=e||(t._keys=function(t){var e,i=new Set;for(e of t)for(let t of Object.keys(e).filter(t=>!t.startsWith("_")))i.add(t);return Array.from(i)}(t._scopes))}function ii(t,e,i,a){var s=t.iScale,{key:r="r"}=this._parsing,n=new Array(a);let o,l,h,d;for(o=0,l=a;oe"x"===t?"y":"x";function ni(t,e,i,a){var t=t.skip?e:t,s=e,e=i.skip?e:i,i=gt(s,t),r=gt(e,s),n=i/(i+r),i=r/(i+r),r=a*(isNaN(n)?0:n),n=a*(isNaN(i)?0:i);return{previous:{x:s.x-r*(e.x-t.x),y:s.y-r*(e.y-t.y)},next:{x:s.x+n*(e.x-t.x),y:s.y+n*(e.y-t.y)}}}function oi(l,e="x"){var i=ri(e),t=l.length,o=Array(t).fill(0),h=Array(t);let a,s,r,n=si(l,0);for(a=0;a!t.skip)),"monotone"===e.cubicInterpolationMode)oi(n,t);else{let t=i?n[n.length-1]:n[0];for(a=0,s=n.length;a0===t||1===t,ci=(t,e,i)=>-Math.pow(2,10*--t)*Math.sin((t-e)*v/i),ui=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*v/i)+1,gi={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-(--t*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>--t*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*D),easeOutSine:t=>Math.sin(t*D),easeInOutSine:t=>-.5*(Math.cos(S*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>di(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>1<=t?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1- --t*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>di(t)?t:ci(t,.075,.3),easeOutElastic:t=>di(t)?t:ui(t,.075,.3),easeInOutElastic(t){return di(t)?t:t<.5?.5*ci(2*t,.1125,.45):.5+.5*ui(2*t-1,.1125,.45)},easeInBack(t){return t*t*(2.70158*t-1.70158)},easeOutBack(t){return--t*t*(2.70158*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-gi.easeOutBounce(1-t),easeOutBounce(t){var e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*gi.easeInBounce(2*t):.5*gi.easeOutBounce(2*t-1)+.5};function fi(t,e,i,a){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function pi(t,e,i,a){return{x:t.x+i*(e.x-t.x),y:("middle"===a?i<.5?t:e:"after"===a?i<1?t:e:0+t||0;function yi(e,i){var a={},t=A(i),s=t?Object.keys(i):i,r=A(e)?t?t=>T(e[t],e[i[t]]):t=>e[t]:()=>e;for(let t of s)a[t]=_i(r(t));return a}function Mi(t){return yi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function wi(t){return yi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function I(t){t=Mi(t);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function z(t,e){e=e||R.font;let i=T((t=t||{}).size,e.size),a=("string"==typeof i&&(i=parseInt(i,10)),T(t.style,e.style));a&&!(""+a).match(xi)&&(console.warn('Invalid font style specified: "'+a+'"'),a=void 0);t={family:T(t.family,e.family),lineHeight:vi(T(t.lineHeight,e.lineHeight),i),size:i,style:a,weight:T(t.weight,e.weight),string:""};return t.string=Te(t),t}function ki(t,e,i,a){let s,r,n,o=!0;for(s=0,r=t.length;si&&0===t?0:t+e;return{min:s(t,-Math.abs(e)),max:s(a,e)}}function Pi(t,e){return Object.assign(Object.create(t),e)}function Di(t,e,i){return t?(a=e,s=i,{x:t=>a+a+s-t,setWidth(t){s=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t};var a,s}function Ci(t,e){var i,a;"ltr"!==e&&"rtl"!==e||(a=[(i=t.canvas.style).getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=a)}function Oi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Ai(t){return"angle"===t?{between:pt,compare:ft,normalize:x}:{between:d,compare:(t,e)=>t-e,normalize:t=>t}}function Ti({start:t,end:e,count:i,loop:a,style:s}){return{start:t%i,end:e%i,loop:a&&(e-t+1)%i==0,style:s}}function Li(t,i,g){if(!g)return[t];let{property:a,start:s,end:r}=g,n=i.length,{compare:o,between:l,normalize:h}=Ai(a),{start:d,end:c,loop:u,style:f}=function(t,e){var{property:i,start:a,end:s}=g,{between:r,normalize:n}=Ai(i),o=e.length;let l,h,{start:d,end:c,loop:u}=t;if(u){for(d+=o,c+=o,l=0,h=o;la&&t[s%e].skip;)s--;return s%=e,{start:a,end:s}}(r,o,i=!!t._loop),Ii(t,!0===n?[{start:a,end:s,loop:i}]:function(e,i,t,a){var s=e.length,r=[];let n,o=i,l=e[i];for(n=i+1;n<=t;++n){let t=e[n%s];t.skip||t.stop?l.skip||(a=!1,r.push({start:i%s,end:(n-1)%s,loop:a}),i=o=t.stop?n:null):(o=n,l.skip&&(i=n)),l=t}return null!==o&&r.push({start:i%s,end:o%s,loop:a}),r}(r,a,s{t[o](a[s],r)&&(n.push({element:t,datasetIndex:e,index:i}),l=l||t.inRange(a.x,a.y,r))}),e&&!l?[]:n}var Hi={evaluateInteractionItems:Vi,modes:{index(t,e,i,a){let s=Se(e,t),r=i.axis||"x",n=i.includeInvisible||!1,o=i.intersect?Bi(t,s,r,a,n):Wi(t,s,r,!1,a,n),l=[];return o.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{var e=o[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})}),l):[]},dataset(t,e,i,a){var e=Se(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let n=i.intersect?Bi(t,e,s,a,r):Wi(t,e,s,!1,a,r);if(0Bi(t,Se(e,t),i.axis||"xy",a,i.includeInvisible||!1),nearest(t,e,i,a){return Wi(t,Se(e,t),i.axis||"xy",i.intersect,a,i.includeInvisible||!1)},x:(t,e,i,a)=>Ni(t,Se(e,t),"x",i.intersect,a),y:(t,e,i,a)=>Ni(t,Se(e,t),"y",i.intersect,a)}};let ji=["left","top","right","bottom"];function Yi(t,e){return t.filter(t=>t.pos===e)}function $i(t,e){return t.filter(t=>-1===ji.indexOf(t.pos)&&t.box.axis===e)}function Ui(t,a){return t.sort((t,e)=>{var i=a?e:t,t=a?t:e;return i.weight===t.weight?i.index-t.index:i.weight-t.weight})}function Xi(t,e,i,a){return Math.max(t[i],e[i])+Math.max(t[a],e[a])}function qi(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Ki(i,a,s,r){var n=[];let o,t,l,h,d,c;for(o=0,t=i.length,d=0;o{e[t]=Math.max(i[t],a[t])}),e}}(l.horizontal,a));let{same:t,other:e}=function(e,t,i,a){var{pos:s,box:r}=i,n=e.maxPadding;if(!A(s)){i.size&&(e[s]-=i.size);let t=a[i.stack]||{size:0,count:1};t.size=Math.max(t.size,i.horizontal?r.height:r.width),i.size=t.size/t.count,e[s]+=i.size}return r.getPadding&&qi(n,r.getPadding()),a=Math.max(0,t.outerWidth-Xi(n,e,"left","right")),s=Math.max(0,t.outerHeight-Xi(n,e,"top","bottom")),r=a!==e.w,t=s!==e.h,e.w=a,e.h=s,i.horizontal?{same:r,other:t}:{same:t,other:r}}(a,s,l,r);d|=t&&n.length,c=c||e,h.fullSize||n.push(l)}return d&&Ki(n,a,s,r)||c}function Gi(t,e,i,a,s){t.top=i,t.left=e,t.right=e+a,t.bottom=i+s,t.width=a,t.height=s}function Zi(t,r,n,e){var o,l=n.padding;let{x:h,y:d}=r;for(o of t){let i=o.box,a=e[o.stack]||{count:1,placed:0,weight:1},s=o.stackWeight/a.weight||1;if(o.horizontal){let t=r.w*s,e=a.size||i.height;G(a.start)&&(d=a.start),i.fullSize?Gi(i,l.left,d,n.outerWidth-l.right-l.left,e):Gi(i,r.left+a.placed,d,t,e),a.start=d,a.placed+=t,d=i.bottom}else{let t=r.h*s,e=a.size||i.width;G(a.start)&&(h=a.start),i.fullSize?Gi(i,h,l.top,e,n.outerHeight-l.bottom-l.top):Gi(i,h,r.top+a.placed,e,t),a.start=h,a.placed+=t,h=i.right}}r.x=h,r.y=d}var s={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){e=t.boxes?t.boxes.indexOf(e):-1;-1!==e&&t.boxes.splice(e,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(i,a,s,r){if(i){var n,o,l=I(i.options.layout.padding),h=Math.max(a-l.width,0),d=Math.max(s-l.height,0),c=(u=function(t){var e=[];let i,a,s,r,n,o;for(i=0,a=(t||[]).length;it.box.fullSize),!0),g=Ui(Yi(u,"left"),!0),f=Ui(Yi(u,"right")),m=Ui(Yi(u,"top"),!0),n=Ui(Yi(u,"bottom")),o=$i(u,"x"),p=$i(u,"y"),{fullSize:c,leftAndTop:g.concat(m),rightAndBottom:f.concat(p).concat(n).concat(o),chartArea:Yi(u,"chartArea"),vertical:g.concat(f).concat(p),horizontal:m.concat(n).concat(o)}),u=c.vertical,g=c.horizontal,f=(k(i.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}),u.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1),p=Object.freeze({outerWidth:a,outerHeight:s,padding:l,availableWidth:h,availableHeight:d,vBoxMaxWidth:h/2/f,hBoxMaxHeight:d/2}),m=Object.assign({},l);qi(m,I(r));let e=Object.assign({maxPadding:m,w:h,h:d,x:l.left,y:l.top},l),t=function(a,s){var r=function(t){var a,s,r={};for(a of t){let{stack:t,pos:e,stackWeight:i}=a;t&&ji.includes(e)&&((s=r[t]||(r[t]={count:0,placed:0,weight:0,size:0})).count++,s.weight+=i)}return r}(a),{vBoxMaxWidth:n,hBoxMaxHeight:o}=s;let l,t,h;for(l=0,t=a.length;l{t=t.box;Object.assign(t,i.chartArea),t.update(e.w,e.h,{left:0,top:0,right:0,bottom:0})})}}};class Ji{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,a){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,a?Math.floor(e/a):i)}}isAttached(t){return!0}updateConfig(t){}}class Qi extends Ji{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}let ta="$chartjs",ea={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ia=t=>null===t||""===t,aa=!!Oe&&{passive:!0};function sa(t,e){for(var i of t)if(i===e||i.contains(e))return!0}function ra(t,e,a){let s=t.canvas,i=new MutationObserver(e=>{let i=!1;for(let t of e)i=i||sa(t.addedNodes,s),i=i&&!sa(t.removedNodes,s);i&&a()});return i.observe(document,{childList:!0,subtree:!0}),i}function na(t,e,a){let s=t.canvas,i=new MutationObserver(e=>{let i=!1;for(let t of e)i=i||sa(t.removedNodes,s),i=i&&!sa(t.addedNodes,s);i&&a()});return i.observe(document,{childList:!0,subtree:!0}),i}let oa=new Map,la=0;function ha(){let i=window.devicePixelRatio;i!==la&&(la=i,oa.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function da(e,t,a){let i=e.canvas,s=i&&ve(i);if(s){let i=St((t,e)=>{var i=s.clientWidth;a(t,e),i{var t=t[0],e=t.contentRect.width,t=t.contentRect.height;0===e&&0===t||i(e,t)});return t.observe(s),e=e,r=i,oa.size||window.addEventListener("resize",ha),oa.set(e,r),t;var r}}function ca(t,e,i){i&&i.disconnect(),"resize"===e&&(i=t,oa.delete(i),oa.size||window.removeEventListener("resize",ha))}function ua(e,t,i){var a=e.canvas,s=St(t=>{null!==e.ctx&&i(function(t,e){var i=ea[t.type]||t.type,{x:a,y:s}=Se(t,e);return{type:i,chart:e,native:t,x:void 0!==a?a:null,y:void 0!==s?s:null}}(t,e))},e);return a.addEventListener(t,s,aa),s}class ga extends Ji{acquireContext(e,t){var i=e&&e.getContext&&e.getContext("2d");{if(i&&i.canvas===e){var a=t,t=e.style,s=e.getAttribute("height"),r=e.getAttribute("width");if(e[ta]={initial:{height:s,width:r,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",ia(r)){let t=Ae(e,"width");void 0!==t&&(e.width=t)}if(ia(s))if(""===e.style.height)e.height=e.width/(a||2);else{let t=Ae(e,"height");void 0!==t&&(e.height=t)}return i}return null}}releaseContext(t){let i=t.canvas;if(!i[ta])return!1;let a=i[ta].initial,e=(["height","width"].forEach(t=>{var e=a[t];P(e)?i.removeAttribute(t):i.setAttribute(t,e)}),a.style||{});return Object.keys(e).forEach(t=>{i.style[t]=e[t]}),i.width=i.width,delete i[ta],!0}addEventListener(t,e,i){this.removeEventListener(t,e);var a=t.$proxies||(t.$proxies={}),s={attach:ra,detach:na,resize:da}[e]||ua;a[e]=s(t,e,i)}removeEventListener(t,e){var i=t.$proxies||(t.$proxies={}),a=i[e];a&&(({attach:ca,detach:ca,resize:ca}[e]||function(t,e,i){t.canvas.removeEventListener(e,i,aa)})(t,e,a),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,a){return De(t,e,i,a)}isAttached(t){t=ve(t);return!(!t||!t.isConnected)}}function fa(t){return!xe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Qi:ga}let pa=Object.freeze({__proto__:null,BasePlatform:Ji,BasicPlatform:Qi,DomPlatform:ga,_detectPlatform:fa}),ma="transparent",ba={boolean:(t,e,i)=>.5t+(e-t)*i};class xa{constructor(t,e,i,a){var s=e[i],s=(a=ki([t.to,a,s,t.from]),ki([t.from,s,a]));this._active=!0,this._fn=t.fn||ba[t.type||typeof s],this._easing=gi[t.easing]||gi.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=s,this._to=a,this._promises=void 0}active(){return this._active}update(t,e,i){var a,s,r;this._active&&(this._notify(!1),a=this._target[this._prop],s=i-this._start,r=this._duration-s,this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=s,this._loop=!!t.loop,this._to=ki([t.to,e,a,t.from]),this._from=ki([t.from,a,e]))}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){var t=t-this._start,e=this._duration,i=this._prop,a=this._from,s=this._loop,r=this._to;this._active=a!==r&&(s||t{i.push({res:t,rej:e})})}_notify(t){var e=t?"res":"rej",i=this._promises||[];for(let t=0;t{var a=t[i];if(A(a)){let e={};for(let t of s)e[t]=a[t];(O(a.properties)&&a.properties||[i]).forEach(t=>{t!==i&&r.has(t)||r.set(t,e)})}})}}_animateOptions(t,e){let i=e.options,a=function(e,i){if(i){let t=e.options;if(t)return t.$shared&&(e.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t;e.options=i}}(t,i);return a?(e=this._createAnimations(a,i),i.$shared&&function(e,t){var i=[],a=Object.keys(t);for(let t=0;t{t.options=i},()=>{}),e):[]}_createAnimations(e,i){var a=this._properties,s=[],r=e.$animations||(e.$animations={}),t=Object.keys(i),n=Date.now();let o;for(o=t.length-1;0<=o;--o){var l=t[o];if("$"!==l.charAt(0))if("options"===l)s.push(...this._animateOptions(e,i));else{var h=i[l];let t=r[l];var d=a.get(l);if(t){if(d&&t.active()){t.update(d,h,n);continue}t.cancel()}d&&d.duration?(r[l]=t=new xa(d,e,l,h),s.push(t)):e[l]=h}}return s}update(t,e){var i;if(0!==this._properties.size)return(i=this._createAnimations(t,e)).length?(r.add(this._chart,i),!0):void 0;Object.assign(t,e)}}function _a(t,e){var t=t&&t.options||{},i=t.reverse,a=void 0===t.min?e:0,t=void 0===t.max?e:0;return{start:i?t:a,end:i?a:t}}function ya(t,e){var i=[],a=t._getSortedDatasetMetas(e);let s,r;for(s=0,r=a.length;si[t].axis===e).shift()}function Da(t,i){var a=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){i=i||t._parsed;for(let e of i){let t=e._stacks;if(!t||void 0===t[s]||void 0===t[s][a])return;delete t[s][a],void 0!==t[s]._visualValues&&void 0!==t[s]._visualValues[a]&&delete t[s]._visualValues[a]}}}let Ca=t=>"reset"===t||"none"===t,Oa=(t,e)=>e?t:Object.assign({},t);class Aa{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(){var t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=wa(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&&Da(this._cachedMeta),this.index=t}linkScales(){var t=this.chart,e=this._cachedMeta,i=this.getDataset(),a=(t,e,i,a)=>"x"===t?e:"r"===t?a:i,s=e.xAxisID=T(i.xAxisID,Pa(t,"x")),r=e.yAxisID=T(i.yAxisID,Pa(t,"y")),i=e.rAxisID=T(i.rAxisID,Pa(t,"r")),t=e.indexAxis,n=e.iAxisID=a(t,s,r,i),a=e.vAxisID=a(t,r,s,i);e.xScale=this.getScaleForId(s),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(i),e.iScale=this.getScaleForId(n),e.vScale=this.getScaleForId(a)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){var e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){var t=this._cachedMeta;this._data&&Mt(this._data,this),t._stacked&&Da(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(A(e))this._data=function(t){var e=Object.keys(t),i=new Array(e.length);let a,s,r;for(a=0,s=e.length;anull===l[n]||c&&l[n]t||dthis.getContext(i,a,e),l)).$shared&&(d.$shared=o,s[r]=Object.freeze(Oa(d,o))),d)}_resolveAnimations(a,s,r){let t=this.chart,e=this._cachedDataOpts,i="animation-"+s,n=e[i];if(n)return n;let o;if(!1!==t.options.animation){let t=this.chart.config,e=t.datasetAnimationScopeKeys(this._type,s),i=t.getOptionScopes(this.getDataset(),e);o=t.createResolver(i,this.getContext(a,r,s))}a=new va(t,o&&o.animations);return o&&o._cacheable&&(e[i]=Object.freeze(a)),a}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ca(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){var t=this.resolveDataElementOptions(t,e),i=this._sharedOptions,a=this.getSharedOptions(t),i=this.includeOptions(e,a)||a!==i;return this.updateSharedOptions(a,e,t),{sharedOptions:a,includeOptions:i}}updateElement(t,e,i,a){Ca(a)?Object.assign(t,i):this._resolveAnimations(e,a).update(t,i)}updateSharedOptions(t,e,i){t&&!Ca(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,a){t.active=a;var s=this.getStyle(e,a);this._resolveAnimations(e,i,a).update(t,{options:!a&&this.getSharedOptions(s)||s})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];var a=i.length,s=e.length,r=Math.min(s,a);r&&this.parse(0,r),a{for(t.length+=e,n=t.length-1;n>=r;n--)t[n]=t[n-e]};for(o(s),n=t;n{a[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),a}}function Ta(t,e,i,a,s){var r=T(a,0),n=Math.min(T(s,t.length),t.length);let o,l,h,d=0;for(i=Math.ceil(i),s&&(i=(o=s-a)/Math.floor(o/i)),h=r;h<0;)d++,h=Math.round(r+d*i);for(l=Math.max(r,0);l"top"===e||"left"===e?t[e]+i:t[e]-i,Ea=(t,e)=>Math.min(e||t,t);function Ra(t,e){var i=[],a=t.length/e,s=t.length;let r=0;for(;rr?r:s,r=n&&s>r?s:r,{min:u(s,u(r,s)),max:u(r,u(s,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){var 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(){c(this.options.beforeUpdate,[this])}update(t,e,i){var{beginAtZero:a,grace:s,ticks:r}=this.options,n=r.sampleSize,t=(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=Si(this,s,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks(),na)return t}}return Math.max(a,1)}(r,a,s);if(0{var e=t.gc,i=e.length/2;let a;if(y({width:r[t]||0,height:n[t]||0});return{first:w(0),last:w(e-1),widest:w(i),highest:w(M),widths:r,heights:n}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);t=this._startPixel+t*this._length;return mt(this._alignToPixels?Re(this.chart,t,0):t)}getDecimalForPixel(t){t=(t-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){var{min:t,max:e}=this;return t<0&&e<0?e:0n+1e-6)))return l}(this,b,f))&&(v=Re(c,x,a),p?_=M=k=P=v:y=w=S=D=v,m.push({tx1:_,ty1:y,tx2:M,ty2:w,x1:k,y1:S,x2:P,y2:D,width:a,color:s,borderDash:r,borderDashOffset:n,tickWidth:o,tickColor:l,tickBorderDash:h,tickBorderDashOffset:d}))}return this._ticksLength=r,this._borderValue=d,m}_computeLabelItems(t){let e=this.axis,i=this.options,{position:o,ticks:l}=i,h=this.isHorizontal(),d=this.ticks,{align:a,crossAlign:c,padding:s,mirror:u}=l,r=Ia(i.grid),n=r+s,g=u?-s:n,f=-L(this.labelRotation),p=[],m,b,x,v,_,y,M,w,k,S,P,D="middle";if("top"===o)_=this.bottom-g,y=this._getXAxisLabelAlignment();else if("bottom"===o)_=this.top+g,y=this._getXAxisLabelAlignment();else if("left"===o){let t=this._getYAxisLabelAlignment(r);y=t.textAlign,v=t.x}else if("right"===o){let t=this._getYAxisLabelAlignment(r);y=t.textAlign,v=t.x}else if("x"===e){if("center"===o)_=(t.top+t.bottom)/2+n;else if(A(o)){let t=Object.keys(o)[0],e=o[t];_=this.chart.scales[t].getPixelForValue(e)+n}y=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===o)v=(t.left+t.right)/2-n;else if(A(o)){let t=Object.keys(o)[0],e=o[t];v=this.chart.scales[t].getPixelForValue(e)}y=this._getYAxisLabelAlignment(r).textAlign}"y"===e&&("start"===a?D="top":"end"===a&&(D="bottom"));var C=this._getLabelSizes();for(m=0,b=d.length;mt.value===e))?i.setContext(this.getContext(t)).lineWidth:0}drawGrid(t){let e=this.options.grid,a=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),s,r;var n=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(e.display)for(s=0,r=i.length;s{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:t,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(e){var i=this.chart.getSortedVisibleDatasetMetas(),a=this.axis+"AxisID",s=[];let r,t;for(r=0,t=i.length;r{var e=t.split("."),i=e.pop(),e=[s].concat(e).join("."),t=r[t].split("."),a=t.pop(),t=t.join(".");R.route(e,i,t,a)})),n.descriptors&&R.describe(e,n.descriptors),this.override&&R.override(t.id,t.overrides)),o;throw new Error("class does not have id: "+t)}get(t){return this.items[t]}unregister(t){var e=this.items,t=t.id,i=this.scope;t in e&&delete e[t],i&&t in R[i]&&(delete R[i][t],this.override)&&delete fe[t]}}var M=new class{constructor(){this.controllers=new Va(Aa,"datasets",!0),this.elements=new Va(e,"elements"),this.plugins=new Va(Object,"plugins"),this.scales=new Va(Fa,"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(i,t,a){[...t].forEach(t=>{var e=a||this._getRegistryForType(t);a||e.isForType(t)||e===this.plugins&&t.id?this._exec(i,e,t):k(t,t=>{var e=a||this._getRegistryForType(t);this._exec(i,e,t)})})}_exec(t,e,i){var a=K(t);c(i["before"+a],[],i),e[t](i),c(i["after"+a],[],i)}_getRegistryForType(e){for(let t=0;tt.filter(e=>!i.some(t=>e.plugin.id===t.plugin.id));this._notify(a(e,i),t,"stop"),this._notify(a(i,e),t,"start")}}function Wa(t,e){var i=R.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Na(t){if("x"===t||"y"===t||"r"===t)return t}function Ha(e,...t){if(Na(e))return e;for(var i of t){let t=i.axis||("top"===(i=i.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||1{var e=o[t];if(!A(e))return console.error("Invalid scale configuration for scale: "+t);if(e._proxy)return console.warn("Ignoring resolver passed as options for scale: "+t);let i=Ha(t,e,function(e,t){if(t.data&&t.data.datasets){t=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(t.length)return ja(e,"x",t[0])||ja(e,"y",t[0])}return{}}(t,n),R.scales[e.type]),a=i===l?"_index_":"_value_",s=r.scales||{};h[t]=$(Object.create(null),[{axis:i},e,s[i],s[a]])}),n.data.datasets.forEach(a=>{let t=a.type||n.type,s=a.indexAxis||Wa(t,e),r=(fe[t]||{}).scales||{};Object.keys(r).forEach(t=>{var e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,s),i=a[e+"AxisID"]||e;h[i]=h[i]||Object.create(null),$(h[i],[{axis:e},o[i],r[t]])})}),Object.keys(h).forEach(t=>{t=h[t];$(t,[R.scales[t.type],R.scale])}),h}(t,e)}function $a(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}let Ua=new Map,Xa=new Set;function qa(t,e){let i=Ua.get(t);return i||(i=e(),Ua.set(t,i),Xa.add(i)),i}let Ka=(t,e,i)=>{e=f(e,i);void 0!==e&&t.add(e)};class Ga{constructor(t){this._config=((t=(t=t)||{}).data=$a(t.data),Ya(t),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=$a(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){var t=this._config;this.clearCache(),Ya(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return qa(t,()=>[["datasets."+t,""]])}datasetAnimationScopeKeys(t,e){return qa(t+".transition."+e,()=>[[`datasets.${t}.transitions.`+e,"transitions."+e],["datasets."+t,""]])}datasetElementScopeKeys(t,e){return qa(t+"-"+e,()=>[[`datasets.${t}.elements.`+e,"datasets."+t,"elements."+e,""]])}pluginScopeKeys(t){let e=t.id;return qa(this.type+"-plugin-"+e,()=>[["plugins."+e,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){var i=this._scopeCache;let a=i.get(t);return a&&!e||(a=new Map,i.set(t,a)),a}getOptionScopes(e,t,i){let{options:a,type:s}=this,r=this._cachedScopes(e,i),n=r.get(t);if(n)return n;let o=new Set;t.forEach(t=>{e&&(o.add(e),t.forEach(t=>Ka(o,e,t))),t.forEach(t=>Ka(o,a,t)),t.forEach(t=>Ka(o,fe[s]||{},t)),t.forEach(t=>Ka(o,R,t)),t.forEach(t=>Ka(o,pe,t))});i=Array.from(o);return 0===i.length&&i.push(Object.create(null)),Xa.has(t)&&r.set(t,i),i}chartOptionScopes(){var{options:t,type:e}=this;return[t,fe[e]||{},R.datasets[e]||{},{type:e},R,pe]}resolveNamedOptions(t,e,i,a=[""]){var s={$shared:!0},{resolver:a,subPrefixes:r}=Za(this._resolverCache,t,a);let n=a;!function(a,t){var s,{isScriptable:r,isIndexable:n}=Ue(a);for(s of t){let t=r(s),e=n(s),i=(e||t)&&a[s];if(t&&(g(i)||Ja(i))||e&&O(i))return 1}}(a,e)||(s.$shared=!1,n=$e(a,i=g(i)?i():i,this.createResolver(t,i,r)));for(let t of e)s[t]=n[t];return s}createResolver(t,e,i=[""],a){t=Za(this._resolverCache,t,i).resolver;return A(e)?$e(t,e,void 0,a):t}}function Za(t,e,i){let a=t.get(e);a||(a=new Map,t.set(e,a));t=i.join();let s=a.get(t);return s||(s={resolver:Ye(e,i),subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},a.set(t,s)),s}let Ja=i=>A(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||g(i[e]),!1),Qa=["top","bottom","left","right","chartArea"];function ts(t,e){return"top"===t||"bottom"===t||-1===Qa.indexOf(t)&&"x"===e}function es(i,a){return function(t,e){return t[i]===e[i]?t[a]-e[a]:t[i]-e[i]}}function is(t){var e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),c(i&&i.onComplete,[t],e)}function as(t){var e=t.chart,i=e.options.animation;c(i&&i.onProgress,[t],e)}function ss(t){return xe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t=t&&t.canvas?t.canvas:t}let rs={},ns=t=>{let e=ss(t);return Object.values(rs).filter(t=>t.canvas===e).pop()};class i{static defaults=R;static instances=rs;static overrides=fe;static registry=M;static version="4.3.3";static getChart=ns;static register(...t){M.add(...t),os()}static unregister(...t){M.remove(...t),os()}constructor(t,e){var e=this.config=new Ga(e),t=ss(t),i=ns(t);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");var i=e.createResolver(e.chartOptionScopes(),this.getContext()),e=(this.platform=new(e.platform||fa(t)),this.platform.updateConfig(e),this.platform.acquireContext(t,i.aspectRatio)),t=e&&e.canvas,a=t&&t.height,s=t&&t.width;this.id=F(),this.ctx=e,this.canvas=t,this.width=s,this.height=a,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Ba,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Pt(t=>this.update(t),i.resizeDelay||0),this._dataChanges=[],rs[this.id]=this,e&&t?(r.listen(this,"complete",is),r.listen(this,"progress",as),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){var{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:a,_aspectRatio:s}=this;return P(t)?e&&s?s:a?i/a:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return M}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ce(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ie(this.canvas,this.ctx),this}stop(){return r.stop(this),this}resize(t,e){r.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){var i=this.options,a=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(a,t,e,s),t=i.devicePixelRatio||this.platform.getDevicePixelRatio(),e=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Ce(this,t,!0)&&(this.notifyPlugins("resize",{size:a}),c(i.onResize,[this,a],this),this.attached)&&this._doResize(e)&&this.render()}ensureScalesHaveIDs(){k(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){let n=this.options,a=n.scales,o=this.scales,l=Object.keys(o).reduce((t,e)=>(t[e]=!1,t),{}),t=[];k(t=a?t.concat(Object.keys(a).map(t=>{var e=a[t],t=Ha(t,e),i="r"===t,t="x"===t;return{options:e,dposition:i?"chartArea":t?"bottom":"left",dtype:i?"radialLinear":t?"category":"linear"}})):t,t=>{var e=t.options,i=e.id,a=Ha(i,e),s=T(e.type,t.dtype);void 0!==e.position&&ts(e.position,a)===ts(t.dposition)||(e.position=t.dposition),l[i]=!0;let r=null;i in o&&o[i].type===s?r=o[i]:(r=new(M.getScale(s))({id:i,type:s,ctx:this.ctx,chart:this}),o[r.id]=r),r.init(e,n)}),k(l,(t,e)=>{t||delete o[e]}),k(o,t=>{s.configure(this,t,t.options),s.addBox(this,t)})}_updateMetasets(){var t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),ei.length&&delete this._stacks,t.forEach((e,t)=>{0===i.filter(t=>t===e._dataset).length&&this._destroyDatasetMeta(t)})}buildOrUpdateControllers(){let s=[],e=this.data.datasets,r,t;for(this._removeUnreferencedMetasets(),r=0,t=e.length;r{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config,i=(e.update(),this._options=e.createResolver(e.chartOptionScopes(),this.getContext())),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1!==this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})){var r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let i=0,t=this.data.datasets.length;i{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(es("z","_idx"));var{_active:t,_lastEvent:n}=this;n?this._eventHandler(n,!0):t.length&&this._updateHoverStyles(t,t,!0),this.render()}}_updateScales(){k(this.scales,t=>{s.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){var t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);Z(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){var e,i,a,s,r=this._hiddenIndices;for({method:e,start:i,count:a}of this._getUniformDataChanges()||[]){n=void 0;o=void 0;l=void 0;s=void 0;h=void 0;var n=r;var o=i;var l="_removeElements"===e?-a:a;let t=Object.keys(n);for(var h of t){let t=+h;t>=o&&(s=n[h],delete n[h],0o)&&(n[t+l]=s)}}}_getUniformDataChanges(){let t=this._dataChanges;if(t&&t.length){this._dataChanges=[];var e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),a=i(0);for(let t=1;tt.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}}_updateLayout(i){if(!1!==this.notifyPlugins("beforeLayout",{cancelable:!0})){s.update(this,this.width,this.height,i);let t=this.chartArea,e=t.width<=0||t.height<=0;this._layers=[],k(this.boxes,t=>{e&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}}_updateDatasets(i){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:i,cancelable:!0})){for(let t=0,e=this.data.datasets.length;tt&&t._dataset===e).pop();return a||(a={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(a)),a}getContext(){return this.$context||(this.$context=Pi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){var e=this.data.datasets[t];return!!e&&("boolean"==typeof(t=this.getDatasetMeta(t)).hidden?!t.hidden:!e.hidden)}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(e,t,i){let a=i?"show":"hide",s=this.getDatasetMeta(e),r=s.controller._resolveAnimations(void 0,a);G(t)?(s.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),r.update(s,{visible:i}),this.update(t=>t.datasetIndex===e?a:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){var e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),r.remove(this),t=0,e=this.data.datasets.length;t{a.addEventListener(this,t,e),i[t]=e},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};k(this.options.events,t=>e(t,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let i=this._responsiveListeners,a=this.platform,t=(t,e)=>{a.addEventListener(this,t,e),i[t]=e},e=(t,e)=>{i[t]&&(a.removeEventListener(this,t,e),delete i[t])},s=(t,e)=>{this.canvas&&this.resize(t,e)},r,n=()=>{e("attach",n),this.attached=!0,this.resize(),t("resize",s),t("detach",r)};r=()=>{this.attached=!1,e("resize",s),this._stop(),this._resize(0,0),t("attach",n)},(a.isAttached(this.canvas)?n:r)()}unbindEvents(){k(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},k(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){var a=i?"set":"remove";let s,r,n;for("dataset"===t&&this.getDatasetMeta(e[0].datasetIndex).controller["_"+a+"DatasetHoverStyle"](),r=0,n=e.length;r{var i=this.getDatasetMeta(t);if(i)return{datasetIndex:t,element:i.data[e],index:e};throw new Error("No dataset found at index "+t)});W(t,e)||(this._active=t,this._lastEvent=null,this._updateHoverStyles(t,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(e){return 1===this._plugins._cache.filter(t=>t.plugin.id===e).length}_updateHoverStyles(t,e,i){var a=this.options.hover,s=(t,i)=>t.filter(e=>!i.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),r=s(e,t),i=i?t:s(t,e);r.length&&this.updateHoverStyle(r,a.mode,!1),i.length&&a.mode&&this.updateHoverStyle(i,a.mode,!0)}_eventHandler(e,t){var i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},a=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1!==this.notifyPlugins("beforeEvent",i,a))return t=this._handleEvent(e,t,i.inChartArea),i.cancelable=!1,this.notifyPlugins("afterEvent",i,a),(t||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:a=[],options:s}=this,r=e,n=this._getActiveElements(t,a,i,r),o=J(t),l=(h=t,d=this._lastEvent,i&&"mouseout"!==h.type?o?d:h:null);i&&(this._lastEvent=null,c(s.onHover,[t,n,this],this),o)&&c(s.onClick,[t,n,this],this);var h,d=!W(n,a);return(d||e)&&(this._active=n,this._updateHoverStyles(n,a,e)),this._lastEvent=l,d}_getActiveElements(t,e,i,a){return"mouseout"===t.type?[]:i?(i=this.options.hover,this.getElementsAtEventForMode(t,i.mode,i,a)):e}}function os(){k(i.instances,t=>t._plugins.invalidate())}function ls(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var hs={_date:class $r{static override(t){Object.assign($r.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return ls()}parse(){return ls()}format(){return ls()}add(){return ls()}diff(){return ls()}startOf(){return ls()}endOf(){return ls()}}};function ds(i,a,s,r){if(O(i)){var n=i,o=a,l=s,h=r,d=l.parse(n[0],h),n=l.parse(n[1],h),h=Math.min(d,n),c=Math.max(d,n);let t=h,e=c;Math.abs(h)>Math.abs(c)&&(t=c,e=h),o[l.axis]=e,o._custom={barStart:t,barEnd:e,start:d,end:n,min:h,max:c}}else a[s.axis]=s.parse(i,r);return a}function cs(t,e,i,a){var s=t.iScale,r=t.vScale,n=s.getLabels(),o=s===r,l=[];let h,d,c,u;for(d=(h=i)+a;h"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(r){var t=r.data;if(t.labels.length&&t.datasets.length){let{pointStyle:a,color:s}=r.legend.options.labels;return t.labels.map((t,e)=>{var i=r.getDatasetMeta(0).controller.getStyle(e);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,fontColor:s,lineWidth:i.borderWidth,pointStyle:a,hidden:!r.getDataVisibility(e),index:e}})}return[]}},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(a,s){let r=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=r;else{let t,e,i=t=>+r[t];if(A(r[a])){let{key:e="value"}=this._parsing;i=t=>+f(r[t],e)}for(e=(t=a)+s;tpt(t,a,s,!0)?1:Math.max(e,e*f,i,i*f),o=(t,e,i)=>pt(t,a,s,!0)?-1:Math.min(e,e*f,i,i*f),l=n(0,t,i),h=n(D,e,r),d=o(S,t,i),c=o(S+D,e,r);p=(l-d)/2,m=(h-c)/2,b=-(l+d)/2,x=-(h+c)/2}return{ratioX:p,ratioY:m,offsetX:b,offsetY:x}}(l,o,r),l=(e.width-s)/l,e=(e.height-s)/o,s=Math.max(Math.min(l,e)/2,0),o=B(this.options.radius,s),l=(o-Math.max(o*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=h*o,this.offsetY=d*o,i.total=this.calculateTotal(),this.outerRadius=o-l*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-l*n,0),this.updateElements(a,0,a.length,t)}_circumference(t,e){var i=this.options,a=this._cachedMeta,s=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===a._parsed[t]||a.data[t].hidden?0:this.calculateCircumference(a._parsed[t]*s/v)}updateElements(a,t,e,s){let r="reset"===s,i=this.chart,n=i.chartArea,o=i.options.animation,l=(n.left+n.right)/2,h=(n.top+n.bottom)/2,d=r&&o.animateScale,c=d?0:this.innerRadius,u=d?0:this.outerRadius,{sharedOptions:g,includeOptions:f}=this._getSharedOptions(t,s),p,m=this._getRotation();for(p=0;p{var i=r.getDatasetMeta(0).controller.getStyle(e);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,fontColor:s,lineWidth:i.borderWidth,pointStyle:a,hidden:!r.getDataVisibility(e),index:e}})}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){var e=this._cachedMeta,i=this.chart,a=i.data.labels||[],e=ce(e._parsed[t].r,i.options.locale);return{label:a[t]||"",value:e}}parseObjectData(t,e,i,a){return ii.bind(this)(t,e,i,a)}update(t){var e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,a={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,e)=>{var i=this.getParsed(e).r;!isNaN(i)&&this.chart.getDataVisibility(e)&&(ia.max)&&(a.max=i)}),a}_updateRadius(){var t=this.chart,e=t.chartArea,i=t.options,e=Math.min(e.right-e.left,e.bottom-e.top),e=Math.max(e/2,0),i=(e-Math.max(i.cutoutPercentage?e/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=e-i*this.index,this.innerRadius=this.outerRadius-i}updateElements(s,t,e,r){var n="reset"===r,o=this.chart,l=o.options.animation,h=this._cachedMeta.rScale,d=h.xCenter,c=h.yCenter,u=h.getIndexAngle(0)-.5*S;let g,f=u;var p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(e).r)&&this.chart.getDataVisibility(e)&&i++}),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?L(this.resolveDataElementOptions(t,e).angle||i):0}}Oe=Object.freeze({__proto__:null,BarController:class extends Aa{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,a){return cs(t,e,i,a)}parseArrayData(t,e,i,a){return cs(t,e,i,a)}parseObjectData(t,e,i,a){var{iScale:s,vScale:r}=t,{xAxisKey:t="x",yAxisKey:n="y"}=this._parsing,o="x"===s.axis?t:n,l="x"===r.axis?t:n,h=[];let d,c,u,g;for(c=(d=i)+a;dt.controller.options.grouped),s=t.options.stacked,r=[];for(let t of a)if((void 0===i||!(t=>{var e=t.controller.getParsed(i),e=e&&e[t.vScale.axis];if(P(e)||isNaN(e))return!0})(t))&&((!1===s||-1===r.indexOf(t.stack)||void 0===s&&void 0===t.stack)&&r.push(t.stack),t.index===e))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){t=this._getStacks(t,i),i=void 0!==e?t.indexOf(e):-1;return-1===i?t.length-1:i}_getRuler(){var t=this.options,e=this._cachedMeta,i=e.iScale,a=[];let s,r;for(s=0,r=e.data.length;st-e))}return a._cache.$bar}(e);let a,s,r,n,o=e._length;var l=()=>{32767!==r&&-32768!==r&&(G(n)&&(o=Math.min(o,Math.abs(r-n)||o)),n=r)};for(a=0,s=i.length;a=m?1:-1))*o),g===l&&(x-=u/2);let t=s.getPixelForDecimal(0),e=s.getPixelForDecimal(1),i=Math.min(t,e),a=Math.max(t,e);x=Math.max(Math.min(x,a),i),c=x+u,r&&!d&&(h._stacks[s.axis]._visualValues[n]=s.getValueForPixel(c)-s.getValueForPixel(x))}if(x===s.getPixelForValue(l)){let t=_(u)*s.getLineWidthForValue(l)/2;x+=t,u-=t}return{size:u,base:x,head:c,center:c+u/2}}_calculateBarIndexPixels(a,s){let t=s.scale,r=this.options,n=r.skipNull,o=T(r.maxBarThickness,1/0),l,h;if(s.grouped){let t=n?this._getStackCount(a):s.stackCount,e=("flex"===r.barThickness?function(t,e,i,a){var s=e.pixels,r=s[t];let n=0=x?e.skip=!0:(M=P((y=this.getParsed(i))[f]),w=e[g]=o.getPixelForValue(y[g],i),k=e[f]=n||M?l.getBasePixel():l.getPixelForValue(h?this.applyStack(l,y,h):y[f],i),e.skip=isNaN(w)||isNaN(k)||M,e.stop=0m,p&&(e.parsed=y,e.raw=d.data[i]),u&&(e.options=c||this.resolveDataElementOptions(i,t.active?"active":r)),b||this.updateElement(t,i,e,r),_=y)}}getMaxOverflow(){var t,e=this._cachedMeta,i=e.dataset,i=i.options&&i.options.borderWidth||0,e=e.data||[];return e.length?(t=e[0].size(this.resolveDataElementOptions(0)),e=e[e.length-1].size(this.resolveDataElementOptions(e.length-1)),Math.max(i,t,e)/2):i}draw(){var t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends ps{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:ms,RadarController:class extends Aa{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){var e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,a){return ii.bind(this)(t,e,i,a)}update(e){let t=this._cachedMeta,i=t.dataset,a=t.data||[],s=t.iScale.getLabels();if(i.points=a,"resize"!==e){let t=this.resolveDatasetElementOptions(e);this.options.showLine||(t.borderWidth=0);var r={_loop:!0,_fullLoop:s.length===a.length,options:t};this.updateElement(i,void 0,r,e)}this.updateElements(a,0,a.length,e)}updateElements(o,t,e,l){var h=this._cachedMeta.rScale,d="reset"===l;for(let n=t;nv,x&&(i.parsed=e,i.raw=g.data[n]),p&&(i.options=f||this.resolveDataElementOptions(n,t.active?"active":l)),_||this.updateElement(t,n,i,l),y=e}this.updateSharedOptions(f,l,i)}getMaxOverflow(){var t,e,i=this._cachedMeta,a=i.data||[];if(this.options.showLine)return i=(i=i.dataset).options&&i.options.borderWidth||0,a.length?(t=a[0].size(this.resolveDataElementOptions(0)),e=a[a.length-1].size(this.resolveDataElementOptions(a.length-1)),Math.max(i,t,e)/2):i;{let e=0;for(let t=a.length-1;0<=t;--t)e=Math.max(e,a[t].size(this.resolveDataElementOptions(t))/2);return 0{var e=(i-Math.min(s,t))*a/2;return C(t,0,Math.min(s,e))};return{outerStart:n(t.outerStart),outerEnd:n(t.outerEnd),innerStart:C(t.innerStart,0,r),innerEnd:C(t.innerEnd,0,r)}}(t,h,c,l-g),b=c-d,x=c-f,v=g+d/b,_=l-f/x,y=h+p,M=h+m,w=g+p/y,k=l-m/M;if(s.beginPath(),r){let t=(v+_)/2;if(s.arc(n,o,c,v,t),s.arc(n,o,c,t,_),0(n+(h?o-t:t))%r,v=()=>{g!==f&&(a.lineTo(m,f),a.lineTo(m,g),a.lineTo(m,p))};for(l&&(c=s[x(0)],a.moveTo(c.x,c.y)),d=0;d<=o;++d)if(!(c=s[x(d)]).skip){let t=c.x,e=c.y,i=0|t;i===u?(ef&&(f=e),m=(b*m+t)/++b):(v(),a.lineTo(t,e),u=i,b=0,g=f=e),p=e}v()}function ks(t){var e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?Ms:ws}let Ss="function"==typeof Path2D;class Ps extends e{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=>"borderDash"!==t&&"fill"!==t};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){var i,a=this.options;!a.tension&&"monotone"!==a.cubicInterpolationMode||a.stepped||this._pointsUpdated||(i=a.spanGaps?this._loop:this._fullLoop,hi(this._points,a,t,i,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=Ri(this,this.options.segment))}first(){var t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){var t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(r,n){var o=this.options,l=r[n],h=this.points,d=Ei(this,{property:n,start:l,end:l});if(d.length){var c,u=[],g=o.stepped?pi:o.tension||"monotone"===o.cubicInterpolationMode?mi:fi;let s,t;for(s=0,t=d.length;s"borderDash"!==t};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){var{angle:t,distance:e}=ut(this.getProps(["x","y"],i),{x:t,y:e}),{startAngle:i,endAngle:a,innerRadius:s,outerRadius:r,circumference:n}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),o=(this.options.spacing+this.options.borderWidth)/2,n=T(n,a-i)>=v||pt(t,i,a),t=d(e,s+o,r+o);return n&&t}getCenterPoint(t){var{x:t,y:e,startAngle:i,endAngle:a,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:n,spacing:o}=this.options,i=(i+a)/2,a=(s+r+o+n)/2;return{x:t+Math.cos(i)*a,y:e+Math.sin(i)*a}}tooltipPosition(t){return this.getCenterPoint(t)}draw(e){var{options:i,circumference:a}=this,s=(i.offset||0)/4,r=(i.spacing||0)/2,n=i.circular;if(this.pixelMargin="inner"===i.borderAlign?.33:0,this.fullCircles=a>v?Math.floor(a/v):0,!(0===a||this.innerRadius<0||this.outerRadius<0)){e.save();var o=(this.startAngle+this.endAngle)/2,o=(e.translate(Math.cos(o)*s,Math.sin(o)*s),s*(1-Math.sin(Math.min(S,a||0))));e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor;{var l=e;s=this;a=o;i=r;var h=n;var{fullCircles:d,startAngle:c,circumference:u}=s;let t=s.endAngle;if(d){xs(l,s,a,i,t,h);for(let t=0;ta=e?a:t,o=t=>s=i?s:t;if(t){let t=_(a),e=_(s);t<0&&e<0?o(0):0g&&(M=rt(y*M/g/u)*u),P(o)||(x=Math.pow(10,o),M=Math.ceil(M*x)/x),_="ticks"===a?(v=Math.floor(e/M)*M,Math.ceil(f/M)*M):(v=e,f),p&&m&&s&<((n-r)/s,M/1e3)?(y=Math.round(Math.min((n-r)/M,h)),M=(n-r)/y,v=r,_=n):b?(v=p?r:v,_=m?n:_,y=l-1,M=(_-v)/y):y=st(y=(_-v)/M,Math.round(y),M/1e3)?Math.round(y):Math.ceil(y);g=Math.max(ct(M),ct(v));x=Math.pow(10,P(o)?g:o),v=Math.round(v*x)/x,_=Math.round(_*x)/x;let w=0;for(p&&(c&&v!==r?(i.push({value:r}),vn)break;i.push({value:t})}return m&&c&&_!==n?i.length&&st(i[i.length-1].value,n,Is(n,d,t))?i[i.length-1].value=n:i.push({value:n}):m&&_!==n||i.push({value:_}),i}({maxTicks:Math.max(2,i),bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&ht(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){var t=this.ticks;let e=this.min,i=this.max;super.configure(),this.options.offset&&t.length&&(t=(i-e)/Math.max(t.length-1,1)/2,e-=t,i+=t),this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ce(t,this.chart.options.locale,this.options.ticks.format)}}class Fs extends zs{static id="linear";static defaults={ticks:{callback:ge.formatters.numeric}};determineDataLimits(){var{min:t,max:e}=this.getMinMax(!0);this.min=p(t)?t:0,this.max=p(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){var t=this.isHorizontal(),e=t?this.width:this.height,i=L(this.options.ticks.minRotation),t=(t?Math.sin(i):Math.cos(i))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,i.lineHeight/t))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}let Vs=t=>Math.floor(o(t)),Bs=(t,e)=>Math.pow(10,Vs(t)+e);function Ws(t){return 1==t/Math.pow(10,Vs(t))}function Ns(t,e,i){i=Math.pow(10,i),t=Math.floor(t/i);return Math.ceil(e/i)-t}class Hs extends Fa{static id="logarithmic";static defaults={ticks:{callback:ge.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){t=zs.prototype.parse.apply(this,[t,e]);if(0!==t)return p(t)&&0a=e?a:t,r=t=>s=i?s:t;a===s&&(a<=0?(t(1),r(10)):(t(Bs(a,-1)),r(Bs(s,1)))),a<=0&&t(Bs(s,-1)),s<=0&&r(Bs(a,1)),this.min=a,this.max=s}buildTicks(){var t=this.options,e=function(t,{min:e,max:i}){e=u(t.min,e);var a=[],s=Vs(e);let r=function(t,e){let i=Vs(e-t);for(;10r?Math.pow(10,s):0,s=Math.round((e-l)*n)/n,h=Math.floor((e-l)/o/10)*o*10;let d=Math.floor((s-h)/Math.pow(10,r)),c=u(t.min,Math.round((l+h+d*Math.pow(10,r))*n)/n);for(;ct,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(){var t=this._padding=I(js(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(){var{min:t,max:e}=this.getMinMax(!1);this.min=p(t)&&!isNaN(t)?t:0,this.max=p(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/js(this.options))}generateTickLabels(t){zs.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{t=c(this.options.pointLabels.callback,[t,e],this);return t||0===t?t:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){var t=this.options;t.display&&t.pointLabels.display?$s(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,a){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-a)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,a))}getIndexAngle(t){return x(t*(v/(this._pointLabels.length||1))+L(this.options.startAngle||0))}getDistanceFromCenterForValue(t){var e;return P(t)?NaN:(e=this.drawingArea/(this.max-this.min),this.options.reverse?(this.max-t)*e:(t-this.min)*e)}getValueForDistanceFromCenter(t){return P(t)?NaN:(t=t/(this.drawingArea/(this.max-this.min)),this.options.reverse?this.max-t:this.min+t)}getPointLabelContext(t){var e=this._pointLabels||[];if(0<=t&&t0!==t)?(m.beginPath(),je(m,{x:b,y:f,w:y,h:v,radius:t}),m.fill()):m.fillRect(b,f,y,v)}var x=z(p.font),{x:M,y:_,textAlign:m}=t;He(u,i._pointLabels[e],M,_+x.lineHeight/2,x,{color:p.color,textAlign:m,textBaseline:"middle"})}}}if(l.display&&this.ticks.forEach((t,e)=>{var i,a,s,r,n,o;0!==e&&(c=this.getDistanceFromCenterForValue(t.value),t=this.getContext(e),e=l.setContext(t),t=h.setContext(t),i=this,e=e,a=c,s=d,t=t,r=i.ctx,n=e.circular,{color:e,lineWidth:o}=e,!n&&!s||!e||!o||a<0||(r.save(),r.strokeStyle=e,r.lineWidth=o,r.setLineDash(t.dash),r.lineDashOffset=t.dashOffset,r.beginPath(),Us(i,a,n,s),r.closePath(),r.stroke(),r.restore()))}),r.display){for(a.save(),n=d-1;0<=n;n--){let t=r.setContext(this.getPointLabelContext(n)),{color:e,lineWidth:i}=t;i&&e&&(a.lineWidth=i,a.strokeStyle=e,a.setLineDash(t.borderDash),a.lineDashOffset=t.borderDashOffset,c=this.getDistanceFromCenterForValue(s.ticks.reverse?this.min:this.max),o=this.getPointPosition(n,c),a.beginPath(),a.moveTo(this.xCenter,this.yCenter),a.lineTo(o.x,o.y),a.stroke())}a.restore()}}drawBorder(){}drawLabels(){let n=this.ctx,o=this.options,l=o.ticks;if(l.display){var t=this.getIndexAngle(0);let s,r;n.save(),n.translate(this.xCenter,this.yCenter),n.rotate(t),n.textAlign="center",n.textBaseline="middle",this.ticks.forEach((e,t)=>{if(0!==t||o.reverse){var i=l.setContext(this.getContext(t)),a=z(i.font);if(s=this.getDistanceFromCenterForValue(this.ticks[t].value),i.showLabelBackdrop){n.font=a.string,r=n.measureText(e.label).width,n.fillStyle=i.backdropColor;let t=I(i.backdropPadding);n.fillRect(-r/2-t.left,-s-a.size/2-t.top,r+t.width,a.size+t.height)}He(n,e.label,0,-s,a,{color:i.color,strokeColor:i.textStrokeColor,strokeWidth:i.textStrokeWidth})}}),n.restore()}}drawTitle(){}}let qs={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}},h=Object.keys(qs);function Ks(t,e){return t-e}function Gs(t,e){if(P(e))return null;var i=t._adapter,{parser:t,round:a,isoWeekday:s}=t._parseOpts;let r=e;return null===(r=p(r="function"==typeof t?t(r):r)?r:"string"==typeof t?i.parse(r,t):i.parse(r))?null:+(r=a?"week"!==a||!ot(s)&&!0!==s?i.startOf(r,a):i.startOf(r,"isoWeek",s):r)}function Zs(t,a,s,r){let e=h.length;for(let i=h.indexOf(t);i=h.indexOf(t);e--){let t=h[e];if(qs[t].common&&i._adapter.diff(r,s,t)>=a-1)return t}return h[t?h.indexOf(t):0]}(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(i){for(let t=h.indexOf(i)+1,e=h.length;t+t.value))}initOffsets(t=[]){let e,i,a=0,s=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),a=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),s=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);t=t.length<3?.5:.25;a=C(a,0,t),s=C(s,0,t),this._offsets={start:a,end:s,factor:1/(a+1+s)}}_generate(){var t=this._adapter,e=this.min,i=this.max,a=this.options,s=a.time,r=s.unit||Zs(s.minUnit,e,i,this._getLabelCapacity(e)),n=T(a.ticks.stepSize,1),s="week"===r&&s.isoWeekday,o=ot(s)||!0===s,l={};let h,d,c=e;if(o&&(c=+t.startOf(c,"isoWeek",s)),c=+t.startOf(c,o?"day":r),t.diff(i,e,r)>1e5*n)throw new Error(e+" and "+i+" are too far apart with stepSize of "+n+" "+r);var u="data"===a.ticks.source&&this.getDataTimestamps();for(h=c,d=0;h+t)}getLabelForValue(t){var e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){var i=this.options.time.displayFormats,a=this._unit,e=e||i[a];return this._adapter.format(t,e)}_tickFormatFunction(t,e,i,a){var s,r=this.options,n=r.ticks.callback;return n?c(n,[t,e,i],this):(n=r.time.displayFormats,r=this._unit,s=this._majorUnit,r=r&&n[r],n=s&&n[s],i=i[e],e=s&&n&&i&&i.major,this._adapter.format(t,a||(e?n:r)))}generateTickLabels(t){let e,i,a;for(e=0,i=t.length;e=t[o].pos&&e<=t[l].pos&&({lo:o,hi:l}=m(t,"pos",e)),{pos:a,time:r}=t[o],{pos:s,time:n}=t[l]):(e>=t[o].time&&e<=t[l].time&&({lo:o,hi:l}=m(t,"time",e)),{time:a,pos:r}=t[o],{time:s,pos:n}=t[l]);i=s-a;return i?r+(n-r)*(e-a)/i:r}let ir=Object.freeze({__proto__:null,CategoryScale:class extends Fa{static id="category";static defaults={ticks:{callback:Rs}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){var e=this._addedLabels;if(e.length){let t=this.getLabels();for(var{index:i,label:a}of e)t[i]===a&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){var i,a,s,r,n,o,l;return P(t)||(i=this.getLabels(),r=e=isFinite(e)&&i[e]===t?e:(a=i,s=T(e,t=t),r=this._addedLabels,-1===(l=a.indexOf(t))?(o=s,r=r,"string"==typeof(n=t)?(o=a.push(n)-1,r.unshift({index:o,label:n})):isNaN(n)&&(o=null),o):l!==a.lastIndexOf(t)?s:l),n=i.length-1,null===r)?null:C(Math.round(r),0,n)}determineDataLimits(){var{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:a}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(a=this.getLabels().length-1)),this.min=i,this.max=a}buildTicks(){var e=this.min,i=this.max,t=this.options.offset,a=[];let s=this.getLabels();s=0===e&&i===s.length-1?s:s.slice(e,i+1),this._valueRange=Math.max(s.length-(t?0:1),1),this._startValue=this.min-(t?.5:0);for(let t=e;t<=i;t++)a.push({value:t});return a}getLabelForValue(t){return Rs.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return null===(t="number"!=typeof t?this.parse(t):t)?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){var 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}},LinearScale:Fs,LogarithmicScale:Hs,RadialLinearScale:Xs,TimeScale:tr,TimeSeriesScale:class extends tr{static id="timeseries";static defaults=tr.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){var t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=er(e,this.min),this._tableRange=er(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){var{min:e,max:i}=this,a=[],s=[];let r,n,o,l,h;for(r=0,n=t.length;r=e&&l<=i&&a.push(l);if(a.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,n=a.length;rt-e)}_getTimestampsForTable(){var t,e,i=this._cache.all||[];return i.length||(t=this.getDataTimestamps(),e=this.getLabelTimestamps(),i=t.length&&e.length?this.normalize(t.concat(e)):t.length?t:e,i=this._cache.all=i),i}getDecimalForValue(t){return(er(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){var e=this._offsets,t=this.getDecimalForPixel(t)/e.factor-e.end;return er(this._table,t*this._tableRange+this._minPos,!0)}}}),ar=["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)"],sr=ar.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function rr(t){return ar[t%ar.length]}function nr(t){return sr[t%sr.length]}function or(r){let n=0;return(t,e)=>{var i,a,s,e=r.getDatasetMeta(e).controller;e instanceof ps?n=(a=t,s=n,a.backgroundColor=a.data.map(()=>rr(s++)),s):e instanceof ms?n=(a=t,i=n,a.backgroundColor=a.data.map(()=>nr(i++)),i):e&&(n=(e=t,t=n,e.borderColor=rr(t),e.backgroundColor=nr(t),++t))}}function lr(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return 1}var hr={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){var a,s,r;i.enabled&&({data:{datasets:a},options:s}=t.config,r=s.elements,!i.forceOverride&&(lr(a)||s&&(s.borderColor||s.backgroundColor)||r&&lr(r))||(i=or(t),a.forEach(i)))}};function dr(t){var e;t._decimated&&(e=t._data,delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e}))}function cr(t){t.data.datasets.forEach(t=>{dr(t)})}var ur={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(l,t,M)=>{if(M.enabled){let o=l.width;l.data.datasets.forEach((e,t)=>{var{_data:i,indexAxis:a}=e,h=l.getDatasetMeta(t),s=i||e.data;if("y"!==ki([a,l.options.indexAxis])&&h.controller.supportsDecimation){t=l.scales[h.xAxisID];if(("linear"===t.type||"time"===t.type)&&!l.options.parsing){var{start:r,count:n}=function(t){var e=t.length;let i,a=0;var s=h.iScale,{min:r,max:n,minDefined:o,maxDefined:l}=s.getUserBounds();return o&&(a=C(m(t,s.axis,r).lo,0,e-1)),i=l?C(m(t,s.axis,n).hi+1,a,e)-a:e-a,{start:a,count:i}}(s);if(n<=(M.threshold||4*o))dr(e);else{let t;switch(P(i)&&(e._data=s,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),M.algorithm){case"lttb":t=function(n,o,l,t){var e=M.samples||t;if(l<=e)return n.slice(o,o+l);var h=[],d=(l-2)/(e-2);let c=0,i=o+l-1,u,g,f,p,m,b=o;for(h[c++]=n[b],u=0;uf&&(f=p,g=n[t],m=t);h[c++]=g,b=m}return h[c++]=n[i],h}(s,r,n,o);break;case"min-max":t=function(a,t,e,i){let s,r,n,o,l,h,d,c,u,g,f=0,p=0;var m=[],b=a[t].x,x=a[t+e-1].x-b;for(s=t;sg&&(g=o,d=s),f=(p*f+r.x)/++p;else{let i=s-1;if(!P(h)&&!P(d)){let t=Math.min(h,d),e=Math.max(h,d);t!==c&&t!==i&&m.push({...a[t],x:f}),e!==c&&e!==i&&m.push({...a[e],x:f})}0{e=fr(t,e,s);t=s[t],e=s[e];null!==a?(r.push({x:t.x,y:a}),r.push({x:e.x,y:a})):null!==i&&(r.push({x:i,y:t.y}),r.push({x:i,y:e.y}))}),r}(t)).length?new Ps({points:i,options:{tension:0},_loop:a,_fullLoop:a}):null}function br(t){return t&&!1!==t.fill}function xr(e,i,a){var s=[];for(let t=0;t{let{boxHeight:i=e,boxWidth:a=e}=t;return t.usePointStyle&&(i=Math.min(i,e),a=t.pointStyleWidth||Math.min(a,e)),{boxWidth:a,boxHeight:i,itemHeight:Math.max(e,i)}};class Dr extends e{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 i=this.options.labels||{},t=c(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(t=>i.filter(t,this.chart.data))),i.sort&&(t=t.sort((t,e)=>i.sort(t,e,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){var{options:i,ctx:a}=this;if(i.display){var s=i.labels,r=z(s.font),n=r.size,o=this._computeTitleHeight(),{boxWidth:s,itemHeight:l}=Pr(s,n);let t,e;a.font=r.string,this.isHorizontal()?(t=this.maxWidth,e=this._fitRows(o,n,s,l)+10):(e=this.maxHeight,t=this._fitCols(o,r,s,l)+10),this.width=Math.min(t,i.maxWidth||this.maxWidth),this.height=Math.min(e,i.maxHeight||this.maxHeight)}else this.width=this.height=0}_fitRows(t,i,a,s){let{ctx:r,maxWidth:n,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],h=this.lineWidths=[0],d=s+o,c=t,u=(r.textAlign="left",r.textBaseline="middle",-1),g=-d;return this.legendItems.forEach((t,e)=>{t=a+i/2+r.measureText(t.text).width;(0===e||h[h.length-1]+t+2*o>n)&&(c+=d,h[h.length-(0{n=l,i=o,a=d,s=t,r=h;var i,a,s,r,{itemWidth:t,itemHeight:n}={itemWidth:function(t,e,i){let a=s.text;return a&&"string"!=typeof a&&(a=a.reduce((t,e)=>t.length>e.length?t:e)),t+e.size/2+i.measureText(a).width}(n,i,a),itemHeight:function(t){let e=r;return e="string"!=typeof s.text?Cr(s,t):e}(i.lineHeight)};0f&&(p+=m+c,g.push({width:m,height:b}),x+=m+c,v++,m=b=0),u[e]={left:x,top:b,col:v,width:t,height:n},m=Math.max(m,t),b+=n+c}),p+=m,g.push({width:m,height:b}),p}adjustHitBoxes(){if(this.options.display){var i=this._computeTitleHeight(),{legendHitBoxes:a,options:{align:s,labels:{padding:r},rtl:t}}=this,n=Di(t,this.left,this.width);if(this.isHorizontal()){let t=0,e=E(s,this.left+r,this.right-this.lineWidths[t]);for(var o of a)t!==o.row&&(t=o.row,e=E(s,this.left+r,this.right-this.lineWidths[t])),o.top+=this.top+i+r,o.left=n.leftForLtr(n.x(e),o.width),e+=o.width+r}else{let t=0,e=E(s,this.top+i+r,this.bottom-this.columnSizes[t].height);for(var l of a)l.col!==t&&(t=l.col,e=E(s,this.top+i+r,this.bottom-this.columnSizes[t].height)),l.top=e,l.left+=this.left+r,l.left=n.leftForLtr(n.x(l.left),l.width),e+=l.height+r}}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){var t;this.options.display&&(Ve(t=this.ctx,this),this._draw(),Be(t))}_draw(){let{options:h,columnSizes:d,lineWidths:c,ctx:u}=this,{align:g,labels:f}=h,p=R.color,m=Di(h.rtl,this.left,this.width),b=z(f.font),x=f.padding,v=b.size,_=v/2,y,{boxWidth:M,boxHeight:w,itemHeight:k}=(this.drawTitle(),u.textAlign=m.textAlign("left"),u.textBaseline="middle",u.lineWidth=.5,u.font=b.string,Pr(f,v)),S=this.isHorizontal(),P=this._computeTitleHeight(),D=(y=S?{x:E(g,this.left+x,this.right-c[0]),y:this.top+x+P,line:0}:{x:this.left+x,y:E(g,this.top+P+x,this.bottom-d[0].height),line:0},Ci(this.ctx,h.textDirection),k+x);this.legendItems.forEach((e,a)=>{u.strokeStyle=e.fontColor,u.fillStyle=e.fontColor;var t=u.measureText(e.text).width,i=m.textAlign(e.textAlign||(e.textAlign=f.textAlign)),t=M+_+t;let s=y.x,r=y.y;m.setWidth(this.width),S?0this.right&&(r=y.y+=D,y.line++,s=y.x=E(g,this.left+x,this.right-c[y.line])):0this.bottom&&(s=y.x=s+d[y.line].width+x,y.line++,r=y.y=E(g,this.top+P+x,this.bottom-d[y.line].height));var a=m.x(s),n=r,o=e;if(!(isNaN(M)||M<=0||isNaN(w)||w<0)){u.save();var l=T(o.lineWidth,1);if(u.fillStyle=T(o.fillStyle,p),u.lineCap=T(o.lineCap,"butt"),u.lineDashOffset=T(o.lineDashOffset,0),u.lineJoin=T(o.lineJoin,"miter"),u.lineWidth=l,u.strokeStyle=T(o.strokeStyle,p),u.setLineDash(T(o.lineDash,[])),f.usePointStyle){let t={radius:w*Math.SQRT2/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:l},e=m.xPlus(a,M/2);Fe(u,t,e,n+_,f.pointStyleWidth&&M)}else{let t=n+Math.max((v-w)/2,0),e=m.leftForLtr(a,M),i=wi(o.borderRadius);u.beginPath(),Object.values(i).some(t=>0!==t)?je(u,{x:e,y:t,w:M,h:w,radius:i}):u.rect(e,t,M,w),u.fill(),0!==l&&u.stroke()}u.restore()}if(s=Ct(i,s+M+_,S?s+t:this.right,h.rtl),n=m.x(s),a=r,o=e,He(u,o.text,n,a+k/2,b,{strikethrough:o.hidden,textAlign:m.textAlign(o.textAlign)}),S)y.x+=t+x;else if("string"!=typeof e.text){let t=b.lineHeight;y.y+=Cr(e,t)+x}else y.y+=D}),Oi(this.ctx,h.textDirection)}drawTitle(){let a=this.options,s=a.title,r=z(s.font),n=I(s.padding);if(s.display){var o=Di(a.rtl,this.left,this.width),l=this.ctx,h=s.position,d=r.size/2,d=n.top+d;let e,t=this.left,i=this.width;if(this.isHorizontal())i=Math.max(...this.lineWidths),e=this.top+d,t=E(a.align,t,this.right-i);else{let t=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);e=d+E(a.align,this.top,this.bottom-t-a.labels.padding-this._computeTitleHeight())}d=E(h,t,t+i);l.textAlign=o.textAlign(Dt(h)),l.textBaseline="middle",l.strokeStyle=s.color,l.fillStyle=s.color,l.font=r.string,He(l,s.text,d,e,r)}}_computeTitleHeight(){var t=this.options.title,e=z(t.font),i=I(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,a,s;if(d(t,this.left,this.right)&&d(e,this.top,this.bottom))for(s=this.legendHitBoxes,i=0;it.chart.options.color,boxWidth:40,padding:10,generateLabels(t){let a=t.data.datasets,{usePointStyle:s,pointStyle:r,textAlign:n,color:o,useBorderRadius:l,borderRadius:h}=t.legend.options.labels;return t._getSortedDatasetMetas().map(t=>{var e=t.controller.getStyle(s?0:void 0),i=I(e.borderWidth);return{text:a[t.index].label,fillStyle:e.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:(i.width+i.height)/4,strokeStyle:e.borderColor,pointStyle:r||e.pointStyle,rotation:e.rotation,textAlign:n||e.textAlign,borderRadius:l&&(h||e.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Ar extends e{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){var i=this.options;this.left=0,this.top=0,i.display?(this.width=this.right=t,this.height=this.bottom=e,t=O(i.text)?i.text.length:1,this._padding=I(i.padding),e=t*z(i.font).lineHeight+this._padding.height,this.isHorizontal()?this.height=e:this.width=e):this.width=this.height=this.right=this.bottom=0}isHorizontal(){var t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){var{top:e,left:i,bottom:a,right:s,options:r}=this,n=r.align;let o,l,h,d=0;return o=this.isHorizontal()?(l=E(n,i,s),h=e+t,s-i):(d="left"===r.position?(l=i+t,h=E(n,a,e),-.5*S):(l=s-t,h=E(n,e,a),.5*S),a-e),{titleX:l,titleY:h,maxWidth:o,rotation:d}}draw(){var t,e,i,a,s,r=this.ctx,n=this.options;n.display&&(e=(t=z(n.font)).lineHeight/2+this._padding.top,{titleX:e,titleY:i,maxWidth:a,rotation:s}=this._drawArgs(e),He(r,n.text,0,0,t,{color:n.color,maxWidth:a,rotation:s,textAlign:Dt(n.align),textBaseline:"middle",translation:[e,i]}))}}var Tr={id:"title",_element:Ar,start(t,e,i){var a;t=t,i=i,a=new Ar({ctx:t.ctx,options:i,chart:t}),s.configure(t,a,i),s.addBox(t,a),t.titleBlock=a},stop(t){var e=t.titleBlock;s.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){var a=t.titleBlock;s.configure(t,a,i),a.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};let Lr=new WeakMap;var Er={id:"subtitle",start(t,e,i){var a=new Ar({ctx:t.ctx,options:i,chart:t});s.configure(t,a,i),s.addBox(t,a),Lr.set(t,a)},stop(t){s.removeBox(t,Lr.get(t)),Lr.delete(t)},beforeUpdate(t,e,i){var a=Lr.get(t);s.configure(t,a,i),a.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};let Rr={average(t){if(!t.length)return!1;let i,e,a=0,s=0,r=0;for(i=0,e=t.length;it+e.before.length+e.lines.length+e.after.length,0),v=(x+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*d.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),x&&(m+=f*(e.displayColors?Math.max(l,h.lineHeight):h.lineHeight)+(x-f)*h.lineHeight+(x-1)*e.bodySpacing),g&&(m+=e.footerMarginTop+g*c.lineHeight+(g-1)*e.footerSpacing),0);return a.save(),a.font=d.string,k(t.title,i),a.font=h.string,k(t.beforeBody.concat(t.afterBody),i),v=e.displayColors?o+2+e.boxPadding:0,k(s,t=>{k(t.before,i),k(t.lines,i),k(t.after,i)}),v=0,a.font=c.string,k(t.footer,i),a.restore(),{width:b+=p.width,height:m}}function Fr(i,t,a){var e=a.yAlign||t.yAlign||function(){var{y:t,height:e}=a;return ti.height-e/2?"bottom":"center"}();return{xAlign:a.xAlign||t.xAlign||function(s,r,n,t){var{x:e,width:i}=n,{width:a,chartArea:{left:o,right:l}}=s;let h="center";return"center"===t?h=e<=(o+l)/2?"left":"right":e<=i/2?h="left":a-i/2<=e&&(h="right"),h=function(t){var{x:e,width:i}=n,a=r.caretSize+r.caretPadding;return"left"===t&&e+i+a>s.width||"right"===t&&e-i-a<0}(h)?"center":h}(i,t,a,e),yAlign:e}}function Vr(t,i,e,a){var{caretSize:t,caretPadding:s,cornerRadius:r}=t,{xAlign:n,yAlign:o}=e,l=t+s,{topLeft:e,topRight:s,bottomLeft:r,bottomRight:h}=wi(r);let d=function(){let{x:t,width:e}=i;return"right"===n?t-=e:"center"===n&&(t-=e/2),t}();var c=function(){let{y:t,height:e}=i;return"top"===o?t+=l:t-="bottom"===o?e+l:e/2,t}();return"center"===o?"left"===n?d+=l:"right"===n&&(d-=l):"left"===n?d-=Math.max(e,r)+t:"right"===n&&(d+=Math.max(s,h)+t),{x:C(d,0,a.width-i.width),y:C(c,0,a.height-i.height)}}function Br(t,e,i){i=I(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.right:t.x+i.left}function Wr(t){return b([],Ir(t))}function Nr(t,e){e=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return e?t.override(e):t}let Hr={beforeTitle:t,title(t){if(0{var e={before:[],lines:[],after:[]},i=Nr(a,t);b(e.before,Ir(w(i,"beforeLabel",this,t))),b(e.lines,w(i,"label",this,t)),b(e.after,Ir(w(i,"afterLabel",this,t))),s.push(e)}),s}getAfterBody(t,e){return Wr(w(e.callbacks,"afterBody",this,t))}getFooter(t,e){var e=e.callbacks,i=w(e,"beforeFooter",this,t),a=w(e,"footer",this,t),e=w(e,"afterFooter",this,t),t=b([],Ir(i));return t=b(t,Ir(a)),b(t,Ir(e))}_createItems(a){let t=this._active,s=this.chart.data,i=[],r=[],n=[],e,o,l=[];for(e=0,o=t.length;ea.filter(t,e,i,s))),k(l=a.itemSort?l.sort((t,e)=>a.itemSort(t,e,s)):l,t=>{var e=Nr(a.callbacks,t);i.push(w(e,"labelColor",this,t)),r.push(w(e,"labelPointStyle",this,t)),n.push(w(e,"labelTextColor",this,t))}),this.labelColors=i,this.labelPointStyles=r,this.labelTextColors=n,this.dataPoints=l}update(t,e){var r=this.options.setContext(this.getContext()),n=this._active;let o,l=[];if(n.length){let t=Rr[r.position].call(this,n,this._eventPosition),e=(l=this._createItems(r),this.title=this.getTitle(l,r),this.beforeBody=this.getBeforeBody(l,r),this.body=this.getBody(l,r),this.afterBody=this.getAfterBody(l,r),this.footer=this.getFooter(l,r),this._size=zr(this,r)),i=Object.assign({},t,e),a=Fr(this.chart,r,i),s=Vr(r,i,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:s.x,y:s.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=l,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,a){t=this.getCaretPosition(t,i,a);e.lineTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineTo(t.x3,t.y3)}getCaretPosition(t,e,i){var{xAlign:a,yAlign:s}=this,{caretSize:i,cornerRadius:r}=i,{topLeft:r,topRight:n,bottomLeft:o,bottomRight:l}=wi(r),{x:t,y:h}=t,{width:e,height:d}=e;let c,u,g,f,p,m;return"center"===s?(p=h+d/2,m="left"===a?(c=t,u=c-i,f=p+i,p-i):(c=t+e,u=c+i,f=p-i,p+i),g=c):(u="left"===a?t+Math.max(r,o)+i:"right"===a?t+e-Math.max(n,l)-i:this.caretX,g="top"===s?(f=h,p=f-i,c=u-i,u+i):(f=h+d,p=f+i,c=u+i,u-i),m=f),{x1:c,x2:u,x3:g,y1:f,y2:p,y3:m}}drawTitle(t,e,i){var a=this.title,s=a.length;let r,n,o;if(s){var l=Di(i.rtl,this.x,this.width);for(t.x=Br(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",r=z(i.titleFont),n=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,o=0;o0!==t)?(a.beginPath(),a.fillStyle=r.multiKeyBackground,je(a,{x:t,y:g,w:h,h:l,radius:i}),a.fill(),a.stroke(),a.fillStyle=n.backgroundColor,a.beginPath(),je(a,{x:e,y:g+1,w:h-2,h:l-2,radius:i}),a.fill()):(a.fillStyle=r.multiKeyBackground,a.fillRect(t,g,h,l),a.strokeRect(t,g,h,l),a.fillStyle=n.backgroundColor,a.fillRect(e,g+1,h-2,l-2))}a.fillStyle=this.labelTextColors[e]}drawBody(e,i,t){function a(t){i.fillText(t,f.x(e.x+g),e.y+u/2),e.y+=u+r}let s=this.body,{bodySpacing:r,bodyAlign:n,displayColors:o,boxHeight:l,boxWidth:h,boxPadding:d}=t,c=z(t.bodyFont),u=c.lineHeight,g=0,f=Di(t.rtl,this.x,this.width),p=f.textAlign(n),m,b,x,v,_,y,M;for(i.textAlign=n,i.textBaseline="middle",i.font=c.string,e.x=Br(this,p,t),i.fillStyle=t.bodyColor,k(this.beforeBody,a),g=o&&"right"!==p?"center"===n?h/2+d:h+2+d:0,v=0,y=s.length;v{var i=this.chart.getDatasetMeta(t);if(i)return{datasetIndex:t,element:i.data[e],index:e};throw new Error("Cannot find a dataset at index "+t)}),i=!W(i,t),a=this._positionChanged(t,e);(i||a)&&(this._active=t,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;var a=this.options,s=this._active||[],i=this._getActiveElements(t,s,e,i),r=this._positionChanged(i,t),s=e||!W(i,s)||r;return s&&(this._active=i,a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e)),s}_getActiveElements(t,e,i,a){var s=this.options;return"mouseout"===t.type?[]:a?(a=this.chart.getElementsAtEventForMode(t,s.mode,s,i),s.reverse&&a.reverse(),a):e}_positionChanged(t,e){var{caretX:i,caretY:a,options:s}=this,s=Rr[s.position].call(this,t,e);return!1!==s&&(i!==s.x||a!==s.y)}}var Yr={id:"tooltip",_element:jr,positioners:Rr,afterInit(t,e,i){i&&(t.tooltip=new jr({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){var e,i=t.tooltip;i&&i._willRender()&&!(e={tooltip:i})!==t.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})&&(i.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",e))},afterEvent(t,e){var i;t.tooltip&&(i=e.replay,t.tooltip.handleEvent(e.event,i,e.inChartArea))&&(e.changed=!0)},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Hr},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};return i.register(Oe,ir,Es,a),i.helpers={...Fi},i._adapters=hs,i.Animation=xa,i.Animations=va,i.animator=r,i.controllers=M.controllers.items,i.DatasetController=Aa,i.Element=e,i.elements=Es,i.Interaction=Hi,i.layouts=s,i.platforms=pa,i.Scale=Fa,i.Ticks=ge,Object.assign(i,Oe,ir,Es,a,pa),i.Chart=i,"undefined"!=typeof window&&(window.Chart=i),i})