@mozaic-ds/chart 0.1.0-beta.13 → 0.1.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Od=Object.defineProperty;var Id=(X,x,at)=>x in X?Od(X,x,{enumerable:!0,configurable:!0,writable:!0,value:at}):X[x]=at;var C=(X,x,at)=>(Id(X,typeof x!="symbol"?x+"":x,at),at);(function(X,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],x):(X=typeof globalThis<"u"?globalThis:X||self,x(X.MozaicChart={},X.Vue))})(this,function(X,x){var Dt;"use strict";/*!
|
|
2
2
|
* @kurkle/color v0.3.2
|
|
3
3
|
* https://github.com/kurkle/color#readme
|
|
4
4
|
* (c) 2023 Jukka Kurkela
|
|
@@ -8,15 +8,15 @@ var Td=Object.defineProperty;var Od=(X,_,at)=>_ in X?Td(X,_,{enumerable:!0,confi
|
|
|
8
8
|
* https://www.chartjs.org
|
|
9
9
|
* (c) 2023 Chart.js Contributors
|
|
10
10
|
* Released under the MIT License
|
|
11
|
-
*/function pt(){}const ma=(()=>{let i=0;return()=>i++})();function F(i){return i===null||typeof i>"u"}function W(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function O(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function V(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function et(i,t){return V(i)?i:t}function T(i,t){return typeof i>"u"?t:i}const ba=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,Cn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function B(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function R(i,t,e,n){let s,o,a;if(W(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;s<o;s++)t.call(e,i[s],s);else if(O(i))for(a=Object.keys(i),o=a.length,s=0;s<o;s++)t.call(e,i[a[s]],a[s])}function We(i,t){let e,n,s,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,n=i.length;e<n;++e)if(s=i[e],o=t[e],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function He(i){if(W(i))return i.map(He);if(O(i)){const t=Object.create(null),e=Object.keys(i),n=e.length;let s=0;for(;s<n;++s)t[e[s]]=He(i[e[s]]);return t}return i}function Mn(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function ya(i,t,e,n){if(!Mn(i))return;const s=t[i],o=e[i];O(s)&&O(o)?te(s,o,n):t[i]=He(o)}function te(i,t,e){const n=W(t)?t:[t],s=n.length;if(!O(i))return i;e=e||{};const o=e.merger||ya;let a;for(let r=0;r<s;++r){if(a=n[r],!O(a))continue;const l=Object.keys(a);for(let c=0,h=l.length;c<h;++c)o(l[c],i,a,e)}return i}function ee(i,t){return te(i,t,{merger:xa})}function xa(i,t,e){if(!Mn(i))return;const n=t[i],s=e[i];O(n)&&O(s)?ee(n,s):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=He(s))}const Pn={"":i=>i,x:i=>i.x,y:i=>i.y};function _a(i){const t=i.split("."),e=[];let n="";for(const s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function va(i){const t=_a(i);return e=>{for(const n of t){if(n==="")break;e=e&&e[n]}return e}}function St(i,t){return(Pn[t]||(Pn[t]=va(t)))(i)}function Ii(i){return i.charAt(0).toUpperCase()+i.slice(1)}const ie=i=>typeof i<"u",kt=i=>typeof i=="function",An=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Sa(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const N=Math.PI,H=2*N,ka=H+N,Ne=Number.POSITIVE_INFINITY,wa=N/180,$=N/2,Lt=N/4,Dn=N*2/3,wt=Math.log10,ct=Math.sign;function ne(i,t,e){return Math.abs(i-t)<e}function Ln(i){const t=Math.round(i);i=ne(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(wt(i))),n=i/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function Ca(i){const t=[],e=Math.sqrt(i);let n;for(n=1;n<e;n++)i%n===0&&(t.push(n),t.push(i/n));return e===(e|0)&&t.push(e),t.sort((s,o)=>s-o).pop(),t}function se(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Ma(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function Tn(i,t,e){let n,s,o;for(n=0,s=i.length;n<s;n++)o=i[n][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function ht(i){return i*(N/180)}function Fi(i){return i*(180/N)}function On(i){if(!V(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function In(i,t){const e=t.x-i.x,n=t.y-i.y,s=Math.sqrt(e*e+n*n);let o=Math.atan2(n,e);return o<-.5*N&&(o+=H),{angle:o,distance:s}}function Ri(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function Pa(i,t){return(i-t+ka)%H-N}function it(i){return(i%H+H)%H}function oe(i,t,e,n){const s=it(i),o=it(t),a=it(e),r=it(o-s),l=it(a-s),c=it(s-o),h=it(s-a);return s===o||s===a||n&&o===a||r>l&&c<h}function G(i,t,e){return Math.max(t,Math.min(e,i))}function Aa(i){return G(i,-32768,32767)}function mt(i,t,e,n=1e-6){return i>=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function Ei(i,t,e){e=e||(a=>i[a]<t);let n=i.length-1,s=0,o;for(;n-s>1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}const Tt=(i,t,e,n)=>Ei(i,e,n?s=>{const o=i[s][t];return o<e||o===e&&i[s+1][t]===e}:s=>i[s][t]<e),Da=(i,t,e)=>Ei(i,e,n=>i[n][t]>=e);function La(i,t,e){let n=0,s=i.length;for(;n<s&&i[n]<t;)n++;for(;s>n&&i[s-1]>e;)s--;return n>0||s<i.length?i.slice(n,s):i}const Fn=["push","pop","shift","splice","unshift"];function Ta(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Fn.forEach(e=>{const n="_onData"+Ii(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const a=s.apply(this,o);return i._chartjs.listeners.forEach(r=>{typeof r[n]=="function"&&r[n](...o)}),a}})})}function Rn(i,t){const e=i._chartjs;if(!e)return;const n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(Fn.forEach(o=>{delete i[o]}),delete i._chartjs)}function En(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Bn=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function zn(i,t){let e=[],n=!1;return function(...s){e=s,n||(n=!0,Bn.call(window,()=>{n=!1,i.apply(t,e)}))}}function Oa(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}const Bi=i=>i==="start"?"left":i==="end"?"right":"center",q=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Ia=(i,t,e,n)=>i===(n?"left":"right")?e:i==="center"?(t+e)/2:t;function Fa(i,t,e){const n=t.length;let s=0,o=n;if(i._sorted){const{iScale:a,_parsed:r}=i,l=a.axis,{min:c,max:h,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(s=G(Math.min(Tt(r,l,c).lo,e?n:Tt(t,l,a.getPixelForValue(c)).lo),0,n-1)),u?o=G(Math.max(Tt(r,a.axis,h,!0).hi+1,e?0:Tt(t,l,a.getPixelForValue(h),!0).hi+1),s,n)-s:o=n-s}return{start:s,count:o}}function Ra(i){const{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}const Ve=i=>i===0||i===1,Wn=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*H/e)),Hn=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*H/e)+1,ae={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*$)+1,easeOutSine:i=>Math.sin(i*$),easeInOutSine:i=>-.5*(Math.cos(N*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Ve(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Ve(i)?i:Wn(i,.075,.3),easeOutElastic:i=>Ve(i)?i:Hn(i,.075,.3),easeInOutElastic(i){return Ve(i)?i:i<.5?.5*Wn(i*2,.1125,.45):.5+.5*Hn(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-ae.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?ae.easeInBounce(i*2)*.5:ae.easeOutBounce(i*2-1)*.5+.5};function zi(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Nn(i){return zi(i)?i:new Jt(i)}function Wi(i){return zi(i)?i:new Jt(i).saturate(.5).darken(.1).hexString()}const Ea=["x","y","borderWidth","radius","tension"],Ba=["color","borderColor","backgroundColor"];function za(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Ba},numbers:{type:"number",properties:Ea}}),i.describe("animations",{_fallback:"animation"}),i.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=>t|0}}}})}function Wa(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Vn=new Map;function Ha(i,t){t=t||{};const e=i+JSON.stringify(t);let n=Vn.get(e);return n||(n=new Intl.NumberFormat(i,t),Vn.set(e,n)),n}function je(i,t,e){return Ha(t,e).format(i)}const jn={values(i){return W(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const n=this.chart.options.locale;let s,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Na(i,e)}const a=wt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),je(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";const n=e[t].significand||i/Math.pow(10,Math.floor(wt(i)));return[1,2,3,5,10,15].includes(n)||t>.8*e.length?jn.numeric.call(this,i,t,e):""}};function Na(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var $e={formatters:jn};function Va(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,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:$e.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ot=Object.create(null),Hi=Object.create(null);function re(i,t){if(!t)return i;const e=t.split(".");for(let n=0,s=e.length;n<s;++n){const o=e[n];i=i[o]||(i[o]=Object.create(null))}return i}function Ni(i,t,e){return typeof t=="string"?te(re(i,t),e):te(re(i,""),t)}class ja{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=n=>n.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=(n,s)=>Wi(s.backgroundColor),this.hoverBorderColor=(n,s)=>Wi(s.borderColor),this.hoverColor=(n,s)=>Wi(s.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 Ni(this,t,e)}get(t){return re(this,t)}describe(t,e){return Ni(Hi,t,e)}override(t,e){return Ni(Ot,t,e)}route(t,e,n,s){const o=re(this,t),a=re(this,n),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[r],c=a[s];return O(l)?Object.assign({},c,l):T(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var j=new ja({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[za,Wa,Va]);function $a(i){return!i||F(i.size)||F(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ue(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function Ua(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let a=0;const r=e.length;let l,c,h,d,u;for(l=0;l<r;l++)if(d=e[l],d!=null&&!W(d))a=Ue(i,s,o,a,d);else if(W(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!W(u)&&(a=Ue(i,s,o,a,u));i.restore();const f=o.length/2;if(f>e.length){for(l=0;l<f;l++)delete s[o[l]];o.splice(0,f)}return a}function It(i,t,e){const n=i.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*n)/n+s}function $n(i,t){t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore()}function Vi(i,t,e,n){Un(i,t,e,n,null)}function Un(i,t,e,n,s){let o,a,r,l,c,h,d,u;const f=t.pointStyle,m=t.rotation,p=t.radius;let g=(m||0)*wa;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,n),i.rotate(g),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(p)||p<=0)){switch(i.beginPath(),f){default:s?i.ellipse(e,n,s/2,p,0,0,H):i.arc(e,n,p,0,H),i.closePath();break;case"triangle":h=s?s/2:p,i.moveTo(e+Math.sin(g)*h,n-Math.cos(g)*p),g+=Dn,i.lineTo(e+Math.sin(g)*h,n-Math.cos(g)*p),g+=Dn,i.lineTo(e+Math.sin(g)*h,n-Math.cos(g)*p),i.closePath();break;case"rectRounded":c=p*.516,l=p-c,a=Math.cos(g+Lt)*l,d=Math.cos(g+Lt)*(s?s/2-c:l),r=Math.sin(g+Lt)*l,u=Math.sin(g+Lt)*(s?s/2-c:l),i.arc(e-d,n-r,c,g-N,g-$),i.arc(e+u,n-a,c,g-$,g),i.arc(e+d,n+r,c,g,g+$),i.arc(e-u,n+a,c,g+$,g+N),i.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,h=s?s/2:l,i.rect(e-h,n-l,2*h,2*l);break}g+=Lt;case"rectRot":d=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),i.moveTo(e-d,n-r),i.lineTo(e+u,n-a),i.lineTo(e+d,n+r),i.lineTo(e-u,n+a),i.closePath();break;case"crossRot":g+=Lt;case"cross":d=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),i.moveTo(e-d,n-r),i.lineTo(e+d,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a);break;case"star":d=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),i.moveTo(e-d,n-r),i.lineTo(e+d,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a),g+=Lt,d=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),i.moveTo(e-d,n-r),i.lineTo(e+d,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a);break;case"line":a=s?s/2:Math.cos(g)*p,r=Math.sin(g)*p,i.moveTo(e-a,n-r),i.lineTo(e+a,n+r);break;case"dash":i.moveTo(e,n),i.lineTo(e+Math.cos(g)*(s?s/2:p),n+Math.sin(g)*p);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function bt(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.x<t.right+e&&i.y>t.top-e&&i.y<t.bottom+e}function Ye(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function Xe(i){i.restore()}function Ya(i,t,e,n,s){if(!t)return i.lineTo(e.x,e.y);if(s==="middle"){const o=(t.x+e.x)/2;i.lineTo(o,t.y),i.lineTo(o,e.y)}else s==="after"!=!!n?i.lineTo(t.x,e.y):i.lineTo(e.x,t.y);i.lineTo(e.x,e.y)}function Xa(i,t,e,n){if(!t)return i.lineTo(e.x,e.y);i.bezierCurveTo(n?t.cp1x:t.cp2x,n?t.cp1y:t.cp2y,n?e.cp2x:e.cp1x,n?e.cp2y:e.cp1y,e.x,e.y)}function Ga(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),F(t.rotation)||i.rotate(t.rotation),t.color&&(i.fillStyle=t.color),t.textAlign&&(i.textAlign=t.textAlign),t.textBaseline&&(i.textBaseline=t.textBaseline)}function qa(i,t,e,n,s){if(s.strikethrough||s.underline){const o=i.measureText(n),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,h=s.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=s.decorationWidth||2,i.moveTo(a,h),i.lineTo(r,h),i.stroke()}}function Ka(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function Ft(i,t,e,n,s,o={}){const a=W(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=s.string,Ga(i,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Ka(i,o.backdrop),r&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),F(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,n,o.maxWidth)),i.fillText(c,e,n,o.maxWidth),qa(i,e,n,c,o),n+=Number(s.lineHeight);i.restore()}function le(i,t){const{x:e,y:n,w:s,h:o,radius:a}=t;i.arc(e+a.topLeft,n+a.topLeft,a.topLeft,1.5*N,N,!0),i.lineTo(e,n+o-a.bottomLeft),i.arc(e+a.bottomLeft,n+o-a.bottomLeft,a.bottomLeft,N,$,!0),i.lineTo(e+s-a.bottomRight,n+o),i.arc(e+s-a.bottomRight,n+o-a.bottomRight,a.bottomRight,$,0,!0),i.lineTo(e+s,n+a.topRight),i.arc(e+s-a.topRight,n+a.topRight,a.topRight,0,-$,!0),i.lineTo(e+a.topLeft,n)}const Za=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Qa=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Ja(i,t){const e=(""+i).match(Za);if(!e||e[1]==="normal")return t*1.2;switch(i=+e[2],e[3]){case"px":return i;case"%":i/=100;break}return t*i}const tr=i=>+i||0;function ji(i,t){const e={},n=O(t),s=n?Object.keys(t):t,o=O(i)?n?a=>T(i[a],i[t[a]]):a=>i[a]:()=>i;for(const a of s)e[a]=tr(o(a));return e}function Yn(i){return ji(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Rt(i){return ji(i,["topLeft","topRight","bottomLeft","bottomRight"])}function K(i){const t=Yn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Y(i,t){i=i||{},t=t||j.font;let e=T(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=T(i.style,t.style);n&&!(""+n).match(Qa)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const s={family:T(i.family,t.family),lineHeight:Ja(T(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:T(i.weight,t.weight),string:""};return s.string=$a(s),s}function Ge(i,t,e,n){let s=!0,o,a,r;for(o=0,a=i.length;o<a;++o)if(r=i[o],r!==void 0&&(t!==void 0&&typeof r=="function"&&(r=r(t),s=!1),e!==void 0&&W(r)&&(r=r[e%r.length],s=!1),r!==void 0))return n&&!s&&(n.cacheable=!1),r}function er(i,t,e){const{min:n,max:s}=i,o=Cn(t,(s-n)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(n,-Math.abs(o)),max:a(s,o)}}function Ct(i,t){return Object.assign(Object.create(i),t)}function $i(i,t=[""],e,n,s=()=>i[0]){const o=e||i;typeof n>"u"&&(n=Zn("_fallback",i));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:n,_getTarget:s,override:r=>$i([r,...i],t,o,n)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete i[0][l],!0},get(r,l){return Gn(r,l,()=>cr(l,t,i,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,l){return Qn(r).includes(l)},ownKeys(r){return Qn(r)},set(r,l,c){const h=r._storage||(r._storage=s());return r[l]=h[l]=c,delete r._keys,!0}})}function jt(i,t,e,n){const s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Xn(i,n),setContext:o=>jt(i,o,e,n),override:o=>jt(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,a){return delete o[a],delete i[a],!0},get(o,a,r){return Gn(o,a,()=>nr(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(i,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,a)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,a){return Reflect.has(i,a)},ownKeys(){return Reflect.ownKeys(i)},set(o,a,r){return i[a]=r,delete o[a],!0}})}function Xn(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:kt(e)?e:()=>e,isIndexable:kt(n)?n:()=>n}}const ir=(i,t)=>i?i+Ii(t):t,Ui=(i,t)=>O(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Gn(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const n=e();return i[t]=n,n}function nr(i,t,e){const{_proxy:n,_context:s,_subProxy:o,_descriptors:a}=i;let r=n[t];return kt(r)&&a.isScriptable(t)&&(r=sr(t,r,i,e)),W(r)&&r.length&&(r=or(t,r,i,a.isIndexable)),Ui(t,r)&&(r=jt(r,s,o&&o[t],a)),r}function sr(i,t,e,n){const{_proxy:s,_context:o,_subProxy:a,_stack:r}=e;if(r.has(i))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+i);r.add(i);let l=t(o,a||n);return r.delete(i),Ui(i,l)&&(l=Yi(s._scopes,s,i,l)),l}function or(i,t,e,n){const{_proxy:s,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&n(i))return t[o.index%t.length];if(O(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=Yi(c,s,i,h);t.push(jt(d,o,a&&a[i],r))}}return t}function qn(i,t,e){return kt(i)?i(t,e):i}const ar=(i,t)=>i===!0?t:typeof i=="string"?St(t,i):void 0;function rr(i,t,e,n,s){for(const o of t){const a=ar(e,o);if(a){i.add(a);const r=qn(a._fallback,e,s);if(typeof r<"u"&&r!==e&&r!==n)return r}else if(a===!1&&typeof n<"u"&&e!==n)return null}return!1}function Yi(i,t,e,n){const s=t._rootScopes,o=qn(t._fallback,e,n),a=[...i,...s],r=new Set;r.add(n);let l=Kn(r,a,e,o||e,n);return l===null||typeof o<"u"&&o!==e&&(l=Kn(r,a,o,l,n),l===null)?!1:$i(Array.from(r),[""],s,o,()=>lr(t,e,n))}function Kn(i,t,e,n,s){for(;e;)e=rr(i,t,e,n,s);return e}function lr(i,t,e){const n=i._getTarget();t in n||(n[t]={});const s=n[t];return W(s)&&O(e)?e:s||{}}function cr(i,t,e,n){let s;for(const o of t)if(s=Zn(ir(o,i),e),typeof s<"u")return Ui(i,s)?Yi(e,n,i,s):s}function Zn(i,t){for(const e of t){if(!e)continue;const n=e[i];if(typeof n<"u")return n}}function Qn(i){let t=i._keys;return t||(t=i._keys=hr(i._scopes)),t}function hr(i){const t=new Set;for(const e of i)for(const n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function dr(i,t,e,n){const{iScale:s}=i,{key:o="r"}=this._parsing,a=new Array(n);let r,l,c,h;for(r=0,l=n;r<l;++r)c=r+e,h=t[c],a[r]={r:s.parse(St(h,o),c)};return a}const ur=Number.EPSILON||1e-14,$t=(i,t)=>t<i.length&&!i[t].skip&&i[t],Jn=i=>i==="x"?"y":"x";function fr(i,t,e,n){const s=i.skip?t:i,o=t,a=e.skip?t:e,r=Ri(o,s),l=Ri(a,o);let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:o.x-d*(a.x-s.x),y:o.y-d*(a.y-s.y)},next:{x:o.x+u*(a.x-s.x),y:o.y+u*(a.y-s.y)}}}function gr(i,t,e){const n=i.length;let s,o,a,r,l,c=$t(i,0);for(let h=0;h<n-1;++h)if(l=c,c=$t(i,h+1),!(!l||!c)){if(ne(t[h],0,ur)){e[h]=e[h+1]=0;continue}s=e[h]/t[h],o=e[h+1]/t[h],r=Math.pow(s,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),e[h]=s*a*t[h],e[h+1]=o*a*t[h])}}function pr(i,t,e="x"){const n=Jn(e),s=i.length;let o,a,r,l=$t(i,0);for(let c=0;c<s;++c){if(a=r,r=l,l=$t(i,c+1),!r)continue;const h=r[e],d=r[n];a&&(o=(h-a[e])/3,r[`cp1${e}`]=h-o,r[`cp1${n}`]=d-o*t[c]),l&&(o=(l[e]-h)/3,r[`cp2${e}`]=h+o,r[`cp2${n}`]=d+o*t[c])}}function mr(i,t="x"){const e=Jn(t),n=i.length,s=Array(n).fill(0),o=Array(n);let a,r,l,c=$t(i,0);for(a=0;a<n;++a)if(r=l,l=c,c=$t(i,a+1),!!l){if(c){const h=c[t]-l[t];s[a]=h!==0?(c[e]-l[e])/h:0}o[a]=r?c?ct(s[a-1])!==ct(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}gr(i,s,o),pr(i,o,t)}function qe(i,t,e){return Math.max(Math.min(i,e),t)}function br(i,t){let e,n,s,o,a,r=bt(i[0],t);for(e=0,n=i.length;e<n;++e)a=o,o=r,r=e<n-1&&bt(i[e+1],t),o&&(s=i[e],a&&(s.cp1x=qe(s.cp1x,t.left,t.right),s.cp1y=qe(s.cp1y,t.top,t.bottom)),r&&(s.cp2x=qe(s.cp2x,t.left,t.right),s.cp2y=qe(s.cp2y,t.top,t.bottom)))}function yr(i,t,e,n,s){let o,a,r,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")mr(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,a=i.length;o<a;++o)r=i[o],l=fr(c,r,i[Math.min(o+1,a-(n?0:1))%a],t.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}t.capBezierPoints&&br(i,e)}function ts(){return typeof window<"u"&&typeof document<"u"}function Xi(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ke(i,t,e){let n;return typeof i=="string"?(n=parseInt(i,10),i.indexOf("%")!==-1&&(n=n/100*t.parentNode[e])):n=i,n}const Ze=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function xr(i,t){return Ze(i).getPropertyValue(t)}const _r=["top","right","bottom","left"];function Et(i,t,e){const n={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=_r[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const vr=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Sr(i,t){const e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n;let a=!1,r,l;if(vr(s,o,i.target))r=s,l=o;else{const c=t.getBoundingClientRect();r=n.clientX-c.left,l=n.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Bt(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:n}=t,s=Ze(e),o=s.boxSizing==="border-box",a=Et(s,"padding"),r=Et(s,"border","width"),{x:l,y:c,box:h}=Sr(i,e),d=a.left+(h&&r.left),u=a.top+(h&&r.top);let{width:f,height:m}=t;return o&&(f-=a.width+r.width,m-=a.height+r.height),{x:Math.round((l-d)/f*e.width/n),y:Math.round((c-u)/m*e.height/n)}}function kr(i,t,e){let n,s;if(t===void 0||e===void 0){const o=Xi(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const a=o.getBoundingClientRect(),r=Ze(o),l=Et(r,"border","width"),c=Et(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,n=Ke(r.maxWidth,o,"clientWidth"),s=Ke(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||Ne,maxHeight:s||Ne}}const Qe=i=>Math.round(i*10)/10;function wr(i,t,e,n){const s=Ze(i),o=Et(s,"margin"),a=Ke(s.maxWidth,i,"clientWidth")||Ne,r=Ke(s.maxHeight,i,"clientHeight")||Ne,l=kr(i,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const u=Et(s,"border","width"),f=Et(s,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?c/n:h-o.height),c=Qe(Math.min(c,a,l.maxWidth)),h=Qe(Math.min(h,r,l.maxHeight)),c&&!h&&(h=Qe(c/2)),(t!==void 0||e!==void 0)&&n&&l.height&&h>l.height&&(h=l.height,c=Qe(Math.floor(h*n))),{width:c,height:h}}function es(i,t,e){const n=t||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const a=i.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${i.height}px`,a.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||a.height!==s||a.width!==o?(i.currentDevicePixelRatio=n,a.height=s,a.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}const Cr=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return i}();function is(i,t){const e=xr(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function zt(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Mr(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Pr(i,t,e,n){const s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},a=zt(i,s,e),r=zt(s,o,e),l=zt(o,t,e),c=zt(a,r,e),h=zt(r,l,e);return zt(c,h,e)}const Ar=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},Dr=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Ut(i,t,e){return i?Ar(t,e):Dr()}function ns(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function ss(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function os(i){return i==="angle"?{between:oe,compare:Pa,normalize:it}:{between:mt,compare:(t,e)=>t-e,normalize:t=>t}}function as({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function Lr(i,t,e){const{property:n,start:s,end:o}=e,{between:a,normalize:r}=os(n),l=t.length;let{start:c,end:h,loop:d}=i,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&a(r(t[c%l][n]),s,o);++u)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:i.style}}function rs(i,t,e){if(!e)return[i];const{property:n,start:s,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=os(n),{start:h,end:d,loop:u,style:f}=Lr(i,t,e),m=[];let p=!1,g=null,b,y,x;const S=()=>l(s,x,b)&&r(s,x)!==0,v=()=>r(o,b)===0||l(o,x,b),w=()=>p||S(),k=()=>!p||v();for(let M=h,P=h;M<=d;++M)y=t[M%a],!y.skip&&(b=c(y[n]),b!==x&&(p=l(b,s,o),g===null&&w()&&(g=r(b,s)===0?M:P),g!==null&&k()&&(m.push(as({start:g,end:M,loop:u,count:a,style:f})),g=null),P=M,x=b));return g!==null&&m.push(as({start:g,end:d,loop:u,count:a,style:f})),m}function ls(i,t){const e=[],n=i.segments;for(let s=0;s<n.length;s++){const o=rs(n[s],i.points,t);o.length&&e.push(...o)}return e}function Tr(i,t,e,n){let s=0,o=t-1;if(e&&!n)for(;s<t&&!i[s].skip;)s++;for(;s<t&&i[s].skip;)s++;for(s%=t,e&&(o+=s);o>s&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Or(i,t,e,n){const s=i.length,o=[];let a=t,r=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%s];c.skip||c.stop?r.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%s,end:a%s,loop:n}),o}function Ir(i,t){const e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];const o=!!i._loop,{start:a,end:r}=Tr(e,s,o,n);if(n===!0)return cs(i,[{start:a,end:r,loop:o}],e,t);const l=r<a?r+s:r,c=!!i._fullLoop&&a===0&&r===s-1;return cs(i,Or(e,a,l,c),e,t)}function cs(i,t,e,n){return!n||!n.setContext||!e?t:Fr(i,t,e,n)}function Fr(i,t,e,n){const s=i._chart.getContext(),o=hs(i.options),{_datasetIndex:a,options:{spanGaps:r}}=i,l=e.length,c=[];let h=o,d=t[0].start,u=d;function f(m,p,g,b){const y=r?-1:1;if(m!==p){for(m+=l;e[m%l].skip;)m-=y;for(;e[p%l].skip;)p+=y;m%l!==p%l&&(c.push({start:m%l,end:p%l,loop:g,style:b}),h=b,d=p%l)}}for(const m of t){d=r?d:m.start;let p=e[d%l],g;for(u=d+1;u<=m.end;u++){const b=e[u%l];g=hs(n.setContext(Ct(s,{type:"segment",p0:p,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Rr(g,h)&&f(d,u-1,m.loop,h),p=b,h=g}d<u-1&&f(d,u-1,m.loop,h)}return c}function hs(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function Rr(i,t){if(!t)return!1;const e=[],n=function(s,o){return zi(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,n)!==JSON.stringify(t,n)}/*!
|
|
11
|
+
*/function pt(){}const ma=(()=>{let i=0;return()=>i++})();function F(i){return i===null||typeof i>"u"}function W(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function O(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function V(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function et(i,t){return V(i)?i:t}function T(i,t){return typeof i>"u"?t:i}const ba=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,Cn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function B(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function R(i,t,e,n){let s,o,a;if(W(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;s<o;s++)t.call(e,i[s],s);else if(O(i))for(a=Object.keys(i),o=a.length,s=0;s<o;s++)t.call(e,i[a[s]],a[s])}function We(i,t){let e,n,s,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,n=i.length;e<n;++e)if(s=i[e],o=t[e],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function He(i){if(W(i))return i.map(He);if(O(i)){const t=Object.create(null),e=Object.keys(i),n=e.length;let s=0;for(;s<n;++s)t[e[s]]=He(i[e[s]]);return t}return i}function Mn(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function ya(i,t,e,n){if(!Mn(i))return;const s=t[i],o=e[i];O(s)&&O(o)?te(s,o,n):t[i]=He(o)}function te(i,t,e){const n=W(t)?t:[t],s=n.length;if(!O(i))return i;e=e||{};const o=e.merger||ya;let a;for(let r=0;r<s;++r){if(a=n[r],!O(a))continue;const l=Object.keys(a);for(let c=0,h=l.length;c<h;++c)o(l[c],i,a,e)}return i}function ee(i,t){return te(i,t,{merger:xa})}function xa(i,t,e){if(!Mn(i))return;const n=t[i],s=e[i];O(n)&&O(s)?ee(n,s):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=He(s))}const Pn={"":i=>i,x:i=>i.x,y:i=>i.y};function _a(i){const t=i.split("."),e=[];let n="";for(const s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function va(i){const t=_a(i);return e=>{for(const n of t){if(n==="")break;e=e&&e[n]}return e}}function St(i,t){return(Pn[t]||(Pn[t]=va(t)))(i)}function Ii(i){return i.charAt(0).toUpperCase()+i.slice(1)}const ie=i=>typeof i<"u",kt=i=>typeof i=="function",An=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Sa(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const N=Math.PI,H=2*N,ka=H+N,Ne=Number.POSITIVE_INFINITY,wa=N/180,$=N/2,Lt=N/4,Dn=N*2/3,wt=Math.log10,ct=Math.sign;function ne(i,t,e){return Math.abs(i-t)<e}function Ln(i){const t=Math.round(i);i=ne(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(wt(i))),n=i/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function Ca(i){const t=[],e=Math.sqrt(i);let n;for(n=1;n<e;n++)i%n===0&&(t.push(n),t.push(i/n));return e===(e|0)&&t.push(e),t.sort((s,o)=>s-o).pop(),t}function se(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Ma(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function Tn(i,t,e){let n,s,o;for(n=0,s=i.length;n<s;n++)o=i[n][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function ht(i){return i*(N/180)}function Fi(i){return i*(180/N)}function On(i){if(!V(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function In(i,t){const e=t.x-i.x,n=t.y-i.y,s=Math.sqrt(e*e+n*n);let o=Math.atan2(n,e);return o<-.5*N&&(o+=H),{angle:o,distance:s}}function Ri(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function Pa(i,t){return(i-t+ka)%H-N}function it(i){return(i%H+H)%H}function oe(i,t,e,n){const s=it(i),o=it(t),a=it(e),r=it(o-s),l=it(a-s),c=it(s-o),h=it(s-a);return s===o||s===a||n&&o===a||r>l&&c<h}function G(i,t,e){return Math.max(t,Math.min(e,i))}function Aa(i){return G(i,-32768,32767)}function mt(i,t,e,n=1e-6){return i>=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function Ei(i,t,e){e=e||(a=>i[a]<t);let n=i.length-1,s=0,o;for(;n-s>1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}const Tt=(i,t,e,n)=>Ei(i,e,n?s=>{const o=i[s][t];return o<e||o===e&&i[s+1][t]===e}:s=>i[s][t]<e),Da=(i,t,e)=>Ei(i,e,n=>i[n][t]>=e);function La(i,t,e){let n=0,s=i.length;for(;n<s&&i[n]<t;)n++;for(;s>n&&i[s-1]>e;)s--;return n>0||s<i.length?i.slice(n,s):i}const Fn=["push","pop","shift","splice","unshift"];function Ta(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Fn.forEach(e=>{const n="_onData"+Ii(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const a=s.apply(this,o);return i._chartjs.listeners.forEach(r=>{typeof r[n]=="function"&&r[n](...o)}),a}})})}function Rn(i,t){const e=i._chartjs;if(!e)return;const n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(Fn.forEach(o=>{delete i[o]}),delete i._chartjs)}function En(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Bn=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function zn(i,t){let e=[],n=!1;return function(...s){e=s,n||(n=!0,Bn.call(window,()=>{n=!1,i.apply(t,e)}))}}function Oa(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}const Bi=i=>i==="start"?"left":i==="end"?"right":"center",q=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Ia=(i,t,e,n)=>i===(n?"left":"right")?e:i==="center"?(t+e)/2:t;function Fa(i,t,e){const n=t.length;let s=0,o=n;if(i._sorted){const{iScale:a,_parsed:r}=i,l=a.axis,{min:c,max:h,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(s=G(Math.min(Tt(r,l,c).lo,e?n:Tt(t,l,a.getPixelForValue(c)).lo),0,n-1)),u?o=G(Math.max(Tt(r,a.axis,h,!0).hi+1,e?0:Tt(t,l,a.getPixelForValue(h),!0).hi+1),s,n)-s:o=n-s}return{start:s,count:o}}function Ra(i){const{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}const Ve=i=>i===0||i===1,Wn=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*H/e)),Hn=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*H/e)+1,ae={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*$)+1,easeOutSine:i=>Math.sin(i*$),easeInOutSine:i=>-.5*(Math.cos(N*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Ve(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Ve(i)?i:Wn(i,.075,.3),easeOutElastic:i=>Ve(i)?i:Hn(i,.075,.3),easeInOutElastic(i){return Ve(i)?i:i<.5?.5*Wn(i*2,.1125,.45):.5+.5*Hn(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-ae.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?ae.easeInBounce(i*2)*.5:ae.easeOutBounce(i*2-1)*.5+.5};function zi(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Nn(i){return zi(i)?i:new Jt(i)}function Wi(i){return zi(i)?i:new Jt(i).saturate(.5).darken(.1).hexString()}const Ea=["x","y","borderWidth","radius","tension"],Ba=["color","borderColor","backgroundColor"];function za(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Ba},numbers:{type:"number",properties:Ea}}),i.describe("animations",{_fallback:"animation"}),i.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=>t|0}}}})}function Wa(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Vn=new Map;function Ha(i,t){t=t||{};const e=i+JSON.stringify(t);let n=Vn.get(e);return n||(n=new Intl.NumberFormat(i,t),Vn.set(e,n)),n}function je(i,t,e){return Ha(t,e).format(i)}const jn={values(i){return W(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const n=this.chart.options.locale;let s,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Na(i,e)}const a=wt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),je(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";const n=e[t].significand||i/Math.pow(10,Math.floor(wt(i)));return[1,2,3,5,10,15].includes(n)||t>.8*e.length?jn.numeric.call(this,i,t,e):""}};function Na(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var $e={formatters:jn};function Va(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,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:$e.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ot=Object.create(null),Hi=Object.create(null);function re(i,t){if(!t)return i;const e=t.split(".");for(let n=0,s=e.length;n<s;++n){const o=e[n];i=i[o]||(i[o]=Object.create(null))}return i}function Ni(i,t,e){return typeof t=="string"?te(re(i,t),e):te(re(i,""),t)}class ja{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=n=>n.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=(n,s)=>Wi(s.backgroundColor),this.hoverBorderColor=(n,s)=>Wi(s.borderColor),this.hoverColor=(n,s)=>Wi(s.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 Ni(this,t,e)}get(t){return re(this,t)}describe(t,e){return Ni(Hi,t,e)}override(t,e){return Ni(Ot,t,e)}route(t,e,n,s){const o=re(this,t),a=re(this,n),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[r],c=a[s];return O(l)?Object.assign({},c,l):T(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var j=new ja({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[za,Wa,Va]);function $a(i){return!i||F(i.size)||F(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ue(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function Ua(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let a=0;const r=e.length;let l,c,h,d,u;for(l=0;l<r;l++)if(d=e[l],d!=null&&!W(d))a=Ue(i,s,o,a,d);else if(W(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!W(u)&&(a=Ue(i,s,o,a,u));i.restore();const f=o.length/2;if(f>e.length){for(l=0;l<f;l++)delete s[o[l]];o.splice(0,f)}return a}function It(i,t,e){const n=i.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*n)/n+s}function $n(i,t){t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore()}function Vi(i,t,e,n){Un(i,t,e,n,null)}function Un(i,t,e,n,s){let o,a,r,l,c,h,d,u;const f=t.pointStyle,m=t.rotation,g=t.radius;let p=(m||0)*wa;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,n),i.rotate(p),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(g)||g<=0)){switch(i.beginPath(),f){default:s?i.ellipse(e,n,s/2,g,0,0,H):i.arc(e,n,g,0,H),i.closePath();break;case"triangle":h=s?s/2:g,i.moveTo(e+Math.sin(p)*h,n-Math.cos(p)*g),p+=Dn,i.lineTo(e+Math.sin(p)*h,n-Math.cos(p)*g),p+=Dn,i.lineTo(e+Math.sin(p)*h,n-Math.cos(p)*g),i.closePath();break;case"rectRounded":c=g*.516,l=g-c,a=Math.cos(p+Lt)*l,d=Math.cos(p+Lt)*(s?s/2-c:l),r=Math.sin(p+Lt)*l,u=Math.sin(p+Lt)*(s?s/2-c:l),i.arc(e-d,n-r,c,p-N,p-$),i.arc(e+u,n-a,c,p-$,p),i.arc(e+d,n+r,c,p,p+$),i.arc(e-u,n+a,c,p+$,p+N),i.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*g,h=s?s/2:l,i.rect(e-h,n-l,2*h,2*l);break}p+=Lt;case"rectRot":d=Math.cos(p)*(s?s/2:g),a=Math.cos(p)*g,r=Math.sin(p)*g,u=Math.sin(p)*(s?s/2:g),i.moveTo(e-d,n-r),i.lineTo(e+u,n-a),i.lineTo(e+d,n+r),i.lineTo(e-u,n+a),i.closePath();break;case"crossRot":p+=Lt;case"cross":d=Math.cos(p)*(s?s/2:g),a=Math.cos(p)*g,r=Math.sin(p)*g,u=Math.sin(p)*(s?s/2:g),i.moveTo(e-d,n-r),i.lineTo(e+d,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a);break;case"star":d=Math.cos(p)*(s?s/2:g),a=Math.cos(p)*g,r=Math.sin(p)*g,u=Math.sin(p)*(s?s/2:g),i.moveTo(e-d,n-r),i.lineTo(e+d,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a),p+=Lt,d=Math.cos(p)*(s?s/2:g),a=Math.cos(p)*g,r=Math.sin(p)*g,u=Math.sin(p)*(s?s/2:g),i.moveTo(e-d,n-r),i.lineTo(e+d,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a);break;case"line":a=s?s/2:Math.cos(p)*g,r=Math.sin(p)*g,i.moveTo(e-a,n-r),i.lineTo(e+a,n+r);break;case"dash":i.moveTo(e,n),i.lineTo(e+Math.cos(p)*(s?s/2:g),n+Math.sin(p)*g);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function bt(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.x<t.right+e&&i.y>t.top-e&&i.y<t.bottom+e}function Ye(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function Xe(i){i.restore()}function Ya(i,t,e,n,s){if(!t)return i.lineTo(e.x,e.y);if(s==="middle"){const o=(t.x+e.x)/2;i.lineTo(o,t.y),i.lineTo(o,e.y)}else s==="after"!=!!n?i.lineTo(t.x,e.y):i.lineTo(e.x,t.y);i.lineTo(e.x,e.y)}function Xa(i,t,e,n){if(!t)return i.lineTo(e.x,e.y);i.bezierCurveTo(n?t.cp1x:t.cp2x,n?t.cp1y:t.cp2y,n?e.cp2x:e.cp1x,n?e.cp2y:e.cp1y,e.x,e.y)}function Ga(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),F(t.rotation)||i.rotate(t.rotation),t.color&&(i.fillStyle=t.color),t.textAlign&&(i.textAlign=t.textAlign),t.textBaseline&&(i.textBaseline=t.textBaseline)}function qa(i,t,e,n,s){if(s.strikethrough||s.underline){const o=i.measureText(n),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,h=s.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=s.decorationWidth||2,i.moveTo(a,h),i.lineTo(r,h),i.stroke()}}function Ka(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function Ft(i,t,e,n,s,o={}){const a=W(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=s.string,Ga(i,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Ka(i,o.backdrop),r&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),F(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,n,o.maxWidth)),i.fillText(c,e,n,o.maxWidth),qa(i,e,n,c,o),n+=Number(s.lineHeight);i.restore()}function le(i,t){const{x:e,y:n,w:s,h:o,radius:a}=t;i.arc(e+a.topLeft,n+a.topLeft,a.topLeft,1.5*N,N,!0),i.lineTo(e,n+o-a.bottomLeft),i.arc(e+a.bottomLeft,n+o-a.bottomLeft,a.bottomLeft,N,$,!0),i.lineTo(e+s-a.bottomRight,n+o),i.arc(e+s-a.bottomRight,n+o-a.bottomRight,a.bottomRight,$,0,!0),i.lineTo(e+s,n+a.topRight),i.arc(e+s-a.topRight,n+a.topRight,a.topRight,0,-$,!0),i.lineTo(e+a.topLeft,n)}const Za=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Qa=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Ja(i,t){const e=(""+i).match(Za);if(!e||e[1]==="normal")return t*1.2;switch(i=+e[2],e[3]){case"px":return i;case"%":i/=100;break}return t*i}const tr=i=>+i||0;function ji(i,t){const e={},n=O(t),s=n?Object.keys(t):t,o=O(i)?n?a=>T(i[a],i[t[a]]):a=>i[a]:()=>i;for(const a of s)e[a]=tr(o(a));return e}function Yn(i){return ji(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Rt(i){return ji(i,["topLeft","topRight","bottomLeft","bottomRight"])}function K(i){const t=Yn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Y(i,t){i=i||{},t=t||j.font;let e=T(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=T(i.style,t.style);n&&!(""+n).match(Qa)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const s={family:T(i.family,t.family),lineHeight:Ja(T(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:T(i.weight,t.weight),string:""};return s.string=$a(s),s}function Ge(i,t,e,n){let s=!0,o,a,r;for(o=0,a=i.length;o<a;++o)if(r=i[o],r!==void 0&&(t!==void 0&&typeof r=="function"&&(r=r(t),s=!1),e!==void 0&&W(r)&&(r=r[e%r.length],s=!1),r!==void 0))return n&&!s&&(n.cacheable=!1),r}function er(i,t,e){const{min:n,max:s}=i,o=Cn(t,(s-n)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(n,-Math.abs(o)),max:a(s,o)}}function Ct(i,t){return Object.assign(Object.create(i),t)}function $i(i,t=[""],e,n,s=()=>i[0]){const o=e||i;typeof n>"u"&&(n=Zn("_fallback",i));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:n,_getTarget:s,override:r=>$i([r,...i],t,o,n)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete i[0][l],!0},get(r,l){return Gn(r,l,()=>cr(l,t,i,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,l){return Qn(r).includes(l)},ownKeys(r){return Qn(r)},set(r,l,c){const h=r._storage||(r._storage=s());return r[l]=h[l]=c,delete r._keys,!0}})}function jt(i,t,e,n){const s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Xn(i,n),setContext:o=>jt(i,o,e,n),override:o=>jt(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,a){return delete o[a],delete i[a],!0},get(o,a,r){return Gn(o,a,()=>nr(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(i,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,a)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,a){return Reflect.has(i,a)},ownKeys(){return Reflect.ownKeys(i)},set(o,a,r){return i[a]=r,delete o[a],!0}})}function Xn(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:kt(e)?e:()=>e,isIndexable:kt(n)?n:()=>n}}const ir=(i,t)=>i?i+Ii(t):t,Ui=(i,t)=>O(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Gn(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const n=e();return i[t]=n,n}function nr(i,t,e){const{_proxy:n,_context:s,_subProxy:o,_descriptors:a}=i;let r=n[t];return kt(r)&&a.isScriptable(t)&&(r=sr(t,r,i,e)),W(r)&&r.length&&(r=or(t,r,i,a.isIndexable)),Ui(t,r)&&(r=jt(r,s,o&&o[t],a)),r}function sr(i,t,e,n){const{_proxy:s,_context:o,_subProxy:a,_stack:r}=e;if(r.has(i))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+i);r.add(i);let l=t(o,a||n);return r.delete(i),Ui(i,l)&&(l=Yi(s._scopes,s,i,l)),l}function or(i,t,e,n){const{_proxy:s,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&n(i))return t[o.index%t.length];if(O(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=Yi(c,s,i,h);t.push(jt(d,o,a&&a[i],r))}}return t}function qn(i,t,e){return kt(i)?i(t,e):i}const ar=(i,t)=>i===!0?t:typeof i=="string"?St(t,i):void 0;function rr(i,t,e,n,s){for(const o of t){const a=ar(e,o);if(a){i.add(a);const r=qn(a._fallback,e,s);if(typeof r<"u"&&r!==e&&r!==n)return r}else if(a===!1&&typeof n<"u"&&e!==n)return null}return!1}function Yi(i,t,e,n){const s=t._rootScopes,o=qn(t._fallback,e,n),a=[...i,...s],r=new Set;r.add(n);let l=Kn(r,a,e,o||e,n);return l===null||typeof o<"u"&&o!==e&&(l=Kn(r,a,o,l,n),l===null)?!1:$i(Array.from(r),[""],s,o,()=>lr(t,e,n))}function Kn(i,t,e,n,s){for(;e;)e=rr(i,t,e,n,s);return e}function lr(i,t,e){const n=i._getTarget();t in n||(n[t]={});const s=n[t];return W(s)&&O(e)?e:s||{}}function cr(i,t,e,n){let s;for(const o of t)if(s=Zn(ir(o,i),e),typeof s<"u")return Ui(i,s)?Yi(e,n,i,s):s}function Zn(i,t){for(const e of t){if(!e)continue;const n=e[i];if(typeof n<"u")return n}}function Qn(i){let t=i._keys;return t||(t=i._keys=hr(i._scopes)),t}function hr(i){const t=new Set;for(const e of i)for(const n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function dr(i,t,e,n){const{iScale:s}=i,{key:o="r"}=this._parsing,a=new Array(n);let r,l,c,h;for(r=0,l=n;r<l;++r)c=r+e,h=t[c],a[r]={r:s.parse(St(h,o),c)};return a}const ur=Number.EPSILON||1e-14,$t=(i,t)=>t<i.length&&!i[t].skip&&i[t],Jn=i=>i==="x"?"y":"x";function fr(i,t,e,n){const s=i.skip?t:i,o=t,a=e.skip?t:e,r=Ri(o,s),l=Ri(a,o);let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:o.x-d*(a.x-s.x),y:o.y-d*(a.y-s.y)},next:{x:o.x+u*(a.x-s.x),y:o.y+u*(a.y-s.y)}}}function gr(i,t,e){const n=i.length;let s,o,a,r,l,c=$t(i,0);for(let h=0;h<n-1;++h)if(l=c,c=$t(i,h+1),!(!l||!c)){if(ne(t[h],0,ur)){e[h]=e[h+1]=0;continue}s=e[h]/t[h],o=e[h+1]/t[h],r=Math.pow(s,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),e[h]=s*a*t[h],e[h+1]=o*a*t[h])}}function pr(i,t,e="x"){const n=Jn(e),s=i.length;let o,a,r,l=$t(i,0);for(let c=0;c<s;++c){if(a=r,r=l,l=$t(i,c+1),!r)continue;const h=r[e],d=r[n];a&&(o=(h-a[e])/3,r[`cp1${e}`]=h-o,r[`cp1${n}`]=d-o*t[c]),l&&(o=(l[e]-h)/3,r[`cp2${e}`]=h+o,r[`cp2${n}`]=d+o*t[c])}}function mr(i,t="x"){const e=Jn(t),n=i.length,s=Array(n).fill(0),o=Array(n);let a,r,l,c=$t(i,0);for(a=0;a<n;++a)if(r=l,l=c,c=$t(i,a+1),!!l){if(c){const h=c[t]-l[t];s[a]=h!==0?(c[e]-l[e])/h:0}o[a]=r?c?ct(s[a-1])!==ct(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}gr(i,s,o),pr(i,o,t)}function qe(i,t,e){return Math.max(Math.min(i,e),t)}function br(i,t){let e,n,s,o,a,r=bt(i[0],t);for(e=0,n=i.length;e<n;++e)a=o,o=r,r=e<n-1&&bt(i[e+1],t),o&&(s=i[e],a&&(s.cp1x=qe(s.cp1x,t.left,t.right),s.cp1y=qe(s.cp1y,t.top,t.bottom)),r&&(s.cp2x=qe(s.cp2x,t.left,t.right),s.cp2y=qe(s.cp2y,t.top,t.bottom)))}function yr(i,t,e,n,s){let o,a,r,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")mr(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,a=i.length;o<a;++o)r=i[o],l=fr(c,r,i[Math.min(o+1,a-(n?0:1))%a],t.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}t.capBezierPoints&&br(i,e)}function ts(){return typeof window<"u"&&typeof document<"u"}function Xi(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ke(i,t,e){let n;return typeof i=="string"?(n=parseInt(i,10),i.indexOf("%")!==-1&&(n=n/100*t.parentNode[e])):n=i,n}const Ze=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function xr(i,t){return Ze(i).getPropertyValue(t)}const _r=["top","right","bottom","left"];function Et(i,t,e){const n={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=_r[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const vr=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Sr(i,t){const e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n;let a=!1,r,l;if(vr(s,o,i.target))r=s,l=o;else{const c=t.getBoundingClientRect();r=n.clientX-c.left,l=n.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Bt(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:n}=t,s=Ze(e),o=s.boxSizing==="border-box",a=Et(s,"padding"),r=Et(s,"border","width"),{x:l,y:c,box:h}=Sr(i,e),d=a.left+(h&&r.left),u=a.top+(h&&r.top);let{width:f,height:m}=t;return o&&(f-=a.width+r.width,m-=a.height+r.height),{x:Math.round((l-d)/f*e.width/n),y:Math.round((c-u)/m*e.height/n)}}function kr(i,t,e){let n,s;if(t===void 0||e===void 0){const o=Xi(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const a=o.getBoundingClientRect(),r=Ze(o),l=Et(r,"border","width"),c=Et(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,n=Ke(r.maxWidth,o,"clientWidth"),s=Ke(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||Ne,maxHeight:s||Ne}}const Qe=i=>Math.round(i*10)/10;function wr(i,t,e,n){const s=Ze(i),o=Et(s,"margin"),a=Ke(s.maxWidth,i,"clientWidth")||Ne,r=Ke(s.maxHeight,i,"clientHeight")||Ne,l=kr(i,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const u=Et(s,"border","width"),f=Et(s,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?c/n:h-o.height),c=Qe(Math.min(c,a,l.maxWidth)),h=Qe(Math.min(h,r,l.maxHeight)),c&&!h&&(h=Qe(c/2)),(t!==void 0||e!==void 0)&&n&&l.height&&h>l.height&&(h=l.height,c=Qe(Math.floor(h*n))),{width:c,height:h}}function es(i,t,e){const n=t||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const a=i.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${i.height}px`,a.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||a.height!==s||a.width!==o?(i.currentDevicePixelRatio=n,a.height=s,a.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}const Cr=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return i}();function is(i,t){const e=xr(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function zt(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Mr(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Pr(i,t,e,n){const s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},a=zt(i,s,e),r=zt(s,o,e),l=zt(o,t,e),c=zt(a,r,e),h=zt(r,l,e);return zt(c,h,e)}const Ar=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},Dr=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Ut(i,t,e){return i?Ar(t,e):Dr()}function ns(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function ss(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function os(i){return i==="angle"?{between:oe,compare:Pa,normalize:it}:{between:mt,compare:(t,e)=>t-e,normalize:t=>t}}function as({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function Lr(i,t,e){const{property:n,start:s,end:o}=e,{between:a,normalize:r}=os(n),l=t.length;let{start:c,end:h,loop:d}=i,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&a(r(t[c%l][n]),s,o);++u)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:i.style}}function rs(i,t,e){if(!e)return[i];const{property:n,start:s,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=os(n),{start:h,end:d,loop:u,style:f}=Lr(i,t,e),m=[];let g=!1,p=null,b,y,_;const S=()=>l(s,_,b)&&r(s,_)!==0,v=()=>r(o,b)===0||l(o,_,b),w=()=>g||S(),k=()=>!g||v();for(let M=h,P=h;M<=d;++M)y=t[M%a],!y.skip&&(b=c(y[n]),b!==_&&(g=l(b,s,o),p===null&&w()&&(p=r(b,s)===0?M:P),p!==null&&k()&&(m.push(as({start:p,end:M,loop:u,count:a,style:f})),p=null),P=M,_=b));return p!==null&&m.push(as({start:p,end:d,loop:u,count:a,style:f})),m}function ls(i,t){const e=[],n=i.segments;for(let s=0;s<n.length;s++){const o=rs(n[s],i.points,t);o.length&&e.push(...o)}return e}function Tr(i,t,e,n){let s=0,o=t-1;if(e&&!n)for(;s<t&&!i[s].skip;)s++;for(;s<t&&i[s].skip;)s++;for(s%=t,e&&(o+=s);o>s&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Or(i,t,e,n){const s=i.length,o=[];let a=t,r=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%s];c.skip||c.stop?r.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%s,end:a%s,loop:n}),o}function Ir(i,t){const e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];const o=!!i._loop,{start:a,end:r}=Tr(e,s,o,n);if(n===!0)return cs(i,[{start:a,end:r,loop:o}],e,t);const l=r<a?r+s:r,c=!!i._fullLoop&&a===0&&r===s-1;return cs(i,Or(e,a,l,c),e,t)}function cs(i,t,e,n){return!n||!n.setContext||!e?t:Fr(i,t,e,n)}function Fr(i,t,e,n){const s=i._chart.getContext(),o=hs(i.options),{_datasetIndex:a,options:{spanGaps:r}}=i,l=e.length,c=[];let h=o,d=t[0].start,u=d;function f(m,g,p,b){const y=r?-1:1;if(m!==g){for(m+=l;e[m%l].skip;)m-=y;for(;e[g%l].skip;)g+=y;m%l!==g%l&&(c.push({start:m%l,end:g%l,loop:p,style:b}),h=b,d=g%l)}}for(const m of t){d=r?d:m.start;let g=e[d%l],p;for(u=d+1;u<=m.end;u++){const b=e[u%l];p=hs(n.setContext(Ct(s,{type:"segment",p0:g,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Rr(p,h)&&f(d,u-1,m.loop,h),g=b,h=p}d<u-1&&f(d,u-1,m.loop,h)}return c}function hs(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function Rr(i,t){if(!t)return!1;const e=[],n=function(s,o){return zi(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,n)!==JSON.stringify(t,n)}/*!
|
|
12
12
|
* Chart.js v4.4.0
|
|
13
13
|
* https://www.chartjs.org
|
|
14
14
|
* (c) 2023 Chart.js Contributors
|
|
15
15
|
* Released under the MIT License
|
|
16
|
-
*/class Er{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,n,s){const o=e.listeners[s],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(n-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Bn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var yt=new Er;const ds="transparent",Br={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=Nn(i||ds),s=n.valid&&Nn(t||ds);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class zr{constructor(t,e,n,s){const o=e[n];s=Ge([t.to,s,o,t.from]);const a=Ge([t.from,o,s]);this._active=!0,this._fn=t.fn||Br[t.type||typeof a],this._easing=ae[t.easing]||ae.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,a=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ge([t.to,e,s,t.from]),this._from=Ge([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||e<n),!this._active){this._target[s]=r,this._notify(!0);return}if(e<0){this._target[s]=o;return}l=e/n%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;s<n.length;s++)n[s][e]()}}class us{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!O(t))return;const e=Object.keys(j.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!O(o))return;const a={};for(const r of e)a[r]=o[r];(W(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!n.has(r))&&n.set(r,a)})})}_animateOptions(t,e){const n=e.options,s=Hr(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&Wr(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const u=n.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new zr(u,t,c,h),s.push(d)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return yt.add(this._chart,n),!0}}function Wr(i,t){const e=[],n=Object.keys(t);for(let s=0;s<n.length;s++){const o=i[n[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function Hr(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function fs(i,t){const e=i&&i.options||{},n=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:n?o:s,end:n?s:o}}function Nr(i,t,e){if(e===!1)return!1;const n=fs(i,e),s=fs(t,e);return{top:s.end,right:n.end,bottom:s.start,left:n.start}}function Vr(i){let t,e,n,s;return O(i)?(t=i.top,e=i.right,n=i.bottom,s=i.left):t=e=n=s=i,{top:t,right:e,bottom:n,left:s,disabled:i===!1}}function gs(i,t){const e=[],n=i._getSortedDatasetMetas(t);let s,o;for(s=0,o=n.length;s<o;++s)e.push(n[s].index);return e}function ps(i,t,e,n={}){const s=i.keys,o=n.mode==="single";let a,r,l,c;if(t!==null){for(a=0,r=s.length;a<r;++a){if(l=+s[a],l===e){if(n.all)continue;break}c=i.values[l],V(c)&&(o||t===0||ct(t)===ct(c))&&(t+=c)}return t}}function jr(i){const t=Object.keys(i),e=new Array(t.length);let n,s,o;for(n=0,s=t.length;n<s;++n)o=t[n],e[n]={x:o,y:i[o]};return e}function ms(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function $r(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Ur(i){const{min:t,max:e,minDefined:n,maxDefined:s}=i.getUserBounds();return{min:n?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function Yr(i,t,e){const n=i[t]||(i[t]={});return n[e]||(n[e]={})}function bs(i,t,e,n){for(const s of t.getMatchingVisibleMetas(n).reverse()){const o=i[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function ys(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=n,l=o.axis,c=a.axis,h=$r(o,a,n),d=t.length;let u;for(let f=0;f<d;++f){const m=t[f],{[l]:p,[c]:g}=m,b=m._stacks||(m._stacks={});u=b[c]=Yr(s,h,p),u[r]=g,u._top=bs(u,a,!0,n.type),u._bottom=bs(u,a,!1,n.type);const y=u._visualValues||(u._visualValues={});y[r]=g}}function Gi(i,t){const e=i.scales;return Object.keys(e).filter(n=>e[n].axis===t).shift()}function Xr(i,t){return Ct(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Gr(i,t,e){return Ct(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ce(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e],o[n]._visualValues!==void 0&&o[n]._visualValues[e]!==void 0&&delete o[n]._visualValues[e]}}}const qi=i=>i==="reset"||i==="none",xs=(i,t)=>t?i:Object.assign({},i),qr=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:gs(e,!0),values:null};class Mt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ms(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&&ce(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(d,u,f,m)=>d==="x"?u:d==="r"?m:f,o=e.xAxisID=T(n.xAxisID,Gi(t,"x")),a=e.yAxisID=T(n.yAxisID,Gi(t,"y")),r=e.rAxisID=T(n.rAxisID,Gi(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,a,r),h=e.vAxisID=s(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Rn(this._data,this),t._stacked&&ce(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(O(e))this._data=jr(e);else if(n!==e){if(n){Rn(n,this);const s=this._cachedMeta;ce(s),s._parsed=[]}e&&Object.isExtensible(e)&&Ta(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=ms(e.vScale,e),e.stack!==n.stack&&(s=!0,ce(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&ys(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:a}=n,r=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,d,u;if(this._parsing===!1)n._parsed=s,n._sorted=!0,u=s;else{W(s[t])?u=this.parseArrayData(n,s,t,e):O(s[t])?u=this.parseObjectData(n,s,t,e):u=this.parsePrimitiveData(n,s,t,e);const f=()=>d[r]===null||c&&d[r]<c[r];for(h=0;h<e;++h)n._parsed[h+t]=d=u[h],l&&(f()&&(l=!1),c=d);n._sorted=l}a&&ys(this,u)}parsePrimitiveData(t,e,n,s){const{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),h=o===a,d=new Array(s);let u,f,m;for(u=0,f=s;u<f;++u)m=u+n,d[u]={[r]:h||o.parse(c[m],m),[l]:a.parse(e[m],m)};return d}parseArrayData(t,e,n,s){const{xScale:o,yScale:a}=t,r=new Array(s);let l,c,h,d;for(l=0,c=s;l<c;++l)h=l+n,d=e[h],r[l]={x:o.parse(d[0],h),y:a.parse(d[1],h)};return r}parseObjectData(t,e,n,s){const{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let h,d,u,f;for(h=0,d=s;h<d;++h)u=h+n,f=e[u],c[h]={x:o.parse(St(f,r),u),y:a.parse(St(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,n){const s=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:gs(s,!0),values:e._stacks[t.axis]._visualValues};return ps(r,a,o.index,{mode:n})}updateRangeFromParsed(t,e,n,s){const o=n[e.axis];let a=o===null?NaN:o;const r=s&&n._stacks[e.axis];s&&r&&(s.values=r,a=ps(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const n=this._cachedMeta,s=n._parsed,o=n._sorted&&t===n.iScale,a=s.length,r=this._getOtherScale(t),l=qr(e,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=Ur(r);let u,f;function m(){f=s[u];const p=f[r.axis];return!V(f[t.axis])||h>p||d<p}for(u=0;u<a&&!(!m()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!m()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,a;for(s=0,o=e.length;s<o;++s)a=e[s][t.axis],V(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,n=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Vr(T(this.options.clip,Nr(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,n=this._cachedMeta,s=n.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,c=this.options.drawActiveElementsOnTop;let h;for(n.dataset&&n.dataset.draw(t,o,r,l),h=r;h<r+l;++h){const d=s[h];d.hidden||(d.active&&c?a.push(d):d.draw(t,o))}for(h=0;h<a.length;++h)a[h].draw(t,o)}getStyle(t,e){const n=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,e,n){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];o=a.$context||(a.$context=Gr(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Xr(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=n,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",n){const s=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&ie(n);if(r)return xs(r,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),h),f=Object.keys(j.elements[t]),m=()=>this.getContext(n,s,e),p=c.resolveNamedOptions(u,f,m,d);return p.$shared&&(p.$shared=l,o[a]=Object.freeze(xs(p,l))),p}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(s.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,n,e))}const c=new us(s,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||qi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:a}}updateElement(t,e,n,s){qi(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!qi(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const s=n.length,o=e.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,n=!0){const s=this._cachedMeta,o=s.data,a=t+e;let r;const l=c=>{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),n&&this.updateElements(o,t,e,"reset")}updateElements(t,e,n,s){}_removeElements(t,e){const n=this._cachedMeta;if(this._parsing){const s=n._parsed.splice(t,e);n._stacked&&ce(n,s)}n.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,n,s]=t;this[e](n,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}C(Mt,"defaults",{}),C(Mt,"datasetElementType",null),C(Mt,"dataElementType",null);function Kr(i,t){if(!i._cache.$bar){const e=i.getMatchingVisibleMetas(t);let n=[];for(let s=0,o=e.length;s<o;s++)n=n.concat(e[s].controller.getAllParsedValues(i));i._cache.$bar=En(n.sort((s,o)=>s-o))}return i._cache.$bar}function Zr(i){const t=i.iScale,e=Kr(t,i.type);let n=t._length,s,o,a,r;const l=()=>{a===32767||a===-32768||(ie(r)&&(n=Math.min(n,Math.abs(a-r)||n)),r=a)};for(s=0,o=e.length;s<o;++s)a=t.getPixelForValue(e[s]),l();for(r=void 0,s=0,o=t.ticks.length;s<o;++s)a=t.getPixelForTick(s),l();return n}function Qr(i,t,e,n){const s=e.barThickness;let o,a;return F(s)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=s*n,a=1),{chunk:o/n,ratio:a,start:t.pixels[i]-o/2}}function Jr(i,t,e,n){const s=t.pixels,o=s[i];let a=i>0?s[i-1]:null,r=i<s.length-1?s[i+1]:null;const l=e.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);const c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/n,ratio:e.barPercentage,start:c}}function tl(i,t,e,n){const s=e.parse(i[0],n),o=e.parse(i[1],n),a=Math.min(s,o),r=Math.max(s,o);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:a,max:r}}function _s(i,t,e,n){return W(i)?tl(i,t,e,n):t[e.axis]=e.parse(i,n),t}function vs(i,t,e,n){const s=i.iScale,o=i.vScale,a=s.getLabels(),r=s===o,l=[];let c,h,d,u;for(c=e,h=e+n;c<h;++c)u=t[c],d={},d[s.axis]=r||s.parse(a[c],c),l.push(_s(u,d,o,c));return l}function Ki(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function el(i,t,e){return i!==0?ct(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function il(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.base<i.y,e="bottom",n="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:n,reverse:t,top:s,bottom:o}}function nl(i,t,e,n){let s=t.borderSkipped;const o={};if(!s){i.borderSkipped=o;return}if(s===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:r,reverse:l,top:c,bottom:h}=il(i);s==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===n?s=c:(e._bottom||0)===n?s=h:(o[Ss(h,a,r,l)]=!0,s=c)),o[Ss(s,a,r,l)]=!0,i.borderSkipped=o}function Ss(i,t,e,n){return n?(i=sl(i,t,e),i=ks(i,e,t)):i=ks(i,t,e),i}function sl(i,t,e){return i===t?e:i===e?t:i}function ks(i,t,e){return i==="start"?t:i==="end"?e:i}function ol(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}class Je extends Mt{parsePrimitiveData(t,e,n,s){return vs(t,e,n,s)}parseArrayData(t,e,n,s){return vs(t,e,n,s)}parseObjectData(t,e,n,s){const{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,h=a.axis==="x"?r:l,d=[];let u,f,m,p;for(u=n,f=n+s;u<f;++u)p=e[u],m={},m[o.axis]=o.parse(St(p,c),u),d.push(_s(St(p,h),m,a,u));return d}updateRangeFromParsed(t,e,n,s){super.updateRangeFromParsed(t,e,n,s);const o=n._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:n,vScale:s}=e,o=this.getParsed(t),a=o._custom,r=Ki(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,n,s){const o=s==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,s);for(let f=e;f<e+n;f++){const m=this.getParsed(f),p=o||F(m[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,h),b=(m._stacks||{})[r.axis],y={horizontal:c,base:p.base,enableBorderRadius:!b||Ki(m._custom)||a===b._top||a===b._bottom,x:c?p.head:g.center,y:c?g.center:p.head,height:c?g.size:Math.abs(p.size),width:c?Math.abs(p.size):g.size};u&&(y.options=d||this.resolveDataElementOptions(f,t[f].active?"active":s));const x=y.options||t[f].options;nl(y,x,b,a),ol(y,x,h.ratio),this.updateElement(t[f],f,y,s)}}_getStacks(t,e){const{iScale:n}=this._cachedMeta,s=n.getMatchingVisibleMetas(this._type).filter(l=>l.controller.options.grouped),o=n.options.stacked,a=[],r=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(F(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&r(l))&&((o===!1||a.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&a.push(l.stack),l.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,a;for(o=0,a=e.data.length;o<a;++o)s.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));const r=t.barThickness;return{min:r||Zr(e),pixels:s,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:n,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,h=Ki(c);let d=l[e.axis],u=0,f=n?this.applyStack(e,l,n):d,m,p;f!==d&&(u=f-d,f=d),h&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&ct(d)!==ct(c.barEnd)&&(u=0),u+=d);const g=!F(o)&&!h?o:u;let b=e.getPixelForValue(g);if(this.chart.getDataVisibility(t)?m=e.getPixelForValue(u+f):m=b,p=m-b,Math.abs(p)<a){p=el(p,e,r)*a,d===r&&(b-=p/2);const y=e.getPixelForDecimal(0),x=e.getPixelForDecimal(1),S=Math.min(y,x),v=Math.max(y,x);b=Math.max(Math.min(b,v),S),m=b+p,n&&!h&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(m)-e.getValueForPixel(b))}if(b===e.getPixelForValue(r)){const y=ct(p)*e.getLineWidthForValue(r)/2;b+=y,p-=y}return{size:p,base:b,head:m,center:m+p/2}}_calculateBarIndexPixels(t,e){const n=e.scale,s=this.options,o=s.skipNull,a=T(s.maxBarThickness,1/0);let r,l;if(e.grouped){const c=o?this._getStackCount(t):e.stackCount,h=s.barThickness==="flex"?Jr(t,e,s,c):Qr(t,e,s,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=h.start+h.chunk*d+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=n.getPixelForValue(this.getParsed(t)[n.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,n=t.data,s=n.length;let o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&n[o].draw(this._ctx)}}C(Je,"id","bar"),C(Je,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),C(Je,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function al(i,t,e){let n=1,s=1,o=0,a=0;if(t<H){const r=i,l=r+t,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(x,S,v)=>oe(x,r,l,!0)?1:Math.max(S,S*e,v,v*e),m=(x,S,v)=>oe(x,r,l,!0)?-1:Math.min(S,S*e,v,v*e),p=f(0,c,d),g=f($,h,u),b=m(N,c,d),y=m(N+$,h,u);n=(p-b)/2,s=(g-y)/2,o=-(p+b)/2,a=-(g+y)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:a}}class he extends Mt{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(O(n[t])){const{key:l="value"}=this._parsing;o=c=>+St(n[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return ht(this.options.rotation-90)}_getCircumference(){return ht(this.options.circumference)}_getRotationExtents(){let t=H,e=-H;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const s=this.chart.getDatasetMeta(n).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:n}=e,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(n.width,n.height)-a)/2,0),l=Math.min(ba(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:m,offsetY:p}=al(d,h,l),g=(n.width-a)/u,b=(n.height-a)/f,y=Math.max(Math.min(g,b)/2,0),x=Cn(this.options.radius,y),S=Math.max(x*l,0),v=(x-S)/this._getVisibleDatasetWeightTotal();this.offsetX=m*x,this.offsetY=p*x,s.total=this.calculateTotal(),this.outerRadius=x-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const n=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/H)}updateElements(t,e,n,s){const o=s==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,h=(r.left+r.right)/2,d=(r.top+r.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,m=u?0:this.outerRadius,{sharedOptions:p,includeOptions:g}=this._getSharedOptions(e,s);let b=this._getRotation(),y;for(y=0;y<e;++y)b+=this._circumference(y,o);for(y=e;y<e+n;++y){const x=this._circumference(y,o),S=t[y],v={x:h+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+x,circumference:x,outerRadius:m,innerRadius:f};g&&(v.options=p||this.resolveDataElementOptions(y,S.active?"active":s)),b+=x,this.updateElement(S,y,v,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let n=0,s;for(s=0;s<e.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?H*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=je(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,a,r,l;if(!t){for(s=0,o=n.data.datasets.length;s<o;++s)if(n.isDatasetVisible(s)){a=n.getDatasetMeta(s),t=a.data,r=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=r.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let n=0,s=t.length;n<s;++n){const o=this.resolveDataElementOptions(n);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(e+=this._getRingWeight(n));return e}_getRingWeight(t){return Math.max(T(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}C(he,"id","doughnut"),C(he,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),C(he,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),C(he,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}});class ti extends Mt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,a=this.chart._animationsDisabled;let{start:r,count:l}=Fa(e,s,a);this._drawStart=r,this._drawCount=l,Ra(e)&&(r=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},t),this.updateElements(s,r,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,s),u=a.axis,f=r.axis,{spanGaps:m,segment:p}=this.options,g=se(m)?m:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",y=e+n,x=t.length;let S=e>0&&this.getParsed(e-1);for(let v=0;v<x;++v){const w=t[v],k=b?w:{};if(v<e||v>=y){k.skip=!0;continue}const M=this.getParsed(v),P=F(M[f]),A=k[u]=a.getPixelForValue(M[u],v),D=k[f]=o||P?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,M,l):M[f],v);k.skip=isNaN(A)||isNaN(D)||P,k.stop=v>0&&Math.abs(M[u]-S[u])>g,p&&(k.parsed=M,k.raw=c.data[v]),d&&(k.options=h||this.resolveDataElementOptions(v,w.active?"active":s)),b||this.updateElement(w,v,k,s),S=M}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}C(ti,"id","line"),C(ti,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),C(ti,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class ei extends Mt{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return dr.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const r={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(n,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,a=s==="reset";for(let r=e;r<e+n;r++){const l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":s),h=o.getPointPositionForValue(r,this.getParsed(r).r),d=a?o.xCenter:h.x,u=a?o.yCenter:h.y,f={x:d,y:u,angle:h.angle,skip:isNaN(d)||isNaN(u),options:c};this.updateElement(l,r,f,s)}}}C(ei,"id","radar"),C(ei,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),C(ei,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});function Wt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Zi{constructor(t){C(this,"options");this.options=t||{}}static override(t){Object.assign(Zi.prototype,t)}init(){}formats(){return Wt()}parse(){return Wt()}format(){return Wt()}add(){return Wt()}diff(){return Wt()}startOf(){return Wt()}endOf(){return Wt()}}var rl={_date:Zi};function ll(i,t,e,n){const{controller:s,data:o,_sorted:a}=i,r=s._cachedMeta.iScale;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const l=r._reversePixels?Da:Tt;if(n){if(s._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(o,t,e-h),u=l(o,t,e+h);return{lo:d.lo,hi:u.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function de(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r<l;++r){const{index:c,data:h}=o[r],{lo:d,hi:u}=ll(o[r],t,a,s);for(let f=d;f<=u;++f){const m=h[f];m.skip||n(m,c,f)}}}function cl(i){const t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(n,s){const o=t?Math.abs(n.x-s.x):0,a=e?Math.abs(n.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Qi(i,t,e,n,s){const o=[];return!s&&!i.isPointInArea(t)||de(i,e,t,function(r,l,c){!s&&!bt(r,i.chartArea,0)||r.inRange(t.x,t.y,n)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function hl(i,t,e,n){let s=[];function o(a,r,l){const{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],n),{angle:d}=In(a,{x:t.x,y:t.y});oe(d,c,h)&&s.push({element:a,datasetIndex:r,index:l})}return de(i,e,t,o),s}function dl(i,t,e,n,s,o){let a=[];const r=cl(e);let l=Number.POSITIVE_INFINITY;function c(h,d,u){const f=h.inRange(t.x,t.y,s);if(n&&!f)return;const m=h.getCenterPoint(s);if(!(!!o||i.isPointInArea(m))&&!f)return;const g=r(t,m);g<l?(a=[{element:h,datasetIndex:d,index:u}],l=g):g===l&&a.push({element:h,datasetIndex:d,index:u})}return de(i,e,t,c),a}function Ji(i,t,e,n,s,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!n?hl(i,t,e,s):dl(i,t,e,n,s,o)}function ws(i,t,e,n,s){const o=[],a=e==="x"?"inXRange":"inYRange";let r=!1;return de(i,e,t,(l,c,h)=>{l[a](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,s))}),n&&!r?[]:o}var ul={evaluateInteractionItems:de,modes:{index(i,t,e,n){const s=Bt(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?Qi(i,s,o,n,a):Ji(i,s,o,!1,n,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=Bt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?Qi(i,s,o,n,a):Ji(i,s,o,!1,n,a);if(r.length>0){const l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let h=0;h<c.length;++h)r.push({element:c[h],datasetIndex:l,index:h})}return r},point(i,t,e,n){const s=Bt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return Qi(i,s,o,n,a)},nearest(i,t,e,n){const s=Bt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return Ji(i,s,o,e.intersect,n,a)},x(i,t,e,n){const s=Bt(t,i);return ws(i,s,"x",e.intersect,n)},y(i,t,e,n){const s=Bt(t,i);return ws(i,s,"y",e.intersect,n)}}};const Cs=["left","top","right","bottom"];function ue(i,t){return i.filter(e=>e.pos===t)}function Ms(i,t){return i.filter(e=>Cs.indexOf(e.pos)===-1&&e.box.axis===t)}function fe(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function fl(i){const t=[];let e,n,s,o,a,r;for(e=0,n=(i||[]).length;e<n;++e)s=i[e],{position:o,options:{stack:a,stackWeight:r=1}}=s,t.push({index:e,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&o+a,stackWeight:r});return t}function gl(i){const t={};for(const e of i){const{stack:n,pos:s,stackWeight:o}=e;if(!n||!Cs.includes(s))continue;const a=t[n]||(t[n]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function pl(i,t){const e=gl(i),{vBoxMaxWidth:n,hBoxMaxHeight:s}=t;let o,a,r;for(o=0,a=i.length;o<a;++o){r=i[o];const{fullSize:l}=r.box,c=e[r.stack],h=c&&r.stackWeight/c.weight;r.horizontal?(r.width=h?h*n:l&&t.availableWidth,r.height=s):(r.width=n,r.height=h?h*s:l&&t.availableHeight)}return e}function ml(i){const t=fl(i),e=fe(t.filter(c=>c.box.fullSize),!0),n=fe(ue(t,"left"),!0),s=fe(ue(t,"right")),o=fe(ue(t,"top"),!0),a=fe(ue(t,"bottom")),r=Ms(t,"x"),l=Ms(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:ue(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function Ps(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function As(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function bl(i,t,e,n){const{pos:s,box:o}=e,a=i.maxPadding;if(!O(s)){e.size&&(i[s]-=e.size);const d=n[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[s]+=e.size}o.getPadding&&As(a,o.getPadding());const r=Math.max(0,t.outerWidth-Ps(a,i,"left","right")),l=Math.max(0,t.outerHeight-Ps(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function yl(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function xl(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return n(i?["left","right"]:["top","bottom"])}function ge(i,t,e,n){const s=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o<a;++o){r=i[o],l=r.box,l.update(r.width||t.w,r.height||t.h,xl(r.horizontal,t));const{same:d,other:u}=bl(t,e,r,n);c|=d&&s.length,h=h||u,l.fullSize||s.push(r)}return c&&ge(s,t,e,n)||h}function ii(i,t,e,n,s){i.top=e,i.left=t,i.right=t+n,i.bottom=e+s,i.width=n,i.height=s}function Ds(i,t,e,n){const s=e.padding;let{x:o,y:a}=t;for(const r of i){const l=r.box,c=n[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/c.weight||1;if(r.horizontal){const d=t.w*h,u=c.size||l.height;ie(c.start)&&(a=c.start),l.fullSize?ii(l,s.left,a,e.outerWidth-s.right-s.left,u):ii(l,t.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*h,u=c.size||l.width;ie(c.start)&&(o=c.start),l.fullSize?ii(l,o,s.top,u,e.outerHeight-s.bottom-s.top):ii(l,o,t.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=a}var st={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){const e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,n){if(!i)return;const s=K(i.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(e-s.height,0),r=ml(i.boxes),l=r.vertical,c=r.horizontal;R(i.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,g)=>g.box.options&&g.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},s);As(u,K(n));const f=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),m=pl(l.concat(c),d);ge(r.fullSize,f,d,m),ge(l,f,d,m),ge(c,f,d,m)&&ge(l,f,d,m),yl(f),Ds(r.leftAndTop,f,d,m),f.x+=f.w,f.y+=f.h,Ds(r.rightAndBottom,f,d,m),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},R(r.chartArea,p=>{const g=p.box;Object.assign(g,i.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Ls{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}}class _l extends Ls{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ni="$chartjs",vl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ts=i=>i===null||i==="";function Sl(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[ni]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ts(s)){const o=is(i,"width");o!==void 0&&(i.width=o)}if(Ts(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=is(i,"height");o!==void 0&&(i.height=o)}return i}const Os=Cr?{passive:!0}:!1;function kl(i,t,e){i.addEventListener(t,e,Os)}function wl(i,t,e){i.canvas.removeEventListener(t,e,Os)}function Cl(i,t){const e=vl[i.type]||i.type,{x:n,y:s}=Bt(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function si(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Ml(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||si(r.addedNodes,n),a=a&&!si(r.removedNodes,n);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Pl(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||si(r.removedNodes,n),a=a&&!si(r.addedNodes,n);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const pe=new Map;let Is=0;function Fs(){const i=window.devicePixelRatio;i!==Is&&(Is=i,pe.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Al(i,t){pe.size||window.addEventListener("resize",Fs),pe.set(i,t)}function Dl(i){pe.delete(i),pe.size||window.removeEventListener("resize",Fs)}function Ll(i,t,e){const n=i.canvas,s=n&&Xi(n);if(!s)return;const o=zn((r,l)=>{const c=s.clientWidth;e(r,l),c<s.clientWidth&&e()},window),a=new ResizeObserver(r=>{const l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(s),Al(i,o),a}function tn(i,t,e){e&&e.disconnect(),t==="resize"&&Dl(i)}function Tl(i,t,e){const n=i.canvas,s=zn(o=>{i.ctx!==null&&e(Cl(o,i))},i);return kl(n,t,s),s}class Ol extends Ls{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(Sl(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[ni])return!1;const n=e[ni].initial;["height","width"].forEach(o=>{const a=n[o];F(a)?e.removeAttribute(o):e.setAttribute(o,a)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[ni],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),a={attach:Ml,detach:Pl,resize:Ll}[e]||Tl;s[e]=a(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:tn,detach:tn,resize:tn}[e]||wl)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return wr(t,e,n,s)}isAttached(t){const e=Xi(t);return!!(e&&e.isConnected)}}function Il(i){return!ts()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?_l:Ol}class rt{constructor(){C(this,"x");C(this,"y");C(this,"active",!1);C(this,"options");C(this,"$animations")}tooltipPosition(t){const{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return se(this.x)&&se(this.y)}getProps(t,e){const n=this.$animations;if(!e||!n)return this;const s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}}C(rt,"defaults",{}),C(rt,"defaultRoutes");function Fl(i,t){const e=i.options.ticks,n=Rl(i),s=Math.min(e.maxTicksLimit||n,n),o=e.major.enabled?Bl(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>s)return zl(t,c,o,a/s),c;const h=El(o,t,s);if(a>0){let d,u;const f=a>1?Math.round((l-r)/(a-1)):null;for(oi(t,c,h,F(f)?0:r-f,r),d=0,u=a-1;d<u;d++)oi(t,c,h,o[d],o[d+1]);return oi(t,c,h,l,F(f)?t.length:l+f),c}return oi(t,c,h),c}function Rl(i){const t=i.options.offset,e=i._tickSize(),n=i._length/e+(t?0:1),s=i._maxLength/e;return Math.floor(Math.min(n,s))}function El(i,t,e){const n=Wl(i),s=t.length/e;if(!n)return Math.max(s,1);const o=Ca(n);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>s)return l}return Math.max(s,1)}function Bl(i){const t=[];let e,n;for(e=0,n=i.length;e<n;e++)i[e].major&&t.push(e);return t}function zl(i,t,e,n){let s=0,o=e[0],a;for(n=Math.ceil(n),a=0;a<i.length;a++)a===o&&(t.push(i[a]),s++,o=e[s*n])}function oi(i,t,e,n,s){const o=T(n,0),a=Math.min(T(s,i.length),i.length);let r=0,l,c,h;for(e=Math.ceil(e),s&&(l=s-n,e=l/Math.floor(l/e)),h=o;h<0;)r++,h=Math.round(o+r*e);for(c=Math.max(o,0);c<a;c++)c===h&&(t.push(i[c]),r++,h=Math.round(o+r*e))}function Wl(i){const t=i.length;let e,n;if(t<2)return!1;for(n=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==n)return!1;return n}const Hl=i=>i==="left"?"right":i==="right"?"left":i,Rs=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Es=(i,t)=>Math.min(t||i,i);function Bs(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;o<s;o+=n)e.push(i[Math.floor(o)]);return e}function Nl(i,t,e){const n=i.ticks.length,s=Math.min(t,n-1),o=i._startPixel,a=i._endPixel,r=1e-6;let l=i.getPixelForTick(s),c;if(!(e&&(n===1?c=Math.max(l-o,a-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-r||l>a+r)))return l}function Vl(i,t){R(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;o<s;++o)delete e.data[n[o]];n.splice(0,s)}})}function me(i){return i.drawTicks?i.tickLength:0}function zs(i,t){if(!i.display)return 0;const e=Y(i.font,t),n=K(i.padding);return(W(i.text)?i.text.length:1)*e.lineHeight+n.height}function jl(i,t){return Ct(i,{scale:t,type:"scale"})}function $l(i,t,e){return Ct(i,{tick:e,index:t,type:"tick"})}function Ul(i,t,e){let n=Bi(i);return(e&&t!=="right"||!e&&t==="right")&&(n=Hl(n)),n}function Yl(i,t,e,n){const{top:s,left:o,bottom:a,right:r,chart:l}=i,{chartArea:c,scales:h}=l;let d=0,u,f,m;const p=a-s,g=r-o;if(i.isHorizontal()){if(f=q(n,o,r),O(e)){const b=Object.keys(e)[0],y=e[b];m=h[b].getPixelForValue(y)+p-t}else e==="center"?m=(c.bottom+c.top)/2+p-t:m=Rs(i,e,t);u=r-o}else{if(O(e)){const b=Object.keys(e)[0],y=e[b];f=h[b].getPixelForValue(y)-g+t}else e==="center"?f=(c.left+c.right)/2-g+t:f=Rs(i,e,t);m=q(n,a,s),d=e==="left"?-$:$}return{titleX:f,titleY:m,maxWidth:u,rotation:d}}class Ht extends rt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:n,_suggestedMax:s}=this;return t=et(t,Number.POSITIVE_INFINITY),e=et(e,Number.NEGATIVE_INFINITY),n=et(n,Number.POSITIVE_INFINITY),s=et(s,Number.NEGATIVE_INFINITY),{min:et(t,n),max:et(e,s),minDefined:V(t),maxDefined:V(e)}}getMinMax(t){let{min:e,max:n,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:e,max:n};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),o||(n=Math.max(n,a.max));return e=o&&e>n?n:e,n=s&&e>n?e:n,{min:et(e,et(n,e)),max:et(n,et(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){B(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=er(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?Bs(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Fl(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,n;this.isHorizontal()?(e=this.left,n=this.right):(e=this.top,n=this.bottom,t=!t),this._startPixel=e,this._endPixel=n,this._reversePixels=t,this._length=n-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){B(this.options.afterUpdate,[this])}beforeSetDimensions(){B(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){B(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),B(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){B(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let n,s,o;for(n=0,s=t.length;n<s;n++)o=t[n],o.label=B(e.callback,[o.value,n,t],this)}afterTickToLabelConversion(){B(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){B(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,n=Es(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation;let a=s,r,l,c;if(!this._isVisible()||!e.display||s>=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=G(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/n:f/(n-1),d+6>r&&(r=f/(n-(t.offset?.5:1)),l=this.maxHeight-me(t.grid)-e.padding-zs(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=Fi(Math.min(Math.asin(G((h.highest.height+6)/r,-1,1)),Math.asin(G(l/c,-1,1))-Math.asin(G(u/c,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){B(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){B(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=zs(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=me(o)+l):(t.height=this.maxHeight,t.width=me(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=n.padding*2,m=ht(this.labelRotation),p=Math.cos(m),g=Math.sin(m);if(r){const b=n.mirror?0:g*d.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=n.mirror?0:p*d.width+g*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,g,p)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=s*t.width,f=n*e.height):(u=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){B(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e<n;e++)F(t[e].label)&&(t.splice(e,1),n--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let n=this.ticks;e<n.length&&(n=Bs(n,e)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,n){const{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/Es(e,n));let c=0,h=0,d,u,f,m,p,g,b,y,x,S,v;for(d=0;d<e;d+=l){if(m=t[d].label,p=this._resolveTickFontOptions(d),s.font=g=p.string,b=o[g]=o[g]||{data:{},gc:[]},y=p.lineHeight,x=S=0,!F(m)&&!W(m))x=Ue(s,b.data,b.gc,x,m),S=y;else if(W(m))for(u=0,f=m.length;u<f;++u)v=m[u],!F(v)&&!W(v)&&(x=Ue(s,b.data,b.gc,x,v),S+=y);a.push(x),r.push(S),c=Math.max(x,c),h=Math.max(S,h)}Vl(o,e);const w=a.indexOf(c),k=r.indexOf(h),M=P=>({width:a[P]||0,height:r[P]||0});return{first:M(0),last:M(e-1),widest:M(w),highest:M(k),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Aa(this._alignToPixels?It(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const n=e[t];return n.$context||(n.$context=$l(this.getContext(),t,n))}return this.$context||(this.$context=jl(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=ht(this.labelRotation),n=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*n>r*s?r/n:l/s:l*s<r*n?l/n:r/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:a,border:r}=s,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=me(o),f=[],m=r.setContext(this.getContext()),p=m.display?m.width:0,g=p/2,b=function(E){return It(n,E,p)};let y,x,S,v,w,k,M,P,A,D,L,z;if(a==="top")y=b(this.bottom),k=this.bottom-u,P=y-g,D=b(t.top)+g,z=t.bottom;else if(a==="bottom")y=b(this.top),D=t.top,z=b(t.bottom)-g,k=y+g,P=this.top+u;else if(a==="left")y=b(this.right),w=this.right-u,M=y-g,A=b(t.left)+g,L=t.right;else if(a==="right")y=b(this.left),A=t.left,L=b(t.right)-g,w=y+g,M=this.left+u;else if(e==="x"){if(a==="center")y=b((t.top+t.bottom)/2+.5);else if(O(a)){const E=Object.keys(a)[0],U=a[E];y=b(this.chart.scales[E].getPixelForValue(U))}D=t.top,z=t.bottom,k=y+g,P=k+u}else if(e==="y"){if(a==="center")y=b((t.left+t.right)/2);else if(O(a)){const E=Object.keys(a)[0],U=a[E];y=b(this.chart.scales[E].getPixelForValue(U))}w=y-g,M=w-u,A=t.left,L=t.right}const Z=T(s.ticks.maxTicksLimit,d),I=Math.max(1,Math.ceil(d/Z));for(x=0;x<d;x+=I){const E=this.getContext(x),U=o.setContext(E),lt=r.setContext(E),Q=U.lineWidth,Kt=U.color,Pi=lt.dash||[],Zt=lt.dashOffset,Oe=U.tickWidth,Ie=U.tickColor,Fe=U.tickBorderDash||[],Re=U.tickBorderDashOffset;S=Nl(this,x,l),S!==void 0&&(v=It(n,S,Q),c?w=M=A=L=v:k=P=D=z=v,f.push({tx1:w,ty1:k,tx2:M,ty2:P,x1:A,y1:D,x2:L,y2:z,width:Q,color:Kt,borderDash:Pi,borderDashOffset:Zt,tickWidth:Oe,tickColor:Ie,tickBorderDash:Fe,tickBorderDashOffset:Re}))}return this._ticksLength=d,this._borderValue=y,f}_computeLabelItems(t){const e=this.axis,n=this.options,{position:s,ticks:o}=n,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=me(n.grid),f=u+h,m=d?-h:f,p=-ht(this.labelRotation),g=[];let b,y,x,S,v,w,k,M,P,A,D,L,z="middle";if(s==="top")w=this.bottom-m,k=this._getXAxisLabelAlignment();else if(s==="bottom")w=this.top+m,k=this._getXAxisLabelAlignment();else if(s==="left"){const I=this._getYAxisLabelAlignment(u);k=I.textAlign,v=I.x}else if(s==="right"){const I=this._getYAxisLabelAlignment(u);k=I.textAlign,v=I.x}else if(e==="x"){if(s==="center")w=(t.top+t.bottom)/2+f;else if(O(s)){const I=Object.keys(s)[0],E=s[I];w=this.chart.scales[I].getPixelForValue(E)+f}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")v=(t.left+t.right)/2-f;else if(O(s)){const I=Object.keys(s)[0],E=s[I];v=this.chart.scales[I].getPixelForValue(E)}k=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?z="top":l==="end"&&(z="bottom"));const Z=this._getLabelSizes();for(b=0,y=r.length;b<y;++b){x=r[b],S=x.label;const I=o.setContext(this.getContext(b));M=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),A=P.lineHeight,D=W(S)?S.length:1;const E=D/2,U=I.color,lt=I.textStrokeColor,Q=I.textStrokeWidth;let Kt=k;a?(v=M,k==="inner"&&(b===y-1?Kt=this.options.reverse?"left":"right":b===0?Kt=this.options.reverse?"right":"left":Kt="center"),s==="top"?c==="near"||p!==0?L=-D*A+A/2:c==="center"?L=-Z.highest.height/2-E*A+A:L=-Z.highest.height+A/2:c==="near"||p!==0?L=A/2:c==="center"?L=Z.highest.height/2-E*A:L=Z.highest.height-D*A,d&&(L*=-1),p!==0&&!I.showLabelBackdrop&&(v+=A/2*Math.sin(p))):(w=M,L=(1-D)*A/2);let Pi;if(I.showLabelBackdrop){const Zt=K(I.backdropPadding),Oe=Z.heights[b],Ie=Z.widths[b];let Fe=L-Zt.top,Re=0-Zt.left;switch(z){case"middle":Fe-=Oe/2;break;case"bottom":Fe-=Oe;break}switch(k){case"center":Re-=Ie/2;break;case"right":Re-=Ie;break}Pi={left:Re,top:Fe,width:Ie+Zt.width,height:Oe+Zt.height,color:I.backdropColor}}g.push({label:S,font:P,textOffset:L,options:{rotation:p,color:U,strokeColor:lt,strokeWidth:Q,textAlign:Kt,textBaseline:z,translation:[v,w],backdrop:Pi}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-ht(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:n,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width;let c,h;return e==="left"?s?(h=this.right+o,n==="near"?c="left":n==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,n==="near"?c="right":n==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?s?(h=this.left+o,n==="near"?c="right":n==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,n==="near"?c="left":n==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:n,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,s,o,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const r=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,a=s.length;o<a;++o){const l=s[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:n,grid:s}}=this,o=n.setContext(this.getContext()),a=n.display?o.width:0;if(!a)return;const r=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,d,u;this.isHorizontal()?(c=It(t,this.left,a)-a/2,h=It(t,this.right,r)+r/2,d=u=l):(d=It(t,this.top,a)-a/2,u=It(t,this.bottom,r)+r/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,d),e.lineTo(h,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const n=this.ctx,s=this._computeLabelArea();s&&Ye(n,s);const o=this.getLabelItems(t);for(const a of o){const r=a.options,l=a.font,c=a.label,h=a.textOffset;Ft(n,c,0,h,l,r)}s&&Xe(n)}drawTitle(){const{ctx:t,options:{position:e,title:n,reverse:s}}=this;if(!n.display)return;const o=Y(n.font),a=K(n.padding),r=n.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||O(e)?(l+=a.bottom,W(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=a.top;const{titleX:c,titleY:h,maxWidth:d,rotation:u}=Yl(this,l,e,r);Ft(t,n.text,0,0,o,{color:n.color,maxWidth:d,rotation:u,textAlign:Ul(r,e,s),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,n=T(t.grid&&t.grid.z,-1),s=T(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Ht.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,a;for(o=0,a=e.length;o<a;++o){const r=e[o];r[n]===this.id&&(!t||r.type===t)&&s.push(r)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return Y(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class ai{constructor(t,e,n){this.type=t,this.scope=e,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let n;ql(e)&&(n=this.register(e));const s=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Xl(t,a,n),this.override&&j.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,n=t.id,s=this.scope;n in e&&delete e[n],s&&n in j[s]&&(delete j[s][n],this.override&&delete Ot[n])}}function Xl(i,t,e){const n=te(Object.create(null),[e?j.get(e):{},j.get(t),i.defaults]);j.set(t,n),i.defaultRoutes&&Gl(t,i.defaultRoutes),i.descriptors&&j.describe(t,i.descriptors)}function Gl(i,t){Object.keys(t).forEach(e=>{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");j.route(o,s,l,r)})}function ql(i){return"id"in i&&"defaults"in i}class Kl{constructor(){this.controllers=new ai(Mt,"datasets",!0),this.elements=new ai(rt,"elements"),this.plugins=new ai(Object,"plugins"),this.scales=new ai(Ht,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):R(s,a=>{const r=n||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,n){const s=Ii(t);B(n["before"+s],[],n),e[t](n),B(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const n=this._typedRegistries[e];if(n.isForType(t))return n}return this.plugins}_get(t,e,n){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return s}}var dt=new Kl;class Zl{constructor(){this._init=[]}notify(t,e,n,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(o,t,e,n);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,n,s){s=s||{};for(const o of t){const a=o.plugin,r=a[n],l=[e,s,o.options];if(B(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){F(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const n=t&&t.config,s=T(n.options&&n.options.plugins,{}),o=Ql(n);return s===!1&&!e?[]:tc(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],n=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}}function Ql(i){const t={},e=[],n=Object.keys(dt.plugins.items);for(let o=0;o<n.length;o++)e.push(dt.getPlugin(n[o]));const s=i.plugins||[];for(let o=0;o<s.length;o++){const a=s[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Jl(i,t){return!t&&i===!1?null:i===!0?{}:i}function tc(i,{plugins:t,localIds:e},n,s){const o=[],a=i.getContext();for(const r of t){const l=r.id,c=Jl(n[l],s);c!==null&&o.push({plugin:r,options:ec(i.config,{plugin:r,local:e[l]},c,a)})}return o}function ec(i,{plugin:t,local:e},n,s){const o=i.pluginScopeKeys(t),a=i.getOptionScopes(n,o);return e&&t.defaults&&a.push(t.defaults),i.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function en(i,t){const e=j.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function ic(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function nc(i,t){return i===t?"_index_":"_value_"}function Ws(i){if(i==="x"||i==="y"||i==="r")return i}function sc(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function nn(i,...t){if(Ws(i))return i;for(const e of t){const n=e.axis||sc(e.position)||i.length>1&&Ws(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Hs(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function oc(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(e.length)return Hs(i,"x",e[0])||Hs(i,"y",e[0])}return{}}function ac(i,t){const e=Ot[i.type]||{scales:{}},n=t.scales||{},s=en(i.type,t),o=Object.create(null);return Object.keys(n).forEach(a=>{const r=n[a];if(!O(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=nn(a,r,oc(a,i),j.scales[r.type]),c=nc(l,s),h=e.scales||{};o[a]=ee(Object.create(null),[{axis:l},r,h[l],h[c]])}),i.data.datasets.forEach(a=>{const r=a.type||i.type,l=a.indexAxis||en(r,t),h=(Ot[r]||{}).scales||{};Object.keys(h).forEach(d=>{const u=ic(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),ee(o[f],[{axis:u},n[f],h[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];ee(r,[j.scales[r.type],j.scale])}),o}function Ns(i){const t=i.options||(i.options={});t.plugins=T(t.plugins,{}),t.scales=ac(i,t)}function Vs(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function rc(i){return i=i||{},i.data=Vs(i.data),Ns(i),i}const js=new Map,$s=new Set;function ri(i,t){let e=js.get(i);return e||(e=t(),js.set(i,e),$s.add(e)),e}const be=(i,t,e)=>{const n=St(t,e);n!==void 0&&i.add(n)};class lc{constructor(t){this._config=rc(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=Vs(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Ns(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ri(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ri(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ri(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return ri(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,a=this._cachedScopes(t,n),r=a.get(e);if(r)return r;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>be(l,t,d))),h.forEach(d=>be(l,s,d)),h.forEach(d=>be(l,Ot[o]||{},d)),h.forEach(d=>be(l,j,d)),h.forEach(d=>be(l,Hi,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),$s.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Ot[e]||{},j.datasets[e]||{},{type:e},j,Hi]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=Us(this._resolverCache,t,s);let l=a;if(hc(a,e)){o.$shared=!1,n=kt(n)?n():n;const c=this.createResolver(t,n,r);l=jt(a,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=Us(this._resolverCache,t,n);return O(e)?jt(o,e,void 0,s):o}}function Us(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:$i(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},n.set(s,o)),o}const cc=i=>O(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||kt(i[e]),!1);function hc(i,t){const{isScriptable:e,isIndexable:n}=Xn(i);for(const s of t){const o=e(s),a=n(s),r=(a||o)&&i[s];if(o&&(kt(r)||cc(r))||a&&W(r))return!0}return!1}var dc="4.4.0";const uc=["top","bottom","left","right","chartArea"];function Ys(i,t){return i==="top"||i==="bottom"||uc.indexOf(i)===-1&&t==="x"}function Xs(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function Gs(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),B(e&&e.onComplete,[i],t)}function fc(i){const t=i.chart,e=t.options.animation;B(e&&e.onProgress,[i],t)}function qs(i){return ts()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const li={},Ks=i=>{const t=qs(i);return Object.values(li).filter(e=>e.canvas===t).pop()};function gc(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const a=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=a)}}}function pc(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}function ci(i,t,e){return i.options.clip?i[e]:t[e]}function mc(i,t){const{xScale:e,yScale:n}=i;return e&&n?{left:ci(e,t,"left"),right:ci(e,t,"right"),top:ci(n,t,"top"),bottom:ci(n,t,"bottom")}:t}let Pt=(Dt=class{static register(...t){dt.add(...t),Zs()}static unregister(...t){dt.remove(...t),Zs()}constructor(t,e){const n=this.config=new lc(e),s=qs(t),o=Ks(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Il(s)),this.platform.updateConfig(n);const r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=ma(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Zl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Oa(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],li[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}yt.listen(this,"complete",Gs),yt.listen(this,"progress",fc),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return F(t)?e&&o?o:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return dt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():es(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return $n(this.canvas,this.ctx),this}stop(){return yt.stop(this),this}resize(t,e){yt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),r=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,es(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),B(n.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};R(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((a,r)=>(a[r]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const r=e[a],l=nn(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),R(o,a=>{const r=a.options,l=r.id,c=nn(l,r),h=T(r.type,a.dtype);(r.position===void 0||Ys(r.position,c)!==Ys(a.dposition))&&(r.position=a.dposition),s[l]=!0;let d=null;if(l in n&&n[l].type===h)d=n[l];else{const u=dt.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),n[d.id]=d}d.init(r,t)}),R(s,(a,r)=>{a||delete n[r]}),R(n,a=>{st.configure(this,a,a.options),st.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;s<n;++s)this._destroyDatasetMeta(s);t.splice(e,n-e)}this._sortedMetasets=t.slice(0).sort(Xs("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n<s;n++){const o=e[n];let a=this.getDatasetMeta(n);const r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(n),a=this.getDatasetMeta(n)),a.type=r,a.indexAxis=o.indexAxis||en(r,this.options),a.order=o.order||0,a.index=n,a.label=""+o.label,a.visible=this.isDatasetVisible(n),a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{const l=dt.getController(r),{datasetElementType:c,dataElementType:h}=j.datasets[r];Object.assign(l,{dataElementType:dt.getElement(h),datasetElementType:c&&dt.getElement(c)}),a.controller=new l(this,n),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){R(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:d}=this.getDatasetMeta(c),u=!s&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),s||R(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Xs("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){R(this.scales,t=>{st.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!An(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const a=n==="_removeElements"?-o:o;gc(t,s,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=n(0);for(let o=1;o<e;o++)if(!An(s,n(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;st.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],R(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e<n;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,n=this.data.datasets.length;e<n;++e)this._updateDataset(e,kt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const n=this.getDatasetMeta(t),s={meta:n,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(n.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(yt.has(this)?this.attached&&!yt.running(this)&&yt.start(this):(this.draw(),Gs({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:n,height:s}=this._resizeBeforeDraw;this._resize(n,s),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,n=[];let s,o;for(s=0,o=e.length;s<o;++s){const a=e[s];(!t||a.visible)&&n.push(a)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=mc(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(s&&Ye(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&Xe(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return bt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=ul.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=Ct(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);ie(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),a.update(o,{visible:n}),this.update(r=>r.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),yt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),$n(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete li[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,n=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};R(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{s("attach",r),this.attached=!0,this.resize(),n("resize",o),n("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){R(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},R(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],n=t.map(({datasetIndex:o,index:a})=>{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!We(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=n?t:o(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,a=e,r=this._getActiveElements(t,s,n,a),l=Sa(t),c=pc(t,this._lastEvent,n,l);n&&(this._lastEvent=null,B(o.onHover,[t,r,this],this),l&&B(o.onClick,[t,r,this],this));const h=!We(r,s);return(h||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},C(Dt,"defaults",j),C(Dt,"instances",li),C(Dt,"overrides",Ot),C(Dt,"registry",dt),C(Dt,"version",dc),C(Dt,"getChart",Ks),Dt);function Zs(){return R(Pt.instances,i=>i._plugins.invalidate())}function bc(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t;let c=s/r;i.beginPath(),i.arc(o,a,r,n-c,e+c),l>s?(c=s/l,i.arc(o,a,l,e+c,n-c,!0)):i.arc(o,a,s,e+$,n-$),i.closePath(),i.clip()}function yc(i){return ji(i,["outerStart","outerEnd","innerStart","innerEnd"])}function xc(i,t,e,n){const s=yc(i.options.borderRadius),o=(e-t)/2,a=Math.min(o,n*t/2),r=l=>{const c=(e-Math.min(o,l))*n/2;return G(l,0,Math.min(o,c))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:G(s.innerStart,0,a),innerEnd:G(s.innerEnd,0,a)}}function Yt(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function hi(i,t,e,n,s,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+n+e-c,0),u=h>0?h+n+e+c:0;let f=0;const m=s-l;if(n){const I=h>0?h-n:0,E=d>0?d-n:0,U=(I+E)/2,lt=U!==0?m*U/(U+n):m;f=(m-lt)/2}const p=Math.max(.001,m*d-e/N)/d,g=(m-p)/2,b=l+g+f,y=s-g-f,{outerStart:x,outerEnd:S,innerStart:v,innerEnd:w}=xc(t,u,d,y-b),k=d-x,M=d-S,P=b+x/k,A=y-S/M,D=u+v,L=u+w,z=b+v/D,Z=y-w/L;if(i.beginPath(),o){const I=(P+A)/2;if(i.arc(a,r,d,P,I),i.arc(a,r,d,I,A),S>0){const Q=Yt(M,A,a,r);i.arc(Q.x,Q.y,S,A,y+$)}const E=Yt(L,y,a,r);if(i.lineTo(E.x,E.y),w>0){const Q=Yt(L,Z,a,r);i.arc(Q.x,Q.y,w,y+$,Z+Math.PI)}const U=(y-w/u+(b+v/u))/2;if(i.arc(a,r,u,y-w/u,U,!0),i.arc(a,r,u,U,b+v/u,!0),v>0){const Q=Yt(D,z,a,r);i.arc(Q.x,Q.y,v,z+Math.PI,b-$)}const lt=Yt(k,b,a,r);if(i.lineTo(lt.x,lt.y),x>0){const Q=Yt(k,P,a,r);i.arc(Q.x,Q.y,x,b-$,P)}}else{i.moveTo(a,r);const I=Math.cos(P)*d+a,E=Math.sin(P)*d+r;i.lineTo(I,E);const U=Math.cos(A)*d+a,lt=Math.sin(A)*d+r;i.lineTo(U,lt)}i.closePath()}function _c(i,t,e,n,s){const{fullCircles:o,startAngle:a,circumference:r}=t;let l=t.endAngle;if(o){hi(i,t,e,n,l,s);for(let c=0;c<o;++c)i.fill();isNaN(r)||(l=a+(r%H||H))}return hi(i,t,e,n,l,s),i.fill(),l}function vc(i,t,e,n,s){const{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,f=l.borderAlign==="inner";if(!c)return;i.setLineDash(d||[]),i.lineDashOffset=u,f?(i.lineWidth=c*2,i.lineJoin=h||"round"):(i.lineWidth=c,i.lineJoin=h||"bevel");let m=t.endAngle;if(o){hi(i,t,e,n,m,s);for(let p=0;p<o;++p)i.stroke();isNaN(r)||(m=a+(r%H||H))}f&&bc(i,t,m),o||(hi(i,t,e,n,m,s),i.stroke())}class ye extends rt{constructor(e){super();C(this,"circumference");C(this,"endAngle");C(this,"fullCircles");C(this,"innerRadius");C(this,"outerRadius");C(this,"pixelMargin");C(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,n,s){const o=this.getProps(["x","y"],s),{angle:a,distance:r}=In(o,{x:e,y:n}),{startAngle:l,endAngle:c,innerRadius:h,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),f=(this.options.spacing+this.options.borderWidth)/2,p=T(u,c-l)>=H||oe(a,l,c),g=mt(r,h+f,d+f);return p&&g}getCenterPoint(e){const{x:n,y:s,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,d=(o+a)/2,u=(r+l+h+c)/2;return{x:n+Math.cos(d)*u,y:s+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:n,circumference:s}=this,o=(n.offset||0)/4,a=(n.spacing||0)/2,r=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=s>H?Math.floor(s/H):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(N,s||0)),h=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,_c(e,this,h,a,r),vc(e,this,h,a,r),e.restore()}}C(ye,"id","arc"),C(ye,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),C(ye,"defaultRoutes",{backgroundColor:"backgroundColor"}),C(ye,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function Qs(i,t,e=t){i.lineCap=T(e.borderCapStyle,t.borderCapStyle),i.setLineDash(T(e.borderDash,t.borderDash)),i.lineDashOffset=T(e.borderDashOffset,t.borderDashOffset),i.lineJoin=T(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=T(e.borderWidth,t.borderWidth),i.strokeStyle=T(e.borderColor,t.borderColor)}function Sc(i,t,e){i.lineTo(e.x,e.y)}function kc(i){return i.stepped?Ya:i.tension||i.cubicInterpolationMode==="monotone"?Xa:Sc}function Js(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:a,end:r}=t,l=Math.max(s,a),c=Math.min(o,r),h=s<a&&o<a||s>r&&o>r;return{count:n,start:l,loop:t.loop,ilen:c<l&&!h?n+c-l:c-l}}function wc(i,t,e,n){const{points:s,options:o}=t,{count:a,start:r,loop:l,ilen:c}=Js(s,e,n),h=kc(o);let{move:d=!0,reverse:u}=n||{},f,m,p;for(f=0;f<=c;++f)m=s[(r+(u?c-f:f))%a],!m.skip&&(d?(i.moveTo(m.x,m.y),d=!1):h(i,p,m,u,o.stepped),p=m);return l&&(m=s[(r+(u?c:0))%a],h(i,p,m,u,o.stepped)),!!l}function Cc(i,t,e,n){const s=t.points,{count:o,start:a,ilen:r}=Js(s,e,n),{move:l=!0,reverse:c}=n||{};let h=0,d=0,u,f,m,p,g,b;const y=S=>(a+(c?r-S:S))%o,x=()=>{p!==g&&(i.lineTo(h,g),i.lineTo(h,p),i.lineTo(h,b))};for(l&&(f=s[y(0)],i.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=s[y(u)],f.skip)continue;const S=f.x,v=f.y,w=S|0;w===m?(v<p?p=v:v>g&&(g=v),h=(d*h+S)/++d):(x(),i.lineTo(S,v),m=w,d=0,p=g=v),b=v}x()}function sn(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Cc:wc}function Mc(i){return i.stepped?Mr:i.tension||i.cubicInterpolationMode==="monotone"?Pr:zt}function Pc(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),Qs(i,t.options),i.stroke(s)}function Ac(i,t,e,n){const{segments:s,options:o}=t,a=sn(t);for(const r of s)Qs(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const Dc=typeof Path2D=="function";function Lc(i,t,e,n){Dc&&!t.options.segment?Pc(i,t,e,n):Ac(i,t,e,n)}class ut extends rt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;yr(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ir(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,a=ls(this,{property:e,start:s,end:s});if(!a.length)return;const r=[],l=Mc(n);let c,h;for(c=0,h=a.length;c<h;++c){const{start:d,end:u}=a[c],f=o[d],m=o[u];if(f===m){r.push(f);continue}const p=Math.abs((s-f[e])/(m[e]-f[e])),g=l(f,m,p,n.stepped);g[e]=t[e],r.push(g)}return r.length===1?r[0]:r}pathSegment(t,e,n){return sn(this)(t,this,e,n)}path(t,e,n){const s=this.segments,o=sn(this);let a=this._loop;e=e||0,n=n||this.points.length-e;for(const r of s)a&=o(t,this,r,{start:e,end:e+n-1});return!!a}draw(t,e,n,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Lc(t,this,n,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}C(ut,"id","line"),C(ut,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),C(ut,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),C(ut,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function to(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)<s.radius+s.hitRadius}class Xt extends rt{constructor(e){super();C(this,"parsed");C(this,"skip");C(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,n,s){const o=this.options,{x:a,y:r}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(n-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,n){return to(this,e,"x",n)}inYRange(e,n){return to(this,e,"y",n)}getCenterPoint(e){const{x:n,y:s}=this.getProps(["x","y"],e);return{x:n,y:s}}size(e){e=e||this.options||{};let n=e.radius||0;n=Math.max(n,n&&e.hoverRadius||0);const s=n&&e.borderWidth||0;return(n+s)*2}draw(e,n){const s=this.options;this.skip||s.radius<.1||!bt(this,n,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Vi(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}C(Xt,"id","point"),C(Xt,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),C(Xt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function eo(i,t){const{x:e,y:n,base:s,width:o,height:a}=i.getProps(["x","y","base","width","height"],t);let r,l,c,h,d;return i.horizontal?(d=a/2,r=Math.min(e,s),l=Math.max(e,s),c=n-d,h=n+d):(d=o/2,r=e-d,l=e+d,c=Math.min(n,s),h=Math.max(n,s)),{left:r,top:c,right:l,bottom:h}}function At(i,t,e,n){return i?0:G(t,e,n)}function Tc(i,t,e){const n=i.options.borderWidth,s=i.borderSkipped,o=Yn(n);return{t:At(s.top,o.top,0,e),r:At(s.right,o.right,0,t),b:At(s.bottom,o.bottom,0,e),l:At(s.left,o.left,0,t)}}function Oc(i,t,e){const{enableBorderRadius:n}=i.getProps(["enableBorderRadius"]),s=i.options.borderRadius,o=Rt(s),a=Math.min(t,e),r=i.borderSkipped,l=n||O(s);return{topLeft:At(!l||r.top||r.left,o.topLeft,0,a),topRight:At(!l||r.top||r.right,o.topRight,0,a),bottomLeft:At(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:At(!l||r.bottom||r.right,o.bottomRight,0,a)}}function Ic(i){const t=eo(i),e=t.right-t.left,n=t.bottom-t.top,s=Tc(i,e/2,n/2),o=Oc(i,e/2,n/2);return{outer:{x:t.left,y:t.top,w:e,h:n,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:n-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function on(i,t,e,n){const s=t===null,o=e===null,r=i&&!(s&&o)&&eo(i,n);return r&&(s||mt(t,r.left,r.right))&&(o||mt(e,r.top,r.bottom))}function Fc(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function Rc(i,t){i.rect(t.x,t.y,t.w,t.h)}function an(i,t,e={}){const n=i.x!==e.x?-t:0,s=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-n,a=(i.y+i.h!==e.y+e.h?t:0)-s;return{x:i.x+n,y:i.y+s,w:i.w+o,h:i.h+a,radius:i.radius}}class xe extends rt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:n,backgroundColor:s}}=this,{inner:o,outer:a}=Ic(this),r=Fc(a.radius)?le:Rc;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,an(a,e,o)),t.clip(),r(t,an(o,-e,a)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),r(t,an(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,n){return on(this,t,e,n)}inXRange(t,e){return on(this,t,null,e)}inYRange(t,e){return on(this,null,t,e)}getCenterPoint(t){const{x:e,y:n,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?n:(n+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}C(xe,"id","bar"),C(xe,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),C(xe,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Ec(i,t,e){const n=i.segments,s=i.points,o=t.points,a=[];for(const r of n){let{start:l,end:c}=r;c=ln(l,c,s);const h=rn(e,s[l],s[c],r.loop);if(!t.segments){a.push({source:r,target:h,start:s[l],end:s[c]});continue}const d=ls(t,h);for(const u of d){const f=rn(e,o[u.start],o[u.end],u.loop),m=rs(r,s,f);for(const p of m)a.push({source:p,target:u,start:{[e]:io(h,f,"start",Math.max)},end:{[e]:io(h,f,"end",Math.min)}})}}return a}function rn(i,t,e,n){if(n)return;let s=t[i],o=e[i];return i==="angle"&&(s=it(s),o=it(o)),{property:i,start:s,end:o}}function Bc(i,t){const{x:e=null,y:n=null}=i||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=ln(a,r,s);const l=s[a],c=s[r];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function ln(i,t,e){for(;t>i;t--){const n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function io(i,t,e,n){return i&&t?n(i[e],t[e]):i?i[e]:t?t[e]:0}function no(i,t){let e=[],n=!1;return W(i)?(n=!0,e=i):e=Bc(i,t),e.length?new ut({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function so(i){return i&&i.fill!==!1}function zc(i,t,e){let s=i[t].fill;const o=[t];let a;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!V(s))return s;if(a=i[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function Wc(i,t,e){const n=jc(i);if(O(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return V(s)&&Math.floor(s)===s?Hc(n[0],t,s,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function Hc(i,t,e,n){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function Nc(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:O(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Vc(i,t,e){let n;return i==="start"?n=e:i==="end"?n=t.options.reverse?t.min:t.max:O(i)?n=i.value:n=t.getBaseValue(),n}function jc(i){const t=i.options,e=t.fill;let n=T(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function $c(i){const{scale:t,index:e,line:n}=i,s=[],o=n.segments,a=n.points,r=Uc(t,e);r.push(no({x:null,y:t.bottom},n));for(let l=0;l<o.length;l++){const c=o[l];for(let h=c.start;h<=c.end;h++)Yc(s,a[h],r)}return new ut({points:s,options:{}})}function Uc(i,t){const e=[],n=i.getMatchingVisibleMetas("line");for(let s=0;s<n.length;s++){const o=n[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function Yc(i,t,e){const n=[];for(let s=0;s<e.length;s++){const o=e[s],{first:a,last:r,point:l}=Xc(o,t,"x");if(!(!l||a&&r)){if(a)n.unshift(l);else if(i.push(l),!r)break}}i.push(...n)}function Xc(i,t,e){const n=i.interpolate(t,e);if(!n)return{};const s=n[e],o=i.segments,a=i.points;let r=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],d=a[h.start][e],u=a[h.end][e];if(mt(s,d,u)){r=s===d,l=s===u;break}}return{first:r,last:l,point:n}}class oo{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,n){const{x:s,y:o,radius:a}=this;return e=e||{start:0,end:H},t.arc(s,o,a,e.end,e.start,!0),!n.bounds}interpolate(t){const{x:e,y:n,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:n+Math.sin(o)*s,angle:o}}}function Gc(i){const{chart:t,fill:e,line:n}=i;if(V(e))return qc(t,e);if(e==="stack")return $c(i);if(e==="shape")return!0;const s=Kc(i);return s instanceof oo?s:no(s,n)}function qc(i,t){const e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function Kc(i){return(i.scale||{}).getPointPositionForValue?Qc(i):Zc(i)}function Zc(i){const{scale:t={},fill:e}=i,n=Nc(e,t);if(V(n)){const s=t.isHorizontal();return{x:s?n:null,y:s?null:n}}return null}function Qc(i){const{scale:t,fill:e}=i,n=t.options,s=t.getLabels().length,o=n.reverse?t.max:t.min,a=Vc(e,t,o),r=[];if(n.grid.circular){const l=t.getPointPositionForValue(0,o);return new oo({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)r.push(t.getPointPositionForValue(l,a));return r}function cn(i,t,e){const n=Gc(t),{line:s,scale:o,axis:a}=t,r=s.options,l=r.fill,c=r.backgroundColor,{above:h=c,below:d=c}=l||{};n&&s.points.length&&(Ye(i,e),Jc(i,{line:s,target:n,above:h,below:d,area:e,scale:o,axis:a}),Xe(i))}function Jc(i,t){const{line:e,target:n,above:s,below:o,area:a,scale:r}=t,l=e._loop?"angle":t.axis;i.save(),l==="x"&&o!==s&&(ao(i,n,a.top),ro(i,{line:e,target:n,color:s,scale:r,property:l}),i.restore(),i.save(),ao(i,n,a.bottom)),ro(i,{line:e,target:n,color:o,scale:r,property:l}),i.restore()}function ao(i,t,e){const{segments:n,points:s}=t;let o=!0,a=!1;i.beginPath();for(const r of n){const{start:l,end:c}=r,h=s[l],d=s[ln(l,c,s)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(h.x,e),i.lineTo(h.x,h.y)),a=!!t.pathSegment(i,r,{move:a}),a?i.closePath():i.lineTo(d.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function ro(i,t){const{line:e,target:n,property:s,color:o,scale:a}=t,r=Ec(e,n,s);for(const{source:l,target:c,start:h,end:d}of r){const{style:{backgroundColor:u=o}={}}=l,f=n!==!0;i.save(),i.fillStyle=u,th(i,a,f&&rn(s,h,d)),i.beginPath();const m=!!e.pathSegment(i,l);let p;if(f){m?i.closePath():lo(i,n,d,s);const g=!!n.pathSegment(i,c,{move:m,reverse:!0});p=m&&g,p||lo(i,n,h,s)}i.closePath(),i.fill(p?"evenodd":"nonzero"),i.restore()}}function th(i,t,e){const{top:n,bottom:s}=t.chart.chartArea,{property:o,start:a,end:r}=e||{};o==="x"&&(i.beginPath(),i.rect(a,n,r-a,s-n),i.clip())}function lo(i,t,e,n){const s=t.interpolate(e,n);s&&i.lineTo(s.x,s.y)}var eh={id:"filler",afterDatasetsUpdate(i,t,e){const n=(i.data.datasets||[]).length,s=[];let o,a,r,l;for(a=0;a<n;++a)o=i.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof ut&&(l={visible:i.isDatasetVisible(a),index:a,fill:Wc(r,a,n),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<n;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=zc(s,a,e.propagate))},beforeDraw(i,t,e){const n=e.drawTime==="beforeDraw",s=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let a=s.length-1;a>=0;--a){const r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),n&&r.fill&&cn(i.ctx,r,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){const o=n[s].$filler;so(o)&&cn(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const n=t.meta.$filler;!so(n)||e.drawTime!=="beforeDatasetDraw"||cn(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const co=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},ih=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class ho extends rt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=B(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const n=t.labels,s=Y(n.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=co(n,o);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,s,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+r;let d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((m,p)=>{const g=n+e/2+o.measureText(m.text).width;(p===0||c[c.length-1]+g+2*r>a)&&(d+=h,c[c.length-(p>0?0:1)]=0,f+=h,u++),l[p]={left:0,top:f,row:u,width:g,height:s},c[c.length-1]+=g+r}),d}_fitCols(t,e,n,s){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t;let d=r,u=0,f=0,m=0,p=0;return this.legendItems.forEach((g,b)=>{const{itemWidth:y,itemHeight:x}=nh(n,e,o,g,s);b>0&&f+x+2*r>h&&(d+=u+r,c.push({width:u,height:f}),m+=u+r,p++,u=f=0),l[b]={left:m,top:f,col:p,width:y,height:x},u=Math.max(u,y),f+=x+r}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:o}}=this,a=Ut(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=q(n,this.left+s,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=q(n,this.left+s,this.right-this.lineWidths[r])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let r=0,l=q(n,this.top+t+s,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=q(n,this.top+t+s,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ye(t,this),this._draw(),Xe(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:o,labels:a}=t,r=j.color,l=Ut(t.rtl,this.left,this.width),c=Y(a.font),{padding:h}=a,d=c.size,u=d/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:p,itemHeight:g}=co(a,d),b=function(w,k,M){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();const P=T(M.lineWidth,1);if(s.fillStyle=T(M.fillStyle,r),s.lineCap=T(M.lineCap,"butt"),s.lineDashOffset=T(M.lineDashOffset,0),s.lineJoin=T(M.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=T(M.strokeStyle,r),s.setLineDash(T(M.lineDash,[])),a.usePointStyle){const A={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:P},D=l.xPlus(w,m/2),L=k+u;Un(s,A,D,L,a.pointStyleWidth&&m)}else{const A=k+Math.max((d-p)/2,0),D=l.leftForLtr(w,m),L=Rt(M.borderRadius);s.beginPath(),Object.values(L).some(z=>z!==0)?le(s,{x:D,y:A,w:m,h:p,radius:L}):s.rect(D,A,m,p),s.fill(),P!==0&&s.stroke()}s.restore()},y=function(w,k,M){Ft(s,M.text,w,k+g/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},x=this.isHorizontal(),S=this._computeTitleHeight();x?f={x:q(o,this.left+h,this.right-n[0]),y:this.top+h+S,line:0}:f={x:this.left+h,y:q(o,this.top+S+h,this.bottom-e[0].height),line:0},ns(this.ctx,t.textDirection);const v=g+h;this.legendItems.forEach((w,k)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const M=s.measureText(w.text).width,P=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),A=m+u+M;let D=f.x,L=f.y;l.setWidth(this.width),x?k>0&&D+A+h>this.right&&(L=f.y+=v,f.line++,D=f.x=q(o,this.left+h,this.right-n[f.line])):k>0&&L+v>this.bottom&&(D=f.x=D+e[f.line].width+h,f.line++,L=f.y=q(o,this.top+S+h,this.bottom-e[f.line].height));const z=l.x(D);if(b(z,L,w),D=Ia(P,D+m+u,x?D+A:this.right,t.rtl),y(l.x(D),L,w),x)f.x+=A+h;else if(typeof w.text!="string"){const Z=c.lineHeight;f.y+=uo(w,Z)+h}else f.y+=v}),ss(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,n=Y(e.font),s=K(e.padding);if(!e.display)return;const o=Ut(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=n.size/2,c=s.top+l;let h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=q(t.align,d,this.right-u);else{const m=this.columnSizes.reduce((p,g)=>Math.max(p,g.height),0);h=c+q(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const f=q(r,d,d+u);a.textAlign=o.textAlign(Bi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=n.string,Ft(a,e.text,f,h,n)}_computeTitleHeight(){const t=this.options.title,e=Y(t.font),n=K(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,o;if(mt(t,this.left,this.right)&&mt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(s=o[n],mt(t,s.left,s.left+s.width)&&mt(e,s.top,s.top+s.height))return this.legendItems[n]}return null}handleEvent(t){const e=this.options;if(!ah(t.type,e))return;const n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=ih(s,n);s&&!o&&B(e.onLeave,[t,s,this],this),this._hoveredItem=n,n&&!o&&B(e.onHover,[t,n,this],this)}else n&&B(e.onClick,[t,n,this],this)}}function nh(i,t,e,n,s){const o=sh(n,i,t,e),a=oh(s,n,t.lineHeight);return{itemWidth:o,itemHeight:a}}function sh(i,t,e,n){let s=i.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+n.measureText(s).width}function oh(i,t,e){let n=i;return typeof t.text!="string"&&(n=uo(t,e)),n}function uo(i,t){const e=i.text?i.text.length:0;return t*e}function ah(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var _e={id:"legend",_element:ho,start(i,t,e){const n=i.legend=new ho({ctx:i.ctx,options:e,chart:i});st.configure(i,n,e),st.addBox(i,n)},stop(i){st.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const n=i.legend;st.configure(i,n,e),n.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=K(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class fo extends rt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=W(n.text)?n.text.length:1;this._padding=K(n.padding);const o=s*Y(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:n,bottom:s,right:o,options:a}=this,r=a.align;let l=0,c,h,d;return this.isHorizontal()?(h=q(r,n,o),d=e+t,c=o-n):(a.position==="left"?(h=n+t,d=q(r,s,e),l=N*-.5):(h=o-t,d=q(r,e,s),l=N*.5),c=s-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const n=Y(e.font),o=n.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);Ft(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:Bi(e.align),textBaseline:"middle",translation:[a,r]})}}function rh(i,t){const e=new fo({ctx:i.ctx,options:t,chart:i});st.configure(i,e,t),st.addBox(i,e),i.titleBlock=e}var ve={id:"title",_element:fo,start(i,t,e){rh(i,e)},stop(i){const t=i.titleBlock;st.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const n=i.titleBlock;st.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Se={average(i){if(!i.length)return!1;let t,e,n=0,s=0,o=0;for(t=0,e=i.length;t<e;++t){const a=i[t].element;if(a&&a.hasValue()){const r=a.tooltipPosition();n+=r.x,s+=r.y,++o}}return{x:n/o,y:s/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,n=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=i.length;o<a;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=Ri(t,c);h<s&&(s=h,r=l)}}if(r){const l=r.tooltipPosition();e=l.x,n=l.y}return{x:e,y:n}}};function ft(i,t){return t&&(W(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function xt(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
|
|
16
|
+
*/class Er{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,n,s){const o=e.listeners[s],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(n-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Bn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var yt=new Er;const ds="transparent",Br={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=Nn(i||ds),s=n.valid&&Nn(t||ds);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class zr{constructor(t,e,n,s){const o=e[n];s=Ge([t.to,s,o,t.from]);const a=Ge([t.from,o,s]);this._active=!0,this._fn=t.fn||Br[t.type||typeof a],this._easing=ae[t.easing]||ae.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,a=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ge([t.to,e,s,t.from]),this._from=Ge([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||e<n),!this._active){this._target[s]=r,this._notify(!0);return}if(e<0){this._target[s]=o;return}l=e/n%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;s<n.length;s++)n[s][e]()}}class us{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!O(t))return;const e=Object.keys(j.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!O(o))return;const a={};for(const r of e)a[r]=o[r];(W(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!n.has(r))&&n.set(r,a)})})}_animateOptions(t,e){const n=e.options,s=Hr(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&Wr(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const u=n.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new zr(u,t,c,h),s.push(d)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return yt.add(this._chart,n),!0}}function Wr(i,t){const e=[],n=Object.keys(t);for(let s=0;s<n.length;s++){const o=i[n[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function Hr(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function fs(i,t){const e=i&&i.options||{},n=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:n?o:s,end:n?s:o}}function Nr(i,t,e){if(e===!1)return!1;const n=fs(i,e),s=fs(t,e);return{top:s.end,right:n.end,bottom:s.start,left:n.start}}function Vr(i){let t,e,n,s;return O(i)?(t=i.top,e=i.right,n=i.bottom,s=i.left):t=e=n=s=i,{top:t,right:e,bottom:n,left:s,disabled:i===!1}}function gs(i,t){const e=[],n=i._getSortedDatasetMetas(t);let s,o;for(s=0,o=n.length;s<o;++s)e.push(n[s].index);return e}function ps(i,t,e,n={}){const s=i.keys,o=n.mode==="single";let a,r,l,c;if(t!==null){for(a=0,r=s.length;a<r;++a){if(l=+s[a],l===e){if(n.all)continue;break}c=i.values[l],V(c)&&(o||t===0||ct(t)===ct(c))&&(t+=c)}return t}}function jr(i){const t=Object.keys(i),e=new Array(t.length);let n,s,o;for(n=0,s=t.length;n<s;++n)o=t[n],e[n]={x:o,y:i[o]};return e}function ms(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function $r(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Ur(i){const{min:t,max:e,minDefined:n,maxDefined:s}=i.getUserBounds();return{min:n?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function Yr(i,t,e){const n=i[t]||(i[t]={});return n[e]||(n[e]={})}function bs(i,t,e,n){for(const s of t.getMatchingVisibleMetas(n).reverse()){const o=i[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function ys(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=n,l=o.axis,c=a.axis,h=$r(o,a,n),d=t.length;let u;for(let f=0;f<d;++f){const m=t[f],{[l]:g,[c]:p}=m,b=m._stacks||(m._stacks={});u=b[c]=Yr(s,h,g),u[r]=p,u._top=bs(u,a,!0,n.type),u._bottom=bs(u,a,!1,n.type);const y=u._visualValues||(u._visualValues={});y[r]=p}}function Gi(i,t){const e=i.scales;return Object.keys(e).filter(n=>e[n].axis===t).shift()}function Xr(i,t){return Ct(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Gr(i,t,e){return Ct(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ce(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e],o[n]._visualValues!==void 0&&o[n]._visualValues[e]!==void 0&&delete o[n]._visualValues[e]}}}const qi=i=>i==="reset"||i==="none",xs=(i,t)=>t?i:Object.assign({},i),qr=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:gs(e,!0),values:null};class Mt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ms(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&&ce(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(d,u,f,m)=>d==="x"?u:d==="r"?m:f,o=e.xAxisID=T(n.xAxisID,Gi(t,"x")),a=e.yAxisID=T(n.yAxisID,Gi(t,"y")),r=e.rAxisID=T(n.rAxisID,Gi(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,a,r),h=e.vAxisID=s(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Rn(this._data,this),t._stacked&&ce(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(O(e))this._data=jr(e);else if(n!==e){if(n){Rn(n,this);const s=this._cachedMeta;ce(s),s._parsed=[]}e&&Object.isExtensible(e)&&Ta(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=ms(e.vScale,e),e.stack!==n.stack&&(s=!0,ce(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&ys(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:a}=n,r=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,d,u;if(this._parsing===!1)n._parsed=s,n._sorted=!0,u=s;else{W(s[t])?u=this.parseArrayData(n,s,t,e):O(s[t])?u=this.parseObjectData(n,s,t,e):u=this.parsePrimitiveData(n,s,t,e);const f=()=>d[r]===null||c&&d[r]<c[r];for(h=0;h<e;++h)n._parsed[h+t]=d=u[h],l&&(f()&&(l=!1),c=d);n._sorted=l}a&&ys(this,u)}parsePrimitiveData(t,e,n,s){const{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),h=o===a,d=new Array(s);let u,f,m;for(u=0,f=s;u<f;++u)m=u+n,d[u]={[r]:h||o.parse(c[m],m),[l]:a.parse(e[m],m)};return d}parseArrayData(t,e,n,s){const{xScale:o,yScale:a}=t,r=new Array(s);let l,c,h,d;for(l=0,c=s;l<c;++l)h=l+n,d=e[h],r[l]={x:o.parse(d[0],h),y:a.parse(d[1],h)};return r}parseObjectData(t,e,n,s){const{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let h,d,u,f;for(h=0,d=s;h<d;++h)u=h+n,f=e[u],c[h]={x:o.parse(St(f,r),u),y:a.parse(St(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,n){const s=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:gs(s,!0),values:e._stacks[t.axis]._visualValues};return ps(r,a,o.index,{mode:n})}updateRangeFromParsed(t,e,n,s){const o=n[e.axis];let a=o===null?NaN:o;const r=s&&n._stacks[e.axis];s&&r&&(s.values=r,a=ps(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const n=this._cachedMeta,s=n._parsed,o=n._sorted&&t===n.iScale,a=s.length,r=this._getOtherScale(t),l=qr(e,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=Ur(r);let u,f;function m(){f=s[u];const g=f[r.axis];return!V(f[t.axis])||h>g||d<g}for(u=0;u<a&&!(!m()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!m()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,a;for(s=0,o=e.length;s<o;++s)a=e[s][t.axis],V(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,n=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Vr(T(this.options.clip,Nr(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,n=this._cachedMeta,s=n.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,c=this.options.drawActiveElementsOnTop;let h;for(n.dataset&&n.dataset.draw(t,o,r,l),h=r;h<r+l;++h){const d=s[h];d.hidden||(d.active&&c?a.push(d):d.draw(t,o))}for(h=0;h<a.length;++h)a[h].draw(t,o)}getStyle(t,e){const n=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,e,n){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];o=a.$context||(a.$context=Gr(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Xr(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=n,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",n){const s=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&ie(n);if(r)return xs(r,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),h),f=Object.keys(j.elements[t]),m=()=>this.getContext(n,s,e),g=c.resolveNamedOptions(u,f,m,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(xs(g,l))),g}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(s.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,n,e))}const c=new us(s,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||qi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:a}}updateElement(t,e,n,s){qi(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!qi(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const s=n.length,o=e.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,n=!0){const s=this._cachedMeta,o=s.data,a=t+e;let r;const l=c=>{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),n&&this.updateElements(o,t,e,"reset")}updateElements(t,e,n,s){}_removeElements(t,e){const n=this._cachedMeta;if(this._parsing){const s=n._parsed.splice(t,e);n._stacked&&ce(n,s)}n.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,n,s]=t;this[e](n,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}C(Mt,"defaults",{}),C(Mt,"datasetElementType",null),C(Mt,"dataElementType",null);function Kr(i,t){if(!i._cache.$bar){const e=i.getMatchingVisibleMetas(t);let n=[];for(let s=0,o=e.length;s<o;s++)n=n.concat(e[s].controller.getAllParsedValues(i));i._cache.$bar=En(n.sort((s,o)=>s-o))}return i._cache.$bar}function Zr(i){const t=i.iScale,e=Kr(t,i.type);let n=t._length,s,o,a,r;const l=()=>{a===32767||a===-32768||(ie(r)&&(n=Math.min(n,Math.abs(a-r)||n)),r=a)};for(s=0,o=e.length;s<o;++s)a=t.getPixelForValue(e[s]),l();for(r=void 0,s=0,o=t.ticks.length;s<o;++s)a=t.getPixelForTick(s),l();return n}function Qr(i,t,e,n){const s=e.barThickness;let o,a;return F(s)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=s*n,a=1),{chunk:o/n,ratio:a,start:t.pixels[i]-o/2}}function Jr(i,t,e,n){const s=t.pixels,o=s[i];let a=i>0?s[i-1]:null,r=i<s.length-1?s[i+1]:null;const l=e.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);const c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/n,ratio:e.barPercentage,start:c}}function tl(i,t,e,n){const s=e.parse(i[0],n),o=e.parse(i[1],n),a=Math.min(s,o),r=Math.max(s,o);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:a,max:r}}function _s(i,t,e,n){return W(i)?tl(i,t,e,n):t[e.axis]=e.parse(i,n),t}function vs(i,t,e,n){const s=i.iScale,o=i.vScale,a=s.getLabels(),r=s===o,l=[];let c,h,d,u;for(c=e,h=e+n;c<h;++c)u=t[c],d={},d[s.axis]=r||s.parse(a[c],c),l.push(_s(u,d,o,c));return l}function Ki(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function el(i,t,e){return i!==0?ct(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function il(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.base<i.y,e="bottom",n="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:n,reverse:t,top:s,bottom:o}}function nl(i,t,e,n){let s=t.borderSkipped;const o={};if(!s){i.borderSkipped=o;return}if(s===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:r,reverse:l,top:c,bottom:h}=il(i);s==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===n?s=c:(e._bottom||0)===n?s=h:(o[Ss(h,a,r,l)]=!0,s=c)),o[Ss(s,a,r,l)]=!0,i.borderSkipped=o}function Ss(i,t,e,n){return n?(i=sl(i,t,e),i=ks(i,e,t)):i=ks(i,t,e),i}function sl(i,t,e){return i===t?e:i===e?t:i}function ks(i,t,e){return i==="start"?t:i==="end"?e:i}function ol(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}class Je extends Mt{parsePrimitiveData(t,e,n,s){return vs(t,e,n,s)}parseArrayData(t,e,n,s){return vs(t,e,n,s)}parseObjectData(t,e,n,s){const{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,h=a.axis==="x"?r:l,d=[];let u,f,m,g;for(u=n,f=n+s;u<f;++u)g=e[u],m={},m[o.axis]=o.parse(St(g,c),u),d.push(_s(St(g,h),m,a,u));return d}updateRangeFromParsed(t,e,n,s){super.updateRangeFromParsed(t,e,n,s);const o=n._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:n,vScale:s}=e,o=this.getParsed(t),a=o._custom,r=Ki(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,n,s){const o=s==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,s);for(let f=e;f<e+n;f++){const m=this.getParsed(f),g=o||F(m[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,h),b=(m._stacks||{})[r.axis],y={horizontal:c,base:g.base,enableBorderRadius:!b||Ki(m._custom)||a===b._top||a===b._bottom,x:c?g.head:p.center,y:c?p.center:g.head,height:c?p.size:Math.abs(g.size),width:c?Math.abs(g.size):p.size};u&&(y.options=d||this.resolveDataElementOptions(f,t[f].active?"active":s));const _=y.options||t[f].options;nl(y,_,b,a),ol(y,_,h.ratio),this.updateElement(t[f],f,y,s)}}_getStacks(t,e){const{iScale:n}=this._cachedMeta,s=n.getMatchingVisibleMetas(this._type).filter(l=>l.controller.options.grouped),o=n.options.stacked,a=[],r=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(F(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&r(l))&&((o===!1||a.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&a.push(l.stack),l.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,a;for(o=0,a=e.data.length;o<a;++o)s.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));const r=t.barThickness;return{min:r||Zr(e),pixels:s,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:n,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,h=Ki(c);let d=l[e.axis],u=0,f=n?this.applyStack(e,l,n):d,m,g;f!==d&&(u=f-d,f=d),h&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&ct(d)!==ct(c.barEnd)&&(u=0),u+=d);const p=!F(o)&&!h?o:u;let b=e.getPixelForValue(p);if(this.chart.getDataVisibility(t)?m=e.getPixelForValue(u+f):m=b,g=m-b,Math.abs(g)<a){g=el(g,e,r)*a,d===r&&(b-=g/2);const y=e.getPixelForDecimal(0),_=e.getPixelForDecimal(1),S=Math.min(y,_),v=Math.max(y,_);b=Math.max(Math.min(b,v),S),m=b+g,n&&!h&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(m)-e.getValueForPixel(b))}if(b===e.getPixelForValue(r)){const y=ct(g)*e.getLineWidthForValue(r)/2;b+=y,g-=y}return{size:g,base:b,head:m,center:m+g/2}}_calculateBarIndexPixels(t,e){const n=e.scale,s=this.options,o=s.skipNull,a=T(s.maxBarThickness,1/0);let r,l;if(e.grouped){const c=o?this._getStackCount(t):e.stackCount,h=s.barThickness==="flex"?Jr(t,e,s,c):Qr(t,e,s,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=h.start+h.chunk*d+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=n.getPixelForValue(this.getParsed(t)[n.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,n=t.data,s=n.length;let o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&n[o].draw(this._ctx)}}C(Je,"id","bar"),C(Je,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),C(Je,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function al(i,t,e){let n=1,s=1,o=0,a=0;if(t<H){const r=i,l=r+t,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(_,S,v)=>oe(_,r,l,!0)?1:Math.max(S,S*e,v,v*e),m=(_,S,v)=>oe(_,r,l,!0)?-1:Math.min(S,S*e,v,v*e),g=f(0,c,d),p=f($,h,u),b=m(N,c,d),y=m(N+$,h,u);n=(g-b)/2,s=(p-y)/2,o=-(g+b)/2,a=-(p+y)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:a}}class he extends Mt{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(O(n[t])){const{key:l="value"}=this._parsing;o=c=>+St(n[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return ht(this.options.rotation-90)}_getCircumference(){return ht(this.options.circumference)}_getRotationExtents(){let t=H,e=-H;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const s=this.chart.getDatasetMeta(n).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:n}=e,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(n.width,n.height)-a)/2,0),l=Math.min(ba(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:m,offsetY:g}=al(d,h,l),p=(n.width-a)/u,b=(n.height-a)/f,y=Math.max(Math.min(p,b)/2,0),_=Cn(this.options.radius,y),S=Math.max(_*l,0),v=(_-S)/this._getVisibleDatasetWeightTotal();this.offsetX=m*_,this.offsetY=g*_,s.total=this.calculateTotal(),this.outerRadius=_-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const n=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/H)}updateElements(t,e,n,s){const o=s==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,h=(r.left+r.right)/2,d=(r.top+r.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,m=u?0:this.outerRadius,{sharedOptions:g,includeOptions:p}=this._getSharedOptions(e,s);let b=this._getRotation(),y;for(y=0;y<e;++y)b+=this._circumference(y,o);for(y=e;y<e+n;++y){const _=this._circumference(y,o),S=t[y],v={x:h+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+_,circumference:_,outerRadius:m,innerRadius:f};p&&(v.options=g||this.resolveDataElementOptions(y,S.active?"active":s)),b+=_,this.updateElement(S,y,v,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let n=0,s;for(s=0;s<e.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?H*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=je(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,a,r,l;if(!t){for(s=0,o=n.data.datasets.length;s<o;++s)if(n.isDatasetVisible(s)){a=n.getDatasetMeta(s),t=a.data,r=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=r.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let n=0,s=t.length;n<s;++n){const o=this.resolveDataElementOptions(n);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(e+=this._getRingWeight(n));return e}_getRingWeight(t){return Math.max(T(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}C(he,"id","doughnut"),C(he,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),C(he,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),C(he,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}});class ti extends Mt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,a=this.chart._animationsDisabled;let{start:r,count:l}=Fa(e,s,a);this._drawStart=r,this._drawCount=l,Ra(e)&&(r=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},t),this.updateElements(s,r,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,s),u=a.axis,f=r.axis,{spanGaps:m,segment:g}=this.options,p=se(m)?m:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",y=e+n,_=t.length;let S=e>0&&this.getParsed(e-1);for(let v=0;v<_;++v){const w=t[v],k=b?w:{};if(v<e||v>=y){k.skip=!0;continue}const M=this.getParsed(v),P=F(M[f]),A=k[u]=a.getPixelForValue(M[u],v),D=k[f]=o||P?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,M,l):M[f],v);k.skip=isNaN(A)||isNaN(D)||P,k.stop=v>0&&Math.abs(M[u]-S[u])>p,g&&(k.parsed=M,k.raw=c.data[v]),d&&(k.options=h||this.resolveDataElementOptions(v,w.active?"active":s)),b||this.updateElement(w,v,k,s),S=M}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}C(ti,"id","line"),C(ti,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),C(ti,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class ei extends Mt{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return dr.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const r={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(n,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,a=s==="reset";for(let r=e;r<e+n;r++){const l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":s),h=o.getPointPositionForValue(r,this.getParsed(r).r),d=a?o.xCenter:h.x,u=a?o.yCenter:h.y,f={x:d,y:u,angle:h.angle,skip:isNaN(d)||isNaN(u),options:c};this.updateElement(l,r,f,s)}}}C(ei,"id","radar"),C(ei,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),C(ei,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});function Wt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Zi{constructor(t){C(this,"options");this.options=t||{}}static override(t){Object.assign(Zi.prototype,t)}init(){}formats(){return Wt()}parse(){return Wt()}format(){return Wt()}add(){return Wt()}diff(){return Wt()}startOf(){return Wt()}endOf(){return Wt()}}var rl={_date:Zi};function ll(i,t,e,n){const{controller:s,data:o,_sorted:a}=i,r=s._cachedMeta.iScale;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const l=r._reversePixels?Da:Tt;if(n){if(s._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(o,t,e-h),u=l(o,t,e+h);return{lo:d.lo,hi:u.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function de(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r<l;++r){const{index:c,data:h}=o[r],{lo:d,hi:u}=ll(o[r],t,a,s);for(let f=d;f<=u;++f){const m=h[f];m.skip||n(m,c,f)}}}function cl(i){const t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(n,s){const o=t?Math.abs(n.x-s.x):0,a=e?Math.abs(n.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Qi(i,t,e,n,s){const o=[];return!s&&!i.isPointInArea(t)||de(i,e,t,function(r,l,c){!s&&!bt(r,i.chartArea,0)||r.inRange(t.x,t.y,n)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function hl(i,t,e,n){let s=[];function o(a,r,l){const{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],n),{angle:d}=In(a,{x:t.x,y:t.y});oe(d,c,h)&&s.push({element:a,datasetIndex:r,index:l})}return de(i,e,t,o),s}function dl(i,t,e,n,s,o){let a=[];const r=cl(e);let l=Number.POSITIVE_INFINITY;function c(h,d,u){const f=h.inRange(t.x,t.y,s);if(n&&!f)return;const m=h.getCenterPoint(s);if(!(!!o||i.isPointInArea(m))&&!f)return;const p=r(t,m);p<l?(a=[{element:h,datasetIndex:d,index:u}],l=p):p===l&&a.push({element:h,datasetIndex:d,index:u})}return de(i,e,t,c),a}function Ji(i,t,e,n,s,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!n?hl(i,t,e,s):dl(i,t,e,n,s,o)}function ws(i,t,e,n,s){const o=[],a=e==="x"?"inXRange":"inYRange";let r=!1;return de(i,e,t,(l,c,h)=>{l[a](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,s))}),n&&!r?[]:o}var ul={evaluateInteractionItems:de,modes:{index(i,t,e,n){const s=Bt(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?Qi(i,s,o,n,a):Ji(i,s,o,!1,n,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=Bt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?Qi(i,s,o,n,a):Ji(i,s,o,!1,n,a);if(r.length>0){const l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let h=0;h<c.length;++h)r.push({element:c[h],datasetIndex:l,index:h})}return r},point(i,t,e,n){const s=Bt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return Qi(i,s,o,n,a)},nearest(i,t,e,n){const s=Bt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return Ji(i,s,o,e.intersect,n,a)},x(i,t,e,n){const s=Bt(t,i);return ws(i,s,"x",e.intersect,n)},y(i,t,e,n){const s=Bt(t,i);return ws(i,s,"y",e.intersect,n)}}};const Cs=["left","top","right","bottom"];function ue(i,t){return i.filter(e=>e.pos===t)}function Ms(i,t){return i.filter(e=>Cs.indexOf(e.pos)===-1&&e.box.axis===t)}function fe(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function fl(i){const t=[];let e,n,s,o,a,r;for(e=0,n=(i||[]).length;e<n;++e)s=i[e],{position:o,options:{stack:a,stackWeight:r=1}}=s,t.push({index:e,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&o+a,stackWeight:r});return t}function gl(i){const t={};for(const e of i){const{stack:n,pos:s,stackWeight:o}=e;if(!n||!Cs.includes(s))continue;const a=t[n]||(t[n]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function pl(i,t){const e=gl(i),{vBoxMaxWidth:n,hBoxMaxHeight:s}=t;let o,a,r;for(o=0,a=i.length;o<a;++o){r=i[o];const{fullSize:l}=r.box,c=e[r.stack],h=c&&r.stackWeight/c.weight;r.horizontal?(r.width=h?h*n:l&&t.availableWidth,r.height=s):(r.width=n,r.height=h?h*s:l&&t.availableHeight)}return e}function ml(i){const t=fl(i),e=fe(t.filter(c=>c.box.fullSize),!0),n=fe(ue(t,"left"),!0),s=fe(ue(t,"right")),o=fe(ue(t,"top"),!0),a=fe(ue(t,"bottom")),r=Ms(t,"x"),l=Ms(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:ue(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function Ps(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function As(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function bl(i,t,e,n){const{pos:s,box:o}=e,a=i.maxPadding;if(!O(s)){e.size&&(i[s]-=e.size);const d=n[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[s]+=e.size}o.getPadding&&As(a,o.getPadding());const r=Math.max(0,t.outerWidth-Ps(a,i,"left","right")),l=Math.max(0,t.outerHeight-Ps(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function yl(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function xl(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return n(i?["left","right"]:["top","bottom"])}function ge(i,t,e,n){const s=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o<a;++o){r=i[o],l=r.box,l.update(r.width||t.w,r.height||t.h,xl(r.horizontal,t));const{same:d,other:u}=bl(t,e,r,n);c|=d&&s.length,h=h||u,l.fullSize||s.push(r)}return c&&ge(s,t,e,n)||h}function ii(i,t,e,n,s){i.top=e,i.left=t,i.right=t+n,i.bottom=e+s,i.width=n,i.height=s}function Ds(i,t,e,n){const s=e.padding;let{x:o,y:a}=t;for(const r of i){const l=r.box,c=n[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/c.weight||1;if(r.horizontal){const d=t.w*h,u=c.size||l.height;ie(c.start)&&(a=c.start),l.fullSize?ii(l,s.left,a,e.outerWidth-s.right-s.left,u):ii(l,t.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*h,u=c.size||l.width;ie(c.start)&&(o=c.start),l.fullSize?ii(l,o,s.top,u,e.outerHeight-s.bottom-s.top):ii(l,o,t.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=a}var st={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){const e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,n){if(!i)return;const s=K(i.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(e-s.height,0),r=ml(i.boxes),l=r.vertical,c=r.horizontal;R(i.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=l.reduce((g,p)=>p.box.options&&p.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},s);As(u,K(n));const f=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),m=pl(l.concat(c),d);ge(r.fullSize,f,d,m),ge(l,f,d,m),ge(c,f,d,m)&&ge(l,f,d,m),yl(f),Ds(r.leftAndTop,f,d,m),f.x+=f.w,f.y+=f.h,Ds(r.rightAndBottom,f,d,m),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},R(r.chartArea,g=>{const p=g.box;Object.assign(p,i.chartArea),p.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Ls{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}}class _l extends Ls{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ni="$chartjs",vl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ts=i=>i===null||i==="";function Sl(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[ni]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ts(s)){const o=is(i,"width");o!==void 0&&(i.width=o)}if(Ts(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=is(i,"height");o!==void 0&&(i.height=o)}return i}const Os=Cr?{passive:!0}:!1;function kl(i,t,e){i.addEventListener(t,e,Os)}function wl(i,t,e){i.canvas.removeEventListener(t,e,Os)}function Cl(i,t){const e=vl[i.type]||i.type,{x:n,y:s}=Bt(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function si(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Ml(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||si(r.addedNodes,n),a=a&&!si(r.removedNodes,n);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Pl(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||si(r.removedNodes,n),a=a&&!si(r.addedNodes,n);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const pe=new Map;let Is=0;function Fs(){const i=window.devicePixelRatio;i!==Is&&(Is=i,pe.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Al(i,t){pe.size||window.addEventListener("resize",Fs),pe.set(i,t)}function Dl(i){pe.delete(i),pe.size||window.removeEventListener("resize",Fs)}function Ll(i,t,e){const n=i.canvas,s=n&&Xi(n);if(!s)return;const o=zn((r,l)=>{const c=s.clientWidth;e(r,l),c<s.clientWidth&&e()},window),a=new ResizeObserver(r=>{const l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(s),Al(i,o),a}function tn(i,t,e){e&&e.disconnect(),t==="resize"&&Dl(i)}function Tl(i,t,e){const n=i.canvas,s=zn(o=>{i.ctx!==null&&e(Cl(o,i))},i);return kl(n,t,s),s}class Ol extends Ls{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(Sl(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[ni])return!1;const n=e[ni].initial;["height","width"].forEach(o=>{const a=n[o];F(a)?e.removeAttribute(o):e.setAttribute(o,a)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[ni],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),a={attach:Ml,detach:Pl,resize:Ll}[e]||Tl;s[e]=a(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:tn,detach:tn,resize:tn}[e]||wl)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return wr(t,e,n,s)}isAttached(t){const e=Xi(t);return!!(e&&e.isConnected)}}function Il(i){return!ts()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?_l:Ol}class rt{constructor(){C(this,"x");C(this,"y");C(this,"active",!1);C(this,"options");C(this,"$animations")}tooltipPosition(t){const{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return se(this.x)&&se(this.y)}getProps(t,e){const n=this.$animations;if(!e||!n)return this;const s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}}C(rt,"defaults",{}),C(rt,"defaultRoutes");function Fl(i,t){const e=i.options.ticks,n=Rl(i),s=Math.min(e.maxTicksLimit||n,n),o=e.major.enabled?Bl(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>s)return zl(t,c,o,a/s),c;const h=El(o,t,s);if(a>0){let d,u;const f=a>1?Math.round((l-r)/(a-1)):null;for(oi(t,c,h,F(f)?0:r-f,r),d=0,u=a-1;d<u;d++)oi(t,c,h,o[d],o[d+1]);return oi(t,c,h,l,F(f)?t.length:l+f),c}return oi(t,c,h),c}function Rl(i){const t=i.options.offset,e=i._tickSize(),n=i._length/e+(t?0:1),s=i._maxLength/e;return Math.floor(Math.min(n,s))}function El(i,t,e){const n=Wl(i),s=t.length/e;if(!n)return Math.max(s,1);const o=Ca(n);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>s)return l}return Math.max(s,1)}function Bl(i){const t=[];let e,n;for(e=0,n=i.length;e<n;e++)i[e].major&&t.push(e);return t}function zl(i,t,e,n){let s=0,o=e[0],a;for(n=Math.ceil(n),a=0;a<i.length;a++)a===o&&(t.push(i[a]),s++,o=e[s*n])}function oi(i,t,e,n,s){const o=T(n,0),a=Math.min(T(s,i.length),i.length);let r=0,l,c,h;for(e=Math.ceil(e),s&&(l=s-n,e=l/Math.floor(l/e)),h=o;h<0;)r++,h=Math.round(o+r*e);for(c=Math.max(o,0);c<a;c++)c===h&&(t.push(i[c]),r++,h=Math.round(o+r*e))}function Wl(i){const t=i.length;let e,n;if(t<2)return!1;for(n=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==n)return!1;return n}const Hl=i=>i==="left"?"right":i==="right"?"left":i,Rs=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Es=(i,t)=>Math.min(t||i,i);function Bs(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;o<s;o+=n)e.push(i[Math.floor(o)]);return e}function Nl(i,t,e){const n=i.ticks.length,s=Math.min(t,n-1),o=i._startPixel,a=i._endPixel,r=1e-6;let l=i.getPixelForTick(s),c;if(!(e&&(n===1?c=Math.max(l-o,a-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-r||l>a+r)))return l}function Vl(i,t){R(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;o<s;++o)delete e.data[n[o]];n.splice(0,s)}})}function me(i){return i.drawTicks?i.tickLength:0}function zs(i,t){if(!i.display)return 0;const e=Y(i.font,t),n=K(i.padding);return(W(i.text)?i.text.length:1)*e.lineHeight+n.height}function jl(i,t){return Ct(i,{scale:t,type:"scale"})}function $l(i,t,e){return Ct(i,{tick:e,index:t,type:"tick"})}function Ul(i,t,e){let n=Bi(i);return(e&&t!=="right"||!e&&t==="right")&&(n=Hl(n)),n}function Yl(i,t,e,n){const{top:s,left:o,bottom:a,right:r,chart:l}=i,{chartArea:c,scales:h}=l;let d=0,u,f,m;const g=a-s,p=r-o;if(i.isHorizontal()){if(f=q(n,o,r),O(e)){const b=Object.keys(e)[0],y=e[b];m=h[b].getPixelForValue(y)+g-t}else e==="center"?m=(c.bottom+c.top)/2+g-t:m=Rs(i,e,t);u=r-o}else{if(O(e)){const b=Object.keys(e)[0],y=e[b];f=h[b].getPixelForValue(y)-p+t}else e==="center"?f=(c.left+c.right)/2-p+t:f=Rs(i,e,t);m=q(n,a,s),d=e==="left"?-$:$}return{titleX:f,titleY:m,maxWidth:u,rotation:d}}class Ht extends rt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:n,_suggestedMax:s}=this;return t=et(t,Number.POSITIVE_INFINITY),e=et(e,Number.NEGATIVE_INFINITY),n=et(n,Number.POSITIVE_INFINITY),s=et(s,Number.NEGATIVE_INFINITY),{min:et(t,n),max:et(e,s),minDefined:V(t),maxDefined:V(e)}}getMinMax(t){let{min:e,max:n,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:e,max:n};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),o||(n=Math.max(n,a.max));return e=o&&e>n?n:e,n=s&&e>n?e:n,{min:et(e,et(n,e)),max:et(n,et(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){B(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=er(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?Bs(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Fl(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,n;this.isHorizontal()?(e=this.left,n=this.right):(e=this.top,n=this.bottom,t=!t),this._startPixel=e,this._endPixel=n,this._reversePixels=t,this._length=n-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){B(this.options.afterUpdate,[this])}beforeSetDimensions(){B(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){B(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),B(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){B(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let n,s,o;for(n=0,s=t.length;n<s;n++)o=t[n],o.label=B(e.callback,[o.value,n,t],this)}afterTickToLabelConversion(){B(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){B(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,n=Es(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation;let a=s,r,l,c;if(!this._isVisible()||!e.display||s>=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=G(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/n:f/(n-1),d+6>r&&(r=f/(n-(t.offset?.5:1)),l=this.maxHeight-me(t.grid)-e.padding-zs(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=Fi(Math.min(Math.asin(G((h.highest.height+6)/r,-1,1)),Math.asin(G(l/c,-1,1))-Math.asin(G(u/c,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){B(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){B(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=zs(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=me(o)+l):(t.height=this.maxHeight,t.width=me(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=n.padding*2,m=ht(this.labelRotation),g=Math.cos(m),p=Math.sin(m);if(r){const b=n.mirror?0:p*d.width+g*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=n.mirror?0:g*d.width+p*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,p,g)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=s*t.width,f=n*e.height):(u=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){B(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e<n;e++)F(t[e].label)&&(t.splice(e,1),n--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let n=this.ticks;e<n.length&&(n=Bs(n,e)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,n){const{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/Es(e,n));let c=0,h=0,d,u,f,m,g,p,b,y,_,S,v;for(d=0;d<e;d+=l){if(m=t[d].label,g=this._resolveTickFontOptions(d),s.font=p=g.string,b=o[p]=o[p]||{data:{},gc:[]},y=g.lineHeight,_=S=0,!F(m)&&!W(m))_=Ue(s,b.data,b.gc,_,m),S=y;else if(W(m))for(u=0,f=m.length;u<f;++u)v=m[u],!F(v)&&!W(v)&&(_=Ue(s,b.data,b.gc,_,v),S+=y);a.push(_),r.push(S),c=Math.max(_,c),h=Math.max(S,h)}Vl(o,e);const w=a.indexOf(c),k=r.indexOf(h),M=P=>({width:a[P]||0,height:r[P]||0});return{first:M(0),last:M(e-1),widest:M(w),highest:M(k),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Aa(this._alignToPixels?It(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const n=e[t];return n.$context||(n.$context=$l(this.getContext(),t,n))}return this.$context||(this.$context=jl(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=ht(this.labelRotation),n=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*n>r*s?r/n:l/s:l*s<r*n?l/n:r/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:a,border:r}=s,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=me(o),f=[],m=r.setContext(this.getContext()),g=m.display?m.width:0,p=g/2,b=function(E){return It(n,E,g)};let y,_,S,v,w,k,M,P,A,D,L,z;if(a==="top")y=b(this.bottom),k=this.bottom-u,P=y-p,D=b(t.top)+p,z=t.bottom;else if(a==="bottom")y=b(this.top),D=t.top,z=b(t.bottom)-p,k=y+p,P=this.top+u;else if(a==="left")y=b(this.right),w=this.right-u,M=y-p,A=b(t.left)+p,L=t.right;else if(a==="right")y=b(this.left),A=t.left,L=b(t.right)-p,w=y+p,M=this.left+u;else if(e==="x"){if(a==="center")y=b((t.top+t.bottom)/2+.5);else if(O(a)){const E=Object.keys(a)[0],U=a[E];y=b(this.chart.scales[E].getPixelForValue(U))}D=t.top,z=t.bottom,k=y+p,P=k+u}else if(e==="y"){if(a==="center")y=b((t.left+t.right)/2);else if(O(a)){const E=Object.keys(a)[0],U=a[E];y=b(this.chart.scales[E].getPixelForValue(U))}w=y-p,M=w-u,A=t.left,L=t.right}const Z=T(s.ticks.maxTicksLimit,d),I=Math.max(1,Math.ceil(d/Z));for(_=0;_<d;_+=I){const E=this.getContext(_),U=o.setContext(E),lt=r.setContext(E),Q=U.lineWidth,Kt=U.color,Pi=lt.dash||[],Zt=lt.dashOffset,Oe=U.tickWidth,Ie=U.tickColor,Fe=U.tickBorderDash||[],Re=U.tickBorderDashOffset;S=Nl(this,_,l),S!==void 0&&(v=It(n,S,Q),c?w=M=A=L=v:k=P=D=z=v,f.push({tx1:w,ty1:k,tx2:M,ty2:P,x1:A,y1:D,x2:L,y2:z,width:Q,color:Kt,borderDash:Pi,borderDashOffset:Zt,tickWidth:Oe,tickColor:Ie,tickBorderDash:Fe,tickBorderDashOffset:Re}))}return this._ticksLength=d,this._borderValue=y,f}_computeLabelItems(t){const e=this.axis,n=this.options,{position:s,ticks:o}=n,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=me(n.grid),f=u+h,m=d?-h:f,g=-ht(this.labelRotation),p=[];let b,y,_,S,v,w,k,M,P,A,D,L,z="middle";if(s==="top")w=this.bottom-m,k=this._getXAxisLabelAlignment();else if(s==="bottom")w=this.top+m,k=this._getXAxisLabelAlignment();else if(s==="left"){const I=this._getYAxisLabelAlignment(u);k=I.textAlign,v=I.x}else if(s==="right"){const I=this._getYAxisLabelAlignment(u);k=I.textAlign,v=I.x}else if(e==="x"){if(s==="center")w=(t.top+t.bottom)/2+f;else if(O(s)){const I=Object.keys(s)[0],E=s[I];w=this.chart.scales[I].getPixelForValue(E)+f}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")v=(t.left+t.right)/2-f;else if(O(s)){const I=Object.keys(s)[0],E=s[I];v=this.chart.scales[I].getPixelForValue(E)}k=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?z="top":l==="end"&&(z="bottom"));const Z=this._getLabelSizes();for(b=0,y=r.length;b<y;++b){_=r[b],S=_.label;const I=o.setContext(this.getContext(b));M=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),A=P.lineHeight,D=W(S)?S.length:1;const E=D/2,U=I.color,lt=I.textStrokeColor,Q=I.textStrokeWidth;let Kt=k;a?(v=M,k==="inner"&&(b===y-1?Kt=this.options.reverse?"left":"right":b===0?Kt=this.options.reverse?"right":"left":Kt="center"),s==="top"?c==="near"||g!==0?L=-D*A+A/2:c==="center"?L=-Z.highest.height/2-E*A+A:L=-Z.highest.height+A/2:c==="near"||g!==0?L=A/2:c==="center"?L=Z.highest.height/2-E*A:L=Z.highest.height-D*A,d&&(L*=-1),g!==0&&!I.showLabelBackdrop&&(v+=A/2*Math.sin(g))):(w=M,L=(1-D)*A/2);let Pi;if(I.showLabelBackdrop){const Zt=K(I.backdropPadding),Oe=Z.heights[b],Ie=Z.widths[b];let Fe=L-Zt.top,Re=0-Zt.left;switch(z){case"middle":Fe-=Oe/2;break;case"bottom":Fe-=Oe;break}switch(k){case"center":Re-=Ie/2;break;case"right":Re-=Ie;break}Pi={left:Re,top:Fe,width:Ie+Zt.width,height:Oe+Zt.height,color:I.backdropColor}}p.push({label:S,font:P,textOffset:L,options:{rotation:g,color:U,strokeColor:lt,strokeWidth:Q,textAlign:Kt,textBaseline:z,translation:[v,w],backdrop:Pi}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-ht(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:n,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width;let c,h;return e==="left"?s?(h=this.right+o,n==="near"?c="left":n==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,n==="near"?c="right":n==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?s?(h=this.left+o,n==="near"?c="right":n==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,n==="near"?c="left":n==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:n,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,s,o,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const r=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,a=s.length;o<a;++o){const l=s[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:n,grid:s}}=this,o=n.setContext(this.getContext()),a=n.display?o.width:0;if(!a)return;const r=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,d,u;this.isHorizontal()?(c=It(t,this.left,a)-a/2,h=It(t,this.right,r)+r/2,d=u=l):(d=It(t,this.top,a)-a/2,u=It(t,this.bottom,r)+r/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,d),e.lineTo(h,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const n=this.ctx,s=this._computeLabelArea();s&&Ye(n,s);const o=this.getLabelItems(t);for(const a of o){const r=a.options,l=a.font,c=a.label,h=a.textOffset;Ft(n,c,0,h,l,r)}s&&Xe(n)}drawTitle(){const{ctx:t,options:{position:e,title:n,reverse:s}}=this;if(!n.display)return;const o=Y(n.font),a=K(n.padding),r=n.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||O(e)?(l+=a.bottom,W(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=a.top;const{titleX:c,titleY:h,maxWidth:d,rotation:u}=Yl(this,l,e,r);Ft(t,n.text,0,0,o,{color:n.color,maxWidth:d,rotation:u,textAlign:Ul(r,e,s),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,n=T(t.grid&&t.grid.z,-1),s=T(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Ht.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,a;for(o=0,a=e.length;o<a;++o){const r=e[o];r[n]===this.id&&(!t||r.type===t)&&s.push(r)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return Y(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class ai{constructor(t,e,n){this.type=t,this.scope=e,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let n;ql(e)&&(n=this.register(e));const s=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Xl(t,a,n),this.override&&j.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,n=t.id,s=this.scope;n in e&&delete e[n],s&&n in j[s]&&(delete j[s][n],this.override&&delete Ot[n])}}function Xl(i,t,e){const n=te(Object.create(null),[e?j.get(e):{},j.get(t),i.defaults]);j.set(t,n),i.defaultRoutes&&Gl(t,i.defaultRoutes),i.descriptors&&j.describe(t,i.descriptors)}function Gl(i,t){Object.keys(t).forEach(e=>{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");j.route(o,s,l,r)})}function ql(i){return"id"in i&&"defaults"in i}class Kl{constructor(){this.controllers=new ai(Mt,"datasets",!0),this.elements=new ai(rt,"elements"),this.plugins=new ai(Object,"plugins"),this.scales=new ai(Ht,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):R(s,a=>{const r=n||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,n){const s=Ii(t);B(n["before"+s],[],n),e[t](n),B(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const n=this._typedRegistries[e];if(n.isForType(t))return n}return this.plugins}_get(t,e,n){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return s}}var dt=new Kl;class Zl{constructor(){this._init=[]}notify(t,e,n,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(o,t,e,n);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,n,s){s=s||{};for(const o of t){const a=o.plugin,r=a[n],l=[e,s,o.options];if(B(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){F(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const n=t&&t.config,s=T(n.options&&n.options.plugins,{}),o=Ql(n);return s===!1&&!e?[]:tc(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],n=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}}function Ql(i){const t={},e=[],n=Object.keys(dt.plugins.items);for(let o=0;o<n.length;o++)e.push(dt.getPlugin(n[o]));const s=i.plugins||[];for(let o=0;o<s.length;o++){const a=s[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Jl(i,t){return!t&&i===!1?null:i===!0?{}:i}function tc(i,{plugins:t,localIds:e},n,s){const o=[],a=i.getContext();for(const r of t){const l=r.id,c=Jl(n[l],s);c!==null&&o.push({plugin:r,options:ec(i.config,{plugin:r,local:e[l]},c,a)})}return o}function ec(i,{plugin:t,local:e},n,s){const o=i.pluginScopeKeys(t),a=i.getOptionScopes(n,o);return e&&t.defaults&&a.push(t.defaults),i.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function en(i,t){const e=j.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function ic(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function nc(i,t){return i===t?"_index_":"_value_"}function Ws(i){if(i==="x"||i==="y"||i==="r")return i}function sc(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function nn(i,...t){if(Ws(i))return i;for(const e of t){const n=e.axis||sc(e.position)||i.length>1&&Ws(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Hs(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function oc(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(e.length)return Hs(i,"x",e[0])||Hs(i,"y",e[0])}return{}}function ac(i,t){const e=Ot[i.type]||{scales:{}},n=t.scales||{},s=en(i.type,t),o=Object.create(null);return Object.keys(n).forEach(a=>{const r=n[a];if(!O(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=nn(a,r,oc(a,i),j.scales[r.type]),c=nc(l,s),h=e.scales||{};o[a]=ee(Object.create(null),[{axis:l},r,h[l],h[c]])}),i.data.datasets.forEach(a=>{const r=a.type||i.type,l=a.indexAxis||en(r,t),h=(Ot[r]||{}).scales||{};Object.keys(h).forEach(d=>{const u=ic(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),ee(o[f],[{axis:u},n[f],h[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];ee(r,[j.scales[r.type],j.scale])}),o}function Ns(i){const t=i.options||(i.options={});t.plugins=T(t.plugins,{}),t.scales=ac(i,t)}function Vs(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function rc(i){return i=i||{},i.data=Vs(i.data),Ns(i),i}const js=new Map,$s=new Set;function ri(i,t){let e=js.get(i);return e||(e=t(),js.set(i,e),$s.add(e)),e}const be=(i,t,e)=>{const n=St(t,e);n!==void 0&&i.add(n)};class lc{constructor(t){this._config=rc(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=Vs(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Ns(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ri(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ri(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ri(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return ri(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,a=this._cachedScopes(t,n),r=a.get(e);if(r)return r;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>be(l,t,d))),h.forEach(d=>be(l,s,d)),h.forEach(d=>be(l,Ot[o]||{},d)),h.forEach(d=>be(l,j,d)),h.forEach(d=>be(l,Hi,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),$s.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Ot[e]||{},j.datasets[e]||{},{type:e},j,Hi]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=Us(this._resolverCache,t,s);let l=a;if(hc(a,e)){o.$shared=!1,n=kt(n)?n():n;const c=this.createResolver(t,n,r);l=jt(a,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=Us(this._resolverCache,t,n);return O(e)?jt(o,e,void 0,s):o}}function Us(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:$i(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},n.set(s,o)),o}const cc=i=>O(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||kt(i[e]),!1);function hc(i,t){const{isScriptable:e,isIndexable:n}=Xn(i);for(const s of t){const o=e(s),a=n(s),r=(a||o)&&i[s];if(o&&(kt(r)||cc(r))||a&&W(r))return!0}return!1}var dc="4.4.0";const uc=["top","bottom","left","right","chartArea"];function Ys(i,t){return i==="top"||i==="bottom"||uc.indexOf(i)===-1&&t==="x"}function Xs(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function Gs(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),B(e&&e.onComplete,[i],t)}function fc(i){const t=i.chart,e=t.options.animation;B(e&&e.onProgress,[i],t)}function qs(i){return ts()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const li={},Ks=i=>{const t=qs(i);return Object.values(li).filter(e=>e.canvas===t).pop()};function gc(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const a=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=a)}}}function pc(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}function ci(i,t,e){return i.options.clip?i[e]:t[e]}function mc(i,t){const{xScale:e,yScale:n}=i;return e&&n?{left:ci(e,t,"left"),right:ci(e,t,"right"),top:ci(n,t,"top"),bottom:ci(n,t,"bottom")}:t}let Pt=(Dt=class{static register(...t){dt.add(...t),Zs()}static unregister(...t){dt.remove(...t),Zs()}constructor(t,e){const n=this.config=new lc(e),s=qs(t),o=Ks(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Il(s)),this.platform.updateConfig(n);const r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=ma(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Zl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Oa(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],li[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}yt.listen(this,"complete",Gs),yt.listen(this,"progress",fc),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return F(t)?e&&o?o:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return dt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():es(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return $n(this.canvas,this.ctx),this}stop(){return yt.stop(this),this}resize(t,e){yt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),r=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,es(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),B(n.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};R(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((a,r)=>(a[r]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const r=e[a],l=nn(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),R(o,a=>{const r=a.options,l=r.id,c=nn(l,r),h=T(r.type,a.dtype);(r.position===void 0||Ys(r.position,c)!==Ys(a.dposition))&&(r.position=a.dposition),s[l]=!0;let d=null;if(l in n&&n[l].type===h)d=n[l];else{const u=dt.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),n[d.id]=d}d.init(r,t)}),R(s,(a,r)=>{a||delete n[r]}),R(n,a=>{st.configure(this,a,a.options),st.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;s<n;++s)this._destroyDatasetMeta(s);t.splice(e,n-e)}this._sortedMetasets=t.slice(0).sort(Xs("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n<s;n++){const o=e[n];let a=this.getDatasetMeta(n);const r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(n),a=this.getDatasetMeta(n)),a.type=r,a.indexAxis=o.indexAxis||en(r,this.options),a.order=o.order||0,a.index=n,a.label=""+o.label,a.visible=this.isDatasetVisible(n),a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{const l=dt.getController(r),{datasetElementType:c,dataElementType:h}=j.datasets[r];Object.assign(l,{dataElementType:dt.getElement(h),datasetElementType:c&&dt.getElement(c)}),a.controller=new l(this,n),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){R(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:d}=this.getDatasetMeta(c),u=!s&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),s||R(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Xs("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){R(this.scales,t=>{st.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!An(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const a=n==="_removeElements"?-o:o;gc(t,s,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=n(0);for(let o=1;o<e;o++)if(!An(s,n(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;st.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],R(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e<n;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,n=this.data.datasets.length;e<n;++e)this._updateDataset(e,kt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const n=this.getDatasetMeta(t),s={meta:n,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(n.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(yt.has(this)?this.attached&&!yt.running(this)&&yt.start(this):(this.draw(),Gs({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:n,height:s}=this._resizeBeforeDraw;this._resize(n,s),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,n=[];let s,o;for(s=0,o=e.length;s<o;++s){const a=e[s];(!t||a.visible)&&n.push(a)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=mc(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(s&&Ye(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&Xe(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return bt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=ul.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=Ct(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);ie(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),a.update(o,{visible:n}),this.update(r=>r.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),yt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),$n(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete li[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,n=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};R(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{s("attach",r),this.attached=!0,this.resize(),n("resize",o),n("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){R(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},R(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],n=t.map(({datasetIndex:o,index:a})=>{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!We(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=n?t:o(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,a=e,r=this._getActiveElements(t,s,n,a),l=Sa(t),c=pc(t,this._lastEvent,n,l);n&&(this._lastEvent=null,B(o.onHover,[t,r,this],this),l&&B(o.onClick,[t,r,this],this));const h=!We(r,s);return(h||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},C(Dt,"defaults",j),C(Dt,"instances",li),C(Dt,"overrides",Ot),C(Dt,"registry",dt),C(Dt,"version",dc),C(Dt,"getChart",Ks),Dt);function Zs(){return R(Pt.instances,i=>i._plugins.invalidate())}function bc(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t;let c=s/r;i.beginPath(),i.arc(o,a,r,n-c,e+c),l>s?(c=s/l,i.arc(o,a,l,e+c,n-c,!0)):i.arc(o,a,s,e+$,n-$),i.closePath(),i.clip()}function yc(i){return ji(i,["outerStart","outerEnd","innerStart","innerEnd"])}function xc(i,t,e,n){const s=yc(i.options.borderRadius),o=(e-t)/2,a=Math.min(o,n*t/2),r=l=>{const c=(e-Math.min(o,l))*n/2;return G(l,0,Math.min(o,c))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:G(s.innerStart,0,a),innerEnd:G(s.innerEnd,0,a)}}function Yt(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function hi(i,t,e,n,s,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+n+e-c,0),u=h>0?h+n+e+c:0;let f=0;const m=s-l;if(n){const I=h>0?h-n:0,E=d>0?d-n:0,U=(I+E)/2,lt=U!==0?m*U/(U+n):m;f=(m-lt)/2}const g=Math.max(.001,m*d-e/N)/d,p=(m-g)/2,b=l+p+f,y=s-p-f,{outerStart:_,outerEnd:S,innerStart:v,innerEnd:w}=xc(t,u,d,y-b),k=d-_,M=d-S,P=b+_/k,A=y-S/M,D=u+v,L=u+w,z=b+v/D,Z=y-w/L;if(i.beginPath(),o){const I=(P+A)/2;if(i.arc(a,r,d,P,I),i.arc(a,r,d,I,A),S>0){const Q=Yt(M,A,a,r);i.arc(Q.x,Q.y,S,A,y+$)}const E=Yt(L,y,a,r);if(i.lineTo(E.x,E.y),w>0){const Q=Yt(L,Z,a,r);i.arc(Q.x,Q.y,w,y+$,Z+Math.PI)}const U=(y-w/u+(b+v/u))/2;if(i.arc(a,r,u,y-w/u,U,!0),i.arc(a,r,u,U,b+v/u,!0),v>0){const Q=Yt(D,z,a,r);i.arc(Q.x,Q.y,v,z+Math.PI,b-$)}const lt=Yt(k,b,a,r);if(i.lineTo(lt.x,lt.y),_>0){const Q=Yt(k,P,a,r);i.arc(Q.x,Q.y,_,b-$,P)}}else{i.moveTo(a,r);const I=Math.cos(P)*d+a,E=Math.sin(P)*d+r;i.lineTo(I,E);const U=Math.cos(A)*d+a,lt=Math.sin(A)*d+r;i.lineTo(U,lt)}i.closePath()}function _c(i,t,e,n,s){const{fullCircles:o,startAngle:a,circumference:r}=t;let l=t.endAngle;if(o){hi(i,t,e,n,l,s);for(let c=0;c<o;++c)i.fill();isNaN(r)||(l=a+(r%H||H))}return hi(i,t,e,n,l,s),i.fill(),l}function vc(i,t,e,n,s){const{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,f=l.borderAlign==="inner";if(!c)return;i.setLineDash(d||[]),i.lineDashOffset=u,f?(i.lineWidth=c*2,i.lineJoin=h||"round"):(i.lineWidth=c,i.lineJoin=h||"bevel");let m=t.endAngle;if(o){hi(i,t,e,n,m,s);for(let g=0;g<o;++g)i.stroke();isNaN(r)||(m=a+(r%H||H))}f&&bc(i,t,m),o||(hi(i,t,e,n,m,s),i.stroke())}class ye extends rt{constructor(e){super();C(this,"circumference");C(this,"endAngle");C(this,"fullCircles");C(this,"innerRadius");C(this,"outerRadius");C(this,"pixelMargin");C(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,n,s){const o=this.getProps(["x","y"],s),{angle:a,distance:r}=In(o,{x:e,y:n}),{startAngle:l,endAngle:c,innerRadius:h,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),f=(this.options.spacing+this.options.borderWidth)/2,g=T(u,c-l)>=H||oe(a,l,c),p=mt(r,h+f,d+f);return g&&p}getCenterPoint(e){const{x:n,y:s,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,d=(o+a)/2,u=(r+l+h+c)/2;return{x:n+Math.cos(d)*u,y:s+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:n,circumference:s}=this,o=(n.offset||0)/4,a=(n.spacing||0)/2,r=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=s>H?Math.floor(s/H):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(N,s||0)),h=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,_c(e,this,h,a,r),vc(e,this,h,a,r),e.restore()}}C(ye,"id","arc"),C(ye,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),C(ye,"defaultRoutes",{backgroundColor:"backgroundColor"}),C(ye,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function Qs(i,t,e=t){i.lineCap=T(e.borderCapStyle,t.borderCapStyle),i.setLineDash(T(e.borderDash,t.borderDash)),i.lineDashOffset=T(e.borderDashOffset,t.borderDashOffset),i.lineJoin=T(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=T(e.borderWidth,t.borderWidth),i.strokeStyle=T(e.borderColor,t.borderColor)}function Sc(i,t,e){i.lineTo(e.x,e.y)}function kc(i){return i.stepped?Ya:i.tension||i.cubicInterpolationMode==="monotone"?Xa:Sc}function Js(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:a,end:r}=t,l=Math.max(s,a),c=Math.min(o,r),h=s<a&&o<a||s>r&&o>r;return{count:n,start:l,loop:t.loop,ilen:c<l&&!h?n+c-l:c-l}}function wc(i,t,e,n){const{points:s,options:o}=t,{count:a,start:r,loop:l,ilen:c}=Js(s,e,n),h=kc(o);let{move:d=!0,reverse:u}=n||{},f,m,g;for(f=0;f<=c;++f)m=s[(r+(u?c-f:f))%a],!m.skip&&(d?(i.moveTo(m.x,m.y),d=!1):h(i,g,m,u,o.stepped),g=m);return l&&(m=s[(r+(u?c:0))%a],h(i,g,m,u,o.stepped)),!!l}function Cc(i,t,e,n){const s=t.points,{count:o,start:a,ilen:r}=Js(s,e,n),{move:l=!0,reverse:c}=n||{};let h=0,d=0,u,f,m,g,p,b;const y=S=>(a+(c?r-S:S))%o,_=()=>{g!==p&&(i.lineTo(h,p),i.lineTo(h,g),i.lineTo(h,b))};for(l&&(f=s[y(0)],i.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=s[y(u)],f.skip)continue;const S=f.x,v=f.y,w=S|0;w===m?(v<g?g=v:v>p&&(p=v),h=(d*h+S)/++d):(_(),i.lineTo(S,v),m=w,d=0,g=p=v),b=v}_()}function sn(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Cc:wc}function Mc(i){return i.stepped?Mr:i.tension||i.cubicInterpolationMode==="monotone"?Pr:zt}function Pc(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),Qs(i,t.options),i.stroke(s)}function Ac(i,t,e,n){const{segments:s,options:o}=t,a=sn(t);for(const r of s)Qs(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const Dc=typeof Path2D=="function";function Lc(i,t,e,n){Dc&&!t.options.segment?Pc(i,t,e,n):Ac(i,t,e,n)}class ut extends rt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;yr(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ir(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,a=ls(this,{property:e,start:s,end:s});if(!a.length)return;const r=[],l=Mc(n);let c,h;for(c=0,h=a.length;c<h;++c){const{start:d,end:u}=a[c],f=o[d],m=o[u];if(f===m){r.push(f);continue}const g=Math.abs((s-f[e])/(m[e]-f[e])),p=l(f,m,g,n.stepped);p[e]=t[e],r.push(p)}return r.length===1?r[0]:r}pathSegment(t,e,n){return sn(this)(t,this,e,n)}path(t,e,n){const s=this.segments,o=sn(this);let a=this._loop;e=e||0,n=n||this.points.length-e;for(const r of s)a&=o(t,this,r,{start:e,end:e+n-1});return!!a}draw(t,e,n,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Lc(t,this,n,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}C(ut,"id","line"),C(ut,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),C(ut,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),C(ut,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function to(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)<s.radius+s.hitRadius}class Xt extends rt{constructor(e){super();C(this,"parsed");C(this,"skip");C(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,n,s){const o=this.options,{x:a,y:r}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(n-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,n){return to(this,e,"x",n)}inYRange(e,n){return to(this,e,"y",n)}getCenterPoint(e){const{x:n,y:s}=this.getProps(["x","y"],e);return{x:n,y:s}}size(e){e=e||this.options||{};let n=e.radius||0;n=Math.max(n,n&&e.hoverRadius||0);const s=n&&e.borderWidth||0;return(n+s)*2}draw(e,n){const s=this.options;this.skip||s.radius<.1||!bt(this,n,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Vi(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}C(Xt,"id","point"),C(Xt,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),C(Xt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function eo(i,t){const{x:e,y:n,base:s,width:o,height:a}=i.getProps(["x","y","base","width","height"],t);let r,l,c,h,d;return i.horizontal?(d=a/2,r=Math.min(e,s),l=Math.max(e,s),c=n-d,h=n+d):(d=o/2,r=e-d,l=e+d,c=Math.min(n,s),h=Math.max(n,s)),{left:r,top:c,right:l,bottom:h}}function At(i,t,e,n){return i?0:G(t,e,n)}function Tc(i,t,e){const n=i.options.borderWidth,s=i.borderSkipped,o=Yn(n);return{t:At(s.top,o.top,0,e),r:At(s.right,o.right,0,t),b:At(s.bottom,o.bottom,0,e),l:At(s.left,o.left,0,t)}}function Oc(i,t,e){const{enableBorderRadius:n}=i.getProps(["enableBorderRadius"]),s=i.options.borderRadius,o=Rt(s),a=Math.min(t,e),r=i.borderSkipped,l=n||O(s);return{topLeft:At(!l||r.top||r.left,o.topLeft,0,a),topRight:At(!l||r.top||r.right,o.topRight,0,a),bottomLeft:At(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:At(!l||r.bottom||r.right,o.bottomRight,0,a)}}function Ic(i){const t=eo(i),e=t.right-t.left,n=t.bottom-t.top,s=Tc(i,e/2,n/2),o=Oc(i,e/2,n/2);return{outer:{x:t.left,y:t.top,w:e,h:n,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:n-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function on(i,t,e,n){const s=t===null,o=e===null,r=i&&!(s&&o)&&eo(i,n);return r&&(s||mt(t,r.left,r.right))&&(o||mt(e,r.top,r.bottom))}function Fc(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function Rc(i,t){i.rect(t.x,t.y,t.w,t.h)}function an(i,t,e={}){const n=i.x!==e.x?-t:0,s=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-n,a=(i.y+i.h!==e.y+e.h?t:0)-s;return{x:i.x+n,y:i.y+s,w:i.w+o,h:i.h+a,radius:i.radius}}class xe extends rt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:n,backgroundColor:s}}=this,{inner:o,outer:a}=Ic(this),r=Fc(a.radius)?le:Rc;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,an(a,e,o)),t.clip(),r(t,an(o,-e,a)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),r(t,an(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,n){return on(this,t,e,n)}inXRange(t,e){return on(this,t,null,e)}inYRange(t,e){return on(this,null,t,e)}getCenterPoint(t){const{x:e,y:n,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?n:(n+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}C(xe,"id","bar"),C(xe,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),C(xe,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Ec(i,t,e){const n=i.segments,s=i.points,o=t.points,a=[];for(const r of n){let{start:l,end:c}=r;c=ln(l,c,s);const h=rn(e,s[l],s[c],r.loop);if(!t.segments){a.push({source:r,target:h,start:s[l],end:s[c]});continue}const d=ls(t,h);for(const u of d){const f=rn(e,o[u.start],o[u.end],u.loop),m=rs(r,s,f);for(const g of m)a.push({source:g,target:u,start:{[e]:io(h,f,"start",Math.max)},end:{[e]:io(h,f,"end",Math.min)}})}}return a}function rn(i,t,e,n){if(n)return;let s=t[i],o=e[i];return i==="angle"&&(s=it(s),o=it(o)),{property:i,start:s,end:o}}function Bc(i,t){const{x:e=null,y:n=null}=i||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=ln(a,r,s);const l=s[a],c=s[r];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function ln(i,t,e){for(;t>i;t--){const n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function io(i,t,e,n){return i&&t?n(i[e],t[e]):i?i[e]:t?t[e]:0}function no(i,t){let e=[],n=!1;return W(i)?(n=!0,e=i):e=Bc(i,t),e.length?new ut({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function so(i){return i&&i.fill!==!1}function zc(i,t,e){let s=i[t].fill;const o=[t];let a;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!V(s))return s;if(a=i[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function Wc(i,t,e){const n=jc(i);if(O(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return V(s)&&Math.floor(s)===s?Hc(n[0],t,s,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function Hc(i,t,e,n){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function Nc(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:O(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Vc(i,t,e){let n;return i==="start"?n=e:i==="end"?n=t.options.reverse?t.min:t.max:O(i)?n=i.value:n=t.getBaseValue(),n}function jc(i){const t=i.options,e=t.fill;let n=T(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function $c(i){const{scale:t,index:e,line:n}=i,s=[],o=n.segments,a=n.points,r=Uc(t,e);r.push(no({x:null,y:t.bottom},n));for(let l=0;l<o.length;l++){const c=o[l];for(let h=c.start;h<=c.end;h++)Yc(s,a[h],r)}return new ut({points:s,options:{}})}function Uc(i,t){const e=[],n=i.getMatchingVisibleMetas("line");for(let s=0;s<n.length;s++){const o=n[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function Yc(i,t,e){const n=[];for(let s=0;s<e.length;s++){const o=e[s],{first:a,last:r,point:l}=Xc(o,t,"x");if(!(!l||a&&r)){if(a)n.unshift(l);else if(i.push(l),!r)break}}i.push(...n)}function Xc(i,t,e){const n=i.interpolate(t,e);if(!n)return{};const s=n[e],o=i.segments,a=i.points;let r=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],d=a[h.start][e],u=a[h.end][e];if(mt(s,d,u)){r=s===d,l=s===u;break}}return{first:r,last:l,point:n}}class oo{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,n){const{x:s,y:o,radius:a}=this;return e=e||{start:0,end:H},t.arc(s,o,a,e.end,e.start,!0),!n.bounds}interpolate(t){const{x:e,y:n,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:n+Math.sin(o)*s,angle:o}}}function Gc(i){const{chart:t,fill:e,line:n}=i;if(V(e))return qc(t,e);if(e==="stack")return $c(i);if(e==="shape")return!0;const s=Kc(i);return s instanceof oo?s:no(s,n)}function qc(i,t){const e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function Kc(i){return(i.scale||{}).getPointPositionForValue?Qc(i):Zc(i)}function Zc(i){const{scale:t={},fill:e}=i,n=Nc(e,t);if(V(n)){const s=t.isHorizontal();return{x:s?n:null,y:s?null:n}}return null}function Qc(i){const{scale:t,fill:e}=i,n=t.options,s=t.getLabels().length,o=n.reverse?t.max:t.min,a=Vc(e,t,o),r=[];if(n.grid.circular){const l=t.getPointPositionForValue(0,o);return new oo({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)r.push(t.getPointPositionForValue(l,a));return r}function cn(i,t,e){const n=Gc(t),{line:s,scale:o,axis:a}=t,r=s.options,l=r.fill,c=r.backgroundColor,{above:h=c,below:d=c}=l||{};n&&s.points.length&&(Ye(i,e),Jc(i,{line:s,target:n,above:h,below:d,area:e,scale:o,axis:a}),Xe(i))}function Jc(i,t){const{line:e,target:n,above:s,below:o,area:a,scale:r}=t,l=e._loop?"angle":t.axis;i.save(),l==="x"&&o!==s&&(ao(i,n,a.top),ro(i,{line:e,target:n,color:s,scale:r,property:l}),i.restore(),i.save(),ao(i,n,a.bottom)),ro(i,{line:e,target:n,color:o,scale:r,property:l}),i.restore()}function ao(i,t,e){const{segments:n,points:s}=t;let o=!0,a=!1;i.beginPath();for(const r of n){const{start:l,end:c}=r,h=s[l],d=s[ln(l,c,s)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(h.x,e),i.lineTo(h.x,h.y)),a=!!t.pathSegment(i,r,{move:a}),a?i.closePath():i.lineTo(d.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function ro(i,t){const{line:e,target:n,property:s,color:o,scale:a}=t,r=Ec(e,n,s);for(const{source:l,target:c,start:h,end:d}of r){const{style:{backgroundColor:u=o}={}}=l,f=n!==!0;i.save(),i.fillStyle=u,th(i,a,f&&rn(s,h,d)),i.beginPath();const m=!!e.pathSegment(i,l);let g;if(f){m?i.closePath():lo(i,n,d,s);const p=!!n.pathSegment(i,c,{move:m,reverse:!0});g=m&&p,g||lo(i,n,h,s)}i.closePath(),i.fill(g?"evenodd":"nonzero"),i.restore()}}function th(i,t,e){const{top:n,bottom:s}=t.chart.chartArea,{property:o,start:a,end:r}=e||{};o==="x"&&(i.beginPath(),i.rect(a,n,r-a,s-n),i.clip())}function lo(i,t,e,n){const s=t.interpolate(e,n);s&&i.lineTo(s.x,s.y)}var eh={id:"filler",afterDatasetsUpdate(i,t,e){const n=(i.data.datasets||[]).length,s=[];let o,a,r,l;for(a=0;a<n;++a)o=i.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof ut&&(l={visible:i.isDatasetVisible(a),index:a,fill:Wc(r,a,n),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<n;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=zc(s,a,e.propagate))},beforeDraw(i,t,e){const n=e.drawTime==="beforeDraw",s=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let a=s.length-1;a>=0;--a){const r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),n&&r.fill&&cn(i.ctx,r,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){const o=n[s].$filler;so(o)&&cn(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const n=t.meta.$filler;!so(n)||e.drawTime!=="beforeDatasetDraw"||cn(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const co=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},ih=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class ho extends rt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=B(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const n=t.labels,s=Y(n.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=co(n,o);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,s,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+r;let d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((m,g)=>{const p=n+e/2+o.measureText(m.text).width;(g===0||c[c.length-1]+p+2*r>a)&&(d+=h,c[c.length-(g>0?0:1)]=0,f+=h,u++),l[g]={left:0,top:f,row:u,width:p,height:s},c[c.length-1]+=p+r}),d}_fitCols(t,e,n,s){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t;let d=r,u=0,f=0,m=0,g=0;return this.legendItems.forEach((p,b)=>{const{itemWidth:y,itemHeight:_}=nh(n,e,o,p,s);b>0&&f+_+2*r>h&&(d+=u+r,c.push({width:u,height:f}),m+=u+r,g++,u=f=0),l[b]={left:m,top:f,col:g,width:y,height:_},u=Math.max(u,y),f+=_+r}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:o}}=this,a=Ut(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=q(n,this.left+s,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=q(n,this.left+s,this.right-this.lineWidths[r])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let r=0,l=q(n,this.top+t+s,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=q(n,this.top+t+s,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ye(t,this),this._draw(),Xe(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:o,labels:a}=t,r=j.color,l=Ut(t.rtl,this.left,this.width),c=Y(a.font),{padding:h}=a,d=c.size,u=d/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:g,itemHeight:p}=co(a,d),b=function(w,k,M){if(isNaN(m)||m<=0||isNaN(g)||g<0)return;s.save();const P=T(M.lineWidth,1);if(s.fillStyle=T(M.fillStyle,r),s.lineCap=T(M.lineCap,"butt"),s.lineDashOffset=T(M.lineDashOffset,0),s.lineJoin=T(M.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=T(M.strokeStyle,r),s.setLineDash(T(M.lineDash,[])),a.usePointStyle){const A={radius:g*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:P},D=l.xPlus(w,m/2),L=k+u;Un(s,A,D,L,a.pointStyleWidth&&m)}else{const A=k+Math.max((d-g)/2,0),D=l.leftForLtr(w,m),L=Rt(M.borderRadius);s.beginPath(),Object.values(L).some(z=>z!==0)?le(s,{x:D,y:A,w:m,h:g,radius:L}):s.rect(D,A,m,g),s.fill(),P!==0&&s.stroke()}s.restore()},y=function(w,k,M){Ft(s,M.text,w,k+p/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},_=this.isHorizontal(),S=this._computeTitleHeight();_?f={x:q(o,this.left+h,this.right-n[0]),y:this.top+h+S,line:0}:f={x:this.left+h,y:q(o,this.top+S+h,this.bottom-e[0].height),line:0},ns(this.ctx,t.textDirection);const v=p+h;this.legendItems.forEach((w,k)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const M=s.measureText(w.text).width,P=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),A=m+u+M;let D=f.x,L=f.y;l.setWidth(this.width),_?k>0&&D+A+h>this.right&&(L=f.y+=v,f.line++,D=f.x=q(o,this.left+h,this.right-n[f.line])):k>0&&L+v>this.bottom&&(D=f.x=D+e[f.line].width+h,f.line++,L=f.y=q(o,this.top+S+h,this.bottom-e[f.line].height));const z=l.x(D);if(b(z,L,w),D=Ia(P,D+m+u,_?D+A:this.right,t.rtl),y(l.x(D),L,w),_)f.x+=A+h;else if(typeof w.text!="string"){const Z=c.lineHeight;f.y+=uo(w,Z)+h}else f.y+=v}),ss(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,n=Y(e.font),s=K(e.padding);if(!e.display)return;const o=Ut(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=n.size/2,c=s.top+l;let h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=q(t.align,d,this.right-u);else{const m=this.columnSizes.reduce((g,p)=>Math.max(g,p.height),0);h=c+q(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const f=q(r,d,d+u);a.textAlign=o.textAlign(Bi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=n.string,Ft(a,e.text,f,h,n)}_computeTitleHeight(){const t=this.options.title,e=Y(t.font),n=K(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,o;if(mt(t,this.left,this.right)&&mt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(s=o[n],mt(t,s.left,s.left+s.width)&&mt(e,s.top,s.top+s.height))return this.legendItems[n]}return null}handleEvent(t){const e=this.options;if(!ah(t.type,e))return;const n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=ih(s,n);s&&!o&&B(e.onLeave,[t,s,this],this),this._hoveredItem=n,n&&!o&&B(e.onHover,[t,n,this],this)}else n&&B(e.onClick,[t,n,this],this)}}function nh(i,t,e,n,s){const o=sh(n,i,t,e),a=oh(s,n,t.lineHeight);return{itemWidth:o,itemHeight:a}}function sh(i,t,e,n){let s=i.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+n.measureText(s).width}function oh(i,t,e){let n=i;return typeof t.text!="string"&&(n=uo(t,e)),n}function uo(i,t){const e=i.text?i.text.length:0;return t*e}function ah(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var _e={id:"legend",_element:ho,start(i,t,e){const n=i.legend=new ho({ctx:i.ctx,options:e,chart:i});st.configure(i,n,e),st.addBox(i,n)},stop(i){st.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const n=i.legend;st.configure(i,n,e),n.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=K(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class fo extends rt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=W(n.text)?n.text.length:1;this._padding=K(n.padding);const o=s*Y(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:n,bottom:s,right:o,options:a}=this,r=a.align;let l=0,c,h,d;return this.isHorizontal()?(h=q(r,n,o),d=e+t,c=o-n):(a.position==="left"?(h=n+t,d=q(r,s,e),l=N*-.5):(h=o-t,d=q(r,e,s),l=N*.5),c=s-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const n=Y(e.font),o=n.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);Ft(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:Bi(e.align),textBaseline:"middle",translation:[a,r]})}}function rh(i,t){const e=new fo({ctx:i.ctx,options:t,chart:i});st.configure(i,e,t),st.addBox(i,e),i.titleBlock=e}var ve={id:"title",_element:fo,start(i,t,e){rh(i,e)},stop(i){const t=i.titleBlock;st.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const n=i.titleBlock;st.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Se={average(i){if(!i.length)return!1;let t,e,n=0,s=0,o=0;for(t=0,e=i.length;t<e;++t){const a=i[t].element;if(a&&a.hasValue()){const r=a.tooltipPosition();n+=r.x,s+=r.y,++o}}return{x:n/o,y:s/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,n=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=i.length;o<a;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=Ri(t,c);h<s&&(s=h,r=l)}}if(r){const l=r.tooltipPosition();e=l.x,n=l.y}return{x:e,y:n}}};function ft(i,t){return t&&(W(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function xt(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
|
|
17
17
|
`)>-1?i.split(`
|
|
18
|
-
`):i}function lh(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:i,label:a,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function go(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=Y(t.bodyFont),c=Y(t.titleFont),h=Y(t.footerFont),d=o.length,u=s.length,f=n.length,m=K(t.padding);let p=m.height,g=0,b=n.reduce((S,v)=>S+v.before.length+v.lines.length+v.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const S=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;p+=f*S+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let y=0;const x=function(S){g=Math.max(g,e.measureText(S).width+y)};return e.save(),e.font=c.string,R(i.title,x),e.font=l.string,R(i.beforeBody.concat(i.afterBody),x),y=t.displayColors?a+2+t.boxPadding:0,R(n,S=>{R(S.before,x),R(S.lines,x),R(S.after,x)}),y=0,e.font=h.string,R(i.footer,x),e.restore(),g+=m.width,{width:g,height:p}}function ch(i,t){const{y:e,height:n}=t;return e<n/2?"top":e>i.height-n/2?"bottom":"center"}function hh(i,t,e,n){const{x:s,width:o}=n,a=e.caretSize+e.caretPadding;if(i==="left"&&s+o+a>t.width||i==="right"&&s-o-a<0)return!0}function dh(i,t,e,n){const{x:s,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return n==="center"?c=s<=(r+l)/2?"left":"right":s<=o/2?c="left":s>=a-o/2&&(c="right"),hh(c,i,t,e)&&(c="center"),c}function po(i,t,e){const n=e.yAlign||t.yAlign||ch(i,e);return{xAlign:e.xAlign||t.xAlign||dh(i,t,e,n),yAlign:n}}function uh(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function fh(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function mo(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=s+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Rt(a);let m=uh(t,r);const p=fh(t,l,c);return l==="center"?r==="left"?m+=c:r==="right"&&(m-=c):r==="left"?m-=Math.max(h,u)+s:r==="right"&&(m+=Math.max(d,f)+s),{x:G(m,0,n.width-t.width),y:G(p,0,n.height-t.height)}}function di(i,t,e){const n=K(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function bo(i){return ft([],xt(i))}function gh(i,t,e){return Ct(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function yo(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const xo={beforeTitle:pt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return e[t.dataIndex]}return""},afterTitle:pt,beforeBody:pt,beforeLabel:pt,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return F(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:pt,afterBody:pt,beforeFooter:pt,footer:pt,afterFooter:pt};function J(i,t,e,n){const s=i[t].call(e,n);return typeof s>"u"?xo[t].call(e,n):s}class hn extends rt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new us(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=gh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=J(n,"beforeTitle",this,t),o=J(n,"title",this,t),a=J(n,"afterTitle",this,t);let r=[];return r=ft(r,xt(s)),r=ft(r,xt(o)),r=ft(r,xt(a)),r}getBeforeBody(t,e){return bo(J(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:n}=e,s=[];return R(t,o=>{const a={before:[],lines:[],after:[]},r=yo(n,o);ft(a.before,xt(J(r,"beforeLabel",this,o))),ft(a.lines,J(r,"label",this,o)),ft(a.after,xt(J(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return bo(J(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:n}=e,s=J(n,"beforeFooter",this,t),o=J(n,"footer",this,t),a=J(n,"afterFooter",this,t);let r=[];return r=ft(r,xt(s)),r=ft(r,xt(o)),r=ft(r,xt(a)),r}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(lh(this.chart,e[l]));return t.filter&&(r=r.filter((h,d,u)=>t.filter(h,d,u,n))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,n))),R(r,h=>{const d=yo(t.callbacks,h);s.push(J(d,"labelColor",this,h)),o.push(J(d,"labelPointStyle",this,h)),a.push(J(d,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const r=Se[n.position].call(this,s,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);const l=this._size=go(this,n),c=Object.assign({},r,l),h=po(this.chart,n,c),d=mo(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Rt(r),{x:u,y:f}=t,{width:m,height:p}=e;let g,b,y,x,S,v;return o==="center"?(S=f+p/2,s==="left"?(g=u,b=g-a,x=S+a,v=S-a):(g=u+m,b=g+a,x=S-a,v=S+a),y=g):(s==="left"?b=u+Math.max(l,h)+a:s==="right"?b=u+m-Math.max(c,d)-a:b=this.caretX,o==="top"?(x=f,S=x-a,g=b-a,y=b+a):(x=f+p,S=x+a,g=b+a,y=b-a),v=x),{x1:g,x2:b,x3:y,y1:x,y2:S,y3:v}}drawTitle(t,e,n){const s=this.title,o=s.length;let a,r,l;if(o){const c=Ut(n.rtl,this.x,this.width);for(t.x=di(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",a=Y(n.titleFont),r=n.titleSpacing,e.fillStyle=n.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=n.titleMarginBottom-r)}}_drawColorBox(t,e,n,s,o){const a=this.labelColors[n],r=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,h=Y(o.bodyFont),d=di(this,"left",o),u=s.x(d),f=l<h.lineHeight?(h.lineHeight-l)/2:0,m=e.y+f;if(o.usePointStyle){const p={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},g=s.leftForLtr(u,c)+c/2,b=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Vi(t,p,g,b),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Vi(t,p,g,b)}else{t.lineWidth=O(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const p=s.leftForLtr(u,c),g=s.leftForLtr(s.xPlus(u,1),c-2),b=Rt(a.borderRadius);Object.values(b).some(y=>y!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,le(t,{x:p,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),le(t,{x:g,y:m+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,m,c,l),t.strokeRect(p,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(g,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=n,d=Y(n.bodyFont);let u=d.lineHeight,f=0;const m=Ut(n.rtl,this.x,this.width),p=function(M){e.fillText(M,m.x(t.x+f),t.y+u/2),t.y+=u+o},g=m.textAlign(a);let b,y,x,S,v,w,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=di(this,g,n),e.fillStyle=n.bodyColor,R(this.beforeBody,p),f=r&&g!=="right"?a==="center"?c/2+h:c+2+h:0,S=0,w=s.length;S<w;++S){for(b=s[S],y=this.labelTextColors[S],e.fillStyle=y,R(b.before,p),x=b.lines,r&&x.length&&(this._drawColorBox(e,t,S,m,n),u=Math.max(d.lineHeight,l)),v=0,k=x.length;v<k;++v)p(x[v]),u=d.lineHeight;R(b.after,p)}f=0,u=d.lineHeight,R(this.afterBody,p),t.y-=o}drawFooter(t,e,n){const s=this.footer,o=s.length;let a,r;if(o){const l=Ut(n.rtl,this.x,this.width);for(t.x=di(this,n.footerAlign,n),t.y+=n.footerMarginTop,e.textAlign=l.textAlign(n.footerAlign),e.textBaseline="middle",a=Y(n.footerFont),e.fillStyle=n.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+n.footerSpacing}}drawBackground(t,e,n,s){const{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:h}=n,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:m}=Rt(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(r+d,l),a==="top"&&this.drawCaret(t,e,n,s),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,n,s),e.lineTo(r+c,l+h-m),e.quadraticCurveTo(r+c,l+h,r+c-m,l+h),a==="bottom"&&this.drawCaret(t,e,n,s),e.lineTo(r+f,l+h),e.quadraticCurveTo(r,l+h,r,l+h-f),a==="center"&&o==="left"&&this.drawCaret(t,e,n,s),e.lineTo(r,l+d),e.quadraticCurveTo(r,l,r+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const a=Se[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=go(this,t),l=Object.assign({},a,this._size),c=po(e,t,l),h=mo(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const a=K(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),ns(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),ss(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!We(n,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,n),r=this._positionChanged(a,t),l=e||!We(a,o)||r;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e;const a=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,a=Se[o.position].call(this,t,e);return a!==!1&&(n!==a.x||s!==a.y)}}C(hn,"positioners",Se);var ke={id:"tooltip",_element:hn,positioners:Se,afterInit(i,t,e){e&&(i.tooltip=new hn({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:xo},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const ph=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function mh(i,t,e,n){const s=i.indexOf(t);if(s===-1)return ph(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const bh=(i,t)=>i===null?null:G(Math.round(i),0,t);function _o(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class we extends Ht{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const n=this.getLabels();for(const{index:s,label:o}of e)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(F(t))return null;const n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:mh(n,t,T(e,t),this._addedLabels),bh(e,n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){const t=this.min,e=this.max,n=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return _o.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}C(we,"id","category"),C(we,"defaults",{ticks:{callback:_o}});function yh(i,t){const e=[],{bounds:s,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=i,f=o||1,m=h-1,{min:p,max:g}=t,b=!F(a),y=!F(r),x=!F(c),S=(g-p)/(d+1);let v=Ln((g-p)/m/f)*f,w,k,M,P;if(v<1e-14&&!b&&!y)return[{value:p},{value:g}];P=Math.ceil(g/v)-Math.floor(p/v),P>m&&(v=Ln(P*v/m/f)*f),F(l)||(w=Math.pow(10,l),v=Math.ceil(v*w)/w),s==="ticks"?(k=Math.floor(p/v)*v,M=Math.ceil(g/v)*v):(k=p,M=g),b&&y&&o&&Ma((r-a)/o,v/1e3)?(P=Math.round(Math.min((r-a)/v,h)),v=(r-a)/P,k=a,M=r):x?(k=b?a:k,M=y?r:M,P=c-1,v=(M-k)/P):(P=(M-k)/v,ne(P,Math.round(P),v/1e3)?P=Math.round(P):P=Math.ceil(P));const A=Math.max(On(v),On(k));w=Math.pow(10,F(l)?A:l),k=Math.round(k*w)/w,M=Math.round(M*w)/w;let D=0;for(b&&(u&&k!==a?(e.push({value:a}),k<a&&D++,ne(Math.round((k+D*v)*w)/w,a,vo(a,S,i))&&D++):k<a&&D++);D<P;++D){const L=Math.round((k+D*v)*w)/w;if(y&&L>r)break;e.push({value:L})}return y&&u&&M!==r?e.length&&ne(e[e.length-1].value,r,vo(r,S,i))?e[e.length-1].value=r:e.push({value:r}):(!y||M===r)&&e.push({value:M}),e}function vo(i,t,{horizontal:e,minRotation:n}){const s=ht(n),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}class ui extends Ht{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return F(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:s,max:o}=this;const a=l=>s=e?s:l,r=l=>o=n?o:l;if(t){const l=ct(s),c=ct(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=yh(s,o);return t.bounds==="ticks"&&Tn(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return je(t,this.chart.options.locale,this.options.ticks.format)}}class Ce extends ui{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=ht(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}C(Ce,"id","linear"),C(Ce,"defaults",{ticks:{callback:$e.formatters.numeric}});const Me=i=>Math.floor(wt(i)),Nt=(i,t)=>Math.pow(10,Me(i)+t);function So(i){return i/Math.pow(10,Me(i))===1}function ko(i,t,e){const n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function xh(i,t){const e=t-i;let n=Me(e);for(;ko(i,t,n)>10;)n++;for(;ko(i,t,n)<10;)n--;return Math.min(n,Me(i))}function _h(i,{min:t,max:e}){t=et(i.min,t);const n=[],s=Me(t);let o=xh(t,e),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10;let d=Math.floor((c-h)/Math.pow(10,o)),u=et(i.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<e;)n.push({value:u,major:So(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+h+d*Math.pow(10,o))*a)/a;const f=et(i.max,u);return n.push({value:f,major:So(f),significand:d}),n}class wo extends Ht{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const n=ui.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return V(n)&&n>0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?Math.max(0,t):null,this.max=V(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!V(this._userMin)&&(this.min=t===Nt(this.min,0)?Nt(this.min,-1):Nt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=r=>n=t?n:r,a=r=>s=e?s:r;n===s&&(n<=0?(o(1),a(10)):(o(Nt(n,-1)),a(Nt(s,1)))),n<=0&&o(Nt(s,-1)),s<=0&&a(Nt(n,1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=_h(e,this);return t.bounds==="ticks"&&Tn(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":je(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=wt(t),this._valueRange=wt(this.max)-wt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(wt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}C(wo,"id","logarithmic"),C(wo,"defaults",{ticks:{callback:$e.formatters.logarithmic,major:{enabled:!0}}});function dn(i){const t=i.ticks;if(t.display&&i.display){const e=K(t.backdropPadding);return T(t.font&&t.font.size,j.font.size)+e.height}return 0}function vh(i,t,e){return e=W(e)?e:[e],{w:Ua(i,t.string,e),h:e.length*t.lineHeight}}function Co(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:i<n||i>s?{start:t-e,end:t}:{start:t,end:t+e}}function Sh(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?N/o:0;for(let l=0;l<o;l++){const c=a.setContext(i.getPointLabelContext(l));s[l]=c.padding;const h=i.getPointPosition(l,i.drawingArea+s[l],r),d=Y(c.font),u=vh(i.ctx,d,i._pointLabels[l]);n[l]=u;const f=it(i.getIndexAngle(l)+r),m=Math.round(Fi(f)),p=Co(m,h.x,u.w,0,180),g=Co(m,h.y,u.h,90,270);kh(e,t,f,p,g)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=Mh(i,n,s)}function kh(i,t,e,n,s){const o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e));let r=0,l=0;n.start<t.l?(r=(t.l-n.start)/o,i.l=Math.min(i.l,t.l-r)):n.end>t.r&&(r=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,i.t=Math.min(i.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,i.b=Math.max(i.b,t.b+l))}function wh(i,t,e){const n=i.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=e,l=i.getPointPosition(t,n+s+a,o),c=Math.round(Fi(it(l.angle+$))),h=Dh(l.y,r.h,c),d=Ph(c),u=Ah(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function Ch(i,t){if(!t)return!0;const{left:e,top:n,right:s,bottom:o}=i;return!(bt({x:e,y:n},t)||bt({x:e,y:o},t)||bt({x:s,y:n},t)||bt({x:s,y:o},t))}function Mh(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:dn(o)/2,additionalAngle:a?N/s:0};let c;for(let h=0;h<s;h++){l.padding=e[h],l.size=t[h];const d=wh(i,h,l);n.push(d),r==="auto"&&(d.visible=Ch(d,c),d.visible&&(c=d))}return n}function Ph(i){return i===0||i===180?"center":i<180?"left":"right"}function Ah(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function Dh(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function Lh(i,t,e){const{left:n,top:s,right:o,bottom:a}=e,{backdropColor:r}=t;if(!F(r)){const l=Rt(t.borderRadius),c=K(t.backdropPadding);i.fillStyle=r;const h=n-c.left,d=s-c.top,u=o-n+c.width,f=a-s+c.height;Object.values(l).some(m=>m!==0)?(i.beginPath(),le(i,{x:h,y:d,w:u,h:f,radius:l}),i.fill()):i.fillRect(h,d,u,f)}}function Th(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=i._pointLabelItems[s];if(!o.visible)continue;const a=n.setContext(i.getPointLabelContext(s));Lh(e,a,o);const r=Y(a.font),{x:l,y:c,textAlign:h}=o;Ft(e,i._pointLabels[s],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function Mo(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,H);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<n;a++)o=i.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function Oh(i,t,e,n,s){const o=i.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!n||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash),o.lineDashOffset=s.dashOffset,o.beginPath(),Mo(i,e,a,n),o.closePath(),o.stroke(),o.restore())}function Ih(i,t,e){return Ct(i,{label:e,index:t,type:"pointLabel"})}class Pe extends ui{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=K(dn(this.options)/2),e=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(e,n)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=V(t)&&!isNaN(t)?t:0,this.max=V(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/dn(this.options))}generateTickLabels(t){ui.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,n)=>{const s=B(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?Sh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=H/(this._pointLabels.length||1),n=this.options.startAngle||0;return it(t*e+ht(n))}getDistanceFromCenterForValue(t){if(F(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(F(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const n=e[t];return Ih(this.getContext(),t,n)}}getPointPosition(t,e,n=0){const s=this.getIndexAngle(t)-$+n;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:n,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:n,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const n=this.ctx;n.save(),n.beginPath(),Mo(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),n.closePath(),n.fillStyle=t,n.fill(),n.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:n,grid:s,border:o}=e,a=this._pointLabels.length;let r,l,c;if(e.pointLabels.display&&Th(this,a),s.display&&this.ticks.forEach((h,d)=>{if(d!==0){l=this.getDistanceFromCenterForValue(h.value);const u=this.getContext(d),f=s.setContext(u),m=o.setContext(u);Oh(this,f,l,a,m)}}),n.display){for(t.save(),r=a-1;r>=0;r--){const h=n.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=Y(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;const d=K(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}Ft(t,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}C(Pe,"id","radialLinear"),C(Pe,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:$e.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),C(Pe,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),C(Pe,"descriptors",{angleLines:{_fallback:"grid"}});const fi={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}},tt=Object.keys(fi);function Po(i,t){return i-t}function Ao(i,t){if(F(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let a=t;return typeof n=="function"&&(a=n(a)),V(a)||(a=typeof n=="string"?e.parse(a,n):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(se(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function Do(i,t,e,n){const s=tt.length;for(let o=tt.indexOf(i);o<s-1;++o){const a=fi[tt[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=n)return tt[o]}return tt[s-1]}function Fh(i,t,e,n,s){for(let o=tt.length-1;o>=tt.indexOf(e);o--){const a=tt[o];if(fi[a].common&&i._adapter.diff(s,n,a)>=t-1)return a}return tt[e?tt.indexOf(e):0]}function Rh(i){for(let t=tt.indexOf(i)+1,e=tt.length;t<e;++t)if(fi[tt[t]].common)return tt[t]}function Lo(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:n,hi:s}=Ei(e,t),o=e[n]>=t?e[n]:e[s];i[o]=!0}}function Eh(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+s.add(r,1,n))l=e[r],l>=0&&(t[l].major=!0);return t}function To(i,t,e){const n=[],s={},o=t.length;let a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,n.push({value:r,major:!1});return o===0||!e?n:Eh(i,n,s,e)}class gi extends Ht{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const n=t.time||(t.time={}),s=this._adapter=new rl._date(t.adapters.date);s.init(e),ee(n.displayFormats,s.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Ao(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,n=t.time.unit||"day";let{min:s,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=V(s)&&!isNaN(s)?s:+e.startOf(Date.now(),n),o=V(o)&&!isNaN(o)?o:+e.endOf(Date.now(),n)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){const t=this.options,e=t.time,n=t.ticks,s=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,a=this.max,r=La(s,o,a);return this._unit=e.unit||(n.autoSkip?Do(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Fh(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:Rh(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),To(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=G(e,0,a),n=G(n,0,a),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,a=o.unit||Do(o.minUnit,e,n,this._getLabelCapacity(e)),r=T(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=se(l)||l===!0,h={};let d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(n,e,a)>1e5*r)throw new Error(e+" and "+n+" are too far apart with stepSize of "+r+" "+a);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<n;u=+t.add(u,r,a),f++)Lo(h,u,m);return(u===n||s.bounds==="ticks"||f===1)&&Lo(h,u,m),Object.keys(h).sort(Po).map(p=>+p)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,a=e||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,n,s){const o=this.options,a=o.ticks.callback;if(a)return B(a,[t,e,n],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=n[e],f=c&&d&&u&&u.major;return this._adapter.format(t,s||(f?d:h))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e<n;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+n)*e.factor)}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,n=this.ctx.measureText(t).width,s=ht(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:n*o+r*a,h:n*a+r*o}}_getLabelCapacity(t){const e=this.options.time,n=e.displayFormats,s=n[e.unit]||n.millisecond,o=this._tickFormatFunction(t,0,To(this,[t],this._majorUnit),s),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e<n;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,n;if(t.length)return t;const s=this.getLabels();for(e=0,n=s.length;e<n;++e)t.push(Ao(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return En(t.sort(Po))}}C(gi,"id","time"),C(gi,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function pi(i,t,e){let n=0,s=i.length-1,o,a,r,l;e?(t>=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=Tt(i,"pos",t)),{pos:o,time:r}=i[n],{pos:a,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=Tt(i,"time",t)),{time:o,pos:r}=i[n],{time:a,pos:l}=i[s]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class Oo extends gi{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=pi(e,this.min),this._tableRange=pi(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(a=0,r=s.length;a<r;++a)h=s[a+1],l=s[a-1],c=s[a],Math.round((h+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){const t=this.min,e=this.max;let n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(e)||n.length===1)&&n.push(e),n.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(pi(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return pi(this._table,n*this._tableRange+this._minPos,!0)}}C(Oo,"id","timeseries"),C(Oo,"defaults",gi.defaults);const Io={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},Bh={type:{type:String,required:!0},...Io},zh=_.version[0]==="2"?(i,t)=>Object.assign(i,{attrs:t}):(i,t)=>Object.assign(i,t);function Gt(i){return _.isProxy(i)?_.toRaw(i):i}function Wh(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i;return _.isProxy(t)?new Proxy(i,{}):i}function Hh(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function Fo(i,t){i.labels=t}function Ro(i,t,e){const n=[];i.datasets=t.map(s=>{const o=i.datasets.find(a=>a[e]===s[e]);return!o||!s.data||n.includes(o)?{...s}:(n.push(o),Object.assign(o,s),o)})}function Nh(i,t){const e={labels:[],datasets:[]};return Fo(e,i.labels),Ro(e,i.datasets,t),e}const Vh=_.defineComponent({props:Bh,setup(i,t){let{expose:e}=t;const n=_.ref(null),s=_.shallowRef(null);e({chart:s});const o=()=>{if(!n.value)return;const{type:l,data:c,options:h,plugins:d,datasetIdKey:u}=i,f=Nh(c,u),m=Wh(f,c);s.value=new Pt(n.value,{type:l,data:m,options:{...h},plugins:d})},a=()=>{const l=_.toRaw(s.value);l&&(l.destroy(),s.value=null)},r=l=>{l.update(i.updateMode)};return _.onMounted(o),_.onBeforeUnmount(a),_.watch([()=>i.options,()=>i.data],(l,c)=>{let[h,d]=l,[u,f]=c;const m=_.toRaw(s.value);if(!m)return;let p=!1;if(h){const g=Gt(h),b=Gt(u);g&&g!==b&&(Hh(m,g),p=!0)}if(d){const g=Gt(d.labels),b=Gt(f.labels),y=Gt(d.datasets),x=Gt(f.datasets);g!==b&&(Fo(m.config.data,g),p=!0),y&&y!==x&&(Ro(m.config.data,y,i.datasetIdKey),p=!0)}p&&r(m)},{deep:!0}),()=>_.h("canvas",{ref:n})}});function mi(i,t){return Pt.register(t),_.defineComponent({props:Io,setup(e,n){let{expose:s}=n;const o=_.shallowRef(null),a=r=>{o.value=r==null?void 0:r.chart};return s({chart:o}),()=>_.h(Vh,zh({ref:a},{type:i,...e}))}})}const Eo=mi("bar",Je),jh=mi("doughnut",he),$h=mi("line",ti),Uh=mi("radar",ei);function bi(){function i(e,n=50,s=50){const o=document.createElement("canvas"),a=o.getContext("2d");return a&&(o.width=n,o.height=s,a.fillStyle=e,a.fillRect(0,0,n,s)),o}function t(e,n){return n?(e+n)%6:e}return{getPatternCanvas:i,getPatternIndexWithShift:t}}function un(i,t){const e=parseInt(i.toFixed());return`${new Intl.NumberFormat().format(e)}${t?" "+t:""}`}function ot(i){return Math.abs(Number(i))>=1e6?new Intl.NumberFormat().format(parseFloat((Number(i)/1e6).toFixed(2)))+" M":Math.abs(Number(i))>=1e3?new Intl.NumberFormat().format(parseFloat((Number(i)/1e3).toFixed(2)))+" K":new Intl.NumberFormat().format(parseFloat(Number(i).toFixed(2)))}function Yh(i,t){return t?(i+t)%6:i}function Xh(i,t){return`${ot(i.data[t].value)} (${ot(i.data[t].rate)}%)`}const Gh="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTExLjc0IDEyLjAzaC4wMi0uMDJ6TTEyIDdhMyAzIDAgMDAtMyAzIC43NS43NSAwIDAwMS41IDBBMS41IDEuNSAwIDAxMTIgOC41MWExLjUgMS41IDAgMDEuNjYgMi44NSAyLjQxIDIuNDEgMCAwMC0xLjQxIDIuMTZ2LjI1YS43NS43NSAwIDAwMS41IDB2LS4yNWEuOTEuOTEgMCAwMS41Ny0uODFBMyAzIDAgMDAxMiA3eiIvPjxjaXJjbGUgY3g9IjEyIiBjeT0iMTYuMjQiIHI9Ii43NSIvPjxwYXRoIGQ9Ik0xMiAyYTEwIDEwIDAgMTAxMCAxMEExMCAxMCAwIDAwMTIgMnptMCAxOGE4IDggMCAxMTgtOCA4IDggMCAwMS04IDh6Ii8+PC9zdmc+",{getPatternCanvas:qh}=bi(),Kh=14,Bo="6px",yi="22px",zo=6,fn="2px";function Wo(i,t,e,n,s,o,a,r){return[{id:"htmlLegend",afterUpdate(l){const h=l.config.type==="doughnut"?"column":"row",d=Si(i,h);for(d.style.margin="1.375rem 1.0625rem";d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).forEach(f=>{const m=l.config.type==="doughnut",p=m?f.index:f.datasetIndex,g=_i(l,t,p);if(m){const y=p+1===a;g.style.marginTop="12px",y&&(g.style.position="relative")}else g.style.marginRight="10px";g.style.width="max-content",g.style.cursor="pointer";let b;t.value?b=No(l,f,t,e,n.value):b=Ho(f,l,e,n.value,s.value,o.value),b.style.boxSizing="border-box",g.appendChild(b),g.appendChild(xi(f)),m&&a&&Zh(r,a,p)&&g.appendChild(Qh(r,a)),d.appendChild(g)})}}]}function Zh(i,t,e){return i.data.length>t&&e===t-1}function Qh(i,t){const e=document.createElement("div"),n=document.createElement("div"),s=document.createElement("img");e.style.position="absolute",e.style.right="-32px",s.src=Gh,s.style.top="0",s.style.width="1.5rem",s.style.filter="invert(38%) sepia(19%) saturate(18%) hue-rotate(337deg) brightness(97%) contrast(85%)",n.style.position="relative",n.style.display="flex";const o=Jh(i,t);return s.onmouseover=()=>{n.firstElementChild.style.visibility="visible"},e.appendChild(n),n.appendChild(o),n.appendChild(s),e}function Jh(i,t){const e=document.createElement("div");return e.style.visibility="hidden",e.style.position="absolute",e.style.zIndex="10",e.style.width="350px",e.style.bottom="100%",e.style.left="50%",e.style.marginLeft="-150px",e.style.background="#FFFFFF",e.style.boxShadow="0px 1px 5px rgba(0, 0, 0, 0.2)",e.style.borderRadius="0.5rem",e.style.fontSize="14px",e.style.overflow="hidden",td(i,t,e),e}function td(i,t,e){const n=t-1;i.data.slice(n).forEach((s,o)=>{const a=n+o,r=document.createElement("div");r.style.display="flex",r.style.justifyContent="space-between",r.style.padding="0.5rem",r.style.border="1px solid #CCCCCC";const l=document.createElement("span");l.appendChild(document.createTextNode(i.labels[a]));const c=document.createElement("span");c.appendChild(document.createTextNode(Xh(i,a))),r.appendChild(l),r.appendChild(c),e.appendChild(r)})}function Ho(i,t,e,n,s,o){const a=t.config.type==="doughnut",r=a?i.index:i.datasetIndex,l=new Image,c=Vo(i,t.config.type),h=o[r](!1,s[r],n),d=qh(h);return l.src=d.toDataURL(),c.style.background=`url(${l.src})`,c.style.backgroundSize="cover",c.style.borderColor=s[r],c.style.borderWidth=fn,c.onmouseover=()=>{a?e.value=r:e.dataSetIndex=r,t.update()},c.onmouseleave=()=>{a?e.value=null:e.dataSetIndex=-1,t.update()},c}function No(i,t,e,n,s){const o=i.config.type==="doughnut",a=o?t.index:t.datasetIndex,r=gn(i,t,s);return i.config.data.labels.every((h,d)=>i.getDataVisibility(d))?(o&&(e.value=!1,n.value=-1),r):(r.onmouseover=()=>{o?n.value=a:n.dataSetIndex=a,i.update()},r.onmouseleave=()=>{o?n.value=null:n.dataSetIndex=-1,i.update()},r)}function xi(i){const t=document.createElement("p");t.style.color=i.fontColor,t.style.fontSize=`${Kh}px`,t.style.margin="0",t.style.padding="0";const e=document.createTextNode(i.text);return t.appendChild(e),t}function Vo(i,t){const e=document.createElement("div");return t!=="doughnut"&&(e.style.background="rgba(0, 0, 0, 0.1)",e.style.borderColor=i.strokeStyle,e.style.borderWidth=fn),e.style.borderRadius="5px",e.style.borderStyle="solid",e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.width=yi,e.style.marginRight=Bo,e.style.height=yi,e}function ed(i){const t=document.createElement("div");return t.style.height=zo+"px",t.style.width=zo+"px",t.style.background="white",t.style.borderStyle="solid",t.style.borderColor=i.strokeStyle,t.style.borderWidth=fn,t}function _i(i,t,e){const n=document.createElement("li");return n.style.alignItems="center",n.style.cursor=t.value?"":"pointer",n.style.display="flex",n.style.flexDirection="row",n.setAttribute("data-test-id",`legend-item-${e}`),n.onclick=()=>{t.value?vi(i,e,t):(Uo(i,e,t),i.update())},n}function id(i,t,e,n){let s="#fff",o="#666";i&&(s=n?t.fillStyle:t.strokeStyle,o=t.strokeStyle),e.setAttribute("checked",""+i),e.setAttribute("class","mc-checkbox__input"),e.setAttribute("style",`background-color: ${s};
|
|
18
|
+
`):i}function lh(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:i,label:a,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function go(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=Y(t.bodyFont),c=Y(t.titleFont),h=Y(t.footerFont),d=o.length,u=s.length,f=n.length,m=K(t.padding);let g=m.height,p=0,b=n.reduce((S,v)=>S+v.before.length+v.lines.length+v.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const S=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=f*S+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(g+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let y=0;const _=function(S){p=Math.max(p,e.measureText(S).width+y)};return e.save(),e.font=c.string,R(i.title,_),e.font=l.string,R(i.beforeBody.concat(i.afterBody),_),y=t.displayColors?a+2+t.boxPadding:0,R(n,S=>{R(S.before,_),R(S.lines,_),R(S.after,_)}),y=0,e.font=h.string,R(i.footer,_),e.restore(),p+=m.width,{width:p,height:g}}function ch(i,t){const{y:e,height:n}=t;return e<n/2?"top":e>i.height-n/2?"bottom":"center"}function hh(i,t,e,n){const{x:s,width:o}=n,a=e.caretSize+e.caretPadding;if(i==="left"&&s+o+a>t.width||i==="right"&&s-o-a<0)return!0}function dh(i,t,e,n){const{x:s,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return n==="center"?c=s<=(r+l)/2?"left":"right":s<=o/2?c="left":s>=a-o/2&&(c="right"),hh(c,i,t,e)&&(c="center"),c}function po(i,t,e){const n=e.yAlign||t.yAlign||ch(i,e);return{xAlign:e.xAlign||t.xAlign||dh(i,t,e,n),yAlign:n}}function uh(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function fh(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function mo(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=s+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Rt(a);let m=uh(t,r);const g=fh(t,l,c);return l==="center"?r==="left"?m+=c:r==="right"&&(m-=c):r==="left"?m-=Math.max(h,u)+s:r==="right"&&(m+=Math.max(d,f)+s),{x:G(m,0,n.width-t.width),y:G(g,0,n.height-t.height)}}function di(i,t,e){const n=K(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function bo(i){return ft([],xt(i))}function gh(i,t,e){return Ct(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function yo(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const xo={beforeTitle:pt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return e[t.dataIndex]}return""},afterTitle:pt,beforeBody:pt,beforeLabel:pt,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return F(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:pt,afterBody:pt,beforeFooter:pt,footer:pt,afterFooter:pt};function J(i,t,e,n){const s=i[t].call(e,n);return typeof s>"u"?xo[t].call(e,n):s}class hn extends rt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new us(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=gh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=J(n,"beforeTitle",this,t),o=J(n,"title",this,t),a=J(n,"afterTitle",this,t);let r=[];return r=ft(r,xt(s)),r=ft(r,xt(o)),r=ft(r,xt(a)),r}getBeforeBody(t,e){return bo(J(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:n}=e,s=[];return R(t,o=>{const a={before:[],lines:[],after:[]},r=yo(n,o);ft(a.before,xt(J(r,"beforeLabel",this,o))),ft(a.lines,J(r,"label",this,o)),ft(a.after,xt(J(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return bo(J(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:n}=e,s=J(n,"beforeFooter",this,t),o=J(n,"footer",this,t),a=J(n,"afterFooter",this,t);let r=[];return r=ft(r,xt(s)),r=ft(r,xt(o)),r=ft(r,xt(a)),r}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(lh(this.chart,e[l]));return t.filter&&(r=r.filter((h,d,u)=>t.filter(h,d,u,n))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,n))),R(r,h=>{const d=yo(t.callbacks,h);s.push(J(d,"labelColor",this,h)),o.push(J(d,"labelPointStyle",this,h)),a.push(J(d,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const r=Se[n.position].call(this,s,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);const l=this._size=go(this,n),c=Object.assign({},r,l),h=po(this.chart,n,c),d=mo(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Rt(r),{x:u,y:f}=t,{width:m,height:g}=e;let p,b,y,_,S,v;return o==="center"?(S=f+g/2,s==="left"?(p=u,b=p-a,_=S+a,v=S-a):(p=u+m,b=p+a,_=S-a,v=S+a),y=p):(s==="left"?b=u+Math.max(l,h)+a:s==="right"?b=u+m-Math.max(c,d)-a:b=this.caretX,o==="top"?(_=f,S=_-a,p=b-a,y=b+a):(_=f+g,S=_+a,p=b+a,y=b-a),v=_),{x1:p,x2:b,x3:y,y1:_,y2:S,y3:v}}drawTitle(t,e,n){const s=this.title,o=s.length;let a,r,l;if(o){const c=Ut(n.rtl,this.x,this.width);for(t.x=di(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",a=Y(n.titleFont),r=n.titleSpacing,e.fillStyle=n.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=n.titleMarginBottom-r)}}_drawColorBox(t,e,n,s,o){const a=this.labelColors[n],r=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,h=Y(o.bodyFont),d=di(this,"left",o),u=s.x(d),f=l<h.lineHeight?(h.lineHeight-l)/2:0,m=e.y+f;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},p=s.leftForLtr(u,c)+c/2,b=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Vi(t,g,p,b),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Vi(t,g,p,b)}else{t.lineWidth=O(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const g=s.leftForLtr(u,c),p=s.leftForLtr(s.xPlus(u,1),c-2),b=Rt(a.borderRadius);Object.values(b).some(y=>y!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,le(t,{x:g,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),le(t,{x:p,y:m+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,m,c,l),t.strokeRect(g,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(p,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=n,d=Y(n.bodyFont);let u=d.lineHeight,f=0;const m=Ut(n.rtl,this.x,this.width),g=function(M){e.fillText(M,m.x(t.x+f),t.y+u/2),t.y+=u+o},p=m.textAlign(a);let b,y,_,S,v,w,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=di(this,p,n),e.fillStyle=n.bodyColor,R(this.beforeBody,g),f=r&&p!=="right"?a==="center"?c/2+h:c+2+h:0,S=0,w=s.length;S<w;++S){for(b=s[S],y=this.labelTextColors[S],e.fillStyle=y,R(b.before,g),_=b.lines,r&&_.length&&(this._drawColorBox(e,t,S,m,n),u=Math.max(d.lineHeight,l)),v=0,k=_.length;v<k;++v)g(_[v]),u=d.lineHeight;R(b.after,g)}f=0,u=d.lineHeight,R(this.afterBody,g),t.y-=o}drawFooter(t,e,n){const s=this.footer,o=s.length;let a,r;if(o){const l=Ut(n.rtl,this.x,this.width);for(t.x=di(this,n.footerAlign,n),t.y+=n.footerMarginTop,e.textAlign=l.textAlign(n.footerAlign),e.textBaseline="middle",a=Y(n.footerFont),e.fillStyle=n.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+n.footerSpacing}}drawBackground(t,e,n,s){const{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:h}=n,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:m}=Rt(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(r+d,l),a==="top"&&this.drawCaret(t,e,n,s),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,n,s),e.lineTo(r+c,l+h-m),e.quadraticCurveTo(r+c,l+h,r+c-m,l+h),a==="bottom"&&this.drawCaret(t,e,n,s),e.lineTo(r+f,l+h),e.quadraticCurveTo(r,l+h,r,l+h-f),a==="center"&&o==="left"&&this.drawCaret(t,e,n,s),e.lineTo(r,l+d),e.quadraticCurveTo(r,l,r+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const a=Se[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=go(this,t),l=Object.assign({},a,this._size),c=po(e,t,l),h=mo(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const a=K(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),ns(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),ss(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!We(n,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,n),r=this._positionChanged(a,t),l=e||!We(a,o)||r;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e;const a=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,a=Se[o.position].call(this,t,e);return a!==!1&&(n!==a.x||s!==a.y)}}C(hn,"positioners",Se);var ke={id:"tooltip",_element:hn,positioners:Se,afterInit(i,t,e){e&&(i.tooltip=new hn({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:xo},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const ph=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function mh(i,t,e,n){const s=i.indexOf(t);if(s===-1)return ph(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const bh=(i,t)=>i===null?null:G(Math.round(i),0,t);function _o(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class we extends Ht{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const n=this.getLabels();for(const{index:s,label:o}of e)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(F(t))return null;const n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:mh(n,t,T(e,t),this._addedLabels),bh(e,n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){const t=this.min,e=this.max,n=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return _o.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}C(we,"id","category"),C(we,"defaults",{ticks:{callback:_o}});function yh(i,t){const e=[],{bounds:s,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=i,f=o||1,m=h-1,{min:g,max:p}=t,b=!F(a),y=!F(r),_=!F(c),S=(p-g)/(d+1);let v=Ln((p-g)/m/f)*f,w,k,M,P;if(v<1e-14&&!b&&!y)return[{value:g},{value:p}];P=Math.ceil(p/v)-Math.floor(g/v),P>m&&(v=Ln(P*v/m/f)*f),F(l)||(w=Math.pow(10,l),v=Math.ceil(v*w)/w),s==="ticks"?(k=Math.floor(g/v)*v,M=Math.ceil(p/v)*v):(k=g,M=p),b&&y&&o&&Ma((r-a)/o,v/1e3)?(P=Math.round(Math.min((r-a)/v,h)),v=(r-a)/P,k=a,M=r):_?(k=b?a:k,M=y?r:M,P=c-1,v=(M-k)/P):(P=(M-k)/v,ne(P,Math.round(P),v/1e3)?P=Math.round(P):P=Math.ceil(P));const A=Math.max(On(v),On(k));w=Math.pow(10,F(l)?A:l),k=Math.round(k*w)/w,M=Math.round(M*w)/w;let D=0;for(b&&(u&&k!==a?(e.push({value:a}),k<a&&D++,ne(Math.round((k+D*v)*w)/w,a,vo(a,S,i))&&D++):k<a&&D++);D<P;++D){const L=Math.round((k+D*v)*w)/w;if(y&&L>r)break;e.push({value:L})}return y&&u&&M!==r?e.length&&ne(e[e.length-1].value,r,vo(r,S,i))?e[e.length-1].value=r:e.push({value:r}):(!y||M===r)&&e.push({value:M}),e}function vo(i,t,{horizontal:e,minRotation:n}){const s=ht(n),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}class ui extends Ht{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return F(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:s,max:o}=this;const a=l=>s=e?s:l,r=l=>o=n?o:l;if(t){const l=ct(s),c=ct(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=yh(s,o);return t.bounds==="ticks"&&Tn(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return je(t,this.chart.options.locale,this.options.ticks.format)}}class Ce extends ui{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=ht(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}C(Ce,"id","linear"),C(Ce,"defaults",{ticks:{callback:$e.formatters.numeric}});const Me=i=>Math.floor(wt(i)),Nt=(i,t)=>Math.pow(10,Me(i)+t);function So(i){return i/Math.pow(10,Me(i))===1}function ko(i,t,e){const n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function xh(i,t){const e=t-i;let n=Me(e);for(;ko(i,t,n)>10;)n++;for(;ko(i,t,n)<10;)n--;return Math.min(n,Me(i))}function _h(i,{min:t,max:e}){t=et(i.min,t);const n=[],s=Me(t);let o=xh(t,e),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10;let d=Math.floor((c-h)/Math.pow(10,o)),u=et(i.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<e;)n.push({value:u,major:So(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+h+d*Math.pow(10,o))*a)/a;const f=et(i.max,u);return n.push({value:f,major:So(f),significand:d}),n}class wo extends Ht{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const n=ui.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return V(n)&&n>0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?Math.max(0,t):null,this.max=V(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!V(this._userMin)&&(this.min=t===Nt(this.min,0)?Nt(this.min,-1):Nt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=r=>n=t?n:r,a=r=>s=e?s:r;n===s&&(n<=0?(o(1),a(10)):(o(Nt(n,-1)),a(Nt(s,1)))),n<=0&&o(Nt(s,-1)),s<=0&&a(Nt(n,1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=_h(e,this);return t.bounds==="ticks"&&Tn(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":je(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=wt(t),this._valueRange=wt(this.max)-wt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(wt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}C(wo,"id","logarithmic"),C(wo,"defaults",{ticks:{callback:$e.formatters.logarithmic,major:{enabled:!0}}});function dn(i){const t=i.ticks;if(t.display&&i.display){const e=K(t.backdropPadding);return T(t.font&&t.font.size,j.font.size)+e.height}return 0}function vh(i,t,e){return e=W(e)?e:[e],{w:Ua(i,t.string,e),h:e.length*t.lineHeight}}function Co(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:i<n||i>s?{start:t-e,end:t}:{start:t,end:t+e}}function Sh(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?N/o:0;for(let l=0;l<o;l++){const c=a.setContext(i.getPointLabelContext(l));s[l]=c.padding;const h=i.getPointPosition(l,i.drawingArea+s[l],r),d=Y(c.font),u=vh(i.ctx,d,i._pointLabels[l]);n[l]=u;const f=it(i.getIndexAngle(l)+r),m=Math.round(Fi(f)),g=Co(m,h.x,u.w,0,180),p=Co(m,h.y,u.h,90,270);kh(e,t,f,g,p)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=Mh(i,n,s)}function kh(i,t,e,n,s){const o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e));let r=0,l=0;n.start<t.l?(r=(t.l-n.start)/o,i.l=Math.min(i.l,t.l-r)):n.end>t.r&&(r=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,i.t=Math.min(i.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,i.b=Math.max(i.b,t.b+l))}function wh(i,t,e){const n=i.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=e,l=i.getPointPosition(t,n+s+a,o),c=Math.round(Fi(it(l.angle+$))),h=Dh(l.y,r.h,c),d=Ph(c),u=Ah(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function Ch(i,t){if(!t)return!0;const{left:e,top:n,right:s,bottom:o}=i;return!(bt({x:e,y:n},t)||bt({x:e,y:o},t)||bt({x:s,y:n},t)||bt({x:s,y:o},t))}function Mh(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:dn(o)/2,additionalAngle:a?N/s:0};let c;for(let h=0;h<s;h++){l.padding=e[h],l.size=t[h];const d=wh(i,h,l);n.push(d),r==="auto"&&(d.visible=Ch(d,c),d.visible&&(c=d))}return n}function Ph(i){return i===0||i===180?"center":i<180?"left":"right"}function Ah(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function Dh(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function Lh(i,t,e){const{left:n,top:s,right:o,bottom:a}=e,{backdropColor:r}=t;if(!F(r)){const l=Rt(t.borderRadius),c=K(t.backdropPadding);i.fillStyle=r;const h=n-c.left,d=s-c.top,u=o-n+c.width,f=a-s+c.height;Object.values(l).some(m=>m!==0)?(i.beginPath(),le(i,{x:h,y:d,w:u,h:f,radius:l}),i.fill()):i.fillRect(h,d,u,f)}}function Th(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=i._pointLabelItems[s];if(!o.visible)continue;const a=n.setContext(i.getPointLabelContext(s));Lh(e,a,o);const r=Y(a.font),{x:l,y:c,textAlign:h}=o;Ft(e,i._pointLabels[s],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function Mo(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,H);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<n;a++)o=i.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function Oh(i,t,e,n,s){const o=i.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!n||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash),o.lineDashOffset=s.dashOffset,o.beginPath(),Mo(i,e,a,n),o.closePath(),o.stroke(),o.restore())}function Ih(i,t,e){return Ct(i,{label:e,index:t,type:"pointLabel"})}class Pe extends ui{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=K(dn(this.options)/2),e=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(e,n)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=V(t)&&!isNaN(t)?t:0,this.max=V(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/dn(this.options))}generateTickLabels(t){ui.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,n)=>{const s=B(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?Sh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=H/(this._pointLabels.length||1),n=this.options.startAngle||0;return it(t*e+ht(n))}getDistanceFromCenterForValue(t){if(F(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(F(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const n=e[t];return Ih(this.getContext(),t,n)}}getPointPosition(t,e,n=0){const s=this.getIndexAngle(t)-$+n;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:n,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:n,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const n=this.ctx;n.save(),n.beginPath(),Mo(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),n.closePath(),n.fillStyle=t,n.fill(),n.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:n,grid:s,border:o}=e,a=this._pointLabels.length;let r,l,c;if(e.pointLabels.display&&Th(this,a),s.display&&this.ticks.forEach((h,d)=>{if(d!==0){l=this.getDistanceFromCenterForValue(h.value);const u=this.getContext(d),f=s.setContext(u),m=o.setContext(u);Oh(this,f,l,a,m)}}),n.display){for(t.save(),r=a-1;r>=0;r--){const h=n.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=Y(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;const d=K(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}Ft(t,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}C(Pe,"id","radialLinear"),C(Pe,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:$e.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),C(Pe,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),C(Pe,"descriptors",{angleLines:{_fallback:"grid"}});const fi={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}},tt=Object.keys(fi);function Po(i,t){return i-t}function Ao(i,t){if(F(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let a=t;return typeof n=="function"&&(a=n(a)),V(a)||(a=typeof n=="string"?e.parse(a,n):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(se(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function Do(i,t,e,n){const s=tt.length;for(let o=tt.indexOf(i);o<s-1;++o){const a=fi[tt[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=n)return tt[o]}return tt[s-1]}function Fh(i,t,e,n,s){for(let o=tt.length-1;o>=tt.indexOf(e);o--){const a=tt[o];if(fi[a].common&&i._adapter.diff(s,n,a)>=t-1)return a}return tt[e?tt.indexOf(e):0]}function Rh(i){for(let t=tt.indexOf(i)+1,e=tt.length;t<e;++t)if(fi[tt[t]].common)return tt[t]}function Lo(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:n,hi:s}=Ei(e,t),o=e[n]>=t?e[n]:e[s];i[o]=!0}}function Eh(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+s.add(r,1,n))l=e[r],l>=0&&(t[l].major=!0);return t}function To(i,t,e){const n=[],s={},o=t.length;let a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,n.push({value:r,major:!1});return o===0||!e?n:Eh(i,n,s,e)}class gi extends Ht{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const n=t.time||(t.time={}),s=this._adapter=new rl._date(t.adapters.date);s.init(e),ee(n.displayFormats,s.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Ao(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,n=t.time.unit||"day";let{min:s,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=V(s)&&!isNaN(s)?s:+e.startOf(Date.now(),n),o=V(o)&&!isNaN(o)?o:+e.endOf(Date.now(),n)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){const t=this.options,e=t.time,n=t.ticks,s=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,a=this.max,r=La(s,o,a);return this._unit=e.unit||(n.autoSkip?Do(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Fh(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:Rh(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),To(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=G(e,0,a),n=G(n,0,a),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,a=o.unit||Do(o.minUnit,e,n,this._getLabelCapacity(e)),r=T(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=se(l)||l===!0,h={};let d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(n,e,a)>1e5*r)throw new Error(e+" and "+n+" are too far apart with stepSize of "+r+" "+a);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<n;u=+t.add(u,r,a),f++)Lo(h,u,m);return(u===n||s.bounds==="ticks"||f===1)&&Lo(h,u,m),Object.keys(h).sort(Po).map(g=>+g)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,a=e||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,n,s){const o=this.options,a=o.ticks.callback;if(a)return B(a,[t,e,n],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=n[e],f=c&&d&&u&&u.major;return this._adapter.format(t,s||(f?d:h))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e<n;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+n)*e.factor)}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,n=this.ctx.measureText(t).width,s=ht(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:n*o+r*a,h:n*a+r*o}}_getLabelCapacity(t){const e=this.options.time,n=e.displayFormats,s=n[e.unit]||n.millisecond,o=this._tickFormatFunction(t,0,To(this,[t],this._majorUnit),s),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e<n;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,n;if(t.length)return t;const s=this.getLabels();for(e=0,n=s.length;e<n;++e)t.push(Ao(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return En(t.sort(Po))}}C(gi,"id","time"),C(gi,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function pi(i,t,e){let n=0,s=i.length-1,o,a,r,l;e?(t>=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=Tt(i,"pos",t)),{pos:o,time:r}=i[n],{pos:a,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=Tt(i,"time",t)),{time:o,pos:r}=i[n],{time:a,pos:l}=i[s]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class Oo extends gi{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=pi(e,this.min),this._tableRange=pi(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(a=0,r=s.length;a<r;++a)h=s[a+1],l=s[a-1],c=s[a],Math.round((h+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){const t=this.min,e=this.max;let n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(e)||n.length===1)&&n.push(e),n.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(pi(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return pi(this._table,n*this._tableRange+this._minPos,!0)}}C(Oo,"id","timeseries"),C(Oo,"defaults",gi.defaults);const Io={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},Bh={type:{type:String,required:!0},...Io},zh=x.version[0]==="2"?(i,t)=>Object.assign(i,{attrs:t}):(i,t)=>Object.assign(i,t);function Gt(i){return x.isProxy(i)?x.toRaw(i):i}function Wh(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i;return x.isProxy(t)?new Proxy(i,{}):i}function Hh(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function Fo(i,t){i.labels=t}function Ro(i,t,e){const n=[];i.datasets=t.map(s=>{const o=i.datasets.find(a=>a[e]===s[e]);return!o||!s.data||n.includes(o)?{...s}:(n.push(o),Object.assign(o,s),o)})}function Nh(i,t){const e={labels:[],datasets:[]};return Fo(e,i.labels),Ro(e,i.datasets,t),e}const Vh=x.defineComponent({props:Bh,setup(i,t){let{expose:e}=t;const n=x.ref(null),s=x.shallowRef(null);e({chart:s});const o=()=>{if(!n.value)return;const{type:l,data:c,options:h,plugins:d,datasetIdKey:u}=i,f=Nh(c,u),m=Wh(f,c);s.value=new Pt(n.value,{type:l,data:m,options:{...h},plugins:d})},a=()=>{const l=x.toRaw(s.value);l&&(l.destroy(),s.value=null)},r=l=>{l.update(i.updateMode)};return x.onMounted(o),x.onBeforeUnmount(a),x.watch([()=>i.options,()=>i.data],(l,c)=>{let[h,d]=l,[u,f]=c;const m=x.toRaw(s.value);if(!m)return;let g=!1;if(h){const p=Gt(h),b=Gt(u);p&&p!==b&&(Hh(m,p),g=!0)}if(d){const p=Gt(d.labels),b=Gt(f.labels),y=Gt(d.datasets),_=Gt(f.datasets);p!==b&&(Fo(m.config.data,p),g=!0),y&&y!==_&&(Ro(m.config.data,y,i.datasetIdKey),g=!0)}g&&r(m)},{deep:!0}),()=>x.h("canvas",{ref:n})}});function mi(i,t){return Pt.register(t),x.defineComponent({props:Io,setup(e,n){let{expose:s}=n;const o=x.shallowRef(null),a=r=>{o.value=r==null?void 0:r.chart};return s({chart:o}),()=>x.h(Vh,zh({ref:a},{type:i,...e}))}})}const Eo=mi("bar",Je),jh=mi("doughnut",he),$h=mi("line",ti),Uh=mi("radar",ei);function bi(){function i(e,n=50,s=50){const o=document.createElement("canvas"),a=o.getContext("2d");return a&&(o.width=n,o.height=s,a.fillStyle=e,a.fillRect(0,0,n,s)),o}function t(e,n){return n?(e+n)%6:e}return{getPatternCanvas:i,getPatternIndexWithShift:t}}function un(i,t){const e=parseInt(i.toFixed());return`${new Intl.NumberFormat().format(e)}${t?" "+t:""}`}function ot(i){return Math.abs(Number(i))>=1e6?new Intl.NumberFormat().format(parseFloat((Number(i)/1e6).toFixed(2)))+" M":Math.abs(Number(i))>=1e3?new Intl.NumberFormat().format(parseFloat((Number(i)/1e3).toFixed(2)))+" K":new Intl.NumberFormat().format(parseFloat(Number(i).toFixed(2)))}function Yh(i,t){return t?(i+t)%6:i}function Xh(i,t){return`${ot(i.data[t].value)} (${ot(i.data[t].rate)}%)`}const Gh="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTExLjc0IDEyLjAzaC4wMi0uMDJ6TTEyIDdhMyAzIDAgMDAtMyAzIC43NS43NSAwIDAwMS41IDBBMS41IDEuNSAwIDAxMTIgOC41MWExLjUgMS41IDAgMDEuNjYgMi44NSAyLjQxIDIuNDEgMCAwMC0xLjQxIDIuMTZ2LjI1YS43NS43NSAwIDAwMS41IDB2LS4yNWEuOTEuOTEgMCAwMS41Ny0uODFBMyAzIDAgMDAxMiA3eiIvPjxjaXJjbGUgY3g9IjEyIiBjeT0iMTYuMjQiIHI9Ii43NSIvPjxwYXRoIGQ9Ik0xMiAyYTEwIDEwIDAgMTAxMCAxMEExMCAxMCAwIDAwMTIgMnptMCAxOGE4IDggMCAxMTgtOCA4IDggMCAwMS04IDh6Ii8+PC9zdmc+",{getPatternCanvas:qh}=bi(),Kh=14,Bo="6px",yi="22px",zo=6,fn="2px";function Wo(i,t,e,n,s,o,a,r){return[{id:"htmlLegend",afterUpdate(l){const h=l.config.type==="doughnut"?"column":"row",d=Si(i,h);for(d.style.margin="1.375rem 1.0625rem";d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).forEach(f=>{const m=l.config.type==="doughnut",g=m?f.index:f.datasetIndex,p=_i(l,t,g);if(m){const y=g+1===a;p.style.marginTop="12px",y&&(p.style.position="relative")}else p.style.marginRight="10px";p.style.width="max-content",p.style.cursor="pointer";let b;t.value?b=No(l,f,t,e,n.value):b=Ho(f,l,e,n.value,s.value,o.value),b.style.boxSizing="border-box",p.appendChild(b),p.appendChild(xi(f)),m&&a&&Zh(r,a,g)&&p.appendChild(Qh(r,a)),d.appendChild(p)})}}]}function Zh(i,t,e){return i.data.length>t&&e===t-1}function Qh(i,t){const e=document.createElement("div"),n=document.createElement("div"),s=document.createElement("img");e.style.position="absolute",e.style.right="-32px",s.src=Gh,s.style.top="0",s.style.width="1.5rem",s.style.filter="invert(38%) sepia(19%) saturate(18%) hue-rotate(337deg) brightness(97%) contrast(85%)",n.style.position="relative",n.style.display="flex";const o=Jh(i,t);return s.onmouseover=()=>{n.firstElementChild.style.visibility="visible"},e.appendChild(n),n.appendChild(o),n.appendChild(s),e}function Jh(i,t){const e=document.createElement("div");return e.style.visibility="hidden",e.style.position="absolute",e.style.zIndex="10",e.style.width="350px",e.style.bottom="100%",e.style.left="50%",e.style.marginLeft="-150px",e.style.background="#FFFFFF",e.style.boxShadow="0px 1px 5px rgba(0, 0, 0, 0.2)",e.style.borderRadius="0.5rem",e.style.fontSize="14px",e.style.overflow="hidden",td(i,t,e),e}function td(i,t,e){const n=t-1;i.data.slice(n).forEach((s,o)=>{const a=n+o,r=document.createElement("div");r.style.display="flex",r.style.justifyContent="space-between",r.style.padding="0.5rem",r.style.border="1px solid #CCCCCC";const l=document.createElement("span");l.appendChild(document.createTextNode(i.labels[a]));const c=document.createElement("span");c.appendChild(document.createTextNode(Xh(i,a))),r.appendChild(l),r.appendChild(c),e.appendChild(r)})}function Ho(i,t,e,n,s,o){const a=t.config.type==="doughnut",r=a?i.index:i.datasetIndex,l=new Image,c=Vo(i,t.config.type),h=o[r](!1,s[r],n),d=qh(h);return l.src=d.toDataURL(),c.style.background=`url(${l.src})`,c.style.backgroundSize="cover",c.style.borderColor=s[r],c.style.borderWidth=fn,c.onmouseover=()=>{a?e.value=r:e.dataSetIndex=r,t.update()},c.onmouseleave=()=>{a?e.value=null:e.dataSetIndex=-1,t.update()},c}function No(i,t,e,n,s){const o=i.config.type==="doughnut",a=o?t.index:t.datasetIndex,r=gn(i,t,s);return i.config.data.labels.every((h,d)=>i.getDataVisibility(d))?(o&&(e.value=!1,n.value=-1),r):(r.onmouseover=()=>{o?n.value=a:n.dataSetIndex=a,i.update()},r.onmouseleave=()=>{o?n.value=null:n.dataSetIndex=-1,i.update()},r)}function xi(i){const t=document.createElement("p");t.style.color=i.fontColor,t.style.fontSize=`${Kh}px`,t.style.margin="0",t.style.padding="0";const e=document.createTextNode(i.text);return t.appendChild(e),t}function Vo(i,t){const e=document.createElement("div");return t!=="doughnut"&&(e.style.background="rgba(0, 0, 0, 0.1)",e.style.borderColor=i.strokeStyle,e.style.borderWidth=fn),e.style.borderRadius="5px",e.style.borderStyle="solid",e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.width=yi,e.style.marginRight=Bo,e.style.height=yi,e}function ed(i){const t=document.createElement("div");return t.style.height=zo+"px",t.style.width=zo+"px",t.style.background="white",t.style.borderStyle="solid",t.style.borderColor=i.strokeStyle,t.style.borderWidth=fn,t}function _i(i,t,e){const n=document.createElement("li");return n.style.alignItems="center",n.style.cursor=t.value?"":"pointer",n.style.display="flex",n.style.flexDirection="row",n.setAttribute("data-test-id",`legend-item-${e}`),n.onclick=()=>{t.value?vi(i,e,t):(Uo(i,e,t),i.update())},n}function id(i,t,e,n){let s="#fff",o="#666";i&&(s=n?t.fillStyle:t.strokeStyle,o=t.strokeStyle),e.setAttribute("checked",""+i),e.setAttribute("class","mc-checkbox__input"),e.setAttribute("style",`background-color: ${s};
|
|
19
19
|
width: ${yi};
|
|
20
20
|
height: ${yi};
|
|
21
21
|
margin-right: ${Bo};
|
|
22
|
-
border-color: ${o};`)}function gn(i,t,e=!1){const n=i.config.type==="doughnut",s=n?t.index:t.datasetIndex,o=document.createElement("input");o.setAttribute("type","checkbox"),o.setAttribute("data-test-id",`legend-checkbox-${s}`);const a=n?i.getDataVisibility(s):i.isDatasetVisible(s);return id(a,t,o,e),o}function jo(i){const{type:t}=i.config;return t==="pie"||t==="doughnut"}function $o(i){let t=i.config.data.datasets;return jo(i)&&(t=i.config.data.datasets[0].data),t}function Uo(i,t,e){if(!e.value){const n=$o(i);e.value=!0,n.forEach((s,o)=>{o!==t&&vi(i,o)})}}function nd(i){let t=!0;return $o(i).forEach((n,s)=>{t=t&&i.isDatasetVisible(s)}),t}function vi(i,t,e){jo(i)?i.toggleDataVisibility(t):i.setDatasetVisibility(t,!i.isDatasetVisible(t)),e&&nd(i)&&(e.value=!1),i.update()}function pn(i,t){const e=Vo(i,""),n=ed(i),s=i.index||i.datasetIndex;return n.style.width="10px",n.style.height="10px",s%2===0?t?n.style.borderRadius="25px":n.style.transform="rotate(45deg)":t?n.style.transform="rotate(45deg)":n.style.borderRadius="25px",e.appendChild(n),e}function Si(i,t){var n,s;let e=(n=i.value)==null?void 0:n.querySelector("ul");return e||(e=document.createElement("ul"),e.style.display="flex",e.style.flexDirection=t,e.style.margin="0",e.style.padding="0",(s=i.value)==null||s.appendChild(e)),e}function Ae(i,t){const e=Math.round(Math.min(Math.max(t||1,0),1)*255);return i+e.toString(16).toUpperCase()}const{getPatternIndexWithShift:mn}=bi();function sd(){const i=_.ref(3),t=_.ref(null),e=_.reactive({dataSetIndex:-1,columnIndex:-1});function n(p,g,b,y,x){return Wo(p,g,e,b,y,x)}function s(){i.value=4,i.value=3}function o(p,g,b,y,x,S){const v=i.value;return p.map((w,k)=>({borderColor:function(M){return b?"#00000000":r(k,M.index,y,S)},backgroundColor:function(M){return l(k,M.index,b,y,x,S)},borderWidth:function(){return b?1:v},data:w.data,label:w.label,stack:`Stack ${g?"0":k}`}))}function a(p,g,b,y,x){return o([p,g],!1,x,b,y)}function r(p,g,b,y){const x=mn(p,y);return u(p,g)?b[x]:Ae(b[x],.2)}function l(p,g,b,y,x,S){const v=mn(p,S);return u(p,g)?x[v](!1,y[v],b):x[v](!0,y[v],b)}function c(){return e.dataSetIndex<0}function h(p,g){return e.dataSetIndex===p&&e.columnIndex===g}function d(p){return e.dataSetIndex===p&&e.columnIndex<0}function u(p,g){return c()||h(p,g)||d(p)}function f(){e.dataSetIndex=-1,e.columnIndex=-1}function m(){return(p,g)=>{g[0]!==void 0?(e.dataSetIndex=g[0].datasetIndex,e.columnIndex=g[0].index):f()}}return{onHoverIndex:e,reloadChart:s,getDatasets:a,getStackedDatasets:o,getOnHoverOptions:m,getBorderColor:r,getPattern:l,privateGetHtmlLegendPlugin:n,getPatternIndexWithShift:mn,barChartRef:t,borderWidth:i}}const{getPatternCanvas:od}=bi();class De{constructor(){C(this,"chartType","");C(this,"datasetIndex",0);C(this,"dataIndex",0);C(this,"titleLines",[""]);C(this,"dataToDisplay","");C(this,"xValue","");C(this,"yValue","");C(this,"patternShifting",0)}createTooltip(t,e,n,s,o,a=!1){var c,h,d,u;if(!t.tooltip.dataPoints)return;this.datasetIndex=((c=t.tooltip)==null?void 0:c.dataPoints[0].datasetIndex)||0,this.dataIndex=t.tooltip.dataPoints[0].dataIndex||0,this.xValue=n.firstLineLabel||"",this.yValue=n.secondLineLabel||"",this.chartType=n.chartType,this.dataToDisplay=e(t),this.patternShifting=n.patternShifting||0;let r=document.querySelector("#chartjs-tooltip");r||(r=this.createNewTooltipElement());const l=t.tooltip;if(l.opacity===0){r.style.opacity="0";return}if(l.body){this.titleLines=l.title||[];const f=l.body.map(this.getBody);let m="background: white;";m+="border-bottom: 1px solid #CCCCCC;",m+="border-radius: 5px;",m+="padding: 10px 20px";const p=`<div style="${m}" class="tooltipTitle">`,g=this.chartType==="DOUGHNUT"?[l.title[0].split("(")[0].trim()]:f[0];let b="",y="";const x=(u=(d=(h=t.tooltip)==null?void 0:h.dataPoints[0])==null?void 0:d.dataset)==null?void 0:u.type;this.chartType==="RADAR"||this.chartType==="LINE_CHART"?(b=this.createLegendStyle(t),y=this.createLegendInnerStyle(t)):this.chartType==="BAR_CHART"||this.chartType==="DETAILS_BAR_CHART"||this.chartType==="DOUGHNUT"?b=this.createPatternLegendStyle(t):this.chartType==="MIXED_BAR_LINE_CHART"&&(x==="bar"?b=this.createPatternLegendStyle(t):(b=this.createLegendStyle(t),y=this.createLegendInnerStyle(t))),this.addLegendToDom(p,b,y,g,m,r,s,o,a,x)}this.handleTooltipPosition(t,l,r)}handleTooltipPosition(t,e,n){const s=t.chart.canvas.getBoundingClientRect(),o=window.innerWidth,a=s.left+window.pageXOffset+e.caretX,r=s.top+window.pageYOffset+e.caretY;n.style.left=a+"px",n.style.top=r+"px",n.style.height="auto",n.style.minWidth="17rem",n.style.opacity="1",n.style.position="absolute",n.style.zIndex="99",n.style.backgroundColor="white",n.style.pointerEvents="none",n.getBoundingClientRect().width+a>o&&(n.style.left=a-n.getBoundingClientRect().width+"px")}createNewTooltipElement(){const t=document.createElement("div");return t.id="chartjs-tooltip",t.style.backgroundColor="white",t.style.borderRadius="5px",t.style.transition="opacity .5s",t.style.boxShadow="0px 1px 5px rgba(0, 0, 0, 0.2)",t.innerHTML='<div class="tooltipCtn"></div>',document.body.appendChild(t),t}createPatternLegendStyle(t){return this.createCommonLegendSquareStyle(t)}createLegendStyle(t){let e=`background-color:${t.tooltip.labelColors[0].backgroundColor}`;return e+=this.createCommonLegendSquareStyle(t),e}createCommonLegendSquareStyle(t){let e=`;border: 2px solid ${t.tooltip.labelColors[0].borderColor}`;return e+=";min-height: 20px",e+=";min-width: 20px",e+=";border-radius: 5px",e+=";margin-right: 10px",e+=";display: flex",e+=";align-items: center",e+=";justify-content: center",e+=";background: rgba(0, 0, 0, 0.1);",e}createLegendInnerStyle(t){let e="height: 12px";return e+=";width: 12px",e+=";background-color: #FFF",e+=`;border: 2px solid ${t.tooltip.labelColors[0].borderColor};`,t.tooltip.labelPointStyles[0].pointStyle==="circle"?e+="border-radius: 25px;":t.tooltip.labelPointStyles[0].pointStyle==="rectRot"&&(e+="transform: rotate(45deg);"),e}addLegendToDom(t,e,n,s,o,a,r,l,c=!1,h){let d=t,u=`<div class="legendIcon" style="${e}">`;const f=`<div style="${n}"></div>`;u+=`${f}</div>`;const m=this.setInnerHtmlToAdd(s,o,u);d+=m;const p=a==null?void 0:a.querySelector(".tooltipCtn");(p==null?void 0:p.innerHTML)!=null&&(h?this.setInnerHtmlAndPattern(p,d,r,l,c,h):this.setInnerHtmlAndPattern(p,d,r,l,c))}setInnerHtmlToAdd(t,e,n){const a=`<span style="font-family: Arial; font-size: 16px">${t[0].split(":")[0]}</span>`;return this.chartType==="RADAR"?this.returnRadarHtml(e,n,a):this.chartType==="DOUGHNUT"?this.returnDoughnutHtml(n,a):this.returnDetailsBarchartHtml(e,n,a)}returnDoughnutHtml(t,e){const n="font-family: Arial; font-size: 16px",s=`<span style="${n}">${e.split("(")[0]}</span>`;let o=`<div style="${n}; display: flex; align-items: center; justify-content: space-between">`;return o+=`<div style="display:flex; align-items: center;" >${t+s}</div>`,o+=`<div style="${n}; margin-left:3rem;">${this.dataToDisplay}</div>`,o+="</div></div>",o}returnRadarHtml(t,e,n){const s="font-family: Arial; font-size: 16px";let o=`<div style="${s}; display: flex; align-items: center;">${e+n}</div>`;return o+="</div>",o+=`<div style="${s}; ${t}; border: none; display:flex; justify-content: space-between;">`,o+=`<div>${this.titleLines[0]}</div>`,o+=`<div style="margin-left: 20px;">${this.dataToDisplay}</div>`,o+="</div>",o+="</div><div>",o}returnDetailsBarchartHtml(t,e,n){const s="font-family: Arial; font-size: 16px";let o=`<div style="${s}; display: flex; align-items: center;">${e+n}</div>`;return o+="</div>",o+=`<div style="${s}; ${t}; display:flex; justify-content: space-between;">`,o+=`<div>${this.xValue}</div>`,o+=`<div style="margin-left: 20px;">${this.titleLines[0]}</div>`,o+="</div>",o+=`<div style="${s}; ${t}; border-: none; display:flex; justify-content: space-between;">`,o+=`<div>${this.yValue}</div>`,o+=`<div style="margin-left: 20px;">${this.dataToDisplay}</div>`,o+="</div>",o}setInnerHtmlAndPattern(t,e,n,s,o=!1,a){t.innerHTML=e;const r=document.querySelector(".legendIcon"),l=new Image;let c;this.chartType==="DOUGHNUT"?c=this.dataIndex+1:c=this.datasetIndex+1;const h=Yh(c,this.patternShifting);if(this.chartType!=="LINE_CHART"&&this.chartType!=="RADAR"&&a!=="line"){const d=s[h-1](!1,n[h-1],o),u=od(d,22,22);l.src=u.toDataURL(),r.style.backgroundImage=`url(${l.src})`}}getBody(t){return t.lines}}var qt=(i=>(i.RADAR="RADAR",i.BAR_CHART="BAR_CHART",i.MIXED_BAR_LINE_CHART="MIXED_BAR_LINE_CHART",i.DETAILS_BAR_CHART="DETAILS_BAR_CHART",i.LINE_CHART="LINE_CHART",i.DOUGHNUT="DOUGHNUT",i))(qt||{});function ad(i,t="#A274FF",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50,a=o*.15;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.006*o,s.rect(.5*o,0,a,a),s.fill(),s.beginPath(),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.006*o,s.rect(.75*o,o/2,a,a),s.fill(),s.beginPath(),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.006*o,s.rect(0,0,a,a),s.fill(),s.beginPath(),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.006*o,s.rect(.25*o,o/2,a,a),s.fill()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const l=document.createElement("canvas").getContext("2d");if(!l)return new CanvasPattern;const c=l.createPattern(n,"repeat");return c||new CanvasPattern}function rd(i,t="#143666",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(-o*.03,-.01*o,o+o/2,.04*o),s.fill(),s.restore(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(.29*o,.33*o,o+o/2,.04*o),s.fill(),s.restore(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(.63*o,.69*o,o+o/2,.04*o),s.fill(),s.restore(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(.33*o,-.37*o,o+o/2,.04*o),s.fill(),s.restore(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(.71*o,-.72*o,o+o/2,.04*o),s.fill(),s.restore()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const r=document.createElement("canvas").getContext("2d");if(!r)return new CanvasPattern;const l=r.createPattern(n,"repeat");return l||new CanvasPattern}function ld(i,t="#00A3B2",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=.08*o,s.moveTo(-o/2,o/2),s.lineTo(0,0),s.lineTo(o/2,o/2),s.lineTo(o,0),s.stroke(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=.08*o,s.moveTo(-o/2,o),s.lineTo(0,o/2),s.lineTo(o/2,o),s.lineTo(o,o/2),s.lineTo(o+o/2,o),s.stroke(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=.08*o,s.moveTo(-o/2,111e-6),s.lineTo(4e-6*o,-o/2),s.lineTo(o/2,111e-6),s.lineTo(o,-o/2),s.lineTo(o+o/2,111e-6),s.stroke(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=.08*o,s.moveTo(-o/2,o+o/2),s.lineTo(0,o),s.lineTo(o/2,o+o/2),s.lineTo(o,o),s.lineTo(o+o/2,o+o/2),s.stroke()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const r=document.createElement("canvas").getContext("2d");if(!r)return new CanvasPattern;const l=r.createPattern(n,"repeat");return l||new CanvasPattern}function cd(i,t="#8C1551",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50,a=o*.15;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,a,o),s.fill(),s.beginPath(),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.005*o,s.rect(o/2,0,a,o),s.fill()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const l=document.createElement("canvas").getContext("2d");if(!l)return new CanvasPattern;const c=l.createPattern(n,"repeat");return c?(l.fillStyle=c,l.fillRect(0,0,o,o),c):new CanvasPattern}function hd(i,t="#F255A3",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=new DOMMatrix,a=21,r=.1*a;n.width=a,n.height=a,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,a,a),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*a,s.rect(0,0,a,a),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*a,s.rect(0,0,a,a),s.fill(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=r,s.moveTo(r,0),s.lineTo(r,.5*a),s.stroke(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=r,s.moveTo(a/2+r,0),s.lineTo(a/2+r,.5*a),s.stroke()),i&&(s.beginPath(),s.fillStyle="#FFFFFF",s.globalAlpha=.5,s.lineWidth=.006*a,s.rect(0,0,a,a),s.fill());const l=document.createElement("canvas"),c=l.getContext("2d");if(!c)return new CanvasPattern;const h=c.createPattern(n,"repeat");return h?(c.fillStyle=h,c.fillRect(0,0,l.width,l.height),h.setTransform(o.rotate(45)),h):new CanvasPattern}function dd(i,t="#095359",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50,a=.04*o;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.1005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.1005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=a,s.arc(a+.06*o,a+.06*o,.06*o,0,2*Math.PI),s.stroke(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=a,s.arc(a+.56*o,a+.06*o,.06*o,0,2*Math.PI),s.stroke(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=.04*o,s.arc(-a+.44*o,a+.56*o,.06*o,0,2*Math.PI),s.stroke(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=.04*o,s.arc(-a+.94*o,a+.56*o,.06*o,0,2*Math.PI),s.stroke()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const r=document.createElement("canvas"),l=r.getContext("2d");if(!l)return new CanvasPattern;const c=l.createPattern(n,"repeat");return c?(l.fillStyle=c,l.fillRect(0,0,r.width,r.height),c):new CanvasPattern}function Le(){return{patternsStandardList:[ad,rd,ld,cd,hd,dd],colourSets:[["#393879","#006974","#405D68","#005C91","#8C3500","#8C0003"],["#A274FF","#143666","#00A3B2","#8C1551","#F255A3","#095359"],["#00A3B2","#143666","#3D993D","#8C1551","#E56D17","#4C3380"],["#8C1551","#E56D17","#4C3380","#4588E5","#095359","#F255A3"],["#4588E5","#4C3380","#E56D17","#143666","#D94141","#8C1551"],["#143666","#F255A3","#095359","#4588E5","#8C1551","#E56D17"],["#A274FF","#B0BBC0","#B0BBC0","#B0BBC0","#B0BBC0","#B0BBC0"]]}}const ud={class:"container"},fd={class:"main"},gd=_.defineComponent({__name:"BarChart",props:{chartId:{type:String,default:"radar-chart"},unit:{type:String,default:"%"},labels:{type:Array,default:()=>[]},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},datasets:{type:Array,default:()=>[]},width:{type:String,default:"400px"},height:{type:String,default:"300px"},cssClasses:{type:String,default:void 0},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]},stacked:{type:Boolean,default:!1},disableAccessibility:{type:Boolean,default:!1},tooltipFirstLineLabel:{type:String,default:"content"},tooltipSecondLineLabel:{type:String,default:"content2"}},setup(i){const t=i;Pt.register(ve,ke,_e,xe,we,Ce);const{colourSets:e,patternsStandardList:n}=Le(),s=_.ref(null),o=_.ref(!1),a=_.computed(()=>t.newPatternsOrder.length!==n.length?e[t.colourSet]:t.newPatternsOrder.map(P=>e[t.colourSet][P])),r=_.computed(()=>t.newPatternsOrder.length!==n.length?n:t.newPatternsOrder.map(P=>n[P])),l=_.computed(()=>t.disableAccessibility),{onHoverIndex:c,barChartRef:h,reloadChart:d,getOnHoverOptions:u,getStackedDatasets:f,privateGetHtmlLegendPlugin:m}=sd(),p=_.computed(()=>{const P=w(x.value);return y(),{labels:P,datasets:f(t.datasets.map((A,D)=>({data:S(D,x.value),label:t.datasets[D].label})),t.stacked,t.disableAccessibility,a.value,r.value,0)}});let g,b;const y=()=>{g=t.tooltipFirstLineLabel,b=t.tooltipSecondLineLabel},x=_.computed(()=>{const P=t.labels;if(P.includes("other")){const A=P.indexOf("other");if(t.datasets[0].data[A].rate+""=="0"&&t.datasets[1].data[A].rate+""=="0")return A}return null}),S=(P,A,D=!1)=>{const L=Object.assign([],t.datasets[P].data);return A&&x.value&&L.splice(x.value,1),L.map(z=>t.unit==="%"?z.rate:z.amount)},v=P=>{const A=P.tooltip.dataPoints[0].datasetIndex,D=P.tooltip.dataPoints[0].dataIndex,L=P.tooltip.body[0].lines[0].split(":")[1],z=t.datasets[A].data[D],Z=z.rate?parseFloat(L.replace(",",".")).toFixed(2)+"% ":"",I=z.amountUnit?z.amountUnit:"",E=z.amount?ot(z.amount):"";return Z+(Z&&E?"/ ":"")+E+I},w=P=>{const A=Object.assign([],t.labels);return P&&A.splice(P,1),A.map(D=>D)},k=_.computed(()=>({onHover:u(),elements:{bar:{borderSkipped:!1}},plugins:{responsive:!0,maintainAspectRatio:!1,legend:{display:!1},title:{display:!1},tooltip:{enabled:!1,position:"nearest",external:function(P){new De().createTooltip(P,v,{chartType:qt.BAR_CHART,firstLineLabel:g,secondLineLabel:b},a.value,r.value,t.disableAccessibility)}}},scales:{x:{stacked:t.stacked},y:{stacked:t.stacked,ticks:{callback:function(P){return t.unit==="%"?un(P,t.unit):ot(P)+" "+t.unit}}}}})),M=_.ref(m(s,o,l,a,r));return _.watch(c,()=>{d()},{deep:!0}),(P,A)=>(_.openBlock(),_.createElementBlock("div",ud,[_.createElementVNode("div",fd,[p.value?(_.openBlock(),_.createBlock(_.unref(Eo),{key:0,ref_key:"barChartRef",ref:h,id:i.chartId,data:p.value,options:k.value,plugins:M.value,class:_.normalizeClass(i.cssClasses),style:_.normalizeStyle([{width:i.width,height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","options","plugins","class","style"])):_.createCommentVNode("",!0)]),_.createElementVNode("div",{ref_key:"legendContainer",ref:s},null,512)]))}}),Id="",Fd="",Te=(i,t)=>{const e=i.__vccOpts||i;for(const[n,s]of t)e[n]=s;return e},ki=Te(gd,[["__scopeId","data-v-fae6dcc9"]]);ki.install=i=>{i.component("BarChart",ki)};function pd(){const i=_.ref(null),t=_.ref(null),e=_.ref(null);function n(h,d,u,f,m,p,g){return Wo(h,d,t,u,f,m,p,g)}function s(h,d,u){return t.value!==null?d.map((f,m)=>t.value===m?f(!1,h[m],u):f(!0,h[m],u)):d.map((f,m)=>f(!1,h[m],u))}function o(h){return t.value!==null?h.map((d,u)=>t.value===u?d:Ae(d,.2)):h}function a(){return(h,d)=>{d[0]!==void 0?t.value=d[0].element.$context.index:t.value=null}}const r=h=>h.charAt(0).toUpperCase()+h.slice(1).toLowerCase();function l(h,d,u,f){let m=h.slice(0),p=d.slice(0);return h.length>u&&(p=c(d,u),m=m.slice(0,u-1),m.push(f)),m.map((g,b)=>`${r(g)} (${ot(p[b].rate)} %)`)}function c(h,d){if(d<1)return h;let u=h.slice(0);return h.length>d&&(u=u.slice(0,d),u[d-1]=h.slice(d).reduce((f,m)=>(f.rate+=m.rate,f.value+=m.value,f),{rate:h[d-1].rate,value:h[d-1].value})),u}return{onHoverIndex:t,privateGetHtmlLegendPlugin:n,getOnHoverOptions:a,groupDataAfterNthValue:c,getDoughnutLabels:l,getBackgroundColor:s,getFormatedText:r,getBorderColor:o,backgroundColor:e,doughnutRef:i}}const md={class:"container"},bd={class:"main"},yd=_.defineComponent({__name:"DoughnutChart",props:{chartId:{type:String,default:"doughnut-chart"},data:{type:Array,default:()=>[]},labels:{type:Array,default:()=>[]},cssClasses:{type:String,default:void 0},disableAccessibility:{type:Boolean,default:!1},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},width:{type:String,default:"400px"},height:{type:String,default:"400px"},maxValues:{type:Number,default:5},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]},othersLabel:{type:String,default:"others"}},setup(i){const t=i;Pt.register(ve,ke,_e,ye);const{colourSets:e,patternsStandardList:n}=Le(),{onHoverIndex:s,doughnutRef:o,getBackgroundColor:a,privateGetHtmlLegendPlugin:r,getOnHoverOptions:l,groupDataAfterNthValue:c,getDoughnutLabels:h,getBorderColor:d}=pd(),u=_.ref(!1),f=_.ref(null),m=_.computed(()=>t.newPatternsOrder.length!==6?e[t.colourSet]:t.newPatternsOrder.map(k=>e[t.colourSet][k])),p=_.computed(()=>t.newPatternsOrder.length!==6?n:t.newPatternsOrder.map(k=>n[k])),g=_.computed(()=>({labels:h(t.labels,t.data,t.maxValues,t.othersLabel),datasets:[{data:c(t.data,t.maxValues).map(k=>k.rate),backgroundColor:a(m.value,p.value,t.disableAccessibility),borderColor:d(m.value)}]})),b=k=>{const M=k.tooltip.dataPoints[0].dataIndex,P=c(t.data,t.maxValues)[M],A=ot(P.rate),D=ot(P.value),L=P.unit||"";return`${D}${L} (${A})%`};function y(){return t.labels.length<=1?0:12}const x=_.computed(()=>{const k=m.value,M=p.value;return{onHover:l(),plugins:{legend:{display:!1,position:"bottom",align:"start",labels:{pointStyle:"rectRounded",usePointStyle:!0}},title:{display:!1},tooltip:{enabled:!1,external:function(P){new De().createTooltip(P,b,{chartType:qt.DOUGHNUT},k,M,v.value)}}},radius:"90%",cutout:"70%",borderWidth:3,spacing:y(),hoverOffset:4}}),S={data:t.data,labels:t.labels},v=_.computed(()=>t.disableAccessibility),w=_.computed(()=>r(f,u,v,m,p,t.maxValues,S));return _.onMounted(()=>{a(m.value,p.value,t.disableAccessibility)}),_.watch(s,(k,M)=>{k!==M&&a(m.value,p.value,t.disableAccessibility)}),_.watch(v,()=>{a(m.value,p.value,t.disableAccessibility)}),(k,M)=>(_.openBlock(),_.createElementBlock("div",md,[_.createElementVNode("div",bd,[g.value?(_.openBlock(),_.createBlock(_.unref(jh),{key:0,ref_key:"doughnutRef",ref:o,id:i.chartId,data:g.value,options:x.value,plugins:w.value,"max-values":i.maxValues,class:_.normalizeClass(i.cssClasses),style:_.normalizeStyle([{width:i.width,height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","options","plugins","max-values","class","style"])):_.createCommentVNode("",!0)]),_.createElementVNode("div",{ref_key:"legendContainer",ref:f},null,512)]))}}),Rd="",wi=Te(yd,[["__scopeId","data-v-9f73f105"]]);wi.install=i=>{i.component("DoughnutChart",wi)};const xd={class:"container"},_d={class:"main"},vd=_.defineComponent({__name:"LineChart",props:{chartId:{type:String,default:"radar-chart"},tooltipFirstLineLabel:{type:String,default:"content"},tooltipSecondLineLabel:{type:String,default:"content2"},width:{type:String,default:"200px"},height:{type:String,default:"400px"},disableAccessibility:{type:Boolean,default:!1},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},lines:{type:Array,default:()=>{}},labels:{type:Array,default:()=>[]},cssClasses:{type:String,default:void 0},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]}},setup(i){const t=i;Pt.register(ve,ke,_e,Xt,ut,we,Ce);const{colourSets:e,patternsStandardList:n}=Le(),s=_.ref(null),o=_.ref(!1),a=_.computed(()=>t.newPatternsOrder.length!==6?e[t.colourSet]:t.newPatternsOrder.map(g=>e[t.colourSet][g])),r=t.newPatternsOrder.length!==6?n:t.newPatternsOrder.map(g=>n[g]),l=g=>{const b=g.tooltip.dataPoints[0].datasetIndex,y=g.tooltip.dataPoints[0].dataIndex,x=t.lines[b].data[y].toFixed(2);return t.lines[b].unit?x+" "+t.lines[b].unit:x},c=_.computed(()=>t.tooltipFirstLineLabel),h=_.computed(()=>t.tooltipSecondLineLabel),d=_.computed(()=>({labels:t.labels.map(g=>g),datasets:[{type:"line",borderColor:a.value[0],pointStyle:"rectRot",pointBackgroundColor:"#FFFFFF",pointRadius:5,label:t.lines[0].label,data:t.lines[0].data,borderWidth:2},{type:"line",borderColor:a.value[1],pointStyle:"circle",pointBackgroundColor:"#FFFFFF",pointRadius:5,label:t.lines[1].label,data:t.lines[1].data,borderWidth:2}]}));function u(g,b){return[{id:"htmlLegend",afterUpdate(y){const x=Si(g,"column");for(x.style.display="flex",x.style.flexDirection="row",x.style.margin="1.375rem 1.0625rem";x.firstChild;)x.firstChild.remove();y.options.plugins.legend.labels.generateLabels(y).forEach(v=>{const w=_i(y,b,v.datasetIndex);let k;b.value?k=f(y,v):k=pn(v),k.style.boxSizing="border-box",w.style.marginRight="10px",w.appendChild(k),w.appendChild(xi(v)),x.appendChild(w)})}}]}function f(g,b){const y=gn(g,b);return y.onclick=x=>{vi(g,b.datasetIndex,o),x.stopPropagation()},y}const m=u(s,o),p=_.computed(()=>({responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1,external:function(g){new De().createTooltip(g,l,{chartType:qt.LINE_CHART,firstLineLabel:c.value,secondLineLabel:h.value},a.value,r,t.disableAccessibility)}}},scales:{x:{offset:!0},y:{type:"linear",display:!0,position:"left",grid:{drawOnChartArea:!0},ticks:{callback:function(g){const b=t.lines[0].unit;return`${ot(g)} ${b||""}`}}}}}));return(g,b)=>(_.openBlock(),_.createElementBlock("div",xd,[_.createElementVNode("div",_d,[d.value?(_.openBlock(),_.createBlock(_.unref($h),{key:0,ref:"lineChartRef",id:i.chartId,data:d.value,options:p.value,plugins:_.unref(m),class:_.normalizeClass(i.cssClasses),style:_.normalizeStyle([{width:i.width,height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","options","plugins","class","style"])):_.createCommentVNode("",!0)]),_.createElementVNode("div",{ref_key:"legendContainer",ref:s},null,512)]))}}),Ed="",Ci=Te(vd,[["__scopeId","data-v-d99146c4"]]);Ci.install=i=>{i.component("LineChart",Ci)};function Sd(i,t){const e=i.ctx,n=i.scales.r,s=i.data.labels;!e||!n||!s||(e.save(),s.forEach((o,a)=>{const r=(n.getIndexAngle(a)-Math.PI/2)%(2*Math.PI),l=n.getPointPositionForValue(a,n.max);e.textAlign=r<=Math.PI/2||r>3*Math.PI/2?"left":"right";let c=r<=Math.PI/2||r>3*Math.PI/2?15:-15,h;r<0||r>Math.PI?h=-15:h=15,r>Math.PI/4&&r<3*Math.PI/4&&(h*=3),(r<-Math.PI/4||r>5*Math.PI/4)&&(h*=3,c=0),(r>11*Math.PI/8||r<-3*Math.PI/8)&&(e.textAlign="center");const d=l.y+h*(o.length-1)/2;e.font="15px Arial",o.forEach((u,f)=>{const m=f===o.length-1?kd(t)[a]:"#000000";e.fillStyle=m;const p=l.x+c,g=d+15*f;e.fillText(u,p,g)})}),e.restore())}const kd=i=>i.datasets[0].areaData.map(t=>{switch(t.color){case"red":return"#C61112";case"green":return"#46A610";default:return"#000000"}}),wd={class:"container"},Cd=_.defineComponent({__name:"RadarChart",props:{chartId:{type:String,default:"radar-chart"},height:{type:String,default:"600px"},labels:{type:Array,default:()=>[]},disableAccessibility:{type:Boolean,default:!1},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},datasets:{type:Array,default:()=>[]},cssClasses:{default:"",type:String},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]}},setup(i){const t=i;Pt.register(ve,ke,_e,Pe,ut,Xt,eh);const{colourSets:e,patternsStandardList:n}=Le(),s=_.computed(()=>t.newPatternsOrder.length!==6?e[t.colourSet]:t.newPatternsOrder.map(g=>e[t.colourSet][g])),o=_.computed(()=>t.newPatternsOrder.length!==6?n:t.newPatternsOrder.map(g=>n[g])),a=_.computed(()=>({labels:d(),datasets:[{label:t.datasets[0].label,backgroundColor:Ae(s.value[0],.1),borderColor:s.value[0],pointBackgroundColor:"#FFFFFF",pointBorderColor:s.value[0],pointBorderWidth:2,borderWidth:2,pointHitRadius:55,pointRadius:5,pointHoverBackgroundColor:s.value[0],pointHoverBorderColor:s.value[0],data:t.datasets[0].areaData.map(g=>g.position)},{label:t.datasets[1].label,backgroundColor:Ae(s.value[1],.1),borderColor:s.value[1],pointBackgroundColor:"#FFFFFF",pointBorderColor:s.value[1],pointBorderWidth:2,borderWidth:2,pointHitRadius:55,pointRadius:5,pointStyle:"rectRot",pointHoverBackgroundColor:s.value[1],pointHoverBorderColor:s.value[1],data:t.datasets[1].areaData.map(g=>g.position)}]})),r={onClick:(g,b,y)=>{b[0]&&Uo(y,b[0].datasetIndex,c)},plugins:{htmlLegend:{containerID:"legend-container"},legend:{display:!1},title:{display:!1},tooltip:{enabled:!1,position:"nearest",external:function(g){new De().createTooltip(g,p,{chartType:qt.RADAR},s.value,o.value,t.disableAccessibility)}}},layout:{padding:{left:130,right:95,top:95,bottom:95}},scales:{r:{min:0,max:100,pointLabels:{display:!1,font:{weight:400,family:"Roboto"}},ticks:{display:!1,stepSize:25}}}},l=_.ref(null),c=_.ref(!1);function h(g,b){if(g.length>9&&g.includes(" ",9)){const x=g.indexOf(" ",9);return[g.substring(0,x),g.substring(x),b]}return[g,b]}const d=()=>t.labels.map((g,b)=>{const y=t.datasets[0].areaData[b].value?`${u(t.datasets[0].areaData[b].value+"")} ${t.datasets[0].areaData[b].unit}`:"No Data";return h(g,y)}),u=g=>ot(parseFloat(g));function f(g,b){const y=gn(g,b);return y.onclick=x=>{vi(g,b.datasetIndex,c),x.stopPropagation()},y}const m=[{id:"htmlLegend",afterUpdate(g){const b=Si(l,"row");for(;b.firstChild;)b.firstChild.remove();g.options.plugins.legend.labels.generateLabels(g).reverse().forEach(x=>{const S=_i(g,c,x.datasetIndex);let v;S.style.marginRight="0.625rem",c.value?v=f(g,x):v=pn(x,!0),S.appendChild(v),S.appendChild(xi(x)),b.appendChild(S)})}},{id:"radarLabelPlugin",beforeDraw(g){Sd(g,t)}}],p=g=>{const b=g.tooltip.dataPoints[0].datasetIndex,y=g.tooltip.dataPoints[0].dataIndex,x=t.datasets[b];return x.areaData[y].value.toFixed(2)+" "+x.areaData[y].unit};return(g,b)=>(_.openBlock(),_.createElementBlock("div",wd,[_.createElementVNode("div",{class:"main",style:_.normalizeStyle({height:i.height})},[a.value?(_.openBlock(),_.createBlock(_.unref(Uh),{key:0,id:i.chartId,data:a.value,options:r,plugins:m,class:_.normalizeClass(i.cssClasses),style:_.normalizeStyle([{height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","class","style"])):_.createCommentVNode("",!0)],4),_.createElementVNode("div",{ref_key:"legendContainer",ref:l,class:"legendContainer"},null,512)]))}}),Bd="",Mi=Te(Cd,[["__scopeId","data-v-e59323c3"]]);Mi.install=i=>{i.component("RadarChart",Mi)};const Yo=Object.freeze(Object.defineProperty({__proto__:null,BarChart:ki,DoughnutChart:wi,LineChart:Ci,RadarChart:Mi},Symbol.toStringTag,{value:"Module"})),{getPatternIndexWithShift:Xo}=bi();function Md(){const i=_.ref(2),t=_.reactive({dataSetIndex:-1,columnIndex:-1});function e(d,u,f,m,p,g){return[{id:"htmlLegend",afterUpdate(b){const y=Si(d,"column");for(y.style.display="flex",y.style.margin="1.375rem 1.0625rem",y.style.flexDirection="row-reverse",y.style.justifyContent="flex-end";y.firstChild;)y.firstChild.remove();b.options.plugins.legend.labels.generateLabels(b).forEach(S=>{const v=_i(b,u,S.datasetIndex);let w;u.value?w=No(b,S,u,-1,m.value):S!=null&&S.lineCap?w=pn(S):w=Ho(S,b,-1,m.value,p.value,g.value),w.style.boxSizing="border-box",v.style.marginRight="10px",v.appendChild(w),v.appendChild(xi(S)),y.appendChild(v)})}}]}function n(d,u,f,m,p){return e(d,u,t,f,m,p)}function s(d,u,f,m,p){const g=i.value;return d.map((b,y)=>({type:b.type,fill:b.type==="bar"?null:!1,borderWidth:function(){return u?1:g},borderColor:function(x){return u?"#00000000":b.type==="bar"?o(y,x.index,f,p):f[y]},backgroundColor:function(x){return a(y,x.index,u,f,m,p)},yAxisID:b.type==="bar"?"A":"B",pointStyle:y%2===0?"rectRot":"circle",data:b.data,label:b.label,pointBackgroundColor:"#FFFFFF",pointRadius:5,order:d.length-y}))}function o(d,u,f,m){const p=Xo(d,m);return r(d,u)?f[p]:Ae(f[p],.2)}function a(d,u,f,m,p,g){const b=Xo(d,g);return r(d,u)?p[b](!1,m[b],f):p[b](!0,m[b],f)}function r(d,u){return l()||c(d,u)||h(d)}function l(){return t.dataSetIndex<0}function c(d,u){return t.dataSetIndex===d&&t.columnIndex===u}function h(d){return t.dataSetIndex===d&&t.columnIndex<0}return{privateGetHtmlLegendPlugin:n,getMixedDatasets:s,getBorderColor:o,getPattern:a,onHoverIndex:t}}const Pd={class:"container"},Ad={class:"main"},Dd=_.defineComponent({__name:"MixedBarLineChart",props:{chartId:{type:String,default:"mixed-bar-line-chart"},unit:{type:String,default:""},labels:{type:Array,default:()=>[]},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},barDatasets:{type:Array,default:()=>[]},barUnit:{type:String,default:""},lineDatasets:{type:Array,default:()=>[]},lineUnit:{type:String,default:""},width:{type:String,default:"400px"},height:{type:String,default:"300px"},cssClasses:{type:String,default:void 0},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]},stacked:{type:Boolean,default:!1},disableAccessibility:{type:Boolean,default:!1},tooltipFirstLineLabel:{type:String,default:"content"},tooltipSecondLineLabel:{type:String,default:"content2"},xAxisTitle:{type:String,default:"title 1"},yLeftAxisTitle:{type:String,default:"title 2"},yRightAxisTitle:{type:String,default:"title 3"}},setup(i){const t=i;Pt.register(ve,ke,_e,xe,we,Ce,ut,Xt);const{privateGetHtmlLegendPlugin:e,getMixedDatasets:n}=Md(),{colourSets:s,patternsStandardList:o}=Le(),a=_.ref(null),r=_.ref(!1),l=_.computed(()=>{let b=[];return t.barDatasets&&(b=b.concat(t.barDatasets)),t.lineDatasets&&(b=b.concat(t.lineDatasets)),b}),c=_.computed(()=>t.newPatternsOrder.length!==o.length?s[t.colourSet]:t.newPatternsOrder.map(b=>s[t.colourSet][b])),h=_.computed(()=>t.newPatternsOrder.length!==o.length?o:t.newPatternsOrder.map(b=>o[b])),d=_.computed(()=>t.disableAccessibility),u=_.computed(()=>({labels:m(),datasets:n(l.value,d.value,c.value,h.value,0)})),f=b=>{const y=b.tooltip.dataPoints[0].datasetIndex,x=b.tooltip.dataPoints[0].dataIndex,S=l.value[y].data[x],v=l.value[y].type==="bar"?t.barUnit:t.lineUnit;return(v==="%"?parseFloat(S.toString().replace(",",".")).toFixed(2):ot(S))+v},m=()=>Object.assign([],t.labels).map(y=>y),p=_.computed(()=>({type:"scatter",responsive:!0,maintainAspectRatio:!0,elements:{bar:{borderSkipped:!1}},plugins:{legend:{display:!1},title:{display:!1},tooltip:{enabled:!1,external:function(b){new De().createTooltip(b,f,{chartType:qt.MIXED_BAR_LINE_CHART,firstLineLabel:t.tooltipFirstLineLabel,secondLineLabel:t.tooltipSecondLineLabel},c.value,h.value,t.disableAccessibility)}}},scales:{x:{offset:!0,title:{display:!0,text:t.xAxisTitle}},A:{type:"linear",display:!0,position:"left",grid:{drawOnChartArea:!0},title:{display:!0,text:t.yLeftAxisTitle},ticks:{callback:function(b){return t.barUnit==="%"?un(b,t.unit):ot(b)+" "+t.barUnit}}},B:{type:"linear",display:!0,position:"right",grid:{drawOnChartArea:!1},title:{display:!0,text:t.yRightAxisTitle},ticks:{callback:function(b){return(t.lineUnit==="%"?un(b,t.unit):ot(b))+" "+t.lineUnit}}}}})),g=_.ref(e(a,r,d,c,h));return(b,y)=>(_.openBlock(),_.createElementBlock("div",Pd,[_.createElementVNode("div",Ad,[u.value?(_.openBlock(),_.createBlock(_.unref(Eo),{key:0,ref:"mixedBarLineChartRef",id:i.chartId,data:u.value,options:p.value,plugins:g.value,class:_.normalizeClass(i.cssClasses),style:_.normalizeStyle([{width:i.width,height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","options","plugins","class","style"])):_.createCommentVNode("",!0)]),_.createElementVNode("div",{ref_key:"legendContainer",ref:a},null,512)]))}}),zd="",Wd="",bn=Te(Dd,[["__scopeId","data-v-758cd368"]]);bn.install=i=>{i.component("MixedBarLineChart",bn)};const Ld={install:(i,t)=>{Object.keys(Yo).forEach(e=>{i.component(e,Yo[e])})}};X.BarChart=ki,X.DoughnutChart=wi,X.LineChart=Ci,X.MixedBarLineChart=bn,X.RadarChart=Mi,X.default=Ld,Object.defineProperties(X,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
22
|
+
border-color: ${o};`)}function gn(i,t,e=!1){const n=i.config.type==="doughnut",s=n?t.index:t.datasetIndex,o=document.createElement("input");o.setAttribute("type","checkbox"),o.setAttribute("data-test-id",`legend-checkbox-${s}`);const a=n?i.getDataVisibility(s):i.isDatasetVisible(s);return id(a,t,o,e),o}function jo(i){const{type:t}=i.config;return t==="pie"||t==="doughnut"}function $o(i){let t=i.config.data.datasets;return jo(i)&&(t=i.config.data.datasets[0].data),t}function Uo(i,t,e){if(!e.value){const n=$o(i);e.value=!0,n.forEach((s,o)=>{o!==t&&vi(i,o)})}}function nd(i){let t=!0;return $o(i).forEach((n,s)=>{t=t&&i.isDatasetVisible(s)}),t}function vi(i,t,e){jo(i)?i.toggleDataVisibility(t):i.setDatasetVisibility(t,!i.isDatasetVisible(t)),e&&nd(i)&&(e.value=!1),i.update()}function pn(i,t){const e=Vo(i,""),n=ed(i),s=i.index||i.datasetIndex;return n.style.width="10px",n.style.height="10px",s%2===0?t?n.style.borderRadius="25px":n.style.transform="rotate(45deg)":t?n.style.transform="rotate(45deg)":n.style.borderRadius="25px",e.appendChild(n),e}function Si(i,t){var n,s;let e=(n=i.value)==null?void 0:n.querySelector("ul");return e||(e=document.createElement("ul"),e.style.display="flex",e.style.flexDirection=t,e.style.margin="0",e.style.padding="0",(s=i.value)==null||s.appendChild(e)),e}function Ae(i,t){const e=Math.round(Math.min(Math.max(t||1,0),1)*255);return i+e.toString(16).toUpperCase()}const{getPatternIndexWithShift:mn}=bi();function sd(){const i=x.ref(3),t=x.ref(null),e=x.reactive({dataSetIndex:-1,columnIndex:-1});function n(g,p,b,y,_){return Wo(g,p,e,b,y,_)}function s(){i.value=4,i.value=3}function o(g,p,b,y,_,S){const v=i.value;return g.map((w,k)=>({borderColor:function(M){return b?"#00000000":r(k,M.index,y,S)},backgroundColor:function(M){return l(k,M.index,b,y,_,S)},borderWidth:function(){return b?1:v},data:w.data,label:w.label,stack:`Stack ${p?"0":k}`}))}function a(g,p,b,y,_){return o([g,p],!1,_,b,y)}function r(g,p,b,y){const _=mn(g,y);return u(g,p)?b[_]:Ae(b[_],.2)}function l(g,p,b,y,_,S){const v=mn(g,S);return u(g,p)?_[v](!1,y[v],b):_[v](!0,y[v],b)}function c(){return e.dataSetIndex<0}function h(g,p){return e.dataSetIndex===g&&e.columnIndex===p}function d(g){return e.dataSetIndex===g&&e.columnIndex<0}function u(g,p){return c()||h(g,p)||d(g)}function f(){e.dataSetIndex=-1,e.columnIndex=-1}function m(){return(g,p)=>{p[0]!==void 0?(e.dataSetIndex=p[0].datasetIndex,e.columnIndex=p[0].index):f()}}return{onHoverIndex:e,reloadChart:s,getDatasets:a,getStackedDatasets:o,getOnHoverOptions:m,getBorderColor:r,getPattern:l,privateGetHtmlLegendPlugin:n,getPatternIndexWithShift:mn,barChartRef:t,borderWidth:i}}const{getPatternCanvas:od}=bi();class De{constructor(){C(this,"chartType","");C(this,"datasetIndex",0);C(this,"dataIndex",0);C(this,"titleLines",[""]);C(this,"dataToDisplay","");C(this,"xValue","");C(this,"yValue","");C(this,"patternShifting",0)}createTooltip(t,e,n,s,o,a=!1){var c,h,d,u;if(!t.tooltip.dataPoints)return;this.datasetIndex=((c=t.tooltip)==null?void 0:c.dataPoints[0].datasetIndex)||0,this.dataIndex=t.tooltip.dataPoints[0].dataIndex||0,this.xValue=n.firstLineLabel||"",this.yValue=n.secondLineLabel||"",this.chartType=n.chartType,this.dataToDisplay=e(t),this.patternShifting=n.patternShifting||0;let r=document.querySelector("#chartjs-tooltip");r||(r=this.createNewTooltipElement());const l=t.tooltip;if(l.opacity===0){r.style.opacity="0";return}if(l.body){this.titleLines=l.title||[];const f=l.body.map(this.getBody);let m="background: white;";m+="border-bottom: 1px solid #CCCCCC;",m+="border-radius: 5px;",m+="padding: 10px 20px";const g=`<div style="${m}" class="tooltipTitle">`,p=this.chartType==="DOUGHNUT"?[l.title[0].split("(")[0].trim()]:f[0];let b="",y="";const _=(u=(d=(h=t.tooltip)==null?void 0:h.dataPoints[0])==null?void 0:d.dataset)==null?void 0:u.type;this.chartType==="RADAR"||this.chartType==="LINE_CHART"?(b=this.createLegendStyle(t),y=this.createLegendInnerStyle(t)):this.chartType==="BAR_CHART"||this.chartType==="DETAILS_BAR_CHART"||this.chartType==="DOUGHNUT"?b=this.createPatternLegendStyle(t):this.chartType==="MIXED_BAR_LINE_CHART"&&(_==="bar"?b=this.createPatternLegendStyle(t):(b=this.createLegendStyle(t),y=this.createLegendInnerStyle(t))),this.addLegendToDom(g,b,y,p,m,r,s,o,a,_)}this.handleTooltipPosition(t,l,r)}handleTooltipPosition(t,e,n){const s=t.chart.canvas.getBoundingClientRect(),o=window.innerWidth,a=s.left+window.pageXOffset+e.caretX,r=s.top+window.pageYOffset+e.caretY;n.style.left=a+"px",n.style.top=r+"px",n.style.height="auto",n.style.minWidth="17rem",n.style.opacity="1",n.style.position="absolute",n.style.zIndex="99",n.style.backgroundColor="white",n.style.pointerEvents="none",n.getBoundingClientRect().width+a>o&&(n.style.left=a-n.getBoundingClientRect().width+"px")}createNewTooltipElement(){const t=document.createElement("div");return t.id="chartjs-tooltip",t.style.backgroundColor="white",t.style.borderRadius="5px",t.style.transition="opacity .5s",t.style.boxShadow="0px 1px 5px rgba(0, 0, 0, 0.2)",t.innerHTML='<div class="tooltipCtn"></div>',document.body.appendChild(t),t}createPatternLegendStyle(t){return this.createCommonLegendSquareStyle(t)}createLegendStyle(t){let e=`background-color:${t.tooltip.labelColors[0].backgroundColor}`;return e+=this.createCommonLegendSquareStyle(t),e}createCommonLegendSquareStyle(t){let e=`;border: 2px solid ${t.tooltip.labelColors[0].borderColor}`;return e+=";min-height: 20px",e+=";min-width: 20px",e+=";border-radius: 5px",e+=";margin-right: 10px",e+=";display: flex",e+=";align-items: center",e+=";justify-content: center",e+=";background: rgba(0, 0, 0, 0.1);",e}createLegendInnerStyle(t){let e="height: 12px";return e+=";width: 12px",e+=";background-color: #FFF",e+=`;border: 2px solid ${t.tooltip.labelColors[0].borderColor};`,t.tooltip.labelPointStyles[0].pointStyle==="circle"?e+="border-radius: 25px;":t.tooltip.labelPointStyles[0].pointStyle==="rectRot"&&(e+="transform: rotate(45deg);"),e}addLegendToDom(t,e,n,s,o,a,r,l,c=!1,h){let d=t,u=`<div class="legendIcon" style="${e}">`;const f=`<div style="${n}"></div>`;u+=`${f}</div>`;const m=this.setInnerHtmlToAdd(s,o,u);d+=m;const g=a==null?void 0:a.querySelector(".tooltipCtn");(g==null?void 0:g.innerHTML)!=null&&(h?this.setInnerHtmlAndPattern(g,d,r,l,c,h):this.setInnerHtmlAndPattern(g,d,r,l,c))}setInnerHtmlToAdd(t,e,n){const a=`<span style="font-family: Arial; font-size: 16px">${t[0].split(":")[0]}</span>`;return this.chartType==="RADAR"?this.returnRadarHtml(e,n,a):this.chartType==="DOUGHNUT"?this.returnDoughnutHtml(n,a):this.returnDetailsBarchartHtml(e,n,a)}returnDoughnutHtml(t,e){const n="font-family: Arial; font-size: 16px",s=`<span style="${n}">${e.split("(")[0]}</span>`;let o=`<div style="${n}; display: flex; align-items: center; justify-content: space-between">`;return o+=`<div style="display:flex; align-items: center;" >${t+s}</div>`,o+=`<div style="${n}; margin-left:3rem;">${this.dataToDisplay}</div>`,o+="</div></div>",o}returnRadarHtml(t,e,n){const s="font-family: Arial; font-size: 16px";let o=`<div style="${s}; display: flex; align-items: center;">${e+n}</div>`;return o+="</div>",o+=`<div style="${s}; ${t}; border: none; display:flex; justify-content: space-between;">`,o+=`<div>${this.titleLines[0]}</div>`,o+=`<div style="margin-left: 20px;">${this.dataToDisplay}</div>`,o+="</div>",o+="</div><div>",o}returnDetailsBarchartHtml(t,e,n){const s="font-family: Arial; font-size: 16px";let o=`<div style="${s}; display: flex; align-items: center;">${e+n}</div>`;return o+="</div>",o+=`<div style="${s}; ${t}; display:flex; justify-content: space-between;">`,o+=`<div>${this.xValue}</div>`,o+=`<div style="margin-left: 20px;">${this.titleLines[0]}</div>`,o+="</div>",o+=`<div style="${s}; ${t}; border-: none; display:flex; justify-content: space-between;">`,o+=`<div>${this.yValue}</div>`,o+=`<div style="margin-left: 20px;">${this.dataToDisplay}</div>`,o+="</div>",o}setInnerHtmlAndPattern(t,e,n,s,o=!1,a){t.innerHTML=e;const r=document.querySelector(".legendIcon"),l=new Image;let c;this.chartType==="DOUGHNUT"?c=this.dataIndex+1:c=this.datasetIndex+1;const h=Yh(c,this.patternShifting);if(this.chartType!=="LINE_CHART"&&this.chartType!=="RADAR"&&a!=="line"){const d=s[h-1](!1,n[h-1],o),u=od(d,22,22);l.src=u.toDataURL(),r.style.backgroundImage=`url(${l.src})`}}getBody(t){return t.lines}}var qt=(i=>(i.RADAR="RADAR",i.BAR_CHART="BAR_CHART",i.MIXED_BAR_LINE_CHART="MIXED_BAR_LINE_CHART",i.DETAILS_BAR_CHART="DETAILS_BAR_CHART",i.LINE_CHART="LINE_CHART",i.DOUGHNUT="DOUGHNUT",i))(qt||{});function ad(i,t="#A274FF",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50,a=o*.15;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.006*o,s.rect(.5*o,0,a,a),s.fill(),s.beginPath(),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.006*o,s.rect(.75*o,o/2,a,a),s.fill(),s.beginPath(),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.006*o,s.rect(0,0,a,a),s.fill(),s.beginPath(),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.006*o,s.rect(.25*o,o/2,a,a),s.fill()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const l=document.createElement("canvas").getContext("2d");if(!l)return new CanvasPattern;const c=l.createPattern(n,"repeat");return c||new CanvasPattern}function rd(i,t="#143666",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(-o*.03,-.01*o,o+o/2,.04*o),s.fill(),s.restore(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(.29*o,.33*o,o+o/2,.04*o),s.fill(),s.restore(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(.63*o,.69*o,o+o/2,.04*o),s.fill(),s.restore(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(.33*o,-.37*o,o+o/2,.04*o),s.fill(),s.restore(),s.save(),s.beginPath(),s.transform(.708293,.705919,-.666352,.745637,0,0),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.075*o,s.miterLimit=4,s.rect(.71*o,-.72*o,o+o/2,.04*o),s.fill(),s.restore()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const r=document.createElement("canvas").getContext("2d");if(!r)return new CanvasPattern;const l=r.createPattern(n,"repeat");return l||new CanvasPattern}function ld(i,t="#00A3B2",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=.08*o,s.moveTo(-o/2,o/2),s.lineTo(0,0),s.lineTo(o/2,o/2),s.lineTo(o,0),s.stroke(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=.08*o,s.moveTo(-o/2,o),s.lineTo(0,o/2),s.lineTo(o/2,o),s.lineTo(o,o/2),s.lineTo(o+o/2,o),s.stroke(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=.08*o,s.moveTo(-o/2,111e-6),s.lineTo(4e-6*o,-o/2),s.lineTo(o/2,111e-6),s.lineTo(o,-o/2),s.lineTo(o+o/2,111e-6),s.stroke(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=.08*o,s.moveTo(-o/2,o+o/2),s.lineTo(0,o),s.lineTo(o/2,o+o/2),s.lineTo(o,o),s.lineTo(o+o/2,o+o/2),s.stroke()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const r=document.createElement("canvas").getContext("2d");if(!r)return new CanvasPattern;const l=r.createPattern(n,"repeat");return l||new CanvasPattern}function cd(i,t="#8C1551",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50,a=o*.15;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.3,s.fillStyle=t,s.lineWidth=.005*o,s.rect(0,0,a,o),s.fill(),s.beginPath(),s.globalAlpha=.7,s.fillStyle=t,s.lineWidth=.005*o,s.rect(o/2,0,a,o),s.fill()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const l=document.createElement("canvas").getContext("2d");if(!l)return new CanvasPattern;const c=l.createPattern(n,"repeat");return c?(l.fillStyle=c,l.fillRect(0,0,o,o),c):new CanvasPattern}function hd(i,t="#F255A3",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=new DOMMatrix,a=21,r=.1*a;n.width=a,n.height=a,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,a,a),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.005*a,s.rect(0,0,a,a),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.005*a,s.rect(0,0,a,a),s.fill(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=r,s.moveTo(r,0),s.lineTo(r,.5*a),s.stroke(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=r,s.moveTo(a/2+r,0),s.lineTo(a/2+r,.5*a),s.stroke()),i&&(s.beginPath(),s.fillStyle="#FFFFFF",s.globalAlpha=.5,s.lineWidth=.006*a,s.rect(0,0,a,a),s.fill());const l=document.createElement("canvas"),c=l.getContext("2d");if(!c)return new CanvasPattern;const h=c.createPattern(n,"repeat");return h?(c.fillStyle=h,c.fillRect(0,0,l.width,l.height),h.setTransform(o.rotate(45)),h):new CanvasPattern}function dd(i,t="#095359",e=!1){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return new CanvasPattern;const o=50,a=.04*o;n.width=o,n.height=o,e===!0?(s.beginPath(),s.fillStyle=t,s.rect(0,0,o,o),s.fill()):(s.beginPath(),s.fillStyle="#FFFFFF",s.lineWidth=.1005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.1,s.fillStyle=t,s.lineWidth=.1005*o,s.rect(0,0,o,o),s.fill(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=a,s.arc(a+.06*o,a+.06*o,.06*o,0,2*Math.PI),s.stroke(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=a,s.arc(a+.56*o,a+.06*o,.06*o,0,2*Math.PI),s.stroke(),s.beginPath(),s.globalAlpha=.3,s.strokeStyle=t,s.lineWidth=.04*o,s.arc(-a+.44*o,a+.56*o,.06*o,0,2*Math.PI),s.stroke(),s.beginPath(),s.globalAlpha=.7,s.strokeStyle=t,s.lineWidth=.04*o,s.arc(-a+.94*o,a+.56*o,.06*o,0,2*Math.PI),s.stroke()),i&&(s.beginPath(),s.globalAlpha=.5,s.fillStyle="#FFFFFF",s.lineWidth=.006*o,s.rect(0,0,o,o),s.fill());const r=document.createElement("canvas"),l=r.getContext("2d");if(!l)return new CanvasPattern;const c=l.createPattern(n,"repeat");return c?(l.fillStyle=c,l.fillRect(0,0,r.width,r.height),c):new CanvasPattern}function Le(){return{patternsStandardList:[ad,rd,ld,cd,hd,dd],colourSets:[["#393879","#006974","#405D68","#005C91","#8C3500","#8C0003"],["#A274FF","#143666","#00A3B2","#8C1551","#F255A3","#095359"],["#00A3B2","#143666","#3D993D","#8C1551","#E56D17","#4C3380"],["#8C1551","#E56D17","#4C3380","#4588E5","#095359","#F255A3"],["#4588E5","#4C3380","#E56D17","#143666","#D94141","#8C1551"],["#143666","#F255A3","#095359","#4588E5","#8C1551","#E56D17"],["#A274FF","#B0BBC0","#B0BBC0","#B0BBC0","#B0BBC0","#B0BBC0"]]}}const ud={class:"container"},fd={class:"main"},gd=x.defineComponent({__name:"BarChart",props:{chartId:{type:String,default:"radar-chart"},unit:{type:String,default:"%"},labels:{type:Array,default:()=>[]},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},datasets:{type:Array,default:()=>[]},width:{type:String,default:"400px"},height:{type:String,default:"300px"},cssClasses:{type:String,default:void 0},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]},stacked:{type:Boolean,default:!1},disableAccessibility:{type:Boolean,default:!1},tooltipFirstLineLabel:{type:String,default:"content"},tooltipSecondLineLabel:{type:String,default:"content2"}},setup(i){const t=i;Pt.register(ve,ke,_e,xe,we,Ce);const{colourSets:e,patternsStandardList:n}=Le(),s=x.ref(null),o=x.ref(!1),a=x.computed(()=>t.newPatternsOrder.length!==n.length?e[t.colourSet]:t.newPatternsOrder.map(P=>e[t.colourSet][P])),r=x.computed(()=>t.newPatternsOrder.length!==n.length?n:t.newPatternsOrder.map(P=>n[P])),l=x.computed(()=>t.disableAccessibility),{onHoverIndex:c,barChartRef:h,reloadChart:d,getOnHoverOptions:u,getStackedDatasets:f,privateGetHtmlLegendPlugin:m}=sd(),g=x.computed(()=>{const P=w(_.value);return y(),{labels:P,datasets:f(t.datasets.map((A,D)=>({data:S(D,_.value),label:t.datasets[D].label})),t.stacked,t.disableAccessibility,a.value,r.value,0)}});let p,b;const y=()=>{p=t.tooltipFirstLineLabel,b=t.tooltipSecondLineLabel},_=x.computed(()=>{const P=t.labels;if(P.includes("other")){const A=P.indexOf("other");if(t.datasets[0].data[A].rate+""=="0"&&t.datasets[1].data[A].rate+""=="0")return A}return null}),S=(P,A,D=!1)=>{const L=Object.assign([],t.datasets[P].data);return A&&_.value&&L.splice(_.value,1),L.map(z=>t.unit==="%"?z.rate:z.amount)},v=P=>{const A=P.tooltip.dataPoints[0].datasetIndex,D=P.tooltip.dataPoints[0].dataIndex,L=P.tooltip.body[0].lines[0].split(":")[1],z=t.datasets[A].data[D],Z=z.rate?parseFloat(L.replace(",",".")).toFixed(2)+"% ":"",I=z.amountUnit?z.amountUnit:"",E=z.amount?ot(z.amount):"";return Z+(Z&&E?"/ ":"")+E+I},w=P=>{const A=Object.assign([],t.labels);return P&&A.splice(P,1),A.map(D=>D)},k=x.computed(()=>({onHover:u(),elements:{bar:{borderSkipped:!1}},plugins:{responsive:!0,maintainAspectRatio:!1,legend:{display:!1},title:{display:!1},tooltip:{enabled:!1,position:"nearest",external:function(P){new De().createTooltip(P,v,{chartType:qt.BAR_CHART,firstLineLabel:p,secondLineLabel:b},a.value,r.value,t.disableAccessibility)}}},scales:{x:{stacked:t.stacked},y:{stacked:t.stacked,ticks:{callback:function(P){return t.unit==="%"?un(P,t.unit):ot(P)+" "+t.unit}}}}})),M=x.ref(m(s,o,l,a,r));return x.watch(c,()=>{d()},{deep:!0}),(P,A)=>(x.openBlock(),x.createElementBlock("div",ud,[x.createElementVNode("div",fd,[g.value?(x.openBlock(),x.createBlock(x.unref(Eo),{key:0,ref_key:"barChartRef",ref:h,id:i.chartId,data:g.value,options:k.value,plugins:M.value,class:x.normalizeClass(i.cssClasses),style:x.normalizeStyle([{width:i.width,height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","options","plugins","class","style"])):x.createCommentVNode("",!0)]),x.createElementVNode("div",{ref_key:"legendContainer",ref:s},null,512)]))}}),Fd="",Rd="",Te=(i,t)=>{const e=i.__vccOpts||i;for(const[n,s]of t)e[n]=s;return e},ki=Te(gd,[["__scopeId","data-v-fae6dcc9"]]);ki.install=i=>{i.component("BarChart",ki)};function pd(){const i=x.ref(null),t=x.ref(null),e=x.ref(null);function n(h,d,u,f,m,g,p){return Wo(h,d,t,u,f,m,g,p)}function s(h,d,u){return t.value!==null?d.map((f,m)=>t.value===m?f(!1,h[m],u):f(!0,h[m],u)):d.map((f,m)=>f(!1,h[m],u))}function o(h){return t.value!==null?h.map((d,u)=>t.value===u?d:Ae(d,.2)):h}function a(){return(h,d)=>{d[0]!==void 0?t.value=d[0].element.$context.index:t.value=null}}const r=h=>h.charAt(0).toUpperCase()+h.slice(1).toLowerCase();function l(h,d,u,f){let m=h.slice(0),g=d.slice(0);return h.length>u&&(g=c(d,u),m=m.slice(0,u-1),m.push(f)),m.map((p,b)=>`${r(p)} (${ot(g[b].rate)} %)`)}function c(h,d){if(d<1)return h;let u=h.slice(0);return h.length>d&&(u=u.slice(0,d),u[d-1]=h.slice(d).reduce((f,m)=>(f.rate+=m.rate,f.value+=m.value,f),{rate:h[d-1].rate,value:h[d-1].value})),u}return{onHoverIndex:t,privateGetHtmlLegendPlugin:n,getOnHoverOptions:a,groupDataAfterNthValue:c,getDoughnutLabels:l,getBackgroundColor:s,getFormatedText:r,getBorderColor:o,backgroundColor:e,doughnutRef:i}}const md={class:"container"},bd={class:"main"},yd=x.defineComponent({__name:"DoughnutChart",props:{chartId:{type:String,default:"doughnut-chart"},data:{type:Array,default:()=>[]},labels:{type:Array,default:()=>[]},cssClasses:{type:String,default:void 0},disableAccessibility:{type:Boolean,default:!1},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},width:{type:String,default:"400px"},height:{type:String,default:"400px"},maxValues:{type:Number,default:5},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]},othersLabel:{type:String,default:"others"}},setup(i){const t=i;Pt.register(ve,ke,_e,ye);const{colourSets:e,patternsStandardList:n}=Le(),{onHoverIndex:s,doughnutRef:o,getBackgroundColor:a,privateGetHtmlLegendPlugin:r,getOnHoverOptions:l,groupDataAfterNthValue:c,getDoughnutLabels:h,getBorderColor:d}=pd(),u=x.ref(!1),f=x.ref(null),m=x.computed(()=>t.newPatternsOrder.length!==6?e[t.colourSet]:t.newPatternsOrder.map(k=>e[t.colourSet][k])),g=x.computed(()=>t.newPatternsOrder.length!==6?n:t.newPatternsOrder.map(k=>n[k])),p=x.computed(()=>({labels:h(t.labels,t.data,t.maxValues,t.othersLabel),datasets:[{data:c(t.data,t.maxValues).map(k=>k.rate),backgroundColor:a(m.value,g.value,t.disableAccessibility),borderColor:d(m.value)}]})),b=k=>{const M=k.tooltip.dataPoints[0].dataIndex,P=c(t.data,t.maxValues)[M],A=ot(P.rate),D=ot(P.value),L=P.unit||"";return`${D}${L} (${A})%`};function y(){return t.labels.length<=1?0:12}const _=x.computed(()=>{const k=m.value,M=g.value;return{onHover:l(),plugins:{legend:{display:!1,position:"bottom",align:"start",labels:{pointStyle:"rectRounded",usePointStyle:!0}},title:{display:!1},tooltip:{enabled:!1,external:function(P){new De().createTooltip(P,b,{chartType:qt.DOUGHNUT},k,M,v.value)}}},radius:"90%",cutout:"70%",borderWidth:3,spacing:y(),hoverOffset:4}}),S={data:t.data,labels:t.labels},v=x.computed(()=>t.disableAccessibility),w=x.computed(()=>r(f,u,v,m,g,t.maxValues,S));return x.onMounted(()=>{a(m.value,g.value,t.disableAccessibility)}),x.watch(s,(k,M)=>{k!==M&&a(m.value,g.value,t.disableAccessibility)}),x.watch(v,()=>{a(m.value,g.value,t.disableAccessibility)}),(k,M)=>(x.openBlock(),x.createElementBlock("div",md,[x.createElementVNode("div",bd,[p.value?(x.openBlock(),x.createBlock(x.unref(jh),{key:0,ref_key:"doughnutRef",ref:o,id:i.chartId,data:p.value,options:_.value,plugins:w.value,"max-values":i.maxValues,class:x.normalizeClass(i.cssClasses),style:x.normalizeStyle([{width:i.width,height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","options","plugins","max-values","class","style"])):x.createCommentVNode("",!0)]),x.createElementVNode("div",{ref_key:"legendContainer",ref:f},null,512)]))}}),Ed="",wi=Te(yd,[["__scopeId","data-v-9f73f105"]]);wi.install=i=>{i.component("DoughnutChart",wi)};const xd={class:"container"},_d={class:"main"},vd=x.defineComponent({__name:"LineChart",props:{chartId:{type:String,default:"radar-chart"},tooltipFirstLineLabel:{type:String,default:"content"},tooltipSecondLineLabel:{type:String,default:"content2"},width:{type:String,default:"200px"},height:{type:String,default:"400px"},disableAccessibility:{type:Boolean,default:!1},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},lines:{type:Array,default:()=>{}},labels:{type:Array,default:()=>[]},cssClasses:{type:String,default:void 0},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]}},setup(i){const t=i;Pt.register(ve,ke,_e,Xt,ut,we,Ce);const{colourSets:e,patternsStandardList:n}=Le(),s=x.ref(null),o=x.ref(!1),a=x.computed(()=>t.newPatternsOrder.length!==6?e[t.colourSet]:t.newPatternsOrder.map(p=>e[t.colourSet][p])),r=t.newPatternsOrder.length!==6?n:t.newPatternsOrder.map(p=>n[p]),l=p=>{const b=p.tooltip.dataPoints[0].datasetIndex,y=p.tooltip.dataPoints[0].dataIndex,_=t.lines[b].data[y].toFixed(2);return t.lines[b].unit?_+" "+t.lines[b].unit:_},c=x.computed(()=>t.tooltipFirstLineLabel),h=x.computed(()=>t.tooltipSecondLineLabel),d=x.computed(()=>({labels:t.labels.map(p=>p),datasets:[{type:"line",borderColor:a.value[0],pointStyle:"rectRot",pointBackgroundColor:"#FFFFFF",pointRadius:5,label:t.lines[0].label,data:t.lines[0].data,borderWidth:2},{type:"line",borderColor:a.value[1],pointStyle:"circle",pointBackgroundColor:"#FFFFFF",pointRadius:5,label:t.lines[1].label,data:t.lines[1].data,borderWidth:2}]}));function u(p,b){return[{id:"htmlLegend",afterUpdate(y){const _=Si(p,"column");for(_.style.display="flex",_.style.flexDirection="row",_.style.margin="1.375rem 1.0625rem";_.firstChild;)_.firstChild.remove();y.options.plugins.legend.labels.generateLabels(y).forEach(v=>{const w=_i(y,b,v.datasetIndex);let k;b.value?k=f(y,v):k=pn(v),k.style.boxSizing="border-box",w.style.marginRight="10px",w.appendChild(k),w.appendChild(xi(v)),_.appendChild(w)})}}]}function f(p,b){const y=gn(p,b);return y.onclick=_=>{vi(p,b.datasetIndex,o),_.stopPropagation()},y}const m=u(s,o),g=x.computed(()=>({responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1,external:function(p){new De().createTooltip(p,l,{chartType:qt.LINE_CHART,firstLineLabel:c.value,secondLineLabel:h.value},a.value,r,t.disableAccessibility)}}},scales:{x:{offset:!0},y:{type:"linear",display:!0,position:"left",grid:{drawOnChartArea:!0},ticks:{callback:function(p){const b=t.lines[0].unit;return`${ot(p)} ${b||""}`}}}}}));return(p,b)=>(x.openBlock(),x.createElementBlock("div",xd,[x.createElementVNode("div",_d,[d.value?(x.openBlock(),x.createBlock(x.unref($h),{key:0,ref:"lineChartRef",id:i.chartId,data:d.value,options:g.value,plugins:x.unref(m),class:x.normalizeClass(i.cssClasses),style:x.normalizeStyle([{width:i.width,height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","options","plugins","class","style"])):x.createCommentVNode("",!0)]),x.createElementVNode("div",{ref_key:"legendContainer",ref:s},null,512)]))}}),Bd="",Ci=Te(vd,[["__scopeId","data-v-d99146c4"]]);Ci.install=i=>{i.component("LineChart",Ci)};function Sd(i,t){const e=i.ctx,n=i.scales.r,s=i.data.labels;!e||!n||!s||(e.save(),s.forEach((o,a)=>{const r=(n.getIndexAngle(a)-Math.PI/2)%(2*Math.PI),l=n.getPointPositionForValue(a,n.max);e.textAlign=r<=Math.PI/2||r>3*Math.PI/2?"left":"right";let c=r<=Math.PI/2||r>3*Math.PI/2?15:-15,h;r<0||r>Math.PI?h=-15:h=15,r>Math.PI/4&&r<3*Math.PI/4&&(h*=3),(r<-Math.PI/4||r>5*Math.PI/4)&&(h*=3,c=0),(r>11*Math.PI/8||r<-3*Math.PI/8)&&(e.textAlign="center");const d=l.y+h*(o.length-1)/2;e.font="12px Arial",o.forEach((u,f)=>{const m=f===o.length-1?kd(t)[a]:"#000000";e.fillStyle=m;const g=l.x+c,p=d+15*f;e.fillText(u,g,p)})}),e.restore())}const kd=i=>i.datasets[0].areaData.map(t=>{switch(t.color){case"red":return"#C61112";case"green":return"#46A610";default:return"#000000"}});function wd(i,t){if(i.length>7&&i.includes(" ",7)){const n=i.indexOf(" ",7);return[i.substring(0,n),i.substring(n),t]}return[i,t]}const Cd={class:"container"},Md=x.defineComponent({__name:"RadarChart",props:{chartId:{type:String,default:"radar-chart"},height:{type:String,default:"600px"},labels:{type:Array,default:()=>[]},disableAccessibility:{type:Boolean,default:!1},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},datasets:{type:Array,default:()=>[]},cssClasses:{default:"",type:String},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]}},setup(i){const t=i;Pt.register(ve,ke,_e,Pe,ut,Xt,eh);const{colourSets:e,patternsStandardList:n}=Le(),s=x.computed(()=>t.newPatternsOrder.length!==6?e[t.colourSet]:t.newPatternsOrder.map(g=>e[t.colourSet][g])),o=x.computed(()=>t.newPatternsOrder.length!==6?n:t.newPatternsOrder.map(g=>n[g])),a=x.computed(()=>({labels:h(),datasets:[{label:t.datasets[0].label,backgroundColor:Ae(s.value[0],.1),borderColor:s.value[0],pointBackgroundColor:"#FFFFFF",pointBorderColor:s.value[0],pointBorderWidth:2,borderWidth:2,pointHitRadius:55,pointRadius:5,pointHoverBackgroundColor:s.value[0],pointHoverBorderColor:s.value[0],data:t.datasets[0].areaData.map(g=>g.position)},{label:t.datasets[1].label,backgroundColor:Ae(s.value[1],.1),borderColor:s.value[1],pointBackgroundColor:"#FFFFFF",pointBorderColor:s.value[1],pointBorderWidth:2,borderWidth:2,pointHitRadius:55,pointRadius:5,pointStyle:"rectRot",pointHoverBackgroundColor:s.value[1],pointHoverBorderColor:s.value[1],data:t.datasets[1].areaData.map(g=>g.position)}]})),r={onClick:(g,p,b)=>{p[0]&&Uo(b,p[0].datasetIndex,c)},plugins:{htmlLegend:{containerID:"legend-container"},legend:{display:!1},title:{display:!1},tooltip:{enabled:!1,position:"nearest",external:function(g){new De().createTooltip(g,m,{chartType:qt.RADAR},s.value,o.value,t.disableAccessibility)}}},layout:{padding:{left:130,right:95,top:95,bottom:95}},scales:{r:{min:0,max:100,pointLabels:{display:!1,font:{weight:400,family:"Roboto"}},ticks:{display:!1,stepSize:25}}}},l=x.ref(null),c=x.ref(!1),h=()=>t.labels.map((g,p)=>{const b=t.datasets[0].areaData[p].value?`${d(t.datasets[0].areaData[p].value+"")} ${t.datasets[0].areaData[p].unit}`:"No Data";return wd(g,b)}),d=g=>ot(parseFloat(g));function u(g,p){const b=gn(g,p);return b.onclick=y=>{vi(g,p.datasetIndex,c),y.stopPropagation()},b}const f=[{id:"htmlLegend",afterUpdate(g){const p=Si(l,"row");for(;p.firstChild;)p.firstChild.remove();g.options.plugins.legend.labels.generateLabels(g).reverse().forEach(y=>{const _=_i(g,c,y.datasetIndex);let S;_.style.marginRight="0.625rem",c.value?S=u(g,y):S=pn(y,!0),_.appendChild(S),_.appendChild(xi(y)),p.appendChild(_)})}},{id:"radarLabelPlugin",beforeDraw(g){Sd(g,t)}}],m=g=>{const p=g.tooltip.dataPoints[0].datasetIndex,b=g.tooltip.dataPoints[0].dataIndex,y=t.datasets[p];return y.areaData[b].value.toFixed(2)+" "+y.areaData[b].unit};return(g,p)=>(x.openBlock(),x.createElementBlock("div",Cd,[x.createElementVNode("div",{class:"main",style:x.normalizeStyle({height:i.height})},[a.value?(x.openBlock(),x.createBlock(x.unref(Uh),{key:0,id:i.chartId,data:a.value,options:r,plugins:f,class:x.normalizeClass(i.cssClasses),style:x.normalizeStyle([{height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","class","style"])):x.createCommentVNode("",!0)],4),x.createElementVNode("div",{ref_key:"legendContainer",ref:l,class:"legendContainer"},null,512)]))}}),zd="",Mi=Te(Md,[["__scopeId","data-v-a28617e3"]]);Mi.install=i=>{i.component("RadarChart",Mi)};const Yo=Object.freeze(Object.defineProperty({__proto__:null,BarChart:ki,DoughnutChart:wi,LineChart:Ci,RadarChart:Mi},Symbol.toStringTag,{value:"Module"})),{getPatternIndexWithShift:Xo}=bi();function Pd(){const i=x.ref(2),t=x.reactive({dataSetIndex:-1,columnIndex:-1});function e(d,u,f,m,g,p){return[{id:"htmlLegend",afterUpdate(b){const y=Si(d,"column");for(y.style.display="flex",y.style.margin="1.375rem 1.0625rem",y.style.flexDirection="row-reverse",y.style.justifyContent="flex-end";y.firstChild;)y.firstChild.remove();b.options.plugins.legend.labels.generateLabels(b).forEach(S=>{const v=_i(b,u,S.datasetIndex);let w;u.value?w=No(b,S,u,{datasetIndex:-1},m.value):S!=null&&S.lineCap?w=pn(S):w=Ho(S,b,{datasetIndex:-1},m.value,g.value,p.value),w.style.boxSizing="border-box",v.style.marginRight="10px",v.appendChild(w),v.appendChild(xi(S)),y.appendChild(v)})}}]}function n(d,u,f,m,g){return e(d,u,t,f,m,g)}function s(d,u,f,m,g){const p=i.value;return d.map((b,y)=>{const _=b.type==="bar";return{type:b.type,fill:_?null:!1,borderWidth:function(){return u&&_?1:p},borderColor:function(S){return u&&_?"#00000000":_?o(y,S.index,f,g):f[y]},backgroundColor:function(S){return a(y,S.index,u,f,m,g)},yAxisID:_?"A":"B",pointStyle:y%2===0?"rectRot":"circle",data:b.data,label:b.label,pointBackgroundColor:"#FFFFFF",pointRadius:5,order:d.length-y}})}function o(d,u,f,m){const g=Xo(d,m);return r(d,u)?f[g]:Ae(f[g],.2)}function a(d,u,f,m,g,p){const b=Xo(d,p);return r(d,u)?g[b](!1,m[b],f):g[b](!0,m[b],f)}function r(d,u){return l()||c(d,u)||h(d)}function l(){return t.dataSetIndex<0}function c(d,u){return t.dataSetIndex===d&&t.columnIndex===u}function h(d){return t.dataSetIndex===d&&t.columnIndex<0}return{privateGetHtmlLegendPlugin:n,getMixedDatasets:s,getBorderColor:o,getPattern:a,onHoverIndex:t}}const Ad={class:"container"},Dd={class:"main"},Ld=x.defineComponent({__name:"MixedBarLineChart",props:{chartId:{type:String,default:"mixed-bar-line-chart"},unit:{type:String,default:""},labels:{type:Array,default:()=>[]},colourSet:{type:Number,default:0},newPatternsOrder:{type:Array,default:()=>[0,1,2,3,4,5]},barDatasets:{type:Array,default:()=>[]},barUnit:{type:String,default:""},lineDatasets:{type:Array,default:()=>[]},lineUnit:{type:String,default:""},width:{type:String,default:"400px"},height:{type:String,default:"300px"},cssClasses:{type:String,default:void 0},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]},stacked:{type:Boolean,default:!1},disableAccessibility:{type:Boolean,default:!1},tooltipFirstLineLabel:{type:String,default:"content"},tooltipSecondLineLabel:{type:String,default:"content2"},xAxisTitle:{type:String,default:"title 1"},yLeftAxisTitle:{type:String,default:"title 2"},yRightAxisTitle:{type:String,default:"title 3"}},setup(i){const t=i;Pt.register(ve,ke,_e,xe,we,Ce,ut,Xt);const{privateGetHtmlLegendPlugin:e,getMixedDatasets:n}=Pd(),{colourSets:s,patternsStandardList:o}=Le(),a=x.ref(null),r=x.ref(!1),l=x.computed(()=>{let b=[];return t.barDatasets&&(b=b.concat(t.barDatasets)),t.lineDatasets&&(b=b.concat(t.lineDatasets)),b}),c=x.computed(()=>t.newPatternsOrder.length!==o.length?s[t.colourSet]:t.newPatternsOrder.map(b=>s[t.colourSet][b])),h=x.computed(()=>t.newPatternsOrder.length!==o.length?o:t.newPatternsOrder.map(b=>o[b])),d=x.computed(()=>t.disableAccessibility),u=x.computed(()=>({labels:m(),datasets:n(l.value,d.value,c.value,h.value,0)})),f=b=>{const y=b.tooltip.dataPoints[0].datasetIndex,_=b.tooltip.dataPoints[0].dataIndex,S=l.value[y].data[_],v=l.value[y].type==="bar"?t.barUnit:t.lineUnit;return(v==="%"?parseFloat(S.toString().replace(",",".")).toFixed(2):ot(S))+v},m=()=>Object.assign([],t.labels).map(y=>y),g=x.computed(()=>({type:"scatter",responsive:!0,maintainAspectRatio:!0,elements:{bar:{borderSkipped:!1}},plugins:{legend:{display:!1},title:{display:!1},tooltip:{enabled:!1,external:function(b){new De().createTooltip(b,f,{chartType:qt.MIXED_BAR_LINE_CHART,firstLineLabel:t.tooltipFirstLineLabel,secondLineLabel:t.tooltipSecondLineLabel},c.value,h.value,t.disableAccessibility)}}},scales:{x:{offset:!0,title:{display:!0,text:t.xAxisTitle}},A:{type:"linear",display:!0,position:"left",grid:{drawOnChartArea:!0},title:{display:!0,text:t.yLeftAxisTitle},ticks:{callback:function(b){return t.barUnit==="%"?un(b,t.unit):ot(b)+" "+t.barUnit}}},B:{type:"linear",display:!0,position:"right",grid:{drawOnChartArea:!1},title:{display:!0,text:t.yRightAxisTitle},ticks:{callback:function(b){return(t.lineUnit==="%"?un(b,t.unit):ot(b))+" "+t.lineUnit}}}}})),p=x.ref(e(a,r,d,c,h));return(b,y)=>(x.openBlock(),x.createElementBlock("div",Ad,[x.createElementVNode("div",Dd,[u.value?(x.openBlock(),x.createBlock(x.unref(Eo),{key:0,ref:"mixedBarLineChartRef",id:i.chartId,data:u.value,options:g.value,plugins:p.value,class:x.normalizeClass(i.cssClasses),style:x.normalizeStyle([{width:i.width,height:i.height,cursor:"pointer"},i.styles])},null,8,["id","data","options","plugins","class","style"])):x.createCommentVNode("",!0)]),x.createElementVNode("div",{ref_key:"legendContainer",ref:a},null,512)]))}}),Wd="",Hd="",bn=Te(Ld,[["__scopeId","data-v-758cd368"]]);bn.install=i=>{i.component("MixedBarLineChart",bn)};const Td={install:(i,t)=>{Object.keys(Yo).forEach(e=>{i.component(e,Yo[e])})}};X.BarChart=ki,X.DoughnutChart=wi,X.LineChart=Ci,X.MixedBarLineChart=bn,X.RadarChart=Mi,X.default=Td,Object.defineProperties(X,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|