|
1
|
|
-(()=>{"use strict";function t(t){return t+.5|0}const e=(t,e,i)=>Math.max(Math.min(t,i),e);function i(i){return e(t(2.55*i),0,255)}function s(i){return e(t(255*i),0,255)}function n(i){return e(t(i/2.55)/100,0,1)}function o(i){return e(t(100*i),0,100)}const a={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},r=[..."0123456789ABCDEF"],l=t=>r[15&t],h=t=>r[(240&t)>>4]+r[15&t],c=t=>(240&t)>>4==(15&t);const d=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function u(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function f(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function g(t,e,i){const s=u(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function p(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}(e,i,s,h,n),r=60*r+.5),[0|r,l||0,a]}function m(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(s)}function x(t,e,i){return m(u,t,e,i)}function b(t){return(t%360+360)%360}const _={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},y={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let v;const M=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,w=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,k=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function S(t,e,i){if(t){let s=p(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=x(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function P(t,e){return t?Object.assign(e||{},t):t}function D(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=s(t[3]))):(e=P(t,{r:0,g:0,b:0,a:1})).a=s(e.a),e}function C(t){return"r"===t.charAt(0)?function(t){const s=M.exec(t);let n,o,a,r=255;if(s){if(s[7]!==n){const t=+s[7];r=s[8]?i(t):e(255*t,0,255)}return n=+s[1],o=+s[3],a=+s[5],n=255&(s[2]?i(n):e(n,0,255)),o=255&(s[4]?i(o):e(o,0,255)),a=255&(s[6]?i(a):e(a,0,255)),{r:n,g:o,b:a,a:r}}}(t):function(t){const e=d.exec(t);let n,o=255;if(!e)return;e[5]!==n&&(o=e[6]?i(+e[5]):s(+e[5]));const a=b(+e[2]),r=+e[3]/100,l=+e[4]/100;return n="hwb"===e[1]?function(t,e,i){return m(g,t,e,i)}(a,r,l):"hsv"===e[1]?function(t,e,i){return m(f,t,e,i)}(a,r,l):x(a,r,l),{r:n[0],g:n[1],b:n[2],a:o}}(t)}class A{constructor(t){if(t instanceof A)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=D(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*a[s[1]],g:255&17*a[s[2]],b:255&17*a[s[3]],a:5===o?17*a[s[4]]:255}:7!==o&&9!==o||(n={r:a[s[1]]<<4|a[s[2]],g:a[s[3]]<<4|a[s[4]],b:a[s[5]]<<4|a[s[6]],a:9===o?a[s[7]]<<4|a[s[8]]:255})),i=n||function(t){v||(v=function(){const t={},e=Object.keys(y),i=Object.keys(_);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,_[o]);o=parseInt(y[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),v.transparent=[0,0,0,0]);const e=v[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||C(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=P(this._rgb);return t&&(t.a=n(t.a)),t}set rgb(t){this._rgb=D(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${n(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?(t=this._rgb,e=(t=>c(t.r)&&c(t.g)&&c(t.b)&&c(t.a))(t)?l:h,t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0):void 0;var t,e}hslString(){return this._valid?function(t){if(!t)return;const e=p(t),i=e[0],s=o(e[1]),a=o(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${a}%, ${n(t.a)})`:`hsl(${i}, ${s}%, ${a}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,a=2*o-1,r=i.a-s.a,l=((a*r===-1?a:(a+r)/(1+a*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const o=k(n(t.r)),a=k(n(t.g)),r=k(n(t.b));return{r:s(w(o+i*(k(n(e.r))-o))),g:s(w(a+i*(k(n(e.g))-a))),b:s(w(r+i*(k(n(e.b))-r))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new A(this.rgb)}alpha(t){return this._rgb.a=s(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const e=this._rgb,i=t(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=i,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return S(this._rgb,2,t),this}darken(t){return S(this._rgb,2,-t),this}saturate(t){return S(this._rgb,1,t),this}desaturate(t){return S(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=p(t);i[0]=b(i[0]+e),i=x(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function O(){}const T=(()=>{let t=0;return()=>t++})();function L(t){return null==t}function E(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function R(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function I(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function z(t,e){return I(t)?t:e}function F(t,e){return void 0===t?e:t}const V=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function B(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function W(t,e,i,s){let n,o,a;if(E(t))if(o=t.length,s)for(n=o-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;n<o;n++)e.call(i,t[n],n);else if(R(t))for(a=Object.keys(t),o=a.length,n=0;n<o;n++)e.call(i,t[a[n]],a[n])}function N(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function H(t){if(E(t))return t.map(H);if(R(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=H(t[i[n]]);return e}return t}function j(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function $(t,e,i,s){if(!j(t))return;const n=e[t],o=i[t];R(n)&&R(o)?q(n,o,s):e[t]=H(o)}function q(t,e,i){const s=E(e)?e:[e],n=s.length;if(!R(t))return t;const o=(i=i||{}).merger||$;let a;for(let e=0;e<n;++e){if(a=s[e],!R(a))continue;const n=Object.keys(a);for(let e=0,s=n.length;e<s;++e)o(n[e],t,a,i)}return t}function Y(t,e){return q(t,e,{merger:U})}function U(t,e,i){if(!j(t))return;const s=e[t],n=i[t];R(s)&&R(n)?Y(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=H(n))}const X={"":t=>t,x:t=>t.x,y:t=>t.y};function K(t,e){const i=X[e]||(X[e]=function(t){const e=function(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function G(t){return t.charAt(0).toUpperCase()+t.slice(1)}const J=t=>void 0!==t,Q=t=>"function"==typeof t,Z=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},tt=Math.PI,et=2*tt,it=et+tt,st=Number.POSITIVE_INFINITY,nt=tt/180,ot=tt/2,at=tt/4,rt=2*tt/3,lt=Math.log10,ht=Math.sign;function ct(t,e,i){return Math.abs(t-e)<i}function dt(t){const e=Math.round(t);t=ct(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(lt(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function ut(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function ft(t,e,i){let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function gt(t){return t*(tt/180)}function pt(t){return t*(180/tt)}function mt(t){if(!I(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function xt(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*tt&&(o+=et),{angle:o,distance:n}}function bt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _t(t,e){return(t-e+it)%et-tt}function yt(t){return(t%et+et)%et}function vt(t,e,i,s){const n=yt(t),o=yt(e),a=yt(i),r=yt(o-n),l=yt(a-n),h=yt(n-o),c=yt(n-a);return n===o||n===a||s&&o===a||r>l&&h<c}function Mt(t,e,i){return Math.max(e,Math.min(i,t))}function wt(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function kt(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,o=0;for(;n-o>1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const St=(t,e,i,s)=>kt(t,i,s?s=>{const n=t[s][e];return n<i||n===i&&t[s+1][e]===i}:s=>t[s][e]<i),Pt=(t,e,i)=>kt(t,i,s=>t[s][e]>=i),Dt=["push","pop","shift","splice","unshift"];function Ct(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(Dt.forEach(e=>{delete t[e]}),delete t._chartjs)}function At(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Ot="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function Tt(t,e){let i=[],s=!1;return function(...n){i=n,s||(s=!0,Ot.call(window,()=>{s=!1,t.apply(e,i)}))}}const Lt=t=>"start"===t?"left":"end"===t?"right":"center",Et=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function Rt(t,e,i){const s=e.length;let n=0,o=s;if(t._sorted){const{iScale:a,vScale:r,_parsed:l}=t,h=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,c=a.axis,{min:d,max:u,minDefined:f,maxDefined:g}=a.getUserBounds();if(f){if(n=Math.min(St(l,c,d).lo,i?s:St(e,c,a.getPixelForValue(d)).lo),h){const t=l.slice(0,n+1).reverse().findIndex(t=>!L(t[r.axis]));n-=Math.max(0,t)}n=Mt(n,0,s-1)}if(g){let t=Math.max(St(l,a.axis,u,!0).hi+1,i?0:St(e,c,a.getPixelForValue(u),!0).hi+1);if(h){const e=l.slice(t-1).findIndex(t=>!L(t[r.axis]));t+=Math.max(0,e)}o=Mt(t,n,s)-n}else o=s-n}return{start:n,count:o}}function It(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}const zt=t=>0===t||1===t,Ft=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*et/i),Vt=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*et/i)+1,Bt={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*ot),easeOutSine:t=>Math.sin(t*ot),easeInOutSine:t=>-.5*(Math.cos(tt*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>zt(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>zt(t)?t:Ft(t,.075,.3),easeOutElastic:t=>zt(t)?t:Vt(t,.075,.3),easeInOutElastic(t){const e=.1125;return zt(t)?t:t<.5?.5*Ft(2*t,e,.45):.5+.5*Vt(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-Bt.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*Bt.easeInBounce(2*t):.5*Bt.easeOutBounce(2*t-1)+.5};function Wt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Nt(t){return Wt(t)?t:new A(t)}function Ht(t){return Wt(t)?t:new A(t).saturate(.5).darken(.1).hexString()}const jt=["x","y","borderWidth","radius","tension"],$t=["color","borderColor","backgroundColor"],qt=new Map;function Yt(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=qt.get(i);return s||(s=new Intl.NumberFormat(t,e),qt.set(i,s)),s}(e,i).format(t)}const Ut={values:t=>E(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t)),i}(t,i)}const a=lt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Yt(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(lt(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?Ut.numeric.call(this,t,e,i):""}};var Xt={formatters:Ut};const Kt=Object.create(null),Gt=Object.create(null);function Jt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;e<s;++e){const s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function Qt(t,e,i){return"string"==typeof e?q(Jt(t,e),i):q(Jt(t,""),e)}class Zt{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=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>Ht(e.backgroundColor),this.hoverBorderColor=(t,e)=>Ht(e.borderColor),this.hoverColor=(t,e)=>Ht(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Qt(this,t,e)}get(t){return Jt(this,t)}describe(t,e){return Qt(Gt,t,e)}override(t,e){return Qt(Kt,t,e)}route(t,e,i,s){const n=Jt(this,t),o=Jt(this,i),a="_"+e;Object.defineProperties(n,{[a]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=o[s];return R(t)?Object.assign({},e,t):F(t,e)},set(t){this[a]=t}}})}apply(t){t.forEach(t=>t(this))}}var te=new Zt({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:$t},numbers:{type:"number",properties:jt}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",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:Xt.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function ee(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function ie(t,e,i,s){let n=(s=s||{}).data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(n=s.data={},o=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let a=0;const r=i.length;let l,h,c,d,u;for(l=0;l<r;l++)if(d=i[l],null==d||E(d)){if(E(d))for(h=0,c=d.length;h<c;h++)u=d[h],null==u||E(u)||(a=ee(t,n,o,a,u))}else a=ee(t,n,o,a,d);t.restore();const f=o.length/2;if(f>i.length){for(l=0;l<f;l++)delete n[o[l]];o.splice(0,f)}return a}function se(t,e,i){const s=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function ne(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function oe(t,e,i,s){ae(t,e,i,s,null)}function ae(t,e,i,s,n){let o,a,r,l,h,c,d,u;const f=e.pointStyle,g=e.rotation,p=e.radius;let m=(g||0)*nt;if(f&&"object"==typeof f&&(o=f.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,s),t.rotate(m),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),void t.restore();if(!(isNaN(p)||p<=0)){switch(t.beginPath(),f){default:n?t.ellipse(i,s,n/2,p,0,0,et):t.arc(i,s,p,0,et),t.closePath();break;case"triangle":c=n?n/2:p,t.moveTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=rt,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=rt,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),t.closePath();break;case"rectRounded":h=.516*p,l=p-h,a=Math.cos(m+at)*l,d=Math.cos(m+at)*(n?n/2-h:l),r=Math.sin(m+at)*l,u=Math.sin(m+at)*(n?n/2-h:l),t.arc(i-d,s-r,h,m-tt,m-ot),t.arc(i+u,s-a,h,m-ot,m),t.arc(i+d,s+r,h,m,m+ot),t.arc(i-u,s+a,h,m+ot,m+tt),t.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,c=n?n/2:l,t.rect(i-c,s-l,2*c,2*l);break}m+=at;case"rectRot":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+u,s-a),t.lineTo(i+d,s+r),t.lineTo(i-u,s+a),t.closePath();break;case"crossRot":m+=at;case"cross":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"star":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a),m+=at,d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"line":a=n?n/2:Math.cos(m)*p,r=Math.sin(m)*p,t.moveTo(i-a,s-r),t.lineTo(i+a,s+r);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(m)*(n?n/2:p),s+Math.sin(m)*p);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function re(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function le(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function he(t){t.restore()}function ce(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===n!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function de(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function ue(t,e,i,s,n){if(n.strikethrough||n.underline){const o=t.measureText(s),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,h=i+o.actualBoundingBoxDescent,c=n.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(a,c),t.lineTo(r,c),t.stroke()}}function fe(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function ge(t,e,i,s,n,o={}){const a=E(e)?e:[e],r=o.strokeWidth>0&&""!==o.strokeColor;let l,h;for(t.save(),t.font=n.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),L(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,o),l=0;l<a.length;++l)h=a[l],o.backdrop&&fe(t,o.backdrop),r&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),L(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(h,i,s,o.maxWidth)),t.fillText(h,i,s,o.maxWidth),ue(t,i,s,h,o),s+=Number(n.lineHeight);t.restore()}function pe(t,e){const{x:i,y:s,w:n,h:o,radius:a}=e;t.arc(i+a.topLeft,s+a.topLeft,a.topLeft,1.5*tt,tt,!0),t.lineTo(i,s+o-a.bottomLeft),t.arc(i+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,tt,ot,!0),t.lineTo(i+n-a.bottomRight,s+o),t.arc(i+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,ot,0,!0),t.lineTo(i+n,s+a.topRight),t.arc(i+n-a.topRight,s+a.topRight,a.topRight,0,-ot,!0),t.lineTo(i+a.topLeft,s)}const me=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,xe=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function be(t,e){const i=(""+t).match(me);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const _e=t=>+t||0;function ye(t,e){const i={},s=R(e),n=s?Object.keys(e):e,o=R(t)?s?i=>F(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=_e(o(t));return i}function ve(t){return ye(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Me(t){return ye(t,["topLeft","topRight","bottomLeft","bottomRight"])}function we(t){const e=ve(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ke(t,e){t=t||{},e=e||te.font;let i=F(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=F(t.style,e.style);s&&!(""+s).match(xe)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:F(t.family,e.family),lineHeight:be(F(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:F(t.weight,e.weight),string:""};return n.string=function(t){return!t||L(t.size)||L(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(n),n}function Se(t,e,i,s){let n,o,a,r=!0;for(n=0,o=t.length;n<o;++n)if(a=t[n],void 0!==a&&(void 0!==e&&"function"==typeof a&&(a=a(e),r=!1),void 0!==i&&E(a)&&(a=a[i%a.length],r=!1),void 0!==a))return s&&!r&&(s.cacheable=!1),a}function Pe(t,e){return Object.assign(Object.create(t),e)}function De(t,e=[""],i,s,n=()=>t[0]){const o=i||t;void 0===s&&(s=Ve("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:s,_getTarget:n,override:i=>De([i,...t],e,o,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>Le(i,s,()=>function(t,e,i,s){let n;for(const o of e)if(n=Ve(Oe(o,t),i),void 0!==n)return Te(t,n)?ze(i,s,t,n):n}(s,e,t,i)),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>Be(t).includes(e),ownKeys:t=>Be(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function Ce(t,e,i,s){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Ae(t,s),setContext:e=>Ce(t,e,i,s),override:n=>Ce(t.override(n),e,i,s)};return new Proxy(n,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Le(t,e,()=>function(t,e,i){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=t;let r=s[e];return Q(r)&&a.isScriptable(e)&&(r=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||s);return r.delete(t),Te(t,l)&&(l=ze(n._scopes,n,t,l)),l}(e,r,t,i)),E(r)&&r.length&&(r=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=i;if(void 0!==o.index&&s(t))return e[o.index%e.length];if(R(e[0])){const i=e,s=n._scopes.filter(t=>t!==i);e=[];for(const l of i){const i=ze(s,n,t,l);e.push(Ce(i,o,a&&a[t],r))}}return e}(e,r,t,a.isIndexable)),Te(e,r)&&(r=Ce(r,n,o&&o[e],a)),r}(t,e,i)),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Ae(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:Q(i)?i:()=>i,isIndexable:Q(s)?s:()=>s}}const Oe=(t,e)=>t?t+G(e):e,Te=(t,e)=>R(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Le(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const s=i();return t[e]=s,s}function Ee(t,e,i){return Q(t)?t(e,i):t}const Re=(t,e)=>!0===t?e:"string"==typeof t?K(e,t):void 0;function Ie(t,e,i,s,n){for(const o of e){const e=Re(i,o);if(e){t.add(e);const o=Ee(e._fallback,i,n);if(void 0!==o&&o!==i&&o!==s)return o}else if(!1===e&&void 0!==s&&i!==s)return null}return!1}function ze(t,e,i,s){const n=e._rootScopes,o=Ee(e._fallback,i,s),a=[...t,...n],r=new Set;r.add(s);let l=Fe(r,a,i,o||i,s);return null!==l&&(void 0===o||o===i||(l=Fe(r,a,o,l,s),null!==l))&&De(Array.from(r),[""],n,o,()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const n=s[e];return E(n)&&R(i)?i:n||{}}(e,i,s))}function Fe(t,e,i,s,n){for(;i;)i=Ie(t,e,i,s,n);return i}function Ve(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function Be(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter(t=>!t.startsWith("_")))e.add(t);return Array.from(e)}(t._scopes)),e}function We(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],a[r]={r:n.parse(K(c,o),h)};return a}const Ne=Number.EPSILON||1e-14,He=(t,e)=>e<t.length&&!t[e].skip&&t[e],je=t=>"x"===t?"y":"x";function $e(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=bt(o,n),l=bt(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function qe(t,e,i){return Math.max(Math.min(t,i),e)}function Ye(t,e,i,s,n){let o,a,r,l;if(e.spanGaps&&(t=t.filter(t=>!t.skip)),"monotone"===e.cubicInterpolationMode)!function(t,e="x"){const i=je(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,h=He(t,0);for(a=0;a<s;++a)if(r=l,l=h,h=He(t,a+1),l){if(h){const t=h[e]-l[e];n[a]=0!==t?(h[i]-l[i])/t:0}o[a]=r?h?ht(n[a-1])!==ht(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}!function(t,e,i){const s=t.length;let n,o,a,r,l,h=He(t,0);for(let c=0;c<s-1;++c)l=h,h=He(t,c+1),l&&h&&(ct(e[c],0,Ne)?i[c]=i[c+1]=0:(n=i[c]/e[c],o=i[c+1]/e[c],r=Math.pow(n,2)+Math.pow(o,2),r<=9||(a=3/Math.sqrt(r),i[c]=n*a*e[c],i[c+1]=o*a*e[c])))}(t,n,o),function(t,e,i="x"){const s=je(i),n=t.length;let o,a,r,l=He(t,0);for(let h=0;h<n;++h){if(a=r,r=l,l=He(t,h+1),!r)continue;const n=r[i],c=r[s];a&&(o=(n-a[i])/3,r[`cp1${i}`]=n-o,r[`cp1${s}`]=c-o*e[h]),l&&(o=(l[i]-n)/3,r[`cp2${i}`]=n+o,r[`cp2${s}`]=c+o*e[h])}}(t,o,e)}(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=$e(i,r,t[Math.min(o+1,a-(s?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,i=r}e.capBezierPoints&&function(t,e){let i,s,n,o,a,r=re(t[0],e);for(i=0,s=t.length;i<s;++i)a=o,o=r,r=i<s-1&&re(t[i+1],e),o&&(n=t[i],a&&(n.cp1x=qe(n.cp1x,e.left,e.right),n.cp1y=qe(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=qe(n.cp2x,e.left,e.right),n.cp2y=qe(n.cp2y,e.top,e.bottom)))}(t,i)}function Ue(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Xe(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function Ke(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const Ge=t=>t.ownerDocument.defaultView.getComputedStyle(t,null),Je=["top","right","bottom","left"];function Qe(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=Je[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function Ze(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=Ge(i),o="border-box"===n.boxSizing,a=Qe(n,"padding"),r=Qe(n,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let a,r,l=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(n,o,t.target))a=n,r=o;else{const t=e.getBoundingClientRect();a=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const ti=t=>Math.round(10*t)/10;function ei(t,e,i){const s=e||1,n=ti(t.height*s),o=ti(t.width*s);t.height=ti(t.height),t.width=ti(t.width);const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const ii=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Ue()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function si(t,e){const i=function(t,e){return Ge(t).getPropertyValue(e)}(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function ni(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function oi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function ai(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=ni(t,n,i),r=ni(n,o,i),l=ni(o,e,i),h=ni(a,r,i),c=ni(r,l,i);return ni(h,c,i)}function ri(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function li(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function hi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function ci(t){return"angle"===t?{between:vt,compare:_t,normalize:yt}:{between:wt,compare:(t,e)=>t-e,normalize:t=>t}}function di({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function ui(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=ci(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=ci(s),l=e.length;let h,c,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,h=0,c=l;h<c&&a(r(e[d%l][s]),n,o);++h)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:f,style:t.style}}(t,e,i),g=[];let p,m,x,b=!1,_=null;const y=()=>b||l(n,x,p)&&0!==r(n,x),v=()=>!b||0===r(o,p)||l(o,x,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==x&&(b=l(p,n,o),null===_&&y()&&(_=0===r(p,n)?t:i),null!==_&&v()&&(g.push(di({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,x=p));return null!==_&&g.push(di({start:_,end:d,loop:u,count:a,style:f})),g}function fi(t,e){const i=[],s=t.segments;for(let n=0;n<s.length;n++){const o=ui(s[n],t.points,e);o.length&&i.push(...o)}return i}function gi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function pi(t,e){if(!e)return!1;const i=[],s=function(t,e){return Wt(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,s)!==JSON.stringify(e,s)}function mi(t,e,i){return t.options.clip?t[i]:e[i]}function xi(t,e){const i=e._clip;if(i.disabled)return!1;const s=function(t,e){const{xScale:i,yScale:s}=t;return i&&s?{left:mi(i,e,"left"),right:mi(i,e,"right"),top:mi(s,e,"top"),bottom:mi(s,e,"bottom")}:e}(e,t.chartArea);return{left:!1===i.left?0:s.left-(!0===i.left?0:i.left),right:!1===i.right?t.width:s.right+(!0===i.right?0:i.right),top:!1===i.top?0:s.top-(!0===i.top?0:i.top),bottom:!1===i.bottom?t.height:s.bottom+(!0===i.bottom?0:i.bottom)}}class bi{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach(s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Ot.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return 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((t,e)=>Math.max(t,e._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 i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var _i=new bi;const yi="transparent",vi={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Nt(t||yi),n=s.valid&&Nt(e||yi);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class Mi{constructor(t,e,i,s){const n=e[i];s=Se([t.to,s,n,t.from]);const o=Se([t.from,n,s]);this._active=!0,this._fn=t.fn||vi[t.type||typeof o],this._easing=Bt[t.easing]||Bt.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Se([t.to,e,s,t.from]),this._from=Se([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e<i),!this._active)return this._target[s]=a,void this._notify(!0);e<0?this._target[s]=n:(r=e/i%2,r=o&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class wi{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!R(t))return;const e=Object.keys(te.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const n=t[s];if(!R(n))return;const o={};for(const t of e)o[t]=n[t];(E(n.properties)&&n.properties||[s]).forEach(t=>{t!==s&&i.has(t)||i.set(t,o)})})}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(i)return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i;t.options=e}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){const n=t[s[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then(()=>{t.options=i},()=>{}),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(n[l]=c=new Mi(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(_i.add(this._chart,i),!0):void 0}}function ki(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function Si(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n<o;++n)i.push(s[n].index);return i}function Pi(t,e,i,s={}){const n=t.keys,o="single"===s.mode;let a,r,l,h;if(null===e)return;let c=!1;for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===i){if(c=!0,s.all)continue;break}h=t.values[l],I(h)&&(o||0===e||ht(e)===ht(h))&&(e+=h)}return c||s.all?e:0}function Di(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Ci(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function Ai(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function Oi(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:o,[h]:d}=i;u=(i._stacks||(i._stacks={}))[h]=Ci(n,c,o),u[r]=d,u._top=Ai(u,a,!0,s.type),u._bottom=Ai(u,a,!1,s.type),(u._visualValues||(u._visualValues={}))[r]=d}}function Ti(t,e){const i=t.scales;return Object.keys(i).filter(t=>i[t].axis===e).shift()}function Li(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i],void 0!==e[s]._visualValues&&void 0!==e[s]._visualValues[i]&&delete e[s]._visualValues[i]}}}const Ei=t=>"reset"===t||"none"===t,Ri=(t,e)=>e?t:Object.assign({},t);class Ii{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Di(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&&Li(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=F(i.xAxisID,Ti(t,"x")),o=e.yAxisID=F(i.yAxisID,Ti(t,"y")),a=e.rAxisID=F(i.rAxisID,Ti(t,"r")),r=e.indexAxis,l=e.iAxisID=s(r,n,o,a),h=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Ct(this._data,this),t._stacked&&Li(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(R(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:s}=e,n="x"===i.axis?"x":"y",o="x"===s.axis?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,h,c;for(l=0,h=a.length;l<h;++l)c=a[l],r[l]={[n]:c,[o]:t[c]};return r}(e,t)}else if(i!==e){if(i){Ct(i,this);const t=this._cachedMeta;Li(t),t._parsed=[]}e&&Object.isExtensible(e)&&((s=e)._chartjs?s._chartjs.listeners.push(this):(Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),Dt.forEach(t=>{const e="_onData"+G(t),i=s[t];Object.defineProperty(s,t,{configurable:!0,enumerable:!1,value(...t){const n=i.apply(this,t);return s._chartjs.listeners.forEach(i=>{"function"==typeof i[e]&&i[e](...t)}),n}})}))),this._syncList=[],this._data=e}var s}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const n=e._stacked;e._stacked=Di(e.vScale,e),e.stack!==i.stack&&(s=!0,Li(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&(Oi(this,e._parsed),e._stacked=Di(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:n,_stacked:o}=i,a=n.axis;let r,l,h,c=0===t&&e===s.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,h=s;else{h=E(s[t])?this.parseArrayData(i,s,t,e):R(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const n=()=>null===l[a]||d&&l[a]<d[a];for(r=0;r<e;++r)i._parsed[r+t]=l=h[r],c&&(n()&&(c=!1),d=l);i._sorted=c}o&&Oi(this,h)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:o}=t,a=n.axis,r=o.axis,l=n.getLabels(),h=n===o,c=new Array(s);let d,u,f;for(d=0,u=s;d<u;++d)f=d+i,c[d]={[a]:h||n.parse(l[f],f),[r]:o.parse(e[f],f)};return c}parseArrayData(t,e,i,s){const{xScale:n,yScale:o}=t,a=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],a[r]={x:n.parse(c[0],h),y:o.parse(c[1],h)};return a}parseObjectData(t,e,i,s){const{xScale:n,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let h,c,d,u;for(h=0,c=s;h<c;++h)d=h+i,u=e[d],l[h]={x:n.parse(K(u,a),d),y:o.parse(K(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,o=e[t.axis];return Pi({keys:Si(s,!0),values:e._stacks[t.axis]._visualValues},o,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let o=null===n?NaN:n;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,o=Pi(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,o=s.length,a=this._getOtherScale(t),r=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Si(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:c}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(a);let d,u;function f(){u=s[d];const e=u[a.axis];return!I(u[t.axis])||h>e||c<e}for(d=0;d<o&&(f()||(this.updateRangeFromParsed(l,t,u,r),!n));++d);if(n)for(d=o-1;d>=0;--d)if(!f()){this.updateRangeFromParsed(l,t,u,r);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s][t.axis],I(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,s,n;return R(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:!1===t}}(F(this.options.clip,function(t,e,i){if(!1===i)return!1;const s=ki(t,i),n=ki(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,n,a,r),h=a;h<a+r;++h){const e=s[h];e.hidden||(e.active&&l?o.push(e):e.draw(t,n))}for(h=0;h<o.length;++h)o[h].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return Pe(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return Pe(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s="active"===e,n=this._cachedDataOpts,o=t+"-"+e,a=n[o],r=this.enableOptionSharing&&J(i);if(a)return Ri(a,r);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),u=Object.keys(te.elements[t]),f=l.resolveNamedOptions(d,u,()=>this.getContext(i,s,e),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Ri(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const l=new wi(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ei(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){Ei(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ei(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"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,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,o=t+e;let a;const r=t=>{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a<o;++a)n[a]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&Li(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,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 i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function zi(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;e<n;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=At(s.sort((t,e)=>t-e))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(J(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;s<n;++s)o=e.getPixelForValue(i[s]),l();for(a=void 0,s=0,n=e.ticks.length;s<n;++s)o=e.getPixelForTick(s),l();return r}function Fi(t,e,i,s){return E(t)?function(t,e,i,s){const n=i.parse(t[0],s),o=i.parse(t[1],s),a=Math.min(n,o),r=Math.max(n,o);let l=a,h=r;Math.abs(a)>Math.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:o,min:a,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Vi(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let h,c,d,u;for(h=i,c=i+s;h<c;++h)u=e[h],d={},d[n.axis]=r||n.parse(a[h],h),l.push(Fi(u,d,o,h));return l}function Bi(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Wi(t,e,i,s){let n=e.borderSkipped;const o={};if(!n)return void(t.borderSkipped=o);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:r,reverse:l,top:h,bottom:c}=function(t){let e,i,s,n,o;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",o="start"):(n="start",o="end"),{start:i,end:s,reverse:e,top:n,bottom:o}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=h:(i._bottom||0)===s?n=c:(o[Ni(c,a,r,l)]=!0,n=h)),o[Ni(n,a,r,l)]=!0,t.borderSkipped=o}function Ni(t,e,i,s){var n,o,a;return s?(a=i,t=Hi(t=(n=t)===(o=e)?a:n===a?o:n,i,e)):t=Hi(t,e,i),t}function Hi(t,e,i){return"start"===t?e:"end"===t?i:t}function ji(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class $i extends Ii{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data,{labels:{pointStyle:i,textAlign:s,color:n,useBorderRadius:o,borderRadius:a}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((e,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:e,fillStyle:l.backgroundColor,fontColor:n,hidden:!t.getDataVisibility(r),lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:l.borderWidth,strokeStyle:l.borderColor,textAlign:s,pointStyle:i,borderRadius:o&&(a||l.borderRadius),index:r}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,o,a=t=>+i[t];if(R(i[t])){const{key:t="value"}=this._parsing;a=e=>+K(i[e],t)}for(n=t,o=t+e;n<o;++n)s._parsed[n]=a(n)}}_getRotation(){return gt(this.options.rotation-90)}_getCircumference(){return gt(this.options.circumference)}_getRotationExtents(){let t=et,e=-et;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,n=s._getRotation(),o=s._getCircumference();t=Math.min(t,n),e=Math.max(e,n+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,n=s.data,o=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-o)/2,0),r=Math.min((h=a,"string"==typeof(l=this.options.cutout)&&l.endsWith("%")?parseFloat(l)/100:+l/h),1);var l,h;const c=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:p,offsetY:m}=function(t,e,i){let s=1,n=1,o=0,a=0;if(e<et){const r=t,l=r+e,h=Math.cos(r),c=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(t,e,s)=>vt(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>vt(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(ot,c,u),x=g(tt,h,d),b=g(tt+ot,c,u);s=(p-x)/2,n=(m-b)/2,o=-(p+x)/2,a=-(m+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),x=(i.width-o)/f,b=(i.height-o)/g,_=Math.max(Math.min(x,b)/2,0),y=V(this.options.radius,_),v=(y-Math.max(y*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*y,this.offsetY=m*y,s.total=this.calculateTotal(),this.outerRadius=y-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*c,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/et)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,h=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:f,includeOptions:g}=this._getSharedOptions(e,s);let p,m=this._getRotation();for(p=0;p<e;++p)m+=this._circumference(p,n);for(p=e;p<e+i;++p){const e=this._circumference(p,n),i=t[p],o={x:l+this.offsetX,y:h+this.offsetY,startAngle:m,endAngle:m+e,circumference:e,outerRadius:u,innerRadius:d};g&&(o.options=f||this.resolveDataElementOptions(p,i.active?"active":s)),m+=e,this.updateElement(i,p,o,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?et*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=Yt(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s<n;++s)if(i.isDatasetVisible(s)){o=i.getDatasetMeta(s),t=o.data,a=o.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)r=a.resolveDataElementOptions(s),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(F(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class qi extends Ii{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=Yt(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return We.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(s<e.min&&(e.min=s),s>e.max&&(e.max=s))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,h=r.yCenter,c=r.getIndexAngle(0)-.5*tt;let d,u=c;const f=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,s,f);for(d=e;d<e+i;d++){const e=t[d];let i=u,g=u+this._computeAngle(d,s,f),p=o.getDataVisibility(d)?r.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=g,n&&(a.animateScale&&(p=0),a.animateRotate&&(i=g=c));const m={x:l,y:h,innerRadius:0,outerRadius:p,startAngle:i,endAngle:g,options:this.resolveDataElementOptions(d,e.active?"active":s)};this.updateElement(e,d,m,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?gt(this.resolveDataElementOptions(t,e).angle||i):0}}var Yi=Object.freeze({__proto__:null,BarController:class extends Ii{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return Vi(t,e,i,s)}parseArrayData(t,e,i,s){return Vi(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?a:r,h="x"===o.axis?a:r,c=[];let d,u,f,g;for(d=i,u=i+s;d<u;++d)g=e[d],f={},f[n.axis]=n.parse(K(g,l),d),c.push(Fi(K(g,h),f,o,d));return c}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,n=this.getParsed(t),o=n._custom,a=Bi(o)?"["+o.start+", "+o.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const n="reset"===s,{index:o,_cachedMeta:{vScale:a}}=this,r=a.getBasePixel(),l=a.isHorizontal(),h=this._getRuler(),{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,s);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=n||L(e[a.axis])?{base:r,head:r}:this._calculateBarValuePixels(u),f=this._calculateBarIndexPixels(u,h),g=(e._stacks||{})[a.axis],p={horizontal:l,base:i.base,enableBorderRadius:!g||Bi(e._custom)||o===g._top||o===g._bottom,x:l?i.head:f.center,y:l?f.center:i.head,height:l?f.size:Math.abs(i.size),width:l?Math.abs(i.size):f.size};d&&(p.options=c||this.resolveDataElementOptions(u,t[u].active?"active":s));const m=p.options||t[u].options;Wi(p,m,g,o),ji(p,m,h.ratio),this.updateElement(t[u],u,p,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(t=>t.controller.options.grouped),n=i.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(e),r=a&&a[i.axis],l=t=>{const e=t._parsed.find(t=>t[i.axis]===r),s=e&&e[t.vScale.axis];if(L(s)||isNaN(s))return!0};for(const i of s)if((void 0===e||!l(i))&&((!1===n||-1===o.indexOf(i.stack)||void 0===n&&void 0===i.stack)&&o.push(i.stack),i.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[F("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n<o;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const a=t.barThickness;return{min:a||zi(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:n,minBarLength:o}}=this,a=n||0,r=this.getParsed(t),l=r._custom,h=Bi(l);let c,d,u=r[e.axis],f=0,g=i?this.applyStack(e,r,i):u;g!==u&&(f=g-u,g=u),h&&(u=l.barStart,g=l.barEnd-l.barStart,0!==u&&ht(u)!==ht(l.barEnd)&&(f=0),f+=u);const p=L(n)||h?f:n;let m=e.getPixelForValue(p);if(c=this.chart.getDataVisibility(t)?e.getPixelForValue(f+g):m,d=c-m,Math.abs(d)<o){d=function(t,e,i){return 0!==t?ht(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,a)*o,u===a&&(m-=d/2);const t=e.getPixelForDecimal(0),n=e.getPixelForDecimal(1),l=Math.min(t,n),f=Math.max(t,n);m=Math.max(Math.min(m,f),l),c=m+d,i&&!h&&(r._stacks[e.axis]._visualValues[s]=e.getValueForPixel(c)-e.getValueForPixel(m))}if(m===e.getPixelForValue(a)){const t=ht(d)*e.getLineWidthForValue(a)/2;m+=t,d-=t}return{size:d,base:m,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,n=s.skipNull,o=F(s.maxBarThickness,1/0);let a,r;const l=this._getAxisCount();if(e.grouped){const i=n?this._getStackCount(t):e.stackCount,h="flex"===s.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===a&&(a=o-(null===r?e.end-e.start:r-o)),null===r&&(r=o+o-a);const h=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/s,ratio:i.barPercentage,start:h}}(t,e,s,i*l):function(t,e,i,s){const n=i.barThickness;let o,a;return L(n)?(o=e.min*i.categoryPercentage,a=i.barPercentage):(o=n*s,a=1),{chunk:o/s,ratio:a,start:e.pixels[t]-o/2}}(t,e,s,i*l),c="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,d=this._getAxis().indexOf(F(c,this.getFirstScaleIdForIndexAxis())),u=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0)+d;a=h.start+h.chunk*u+h.chunk/2,r=Math.min(o,h.chunk*h.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),r=Math.min(o,e.min*e.ratio);return{base:a-r/2,head:a+r/2,center:a,size:r}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)null===this.getParsed(n)[e.axis]||i[n].hidden||i[n].draw(this._ctx)}},BubbleController:class extends Ii{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const n=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+i).radius;return n}parseArrayData(t,e,i,s){const n=super.parseArrayData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=F(s[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,s){const n=super.parseObjectData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=F(s&&s.r&&+s.r,this.resolveDataElementOptions(t+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y),l=o._custom;return{label:i[t]||"",value:"("+a+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,s),h=o.axis,c=a.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!n&&this.getParsed(d),u={},f=u[h]=n?o.getPixelForDecimal(.5):o.getPixelForValue(i[h]),g=u[c]=n?a.getBasePixel():a.getPixelForValue(i[c]);u.skip=isNaN(f)||isNaN(g),l&&(u.options=r||this.resolveDataElementOptions(d,e.active?"active":s),n&&(u.options.radius=0)),this.updateElement(e,d,u,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const n=s.radius;return"active"!==e&&(s.radius=0),s.radius+=F(i&&i._custom,n),s}},DoughnutController:$i,LineController:class extends Ii{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=Rt(e,s,o);this._drawStart=a,this._drawCount=r,It(e)&&(a=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(s,a,r,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,{sharedOptions:h,includeOptions:c}=this._getSharedOptions(e,s),d=o.axis,u=a.axis,{spanGaps:f,segment:g}=this.options,p=ut(f)?f:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||n||"none"===s,x=e+i,b=t.length;let _=e>0&&this.getParsed(e-1);for(let i=0;i<b;++i){const f=t[i],b=m?f:{};if(i<e||i>=x){b.skip=!0;continue}const y=this.getParsed(i),v=L(y[u]),M=b[d]=o.getPixelForValue(y[d],i),w=b[u]=n||v?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,y,r):y[u],i);b.skip=isNaN(M)||isNaN(w)||v,b.stop=i>0&&Math.abs(y[d]-_[d])>p,g&&(b.parsed=y,b.raw=l.data[i]),c&&(b.options=h||this.resolveDataElementOptions(i,f.active?"active":s)),m||this.updateElement(f,i,b,s),_=y}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends $i{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:qi,RadarController:class extends Ii{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return We.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let a=e;a<e+i;a++){const e=t[a],i=this.resolveDataElementOptions(a,e.active?"active":s),r=n.getPointPositionForValue(a,this.getParsed(a).r),l=o?n.xCenter:r.x,h=o?n.yCenter:r.y,c={x:l,y:h,angle:r.angle,skip:isNaN(l)||isNaN(h),options:i};this.updateElement(e,a,c,s)}}},ScatterController:class extends Ii{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y);return{label:i[t]||"",value:"("+a+", "+r+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:n,count:o}=Rt(e,i,s);if(this._drawStart=n,this._drawCount=o,It(e)&&(n=0,o=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:n,_dataset:o}=e;n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=i;const a=this.resolveDatasetElementOptions(t);a.segment=this.options.segment,this.updateElement(n,void 0,{animated:!s,options:a},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,h=this.resolveDataElementOptions(e,s),c=this.getSharedOptions(h),d=this.includeOptions(s,c),u=o.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=ut(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||n||"none"===s;let b=e>0&&this.getParsed(e-1);for(let h=e;h<e+i;++h){const e=t[h],i=this.getParsed(h),g=x?e:{},_=L(i[f]),y=g[u]=o.getPixelForValue(i[u],h),v=g[f]=n||_?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,i,r):i[f],h);g.skip=isNaN(y)||isNaN(v)||_,g.stop=h>0&&Math.abs(i[u]-b[u])>m,p&&(g.parsed=i,g.raw=l.data[h]),d&&(g.options=c||this.resolveDataElementOptions(h,e.active?"active":s)),x||this.updateElement(e,h,g,s),b=i}this.updateSharedOptions(c,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}}});function Ui(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Xi{static override(t){Object.assign(Xi.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Ui()}parse(){return Ui()}format(){return Ui()}add(){return Ui()}diff(){return Ui()}startOf(){return Ui()}endOf(){return Ui()}}var Ki=Xi;function Gi(t,e,i,s){const{controller:n,data:o,_sorted:a}=t,r=n._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(r&&e===r.axis&&"r"!==e&&a&&o.length){const a=r._reversePixels?Pt:St;if(!s){const s=a(o,e,i);if(l){const{vScale:e}=n._cachedMeta,{_parsed:i}=t,o=i.slice(0,s.lo+1).reverse().findIndex(t=>!L(t[e.axis]));s.lo-=Math.max(0,o);const a=i.slice(s.hi).findIndex(t=>!L(t[e.axis]));s.hi+=Math.max(0,a)}return s}if(n._sharedOptions){const t=o[0],s="function"==typeof t.getRange&&t.getRange(e);if(s){const t=a(o,e,i-s),n=a(o,e,i+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:o.length-1}}function Ji(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t<i;++t){const{index:i,data:r}=o[t],{lo:l,hi:h}=Gi(o[t],e,a,n);for(let t=l;t<=h;++t){const e=r[t];e.skip||s(e,i,t)}}}function Qi(t,e,i,s,n){const o=[];return n||t.isPointInArea(e)?(Ji(t,i,e,function(i,a,r){(n||re(i,t.chartArea,0))&&i.inRange(e.x,e.y,s)&&o.push({element:i,datasetIndex:a,index:r})},!0),o):o}function Zi(t,e,i,s,n,o){return o||t.isPointInArea(e)?"r"!==i||s?function(t,e,i,s,n,o){let a=[];const r=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const n=e?Math.abs(t.x-s.x):0,o=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2))}}(i);let l=Number.POSITIVE_INFINITY;return Ji(t,i,e,function(i,h,c){const d=i.inRange(e.x,e.y,n);if(s&&!d)return;const u=i.getCenterPoint(n);if(!o&&!t.isPointInArea(u)&&!d)return;const f=r(e,u);f<l?(a=[{element:i,datasetIndex:h,index:c}],l=f):f===l&&a.push({element:i,datasetIndex:h,index:c})}),a}(t,e,i,s,n,o):function(t,e,i,s){let n=[];return Ji(t,i,e,function(t,i,o){const{startAngle:a,endAngle:r}=t.getProps(["startAngle","endAngle"],s),{angle:l}=xt(t,{x:e.x,y:e.y});vt(l,a,r)&&n.push({element:t,datasetIndex:i,index:o})}),n}(t,e,i,n):[]}function ts(t,e,i,s,n){const o=[],a="x"===i?"inXRange":"inYRange";let r=!1;return Ji(t,i,e,(t,s,l)=>{t[a]&&t[a](e[i],n)&&(o.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))}),s&&!r?[]:o}var es={evaluateInteractionItems:Ji,modes:{index(t,e,i,s){const n=Ze(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Qi(t,n,o,s,a):Zi(t,n,o,!1,s,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})}),l):[]},dataset(t,e,i,s){const n=Ze(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Qi(t,n,o,s,a):Zi(t,n,o,!1,s,a);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;t<i.length;++t)r.push({element:i[t],datasetIndex:e,index:t})}return r},point:(t,e,i,s)=>Qi(t,Ze(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=Ze(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return Zi(t,n,o,i.intersect,s,a)},x:(t,e,i,s)=>ts(t,Ze(e,t),"x",i.intersect,s),y:(t,e,i,s)=>ts(t,Ze(e,t),"y",i.intersect,s)}};const is=["left","top","right","bottom"];function ss(t,e){return t.filter(t=>t.pos===e)}function ns(t,e){return t.filter(t=>-1===is.indexOf(t.pos)&&t.box.axis===e)}function os(t,e){return t.sort((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight})}function as(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function rs(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function ls(t,e,i,s){const{pos:n,box:o}=i,a=t.maxPadding;if(!R(n)){i.size&&(t[n]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?o.height:o.width),i.size=e.size/e.count,t[n]+=i.size}o.getPadding&&rs(a,o.getPadding());const r=Math.max(0,e.outerWidth-as(a,t,"left","right")),l=Math.max(0,e.outerHeight-as(a,t,"top","bottom")),h=r!==t.w,c=l!==t.h;return t.w=r,t.h=l,i.horizontal?{same:h,other:c}:{same:c,other:h}}function hs(t,e){const i=e.maxPadding;return function(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{s[t]=Math.max(e[t],i[t])}),s}(t?["left","right"]:["top","bottom"])}function cs(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,hs(r.horizontal,e));const{same:a,other:d}=ls(e,i,r,s);h|=a&&n.length,c=c||d,l.fullSize||n.push(r)}return h&&cs(n,e,i,s)||c}function ds(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function us(t,e,i,s){const n=i.padding;let{x:o,y:a}=e;for(const r of t){const t=r.box,l=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/l.weight||1;if(r.horizontal){const s=e.w*h,o=l.size||t.height;J(l.start)&&(a=l.start),t.fullSize?ds(t,n.left,a,i.outerWidth-n.right-n.left,o):ds(t,e.left+l.placed,a,s,o),l.start=a,l.placed+=s,a=t.bottom}else{const s=e.h*h,a=l.size||t.width;J(l.start)&&(o=l.start),t.fullSize?ds(t,o,n.top,a,i.outerHeight-n.bottom-n.top):ds(t,o,e.top+l.placed,a,s),l.start=o,l.placed+=s,o=t.right}}e.x=o,e.y=a}var fs={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const n=we(t.options.layout.padding),o=Math.max(e-n.width,0),a=Math.max(i-n.height,0),r=function(t){const e=function(t){const e=[];let i,s,n,o,a,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],({position:o,options:{stack:a,stackWeight:r=1}}=n),e.push({index:i,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return e}(t),i=os(e.filter(t=>t.box.fullSize),!0),s=os(ss(e,"left"),!0),n=os(ss(e,"right")),o=os(ss(e,"top"),!0),a=os(ss(e,"bottom")),r=ns(e,"x"),l=ns(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:ss(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;W(t.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});const c=l.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),u=Object.assign({},n);rs(u,we(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=function(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!is.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:a}=r.box,l=i[r.stack],h=l&&r.stackWeight/l.weight;r.horizontal?(r.width=h?h*s:a&&e.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:a&&e.availableHeight)}return i}(l.concat(h),d);cs(r.fullSize,f,d,g),cs(l,f,d,g),cs(h,f,d,g)&&cs(l,f,d,g),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(f),us(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,us(r.rightAndBottom,f,d,g),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},W(r.chartArea,e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class gs{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class ps extends gs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ms="$chartjs",xs={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},bs=t=>null===t||""===t,_s=!!ii&&{passive:!0};function ys(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,_s)}function vs(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function Ms(t,e,i){const s=t.canvas,n=new MutationObserver(t=>{let e=!1;for(const i of t)e=e||vs(i.addedNodes,s),e=e&&!vs(i.removedNodes,s);e&&i()});return n.observe(document,{childList:!0,subtree:!0}),n}function ws(t,e,i){const s=t.canvas,n=new MutationObserver(t=>{let e=!1;for(const i of t)e=e||vs(i.removedNodes,s),e=e&&!vs(i.addedNodes,s);e&&i()});return n.observe(document,{childList:!0,subtree:!0}),n}const ks=new Map;let Ss=0;function Ps(){const t=window.devicePixelRatio;t!==Ss&&(Ss=t,ks.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function Ds(t,e,i){const s=t.canvas,n=s&&Xe(s);if(!n)return;const o=Tt((t,e)=>{const s=n.clientWidth;i(t,e),s<n.clientWidth&&i()},window),a=new ResizeObserver(t=>{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)});return a.observe(n),function(t,e){ks.size||window.addEventListener("resize",Ps),ks.set(t,e)}(t,o),a}function Cs(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){ks.delete(t),ks.size||window.removeEventListener("resize",Ps)}(t)}function As(t,e,i){const s=t.canvas,n=Tt(e=>{null!==t.ctx&&i(function(t,e){const i=xs[t.type]||t.type,{x:s,y:n}=Ze(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))},t);return function(t,e,i){t&&t.addEventListener(e,i,_s)}(s,e,n),n}class Os extends gs{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[ms]={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",bs(n)){const e=si(t,"width");void 0!==e&&(t.width=e)}if(bs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=si(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[ms])return!1;const i=e[ms].initial;["height","width"].forEach(t=>{const s=i[t];L(s)?e.removeAttribute(t):e.setAttribute(t,s)});const s=i.style||{};return Object.keys(s).forEach(t=>{e.style[t]=s[t]}),e.width=e.width,delete e[ms],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:Ms,detach:ws,resize:Ds}[e]||As;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];s&&(({attach:Cs,detach:Cs,resize:Cs}[e]||ys)(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return function(t,e,i,s){const n=Ge(t),o=Qe(n,"margin"),a=Ke(n.maxWidth,t,"clientWidth")||st,r=Ke(n.maxHeight,t,"clientHeight")||st,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=t&&Xe(t);if(o){const t=o.getBoundingClientRect(),a=Ge(o),r=Qe(a,"border","width"),l=Qe(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=Ke(a.maxWidth,o,"clientWidth"),n=Ke(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||st,maxHeight:n||st}}(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=Qe(n,"border","width"),e=Qe(n,"padding");h-=e.width+t.width,c-=e.height+t.height}return h=Math.max(0,h-o.width),c=Math.max(0,s?h/s:c-o.height),h=ti(Math.min(h,a,l.maxWidth)),c=ti(Math.min(c,r,l.maxHeight)),h&&!c&&(c=ti(h/2)),(void 0!==e||void 0!==i)&&s&&l.height&&c>l.height&&(c=l.height,h=ti(Math.floor(c*s))),{width:h,height:c}}(t,e,i,s)}isAttached(t){const e=t&&Xe(t);return!(!e||!e.isConnected)}}class Ts{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return ut(this.x)&&ut(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),s}}function Ls(t,e,i,s,n){const o=F(s,0),a=Math.min(F(n,t.length),t.length);let r,l,h,c=0;for(i=Math.ceil(i),n&&(r=n-s,i=r/Math.floor(r/i)),h=o;h<0;)c++,h=Math.round(o+c*i);for(l=Math.max(o,0);l<a;l++)l===h&&(e.push(t[l]),c++,h=Math.round(o+c*i))}const Es=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,Rs=(t,e)=>Math.min(e||t,t);function Is(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;o<n;o+=s)i.push(t[Math.floor(o)]);return i}function zs(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l,h=t.getPixelForTick(n);if(!(i&&(l=1===s?Math.max(h-o,a-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(n-1))/2,h+=n<e?l:-l,h<o-r||h>a+r)))return h}function Fs(t){return t.drawTicks?t.tickLength:0}function Vs(t,e){if(!t.display)return 0;const i=ke(t.font,e),s=we(t.padding);return(E(t.text)?t.text.length:1)*i.lineHeight+s.height}function Bs(t,e,i){let s=Lt(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class Ws extends Ts{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=z(t,Number.POSITIVE_INFINITY),e=z(e,Number.NEGATIVE_INFINITY),i=z(i,Number.POSITIVE_INFINITY),s=z(s,Number.NEGATIVE_INFINITY),{min:z(t,i),max:z(e,s),minDefined:I(t),maxDefined:I(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;r<l;++r)e=a[r].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),o||(s=Math.max(s,e.max));return i=o&&i>s?s:i,s=n&&i>s?i:s,{min:z(i,z(s,i)),max:z(s,z(i,s))}}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,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:s,max:n}=t,o=V(e,(n-s)/2),a=(t,e)=>i&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a<this.ticks.length;this._convertTicksToLabels(r?Is(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(this.ticks=function(t,e){const i=t.options.ticks,s=function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),n=Math.min(i.maxTicksLimit||s,s),o=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}(e):[],a=o.length,r=o[0],l=o[a-1],h=[];if(a>n)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===a&&(e.push(t[n]),o++,a=i[o*s])}(e,h,o,a/n),h;const c=function(t,e,i){const s=function(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),n=e.length/i;if(!s)return Math.max(n,1);const o=function(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s===0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort((t,e)=>t-e).pop(),e}(s);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>n)return e}return Math.max(n,1)}(o,e,n);if(a>0){let t,i;const s=a>1?Math.round((l-r)/(a-1)):null;for(Ls(e,h,c,L(s)?0:r-s,r),t=0,i=a-1;t<i;t++)Ls(e,h,c,o[t],o[t+1]);return Ls(e,h,c,l,L(s)?e.length:l+s),h}return Ls(e,h,c),h}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,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 i,s,n;for(i=0,s=t.length;i<s;i++)n=t[i],n.label=B(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){B(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){B(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=Rs(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,n=e.maxRotation;let o,a,r,l=s;if(!this._isVisible()||!e.display||s>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Mt(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-Fs(t.grid)-e.padding-Vs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=pt(Math.min(Math.asin(Mt((h.highest.height+6)/o,-1,1)),Math.asin(Mt(a/r,-1,1))-Math.asin(Mt(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){B(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){B(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Vs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Fs(n)+o):(t.height=this.maxHeight,t.width=Fs(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,l=gt(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*n.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_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"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)L(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Is(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:n}=this,o=[],a=[],r=Math.floor(e/Rs(e,i));let l,h,c,d,u,f,g,p,m,x,b,_=0,y=0;for(l=0;l<e;l+=r){if(d=t[l].label,u=this._resolveTickFontOptions(l),s.font=f=u.string,g=n[f]=n[f]||{data:{},gc:[]},p=u.lineHeight,m=x=0,L(d)||E(d)){if(E(d))for(h=0,c=d.length;h<c;++h)b=d[h],L(b)||E(b)||(m=ee(s,g.data,g.gc,m,b),x+=p)}else m=ee(s,g.data,g.gc,m,d),x=p;o.push(m),a.push(x),_=Math.max(m,_),y=Math.max(x,y)}!function(t,e){W(t,t=>{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n<s;++n)delete t.data[i[n]];i.splice(0,s)}})}(n,e);const v=o.indexOf(_),M=a.indexOf(y),w=t=>({width:o[t]||0,height:a[t]||0});return{first:w(0),last:w(e-1),widest:w(v),highest:w(M),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Mt(this._alignToPixels?se(this.chart,e,0):e,-32768,32767)}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 i=e[t];return i.$context||(i.$context=function(t,e,i){return Pe(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Pe(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=gt(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),n=this._getLabelSizes(),o=t.autoSkipPadding||0,a=n?n.widest.width+o:0,r=n?n.highest.height+o:0;return this.isHorizontal()?r*i>a*s?a/i:r/s:r*s<a*i?r/i:a/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:o,border:a}=s,r=n.offset,l=this.isHorizontal(),h=this.ticks.length+(r?1:0),c=Fs(n),d=[],u=a.setContext(this.getContext()),f=u.display?u.width:0,g=f/2,p=function(t){return se(i,t,f)};let m,x,b,_,y,v,M,w,k,S,P,D;if("top"===o)m=p(this.bottom),v=this.bottom-c,w=m-g,S=p(t.top)+g,D=t.bottom;else if("bottom"===o)m=p(this.top),S=t.top,D=p(t.bottom)-g,v=m+g,w=this.top+c;else if("left"===o)m=p(this.right),y=this.right-c,M=m-g,k=p(t.left)+g,P=t.right;else if("right"===o)m=p(this.left),k=t.left,P=p(t.right)-g,y=m+g,M=this.left+c;else if("x"===e){if("center"===o)m=p((t.top+t.bottom)/2+.5);else if(R(o)){const t=Object.keys(o)[0],e=o[t];m=p(this.chart.scales[t].getPixelForValue(e))}S=t.top,D=t.bottom,v=m+g,w=v+c}else if("y"===e){if("center"===o)m=p((t.left+t.right)/2);else if(R(o)){const t=Object.keys(o)[0],e=o[t];m=p(this.chart.scales[t].getPixelForValue(e))}y=m-g,M=y-c,k=t.left,P=t.right}const C=F(s.ticks.maxTicksLimit,h),A=Math.max(1,Math.ceil(h/C));for(x=0;x<h;x+=A){const t=this.getContext(x),e=n.setContext(t),s=a.setContext(t),o=e.lineWidth,h=e.color,c=s.dash||[],u=s.dashOffset,f=e.tickWidth,g=e.tickColor,p=e.tickBorderDash||[],m=e.tickBorderDashOffset;b=zs(this,x,r),void 0!==b&&(_=se(i,b,o),l?y=M=k=P=_:v=w=S=D=_,d.push({tx1:y,ty1:v,tx2:M,ty2:w,x1:k,y1:S,x2:P,y2:D,width:o,color:h,borderDash:c,borderDashOffset:u,tickWidth:f,tickColor:g,tickBorderDash:p,tickBorderDashOffset:m}))}return this._ticksLength=h,this._borderValue=m,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:n}=i,o=this.isHorizontal(),a=this.ticks,{align:r,crossAlign:l,padding:h,mirror:c}=n,d=Fs(i.grid),u=d+h,f=c?-h:u,g=-gt(this.labelRotation),p=[];let m,x,b,_,y,v,M,w,k,S,P,D,C="middle";if("top"===s)v=this.bottom-f,M=this._getXAxisLabelAlignment();else if("bottom"===s)v=this.top+f,M=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(d);M=t.textAlign,y=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(d);M=t.textAlign,y=t.x}else if("x"===e){if("center"===s)v=(t.top+t.bottom)/2+u;else if(R(s)){const t=Object.keys(s)[0],e=s[t];v=this.chart.scales[t].getPixelForValue(e)+u}M=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)y=(t.left+t.right)/2-u;else if(R(s)){const t=Object.keys(s)[0],e=s[t];y=this.chart.scales[t].getPixelForValue(e)}M=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===r?C="top":"end"===r&&(C="bottom"));const A=this._getLabelSizes();for(m=0,x=a.length;m<x;++m){b=a[m],_=b.label;const t=n.setContext(this.getContext(m));w=this.getPixelForTick(m)+n.labelOffset,k=this._resolveTickFontOptions(m),S=k.lineHeight,P=E(_)?_.length:1;const e=P/2,i=t.color,r=t.textStrokeColor,h=t.textStrokeWidth;let d,u=M;if(o?(y=w,"inner"===M&&(u=m===x-1?this.options.reverse?"left":"right":0===m?this.options.reverse?"right":"left":"center"),D="top"===s?"near"===l||0!==g?-P*S+S/2:"center"===l?-A.highest.height/2-e*S+S:-A.highest.height+S/2:"near"===l||0!==g?S/2:"center"===l?A.highest.height/2-e*S:A.highest.height-P*S,c&&(D*=-1),0===g||t.showLabelBackdrop||(y+=S/2*Math.sin(g))):(v=w,D=(1-P)*S/2),t.showLabelBackdrop){const e=we(t.backdropPadding),i=A.heights[m],s=A.widths[m];let n=D-e.top,o=0-e.left;switch(C){case"middle":n-=i/2;break;case"bottom":n-=i}switch(M){case"center":o-=s/2;break;case"right":o-=s;break;case"inner":m===x-1?o-=s:m>0&&(o-=s/2)}d={left:o,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}p.push({label:_,font:k,textOffset:D,options:{rotation:g,color:i,strokeColor:r,strokeWidth:h,textAlign:u,textBaseline:C,translation:[y,v],backdrop:d}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-gt(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:n}}=this.options,o=t+n,a=this._getLabelSizes().widest.width;let r,l;return"left"===e?s?(l=this.right+n,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l+=a)):(l=this.right-o,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l=this.left)):"right"===e?s?(l=this.left+n,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l-=a)):(l=this.left+o,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex(e=>e.value===t);return i>=0?e.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n<o;++n){const t=s[n];e.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&a({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,n=i.setContext(this.getContext()),o=i.display?n.width:0;if(!o)return;const a=s.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let l,h,c,d;this.isHorizontal()?(l=se(t,this.left,o)-o/2,h=se(t,this.right,a)+a/2,c=d=r):(c=se(t,this.top,o)-o/2,d=se(t,this.bottom,a)+a/2,l=h=r),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,c),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&le(e,i);const s=this.getLabelItems(t);for(const t of s){const i=t.options,s=t.font;ge(e,t.label,0,t.textOffset,s,i)}i&&he(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const n=ke(i.font),o=we(i.padding),a=i.align;let r=n.lineHeight/2;"bottom"===e||"center"===e||R(e)?(r+=o.bottom,E(i.text)&&(r+=n.lineHeight*(i.text.length-1))):r+=o.top;const{titleX:l,titleY:h,maxWidth:c,rotation:d}=function(t,e,i,s){const{top:n,left:o,bottom:a,right:r,chart:l}=t,{chartArea:h,scales:c}=l;let d,u,f,g=0;const p=a-n,m=r-o;if(t.isHorizontal()){if(u=Et(s,o,r),R(i)){const t=Object.keys(i)[0],s=i[t];f=c[t].getPixelForValue(s)+p-e}else f="center"===i?(h.bottom+h.top)/2+p-e:Es(t,i,e);d=r-o}else{if(R(i)){const t=Object.keys(i)[0],s=i[t];u=c[t].getPixelForValue(s)-m+e}else u="center"===i?(h.left+h.right)/2-m+e:Es(t,i,e);f=Et(s,a,n),g="left"===i?-ot:ot}return{titleX:u,titleY:f,maxWidth:d,rotation:g}}(this,r,e,a);ge(t,i.text,0,0,n,{color:i.color,maxWidth:c,rotation:d,textAlign:Bs(a,e,s),textBaseline:"middle",translation:[l,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,i=F(t.grid&&t.grid.z,-1),s=F(t.border&&t.border.z,0);return this._isVisible()&&this.draw===Ws.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];o[i]!==this.id||t&&o.type!==t||s.push(o)}return s}_resolveTickFontOptions(t){return ke(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ns{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const s=this.items,n=t.id,o=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,e,i){const s=q(Object.create(null),[i?te.get(i):{},te.get(e),t.defaults]);te.set(e,s),t.defaultRoutes&&function(t,e){Object.keys(e).forEach(i=>{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");te.route(o,n,l,r)})}(e,t.defaultRoutes),t.descriptors&&te.describe(e,t.descriptors)}(t,o,i),this.override&&te.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in te[s]&&(delete te[s][i],this.override&&delete Kt[i])}}class Hs{constructor(){this.controllers=new Ns(Ii,"datasets",!0),this.elements=new Ns(Ts,"elements"),this.plugins=new Ns(Object,"plugins"),this.scales=new Ns(Ws,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):W(e,e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)})})}_exec(t,e,i){const s=G(t);B(i["before"+s],[],i),e[t](i),B(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var js=new Hs;class $s{constructor(){this._init=void 0}notify(t,e,i,s){if("beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),void 0===this._init)return;const n=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),o}_notify(t,e,i,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===B(t[i],[e,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){L(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 i=t&&t.config,s=F(i.options&&i.options.plugins,{}),n=function(t){const e={},i=[],s=Object.keys(js.plugins.items);for(let t=0;t<s.length;t++)i.push(js.getPlugin(s[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const s=n[t];-1===i.indexOf(s)&&(i.push(s),e[s.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==s||e?function(t,{plugins:e,localIds:i},s,n){const o=[],a=t.getContext();for(const r of e){const e=r.id,l=qs(s[e],n);null!==l&&o.push({plugin:r,options:Ys(t.config,{plugin:r,local:i[e]},l,a)})}return o}(t,n,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function qs(t,e){return e||!1!==t?!0===t?{}:t:null}function Ys(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(s,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Us(t,e){const i=te.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Xs(t){if("x"===t||"y"===t||"r"===t)return t}function Ks(t){return"top"===t||"bottom"===t?"x":"left"===t||"right"===t?"y":void 0}function Gs(t,...e){if(Xs(t))return t;for(const i of e){const e=i.axis||Ks(i.position)||t.length>1&&Xs(t[0].toLowerCase());if(e)return e}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Js(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function Qs(t){const e=t.options||(t.options={});e.plugins=F(e.plugins,{}),e.scales=function(t,e){const i=Kt[t.type]||{scales:{}},s=e.scales||{},n=Us(t.type,e),o=Object.create(null);return Object.keys(s).forEach(e=>{const a=s[e];if(!R(a))return console.error(`Invalid scale configuration for scale: ${e}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const r=Gs(e,a,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter(e=>e.xAxisID===t||e.yAxisID===t);if(i.length)return Js(t,"x",i[0])||Js(t,"y",i[0])}return{}}(e,t),te.scales[a.type]),l=function(t,e){return t===e?"_index_":"_value_"}(r,n),h=i.scales||{};o[e]=Y(Object.create(null),[{axis:r},a,h[r],h[l]])}),t.data.datasets.forEach(i=>{const n=i.type||t.type,a=i.indexAxis||Us(n,e),r=(Kt[n]||{}).scales||{};Object.keys(r).forEach(t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,a),n=i[e+"AxisID"]||e;o[n]=o[n]||Object.create(null),Y(o[n],[{axis:e},s[n],r[t]])})}),Object.keys(o).forEach(t=>{const e=o[t];Y(e,[te.scales[e.type],te.scale])}),o}(t,e)}function Zs(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const tn=new Map,en=new Set;function sn(t,e){let i=tn.get(t);return i||(i=e(),tn.set(t,i),en.add(i)),i}const nn=(t,e,i)=>{const s=K(e,i);void 0!==s&&t.add(s)};class on{constructor(t){this._config=function(t){return(t=t||{}).data=Zs(t.data),Qs(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Zs(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(),Qs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return sn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return sn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return sn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id;return sn(`${this.type}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach(e=>{t&&(r.add(t),e.forEach(e=>nn(r,t,e))),e.forEach(t=>nn(r,s,t)),e.forEach(t=>nn(r,Kt[n]||{},t)),e.forEach(t=>nn(r,te,t)),e.forEach(t=>nn(r,Gt,t))});const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),en.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Kt[e]||{},te.datasets[e]||{},{type:e},te,Gt]}resolveNamedOptions(t,e,i,s=[""]){const n={$shared:!0},{resolver:o,subPrefixes:a}=an(this._resolverCache,t,s);let r=o;(function(t,e){const{isScriptable:i,isIndexable:s}=Ae(t);for(const n of e){const e=i(n),o=s(n),a=(o||e)&&t[n];if(e&&(Q(a)||rn(a))||o&&E(a))return!0}return!1})(o,e)&&(n.$shared=!1,r=Ce(o,i=Q(i)?i():i,this.createResolver(t,i,a)));for(const t of e)n[t]=r[t];return n}createResolver(t,e,i=[""],s){const{resolver:n}=an(this._resolverCache,t,i);return R(e)?Ce(n,e,void 0,s):n}}function an(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);return o||(o={resolver:De(e,i),subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},s.set(n,o)),o}const rn=t=>R(t)&&Object.getOwnPropertyNames(t).some(e=>Q(t[e])),ln=["top","bottom","left","right","chartArea"];function hn(t,e){return"top"===t||"bottom"===t||-1===ln.indexOf(t)&&"x"===e}function cn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function dn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),B(i&&i.onComplete,[t],e)}function un(t){const e=t.chart,i=e.options.animation;B(i&&i.onProgress,[t],e)}function fn(t){return Ue()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const gn={},pn=t=>{const e=fn(t);return Object.values(gn).filter(t=>t.canvas===e).pop()};function mn(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class xn{static defaults=te;static instances=gn;static overrides=Kt;static registry=js;static version="4.5.1";static getChart=pn;static register(...t){js.add(...t),bn()}static unregister(...t){js.remove(...t),bn()}constructor(t,e){const i=this.config=new on(e),s=fn(t),n=pn(s);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Ue()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?ps:Os}(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),r=a&&a.canvas,l=r&&r.height,h=r&&r.width;this.id=T(),this.ctx=a,this.canvas=r,this.width=h,this.height=l,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new $s,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}(t=>this.update(t),o.resizeDelay||0),this._dataChanges=[],gn[this.id]=this,a&&r?(_i.listen(this,"complete",dn),_i.listen(this,"progress",un),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:n}=this;return L(t)?e&&n?n:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return js}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ei(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ne(this.canvas,this.ctx),this}stop(){return _i.stop(this),this}resize(t,e){_i.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ei(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),B(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){W(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{});let n=[];e&&(n=n.concat(Object.keys(e).map(t=>{const i=e[t],s=Gs(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}}))),W(n,e=>{const n=e.options,o=n.id,a=Gs(o,n),r=F(n.type,e.dtype);void 0!==n.position&&hn(n.position,a)===hn(e.dposition)||(n.position=e.dposition),s[o]=!0;let l=null;o in i&&i[o].type===r?l=i[o]:(l=new(js.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[l.id]=l),l.init(n,t)}),W(s,(t,e)=>{t||delete i[e]}),W(i,t=>{fs.configure(this,t,t.options),fs.addBox(this,t)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(cn("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const s=e[i];let n=this.getDatasetMeta(i);const o=s.type||this.config.type;if(n.type&&n.type!==o&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=o,n.indexAxis=s.indexAxis||Us(o,this.options),n.order=s.order||0,n.index=i,n.label=""+s.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=js.getController(o),{datasetElementType:s,dataElementType:a}=te.datasets[o];Object.assign(e,{dataElementType:js.getElement(a),datasetElementType:s&&js.getElement(s)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){W(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 i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!s&&-1===n.indexOf(e);e.buildOrUpdateElements(i),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||W(n,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(cn("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){W(this.scales,t=>{fs.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);Z(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e)mn(t,s,"_removeElements"===i?-n:n)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),s=i(0);for(let t=1;t<e;t++)if(!Z(s,i(t)))return;return Array.from(s).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;fs.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],W(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Q(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(_i.has(this)?this.attached&&!_i.running(this)&&_i.start(this):(this.draw(),dn({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))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,i=[];let s,n;for(s=0,n=e.length;s<n;++s){const n=e[s];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))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,i={meta:t,index:t.index,cancelable:!0},s=xi(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(s&&le(e,s),t.controller.draw(),s&&he(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return re(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=es.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(t=>t&&t._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Pe(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);J(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update(e=>e.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(),_i.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(),ne(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete gn[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,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};W(this.options.events,t=>i(t,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){W(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},W(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}});!N(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,B(n.onHover,[t,a,this],this),r&&B(n.onClick,[t,a,this],this));const h=!N(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function bn(){return W(xn.instances,t=>t._plugins.invalidate())}function yn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function vn(t,e,i,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-h,0),u=c>0?c+s+i+h:0;let f=0;const g=n-l;if(s){const t=((c>0?c-s:0)+(d>0?d-s:0))/2;f=(g-(0!==t?g*t/(t+s):g))/2}const p=(g-Math.max(.001,g*d-i/tt)/d)/2,m=l+p+f,x=n-p-f,{outerStart:b,outerEnd:_,innerStart:y,innerEnd:v}=function(t,e,i,s){const n=ye(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return Mt(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Mt(n.innerStart,0,a),innerEnd:Mt(n.innerEnd,0,a)}}(e,u,d,x-m),M=d-b,w=d-_,k=m+b/M,S=x-_/w,P=u+y,D=u+v,C=m+y/P,A=x-v/D;if(t.beginPath(),o){const e=(k+S)/2;if(t.arc(a,r,d,k,e),t.arc(a,r,d,e,S),_>0){const e=yn(w,S,a,r);t.arc(e.x,e.y,_,S,x+ot)}const i=yn(D,x,a,r);if(t.lineTo(i.x,i.y),v>0){const e=yn(D,A,a,r);t.arc(e.x,e.y,v,x+ot,A+Math.PI)}const s=(x-v/u+(m+y/u))/2;if(t.arc(a,r,u,x-v/u,s,!0),t.arc(a,r,u,s,m+y/u,!0),y>0){const e=yn(P,C,a,r);t.arc(e.x,e.y,y,C+Math.PI,m-ot)}const n=yn(M,m,a,r);if(t.lineTo(n.x,n.y),b>0){const e=yn(M,k,a,r);t.arc(e.x,e.y,b,m-ot,k)}}else{t.moveTo(a,r);const e=Math.cos(k)*d+a,i=Math.sin(k)*d+r;t.lineTo(e,i);const s=Math.cos(S)*d+a,n=Math.sin(S)*d+r;t.lineTo(s,n)}t.closePath()}function Mn(t,e,i=e){t.lineCap=F(i.borderCapStyle,e.borderCapStyle),t.setLineDash(F(i.borderDash,e.borderDash)),t.lineDashOffset=F(i.borderDashOffset,e.borderDashOffset),t.lineJoin=F(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=F(i.borderWidth,e.borderWidth),t.strokeStyle=F(i.borderColor,e.borderColor)}function wn(t,e,i){t.lineTo(i.x,i.y)}function kn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,l=Math.max(n,a),h=Math.min(o,r),c=n<a&&o<a||n>r&&o>r;return{count:s,start:l,loop:e.loop,ilen:h<l&&!c?s+h-l:h-l}}function Sn(t,e,i,s){const{points:n,options:o}=e,{count:a,start:r,loop:l,ilen:h}=kn(n,i,s),c=function(t){return t.stepped?ce:t.tension||"monotone"===t.cubicInterpolationMode?de:wn}(o);let d,u,f,{move:g=!0,reverse:p}=s||{};for(d=0;d<=h;++d)u=n[(r+(p?h-d:d))%a],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):c(t,f,u,p,o.stepped),f=u);return l&&(u=n[(r+(p?h:0))%a],c(t,f,u,p,o.stepped)),!!l}function Pn(t,e,i,s){const n=e.points,{count:o,start:a,ilen:r}=kn(n,i,s),{move:l=!0,reverse:h}=s||{};let c,d,u,f,g,p,m=0,x=0;const b=t=>(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[b(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(i<f?f=i:i>g&&(g=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=s,x=0,f=g=i),p=i}_()}function Dn(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?Sn:Pn}const Cn="function"==typeof Path2D;class An extends Ts{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Ye(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,s=t.options.spanGaps,n=i.length;if(!n)return[];const o=!!t._loop,{start:a,end:r}=function(t,e,i,s){let n=0,o=e-1;if(i&&!s)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(o+=n);o>n&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);return function(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const n=t._chart.getContext(),o=gi(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=i.length,h=[];let c=o,d=e[0].start,u=d;function f(t,e,s,n){const o=r?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=o;for(;i[e%l].skip;)e+=o;t%l!==e%l&&(h.push({start:t%l,end:e%l,loop:s,style:n}),c=n,d=e%l)}}for(const t of e){d=r?d:t.start;let e,o=i[d%l];for(u=d+1;u<=t.end;u++){const r=i[u%l];e=gi(s.setContext(Pe(n,{type:"segment",p0:o,p1:r,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),pi(e,c)&&f(d,u-1,t.loop,c),o=r,c=e}d<u-1&&f(d,u-1,t.loop,c)}return h}(t,e,i,s):e}(t,!0===s?[{start:a,end:r,loop:o}]:function(t,e,i,s){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?l.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r<a?r+n:r,!!t._fullLoop&&0===a&&r===n-1),i,e)}(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,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=fi(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?oi:t.tension||"monotone"===t.cubicInterpolationMode?ai:ni}(i);let l,h;for(l=0,h=o.length;l<h;++l){const{start:h,end:c}=o[l],d=n[h],u=n[c];if(d===u){a.push(d);continue}const f=r(d,u,Math.abs((s-d[e])/(u[e]-d[e])),i.stepped);f[e]=t[e],a.push(f)}return 1===a.length?a[0]:a}pathSegment(t,e,i){return Dn(this)(t,this,e,i)}path(t,e,i){const s=this.segments,n=Dn(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)o&=n(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,s){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),function(t,e,i,s){Cn&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),Mn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=Dn(e);for(const r of n)Mn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function On(t,e,i,s){const n=t.options,{[i]:o}=t.getProps([i],s);return Math.abs(e-o)<n.radius+n.hitRadius}function Tn(t,e){const{x:i,y:s,base:n,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,h,c,d;return t.horizontal?(d=a/2,r=Math.min(i,n),l=Math.max(i,n),h=s-d,c=s+d):(d=o/2,r=i-d,l=i+d,h=Math.min(s,n),c=Math.max(s,n)),{left:r,top:h,right:l,bottom:c}}function Ln(t,e,i,s){return t?0:Mt(e,i,s)}function En(t,e,i,s){const n=null===e,o=null===i,a=t&&!(n&&o)&&Tn(t,s);return a&&(n||wt(e,a.left,a.right))&&(o||wt(i,a.top,a.bottom))}function Rn(t,e){t.rect(e.x,e.y,e.w,e.h)}function In(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-s,a=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+o,h:t.h+a,radius:t.radius}}var zn=Object.freeze({__proto__:null,ArcElement:class extends Ts{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:n,distance:o}=xt(s,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:l,outerRadius:h,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,u=F(c,r-a),f=vt(n,a,r)&&a!==r,g=u>=et||f,p=wt(o,l+d,h+d);return g&&p}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(o+a+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>et?Math.floor(i/et):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const r=s*(1-Math.sin(Math.min(tt,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){vn(t,e,i,s,l,n);for(let e=0;e<o;++e)t.fill();isNaN(r)||(l=a+(r%et||et))}vn(t,e,i,s,l,n),t.fill()}(t,this,r,n,o),function(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:h,borderJoinStyle:c,borderDash:d,borderDashOffset:u,borderRadius:f}=l,g="inner"===l.borderAlign;if(!h)return;t.setLineDash(d||[]),t.lineDashOffset=u,g?(t.lineWidth=2*h,t.lineJoin=c||"round"):(t.lineWidth=h,t.lineJoin=c||"bevel");let p=e.endAngle;if(o){vn(t,e,i,s,p,n);for(let e=0;e<o;++e)t.stroke();isNaN(r)||(p=a+(r%et||et))}g&&function(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=e;let h=n/r;t.beginPath(),t.arc(o,a,r,s-h,i+h),l>n?(h=n/l,t.arc(o,a,l,i+h,s-h,!0)):t.arc(o,a,n,i+ot,s-ot),t.closePath(),t.clip()}(t,e,p),l.selfJoin&&p-a>=tt&&0===f&&"miter"!==c&&function(t,e,i){const{startAngle:s,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=e,{borderWidth:h,borderJoinStyle:c}=l,d=Math.min(h/a,yt(s-i));if(t.beginPath(),t.arc(n,o,a-h/2,s+d/2,i-d/2),r>0){const e=Math.min(h/r,yt(s-i));t.arc(n,o,r+h/2,i-e/2,s+e/2,!0)}else{const e=Math.min(h/2,a*yt(s-i));if("round"===c)t.arc(n,o,e,i-tt/2,s+tt/2,!0);else if("bevel"===c){const a=2*e*e,r=-a*Math.cos(i+tt/2)+n,l=-a*Math.sin(i+tt/2)+o,h=a*Math.cos(s+tt/2)+n,c=a*Math.sin(s+tt/2)+o;t.lineTo(r,l),t.lineTo(h,c)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}(t,e,p),o||(vn(t,e,i,s,p,n),t.stroke())}(t,this,r,n,o),t.restore()}},BarElement:class extends Ts{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:n,outer:o}=function(t){const e=Tn(t),i=e.right-e.left,s=e.bottom-e.top,n=function(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,o=ve(s);return{t:Ln(n.top,o.top,0,i),r:Ln(n.right,o.right,0,e),b:Ln(n.bottom,o.bottom,0,i),l:Ln(n.left,o.left,0,e)}}(t,i/2,s/2),o=function(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,o=Me(n),a=Math.min(e,i),r=t.borderSkipped,l=s||R(n);return{topLeft:Ln(!l||r.top||r.left,o.topLeft,0,a),topRight:Ln(!l||r.top||r.right,o.topRight,0,a),bottomLeft:Ln(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:Ln(!l||r.bottom||r.right,o.bottomRight,0,a)}}(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:o},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}(this),a=(r=o.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?pe:Rn;var r;t.save(),o.w===n.w&&o.h===n.h||(t.beginPath(),a(t,In(o,e,n)),t.clip(),a(t,In(n,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,In(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return En(this,t,e,i)}inXRange(t,e){return En(this,t,null,e)}inYRange(t,e){return En(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:An,PointElement:class extends Ts{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return On(this,t,"x",e)}inYRange(t,e){return On(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;return e=Math.max(e,e&&t.hoverRadius||0),2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!re(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,oe(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});const Fn=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Vn=Fn.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function Bn(t){return Fn[t%Fn.length]}function Wn(t){return Vn[t%Vn.length]}function Nn(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var Hn={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:s},options:n}=t.config,{elements:o}=n,a=Nn(s)||(r=n)&&(r.borderColor||r.backgroundColor)||o&&Nn(o)||"rgba(0,0,0,0.1)"!==te.borderColor||"rgba(0,0,0,0.1)"!==te.backgroundColor;var r;if(!i.forceOverride&&a)return;const l=function(t){let e=0;return(i,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof $i?e=function(t,e){return t.backgroundColor=t.data.map(()=>Bn(e++)),e}(i,e):n instanceof qi?e=function(t,e){return t.backgroundColor=t.data.map(()=>Wn(e++)),e}(i,e):n&&(e=function(t,e){return t.borderColor=Bn(e),t.backgroundColor=Wn(e),++e}(i,e))}}(t);s.forEach(l)}};function jn(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function $n(t){t.data.datasets.forEach(t=>{jn(t)})}var qn={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void $n(t);const s=t.width;t.data.datasets.forEach((e,n)=>{const{_data:o,indexAxis:a}=e,r=t.getDatasetMeta(n),l=o||e.data;if("y"===Se([a,t.options.indexAxis]))return;if(!r.controller.supportsDecimation)return;const h=t.scales[r.xAxisID];if("linear"!==h.type&&"time"!==h.type)return;if(t.options.parsing)return;let c,{start:d,count:u}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(n=Mt(St(e,o.axis,a).lo,0,i-1)),s=h?Mt(St(e,o.axis,r).hi+1,n,i)-n:i-n,{start:n,count:s}}(r,l);if(u<=(i.threshold||4*s))jn(e);else{switch(L(o)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":c=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const h=e+i-1;let c,d,u,f,g,p=e;for(a[l++]=t[p],c=0;c<o-2;c++){let s,n=0,o=0;const h=Math.floor((c+1)*r)+1+e,m=Math.min(Math.floor((c+2)*r)+1,i)+e,x=m-h;for(s=h;s<m;s++)n+=t[s].x,o+=t[s].y;n/=x,o/=x;const b=Math.floor(c*r)+1+e,_=Math.min(Math.floor((c+1)*r)+1,i)+e,{x:y,y:v}=t[p];for(u=f=-1,s=b;s<_;s++)f=.5*Math.abs((y-n)*(t[s].y-v)-(y-t[s].x)*(o-v)),f>u&&(u=f,d=t[s],g=s);a[l++]=d,p=g}return a[l++]=t[h],a}(l,d,u,s,i);break;case"min-max":c=function(t,e,i,s){let n,o,a,r,l,h,c,d,u,f,g=0,p=0;const m=[],x=e+i-1,b=t[e].x,_=t[x].x-b;for(n=e;n<e+i;++n){o=t[n],a=(o.x-b)/_*s,r=o.y;const e=0|a;if(e===l)r<u?(u=r,h=n):r>f&&(f=r,c=n),g=(p*g+o.x)/++p;else{const i=n-1;if(!L(h)&&!L(c)){const e=Math.min(h,c),s=Math.max(h,c);e!==d&&e!==i&&m.push({...t[e],x:g}),s!==d&&s!==i&&m.push({...t[s],x:g})}n>0&&i!==d&&m.push(t[i]),m.push(o),l=e,p=0,u=f=r,h=c=d=n}}return m}(l,d,u,s);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=c}})},destroy(t){$n(t)}};function Yn(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=yt(n),o=yt(o)),{property:t,start:n,end:o}}function Un(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function Xn(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function Kn(t,e){let i=[],s=!1;return E(t)?(s=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach(({start:t,end:e})=>{e=Un(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))}),o}(t,e),i.length?new An({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function Gn(t){return t&&!1!==t.fill}function Jn(t,e,i){let s=t[e].fill;const n=[e];let o;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!I(s))return s;if(o=t[s],!o)return!1;if(o.visible)return s;n.push(s),s=o.fill}return!1}function Qn(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=F(i&&i.target,i);return void 0===s&&(s=!!e.backgroundColor),!1!==s&&null!==s&&(!0===s?"origin":s)}(t);if(R(s))return!isNaN(s.value)&&s;let n=parseFloat(s);return I(n)&&Math.floor(n)===n?function(t,e,i,s){return"-"!==t&&"+"!==t||(i=e+i),!(i===e||i<0||i>=s)&&i}(s[0],e,n,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function Zn(t,e,i){const s=[];for(let n=0;n<i.length;n++){const o=i[n],{first:a,last:r,point:l}=to(o,e,"x");if(!(!l||a&&r))if(a)s.unshift(l);else if(t.push(l),!r)break}t.push(...s)}function to(t,e,i){const s=t.interpolate(e,i);if(!s)return{};const n=s[i],o=t.segments,a=t.points;let r=!1,l=!1;for(let t=0;t<o.length;t++){const e=o[t],s=a[e.start][i],h=a[e.end][i];if(wt(n,s,h)){r=n===s,l=n===h;break}}return{first:r,last:l,point:s}}class eo{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:n,radius:o}=this;return e=e||{start:0,end:et},t.arc(s,n,o,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,n=t.angle;return{x:e+Math.cos(n)*s,y:i+Math.sin(n)*s,angle:n}}}function io(t,e,i){const s=function(t){const{chart:e,fill:i,line:s}=t;if(I(i))return function(t,e){const i=t.getDatasetMeta(e);return i&&t.isDatasetVisible(e)?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:s}=t,n=[],o=s.segments,a=s.points,r=function(t,e){const i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t<s.length;t++){const n=s[t];if(n.index===e)break;n.hidden||i.unshift(n.dataset)}return i}(e,i);r.push(Kn({x:null,y:e.bottom},s));for(let t=0;t<o.length;t++){const e=o[t];for(let t=e.start;t<=e.end;t++)Zn(n,a[t],r)}return new An({points:n,options:{}})}(t);if("shape"===i)return!0;const n=function(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:e,fill:i}=t,s=e.options,n=e.getLabels().length,o=s.reverse?e.max:e.min,a=function(t,e,i){let s;return s="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:R(t)?t.value:e.getBaseValue(),s}(i,e,o),r=[];if(s.grid.circular){const t=e.getPointPositionForValue(0,o);return new eo({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(a)})}for(let t=0;t<n;++t)r.push(e.getPointPositionForValue(t,a));return r}(t):function(t){const{scale:e={},fill:i}=t,s=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:R(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(I(s)){const t=e.isHorizontal();return{x:t?s:null,y:t?null:s}}return null}(t)}(t);return n instanceof eo?n:Kn(n,s)}(e),{chart:n,index:o,line:a,scale:r,axis:l}=e,h=a.options,c=h.fill,d=h.backgroundColor,{above:u=d,below:f=d}=c||{},g=n.getDatasetMeta(o),p=xi(n,g);s&&a.points.length&&(le(t,i),function(t,e){const{line:i,target:s,above:n,below:o,area:a,scale:r,clip:l}=e,h=i._loop?"angle":e.axis;t.save();let c=o;o!==n&&("x"===h?(so(t,s,a.top),oo(t,{line:i,target:s,color:n,scale:r,property:h,clip:l}),t.restore(),t.save(),so(t,s,a.bottom)):"y"===h&&(no(t,s,a.left),oo(t,{line:i,target:s,color:o,scale:r,property:h,clip:l}),t.restore(),t.save(),no(t,s,a.right),c=n)),oo(t,{line:i,target:s,color:c,scale:r,property:h,clip:l}),t.restore()}(t,{line:a,target:s,above:u,below:f,area:i,scale:r,axis:l,clip:p}),he(t))}function so(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:l}=r,h=n[s],c=n[Un(s,l,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(h.x,i),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function no(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:l}=r,h=n[s],c=n[Un(s,l,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(i,h.y),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(i,c.y)}t.lineTo(i,e.first().y),t.closePath(),t.clip()}function oo(t,e){const{line:i,target:s,property:n,color:o,scale:a,clip:r}=e,l=function(t,e,i){const s=t.segments,n=t.points,o=e.points,a=[];for(const t of s){let{start:s,end:r}=t;r=Un(s,r,n);const l=Yn(i,n[s],n[r],t.loop);if(!e.segments){a.push({source:t,target:l,start:n[s],end:n[r]});continue}const h=fi(e,l);for(const e of h){const s=Yn(i,o[e.start],o[e.end],e.loop),r=ui(t,n,s);for(const t of r)a.push({source:t,target:e,start:{[i]:Xn(l,s,"start",Math.max)},end:{[i]:Xn(l,s,"end",Math.min)}})}}return a}(i,s,n);for(const{source:e,target:h,start:c,end:d}of l){const{style:{backgroundColor:l=o}={}}=e,u=!0!==s;t.save(),t.fillStyle=l,ao(t,a,r,u&&Yn(n,c,d)),t.beginPath();const f=!!i.pathSegment(t,e);let g;if(u){f?t.closePath():ro(t,s,d,n);const e=!!s.pathSegment(t,h,{move:f,reverse:!0});g=f&&e,g||ro(t,s,c,n)}t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}function ao(t,e,i,s){const n=e.chart.chartArea,{property:o,start:a,end:r}=s||{};if("x"===o||"y"===o){let e,s,l,h;"x"===o?(e=a,s=n.top,l=r,h=n.bottom):(e=n.left,s=a,l=n.right,h=r),t.beginPath(),i&&(e=Math.max(e,i.left),l=Math.min(l,i.right),s=Math.max(s,i.top),h=Math.min(h,i.bottom)),t.rect(e,s,l-e,h-s),t.clip()}}function ro(t,e,i,s){const n=e.interpolate(i,s);n&&t.lineTo(n.x,n.y)}var lo={id:"filler",afterDatasetsUpdate(t,e,i){const s=(t.data.datasets||[]).length,n=[];let o,a,r,l;for(a=0;a<s;++a)o=t.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof An&&(l={visible:t.isDatasetVisible(a),index:a,fill:Qn(r,a,s),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<s;++a)l=n[a],l&&!1!==l.fill&&(l.fill=Jn(n,a,i.propagate))},beforeDraw(t,e,i){const s="beforeDraw"===i.drawTime,n=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&io(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;Gn(i)&&io(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;Gn(s)&&"beforeDatasetDraw"===i.drawTime&&io(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ho=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class co extends Ts{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=B(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,i)=>t.sort(e,i,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=ke(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=ho(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(o,n,a,r)+10):(h=this.maxHeight,l=this._fitCols(o,s,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*a>o)&&(c+=h,l[l.length-(f>0?0:1)]=0,u+=h,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+a}),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=o-t;let c=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach((t,o)=>{const{itemWidth:p,itemHeight:m}=function(t,e,i,s,n){const o=function(t,e,i,s){let n=t.text;return n&&"string"!=typeof n&&(n=n.reduce((t,e)=>t.length>e.length?t:e)),e+i.size/2+s.measureText(n).width}(s,t,e,i),a=function(t,e,i){let s=t;return"string"!=typeof e.text&&(s=uo(e,i)),s}(n,s,e.lineHeight);return{itemWidth:o,itemHeight:a}}(i,e,n,t,s);o>0&&u+m+2*a>h&&(c+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[o]={left:f,top:u,col:g,width:p,height:m},d=Math.max(d,p),u+=m+a}),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=ri(n,this.left,this.width);if(this.isHorizontal()){let n=0,a=Et(i,this.left+s,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,a=Et(i,this.left+s,this.right-this.lineWidths[n])),r.top+=this.top+t+s,r.left=o.leftForLtr(o.x(a),r.width),a+=r.width+s}else{let n=0,a=Et(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,a=Et(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),r.top=a,r.left+=this.left+s,r.left=o.leftForLtr(o.x(r.left),r.width),a+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;le(t,this),this._draw(),he(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,a=te.color,r=ri(t.rtl,this.left,this.width),l=ke(o.font),{padding:h}=o,c=l.size,d=c/2;let u;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:f,boxHeight:g,itemHeight:p}=ho(o,c),m=this.isHorizontal(),x=this._computeTitleHeight();u=m?{x:Et(n,this.left+h,this.right-i[0]),y:this.top+h+x,line:0}:{x:this.left+h,y:Et(n,this.top+x+h,this.bottom-e[0].height),line:0},li(this.ctx,t.textDirection);const b=p+h;this.legendItems.forEach((_,y)=>{s.strokeStyle=_.fontColor,s.fillStyle=_.fontColor;const v=s.measureText(_.text).width,M=r.textAlign(_.textAlign||(_.textAlign=o.textAlign)),w=f+d+v;let k=u.x,S=u.y;if(r.setWidth(this.width),m?y>0&&k+w+h>this.right&&(S=u.y+=b,u.line++,k=u.x=Et(n,this.left+h,this.right-i[u.line])):y>0&&S+b>this.bottom&&(k=u.x=k+e[u.line].width+h,u.line++,S=u.y=Et(n,this.top+x+h,this.bottom-e[u.line].height)),function(t,e,i){if(isNaN(f)||f<=0||isNaN(g)||g<0)return;s.save();const n=F(i.lineWidth,1);if(s.fillStyle=F(i.fillStyle,a),s.lineCap=F(i.lineCap,"butt"),s.lineDashOffset=F(i.lineDashOffset,0),s.lineJoin=F(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=F(i.strokeStyle,a),s.setLineDash(F(i.lineDash,[])),o.usePointStyle){const a={radius:g*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=r.xPlus(t,f/2);ae(s,a,l,e+d,o.pointStyleWidth&&f)}else{const o=e+Math.max((c-g)/2,0),a=r.leftForLtr(t,f),l=Me(i.borderRadius);s.beginPath(),Object.values(l).some(t=>0!==t)?pe(s,{x:a,y:o,w:f,h:g,radius:l}):s.rect(a,o,f,g),s.fill(),0!==n&&s.stroke()}s.restore()}(r.x(k),S,_),k=((t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e)(M,k+f+d,m?k+w:this.right,t.rtl),function(t,e,i){ge(s,i.text,t,e+p/2,l,{strikethrough:i.hidden,textAlign:r.textAlign(i.textAlign)})}(r.x(k),S,_),m)u.x+=w+h;else if("string"!=typeof _.text){const t=l.lineHeight;u.y+=uo(_,t)+h}else u.y+=b}),hi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ke(e.font),s=we(e.padding);if(!e.display)return;const n=ri(t.rtl,this.left,this.width),o=this.ctx,a=e.position,r=i.size/2,l=s.top+r;let h,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,c=Et(t.align,c,this.right-d);else{const e=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);h=l+Et(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=Et(a,c,c+d);o.textAlign=n.textAlign(Lt(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,ge(o,e.text,u,h,i)}_computeTitleHeight(){const t=this.options.title,e=ke(t.font),i=we(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(wt(t,this.left,this.right)&&wt(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(s=n[i],wt(t,s.left,s.left+s.width)&&wt(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){return!("mousemove"!==t&&"mouseout"!==t||!e.onHover&&!e.onLeave)||!(!e.onClick||"click"!==t&&"mouseup"!==t)}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const o=this._hoveredItem,a=(n=i,null!==(s=o)&&null!==n&&s.datasetIndex===n.datasetIndex&&s.index===n.index);o&&!a&&B(e.onLeave,[t,o,this],this),this._hoveredItem=i,i&&!a&&B(e.onHover,[t,i,this],this)}else i&&B(e.onClick,[t,i,this],this);var s,n}}function uo(t,e){return e*(t.text?t.text.length:0)}var fo={id:"legend",_element:co,start(t,e,i){const s=t.legend=new co({ctx:t.ctx,options:i,chart:t});fs.configure(t,s,i),fs.addBox(t,s)},stop(t){fs.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;fs.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,n=i.chart;n.isDatasetVisible(s)?(n.hide(s),e.hidden=!0):(n.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{const l=t.controller.getStyle(i?0:void 0),h=we(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:a&&(r||l.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class go extends Ts{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 i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const s=E(i.text)?i.text.length:1;this._padding=we(i.padding);const n=s*ke(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,a=o.align;let r,l,h,c=0;return this.isHorizontal()?(l=Et(a,i,n),h=e+t,r=n-i):("left"===o.position?(l=i+t,h=Et(a,s,e),c=-.5*tt):(l=n-t,h=Et(a,e,s),c=.5*tt),r=s-e),{titleX:l,titleY:h,maxWidth:r,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=ke(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:a,rotation:r}=this._drawArgs(s);ge(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:r,textAlign:Lt(e.align),textBaseline:"middle",translation:[n,o]})}}var po={id:"title",_element:go,start(t,e,i){!function(t,e){const i=new go({ctx:t.ctx,options:e,chart:t});fs.configure(t,i,e),fs.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;fs.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;fs.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const mo=new WeakMap;var xo={id:"subtitle",start(t,e,i){const s=new go({ctx:t.ctx,options:i,chart:t});fs.configure(t,s,i),fs.addBox(t,s),mo.set(t,s)},stop(t){fs.removeBox(t,mo.get(t)),mo.delete(t)},beforeUpdate(t,e,i){const s=mo.get(t);fs.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const bo={average(t){if(!t.length)return!1;let e,i,s=new Set,n=0,o=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s.add(t.x),n+=t.y,++o}}return 0!==o&&0!==s.size&&{x:[...s].reduce((t,e)=>t+e)/s.size,y:n/o}},nearest(t,e){if(!t.length)return!1;let i,s,n,o=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=bt(e,s.getCenterPoint());t<r&&(r=t,n=s)}}if(n){const t=n.tooltipPosition();o=t.x,a=t.y}return{x:o,y:a}}};function _o(t,e){return e&&(E(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function yo(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function vo(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Mo(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=ke(e.bodyFont),h=ke(e.titleFont),c=ke(e.footerFont),d=o.length,u=n.length,f=s.length,g=we(e.padding);let p=g.height,m=0,x=s.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);x+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),x&&(p+=f*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(x-f)*l.lineHeight+(x-1)*e.bodySpacing),u&&(p+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let b=0;const _=function(t){m=Math.max(m,i.measureText(t).width+b)};return i.save(),i.font=h.string,W(t.title,_),i.font=l.string,W(t.beforeBody.concat(t.afterBody),_),b=e.displayColors?a+2+e.boxPadding:0,W(s,t=>{W(t.before,_),W(t.lines,_),W(t.after,_)}),b=0,i.font=c.string,W(t.footer,_),i.restore(),m+=g.width,{width:m,height:p}}function wo(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=o/2?h="left":n>=a-o/2&&(h="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(h,t,e,i)&&(h="center"),h}function ko(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||wo(t,e,i,s),yAlign:s}}function So(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,h=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=Me(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:Mt(g,0,s.width-e.width),y:Mt(p,0,s.height-e.height)}}function Po(t,e,i){const s=we(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function Do(t){return _o([],yo(t))}function Co(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const Ao={beforeTitle:O,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:O,beforeBody:O,beforeLabel:O,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return L(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.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(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:O,afterBody:O,beforeFooter:O,footer:O,afterFooter:O};function Oo(t,e,i,s){const n=t[e].call(i,s);return void 0===n?Ao[e].call(i,s):n}class To extends Ts{static positioners=bo;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,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new wi(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=Pe(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"}))}getTitle(t,e){const{callbacks:i}=e,s=Oo(i,"beforeTitle",this,t),n=Oo(i,"title",this,t),o=Oo(i,"afterTitle",this,t);let a=[];return a=_o(a,yo(s)),a=_o(a,yo(n)),a=_o(a,yo(o)),a}getBeforeBody(t,e){return Do(Oo(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return W(t,t=>{const e={before:[],lines:[],after:[]},n=Co(i,t);_o(e.before,yo(Oo(n,"beforeLabel",this,t))),_o(e.lines,Oo(n,"label",this,t)),_o(e.after,yo(Oo(n,"afterLabel",this,t))),s.push(e)}),s}getAfterBody(t,e){return Do(Oo(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Oo(i,"beforeFooter",this,t),n=Oo(i,"footer",this,t),o=Oo(i,"afterFooter",this,t);let a=[];return a=_o(a,yo(s)),a=_o(a,yo(n)),a=_o(a,yo(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;a<r;++a)l.push(vo(this.chart,e[a]));return t.filter&&(l=l.filter((e,s,n)=>t.filter(e,s,n,i))),t.itemSort&&(l=l.sort((e,s)=>t.itemSort(e,s,i))),W(l,e=>{const i=Co(t.callbacks,e);s.push(Oo(i,"labelColor",this,e)),n.push(Oo(i,"labelPointStyle",this,e)),o.push(Oo(i,"labelTextColor",this,e))}),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=bo[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Mo(this,i),a=Object.assign({},t,e),r=ko(this.chart,i,a),l=So(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=Me(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,x,b,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,b=_+o,y=_-o):(p=d+f,m=p+o,b=_-o,y=_+o),x=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(b=u,_=b-o,p=m-o,x=m+o):(b=u+g,_=b+o,p=m+o,x=m-o),y=b),{x1:p,x2:m,x3:x,y1:b,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=ri(i.rtl,this.x,this.width);for(t.x=Po(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=ke(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r<n;++r)e.fillText(s[r],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,r+1===n&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,n){const o=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:r,boxWidth:l}=n,h=ke(n.bodyFont),c=Po(this,"left",n),d=s.x(c),u=r<h.lineHeight?(h.lineHeight-r)/2:0,f=e.y+u;if(n.usePointStyle){const e={radius:Math.min(l,r)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},i=s.leftForLtr(d,l)+l/2,h=f+r/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,oe(t,e,i,h),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,oe(t,e,i,h)}else{t.lineWidth=R(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const e=s.leftForLtr(d,l),i=s.leftForLtr(s.xPlus(d,1),l-2),a=Me(o.borderRadius);Object.values(a).some(t=>0!==t)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,pe(t,{x:e,y:f,w:l,h:r,radius:a}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),pe(t,{x:i,y:f+1,w:l-2,h:r-2,radius:a}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,f,l,r),t.strokeRect(e,f,l,r),t.fillStyle=o.backgroundColor,t.fillRect(i,f+1,l-2,r-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=ke(i.bodyFont);let d=c.lineHeight,u=0;const f=ri(i.rtl,this.x,this.width),g=function(i){e.fillText(i,f.x(t.x+u),t.y+d/2),t.y+=d+n},p=f.textAlign(o);let m,x,b,_,y,v,M;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Po(this,p,i),e.fillStyle=i.bodyColor,W(this.beforeBody,g),u=a&&"right"!==p?"center"===o?l/2+h:l+2+h:0,_=0,v=s.length;_<v;++_){for(m=s[_],x=this.labelTextColors[_],e.fillStyle=x,W(m.before,g),b=m.lines,a&&b.length&&(this._drawColorBox(e,t,_,f,i),d=Math.max(c.lineHeight,r)),y=0,M=b.length;y<M;++y)g(b[y]),d=c.lineHeight;W(m.after,g)}u=0,d=c.lineHeight,W(this.afterBody,g),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let o,a;if(n){const r=ri(i.rtl,this.x,this.width);for(t.x=Po(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",o=ke(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<n;++a)e.fillText(s[a],r.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:o}=this,{x:a,y:r}=t,{width:l,height:h}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=Me(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+c,r),"top"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+l-d,r),e.quadraticCurveTo(a+l,r,a+l,r+d),"center"===o&&"right"===n&&this.drawCaret(t,e,i,s),e.lineTo(a+l,r+h-f),e.quadraticCurveTo(a+l,r+h,a+l-f,r+h),"bottom"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+u,r+h),e.quadraticCurveTo(a,r+h,a,r+h-u),"center"===o&&"left"===n&&this.drawCaret(t,e,i,s),e.lineTo(a,r+c),e.quadraticCurveTo(a,r,a+c,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=bo[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Mo(this,t),a=Object.assign({},i,this._size),r=ko(e,t,a),l=So(t,a,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=we(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),li(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),hi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),n=!N(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!N(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=bo[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}var Lo={id:"tooltip",_element:To,positioners:bo,afterInit(t,e,i){i&&(t.tooltip=new To({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Ao},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Eo=Object.freeze({__proto__:null,Colors:Hn,Decimation:qn,Filler:lo,Legend:fo,SubTitle:xo,Title:po,Tooltip:Lo});function Ro(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function Io(t,e,{horizontal:i,minRotation:s}){const n=gt(s),o=(i?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}class zo extends Ws{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 L(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=e?s:t,a=t=>n=i?n:t;if(t){const t=ht(s),e=ht(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=0===n?1:Math.abs(.05*n);a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s=function(t,e){const i=[],{bounds:s,step:n,min:o,max:a,precision:r,count:l,maxTicks:h,maxDigits:c,includeBounds:d}=t,u=n||1,f=h-1,{min:g,max:p}=e,m=!L(o),x=!L(a),b=!L(l),_=(p-g)/(c+1);let y,v,M,w,k=dt((p-g)/f/u)*u;if(k<1e-14&&!m&&!x)return[{value:g},{value:p}];w=Math.ceil(p/k)-Math.floor(g/k),w>f&&(k=dt(w*k/f/u)*u),L(r)||(y=Math.pow(10,r),k=Math.ceil(k*y)/y),"ticks"===s?(v=Math.floor(g/k)*k,M=Math.ceil(p/k)*k):(v=g,M=p),m&&x&&n&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((a-o)/n,k/1e3)?(w=Math.round(Math.min((a-o)/k,h)),k=(a-o)/w,v=o,M=a):b?(v=m?o:v,M=x?a:M,w=l-1,k=(M-v)/w):(w=(M-v)/k,w=ct(w,Math.round(w),k/1e3)?Math.round(w):Math.ceil(w));const S=Math.max(mt(k),mt(v));y=Math.pow(10,L(r)?S:r),v=Math.round(v*y)/y,M=Math.round(M*y)/y;let P=0;for(m&&(d&&v!==o?(i.push({value:o}),v<o&&P++,ct(Math.round((v+P*k)*y)/y,o,Io(o,_,t))&&P++):v<o&&P++);P<w;++P){const t=Math.round((v+P*k)*y)/y;if(x&&t>a)break;i.push({value:t})}return x&&d&&M!==a?i.length&&ct(i[i.length-1].value,a,Io(a,_,t))?i[i.length-1].value=a:i.push({value:a}):x&&M!==a||i.push({value:M}),i}({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&ft(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Yt(t,this.chart.options.locale,this.options.ticks.format)}}class Fo extends zo{static id="linear";static defaults={ticks:{callback:Xt.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=I(t)?t:0,this.max=I(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=gt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Vo=t=>Math.floor(lt(t)),Bo=(t,e)=>Math.pow(10,Vo(t)+e);function Wo(t){return 1===t/Math.pow(10,Vo(t))}function No(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s);return Math.ceil(e/s)-n}class Ho extends Ws{static id="logarithmic";static defaults={ticks:{callback:Xt.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=zo.prototype.parse.apply(this,[t,e]);if(0!==i)return I(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=I(t)?Math.max(0,t):null,this.max=I(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!I(this._userMin)&&(this.min=t===Bo(this.min,0)?Bo(this.min,-1):Bo(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t;i===s&&(i<=0?(n(1),o(10)):(n(Bo(i,-1)),o(Bo(s,1)))),i<=0&&n(Bo(s,-1)),s<=0&&o(Bo(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=function(t,{min:e,max:i}){e=z(t.min,e);const s=[],n=Vo(e);let o=function(t,e){let i=Vo(e-t);for(;No(t,e,i)>10;)i++;for(;No(t,e,i)<10;)i--;return Math.min(i,Vo(t))}(e,i),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,h=Math.round((e-l)*a)/a,c=Math.floor((e-l)/r/10)*r*10;let d=Math.floor((h-c)/Math.pow(10,o)),u=z(t.min,Math.round((l+c+d*Math.pow(10,o))*a)/a);for(;u<i;)s.push({value:u,major:Wo(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+c+d*Math.pow(10,o))*a)/a;const f=z(t.max,u);return s.push({value:f,major:Wo(f),significand:d}),s}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&ft(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":Yt(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=lt(t),this._valueRange=lt(this.max)-lt(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(lt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function jo(t){const e=t.ticks;if(e.display&&t.display){const t=we(e.backdropPadding);return F(e.font&&e.font.size,te.font.size)+t.height}return 0}function $o(t,e,i){return i=E(i)?i:[i],{w:ie(t,e.string,i),h:i.length*e.lineHeight}}function qo(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:t<s||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function Yo(t,e,i,s,n){const o=Math.abs(Math.sin(i)),a=Math.abs(Math.cos(i));let r=0,l=0;s.start<e.l?(r=(e.l-s.start)/o,t.l=Math.min(t.l,e.l-r)):s.end>e.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.start<e.t?(l=(e.t-n.start)/a,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function Uo(t,e,i){const s=t.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=i,l=t.getPointPosition(e,s+n+a,o),h=Math.round(pt(yt(l.angle+ot))),c=function(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}(l.y,r.h,h),d=function(t){return 0===t||180===t?"center":t<180?"left":"right"}(h),u=(f=l.x,g=r.w,"right"===(p=d)?f-=g:"center"===p&&(f-=g/2),f);var f,g,p;return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+r.w,bottom:c+r.h}}function Xo(t,e){if(!e)return!0;const{left:i,top:s,right:n,bottom:o}=t;return!(re({x:i,y:s},e)||re({x:i,y:o},e)||re({x:n,y:s},e)||re({x:n,y:o},e))}function Ko(t,e,i){const{left:s,top:n,right:o,bottom:a}=i,{backdropColor:r}=e;if(!L(r)){const i=Me(e.borderRadius),l=we(e.backdropPadding);t.fillStyle=r;const h=s-l.left,c=n-l.top,d=o-s+l.width,u=a-n+l.height;Object.values(i).some(t=>0!==t)?(t.beginPath(),pe(t,{x:h,y:c,w:d,h:u,radius:i}),t.fill()):t.fillRect(h,c,d,u)}}function Go(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,et);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;o<s;o++)i=t.getPointPosition(o,e),n.lineTo(i.x,i.y)}}class Jo extends zo{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Xt.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=we(jo(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=I(t)&&!isNaN(t)?t:0,this.max=I(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/jo(this.options))}generateTickLabels(t){zo.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{const i=B(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){const t=this.options;t.display&&t.pointLabels.display?function(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],n=[],o=t._pointLabels.length,a=t.options.pointLabels,r=a.centerPointLabels?tt/o:0;for(let l=0;l<o;l++){const o=a.setContext(t.getPointLabelContext(l));n[l]=o.padding;const h=t.getPointPosition(l,t.drawingArea+n[l],r),c=ke(o.font),d=$o(t.ctx,c,t._pointLabels[l]);s[l]=d;const u=yt(t.getIndexAngle(l)+r),f=Math.round(pt(u));Yo(i,e,u,qo(f,h.x,d.w,0,180),qo(f,h.y,d.h,90,270))}t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const s=[],n=t._pointLabels.length,o=t.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:jo(o)/2,additionalAngle:a?tt/n:0};let h;for(let o=0;o<n;o++){l.padding=i[o],l.size=e[o];const n=Uo(t,o,l);s.push(n),"auto"===r&&(n.visible=Xo(n,h),n.visible&&(h=n))}return s}(t,s,n)}(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return yt(t*(et/(this._pointLabels.length||1))+gt(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(L(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(L(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 i=e[t];return function(t,e,i){return Pe(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-ot+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Go(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:n}=e,o=this._pointLabels.length;let a,r,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const o=s.setContext(t.getPointLabelContext(n));Ko(i,o,e);const a=ke(o.font),{x:r,y:l,textAlign:h}=e;ge(i,t._pointLabels[n],r,l+a.lineHeight/2,a,{color:o.color,textAlign:h,textBaseline:"middle"})}}(this,o),s.display&&this.ticks.forEach((t,e)=>{if(0!==e||0===e&&this.min<0){r=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),a=s.setContext(i),l=n.setContext(i);!function(t,e,i,s,n){const o=t.ctx,a=e.circular,{color:r,lineWidth:l}=e;!a&&!s||!r||!l||i<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Go(t,i,a,s),o.closePath(),o.stroke(),o.restore())}(this,a,r,o,l)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const s=i.setContext(this.getPointLabelContext(a)),{color:n,lineWidth:o}=s;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,r=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(a,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((s,a)=>{if(0===a&&this.min>=0&&!e.reverse)return;const r=i.setContext(this.getContext(a)),l=ke(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=we(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}ge(t,s.label,0,-n,l,{color:r.color,strokeColor:r.textStrokeColor,strokeWidth:r.textStrokeWidth})}),t.restore()}drawTitle(){}}const Qo={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}},Zo=Object.keys(Qo);function ta(t,e){return t-e}function ea(t,e){if(L(e))return null;const i=t._adapter,{parser:s,round:n,isoWeekday:o}=t._parseOpts;let a=e;return"function"==typeof s&&(a=s(a)),I(a)||(a="string"==typeof s?i.parse(a,s):i.parse(a)),null===a?null:(n&&(a="week"!==n||!ut(o)&&!0!==o?i.startOf(a,n):i.startOf(a,"isoWeek",o)),+a)}function ia(t,e,i,s){const n=Zo.length;for(let o=Zo.indexOf(t);o<n-1;++o){const t=Qo[Zo[o]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=s)return Zo[o]}return Zo[n-1]}function sa(t,e,i){if(i){if(i.length){const{lo:s,hi:n}=kt(i,e);t[i[s]>=e?i[s]:i[n]]=!0}}else t[e]=!0}function na(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],n[r]=a,s.push({value:r,major:!1});return 0!==o&&i?function(t,e,i,s){const n=t._adapter,o=+n.startOf(e[0].value,s),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=i[r],l>=0&&(e[l].major=!0);return e}(t,s,n,i):s}class oa extends Ws{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Ki(t.adapters.date);s.init(e),Y(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:ea(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:o,maxDefined:a}=this.getUserBounds();function r(t){o||isNaN(t.min)||(s=Math.min(s,t.min)),a||isNaN(t.max)||(n=Math.max(n,t.max))}o&&a||(r(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||r(this.getMinMax(!1))),s=I(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=I(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=function(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}(s,n,this.max);return this._unit=e.unit||(i.autoSkip?ia(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=Zo.length-1;o>=Zo.indexOf(i);o--){const i=Zo[o];if(Qo[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return Zo[i?Zo.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=Zo.indexOf(t)+1,i=Zo.length;e<i;++e)if(Qo[Zo[e]].common)return Zo[e]}(this._unit):void 0,this.initOffsets(s),t.reverse&&o.reverse(),na(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=Mt(s,0,o),n=Mt(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||ia(n.minUnit,e,i,this._getLabelCapacity(e)),a=F(s.ticks.stepSize,1),r="week"===o&&n.isoWeekday,l=ut(r)||!0===r,h={};let c,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",r)),u=+t.startOf(u,l?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const f="data"===s.ticks.source&&this.getDataTimestamps();for(c=u,d=0;c<i;c=+t.add(c,a,o),d++)sa(h,c,f);return c!==i&&"ticks"!==s.bounds&&1!==d||sa(h,c,f),Object.keys(h).sort(ta).map(t=>+t)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,s=this._unit,n=e||i[s];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.ticks.callback;if(o)return B(o,[t,e,i],this);const a=n.time.displayFormats,r=this._unit,l=this._majorUnit,h=r&&a[r],c=l&&a[l],d=i[e],u=l&&c&&d&&d.major;return this._adapter.format(t,s||(u?c:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=gt(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*n+a*o,h:i*o+a*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,na(this,[t],this._majorUnit),s),o=this._getLabelSize(n),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(ea(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return At(t.sort(ta))}}function aa(t,e,i){let s,n,o,a,r=0,l=t.length-1;i?(e>=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=St(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=St(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[l]));const h=n-s;return h?o+(a-o)*(e-s)/h:o}var ra=Object.freeze({__proto__:null,CategoryScale:class extends Ws{static id="category";static defaults={ticks:{callback:Ro}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(L(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Mt(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:function(t,e,i,s){const n=t.indexOf(e);return-1===n?((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s):n!==t.lastIndexOf(e)?i:n}(i,t,F(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return Ro.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?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}},LinearScale:Fo,LogarithmicScale:Ho,RadialLinearScale:Jo,TimeScale:oa,TimeSeriesScale:class extends oa{static id="timeseries";static defaults=oa.defaults;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=aa(e,this.min),this._tableRange=aa(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,l,h;for(o=0,a=t.length;o<a;++o)l=t[o],l>=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;++o)h=s[o+1],r=s[o-1],l=s[o],Math.round((h+r)/2)!==l&&n.push({time:l,pos:o/(a-1)});return n}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort((t,e)=>t-e)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(aa(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return aa(this._table,i*this._tableRange+this._minPos,!0)}}});const la=[Yi,zn,Eo,ra];xn.register(...la);const ha=xn;document.addEventListener("DOMContentLoaded",function(){const t=(t="today",e="")=>{wp.apiFetch({path:wp.url.addQueryArgs("lp/v1/statistics/overviews-statistics",{filtertype:t,date:e}),method:"GET"}).then(t=>{const{data:e,status:i,message:s}=t;if("error"===i)throw new Error(s||"Error");if(a("net-sales-chart-content",e.chart_data,{options:{scales:{y:{min:0,ticks:{callback:(t,e,i)=>"$"+t}}}}}),document.querySelector(".total-sales").textContent=e.total_sales,document.querySelector(".total-orders").textContent=e.total_orders,document.querySelector(".total-courses").textContent=e.total_courses,document.querySelector(".total-instructors").textContent=e.total_instructors,document.querySelector(".total-students").textContent=e.total_students,e.top_courses.length>0){const t=e.top_courses,i=document.querySelector(".top-course-sold");for(let e=0;e<t.length;e++)i.insertAdjacentHTML("beforeend",`<li>${t[e].course_name} - ${t[e].course_count}</li>`)}if(e.top_categories.length>0){const t=e.top_categories,i=document.querySelector(".top-category-sold");for(let e=0;e<t.length;e++)i.insertAdjacentHTML("beforeend",`<li>${t[e].term_name} - ${t[e].term_count}</li>`)}}).catch(t=>{console.log(t)}).finally(()=>{})},e=(t="today",e="")=>{wp.apiFetch({path:wp.url.addQueryArgs("lp/v1/statistics/order-statistics",{filtertype:t,date:e}),method:"GET"}).then(t=>{const{data:e,status:i,message:s}=t;if("error"===i)throw new Error(s||"Error");if(a("orders-chart-content",e.chart_data),e.statistics.length>0){let t=0;for(let i=e.statistics.length-1;i>=0;i--){const s=e.statistics[i];"completed"==s.order_status?(document.querySelector(".completed-order-count").textContent=s.count_order,t+=parseInt(s.count_order)):"pending"==s.order_status?(document.querySelector(".pending-order-count").textContent=s.count_order,t+=parseInt(s.count_order)):"processing"==s.order_status?(document.querySelector(".processing-order-count").textContent=s.count_order,t+=parseInt(s.count_order)):"cancelled"==s.order_status?(document.querySelector(".cancelled-order-count").textContent=s.count_order,t+=parseInt(s.count_order)):"failed"==s.order_status&&(document.querySelector(".failed-order-count").textContent=s.count_order,t+=parseInt(s.count_order))}document.querySelector(".total-order-count").textContent=t}else document.querySelectorAll(".statistics-item-count").forEach(t=>{t.textContent=0})}).catch(t=>{console.log(t)}).finally(()=>{})},i=(t="today",e="")=>{wp.apiFetch({path:wp.url.addQueryArgs("lp/v1/statistics/course-statistics",{filtertype:t,date:e}),method:"GET"}).then(t=>{const{data:e,status:i,message:s}=t;if("error"===i)throw new Error(s||"Error");if(a("course-chart-content",e.chart_data),e.courses.length>0){let t=0;for(let i=0;i<e.courses.length;i++){const s=e.courses[i];"publish"==s.course_status?(document.querySelector(".statistics-courses.published").textContent=s.course_count,t+=parseInt(s.course_count)):"pending"==s.course_status?(document.querySelector(".statistics-courses.pending").textContent=s.course_count,t+=parseInt(s.course_count)):"future"==s.course_status&&(document.querySelector(".statistics-courses.future").textContent=s.course_count,t+=parseInt(s.course_count))}document.querySelector(".statistics-courses.total").textContent=t}else document.querySelectorAll(".statistics-courses").forEach(t=>{t.textContent=0});if(e.items.length>0)for(let t=0;t<e.items.length;t++){const i=e.items[t];"lp_lesson"==i.item_type?document.querySelector(".statistics-items.lessons").textContent=i.item_count:"lp_quiz"==i.item_type?document.querySelector(".statistics-items.quizes").textContent=i.item_count:"lp_assignment"==i.item_type&&(document.querySelector(".statistics-items.assignment").textContent=i.item_count)}else document.querySelectorAll(".statistics-items").forEach(t=>{t.textContent=0})}).catch(t=>{console.log(t)}).finally(()=>{})},s=(t="today",e="")=>{wp.apiFetch({path:wp.url.addQueryArgs("lp/v1/statistics/user-statistics",{filtertype:t,date:e}),method:"GET"}).then(t=>{const{data:e,status:i,message:s}=t;if("error"===i)throw new Error(s||"Error");if(a("user-chart-content",e.chart_data),document.querySelector(".statistics-instructors").textContent=e.total_instructors,document.querySelector(".statistics-students").textContent=e.total_students,document.querySelector(".statistics-user-actived").textContent=e.total_instructors+e.total_students,document.querySelector(".statistics-not-started").textContent=e.user_not_start_course,e.user_course_statused.length>0){let t=e.user_course_statused,i=0;for(let e=0;e<t.length;e++)"in-progress"===t[e].graduation_status?document.querySelector(".statistics-graduration.in-progress").textContent=t[e].user_count:i+=parseInt(t[e].user_count);document.querySelector(".statistics-graduration.finished").textContent=i}else document.querySelectorAll(".statistics-graduration").forEach(t=>{t.textContent=0});if(Object.keys(e.top_enrolled_instructor).length>0){const t=e.top_enrolled_instructor,i=document.querySelector(".top-intructor-by-student");Object.keys(t).forEach(function(e){i.insertAdjacentHTML("beforeend",`<li>${t[e].name} - ${t[e].students}</li>`)})}if(e.top_enrolled_courses.length>0){const t=e.top_enrolled_courses,i=document.querySelector(".top-course-by-student");for(let e=0;e<t.length;e++)i.insertAdjacentHTML("beforeend",`<li>${t[e].course_name} - ${t[e].enrolled_user}</li>`)}}).catch(t=>{console.log(t)}).finally(()=>{})},n=(t="",e=[],i={})=>{const s=document.getElementById(t),n={type:"line",data:{labels:e.labels,datasets:[{label:e.line_label,borderColor:"rgb(49 74 199)",borderWidth:2,data:e.data,backgroundColor:"rgb(49 74 199)"}]},options:{responsive:!0,maintainAspectRatio:!1,aspectRatio:.8,plugins:{legend:{display:!1}},scales:{y:{min:0},x:{title:{display:!0,text:e.x_label,align:"end"}}}}},o={...n,...i};return o.options={...n.options,...i.options},new ha(s,o)},o=(t=!1)=>{t?document.querySelectorAll(".lp-skeleton-animation").forEach(t=>{t.style.display="block"}):document.querySelectorAll(".lp-skeleton-animation").forEach(t=>{t.style.display="none"})};document.querySelectorAll(".btn-filter-time").forEach(n=>{n.addEventListener("click",()=>{document.querySelectorAll(".btn-filter-time").forEach(t=>t.classList.remove("active")),n.classList.add("active");const a=n.dataset.filter;if("custom"==a)document.querySelector(".custom-filter-time").style.display="flex";else{const n=document.querySelector("input.statistics-type");n&&(document.querySelector(".statistics-content canvas").style.display="none",o(!0),"orders-statistics"==n.value?e(a):"overview-statistics"==n.value?(document.querySelector(".top-category-sold").innerHTML="",document.querySelector(".top-course-sold").innerHTML="",t(a)):"courses-statistics"==n.value?i(a):"users-statistics"==n.value&&(document.querySelector(".top-course-by-student").innerHTML="",document.querySelector(".top-intructor-by-student").innerHTML="",s(a)))}})}),document.querySelector(".custom-filter-btn").addEventListener("click",n=>{const a=document.querySelector("#ct-filter-1").value,r=document.querySelector("#ct-filter-2").value;if(a&&r){const n=document.querySelector("input.statistics-type");document.querySelector(".statistics-content canvas").style.display="none",o(!0),n&&("orders-statistics"===n.value?e("custom",`${a}+${r}`):"overview-statistics"===n.value?(document.querySelector(".top-category-sold").innerHTML="",document.querySelector(".top-course-sold").innerHTML="",t("custom",`${a}+${r}`)):"courses-statistics"===n.value?i("custom",`${a}+${r}`):"users-statistics"===n.value&&s("custom",`${a}+${r}`))}else alert("Choose date")}),(()=>{const n=document.querySelector("input.statistics-type");n&&("orders-statistics"===n.value?e():"overview-statistics"===n.value?t():"courses-statistics"===n.value?i():"users-statistics"===n.value&&s())})();const a=(t="",e=[],i=!1)=>{let s=ha.getChart(t);document.getElementById(t).style.display="block",o(),void 0===s?s=i?n(t,e,i):n(t,e):(s.data.labels=e.labels,s.data.datasets[0].data=e.data,s.config.options.scales.x.title.text=e.x_label,s.update())}})})(); |
|
1
|
+(()=>{var t={8465(t){t.exports=function(){"use strict";function t(t,e,s){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:s;throw new TypeError("Private element is not present on this object")}function e(e,s){return e.get(t(e,s))}function s(t,e,s){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,s)}const i={},n=t=>new Promise(e=>{if(!t)return e();const s=window.scrollX,n=window.scrollY;i.restoreFocusTimeout=setTimeout(()=>{i.previousActiveElement instanceof HTMLElement?(i.previousActiveElement.focus(),i.previousActiveElement=null):document.body&&document.body.focus(),e()},100),window.scrollTo(s,n)}),o="swal2-",a=["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error","draggable","dragging"].reduce((t,e)=>(t[e]=o+e,t),{}),r=["success","warning","info","question","error"].reduce((t,e)=>(t[e]=o+e,t),{}),l="SweetAlert2:",c=t=>t.charAt(0).toUpperCase()+t.slice(1),h=t=>{console.warn(`${l} ${"object"==typeof t?t.join(" "):t}`)},d=t=>{console.error(`${l} ${t}`)},u=[],p=(t,e=null)=>{var s;s=`"${t}" is deprecated and will be removed in the next major release.${e?` Use "${e}" instead.`:""}`,u.includes(s)||(u.push(s),h(s))},g=t=>"function"==typeof t?t():t,f=t=>t&&"function"==typeof t.toPromise,m=t=>f(t)?t.toPromise():Promise.resolve(t),b=t=>t&&Promise.resolve(t)===t,w=()=>document.body.querySelector(`.${a.container}`),v=t=>{const e=w();return e?e.querySelector(t):null},y=t=>v(`.${t}`),x=()=>y(a.popup),_=()=>y(a.icon),k=()=>y(a.title),C=()=>y(a["html-container"]),S=()=>y(a.image),M=()=>y(a["progress-steps"]),P=()=>y(a["validation-message"]),A=()=>v(`.${a.actions} .${a.confirm}`),E=()=>v(`.${a.actions} .${a.cancel}`),T=()=>v(`.${a.actions} .${a.deny}`),L=()=>v(`.${a.loader}`),D=()=>y(a.actions),O=()=>y(a.footer),R=()=>y(a["timer-progress-bar"]),I=()=>y(a.close),B=()=>{const t=x();if(!t)return[];const e=t.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'),s=Array.from(e).sort((t,e)=>{const s=parseInt(t.getAttribute("tabindex")||"0"),i=parseInt(e.getAttribute("tabindex")||"0");return s>i?1:s<i?-1:0}),i=t.querySelectorAll('\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex="0"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n'),n=Array.from(i).filter(t=>"-1"!==t.getAttribute("tabindex"));return[...new Set(s.concat(n))].filter(t=>tt(t))},z=()=>V(document.body,a.shown)&&!V(document.body,a["toast-shown"])&&!V(document.body,a["no-backdrop"]),F=()=>{const t=x();return!!t&&V(t,a.toast)},$=(t,e)=>{if(t.textContent="",e){const s=(new DOMParser).parseFromString(e,"text/html"),i=s.querySelector("head");i&&Array.from(i.childNodes).forEach(e=>{t.appendChild(e)});const n=s.querySelector("body");n&&Array.from(n.childNodes).forEach(e=>{e instanceof HTMLVideoElement||e instanceof HTMLAudioElement?t.appendChild(e.cloneNode(!0)):t.appendChild(e)})}},V=(t,e)=>{if(!e)return!1;const s=e.split(/\s+/);for(let e=0;e<s.length;e++)if(!t.classList.contains(s[e]))return!1;return!0},H=(t,e,s)=>{if(((t,e)=>{Array.from(t.classList).forEach(s=>{Object.values(a).includes(s)||Object.values(r).includes(s)||Object.values(e.showClass||{}).includes(s)||t.classList.remove(s)})})(t,e),!e.customClass)return;const i=e.customClass[s];i&&("string"==typeof i||i.forEach?q(t,i):h(`Invalid type of customClass.${s}! Expected string or iterable object, got "${typeof i}"`))},j=(t,e)=>{if(!e)return null;switch(e){case"select":case"textarea":case"file":return t.querySelector(`.${a.popup} > .${a[e]}`);case"checkbox":return t.querySelector(`.${a.popup} > .${a.checkbox} input`);case"radio":return t.querySelector(`.${a.popup} > .${a.radio} input:checked`)||t.querySelector(`.${a.popup} > .${a.radio} input:first-child`);case"range":return t.querySelector(`.${a.popup} > .${a.range} input`);default:return t.querySelector(`.${a.popup} > .${a.input}`)}},N=t=>{if(t.focus(),"file"!==t.type){const e=t.value;t.value="",t.value=e}},W=(t,e,s)=>{t&&e&&("string"==typeof e&&(e=e.split(/\s+/).filter(Boolean)),e.forEach(e=>{Array.isArray(t)?t.forEach(t=>{s?t.classList.add(e):t.classList.remove(e)}):s?t.classList.add(e):t.classList.remove(e)}))},q=(t,e)=>{W(t,e,!0)},U=(t,e)=>{W(t,e,!1)},Y=(t,e)=>{const s=Array.from(t.children);for(let t=0;t<s.length;t++){const i=s[t];if(i instanceof HTMLElement&&V(i,e))return i}},X=(t,e,s)=>{s===`${parseInt(`${s}`)}`&&(s=parseInt(s)),s||0===parseInt(`${s}`)?t.style.setProperty(e,"number"==typeof s?`${s}px`:s):t.style.removeProperty(e)},K=(t,e="flex")=>{t&&(t.style.display=e)},Z=t=>{t&&(t.style.display="none")},J=(t,e="block")=>{t&&new MutationObserver(()=>{Q(t,t.innerHTML,e)}).observe(t,{childList:!0,subtree:!0})},G=(t,e,s,i)=>{const n=t.querySelector(e);n&&n.style.setProperty(s,i)},Q=(t,e,s="flex")=>{e?K(t,s):Z(t)},tt=t=>Boolean(t&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)),et=t=>Boolean(t.scrollHeight>t.clientHeight),st=t=>{const e=window.getComputedStyle(t),s=parseFloat(e.getPropertyValue("animation-duration")||"0"),i=parseFloat(e.getPropertyValue("transition-duration")||"0");return s>0||i>0},it=(t,e=!1)=>{const s=R();s&&tt(s)&&(e&&(s.style.transition="none",s.style.width="100%"),setTimeout(()=>{s.style.transition=`width ${t/1e3}s linear`,s.style.width="0%"},10))},nt=`\n <div aria-labelledby="${a.title}" aria-describedby="${a["html-container"]}" class="${a.popup}" tabindex="-1">\n <button type="button" class="${a.close}"></button>\n <ul class="${a["progress-steps"]}"></ul>\n <div class="${a.icon}"></div>\n <img class="${a.image}" />\n <h2 class="${a.title}" id="${a.title}"></h2>\n <div class="${a["html-container"]}" id="${a["html-container"]}"></div>\n <input class="${a.input}" id="${a.input}" />\n <input type="file" class="${a.file}" />\n <div class="${a.range}">\n <input type="range" />\n <output></output>\n </div>\n <select class="${a.select}" id="${a.select}"></select>\n <div class="${a.radio}"></div>\n <label class="${a.checkbox}">\n <input type="checkbox" id="${a.checkbox}" />\n <span class="${a.label}"></span>\n </label>\n <textarea class="${a.textarea}" id="${a.textarea}"></textarea>\n <div class="${a["validation-message"]}" id="${a["validation-message"]}"></div>\n <div class="${a.actions}">\n <div class="${a.loader}"></div>\n <button type="button" class="${a.confirm}"></button>\n <button type="button" class="${a.deny}"></button>\n <button type="button" class="${a.cancel}"></button>\n </div>\n <div class="${a.footer}"></div>\n <div class="${a["timer-progress-bar-container"]}">\n <div class="${a["timer-progress-bar"]}"></div>\n </div>\n </div>\n`.replace(/(^|\n)\s*/g,""),ot=()=>{i.currentInstance&&i.currentInstance.resetValidationMessage()},at=t=>{const e=(()=>{const t=w();return!!t&&(t.remove(),U([document.documentElement,document.body],[a["no-backdrop"],a["toast-shown"],a["has-column"]]),!0)})();if("undefined"==typeof window||"undefined"==typeof document)return void d("SweetAlert2 requires document to initialize");const s=document.createElement("div");s.className=a.container,e&&q(s,a["no-transition"]),$(s,nt),s.dataset.swal2Theme=t.theme;const n=(t=>{if("string"==typeof t){const e=document.querySelector(t);if(!e)throw new Error(`Target element "${t}" not found`);return e}return t})(t.target||"body");n.appendChild(s),t.topLayer&&(s.setAttribute("popover",""),s.showPopover()),(t=>{const e=x();e&&(e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true"))})(t),(t=>{"rtl"===window.getComputedStyle(t).direction&&(q(w(),a.rtl),i.isRTL=!0)})(n),(()=>{const t=x();if(!t)return;const e=Y(t,a.input),s=Y(t,a.file),i=t.querySelector(`.${a.range} input`),n=t.querySelector(`.${a.range} output`),o=Y(t,a.select),r=t.querySelector(`.${a.checkbox} input`),l=Y(t,a.textarea);e&&(e.oninput=ot),s&&(s.onchange=ot),o&&(o.onchange=ot),r&&(r.onchange=ot),l&&(l.oninput=ot),i&&n&&(i.oninput=()=>{ot(),n.value=i.value},i.onchange=()=>{ot(),n.value=i.value})})()},rt=(t,e)=>{t instanceof HTMLElement?e.appendChild(t):"object"==typeof t?lt(t,e):t&&$(e,t)},lt=(t,e)=>{"jquery"in t?ct(e,t):$(e,t.toString())},ct=(t,e)=>{if(t.textContent="",0 in e)for(let s=0;s in e;s++)t.appendChild(e[s].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},ht=(t,e)=>{const s=D(),i=L();s&&i&&(e.showConfirmButton||e.showDenyButton||e.showCancelButton?K(s):Z(s),H(s,e,"actions"),function(t,e,s){const i=A(),n=T(),o=E();i&&n&&o&&(ut(i,"confirm",s),ut(n,"deny",s),ut(o,"cancel",s),function(t,e,s,i){i.buttonsStyling?(q([t,e,s],a.styled),i.confirmButtonColor&&t.style.setProperty("--swal2-confirm-button-background-color",i.confirmButtonColor),i.denyButtonColor&&e.style.setProperty("--swal2-deny-button-background-color",i.denyButtonColor),i.cancelButtonColor&&s.style.setProperty("--swal2-cancel-button-background-color",i.cancelButtonColor),dt(t),dt(e),dt(s)):U([t,e,s],a.styled)}(i,n,o,s),s.reverseButtons&&(s.toast?(t.insertBefore(o,i),t.insertBefore(n,i)):(t.insertBefore(o,e),t.insertBefore(n,e),t.insertBefore(i,e))))}(s,i,e),$(i,e.loaderHtml||""),H(i,e,"loader"))};function dt(t){const e=window.getComputedStyle(t);if(e.getPropertyValue("--swal2-action-button-focus-box-shadow"))return;const s=e.backgroundColor.replace(/rgba?\((\d+), (\d+), (\d+).*/,"rgba($1, $2, $3, 0.5)");t.style.setProperty("--swal2-action-button-focus-box-shadow",e.getPropertyValue("--swal2-outline").replace(/ rgba\(.*/,` ${s}`))}function ut(t,e,s){const i=c(e);Q(t,s[`show${i}Button`],"inline-block"),$(t,s[`${e}ButtonText`]||""),t.setAttribute("aria-label",s[`${e}ButtonAriaLabel`]||""),t.className=a[e],H(t,s,`${e}Button`)}const pt=(t,e)=>{const s=w();s&&(function(t,e){"string"==typeof e?t.style.background=e:e||q([document.documentElement,document.body],a["no-backdrop"])}(s,e.backdrop),function(t,e){e&&(e in a?q(t,a[e]):(h('The "position" parameter is not valid, defaulting to "center"'),q(t,a.center)))}(s,e.position),function(t,e){e&&q(t,a[`grow-${e}`])}(s,e.grow),H(s,e,"container"))};var gt={innerParams:new WeakMap,domCache:new WeakMap};const ft=["input","file","range","select","radio","checkbox","textarea"],mt=t=>{if(!t.input)return;if(!kt[t.input])return void d(`Unexpected type of input! Expected ${Object.keys(kt).join(" | ")}, got "${t.input}"`);const e=xt(t.input);if(!e)return;const s=kt[t.input](e,t);K(e),t.inputAutoFocus&&setTimeout(()=>{N(s)})},bt=(t,e)=>{const s=x();if(!s)return;const i=j(s,t);if(i){(t=>{for(let e=0;e<t.attributes.length;e++){const s=t.attributes[e].name;["id","type","value","style"].includes(s)||t.removeAttribute(s)}})(i);for(const t in e)i.setAttribute(t,e[t])}},wt=t=>{if(!t.input)return;const e=xt(t.input);e&&H(e,t,"input")},vt=(t,e)=>{!t.placeholder&&e.inputPlaceholder&&(t.placeholder=e.inputPlaceholder)},yt=(t,e,s)=>{if(s.inputLabel){const i=document.createElement("label"),n=a["input-label"];i.setAttribute("for",t.id),i.className=n,"object"==typeof s.customClass&&q(i,s.customClass.inputLabel),i.innerText=s.inputLabel,e.insertAdjacentElement("beforebegin",i)}},xt=t=>{const e=x();if(e)return Y(e,a[t]||a.input)},_t=(t,e)=>{["string","number"].includes(typeof e)?t.value=`${e}`:b(e)||h(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof e}"`)},kt={};kt.text=kt.email=kt.password=kt.number=kt.tel=kt.url=kt.search=kt.date=kt["datetime-local"]=kt.time=kt.week=kt.month=(t,e)=>{const s=t;return _t(s,e.inputValue),yt(s,s,e),vt(s,e),s.type=e.input,s},kt.file=(t,e)=>{const s=t;return yt(s,s,e),vt(s,e),s},kt.range=(t,e)=>{const s=t,i=s.querySelector("input"),n=s.querySelector("output");return i&&(_t(i,e.inputValue),i.type=e.input,yt(i,t,e)),n&&_t(n,e.inputValue),t},kt.select=(t,e)=>{const s=t;if(s.textContent="",e.inputPlaceholder){const t=document.createElement("option");$(t,e.inputPlaceholder),t.value="",t.disabled=!0,t.selected=!0,s.appendChild(t)}return yt(s,s,e),s},kt.radio=t=>(t.textContent="",t),kt.checkbox=(t,e)=>{const s=x();if(!s)throw new Error("Popup not found");const i=j(s,"checkbox");if(!i)throw new Error("Checkbox input not found");i.value="1",i.checked=Boolean(e.inputValue);const n=t.querySelector("span");if(n){const t=e.inputPlaceholder||e.inputLabel;t&&$(n,t)}return i},kt.textarea=(t,e)=>{const s=t;_t(s,e.inputValue),vt(s,e),yt(s,s,e);return setTimeout(()=>{if("MutationObserver"in window){const t=x();if(!t)return;const i=parseInt(window.getComputedStyle(t).width);new MutationObserver(()=>{if(!document.body.contains(s))return;const t=s.offsetWidth+(o=s,parseInt(window.getComputedStyle(o).marginLeft)+parseInt(window.getComputedStyle(o).marginRight)),n=x();var o;n&&(t>i?n.style.width=`${t}px`:X(n,"width",e.width))}).observe(s,{attributes:!0,attributeFilter:["style"]})}}),s};const Ct=(t,e)=>{const s=C();s&&(J(s),H(s,e,"htmlContainer"),e.html?(rt(e.html,s),K(s,"block")):e.text?(s.textContent=e.text,K(s,"block")):Z(s),((t,e)=>{const s=x();if(!s)return;const i=gt.innerParams.get(t),n=!i||e.input!==i.input;ft.forEach(t=>{const i=Y(s,a[t]);i&&(bt(t,e.inputAttributes),i.className=a[t],n&&Z(i))}),e.input&&(n&&mt(e),wt(e))})(t,e))},St=(t,e)=>{for(const[s,i]of Object.entries(r))e.icon!==s&&U(t,i);q(t,e.icon&&r[e.icon]),At(t,e),Mt(),H(t,e,"icon")},Mt=()=>{const t=x();if(!t)return;const e=window.getComputedStyle(t).getPropertyValue("background-color"),s=t.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix");for(let t=0;t<s.length;t++)s[t].style.backgroundColor=e},Pt=(t,e)=>{if(!e.icon&&!e.iconHtml)return;let s=t.innerHTML,i="";e.iconHtml?i=Et(e.iconHtml):"success"===e.icon?(i=(t=>`\n ${t.animation?'<div class="swal2-success-circular-line-left"></div>':""}\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div>\n ${t.animation?'<div class="swal2-success-fix"></div>':""}\n ${t.animation?'<div class="swal2-success-circular-line-right"></div>':""}\n`)(e),s=s.replace(/ style=".*?"/g,"")):"error"===e.icon?i='\n <span class="swal2-x-mark">\n <span class="swal2-x-mark-line-left"></span>\n <span class="swal2-x-mark-line-right"></span>\n </span>\n':e.icon&&(i=Et({question:"?",warning:"!",info:"i"}[e.icon])),s.trim()!==i.trim()&&$(t,i)},At=(t,e)=>{if(e.iconColor){t.style.color=e.iconColor,t.style.borderColor=e.iconColor;for(const s of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])G(t,s,"background-color",e.iconColor);G(t,".swal2-success-ring","border-color",e.iconColor)}},Et=t=>`<div class="${a["icon-content"]}">${t}</div>`;let Tt=!1,Lt=0,Dt=0,Ot=0,Rt=0;const It=t=>{const e=x();if(!e)return;const s=_();if(t.target===e||s&&s.contains(t.target)){Tt=!0;const s=Ft(t);Lt=s.clientX,Dt=s.clientY,Ot=parseInt(e.style.insetInlineStart)||0,Rt=parseInt(e.style.insetBlockStart)||0,q(e,"swal2-dragging")}},Bt=t=>{const e=x();if(e&&Tt){let{clientX:s,clientY:n}=Ft(t);const o=s-Lt;e.style.insetInlineStart=`${Ot+(i.isRTL?-o:o)}px`,e.style.insetBlockStart=`${Rt+(n-Dt)}px`}},zt=()=>{const t=x();Tt=!1,U(t,"swal2-dragging")},Ft=t=>{let e=0,s=0;return t.type.startsWith("mouse")?(e=t.clientX,s=t.clientY):t.type.startsWith("touch")&&(e=t.touches[0].clientX,s=t.touches[0].clientY),{clientX:e,clientY:s}},$t=(t,e)=>{const s=w(),i=x();if(s&&i){if(e.toast){X(s,"width",e.width),i.style.width="100%";const t=L();t&&i.insertBefore(t,_())}else X(i,"width",e.width);X(i,"padding",e.padding),e.color&&(i.style.color=e.color),e.background&&(i.style.background=e.background),Z(P()),Vt(i,e),e.draggable&&!e.toast?(q(i,a.draggable),(t=>{t.addEventListener("mousedown",It),document.body.addEventListener("mousemove",Bt),t.addEventListener("mouseup",zt),t.addEventListener("touchstart",It),document.body.addEventListener("touchmove",Bt),t.addEventListener("touchend",zt)})(i)):(U(i,a.draggable),(t=>{t.removeEventListener("mousedown",It),document.body.removeEventListener("mousemove",Bt),t.removeEventListener("mouseup",zt),t.removeEventListener("touchstart",It),document.body.removeEventListener("touchmove",Bt),t.removeEventListener("touchend",zt)})(i))}},Vt=(t,e)=>{const s=e.showClass||{};t.className=`${a.popup} ${tt(t)?s.popup:""}`,e.toast?(q([document.documentElement,document.body],a["toast-shown"]),q(t,a.toast)):q(t,a.modal),H(t,e,"popup"),"string"==typeof e.customClass&&q(t,e.customClass),e.icon&&q(t,a[`icon-${e.icon}`])},Ht=t=>{const e=document.createElement("li");return q(e,a["progress-step"]),$(e,t),e},jt=t=>{const e=document.createElement("li");return q(e,a["progress-step-line"]),t.progressStepsDistance&&X(e,"width",t.progressStepsDistance),e},Nt=(t,e)=>{var s;$t(0,e),pt(0,e),((t,e)=>{const s=M();if(!s)return;const{progressSteps:i,currentProgressStep:n}=e;i&&0!==i.length&&void 0!==n?(K(s),s.textContent="",n>=i.length&&h("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),i.forEach((t,o)=>{const r=Ht(t);if(s.appendChild(r),o===n&&q(r,a["active-progress-step"]),o!==i.length-1){const t=jt(e);s.appendChild(t)}})):Z(s)})(0,e),((t,e)=>{const s=gt.innerParams.get(t),i=_();if(i){if(s&&e.icon===s.icon)return Pt(i,e),void St(i,e);if(e.icon||e.iconHtml){if(e.icon&&-1===Object.keys(r).indexOf(e.icon))return d(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${e.icon}"`),void Z(i);K(i),Pt(i,e),St(i,e),q(i,e.showClass&&e.showClass.icon),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",Mt)}else Z(i)}})(t,e),((t,e)=>{const s=S();s&&(e.imageUrl?(K(s,""),s.setAttribute("src",e.imageUrl),s.setAttribute("alt",e.imageAlt||""),X(s,"width",e.imageWidth),X(s,"height",e.imageHeight),s.className=a.image,H(s,e,"image")):Z(s))})(0,e),((t,e)=>{const s=k();s&&(J(s),Q(s,Boolean(e.title||e.titleText),"block"),e.title&&rt(e.title,s),e.titleText&&(s.innerText=e.titleText),H(s,e,"title"))})(0,e),((t,e)=>{const s=I();s&&($(s,e.closeButtonHtml||""),H(s,e,"closeButton"),Q(s,e.showCloseButton),s.setAttribute("aria-label",e.closeButtonAriaLabel||""))})(0,e),Ct(t,e),ht(0,e),((t,e)=>{const s=O();s&&(J(s),Q(s,Boolean(e.footer),"block"),e.footer&&rt(e.footer,s),H(s,e,"footer"))})(0,e);const n=x();"function"==typeof e.didRender&&n&&e.didRender(n),null===(s=i.eventEmitter)||void 0===s||s.emit("didRender",n)},Wt=()=>{var t;return null===(t=A())||void 0===t?void 0:t.click()},qt=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),Ut=t=>{if(t.keydownTarget&&t.keydownHandlerAdded&&t.keydownHandler){const e=t.keydownHandler;t.keydownTarget.removeEventListener("keydown",e,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1}},Yt=(t,e)=>{var s;const i=B();if(i.length)return-2===(t+=e)&&(t=i.length-1),t===i.length?t=0:-1===t&&(t=i.length-1),void i[t].focus();null===(s=x())||void 0===s||s.focus()},Xt=["ArrowRight","ArrowDown"],Kt=["ArrowLeft","ArrowUp"],Zt=(t,e,s)=>{t&&(e.isComposing||229===e.keyCode||(t.stopKeydownPropagation&&e.stopPropagation(),"Enter"===e.key?Jt(e,t):"Tab"===e.key?Gt(e):[...Xt,...Kt].includes(e.key)?Qt(e.key):"Escape"===e.key&&te(e,t,s)))},Jt=(t,e)=>{if(!g(e.allowEnterKey))return;const s=x();if(!s||!e.input)return;const i=j(s,e.input);if(t.target&&i&&t.target instanceof HTMLElement&&t.target.outerHTML===i.outerHTML){if(["textarea","file"].includes(e.input))return;Wt(),t.preventDefault()}},Gt=t=>{const e=t.target,s=B();let i=-1;for(let t=0;t<s.length;t++)if(e===s[t]){i=t;break}t.shiftKey?Yt(i,-1):Yt(i,1),t.stopPropagation(),t.preventDefault()},Qt=t=>{const e=D(),s=A(),i=T(),n=E();if(!(e&&s&&i&&n))return;const o=[s,i,n];if(document.activeElement instanceof HTMLElement&&!o.includes(document.activeElement))return;const a=Xt.includes(t)?"nextElementSibling":"previousElementSibling";let r=document.activeElement;if(r){for(let t=0;t<e.children.length;t++){if(r=r[a],!r)return;if(r instanceof HTMLButtonElement&&tt(r))break}r instanceof HTMLButtonElement&&r.focus()}},te=(t,e,s)=>{t.preventDefault(),g(e.allowEscapeKey)&&s(qt.esc)};var ee={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const se=()=>{Array.from(document.body.children).forEach(t=>{t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")||""),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")})},ie="undefined"!=typeof window&&Boolean(window.GestureEvent),ne=()=>{const t=w();if(!t)return;let e;t.ontouchstart=t=>{e=oe(t)},t.ontouchmove=t=>{e&&(t.preventDefault(),t.stopPropagation())}},oe=t=>{const e=t.target,s=w(),i=C();return!(!s||!i||ae(t)||re(t)||e!==s&&(et(s)||!(e instanceof HTMLElement)||((t,e)=>{let s=t;for(;s&&s!==e;){if(et(s))return!0;s=s.parentElement}return!1})(e,i)||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||et(i)&&i.contains(e)))},ae=t=>Boolean(t.touches&&t.touches.length&&"stylus"===t.touches[0].touchType),re=t=>t.touches&&t.touches.length>1;let le=null;const ce=t=>{null===le&&(document.body.scrollHeight>window.innerHeight||"scroll"===t)&&(le=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${le+(()=>{const t=document.createElement("div");t.className=a["scrollbar-measure"],document.body.appendChild(t);const e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e})()}px`)};function he(t,e,s,o){F()?we(t,o):(n(s).then(()=>we(t,o)),Ut(i)),ie?(e.setAttribute("style","display:none !important"),e.removeAttribute("class"),e.innerHTML=""):e.remove(),z()&&(null!==le&&(document.body.style.paddingRight=`${le}px`,le=null),(()=>{if(V(document.body,a.iosfix)){const t=parseInt(document.body.style.top,10);U(document.body,a.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}})(),se()),U([document.documentElement,document.body],[a.shown,a["height-auto"],a["no-backdrop"],a["toast-shown"]])}function de(t){t=fe(t);const e=ee.swalPromiseResolve.get(this),s=ue(this);this.isAwaitingPromise?t.isDismissed||(ge(this),e(t)):s&&e(t)}const ue=t=>{const e=x();if(!e)return!1;const s=gt.innerParams.get(t);if(!s||V(e,s.hideClass.popup))return!1;U(e,s.showClass.popup),q(e,s.hideClass.popup);const i=w();return U(i,s.showClass.backdrop),q(i,s.hideClass.backdrop),me(t,e,s),!0};function pe(t){const e=ee.swalPromiseReject.get(this);ge(this),e&&e(t)}const ge=t=>{t.isAwaitingPromise&&(delete t.isAwaitingPromise,gt.innerParams.get(t)||t._destroy())},fe=t=>void 0===t?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},t),me=(t,e,s)=>{var n;const o=w(),a=st(e);"function"==typeof s.willClose&&s.willClose(e),null===(n=i.eventEmitter)||void 0===n||n.emit("willClose",e),a&&o?be(t,e,o,Boolean(s.returnFocus),s.didClose):o&&he(t,o,Boolean(s.returnFocus),s.didClose)},be=(t,e,s,n,o)=>{i.swalCloseEventFinishedCallback=he.bind(null,t,s,n,o);const a=function(t){var s;t.target===e&&(null===(s=i.swalCloseEventFinishedCallback)||void 0===s||s.call(i),delete i.swalCloseEventFinishedCallback,e.removeEventListener("animationend",a),e.removeEventListener("transitionend",a))};e.addEventListener("animationend",a),e.addEventListener("transitionend",a)},we=(t,e)=>{setTimeout(()=>{var s;"function"==typeof e&&e.bind(t.params)(),null===(s=i.eventEmitter)||void 0===s||s.emit("didClose"),t._destroy&&t._destroy()})},ve=t=>{let e=x();if(e||new Gs,e=x(),!e)return;const s=L();F()?Z(_()):ye(e,t),K(s),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true"),e.focus()},ye=(t,e)=>{const s=D(),i=L();s&&i&&(!e&&tt(A())&&(e=A()),K(s),e&&(Z(e),i.setAttribute("data-button-to-replace",e.className),s.insertBefore(i,e)),q([t,s],a.loading))},xe=t=>t.checked?1:0,_e=t=>t.checked?t.value:null,ke=t=>t.files&&t.files.length?null!==t.getAttribute("multiple")?t.files:t.files[0]:null,Ce=(t,e)=>{const s=x();if(!s)return;const i=t=>{"select"===e.input?function(t,e,s){const i=Y(t,a.select);if(!i)return;const n=(t,e,i)=>{const n=document.createElement("option");n.value=i,$(n,e),n.selected=Pe(i,s.inputValue),t.appendChild(n)};e.forEach(t=>{const e=t[0],s=t[1];if(Array.isArray(s)){const t=document.createElement("optgroup");t.label=e,t.disabled=!1,i.appendChild(t),s.forEach(e=>n(t,e[1],e[0]))}else n(i,s,e)}),i.focus()}(s,Me(t),e):"radio"===e.input&&function(t,e,s){const i=Y(t,a.radio);if(!i)return;e.forEach(t=>{const e=t[0],n=t[1],o=document.createElement("input"),r=document.createElement("label");o.type="radio",o.name=a.radio,o.value=e,Pe(e,s.inputValue)&&(o.checked=!0);const l=document.createElement("span");$(l,n),l.className=a.label,r.appendChild(o),r.appendChild(l),i.appendChild(r)});const n=i.querySelectorAll("input");n.length&&n[0].focus()}(s,Me(t),e)};f(e.inputOptions)||b(e.inputOptions)?(ve(A()),m(e.inputOptions).then(e=>{t.hideLoading(),i(e)})):"object"==typeof e.inputOptions?i(e.inputOptions):d("Unexpected type of inputOptions! Expected object, Map or Promise, got "+typeof e.inputOptions)},Se=(t,e)=>{const s=t.getInput();s&&(Z(s),m(e.inputValue).then(i=>{s.value="number"===e.input?`${parseFloat(i)||0}`:`${i}`,K(s),s.focus(),t.hideLoading()}).catch(e=>{d(`Error in inputValue promise: ${e}`),s.value="",K(s),s.focus(),t.hideLoading()}))};const Me=t=>{const e=[];return t instanceof Map?t.forEach((t,s)=>{let i=t;"object"==typeof i&&(i=Me(i)),e.push([s,i])}):Object.keys(t).forEach(s=>{let i=t[s];"object"==typeof i&&(i=Me(i)),e.push([s,i])}),e},Pe=(t,e)=>Boolean(e)&&null!=e&&e.toString()===t.toString(),Ae=(t,e)=>{const s=gt.innerParams.get(t);if(!s.input)return void d(`The "input" parameter is needed to be set when using returnInputValueOn${c(e)}`);const i=t.getInput(),n=((t,e)=>{const s=t.getInput();if(!s)return null;switch(e.input){case"checkbox":return xe(s);case"radio":return _e(s);case"file":return ke(s);default:return e.inputAutoTrim?s.value.trim():s.value}})(t,s);s.inputValidator?Ee(t,n,e):i&&!i.checkValidity()?(t.enableButtons(),t.showValidationMessage(s.validationMessage||i.validationMessage)):"deny"===e?Te(t,n):Oe(t,n)},Ee=(t,e,s)=>{const i=gt.innerParams.get(t);t.disableInput(),Promise.resolve().then(()=>m(i.inputValidator(e,i.validationMessage))).then(i=>{t.enableButtons(),t.enableInput(),i?t.showValidationMessage(i):"deny"===s?Te(t,e):Oe(t,e)})},Te=(t,e)=>{const s=gt.innerParams.get(t);s.showLoaderOnDeny&&ve(T()),s.preDeny?(t.isAwaitingPromise=!0,Promise.resolve().then(()=>m(s.preDeny(e,s.validationMessage))).then(s=>{!1===s?(t.hideLoading(),ge(t)):t.close({isDenied:!0,value:void 0===s?e:s})}).catch(e=>De(t,e))):t.close({isDenied:!0,value:e})},Le=(t,e)=>{t.close({isConfirmed:!0,value:e})},De=(t,e)=>{t.rejectPromise(e)},Oe=(t,e)=>{const s=gt.innerParams.get(t);s.showLoaderOnConfirm&&ve(),s.preConfirm?(t.resetValidationMessage(),t.isAwaitingPromise=!0,Promise.resolve().then(()=>m(s.preConfirm(e,s.validationMessage))).then(s=>{tt(P())||!1===s?(t.hideLoading(),ge(t)):Le(t,void 0===s?e:s)}).catch(e=>De(t,e))):Le(t,e)};function Re(){const t=gt.innerParams.get(this);if(!t)return;const e=gt.domCache.get(this);Z(e.loader),F()?t.icon&&K(_()):Ie(e),U([e.popup,e.actions],a.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.denyButton.disabled=!1,e.cancelButton.disabled=!1}const Ie=t=>{const e=t.loader.getAttribute("data-button-to-replace"),s=e?t.popup.getElementsByClassName(e):[];s.length?K(s[0],"inline-block"):!tt(A())&&!tt(T())&&!tt(E())&&Z(t.actions)};function Be(){const t=gt.innerParams.get(this),e=gt.domCache.get(this);return e?j(e.popup,t.input):null}function ze(t,e,s){const i=gt.domCache.get(t);e.forEach(t=>{i[t].disabled=s})}function Fe(t,e){const s=x();if(s&&t)if("radio"===t.type){const t=s.querySelectorAll(`[name="${a.radio}"]`);for(let s=0;s<t.length;s++)t[s].disabled=e}else t.disabled=e}function $e(){ze(this,["confirmButton","denyButton","cancelButton"],!1)}function Ve(){ze(this,["confirmButton","denyButton","cancelButton"],!0)}function He(){Fe(this.getInput(),!1)}function je(){Fe(this.getInput(),!0)}function Ne(t){const e=gt.domCache.get(this),s=gt.innerParams.get(this);$(e.validationMessage,t),e.validationMessage.className=a["validation-message"],s.customClass&&s.customClass.validationMessage&&q(e.validationMessage,s.customClass.validationMessage),K(e.validationMessage);const i=this.getInput();i&&(i.setAttribute("aria-invalid","true"),i.setAttribute("aria-describedby",a["validation-message"]),N(i),q(i,a.inputerror))}function We(){const t=gt.domCache.get(this);t.validationMessage&&Z(t.validationMessage);const e=this.getInput();e&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby"),U(e,a.inputerror))}const qe={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,draggable:!1,animation:!0,theme:"light",showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoFocus:!0,inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0,topLayer:!1},Ue=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","draggable","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","theme","willClose"],Ye={allowEnterKey:void 0},Xe=["allowOutsideClick","allowEnterKey","backdrop","draggable","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],Ke=t=>Object.prototype.hasOwnProperty.call(qe,t),Ze=t=>-1!==Ue.indexOf(t),Je=t=>Ye[t],Ge=t=>{Ke(t)||h(`Unknown parameter "${t}"`)},Qe=t=>{Xe.includes(t)&&h(`The parameter "${t}" is incompatible with toasts`)},ts=t=>{const e=Je(t);e&&p(t,e)},es=t=>{!1===t.backdrop&&t.allowOutsideClick&&h('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),t.theme&&!["light","dark","auto","minimal","borderless","bootstrap-4","bootstrap-4-light","bootstrap-4-dark","bootstrap-5","bootstrap-5-light","bootstrap-5-dark","material-ui","material-ui-light","material-ui-dark","embed-iframe","bulma","bulma-light","bulma-dark"].includes(t.theme)&&h(`Invalid theme "${t.theme}"`);for(const e in t)Ge(e),t.toast&&Qe(e),ts(e)};function ss(t){const e=w(),s=x(),i=gt.innerParams.get(this);if(!s||V(s,i.hideClass.popup))return void h("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");const n=is(t),o=Object.assign({},i,n);es(o),e&&(e.dataset.swal2Theme=o.theme),Nt(this,o),gt.innerParams.set(this,o),Object.defineProperties(this,{params:{value:Object.assign({},this.params,t),writable:!1,enumerable:!0}})}const is=t=>{const e={};return Object.keys(t).forEach(s=>{if(Ze(s)){const i=t;e[s]=i[s]}else h(`Invalid parameter to update: ${s}`)}),e};function ns(){var t;const e=gt.domCache.get(this),s=gt.innerParams.get(this);s?(e.popup&&i.swalCloseEventFinishedCallback&&(i.swalCloseEventFinishedCallback(),delete i.swalCloseEventFinishedCallback),"function"==typeof s.didDestroy&&s.didDestroy(),null===(t=i.eventEmitter)||void 0===t||t.emit("didDestroy"),os(this)):as(this)}const os=t=>{as(t),delete t.params,delete i.keydownHandler,delete i.keydownTarget,delete i.currentInstance},as=t=>{t.isAwaitingPromise?(rs(gt,t),t.isAwaitingPromise=!0):(rs(ee,t),rs(gt,t),delete t.isAwaitingPromise,delete t.disableButtons,delete t.enableButtons,delete t.getInput,delete t.disableInput,delete t.enableInput,delete t.hideLoading,delete t.disableLoading,delete t.showValidationMessage,delete t.resetValidationMessage,delete t.close,delete t.closePopup,delete t.closeModal,delete t.closeToast,delete t.rejectPromise,delete t.update,delete t._destroy)},rs=(t,e)=>{for(const s in t)t[s].delete(e)};var ls=Object.freeze({__proto__:null,_destroy:ns,close:de,closeModal:de,closePopup:de,closeToast:de,disableButtons:Ve,disableInput:je,disableLoading:Re,enableButtons:$e,enableInput:He,getInput:Be,handleAwaitingPromise:ge,hideLoading:Re,rejectPromise:pe,resetValidationMessage:We,showValidationMessage:Ne,update:ss});const cs=(t,e,s)=>{e.popup.onclick=()=>{t&&(hs(t)||t.timer||t.input)||s(qt.close)}},hs=t=>Boolean(t.showConfirmButton||t.showDenyButton||t.showCancelButton||t.showCloseButton);let ds=!1;const us=t=>{t.popup.onmousedown=()=>{t.container.onmouseup=function(e){t.container.onmouseup=()=>{},e.target===t.container&&(ds=!0)}}},ps=t=>{t.container.onmousedown=e=>{e.target===t.container&&e.preventDefault(),t.popup.onmouseup=function(e){t.popup.onmouseup=()=>{},(e.target===t.popup||e.target instanceof HTMLElement&&t.popup.contains(e.target))&&(ds=!0)}}},gs=(t,e,s)=>{e.container.onclick=i=>{ds?ds=!1:i.target===e.container&&g(t.allowOutsideClick)&&s(qt.backdrop)}},fs=t=>t instanceof Element||(t=>"object"==typeof t&&t.jquery)(t);const ms=()=>{if(i.timeout)return(()=>{const t=R();if(!t)return;const e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";const s=e/parseInt(window.getComputedStyle(t).width)*100;t.style.width=`${s}%`})(),i.timeout.stop()},bs=()=>{if(i.timeout){const t=i.timeout.start();return it(t),t}};let ws=!1;const vs={};const ys=t=>{for(let e=t.target;e&&e!==document;e=e.parentNode)for(const t in vs){const s=e.getAttribute&&e.getAttribute(t);if(s)return void vs[t].fire({template:s})}};i.eventEmitter=new class{constructor(){this.events={}}_getHandlersByEventName(t){return void 0===this.events[t]&&(this.events[t]=[]),this.events[t]}on(t,e){const s=this._getHandlersByEventName(t);s.includes(e)||s.push(e)}once(t,e){const s=(...i)=>{this.removeListener(t,s),e.apply(this,i)};this.on(t,s)}emit(t,...e){this._getHandlersByEventName(t).forEach(t=>{try{t.apply(this,e)}catch(t){console.error(t)}})}removeListener(t,e){const s=this._getHandlersByEventName(t),i=s.indexOf(e);i>-1&&s.splice(i,1)}removeAllListeners(t){void 0!==this.events[t]&&(this.events[t].length=0)}reset(){this.events={}}};var xs=Object.freeze({__proto__:null,argsToParams:t=>{const e={};return"object"!=typeof t[0]||fs(t[0])?["title","html","icon"].forEach((s,i)=>{const n=t[i];"string"==typeof n||fs(n)?e[s]=n:void 0!==n&&d(`Unexpected type of ${s}! Expected "string" or "Element", got ${typeof n}`)}):Object.assign(e,t[0]),e},bindClickHandler:function(t="data-swal-template"){vs[t]=this,ws||(document.body.addEventListener("click",ys),ws=!0)},clickCancel:()=>{var t;return null===(t=E())||void 0===t?void 0:t.click()},clickConfirm:Wt,clickDeny:()=>{var t;return null===(t=T())||void 0===t?void 0:t.click()},enableLoading:ve,fire:function(...t){return new this(...t)},getActions:D,getCancelButton:E,getCloseButton:I,getConfirmButton:A,getContainer:w,getDenyButton:T,getFocusableElements:B,getFooter:O,getHtmlContainer:C,getIcon:_,getIconContent:()=>y(a["icon-content"]),getImage:S,getInputLabel:()=>y(a["input-label"]),getLoader:L,getPopup:x,getProgressSteps:M,getTimerLeft:()=>i.timeout&&i.timeout.getTimerLeft(),getTimerProgressBar:R,getTitle:k,getValidationMessage:P,increaseTimer:t=>{if(i.timeout){const e=i.timeout.increase(t);return it(e,!0),e}},isDeprecatedParameter:Je,isLoading:()=>{const t=x();return!!t&&t.hasAttribute("data-loading")},isTimerRunning:()=>Boolean(i.timeout&&i.timeout.isRunning()),isUpdatableParameter:Ze,isValidParameter:Ke,isVisible:()=>tt(x()),mixin:function(t){return class extends(this){_main(e,s){return super._main(e,Object.assign({},t,s))}}},off:(t,e)=>{i.eventEmitter&&(t?e?i.eventEmitter.removeListener(t,e):i.eventEmitter.removeAllListeners(t):i.eventEmitter.reset())},on:(t,e)=>{i.eventEmitter&&i.eventEmitter.on(t,e)},once:(t,e)=>{i.eventEmitter&&i.eventEmitter.once(t,e)},resumeTimer:bs,showLoading:ve,stopTimer:ms,toggleTimer:()=>{const t=i.timeout;return t&&(t.running?ms():bs())}});class _s{constructor(t,e){this.callback=t,this.remaining=e,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.started&&this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=(new Date).getTime()-this.started.getTime()),this.remaining}increase(t){const e=this.running;return e&&this.stop(),this.remaining+=t,e&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const ks=["swal-title","swal-html","swal-footer"],Cs=t=>{const e={};return Array.from(t.querySelectorAll("swal-param")).forEach(t=>{Ds(t,["name","value"]);const s=t.getAttribute("name"),i=t.getAttribute("value");s&&i&&(e[s]=s in qe&&"boolean"==typeof qe[s]?"false"!==i:s in qe&&"object"==typeof qe[s]?JSON.parse(i):i)}),e},Ss=t=>{const e={};return Array.from(t.querySelectorAll("swal-function-param")).forEach(t=>{const s=t.getAttribute("name"),i=t.getAttribute("value");s&&i&&(e[s]=new Function(`return ${i}`)())}),e},Ms=t=>{const e={};return Array.from(t.querySelectorAll("swal-button")).forEach(t=>{Ds(t,["type","color","aria-label"]);const s=t.getAttribute("type");if(s&&["confirm","cancel","deny"].includes(s)){if(e[`${s}ButtonText`]=t.innerHTML,e[`show${c(s)}Button`]=!0,t.hasAttribute("color")){const i=t.getAttribute("color");null!==i&&(e[`${s}ButtonColor`]=i)}if(t.hasAttribute("aria-label")){const i=t.getAttribute("aria-label");null!==i&&(e[`${s}ButtonAriaLabel`]=i)}}}),e},Ps=t=>{const e={},s=t.querySelector("swal-image");return s&&(Ds(s,["src","width","height","alt"]),s.hasAttribute("src")&&(e.imageUrl=s.getAttribute("src")||void 0),s.hasAttribute("width")&&(e.imageWidth=s.getAttribute("width")||void 0),s.hasAttribute("height")&&(e.imageHeight=s.getAttribute("height")||void 0),s.hasAttribute("alt")&&(e.imageAlt=s.getAttribute("alt")||void 0)),e},As=t=>{const e={},s=t.querySelector("swal-icon");return s&&(Ds(s,["type","color"]),s.hasAttribute("type")&&(e.icon=s.getAttribute("type")),s.hasAttribute("color")&&(e.iconColor=s.getAttribute("color")),e.iconHtml=s.innerHTML),e},Es=t=>{const e={},s=t.querySelector("swal-input");s&&(Ds(s,["type","label","placeholder","value"]),e.input=s.getAttribute("type")||"text",s.hasAttribute("label")&&(e.inputLabel=s.getAttribute("label")),s.hasAttribute("placeholder")&&(e.inputPlaceholder=s.getAttribute("placeholder")),s.hasAttribute("value")&&(e.inputValue=s.getAttribute("value")));const i=Array.from(t.querySelectorAll("swal-input-option"));return i.length&&(e.inputOptions={},i.forEach(t=>{Ds(t,["value"]);const s=t.getAttribute("value");if(!s)return;const i=t.innerHTML;e.inputOptions[s]=i})),e},Ts=(t,e)=>{const s={};for(const i in e){const n=e[i],o=t.querySelector(n);o&&(Ds(o,[]),s[n.replace(/^swal-/,"")]=o.innerHTML.trim())}return s},Ls=t=>{const e=ks.concat(["swal-param","swal-function-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(t.children).forEach(t=>{const s=t.tagName.toLowerCase();e.includes(s)||h(`Unrecognized element <${s}>`)})},Ds=(t,e)=>{Array.from(t.attributes).forEach(s=>{-1===e.indexOf(s.name)&&h([`Unrecognized attribute "${s.name}" on <${t.tagName.toLowerCase()}>.`,e.length?`Allowed attributes are: ${e.join(", ")}`:"To set the value, use HTML within the element."])})},Os=t=>{var e,s;const n=w(),o=x();if(!n||!o)return;"function"==typeof t.willOpen&&t.willOpen(o),null===(e=i.eventEmitter)||void 0===e||e.emit("willOpen",o);const a=window.getComputedStyle(document.body).overflowY;if(zs(n,o,t),setTimeout(()=>{Is(n,o)},10),z()&&(Bs(n,void 0!==t.scrollbarPadding&&t.scrollbarPadding,a),(()=>{const t=w();Array.from(document.body.children).forEach(e=>{e.contains(t)||(e.hasAttribute("aria-hidden")&&e.setAttribute("data-previous-aria-hidden",e.getAttribute("aria-hidden")||""),e.setAttribute("aria-hidden","true"))})})()),F()||i.previousActiveElement||(i.previousActiveElement=document.activeElement),"function"==typeof t.didOpen){const e=t.didOpen;setTimeout(()=>e(o))}null===(s=i.eventEmitter)||void 0===s||s.emit("didOpen",o)},Rs=t=>{const e=x();if(!e||t.target!==e)return;const s=w();s&&(e.removeEventListener("animationend",Rs),e.removeEventListener("transitionend",Rs),s.style.overflowY="auto",U(s,a["no-transition"]))},Is=(t,e)=>{st(e)?(t.style.overflowY="hidden",e.addEventListener("animationend",Rs),e.addEventListener("transitionend",Rs)):t.style.overflowY="auto"},Bs=(t,e,s)=>{(()=>{if(ie&&!V(document.body,a.iosfix)){const t=document.body.scrollTop;document.body.style.top=-1*t+"px",q(document.body,a.iosfix),ne()}})(),e&&"hidden"!==s&&ce(s),setTimeout(()=>{t.scrollTop=0})},zs=(t,e,s)=>{var i;null!==(i=s.showClass)&&void 0!==i&&i.backdrop&&q(t,s.showClass.backdrop),s.animation?(e.style.setProperty("opacity","0","important"),K(e,"grid"),setTimeout(()=>{var t;null!==(t=s.showClass)&&void 0!==t&&t.popup&&q(e,s.showClass.popup),e.style.removeProperty("opacity")},10)):K(e,"grid"),q([document.documentElement,document.body],a.shown),s.heightAuto&&s.backdrop&&!s.toast&&q([document.documentElement,document.body],a["height-auto"])};var Fs=(t,e)=>/^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address"),$s=(t,e)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL");function Vs(t){(function(t){t.inputValidator||("email"===t.input&&(t.inputValidator=Fs),"url"===t.input&&(t.inputValidator=$s))})(t),t.showLoaderOnConfirm&&!t.preConfirm&&h("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),function(t){(!t.target||"string"==typeof t.target&&!document.querySelector(t.target)||"string"!=typeof t.target&&!t.target.appendChild)&&(h('Target parameter is not valid, defaulting to "body"'),t.target="body")}(t),"string"==typeof t.title&&(t.title=t.title.split("\n").join("<br />")),at(t)}let Hs;var js=new WeakMap;class Ns{constructor(...e){if(s(this,js,Promise.resolve({isConfirmed:!1,isDenied:!1,isDismissed:!0})),"undefined"==typeof window)return;Hs=this;const i=Object.freeze(this.constructor.argsToParams(e));var n,o,a;this.params=i,this.isAwaitingPromise=!1,n=js,o=this,a=this._main(Hs.params),n.set(t(n,o),a)}_main(t,e={}){if(es(Object.assign({},e,t)),i.currentInstance){const t=ee.swalPromiseResolve.get(i.currentInstance),{isAwaitingPromise:e}=i.currentInstance;i.currentInstance._destroy(),e||t({isDismissed:!0}),z()&&se()}i.currentInstance=Hs;const s=qs(t,e);Vs(s),Object.freeze(s),i.timeout&&(i.timeout.stop(),delete i.timeout),clearTimeout(i.restoreFocusTimeout);const n=Us(Hs);return Nt(Hs,s),gt.innerParams.set(Hs,s),Ws(Hs,n,s)}then(t){return e(js,this).then(t)}finally(t){return e(js,this).finally(t)}}const Ws=(t,e,s)=>new Promise((n,o)=>{const a=e=>{t.close({isDismissed:!0,dismiss:e,isConfirmed:!1,isDenied:!1})};ee.swalPromiseResolve.set(t,n),ee.swalPromiseReject.set(t,o),e.confirmButton.onclick=()=>{(t=>{const e=gt.innerParams.get(t);t.disableButtons(),e.input?Ae(t,"confirm"):Oe(t,!0)})(t)},e.denyButton.onclick=()=>{(t=>{const e=gt.innerParams.get(t);t.disableButtons(),e.returnInputValueOnDeny?Ae(t,"deny"):Te(t,!1)})(t)},e.cancelButton.onclick=()=>{((t,e)=>{t.disableButtons(),e(qt.cancel)})(t,a)},e.closeButton.onclick=()=>{a(qt.close)},((t,e,s)=>{t.toast?cs(t,e,s):(us(e),ps(e),gs(t,e,s))})(s,e,a),((t,e,s)=>{if(Ut(t),!e.toast){const i=t=>Zt(e,t,s);t.keydownHandler=i;const n=e.keydownListenerCapture?window:x();if(n){t.keydownTarget=n,t.keydownListenerCapture=e.keydownListenerCapture;const s=i;t.keydownTarget.addEventListener("keydown",s,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0}}})(i,s,a),((t,e)=>{"select"===e.input||"radio"===e.input?Ce(t,e):["text","email","number","tel","textarea"].some(t=>t===e.input)&&(f(e.inputValue)||b(e.inputValue))&&(ve(A()),Se(t,e))})(t,s),Os(s),Ys(i,s,a),Xs(e,s),setTimeout(()=>{e.container.scrollTop=0})}),qs=(t,e)=>{const s=(t=>{const e="string"==typeof t.template?document.querySelector(t.template):t.template;if(!e)return{};const s=e.content;return Ls(s),Object.assign(Cs(s),Ss(s),Ms(s),Ps(s),As(s),Es(s),Ts(s,ks))})(t),i=Object.assign({},qe,e,s,t);return i.showClass=Object.assign({},qe.showClass,i.showClass),i.hideClass=Object.assign({},qe.hideClass,i.hideClass),!1===i.animation&&(i.showClass={backdrop:"swal2-noanimation"},i.hideClass={}),i},Us=t=>{const e={popup:x(),container:w(),actions:D(),confirmButton:A(),denyButton:T(),cancelButton:E(),loader:L(),closeButton:I(),validationMessage:P(),progressSteps:M()};return gt.domCache.set(t,e),e},Ys=(t,e,s)=>{const i=R();Z(i),e.timer&&(t.timeout=new _s(()=>{s("timer"),delete t.timeout},e.timer),e.timerProgressBar&&i&&(K(i),H(i,e,"timerProgressBar"),setTimeout(()=>{t.timeout&&t.timeout.running&&it(e.timer)})))},Xs=(t,e)=>{if(!e.toast)return g(e.allowEnterKey)?void(Ks(t)||Zs(t,e)||Yt(-1,1)):(p("allowEnterKey"),void Js())},Ks=t=>{const e=Array.from(t.popup.querySelectorAll("[autofocus]"));for(const t of e)if(t instanceof HTMLElement&&tt(t))return t.focus(),!0;return!1},Zs=(t,e)=>e.focusDeny&&tt(t.denyButton)?(t.denyButton.focus(),!0):e.focusCancel&&tt(t.cancelButton)?(t.cancelButton.focus(),!0):!(!e.focusConfirm||!tt(t.confirmButton)||(t.confirmButton.focus(),0)),Js=()=>{document.activeElement instanceof HTMLElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};Ns.prototype.disableButtons=Ve,Ns.prototype.enableButtons=$e,Ns.prototype.getInput=Be,Ns.prototype.disableInput=je,Ns.prototype.enableInput=He,Ns.prototype.hideLoading=Re,Ns.prototype.disableLoading=Re,Ns.prototype.showValidationMessage=Ne,Ns.prototype.resetValidationMessage=We,Ns.prototype.close=de,Ns.prototype.closePopup=de,Ns.prototype.closeModal=de,Ns.prototype.closeToast=de,Ns.prototype.rejectPromise=pe,Ns.prototype.update=ss,Ns.prototype._destroy=ns,Object.assign(Ns,xs),Object.keys(ls).forEach(t=>{Ns[t]=function(...e){if(Hs&&Hs[t])return Hs[t](...e)}}),Ns.DismissReason=qt,Ns.version="11.26.17";const Gs=Ns;return Gs.default=Gs,Gs}(),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2),"undefined"!=typeof document&&function(t,e){var s=t.createElement("style");if(t.getElementsByTagName("head")[0].appendChild(s),s.styleSheet)s.styleSheet.disabled||(s.styleSheet.cssText=e);else try{s.innerHTML=e}catch(t){s.innerText=e}}(document,':root{--swal2-outline: 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-container-padding: 0.625em;--swal2-backdrop: rgba(0, 0, 0, 0.4);--swal2-backdrop-transition: background-color 0.15s;--swal2-width: 32em;--swal2-padding: 0 0 1.25em;--swal2-border: none;--swal2-border-radius: 0.3125rem;--swal2-background: white;--swal2-color: #545454;--swal2-show-animation: swal2-show 0.3s;--swal2-hide-animation: swal2-hide 0.15s forwards;--swal2-icon-zoom: 1;--swal2-icon-animations: true;--swal2-title-padding: 0.8em 1em 0;--swal2-html-container-padding: 1em 1.6em 0.3em;--swal2-input-border: 1px solid #d9d9d9;--swal2-input-border-radius: 0.1875em;--swal2-input-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-background: transparent;--swal2-input-transition: border-color 0.2s, box-shadow 0.2s;--swal2-input-hover-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-focus-border: 1px solid #b4dbed;--swal2-input-focus-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-progress-step-background: #add8e6;--swal2-validation-message-background: #f0f0f0;--swal2-validation-message-color: #666;--swal2-footer-border-color: #eee;--swal2-footer-background: transparent;--swal2-footer-color: inherit;--swal2-timer-progress-bar-background: rgba(0, 0, 0, 0.3);--swal2-close-button-position: initial;--swal2-close-button-inset: auto;--swal2-close-button-font-size: 2.5em;--swal2-close-button-color: #ccc;--swal2-close-button-transition: color 0.2s, box-shadow 0.2s;--swal2-close-button-outline: initial;--swal2-close-button-box-shadow: inset 0 0 0 3px transparent;--swal2-close-button-focus-box-shadow: inset var(--swal2-outline);--swal2-close-button-hover-transform: none;--swal2-actions-justify-content: center;--swal2-actions-width: auto;--swal2-actions-margin: 1.25em auto 0;--swal2-actions-padding: 0;--swal2-actions-border-radius: 0;--swal2-actions-background: transparent;--swal2-action-button-transition: background-color 0.2s, box-shadow 0.2s;--swal2-action-button-hover: black 10%;--swal2-action-button-active: black 10%;--swal2-confirm-button-box-shadow: none;--swal2-confirm-button-border-radius: 0.25em;--swal2-confirm-button-background-color: #7066e0;--swal2-confirm-button-color: #fff;--swal2-deny-button-box-shadow: none;--swal2-deny-button-border-radius: 0.25em;--swal2-deny-button-background-color: #dc3741;--swal2-deny-button-color: #fff;--swal2-cancel-button-box-shadow: none;--swal2-cancel-button-border-radius: 0.25em;--swal2-cancel-button-background-color: #6e7881;--swal2-cancel-button-color: #fff;--swal2-toast-show-animation: swal2-toast-show 0.5s;--swal2-toast-hide-animation: swal2-toast-hide 0.1s forwards;--swal2-toast-border: none;--swal2-toast-box-shadow: 0 0 1px hsl(0deg 0% 0% / 0.075), 0 1px 2px hsl(0deg 0% 0% / 0.075), 1px 2px 4px hsl(0deg 0% 0% / 0.075), 1px 3px 8px hsl(0deg 0% 0% / 0.075), 2px 4px 16px hsl(0deg 0% 0% / 0.075)}[data-swal2-theme=dark]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}@media(prefers-color-scheme: dark){[data-swal2-theme=auto]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px var(--swal2-backdrop)}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}@media print{body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown) .swal2-container{position:static !important}}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:var(--swal2-container-padding);overflow-x:hidden;transition:var(--swal2-backdrop-transition);-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:var(--swal2-backdrop)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container)[popover]{width:auto;border:0}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:var(--swal2-width);max-width:100%;padding:var(--swal2-padding);border:var(--swal2-border);border-radius:var(--swal2-border-radius);background:var(--swal2-background);color:var(--swal2-color);font-family:inherit;font-size:1rem;container-name:swal2-popup}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable{cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable div:where(.swal2-icon){cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging{cursor:grabbing}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging div:where(.swal2-icon){cursor:grabbing}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:var(--swal2-title-padding);color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;overflow-wrap:break-word;cursor:initial}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:var(--swal2-actions-justify-content);width:var(--swal2-actions-width);margin:var(--swal2-actions-margin);padding:var(--swal2-actions-padding);border-radius:var(--swal2-actions-border-radius);background:var(--swal2-actions-background)}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:var(--swal2-action-button-transition);border:none;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border-radius:var(--swal2-confirm-button-border-radius);background:initial;background-color:var(--swal2-confirm-button-background-color);box-shadow:var(--swal2-confirm-button-box-shadow);color:var(--swal2-confirm-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):active{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border-radius:var(--swal2-deny-button-border-radius);background:initial;background-color:var(--swal2-deny-button-background-color);box-shadow:var(--swal2-deny-button-box-shadow);color:var(--swal2-deny-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):hover{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):active{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border-radius:var(--swal2-cancel-button-border-radius);background:initial;background-color:var(--swal2-cancel-button-background-color);box-shadow:var(--swal2-cancel-button-box-shadow);color:var(--swal2-cancel-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):hover{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):active{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none;box-shadow:var(--swal2-action-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-styled)[disabled]:not(.swal2-loading){opacity:.4}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid var(--swal2-footer-border-color);background:var(--swal2-footer-background);color:var(--swal2-footer-color);font-size:1em;text-align:center;cursor:initial}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:var(--swal2-border-radius);border-bottom-left-radius:var(--swal2-border-radius)}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:var(--swal2-timer-progress-bar-background)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em;cursor:initial}div:where(.swal2-container) button:where(.swal2-close){position:var(--swal2-close-button-position);inset:var(--swal2-close-button-inset);z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:var(--swal2-close-button-transition);border:none;border-radius:var(--swal2-border-radius);outline:var(--swal2-close-button-outline);background:rgba(0,0,0,0);color:var(--swal2-close-button-color);font-family:monospace;font-size:var(--swal2-close-button-font-size);cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:var(--swal2-close-button-hover-transform);background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:var(--swal2-close-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-html-container){z-index:1;justify-content:center;margin:0;padding:var(--swal2-html-container-padding);overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;overflow-wrap:break-word;word-break:break-word;cursor:initial}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:var(--swal2-input-transition);border:var(--swal2-input-border);border-radius:var(--swal2-input-border-radius);background:var(--swal2-input-background);box-shadow:var(--swal2-input-box-shadow);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):hover,div:where(.swal2-container) input:where(.swal2-file):hover,div:where(.swal2-container) textarea:where(.swal2-textarea):hover{box-shadow:var(--swal2-input-hover-box-shadow)}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:var(--swal2-input-focus-border);outline:none;box-shadow:var(--swal2-input-focus-box-shadow)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:var(--swal2-background)}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:var(--swal2-input-background);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:var(--swal2-input-background);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:var(--swal2-background);color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:var(--swal2-validation-message-background);color:var(--swal2-validation-message-color);font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:var(--swal2-progress-step-background);color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:var(--swal2-progress-step-background)}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;zoom:var(--swal2-icon-zoom);border:.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}}div:where(.swal2-icon).swal2-warning{border-color:#f8bb86;color:#f8bb86}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}}div:where(.swal2-icon).swal2-info{border-color:#3fc3ee;color:#3fc3ee}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}}div:where(.swal2-icon).swal2-question{border-color:#87adbd;color:#87adbd}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:var(--swal2-show-animation)}.swal2-hide{animation:var(--swal2-hide-animation)}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;border:var(--swal2-toast-border);background:var(--swal2-background);box-shadow:var(--swal2-toast-box-shadow);pointer-events:all}.swal2-toast>*{grid-column:2}.swal2-toast h2:where(.swal2-title){margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-toast .swal2-loading{justify-content:center}.swal2-toast input:where(.swal2-input){height:2em;margin:.5em;font-size:1em}.swal2-toast .swal2-validation-message{font-size:1em}.swal2-toast div:where(.swal2-footer){margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-toast button:where(.swal2-close){grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-toast div:where(.swal2-html-container){margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-toast div:where(.swal2-html-container):empty{padding:0}.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-toast div:where(.swal2-actions){justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-toast button:where(.swal2-styled){margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}@container swal2-popup style(--swal2-icon-animations:true){.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}}.swal2-toast.swal2-show{animation:var(--swal2-toast-show-animation)}.swal2-toast.swal2-hide{animation:var(--swal2-toast-hide-animation)}@keyframes swal2-show{0%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}100%{transform:translate3d(0, 0, 0) scale(1);opacity:1}}@keyframes swal2-hide{0%{transform:translate3d(0, 0, 0) scale(1);opacity:1}100%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}')}},e={};function s(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";const t="loading",e=(t,e)=>{const s=document.querySelector(t);if(s)return void e(s);const i=new MutationObserver((s,i)=>{const n=document.querySelector(t);n&&(i.disconnect(),e(n))});i.observe(document.documentElement,{childList:!0,subtree:!0})},i=(e,s)=>{e&&(s?e.classList.add(t):e.classList.remove(t))},n=(t,e)=>{document.addEventListener(t,s=>{const i=s.target;let n={e:s,target:i};e.forEach(e=>{n={...n,...e},e.conditionBeforeCallBack&&!0!==e.conditionBeforeCallBack(n)||"keydown"===t&&e.checkIsEventEnter&&"Enter"!==s.key||i.closest(e.selector)&&(e.class?e.class[e.callBack](n):e.callBack(n))})})};window.lpToggleEnableInit=0,window.lpFullScreenViewInit=0;const o="lp-stats:filter-changed",a="lp-stats:export-csv",r="lp-stats:range-resolved",l="previous_period",c=new class{constructor(){const t=new URL(window.location.href).searchParams;this.filters={filtertype:t.get("filtertype")||"today",date:t.get("date")||"",compare:"previous_year"===t.get("compare")?"previous_year":l,instructor_id:parseInt(t.get("instructor_id"),10)||0,category_id:parseInt(t.get("category_id"),10)||0}}get(){return{...this.filters}}set(t={}){this.filters={...this.filters,...t},this.syncUrl(),document.dispatchEvent(new CustomEvent(o,{detail:this.get()}))}syncUrl(){if(!window.history||"function"!=typeof window.history.replaceState)return;const t=new URL(window.location.href),e=t.searchParams,{filtertype:s,date:i,compare:n,instructor_id:o,category_id:a}=this.filters;this.writeParam(e,"filtertype",s&&"today"!==s?s:""),this.writeParam(e,"date",i),this.writeParam(e,"compare",n&&n!==l?n:""),this.writeParam(e,"instructor_id",o>0?String(o):""),this.writeParam(e,"category_id",a>0?String(a):""),window.history.replaceState(null,"",t.toString())}writeParam(t,e,s){s?t.set(e,s):t.delete(e)}},h=()=>window.lpAdminStatisticSettings||{},d=(t,e="")=>{const{i18n:s={}}=h();return s[t]||e},u=(t,e={},s={})=>{const i=window.lpDataAdmin||{},n=h().restNamespace||"lp/v1/statistics",o=((t,e)=>{const s=new URL(t);return Object.keys(e).forEach(t=>{s.searchParams.set(t,e[t])}),s})(`${i.lp_rest_url||"/wp-json/"}${n}/${t}`,{...c.get(),...e}),a="function"==typeof s.error?s.error:t=>console.error("LP Statistics:",t);((t,e={},s={})=>{"function"==typeof s.before&&s.before(),fetch(t,{method:"GET",...e}).then(t=>t.json()).then(t=>{"function"==typeof s.success&&s.success(t)}).catch(t=>{"function"==typeof s.error&&s.error(t)}).finally(()=>{"function"==typeof s.completed&&s.completed()})})(o,{headers:{"X-WP-Nonce":i.nonce||""}},{...s,success:t=>{if(t&&"success"===t.status){const e=t.data&&t.data.range;e&&e.label&&document.dispatchEvent(new CustomEvent(r,{detail:e})),"function"==typeof s.success&&s.success(t)}else a(new Error(t&&t.message||d("loadError","Request failed.")))},error:a})};function p(t){return t+.5|0}const g=(t,e,s)=>Math.max(Math.min(t,s),e);function f(t){return g(p(2.55*t),0,255)}function m(t){return g(p(255*t),0,255)}function b(t){return g(p(t/2.55)/100,0,1)}function w(t){return g(p(100*t),0,100)}const v={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},y=[..."0123456789ABCDEF"],x=t=>y[15&t],_=t=>y[(240&t)>>4]+y[15&t],k=t=>(240&t)>>4==(15&t);const C=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function S(t,e,s){const i=e*Math.min(s,1-s),n=(e,n=(e+t/30)%12)=>s-i*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function M(t,e,s){const i=(i,n=(i+t/60)%6)=>s-s*e*Math.max(Math.min(n,4-n,1),0);return[i(5),i(3),i(1)]}function P(t,e,s){const i=S(t,1,.5);let n;for(e+s>1&&(n=1/(e+s),e*=n,s*=n),n=0;n<3;n++)i[n]*=1-e-s,i[n]+=e;return i}function A(t){const e=t.r/255,s=t.g/255,i=t.b/255,n=Math.max(e,s,i),o=Math.min(e,s,i),a=(n+o)/2;let r,l,c;return n!==o&&(c=n-o,l=a>.5?c/(2-n-o):c/(n+o),r=function(t,e,s,i,n){return t===n?(e-s)/i+(e<s?6:0):e===n?(s-t)/i+2:(t-e)/i+4}(e,s,i,c,n),r=60*r+.5),[0|r,l||0,a]}function E(t,e,s,i){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,s,i)).map(m)}function T(t,e,s){return E(S,t,e,s)}function L(t){return(t%360+360)%360}const D={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},O={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let R;const I=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,B=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,z=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function F(t,e,s){if(t){let i=A(t);i[e]=Math.max(0,Math.min(i[e]+i[e]*s,0===e?360:1)),i=T(i),t.r=i[0],t.g=i[1],t.b=i[2]}}function $(t,e){return t?Object.assign(e||{},t):t}function V(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=m(t[3]))):(e=$(t,{r:0,g:0,b:0,a:1})).a=m(e.a),e}function H(t){return"r"===t.charAt(0)?function(t){const e=I.exec(t);let s,i,n,o=255;if(e){if(e[7]!==s){const t=+e[7];o=e[8]?f(t):g(255*t,0,255)}return s=+e[1],i=+e[3],n=+e[5],s=255&(e[2]?f(s):g(s,0,255)),i=255&(e[4]?f(i):g(i,0,255)),n=255&(e[6]?f(n):g(n,0,255)),{r:s,g:i,b:n,a:o}}}(t):function(t){const e=C.exec(t);let s,i=255;if(!e)return;e[5]!==s&&(i=e[6]?f(+e[5]):m(+e[5]));const n=L(+e[2]),o=+e[3]/100,a=+e[4]/100;return s="hwb"===e[1]?function(t,e,s){return E(P,t,e,s)}(n,o,a):"hsv"===e[1]?function(t,e,s){return E(M,t,e,s)}(n,o,a):T(n,o,a),{r:s[0],g:s[1],b:s[2],a:i}}(t)}class j{constructor(t){if(t instanceof j)return t;const e=typeof t;let s;var i,n,o;"object"===e?s=V(t):"string"===e&&(o=(i=t).length,"#"===i[0]&&(4===o||5===o?n={r:255&17*v[i[1]],g:255&17*v[i[2]],b:255&17*v[i[3]],a:5===o?17*v[i[4]]:255}:7!==o&&9!==o||(n={r:v[i[1]]<<4|v[i[2]],g:v[i[3]]<<4|v[i[4]],b:v[i[5]]<<4|v[i[6]],a:9===o?v[i[7]]<<4|v[i[8]]:255})),s=n||function(t){R||(R=function(){const t={},e=Object.keys(O),s=Object.keys(D);let i,n,o,a,r;for(i=0;i<e.length;i++){for(a=r=e[i],n=0;n<s.length;n++)o=s[n],r=r.replace(o,D[o]);o=parseInt(O[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),R.transparent=[0,0,0,0]);const e=R[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||H(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=$(this._rgb);return t&&(t.a=b(t.a)),t}set rgb(t){this._rgb=V(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${b(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?(t=this._rgb,e=(t=>k(t.r)&&k(t.g)&&k(t.b)&&k(t.a))(t)?x:_,t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0):void 0;var t,e}hslString(){return this._valid?function(t){if(!t)return;const e=A(t),s=e[0],i=w(e[1]),n=w(e[2]);return t.a<255?`hsla(${s}, ${i}%, ${n}%, ${b(t.a)})`:`hsl(${s}, ${i}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,i=t.rgb;let n;const o=e===n?.5:e,a=2*o-1,r=s.a-i.a,l=((a*r===-1?a:(a+r)/(1+a*r))+1)/2;n=1-l,s.r=255&l*s.r+n*i.r+.5,s.g=255&l*s.g+n*i.g+.5,s.b=255&l*s.b+n*i.b+.5,s.a=o*s.a+(1-o)*i.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,s){const i=z(b(t.r)),n=z(b(t.g)),o=z(b(t.b));return{r:m(B(i+s*(z(b(e.r))-i))),g:m(B(n+s*(z(b(e.g))-n))),b:m(B(o+s*(z(b(e.b))-o))),a:t.a+s*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new j(this.rgb)}alpha(t){return this._rgb.a=m(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=p(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return F(this._rgb,2,t),this}darken(t){return F(this._rgb,2,-t),this}saturate(t){return F(this._rgb,1,t),this}desaturate(t){return F(this._rgb,1,-t),this}rotate(t){return function(t,e){var s=A(t);s[0]=L(s[0]+e),s=T(s),t.r=s[0],t.g=s[1],t.b=s[2]}(this._rgb,t),this}}function N(){}const W=(()=>{let t=0;return()=>t++})();function q(t){return null==t}function U(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function Y(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function X(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function K(t,e){return X(t)?t:e}function Z(t,e){return void 0===t?e:t}const J=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function G(t,e,s){if(t&&"function"==typeof t.call)return t.apply(s,e)}function Q(t,e,s,i){let n,o,a;if(U(t))if(o=t.length,i)for(n=o-1;n>=0;n--)e.call(s,t[n],n);else for(n=0;n<o;n++)e.call(s,t[n],n);else if(Y(t))for(a=Object.keys(t),o=a.length,n=0;n<o;n++)e.call(s,t[a[n]],a[n])}function tt(t,e){let s,i,n,o;if(!t||!e||t.length!==e.length)return!1;for(s=0,i=t.length;s<i;++s)if(n=t[s],o=e[s],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function et(t){if(U(t))return t.map(et);if(Y(t)){const e=Object.create(null),s=Object.keys(t),i=s.length;let n=0;for(;n<i;++n)e[s[n]]=et(t[s[n]]);return e}return t}function st(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function it(t,e,s,i){if(!st(t))return;const n=e[t],o=s[t];Y(n)&&Y(o)?nt(n,o,i):e[t]=et(o)}function nt(t,e,s){const i=U(e)?e:[e],n=i.length;if(!Y(t))return t;const o=(s=s||{}).merger||it;let a;for(let e=0;e<n;++e){if(a=i[e],!Y(a))continue;const n=Object.keys(a);for(let e=0,i=n.length;e<i;++e)o(n[e],t,a,s)}return t}function ot(t,e){return nt(t,e,{merger:at})}function at(t,e,s){if(!st(t))return;const i=e[t],n=s[t];Y(i)&&Y(n)?ot(i,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=et(n))}const rt={"":t=>t,x:t=>t.x,y:t=>t.y};function lt(t,e){const s=rt[e]||(rt[e]=function(t){const e=function(t){const e=t.split("."),s=[];let i="";for(const t of e)i+=t,i.endsWith("\\")?i=i.slice(0,-1)+".":(s.push(i),i="");return s}(t);return t=>{for(const s of e){if(""===s)break;t=t&&t[s]}return t}}(e));return s(t)}function ct(t){return t.charAt(0).toUpperCase()+t.slice(1)}const ht=t=>void 0!==t,dt=t=>"function"==typeof t,ut=(t,e)=>{if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;return!0},pt=Math.PI,gt=2*pt,ft=gt+pt,mt=Number.POSITIVE_INFINITY,bt=pt/180,wt=pt/2,vt=pt/4,yt=2*pt/3,xt=Math.log10,_t=Math.sign;function kt(t,e,s){return Math.abs(t-e)<s}function Ct(t){const e=Math.round(t);t=kt(t,e,t/1e3)?e:t;const s=Math.pow(10,Math.floor(xt(t))),i=t/s;return(i<=1?1:i<=2?2:i<=5?5:10)*s}function St(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function Mt(t,e,s){let i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i][s],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function Pt(t){return t*(pt/180)}function At(t){return t*(180/pt)}function Et(t){if(!X(t))return;let e=1,s=0;for(;Math.round(t*e)/e!==t;)e*=10,s++;return s}function Tt(t,e){const s=e.x-t.x,i=e.y-t.y,n=Math.sqrt(s*s+i*i);let o=Math.atan2(i,s);return o<-.5*pt&&(o+=gt),{angle:o,distance:n}}function Lt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Dt(t,e){return(t-e+ft)%gt-pt}function Ot(t){return(t%gt+gt)%gt}function Rt(t,e,s,i){const n=Ot(t),o=Ot(e),a=Ot(s),r=Ot(o-n),l=Ot(a-n),c=Ot(n-o),h=Ot(n-a);return n===o||n===a||i&&o===a||r>l&&c<h}function It(t,e,s){return Math.max(e,Math.min(s,t))}function Bt(t,e,s,i=1e-6){return t>=Math.min(e,s)-i&&t<=Math.max(e,s)+i}function zt(t,e,s){s=s||(s=>t[s]<e);let i,n=t.length-1,o=0;for(;n-o>1;)i=o+n>>1,s(i)?o=i:n=i;return{lo:o,hi:n}}const Ft=(t,e,s,i)=>zt(t,s,i?i=>{const n=t[i][e];return n<s||n===s&&t[i+1][e]===s}:i=>t[i][e]<s),$t=(t,e,s)=>zt(t,s,i=>t[i][e]>=s),Vt=["push","pop","shift","splice","unshift"];function Ht(t,e){const s=t._chartjs;if(!s)return;const i=s.listeners,n=i.indexOf(e);-1!==n&&i.splice(n,1),i.length>0||(Vt.forEach(e=>{delete t[e]}),delete t._chartjs)}function jt(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Nt="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function Wt(t,e){let s=[],i=!1;return function(...n){s=n,i||(i=!0,Nt.call(window,()=>{i=!1,t.apply(e,s)}))}}const qt=t=>"start"===t?"left":"end"===t?"right":"center",Ut=(t,e,s)=>"start"===t?e:"end"===t?s:(e+s)/2;function Yt(t,e,s){const i=e.length;let n=0,o=i;if(t._sorted){const{iScale:a,vScale:r,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,h=a.axis,{min:d,max:u,minDefined:p,maxDefined:g}=a.getUserBounds();if(p){if(n=Math.min(Ft(l,h,d).lo,s?i:Ft(e,h,a.getPixelForValue(d)).lo),c){const t=l.slice(0,n+1).reverse().findIndex(t=>!q(t[r.axis]));n-=Math.max(0,t)}n=It(n,0,i-1)}if(g){let t=Math.max(Ft(l,a.axis,u,!0).hi+1,s?0:Ft(e,h,a.getPixelForValue(u),!0).hi+1);if(c){const e=l.slice(t-1).findIndex(t=>!q(t[r.axis]));t+=Math.max(0,e)}o=It(t,n,i)-n}else o=i-n}return{start:n,count:o}}function Xt(t){const{xScale:e,yScale:s,_scaleRanges:i}=t,n={xmin:e.min,xmax:e.max,ymin:s.min,ymax:s.max};if(!i)return t._scaleRanges=n,!0;const o=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==s.min||i.ymax!==s.max;return Object.assign(i,n),o}const Kt=t=>0===t||1===t,Zt=(t,e,s)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*gt/s),Jt=(t,e,s)=>Math.pow(2,-10*t)*Math.sin((t-e)*gt/s)+1,Gt={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*wt),easeOutSine:t=>Math.sin(t*wt),easeInOutSine:t=>-.5*(Math.cos(pt*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>Kt(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Kt(t)?t:Zt(t,.075,.3),easeOutElastic:t=>Kt(t)?t:Jt(t,.075,.3),easeInOutElastic(t){const e=.1125;return Kt(t)?t:t<.5?.5*Zt(2*t,e,.45):.5+.5*Jt(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-Gt.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375},easeInOutBounce:t=>t<.5?.5*Gt.easeInBounce(2*t):.5*Gt.easeOutBounce(2*t-1)+.5};function Qt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function te(t){return Qt(t)?t:new j(t)}function ee(t){return Qt(t)?t:new j(t).saturate(.5).darken(.1).hexString()}const se=["x","y","borderWidth","radius","tension"],ie=["color","borderColor","backgroundColor"],ne=new Map;function oe(t,e,s){return function(t,e){e=e||{};const s=t+JSON.stringify(e);let i=ne.get(s);return i||(i=new Intl.NumberFormat(t,e),ne.set(s,i)),i}(e,s).format(t)}const ae={values:t=>U(t)?t:""+t,numeric(t,e,s){if(0===t)return"0";const i=this.chart.options.locale;let n,o=t;if(s.length>1){const e=Math.max(Math.abs(s[0].value),Math.abs(s[s.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let s=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(s)>=1&&t!==Math.floor(t)&&(s=t-Math.floor(t)),s}(t,s)}const a=xt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),oe(t,i,l)},logarithmic(t,e,s){if(0===t)return"0";const i=s[e].significand||t/Math.pow(10,Math.floor(xt(t)));return[1,2,3,5,10,15].includes(i)||e>.8*s.length?ae.numeric.call(this,t,e,s):""}};var re={formatters:ae};const le=Object.create(null),ce=Object.create(null);function he(t,e){if(!e)return t;const s=e.split(".");for(let e=0,i=s.length;e<i;++e){const i=s[e];t=t[i]||(t[i]=Object.create(null))}return t}function de(t,e,s){return"string"==typeof e?nt(he(t,e),s):nt(he(t,""),e)}class ue{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=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>ee(e.backgroundColor),this.hoverBorderColor=(t,e)=>ee(e.borderColor),this.hoverColor=(t,e)=>ee(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return de(this,t,e)}get(t){return he(this,t)}describe(t,e){return de(ce,t,e)}override(t,e){return de(le,t,e)}route(t,e,s,i){const n=he(this,t),o=he(this,s),a="_"+e;Object.defineProperties(n,{[a]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=o[i];return Y(t)?Object.assign({},e,t):Z(t,e)},set(t){this[a]=t}}})}apply(t){t.forEach(t=>t(this))}}var pe=new ue({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:ie},numbers:{type:"number",properties:se}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",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:re.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function ge(t,e,s,i,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,s.push(n)),o>i&&(i=o),i}function fe(t,e,s,i){let n=(i=i||{}).data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(n=i.data={},o=i.garbageCollect=[],i.font=e),t.save(),t.font=e;let a=0;const r=s.length;let l,c,h,d,u;for(l=0;l<r;l++)if(d=s[l],null==d||U(d)){if(U(d))for(c=0,h=d.length;c<h;c++)u=d[c],null==u||U(u)||(a=ge(t,n,o,a,u))}else a=ge(t,n,o,a,d);t.restore();const p=o.length/2;if(p>s.length){for(l=0;l<p;l++)delete n[o[l]];o.splice(0,p)}return a}function me(t,e,s){const i=t.currentDevicePixelRatio,n=0!==s?Math.max(s/2,.5):0;return Math.round((e-n)*i)/i+n}function be(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function we(t,e,s,i){ve(t,e,s,i,null)}function ve(t,e,s,i,n){let o,a,r,l,c,h,d,u;const p=e.pointStyle,g=e.rotation,f=e.radius;let m=(g||0)*bt;if(p&&"object"==typeof p&&(o=p.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(s,i),t.rotate(m),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(f)||f<=0)){switch(t.beginPath(),p){default:n?t.ellipse(s,i,n/2,f,0,0,gt):t.arc(s,i,f,0,gt),t.closePath();break;case"triangle":h=n?n/2:f,t.moveTo(s+Math.sin(m)*h,i-Math.cos(m)*f),m+=yt,t.lineTo(s+Math.sin(m)*h,i-Math.cos(m)*f),m+=yt,t.lineTo(s+Math.sin(m)*h,i-Math.cos(m)*f),t.closePath();break;case"rectRounded":c=.516*f,l=f-c,a=Math.cos(m+vt)*l,d=Math.cos(m+vt)*(n?n/2-c:l),r=Math.sin(m+vt)*l,u=Math.sin(m+vt)*(n?n/2-c:l),t.arc(s-d,i-r,c,m-pt,m-wt),t.arc(s+u,i-a,c,m-wt,m),t.arc(s+d,i+r,c,m,m+wt),t.arc(s-u,i+a,c,m+wt,m+pt),t.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*f,h=n?n/2:l,t.rect(s-h,i-l,2*h,2*l);break}m+=vt;case"rectRot":d=Math.cos(m)*(n?n/2:f),a=Math.cos(m)*f,r=Math.sin(m)*f,u=Math.sin(m)*(n?n/2:f),t.moveTo(s-d,i-r),t.lineTo(s+u,i-a),t.lineTo(s+d,i+r),t.lineTo(s-u,i+a),t.closePath();break;case"crossRot":m+=vt;case"cross":d=Math.cos(m)*(n?n/2:f),a=Math.cos(m)*f,r=Math.sin(m)*f,u=Math.sin(m)*(n?n/2:f),t.moveTo(s-d,i-r),t.lineTo(s+d,i+r),t.moveTo(s+u,i-a),t.lineTo(s-u,i+a);break;case"star":d=Math.cos(m)*(n?n/2:f),a=Math.cos(m)*f,r=Math.sin(m)*f,u=Math.sin(m)*(n?n/2:f),t.moveTo(s-d,i-r),t.lineTo(s+d,i+r),t.moveTo(s+u,i-a),t.lineTo(s-u,i+a),m+=vt,d=Math.cos(m)*(n?n/2:f),a=Math.cos(m)*f,r=Math.sin(m)*f,u=Math.sin(m)*(n?n/2:f),t.moveTo(s-d,i-r),t.lineTo(s+d,i+r),t.moveTo(s+u,i-a),t.lineTo(s-u,i+a);break;case"line":a=n?n/2:Math.cos(m)*f,r=Math.sin(m)*f,t.moveTo(s-a,i-r),t.lineTo(s+a,i+r);break;case"dash":t.moveTo(s,i),t.lineTo(s+Math.cos(m)*(n?n/2:f),i+Math.sin(m)*f);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function ye(t,e,s){return s=s||.5,!e||t&&t.x>e.left-s&&t.x<e.right+s&&t.y>e.top-s&&t.y<e.bottom+s}function xe(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function _e(t){t.restore()}function ke(t,e,s,i,n){if(!e)return t.lineTo(s.x,s.y);if("middle"===n){const i=(e.x+s.x)/2;t.lineTo(i,e.y),t.lineTo(i,s.y)}else"after"===n!=!!i?t.lineTo(e.x,s.y):t.lineTo(s.x,e.y);t.lineTo(s.x,s.y)}function Ce(t,e,s,i){if(!e)return t.lineTo(s.x,s.y);t.bezierCurveTo(i?e.cp1x:e.cp2x,i?e.cp1y:e.cp2y,i?s.cp2x:s.cp1x,i?s.cp2y:s.cp1y,s.x,s.y)}function Se(t,e,s,i,n){if(n.strikethrough||n.underline){const o=t.measureText(i),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=s-o.actualBoundingBoxAscent,c=s+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(a,h),t.lineTo(r,h),t.stroke()}}function Me(t,e){const s=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=s}function Pe(t,e,s,i,n,o={}){const a=U(e)?e:[e],r=o.strokeWidth>0&&""!==o.strokeColor;let l,c;for(t.save(),t.font=n.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),q(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Me(t,o.backdrop),r&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),q(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(c,s,i,o.maxWidth)),t.fillText(c,s,i,o.maxWidth),Se(t,s,i,c,o),i+=Number(n.lineHeight);t.restore()}function Ae(t,e){const{x:s,y:i,w:n,h:o,radius:a}=e;t.arc(s+a.topLeft,i+a.topLeft,a.topLeft,1.5*pt,pt,!0),t.lineTo(s,i+o-a.bottomLeft),t.arc(s+a.bottomLeft,i+o-a.bottomLeft,a.bottomLeft,pt,wt,!0),t.lineTo(s+n-a.bottomRight,i+o),t.arc(s+n-a.bottomRight,i+o-a.bottomRight,a.bottomRight,wt,0,!0),t.lineTo(s+n,i+a.topRight),t.arc(s+n-a.topRight,i+a.topRight,a.topRight,0,-wt,!0),t.lineTo(s+a.topLeft,i)}const Ee=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Te=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Le(t,e){const s=(""+t).match(Ee);if(!s||"normal"===s[1])return 1.2*e;switch(t=+s[2],s[3]){case"px":return t;case"%":t/=100}return e*t}const De=t=>+t||0;function Oe(t,e){const s={},i=Y(e),n=i?Object.keys(e):e,o=Y(t)?i?s=>Z(t[s],t[e[s]]):e=>t[e]:()=>t;for(const t of n)s[t]=De(o(t));return s}function Re(t){return Oe(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Ie(t){return Oe(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Be(t){const e=Re(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ze(t,e){t=t||{},e=e||pe.font;let s=Z(t.size,e.size);"string"==typeof s&&(s=parseInt(s,10));let i=Z(t.style,e.style);i&&!(""+i).match(Te)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const n={family:Z(t.family,e.family),lineHeight:Le(Z(t.lineHeight,e.lineHeight),s),size:s,style:i,weight:Z(t.weight,e.weight),string:""};return n.string=function(t){return!t||q(t.size)||q(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(n),n}function Fe(t,e,s,i){let n,o,a,r=!0;for(n=0,o=t.length;n<o;++n)if(a=t[n],void 0!==a&&(void 0!==e&&"function"==typeof a&&(a=a(e),r=!1),void 0!==s&&U(a)&&(a=a[s%a.length],r=!1),void 0!==a))return i&&!r&&(i.cacheable=!1),a}function $e(t,e){return Object.assign(Object.create(t),e)}function Ve(t,e=[""],s,i,n=()=>t[0]){const o=s||t;void 0===i&&(i=Je("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:i,_getTarget:n,override:s=>Ve([s,...t],e,o,i)};return new Proxy(a,{deleteProperty:(e,s)=>(delete e[s],delete e._keys,delete t[0][s],!0),get:(s,i)=>qe(s,i,()=>function(t,e,s,i){let n;for(const o of e)if(n=Je(Ne(o,t),s),void 0!==n)return We(t,n)?Ke(s,i,t,n):n}(i,e,t,s)),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>Ge(t).includes(e),ownKeys:t=>Ge(t),set(t,e,s){const i=t._storage||(t._storage=n());return t[e]=i[e]=s,delete t._keys,!0}})}function He(t,e,s,i){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:s,_stack:new Set,_descriptors:je(t,i),setContext:e=>He(t,e,s,i),override:n=>He(t.override(n),e,s,i)};return new Proxy(n,{deleteProperty:(e,s)=>(delete e[s],delete t[s],!0),get:(t,e,s)=>qe(t,e,()=>function(t,e,s){const{_proxy:i,_context:n,_subProxy:o,_descriptors:a}=t;let r=i[e];return dt(r)&&a.isScriptable(e)&&(r=function(t,e,s,i){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=s;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||i);return r.delete(t),We(t,l)&&(l=Ke(n._scopes,n,t,l)),l}(e,r,t,s)),U(r)&&r.length&&(r=function(t,e,s,i){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=s;if(void 0!==o.index&&i(t))return e[o.index%e.length];if(Y(e[0])){const s=e,i=n._scopes.filter(t=>t!==s);e=[];for(const l of s){const s=Ke(i,n,t,l);e.push(He(s,o,a&&a[t],r))}}return e}(e,r,t,a.isIndexable)),We(e,r)&&(r=He(r,n,o&&o[e],a)),r}(t,e,s)),getOwnPropertyDescriptor:(e,s)=>e._descriptors.allKeys?Reflect.has(t,s)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,s),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,s)=>Reflect.has(t,s),ownKeys:()=>Reflect.ownKeys(t),set:(e,s,i)=>(t[s]=i,delete e[s],!0)})}function je(t,e={scriptable:!0,indexable:!0}){const{_scriptable:s=e.scriptable,_indexable:i=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:s,indexable:i,isScriptable:dt(s)?s:()=>s,isIndexable:dt(i)?i:()=>i}}const Ne=(t,e)=>t?t+ct(e):e,We=(t,e)=>Y(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function qe(t,e,s){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const i=s();return t[e]=i,i}function Ue(t,e,s){return dt(t)?t(e,s):t}const Ye=(t,e)=>!0===t?e:"string"==typeof t?lt(e,t):void 0;function Xe(t,e,s,i,n){for(const o of e){const e=Ye(s,o);if(e){t.add(e);const o=Ue(e._fallback,s,n);if(void 0!==o&&o!==s&&o!==i)return o}else if(!1===e&&void 0!==i&&s!==i)return null}return!1}function Ke(t,e,s,i){const n=e._rootScopes,o=Ue(e._fallback,s,i),a=[...t,...n],r=new Set;r.add(i);let l=Ze(r,a,s,o||s,i);return null!==l&&(void 0===o||o===s||(l=Ze(r,a,o,l,i),null!==l))&&Ve(Array.from(r),[""],n,o,()=>function(t,e,s){const i=t._getTarget();e in i||(i[e]={});const n=i[e];return U(n)&&Y(s)?s:n||{}}(e,s,i))}function Ze(t,e,s,i,n){for(;s;)s=Xe(t,e,s,i,n);return s}function Je(t,e){for(const s of e){if(!s)continue;const e=s[t];if(void 0!==e)return e}}function Ge(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const s of t)for(const t of Object.keys(s).filter(t=>!t.startsWith("_")))e.add(t);return Array.from(e)}(t._scopes)),e}function Qe(t,e,s,i){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(i);let r,l,c,h;for(r=0,l=i;r<l;++r)c=r+s,h=e[c],a[r]={r:n.parse(lt(h,o),c)};return a}const ts=Number.EPSILON||1e-14,es=(t,e)=>e<t.length&&!t[e].skip&&t[e],ss=t=>"x"===t?"y":"x";function is(t,e,s,i){const n=t.skip?e:t,o=e,a=s.skip?e:s,r=Lt(o,n),l=Lt(a,o);let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=i*c,u=i*h;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function ns(t,e,s){return Math.max(Math.min(t,s),e)}function os(t,e,s,i,n){let o,a,r,l;if(e.spanGaps&&(t=t.filter(t=>!t.skip)),"monotone"===e.cubicInterpolationMode)!function(t,e="x"){const s=ss(e),i=t.length,n=Array(i).fill(0),o=Array(i);let a,r,l,c=es(t,0);for(a=0;a<i;++a)if(r=l,l=c,c=es(t,a+1),l){if(c){const t=c[e]-l[e];n[a]=0!==t?(c[s]-l[s])/t:0}o[a]=r?c?_t(n[a-1])!==_t(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}!function(t,e,s){const i=t.length;let n,o,a,r,l,c=es(t,0);for(let h=0;h<i-1;++h)l=c,c=es(t,h+1),l&&c&&(kt(e[h],0,ts)?s[h]=s[h+1]=0:(n=s[h]/e[h],o=s[h+1]/e[h],r=Math.pow(n,2)+Math.pow(o,2),r<=9||(a=3/Math.sqrt(r),s[h]=n*a*e[h],s[h+1]=o*a*e[h])))}(t,n,o),function(t,e,s="x"){const i=ss(s),n=t.length;let o,a,r,l=es(t,0);for(let c=0;c<n;++c){if(a=r,r=l,l=es(t,c+1),!r)continue;const n=r[s],h=r[i];a&&(o=(n-a[s])/3,r[`cp1${s}`]=n-o,r[`cp1${i}`]=h-o*e[c]),l&&(o=(l[s]-n)/3,r[`cp2${s}`]=n+o,r[`cp2${i}`]=h+o*e[c])}}(t,o,e)}(t,n);else{let s=i?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=is(s,r,t[Math.min(o+1,a-(i?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,s=r}e.capBezierPoints&&function(t,e){let s,i,n,o,a,r=ye(t[0],e);for(s=0,i=t.length;s<i;++s)a=o,o=r,r=s<i-1&&ye(t[s+1],e),o&&(n=t[s],a&&(n.cp1x=ns(n.cp1x,e.left,e.right),n.cp1y=ns(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=ns(n.cp2x,e.left,e.right),n.cp2y=ns(n.cp2y,e.top,e.bottom)))}(t,s)}function as(){return"undefined"!=typeof window&&"undefined"!=typeof document}function rs(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function ls(t,e,s){let i;return"string"==typeof t?(i=parseInt(t,10),-1!==t.indexOf("%")&&(i=i/100*e.parentNode[s])):i=t,i}const cs=t=>t.ownerDocument.defaultView.getComputedStyle(t,null),hs=["top","right","bottom","left"];function ds(t,e,s){const i={};s=s?"-"+s:"";for(let n=0;n<4;n++){const o=hs[n];i[o]=parseFloat(t[e+"-"+o+s])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}function us(t,e){if("native"in t)return t;const{canvas:s,currentDevicePixelRatio:i}=e,n=cs(s),o="border-box"===n.boxSizing,a=ds(n,"padding"),r=ds(n,"border","width"),{x:l,y:c,box:h}=function(t,e){const s=t.touches,i=s&&s.length?s[0]:t,{offsetX:n,offsetY:o}=i;let a,r,l=!1;if(((t,e,s)=>(t>0||e>0)&&(!s||!s.shadowRoot))(n,o,t.target))a=n,r=o;else{const t=e.getBoundingClientRect();a=i.clientX-t.left,r=i.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,s),d=a.left+(h&&r.left),u=a.top+(h&&r.top);let{width:p,height:g}=e;return o&&(p-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/p*s.width/i),y:Math.round((c-u)/g*s.height/i)}}const ps=t=>Math.round(10*t)/10;function gs(t,e,s){const i=e||1,n=ps(t.height*i),o=ps(t.width*i);t.height=ps(t.height),t.width=ps(t.width);const a=t.canvas;return a.style&&(s||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==i||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=i,a.height=n,a.width=o,t.ctx.setTransform(i,0,0,i,0,0),!0)}const fs=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};as()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function ms(t,e){const s=function(t,e){return cs(t).getPropertyValue(e)}(t,e),i=s&&s.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function bs(t,e,s,i){return{x:t.x+s*(e.x-t.x),y:t.y+s*(e.y-t.y)}}function ws(t,e,s,i){return{x:t.x+s*(e.x-t.x),y:"middle"===i?s<.5?t.y:e.y:"after"===i?s<1?t.y:e.y:s>0?e.y:t.y}}function vs(t,e,s,i){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=bs(t,n,s),r=bs(n,o,s),l=bs(o,e,s),c=bs(a,r,s),h=bs(r,l,s);return bs(c,h,s)}function ys(t,e,s){return t?function(t,e){return{x:s=>t+t+e-s,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,s):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function xs(t,e){let s,i;"ltr"!==e&&"rtl"!==e||(s=t.canvas.style,i=[s.getPropertyValue("direction"),s.getPropertyPriority("direction")],s.setProperty("direction",e,"important"),t.prevTextDirection=i)}function _s(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function ks(t){return"angle"===t?{between:Rt,compare:Dt,normalize:Ot}:{between:Bt,compare:(t,e)=>t-e,normalize:t=>t}}function Cs({start:t,end:e,count:s,loop:i,style:n}){return{start:t%s,end:e%s,loop:i&&(e-t+1)%s==0,style:n}}function Ss(t,e,s){if(!s)return[t];const{property:i,start:n,end:o}=s,a=e.length,{compare:r,between:l,normalize:c}=ks(i),{start:h,end:d,loop:u,style:p}=function(t,e,s){const{property:i,start:n,end:o}=s,{between:a,normalize:r}=ks(i),l=e.length;let c,h,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,c=0,h=l;c<h&&a(r(e[d%l][i]),n,o);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,s),g=[];let f,m,b,w=!1,v=null;const y=()=>w||l(n,b,f)&&0!==r(n,b),x=()=>!w||0===r(o,f)||l(o,b,f);for(let t=h,s=h;t<=d;++t)m=e[t%a],m.skip||(f=c(m[i]),f!==b&&(w=l(f,n,o),null===v&&y()&&(v=0===r(f,n)?t:s),null!==v&&x()&&(g.push(Cs({start:v,end:t,loop:u,count:a,style:p})),v=null),s=t,b=f));return null!==v&&g.push(Cs({start:v,end:d,loop:u,count:a,style:p})),g}function Ms(t,e){const s=[],i=t.segments;for(let n=0;n<i.length;n++){const o=Ss(i[n],t.points,e);o.length&&s.push(...o)}return s}function Ps(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function As(t,e){if(!e)return!1;const s=[],i=function(t,e){return Qt(e)?(s.includes(e)||s.push(e),s.indexOf(e)):e};return JSON.stringify(t,i)!==JSON.stringify(e,i)}function Es(t,e,s){return t.options.clip?t[s]:e[s]}function Ts(t,e){const s=e._clip;if(s.disabled)return!1;const i=function(t,e){const{xScale:s,yScale:i}=t;return s&&i?{left:Es(s,e,"left"),right:Es(s,e,"right"),top:Es(i,e,"top"),bottom:Es(i,e,"bottom")}:e}(e,t.chartArea);return{left:!1===s.left?0:i.left-(!0===s.left?0:s.left),right:!1===s.right?t.width:i.right+(!0===s.right?0:s.right),top:!1===s.top?0:i.top-(!0===s.top?0:s.top),bottom:!1===s.bottom?t.height:i.bottom+(!0===s.bottom?0:s.bottom)}}class Ls{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,i){const n=e.listeners[i],o=e.duration;n.forEach(i=>i({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(s-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Nt.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,i)=>{if(!s.running||!s.items.length)return;const n=s.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>s.duration&&(s.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(i.draw(),this._notify(i,s,t,"progress")),n.length||(s.running=!1,this._notify(i,s,t,"complete"),s.initial=!1),e+=n.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}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((t,e)=>Math.max(t,e._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 s=e.items;let i=s.length-1;for(;i>=0;--i)s[i].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Ds=new Ls;const Os="transparent",Rs={boolean:(t,e,s)=>s>.5?e:t,color(t,e,s){const i=te(t||Os),n=i.valid&&te(e||Os);return n&&n.valid?n.mix(i,s).hexString():e},number:(t,e,s)=>t+(e-t)*s};class Is{constructor(t,e,s,i){const n=e[s];i=Fe([t.to,i,n,t.from]);const o=Fe([t.from,n,i]);this._active=!0,this._fn=t.fn||Rs[t.type||typeof o],this._easing=Gt[t.easing]||Gt.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=s,this._from=o,this._to=i,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const i=this._target[this._prop],n=s-this._start,o=this._duration-n;this._start=s,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Fe([t.to,e,i,t.from]),this._from=Fe([t.from,i,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,i=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e<s),!this._active)return this._target[i]=a,void this._notify(!0);e<0?this._target[i]=n:(r=e/s%2,r=o&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[i]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let t=0;t<s.length;t++)s[t][e]()}}class Bs{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!Y(t))return;const e=Object.keys(pe.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const n=t[i];if(!Y(n))return;const o={};for(const t of e)o[t]=n[t];(U(n.properties)&&n.properties||[i]).forEach(t=>{t!==i&&s.has(t)||s.set(t,o)})})}_animateOptions(t,e){const s=e.options,i=function(t,e){if(!e)return;let s=t.options;if(s)return s.$shared&&(t.options=s=Object.assign({},s,{$shared:!1,$animations:{}})),s;t.options=e}(t,s);if(!i)return[];const n=this._createAnimations(i,s);return s.$shared&&function(t,e){const s=[],i=Object.keys(e);for(let e=0;e<i.length;e++){const n=t[i[e]];n&&n.active()&&s.push(n.wait())}return Promise.all(s)}(t.options.$animations,s).then(()=>{t.options=s},()=>{}),n}_createAnimations(t,e){const s=this._properties,i=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){i.push(...this._animateOptions(t,e));continue}const c=e[l];let h=n[l];const d=s.get(l);if(h){if(d&&h.active()){h.update(d,c,a);continue}h.cancel()}d&&d.duration?(n[l]=h=new Is(d,t,l,c),i.push(h)):t[l]=c}return i}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const s=this._createAnimations(t,e);return s.length?(Ds.add(this._chart,s),!0):void 0}}function zs(t,e){const s=t&&t.options||{},i=s.reverse,n=void 0===s.min?e:0,o=void 0===s.max?e:0;return{start:i?o:n,end:i?n:o}}function Fs(t,e){const s=[],i=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=i.length;n<o;++n)s.push(i[n].index);return s}function $s(t,e,s,i={}){const n=t.keys,o="single"===i.mode;let a,r,l,c;if(null===e)return;let h=!1;for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===s){if(h=!0,i.all)continue;break}c=t.values[l],X(c)&&(o||0===e||_t(e)===_t(c))&&(e+=c)}return h||i.all?e:0}function Vs(t,e){const s=t&&t.options.stacked;return s||void 0===s&&void 0!==e.stack}function Hs(t,e,s){const i=t[e]||(t[e]={});return i[s]||(i[s]={})}function js(t,e,s,i){for(const n of e.getMatchingVisibleMetas(i).reverse()){const e=t[n.index];if(s&&e>0||!s&&e<0)return n.index}return null}function Ns(t,e){const{chart:s,_cachedMeta:i}=t,n=s._stacks||(s._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,h=function(t,e,s){return`${t.id}.${e.id}.${s.stack||s.type}`}(o,a,i),d=e.length;let u;for(let t=0;t<d;++t){const s=e[t],{[l]:o,[c]:d}=s;u=(s._stacks||(s._stacks={}))[c]=Hs(n,h,o),u[r]=d,u._top=js(u,a,!0,i.type),u._bottom=js(u,a,!1,i.type),(u._visualValues||(u._visualValues={}))[r]=d}}function Ws(t,e){const s=t.scales;return Object.keys(s).filter(t=>s[t].axis===e).shift()}function qs(t,e){const s=t.controller.index,i=t.vScale&&t.vScale.axis;if(i){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[i]||void 0===e[i][s])return;delete e[i][s],void 0!==e[i]._visualValues&&void 0!==e[i]._visualValues[s]&&delete e[i]._visualValues[s]}}}const Us=t=>"reset"===t||"none"===t,Ys=(t,e)=>e?t:Object.assign({},t);class Xs{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Vs(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&&qs(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),i=(t,e,s,i)=>"x"===t?e:"r"===t?i:s,n=e.xAxisID=Z(s.xAxisID,Ws(t,"x")),o=e.yAxisID=Z(s.yAxisID,Ws(t,"y")),a=e.rAxisID=Z(s.rAxisID,Ws(t,"r")),r=e.indexAxis,l=e.iAxisID=i(r,n,o,a),c=e.vAxisID=i(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Ht(this._data,this),t._stacked&&qs(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(Y(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:s,vScale:i}=e,n="x"===s.axis?"x":"y",o="x"===i.axis?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,c,h;for(l=0,c=a.length;l<c;++l)h=a[l],r[l]={[n]:h,[o]:t[h]};return r}(e,t)}else if(s!==e){if(s){Ht(s,this);const t=this._cachedMeta;qs(t),t._parsed=[]}e&&Object.isExtensible(e)&&((i=e)._chartjs?i._chartjs.listeners.push(this):(Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),Vt.forEach(t=>{const e="_onData"+ct(t),s=i[t];Object.defineProperty(i,t,{configurable:!0,enumerable:!1,value(...t){const n=s.apply(this,t);return i._chartjs.listeners.forEach(s=>{"function"==typeof s[e]&&s[e](...t)}),n}})}))),this._syncList=[],this._data=e}var i}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let i=!1;this._dataCheck();const n=e._stacked;e._stacked=Vs(e.vScale,e),e.stack!==s.stack&&(i=!0,qs(e),e.stack=s.stack),this._resyncElements(t),(i||n!==e._stacked)&&(Ns(this,e._parsed),e._stacked=Vs(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:i}=this,{iScale:n,_stacked:o}=s,a=n.axis;let r,l,c,h=0===t&&e===i.length||s._sorted,d=t>0&&s._parsed[t-1];if(!1===this._parsing)s._parsed=i,s._sorted=!0,c=i;else{c=U(i[t])?this.parseArrayData(s,i,t,e):Y(i[t])?this.parseObjectData(s,i,t,e):this.parsePrimitiveData(s,i,t,e);const n=()=>null===l[a]||d&&l[a]<d[a];for(r=0;r<e;++r)s._parsed[r+t]=l=c[r],h&&(n()&&(h=!1),d=l);s._sorted=h}o&&Ns(this,c)}parsePrimitiveData(t,e,s,i){const{iScale:n,vScale:o}=t,a=n.axis,r=o.axis,l=n.getLabels(),c=n===o,h=new Array(i);let d,u,p;for(d=0,u=i;d<u;++d)p=d+s,h[d]={[a]:c||n.parse(l[p],p),[r]:o.parse(e[p],p)};return h}parseArrayData(t,e,s,i){const{xScale:n,yScale:o}=t,a=new Array(i);let r,l,c,h;for(r=0,l=i;r<l;++r)c=r+s,h=e[c],a[r]={x:n.parse(h[0],c),y:o.parse(h[1],c)};return a}parseObjectData(t,e,s,i){const{xScale:n,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(i);let c,h,d,u;for(c=0,h=i;c<h;++c)d=c+s,u=e[d],l[c]={x:n.parse(lt(u,a),d),y:o.parse(lt(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,s){const i=this.chart,n=this._cachedMeta,o=e[t.axis];return $s({keys:Fs(i,!0),values:e._stacks[t.axis]._visualValues},o,n.index,{mode:s})}updateRangeFromParsed(t,e,s,i){const n=s[e.axis];let o=null===n?NaN:n;const a=i&&s._stacks[e.axis];i&&a&&(i.values=a,o=$s(i,n,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const s=this._cachedMeta,i=s._parsed,n=s._sorted&&t===s.iScale,o=i.length,a=this._getOtherScale(t),r=((t,e,s)=>t&&!e.hidden&&e._stacked&&{keys:Fs(s,!0),values:null})(e,s,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=function(t){const{min:e,max:s,minDefined:i,maxDefined:n}=t.getUserBounds();return{min:i?e:Number.NEGATIVE_INFINITY,max:n?s:Number.POSITIVE_INFINITY}}(a);let d,u;function p(){u=i[d];const e=u[a.axis];return!X(u[t.axis])||c>e||h<e}for(d=0;d<o&&(p()||(this.updateRangeFromParsed(l,t,u,r),!n));++d);if(n)for(d=o-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,r);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let i,n,o;for(i=0,n=e.length;i<n;++i)o=e[i][t.axis],X(o)&&s.push(o);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,s=e.iScale,i=e.vScale,n=this.getParsed(t);return{label:s?""+s.getLabelForValue(n[s.axis]):"",value:i?""+i.getLabelForValue(n[i.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,s,i,n;return Y(t)?(e=t.top,s=t.right,i=t.bottom,n=t.left):e=s=i=n=t,{top:e,right:s,bottom:i,left:n,disabled:!1===t}}(Z(this.options.clip,function(t,e,s){if(!1===s)return!1;const i=zs(t,s),n=zs(e,s);return{top:n.end,right:i.end,bottom:n.start,left:i.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,s=this._cachedMeta,i=s.data||[],n=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||i.length-a,l=this.options.drawActiveElementsOnTop;let c;for(s.dataset&&s.dataset.draw(t,n,a,r),c=a;c<a+r;++c){const e=i[c];e.hidden||(e.active&&l?o.push(e):e.draw(t,n))}for(c=0;c<o.length;++c)o[c].draw(t,n)}getStyle(t,e){const s=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,e,s){const i=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,s){return $e(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:s,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=i.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return $e(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=i,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=s,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",s){const i="active"===e,n=this._cachedDataOpts,o=t+"-"+e,a=n[o],r=this.enableOptionSharing&&ht(s);if(a)return Ys(a,r);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=i?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(pe.elements[t]),p=l.resolveNamedOptions(d,u,()=>this.getContext(s,i,e),h);return p.$shared&&(p.$shared=r,n[o]=Object.freeze(Ys(p,r))),p}_resolveAnimations(t,e,s){const i=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==i.options.animation){const i=this.chart.config,n=i.datasetAnimationScopeKeys(this._type,e),o=i.getOptionScopes(this.getDataset(),n);r=i.createResolver(o,this.getContext(t,s,e))}const l=new Bs(i,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Us(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),i=this._sharedOptions,n=this.getSharedOptions(s),o=this.includeOptions(e,n)||n!==i;return this.updateSharedOptions(n,e,s),{sharedOptions:n,includeOptions:o}}updateElement(t,e,s,i){Us(i)?Object.assign(t,s):this._resolveAnimations(e,i).update(t,s)}updateSharedOptions(t,e,s){t&&!Us(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,i){t.active=i;const n=this.getStyle(e,i);this._resolveAnimations(e,s,i).update(t,{options:!i&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"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,s=this._cachedMeta.data;for(const[t,e,s]of this._syncList)this[t](e,s);this._syncList=[];const i=s.length,n=e.length,o=Math.min(n,i);o&&this.parse(0,o),n>i?this._insertElements(i,n-i,t):n<i&&this._removeElements(n,i-n)}_insertElements(t,e,s=!0){const i=this._cachedMeta,n=i.data,o=t+e;let a;const r=t=>{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a<o;++a)n[a]=new this.dataElementType;this._parsing&&r(i._parsed),this.parse(t,e),s&&this.updateElements(n,t,e,"reset")}updateElements(t,e,s,i){}_removeElements(t,e){const s=this._cachedMeta;if(this._parsing){const i=s._parsed.splice(t,e);s._stacked&&qs(s,i)}s.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,s,i]=t;this[e](s,i)}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 s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Ks(t){const e=t.iScale,s=function(t,e){if(!t._cache.$bar){const s=t.getMatchingVisibleMetas(e);let i=[];for(let e=0,n=s.length;e<n;e++)i=i.concat(s[e].controller.getAllParsedValues(t));t._cache.$bar=jt(i.sort((t,e)=>t-e))}return t._cache.$bar}(e,t.type);let i,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(ht(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(i=0,n=s.length;i<n;++i)o=e.getPixelForValue(s[i]),l();for(a=void 0,i=0,n=e.ticks.length;i<n;++i)o=e.getPixelForTick(i),l();return r}function Zs(t,e,s,i){return U(t)?function(t,e,s,i){const n=s.parse(t[0],i),o=s.parse(t[1],i),a=Math.min(n,o),r=Math.max(n,o);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),e[s.axis]=c,e._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}(t,e,s,i):e[s.axis]=s.parse(t,i),e}function Js(t,e,s,i){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let c,h,d,u;for(c=s,h=s+i;c<h;++c)u=e[c],d={},d[n.axis]=r||n.parse(a[c],c),l.push(Zs(u,d,o,c));return l}function Gs(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Qs(t,e,s,i){let n=e.borderSkipped;const o={};if(!n)return void(t.borderSkipped=o);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:r,reverse:l,top:c,bottom:h}=function(t){let e,s,i,n,o;return t.horizontal?(e=t.base>t.x,s="left",i="right"):(e=t.base<t.y,s="bottom",i="top"),e?(n="end",o="start"):(n="start",o="end"),{start:s,end:i,reverse:e,top:n,bottom:o}}(t);"middle"===n&&s&&(t.enableBorderRadius=!0,(s._top||0)===i?n=c:(s._bottom||0)===i?n=h:(o[ti(h,a,r,l)]=!0,n=c)),o[ti(n,a,r,l)]=!0,t.borderSkipped=o}function ti(t,e,s,i){var n,o,a;return i?(a=s,t=ei(t=(n=t)===(o=e)?a:n===a?o:n,s,e)):t=ei(t,e,s),t}function ei(t,e,s){return"start"===t?e:"end"===t?s:t}function si(t,{inflateAmount:e},s){t.inflateAmount="auto"===e?1===s?.33:0:e}class ii extends Xs{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data,{labels:{pointStyle:s,textAlign:i,color:n,useBorderRadius:o,borderRadius:a}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((e,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:e,fillStyle:l.backgroundColor,fontColor:n,hidden:!t.getDataVisibility(r),lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:l.borderWidth,strokeStyle:l.borderColor,textAlign:i,pointStyle:s,borderRadius:o&&(a||l.borderRadius),index:r}}):[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const s=this.getDataset().data,i=this._cachedMeta;if(!1===this._parsing)i._parsed=s;else{let n,o,a=t=>+s[t];if(Y(s[t])){const{key:t="value"}=this._parsing;a=e=>+lt(s[e],t)}for(n=t,o=t+e;n<o;++n)i._parsed[n]=a(n)}}_getRotation(){return Pt(this.options.rotation-90)}_getCircumference(){return Pt(this.options.circumference)}_getRotationExtents(){let t=gt,e=-gt;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const i=this.chart.getDatasetMeta(s).controller,n=i._getRotation(),o=i._getCircumference();t=Math.min(t,n),e=Math.max(e,n+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:s}=e,i=this._cachedMeta,n=i.data,o=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,a=Math.max((Math.min(s.width,s.height)-o)/2,0),r=Math.min((c=a,"string"==typeof(l=this.options.cutout)&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:g,offsetX:f,offsetY:m}=function(t,e,s){let i=1,n=1,o=0,a=0;if(e<gt){const r=t,l=r+e,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),p=(t,e,i)=>Rt(t,r,l,!0)?1:Math.max(e,e*s,i,i*s),g=(t,e,i)=>Rt(t,r,l,!0)?-1:Math.min(e,e*s,i,i*s),f=p(0,c,d),m=p(wt,h,u),b=g(pt,c,d),w=g(pt+wt,h,u);i=(f-b)/2,n=(m-w)/2,o=-(f+b)/2,a=-(m+w)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),b=(s.width-o)/p,w=(s.height-o)/g,v=Math.max(Math.min(b,w)/2,0),y=J(this.options.radius,v),x=(y-Math.max(y*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*y,this.offsetY=m*y,i.total=this.calculateTotal(),this.outerRadius=y-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*h,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const s=this.options,i=this._cachedMeta,n=this._getCircumference();return e&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||null===i._parsed[t]||i.data[t].hidden?0:this.calculateCircumference(i._parsed[t]*n/gt)}updateElements(t,e,s,i){const n="reset"===i,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,c=(a.top+a.bottom)/2,h=n&&r.animateScale,d=h?0:this.innerRadius,u=h?0:this.outerRadius,{sharedOptions:p,includeOptions:g}=this._getSharedOptions(e,i);let f,m=this._getRotation();for(f=0;f<e;++f)m+=this._circumference(f,n);for(f=e;f<e+s;++f){const e=this._circumference(f,n),s=t[f],o={x:l+this.offsetX,y:c+this.offsetY,startAngle:m,endAngle:m+e,circumference:e,outerRadius:u,innerRadius:d};g&&(o.options=p||this.resolveDataElementOptions(f,s.active?"active":i)),m+=e,this.updateElement(s,f,o,i)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let s,i=0;for(s=0;s<e.length;s++){const n=t._parsed[s];null===n||isNaN(n)||!this.chart.getDataVisibility(s)||e[s].hidden||(i+=Math.abs(n))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?gt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,i=s.data.labels||[],n=oe(e._parsed[t],s.options.locale);return{label:i[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const s=this.chart;let i,n,o,a,r;if(!t)for(i=0,n=s.data.datasets.length;i<n;++i)if(s.isDatasetVisible(i)){o=s.getDatasetMeta(i),t=o.data,a=o.controller;break}if(!t)return 0;for(i=0,n=t.length;i<n;++i)r=a.resolveDataElementOptions(i),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let s=0,i=t.length;s<i;++s){const t=this.resolveDataElementOptions(s);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(e+=this._getRingWeight(s));return e}_getRingWeight(t){return Math.max(Z(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class ni extends Xs{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:i}}=t.legend.options;return e.labels.map((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:i,lineWidth:o.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(n),index:n}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,i=s.data.labels||[],n=oe(e._parsed[t].r,s.options.locale);return{label:i[t]||"",value:n}}parseObjectData(t,e,s,i){return Qe.bind(this)(t,e,s,i)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,s)=>{const i=this.getParsed(s).r;!isNaN(i)&&this.chart.getDataVisibility(s)&&(i<e.min&&(e.min=i),i>e.max&&(e.max=i))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,s=t.options,i=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(i/2,0),o=(n-Math.max(s.cutoutPercentage?n/100*s.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,s,i){const n="reset"===i,o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,c=r.yCenter,h=r.getIndexAngle(0)-.5*pt;let d,u=h;const p=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,i,p);for(d=e;d<e+s;d++){const e=t[d];let s=u,g=u+this._computeAngle(d,i,p),f=o.getDataVisibility(d)?r.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=g,n&&(a.animateScale&&(f=0),a.animateRotate&&(s=g=h));const m={x:l,y:c,innerRadius:0,outerRadius:f,startAngle:s,endAngle:g,options:this.resolveDataElementOptions(d,e.active?"active":i)};this.updateElement(e,d,m,i)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((t,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,s){return this.chart.getDataVisibility(t)?Pt(this.resolveDataElementOptions(t,e).angle||s):0}}var oi=Object.freeze({__proto__:null,BarController:class extends Xs{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,s,i){return Js(t,e,s,i)}parseArrayData(t,e,s,i){return Js(t,e,s,i)}parseObjectData(t,e,s,i){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?a:r,c="x"===o.axis?a:r,h=[];let d,u,p,g;for(d=s,u=s+i;d<u;++d)g=e[d],p={},p[n.axis]=n.parse(lt(g,l),d),h.push(Zs(lt(g,c),p,o,d));return h}updateRangeFromParsed(t,e,s,i){super.updateRangeFromParsed(t,e,s,i);const n=s._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:s,vScale:i}=e,n=this.getParsed(t),o=n._custom,a=Gs(o)?"["+o.start+", "+o.end+"]":""+i.getLabelForValue(n[i.axis]);return{label:""+s.getLabelForValue(n[s.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,s,i){const n="reset"===i,{index:o,_cachedMeta:{vScale:a}}=this,r=a.getBasePixel(),l=a.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,i);for(let u=e;u<e+s;u++){const e=this.getParsed(u),s=n||q(e[a.axis])?{base:r,head:r}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,c),g=(e._stacks||{})[a.axis],f={horizontal:l,base:s.base,enableBorderRadius:!g||Gs(e._custom)||o===g._top||o===g._bottom,x:l?s.head:p.center,y:l?p.center:s.head,height:l?p.size:Math.abs(s.size),width:l?Math.abs(s.size):p.size};d&&(f.options=h||this.resolveDataElementOptions(u,t[u].active?"active":i));const m=f.options||t[u].options;Qs(f,m,g,o),si(f,m,c.ratio),this.updateElement(t[u],u,f,i)}}_getStacks(t,e){const{iScale:s}=this._cachedMeta,i=s.getMatchingVisibleMetas(this._type).filter(t=>t.controller.options.grouped),n=s.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(e),r=a&&a[s.axis],l=t=>{const e=t._parsed.find(t=>t[s.axis]===r),i=e&&e[t.vScale.axis];if(q(i)||isNaN(i))return!0};for(const s of i)if((void 0===e||!l(s))&&((!1===n||-1===o.indexOf(s.stack)||void 0===n&&void 0===s.stack)&&o.push(s.stack),s.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(s=>t[s].axis===e).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const s of this.chart.data.datasets)t[Z("x"===this.chart.options.indexAxis?s.xAxisID:s.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,s){const i=this._getStacks(t,s),n=void 0!==e?i.indexOf(e):-1;return-1===n?i.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,i=[];let n,o;for(n=0,o=e.data.length;n<o;++n)i.push(s.getPixelForValue(this.getParsed(n)[s.axis],n));const a=t.barThickness;return{min:a||Ks(e),pixels:i,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:s,index:i},options:{base:n,minBarLength:o}}=this,a=n||0,r=this.getParsed(t),l=r._custom,c=Gs(l);let h,d,u=r[e.axis],p=0,g=s?this.applyStack(e,r,s):u;g!==u&&(p=g-u,g=u),c&&(u=l.barStart,g=l.barEnd-l.barStart,0!==u&&_t(u)!==_t(l.barEnd)&&(p=0),p+=u);const f=q(n)||c?p:n;let m=e.getPixelForValue(f);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(p+g):m,d=h-m,Math.abs(d)<o){d=function(t,e,s){return 0!==t?_t(t):(e.isHorizontal()?1:-1)*(e.min>=s?1:-1)}(d,e,a)*o,u===a&&(m-=d/2);const t=e.getPixelForDecimal(0),n=e.getPixelForDecimal(1),l=Math.min(t,n),p=Math.max(t,n);m=Math.max(Math.min(m,p),l),h=m+d,s&&!c&&(r._stacks[e.axis]._visualValues[i]=e.getValueForPixel(h)-e.getValueForPixel(m))}if(m===e.getPixelForValue(a)){const t=_t(d)*e.getLineWidthForValue(a)/2;m+=t,d-=t}return{size:d,base:m,head:h,center:h+d/2}}_calculateBarIndexPixels(t,e){const s=e.scale,i=this.options,n=i.skipNull,o=Z(i.maxBarThickness,1/0);let a,r;const l=this._getAxisCount();if(e.grouped){const s=n?this._getStackCount(t):e.stackCount,c="flex"===i.barThickness?function(t,e,s,i){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const l=s.categoryPercentage;null===a&&(a=o-(null===r?e.end-e.start:r-o)),null===r&&(r=o+o-a);const c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/i,ratio:s.barPercentage,start:c}}(t,e,i,s*l):function(t,e,s,i){const n=s.barThickness;let o,a;return q(n)?(o=e.min*s.categoryPercentage,a=s.barPercentage):(o=n*i,a=1),{chunk:o/i,ratio:a,start:e.pixels[t]-o/2}}(t,e,i,s*l),h="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,d=this._getAxis().indexOf(Z(h,this.getFirstScaleIdForIndexAxis())),u=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0)+d;a=c.start+c.chunk*u+c.chunk/2,r=Math.min(o,c.chunk*c.ratio)}else a=s.getPixelForValue(this.getParsed(t)[s.axis],t),r=Math.min(o,e.min*e.ratio);return{base:a-r/2,head:a+r/2,center:a,size:r}}draw(){const t=this._cachedMeta,e=t.vScale,s=t.data,i=s.length;let n=0;for(;n<i;++n)null===this.getParsed(n)[e.axis]||s[n].hidden||s[n].draw(this._ctx)}},BubbleController:class extends Xs{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,s,i){const n=super.parsePrimitiveData(t,e,s,i);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+s).radius;return n}parseArrayData(t,e,s,i){const n=super.parseArrayData(t,e,s,i);for(let t=0;t<n.length;t++){const i=e[s+t];n[t]._custom=Z(i[2],this.resolveDataElementOptions(t+s).radius)}return n}parseObjectData(t,e,s,i){const n=super.parseObjectData(t,e,s,i);for(let t=0;t<n.length;t++){const i=e[s+t];n[t]._custom=Z(i&&i.r&&+i.r,this.resolveDataElementOptions(t+s).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let s=t.length-1;s>=0;--s)e=Math.max(e,t[s].size(this.resolveDataElementOptions(s))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:i,yScale:n}=e,o=this.getParsed(t),a=i.getLabelForValue(o.x),r=n.getLabelForValue(o.y),l=o._custom;return{label:s[t]||"",value:"("+a+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,s,i){const n="reset"===i,{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,i),c=o.axis,h=a.axis;for(let d=e;d<e+s;d++){const e=t[d],s=!n&&this.getParsed(d),u={},p=u[c]=n?o.getPixelForDecimal(.5):o.getPixelForValue(s[c]),g=u[h]=n?a.getBasePixel():a.getPixelForValue(s[h]);u.skip=isNaN(p)||isNaN(g),l&&(u.options=r||this.resolveDataElementOptions(d,e.active?"active":i),n&&(u.options.radius=0)),this.updateElement(e,d,u,i)}}resolveDataElementOptions(t,e){const s=this.getParsed(t);let i=super.resolveDataElementOptions(t,e);i.$shared&&(i=Object.assign({},i,{$shared:!1}));const n=i.radius;return"active"!==e&&(i.radius=0),i.radius+=Z(s&&s._custom,n),i}},DoughnutController:ii,LineController:class extends Xs{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:s,data:i=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=Yt(e,i,o);this._drawStart=a,this._drawCount=r,Xt(e)&&(a=0,r=i.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!n._decimated,s.points=i;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(s,void 0,{animated:!o,options:l},t),this.updateElements(i,a,r,t)}updateElements(t,e,s,i){const n="reset"===i,{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,i),d=o.axis,u=a.axis,{spanGaps:p,segment:g}=this.options,f=St(p)?p:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||n||"none"===i,b=e+s,w=t.length;let v=e>0&&this.getParsed(e-1);for(let s=0;s<w;++s){const p=t[s],w=m?p:{};if(s<e||s>=b){w.skip=!0;continue}const y=this.getParsed(s),x=q(y[u]),_=w[d]=o.getPixelForValue(y[d],s),k=w[u]=n||x?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,y,r):y[u],s);w.skip=isNaN(_)||isNaN(k)||x,w.stop=s>0&&Math.abs(y[d]-v[d])>f,g&&(w.parsed=y,w.raw=l.data[s]),h&&(w.options=c||this.resolveDataElementOptions(s,p.active?"active":i)),m||this.updateElement(p,s,w,i),v=y}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,i=t.data||[];if(!i.length)return s;const n=i[0].size(this.resolveDataElementOptions(0)),o=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(s,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends ii{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:ni,RadarController:class extends Xs{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,s=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(s[e.axis])}}parseObjectData(t,e,s,i){return Qe.bind(this)(t,e,s,i)}update(t){const e=this._cachedMeta,s=e.dataset,i=e.data||[],n=e.iScale.getLabels();if(s.points=i,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===i.length,options:e};this.updateElement(s,void 0,o,t)}this.updateElements(i,0,i.length,t)}updateElements(t,e,s,i){const n=this._cachedMeta.rScale,o="reset"===i;for(let a=e;a<e+s;a++){const e=t[a],s=this.resolveDataElementOptions(a,e.active?"active":i),r=n.getPointPositionForValue(a,this.getParsed(a).r),l=o?n.xCenter:r.x,c=o?n.yCenter:r.y,h={x:l,y:c,angle:r.angle,skip:isNaN(l)||isNaN(c),options:s};this.updateElement(e,a,h,i)}}},ScatterController:class extends Xs{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:i,yScale:n}=e,o=this.getParsed(t),a=i.getLabelForValue(o.x),r=n.getLabelForValue(o.y);return{label:s[t]||"",value:"("+a+", "+r+")"}}update(t){const e=this._cachedMeta,{data:s=[]}=e,i=this.chart._animationsDisabled;let{start:n,count:o}=Yt(e,s,i);if(this._drawStart=n,this._drawCount=o,Xt(e)&&(n=0,o=s.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:n,_dataset:o}=e;n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const a=this.resolveDatasetElementOptions(t);a.segment=this.options.segment,this.updateElement(n,void 0,{animated:!i,options:a},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(s,n,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,s,i){const n="reset"===i,{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,i),h=this.getSharedOptions(c),d=this.includeOptions(i,h),u=o.axis,p=a.axis,{spanGaps:g,segment:f}=this.options,m=St(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||n||"none"===i;let w=e>0&&this.getParsed(e-1);for(let c=e;c<e+s;++c){const e=t[c],s=this.getParsed(c),g=b?e:{},v=q(s[p]),y=g[u]=o.getPixelForValue(s[u],c),x=g[p]=n||v?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,s,r):s[p],c);g.skip=isNaN(y)||isNaN(x)||v,g.stop=c>0&&Math.abs(s[u]-w[u])>m,f&&(g.parsed=s,g.raw=l.data[c]),d&&(g.options=h||this.resolveDataElementOptions(c,e.active?"active":i)),b||this.updateElement(e,c,g,i),w=s}this.updateSharedOptions(h,i,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let s=e.length-1;s>=0;--s)t=Math.max(t,e[s].size(this.resolveDataElementOptions(s))/2);return t>0&&t}const s=t.dataset,i=s.options&&s.options.borderWidth||0;if(!e.length)return i;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(i,n,o)/2}}});function ai(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ri{static override(t){Object.assign(ri.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return ai()}parse(){return ai()}format(){return ai()}add(){return ai()}diff(){return ai()}startOf(){return ai()}endOf(){return ai()}}var li=ri;function ci(t,e,s,i){const{controller:n,data:o,_sorted:a}=t,r=n._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(r&&e===r.axis&&"r"!==e&&a&&o.length){const a=r._reversePixels?$t:Ft;if(!i){const i=a(o,e,s);if(l){const{vScale:e}=n._cachedMeta,{_parsed:s}=t,o=s.slice(0,i.lo+1).reverse().findIndex(t=>!q(t[e.axis]));i.lo-=Math.max(0,o);const a=s.slice(i.hi).findIndex(t=>!q(t[e.axis]));i.hi+=Math.max(0,a)}return i}if(n._sharedOptions){const t=o[0],i="function"==typeof t.getRange&&t.getRange(e);if(i){const t=a(o,e,s-i),n=a(o,e,s+i);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:o.length-1}}function hi(t,e,s,i,n){const o=t.getSortedVisibleDatasetMetas(),a=s[e];for(let t=0,s=o.length;t<s;++t){const{index:s,data:r}=o[t],{lo:l,hi:c}=ci(o[t],e,a,n);for(let t=l;t<=c;++t){const e=r[t];e.skip||i(e,s,t)}}}function di(t,e,s,i,n){const o=[];return n||t.isPointInArea(e)?(hi(t,s,e,function(s,a,r){(n||ye(s,t.chartArea,0))&&s.inRange(e.x,e.y,i)&&o.push({element:s,datasetIndex:a,index:r})},!0),o):o}function ui(t,e,s,i,n,o){return o||t.isPointInArea(e)?"r"!==s||i?function(t,e,s,i,n,o){let a=[];const r=function(t){const e=-1!==t.indexOf("x"),s=-1!==t.indexOf("y");return function(t,i){const n=e?Math.abs(t.x-i.x):0,o=s?Math.abs(t.y-i.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2))}}(s);let l=Number.POSITIVE_INFINITY;return hi(t,s,e,function(s,c,h){const d=s.inRange(e.x,e.y,n);if(i&&!d)return;const u=s.getCenterPoint(n);if(!o&&!t.isPointInArea(u)&&!d)return;const p=r(e,u);p<l?(a=[{element:s,datasetIndex:c,index:h}],l=p):p===l&&a.push({element:s,datasetIndex:c,index:h})}),a}(t,e,s,i,n,o):function(t,e,s,i){let n=[];return hi(t,s,e,function(t,s,o){const{startAngle:a,endAngle:r}=t.getProps(["startAngle","endAngle"],i),{angle:l}=Tt(t,{x:e.x,y:e.y});Rt(l,a,r)&&n.push({element:t,datasetIndex:s,index:o})}),n}(t,e,s,n):[]}function pi(t,e,s,i,n){const o=[],a="x"===s?"inXRange":"inYRange";let r=!1;return hi(t,s,e,(t,i,l)=>{t[a]&&t[a](e[s],n)&&(o.push({element:t,datasetIndex:i,index:l}),r=r||t.inRange(e.x,e.y,n))}),i&&!r?[]:o}var gi={evaluateInteractionItems:hi,modes:{index(t,e,s,i){const n=us(e,t),o=s.axis||"x",a=s.includeInvisible||!1,r=s.intersect?di(t,n,o,i,a):ui(t,n,o,!1,i,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{const e=r[0].index,s=t.data[e];s&&!s.skip&&l.push({element:s,datasetIndex:t.index,index:e})}),l):[]},dataset(t,e,s,i){const n=us(e,t),o=s.axis||"xy",a=s.includeInvisible||!1;let r=s.intersect?di(t,n,o,i,a):ui(t,n,o,!1,i,a);if(r.length>0){const e=r[0].datasetIndex,s=t.getDatasetMeta(e).data;r=[];for(let t=0;t<s.length;++t)r.push({element:s[t],datasetIndex:e,index:t})}return r},point:(t,e,s,i)=>di(t,us(e,t),s.axis||"xy",i,s.includeInvisible||!1),nearest(t,e,s,i){const n=us(e,t),o=s.axis||"xy",a=s.includeInvisible||!1;return ui(t,n,o,s.intersect,i,a)},x:(t,e,s,i)=>pi(t,us(e,t),"x",s.intersect,i),y:(t,e,s,i)=>pi(t,us(e,t),"y",s.intersect,i)}};const fi=["left","top","right","bottom"];function mi(t,e){return t.filter(t=>t.pos===e)}function bi(t,e){return t.filter(t=>-1===fi.indexOf(t.pos)&&t.box.axis===e)}function wi(t,e){return t.sort((t,s)=>{const i=e?s:t,n=e?t:s;return i.weight===n.weight?i.index-n.index:i.weight-n.weight})}function vi(t,e,s,i){return Math.max(t[s],e[s])+Math.max(t[i],e[i])}function yi(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function xi(t,e,s,i){const{pos:n,box:o}=s,a=t.maxPadding;if(!Y(n)){s.size&&(t[n]-=s.size);const e=i[s.stack]||{size:0,count:1};e.size=Math.max(e.size,s.horizontal?o.height:o.width),s.size=e.size/e.count,t[n]+=s.size}o.getPadding&&yi(a,o.getPadding());const r=Math.max(0,e.outerWidth-vi(a,t,"left","right")),l=Math.max(0,e.outerHeight-vi(a,t,"top","bottom")),c=r!==t.w,h=l!==t.h;return t.w=r,t.h=l,s.horizontal?{same:c,other:h}:{same:h,other:c}}function _i(t,e){const s=e.maxPadding;return function(t){const i={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{i[t]=Math.max(e[t],s[t])}),i}(t?["left","right"]:["top","bottom"])}function ki(t,e,s,i){const n=[];let o,a,r,l,c,h;for(o=0,a=t.length,c=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,_i(r.horizontal,e));const{same:a,other:d}=xi(e,s,r,i);c|=a&&n.length,h=h||d,l.fullSize||n.push(r)}return c&&ki(n,e,s,i)||h}function Ci(t,e,s,i,n){t.top=s,t.left=e,t.right=e+i,t.bottom=s+n,t.width=i,t.height=n}function Si(t,e,s,i){const n=s.padding;let{x:o,y:a}=e;for(const r of t){const t=r.box,l=i[r.stack]||{count:1,placed:0,weight:1},c=r.stackWeight/l.weight||1;if(r.horizontal){const i=e.w*c,o=l.size||t.height;ht(l.start)&&(a=l.start),t.fullSize?Ci(t,n.left,a,s.outerWidth-n.right-n.left,o):Ci(t,e.left+l.placed,a,i,o),l.start=a,l.placed+=i,a=t.bottom}else{const i=e.h*c,a=l.size||t.width;ht(l.start)&&(o=l.start),t.fullSize?Ci(t,o,n.top,a,s.outerHeight-n.bottom-n.top):Ci(t,o,e.top+l.placed,a,i),l.start=o,l.placed+=i,o=t.right}}e.x=o,e.y=a}var Mi={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const s=t.boxes?t.boxes.indexOf(e):-1;-1!==s&&t.boxes.splice(s,1)},configure(t,e,s){e.fullSize=s.fullSize,e.position=s.position,e.weight=s.weight},update(t,e,s,i){if(!t)return;const n=Be(t.options.layout.padding),o=Math.max(e-n.width,0),a=Math.max(s-n.height,0),r=function(t){const e=function(t){const e=[];let s,i,n,o,a,r;for(s=0,i=(t||[]).length;s<i;++s)n=t[s],({position:o,options:{stack:a,stackWeight:r=1}}=n),e.push({index:s,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return e}(t),s=wi(e.filter(t=>t.box.fullSize),!0),i=wi(mi(e,"left"),!0),n=wi(mi(e,"right")),o=wi(mi(e,"top"),!0),a=wi(mi(e,"bottom")),r=bi(e,"x"),l=bi(e,"y");return{fullSize:s,leftAndTop:i.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:mi(e,"chartArea"),vertical:i.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,c=r.horizontal;Q(t.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});const h=l.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,d=Object.freeze({outerWidth:e,outerHeight:s,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);yi(u,Be(i));const p=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=function(t,e){const s=function(t){const e={};for(const s of t){const{stack:t,pos:i,stackWeight:n}=s;if(!t||!fi.includes(i))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:i,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:a}=r.box,l=s[r.stack],c=l&&r.stackWeight/l.weight;r.horizontal?(r.width=c?c*i:a&&e.availableWidth,r.height=n):(r.width=i,r.height=c?c*n:a&&e.availableHeight)}return s}(l.concat(c),d);ki(r.fullSize,p,d,g),ki(l,p,d,g),ki(c,p,d,g)&&ki(l,p,d,g),function(t){const e=t.maxPadding;function s(s){const i=Math.max(e[s]-t[s],0);return t[s]+=i,i}t.y+=s("top"),t.x+=s("left"),s("right"),s("bottom")}(p),Si(r.leftAndTop,p,d,g),p.x+=p.w,p.y+=p.h,Si(r.rightAndBottom,p,d,g),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Q(r.chartArea,e=>{const s=e.box;Object.assign(s,t.chartArea),s.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class Pi{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,i){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,i?Math.floor(e/i):s)}}isAttached(t){return!0}updateConfig(t){}}class Ai extends Pi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ei="$chartjs",Ti={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Li=t=>null===t||""===t,Di=!!fs&&{passive:!0};function Oi(t,e,s){t&&t.canvas&&t.canvas.removeEventListener(e,s,Di)}function Ri(t,e){for(const s of t)if(s===e||s.contains(e))return!0}function Ii(t,e,s){const i=t.canvas,n=new MutationObserver(t=>{let e=!1;for(const s of t)e=e||Ri(s.addedNodes,i),e=e&&!Ri(s.removedNodes,i);e&&s()});return n.observe(document,{childList:!0,subtree:!0}),n}function Bi(t,e,s){const i=t.canvas,n=new MutationObserver(t=>{let e=!1;for(const s of t)e=e||Ri(s.removedNodes,i),e=e&&!Ri(s.addedNodes,i);e&&s()});return n.observe(document,{childList:!0,subtree:!0}),n}const zi=new Map;let Fi=0;function $i(){const t=window.devicePixelRatio;t!==Fi&&(Fi=t,zi.forEach((e,s)=>{s.currentDevicePixelRatio!==t&&e()}))}function Vi(t,e,s){const i=t.canvas,n=i&&rs(i);if(!n)return;const o=Wt((t,e)=>{const i=n.clientWidth;s(t,e),i<n.clientWidth&&s()},window),a=new ResizeObserver(t=>{const e=t[0],s=e.contentRect.width,i=e.contentRect.height;0===s&&0===i||o(s,i)});return a.observe(n),function(t,e){zi.size||window.addEventListener("resize",$i),zi.set(t,e)}(t,o),a}function Hi(t,e,s){s&&s.disconnect(),"resize"===e&&function(t){zi.delete(t),zi.size||window.removeEventListener("resize",$i)}(t)}function ji(t,e,s){const i=t.canvas,n=Wt(e=>{null!==t.ctx&&s(function(t,e){const s=Ti[t.type]||t.type,{x:i,y:n}=us(t,e);return{type:s,chart:e,native:t,x:void 0!==i?i:null,y:void 0!==n?n:null}}(e,t))},t);return function(t,e,s){t&&t.addEventListener(e,s,Di)}(i,e,n),n}class Ni extends Pi{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(function(t,e){const s=t.style,i=t.getAttribute("height"),n=t.getAttribute("width");if(t[Ei]={initial:{height:i,width:n,style:{display:s.display,height:s.height,width:s.width}}},s.display=s.display||"block",s.boxSizing=s.boxSizing||"border-box",Li(n)){const e=ms(t,"width");void 0!==e&&(t.width=e)}if(Li(i))if(""===t.style.height)t.height=t.width/(e||2);else{const e=ms(t,"height");void 0!==e&&(t.height=e)}}(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Ei])return!1;const s=e[Ei].initial;["height","width"].forEach(t=>{const i=s[t];q(i)?e.removeAttribute(t):e.setAttribute(t,i)});const i=s.style||{};return Object.keys(i).forEach(t=>{e.style[t]=i[t]}),e.width=e.width,delete e[Ei],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const i=t.$proxies||(t.$proxies={}),n={attach:Ii,detach:Bi,resize:Vi}[e]||ji;i[e]=n(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),i=s[e];i&&(({attach:Hi,detach:Hi,resize:Hi}[e]||Oi)(t,e,i),s[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,i){return function(t,e,s,i){const n=cs(t),o=ds(n,"margin"),a=ls(n.maxWidth,t,"clientWidth")||mt,r=ls(n.maxHeight,t,"clientHeight")||mt,l=function(t,e,s){let i,n;if(void 0===e||void 0===s){const o=t&&rs(t);if(o){const t=o.getBoundingClientRect(),a=cs(o),r=ds(a,"border","width"),l=ds(a,"padding");e=t.width-l.width-r.width,s=t.height-l.height-r.height,i=ls(a.maxWidth,o,"clientWidth"),n=ls(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,s=t.clientHeight}return{width:e,height:s,maxWidth:i||mt,maxHeight:n||mt}}(t,e,s);let{width:c,height:h}=l;if("content-box"===n.boxSizing){const t=ds(n,"border","width"),e=ds(n,"padding");c-=e.width+t.width,h-=e.height+t.height}return c=Math.max(0,c-o.width),h=Math.max(0,i?c/i:h-o.height),c=ps(Math.min(c,a,l.maxWidth)),h=ps(Math.min(h,r,l.maxHeight)),c&&!h&&(h=ps(c/2)),(void 0!==e||void 0!==s)&&i&&l.height&&h>l.height&&(h=l.height,c=ps(Math.floor(h*i))),{width:c,height:h}}(t,e,s,i)}isAttached(t){const e=t&&rs(t);return!(!e||!e.isConnected)}}class Wi{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return St(this.x)&&St(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const i={};return t.forEach(t=>{i[t]=s[t]&&s[t].active()?s[t]._to:this[t]}),i}}function qi(t,e,s,i,n){const o=Z(i,0),a=Math.min(Z(n,t.length),t.length);let r,l,c,h=0;for(s=Math.ceil(s),n&&(r=n-i,s=r/Math.floor(r/s)),c=o;c<0;)h++,c=Math.round(o+h*s);for(l=Math.max(o,0);l<a;l++)l===c&&(e.push(t[l]),h++,c=Math.round(o+h*s))}const Ui=(t,e,s)=>"top"===e||"left"===e?t[e]+s:t[e]-s,Yi=(t,e)=>Math.min(e||t,t);function Xi(t,e){const s=[],i=t.length/e,n=t.length;let o=0;for(;o<n;o+=i)s.push(t[Math.floor(o)]);return s}function Ki(t,e,s){const i=t.ticks.length,n=Math.min(e,i-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l,c=t.getPixelForTick(n);if(!(s&&(l=1===i?Math.max(c-o,a-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(n-1))/2,c+=n<e?l:-l,c<o-r||c>a+r)))return c}function Zi(t){return t.drawTicks?t.tickLength:0}function Ji(t,e){if(!t.display)return 0;const s=ze(t.font,e),i=Be(t.padding);return(U(t.text)?t.text.length:1)*s.lineHeight+i.height}function Gi(t,e,s){let i=qt(t);return(s&&"right"!==e||!s&&"right"===e)&&(i=(t=>"left"===t?"right":"right"===t?"left":t)(i)),i}class Qi extends Wi{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:s,_suggestedMax:i}=this;return t=K(t,Number.POSITIVE_INFINITY),e=K(e,Number.NEGATIVE_INFINITY),s=K(s,Number.POSITIVE_INFINITY),i=K(i,Number.NEGATIVE_INFINITY),{min:K(t,s),max:K(e,i),minDefined:X(t),maxDefined:X(e)}}getMinMax(t){let e,{min:s,max:i,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:s,max:i};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;r<l;++r)e=a[r].controller.getMinMax(this,t),n||(s=Math.min(s,e.min)),o||(i=Math.max(i,e.max));return s=o&&s>i?i:s,i=n&&s>i?s:i,{min:K(s,K(i,s)),max:K(i,K(s,i))}}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(){G(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:i,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,s){const{min:i,max:n}=t,o=J(e,(n-i)/2),a=(t,e)=>s&&0===t?0:t+e;return{min:a(i,-Math.abs(o)),max:a(n,o)}}(this,n,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a<this.ticks.length;this._convertTicksToLabels(r?Xi(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(this.ticks=function(t,e){const s=t.options.ticks,i=function(t){const e=t.options.offset,s=t._tickSize(),i=t._length/s+(e?0:1),n=t._maxLength/s;return Math.floor(Math.min(i,n))}(t),n=Math.min(s.maxTicksLimit||i,i),o=s.major.enabled?function(t){const e=[];let s,i;for(s=0,i=t.length;s<i;s++)t[s].major&&e.push(s);return e}(e):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return function(t,e,s,i){let n,o=0,a=s[0];for(i=Math.ceil(i),n=0;n<t.length;n++)n===a&&(e.push(t[n]),o++,a=s[o*i])}(e,c,o,a/n),c;const h=function(t,e,s){const i=function(t){const e=t.length;let s,i;if(e<2)return!1;for(i=t[0],s=1;s<e;++s)if(t[s]-t[s-1]!==i)return!1;return i}(t),n=e.length/s;if(!i)return Math.max(n,1);const o=function(t){const e=[],s=Math.sqrt(t);let i;for(i=1;i<s;i++)t%i===0&&(e.push(i),e.push(t/i));return s===(0|s)&&e.push(s),e.sort((t,e)=>t-e).pop(),e}(i);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>n)return e}return Math.max(n,1)}(o,e,n);if(a>0){let t,s;const i=a>1?Math.round((l-r)/(a-1)):null;for(qi(e,c,h,q(i)?0:r-i,r),t=0,s=a-1;t<s;t++)qi(e,c,h,o[t],o[t+1]);return qi(e,c,h,l,q(i)?e.length:l+i),c}return qi(e,c,h),c}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,s=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,s=!s),this._startPixel=t,this._endPixel=e,this._reversePixels=s,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){G(this.options.afterUpdate,[this])}beforeSetDimensions(){G(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(){G(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),G(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){G(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let s,i,n;for(s=0,i=t.length;s<i;s++)n=t[s],n.label=G(e.callback,[n.value,s,t],this)}afterTickToLabelConversion(){G(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){G(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=Yi(this.ticks.length,t.ticks.maxTicksLimit),i=e.minRotation||0,n=e.maxRotation;let o,a,r,l=i;if(!this._isVisible()||!e.display||i>=n||s<=1||!this.isHorizontal())return void(this.labelRotation=i);const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,u=It(this.chart.width-h,0,this.maxWidth);o=t.offset?this.maxWidth/s:u/(s-1),h+6>o&&(o=u/(s-(t.offset?.5:1)),a=this.maxHeight-Zi(t.grid)-e.padding-Ji(t.title,this.chart.options.font),r=Math.sqrt(h*h+d*d),l=At(Math.min(Math.asin(It((c.highest.height+6)/o,-1,1)),Math.asin(It(a/r,-1,1))-Math.asin(It(d/r,-1,1)))),l=Math.max(i,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){G(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){G(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:i,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Ji(i,e.options.font);if(a?(t.width=this.maxWidth,t.height=Zi(n)+o):(t.height=this.maxHeight,t.width=Zi(n)+o),s.display&&this.ticks.length){const{first:e,last:i,widest:n,highest:o}=this._getLabelSizes(),r=2*s.padding,l=Pt(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(a){const e=s.mirror?0:h*n.width+c*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=s.mirror?0:c*n.width+h*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,i,h,c)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,i){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;r?l?(h=i*t.width,d=s*e.height):(h=s*t.height,d=i*e.width):"start"===n?d=e.width:"end"===n?h=t.width:"inner"!==n&&(h=t.width/2,d=e.width/2),this.paddingLeft=Math.max((h-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-c+o)*this.width/(this.width-c),0)}else{let s=e.height/2,i=t.height/2;"start"===n?(s=0,i=t.height):"end"===n&&(s=e.height,i=0),this.paddingTop=s+o,this.paddingBottom=i+o}}_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(){G(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,s;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,s=t.length;e<s;e++)q(t[e].label)&&(t.splice(e,1),s--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let s=this.ticks;e<s.length&&(s=Xi(s,e)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,s){const{ctx:i,_longestTextCache:n}=this,o=[],a=[],r=Math.floor(e/Yi(e,s));let l,c,h,d,u,p,g,f,m,b,w,v=0,y=0;for(l=0;l<e;l+=r){if(d=t[l].label,u=this._resolveTickFontOptions(l),i.font=p=u.string,g=n[p]=n[p]||{data:{},gc:[]},f=u.lineHeight,m=b=0,q(d)||U(d)){if(U(d))for(c=0,h=d.length;c<h;++c)w=d[c],q(w)||U(w)||(m=ge(i,g.data,g.gc,m,w),b+=f)}else m=ge(i,g.data,g.gc,m,d),b=f;o.push(m),a.push(b),v=Math.max(m,v),y=Math.max(b,y)}!function(t,e){Q(t,t=>{const s=t.gc,i=s.length/2;let n;if(i>e){for(n=0;n<i;++n)delete t.data[s[n]];s.splice(0,i)}})}(n,e);const x=o.indexOf(v),_=a.indexOf(y),k=t=>({width:o[t]||0,height:a[t]||0});return{first:k(0),last:k(e-1),widest:k(x),highest:k(_),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return It(this._alignToPixels?me(this.chart,e,0):e,-32768,32767)}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 s=e[t];return s.$context||(s.$context=function(t,e,s){return $e(t,{tick:s,index:e,type:"tick"})}(this.getContext(),t,s))}return this.$context||(this.$context=$e(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=Pt(this.labelRotation),s=Math.abs(Math.cos(e)),i=Math.abs(Math.sin(e)),n=this._getLabelSizes(),o=t.autoSkipPadding||0,a=n?n.widest.width+o:0,r=n?n.highest.height+o:0;return this.isHorizontal()?r*s>a*i?a/s:r/i:r*i<a*s?r/s:a/i}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,s=this.chart,i=this.options,{grid:n,position:o,border:a}=i,r=n.offset,l=this.isHorizontal(),c=this.ticks.length+(r?1:0),h=Zi(n),d=[],u=a.setContext(this.getContext()),p=u.display?u.width:0,g=p/2,f=function(t){return me(s,t,p)};let m,b,w,v,y,x,_,k,C,S,M,P;if("top"===o)m=f(this.bottom),x=this.bottom-h,k=m-g,S=f(t.top)+g,P=t.bottom;else if("bottom"===o)m=f(this.top),S=t.top,P=f(t.bottom)-g,x=m+g,k=this.top+h;else if("left"===o)m=f(this.right),y=this.right-h,_=m-g,C=f(t.left)+g,M=t.right;else if("right"===o)m=f(this.left),C=t.left,M=f(t.right)-g,y=m+g,_=this.left+h;else if("x"===e){if("center"===o)m=f((t.top+t.bottom)/2+.5);else if(Y(o)){const t=Object.keys(o)[0],e=o[t];m=f(this.chart.scales[t].getPixelForValue(e))}S=t.top,P=t.bottom,x=m+g,k=x+h}else if("y"===e){if("center"===o)m=f((t.left+t.right)/2);else if(Y(o)){const t=Object.keys(o)[0],e=o[t];m=f(this.chart.scales[t].getPixelForValue(e))}y=m-g,_=y-h,C=t.left,M=t.right}const A=Z(i.ticks.maxTicksLimit,c),E=Math.max(1,Math.ceil(c/A));for(b=0;b<c;b+=E){const t=this.getContext(b),e=n.setContext(t),i=a.setContext(t),o=e.lineWidth,c=e.color,h=i.dash||[],u=i.dashOffset,p=e.tickWidth,g=e.tickColor,f=e.tickBorderDash||[],m=e.tickBorderDashOffset;w=Ki(this,b,r),void 0!==w&&(v=me(s,w,o),l?y=_=C=M=v:x=k=S=P=v,d.push({tx1:y,ty1:x,tx2:_,ty2:k,x1:C,y1:S,x2:M,y2:P,width:o,color:c,borderDash:h,borderDashOffset:u,tickWidth:p,tickColor:g,tickBorderDash:f,tickBorderDashOffset:m}))}return this._ticksLength=c,this._borderValue=m,d}_computeLabelItems(t){const e=this.axis,s=this.options,{position:i,ticks:n}=s,o=this.isHorizontal(),a=this.ticks,{align:r,crossAlign:l,padding:c,mirror:h}=n,d=Zi(s.grid),u=d+c,p=h?-c:u,g=-Pt(this.labelRotation),f=[];let m,b,w,v,y,x,_,k,C,S,M,P,A="middle";if("top"===i)x=this.bottom-p,_=this._getXAxisLabelAlignment();else if("bottom"===i)x=this.top+p,_=this._getXAxisLabelAlignment();else if("left"===i){const t=this._getYAxisLabelAlignment(d);_=t.textAlign,y=t.x}else if("right"===i){const t=this._getYAxisLabelAlignment(d);_=t.textAlign,y=t.x}else if("x"===e){if("center"===i)x=(t.top+t.bottom)/2+u;else if(Y(i)){const t=Object.keys(i)[0],e=i[t];x=this.chart.scales[t].getPixelForValue(e)+u}_=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===i)y=(t.left+t.right)/2-u;else if(Y(i)){const t=Object.keys(i)[0],e=i[t];y=this.chart.scales[t].getPixelForValue(e)}_=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===r?A="top":"end"===r&&(A="bottom"));const E=this._getLabelSizes();for(m=0,b=a.length;m<b;++m){w=a[m],v=w.label;const t=n.setContext(this.getContext(m));k=this.getPixelForTick(m)+n.labelOffset,C=this._resolveTickFontOptions(m),S=C.lineHeight,M=U(v)?v.length:1;const e=M/2,s=t.color,r=t.textStrokeColor,c=t.textStrokeWidth;let d,u=_;if(o?(y=k,"inner"===_&&(u=m===b-1?this.options.reverse?"left":"right":0===m?this.options.reverse?"right":"left":"center"),P="top"===i?"near"===l||0!==g?-M*S+S/2:"center"===l?-E.highest.height/2-e*S+S:-E.highest.height+S/2:"near"===l||0!==g?S/2:"center"===l?E.highest.height/2-e*S:E.highest.height-M*S,h&&(P*=-1),0===g||t.showLabelBackdrop||(y+=S/2*Math.sin(g))):(x=k,P=(1-M)*S/2),t.showLabelBackdrop){const e=Be(t.backdropPadding),s=E.heights[m],i=E.widths[m];let n=P-e.top,o=0-e.left;switch(A){case"middle":n-=s/2;break;case"bottom":n-=s}switch(_){case"center":o-=i/2;break;case"right":o-=i;break;case"inner":m===b-1?o-=i:m>0&&(o-=i/2)}d={left:o,top:n,width:i+e.width,height:s+e.height,color:t.backdropColor}}f.push({label:v,font:C,textOffset:P,options:{rotation:g,color:s,strokeColor:r,strokeWidth:c,textAlign:u,textBaseline:A,translation:[y,x],backdrop:d}})}return f}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Pt(this.labelRotation))return"top"===t?"left":"right";let s="center";return"start"===e.align?s="left":"end"===e.align?s="right":"inner"===e.align&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:i,padding:n}}=this.options,o=t+n,a=this._getLabelSizes().widest.width;let r,l;return"left"===e?i?(l=this.right+n,"near"===s?r="left":"center"===s?(r="center",l+=a/2):(r="right",l+=a)):(l=this.right-o,"near"===s?r="right":"center"===s?(r="center",l-=a/2):(r="left",l=this.left)):"right"===e?i?(l=this.left+n,"near"===s?r="right":"center"===s?(r="center",l-=a/2):(r="left",l-=a)):(l=this.left+o,"near"===s?r="left":"center"===s?(r="center",l+=a/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:i,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,i,n,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(e=>e.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,i)=>{i.width&&i.color&&(s.save(),s.lineWidth=i.width,s.strokeStyle=i.color,s.setLineDash(i.borderDash||[]),s.lineDashOffset=i.borderDashOffset,s.beginPath(),s.moveTo(t.x,t.y),s.lineTo(e.x,e.y),s.stroke(),s.restore())};if(e.display)for(n=0,o=i.length;n<o;++n){const t=i[n];e.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&a({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:s,grid:i}}=this,n=s.setContext(this.getContext()),o=s.display?n.width:0;if(!o)return;const a=i.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=me(t,this.left,o)-o/2,c=me(t,this.right,a)+a/2,h=d=r):(h=me(t,this.top,o)-o/2,d=me(t,this.bottom,a)+a/2,l=c=r),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,s=this._computeLabelArea();s&&xe(e,s);const i=this.getLabelItems(t);for(const t of i){const s=t.options,i=t.font;Pe(e,t.label,0,t.textOffset,i,s)}s&&_e(e)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:i}}=this;if(!s.display)return;const n=ze(s.font),o=Be(s.padding),a=s.align;let r=n.lineHeight/2;"bottom"===e||"center"===e||Y(e)?(r+=o.bottom,U(s.text)&&(r+=n.lineHeight*(s.text.length-1))):r+=o.top;const{titleX:l,titleY:c,maxWidth:h,rotation:d}=function(t,e,s,i){const{top:n,left:o,bottom:a,right:r,chart:l}=t,{chartArea:c,scales:h}=l;let d,u,p,g=0;const f=a-n,m=r-o;if(t.isHorizontal()){if(u=Ut(i,o,r),Y(s)){const t=Object.keys(s)[0],i=s[t];p=h[t].getPixelForValue(i)+f-e}else p="center"===s?(c.bottom+c.top)/2+f-e:Ui(t,s,e);d=r-o}else{if(Y(s)){const t=Object.keys(s)[0],i=s[t];u=h[t].getPixelForValue(i)-m+e}else u="center"===s?(c.left+c.right)/2-m+e:Ui(t,s,e);p=Ut(i,a,n),g="left"===s?-wt:wt}return{titleX:u,titleY:p,maxWidth:d,rotation:g}}(this,r,e,a);Pe(t,s.text,0,0,n,{color:s.color,maxWidth:h,rotation:d,textAlign:Gi(a,e,i),textBaseline:"middle",translation:[l,c]})}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,s=Z(t.grid&&t.grid.z,-1),i=Z(t.border&&t.border.z,0);return this._isVisible()&&this.draw===Qi.prototype.draw?[{z:s,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];o[s]!==this.id||t&&o.type!==t||i.push(o)}return i}_resolveTickFontOptions(t){return ze(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class tn{constructor(t,e,s){this.type=t,this.scope=e,this.override=s,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 s;(function(t){return"id"in t&&"defaults"in t})(e)&&(s=this.register(e));const i=this.items,n=t.id,o=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in i||(i[n]=t,function(t,e,s){const i=nt(Object.create(null),[s?pe.get(s):{},pe.get(e),t.defaults]);pe.set(e,i),t.defaultRoutes&&function(t,e){Object.keys(e).forEach(s=>{const i=s.split("."),n=i.pop(),o=[t].concat(i).join("."),a=e[s].split("."),r=a.pop(),l=a.join(".");pe.route(o,n,l,r)})}(e,t.defaultRoutes),t.descriptors&&pe.describe(e,t.descriptors)}(t,o,s),this.override&&pe.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,s=t.id,i=this.scope;s in e&&delete e[s],i&&s in pe[i]&&(delete pe[i][s],this.override&&delete le[s])}}class en{constructor(){this.controllers=new tn(Xs,"datasets",!0),this.elements=new tn(Wi,"elements"),this.plugins=new tn(Object,"plugins"),this.scales=new tn(Qi,"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,s){[...e].forEach(e=>{const i=s||this._getRegistryForType(e);s||i.isForType(e)||i===this.plugins&&e.id?this._exec(t,i,e):Q(e,e=>{const i=s||this._getRegistryForType(e);this._exec(t,i,e)})})}_exec(t,e,s){const i=ct(t);G(s["before"+i],[],s),e[t](s),G(s["after"+i],[],s)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const s=this._typedRegistries[e];if(s.isForType(t))return s}return this.plugins}_get(t,e,s){const i=e.get(t);if(void 0===i)throw new Error('"'+t+'" is not a registered '+s+".");return i}}var sn=new en;class nn{constructor(){this._init=void 0}notify(t,e,s,i){if("beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),void 0===this._init)return;const n=i?this._descriptors(t).filter(i):this._descriptors(t),o=this._notify(n,t,e,s);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),o}_notify(t,e,s,i){i=i||{};for(const n of t){const t=n.plugin;if(!1===G(t[s],[e,i,n.options],t)&&i.cancelable)return!1}return!0}invalidate(){q(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 s=t&&t.config,i=Z(s.options&&s.options.plugins,{}),n=function(t){const e={},s=[],i=Object.keys(sn.plugins.items);for(let t=0;t<i.length;t++)s.push(sn.getPlugin(i[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const i=n[t];-1===s.indexOf(i)&&(s.push(i),e[i.id]=!0)}return{plugins:s,localIds:e}}(s);return!1!==i||e?function(t,{plugins:e,localIds:s},i,n){const o=[],a=t.getContext();for(const r of e){const e=r.id,l=on(i[e],n);null!==l&&o.push({plugin:r,options:an(t.config,{plugin:r,local:s[e]},l,a)})}return o}(t,n,i,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],s=this._cache,i=(t,e)=>t.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(i(e,s),t,"stop"),this._notify(i(s,e),t,"start")}}function on(t,e){return e||!1!==t?!0===t?{}:t:null}function an(t,{plugin:e,local:s},i,n){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(i,o);return s&&e.defaults&&a.push(e.defaults),t.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function rn(t,e){const s=pe.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||s.indexAxis||"x"}function ln(t){if("x"===t||"y"===t||"r"===t)return t}function cn(t){return"top"===t||"bottom"===t?"x":"left"===t||"right"===t?"y":void 0}function hn(t,...e){if(ln(t))return t;for(const s of e){const e=s.axis||cn(s.position)||t.length>1&&ln(t[0].toLowerCase());if(e)return e}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function dn(t,e,s){if(s[e+"AxisID"]===t)return{axis:e}}function un(t){const e=t.options||(t.options={});e.plugins=Z(e.plugins,{}),e.scales=function(t,e){const s=le[t.type]||{scales:{}},i=e.scales||{},n=rn(t.type,e),o=Object.create(null);return Object.keys(i).forEach(e=>{const a=i[e];if(!Y(a))return console.error(`Invalid scale configuration for scale: ${e}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const r=hn(e,a,function(t,e){if(e.data&&e.data.datasets){const s=e.data.datasets.filter(e=>e.xAxisID===t||e.yAxisID===t);if(s.length)return dn(t,"x",s[0])||dn(t,"y",s[0])}return{}}(e,t),pe.scales[a.type]),l=function(t,e){return t===e?"_index_":"_value_"}(r,n),c=s.scales||{};o[e]=ot(Object.create(null),[{axis:r},a,c[r],c[l]])}),t.data.datasets.forEach(s=>{const n=s.type||t.type,a=s.indexAxis||rn(n,e),r=(le[n]||{}).scales||{};Object.keys(r).forEach(t=>{const e=function(t,e){let s=t;return"_index_"===t?s=e:"_value_"===t&&(s="x"===e?"y":"x"),s}(t,a),n=s[e+"AxisID"]||e;o[n]=o[n]||Object.create(null),ot(o[n],[{axis:e},i[n],r[t]])})}),Object.keys(o).forEach(t=>{const e=o[t];ot(e,[pe.scales[e.type],pe.scale])}),o}(t,e)}function pn(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const gn=new Map,fn=new Set;function mn(t,e){let s=gn.get(t);return s||(s=e(),gn.set(t,s),fn.add(s)),s}const bn=(t,e,s)=>{const i=lt(e,s);void 0!==i&&t.add(i)};class wn{constructor(t){this._config=function(t){return(t=t||{}).data=pn(t.data),un(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=pn(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(),un(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return mn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return mn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return mn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id;return mn(`${this.type}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let i=s.get(t);return i&&!e||(i=new Map,s.set(t,i)),i}getOptionScopes(t,e,s){const{options:i,type:n}=this,o=this._cachedScopes(t,s),a=o.get(e);if(a)return a;const r=new Set;e.forEach(e=>{t&&(r.add(t),e.forEach(e=>bn(r,t,e))),e.forEach(t=>bn(r,i,t)),e.forEach(t=>bn(r,le[n]||{},t)),e.forEach(t=>bn(r,pe,t)),e.forEach(t=>bn(r,ce,t))});const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),fn.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,le[e]||{},pe.datasets[e]||{},{type:e},pe,ce]}resolveNamedOptions(t,e,s,i=[""]){const n={$shared:!0},{resolver:o,subPrefixes:a}=vn(this._resolverCache,t,i);let r=o;(function(t,e){const{isScriptable:s,isIndexable:i}=je(t);for(const n of e){const e=s(n),o=i(n),a=(o||e)&&t[n];if(e&&(dt(a)||yn(a))||o&&U(a))return!0}return!1})(o,e)&&(n.$shared=!1,r=He(o,s=dt(s)?s():s,this.createResolver(t,s,a)));for(const t of e)n[t]=r[t];return n}createResolver(t,e,s=[""],i){const{resolver:n}=vn(this._resolverCache,t,s);return Y(e)?He(n,e,void 0,i):n}}function vn(t,e,s){let i=t.get(e);i||(i=new Map,t.set(e,i));const n=s.join();let o=i.get(n);return o||(o={resolver:Ve(e,s),subPrefixes:s.filter(t=>!t.toLowerCase().includes("hover"))},i.set(n,o)),o}const yn=t=>Y(t)&&Object.getOwnPropertyNames(t).some(e=>dt(t[e])),xn=["top","bottom","left","right","chartArea"];function kn(t,e){return"top"===t||"bottom"===t||-1===xn.indexOf(t)&&"x"===e}function Cn(t,e){return function(s,i){return s[t]===i[t]?s[e]-i[e]:s[t]-i[t]}}function Sn(t){const e=t.chart,s=e.options.animation;e.notifyPlugins("afterRender"),G(s&&s.onComplete,[t],e)}function Mn(t){const e=t.chart,s=e.options.animation;G(s&&s.onProgress,[t],e)}function Pn(t){return as()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const An={},En=t=>{const e=Pn(t);return Object.values(An).filter(t=>t.canvas===e).pop()};function Tn(t,e,s){const i=Object.keys(t);for(const n of i){const i=+n;if(i>=e){const o=t[n];delete t[n],(s>0||i>e)&&(t[i+s]=o)}}}class Ln{static defaults=pe;static instances=An;static overrides=le;static registry=sn;static version="4.5.1";static getChart=En;static register(...t){sn.add(...t),Dn()}static unregister(...t){sn.remove(...t),Dn()}constructor(t,e){const s=this.config=new wn(e),i=Pn(t),n=En(i);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const o=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||function(t){return!as()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Ai:Ni}(i)),this.platform.updateConfig(s);const a=this.platform.acquireContext(i,o.aspectRatio),r=a&&a.canvas,l=r&&r.height,c=r&&r.width;this.id=W(),this.ctx=a,this.canvas=r,this.width=c,this.height=l,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new nn,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let s;return function(...i){return e?(clearTimeout(s),s=setTimeout(t,e,i)):t.apply(this,i),e}}(t=>this.update(t),o.resizeDelay||0),this._dataChanges=[],An[this.id]=this,a&&r?(Ds.listen(this,"complete",Sn),Ds.listen(this,"progress",Mn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:i,_aspectRatio:n}=this;return q(t)?e&&n?n:i?s/i: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 sn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():gs(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return be(this.canvas,this.ctx),this}stop(){return Ds.stop(this),this}resize(t,e){Ds.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,i=this.canvas,n=s.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(i,t,e,n),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,gs(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),G(s.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){Q(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,i=Object.keys(s).reduce((t,e)=>(t[e]=!1,t),{});let n=[];e&&(n=n.concat(Object.keys(e).map(t=>{const s=e[t],i=hn(t,s),n="r"===i,o="x"===i;return{options:s,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}}))),Q(n,e=>{const n=e.options,o=n.id,a=hn(o,n),r=Z(n.type,e.dtype);void 0!==n.position&&kn(n.position,a)===kn(e.dposition)||(n.position=e.dposition),i[o]=!0;let l=null;o in s&&s[o].type===r?l=s[o]:(l=new(sn.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),s[l.id]=l),l.init(n,t)}),Q(i,(t,e)=>{t||delete s[e]}),Q(s,t=>{Mi.configure(this,t,t.options),Mi.addBox(this,t)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((t,e)=>t.index-e.index),s>e){for(let t=e;t<s;++t)this._destroyDatasetMeta(t);t.splice(e,s-e)}this._sortedMetasets=t.slice(0).sort(Cn("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((t,s)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,i;for(this._removeUnreferencedMetasets(),s=0,i=e.length;s<i;s++){const i=e[s];let n=this.getDatasetMeta(s);const o=i.type||this.config.type;if(n.type&&n.type!==o&&(this._destroyDatasetMeta(s),n=this.getDatasetMeta(s)),n.type=o,n.indexAxis=i.indexAxis||rn(o,this.options),n.order=i.order||0,n.index=s,n.label=""+i.label,n.visible=this.isDatasetVisible(s),n.controller)n.controller.updateIndex(s),n.controller.linkScales();else{const e=sn.getController(o),{datasetElementType:i,dataElementType:a}=pe.datasets[o];Object.assign(e,{dataElementType:sn.getElement(a),datasetElementType:i&&sn.getElement(i)}),n.controller=new e(this,s),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){Q(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 s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),s=!i&&-1===n.indexOf(e);e.buildOrUpdateElements(s),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=s.layout.autoPadding?o:0,this._updateLayout(o),i||Q(n,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Cn("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){Q(this.scales,t=>{Mi.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);ut(e,s)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:i,count:n}of e)Tn(t,i,"_removeElements"===s?-n:n)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),i=s(0);for(let t=1;t<e;t++)if(!ut(i,s(t)))return;return Array.from(i).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Mi.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],Q(this.boxes,t=>{s&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,s=this.data.datasets.length;e<s;++e)this._updateDataset(e,dt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const s=this.getDatasetMeta(t),i={meta:s,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",i)&&(s.controller._update(e),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(Ds.has(this)?this.attached&&!Ds.running(this)&&Ds.start(this):(this.draw(),Sn({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))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,s=[];let i,n;for(i=0,n=e.length;i<n;++i){const n=e[i];t&&!n.visible||s.push(n)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))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,s={meta:t,index:t.index,cancelable:!0},i=Ts(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(i&&xe(e,i),t.controller.draw(),i&&_e(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return ye(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,i){const n=gi.modes[e];return"function"==typeof n?n(this,t,s,i):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let i=s.filter(t=>t&&t._dataset===e).pop();return i||(i={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},s.push(i)),i}getContext(){return this.$context||(this.$context=$e(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return"boolean"==typeof s.hidden?!s.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const i=s?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,i);ht(e)?(n.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),o.update(n,{visible:s}),this.update(e=>e.datasetIndex===t?i: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(),Ds.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(),be(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete An[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,s=(s,i)=>{e.addEventListener(this,s,i),t[s]=i},i=(t,e,s)=>{t.offsetX=e,t.offsetY=s,this._eventHandler(t)};Q(this.options.events,t=>s(t,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(s,i)=>{e.addEventListener(this,s,i),t[s]=i},i=(s,i)=>{t[s]&&(e.removeEventListener(this,s,i),delete t[s])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{i("attach",a),this.attached=!0,this.resize(),s("resize",n),s("detach",o)};o=()=>{this.attached=!1,i("resize",n),this._stop(),this._resize(0,0),s("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){Q(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},Q(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const i=s?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+i+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[i+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],s=t.map(({datasetIndex:t,index:e})=>{const s=this.getDatasetMeta(t);if(!s)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:s.data[e],index:e}});!tt(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,s){const i=this.options.hover,n=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),o=n(e,t),a=s?t:n(t,e);o.length&&this.updateHoverStyle(o,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},i=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",s,i))return;const n=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,i),(n||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:i=[],options:n}=this,o=e,a=this._getActiveElements(t,i,s,o),r=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,s,i){return s&&"mouseout"!==t.type?i?e:t:null}(t,this._lastEvent,s,r);s&&(this._lastEvent=null,G(n.onHover,[t,a,this],this),r&&G(n.onClick,[t,a,this],this));const c=!tt(a,i);return(c||e)&&(this._active=a,this._updateHoverStyles(a,i,e)),this._lastEvent=l,c}_getActiveElements(t,e,s,i){if("mouseout"===t.type)return[];if(!s)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,i)}}function Dn(){return Q(Ln.instances,t=>t._plugins.invalidate())}function On(t,e,s,i){return{x:s+t*Math.cos(e),y:i+t*Math.sin(e)}}function Rn(t,e,s,i,n,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=e,d=Math.max(e.outerRadius+i+s-c,0),u=h>0?h+i+s+c:0;let p=0;const g=n-l;if(i){const t=((h>0?h-i:0)+(d>0?d-i:0))/2;p=(g-(0!==t?g*t/(t+i):g))/2}const f=(g-Math.max(.001,g*d-s/pt)/d)/2,m=l+f+p,b=n-f-p,{outerStart:w,outerEnd:v,innerStart:y,innerEnd:x}=function(t,e,s,i){const n=Oe(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),o=(s-e)/2,a=Math.min(o,i*e/2),r=t=>{const e=(s-Math.min(o,t))*i/2;return It(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:It(n.innerStart,0,a),innerEnd:It(n.innerEnd,0,a)}}(e,u,d,b-m),_=d-w,k=d-v,C=m+w/_,S=b-v/k,M=u+y,P=u+x,A=m+y/M,E=b-x/P;if(t.beginPath(),o){const e=(C+S)/2;if(t.arc(a,r,d,C,e),t.arc(a,r,d,e,S),v>0){const e=On(k,S,a,r);t.arc(e.x,e.y,v,S,b+wt)}const s=On(P,b,a,r);if(t.lineTo(s.x,s.y),x>0){const e=On(P,E,a,r);t.arc(e.x,e.y,x,b+wt,E+Math.PI)}const i=(b-x/u+(m+y/u))/2;if(t.arc(a,r,u,b-x/u,i,!0),t.arc(a,r,u,i,m+y/u,!0),y>0){const e=On(M,A,a,r);t.arc(e.x,e.y,y,A+Math.PI,m-wt)}const n=On(_,m,a,r);if(t.lineTo(n.x,n.y),w>0){const e=On(_,C,a,r);t.arc(e.x,e.y,w,m-wt,C)}}else{t.moveTo(a,r);const e=Math.cos(C)*d+a,s=Math.sin(C)*d+r;t.lineTo(e,s);const i=Math.cos(S)*d+a,n=Math.sin(S)*d+r;t.lineTo(i,n)}t.closePath()}function In(t,e,s=e){t.lineCap=Z(s.borderCapStyle,e.borderCapStyle),t.setLineDash(Z(s.borderDash,e.borderDash)),t.lineDashOffset=Z(s.borderDashOffset,e.borderDashOffset),t.lineJoin=Z(s.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Z(s.borderWidth,e.borderWidth),t.strokeStyle=Z(s.borderColor,e.borderColor)}function Bn(t,e,s){t.lineTo(s.x,s.y)}function zn(t,e,s={}){const i=t.length,{start:n=0,end:o=i-1}=s,{start:a,end:r}=e,l=Math.max(n,a),c=Math.min(o,r),h=n<a&&o<a||n>r&&o>r;return{count:i,start:l,loop:e.loop,ilen:c<l&&!h?i+c-l:c-l}}function Fn(t,e,s,i){const{points:n,options:o}=e,{count:a,start:r,loop:l,ilen:c}=zn(n,s,i),h=function(t){return t.stepped?ke:t.tension||"monotone"===t.cubicInterpolationMode?Ce:Bn}(o);let d,u,p,{move:g=!0,reverse:f}=i||{};for(d=0;d<=c;++d)u=n[(r+(f?c-d:d))%a],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):h(t,p,u,f,o.stepped),p=u);return l&&(u=n[(r+(f?c:0))%a],h(t,p,u,f,o.stepped)),!!l}function $n(t,e,s,i){const n=e.points,{count:o,start:a,ilen:r}=zn(n,s,i),{move:l=!0,reverse:c}=i||{};let h,d,u,p,g,f,m=0,b=0;const w=t=>(a+(c?r-t:t))%o,v=()=>{p!==g&&(t.lineTo(m,g),t.lineTo(m,p),t.lineTo(m,f))};for(l&&(d=n[w(0)],t.moveTo(d.x,d.y)),h=0;h<=r;++h){if(d=n[w(h)],d.skip)continue;const e=d.x,s=d.y,i=0|e;i===u?(s<p?p=s:s>g&&(g=s),m=(b*m+e)/++b):(v(),t.lineTo(e,s),u=i,b=0,p=g=s),f=s}v()}function Vn(t){const e=t.options,s=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||s?Fn:$n}const Hn="function"==typeof Path2D;class jn extends Wi{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||"monotone"===s.cubicInterpolationMode)&&!s.stepped&&!this._pointsUpdated){const i=s.spanGaps?this._loop:this._fullLoop;os(this._points,s,t,i,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const s=t.points,i=t.options.spanGaps,n=s.length;if(!n)return[];const o=!!t._loop,{start:a,end:r}=function(t,e,s,i){let n=0,o=e-1;if(s&&!i)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,s&&(o+=n);o>n&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(s,n,o,i);return function(t,e,s,i){return i&&i.setContext&&s?function(t,e,s,i){const n=t._chart.getContext(),o=Ps(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=s.length,c=[];let h=o,d=e[0].start,u=d;function p(t,e,i,n){const o=r?-1:1;if(t!==e){for(t+=l;s[t%l].skip;)t-=o;for(;s[e%l].skip;)e+=o;t%l!==e%l&&(c.push({start:t%l,end:e%l,loop:i,style:n}),h=n,d=e%l)}}for(const t of e){d=r?d:t.start;let e,o=s[d%l];for(u=d+1;u<=t.end;u++){const r=s[u%l];e=Ps(i.setContext($e(n,{type:"segment",p0:o,p1:r,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),As(e,h)&&p(d,u-1,t.loop,h),o=r,h=e}d<u-1&&p(d,u-1,t.loop,h)}return c}(t,e,s,i):e}(t,!0===i?[{start:a,end:r,loop:o}]:function(t,e,s,i){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=s;++a){const s=t[a%n];s.skip||s.stop?l.skip||(i=!1,o.push({start:e%n,end:(a-1)%n,loop:i}),e=r=s.stop?a:null):(r=a,l.skip&&(e=a)),l=s}return null!==r&&o.push({start:e%n,end:r%n,loop:i}),o}(s,a,r<a?r+n:r,!!t._fullLoop&&0===a&&r===n-1),s,e)}(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,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,i=t[e],n=this.points,o=Ms(this,{property:e,start:i,end:i});if(!o.length)return;const a=[],r=function(t){return t.stepped?ws:t.tension||"monotone"===t.cubicInterpolationMode?vs:bs}(s);let l,c;for(l=0,c=o.length;l<c;++l){const{start:c,end:h}=o[l],d=n[c],u=n[h];if(d===u){a.push(d);continue}const p=r(d,u,Math.abs((i-d[e])/(u[e]-d[e])),s.stepped);p[e]=t[e],a.push(p)}return 1===a.length?a[0]:a}pathSegment(t,e,s){return Vn(this)(t,this,e,s)}path(t,e,s){const i=this.segments,n=Vn(this);let o=this._loop;e=e||0,s=s||this.points.length-e;for(const a of i)o&=n(t,this,a,{start:e,end:e+s-1});return!!o}draw(t,e,s,i){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),function(t,e,s,i){Hn&&!e.options.segment?function(t,e,s,i){let n=e._path;n||(n=e._path=new Path2D,e.path(n,s,i)&&n.closePath()),In(t,e.options),t.stroke(n)}(t,e,s,i):function(t,e,s,i){const{segments:n,options:o}=e,a=Vn(e);for(const r of n)In(t,o,r.style),t.beginPath(),a(t,e,r,{start:s,end:s+i-1})&&t.closePath(),t.stroke()}(t,e,s,i)}(t,this,s,i),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Nn(t,e,s,i){const n=t.options,{[s]:o}=t.getProps([s],i);return Math.abs(e-o)<n.radius+n.hitRadius}function Wn(t,e){const{x:s,y:i,base:n,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,c,h,d;return t.horizontal?(d=a/2,r=Math.min(s,n),l=Math.max(s,n),c=i-d,h=i+d):(d=o/2,r=s-d,l=s+d,c=Math.min(i,n),h=Math.max(i,n)),{left:r,top:c,right:l,bottom:h}}function qn(t,e,s,i){return t?0:It(e,s,i)}function Un(t,e,s,i){const n=null===e,o=null===s,a=t&&!(n&&o)&&Wn(t,i);return a&&(n||Bt(e,a.left,a.right))&&(o||Bt(s,a.top,a.bottom))}function Yn(t,e){t.rect(e.x,e.y,e.w,e.h)}function Xn(t,e,s={}){const i=t.x!==s.x?-e:0,n=t.y!==s.y?-e:0,o=(t.x+t.w!==s.x+s.w?e:0)-i,a=(t.y+t.h!==s.y+s.h?e:0)-n;return{x:t.x+i,y:t.y+n,w:t.w+o,h:t.h+a,radius:t.radius}}var Kn=Object.freeze({__proto__:null,ArcElement:class extends Wi{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,s){const i=this.getProps(["x","y"],s),{angle:n,distance:o}=Tt(i,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),d=(this.options.spacing+this.options.borderWidth)/2,u=Z(h,r-a),p=Rt(n,a,r)&&a!==r,g=u>=gt||p,f=Bt(o,l+d,c+d);return g&&f}getCenterPoint(t){const{x:e,y:s,startAngle:i,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:l}=this.options,c=(i+n)/2,h=(o+a+l+r)/2;return{x:e+Math.cos(c)*h,y:s+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:s}=this,i=(e.offset||0)/4,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=s>gt?Math.floor(s/gt):0,0===s||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*i,Math.sin(a)*i);const r=i*(1-Math.sin(Math.min(pt,s||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,s,i,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){Rn(t,e,s,i,l,n);for(let e=0;e<o;++e)t.fill();isNaN(r)||(l=a+(r%gt||gt))}Rn(t,e,s,i,l,n),t.fill()}(t,this,r,n,o),function(t,e,s,i,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u,borderRadius:p}=l,g="inner"===l.borderAlign;if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=u,g?(t.lineWidth=2*c,t.lineJoin=h||"round"):(t.lineWidth=c,t.lineJoin=h||"bevel");let f=e.endAngle;if(o){Rn(t,e,s,i,f,n);for(let e=0;e<o;++e)t.stroke();isNaN(r)||(f=a+(r%gt||gt))}g&&function(t,e,s){const{startAngle:i,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=e;let c=n/r;t.beginPath(),t.arc(o,a,r,i-c,s+c),l>n?(c=n/l,t.arc(o,a,l,s+c,i-c,!0)):t.arc(o,a,n,s+wt,i-wt),t.closePath(),t.clip()}(t,e,f),l.selfJoin&&f-a>=pt&&0===p&&"miter"!==h&&function(t,e,s){const{startAngle:i,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=e,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/a,Ot(i-s));if(t.beginPath(),t.arc(n,o,a-c/2,i+d/2,s-d/2),r>0){const e=Math.min(c/r,Ot(i-s));t.arc(n,o,r+c/2,s-e/2,i+e/2,!0)}else{const e=Math.min(c/2,a*Ot(i-s));if("round"===h)t.arc(n,o,e,s-pt/2,i+pt/2,!0);else if("bevel"===h){const a=2*e*e,r=-a*Math.cos(s+pt/2)+n,l=-a*Math.sin(s+pt/2)+o,c=a*Math.cos(i+pt/2)+n,h=a*Math.sin(i+pt/2)+o;t.lineTo(r,l),t.lineTo(c,h)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}(t,e,f),o||(Rn(t,e,s,i,f,n),t.stroke())}(t,this,r,n,o),t.restore()}},BarElement:class extends Wi{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:s,backgroundColor:i}}=this,{inner:n,outer:o}=function(t){const e=Wn(t),s=e.right-e.left,i=e.bottom-e.top,n=function(t,e,s){const i=t.options.borderWidth,n=t.borderSkipped,o=Re(i);return{t:qn(n.top,o.top,0,s),r:qn(n.right,o.right,0,e),b:qn(n.bottom,o.bottom,0,s),l:qn(n.left,o.left,0,e)}}(t,s/2,i/2),o=function(t,e,s){const{enableBorderRadius:i}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,o=Ie(n),a=Math.min(e,s),r=t.borderSkipped,l=i||Y(n);return{topLeft:qn(!l||r.top||r.left,o.topLeft,0,a),topRight:qn(!l||r.top||r.right,o.topRight,0,a),bottomLeft:qn(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:qn(!l||r.bottom||r.right,o.bottomRight,0,a)}}(t,s/2,i/2);return{outer:{x:e.left,y:e.top,w:s,h:i,radius:o},inner:{x:e.left+n.l,y:e.top+n.t,w:s-n.l-n.r,h:i-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}(this),a=(r=o.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?Ae:Yn;var r;t.save(),o.w===n.w&&o.h===n.h||(t.beginPath(),a(t,Xn(o,e,n)),t.clip(),a(t,Xn(n,-e,o)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),a(t,Xn(n,e)),t.fillStyle=i,t.fill(),t.restore()}inRange(t,e,s){return Un(this,t,e,s)}inXRange(t,e){return Un(this,t,null,e)}inYRange(t,e){return Un(this,null,t,e)}getCenterPoint(t){const{x:e,y:s,base:i,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+i)/2:e,y:n?s:(s+i)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:jn,PointElement:class extends Wi{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,s){const i=this.options,{x:n,y:o}=this.getProps(["x","y"],s);return Math.pow(t-n,2)+Math.pow(e-o,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(t,e){return Nn(this,t,"x",e)}inYRange(t,e){return Nn(this,t,"y",e)}getCenterPoint(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}size(t){let e=(t=t||this.options||{}).radius||0;return e=Math.max(e,e&&t.hoverRadius||0),2*(e+(e&&t.borderWidth||0))}draw(t,e){const s=this.options;this.skip||s.radius<.1||!ye(this,e,this.size(s)/2)||(t.strokeStyle=s.borderColor,t.lineWidth=s.borderWidth,t.fillStyle=s.backgroundColor,we(t,s,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});const Zn=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Jn=Zn.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function Gn(t){return Zn[t%Zn.length]}function Qn(t){return Jn[t%Jn.length]}function to(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var eo={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,s){if(!s.enabled)return;const{data:{datasets:i},options:n}=t.config,{elements:o}=n,a=to(i)||(r=n)&&(r.borderColor||r.backgroundColor)||o&&to(o)||"rgba(0,0,0,0.1)"!==pe.borderColor||"rgba(0,0,0,0.1)"!==pe.backgroundColor;var r;if(!s.forceOverride&&a)return;const l=function(t){let e=0;return(s,i)=>{const n=t.getDatasetMeta(i).controller;n instanceof ii?e=function(t,e){return t.backgroundColor=t.data.map(()=>Gn(e++)),e}(s,e):n instanceof ni?e=function(t,e){return t.backgroundColor=t.data.map(()=>Qn(e++)),e}(s,e):n&&(e=function(t,e){return t.borderColor=Gn(e),t.backgroundColor=Qn(e),++e}(s,e))}}(t);i.forEach(l)}};function so(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function io(t){t.data.datasets.forEach(t=>{so(t)})}var no={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,s)=>{if(!s.enabled)return void io(t);const i=t.width;t.data.datasets.forEach((e,n)=>{const{_data:o,indexAxis:a}=e,r=t.getDatasetMeta(n),l=o||e.data;if("y"===Fe([a,t.options.indexAxis]))return;if(!r.controller.supportsDecimation)return;const c=t.scales[r.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let h,{start:d,count:u}=function(t,e){const s=e.length;let i,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(n=It(Ft(e,o.axis,a).lo,0,s-1)),i=c?It(Ft(e,o.axis,r).hi+1,n,s)-n:s-n,{start:n,count:i}}(r,l);if(u<=(s.threshold||4*i))so(e);else{switch(q(o)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),s.algorithm){case"lttb":h=function(t,e,s,i,n){const o=n.samples||i;if(o>=s)return t.slice(e,e+s);const a=[],r=(s-2)/(o-2);let l=0;const c=e+s-1;let h,d,u,p,g,f=e;for(a[l++]=t[f],h=0;h<o-2;h++){let i,n=0,o=0;const c=Math.floor((h+1)*r)+1+e,m=Math.min(Math.floor((h+2)*r)+1,s)+e,b=m-c;for(i=c;i<m;i++)n+=t[i].x,o+=t[i].y;n/=b,o/=b;const w=Math.floor(h*r)+1+e,v=Math.min(Math.floor((h+1)*r)+1,s)+e,{x:y,y:x}=t[f];for(u=p=-1,i=w;i<v;i++)p=.5*Math.abs((y-n)*(t[i].y-x)-(y-t[i].x)*(o-x)),p>u&&(u=p,d=t[i],g=i);a[l++]=d,f=g}return a[l++]=t[c],a}(l,d,u,i,s);break;case"min-max":h=function(t,e,s,i){let n,o,a,r,l,c,h,d,u,p,g=0,f=0;const m=[],b=e+s-1,w=t[e].x,v=t[b].x-w;for(n=e;n<e+s;++n){o=t[n],a=(o.x-w)/v*i,r=o.y;const e=0|a;if(e===l)r<u?(u=r,c=n):r>p&&(p=r,h=n),g=(f*g+o.x)/++f;else{const s=n-1;if(!q(c)&&!q(h)){const e=Math.min(c,h),i=Math.max(c,h);e!==d&&e!==s&&m.push({...t[e],x:g}),i!==d&&i!==s&&m.push({...t[i],x:g})}n>0&&s!==d&&m.push(t[s]),m.push(o),l=e,f=0,u=p=r,c=h=d=n}}return m}(l,d,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${s.algorithm}'`)}e._decimated=h}})},destroy(t){io(t)}};function oo(t,e,s,i){if(i)return;let n=e[t],o=s[t];return"angle"===t&&(n=Ot(n),o=Ot(o)),{property:t,start:n,end:o}}function ao(t,e,s){for(;e>t;e--){const t=s[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function ro(t,e,s,i){return t&&e?i(t[s],e[s]):t?t[s]:e?e[s]:0}function lo(t,e){let s=[],i=!1;return U(t)?(i=!0,s=t):s=function(t,e){const{x:s=null,y:i=null}=t||{},n=e.points,o=[];return e.segments.forEach(({start:t,end:e})=>{e=ao(t,e,n);const a=n[t],r=n[e];null!==i?(o.push({x:a.x,y:i}),o.push({x:r.x,y:i})):null!==s&&(o.push({x:s,y:a.y}),o.push({x:s,y:r.y}))}),o}(t,e),s.length?new jn({points:s,options:{tension:0},_loop:i,_fullLoop:i}):null}function co(t){return t&&!1!==t.fill}function ho(t,e,s){let i=t[e].fill;const n=[e];let o;if(!s)return i;for(;!1!==i&&-1===n.indexOf(i);){if(!X(i))return i;if(o=t[i],!o)return!1;if(o.visible)return i;n.push(i),i=o.fill}return!1}function uo(t,e,s){const i=function(t){const e=t.options,s=e.fill;let i=Z(s&&s.target,s);return void 0===i&&(i=!!e.backgroundColor),!1!==i&&null!==i&&(!0===i?"origin":i)}(t);if(Y(i))return!isNaN(i.value)&&i;let n=parseFloat(i);return X(n)&&Math.floor(n)===n?function(t,e,s,i){return"-"!==t&&"+"!==t||(s=e+s),!(s===e||s<0||s>=i)&&s}(i[0],e,n,s):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function po(t,e,s){const i=[];for(let n=0;n<s.length;n++){const o=s[n],{first:a,last:r,point:l}=go(o,e,"x");if(!(!l||a&&r))if(a)i.unshift(l);else if(t.push(l),!r)break}t.push(...i)}function go(t,e,s){const i=t.interpolate(e,s);if(!i)return{};const n=i[s],o=t.segments,a=t.points;let r=!1,l=!1;for(let t=0;t<o.length;t++){const e=o[t],i=a[e.start][s],c=a[e.end][s];if(Bt(n,i,c)){r=n===i,l=n===c;break}}return{first:r,last:l,point:i}}class fo{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,s){const{x:i,y:n,radius:o}=this;return e=e||{start:0,end:gt},t.arc(i,n,o,e.end,e.start,!0),!s.bounds}interpolate(t){const{x:e,y:s,radius:i}=this,n=t.angle;return{x:e+Math.cos(n)*i,y:s+Math.sin(n)*i,angle:n}}}function mo(t,e,s){const i=function(t){const{chart:e,fill:s,line:i}=t;if(X(s))return function(t,e){const s=t.getDatasetMeta(e);return s&&t.isDatasetVisible(e)?s.dataset:null}(e,s);if("stack"===s)return function(t){const{scale:e,index:s,line:i}=t,n=[],o=i.segments,a=i.points,r=function(t,e){const s=[],i=t.getMatchingVisibleMetas("line");for(let t=0;t<i.length;t++){const n=i[t];if(n.index===e)break;n.hidden||s.unshift(n.dataset)}return s}(e,s);r.push(lo({x:null,y:e.bottom},i));for(let t=0;t<o.length;t++){const e=o[t];for(let t=e.start;t<=e.end;t++)po(n,a[t],r)}return new jn({points:n,options:{}})}(t);if("shape"===s)return!0;const n=function(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:e,fill:s}=t,i=e.options,n=e.getLabels().length,o=i.reverse?e.max:e.min,a=function(t,e,s){let i;return i="start"===t?s:"end"===t?e.options.reverse?e.min:e.max:Y(t)?t.value:e.getBaseValue(),i}(s,e,o),r=[];if(i.grid.circular){const t=e.getPointPositionForValue(0,o);return new fo({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(a)})}for(let t=0;t<n;++t)r.push(e.getPointPositionForValue(t,a));return r}(t):function(t){const{scale:e={},fill:s}=t,i=function(t,e){let s=null;return"start"===t?s=e.bottom:"end"===t?s=e.top:Y(t)?s=e.getPixelForValue(t.value):e.getBasePixel&&(s=e.getBasePixel()),s}(s,e);if(X(i)){const t=e.isHorizontal();return{x:t?i:null,y:t?null:i}}return null}(t)}(t);return n instanceof fo?n:lo(n,i)}(e),{chart:n,index:o,line:a,scale:r,axis:l}=e,c=a.options,h=c.fill,d=c.backgroundColor,{above:u=d,below:p=d}=h||{},g=n.getDatasetMeta(o),f=Ts(n,g);i&&a.points.length&&(xe(t,s),function(t,e){const{line:s,target:i,above:n,below:o,area:a,scale:r,clip:l}=e,c=s._loop?"angle":e.axis;t.save();let h=o;o!==n&&("x"===c?(bo(t,i,a.top),vo(t,{line:s,target:i,color:n,scale:r,property:c,clip:l}),t.restore(),t.save(),bo(t,i,a.bottom)):"y"===c&&(wo(t,i,a.left),vo(t,{line:s,target:i,color:o,scale:r,property:c,clip:l}),t.restore(),t.save(),wo(t,i,a.right),h=n)),vo(t,{line:s,target:i,color:h,scale:r,property:c,clip:l}),t.restore()}(t,{line:a,target:i,above:u,below:p,area:s,scale:r,axis:l,clip:f}),_e(t))}function bo(t,e,s){const{segments:i,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of i){const{start:i,end:l}=r,c=n[i],h=n[ao(i,l,n)];o?(t.moveTo(c.x,c.y),o=!1):(t.lineTo(c.x,s),t.lineTo(c.x,c.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(h.x,s)}t.lineTo(e.first().x,s),t.closePath(),t.clip()}function wo(t,e,s){const{segments:i,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of i){const{start:i,end:l}=r,c=n[i],h=n[ao(i,l,n)];o?(t.moveTo(c.x,c.y),o=!1):(t.lineTo(s,c.y),t.lineTo(c.x,c.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(s,h.y)}t.lineTo(s,e.first().y),t.closePath(),t.clip()}function vo(t,e){const{line:s,target:i,property:n,color:o,scale:a,clip:r}=e,l=function(t,e,s){const i=t.segments,n=t.points,o=e.points,a=[];for(const t of i){let{start:i,end:r}=t;r=ao(i,r,n);const l=oo(s,n[i],n[r],t.loop);if(!e.segments){a.push({source:t,target:l,start:n[i],end:n[r]});continue}const c=Ms(e,l);for(const e of c){const i=oo(s,o[e.start],o[e.end],e.loop),r=Ss(t,n,i);for(const t of r)a.push({source:t,target:e,start:{[s]:ro(l,i,"start",Math.max)},end:{[s]:ro(l,i,"end",Math.min)}})}}return a}(s,i,n);for(const{source:e,target:c,start:h,end:d}of l){const{style:{backgroundColor:l=o}={}}=e,u=!0!==i;t.save(),t.fillStyle=l,yo(t,a,r,u&&oo(n,h,d)),t.beginPath();const p=!!s.pathSegment(t,e);let g;if(u){p?t.closePath():xo(t,i,d,n);const e=!!i.pathSegment(t,c,{move:p,reverse:!0});g=p&&e,g||xo(t,i,h,n)}t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}function yo(t,e,s,i){const n=e.chart.chartArea,{property:o,start:a,end:r}=i||{};if("x"===o||"y"===o){let e,i,l,c;"x"===o?(e=a,i=n.top,l=r,c=n.bottom):(e=n.left,i=a,l=n.right,c=r),t.beginPath(),s&&(e=Math.max(e,s.left),l=Math.min(l,s.right),i=Math.max(i,s.top),c=Math.min(c,s.bottom)),t.rect(e,i,l-e,c-i),t.clip()}}function xo(t,e,s,i){const n=e.interpolate(s,i);n&&t.lineTo(n.x,n.y)}var _o={id:"filler",afterDatasetsUpdate(t,e,s){const i=(t.data.datasets||[]).length,n=[];let o,a,r,l;for(a=0;a<i;++a)o=t.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof jn&&(l={visible:t.isDatasetVisible(a),index:a,fill:uo(r,a,i),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<i;++a)l=n[a],l&&!1!==l.fill&&(l.fill=ho(n,a,s.propagate))},beforeDraw(t,e,s){const i="beforeDraw"===s.drawTime,n=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let e=n.length-1;e>=0;--e){const s=n[e].$filler;s&&(s.line.updateControlPoints(o,s.axis),i&&s.fill&&mo(t.ctx,s,o))}},beforeDatasetsDraw(t,e,s){if("beforeDatasetsDraw"!==s.drawTime)return;const i=t.getSortedVisibleDatasetMetas();for(let e=i.length-1;e>=0;--e){const s=i[e].$filler;co(s)&&mo(t.ctx,s,t.chartArea)}},beforeDatasetDraw(t,e,s){const i=e.meta.$filler;co(i)&&"beforeDatasetDraw"===s.drawTime&&mo(t.ctx,i,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ko=(t,e)=>{let{boxHeight:s=e,boxWidth:i=e}=t;return t.usePointStyle&&(s=Math.min(s,e),i=t.pointStyleWidth||Math.min(i,e)),{boxWidth:i,boxHeight:s,itemHeight:Math.max(e,s)}};class Co extends Wi{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,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,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=G(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,s)=>t.sort(e,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const s=t.labels,i=ze(s.font),n=i.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=ko(s,n);let l,c;e.font=i.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(o,n,a,r)+10):(c=this.maxHeight,l=this._fitCols(o,i,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,i){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],c=i+a;let h=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-c;return this.legendItems.forEach((t,p)=>{const g=s+e/2+n.measureText(t.text).width;(0===p||l[l.length-1]+g+2*a>o)&&(h+=c,l[l.length-(p>0?0:1)]=0,u+=c,d++),r[p]={left:0,top:u,row:d,width:g,height:i},l[l.length-1]+=g+a}),h}_fitCols(t,e,s,i){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],c=o-t;let h=a,d=0,u=0,p=0,g=0;return this.legendItems.forEach((t,o)=>{const{itemWidth:f,itemHeight:m}=function(t,e,s,i,n){const o=function(t,e,s,i){let n=t.text;return n&&"string"!=typeof n&&(n=n.reduce((t,e)=>t.length>e.length?t:e)),e+s.size/2+i.measureText(n).width}(i,t,e,s),a=function(t,e,s){let i=t;return"string"!=typeof e.text&&(i=So(e,s)),i}(n,i,e.lineHeight);return{itemWidth:o,itemHeight:a}}(s,e,n,t,i);o>0&&u+m+2*a>c&&(h+=d+a,l.push({width:d,height:u}),p+=d+a,g++,d=u=0),r[o]={left:p,top:u,col:g,width:f,height:m},d=Math.max(d,f),u+=m+a}),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:i},rtl:n}}=this,o=ys(n,this.left,this.width);if(this.isHorizontal()){let n=0,a=Ut(s,this.left+i,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,a=Ut(s,this.left+i,this.right-this.lineWidths[n])),r.top+=this.top+t+i,r.left=o.leftForLtr(o.x(a),r.width),a+=r.width+i}else{let n=0,a=Ut(s,this.top+t+i,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,a=Ut(s,this.top+t+i,this.bottom-this.columnSizes[n].height)),r.top=a,r.left+=this.left+i,r.left=o.leftForLtr(o.x(r.left),r.width),a+=r.height+i}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;xe(t,this),this._draw(),_e(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:i}=this,{align:n,labels:o}=t,a=pe.color,r=ys(t.rtl,this.left,this.width),l=ze(o.font),{padding:c}=o,h=l.size,d=h/2;let u;this.drawTitle(),i.textAlign=r.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=l.string;const{boxWidth:p,boxHeight:g,itemHeight:f}=ko(o,h),m=this.isHorizontal(),b=this._computeTitleHeight();u=m?{x:Ut(n,this.left+c,this.right-s[0]),y:this.top+c+b,line:0}:{x:this.left+c,y:Ut(n,this.top+b+c,this.bottom-e[0].height),line:0},xs(this.ctx,t.textDirection);const w=f+c;this.legendItems.forEach((v,y)=>{i.strokeStyle=v.fontColor,i.fillStyle=v.fontColor;const x=i.measureText(v.text).width,_=r.textAlign(v.textAlign||(v.textAlign=o.textAlign)),k=p+d+x;let C=u.x,S=u.y;if(r.setWidth(this.width),m?y>0&&C+k+c>this.right&&(S=u.y+=w,u.line++,C=u.x=Ut(n,this.left+c,this.right-s[u.line])):y>0&&S+w>this.bottom&&(C=u.x=C+e[u.line].width+c,u.line++,S=u.y=Ut(n,this.top+b+c,this.bottom-e[u.line].height)),function(t,e,s){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;i.save();const n=Z(s.lineWidth,1);if(i.fillStyle=Z(s.fillStyle,a),i.lineCap=Z(s.lineCap,"butt"),i.lineDashOffset=Z(s.lineDashOffset,0),i.lineJoin=Z(s.lineJoin,"miter"),i.lineWidth=n,i.strokeStyle=Z(s.strokeStyle,a),i.setLineDash(Z(s.lineDash,[])),o.usePointStyle){const a={radius:g*Math.SQRT2/2,pointStyle:s.pointStyle,rotation:s.rotation,borderWidth:n},l=r.xPlus(t,p/2);ve(i,a,l,e+d,o.pointStyleWidth&&p)}else{const o=e+Math.max((h-g)/2,0),a=r.leftForLtr(t,p),l=Ie(s.borderRadius);i.beginPath(),Object.values(l).some(t=>0!==t)?Ae(i,{x:a,y:o,w:p,h:g,radius:l}):i.rect(a,o,p,g),i.fill(),0!==n&&i.stroke()}i.restore()}(r.x(C),S,v),C=((t,e,s,i)=>t===(i?"left":"right")?s:"center"===t?(e+s)/2:e)(_,C+p+d,m?C+k:this.right,t.rtl),function(t,e,s){Pe(i,s.text,t,e+f/2,l,{strikethrough:s.hidden,textAlign:r.textAlign(s.textAlign)})}(r.x(C),S,v),m)u.x+=k+c;else if("string"!=typeof v.text){const t=l.lineHeight;u.y+=So(v,t)+c}else u.y+=w}),_s(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=ze(e.font),i=Be(e.padding);if(!e.display)return;const n=ys(t.rtl,this.left,this.width),o=this.ctx,a=e.position,r=s.size/2,l=i.top+r;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=Ut(t.align,h,this.right-d);else{const e=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);c=l+Ut(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=Ut(a,h,h+d);o.textAlign=n.textAlign(qt(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=s.string,Pe(o,e.text,u,c,s)}_computeTitleHeight(){const t=this.options.title,e=ze(t.font),s=Be(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,i,n;if(Bt(t,this.left,this.right)&&Bt(e,this.top,this.bottom))for(n=this.legendHitBoxes,s=0;s<n.length;++s)if(i=n[s],Bt(t,i.left,i.left+i.width)&&Bt(e,i.top,i.top+i.height))return this.legendItems[s];return null}handleEvent(t){const e=this.options;if(!function(t,e){return!("mousemove"!==t&&"mouseout"!==t||!e.onHover&&!e.onLeave)||!(!e.onClick||"click"!==t&&"mouseup"!==t)}(t.type,e))return;const s=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const o=this._hoveredItem,a=(n=s,null!==(i=o)&&null!==n&&i.datasetIndex===n.datasetIndex&&i.index===n.index);o&&!a&&G(e.onLeave,[t,o,this],this),this._hoveredItem=s,s&&!a&&G(e.onHover,[t,s,this],this)}else s&&G(e.onClick,[t,s,this],this);var i,n}}function So(t,e){return e*(t.text?t.text.length:0)}var Mo={id:"legend",_element:Co,start(t,e,s){const i=t.legend=new Co({ctx:t.ctx,options:s,chart:t});Mi.configure(t,i,s),Mi.addBox(t,i)},stop(t){Mi.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,s){const i=t.legend;Mi.configure(t,i,s),i.options=s},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,s){const i=e.datasetIndex,n=s.chart;n.isDatasetVisible(i)?(n.hide(i),e.hidden=!0):(n.show(i),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:s,pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{const l=t.controller.getStyle(s?0:void 0),c=Be(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:i||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:a&&(r||l.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Po extends Wi{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 s=this.options;if(this.left=0,this.top=0,!s.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const i=U(s.text)?s.text.length:1;this._padding=Be(s.padding);const n=i*ze(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:s,bottom:i,right:n,options:o}=this,a=o.align;let r,l,c,h=0;return this.isHorizontal()?(l=Ut(a,s,n),c=e+t,r=n-s):("left"===o.position?(l=s+t,c=Ut(a,i,e),h=-.5*pt):(l=n-t,c=Ut(a,e,i),h=.5*pt),r=i-e),{titleX:l,titleY:c,maxWidth:r,rotation:h}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=ze(e.font),i=s.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:a,rotation:r}=this._drawArgs(i);Pe(t,e.text,0,0,s,{color:e.color,maxWidth:a,rotation:r,textAlign:qt(e.align),textBaseline:"middle",translation:[n,o]})}}var Ao={id:"title",_element:Po,start(t,e,s){!function(t,e){const s=new Po({ctx:t.ctx,options:e,chart:t});Mi.configure(t,s,e),Mi.addBox(t,s),t.titleBlock=s}(t,s)},stop(t){const e=t.titleBlock;Mi.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,s){const i=t.titleBlock;Mi.configure(t,i,s),i.options=s},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 Eo=new WeakMap;var To={id:"subtitle",start(t,e,s){const i=new Po({ctx:t.ctx,options:s,chart:t});Mi.configure(t,i,s),Mi.addBox(t,i),Eo.set(t,i)},stop(t){Mi.removeBox(t,Eo.get(t)),Eo.delete(t)},beforeUpdate(t,e,s){const i=Eo.get(t);Mi.configure(t,i,s),i.options=s},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Lo={average(t){if(!t.length)return!1;let e,s,i=new Set,n=0,o=0;for(e=0,s=t.length;e<s;++e){const s=t[e].element;if(s&&s.hasValue()){const t=s.tooltipPosition();i.add(t.x),n+=t.y,++o}}return 0!==o&&0!==i.size&&{x:[...i].reduce((t,e)=>t+e)/i.size,y:n/o}},nearest(t,e){if(!t.length)return!1;let s,i,n,o=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(s=0,i=t.length;s<i;++s){const i=t[s].element;if(i&&i.hasValue()){const t=Lt(e,i.getCenterPoint());t<r&&(r=t,n=i)}}if(n){const t=n.tooltipPosition();o=t.x,a=t.y}return{x:o,y:a}}};function Do(t,e){return e&&(U(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Oo(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Ro(t,e){const{element:s,datasetIndex:i,index:n}=e,o=t.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[i].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:s}}function Io(t,e){const s=t.chart.ctx,{body:i,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=ze(e.bodyFont),c=ze(e.titleFont),h=ze(e.footerFont),d=o.length,u=n.length,p=i.length,g=Be(e.padding);let f=g.height,m=0,b=i.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);b+=t.beforeBody.length+t.afterBody.length,d&&(f+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b&&(f+=p*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-p)*l.lineHeight+(b-1)*e.bodySpacing),u&&(f+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let w=0;const v=function(t){m=Math.max(m,s.measureText(t).width+w)};return s.save(),s.font=c.string,Q(t.title,v),s.font=l.string,Q(t.beforeBody.concat(t.afterBody),v),w=e.displayColors?a+2+e.boxPadding:0,Q(i,t=>{Q(t.before,v),Q(t.lines,v),Q(t.after,v)}),w=0,s.font=h.string,Q(t.footer,v),s.restore(),m+=g.width,{width:m,height:f}}function Bo(t,e,s,i){const{x:n,width:o}=s,{width:a,chartArea:{left:r,right:l}}=t;let c="center";return"center"===i?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),function(t,e,s,i){const{x:n,width:o}=i,a=s.caretSize+s.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(c,t,e,s)&&(c="center"),c}function zo(t,e,s){const i=s.yAlign||e.yAlign||function(t,e){const{y:s,height:i}=e;return s<i/2?"top":s>t.height-i/2?"bottom":"center"}(t,s);return{xAlign:s.xAlign||e.xAlign||Bo(t,e,s,i),yAlign:i}}function Fo(t,e,s,i){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=s,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=Ie(a);let g=function(t,e){let{x:s,width:i}=t;return"right"===e?s-=i:"center"===e&&(s-=i/2),s}(e,r);const f=function(t,e,s){let{y:i,height:n}=t;return"top"===e?i+=s:i-="bottom"===e?n+s:n/2,i}(e,l,c);return"center"===l?"left"===r?g+=c:"right"===r&&(g-=c):"left"===r?g-=Math.max(h,u)+n:"right"===r&&(g+=Math.max(d,p)+n),{x:It(g,0,i.width-e.width),y:It(f,0,i.height-e.height)}}function $o(t,e,s){const i=Be(s.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.right:t.x+i.left}function Vo(t){return Do([],Oo(t))}function Ho(t,e){const s=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return s?t.override(s):t}const jo={beforeTitle:N,title(t){if(t.length>0){const e=t[0],s=e.chart.data.labels,i=s?s.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex<i)return s[e.dataIndex]}return""},afterTitle:N,beforeBody:N,beforeLabel:N,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const s=t.formattedValue;return q(s)||(e+=s),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.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(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:N,afterBody:N,beforeFooter:N,footer:N,afterFooter:N};function No(t,e,s,i){const n=t[e].call(s,i);return void 0===n?jo[e].call(s,i):n}class Wo extends Wi{static positioners=Lo;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,s=this.options.setContext(this.getContext()),i=s.enabled&&e.options.animation&&s.animations,n=new Bs(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=$e(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"}))}getTitle(t,e){const{callbacks:s}=e,i=No(s,"beforeTitle",this,t),n=No(s,"title",this,t),o=No(s,"afterTitle",this,t);let a=[];return a=Do(a,Oo(i)),a=Do(a,Oo(n)),a=Do(a,Oo(o)),a}getBeforeBody(t,e){return Vo(No(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,i=[];return Q(t,t=>{const e={before:[],lines:[],after:[]},n=Ho(s,t);Do(e.before,Oo(No(n,"beforeLabel",this,t))),Do(e.lines,No(n,"label",this,t)),Do(e.after,Oo(No(n,"afterLabel",this,t))),i.push(e)}),i}getAfterBody(t,e){return Vo(No(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,i=No(s,"beforeFooter",this,t),n=No(s,"footer",this,t),o=No(s,"afterFooter",this,t);let a=[];return a=Do(a,Oo(i)),a=Do(a,Oo(n)),a=Do(a,Oo(o)),a}_createItems(t){const e=this._active,s=this.chart.data,i=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;a<r;++a)l.push(Ro(this.chart,e[a]));return t.filter&&(l=l.filter((e,i,n)=>t.filter(e,i,n,s))),t.itemSort&&(l=l.sort((e,i)=>t.itemSort(e,i,s))),Q(l,e=>{const s=Ho(t.callbacks,e);i.push(No(s,"labelColor",this,e)),n.push(No(s,"labelPointStyle",this,e)),o.push(No(s,"labelTextColor",this,e))}),this.labelColors=i,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const s=this.options.setContext(this.getContext()),i=this._active;let n,o=[];if(i.length){const t=Lo[s.position].call(this,i,this._eventPosition);o=this._createItems(s),this.title=this.getTitle(o,s),this.beforeBody=this.getBeforeBody(o,s),this.body=this.getBody(o,s),this.afterBody=this.getAfterBody(o,s),this.footer=this.getFooter(o,s);const e=this._size=Io(this,s),a=Object.assign({},t,e),r=zo(this.chart,s,a),l=Fo(s,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,i){const n=this.getCaretPosition(t,s,i);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,s){const{xAlign:i,yAlign:n}=this,{caretSize:o,cornerRadius:a}=s,{topLeft:r,topRight:l,bottomLeft:c,bottomRight:h}=Ie(a),{x:d,y:u}=t,{width:p,height:g}=e;let f,m,b,w,v,y;return"center"===n?(v=u+g/2,"left"===i?(f=d,m=f-o,w=v+o,y=v-o):(f=d+p,m=f+o,w=v-o,y=v+o),b=f):(m="left"===i?d+Math.max(r,c)+o:"right"===i?d+p-Math.max(l,h)-o:this.caretX,"top"===n?(w=u,v=w-o,f=m-o,b=m+o):(w=u+g,v=w+o,f=m+o,b=m-o),y=w),{x1:f,x2:m,x3:b,y1:w,y2:v,y3:y}}drawTitle(t,e,s){const i=this.title,n=i.length;let o,a,r;if(n){const l=ys(s.rtl,this.x,this.width);for(t.x=$o(this,s.titleAlign,s),e.textAlign=l.textAlign(s.titleAlign),e.textBaseline="middle",o=ze(s.titleFont),a=s.titleSpacing,e.fillStyle=s.titleColor,e.font=o.string,r=0;r<n;++r)e.fillText(i[r],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,r+1===n&&(t.y+=s.titleMarginBottom-a)}}_drawColorBox(t,e,s,i,n){const o=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:r,boxWidth:l}=n,c=ze(n.bodyFont),h=$o(this,"left",n),d=i.x(h),u=r<c.lineHeight?(c.lineHeight-r)/2:0,p=e.y+u;if(n.usePointStyle){const e={radius:Math.min(l,r)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},s=i.leftForLtr(d,l)+l/2,c=p+r/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,we(t,e,s,c),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,we(t,e,s,c)}else{t.lineWidth=Y(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const e=i.leftForLtr(d,l),s=i.leftForLtr(i.xPlus(d,1),l-2),a=Ie(o.borderRadius);Object.values(a).some(t=>0!==t)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,Ae(t,{x:e,y:p,w:l,h:r,radius:a}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Ae(t,{x:s,y:p+1,w:l-2,h:r-2,radius:a}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,p,l,r),t.strokeRect(e,p,l,r),t.fillStyle=o.backgroundColor,t.fillRect(s,p+1,l-2,r-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:i}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:c}=s,h=ze(s.bodyFont);let d=h.lineHeight,u=0;const p=ys(s.rtl,this.x,this.width),g=function(s){e.fillText(s,p.x(t.x+u),t.y+d/2),t.y+=d+n},f=p.textAlign(o);let m,b,w,v,y,x,_;for(e.textAlign=o,e.textBaseline="middle",e.font=h.string,t.x=$o(this,f,s),e.fillStyle=s.bodyColor,Q(this.beforeBody,g),u=a&&"right"!==f?"center"===o?l/2+c:l+2+c:0,v=0,x=i.length;v<x;++v){for(m=i[v],b=this.labelTextColors[v],e.fillStyle=b,Q(m.before,g),w=m.lines,a&&w.length&&(this._drawColorBox(e,t,v,p,s),d=Math.max(h.lineHeight,r)),y=0,_=w.length;y<_;++y)g(w[y]),d=h.lineHeight;Q(m.after,g)}u=0,d=h.lineHeight,Q(this.afterBody,g),t.y-=n}drawFooter(t,e,s){const i=this.footer,n=i.length;let o,a;if(n){const r=ys(s.rtl,this.x,this.width);for(t.x=$o(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=r.textAlign(s.footerAlign),e.textBaseline="middle",o=ze(s.footerFont),e.fillStyle=s.footerColor,e.font=o.string,a=0;a<n;++a)e.fillText(i[a],r.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+s.footerSpacing}}drawBackground(t,e,s,i){const{xAlign:n,yAlign:o}=this,{x:a,y:r}=t,{width:l,height:c}=s,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=Ie(i.cornerRadius);e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,e.lineWidth=i.borderWidth,e.beginPath(),e.moveTo(a+h,r),"top"===o&&this.drawCaret(t,e,s,i),e.lineTo(a+l-d,r),e.quadraticCurveTo(a+l,r,a+l,r+d),"center"===o&&"right"===n&&this.drawCaret(t,e,s,i),e.lineTo(a+l,r+c-p),e.quadraticCurveTo(a+l,r+c,a+l-p,r+c),"bottom"===o&&this.drawCaret(t,e,s,i),e.lineTo(a+u,r+c),e.quadraticCurveTo(a,r+c,a,r+c-u),"center"===o&&"left"===n&&this.drawCaret(t,e,s,i),e.lineTo(a,r+h),e.quadraticCurveTo(a,r,a+h,r),e.closePath(),e.fill(),i.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,i=s&&s.x,n=s&&s.y;if(i||n){const s=Lo[t.position].call(this,this._active,this._eventPosition);if(!s)return;const o=this._size=Io(this,t),a=Object.assign({},s,this._size),r=zo(e,t,a),l=Fo(t,a,r,e);i._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const i={width:this.width,height:this.height},n={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const o=Be(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(n,t,i,e),xs(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),_s(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,i=t.map(({datasetIndex:t,index:e})=>{const s=this.chart.getDatasetMeta(t);if(!s)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:s.data[e],index:e}}),n=!tt(s,i),o=this._positionChanged(i,e);(n||o)&&(this._active=i,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,s),a=this._positionChanged(o,t),r=e||!tt(o,n)||a;return r&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,s,i){const n=this.options;if("mouseout"===t.type)return[];if(!i)return e.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));const o=this.chart.getElementsAtEventForMode(t,n.mode,n,s);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:s,caretY:i,options:n}=this,o=Lo[n.position].call(this,t,e);return!1!==o&&(s!==o.x||i!==o.y)}}var qo={id:"tooltip",_element:Wo,positioners:Lo,afterInit(t,e,s){s&&(t.tooltip=new Wo({chart:t,options:s}))},beforeUpdate(t,e,s){t.tooltip&&t.tooltip.initialize(s)},reset(t,e,s){t.tooltip&&t.tooltip.initialize(s)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const s={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...s,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",s)}},afterEvent(t,e){if(t.tooltip){const s=e.replay;t.tooltip.handleEvent(e.event,s,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:jo},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Uo=Object.freeze({__proto__:null,Colors:eo,Decimation:no,Filler:_o,Legend:Mo,SubTitle:To,Title:Ao,Tooltip:qo});function Yo(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function Xo(t,e,{horizontal:s,minRotation:i}){const n=Pt(i),o=(s?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}class Ko extends Qi{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 q(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:i,max:n}=this;const o=t=>i=e?i:t,a=t=>n=s?n:t;if(t){const t=_t(i),e=_t(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(i===n){let e=0===n?1:Math.abs(.05*n);a(n+e),t||o(i-e)}this.min=i,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:s,stepSize:i}=t;return i?(e=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),s=s||11),s&&(e=Math.min(s,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const i=function(t,e){const s=[],{bounds:i,step:n,min:o,max:a,precision:r,count:l,maxTicks:c,maxDigits:h,includeBounds:d}=t,u=n||1,p=c-1,{min:g,max:f}=e,m=!q(o),b=!q(a),w=!q(l),v=(f-g)/(h+1);let y,x,_,k,C=Ct((f-g)/p/u)*u;if(C<1e-14&&!m&&!b)return[{value:g},{value:f}];k=Math.ceil(f/C)-Math.floor(g/C),k>p&&(C=Ct(k*C/p/u)*u),q(r)||(y=Math.pow(10,r),C=Math.ceil(C*y)/y),"ticks"===i?(x=Math.floor(g/C)*C,_=Math.ceil(f/C)*C):(x=g,_=f),m&&b&&n&&function(t,e){const s=Math.round(t);return s-e<=t&&s+e>=t}((a-o)/n,C/1e3)?(k=Math.round(Math.min((a-o)/C,c)),C=(a-o)/k,x=o,_=a):w?(x=m?o:x,_=b?a:_,k=l-1,C=(_-x)/k):(k=(_-x)/C,k=kt(k,Math.round(k),C/1e3)?Math.round(k):Math.ceil(k));const S=Math.max(Et(C),Et(x));y=Math.pow(10,q(r)?S:r),x=Math.round(x*y)/y,_=Math.round(_*y)/y;let M=0;for(m&&(d&&x!==o?(s.push({value:o}),x<o&&M++,kt(Math.round((x+M*C)*y)/y,o,Xo(o,v,t))&&M++):x<o&&M++);M<k;++M){const t=Math.round((x+M*C)*y)/y;if(b&&t>a)break;s.push({value:t})}return b&&d&&_!==a?s.length&&kt(s[s.length-1].value,a,Xo(a,v,t))?s[s.length-1].value=a:s.push({value:a}):b&&_!==a||s.push({value:_}),s}({maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&Mt(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const i=(s-e)/Math.max(t.length-1,1)/2;e-=i,s+=i}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return oe(t,this.chart.options.locale,this.options.ticks.format)}}class Zo extends Ko{static id="linear";static defaults={ticks:{callback:re.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?t:0,this.max=X(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=Pt(this.options.ticks.minRotation),i=(t?Math.sin(s):Math.cos(s))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/i))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Jo=t=>Math.floor(xt(t)),Go=(t,e)=>Math.pow(10,Jo(t)+e);function Qo(t){return 1===t/Math.pow(10,Jo(t))}function ta(t,e,s){const i=Math.pow(10,s),n=Math.floor(t/i);return Math.ceil(e/i)-n}class ea extends Qi{static id="logarithmic";static defaults={ticks:{callback:re.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const s=Ko.prototype.parse.apply(this,[t,e]);if(0!==s)return X(s)&&s>0?s:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?Math.max(0,t):null,this.max=X(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!X(this._userMin)&&(this.min=t===Go(this.min,0)?Go(this.min,-1):Go(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let s=this.min,i=this.max;const n=e=>s=t?s:e,o=t=>i=e?i:t;s===i&&(s<=0?(n(1),o(10)):(n(Go(s,-1)),o(Go(i,1)))),s<=0&&n(Go(i,-1)),i<=0&&o(Go(s,1)),this.min=s,this.max=i}buildTicks(){const t=this.options,e=function(t,{min:e,max:s}){e=K(t.min,e);const i=[],n=Jo(e);let o=function(t,e){let s=Jo(e-t);for(;ta(t,e,s)>10;)s++;for(;ta(t,e,s)<10;)s--;return Math.min(s,Jo(t))}(e,s),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((e-l)*a)/a,h=Math.floor((e-l)/r/10)*r*10;let d=Math.floor((c-h)/Math.pow(10,o)),u=K(t.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<s;)i.push({value:u,major:Qo(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 p=K(t.max,u);return i.push({value:p,major:Qo(p),significand:d}),i}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&Mt(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":oe(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=xt(t),this._valueRange=xt(this.max)-xt(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(xt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function sa(t){const e=t.ticks;if(e.display&&t.display){const t=Be(e.backdropPadding);return Z(e.font&&e.font.size,pe.font.size)+t.height}return 0}function ia(t,e,s){return s=U(s)?s:[s],{w:fe(t,e.string,s),h:s.length*e.lineHeight}}function na(t,e,s,i,n){return t===i||t===n?{start:e-s/2,end:e+s/2}:t<i||t>n?{start:e-s,end:e}:{start:e,end:e+s}}function oa(t,e,s,i,n){const o=Math.abs(Math.sin(s)),a=Math.abs(Math.cos(s));let r=0,l=0;i.start<e.l?(r=(e.l-i.start)/o,t.l=Math.min(t.l,e.l-r)):i.end>e.r&&(r=(i.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.start<e.t?(l=(e.t-n.start)/a,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function aa(t,e,s){const i=t.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=s,l=t.getPointPosition(e,i+n+a,o),c=Math.round(At(Ot(l.angle+wt))),h=function(t,e,s){return 90===s||270===s?t-=e/2:(s>270||s<90)&&(t-=e),t}(l.y,r.h,c),d=function(t){return 0===t||180===t?"center":t<180?"left":"right"}(c),u=(p=l.x,g=r.w,"right"===(f=d)?p-=g:"center"===f&&(p-=g/2),p);var p,g,f;return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function ra(t,e){if(!e)return!0;const{left:s,top:i,right:n,bottom:o}=t;return!(ye({x:s,y:i},e)||ye({x:s,y:o},e)||ye({x:n,y:i},e)||ye({x:n,y:o},e))}function la(t,e,s){const{left:i,top:n,right:o,bottom:a}=s,{backdropColor:r}=e;if(!q(r)){const s=Ie(e.borderRadius),l=Be(e.backdropPadding);t.fillStyle=r;const c=i-l.left,h=n-l.top,d=o-i+l.width,u=a-n+l.height;Object.values(s).some(t=>0!==t)?(t.beginPath(),Ae(t,{x:c,y:h,w:d,h:u,radius:s}),t.fill()):t.fillRect(c,h,d,u)}}function ca(t,e,s,i){const{ctx:n}=t;if(s)n.arc(t.xCenter,t.yCenter,e,0,gt);else{let s=t.getPointPosition(0,e);n.moveTo(s.x,s.y);for(let o=1;o<i;o++)s=t.getPointPosition(o,e),n.lineTo(s.x,s.y)}}class ha extends Ko{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:re.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Be(sa(this.options)/2),e=this.width=this.maxWidth-t.width,s=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+s/2+t.top),this.drawingArea=Math.floor(Math.min(e,s)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=X(t)&&!isNaN(t)?t:0,this.max=X(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/sa(this.options))}generateTickLabels(t){Ko.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{const s=G(this.options.pointLabels.callback,[t,e],this);return s||0===s?s:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){const t=this.options;t.display&&t.pointLabels.display?function(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},s=Object.assign({},e),i=[],n=[],o=t._pointLabels.length,a=t.options.pointLabels,r=a.centerPointLabels?pt/o:0;for(let l=0;l<o;l++){const o=a.setContext(t.getPointLabelContext(l));n[l]=o.padding;const c=t.getPointPosition(l,t.drawingArea+n[l],r),h=ze(o.font),d=ia(t.ctx,h,t._pointLabels[l]);i[l]=d;const u=Ot(t.getIndexAngle(l)+r),p=Math.round(At(u));oa(s,e,u,na(p,c.x,d.w,0,180),na(p,c.y,d.h,90,270))}t.setCenterPoint(e.l-s.l,s.r-e.r,e.t-s.t,s.b-e.b),t._pointLabelItems=function(t,e,s){const i=[],n=t._pointLabels.length,o=t.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:sa(o)/2,additionalAngle:a?pt/n:0};let c;for(let o=0;o<n;o++){l.padding=s[o],l.size=e[o];const n=aa(t,o,l);i.push(n),"auto"===r&&(n.visible=ra(n,c),n.visible&&(c=n))}return i}(t,i,n)}(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,i){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,i))}getIndexAngle(t){return Ot(t*(gt/(this._pointLabels.length||1))+Pt(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(q(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(q(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 s=e[t];return function(t,e,s){return $e(t,{label:s,index:e,type:"pointLabel"})}(this.getContext(),t,s)}}getPointPosition(t,e,s=0){const i=this.getIndexAngle(t)-wt+s;return{x:Math.cos(i)*e+this.xCenter,y:Math.sin(i)*e+this.yCenter,angle:i}}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:s,right:i,bottom:n}=this._pointLabelItems[t];return{left:e,top:s,right:i,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const s=this.ctx;s.save(),s.beginPath(),ca(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),s.closePath(),s.fillStyle=t,s.fill(),s.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:s,grid:i,border:n}=e,o=this._pointLabels.length;let a,r,l;if(e.pointLabels.display&&function(t,e){const{ctx:s,options:{pointLabels:i}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const o=i.setContext(t.getPointLabelContext(n));la(s,o,e);const a=ze(o.font),{x:r,y:l,textAlign:c}=e;Pe(s,t._pointLabels[n],r,l+a.lineHeight/2,a,{color:o.color,textAlign:c,textBaseline:"middle"})}}(this,o),i.display&&this.ticks.forEach((t,e)=>{if(0!==e||0===e&&this.min<0){r=this.getDistanceFromCenterForValue(t.value);const s=this.getContext(e),a=i.setContext(s),l=n.setContext(s);!function(t,e,s,i,n){const o=t.ctx,a=e.circular,{color:r,lineWidth:l}=e;!a&&!i||!r||!l||s<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),ca(t,s,a,i),o.closePath(),o.stroke(),o.restore())}(this,a,r,o,l)}}),s.display){for(t.save(),a=o-1;a>=0;a--){const i=s.setContext(this.getPointLabelContext(a)),{color:n,lineWidth:o}=i;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(i.borderDash),t.lineDashOffset=i.borderDashOffset,r=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(a,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,s=e.ticks;if(!s.display)return;const i=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(i),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((i,a)=>{if(0===a&&this.min>=0&&!e.reverse)return;const r=s.setContext(this.getContext(a)),l=ze(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(i.label).width,t.fillStyle=r.backdropColor;const e=Be(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}Pe(t,i.label,0,-n,l,{color:r.color,strokeColor:r.textStrokeColor,strokeWidth:r.textStrokeWidth})}),t.restore()}drawTitle(){}}const da={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}},ua=Object.keys(da);function pa(t,e){return t-e}function ga(t,e){if(q(e))return null;const s=t._adapter,{parser:i,round:n,isoWeekday:o}=t._parseOpts;let a=e;return"function"==typeof i&&(a=i(a)),X(a)||(a="string"==typeof i?s.parse(a,i):s.parse(a)),null===a?null:(n&&(a="week"!==n||!St(o)&&!0!==o?s.startOf(a,n):s.startOf(a,"isoWeek",o)),+a)}function fa(t,e,s,i){const n=ua.length;for(let o=ua.indexOf(t);o<n-1;++o){const t=da[ua[o]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((s-e)/(n*t.size))<=i)return ua[o]}return ua[n-1]}function ma(t,e,s){if(s){if(s.length){const{lo:i,hi:n}=zt(s,e);t[s[i]>=e?s[i]:s[n]]=!0}}else t[e]=!0}function ba(t,e,s){const i=[],n={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],n[r]=a,i.push({value:r,major:!1});return 0!==o&&s?function(t,e,s,i){const n=t._adapter,o=+n.startOf(e[0].value,i),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,i))l=s[r],l>=0&&(e[l].major=!0);return e}(t,i,n,s):i}class wa extends Qi{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const s=t.time||(t.time={}),i=this._adapter=new li(t.adapters.date);i.init(e),ot(s.displayFormats,i.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:ga(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,s=t.time.unit||"day";let{min:i,max:n,minDefined:o,maxDefined:a}=this.getUserBounds();function r(t){o||isNaN(t.min)||(i=Math.min(i,t.min)),a||isNaN(t.max)||(n=Math.max(n,t.max))}o&&a||(r(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||r(this.getMinMax(!1))),i=X(i)&&!isNaN(i)?i:+e.startOf(Date.now(),s),n=X(n)&&!isNaN(n)?n:+e.endOf(Date.now(),s)+1,this.min=Math.min(i,n-1),this.max=Math.max(i+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],s=t[t.length-1]),{min:e,max:s}}buildTicks(){const t=this.options,e=t.time,s=t.ticks,i="labels"===s.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const n=this.min,o=function(t,e,s){let i=0,n=t.length;for(;i<n&&t[i]<e;)i++;for(;n>i&&t[n-1]>s;)n--;return i>0||n<t.length?t.slice(i,n):t}(i,n,this.max);return this._unit=e.unit||(s.autoSkip?fa(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,s,i,n){for(let o=ua.length-1;o>=ua.indexOf(s);o--){const s=ua[o];if(da[s].common&&t._adapter.diff(n,i,s)>=e-1)return s}return ua[s?ua.indexOf(s):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=s.major.enabled&&"year"!==this._unit?function(t){for(let e=ua.indexOf(t)+1,s=ua.length;e<s;++e)if(da[ua[e]].common)return ua[e]}(this._unit):void 0,this.initOffsets(i),t.reverse&&o.reverse(),ba(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e,s,i=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),i=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,s=this.getDecimalForValue(t[t.length-1]),n=1===t.length?s:(s-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;i=It(i,0,o),n=It(n,0,o),this._offsets={start:i,end:n,factor:1/(i+1+n)}}_generate(){const t=this._adapter,e=this.min,s=this.max,i=this.options,n=i.time,o=n.unit||fa(n.minUnit,e,s,this._getLabelCapacity(e)),a=Z(i.ticks.stepSize,1),r="week"===o&&n.isoWeekday,l=St(r)||!0===r,c={};let h,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",r)),u=+t.startOf(u,l?"day":o),t.diff(s,e,o)>1e5*a)throw new Error(e+" and "+s+" are too far apart with stepSize of "+a+" "+o);const p="data"===i.ticks.source&&this.getDataTimestamps();for(h=u,d=0;h<s;h=+t.add(h,a,o),d++)ma(c,h,p);return h!==s&&"ticks"!==i.bounds&&1!==d||ma(c,h,p),Object.keys(c).sort(pa).map(t=>+t)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,i=this._unit,n=e||s[i];return this._adapter.format(t,n)}_tickFormatFunction(t,e,s,i){const n=this.options,o=n.ticks.callback;if(o)return G(o,[t,e,s],this);const a=n.time.displayFormats,r=this._unit,l=this._majorUnit,c=r&&a[r],h=l&&a[l],d=s[e],u=l&&h&&d&&d.major;return this._adapter.format(t,i||(u?h:c))}generateTickLabels(t){let e,s,i;for(e=0,s=t.length;e<s;++e)i=t[e],i.label=this._tickFormatFunction(i.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+s)*e.factor)}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,s=this.ctx.measureText(t).width,i=Pt(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(i),o=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:s*n+a*o,h:s*o+a*n}}_getLabelCapacity(t){const e=this.options.time,s=e.displayFormats,i=s[e.unit]||s.millisecond,n=this._tickFormatFunction(t,0,ba(this,[t],this._majorUnit),i),o=this._getLabelSize(n),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t,e,s=this._cache.data||[];if(s.length)return s;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(t=0,e=i.length;t<e;++t)s=s.concat(i[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(s)}getLabelTimestamps(){const t=this._cache.labels||[];let e,s;if(t.length)return t;const i=this.getLabels();for(e=0,s=i.length;e<s;++e)t.push(ga(this,i[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return jt(t.sort(pa))}}function va(t,e,s){let i,n,o,a,r=0,l=t.length-1;s?(e>=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=Ft(t,"pos",e)),({pos:i,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=Ft(t,"time",e)),({time:i,pos:o}=t[r]),({time:n,pos:a}=t[l]));const c=n-i;return c?o+(a-o)*(e-i)/c:o}var ya=Object.freeze({__proto__:null,CategoryScale:class extends Qi{static id="category";static defaults={ticks:{callback:Yo}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:s,label:i}of e)t[s]===i&&t.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(q(t))return null;const s=this.getLabels();return((t,e)=>null===t?null:It(Math.round(t),0,e))(e=isFinite(e)&&s[e]===t?e:function(t,e,s,i){const n=t.indexOf(e);return-1===n?((t,e,s,i)=>("string"==typeof e?(s=t.push(e)-1,i.unshift({index:s,label:e})):isNaN(e)&&(s=null),s))(t,e,s,i):n!==t.lastIndexOf(e)?s:n}(s,t,Z(e,t),this._addedLabels),s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:s,max:i}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(s=0),e||(i=this.getLabels().length-1)),this.min=s,this.max=i}buildTicks(){const t=this.min,e=this.max,s=this.options.offset,i=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let s=t;s<=e;s++)i.push({value:s});return i}getLabelForValue(t){return Yo.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?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}},LinearScale:Zo,LogarithmicScale:ea,RadialLinearScale:ha,TimeScale:wa,TimeSeriesScale:class extends wa{static id="timeseries";static defaults=wa.defaults;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=va(e,this.min),this._tableRange=va(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,i=[],n=[];let o,a,r,l,c;for(o=0,a=t.length;o<a;++o)l=t[o],l>=e&&l<=s&&i.push(l);if(i.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(o=0,a=i.length;o<a;++o)c=i[o+1],r=i[o-1],l=i[o],Math.round((c+r)/2)!==l&&n.push({time:l,pos:o/(a-1)});return n}_generate(){const t=this.min,e=this.max;let s=super.getDataTimestamps();return s.includes(t)&&s.length||s.splice(0,0,t),s.includes(e)&&1!==s.length||s.push(e),s.sort((t,e)=>t-e)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return t=e.length&&s.length?this.normalize(e.concat(s)):e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(va(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return va(this._table,s*this._tableRange+this._minPos,!0)}}});const xa=[oi,Kn,Uo,ya];Ln.register(...xa);const _a=Ln,ka=["#2271b1","#00a32a"],Ca="lp-stats-chart-empty",Sa=(t,e)=>{const s=t.parentElement;if(!s)return;let i=s.querySelector(`.${Ca}`);e&&!i&&(i=document.createElement("p"),i.className=Ca,i.textContent=d("noData","No data for this period."),s.appendChild(i)),i&&(i.style.display=e?"":"none"),t.style.display=e?"none":"block"},Ma=(t,e)=>new Intl.DateTimeFormat(void 0,e).format(t),Pa=(t,e={},s={})=>{var i;const n=document.querySelector(t);if(!n)return null;const{datasets:o=[],xLabel:a="",granularity:r=""}=e;let{labels:l=[]}=e;if(!(o.length>0&&o.some(t=>(t.data||[]).length>0))){const t=_a.getChart(n);return t&&t.destroy(),Sa(n,!0),null}Sa(n,!1);const c="function"==typeof s.formatLabel?s.formatLabel:((t,e=[])=>{switch(t){case"hour":return t=>`${t}h`;case"day":{const t=e.length<=7&&(t=>{const e=t.map(t=>String(t).slice(0,7));return e.every(t=>t===e[0])})(e)?{weekday:"short",day:"numeric"}:{month:"short",day:"numeric"},s=new Intl.DateTimeFormat(void 0,t);return t=>{const e=new Date(`${t}T00:00:00`);return isNaN(e.getTime())?String(t):s.format(e)}}case"month":{const t=new Intl.DateTimeFormat(void 0,{month:"short",year:"2-digit"});return e=>{const s=String(e).split("-"),i=parseInt(s[0],10);return 2===s.length&&i>=1&&i<=12?t.format(new Date(parseInt(s[1],10),i-1,1)):String(e)}}default:return null}})(r,l);c&&(l=l.map((t,e)=>c(t,e)));const d=o.length>1,u=null!==(i=s.yCurrency)&&void 0!==i?i:d,p=h().currencySymbol||"",g=o.map((t,e)=>{const s=t.color||ka[e%ka.length];return{label:t.label||"",data:t.data||[],borderColor:s,backgroundColor:s,borderWidth:2,yAxisID:t.yAxisID||(d&&e>0?"y1":"y")}}),f={y:{min:0,position:"left",ticks:u?{callback:t=>p+t}:{}},x:{title:{display:!!a,text:a,align:"end"}}};d&&(f.y1={min:0,position:"right",grid:{drawOnChartArea:!1},ticks:{precision:0}});const m=_a.getChart(n);if(m){if(m.data.datasets.length===g.length)return m.data.labels=l,g.forEach((t,e)=>{m.data.datasets[e].data=t.data,m.data.datasets[e].label=t.label}),m.config.options.scales.x.title.text=a,m.update(),m;m.destroy()}return new _a(n,{type:"line",data:{labels:l,datasets:g},options:{responsive:!0,maintainAspectRatio:!1,aspectRatio:.8,plugins:{legend:{display:d}},scales:f}})};class Aa{static selectors={elContainer:".lp-statistics-filter-bar",elDaterange:".lp-stats-daterange",elToggle:".lp-stats-daterange__toggle",elToggleLabel:".lp-stats-daterange__label",elPanel:".lp-stats-daterange__panel",elTab:".lp-stats-daterange__tab",elTabpanel:".lp-stats-daterange__tabpanel",elPresetRadio:'input[name="lp-stats-preset"]',elCompareRadio:'input[name="lp-stats-compare"]',elCustomFrom:".lp-stats-daterange__from",elCustomTo:".lp-stats-daterange__to",elBtnUpdate:".lp-stats-daterange__update",elSelectInstructor:".lp-stats-filter-instructor",elSelectCategory:".lp-stats-filter-category",elBtnExport:".lp-stats-export-csv"};init(){this.elContainer=document.querySelector(Aa.selectors.elContainer),this.elContainer&&(this.loadFilterOptions(),this.events())}events(){Aa._loadedEvents||(Aa._loadedEvents=this,n("click",[{selector:Aa.selectors.elToggle,class:this,callBack:this.togglePanel.name},{selector:Aa.selectors.elTab,class:this,callBack:this.switchTab.name},{selector:Aa.selectors.elPresetRadio,class:this,callBack:this.changePreset.name},{selector:Aa.selectors.elBtnUpdate,class:this,callBack:this.applyCustomRange.name},{selector:Aa.selectors.elBtnExport,class:this,callBack:this.exportCsv.name}]),n("keydown",[{selector:Aa.selectors.elPresetRadio,class:this,callBack:this.changePreset.name,conditionBeforeCallBack:t=>"Enter"===t.e.key||" "===t.e.key}]),n("change",[{selector:Aa.selectors.elCompareRadio,class:this,callBack:this.changeCompare.name},{selector:Aa.selectors.elSelectInstructor,class:this,callBack:this.changeScope.name},{selector:Aa.selectors.elSelectCategory,class:this,callBack:this.changeScope.name}]),document.addEventListener("click",t=>{this.isPanelOpen()&&!t.target.closest(Aa.selectors.elDaterange)&&this.closePanel()}),document.addEventListener("keydown",t=>{"Escape"===t.key&&this.isPanelOpen()&&this.closePanel(!0)}),document.addEventListener(o,t=>{this.setToggleLabel(this.labelForState(t.detail))}),document.addEventListener(r,t=>{this.setToggleLabel(t.detail?.label)}))}panel(){return this.elContainer.querySelector(Aa.selectors.elPanel)}isPanelOpen(){const t=this.panel();return!!t&&!t.hidden}togglePanel(t){const e=t.target.closest(Aa.selectors.elToggle);if(!e||!this.elContainer.contains(e))return;const s=this.panel();if(!s)return;if(!s.hidden)return void this.closePanel();s.hidden=!1,e.setAttribute("aria-expanded","true");const i=s.querySelector(`${Aa.selectors.elPresetRadio}:checked`),n=s.querySelector(`${Aa.selectors.elTab}.active`);(i&&i.offsetParent?i:n)?.focus()}closePanel(t=!1){const e=this.panel();if(!e)return;e.hidden=!0;const s=this.elContainer.querySelector(Aa.selectors.elToggle);s?.setAttribute("aria-expanded","false"),t&&s?.focus()}switchTab(t){const e=t.target.closest(Aa.selectors.elTab);if(!e||!this.elContainer.contains(e))return;const s=e.dataset.tab;this.elContainer.querySelectorAll(Aa.selectors.elTab).forEach(t=>{const s=t===e;t.classList.toggle("active",s),t.setAttribute("aria-selected",s?"true":"false")}),this.elContainer.querySelectorAll(Aa.selectors.elTabpanel).forEach(t=>{t.hidden=t.dataset.tabpanel!==s})}changePreset(t){const e=t.target.closest(Aa.selectors.elPresetRadio);e&&this.elContainer.contains(e)&&("click"!==t.e.type||t.e.detail)&&(this.closePanel(!0),c.set({filtertype:e.value,date:""}))}changeCompare(t){const e=t.target.closest(Aa.selectors.elCompareRadio);e&&this.elContainer.contains(e)&&c.set({compare:e.value})}applyCustomRange(t){const e=t.target.closest(Aa.selectors.elBtnUpdate);if(!e||!this.elContainer.contains(e))return;const s=this.elContainer.querySelector(Aa.selectors.elCustomFrom)?.value,i=this.elContainer.querySelector(Aa.selectors.elCustomTo)?.value;if(!s||!i)return;this.elContainer.querySelectorAll(Aa.selectors.elPresetRadio).forEach(t=>{t.checked=!1});const[n,o]=[s,i].sort();this.closePanel(!0),c.set({filtertype:"custom",date:`${n}+${o}`})}setToggleLabel(t){const e=this.elContainer.querySelector(Aa.selectors.elToggleLabel);e&&t&&(e.textContent=t)}labelForState({filtertype:t,date:e}={}){if("custom"===t&&e){const[t,s]=e.split("+");if(t&&s)return`${d("custom","Custom")} (${this.customRangeLabel(t,s)})`}return this.presetLabel(t)}presetLabel(t){const{presets:e=[]}=h().dateRange||{},s=e.find(e=>e.value===t);return s?s.rangeLabel?`${s.name} (${s.rangeLabel})`:s.name:t}customRangeLabel(t,e){const s=new Date(`${t}T00:00:00`),i=new Date(`${e}T00:00:00`);if(isNaN(s.getTime())||isNaN(i.getTime()))return`${t} – ${e}`;const n=s.getFullYear()===i.getFullYear();if(n&&s.getMonth()===i.getMonth()){const n=Ma(s,{month:"short",day:"numeric"});return t===e?n:`${n} – ${Ma(i,{day:"numeric"})}`}if(n){const t={month:"short",day:"numeric"};return`${Ma(s,t)} – ${Ma(i,t)}`}const o={month:"short",day:"numeric",year:"numeric"};return`${Ma(s,o)} – ${Ma(i,o)}`}loadFilterOptions(){u("filter-options",{},{success:t=>{const{instructors:e=[],categories:s=[]}=t.data||{};this.fillSelect(Aa.selectors.elSelectInstructor,e,c.get().instructor_id),this.fillSelect(Aa.selectors.elSelectCategory,s,c.get().category_id)}})}fillSelect(t,e,s=0){const i=this.elContainer.querySelector(t);i&&(e.forEach(t=>{const e=document.createElement("option");e.value=t.id,e.textContent=t.name,i.appendChild(e)}),s&&(i.value=String(s),i.value!==String(s)&&(i.value="0")))}changeScope(t){const e=t.target.closest("select");if(!e||!this.elContainer.contains(e))return;const s=this.elContainer.querySelector(Aa.selectors.elSelectInstructor),i=this.elContainer.querySelector(Aa.selectors.elSelectCategory);c.set({instructor_id:parseInt(s?.value,10)||0,category_id:parseInt(i?.value,10)||0})}exportCsv(t){const e=t.target.closest(Aa.selectors.elBtnExport);e&&this.elContainer.contains(e)&&document.dispatchEvent(new CustomEvent(a))}}const Ea=new Aa;var Ta=s(8465),La=s.n(Ta);class Da{static selectors={template:"#lp-tmpl-stats-report-modal",elContainer:".lp-stats-report-modal",elSearch:".lp-stats-report-modal__search",elExport:".lp-stats-report-modal__export",elTarget:".lp-target"};constructor(){this.title="",this.tableId=""}init(){this.events()}events(){Da._loadedEvents||(Da._loadedEvents=this,this.debouncedSearch=((t,e=500)=>{let s;return i=>{clearTimeout(s),s=setTimeout(()=>t(i),e)}})(()=>this.applySearch(),400),n("click",[{selector:Da.selectors.elExport,class:this,callBack:this.exportCsv.name}]),n("input",[{selector:Da.selectors.elSearch,class:this,callBack:this.onSearchInput.name}]))}getAjaxHandle(){const t=window.lpAJAXG;return t&&"function"==typeof t.getDataSetCurrent&&"function"==typeof t.setDataSetCurrent&&"function"==typeof t.fetchAJAX&&"function"==typeof t.showHideLoading?t:null}getModalPopup(){return La().getPopup?La().getPopup():null}getModalContent(){const t=this.getModalPopup();return t?t.querySelector(Da.selectors.elContainer):null}getTarget(){const t=this.getModalContent();return t?t.querySelector(Da.selectors.elTarget):null}getModalHtml(){const t=document.querySelector(Da.selectors.template);return t?t.innerHTML:""}isOpen(){return!!this.getModalContent()}open(t={}){const e=this.getModalHtml();e&&t.report&&(this.init(),this.title=t.title||"",this.tableId=t.tableId||t.report,La().fire({title:this.title,html:e,width:"100%",customClass:{popup:"lp-stats-report-popup"},showConfirmButton:!1,showCloseButton:!0,didOpen:()=>this.loadReport(t)}))}close(){La().close()}loadReport(t){const e=this.getTarget(),s=this.getAjaxHandle();if(!e||!s)return void(e&&(e.innerHTML=d("loadError","Request failed.")));const i=s.getDataSetCurrent(e);i.args={...i.args||{},...c.get(),report:t.report,search:"",paged:1,...t.args||{}},t.orderStatus&&(i.args.order_status=t.orderStatus),s.setDataSetCurrent(e,i),this.reloadTarget(e,i)}onSearchInput(){this.debouncedSearch()}applySearch(){const t=this.getModalContent(),e=this.getTarget(),s=this.getAjaxHandle();if(!t||!e||!s)return;const i=t.querySelector(Da.selectors.elSearch),n=s.getDataSetCurrent(e);n.args=n.args||{},n.args.search=(i?.value||"").trim(),n.args.paged=1,s.setDataSetCurrent(e,n),this.reloadTarget(e,n)}reloadTarget(t,e){const s=this.getAjaxHandle();s&&(s.showHideLoading(t,1),s.fetchAJAX(e,{success:e=>{const{status:s,message:i,data:n}=e;t.innerHTML="success"===s?n.content||"":i||d("loadError","Request failed.")},error:t=>{console.error("LP Statistics report:",t)},completed:()=>s.showHideLoading(t,0)}))}exportCsv(t){const e=this.getModalContent(),s=this.getTarget(),n=this.getAjaxHandle();if(!e||!s||!n)return;const o=t?.target?.closest(Da.selectors.elExport);if(!o||o.classList.contains("loading"))return;const a=n.getDataSetCurrent(s),r={...a,args:{...a.args||{}},callback:{...a.callback||{},method:"render_report_csv"}};i(o,1),n.fetchAJAX(r,{success:t=>{const{status:e,data:s}=t;"success"===e&&s&&s.csv&&this.download(s.filename||"learnpress-report.csv",s.csv)},error:t=>{console.error("LP Statistics export:",t)},completed:()=>i(o,0)})}download(t,e){const s=new Blob(["\ufeff"+e],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(s),n=document.createElement("a");n.href=i,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(i)}}const Oa=new Da,Ra=(t,e={})=>{if(!t)return;const s=t.querySelector(".lp-kpi-value"),i=t.querySelector(".lp-kpi-delta"),n=t.querySelector(".lp-kpi-subline");if(s){var o;const t=null!==(o=e.formatted)&&void 0!==o?o:e.value;s.textContent=null==t||""===t?"–":String(t)}if(i)if(i.classList.remove("is-up","is-down"),"number"==typeof e.change_pct){const t=e.change_pct>=0;i.classList.add(t?"is-up":"is-down"),i.textContent=`${t?"▲":"▼"} ${Math.abs(e.change_pct)}%`}else i.textContent="";var a;n&&(n.textContent=null!==(a=e.subline)&&void 0!==a?a:"")},Ia=(t,e=[],s=[],i={})=>{if(!t)return{columns:e,rows:s};t.textContent="";const n=document.createElement("div");n.className="lp-table-wrap";const o=document.createElement("table");o.className="lp-list-table lp-stats-table";const a=document.createElement("thead"),r=document.createElement("tr");e.forEach(t=>{var e;const s=document.createElement("th");s.textContent=null!==(e=t.label)&&void 0!==e?e:"",r.appendChild(s)}),a.appendChild(r),o.appendChild(a);const l=document.createElement("tbody");if(s.length)s.forEach(t=>{const s=document.createElement("tr");e.forEach(e=>{const i=document.createElement("td"),n=t[e.key],o="function"==typeof e.format?e.format(n,t):n;let a;a=o instanceof Node?o:document.createTextNode(null==o?"":String(o));const r="function"==typeof e.badge?e.badge(t):"";if(r){const t=document.createElement("span");t.className=`lp-badge lp-badge--${r}`,t.appendChild(a),i.appendChild(t)}else i.appendChild(a);s.appendChild(i)}),l.appendChild(s)});else{const t=document.createElement("tr"),s=document.createElement("td");s.colSpan=e.length||1,s.className="lp-stats-table__empty",s.textContent=i.emptyText||d("noData","No data for this period."),t.appendChild(s),l.appendChild(t)}return o.appendChild(l),n.appendChild(o),t.appendChild(n),{columns:e,rows:s}},Ba=t=>String(null!=t?t:"").toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"")||"data",za=(t,e)=>{const{filtertype:s}=c.get();return`learnpress-${Ba(t)}-${Ba(e)}-${Ba(s)}.csv`},Fa=t=>{let e=null==t?"":String(t);return/^[=+\-@]/.test(e)&&(e=`'${e}`),/[",\n\r]/.test(e)&&(e=`"${e.replace(/"/g,'""')}"`),e},$a=(t,e=[],s=[])=>{if(!e.length)return;const i=[e.map(t=>Fa(t.label)).join(",")];s.forEach(t=>{i.push(e.map(e=>{const s="function"==typeof e.csv?e.csv(t):t[e.key];return Fa(s)}).join(","))});const n=new Blob(["\ufeff"+i.join("\r\n")],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(n),a=document.createElement("a");a.href=o,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)},Va=(t,e)=>String(t).replace(/%[ds]/,String(e)).replace(/%%/g,"%");class Ha{static selectors={elContainer:".lp-stats-tab-overview",elChartCanvas:"#net-sales-chart-content",elFunnelStep:".lp-stats-funnel__step",elTableTopCourses:".lp-stats-table-top-courses",elTableInstructors:".lp-stats-table-instructors",elBtnViewAllCourses:".lp-stats-view-all-courses",elOrderHealthBox:".lp-stats-order-health .lp-stats-health-box",elHealthCheckCount:".lp-stats-health-check__count",elSkeleton:".lp-skeleton-animation"};static kpiCards={net_sales:".lp-kpi-net-sales",completed_orders:".lp-kpi-completed-orders",enrollments:".lp-kpi-enrollments",completion_rate:".lp-kpi-completion-rate",active_learners:".lp-kpi-active-learners",failed_orders:".lp-kpi-failed-orders"};constructor(){this.elContainer=null,this.isRequesting=!1,this.pendingReload=!1,this.tables={}}init(){this.elContainer=document.querySelector(Ha.selectors.elContainer),this.elContainer&&(this.events(),this.loadData())}events(){Ha._loadedEvents||(Ha._loadedEvents=this,n("click",[{selector:Ha.selectors.elBtnViewAllCourses,class:this,callBack:this.viewAllCourses.name}]),document.addEventListener(o,()=>this.loadData()),document.addEventListener(a,()=>this.exportTables()))}toggleSkeletons(t){this.elContainer.querySelectorAll(Ha.selectors.elSkeleton).forEach(e=>{e.style.display=t?"block":"none"})}loadData(){this.isRequesting?this.pendingReload=!0:(this.isRequesting=!0,u("overviews-statistics",{},{before:()=>this.toggleSkeletons(!0),success:t=>this.render(t.data?.dashboard),error:t=>{console.error("LP Statistics overview:",t),this.render(null)},completed:()=>{this.toggleSkeletons(!1),this.isRequesting=!1,this.pendingReload&&(this.pendingReload=!1,this.loadData())}}))}render(t){t||(console.error("LP Statistics overview: dashboard payload missing."),t={}),this.renderKpis(t.kpis||{}),this.renderChart(t.chart||{}),this.renderFunnel(t.funnel||{}),this.renderTables(t),this.renderOrderHealth(t.order_health||{}),this.renderHealthChecks(t.health_checks||{})}renderKpis(t){const e=(t,e)=>d(t,e);Object.entries(Ha.kpiCards).forEach(([s,i])=>{const n=this.elContainer.querySelector(i),o={...t[s]||{}};var a;"completed_orders"===s&&o.aov_formatted&&(o.subline=Va(e("aov","Avg. order value: %s"),o.aov_formatted)),"completion_rate"===s&&("number"==typeof o.value&&(o.formatted=`${o.value}%`),o.subline=Va(e("belowTarget","%d below completion target"),null!==(a=o.courses_below_target)&&void 0!==a?a:0)),"failed_orders"===s&&null!=o.fail_rate_pct&&(o.subline=Va(e("failRate","%s%% of all orders"),o.fail_rate_pct)),Ra(n,o)})}renderChart(t){Pa(Ha.selectors.elChartCanvas,{labels:t.labels||[],datasets:[{label:d("revenue","Revenue"),data:t.revenue||[],yAxisID:"y"},{label:d("enrollments","Enrollments"),data:t.enrollments||[],yAxisID:"y1"}],xLabel:t.x_label||"",granularity:t.granularity||""})}renderFunnel(t){let e=null;["registered","enrolled","started","completed"].forEach(s=>{var i;const n=this.elContainer.querySelector(`${Ha.selectors.elFunnelStep}[data-step="${s}"]`);if(!n)return;const o=Number(null!==(i=t[s])&&void 0!==i?i:0),a=null===e?o:e,r=a>0?Math.min(100,o/a*100):0;n.querySelector(".lp-stats-funnel__count").textContent=String(o),n.querySelector(".lp-stats-funnel__bar").style.width=`${r}%`,e=o})}completionBadge(t){var e,s;if(null==t)return"";const{completionBadge:i={}}=h(),n=null!==(e=i.green)&&void 0!==e?e:60,o=null!==(s=i.yellow)&&void 0!==s?s:40;return t>=n?"green":t>=o?"yellow":"red"}topCoursesColumns(){return[{key:"course_name",label:d("course","Course")},{key:"revenue_formatted",label:d("revenue","Revenue"),csv:t=>t.revenue},{key:"order_count",label:d("orders","Orders")},{key:"enrolled",label:d("enrolled","Enrolled")},{key:"completion_rate",label:d("completion","Completion"),format:t=>null==t?"–":`${t}%`,badge:t=>this.completionBadge(t.completion_rate)}]}instructorColumns(){return[{key:"instructor_name",label:d("instructor","Instructor")},{key:"course_count",label:d("courses","Courses")},{key:"revenue_formatted",label:d("revenue","Revenue"),csv:t=>t.revenue},{key:"enrolled",label:d("enrolled","Enrolled")},{key:"completion_rate",label:d("completion","Completion"),format:t=>null==t?"–":`${t}%`,badge:t=>this.completionBadge(t.completion_rate)}]}renderTables(t){this.tables["top-courses"]=Ia(this.elContainer.querySelector(Ha.selectors.elTableTopCourses),this.topCoursesColumns(),t.top_courses||[]),this.tables.instructors=Ia(this.elContainer.querySelector(Ha.selectors.elTableInstructors),this.instructorColumns(),t.instructor_summary||[])}renderOrderHealth(t){this.elContainer.querySelectorAll(Ha.selectors.elOrderHealthBox).forEach(e=>{const s=e.dataset.status,i=e.querySelector(".lp-stats-health-box__count");var n;i&&(i.textContent=String(null!==(n=t[s])&&void 0!==n?n:0))})}renderHealthChecks(t){this.elContainer.querySelectorAll(Ha.selectors.elHealthCheckCount).forEach(e=>{var s;const i=e.dataset.check;e.textContent=String(null!==(s=t[i])&&void 0!==s?s:0)})}viewAllCourses(t){const e=t.target.closest(Ha.selectors.elBtnViewAllCourses);e&&this.elContainer.contains(e)&&Oa.open({report:"top_courses",title:d("topCourses","Top courses"),tableId:"top-courses"})}exportTables(){Object.entries(this.tables).forEach(([t,e])=>{e&&e.rows.length&&$a(za("overview",t),e.columns,e.rows)})}}const ja=new Ha,Na=(t,e)=>String(t).replace(/%[ds]/,String(e)).replace(/%%/g,"%");class Wa{static selectors={elContainer:".lp-stats-tab-orders",elChartCanvas:"#orders-chart-content",elTableTopSold:".lp-stats-table-top-sold-courses",elTableExceptions:".lp-stats-table-order-exceptions",elBtnViewAllTopSold:".lp-stats-view-all-top-sold",elBtnViewAllExceptions:".lp-stats-view-all-exceptions",elPaymentHealthRow:".lp-stats-payment-health__row",elSkeleton:".lp-skeleton-animation"};static kpiCards={net_sales:".lp-kpi-net-sales",completed_orders:".lp-kpi-completed-orders",processing:".lp-kpi-processing",pending:".lp-kpi-pending",cancelled_failed:".lp-kpi-cancelled-failed",paid_courses_sold:".lp-kpi-paid-courses-sold"};static orderStatusAllowlist=["completed","processing","pending","cancelled","failed"];constructor(){this.elContainer=null,this.isRequesting=!1,this.pendingReload=!1,this.tables={},this.orderStatusFilter=""}init(){this.elContainer=document.querySelector(Wa.selectors.elContainer),this.elContainer&&(this.orderStatusFilter=this.readOrderStatus(),this.events(),this.loadData())}events(){Wa._loadedEvents||(Wa._loadedEvents=this,n("click",[{selector:Wa.selectors.elBtnViewAllTopSold,class:this,callBack:this.viewAllTopSold.name},{selector:Wa.selectors.elBtnViewAllExceptions,class:this,callBack:this.viewAllExceptions.name}]),document.addEventListener(o,()=>this.loadData()),document.addEventListener(a,()=>this.exportTables()))}readOrderStatus(){const t=new URL(window.location.href).searchParams.get("order_status");return Wa.orderStatusAllowlist.includes(t)?t:""}toggleSkeletons(t){this.elContainer.querySelectorAll(Wa.selectors.elSkeleton).forEach(e=>{e.style.display=t?"block":"none"})}loadData(){this.isRequesting?this.pendingReload=!0:(this.isRequesting=!0,u("order-statistics",{},{before:()=>this.toggleSkeletons(!0),success:t=>this.render(t.data),error:t=>{console.error("LP Statistics orders:",t),this.render(null)},completed:()=>{this.toggleSkeletons(!1),this.isRequesting=!1,this.pendingReload&&(this.pendingReload=!1,this.loadData())}}))}render(t){t?.dashboard||(console.error("LP Statistics orders: dashboard payload missing."),t={chart_data:{},dashboard:{}});const e=t.dashboard||{};this.renderKpis(e.kpis||{}),this.renderChart(t.chart_data||{}),this.renderPaymentHealth(e.order_health||{}),this.renderTables(e),this.highlightStatus()}renderKpis(t){Object.entries(Wa.kpiCards).forEach(([e,s])=>{const i=this.elContainer.querySelector(s),n={...t[e]||{}};"completed_orders"===e&&n.aov_formatted&&(n.subline=Na(d("aov","Avg. order value: %s"),n.aov_formatted)),"processing"===e&&(n.subline=d("needsFulfillmentReview","Needs fulfillment review")),"pending"===e&&(n.subline=d("awaitingPayment","Awaiting payment")),"cancelled_failed"===e&&null!=n.rate_pct&&(n.subline=Na(d("exceptionRate","%s%% of all orders"),n.rate_pct)),Ra(i,n)})}renderPaymentHealth(t){this.elContainer.querySelectorAll(Wa.selectors.elPaymentHealthRow).forEach(e=>{const s=e.dataset.status,i=e.querySelector(".lp-stats-payment-health__count");var n;i&&(i.textContent=String(null!==(n=t[s])&&void 0!==n?n:0))})}renderChart(t){Pa(Wa.selectors.elChartCanvas,{labels:t.labels||[],datasets:[{label:t.line_label||d("orders","Orders"),data:t.data||[],yAxisID:"y"}],xLabel:t.x_label||"",granularity:t.granularity||""},{yCurrency:!1})}statusLabel(t){return{healthy:d("healthy","Healthy"),watch_completion:d("watchCompletion","Watch completion"),high_failed_quizzes:d("highFailedQuizzes","High failed quizzes")}[t]||String(t||"")}statusBadge(t){return"high_failed_quizzes"===t?"red":"watch_completion"===t?"yellow":"green"}severityLabel(t){return{high:d("high","High"),medium:d("medium","Medium"),low:d("low","Low")}[t]||String(t||"")}severityBadge(t){return"high"===t?"red":"medium"===t?"yellow":"grey"}topSoldColumns(){return[{key:"name",label:d("course","Course")},{key:"revenue_formatted",label:d("revenue","Revenue"),csv:t=>t.revenue},{key:"orders",label:d("orders","Orders")},{key:"aov_formatted",label:d("aovShort","AOV"),csv:t=>t.aov},{key:"status_label",label:d("status","Status"),format:t=>this.statusLabel(t),badge:t=>this.statusBadge(t.status_label)}]}exceptionColumns(){return[{key:"order_id",label:d("orderId","Order ID"),format:(t,e)=>{if(!e.edit_link)return t;const s=document.createElement("a");return s.href=e.edit_link,s.textContent=`#${t}`,s},csv:t=>t.order_id},{key:"student",label:d("student","Student")},{key:"course",label:d("course","Course")},{key:"issue",label:d("issue","Issue")},{key:"date",label:d("date","Date")},{key:"severity",label:d("severity","Severity"),format:t=>this.severityLabel(t),badge:t=>this.severityBadge(t.severity)}]}filterExceptions(t=[]){return["cancelled","failed"].includes(this.orderStatusFilter)?t.filter(t=>t.status===this.orderStatusFilter):t}renderTables(t){this.tables["top-sold-courses"]=Ia(this.elContainer.querySelector(Wa.selectors.elTableTopSold),this.topSoldColumns(),t.top_sold_courses||[]);const e=this.filterExceptions(t.exceptions||[]),s=Ia(this.elContainer.querySelector(Wa.selectors.elTableExceptions),this.exceptionColumns(),e,{emptyText:d("noOrderExceptions","No failed or cancelled orders in this period.")});this.tables.exceptions={...s,rows:e,allRows:t.exceptions||[]}}highlightStatus(){Object.values(Wa.kpiCards).forEach(t=>{const e=this.elContainer.querySelector(t);e&&e.classList.remove("is-highlighted")});const t={completed:"completed_orders",processing:"processing",pending:"pending",cancelled:"cancelled_failed",failed:"cancelled_failed"}[this.orderStatusFilter],e=t?Wa.kpiCards[t]:"",s=e?this.elContainer.querySelector(e):null;s&&s.classList.add("is-highlighted")}viewAllTopSold(t){const e=t.target.closest(Wa.selectors.elBtnViewAllTopSold);e&&this.elContainer.contains(e)&&Oa.open({report:"top_sold_courses",title:d("topSoldCourses","Top sold courses"),tableId:"top-sold-courses"})}viewAllExceptions(t){const e=t.target.closest(Wa.selectors.elBtnViewAllExceptions);e&&this.elContainer.contains(e)&&Oa.open({report:"exceptions",title:d("orderExceptions","Recent order exceptions"),tableId:"exceptions",orderStatus:["cancelled","failed"].includes(this.orderStatusFilter)?this.orderStatusFilter:""})}exportTables(){Object.entries(this.tables).forEach(([t,e])=>{e&&e.rows.length&&$a(za("orders",t),e.columns,e.rows)})}}const qa=new Wa,Ua=(t,e)=>String(t).replace(/%[ds]/,String(e)).replace(/%%/g,"%");class Ya{static selectors={elContainer:".lp-stats-tab-courses",elChartCanvas:"#course-chart-content",elTablePerformance:".lp-stats-table-course-performance",elTableInventory:".lp-stats-table-content-inventory",elBtnViewAllPerformance:".lp-stats-view-all-performance",elPerformanceRow:".lp-stats-course-performance-row",elHealthCheckCount:".lp-stats-health-check__count",elSkeleton:".lp-skeleton-animation"};static kpiCards={published:".lp-kpi-published",pending_review:".lp-kpi-pending-review",future:".lp-kpi-future",enrollments:".lp-kpi-enrollments",avg_completion:".lp-kpi-avg-completion",courses_without_enrollment:".lp-kpi-courses-without-enrollment"};constructor(){this.elContainer=null,this.isRequesting=!1,this.pendingReload=!1,this.tables={}}init(){this.elContainer=document.querySelector(Ya.selectors.elContainer),this.elContainer&&(this.events(),this.loadData())}events(){Ya._loadedEvents||(Ya._loadedEvents=this,n("click",[{selector:Ya.selectors.elBtnViewAllPerformance,class:this,callBack:this.viewAllPerformance.name},{selector:Ya.selectors.elPerformanceRow,class:this,callBack:this.openCourseEdit.name}]),document.addEventListener(o,()=>this.loadData()),document.addEventListener(a,()=>this.exportTables()))}toggleSkeletons(t){this.elContainer.querySelectorAll(Ya.selectors.elSkeleton).forEach(e=>{e.style.display=t?"block":"none"})}loadData(){this.isRequesting?this.pendingReload=!0:(this.isRequesting=!0,u("course-statistics",{},{before:()=>this.toggleSkeletons(!0),success:t=>this.render(t.data),error:t=>{console.error("LP Statistics courses:",t),this.render(null)},completed:()=>{this.toggleSkeletons(!1),this.isRequesting=!1,this.pendingReload&&(this.pendingReload=!1,this.loadData())}}))}render(t){t?.dashboard||(console.error("LP Statistics courses: dashboard payload missing."),t={chart_data:{},dashboard:{}});const e=t.dashboard||{};this.renderKpis(e.kpis||{}),this.renderTables(e),this.renderChart(e.chart||t.chart_data||{}),this.renderHealthChecks(e.health_checks||{})}renderKpis(t){Object.entries(Ya.kpiCards).forEach(([e,s])=>{const i=this.elContainer.querySelector(s),n={...t[e]||{}};var o,a,r;"published"===e&&(n.subline=Ua(d("addedThisPeriod","%d added this period"),null!==(o=n.added_in_period)&&void 0!==o?o:0)),"pending_review"===e&&(n.subline=d("needsInstructorAction","Needs instructor action")),"future"===e&&(n.subline=d("scheduledReleases","Scheduled releases")),"avg_completion"===e&&("number"==typeof n.value&&(n.formatted=`${n.value}%`),n.subline=Ua(d("targetPercent","Target: %s%%"),null!==(a=null!==(r=n.target)&&void 0!==r?r:h().completionTarget)&&void 0!==a?a:0)),Ra(i,n),"avg_completion"===e&&this.renderCompletionProgress(i,n)})}renderCompletionProgress(t,e){const s=t?.querySelector(".lp-kpi-progress__bar");if(!s)return;const i=Number(e.value||0),n=Number(e.target||h().completionTarget||0),o=n>0?Math.min(100,i/n*100):0;s.style.width=`${o}%`}renderChart(t){Pa(Ya.selectors.elChartCanvas,{labels:t.labels||[],datasets:[{label:t.line_label||d("publishedCourses","Published courses"),data:t.data||[],yAxisID:"y"}],xLabel:t.x_label||"",granularity:t.granularity||""},{yCurrency:!1})}completionBadge(t){var e,s;if(null==t)return"";const{completionBadge:i={}}=h(),n=null!==(e=i.green)&&void 0!==e?e:60,o=null!==(s=i.yellow)&&void 0!==s?s:40;return t>=n?"green":t>=o?"yellow":"red"}performanceColumns(){return[{key:"name",label:d("course","Course")},{key:"instructor",label:d("instructor","Instructor")},{key:"revenue_formatted",label:d("revenue","Revenue"),csv:t=>t.revenue},{key:"enrollments",label:d("enrollments","Enrollments")},{key:"completion_rate",label:d("completion","Completion"),format:t=>null==t?"-":`${t}%`,badge:t=>this.completionBadge(t.completion_rate)}]}inventoryLabel(t){return{courses:d("courses","Courses"),lessons:d("lessons","Lessons"),quizzes:d("quizzes","Quizzes"),assignments:d("assignments","Assignments")}[t]||String(t||"")}inventoryStatusLabel(t){return{publish:d("published","Published"),pending:d("pending","Pending"),future:d("future","Future"),draft:d("drafts","Drafts"),total:d("total","Total")}[t]||String(t||"")}inventoryRows(t={}){return Object.entries(t).map(([t,e])=>({type:t,label:this.inventoryLabel(t),...e||{}}))}inventoryColumns(t=[]){const e=["publish","pending","future","draft","total"].filter(e=>t.some(t=>Object.prototype.hasOwnProperty.call(t,e)));return[{key:"label",label:d("content","Content")},...e.map(t=>({key:t,label:this.inventoryStatusLabel(t),csv:e=>e[t]}))]}renderTables(t){const e=t.performance||[],s=Ia(this.elContainer.querySelector(Ya.selectors.elTablePerformance),this.performanceColumns(),e,{emptyText:d("noCoursePerformance","No course performance data in this period.")});this.tables.performance=s,this.decoratePerformanceRows(e);const i=this.inventoryRows(t.inventory||{});this.tables.inventory=Ia(this.elContainer.querySelector(Ya.selectors.elTableInventory),this.inventoryColumns(i),i)}decoratePerformanceRows(t=[]){const e=this.elContainer.querySelectorAll(`${Ya.selectors.elTablePerformance} tbody tr`);t.forEach((t,s)=>{const i=e[s];i&&t.edit_link&&(i.classList.add("lp-stats-course-performance-row"),i.dataset.editLink=t.edit_link)})}renderHealthChecks(t){this.elContainer.querySelectorAll(Ya.selectors.elHealthCheckCount).forEach(e=>{var s;const i=e.dataset.check;e.textContent=String(null!==(s=t[i])&&void 0!==s?s:0)})}openCourseEdit(t){const e=t.target.closest(Ya.selectors.elPerformanceRow);if(!e||!this.elContainer.contains(e))return;const s=e.dataset.editLink||"",i=h().adminUrl||"";s&&i&&s.startsWith(i)&&(window.location.href=s)}viewAllPerformance(t){const e=t.target.closest(Ya.selectors.elBtnViewAllPerformance);e&&this.elContainer.contains(e)&&Oa.open({report:"course_performance",title:d("coursePerformance","Course performance"),tableId:"course-performance"})}exportTables(){Object.entries(this.tables).forEach(([t,e])=>{e&&e.rows.length&&$a(za("courses",t),e.columns,e.rows)})}}const Xa=new Ya,Ka=(t,e)=>String(t).replace(/%[ds]/,String(e)).replace(/%%/g,"%");class Za{static selectors={elContainer:".lp-stats-tab-users",elChartCanvas:"#user-chart-content",elFunnelStep:".lp-stats-funnel__step",elTableTopStudents:".lp-stats-table-top-students",elTableCoursesByStudents:".lp-stats-table-courses-by-students",elBtnViewAllStudents:".lp-stats-view-all-students",elBtnViewAllCourses:".lp-stats-view-all-courses-by-students",elSkeleton:".lp-skeleton-animation"};static kpiCards={users_activated:".lp-kpi-users-activated",students:".lp-kpi-students",instructors:".lp-kpi-instructors",not_started:".lp-kpi-not-started",in_progress:".lp-kpi-in-progress",finished:".lp-kpi-finished"};constructor(){this.elContainer=null,this.isRequesting=!1,this.pendingReload=!1,this.tables={}}init(){this.elContainer=document.querySelector(Za.selectors.elContainer),this.elContainer&&(this.events(),this.loadData())}events(){Za._loadedEvents||(Za._loadedEvents=this,n("click",[{selector:Za.selectors.elBtnViewAllStudents,class:this,callBack:this.viewAllStudents.name},{selector:Za.selectors.elBtnViewAllCourses,class:this,callBack:this.viewAllCoursesByStudents.name}]),document.addEventListener(o,()=>this.loadData()),document.addEventListener(a,()=>this.exportTables()))}toggleSkeletons(t){this.elContainer.querySelectorAll(Za.selectors.elSkeleton).forEach(e=>{e.style.display=t?"block":"none"})}loadData(){this.isRequesting?this.pendingReload=!0:(this.isRequesting=!0,u("user-statistics",{},{before:()=>this.toggleSkeletons(!0),success:t=>this.render(t.data),error:t=>{console.error("LP Statistics users:",t),this.render(null)},completed:()=>{this.toggleSkeletons(!1),this.isRequesting=!1,this.pendingReload&&(this.pendingReload=!1,this.loadData())}}))}render(t){t?.dashboard||(console.error("LP Statistics users: dashboard payload missing."),t={chart_data:{},dashboard:{}});const e=t.dashboard||{};this.renderKpis(e.kpis||{}),this.renderChart(t.chart_data||{}),this.renderFunnel(e.funnel||{}),this.renderTables(e)}renderKpis(t){Object.entries(Za.kpiCards).forEach(([e,s])=>{const i=this.elContainer.querySelector(s),n={...t[e]||{}};var o,a,r,l;"users_activated"===e&&(n.subline=Ka(d("newThisPeriod","+%d this period"),null!==(o=n.new_in_period)&&void 0!==o?o:0)),"students"===e&&(n.subline=Ka(d("activeInPeriod","%d active in this period"),null!==(a=n.active_in_period)&&void 0!==a?a:0)),"instructors"===e&&(n.subline=`${null!==(r=n.active_in_period)&&void 0!==r?r:0}/${null!==(l=n.value)&&void 0!==l?l:0} ${d("activeThisPeriod","active this period")}`),"not_started"===e&&(n.subline=d("afterEnrollment","After enrollment")),"in_progress"===e&&(n.subline=d("currentLearners","Current learners")),"finished"===e&&null!=n.completion_rate&&(n.subline=Ka(d("completionRateSub","%s%% completion rate"),n.completion_rate)),Ra(i,n)})}renderChart(t){Pa(Za.selectors.elChartCanvas,{labels:t.labels||[],datasets:[{label:t.line_label||d("registeredUsers","Registered users"),data:t.data||[],yAxisID:"y"}],xLabel:t.x_label||"",granularity:t.granularity||""},{yCurrency:!1})}renderFunnel(t){let e=null;["registered","enrolled","started","completed","failed"].forEach(s=>{var i;const n=this.elContainer.querySelector(`${Za.selectors.elFunnelStep}[data-step="${s}"]`);if(!n)return;const o=Number(null!==(i=t[s])&&void 0!==i?i:0);let a=e;var r;"failed"===s?a=Number(null!==(r=t.started)&&void 0!==r?r:0):null===e&&(a=o);const l=a>0?Math.min(100,o/a*100):0;n.querySelector(".lp-stats-funnel__count").textContent=String(o),n.querySelector(".lp-stats-funnel__bar").style.width=`${l}%`,"failed"!==s&&(e=o)})}completionBadge(t){var e,s;if(null==t)return"";const{completionBadge:i={}}=h(),n=null!==(e=i.green)&&void 0!==e?e:60,o=null!==(s=i.yellow)&&void 0!==s?s:40;return t>=n?"green":t>=o?"yellow":"red"}studentStatusLabel(t){return{active:d("statusActive","Active"),at_risk:d("statusAtRisk","At risk"),idle:d("statusIdle","Idle")}[t]||String(t||"")}studentStatusBadge(t){return{active:"green",at_risk:"yellow",idle:"grey"}[t]||""}formatLastActive(t){if(!t)return"—";const e=new Date(String(t).replace(" ","T"));if(isNaN(e.getTime()))return"—";try{const t=Math.round((e.getTime()-Date.now())/864e5);return new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}).format(t,"day")}catch{return e.toLocaleDateString()}}topStudentsColumns(t=!0){const e=[{key:"name",label:d("student","Student")},{key:"enrolled",label:d("enrolled","Enrolled")},{key:"completed",label:d("completedLabel","Completed")}];return t&&e.push({key:"avg_score",label:d("avgScore","Quiz pass rate"),format:t=>null==t?"—":`${t}%`}),e.push({key:"last_active",label:d("lastActive","Last active"),format:t=>this.formatLastActive(t),csv:t=>t.last_active||""},{key:"status",label:d("status","Status"),format:t=>this.studentStatusLabel(t),badge:t=>this.studentStatusBadge(t.status),csv:t=>t.status}),e}coursesByStudentsColumns(){return[{key:"name",label:d("course","Course")},{key:"enrolled",label:d("enrolled","Enrolled")},{key:"started",label:d("startedLabel","Started")},{key:"completed",label:d("completedLabel","Completed")},{key:"completion_rate",label:d("completion","Completion"),format:t=>null==t?"—":`${t}%`,badge:t=>this.completionBadge(t.completion_rate)},{key:"active_7d",label:d("activeLast7dShort","Active 7d")}]}hasScores(t=[]){return t.some(t=>null!=t.avg_score)}renderTables(t){const e=t.top_students||[];this.tables["top-students"]=Ia(this.elContainer.querySelector(Za.selectors.elTableTopStudents),this.topStudentsColumns(this.hasScores(e)),e),this.tables["courses-by-students"]=Ia(this.elContainer.querySelector(Za.selectors.elTableCoursesByStudents),this.coursesByStudentsColumns(),t.top_courses_by_students||[])}viewAllStudents(t){const e=t.target.closest(Za.selectors.elBtnViewAllStudents);e&&this.elContainer.contains(e)&&Oa.open({report:"top_students",title:d("topStudents","Top students"),tableId:"top-students"})}viewAllCoursesByStudents(t){const e=t.target.closest(Za.selectors.elBtnViewAllCourses);e&&this.elContainer.contains(e)&&Oa.open({report:"courses_by_students",title:d("topCoursesByStudents","Top courses by students"),tableId:"courses-by-students"})}exportTables(){Object.entries(this.tables).forEach(([t,e])=>{e&&e.rows.length&&$a(za("users",t),e.columns,e.rows)})}}const Ja=new Za,Ga=(t,e)=>String(t).replace(/%[ds]/,String(e)).replace(/%%/g,"%");class Qa{static selectors={elContainer:".lp-stats-tab-instructors",elChartCanvas:"#instructor-chart-content",elTablePerformance:".lp-stats-table-instructor-performance",elTableWatchlist:".lp-stats-table-instructor-watchlist",elBtnViewAllInstructors:".lp-stats-view-all-instructors",elPerformanceRow:".lp-stats-instructor-performance-row",elOperationsRow:".lp-stats-operations__row",elSkeleton:".lp-skeleton-animation"};static kpiCards={active_instructors:".lp-kpi-active-instructors",instructor_revenue:".lp-kpi-instructor-revenue",courses_managed:".lp-kpi-courses-managed",students_reached:".lp-kpi-students-reached",avg_completion:".lp-kpi-avg-completion",needs_review:".lp-kpi-needs-review"};constructor(){this.elContainer=null,this.isRequesting=!1,this.pendingReload=!1,this.tables={}}init(){this.elContainer=document.querySelector(Qa.selectors.elContainer),this.elContainer&&(this.events(),this.loadData())}events(){Qa._loadedEvents||(Qa._loadedEvents=this,n("click",[{selector:Qa.selectors.elBtnViewAllInstructors,class:this,callBack:this.viewAllInstructors.name},{selector:Qa.selectors.elPerformanceRow,class:this,callBack:this.openInstructorReport.name}]),document.addEventListener(o,()=>this.loadData()),document.addEventListener(a,()=>this.exportTables()))}toggleSkeletons(t){this.elContainer.querySelectorAll(Qa.selectors.elSkeleton).forEach(e=>{e.style.display=t?"block":"none"})}loadData(){this.isRequesting?this.pendingReload=!0:(this.isRequesting=!0,u("instructor-statistics",{},{before:()=>this.toggleSkeletons(!0),success:t=>this.render(t.data),error:t=>{console.error("LP Statistics instructors:",t),this.render(null)},completed:()=>{this.toggleSkeletons(!1),this.isRequesting=!1,this.pendingReload&&(this.pendingReload=!1,this.loadData())}}))}render(t){t?.dashboard||(console.error("LP Statistics instructors: dashboard payload missing."),t={chart_data:{},dashboard:{}});const e=t.dashboard||{};this.renderKpis(e.kpis||{}),this.renderChart(t.chart_data||{}),this.renderOperations(e.operations||{}),this.renderTables(e)}renderKpis(t){Object.entries(Qa.kpiCards).forEach(([e,s])=>{const i=this.elContainer.querySelector(s),n={...t[e]||{}};var o;"active_instructors"===e&&(n.subline=Ga(d("ofTotalInstructors","%d total"),null!==(o=n.total)&&void 0!==o?o:0)),"instructor_revenue"===e&&null!=n.contribution_pct&&(n.subline=Ga(d("ofNetSales","%s%% of net sales"),n.contribution_pct)),"avg_completion"===e&&"number"==typeof n.value&&(n.formatted=`${n.value}%`),Ra(i,n)})}renderChart(t){Pa(Qa.selectors.elChartCanvas,{labels:t.labels||[],datasets:[{label:d("revenue","Revenue"),data:t.revenue||[],yAxisID:"y"},{label:d("enrollments","Enrollments"),data:t.enrollments||[],yAxisID:"y1"}],xLabel:t.x_label||"",granularity:t.granularity||""})}renderOperations(t){this.elContainer.querySelectorAll(Qa.selectors.elOperationsRow).forEach(e=>{const s=e.dataset.op,i=e.querySelector(".lp-stats-operations__value"),n=e.querySelector(".lp-stats-operations__name"),o=t[s];if(n&&(n.textContent=""),null!=o)if("object"==typeof o){var a,r;i&&(i.textContent=null!==(a=o.value_formatted)&&void 0!==a?a:"number"==typeof o.value&&"top_completion"===s?`${o.value}%`:String(null!==(r=o.value)&&void 0!==r?r:"")),n&&(n.textContent=o.name||"")}else i&&(i.textContent=String(o));else i&&(i.textContent="–")})}completionBadge(t){var e,s;if(null==t)return"";const{completionBadge:i={}}=h(),n=null!==(e=i.green)&&void 0!==e?e:60,o=null!==(s=i.yellow)&&void 0!==s?s:40;return t>=n?"green":t>=o?"yellow":"red"}riskLabel(t){return{high:d("riskHigh","High"),medium:d("riskMedium","Medium"),healthy:d("riskHealthy","Healthy")}[t]||String(t||"")}actionLabel(t){const{watchlistActions:e={}}=h().i18n||{};return e[t]||String(t||"")}performanceColumns(){return[{key:"name",label:d("instructor","Instructor")},{key:"courses",label:d("courses","Courses")},{key:"students",label:d("students","Students")},{key:"revenue_formatted",label:d("revenue","Revenue"),csv:t=>t.revenue},{key:"avg_completion",label:d("completion","Completion"),format:t=>null==t?"–":`${t}%`,badge:t=>this.completionBadge(t.avg_completion)}]}watchlistColumns(){return[{key:"name",label:d("course","Course")},{key:"instructor",label:d("instructor","Instructor")},{key:"completion_rate",label:d("completion","Completion"),format:t=>null==t?"–":`${t}%`},{key:"risk",label:d("risk","Risk"),format:t=>{const e=document.createElement("span");return e.className=`lp-badge lp-risk lp-risk--${t}`,e.textContent=this.riskLabel(t),e},csv:t=>this.riskLabel(t.risk)},{key:"action",label:d("actionRequired","Action required"),format:t=>this.actionLabel(t),csv:t=>this.actionLabel(t.action)}]}renderTables(t){const e=t.performance||[];this.tables.performance=Ia(this.elContainer.querySelector(Qa.selectors.elTablePerformance),this.performanceColumns(),e,{emptyText:d("noInstructorData","No instructor data in this period.")}),this.decoratePerformanceRows(e),this.tables.watchlist=Ia(this.elContainer.querySelector(Qa.selectors.elTableWatchlist),this.watchlistColumns(),t.watchlist||[])}decoratePerformanceRows(t=[]){const e=c.get().instructor_id,s=this.elContainer.querySelectorAll(`${Qa.selectors.elTablePerformance} tbody tr`);t.forEach((t,i)=>{const n=s[i];n&&t.instructor_id&&(n.classList.add("lp-stats-instructor-performance-row"),n.dataset.instructorId=String(t.instructor_id),n.dataset.instructorName=t.name||"",e&&e===t.instructor_id&&n.classList.add("is-highlighted"))})}openInstructorReport(t){const e=t.target.closest(Qa.selectors.elPerformanceRow);if(!e||!this.elContainer.contains(e))return;const s=parseInt(e.dataset.instructorId,10)||0;if(s<=0)return;const i=e.dataset.instructorName||d("instructorReport","Instructor report");Oa.open({report:"instructor_report",title:i,tableId:`instructor-${s}`,args:{instructor_id:s}})}viewAllInstructors(t){const e=t.target.closest(Qa.selectors.elBtnViewAllInstructors);e&&this.elContainer.contains(e)&&Oa.open({report:"instructor_performance",title:d("instructorPerformance","Instructor performance"),tableId:"instructor-performance"})}exportTables(){Object.entries(this.tables).forEach(([t,e])=>{e&&e.rows.length&&$a(za("instructors",t),e.columns,e.rows)})}}const tr=new Qa;e(Aa.selectors.elContainer,()=>{Ea.init()}),Oa.init(),e(Ha.selectors.elContainer,()=>{ja.init()}),e(Wa.selectors.elContainer,()=>{qa.init()}),e(Ya.selectors.elContainer,()=>{Xa.init()}),e(Za.selectors.elContainer,()=>{Ja.init()}),e(Qa.selectors.elContainer,()=>{tr.init()})})()})(); |