termweb-dashboard 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/app.bundle.js +29 -29
  2. package/package.json +3 -3
@@ -1,25 +1,25 @@
1
- (()=>{function Ce(s){return s+.5|0}var Rt=(s,t,e)=>Math.max(Math.min(s,e),t);function Se(s){return Rt(Ce(s*2.55),0,255)}function It(s){return Rt(Ce(s*255),0,255)}function wt(s){return Rt(Ce(s/2.55)/100,0,1)}function pn(s){return Rt(Ce(s*100),0,100)}var lt={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},Ys=[..."0123456789ABCDEF"],Ya=s=>Ys[s&15],Ua=s=>Ys[(s&240)>>4]+Ys[s&15],Je=s=>(s&240)>>4===(s&15),Xa=s=>Je(s.r)&&Je(s.g)&&Je(s.b)&&Je(s.a);function qa(s){var t=s.length,e;return s[0]==="#"&&(t===4||t===5?e={r:255&lt[s[1]]*17,g:255&lt[s[2]]*17,b:255&lt[s[3]]*17,a:t===5?lt[s[4]]*17:255}:(t===7||t===9)&&(e={r:lt[s[1]]<<4|lt[s[2]],g:lt[s[3]]<<4|lt[s[4]],b:lt[s[5]]<<4|lt[s[6]],a:t===9?lt[s[7]]<<4|lt[s[8]]:255})),e}var Ka=(s,t)=>s<255?t(s):"";function Ga(s){var t=Xa(s)?Ya:Ua;return s?"#"+t(s.r)+t(s.g)+t(s.b)+Ka(s.a,t):void 0}var Ja=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function xn(s,t,e){let i=t*Math.min(e,1-e),n=(o,a=(o+s/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function Za(s,t,e){let i=(n,o=(n+s/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function Qa(s,t,e){let i=xn(s,1,.5),n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)i[n]*=1-t-e,i[n]+=t;return i}function tr(s,t,e,i,n){return s===n?(t-e)/i+(t<e?6:0):t===n?(e-s)/i+2:(s-t)/i+4}function Us(s){let e=s.r/255,i=s.g/255,n=s.b/255,o=Math.max(e,i,n),a=Math.min(e,i,n),r=(o+a)/2,l,c,h;return o!==a&&(h=o-a,c=r>.5?h/(2-o-a):h/(o+a),l=tr(e,i,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Xs(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(It)}function qs(s,t,e){return Xs(xn,s,t,e)}function er(s,t,e){return Xs(Qa,s,t,e)}function sr(s,t,e){return Xs(Za,s,t,e)}function _n(s){return(s%360+360)%360}function ir(s){let t=Ja.exec(s),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Se(+t[5]):It(+t[5]));let n=_n(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=er(n,o,a):t[1]==="hsv"?i=sr(n,o,a):i=qs(n,o,a),{r:i[0],g:i[1],b:i[2],a:e}}function nr(s,t){var e=Us(s);e[0]=_n(e[0]+t),e=qs(e),s.r=e[0],s.g=e[1],s.b=e[2]}function or(s){if(!s)return;let t=Us(s),e=t[0],i=pn(t[1]),n=pn(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${wt(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}var gn={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"},mn={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"};function ar(){let s={},t=Object.keys(mn),e=Object.keys(gn),i,n,o,a,r;for(i=0;i<t.length;i++){for(a=r=t[i],n=0;n<e.length;n++)o=e[n],r=r.replace(o,gn[o]);o=parseInt(mn[a],16),s[r]=[o>>16&255,o>>8&255,o&255]}return s}var Ze;function rr(s){Ze||(Ze=ar(),Ze.transparent=[0,0,0,0]);let t=Ze[s.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var lr=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function cr(s){let t=lr.exec(s),e=255,i,n,o;if(t){if(t[7]!==i){let a=+t[7];e=t[8]?Se(a):Rt(a*255,0,255)}return i=+t[1],n=+t[3],o=+t[5],i=255&(t[2]?Se(i):Rt(i,0,255)),n=255&(t[4]?Se(n):Rt(n,0,255)),o=255&(t[6]?Se(o):Rt(o,0,255)),{r:i,g:n,b:o,a:e}}}function hr(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${wt(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}var js=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,ne=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);function dr(s,t,e){let i=ne(wt(s.r)),n=ne(wt(s.g)),o=ne(wt(s.b));return{r:It(js(i+e*(ne(wt(t.r))-i))),g:It(js(n+e*(ne(wt(t.g))-n))),b:It(js(o+e*(ne(wt(t.b))-o))),a:s.a+e*(t.a-s.a)}}function Qe(s,t,e){if(s){let i=Us(s);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=qs(i),s.r=i[0],s.g=i[1],s.b=i[2]}}function yn(s,t){return s&&Object.assign(t||{},s)}function bn(s){var t={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(t={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(t.a=It(s[3]))):(t=yn(s,{r:0,g:0,b:0,a:1}),t.a=It(t.a)),t}function ur(s){return s.charAt(0)==="r"?cr(s):ir(s)}var Pe=class s{constructor(t){if(t instanceof s)return t;let e=typeof t,i;e==="object"?i=bn(t):e==="string"&&(i=qa(t)||rr(t)||ur(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=yn(this._rgb);return t&&(t.a=wt(t.a)),t}set rgb(t){this._rgb=bn(t)}rgbString(){return this._valid?hr(this._rgb):void 0}hexString(){return this._valid?Ga(this._rgb):void 0}hslString(){return this._valid?or(this._rgb):void 0}mix(t,e){if(t){let i=this.rgb,n=t.rgb,o,a=e===o?.5:e,r=2*a-1,l=i.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,i.r=255&c*i.r+o*n.r+.5,i.g=255&c*i.g+o*n.g+.5,i.b=255&c*i.b+o*n.b+.5,i.a=a*i.a+(1-a)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=dr(this._rgb,t._rgb,e)),this}clone(){return new s(this.rgb)}alpha(t){return this._rgb.a=It(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=Ce(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Qe(this._rgb,2,t),this}darken(t){return Qe(this._rgb,2,-t),this}saturate(t){return Qe(this._rgb,1,t),this}desaturate(t){return Qe(this._rgb,1,-t),this}rotate(t){return nr(this._rgb,t),this}};function gt(){}var Tn=(()=>{let s=0;return()=>s++})();function O(s){return s==null}function F(s){if(Array.isArray&&Array.isArray(s))return!0;let t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function T(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function H(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function it(s,t){return H(s)?s:t}function D(s,t){return typeof s>"u"?t:s}var Ln=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:+s/t,Zs=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;function I(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function E(s,t,e,i){let n,o,a;if(F(s))if(o=s.length,i)for(n=o-1;n>=0;n--)t.call(e,s[n],n);else for(n=0;n<o;n++)t.call(e,s[n],n);else if(T(s))for(a=Object.keys(s),o=a.length,n=0;n<o;n++)t.call(e,s[a[n]],a[n])}function Oe(s,t){let e,i,n,o;if(!s||!t||s.length!==t.length)return!1;for(e=0,i=s.length;e<i;++e)if(n=s[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function is(s){if(F(s))return s.map(is);if(T(s)){let t=Object.create(null),e=Object.keys(s),i=e.length,n=0;for(;n<i;++n)t[e[n]]=is(s[e[n]]);return t}return s}function En(s){return["__proto__","prototype","constructor"].indexOf(s)===-1}function fr(s,t,e,i){if(!En(s))return;let n=t[s],o=e[s];T(n)&&T(o)?ae(n,o,i):t[s]=is(o)}function ae(s,t,e){let i=F(t)?t:[t],n=i.length;if(!T(s))return s;e=e||{};let o=e.merger||fr,a;for(let r=0;r<n;++r){if(a=i[r],!T(a))continue;let l=Object.keys(a);for(let c=0,h=l.length;c<h;++c)o(l[c],s,a,e)}return s}function le(s,t){return ae(s,t,{merger:pr})}function pr(s,t,e){if(!En(s))return;let i=t[s],n=e[s];T(i)&&T(n)?le(i,n):Object.prototype.hasOwnProperty.call(t,s)||(t[s]=is(n))}var vn={"":s=>s,x:s=>s.x,y:s=>s.y};function gr(s){let t=s.split("."),e=[],i="";for(let n of t)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function mr(s){let t=gr(s);return e=>{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function St(s,t){return(vn[t]||(vn[t]=mr(t)))(s)}function rs(s){return s.charAt(0).toUpperCase()+s.slice(1)}var ce=s=>typeof s<"u",kt=s=>typeof s=="function",Qs=(s,t)=>{if(s.size!==t.size)return!1;for(let e of s)if(!t.has(e))return!1;return!0};function Rn(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}var L=Math.PI,z=2*L,br=z+L,ns=Number.POSITIVE_INFINITY,xr=L/180,W=L/2,Xt=L/4,wn=L*2/3,Mt=Math.log10,dt=Math.sign;function he(s,t,e){return Math.abs(s-t)<e}function ti(s){let t=Math.round(s);s=he(s,t,s/1e3)?t:s;let e=Math.pow(10,Math.floor(Mt(s))),i=s/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function In(s){let t=[],e=Math.sqrt(s),i;for(i=1;i<e;i++)s%i===0&&(t.push(i),t.push(s/i));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function _r(s){return typeof s=="symbol"||typeof s=="object"&&s!==null&&!(Symbol.toPrimitive in s||"toString"in s||"valueOf"in s)}function Gt(s){return!_r(s)&&!isNaN(parseFloat(s))&&isFinite(s)}function Fn(s,t){let e=Math.round(s);return e-t<=s&&e+t>=s}function ei(s,t,e){let i,n,o;for(i=0,n=s.length;i<n;i++)o=s[i][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function ct(s){return s*(L/180)}function ls(s){return s*(180/L)}function si(s){if(!H(s))return;let t=1,e=0;for(;Math.round(s*t)/t!==s;)t*=10,e++;return e}function ii(s,t){let e=t.x-s.x,i=t.y-s.y,n=Math.sqrt(e*e+i*i),o=Math.atan2(i,e);return o<-.5*L&&(o+=z),{angle:o,distance:n}}function os(s,t){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function yr(s,t){return(s-t+br)%z-L}function G(s){return(s%z+z)%z}function de(s,t,e,i){let n=G(s),o=G(t),a=G(e),r=G(o-n),l=G(a-n),c=G(n-o),h=G(n-a);return n===o||n===a||i&&o===a||r>l&&c<h}function K(s,t,e){return Math.max(t,Math.min(e,s))}function zn(s){return K(s,-32768,32767)}function mt(s,t,e,i=1e-6){return s>=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function cs(s,t,e){e=e||(a=>s[a]<t);let i=s.length-1,n=0,o;for(;i-n>1;)o=n+i>>1,e(o)?n=o:i=o;return{lo:n,hi:i}}var ft=(s,t,e,i)=>cs(s,e,i?n=>{let o=s[n][t];return o<e||o===e&&s[n+1][t]===e}:n=>s[n][t]<e),Bn=(s,t,e)=>cs(s,e,i=>s[i][t]>=e);function $n(s,t,e){let i=0,n=s.length;for(;i<n&&s[i]<t;)i++;for(;n>i&&s[n-1]>e;)n--;return i>0||n<s.length?s.slice(i,n):s}var Nn=["push","pop","shift","splice","unshift"];function Vn(s,t){if(s._chartjs){s._chartjs.listeners.push(t);return}Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Nn.forEach(e=>{let i="_onData"+rs(e),n=s[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value(...o){let a=n.apply(this,o);return s._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...o)}),a}})})}function ni(s,t){let e=s._chartjs;if(!e)return;let i=e.listeners,n=i.indexOf(t);n!==-1&&i.splice(n,1),!(i.length>0)&&(Nn.forEach(o=>{delete s[o]}),delete s._chartjs)}function oi(s){let t=new Set(s);return t.size===s.length?s:Array.from(t)}var ai=function(){return typeof window>"u"?function(s){return s()}:window.requestAnimationFrame}();function ri(s,t){let e=[],i=!1;return function(...n){e=n,i||(i=!0,ai.call(window,()=>{i=!1,s.apply(t,e)}))}}function Hn(s,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(s,t,i)):s.apply(this,i),t}}var hs=s=>s==="start"?"left":s==="end"?"right":"center",J=(s,t,e)=>s==="start"?t:s==="end"?e:(t+e)/2,Wn=(s,t,e,i)=>s===(i?"left":"right")?e:s==="center"?(t+e)/2:t;function li(s,t,e){let i=t.length,n=0,o=i;if(s._sorted){let{iScale:a,vScale:r,_parsed:l}=s,c=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null,h=a.axis,{min:d,max:u,minDefined:f,maxDefined:p}=a.getUserBounds();if(f){if(n=Math.min(ft(l,h,d).lo,e?i:ft(t,h,a.getPixelForValue(d)).lo),c){let g=l.slice(0,n+1).reverse().findIndex(m=>!O(m[r.axis]));n-=Math.max(0,g)}n=K(n,0,i-1)}if(p){let g=Math.max(ft(l,a.axis,u,!0).hi+1,e?0:ft(t,h,a.getPixelForValue(u),!0).hi+1);if(c){let m=l.slice(g-1).findIndex(b=>!O(b[r.axis]));g+=Math.max(0,m)}o=K(g,n,i)-n}else o=i-n}return{start:n,count:o}}function ci(s){let{xScale:t,yScale:e,_scaleRanges:i}=s,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return s._scaleRanges=n,!0;let o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,n),o}var ts=s=>s===0||s===1,kn=(s,t,e)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-t)*z/e)),Mn=(s,t,e)=>Math.pow(2,-10*s)*Math.sin((s-t)*z/e)+1,oe={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*W)+1,easeOutSine:s=>Math.sin(s*W),easeInOutSine:s=>-.5*(Math.cos(L*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>ts(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>ts(s)?s:kn(s,.075,.3),easeOutElastic:s=>ts(s)?s:Mn(s,.075,.3),easeInOutElastic(s){return ts(s)?s:s<.5?.5*kn(s*2,.1125,.45):.5+.5*Mn(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let t=1.70158;return(s/=.5)<1?.5*(s*s*(((t*=1.525)+1)*s-t)):.5*((s-=2)*s*(((t*=1.525)+1)*s+t)+2)},easeInBounce:s=>1-oe.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?oe.easeInBounce(s*2)*.5:oe.easeOutBounce(s*2-1)*.5+.5};function hi(s){if(s&&typeof s=="object"){let t=s.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function di(s){return hi(s)?s:new Pe(s)}function Ks(s){return hi(s)?s:new Pe(s).saturate(.5).darken(.1).hexString()}var vr=["x","y","borderWidth","radius","tension"],wr=["color","borderColor","backgroundColor"];function kr(s){s.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),s.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),s.set("animations",{colors:{type:"color",properties:wr},numbers:{type:"number",properties:vr}}),s.describe("animations",{_fallback:"animation"}),s.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Mr(s){s.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Sn=new Map;function Sr(s,t){t=t||{};let e=s+JSON.stringify(t),i=Sn.get(e);return i||(i=new Intl.NumberFormat(s,t),Sn.set(e,i)),i}function ue(s,t,e){return Sr(t,e).format(s)}var jn={values(s){return F(s)?s:""+s},numeric(s,t,e){if(s===0)return"0";let i=this.chart.options.locale,n,o=s;if(e.length>1){let c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=Pr(s,e)}let a=Mt(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),ue(s,i,l)},logarithmic(s,t,e){if(s===0)return"0";let i=e[t].significand||s/Math.pow(10,Math.floor(Mt(s)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?jn.numeric.call(this,s,t,e):""}};function Pr(s,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&s!==Math.floor(s)&&(e=s-Math.floor(s)),e}var Te={formatters:jn};function Cr(s){s.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:Te.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.route("scale.ticks","color","","color"),s.route("scale.grid","color","","borderColor"),s.route("scale.border","color","","borderColor"),s.route("scale.title","color","","color"),s.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),s.describe("scales",{_fallback:"scale"}),s.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}var Bt=Object.create(null),ds=Object.create(null);function De(s,t){if(!t)return s;let e=t.split(".");for(let i=0,n=e.length;i<n;++i){let o=e[i];s=s[o]||(s[o]=Object.create(null))}return s}function Gs(s,t,e){return typeof t=="string"?ae(De(s,t),e):ae(De(s,""),t)}var Js=class{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=i=>i.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=(i,n)=>Ks(n.backgroundColor),this.hoverBorderColor=(i,n)=>Ks(n.borderColor),this.hoverColor=(i,n)=>Ks(n.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 Gs(this,t,e)}get(t){return De(this,t)}describe(t,e){return Gs(ds,t,e)}override(t,e){return Gs(Bt,t,e)}route(t,e,i,n){let o=De(this,t),a=De(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[r],c=a[n];return T(l)?Object.assign({},c,l):D(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}},B=new Js({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[kr,Mr,Cr]);function Dr(s){return!s||O(s.size)||O(s.family)?null:(s.style?s.style+" ":"")+(s.weight?s.weight+" ":"")+s.size+"px "+s.family}function Ae(s,t,e,i,n){let o=t[n];return o||(o=t[n]=s.measureText(n).width,e.push(n)),o>i&&(i=o),i}function Yn(s,t,e,i){i=i||{};let n=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(n=i.data={},o=i.garbageCollect=[],i.font=t),s.save(),s.font=t;let a=0,r=e.length,l,c,h,d,u;for(l=0;l<r;l++)if(d=e[l],d!=null&&!F(d))a=Ae(s,n,o,a,d);else if(F(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!F(u)&&(a=Ae(s,n,o,a,u));s.restore();let f=o.length/2;if(f>e.length){for(l=0;l<f;l++)delete n[o[l]];o.splice(0,f)}return a}function $t(s,t,e){let i=s.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*i)/i+n}function ui(s,t){!t&&!s||(t=t||s.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,s.width,s.height),t.restore())}function us(s,t,e,i){fi(s,t,e,i,null)}function fi(s,t,e,i,n){let o,a,r,l,c,h,d,u,f=t.pointStyle,p=t.rotation,g=t.radius,m=(p||0)*xr;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){s.save(),s.translate(e,i),s.rotate(m),s.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),s.restore();return}if(!(isNaN(g)||g<=0)){switch(s.beginPath(),f){default:n?s.ellipse(e,i,n/2,g,0,0,z):s.arc(e,i,g,0,z),s.closePath();break;case"triangle":h=n?n/2:g,s.moveTo(e+Math.sin(m)*h,i-Math.cos(m)*g),m+=wn,s.lineTo(e+Math.sin(m)*h,i-Math.cos(m)*g),m+=wn,s.lineTo(e+Math.sin(m)*h,i-Math.cos(m)*g),s.closePath();break;case"rectRounded":c=g*.516,l=g-c,a=Math.cos(m+Xt)*l,d=Math.cos(m+Xt)*(n?n/2-c:l),r=Math.sin(m+Xt)*l,u=Math.sin(m+Xt)*(n?n/2-c:l),s.arc(e-d,i-r,c,m-L,m-W),s.arc(e+u,i-a,c,m-W,m),s.arc(e+d,i+r,c,m,m+W),s.arc(e-u,i+a,c,m+W,m+L),s.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*g,h=n?n/2:l,s.rect(e-h,i-l,2*h,2*l);break}m+=Xt;case"rectRot":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),s.moveTo(e-d,i-r),s.lineTo(e+u,i-a),s.lineTo(e+d,i+r),s.lineTo(e-u,i+a),s.closePath();break;case"crossRot":m+=Xt;case"cross":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),s.moveTo(e-d,i-r),s.lineTo(e+d,i+r),s.moveTo(e+u,i-a),s.lineTo(e-u,i+a);break;case"star":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),s.moveTo(e-d,i-r),s.lineTo(e+d,i+r),s.moveTo(e+u,i-a),s.lineTo(e-u,i+a),m+=Xt,d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),s.moveTo(e-d,i-r),s.lineTo(e+d,i+r),s.moveTo(e+u,i-a),s.lineTo(e-u,i+a);break;case"line":a=n?n/2:Math.cos(m)*g,r=Math.sin(m)*g,s.moveTo(e-a,i-r),s.lineTo(e+a,i+r);break;case"dash":s.moveTo(e,i),s.lineTo(e+Math.cos(m)*(n?n/2:g),i+Math.sin(m)*g);break;case!1:s.closePath();break}s.fill(),t.borderWidth>0&&s.stroke()}}function pt(s,t,e){return e=e||.5,!t||s&&s.x>t.left-e&&s.x<t.right+e&&s.y>t.top-e&&s.y<t.bottom+e}function Le(s,t){s.save(),s.beginPath(),s.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),s.clip()}function Ee(s){s.restore()}function Un(s,t,e,i,n){if(!t)return s.lineTo(e.x,e.y);if(n==="middle"){let o=(t.x+e.x)/2;s.lineTo(o,t.y),s.lineTo(o,e.y)}else n==="after"!=!!i?s.lineTo(t.x,e.y):s.lineTo(e.x,t.y);s.lineTo(e.x,e.y)}function Xn(s,t,e,i){if(!t)return s.lineTo(e.x,e.y);s.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function Ar(s,t){t.translation&&s.translate(t.translation[0],t.translation[1]),O(t.rotation)||s.rotate(t.rotation),t.color&&(s.fillStyle=t.color),t.textAlign&&(s.textAlign=t.textAlign),t.textBaseline&&(s.textBaseline=t.textBaseline)}function Or(s,t,e,i,n){if(n.strikethrough||n.underline){let o=s.measureText(i),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;s.strokeStyle=s.fillStyle,s.beginPath(),s.lineWidth=n.decorationWidth||2,s.moveTo(a,h),s.lineTo(r,h),s.stroke()}}function Tr(s,t){let e=s.fillStyle;s.fillStyle=t.color,s.fillRect(t.left,t.top,t.width,t.height),s.fillStyle=e}function Nt(s,t,e,i,n,o={}){let a=F(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(s.save(),s.font=n.string,Ar(s,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Tr(s,o.backdrop),r&&(o.strokeColor&&(s.strokeStyle=o.strokeColor),O(o.strokeWidth)||(s.lineWidth=o.strokeWidth),s.strokeText(c,e,i,o.maxWidth)),s.fillText(c,e,i,o.maxWidth),Or(s,e,i,c,o),i+=Number(n.lineHeight);s.restore()}function fe(s,t){let{x:e,y:i,w:n,h:o,radius:a}=t;s.arc(e+a.topLeft,i+a.topLeft,a.topLeft,1.5*L,L,!0),s.lineTo(e,i+o-a.bottomLeft),s.arc(e+a.bottomLeft,i+o-a.bottomLeft,a.bottomLeft,L,W,!0),s.lineTo(e+n-a.bottomRight,i+o),s.arc(e+n-a.bottomRight,i+o-a.bottomRight,a.bottomRight,W,0,!0),s.lineTo(e+n,i+a.topRight),s.arc(e+n-a.topRight,i+a.topRight,a.topRight,0,-W,!0),s.lineTo(e+a.topLeft,i)}var Lr=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Er=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Rr(s,t){let e=(""+s).match(Lr);if(!e||e[1]==="normal")return t*1.2;switch(s=+e[2],e[3]){case"px":return s;case"%":s/=100;break}return t*s}var Ir=s=>+s||0;function fs(s,t){let e={},i=T(t),n=i?Object.keys(t):t,o=T(s)?i?a=>D(s[a],s[t[a]]):a=>s[a]:()=>s;for(let a of n)e[a]=Ir(o(a));return e}function pi(s){return fs(s,{top:"y",right:"x",bottom:"y",left:"x"})}function Vt(s){return fs(s,["topLeft","topRight","bottomLeft","bottomRight"])}function Z(s){let t=pi(s);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function X(s,t){s=s||{},t=t||B.font;let e=D(s.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=D(s.style,t.style);i&&!(""+i).match(Er)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);let n={family:D(s.family,t.family),lineHeight:Rr(D(s.lineHeight,t.lineHeight),e),size:e,style:i,weight:D(s.weight,t.weight),string:""};return n.string=Dr(n),n}function pe(s,t,e,i){let n=!0,o,a,r;for(o=0,a=s.length;o<a;++o)if(r=s[o],r!==void 0&&(t!==void 0&&typeof r=="function"&&(r=r(t),n=!1),e!==void 0&&F(r)&&(r=r[e%r.length],n=!1),r!==void 0))return i&&!n&&(i.cacheable=!1),r}function qn(s,t,e){let{min:i,max:n}=s,o=Zs(t,(n-i)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(i,-Math.abs(o)),max:a(n,o)}}function Pt(s,t){return Object.assign(Object.create(s),t)}function ps(s,t=[""],e,i,n=()=>s[0]){let o=e||s;typeof i>"u"&&(i=Jn("_fallback",s));let a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:o,_fallback:i,_getTarget:n,override:r=>ps([r,...s],t,o,i)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete s[0][l],!0},get(r,l){return Kn(r,l,()=>Wr(l,t,s,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(r,l){return Cn(r).includes(l)},ownKeys(r){return Cn(r)},set(r,l,c){let h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,!0}})}function Kt(s,t,e,i){let n={_cacheable:!1,_proxy:s,_context:t,_subProxy:e,_stack:new Set,_descriptors:gi(s,i),setContext:o=>Kt(s,o,e,i),override:o=>Kt(s.override(o),t,e,i)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete s[a],!0},get(o,a,r){return Kn(o,a,()=>zr(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(s,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,a)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(o,a){return Reflect.has(s,a)},ownKeys(){return Reflect.ownKeys(s)},set(o,a,r){return s[a]=r,delete o[a],!0}})}function gi(s,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:n=t.allKeys}=s;return{allKeys:n,scriptable:e,indexable:i,isScriptable:kt(e)?e:()=>e,isIndexable:kt(i)?i:()=>i}}var Fr=(s,t)=>s?s+rs(t):t,mi=(s,t)=>T(t)&&s!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Kn(s,t,e){if(Object.prototype.hasOwnProperty.call(s,t)||t==="constructor")return s[t];let i=e();return s[t]=i,i}function zr(s,t,e){let{_proxy:i,_context:n,_subProxy:o,_descriptors:a}=s,r=i[t];return kt(r)&&a.isScriptable(t)&&(r=Br(t,r,s,e)),F(r)&&r.length&&(r=$r(t,r,s,a.isIndexable)),mi(t,r)&&(r=Kt(r,n,o&&o[t],a)),r}function Br(s,t,e,i){let{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(s))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+s);r.add(s);let l=t(o,a||i);return r.delete(s),mi(s,l)&&(l=bi(n._scopes,n,s,l)),l}function $r(s,t,e,i){let{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&i(s))return t[o.index%t.length];if(T(t[0])){let l=t,c=n._scopes.filter(h=>h!==l);t=[];for(let h of l){let d=bi(c,n,s,h);t.push(Kt(d,o,a&&a[s],r))}}return t}function Gn(s,t,e){return kt(s)?s(t,e):s}var Nr=(s,t)=>s===!0?t:typeof s=="string"?St(t,s):void 0;function Vr(s,t,e,i,n){for(let o of t){let a=Nr(e,o);if(a){s.add(a);let r=Gn(a._fallback,e,n);if(typeof r<"u"&&r!==e&&r!==i)return r}else if(a===!1&&typeof i<"u"&&e!==i)return null}return!1}function bi(s,t,e,i){let n=t._rootScopes,o=Gn(t._fallback,e,i),a=[...s,...n],r=new Set;r.add(i);let l=Pn(r,a,e,o||e,i);return l===null||typeof o<"u"&&o!==e&&(l=Pn(r,a,o,l,i),l===null)?!1:ps(Array.from(r),[""],n,o,()=>Hr(t,e,i))}function Pn(s,t,e,i,n){for(;e;)e=Vr(s,t,e,i,n);return e}function Hr(s,t,e){let i=s._getTarget();t in i||(i[t]={});let n=i[t];return F(n)&&T(e)?e:n||{}}function Wr(s,t,e,i){let n;for(let o of t)if(n=Jn(Fr(o,s),e),typeof n<"u")return mi(s,n)?bi(e,i,s,n):n}function Jn(s,t){for(let e of t){if(!e)continue;let i=e[s];if(typeof i<"u")return i}}function Cn(s){let t=s._keys;return t||(t=s._keys=jr(s._scopes)),t}function jr(s){let t=new Set;for(let e of s)for(let i of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(i);return Array.from(t)}function xi(s,t,e,i){let{iScale:n}=s,{key:o="r"}=this._parsing,a=new Array(i),r,l,c,h;for(r=0,l=i;r<l;++r)c=r+e,h=t[c],a[r]={r:n.parse(St(h,o),c)};return a}var Yr=Number.EPSILON||1e-14,re=(s,t)=>t<s.length&&!s[t].skip&&s[t],Zn=s=>s==="x"?"y":"x";function Ur(s,t,e,i){let n=s.skip?t:s,o=t,a=e.skip?t:e,r=os(o,n),l=os(a,o),c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;let 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 Xr(s,t,e){let i=s.length,n,o,a,r,l,c=re(s,0);for(let h=0;h<i-1;++h)if(l=c,c=re(s,h+1),!(!l||!c)){if(he(t[h],0,Yr)){e[h]=e[h+1]=0;continue}n=e[h]/t[h],o=e[h+1]/t[h],r=Math.pow(n,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),e[h]=n*a*t[h],e[h+1]=o*a*t[h])}}function qr(s,t,e="x"){let i=Zn(e),n=s.length,o,a,r,l=re(s,0);for(let c=0;c<n;++c){if(a=r,r=l,l=re(s,c+1),!r)continue;let h=r[e],d=r[i];a&&(o=(h-a[e])/3,r[`cp1${e}`]=h-o,r[`cp1${i}`]=d-o*t[c]),l&&(o=(l[e]-h)/3,r[`cp2${e}`]=h+o,r[`cp2${i}`]=d+o*t[c])}}function Kr(s,t="x"){let e=Zn(t),i=s.length,n=Array(i).fill(0),o=Array(i),a,r,l,c=re(s,0);for(a=0;a<i;++a)if(r=l,l=c,c=re(s,a+1),!!l){if(c){let h=c[t]-l[t];n[a]=h!==0?(c[e]-l[e])/h:0}o[a]=r?c?dt(n[a-1])!==dt(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}Xr(s,n,o),qr(s,o,t)}function es(s,t,e){return Math.max(Math.min(s,e),t)}function Gr(s,t){let e,i,n,o,a,r=pt(s[0],t);for(e=0,i=s.length;e<i;++e)a=o,o=r,r=e<i-1&&pt(s[e+1],t),o&&(n=s[e],a&&(n.cp1x=es(n.cp1x,t.left,t.right),n.cp1y=es(n.cp1y,t.top,t.bottom)),r&&(n.cp2x=es(n.cp2x,t.left,t.right),n.cp2y=es(n.cp2y,t.top,t.bottom)))}function Qn(s,t,e,i,n){let o,a,r,l;if(t.spanGaps&&(s=s.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Kr(s,n);else{let c=i?s[s.length-1]:s[0];for(o=0,a=s.length;o<a;++o)r=s[o],l=Ur(c,r,s[Math.min(o+1,a-(i?0:1))%a],t.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}t.capBezierPoints&&Gr(s,e)}function gs(){return typeof window<"u"&&typeof document<"u"}function ms(s){let t=s.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function as(s,t,e){let i;return typeof s=="string"?(i=parseInt(s,10),s.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=s,i}var bs=s=>s.ownerDocument.defaultView.getComputedStyle(s,null);function Jr(s,t){return bs(s).getPropertyValue(t)}var Zr=["top","right","bottom","left"];function qt(s,t,e){let i={};e=e?"-"+e:"";for(let n=0;n<4;n++){let o=Zr[n];i[o]=parseFloat(s[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}var Qr=(s,t,e)=>(s>0||t>0)&&(!e||!e.shadowRoot);function tl(s,t){let e=s.touches,i=e&&e.length?e[0]:s,{offsetX:n,offsetY:o}=i,a=!1,r,l;if(Qr(n,o,s.target))r=n,l=o;else{let c=t.getBoundingClientRect();r=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Ht(s,t){if("native"in s)return s;let{canvas:e,currentDevicePixelRatio:i}=t,n=bs(e),o=n.boxSizing==="border-box",a=qt(n,"padding"),r=qt(n,"border","width"),{x:l,y:c,box:h}=tl(s,e),d=a.left+(h&&r.left),u=a.top+(h&&r.top),{width:f,height:p}=t;return o&&(f-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-d)/f*e.width/i),y:Math.round((c-u)/p*e.height/i)}}function el(s,t,e){let i,n;if(t===void 0||e===void 0){let o=s&&ms(s);if(!o)t=s.clientWidth,e=s.clientHeight;else{let a=o.getBoundingClientRect(),r=bs(o),l=qt(r,"border","width"),c=qt(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=as(r.maxWidth,o,"clientWidth"),n=as(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||ns,maxHeight:n||ns}}var zt=s=>Math.round(s*10)/10;function to(s,t,e,i){let n=bs(s),o=qt(n,"margin"),a=as(n.maxWidth,s,"clientWidth")||ns,r=as(n.maxHeight,s,"clientHeight")||ns,l=el(s,t,e),{width:c,height:h}=l;if(n.boxSizing==="content-box"){let u=qt(n,"border","width"),f=qt(n,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,i?c/i:h-o.height),c=zt(Math.min(c,a,l.maxWidth)),h=zt(Math.min(h,r,l.maxHeight)),c&&!h&&(h=zt(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&h>l.height&&(h=l.height,c=zt(Math.floor(h*i))),{width:c,height:h}}function _i(s,t,e){let i=t||1,n=zt(s.height*i),o=zt(s.width*i);s.height=zt(s.height),s.width=zt(s.width);let a=s.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${s.height}px`,a.style.width=`${s.width}px`),s.currentDevicePixelRatio!==i||a.height!==n||a.width!==o?(s.currentDevicePixelRatio=i,a.height=n,a.width=o,s.ctx.setTransform(i,0,0,i,0,0),!0):!1}var eo=function(){let s=!1;try{let t={get passive(){return s=!0,!1}};gs()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return s}();function yi(s,t){let e=Jr(s,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Ft(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:s.y+e*(t.y-s.y)}}function so(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:i==="middle"?e<.5?s.y:t.y:i==="after"?e<1?s.y:t.y:e>0?t.y:s.y}}function io(s,t,e,i){let n={x:s.cp2x,y:s.cp2y},o={x:t.cp1x,y:t.cp1y},a=Ft(s,n,e),r=Ft(n,o,e),l=Ft(o,t,e),c=Ft(a,r,e),h=Ft(r,l,e);return Ft(c,h,e)}var sl=function(s,t){return{x(e){return s+s+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},il=function(){return{x(s){return s},setWidth(s){},textAlign(s){return s},xPlus(s,t){return s+t},leftForLtr(s,t){return s}}};function Jt(s,t,e){return s?sl(t,e):il()}function vi(s,t){let e,i;(t==="ltr"||t==="rtl")&&(e=s.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),s.prevTextDirection=i)}function wi(s,t){t!==void 0&&(delete s.prevTextDirection,s.canvas.style.setProperty("direction",t[0],t[1]))}function no(s){return s==="angle"?{between:de,compare:yr,normalize:G}:{between:mt,compare:(t,e)=>t-e,normalize:t=>t}}function Dn({start:s,end:t,count:e,loop:i,style:n}){return{start:s%e,end:t%e,loop:i&&(t-s+1)%e===0,style:n}}function nl(s,t,e){let{property:i,start:n,end:o}=e,{between:a,normalize:r}=no(i),l=t.length,{start:c,end:h,loop:d}=s,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&a(r(t[c%l][i]),n,o);++u)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:s.style}}function ki(s,t,e){if(!e)return[s];let{property:i,start:n,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=no(i),{start:h,end:d,loop:u,style:f}=nl(s,t,e),p=[],g=!1,m=null,b,x,v,y=()=>l(n,v,b)&&r(n,v)!==0,_=()=>r(o,b)===0||l(o,v,b),w=()=>g||y(),k=()=>!g||_();for(let M=h,S=h;M<=d;++M)x=t[M%a],!x.skip&&(b=c(x[i]),b!==v&&(g=l(b,n,o),m===null&&w()&&(m=r(b,n)===0?M:S),m!==null&&k()&&(p.push(Dn({start:m,end:M,loop:u,count:a,style:f})),m=null),S=M,v=b));return m!==null&&p.push(Dn({start:m,end:d,loop:u,count:a,style:f})),p}function Mi(s,t){let e=[],i=s.segments;for(let n=0;n<i.length;n++){let o=ki(i[n],s.points,t);o.length&&e.push(...o)}return e}function ol(s,t,e,i){let n=0,o=t-1;if(e&&!i)for(;n<t&&!s[n].skip;)n++;for(;n<t&&s[n].skip;)n++;for(n%=t,e&&(o+=n);o>n&&s[o%t].skip;)o--;return o%=t,{start:n,end:o}}function al(s,t,e,i){let n=s.length,o=[],a=t,r=s[t],l;for(l=t+1;l<=e;++l){let c=s[l%n];c.skip||c.stop?r.skip||(i=!1,o.push({start:t%n,end:(l-1)%n,loop:i}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%n,end:a%n,loop:i}),o}function oo(s,t){let e=s.points,i=s.options.spanGaps,n=e.length;if(!n)return[];let o=!!s._loop,{start:a,end:r}=ol(e,n,o,i);if(i===!0)return An(s,[{start:a,end:r,loop:o}],e,t);let l=r<a?r+n:r,c=!!s._fullLoop&&a===0&&r===n-1;return An(s,al(e,a,l,c),e,t)}function An(s,t,e,i){return!i||!i.setContext||!e?t:rl(s,t,e,i)}function rl(s,t,e,i){let n=s._chart.getContext(),o=On(s.options),{_datasetIndex:a,options:{spanGaps:r}}=s,l=e.length,c=[],h=o,d=t[0].start,u=d;function f(p,g,m,b){let x=r?-1:1;if(p!==g){for(p+=l;e[p%l].skip;)p-=x;for(;e[g%l].skip;)g+=x;p%l!==g%l&&(c.push({start:p%l,end:g%l,loop:m,style:b}),h=b,d=g%l)}}for(let p of t){d=r?d:p.start;let g=e[d%l],m;for(u=d+1;u<=p.end;u++){let b=e[u%l];m=On(i.setContext(Pt(n,{type:"segment",p0:g,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),ll(m,h)&&f(d,u-1,p.loop,h),g=b,h=m}d<u-1&&f(d,u-1,p.loop,h)}return c}function On(s){return{backgroundColor:s.backgroundColor,borderCapStyle:s.borderCapStyle,borderDash:s.borderDash,borderDashOffset:s.borderDashOffset,borderJoinStyle:s.borderJoinStyle,borderWidth:s.borderWidth,borderColor:s.borderColor}}function ll(s,t){if(!t)return!1;let e=[],i=function(n,o){return hi(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(s,i)!==JSON.stringify(t,i)}function ss(s,t,e){return s.options.clip?s[e]:t[e]}function cl(s,t){let{xScale:e,yScale:i}=s;return e&&i?{left:ss(e,t,"left"),right:ss(e,t,"right"),top:ss(i,t,"top"),bottom:ss(i,t,"bottom")}:t}function Si(s,t){let e=t._clip;if(e.disabled)return!1;let i=cl(t,s.chartArea);return{left:e.left===!1?0:i.left-(e.left===!0?0:e.left),right:e.right===!1?s.width:i.right+(e.right===!0?0:e.right),top:e.top===!1?0:i.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?s.height:i.bottom+(e.bottom===!0?0:e.bottom)}}var zi=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){let o=e.listeners[n],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=ai.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;let o=i.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},Ct=new zi,ao="transparent",hl={boolean(s,t,e){return e>.5?t:s},color(s,t,e){let i=di(s||ao),n=i.valid&&di(t||ao);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}},Bi=class{constructor(t,e,i,n){let o=e[i];n=pe([t.to,n,o,t.from]);let a=pe([t.from,o,n]);this._active=!0,this._fn=t.fn||hl[t.type||typeof a],this._easing=oe[t.easing]||oe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let n=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=pe([t.to,e,n,t.from]),this._from=pe([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e<i),!this._active){this._target[n]=r,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let n=0;n<i.length;n++)i[n][e]()}},Ps=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!T(t))return;let e=Object.keys(B.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{let o=t[n];if(!T(o))return;let a={};for(let r of e)a[r]=o[r];(F(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){let i=e.options,n=ul(t,i);if(!n)return[];let o=this._createAnimations(n,i);return i.$shared&&dl(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}let h=e[c],d=o[c],u=i.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new Bi(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return Ct.add(this._chart,i),!0}};function dl(s,t){let e=[],i=Object.keys(t);for(let n=0;n<i.length;n++){let o=s[i[n]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function ul(s,t){if(!t)return;let e=s.options;if(!e){s.options=t;return}return e.$shared&&(s.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function ro(s,t){let e=s&&s.options||{},i=e.reverse,n=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:i?o:n,end:i?n:o}}function fl(s,t,e){if(e===!1)return!1;let i=ro(s,e),n=ro(t,e);return{top:n.end,right:i.end,bottom:n.start,left:i.start}}function pl(s){let t,e,i,n;return T(s)?(t=s.top,e=s.right,i=s.bottom,n=s.left):t=e=i=n=s,{top:t,right:e,bottom:i,left:n,disabled:s===!1}}function aa(s,t){let e=[],i=s._getSortedDatasetMetas(t),n,o;for(n=0,o=i.length;n<o;++n)e.push(i[n].index);return e}function lo(s,t,e,i={}){let n=s.keys,o=i.mode==="single",a,r,l,c;if(t===null)return;let h=!1;for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===e){if(h=!0,i.all)continue;break}c=s.values[l],H(c)&&(o||t===0||dt(t)===dt(c))&&(t+=c)}return!h&&!i.all?0:t}function gl(s,t){let{iScale:e,vScale:i}=t,n=e.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",a=Object.keys(s),r=new Array(a.length),l,c,h;for(l=0,c=a.length;l<c;++l)h=a[l],r[l]={[n]:h,[o]:s[h]};return r}function Pi(s,t){let e=s&&s.options.stacked;return e||e===void 0&&t.stack!==void 0}function ml(s,t,e){return`${s.id}.${t.id}.${e.stack||e.type}`}function bl(s){let{min:t,max:e,minDefined:i,maxDefined:n}=s.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}function xl(s,t,e){let i=s[t]||(s[t]={});return i[e]||(i[e]={})}function co(s,t,e,i){for(let n of t.getMatchingVisibleMetas(i).reverse()){let o=s[n.index];if(e&&o>0||!e&&o<0)return n.index}return null}function ho(s,t){let{chart:e,_cachedMeta:i}=s,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,h=ml(o,a,i),d=t.length,u;for(let f=0;f<d;++f){let p=t[f],{[l]:g,[c]:m}=p,b=p._stacks||(p._stacks={});u=b[c]=xl(n,h,g),u[r]=m,u._top=co(u,a,!0,i.type),u._bottom=co(u,a,!1,i.type);let x=u._visualValues||(u._visualValues={});x[r]=m}}function Ci(s,t){let e=s.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function _l(s,t){return Pt(s,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function yl(s,t,e){return Pt(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Re(s,t){let e=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){t=t||s._parsed;for(let n of t){let o=n._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}var Di=s=>s==="reset"||s==="none",uo=(s,t)=>t?s:Object.assign({},s),vl=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:aa(e,!0),values:null},_t=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Pi(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&&Re(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(d,u,f,p)=>d==="x"?u:d==="r"?p:f,o=e.xAxisID=D(i.xAxisID,Ci(t,"x")),a=e.yAxisID=D(i.yAxisID,Ci(t,"y")),r=e.rAxisID=D(i.rAxisID,Ci(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&ni(this._data,this),t._stacked&&Re(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(T(e)){let n=this._cachedMeta;this._data=gl(e,n)}else if(i!==e){if(i){ni(i,this);let n=this._cachedMeta;Re(n),n._parsed=[]}e&&Object.isExtensible(e)&&Vn(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),n=!1;this._dataCheck();let o=e._stacked;e._stacked=Pi(e.vScale,e),e.stack!==i.stack&&(n=!0,Re(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(ho(this,e._parsed),e._stacked=Pi(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:a}=i,r=o.axis,l=t===0&&e===n.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,d,u;if(this._parsing===!1)i._parsed=n,i._sorted=!0,u=n;else{F(n[t])?u=this.parseArrayData(i,n,t,e):T(n[t])?u=this.parseObjectData(i,n,t,e):u=this.parsePrimitiveData(i,n,t,e);let f=()=>d[r]===null||c&&d[r]<c[r];for(h=0;h<e;++h)i._parsed[h+t]=d=u[h],l&&(f()&&(l=!1),c=d);i._sorted=l}a&&ho(this,u)}parsePrimitiveData(t,e,i,n){let{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),h=o===a,d=new Array(n),u,f,p;for(u=0,f=n;u<f;++u)p=u+i,d[u]={[r]:h||o.parse(c[p],p),[l]:a.parse(e[p],p)};return d}parseArrayData(t,e,i,n){let{xScale:o,yScale:a}=t,r=new Array(n),l,c,h,d;for(l=0,c=n;l<c;++l)h=l+i,d=e[h],r[l]={x:o.parse(d[0],h),y:a.parse(d[1],h)};return r}parseObjectData(t,e,i,n){let{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(n),h,d,u,f;for(h=0,d=n;h<d;++h)u=h+i,f=e[u],c[h]={x:o.parse(St(f,r),u),y:a.parse(St(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let n=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:aa(n,!0),values:e._stacks[t.axis]._visualValues};return lo(r,a,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){let o=i[e.axis],a=o===null?NaN:o,r=n&&i._stacks[e.axis];n&&r&&(n.values=r,a=lo(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,a=n.length,r=this._getOtherScale(t),l=vl(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=bl(r),u,f;function p(){f=n[u];let g=f[r.axis];return!H(f[t.axis])||h>g||d<g}for(u=0;u<a&&!(!p()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!p()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],n,o,a;for(n=0,o=e.length;n<o;++n)a=e[n][t.axis],H(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=pl(D(this.options.clip,fl(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||n.length-r,c=this.options.drawActiveElementsOnTop,h;for(i.dataset&&i.dataset.draw(t,o,r,l),h=r;h<r+l;++h){let d=n[h];d.hidden||(d.active&&c?a.push(d):d.draw(t,o))}for(h=0;h<a.length;++h)a[h].draw(t,o)}getStyle(t,e){let i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){let n=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];o=a.$context||(a.$context=yl(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=_l(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){let n=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&ce(i);if(r)return uo(r,l);let c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),h),f=Object.keys(B.elements[t]),p=()=>this.getContext(i,n,e),g=c.resolveNamedOptions(u,f,p,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(uo(g,l))),g}_resolveAnimations(t,e,i){let n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){let h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,i,e))}let c=new Ps(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Di(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,n){Di(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Di(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;let o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];let n=i.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){let n=this._cachedMeta,o=n.data,a=t+e,r,l=c=>{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let n=i._parsed.splice(t,e);i._stacked&&Re(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};function wl(s,t){if(!s._cache.$bar){let e=s.getMatchingVisibleMetas(t),i=[];for(let n=0,o=e.length;n<o;n++)i=i.concat(e[n].controller.getAllParsedValues(s));s._cache.$bar=oi(i.sort((n,o)=>n-o))}return s._cache.$bar}function kl(s){let t=s.iScale,e=wl(t,s.type),i=t._length,n,o,a,r,l=()=>{a===32767||a===-32768||(ce(r)&&(i=Math.min(i,Math.abs(a-r)||i)),r=a)};for(n=0,o=e.length;n<o;++n)a=t.getPixelForValue(e[n]),l();for(r=void 0,n=0,o=t.ticks.length;n<o;++n)a=t.getPixelForTick(n),l();return i}function Ml(s,t,e,i){let n=e.barThickness,o,a;return O(n)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=n*i,a=1),{chunk:o/i,ratio:a,start:t.pixels[s]-o/2}}function Sl(s,t,e,i){let n=t.pixels,o=n[s],a=s>0?n[s-1]:null,r=s<n.length-1?n[s+1]:null,l=e.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);let c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/i,ratio:e.barPercentage,start:c}}function Pl(s,t,e,i){let n=e.parse(s[0],i),o=e.parse(s[1],i),a=Math.min(n,o),r=Math.max(n,o),l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function ra(s,t,e,i){return F(s)?Pl(s,t,e,i):t[e.axis]=e.parse(s,i),t}function fo(s,t,e,i){let n=s.iScale,o=s.vScale,a=n.getLabels(),r=n===o,l=[],c,h,d,u;for(c=e,h=e+i;c<h;++c)u=t[c],d={},d[n.axis]=r||n.parse(a[c],c),l.push(ra(u,d,o,c));return l}function Ai(s){return s&&s.barStart!==void 0&&s.barEnd!==void 0}function Cl(s,t,e){return s!==0?dt(s):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Dl(s){let t,e,i,n,o;return s.horizontal?(t=s.base>s.x,e="left",i="right"):(t=s.base<s.y,e="bottom",i="top"),t?(n="end",o="start"):(n="start",o="end"),{start:e,end:i,reverse:t,top:n,bottom:o}}function Al(s,t,e,i){let n=t.borderSkipped,o={};if(!n){s.borderSkipped=o;return}if(n===!0){s.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:a,end:r,reverse:l,top:c,bottom:h}=Dl(s);n==="middle"&&e&&(s.enableBorderRadius=!0,(e._top||0)===i?n=c:(e._bottom||0)===i?n=h:(o[po(h,a,r,l)]=!0,n=c)),o[po(n,a,r,l)]=!0,s.borderSkipped=o}function po(s,t,e,i){return i?(s=Ol(s,t,e),s=go(s,e,t)):s=go(s,t,e),s}function Ol(s,t,e){return s===t?e:s===e?t:s}function go(s,t,e){return s==="start"?t:s==="end"?e:s}function Tl(s,{inflateAmount:t},e){s.inflateAmount=t==="auto"?e===1?.33:0:t}var $i=class extends _t{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,n){return fo(t,e,i,n)}parseArrayData(t,e,i,n){return fo(t,e,i,n)}parseObjectData(t,e,i,n){let{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,h=a.axis==="x"?r:l,d=[],u,f,p,g;for(u=i,f=i+n;u<f;++u)g=e[u],p={},p[o.axis]=o.parse(St(g,c),u),d.push(ra(St(g,h),p,a,u));return d}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);let o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),a=o._custom,r=Ai(a)?"["+a.start+", "+a.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){let o=n==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+i;f++){let p=this.getParsed(f),g=o||O(p[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,h),b=(p._stacks||{})[r.axis],x={horizontal:c,base:g.base,enableBorderRadius:!b||Ai(p._custom)||a===b._top||a===b._bottom,x:c?g.head:m.center,y:c?m.center:g.head,height:c?m.size:Math.abs(g.size),width:c?Math.abs(g.size):m.size};u&&(x.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));let v=x.options||t[f].options;Al(x,v,b,a),Tl(x,v,h.ratio),this.updateElement(t[f],f,x,n)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],c=h=>{let d=h._parsed.find(f=>f[i.axis]===l),u=d&&d[h.vScale.axis];if(O(u)||isNaN(u))return!0};for(let h of n)if(!(e!==void 0&&c(h))&&((o===!1||a.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[D(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let n=this._getStacks(t,i),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,n=[],o,a;for(o=0,a=e.data.length;o<a;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));let r=t.barThickness;return{min:r||kl(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,h=Ai(c),d=l[e.axis],u=0,f=i?this.applyStack(e,l,i):d,p,g;f!==d&&(u=f-d,f=d),h&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&dt(d)!==dt(c.barEnd)&&(u=0),u+=d);let m=!O(o)&&!h?o:u,b=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(u+f):p=b,g=p-b,Math.abs(g)<a){g=Cl(g,e,r)*a,d===r&&(b-=g/2);let x=e.getPixelForDecimal(0),v=e.getPixelForDecimal(1),y=Math.min(x,v),_=Math.max(x,v);b=Math.max(Math.min(b,_),y),p=b+g,i&&!h&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(p)-e.getValueForPixel(b))}if(b===e.getPixelForValue(r)){let x=dt(g)*e.getLineWidthForValue(r)/2;b+=x,g-=x}return{size:g,base:b,head:p,center:p+g/2}}_calculateBarIndexPixels(t,e){let i=e.scale,n=this.options,o=n.skipNull,a=D(n.maxBarThickness,1/0),r,l,c=this._getAxisCount();if(e.grouped){let h=o?this._getStackCount(t):e.stackCount,d=n.barThickness==="flex"?Sl(t,e,n,h*c):Ml(t,e,n,h*c),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(D(u,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=d.start+d.chunk*p+d.chunk/2,l=Math.min(a,d.chunk*d.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){let t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length,o=0;for(;o<n;++o)this.getParsed(o)[e.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}},Ni=class extends _t{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,n){let o=super.parsePrimitiveData(t,e,i,n);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+i).radius;return o}parseArrayData(t,e,i,n){let o=super.parseArrayData(t,e,i,n);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=D(r[2],this.resolveDataElementOptions(a+i).radius)}return o}parseObjectData(t,e,i,n){let o=super.parseObjectData(t,e,i,n);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=D(r&&r.r&&+r.r,this.resolveDataElementOptions(a+i).radius)}return o}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,n),h=a.axis,d=r.axis;for(let u=e;u<e+i;u++){let f=t[u],p=!o&&this.getParsed(u),g={},m=g[h]=o?a.getPixelForDecimal(.5):a.getPixelForValue(p[h]),b=g[d]=o?r.getBasePixel():r.getPixelForValue(p[d]);g.skip=isNaN(m)||isNaN(b),c&&(g.options=l||this.resolveDataElementOptions(u,f.active?"active":n),o&&(g.options.radius=0)),this.updateElement(f,u,g,n)}}resolveDataElementOptions(t,e){let i=this.getParsed(t),n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));let o=n.radius;return e!=="active"&&(n.radius=0),n.radius+=D(i&&i._custom,o),n}};function Ll(s,t,e){let i=1,n=1,o=0,a=0;if(t<z){let r=s,l=r+t,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(v,y,_)=>de(v,r,l,!0)?1:Math.max(y,y*e,_,_*e),p=(v,y,_)=>de(v,r,l,!0)?-1:Math.min(y,y*e,_,_*e),g=f(0,c,d),m=f(W,h,u),b=p(L,c,d),x=p(L+W,h,u);i=(g-b)/2,n=(m-x)/2,o=-(g+b)/2,a=-(m+x)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:a}}var Ve=class extends _t{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{let d=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:n,pointStyle:i,borderRadius:a&&(r||d.borderRadius),index:c}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=i;else{let o=l=>+i[l];if(T(i[t])){let{key:l="value"}=this._parsing;o=c=>+St(i[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)n._parsed[a]=o(a)}}_getRotation(){return ct(this.options.rotation-90)}_getCircumference(){return ct(this.options.circumference)}_getRotationExtents(){let t=z,e=-z;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){let n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),a=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){let e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(Ln(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:p,offsetY:g}=Ll(d,h,l),m=(i.width-a)/u,b=(i.height-a)/f,x=Math.max(Math.min(m,b)/2,0),v=Zs(this.options.radius,x),y=Math.max(v*l,0),_=(v-y)/this._getVisibleDatasetWeightTotal();this.offsetX=p*v,this.offsetY=g*v,n.total=this.calculateTotal(),this.outerRadius=v-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){let i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||n._parsed[t]===null||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/z)}updateElements(t,e,i,n){let o=n==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,h=(r.left+r.right)/2,d=(r.top+r.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,p=u?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(e,n),b=this._getRotation(),x;for(x=0;x<e;++x)b+=this._circumference(x,o);for(x=e;x<e+i;++x){let v=this._circumference(x,o),y=t[x],_={x:h+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+v,circumference:v,outerRadius:p,innerRadius:f};m&&(_.options=g||this.resolveDataElementOptions(x,y.active?"active":n)),b+=v,this.updateElement(y,x,_,n)}}calculateTotal(){let t=this._cachedMeta,e=t.data,i=0,n;for(n=0;n<e.length;n++){let o=t._parsed[n];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(n)&&!e[n].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?z*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=ue(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,n,o,a,r,l;if(!t){for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){a=i.getDatasetMeta(n),t=a.data,r=a.controller;break}}if(!t)return 0;for(n=0,o=t.length;n<o;++n)l=r.resolveDataElementOptions(n),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){let o=this.resolveDataElementOptions(i);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(D(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},Vi=class extends _t{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=li(e,n,a);this._drawStart=r,this._drawCount=l,ci(e)&&(r=0,l=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(n,r,l,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=r.axis,{spanGaps:p,segment:g}=this.options,m=Gt(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||n==="none",x=e+i,v=t.length,y=e>0&&this.getParsed(e-1);for(let _=0;_<v;++_){let w=t[_],k=b?w:{};if(_<e||_>=x){k.skip=!0;continue}let M=this.getParsed(_),S=O(M[f]),P=k[u]=a.getPixelForValue(M[u],_),C=k[f]=o||S?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,M,l):M[f],_);k.skip=isNaN(P)||isNaN(C)||S,k.stop=_>0&&Math.abs(M[u]-y[u])>m,g&&(k.parsed=M,k.raw=c.data[_]),d&&(k.options=h||this.resolveDataElementOptions(_,w.active?"active":n)),b||this.updateElement(w,_,k,n),y=M}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;let o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},Cs=class extends _t{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map((o,a)=>{let l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=ue(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return xi.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,n)=>{let o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,n){let o=n==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,u=c.getIndexAngle(0)-.5*L,f=u,p,g=360/this.countVisibleElements();for(p=0;p<e;++p)f+=this._computeAngle(p,n,g);for(p=e;p<e+i;p++){let m=t[p],b=f,x=f+this._computeAngle(p,n,g),v=a.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=x,o&&(l.animateScale&&(v=0),l.animateRotate&&(b=x=u));let y={x:h,y:d,innerRadius:0,outerRadius:v,startAngle:b,endAngle:x,options:this.resolveDataElementOptions(p,m.active?"active":n)};this.updateElement(m,p,y,n)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((i,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?ct(this.resolveDataElementOptions(t,e).angle||i):0}},Hi=class extends Ve{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},Wi=class extends _t{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return xi.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let r={_loop:!0,_fullLoop:o.length===n.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){let o=this._cachedMeta.rScale,a=n==="reset";for(let r=e;r<e+i;r++){let l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":n),h=o.getPointPositionForValue(r,this.getParsed(r).r),d=a?o.xCenter:h.x,u=a?o.yCenter:h.y,f={x:d,y:u,angle:h.angle,skip:isNaN(d)||isNaN(u),options:c};this.updateElement(l,r,f,n)}}},ji=class extends _t{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:i[t]||"",value:"("+r+", "+l+")"}}update(t){let e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled,{start:o,count:a}=li(e,i,n);if(this._drawStart=o,this._drawCount=a,ci(e)&&(o=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:r,_dataset:l}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=i;let c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!n,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(h),u=this.includeOptions(n,d),f=a.axis,p=r.axis,{spanGaps:g,segment:m}=this.options,b=Gt(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||n==="none",v=e>0&&this.getParsed(e-1);for(let y=e;y<e+i;++y){let _=t[y],w=this.getParsed(y),k=x?_:{},M=O(w[p]),S=k[f]=a.getPixelForValue(w[f],y),P=k[p]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,w,l):w[p],y);k.skip=isNaN(S)||isNaN(P)||M,k.stop=y>0&&Math.abs(w[f]-v[f])>b,m&&(k.parsed=w,k.raw=c.data[y]),u&&(k.options=d||this.resolveDataElementOptions(y,_.active?"active":n)),x||this.updateElement(_,y,k,n),v=w}this.updateSharedOptions(d,n,h)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}let i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;let o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,a)/2}},El=Object.freeze({__proto__:null,BarController:$i,BubbleController:Ni,DoughnutController:Ve,LineController:Vi,PieController:Hi,PolarAreaController:Cs,RadarController:Wi,ScatterController:ji});function Zt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Yi=class s{static override(t){Object.assign(s.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Zt()}parse(){return Zt()}format(){return Zt()}add(){return Zt()}diff(){return Zt()}startOf(){return Zt()}endOf(){return Zt()}},Rl={_date:Yi};function Il(s,t,e,i){let{controller:n,data:o,_sorted:a}=s,r=n._cachedMeta.iScale,l=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){let c=r._reversePixels?Bn:ft;if(i){if(n._sharedOptions){let h=o[0],d=typeof h.getRange=="function"&&h.getRange(t);if(d){let u=c(o,t,e-d),f=c(o,t,e+d);return{lo:u.lo,hi:f.hi}}}}else{let h=c(o,t,e);if(l){let{vScale:d}=n._cachedMeta,{_parsed:u}=s,f=u.slice(0,h.lo+1).reverse().findIndex(g=>!O(g[d.axis]));h.lo-=Math.max(0,f);let p=u.slice(h.hi).findIndex(g=>!O(g[d.axis]));h.hi+=Math.max(0,p)}return h}}return{lo:0,hi:o.length-1}}function Ue(s,t,e,i,n){let o=s.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r<l;++r){let{index:c,data:h}=o[r],{lo:d,hi:u}=Il(o[r],t,a,n);for(let f=d;f<=u;++f){let p=h[f];p.skip||i(p,c,f)}}}function Fl(s){let t=s.indexOf("x")!==-1,e=s.indexOf("y")!==-1;return function(i,n){let o=t?Math.abs(i.x-n.x):0,a=e?Math.abs(i.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Oi(s,t,e,i,n){let o=[];return!n&&!s.isPointInArea(t)||Ue(s,e,t,function(r,l,c){!n&&!pt(r,s.chartArea,0)||r.inRange(t.x,t.y,i)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function zl(s,t,e,i){let n=[];function o(a,r,l){let{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],i),{angle:d}=ii(a,{x:t.x,y:t.y});de(d,c,h)&&n.push({element:a,datasetIndex:r,index:l})}return Ue(s,e,t,o),n}function Bl(s,t,e,i,n,o){let a=[],r=Fl(e),l=Number.POSITIVE_INFINITY;function c(h,d,u){let f=h.inRange(t.x,t.y,n);if(i&&!f)return;let p=h.getCenterPoint(n);if(!(!!o||s.isPointInArea(p))&&!f)return;let m=r(t,p);m<l?(a=[{element:h,datasetIndex:d,index:u}],l=m):m===l&&a.push({element:h,datasetIndex:d,index:u})}return Ue(s,e,t,c),a}function Ti(s,t,e,i,n,o){return!o&&!s.isPointInArea(t)?[]:e==="r"&&!i?zl(s,t,e,n):Bl(s,t,e,i,n,o)}function mo(s,t,e,i,n){let o=[],a=e==="x"?"inXRange":"inYRange",r=!1;return Ue(s,e,t,(l,c,h)=>{l[a]&&l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,n))}),i&&!r?[]:o}var $l={evaluateInteractionItems:Ue,modes:{index(s,t,e,i){let n=Ht(t,s),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?Oi(s,n,o,i,a):Ti(s,n,o,!1,i,a),l=[];return r.length?(s.getSortedVisibleDatasetMetas().forEach(c=>{let h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(s,t,e,i){let n=Ht(t,s),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?Oi(s,n,o,i,a):Ti(s,n,o,!1,i,a);if(r.length>0){let l=r[0].datasetIndex,c=s.getDatasetMeta(l).data;r=[];for(let h=0;h<c.length;++h)r.push({element:c[h],datasetIndex:l,index:h})}return r},point(s,t,e,i){let n=Ht(t,s),o=e.axis||"xy",a=e.includeInvisible||!1;return Oi(s,n,o,i,a)},nearest(s,t,e,i){let n=Ht(t,s),o=e.axis||"xy",a=e.includeInvisible||!1;return Ti(s,n,o,e.intersect,i,a)},x(s,t,e,i){let n=Ht(t,s);return mo(s,n,"x",e.intersect,i)},y(s,t,e,i){let n=Ht(t,s);return mo(s,n,"y",e.intersect,i)}}},la=["left","top","right","bottom"];function Ie(s,t){return s.filter(e=>e.pos===t)}function bo(s,t){return s.filter(e=>la.indexOf(e.pos)===-1&&e.box.axis===t)}function Fe(s,t){return s.sort((e,i)=>{let n=t?i:e,o=t?e:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Nl(s){let t=[],e,i,n,o,a,r;for(e=0,i=(s||[]).length;e<i;++e)n=s[e],{position:o,options:{stack:a,stackWeight:r=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return t}function Vl(s){let t={};for(let e of s){let{stack:i,pos:n,stackWeight:o}=e;if(!i||!la.includes(n))continue;let a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function Hl(s,t){let e=Vl(s),{vBoxMaxWidth:i,hBoxMaxHeight:n}=t,o,a,r;for(o=0,a=s.length;o<a;++o){r=s[o];let{fullSize:l}=r.box,c=e[r.stack],h=c&&r.stackWeight/c.weight;r.horizontal?(r.width=h?h*i:l&&t.availableWidth,r.height=n):(r.width=i,r.height=h?h*n:l&&t.availableHeight)}return e}function Wl(s){let t=Nl(s),e=Fe(t.filter(c=>c.box.fullSize),!0),i=Fe(Ie(t,"left"),!0),n=Fe(Ie(t,"right")),o=Fe(Ie(t,"top"),!0),a=Fe(Ie(t,"bottom")),r=bo(t,"x"),l=bo(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Ie(t,"chartArea"),vertical:i.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function xo(s,t,e,i){return Math.max(s[e],t[e])+Math.max(s[i],t[i])}function ca(s,t){s.top=Math.max(s.top,t.top),s.left=Math.max(s.left,t.left),s.bottom=Math.max(s.bottom,t.bottom),s.right=Math.max(s.right,t.right)}function jl(s,t,e,i){let{pos:n,box:o}=e,a=s.maxPadding;if(!T(n)){e.size&&(s[n]-=e.size);let d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,s[n]+=e.size}o.getPadding&&ca(a,o.getPadding());let r=Math.max(0,t.outerWidth-xo(a,s,"left","right")),l=Math.max(0,t.outerHeight-xo(a,s,"top","bottom")),c=r!==s.w,h=l!==s.h;return s.w=r,s.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Yl(s){let t=s.maxPadding;function e(i){let n=Math.max(t[i]-s[i],0);return s[i]+=n,n}s.y+=e("top"),s.x+=e("left"),e("right"),e("bottom")}function Ul(s,t){let e=t.maxPadding;function i(n){let o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return i(s?["left","right"]:["top","bottom"])}function $e(s,t,e,i){let n=[],o,a,r,l,c,h;for(o=0,a=s.length,c=0;o<a;++o){r=s[o],l=r.box,l.update(r.width||t.w,r.height||t.h,Ul(r.horizontal,t));let{same:d,other:u}=jl(t,e,r,i);c|=d&&n.length,h=h||u,l.fullSize||n.push(r)}return c&&$e(n,t,e,i)||h}function xs(s,t,e,i,n){s.top=e,s.left=t,s.right=t+i,s.bottom=e+n,s.width=i,s.height=n}function _o(s,t,e,i){let n=e.padding,{x:o,y:a}=t;for(let r of s){let l=r.box,c=i[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/c.weight||1;if(r.horizontal){let d=t.w*h,u=c.size||l.height;ce(c.start)&&(a=c.start),l.fullSize?xs(l,n.left,a,e.outerWidth-n.right-n.left,u):xs(l,t.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom}else{let d=t.h*h,u=c.size||l.width;ce(c.start)&&(o=c.start),l.fullSize?xs(l,o,n.top,u,e.outerHeight-n.bottom-n.top):xs(l,o,t.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=a}var tt={addBox(s,t){s.boxes||(s.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},s.boxes.push(t)},removeBox(s,t){let e=s.boxes?s.boxes.indexOf(t):-1;e!==-1&&s.boxes.splice(e,1)},configure(s,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(s,t,e,i){if(!s)return;let n=Z(s.options.layout.padding),o=Math.max(t-n.width,0),a=Math.max(e-n.height,0),r=Wl(s.boxes),l=r.vertical,c=r.horizontal;E(s.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});let h=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);ca(u,Z(i));let f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),p=Hl(l.concat(c),d);$e(r.fullSize,f,d,p),$e(l,f,d,p),$e(c,f,d,p)&&$e(l,f,d,p),Yl(f),_o(r.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,_o(r.rightAndBottom,f,d,p),s.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},E(r.chartArea,g=>{let m=g.box;Object.assign(m,s.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},Ds=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}},Ui=class extends Ds{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Ms="$chartjs",Xl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},yo=s=>s===null||s==="";function ql(s,t){let e=s.style,i=s.getAttribute("height"),n=s.getAttribute("width");if(s[Ms]={initial:{height:i,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",yo(n)){let o=yi(s,"width");o!==void 0&&(s.width=o)}if(yo(i))if(s.style.height==="")s.height=s.width/(t||2);else{let o=yi(s,"height");o!==void 0&&(s.height=o)}return s}var ha=eo?{passive:!0}:!1;function Kl(s,t,e){s&&s.addEventListener(t,e,ha)}function Gl(s,t,e){s&&s.canvas&&s.canvas.removeEventListener(t,e,ha)}function Jl(s,t){let e=Xl[s.type]||s.type,{x:i,y:n}=Ht(s,t);return{type:e,chart:t,native:s,x:i!==void 0?i:null,y:n!==void 0?n:null}}function As(s,t){for(let e of s)if(e===t||e.contains(t))return!0}function Zl(s,t,e){let i=s.canvas,n=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||As(r.addedNodes,i),a=a&&!As(r.removedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Ql(s,t,e){let i=s.canvas,n=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||As(r.removedNodes,i),a=a&&!As(r.addedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}var He=new Map,vo=0;function da(){let s=window.devicePixelRatio;s!==vo&&(vo=s,He.forEach((t,e)=>{e.currentDevicePixelRatio!==s&&t()}))}function tc(s,t){He.size||window.addEventListener("resize",da),He.set(s,t)}function ec(s){He.delete(s),He.size||window.removeEventListener("resize",da)}function sc(s,t,e){let i=s.canvas,n=i&&ms(i);if(!n)return;let o=ri((r,l)=>{let c=n.clientWidth;e(r,l),c<n.clientWidth&&e()},window),a=new ResizeObserver(r=>{let l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),tc(s,o),a}function Li(s,t,e){e&&e.disconnect(),t==="resize"&&ec(s)}function ic(s,t,e){let i=s.canvas,n=ri(o=>{s.ctx!==null&&e(Jl(o,s))},s);return Kl(i,t,n),n}var Xi=class extends Ds{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(ql(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[Ms])return!1;let i=e[Ms].initial;["height","width"].forEach(o=>{let a=i[o];O(a)?e.removeAttribute(o):e.setAttribute(o,a)});let n=i.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Ms],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let n=t.$proxies||(t.$proxies={}),a={attach:Zl,detach:Ql,resize:sc}[e]||ic;n[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:Li,detach:Li,resize:Li}[e]||Gl)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return to(t,e,i,n)}isAttached(t){let e=t&&ms(t);return!!(e&&e.isConnected)}};function nc(s){return!gs()||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?Ui:Xi}var ut=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Gt(this.x)&&Gt(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let n={};return t.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}};function oc(s,t){let e=s.options.ticks,i=ac(s),n=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?lc(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return cc(t,c,o,a/n),c;let h=rc(o,t,n);if(a>0){let d,u,f=a>1?Math.round((l-r)/(a-1)):null;for(_s(t,c,h,O(f)?0:r-f,r),d=0,u=a-1;d<u;d++)_s(t,c,h,o[d],o[d+1]);return _s(t,c,h,l,O(f)?t.length:l+f),c}return _s(t,c,h),c}function ac(s){let t=s.options.offset,e=s._tickSize(),i=s._length/e+(t?0:1),n=s._maxLength/e;return Math.floor(Math.min(i,n))}function rc(s,t,e){let i=hc(s),n=t.length/e;if(!i)return Math.max(n,1);let o=In(i);for(let a=0,r=o.length-1;a<r;a++){let l=o[a];if(l>n)return l}return Math.max(n,1)}function lc(s){let t=[],e,i;for(e=0,i=s.length;e<i;e++)s[e].major&&t.push(e);return t}function cc(s,t,e,i){let n=0,o=e[0],a;for(i=Math.ceil(i),a=0;a<s.length;a++)a===o&&(t.push(s[a]),n++,o=e[n*i])}function _s(s,t,e,i,n){let o=D(i,0),a=Math.min(D(n,s.length),s.length),r=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-i,e=l/Math.floor(l/e)),h=o;h<0;)r++,h=Math.round(o+r*e);for(c=Math.max(o,0);c<a;c++)c===h&&(t.push(s[c]),r++,h=Math.round(o+r*e))}function hc(s){let t=s.length,e,i;if(t<2)return!1;for(i=s[0],e=1;e<t;++e)if(s[e]-s[e-1]!==i)return!1;return i}var dc=s=>s==="left"?"right":s==="right"?"left":s,wo=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e,ko=(s,t)=>Math.min(t||s,s);function Mo(s,t){let e=[],i=s.length/t,n=s.length,o=0;for(;o<n;o+=i)e.push(s[Math.floor(o)]);return e}function uc(s,t,e){let i=s.ticks.length,n=Math.min(t,i-1),o=s._startPixel,a=s._endPixel,r=1e-6,l=s.getPixelForTick(n),c;if(!(e&&(i===1?c=Math.max(l-o,a-l):t===0?c=(s.getPixelForTick(1)-l)/2:c=(l-s.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<o-r||l>a+r)))return l}function fc(s,t){E(s,e=>{let i=e.gc,n=i.length/2,o;if(n>t){for(o=0;o<n;++o)delete e.data[i[o]];i.splice(0,n)}})}function ze(s){return s.drawTicks?s.tickLength:0}function So(s,t){if(!s.display)return 0;let e=X(s.font,t),i=Z(s.padding);return(F(s.text)?s.text.length:1)*e.lineHeight+i.height}function pc(s,t){return Pt(s,{scale:t,type:"scale"})}function gc(s,t,e){return Pt(s,{tick:e,index:t,type:"tick"})}function mc(s,t,e){let i=hs(s);return(e&&t!=="right"||!e&&t==="right")&&(i=dc(i)),i}function bc(s,t,e,i){let{top:n,left:o,bottom:a,right:r,chart:l}=s,{chartArea:c,scales:h}=l,d=0,u,f,p,g=a-n,m=r-o;if(s.isHorizontal()){if(f=J(i,o,r),T(e)){let b=Object.keys(e)[0],x=e[b];p=h[b].getPixelForValue(x)+g-t}else e==="center"?p=(c.bottom+c.top)/2+g-t:p=wo(s,e,t);u=r-o}else{if(T(e)){let b=Object.keys(e)[0],x=e[b];f=h[b].getPixelForValue(x)-m+t}else e==="center"?f=(c.left+c.right)/2-m+t:f=wo(s,e,t);p=J(i,a,n),d=e==="left"?-W:W}return{titleX:f,titleY:p,maxWidth:u,rotation:d}}var te=class s extends ut{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:n}=this;return t=it(t,Number.POSITIVE_INFINITY),e=it(e,Number.NEGATIVE_INFINITY),i=it(i,Number.POSITIVE_INFINITY),n=it(n,Number.NEGATIVE_INFINITY),{min:it(t,i),max:it(e,n),minDefined:H(t),maxDefined:H(e)}}getMinMax(t){let{min:e,max:i,minDefined:n,maxDefined:o}=this.getUserBounds(),a;if(n&&o)return{min:e,max:i};let r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),n||(e=Math.min(e,a.min)),o||(i=Math.max(i,a.max));return e=o&&e>i?i:e,i=n&&e>i?e:i,{min:it(e,it(i,e)),max:it(i,it(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=qn(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r<this.ticks.length;this._convertTicksToLabels(l?Mo(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=oc(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i],o.label=I(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,i=ko(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation,a=n,r,l,c;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=K(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/i:f/(i-1),d+6>r&&(r=f/(i-(t.offset?.5:1)),l=this.maxHeight-ze(t.grid)-e.padding-So(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=ls(Math.min(Math.asin(K((h.highest.height+6)/r,-1,1)),Math.asin(K(l/c,-1,1))-Math.asin(K(u/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=So(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=ze(o)+l):(t.height=this.maxHeight,t.width=ze(o)+l),i.display&&this.ticks.length){let{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=i.padding*2,p=ct(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(r){let b=i.mirror?0:m*d.width+g*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{let b=i.mirror?0:g*d.width+m*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,m,g)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=n*t.width,f=i*e.height):(u=i*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){I(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)O(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=Mo(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){let{ctx:n,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/ko(e,i)),c=0,h=0,d,u,f,p,g,m,b,x,v,y,_;for(d=0;d<e;d+=l){if(p=t[d].label,g=this._resolveTickFontOptions(d),n.font=m=g.string,b=o[m]=o[m]||{data:{},gc:[]},x=g.lineHeight,v=y=0,!O(p)&&!F(p))v=Ae(n,b.data,b.gc,v,p),y=x;else if(F(p))for(u=0,f=p.length;u<f;++u)_=p[u],!O(_)&&!F(_)&&(v=Ae(n,b.data,b.gc,v,_),y+=x);a.push(v),r.push(y),c=Math.max(v,c),h=Math.max(y,h)}fc(o,e);let w=a.indexOf(c),k=r.indexOf(h),M=S=>({width:a[S]||0,height:r[S]||0});return{first:M(0),last:M(e-1),widest:M(w),highest:M(k),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return zn(this._alignToPixels?$t(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&t<e.length){let i=e[t];return i.$context||(i.$context=gc(this.getContext(),t,i))}return this.$context||(this.$context=pc(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=ct(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*i>r*n?r/i:l/n:l*n<r*i?l/i:r/n}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,i=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=ze(o),f=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(V){return $t(i,V,g)},x,v,y,_,w,k,M,S,P,C,A,Y;if(a==="top")x=b(this.bottom),k=this.bottom-u,S=x-m,C=b(t.top)+m,Y=t.bottom;else if(a==="bottom")x=b(this.top),C=t.top,Y=b(t.bottom)-m,k=x+m,S=this.top+u;else if(a==="left")x=b(this.right),w=this.right-u,M=x-m,P=b(t.left)+m,A=t.right;else if(a==="right")x=b(this.left),P=t.left,A=b(t.right)-m,w=x+m,M=this.left+u;else if(e==="x"){if(a==="center")x=b((t.top+t.bottom)/2+.5);else if(T(a)){let V=Object.keys(a)[0],U=a[V];x=b(this.chart.scales[V].getPixelForValue(U))}C=t.top,Y=t.bottom,k=x+m,S=k+u}else if(e==="y"){if(a==="center")x=b((t.left+t.right)/2);else if(T(a)){let V=Object.keys(a)[0],U=a[V];x=b(this.chart.scales[V].getPixelForValue(U))}w=x-m,M=w-u,P=t.left,A=t.right}let at=D(n.ticks.maxTicksLimit,d),R=Math.max(1,Math.ceil(d/at));for(v=0;v<d;v+=R){let V=this.getContext(v),U=o.setContext(V),ht=r.setContext(V),Q=U.lineWidth,se=U.color,Ge=ht.dash||[],ie=ht.dashOffset,ke=U.tickWidth,Yt=U.tickColor,Me=U.tickBorderDash||[],Ut=U.tickBorderDashOffset;y=uc(this,v,l),y!==void 0&&(_=$t(i,y,Q),c?w=M=P=A=_:k=S=C=Y=_,f.push({tx1:w,ty1:k,tx2:M,ty2:S,x1:P,y1:C,x2:A,y2:Y,width:Q,color:se,borderDash:Ge,borderDashOffset:ie,tickWidth:ke,tickColor:Yt,tickBorderDash:Me,tickBorderDashOffset:Ut}))}return this._ticksLength=d,this._borderValue=x,f}_computeLabelItems(t){let e=this.axis,i=this.options,{position:n,ticks:o}=i,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=ze(i.grid),f=u+h,p=d?-h:f,g=-ct(this.labelRotation),m=[],b,x,v,y,_,w,k,M,S,P,C,A,Y="middle";if(n==="top")w=this.bottom-p,k=this._getXAxisLabelAlignment();else if(n==="bottom")w=this.top+p,k=this._getXAxisLabelAlignment();else if(n==="left"){let R=this._getYAxisLabelAlignment(u);k=R.textAlign,_=R.x}else if(n==="right"){let R=this._getYAxisLabelAlignment(u);k=R.textAlign,_=R.x}else if(e==="x"){if(n==="center")w=(t.top+t.bottom)/2+f;else if(T(n)){let R=Object.keys(n)[0],V=n[R];w=this.chart.scales[R].getPixelForValue(V)+f}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")_=(t.left+t.right)/2-f;else if(T(n)){let R=Object.keys(n)[0],V=n[R];_=this.chart.scales[R].getPixelForValue(V)}k=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?Y="top":l==="end"&&(Y="bottom"));let at=this._getLabelSizes();for(b=0,x=r.length;b<x;++b){v=r[b],y=v.label;let R=o.setContext(this.getContext(b));M=this.getPixelForTick(b)+o.labelOffset,S=this._resolveTickFontOptions(b),P=S.lineHeight,C=F(y)?y.length:1;let V=C/2,U=R.color,ht=R.textStrokeColor,Q=R.textStrokeWidth,se=k;a?(_=M,k==="inner"&&(b===x-1?se=this.options.reverse?"left":"right":b===0?se=this.options.reverse?"right":"left":se="center"),n==="top"?c==="near"||g!==0?A=-C*P+P/2:c==="center"?A=-at.highest.height/2-V*P+P:A=-at.highest.height+P/2:c==="near"||g!==0?A=P/2:c==="center"?A=at.highest.height/2-V*P:A=at.highest.height-C*P,d&&(A*=-1),g!==0&&!R.showLabelBackdrop&&(_+=P/2*Math.sin(g))):(w=M,A=(1-C)*P/2);let Ge;if(R.showLabelBackdrop){let ie=Z(R.backdropPadding),ke=at.heights[b],Yt=at.widths[b],Me=A-ie.top,Ut=0-ie.left;switch(Y){case"middle":Me-=ke/2;break;case"bottom":Me-=ke;break}switch(k){case"center":Ut-=Yt/2;break;case"right":Ut-=Yt;break;case"inner":b===x-1?Ut-=Yt:b>0&&(Ut-=Yt/2);break}Ge={left:Ut,top:Me,width:Yt+ie.width,height:ke+ie.height,color:R.backdropColor}}m.push({label:y,font:S,textOffset:A,options:{rotation:g,color:U,strokeColor:ht,strokeWidth:Q,textAlign:se,textBaseline:Y,translation:[_,w],backdrop:Ge}})}return m}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-ct(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width,c,h;return e==="left"?n?(h=this.right+o,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(o=0,a=n.length;o<a;++o){let l=n[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:e,options:{border:i,grid:n}}=this,o=i.setContext(this.getContext()),a=i.display?o.width:0;if(!a)return;let r=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,h,d,u;this.isHorizontal()?(c=$t(t,this.left,a)-a/2,h=$t(t,this.right,r)+r/2,d=u=l):(d=$t(t,this.top,a)-a/2,u=$t(t,this.bottom,r)+r/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,d),e.lineTo(h,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;let i=this.ctx,n=this._computeLabelArea();n&&Le(i,n);let o=this.getLabelItems(t);for(let a of o){let r=a.options,l=a.font,c=a.label,h=a.textOffset;Nt(i,c,0,h,l,r)}n&&Ee(i)}drawTitle(){let{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;let o=X(i.font),a=Z(i.padding),r=i.align,l=o.lineHeight/2;e==="bottom"||e==="center"||T(e)?(l+=a.bottom,F(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=a.top;let{titleX:c,titleY:h,maxWidth:d,rotation:u}=bc(this,l,e,r);Nt(t,i.text,0,0,o,{color:i.color,maxWidth:d,rotation:u,textAlign:mc(r,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,i=D(t.grid&&t.grid.z,-1),n=D(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==s.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[],o,a;for(o=0,a=e.length;o<a;++o){let r=e[o];r[i]===this.id&&(!t||r.type===t)&&n.push(r)}return n}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return X(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},me=class{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),i;yc(e)&&(i=this.register(e));let n=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,xc(t,a,i),this.override&&B.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in B[n]&&(delete B[n][i],this.override&&delete Bt[i])}};function xc(s,t,e){let i=ae(Object.create(null),[e?B.get(e):{},B.get(t),s.defaults]);B.set(t,i),s.defaultRoutes&&_c(t,s.defaultRoutes),s.descriptors&&B.describe(t,s.descriptors)}function _c(s,t){Object.keys(t).forEach(e=>{let i=e.split("."),n=i.pop(),o=[s].concat(i).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");B.route(o,n,l,r)})}function yc(s){return"id"in s&&"defaults"in s}var qi=class{constructor(){this.controllers=new me(_t,"datasets",!0),this.elements=new me(ut,"elements"),this.plugins=new me(Object,"plugins"),this.scales=new me(te,"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(n=>{let o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):E(n,a=>{let r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){let n=rs(t);I(i["before"+n],[],i),e[t](i),I(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let n=e.get(t);if(n===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return n}},xt=new qi,Ki=class{constructor(){this._init=void 0}notify(t,e,i,n){if(e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;let o=n?this._descriptors(t).filter(n):this._descriptors(t),a=this._notify(o,t,e,i);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,i,n){n=n||{};for(let o of t){let a=o.plugin,r=a[i],l=[e,n,o.options];if(I(r,l,a)===!1&&n.cancelable)return!1}return!0}invalidate(){O(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let i=t&&t.config,n=D(i.options&&i.options.plugins,{}),o=vc(i);return n===!1&&!e?[]:kc(t,o,n,e)}_notifyStateChanges(t){let e=this._oldCache||[],i=this._cache,n=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}};function vc(s){let t={},e=[],i=Object.keys(xt.plugins.items);for(let o=0;o<i.length;o++)e.push(xt.getPlugin(i[o]));let n=s.plugins||[];for(let o=0;o<n.length;o++){let a=n[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function wc(s,t){return!t&&s===!1?null:s===!0?{}:s}function kc(s,{plugins:t,localIds:e},i,n){let o=[],a=s.getContext();for(let r of t){let l=r.id,c=wc(i[l],n);c!==null&&o.push({plugin:r,options:Mc(s.config,{plugin:r,local:e[l]},c,a)})}return o}function Mc(s,{plugin:t,local:e},i,n){let o=s.pluginScopeKeys(t),a=s.getOptionScopes(i,o);return e&&t.defaults&&a.push(t.defaults),s.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Gi(s,t){let e=B.datasets[s]||{};return((t.datasets||{})[s]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Sc(s,t){let e=s;return s==="_index_"?e=t:s==="_value_"&&(e=t==="x"?"y":"x"),e}function Pc(s,t){return s===t?"_index_":"_value_"}function Po(s){if(s==="x"||s==="y"||s==="r")return s}function Cc(s){if(s==="top"||s==="bottom")return"x";if(s==="left"||s==="right")return"y"}function Ji(s,...t){if(Po(s))return s;for(let e of t){let i=e.axis||Cc(e.position)||s.length>1&&Po(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function Co(s,t,e){if(e[t+"AxisID"]===s)return{axis:t}}function Dc(s,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(e.length)return Co(s,"x",e[0])||Co(s,"y",e[0])}return{}}function Ac(s,t){let e=Bt[s.type]||{scales:{}},i=t.scales||{},n=Gi(s.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{let r=i[a];if(!T(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);let l=Ji(a,r,Dc(a,s),B.scales[r.type]),c=Pc(l,n),h=e.scales||{};o[a]=le(Object.create(null),[{axis:l},r,h[l],h[c]])}),s.data.datasets.forEach(a=>{let r=a.type||s.type,l=a.indexAxis||Gi(r,t),h=(Bt[r]||{}).scales||{};Object.keys(h).forEach(d=>{let u=Sc(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),le(o[f],[{axis:u},i[f],h[d]])})}),Object.keys(o).forEach(a=>{let r=o[a];le(r,[B.scales[r.type],B.scale])}),o}function ua(s){let t=s.options||(s.options={});t.plugins=D(t.plugins,{}),t.scales=Ac(s,t)}function fa(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function Oc(s){return s=s||{},s.data=fa(s.data),ua(s),s}var Do=new Map,pa=new Set;function ys(s,t){let e=Do.get(s);return e||(e=t(),Do.set(s,e),pa.add(e)),e}var Be=(s,t,e)=>{let i=St(t,e);i!==void 0&&s.add(i)},Zi=class{constructor(t){this._config=Oc(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=fa(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),ua(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ys(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ys(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ys(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return ys(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,n=i.get(t);return(!n||e)&&(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){let{options:n,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;let l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>Be(l,t,d))),h.forEach(d=>Be(l,n,d)),h.forEach(d=>Be(l,Bt[o]||{},d)),h.forEach(d=>Be(l,B,d)),h.forEach(d=>Be(l,ds,d))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),pa.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,Bt[e]||{},B.datasets[e]||{},{type:e},B,ds]}resolveNamedOptions(t,e,i,n=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=Ao(this._resolverCache,t,n),l=a;if(Lc(a,e)){o.$shared=!1,i=kt(i)?i():i;let c=this.createResolver(t,i,r);l=Kt(a,i,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],n){let{resolver:o}=Ao(this._resolverCache,t,i);return T(e)?Kt(o,e,void 0,n):o}};function Ao(s,t,e){let i=s.get(t);i||(i=new Map,s.set(t,i));let n=e.join(),o=i.get(n);return o||(o={resolver:ps(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},i.set(n,o)),o}var Tc=s=>T(s)&&Object.getOwnPropertyNames(s).some(t=>kt(s[t]));function Lc(s,t){let{isScriptable:e,isIndexable:i}=gi(s);for(let n of t){let o=e(n),a=i(n),r=(a||o)&&s[n];if(o&&(kt(r)||Tc(r))||a&&F(r))return!0}return!1}var Ec="4.5.1",Rc=["top","bottom","left","right","chartArea"];function Oo(s,t){return s==="top"||s==="bottom"||Rc.indexOf(s)===-1&&t==="x"}function To(s,t){return function(e,i){return e[s]===i[s]?e[t]-i[t]:e[s]-i[s]}}function Lo(s){let t=s.chart,e=t.options.animation;t.notifyPlugins("afterRender"),I(e&&e.onComplete,[s],t)}function Ic(s){let t=s.chart,e=t.options.animation;I(e&&e.onProgress,[s],t)}function ga(s){return gs()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}var Ss={},Eo=s=>{let t=ga(s);return Object.values(Ss).filter(e=>e.canvas===t).pop()};function Fc(s,t,e){let i=Object.keys(s);for(let n of i){let o=+n;if(o>=t){let a=s[n];delete s[n],(e>0||o>t)&&(s[o+e]=a)}}}function zc(s,t,e,i){return!e||s.type==="mouseout"?null:i?t:s}var At=class{static defaults=B;static instances=Ss;static overrides=Bt;static registry=xt;static version=Ec;static getChart=Eo;static register(...t){xt.add(...t),Ro()}static unregister(...t){xt.remove(...t),Ro()}constructor(t,e){let i=this.config=new Zi(e),n=ga(t),o=Eo(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||nc(n)),this.platform.updateConfig(i);let r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Tn(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Ki,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Hn(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Ss[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ct.listen(this,"complete",Lo),Ct.listen(this,"progress",Ic),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return O(t)?e&&o?o:n?i/n: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 xt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():_i(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ui(this.canvas,this.ctx),this}stop(){return Ct.stop(this),this}resize(t,e){Ct.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,_i(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),I(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};E(e,(i,n)=>{i.id=n})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=Ji(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),E(o,a=>{let r=a.options,l=r.id,c=Ji(l,r),h=D(r.type,a.dtype);(r.position===void 0||Oo(r.position,c)!==Oo(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in i&&i[l].type===h)d=i[l];else{let u=xt.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(r,t)}),E(n,(a,r)=>{a||delete i[r]}),E(i,a=>{tt.configure(this,a,a.options),tt.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((n,o)=>n.index-o.index),i>e){for(let n=e;n<i;++n)this._destroyDatasetMeta(n);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(To("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,n)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){let o=e[i],a=this.getDatasetMeta(i),r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=r,a.indexAxis=o.indexAxis||Gi(r,this.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{let l=xt.getController(r),{datasetElementType:c,dataElementType:h}=B.datasets[r];Object.assign(l,{dataElementType:xt.getElement(h),datasetElementType:c&&xt.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){E(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c<h;c++){let{controller:d}=this.getDatasetMeta(c),u=!n&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),n||E(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(To("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){E(this.scales,t=>{tt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Qs(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:n,count:o}of e){let a=i==="_removeElements"?-o:o;Fc(t,n,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=i(0);for(let o=1;o<e;o++)if(!Qs(n,i(o)))return;return Array.from(n).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;tt.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],E(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,kt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Ct.has(this)?this.attached&&!Ct.running(this)&&Ct.start(this):(this.draw(),Lo({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:i,height:n}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,n)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let e=this._sortedMetasets,i=[],n,o;for(n=0,o=e.length;n<o;++n){let a=e[n];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},n=Si(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(n&&Le(e,n),t.controller.draw(),n&&Ee(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return pt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){let o=$l.modes[e];return typeof o=="function"?o(this,t,i,n):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,n=i.filter(o=>o&&o._dataset===e).pop();return n||(n={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(n)),n}getContext(){return this.$context||(this.$context=Pt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let n=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);ce(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Ct.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),ui(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ss[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,e=this.platform,i=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};E(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},a,r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){E(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},E(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let n=i?"set":"remove",o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];let c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[n+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],i=t.map(({datasetIndex:o,index:a})=>{let r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!Oe(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){let n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=i?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,i,a),l=Rn(t),c=zc(t,this._lastEvent,i,l);i&&(this._lastEvent=null,I(o.onHover,[t,r,this],this),l&&I(o.onClick,[t,r,this],this));let h=!Oe(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,n){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};function Ro(){return E(At.instances,s=>s._plugins.invalidate())}function Bc(s,t,e){let{startAngle:i,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/a,G(i-e));if(s.beginPath(),s.arc(n,o,a-c/2,i+d/2,e-d/2),r>0){let u=Math.min(c/r,G(i-e));s.arc(n,o,r+c/2,e-u/2,i+u/2,!0)}else{let u=Math.min(c/2,a*G(i-e));if(h==="round")s.arc(n,o,u,e-L/2,i+L/2,!0);else if(h==="bevel"){let f=2*u*u,p=-f*Math.cos(e+L/2)+n,g=-f*Math.sin(e+L/2)+o,m=f*Math.cos(i+L/2)+n,b=f*Math.sin(i+L/2)+o;s.lineTo(p,g),s.lineTo(m,b)}}s.closePath(),s.moveTo(0,0),s.rect(0,0,s.canvas.width,s.canvas.height),s.clip("evenodd")}function $c(s,t,e){let{startAngle:i,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=t,c=n/r;s.beginPath(),s.arc(o,a,r,i-c,e+c),l>n?(c=n/l,s.arc(o,a,l,e+c,i-c,!0)):s.arc(o,a,n,e+W,i-W),s.closePath(),s.clip()}function Nc(s){return fs(s,["outerStart","outerEnd","innerStart","innerEnd"])}function Vc(s,t,e,i){let n=Nc(s.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),r=l=>{let c=(e-Math.min(o,l))*i/2;return K(l,0,Math.min(o,c))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:K(n.innerStart,0,a),innerEnd:K(n.innerEnd,0,a)}}function ge(s,t,e,i){return{x:e+s*Math.cos(t),y:i+s*Math.sin(t)}}function Os(s,t,e,i,n,o){let{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+i+e-c,0),u=h>0?h+i+e+c:0,f=0,p=n-l;if(i){let R=h>0?h-i:0,V=d>0?d-i:0,U=(R+V)/2,ht=U!==0?p*U/(U+i):p;f=(p-ht)/2}let g=Math.max(.001,p*d-e/L)/d,m=(p-g)/2,b=l+m+f,x=n-m-f,{outerStart:v,outerEnd:y,innerStart:_,innerEnd:w}=Vc(t,u,d,x-b),k=d-v,M=d-y,S=b+v/k,P=x-y/M,C=u+_,A=u+w,Y=b+_/C,at=x-w/A;if(s.beginPath(),o){let R=(S+P)/2;if(s.arc(a,r,d,S,R),s.arc(a,r,d,R,P),y>0){let Q=ge(M,P,a,r);s.arc(Q.x,Q.y,y,P,x+W)}let V=ge(A,x,a,r);if(s.lineTo(V.x,V.y),w>0){let Q=ge(A,at,a,r);s.arc(Q.x,Q.y,w,x+W,at+Math.PI)}let U=(x-w/u+(b+_/u))/2;if(s.arc(a,r,u,x-w/u,U,!0),s.arc(a,r,u,U,b+_/u,!0),_>0){let Q=ge(C,Y,a,r);s.arc(Q.x,Q.y,_,Y+Math.PI,b-W)}let ht=ge(k,b,a,r);if(s.lineTo(ht.x,ht.y),v>0){let Q=ge(k,S,a,r);s.arc(Q.x,Q.y,v,b-W,S)}}else{s.moveTo(a,r);let R=Math.cos(S)*d+a,V=Math.sin(S)*d+r;s.lineTo(R,V);let U=Math.cos(P)*d+a,ht=Math.sin(P)*d+r;s.lineTo(U,ht)}s.closePath()}function Hc(s,t,e,i,n){let{fullCircles:o,startAngle:a,circumference:r}=t,l=t.endAngle;if(o){Os(s,t,e,i,l,n);for(let c=0;c<o;++c)s.fill();isNaN(r)||(l=a+(r%z||z))}return Os(s,t,e,i,l,n),s.fill(),l}function Wc(s,t,e,i,n){let{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u,borderRadius:f}=l,p=l.borderAlign==="inner";if(!c)return;s.setLineDash(d||[]),s.lineDashOffset=u,p?(s.lineWidth=c*2,s.lineJoin=h||"round"):(s.lineWidth=c,s.lineJoin=h||"bevel");let g=t.endAngle;if(o){Os(s,t,e,i,g,n);for(let m=0;m<o;++m)s.stroke();isNaN(r)||(g=a+(r%z||z))}p&&$c(s,t,g),l.selfJoin&&g-a>=L&&f===0&&h!=="miter"&&Bc(s,t,g),o||(Os(s,t,e,i,g,n),s.stroke())}var Qi=class extends ut{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){let n=this.getProps(["x","y"],i),{angle:o,distance:a}=ii(n,{x:t,y:e}),{startAngle:r,endAngle:l,innerRadius:c,outerRadius:h,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,f=D(d,l-r),p=de(o,r,l)&&r!==l,g=f>=z||p,m=mt(a,c+u,h+u);return g&&m}getCenterPoint(t){let{x:e,y:i,startAngle:n,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,h=(n+o)/2,d=(a+r+c+l)/2;return{x:e+Math.cos(h)*d,y:i+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>z?Math.floor(i/z):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);let l=1-Math.sin(Math.min(L,i||0)),c=n*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,Hc(t,this,c,o,a),Wc(t,this,c,o,a),t.restore()}};function ma(s,t,e=t){s.lineCap=D(e.borderCapStyle,t.borderCapStyle),s.setLineDash(D(e.borderDash,t.borderDash)),s.lineDashOffset=D(e.borderDashOffset,t.borderDashOffset),s.lineJoin=D(e.borderJoinStyle,t.borderJoinStyle),s.lineWidth=D(e.borderWidth,t.borderWidth),s.strokeStyle=D(e.borderColor,t.borderColor)}function jc(s,t,e){s.lineTo(e.x,e.y)}function Yc(s){return s.stepped?Un:s.tension||s.cubicInterpolationMode==="monotone"?Xn:jc}function ba(s,t,e={}){let i=s.length,{start:n=0,end:o=i-1}=e,{start:a,end:r}=t,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:t.loop,ilen:c<l&&!h?i+c-l:c-l}}function Uc(s,t,e,i){let{points:n,options:o}=t,{count:a,start:r,loop:l,ilen:c}=ba(n,e,i),h=Yc(o),{move:d=!0,reverse:u}=i||{},f,p,g;for(f=0;f<=c;++f)p=n[(r+(u?c-f:f))%a],!p.skip&&(d?(s.moveTo(p.x,p.y),d=!1):h(s,g,p,u,o.stepped),g=p);return l&&(p=n[(r+(u?c:0))%a],h(s,g,p,u,o.stepped)),!!l}function Xc(s,t,e,i){let n=t.points,{count:o,start:a,ilen:r}=ba(n,e,i),{move:l=!0,reverse:c}=i||{},h=0,d=0,u,f,p,g,m,b,x=y=>(a+(c?r-y:y))%o,v=()=>{g!==m&&(s.lineTo(h,m),s.lineTo(h,g),s.lineTo(h,b))};for(l&&(f=n[x(0)],s.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=n[x(u)],f.skip)continue;let y=f.x,_=f.y,w=y|0;w===p?(_<g?g=_:_>m&&(m=_),h=(d*h+y)/++d):(v(),s.lineTo(y,_),p=w,d=0,g=m=_),b=_}v()}function tn(s){let t=s.options,e=t.borderDash&&t.borderDash.length;return!s._decimated&&!s._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Xc:Uc}function qc(s){return s.stepped?so:s.tension||s.cubicInterpolationMode==="monotone"?io:Ft}function Kc(s,t,e,i){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,i)&&n.closePath()),ma(s,t.options),s.stroke(n)}function Gc(s,t,e,i){let{segments:n,options:o}=t,a=tn(t);for(let r of n)ma(s,o,r.style),s.beginPath(),a(s,t,r,{start:e,end:e+i-1})&&s.closePath(),s.stroke()}var Jc=typeof Path2D=="function";function Zc(s,t,e,i){Jc&&!t.options.segment?Kc(s,t,e,i):Gc(s,t,e,i)}var be=class extends ut{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let n=i.spanGaps?this._loop:this._fullLoop;Qn(this._points,i,t,n,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=oo(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,n=t[e],o=this.points,a=Mi(this,{property:e,start:n,end:n});if(!a.length)return;let r=[],l=qc(i),c,h;for(c=0,h=a.length;c<h;++c){let{start:d,end:u}=a[c],f=o[d],p=o[u];if(f===p){r.push(f);continue}let g=Math.abs((n-f[e])/(p[e]-f[e])),m=l(f,p,g,i.stepped);m[e]=t[e],r.push(m)}return r.length===1?r[0]:r}pathSegment(t,e,i){return tn(this)(t,this,e,i)}path(t,e,i){let n=this.segments,o=tn(this),a=this._loop;e=e||0,i=i||this.points.length-e;for(let r of n)a&=o(t,this,r,{start:e,end:e+i-1});return!!a}draw(t,e,i,n){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Zc(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function Io(s,t,e,i){let n=s.options,{[e]:o}=s.getProps([e],i);return Math.abs(t-o)<n.radius+n.hitRadius}var en=class extends ut{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){let n=this.options,{x:o,y:a}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-a,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return Io(this,t,"x",e)}inYRange(t,e){return Io(this,t,"y",e)}getCenterPoint(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);let i=e&&t.borderWidth||0;return(e+i)*2}draw(t,e){let i=this.options;this.skip||i.radius<.1||!pt(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,us(t,i,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}};function xa(s,t){let{x:e,y:i,base:n,width:o,height:a}=s.getProps(["x","y","base","width","height"],t),r,l,c,h,d;return s.horizontal?(d=a/2,r=Math.min(e,n),l=Math.max(e,n),c=i-d,h=i+d):(d=o/2,r=e-d,l=e+d,c=Math.min(i,n),h=Math.max(i,n)),{left:r,top:c,right:l,bottom:h}}function Wt(s,t,e,i){return s?0:K(t,e,i)}function Qc(s,t,e){let i=s.options.borderWidth,n=s.borderSkipped,o=pi(i);return{t:Wt(n.top,o.top,0,e),r:Wt(n.right,o.right,0,t),b:Wt(n.bottom,o.bottom,0,e),l:Wt(n.left,o.left,0,t)}}function th(s,t,e){let{enableBorderRadius:i}=s.getProps(["enableBorderRadius"]),n=s.options.borderRadius,o=Vt(n),a=Math.min(t,e),r=s.borderSkipped,l=i||T(n);return{topLeft:Wt(!l||r.top||r.left,o.topLeft,0,a),topRight:Wt(!l||r.top||r.right,o.topRight,0,a),bottomLeft:Wt(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:Wt(!l||r.bottom||r.right,o.bottomRight,0,a)}}function eh(s){let t=xa(s),e=t.right-t.left,i=t.bottom-t.top,n=Qc(s,e/2,i/2),o=th(s,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:o},inner:{x:t.left+n.l,y:t.top+n.t,w:e-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))}}}}function Ei(s,t,e,i){let n=t===null,o=e===null,r=s&&!(n&&o)&&xa(s,i);return r&&(n||mt(t,r.left,r.right))&&(o||mt(e,r.top,r.bottom))}function sh(s){return s.topLeft||s.topRight||s.bottomLeft||s.bottomRight}function ih(s,t){s.rect(t.x,t.y,t.w,t.h)}function Ri(s,t,e={}){let i=s.x!==e.x?-t:0,n=s.y!==e.y?-t:0,o=(s.x+s.w!==e.x+e.w?t:0)-i,a=(s.y+s.h!==e.y+e.h?t:0)-n;return{x:s.x+i,y:s.y+n,w:s.w+o,h:s.h+a,radius:s.radius}}var sn=class extends ut{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:a}=eh(this),r=sh(a.radius)?fe:ih;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,Ri(a,e,o)),t.clip(),r(t,Ri(o,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,Ri(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return Ei(this,t,e,i)}inXRange(t,e){return Ei(this,t,null,e)}inYRange(t,e){return Ei(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}},nh=Object.freeze({__proto__:null,ArcElement:Qi,BarElement:sn,LineElement:be,PointElement:en}),nn=["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)"],Fo=nn.map(s=>s.replace("rgb(","rgba(").replace(")",", 0.5)"));function _a(s){return nn[s%nn.length]}function ya(s){return Fo[s%Fo.length]}function oh(s,t){return s.borderColor=_a(t),s.backgroundColor=ya(t),++t}function ah(s,t){return s.backgroundColor=s.data.map(()=>_a(t++)),t}function rh(s,t){return s.backgroundColor=s.data.map(()=>ya(t++)),t}function lh(s){let t=0;return(e,i)=>{let n=s.getDatasetMeta(i).controller;n instanceof Ve?t=ah(e,t):n instanceof Cs?t=rh(e,t):n&&(t=oh(e,t))}}function zo(s){let t;for(t in s)if(s[t].borderColor||s[t].backgroundColor)return!0;return!1}function ch(s){return s&&(s.borderColor||s.backgroundColor)}function hh(){return B.borderColor!=="rgba(0,0,0,0.1)"||B.backgroundColor!=="rgba(0,0,0,0.1)"}var dh={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,t,e){if(!e.enabled)return;let{data:{datasets:i},options:n}=s.config,{elements:o}=n,a=zo(i)||ch(n)||o&&zo(o)||hh();if(!e.forceOverride&&a)return;let r=lh(s);i.forEach(r)}};function uh(s,t,e,i,n){let o=n.samples||i;if(o>=e)return s.slice(t,t+e);let a=[],r=(e-2)/(o-2),l=0,c=t+e-1,h=t,d,u,f,p,g;for(a[l++]=s[h],d=0;d<o-2;d++){let m=0,b=0,x,v=Math.floor((d+1)*r)+1+t,y=Math.min(Math.floor((d+2)*r)+1,e)+t,_=y-v;for(x=v;x<y;x++)m+=s[x].x,b+=s[x].y;m/=_,b/=_;let w=Math.floor(d*r)+1+t,k=Math.min(Math.floor((d+1)*r)+1,e)+t,{x:M,y:S}=s[h];for(f=p=-1,x=w;x<k;x++)p=.5*Math.abs((M-m)*(s[x].y-S)-(M-s[x].x)*(b-S)),p>f&&(f=p,u=s[x],g=x);a[l++]=u,h=g}return a[l++]=s[c],a}function fh(s,t,e,i){let n=0,o=0,a,r,l,c,h,d,u,f,p,g,m=[],b=t+e-1,x=s[t].x,y=s[b].x-x;for(a=t;a<t+e;++a){r=s[a],l=(r.x-x)/y*i,c=r.y;let _=l|0;if(_===h)c<p?(p=c,d=a):c>g&&(g=c,u=a),n=(o*n+r.x)/++o;else{let w=a-1;if(!O(d)&&!O(u)){let k=Math.min(d,u),M=Math.max(d,u);k!==f&&k!==w&&m.push({...s[k],x:n}),M!==f&&M!==w&&m.push({...s[M],x:n})}a>0&&w!==f&&m.push(s[w]),m.push(r),h=_,o=0,p=g=c,d=u=f=a}}return m}function va(s){if(s._decimated){let t=s._data;delete s._decimated,delete s._data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Bo(s){s.data.datasets.forEach(t=>{va(t)})}function ph(s,t){let e=t.length,i=0,n,{iScale:o}=s,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=K(ft(t,o.axis,a).lo,0,e-1)),c?n=K(ft(t,o.axis,r).hi+1,i,e)-i:n=e-i,{start:i,count:n}}var gh={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(s,t,e)=>{if(!e.enabled){Bo(s);return}let i=s.width;s.data.datasets.forEach((n,o)=>{let{_data:a,indexAxis:r}=n,l=s.getDatasetMeta(o),c=a||n.data;if(pe([r,s.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let h=s.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||s.options.parsing)return;let{start:d,count:u}=ph(l,c),f=e.threshold||4*i;if(u<=f){va(n);return}O(a)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(e.algorithm){case"lttb":p=uh(c,d,u,i,e);break;case"min-max":p=fh(c,d,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}n._decimated=p})},destroy(s){Bo(s)}};function mh(s,t,e){let i=s.segments,n=s.points,o=t.points,a=[];for(let r of i){let{start:l,end:c}=r;c=Rs(l,c,n);let h=on(e,n[l],n[c],r.loop);if(!t.segments){a.push({source:r,target:h,start:n[l],end:n[c]});continue}let d=Mi(t,h);for(let u of d){let f=on(e,o[u.start],o[u.end],u.loop),p=ki(r,n,f);for(let g of p)a.push({source:g,target:u,start:{[e]:$o(h,f,"start",Math.max)},end:{[e]:$o(h,f,"end",Math.min)}})}}return a}function on(s,t,e,i){if(i)return;let n=t[s],o=e[s];return s==="angle"&&(n=G(n),o=G(o)),{property:s,start:n,end:o}}function bh(s,t){let{x:e=null,y:i=null}=s||{},n=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Rs(a,r,n);let l=n[a],c=n[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Rs(s,t,e){for(;t>s;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function $o(s,t,e,i){return s&&t?i(s[e],t[e]):s?s[e]:t?t[e]:0}function wa(s,t){let e=[],i=!1;return F(s)?(i=!0,e=s):e=bh(s,t),e.length?new be({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function No(s){return s&&s.fill!==!1}function xh(s,t,e){let n=s[t].fill,o=[t],a;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!H(n))return n;if(a=s[n],!a)return!1;if(a.visible)return n;o.push(n),n=a.fill}return!1}function _h(s,t,e){let i=kh(s);if(T(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return H(n)&&Math.floor(n)===n?yh(i[0],t,n,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function yh(s,t,e,i){return(s==="-"||s==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function vh(s,t){let e=null;return s==="start"?e=t.bottom:s==="end"?e=t.top:T(s)?e=t.getPixelForValue(s.value):t.getBasePixel&&(e=t.getBasePixel()),e}function wh(s,t,e){let i;return s==="start"?i=e:s==="end"?i=t.options.reverse?t.min:t.max:T(s)?i=s.value:i=t.getBaseValue(),i}function kh(s){let t=s.options,e=t.fill,i=D(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Mh(s){let{scale:t,index:e,line:i}=s,n=[],o=i.segments,a=i.points,r=Sh(t,e);r.push(wa({x:null,y:t.bottom},i));for(let l=0;l<o.length;l++){let c=o[l];for(let h=c.start;h<=c.end;h++)Ph(n,a[h],r)}return new be({points:n,options:{}})}function Sh(s,t){let e=[],i=s.getMatchingVisibleMetas("line");for(let n=0;n<i.length;n++){let o=i[n];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function Ph(s,t,e){let i=[];for(let n=0;n<e.length;n++){let o=e[n],{first:a,last:r,point:l}=Ch(o,t,"x");if(!(!l||a&&r)){if(a)i.unshift(l);else if(s.push(l),!r)break}}s.push(...i)}function Ch(s,t,e){let i=s.interpolate(t,e);if(!i)return{};let n=i[e],o=s.segments,a=s.points,r=!1,l=!1;for(let c=0;c<o.length;c++){let h=o[c],d=a[h.start][e],u=a[h.end][e];if(mt(n,d,u)){r=n===d,l=n===u;break}}return{first:r,last:l,point:i}}var Ts=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:n,y:o,radius:a}=this;return e=e||{start:0,end:z},t.arc(n,o,a,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}};function Dh(s){let{chart:t,fill:e,line:i}=s;if(H(e))return Ah(t,e);if(e==="stack")return Mh(s);if(e==="shape")return!0;let n=Oh(s);return n instanceof Ts?n:wa(n,i)}function Ah(s,t){let e=s.getDatasetMeta(t);return e&&s.isDatasetVisible(t)?e.dataset:null}function Oh(s){return(s.scale||{}).getPointPositionForValue?Lh(s):Th(s)}function Th(s){let{scale:t={},fill:e}=s,i=vh(e,t);if(H(i)){let n=t.isHorizontal();return{x:n?i:null,y:n?null:i}}return null}function Lh(s){let{scale:t,fill:e}=s,i=t.options,n=t.getLabels().length,o=i.reverse?t.max:t.min,a=wh(e,t,o),r=[];if(i.grid.circular){let l=t.getPointPositionForValue(0,o);return new Ts({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<n;++l)r.push(t.getPointPositionForValue(l,a));return r}function Ii(s,t,e){let i=Dh(t),{chart:n,index:o,line:a,scale:r,axis:l}=t,c=a.options,h=c.fill,d=c.backgroundColor,{above:u=d,below:f=d}=h||{},p=n.getDatasetMeta(o),g=Si(n,p);i&&a.points.length&&(Le(s,e),Eh(s,{line:a,target:i,above:u,below:f,area:e,scale:r,axis:l,clip:g}),Ee(s))}function Eh(s,t){let{line:e,target:i,above:n,below:o,area:a,scale:r,clip:l}=t,c=e._loop?"angle":t.axis;s.save();let h=o;o!==n&&(c==="x"?(Vo(s,i,a.top),Fi(s,{line:e,target:i,color:n,scale:r,property:c,clip:l}),s.restore(),s.save(),Vo(s,i,a.bottom)):c==="y"&&(Ho(s,i,a.left),Fi(s,{line:e,target:i,color:o,scale:r,property:c,clip:l}),s.restore(),s.save(),Ho(s,i,a.right),h=n)),Fi(s,{line:e,target:i,color:h,scale:r,property:c,clip:l}),s.restore()}function Vo(s,t,e){let{segments:i,points:n}=t,o=!0,a=!1;s.beginPath();for(let r of i){let{start:l,end:c}=r,h=n[l],d=n[Rs(l,c,n)];o?(s.moveTo(h.x,h.y),o=!1):(s.lineTo(h.x,e),s.lineTo(h.x,h.y)),a=!!t.pathSegment(s,r,{move:a}),a?s.closePath():s.lineTo(d.x,e)}s.lineTo(t.first().x,e),s.closePath(),s.clip()}function Ho(s,t,e){let{segments:i,points:n}=t,o=!0,a=!1;s.beginPath();for(let r of i){let{start:l,end:c}=r,h=n[l],d=n[Rs(l,c,n)];o?(s.moveTo(h.x,h.y),o=!1):(s.lineTo(e,h.y),s.lineTo(h.x,h.y)),a=!!t.pathSegment(s,r,{move:a}),a?s.closePath():s.lineTo(e,d.y)}s.lineTo(e,t.first().y),s.closePath(),s.clip()}function Fi(s,t){let{line:e,target:i,property:n,color:o,scale:a,clip:r}=t,l=mh(e,i,n);for(let{source:c,target:h,start:d,end:u}of l){let{style:{backgroundColor:f=o}={}}=c,p=i!==!0;s.save(),s.fillStyle=f,Rh(s,a,r,p&&on(n,d,u)),s.beginPath();let g=!!e.pathSegment(s,c),m;if(p){g?s.closePath():Wo(s,i,u,n);let b=!!i.pathSegment(s,h,{move:g,reverse:!0});m=g&&b,m||Wo(s,i,d,n)}s.closePath(),s.fill(m?"evenodd":"nonzero"),s.restore()}}function Rh(s,t,e,i){let n=t.chart.chartArea,{property:o,start:a,end:r}=i||{};if(o==="x"||o==="y"){let l,c,h,d;o==="x"?(l=a,c=n.top,h=r,d=n.bottom):(l=n.left,c=a,h=n.right,d=r),s.beginPath(),e&&(l=Math.max(l,e.left),h=Math.min(h,e.right),c=Math.max(c,e.top),d=Math.min(d,e.bottom)),s.rect(l,c,h-l,d-c),s.clip()}}function Wo(s,t,e,i){let n=t.interpolate(e,i);n&&s.lineTo(n.x,n.y)}var Ih={id:"filler",afterDatasetsUpdate(s,t,e){let i=(s.data.datasets||[]).length,n=[],o,a,r,l;for(a=0;a<i;++a)o=s.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof be&&(l={visible:s.isDatasetVisible(a),index:a,fill:_h(r,a,i),chart:s,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||l.fill===!1)&&(l.fill=xh(n,a,e.propagate))},beforeDraw(s,t,e){let i=e.drawTime==="beforeDraw",n=s.getSortedVisibleDatasetMetas(),o=s.chartArea;for(let a=n.length-1;a>=0;--a){let r=n[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&Ii(s.ctx,r,o))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){let o=i[n].$filler;No(o)&&Ii(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,t,e){let i=t.meta.$filler;!No(i)||e.drawTime!=="beforeDatasetDraw"||Ii(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},jo=(s,t)=>{let{boxHeight:e=t,boxWidth:i=t}=s;return s.usePointStyle&&(e=Math.min(e,t),i=s.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},Fh=(s,t)=>s!==null&&t!==null&&s.datasetIndex===t.datasetIndex&&s.index===t.index,Ls=class extends ut{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=I(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,n)=>t.sort(i,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,n=X(i.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=jo(i,o),c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r,d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((p,g)=>{let m=i+e/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*r>a)&&(d+=h,c[c.length-(g>0?0:1)]=0,f+=h,u++),l[g]={left:0,top:f,row:u,width:m,height:n},c[c.length-1]+=m+r}),d}_fitCols(t,e,i,n){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t,d=r,u=0,f=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{let{itemWidth:x,itemHeight:v}=zh(i,e,o,m,n);b>0&&f+v+2*r>h&&(d+=u+r,c.push({width:u,height:f}),p+=u+r,g++,u=f=0),l[b]={left:p,top:f,col:g,width:x,height:v},u=Math.max(u,x),f+=v+r}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,a=Jt(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=J(i,this.left+n,this.right-this.lineWidths[r]);for(let c of e)r!==c.row&&(r=c.row,l=J(i,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=J(i,this.top+t+n,this.bottom-this.columnSizes[r].height);for(let c of e)c.col!==r&&(r=c.col,l=J(i,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;Le(t,this),this._draw(),Ee(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:a}=t,r=B.color,l=Jt(t.rtl,this.left,this.width),c=X(a.font),{padding:h}=a,d=c.size,u=d/2,f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;let{boxWidth:p,boxHeight:g,itemHeight:m}=jo(a,d),b=function(w,k,M){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;n.save();let S=D(M.lineWidth,1);if(n.fillStyle=D(M.fillStyle,r),n.lineCap=D(M.lineCap,"butt"),n.lineDashOffset=D(M.lineDashOffset,0),n.lineJoin=D(M.lineJoin,"miter"),n.lineWidth=S,n.strokeStyle=D(M.strokeStyle,r),n.setLineDash(D(M.lineDash,[])),a.usePointStyle){let P={radius:g*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:S},C=l.xPlus(w,p/2),A=k+u;fi(n,P,C,A,a.pointStyleWidth&&p)}else{let P=k+Math.max((d-g)/2,0),C=l.leftForLtr(w,p),A=Vt(M.borderRadius);n.beginPath(),Object.values(A).some(Y=>Y!==0)?fe(n,{x:C,y:P,w:p,h:g,radius:A}):n.rect(C,P,p,g),n.fill(),S!==0&&n.stroke()}n.restore()},x=function(w,k,M){Nt(n,M.text,w,k+m/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();v?f={x:J(o,this.left+h,this.right-i[0]),y:this.top+h+y,line:0}:f={x:this.left+h,y:J(o,this.top+y+h,this.bottom-e[0].height),line:0},vi(this.ctx,t.textDirection);let _=m+h;this.legendItems.forEach((w,k)=>{n.strokeStyle=w.fontColor,n.fillStyle=w.fontColor;let M=n.measureText(w.text).width,S=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),P=p+u+M,C=f.x,A=f.y;l.setWidth(this.width),v?k>0&&C+P+h>this.right&&(A=f.y+=_,f.line++,C=f.x=J(o,this.left+h,this.right-i[f.line])):k>0&&A+_>this.bottom&&(C=f.x=C+e[f.line].width+h,f.line++,A=f.y=J(o,this.top+y+h,this.bottom-e[f.line].height));let Y=l.x(C);if(b(Y,A,w),C=Wn(S,C+p+u,v?C+P:this.right,t.rtl),x(l.x(C),A,w),v)f.x+=P+h;else if(typeof w.text!="string"){let at=c.lineHeight;f.y+=ka(w,at)+h}else f.y+=_}),wi(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=X(e.font),n=Z(e.padding);if(!e.display)return;let o=Jt(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.size/2,c=n.top+l,h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=J(t.align,d,this.right-u);else{let p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);h=c+J(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}let f=J(r,d,d+u);a.textAlign=o.textAlign(hs(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,Nt(a,e.text,f,h,i)}_computeTitleHeight(){let t=this.options.title,e=X(t.font),i=Z(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(mt(t,this.left,this.right)&&mt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(n=o[i],mt(t,n.left,n.left+n.width)&&mt(e,n.top,n.top+n.height))return this.legendItems[i]}return null}handleEvent(t){let e=this.options;if(!Nh(t.type,e))return;let i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let n=this._hoveredItem,o=Fh(n,i);n&&!o&&I(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&I(e.onHover,[t,i,this],this)}else i&&I(e.onClick,[t,i,this],this)}};function zh(s,t,e,i,n){let o=Bh(i,s,t,e),a=$h(n,i,t.lineHeight);return{itemWidth:o,itemHeight:a}}function Bh(s,t,e,i){let n=s.text;return n&&typeof n!="string"&&(n=n.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+i.measureText(n).width}function $h(s,t,e){let i=s;return typeof t.text!="string"&&(i=ka(t,e)),i}function ka(s,t){let e=s.text?s.text.length:0;return t*e}function Nh(s,t){return!!((s==="mousemove"||s==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(s==="click"||s==="mouseup"))}var Vh={id:"legend",_element:Ls,start(s,t,e){let i=s.legend=new Ls({ctx:s.ctx,options:e,chart:s});tt.configure(s,i,e),tt.addBox(s,i)},stop(s){tt.removeBox(s,s.legend),delete s.legend},beforeUpdate(s,t,e){let i=s.legend;tt.configure(s,i,e),i.options=e},afterUpdate(s){let t=s.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(s,t){t.replay||s.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(s,t,e){let i=t.datasetIndex,n=e.chart;n.isDatasetVisible(i)?(n.hide(i),t.hidden=!0):(n.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:s=>s.chart.options.color,boxWidth:40,padding:10,generateLabels(s){let t=s.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(e?0:void 0),h=Z(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}},We=class extends ut{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let n=F(i.text)?i.text.length:1;this._padding=Z(i.padding);let o=n*X(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:i,bottom:n,right:o,options:a}=this,r=a.align,l=0,c,h,d;return this.isHorizontal()?(h=J(r,i,o),d=e+t,c=o-i):(a.position==="left"?(h=i+t,d=J(r,n,e),l=L*-.5):(h=o-t,d=J(r,e,n),l=L*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=X(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);Nt(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:hs(e.align),textBaseline:"middle",translation:[a,r]})}};function Hh(s,t){let e=new We({ctx:s.ctx,options:t,chart:s});tt.configure(s,e,t),tt.addBox(s,e),s.titleBlock=e}var Wh={id:"title",_element:We,start(s,t,e){Hh(s,e)},stop(s){let t=s.titleBlock;tt.removeBox(s,t),delete s.titleBlock},beforeUpdate(s,t,e){let i=s.titleBlock;tt.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},vs=new WeakMap,jh={id:"subtitle",start(s,t,e){let i=new We({ctx:s.ctx,options:e,chart:s});tt.configure(s,i,e),tt.addBox(s,i),vs.set(s,i)},stop(s){tt.removeBox(s,vs.get(s)),vs.delete(s)},beforeUpdate(s,t,e){let i=vs.get(s);tt.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Ne={average(s){if(!s.length)return!1;let t,e,i=new Set,n=0,o=0;for(t=0,e=s.length;t<e;++t){let r=s[t].element;if(r&&r.hasValue()){let l=r.tooltipPosition();i.add(l.x),n+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((r,l)=>r+l)/i.size,y:n/o}},nearest(s,t){if(!s.length)return!1;let e=t.x,i=t.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=s.length;o<a;++o){let l=s[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),h=os(t,c);h<n&&(n=h,r=l)}}if(r){let l=r.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function bt(s,t){return t&&(F(t)?Array.prototype.push.apply(s,t):s.push(t)),s}function Dt(s){return(typeof s=="string"||s instanceof String)&&s.indexOf(`
1
+ (()=>{function Ae(s){return s+.5|0}var It=(s,t,e)=>Math.max(Math.min(s,e),t);function Ce(s){return It(Ae(s*2.55),0,255)}function Ft(s){return It(Ae(s*255),0,255)}function kt(s){return It(Ae(s/2.55)/100,0,1)}function bn(s){return It(Ae(s*100),0,100)}var lt={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},qs=[..."0123456789ABCDEF"],qa=s=>qs[s&15],Ka=s=>qs[(s&240)>>4]+qs[s&15],Qe=s=>(s&240)>>4===(s&15),Ga=s=>Qe(s.r)&&Qe(s.g)&&Qe(s.b)&&Qe(s.a);function Ja(s){var t=s.length,e;return s[0]==="#"&&(t===4||t===5?e={r:255&lt[s[1]]*17,g:255&lt[s[2]]*17,b:255&lt[s[3]]*17,a:t===5?lt[s[4]]*17:255}:(t===7||t===9)&&(e={r:lt[s[1]]<<4|lt[s[2]],g:lt[s[3]]<<4|lt[s[4]],b:lt[s[5]]<<4|lt[s[6]],a:t===9?lt[s[7]]<<4|lt[s[8]]:255})),e}var Za=(s,t)=>s<255?t(s):"";function Qa(s){var t=Ga(s)?qa:Ka;return s?"#"+t(s.r)+t(s.g)+t(s.b)+Za(s.a,t):void 0}var tr=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function vn(s,t,e){let i=t*Math.min(e,1-e),n=(o,a=(o+s/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function er(s,t,e){let i=(n,o=(n+s/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function sr(s,t,e){let i=vn(s,1,.5),n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)i[n]*=1-t-e,i[n]+=t;return i}function ir(s,t,e,i,n){return s===n?(t-e)/i+(t<e?6:0):t===n?(e-s)/i+2:(s-t)/i+4}function Ks(s){let e=s.r/255,i=s.g/255,n=s.b/255,o=Math.max(e,i,n),a=Math.min(e,i,n),r=(o+a)/2,l,c,h;return o!==a&&(h=o-a,c=r>.5?h/(2-o-a):h/(o+a),l=ir(e,i,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Gs(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(Ft)}function Js(s,t,e){return Gs(vn,s,t,e)}function nr(s,t,e){return Gs(sr,s,t,e)}function or(s,t,e){return Gs(er,s,t,e)}function wn(s){return(s%360+360)%360}function ar(s){let t=tr.exec(s),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Ce(+t[5]):Ft(+t[5]));let n=wn(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=nr(n,o,a):t[1]==="hsv"?i=or(n,o,a):i=Js(n,o,a),{r:i[0],g:i[1],b:i[2],a:e}}function rr(s,t){var e=Ks(s);e[0]=wn(e[0]+t),e=Js(e),s.r=e[0],s.g=e[1],s.b=e[2]}function lr(s){if(!s)return;let t=Ks(s),e=t[0],i=bn(t[1]),n=bn(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${kt(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}var xn={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"},_n={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"};function cr(){let s={},t=Object.keys(_n),e=Object.keys(xn),i,n,o,a,r;for(i=0;i<t.length;i++){for(a=r=t[i],n=0;n<e.length;n++)o=e[n],r=r.replace(o,xn[o]);o=parseInt(_n[a],16),s[r]=[o>>16&255,o>>8&255,o&255]}return s}var ts;function hr(s){ts||(ts=cr(),ts.transparent=[0,0,0,0]);let t=ts[s.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var dr=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function ur(s){let t=dr.exec(s),e=255,i,n,o;if(t){if(t[7]!==i){let a=+t[7];e=t[8]?Ce(a):It(a*255,0,255)}return i=+t[1],n=+t[3],o=+t[5],i=255&(t[2]?Ce(i):It(i,0,255)),n=255&(t[4]?Ce(n):It(n,0,255)),o=255&(t[6]?Ce(o):It(o,0,255)),{r:i,g:n,b:o,a:e}}}function fr(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${kt(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}var Xs=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,oe=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);function pr(s,t,e){let i=oe(kt(s.r)),n=oe(kt(s.g)),o=oe(kt(s.b));return{r:Ft(Xs(i+e*(oe(kt(t.r))-i))),g:Ft(Xs(n+e*(oe(kt(t.g))-n))),b:Ft(Xs(o+e*(oe(kt(t.b))-o))),a:s.a+e*(t.a-s.a)}}function es(s,t,e){if(s){let i=Ks(s);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=Js(i),s.r=i[0],s.g=i[1],s.b=i[2]}}function kn(s,t){return s&&Object.assign(t||{},s)}function yn(s){var t={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(t={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(t.a=Ft(s[3]))):(t=kn(s,{r:0,g:0,b:0,a:1}),t.a=Ft(t.a)),t}function gr(s){return s.charAt(0)==="r"?ur(s):ar(s)}var De=class s{constructor(t){if(t instanceof s)return t;let e=typeof t,i;e==="object"?i=yn(t):e==="string"&&(i=Ja(t)||hr(t)||gr(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=kn(this._rgb);return t&&(t.a=kt(t.a)),t}set rgb(t){this._rgb=yn(t)}rgbString(){return this._valid?fr(this._rgb):void 0}hexString(){return this._valid?Qa(this._rgb):void 0}hslString(){return this._valid?lr(this._rgb):void 0}mix(t,e){if(t){let i=this.rgb,n=t.rgb,o,a=e===o?.5:e,r=2*a-1,l=i.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,i.r=255&c*i.r+o*n.r+.5,i.g=255&c*i.g+o*n.g+.5,i.b=255&c*i.b+o*n.b+.5,i.a=a*i.a+(1-a)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=pr(this._rgb,t._rgb,e)),this}clone(){return new s(this.rgb)}alpha(t){return this._rgb.a=Ft(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=Ae(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return es(this._rgb,2,t),this}darken(t){return es(this._rgb,2,-t),this}saturate(t){return es(this._rgb,1,t),this}desaturate(t){return es(this._rgb,1,-t),this}rotate(t){return rr(this._rgb,t),this}};function gt(){}var Rn=(()=>{let s=0;return()=>s++})();function O(s){return s==null}function F(s){if(Array.isArray&&Array.isArray(s))return!0;let t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function T(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function V(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function it(s,t){return V(s)?s:t}function D(s,t){return typeof s>"u"?t:s}var In=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:+s/t,ei=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;function I(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function E(s,t,e,i){let n,o,a;if(F(s))if(o=s.length,i)for(n=o-1;n>=0;n--)t.call(e,s[n],n);else for(n=0;n<o;n++)t.call(e,s[n],n);else if(T(s))for(a=Object.keys(s),o=a.length,n=0;n<o;n++)t.call(e,s[a[n]],a[n])}function Le(s,t){let e,i,n,o;if(!s||!t||s.length!==t.length)return!1;for(e=0,i=s.length;e<i;++e)if(n=s[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function os(s){if(F(s))return s.map(os);if(T(s)){let t=Object.create(null),e=Object.keys(s),i=e.length,n=0;for(;n<i;++n)t[e[n]]=os(s[e[n]]);return t}return s}function Fn(s){return["__proto__","prototype","constructor"].indexOf(s)===-1}function mr(s,t,e,i){if(!Fn(s))return;let n=t[s],o=e[s];T(n)&&T(o)?re(n,o,i):t[s]=os(o)}function re(s,t,e){let i=F(t)?t:[t],n=i.length;if(!T(s))return s;e=e||{};let o=e.merger||mr,a;for(let r=0;r<n;++r){if(a=i[r],!T(a))continue;let l=Object.keys(a);for(let c=0,h=l.length;c<h;++c)o(l[c],s,a,e)}return s}function ce(s,t){return re(s,t,{merger:br})}function br(s,t,e){if(!Fn(s))return;let i=t[s],n=e[s];T(i)&&T(n)?ce(i,n):Object.prototype.hasOwnProperty.call(t,s)||(t[s]=os(n))}var Mn={"":s=>s,x:s=>s.x,y:s=>s.y};function xr(s){let t=s.split("."),e=[],i="";for(let n of t)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function _r(s){let t=xr(s);return e=>{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function Pt(s,t){return(Mn[t]||(Mn[t]=_r(t)))(s)}function cs(s){return s.charAt(0).toUpperCase()+s.slice(1)}var he=s=>typeof s<"u",Mt=s=>typeof s=="function",si=(s,t)=>{if(s.size!==t.size)return!1;for(let e of s)if(!t.has(e))return!1;return!0};function zn(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}var L=Math.PI,z=2*L,yr=z+L,as=Number.POSITIVE_INFINITY,vr=L/180,W=L/2,qt=L/4,Sn=L*2/3,St=Math.log10,dt=Math.sign;function de(s,t,e){return Math.abs(s-t)<e}function ii(s){let t=Math.round(s);s=de(s,t,s/1e3)?t:s;let e=Math.pow(10,Math.floor(St(s))),i=s/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function Bn(s){let t=[],e=Math.sqrt(s),i;for(i=1;i<e;i++)s%i===0&&(t.push(i),t.push(s/i));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function wr(s){return typeof s=="symbol"||typeof s=="object"&&s!==null&&!(Symbol.toPrimitive in s||"toString"in s||"valueOf"in s)}function Jt(s){return!wr(s)&&!isNaN(parseFloat(s))&&isFinite(s)}function $n(s,t){let e=Math.round(s);return e-t<=s&&e+t>=s}function ni(s,t,e){let i,n,o;for(i=0,n=s.length;i<n;i++)o=s[i][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function ct(s){return s*(L/180)}function hs(s){return s*(180/L)}function oi(s){if(!V(s))return;let t=1,e=0;for(;Math.round(s*t)/t!==s;)t*=10,e++;return e}function ai(s,t){let e=t.x-s.x,i=t.y-s.y,n=Math.sqrt(e*e+i*i),o=Math.atan2(i,e);return o<-.5*L&&(o+=z),{angle:o,distance:n}}function rs(s,t){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function kr(s,t){return(s-t+yr)%z-L}function G(s){return(s%z+z)%z}function ue(s,t,e,i){let n=G(s),o=G(t),a=G(e),r=G(o-n),l=G(a-n),c=G(n-o),h=G(n-a);return n===o||n===a||i&&o===a||r>l&&c<h}function K(s,t,e){return Math.max(t,Math.min(e,s))}function Nn(s){return K(s,-32768,32767)}function mt(s,t,e,i=1e-6){return s>=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function ds(s,t,e){e=e||(a=>s[a]<t);let i=s.length-1,n=0,o;for(;i-n>1;)o=n+i>>1,e(o)?n=o:i=o;return{lo:n,hi:i}}var ft=(s,t,e,i)=>ds(s,e,i?n=>{let o=s[n][t];return o<e||o===e&&s[n+1][t]===e}:n=>s[n][t]<e),Hn=(s,t,e)=>ds(s,e,i=>s[i][t]>=e);function Vn(s,t,e){let i=0,n=s.length;for(;i<n&&s[i]<t;)i++;for(;n>i&&s[n-1]>e;)n--;return i>0||n<s.length?s.slice(i,n):s}var Wn=["push","pop","shift","splice","unshift"];function jn(s,t){if(s._chartjs){s._chartjs.listeners.push(t);return}Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Wn.forEach(e=>{let i="_onData"+cs(e),n=s[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value(...o){let a=n.apply(this,o);return s._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...o)}),a}})})}function ri(s,t){let e=s._chartjs;if(!e)return;let i=e.listeners,n=i.indexOf(t);n!==-1&&i.splice(n,1),!(i.length>0)&&(Wn.forEach(o=>{delete s[o]}),delete s._chartjs)}function li(s){let t=new Set(s);return t.size===s.length?s:Array.from(t)}var ci=function(){return typeof window>"u"?function(s){return s()}:window.requestAnimationFrame}();function hi(s,t){let e=[],i=!1;return function(...n){e=n,i||(i=!0,ci.call(window,()=>{i=!1,s.apply(t,e)}))}}function Yn(s,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(s,t,i)):s.apply(this,i),t}}var us=s=>s==="start"?"left":s==="end"?"right":"center",J=(s,t,e)=>s==="start"?t:s==="end"?e:(t+e)/2,Un=(s,t,e,i)=>s===(i?"left":"right")?e:s==="center"?(t+e)/2:t;function di(s,t,e){let i=t.length,n=0,o=i;if(s._sorted){let{iScale:a,vScale:r,_parsed:l}=s,c=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null,h=a.axis,{min:d,max:u,minDefined:f,maxDefined:p}=a.getUserBounds();if(f){if(n=Math.min(ft(l,h,d).lo,e?i:ft(t,h,a.getPixelForValue(d)).lo),c){let g=l.slice(0,n+1).reverse().findIndex(m=>!O(m[r.axis]));n-=Math.max(0,g)}n=K(n,0,i-1)}if(p){let g=Math.max(ft(l,a.axis,u,!0).hi+1,e?0:ft(t,h,a.getPixelForValue(u),!0).hi+1);if(c){let m=l.slice(g-1).findIndex(b=>!O(b[r.axis]));g+=Math.max(0,m)}o=K(g,n,i)-n}else o=i-n}return{start:n,count:o}}function ui(s){let{xScale:t,yScale:e,_scaleRanges:i}=s,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return s._scaleRanges=n,!0;let o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,n),o}var ss=s=>s===0||s===1,Pn=(s,t,e)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-t)*z/e)),Cn=(s,t,e)=>Math.pow(2,-10*s)*Math.sin((s-t)*z/e)+1,ae={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*W)+1,easeOutSine:s=>Math.sin(s*W),easeInOutSine:s=>-.5*(Math.cos(L*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>ss(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>ss(s)?s:Pn(s,.075,.3),easeOutElastic:s=>ss(s)?s:Cn(s,.075,.3),easeInOutElastic(s){return ss(s)?s:s<.5?.5*Pn(s*2,.1125,.45):.5+.5*Cn(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let t=1.70158;return(s/=.5)<1?.5*(s*s*(((t*=1.525)+1)*s-t)):.5*((s-=2)*s*(((t*=1.525)+1)*s+t)+2)},easeInBounce:s=>1-ae.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?ae.easeInBounce(s*2)*.5:ae.easeOutBounce(s*2-1)*.5+.5};function fi(s){if(s&&typeof s=="object"){let t=s.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function pi(s){return fi(s)?s:new De(s)}function Zs(s){return fi(s)?s:new De(s).saturate(.5).darken(.1).hexString()}var Mr=["x","y","borderWidth","radius","tension"],Sr=["color","borderColor","backgroundColor"];function Pr(s){s.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),s.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),s.set("animations",{colors:{type:"color",properties:Sr},numbers:{type:"number",properties:Mr}}),s.describe("animations",{_fallback:"animation"}),s.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Cr(s){s.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Dn=new Map;function Dr(s,t){t=t||{};let e=s+JSON.stringify(t),i=Dn.get(e);return i||(i=new Intl.NumberFormat(s,t),Dn.set(e,i)),i}function fe(s,t,e){return Dr(t,e).format(s)}var Xn={values(s){return F(s)?s:""+s},numeric(s,t,e){if(s===0)return"0";let i=this.chart.options.locale,n,o=s;if(e.length>1){let c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=Ar(s,e)}let a=St(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),fe(s,i,l)},logarithmic(s,t,e){if(s===0)return"0";let i=e[t].significand||s/Math.pow(10,Math.floor(St(s)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?Xn.numeric.call(this,s,t,e):""}};function Ar(s,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&s!==Math.floor(s)&&(e=s-Math.floor(s)),e}var Ee={formatters:Xn};function Or(s){s.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:Ee.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.route("scale.ticks","color","","color"),s.route("scale.grid","color","","borderColor"),s.route("scale.border","color","","borderColor"),s.route("scale.title","color","","color"),s.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),s.describe("scales",{_fallback:"scale"}),s.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}var $t=Object.create(null),fs=Object.create(null);function Oe(s,t){if(!t)return s;let e=t.split(".");for(let i=0,n=e.length;i<n;++i){let o=e[i];s=s[o]||(s[o]=Object.create(null))}return s}function Qs(s,t,e){return typeof t=="string"?re(Oe(s,t),e):re(Oe(s,""),t)}var ti=class{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=i=>i.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=(i,n)=>Zs(n.backgroundColor),this.hoverBorderColor=(i,n)=>Zs(n.borderColor),this.hoverColor=(i,n)=>Zs(n.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 Qs(this,t,e)}get(t){return Oe(this,t)}describe(t,e){return Qs(fs,t,e)}override(t,e){return Qs($t,t,e)}route(t,e,i,n){let o=Oe(this,t),a=Oe(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[r],c=a[n];return T(l)?Object.assign({},c,l):D(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}},B=new ti({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Pr,Cr,Or]);function Tr(s){return!s||O(s.size)||O(s.family)?null:(s.style?s.style+" ":"")+(s.weight?s.weight+" ":"")+s.size+"px "+s.family}function Te(s,t,e,i,n){let o=t[n];return o||(o=t[n]=s.measureText(n).width,e.push(n)),o>i&&(i=o),i}function qn(s,t,e,i){i=i||{};let n=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(n=i.data={},o=i.garbageCollect=[],i.font=t),s.save(),s.font=t;let a=0,r=e.length,l,c,h,d,u;for(l=0;l<r;l++)if(d=e[l],d!=null&&!F(d))a=Te(s,n,o,a,d);else if(F(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!F(u)&&(a=Te(s,n,o,a,u));s.restore();let f=o.length/2;if(f>e.length){for(l=0;l<f;l++)delete n[o[l]];o.splice(0,f)}return a}function Nt(s,t,e){let i=s.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*i)/i+n}function gi(s,t){!t&&!s||(t=t||s.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,s.width,s.height),t.restore())}function ps(s,t,e,i){mi(s,t,e,i,null)}function mi(s,t,e,i,n){let o,a,r,l,c,h,d,u,f=t.pointStyle,p=t.rotation,g=t.radius,m=(p||0)*vr;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){s.save(),s.translate(e,i),s.rotate(m),s.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),s.restore();return}if(!(isNaN(g)||g<=0)){switch(s.beginPath(),f){default:n?s.ellipse(e,i,n/2,g,0,0,z):s.arc(e,i,g,0,z),s.closePath();break;case"triangle":h=n?n/2:g,s.moveTo(e+Math.sin(m)*h,i-Math.cos(m)*g),m+=Sn,s.lineTo(e+Math.sin(m)*h,i-Math.cos(m)*g),m+=Sn,s.lineTo(e+Math.sin(m)*h,i-Math.cos(m)*g),s.closePath();break;case"rectRounded":c=g*.516,l=g-c,a=Math.cos(m+qt)*l,d=Math.cos(m+qt)*(n?n/2-c:l),r=Math.sin(m+qt)*l,u=Math.sin(m+qt)*(n?n/2-c:l),s.arc(e-d,i-r,c,m-L,m-W),s.arc(e+u,i-a,c,m-W,m),s.arc(e+d,i+r,c,m,m+W),s.arc(e-u,i+a,c,m+W,m+L),s.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*g,h=n?n/2:l,s.rect(e-h,i-l,2*h,2*l);break}m+=qt;case"rectRot":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),s.moveTo(e-d,i-r),s.lineTo(e+u,i-a),s.lineTo(e+d,i+r),s.lineTo(e-u,i+a),s.closePath();break;case"crossRot":m+=qt;case"cross":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),s.moveTo(e-d,i-r),s.lineTo(e+d,i+r),s.moveTo(e+u,i-a),s.lineTo(e-u,i+a);break;case"star":d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),s.moveTo(e-d,i-r),s.lineTo(e+d,i+r),s.moveTo(e+u,i-a),s.lineTo(e-u,i+a),m+=qt,d=Math.cos(m)*(n?n/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),s.moveTo(e-d,i-r),s.lineTo(e+d,i+r),s.moveTo(e+u,i-a),s.lineTo(e-u,i+a);break;case"line":a=n?n/2:Math.cos(m)*g,r=Math.sin(m)*g,s.moveTo(e-a,i-r),s.lineTo(e+a,i+r);break;case"dash":s.moveTo(e,i),s.lineTo(e+Math.cos(m)*(n?n/2:g),i+Math.sin(m)*g);break;case!1:s.closePath();break}s.fill(),t.borderWidth>0&&s.stroke()}}function pt(s,t,e){return e=e||.5,!t||s&&s.x>t.left-e&&s.x<t.right+e&&s.y>t.top-e&&s.y<t.bottom+e}function Re(s,t){s.save(),s.beginPath(),s.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),s.clip()}function Ie(s){s.restore()}function Kn(s,t,e,i,n){if(!t)return s.lineTo(e.x,e.y);if(n==="middle"){let o=(t.x+e.x)/2;s.lineTo(o,t.y),s.lineTo(o,e.y)}else n==="after"!=!!i?s.lineTo(t.x,e.y):s.lineTo(e.x,t.y);s.lineTo(e.x,e.y)}function Gn(s,t,e,i){if(!t)return s.lineTo(e.x,e.y);s.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function Lr(s,t){t.translation&&s.translate(t.translation[0],t.translation[1]),O(t.rotation)||s.rotate(t.rotation),t.color&&(s.fillStyle=t.color),t.textAlign&&(s.textAlign=t.textAlign),t.textBaseline&&(s.textBaseline=t.textBaseline)}function Er(s,t,e,i,n){if(n.strikethrough||n.underline){let o=s.measureText(i),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;s.strokeStyle=s.fillStyle,s.beginPath(),s.lineWidth=n.decorationWidth||2,s.moveTo(a,h),s.lineTo(r,h),s.stroke()}}function Rr(s,t){let e=s.fillStyle;s.fillStyle=t.color,s.fillRect(t.left,t.top,t.width,t.height),s.fillStyle=e}function Ht(s,t,e,i,n,o={}){let a=F(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(s.save(),s.font=n.string,Lr(s,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Rr(s,o.backdrop),r&&(o.strokeColor&&(s.strokeStyle=o.strokeColor),O(o.strokeWidth)||(s.lineWidth=o.strokeWidth),s.strokeText(c,e,i,o.maxWidth)),s.fillText(c,e,i,o.maxWidth),Er(s,e,i,c,o),i+=Number(n.lineHeight);s.restore()}function pe(s,t){let{x:e,y:i,w:n,h:o,radius:a}=t;s.arc(e+a.topLeft,i+a.topLeft,a.topLeft,1.5*L,L,!0),s.lineTo(e,i+o-a.bottomLeft),s.arc(e+a.bottomLeft,i+o-a.bottomLeft,a.bottomLeft,L,W,!0),s.lineTo(e+n-a.bottomRight,i+o),s.arc(e+n-a.bottomRight,i+o-a.bottomRight,a.bottomRight,W,0,!0),s.lineTo(e+n,i+a.topRight),s.arc(e+n-a.topRight,i+a.topRight,a.topRight,0,-W,!0),s.lineTo(e+a.topLeft,i)}var Ir=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Fr=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function zr(s,t){let e=(""+s).match(Ir);if(!e||e[1]==="normal")return t*1.2;switch(s=+e[2],e[3]){case"px":return s;case"%":s/=100;break}return t*s}var Br=s=>+s||0;function gs(s,t){let e={},i=T(t),n=i?Object.keys(t):t,o=T(s)?i?a=>D(s[a],s[t[a]]):a=>s[a]:()=>s;for(let a of n)e[a]=Br(o(a));return e}function bi(s){return gs(s,{top:"y",right:"x",bottom:"y",left:"x"})}function Vt(s){return gs(s,["topLeft","topRight","bottomLeft","bottomRight"])}function Z(s){let t=bi(s);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function X(s,t){s=s||{},t=t||B.font;let e=D(s.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=D(s.style,t.style);i&&!(""+i).match(Fr)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);let n={family:D(s.family,t.family),lineHeight:zr(D(s.lineHeight,t.lineHeight),e),size:e,style:i,weight:D(s.weight,t.weight),string:""};return n.string=Tr(n),n}function ge(s,t,e,i){let n=!0,o,a,r;for(o=0,a=s.length;o<a;++o)if(r=s[o],r!==void 0&&(t!==void 0&&typeof r=="function"&&(r=r(t),n=!1),e!==void 0&&F(r)&&(r=r[e%r.length],n=!1),r!==void 0))return i&&!n&&(i.cacheable=!1),r}function Jn(s,t,e){let{min:i,max:n}=s,o=ei(t,(n-i)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(i,-Math.abs(o)),max:a(n,o)}}function Ct(s,t){return Object.assign(Object.create(s),t)}function ms(s,t=[""],e,i,n=()=>s[0]){let o=e||s;typeof i>"u"&&(i=to("_fallback",s));let a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:o,_fallback:i,_getTarget:n,override:r=>ms([r,...s],t,o,i)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete s[0][l],!0},get(r,l){return Zn(r,l,()=>Ur(l,t,s,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(r,l){return On(r).includes(l)},ownKeys(r){return On(r)},set(r,l,c){let h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,!0}})}function Gt(s,t,e,i){let n={_cacheable:!1,_proxy:s,_context:t,_subProxy:e,_stack:new Set,_descriptors:xi(s,i),setContext:o=>Gt(s,o,e,i),override:o=>Gt(s.override(o),t,e,i)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete s[a],!0},get(o,a,r){return Zn(o,a,()=>Nr(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(s,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,a)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(o,a){return Reflect.has(s,a)},ownKeys(){return Reflect.ownKeys(s)},set(o,a,r){return s[a]=r,delete o[a],!0}})}function xi(s,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:n=t.allKeys}=s;return{allKeys:n,scriptable:e,indexable:i,isScriptable:Mt(e)?e:()=>e,isIndexable:Mt(i)?i:()=>i}}var $r=(s,t)=>s?s+cs(t):t,_i=(s,t)=>T(t)&&s!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Zn(s,t,e){if(Object.prototype.hasOwnProperty.call(s,t)||t==="constructor")return s[t];let i=e();return s[t]=i,i}function Nr(s,t,e){let{_proxy:i,_context:n,_subProxy:o,_descriptors:a}=s,r=i[t];return Mt(r)&&a.isScriptable(t)&&(r=Hr(t,r,s,e)),F(r)&&r.length&&(r=Vr(t,r,s,a.isIndexable)),_i(t,r)&&(r=Gt(r,n,o&&o[t],a)),r}function Hr(s,t,e,i){let{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(s))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+s);r.add(s);let l=t(o,a||i);return r.delete(s),_i(s,l)&&(l=yi(n._scopes,n,s,l)),l}function Vr(s,t,e,i){let{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&i(s))return t[o.index%t.length];if(T(t[0])){let l=t,c=n._scopes.filter(h=>h!==l);t=[];for(let h of l){let d=yi(c,n,s,h);t.push(Gt(d,o,a&&a[s],r))}}return t}function Qn(s,t,e){return Mt(s)?s(t,e):s}var Wr=(s,t)=>s===!0?t:typeof s=="string"?Pt(t,s):void 0;function jr(s,t,e,i,n){for(let o of t){let a=Wr(e,o);if(a){s.add(a);let r=Qn(a._fallback,e,n);if(typeof r<"u"&&r!==e&&r!==i)return r}else if(a===!1&&typeof i<"u"&&e!==i)return null}return!1}function yi(s,t,e,i){let n=t._rootScopes,o=Qn(t._fallback,e,i),a=[...s,...n],r=new Set;r.add(i);let l=An(r,a,e,o||e,i);return l===null||typeof o<"u"&&o!==e&&(l=An(r,a,o,l,i),l===null)?!1:ms(Array.from(r),[""],n,o,()=>Yr(t,e,i))}function An(s,t,e,i,n){for(;e;)e=jr(s,t,e,i,n);return e}function Yr(s,t,e){let i=s._getTarget();t in i||(i[t]={});let n=i[t];return F(n)&&T(e)?e:n||{}}function Ur(s,t,e,i){let n;for(let o of t)if(n=to($r(o,s),e),typeof n<"u")return _i(s,n)?yi(e,i,s,n):n}function to(s,t){for(let e of t){if(!e)continue;let i=e[s];if(typeof i<"u")return i}}function On(s){let t=s._keys;return t||(t=s._keys=Xr(s._scopes)),t}function Xr(s){let t=new Set;for(let e of s)for(let i of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(i);return Array.from(t)}function vi(s,t,e,i){let{iScale:n}=s,{key:o="r"}=this._parsing,a=new Array(i),r,l,c,h;for(r=0,l=i;r<l;++r)c=r+e,h=t[c],a[r]={r:n.parse(Pt(h,o),c)};return a}var qr=Number.EPSILON||1e-14,le=(s,t)=>t<s.length&&!s[t].skip&&s[t],eo=s=>s==="x"?"y":"x";function Kr(s,t,e,i){let n=s.skip?t:s,o=t,a=e.skip?t:e,r=rs(o,n),l=rs(a,o),c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;let 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 Gr(s,t,e){let i=s.length,n,o,a,r,l,c=le(s,0);for(let h=0;h<i-1;++h)if(l=c,c=le(s,h+1),!(!l||!c)){if(de(t[h],0,qr)){e[h]=e[h+1]=0;continue}n=e[h]/t[h],o=e[h+1]/t[h],r=Math.pow(n,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),e[h]=n*a*t[h],e[h+1]=o*a*t[h])}}function Jr(s,t,e="x"){let i=eo(e),n=s.length,o,a,r,l=le(s,0);for(let c=0;c<n;++c){if(a=r,r=l,l=le(s,c+1),!r)continue;let h=r[e],d=r[i];a&&(o=(h-a[e])/3,r[`cp1${e}`]=h-o,r[`cp1${i}`]=d-o*t[c]),l&&(o=(l[e]-h)/3,r[`cp2${e}`]=h+o,r[`cp2${i}`]=d+o*t[c])}}function Zr(s,t="x"){let e=eo(t),i=s.length,n=Array(i).fill(0),o=Array(i),a,r,l,c=le(s,0);for(a=0;a<i;++a)if(r=l,l=c,c=le(s,a+1),!!l){if(c){let h=c[t]-l[t];n[a]=h!==0?(c[e]-l[e])/h:0}o[a]=r?c?dt(n[a-1])!==dt(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}Gr(s,n,o),Jr(s,o,t)}function is(s,t,e){return Math.max(Math.min(s,e),t)}function Qr(s,t){let e,i,n,o,a,r=pt(s[0],t);for(e=0,i=s.length;e<i;++e)a=o,o=r,r=e<i-1&&pt(s[e+1],t),o&&(n=s[e],a&&(n.cp1x=is(n.cp1x,t.left,t.right),n.cp1y=is(n.cp1y,t.top,t.bottom)),r&&(n.cp2x=is(n.cp2x,t.left,t.right),n.cp2y=is(n.cp2y,t.top,t.bottom)))}function so(s,t,e,i,n){let o,a,r,l;if(t.spanGaps&&(s=s.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Zr(s,n);else{let c=i?s[s.length-1]:s[0];for(o=0,a=s.length;o<a;++o)r=s[o],l=Kr(c,r,s[Math.min(o+1,a-(i?0:1))%a],t.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}t.capBezierPoints&&Qr(s,e)}function bs(){return typeof window<"u"&&typeof document<"u"}function xs(s){let t=s.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ls(s,t,e){let i;return typeof s=="string"?(i=parseInt(s,10),s.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=s,i}var _s=s=>s.ownerDocument.defaultView.getComputedStyle(s,null);function tl(s,t){return _s(s).getPropertyValue(t)}var el=["top","right","bottom","left"];function Kt(s,t,e){let i={};e=e?"-"+e:"";for(let n=0;n<4;n++){let o=el[n];i[o]=parseFloat(s[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}var sl=(s,t,e)=>(s>0||t>0)&&(!e||!e.shadowRoot);function il(s,t){let e=s.touches,i=e&&e.length?e[0]:s,{offsetX:n,offsetY:o}=i,a=!1,r,l;if(sl(n,o,s.target))r=n,l=o;else{let c=t.getBoundingClientRect();r=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Wt(s,t){if("native"in s)return s;let{canvas:e,currentDevicePixelRatio:i}=t,n=_s(e),o=n.boxSizing==="border-box",a=Kt(n,"padding"),r=Kt(n,"border","width"),{x:l,y:c,box:h}=il(s,e),d=a.left+(h&&r.left),u=a.top+(h&&r.top),{width:f,height:p}=t;return o&&(f-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-d)/f*e.width/i),y:Math.round((c-u)/p*e.height/i)}}function nl(s,t,e){let i,n;if(t===void 0||e===void 0){let o=s&&xs(s);if(!o)t=s.clientWidth,e=s.clientHeight;else{let a=o.getBoundingClientRect(),r=_s(o),l=Kt(r,"border","width"),c=Kt(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=ls(r.maxWidth,o,"clientWidth"),n=ls(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||as,maxHeight:n||as}}var Bt=s=>Math.round(s*10)/10;function io(s,t,e,i){let n=_s(s),o=Kt(n,"margin"),a=ls(n.maxWidth,s,"clientWidth")||as,r=ls(n.maxHeight,s,"clientHeight")||as,l=nl(s,t,e),{width:c,height:h}=l;if(n.boxSizing==="content-box"){let u=Kt(n,"border","width"),f=Kt(n,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,i?c/i:h-o.height),c=Bt(Math.min(c,a,l.maxWidth)),h=Bt(Math.min(h,r,l.maxHeight)),c&&!h&&(h=Bt(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&h>l.height&&(h=l.height,c=Bt(Math.floor(h*i))),{width:c,height:h}}function wi(s,t,e){let i=t||1,n=Bt(s.height*i),o=Bt(s.width*i);s.height=Bt(s.height),s.width=Bt(s.width);let a=s.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${s.height}px`,a.style.width=`${s.width}px`),s.currentDevicePixelRatio!==i||a.height!==n||a.width!==o?(s.currentDevicePixelRatio=i,a.height=n,a.width=o,s.ctx.setTransform(i,0,0,i,0,0),!0):!1}var no=function(){let s=!1;try{let t={get passive(){return s=!0,!1}};bs()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return s}();function ki(s,t){let e=tl(s,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function zt(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:s.y+e*(t.y-s.y)}}function oo(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:i==="middle"?e<.5?s.y:t.y:i==="after"?e<1?s.y:t.y:e>0?t.y:s.y}}function ao(s,t,e,i){let n={x:s.cp2x,y:s.cp2y},o={x:t.cp1x,y:t.cp1y},a=zt(s,n,e),r=zt(n,o,e),l=zt(o,t,e),c=zt(a,r,e),h=zt(r,l,e);return zt(c,h,e)}var ol=function(s,t){return{x(e){return s+s+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},al=function(){return{x(s){return s},setWidth(s){},textAlign(s){return s},xPlus(s,t){return s+t},leftForLtr(s,t){return s}}};function Zt(s,t,e){return s?ol(t,e):al()}function Mi(s,t){let e,i;(t==="ltr"||t==="rtl")&&(e=s.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),s.prevTextDirection=i)}function Si(s,t){t!==void 0&&(delete s.prevTextDirection,s.canvas.style.setProperty("direction",t[0],t[1]))}function ro(s){return s==="angle"?{between:ue,compare:kr,normalize:G}:{between:mt,compare:(t,e)=>t-e,normalize:t=>t}}function Tn({start:s,end:t,count:e,loop:i,style:n}){return{start:s%e,end:t%e,loop:i&&(t-s+1)%e===0,style:n}}function rl(s,t,e){let{property:i,start:n,end:o}=e,{between:a,normalize:r}=ro(i),l=t.length,{start:c,end:h,loop:d}=s,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&a(r(t[c%l][i]),n,o);++u)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:s.style}}function Pi(s,t,e){if(!e)return[s];let{property:i,start:n,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=ro(i),{start:h,end:d,loop:u,style:f}=rl(s,t,e),p=[],g=!1,m=null,b,x,v,y=()=>l(n,v,b)&&r(n,v)!==0,_=()=>r(o,b)===0||l(o,v,b),w=()=>g||y(),k=()=>!g||_();for(let M=h,S=h;M<=d;++M)x=t[M%a],!x.skip&&(b=c(x[i]),b!==v&&(g=l(b,n,o),m===null&&w()&&(m=r(b,n)===0?M:S),m!==null&&k()&&(p.push(Tn({start:m,end:M,loop:u,count:a,style:f})),m=null),S=M,v=b));return m!==null&&p.push(Tn({start:m,end:d,loop:u,count:a,style:f})),p}function Ci(s,t){let e=[],i=s.segments;for(let n=0;n<i.length;n++){let o=Pi(i[n],s.points,t);o.length&&e.push(...o)}return e}function ll(s,t,e,i){let n=0,o=t-1;if(e&&!i)for(;n<t&&!s[n].skip;)n++;for(;n<t&&s[n].skip;)n++;for(n%=t,e&&(o+=n);o>n&&s[o%t].skip;)o--;return o%=t,{start:n,end:o}}function cl(s,t,e,i){let n=s.length,o=[],a=t,r=s[t],l;for(l=t+1;l<=e;++l){let c=s[l%n];c.skip||c.stop?r.skip||(i=!1,o.push({start:t%n,end:(l-1)%n,loop:i}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%n,end:a%n,loop:i}),o}function lo(s,t){let e=s.points,i=s.options.spanGaps,n=e.length;if(!n)return[];let o=!!s._loop,{start:a,end:r}=ll(e,n,o,i);if(i===!0)return Ln(s,[{start:a,end:r,loop:o}],e,t);let l=r<a?r+n:r,c=!!s._fullLoop&&a===0&&r===n-1;return Ln(s,cl(e,a,l,c),e,t)}function Ln(s,t,e,i){return!i||!i.setContext||!e?t:hl(s,t,e,i)}function hl(s,t,e,i){let n=s._chart.getContext(),o=En(s.options),{_datasetIndex:a,options:{spanGaps:r}}=s,l=e.length,c=[],h=o,d=t[0].start,u=d;function f(p,g,m,b){let x=r?-1:1;if(p!==g){for(p+=l;e[p%l].skip;)p-=x;for(;e[g%l].skip;)g+=x;p%l!==g%l&&(c.push({start:p%l,end:g%l,loop:m,style:b}),h=b,d=g%l)}}for(let p of t){d=r?d:p.start;let g=e[d%l],m;for(u=d+1;u<=p.end;u++){let b=e[u%l];m=En(i.setContext(Ct(n,{type:"segment",p0:g,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),dl(m,h)&&f(d,u-1,p.loop,h),g=b,h=m}d<u-1&&f(d,u-1,p.loop,h)}return c}function En(s){return{backgroundColor:s.backgroundColor,borderCapStyle:s.borderCapStyle,borderDash:s.borderDash,borderDashOffset:s.borderDashOffset,borderJoinStyle:s.borderJoinStyle,borderWidth:s.borderWidth,borderColor:s.borderColor}}function dl(s,t){if(!t)return!1;let e=[],i=function(n,o){return fi(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(s,i)!==JSON.stringify(t,i)}function ns(s,t,e){return s.options.clip?s[e]:t[e]}function ul(s,t){let{xScale:e,yScale:i}=s;return e&&i?{left:ns(e,t,"left"),right:ns(e,t,"right"),top:ns(i,t,"top"),bottom:ns(i,t,"bottom")}:t}function Di(s,t){let e=t._clip;if(e.disabled)return!1;let i=ul(t,s.chartArea);return{left:e.left===!1?0:i.left-(e.left===!0?0:e.left),right:e.right===!1?s.width:i.right+(e.right===!0?0:e.right),top:e.top===!1?0:i.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?s.height:i.bottom+(e.bottom===!0?0:e.bottom)}}var Ni=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){let o=e.listeners[n],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=ci.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;let o=i.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},Dt=new Ni,co="transparent",fl={boolean(s,t,e){return e>.5?t:s},color(s,t,e){let i=pi(s||co),n=i.valid&&pi(t||co);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}},Hi=class{constructor(t,e,i,n){let o=e[i];n=ge([t.to,n,o,t.from]);let a=ge([t.from,o,n]);this._active=!0,this._fn=t.fn||fl[t.type||typeof a],this._easing=ae[t.easing]||ae.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let n=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ge([t.to,e,n,t.from]),this._from=ge([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e<i),!this._active){this._target[n]=r,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let n=0;n<i.length;n++)i[n][e]()}},Ds=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!T(t))return;let e=Object.keys(B.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{let o=t[n];if(!T(o))return;let a={};for(let r of e)a[r]=o[r];(F(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){let i=e.options,n=gl(t,i);if(!n)return[];let o=this._createAnimations(n,i);return i.$shared&&pl(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}let h=e[c],d=o[c],u=i.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new Hi(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return Dt.add(this._chart,i),!0}};function pl(s,t){let e=[],i=Object.keys(t);for(let n=0;n<i.length;n++){let o=s[i[n]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function gl(s,t){if(!t)return;let e=s.options;if(!e){s.options=t;return}return e.$shared&&(s.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function ho(s,t){let e=s&&s.options||{},i=e.reverse,n=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:i?o:n,end:i?n:o}}function ml(s,t,e){if(e===!1)return!1;let i=ho(s,e),n=ho(t,e);return{top:n.end,right:i.end,bottom:n.start,left:i.start}}function bl(s){let t,e,i,n;return T(s)?(t=s.top,e=s.right,i=s.bottom,n=s.left):t=e=i=n=s,{top:t,right:e,bottom:i,left:n,disabled:s===!1}}function ca(s,t){let e=[],i=s._getSortedDatasetMetas(t),n,o;for(n=0,o=i.length;n<o;++n)e.push(i[n].index);return e}function uo(s,t,e,i={}){let n=s.keys,o=i.mode==="single",a,r,l,c;if(t===null)return;let h=!1;for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===e){if(h=!0,i.all)continue;break}c=s.values[l],V(c)&&(o||t===0||dt(t)===dt(c))&&(t+=c)}return!h&&!i.all?0:t}function xl(s,t){let{iScale:e,vScale:i}=t,n=e.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",a=Object.keys(s),r=new Array(a.length),l,c,h;for(l=0,c=a.length;l<c;++l)h=a[l],r[l]={[n]:h,[o]:s[h]};return r}function Ai(s,t){let e=s&&s.options.stacked;return e||e===void 0&&t.stack!==void 0}function _l(s,t,e){return`${s.id}.${t.id}.${e.stack||e.type}`}function yl(s){let{min:t,max:e,minDefined:i,maxDefined:n}=s.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}function vl(s,t,e){let i=s[t]||(s[t]={});return i[e]||(i[e]={})}function fo(s,t,e,i){for(let n of t.getMatchingVisibleMetas(i).reverse()){let o=s[n.index];if(e&&o>0||!e&&o<0)return n.index}return null}function po(s,t){let{chart:e,_cachedMeta:i}=s,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,h=_l(o,a,i),d=t.length,u;for(let f=0;f<d;++f){let p=t[f],{[l]:g,[c]:m}=p,b=p._stacks||(p._stacks={});u=b[c]=vl(n,h,g),u[r]=m,u._top=fo(u,a,!0,i.type),u._bottom=fo(u,a,!1,i.type);let x=u._visualValues||(u._visualValues={});x[r]=m}}function Oi(s,t){let e=s.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function wl(s,t){return Ct(s,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function kl(s,t,e){return Ct(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Fe(s,t){let e=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){t=t||s._parsed;for(let n of t){let o=n._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}var Ti=s=>s==="reset"||s==="none",go=(s,t)=>t?s:Object.assign({},s),Ml=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:ca(e,!0),values:null},_t=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ai(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&&Fe(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(d,u,f,p)=>d==="x"?u:d==="r"?p:f,o=e.xAxisID=D(i.xAxisID,Oi(t,"x")),a=e.yAxisID=D(i.yAxisID,Oi(t,"y")),r=e.rAxisID=D(i.rAxisID,Oi(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&ri(this._data,this),t._stacked&&Fe(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(T(e)){let n=this._cachedMeta;this._data=xl(e,n)}else if(i!==e){if(i){ri(i,this);let n=this._cachedMeta;Fe(n),n._parsed=[]}e&&Object.isExtensible(e)&&jn(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),n=!1;this._dataCheck();let o=e._stacked;e._stacked=Ai(e.vScale,e),e.stack!==i.stack&&(n=!0,Fe(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(po(this,e._parsed),e._stacked=Ai(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:a}=i,r=o.axis,l=t===0&&e===n.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,d,u;if(this._parsing===!1)i._parsed=n,i._sorted=!0,u=n;else{F(n[t])?u=this.parseArrayData(i,n,t,e):T(n[t])?u=this.parseObjectData(i,n,t,e):u=this.parsePrimitiveData(i,n,t,e);let f=()=>d[r]===null||c&&d[r]<c[r];for(h=0;h<e;++h)i._parsed[h+t]=d=u[h],l&&(f()&&(l=!1),c=d);i._sorted=l}a&&po(this,u)}parsePrimitiveData(t,e,i,n){let{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),h=o===a,d=new Array(n),u,f,p;for(u=0,f=n;u<f;++u)p=u+i,d[u]={[r]:h||o.parse(c[p],p),[l]:a.parse(e[p],p)};return d}parseArrayData(t,e,i,n){let{xScale:o,yScale:a}=t,r=new Array(n),l,c,h,d;for(l=0,c=n;l<c;++l)h=l+i,d=e[h],r[l]={x:o.parse(d[0],h),y:a.parse(d[1],h)};return r}parseObjectData(t,e,i,n){let{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(n),h,d,u,f;for(h=0,d=n;h<d;++h)u=h+i,f=e[u],c[h]={x:o.parse(Pt(f,r),u),y:a.parse(Pt(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let n=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:ca(n,!0),values:e._stacks[t.axis]._visualValues};return uo(r,a,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){let o=i[e.axis],a=o===null?NaN:o,r=n&&i._stacks[e.axis];n&&r&&(n.values=r,a=uo(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,a=n.length,r=this._getOtherScale(t),l=Ml(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=yl(r),u,f;function p(){f=n[u];let g=f[r.axis];return!V(f[t.axis])||h>g||d<g}for(u=0;u<a&&!(!p()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!p()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],n,o,a;for(n=0,o=e.length;n<o;++n)a=e[n][t.axis],V(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=bl(D(this.options.clip,ml(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||n.length-r,c=this.options.drawActiveElementsOnTop,h;for(i.dataset&&i.dataset.draw(t,o,r,l),h=r;h<r+l;++h){let d=n[h];d.hidden||(d.active&&c?a.push(d):d.draw(t,o))}for(h=0;h<a.length;++h)a[h].draw(t,o)}getStyle(t,e){let i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){let n=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];o=a.$context||(a.$context=kl(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=wl(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){let n=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&he(i);if(r)return go(r,l);let c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),h),f=Object.keys(B.elements[t]),p=()=>this.getContext(i,n,e),g=c.resolveNamedOptions(u,f,p,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(go(g,l))),g}_resolveAnimations(t,e,i){let n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){let h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,i,e))}let c=new Ds(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ti(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,n){Ti(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Ti(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;let o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];let n=i.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){let n=this._cachedMeta,o=n.data,a=t+e,r,l=c=>{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let n=i._parsed.splice(t,e);i._stacked&&Fe(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};function Sl(s,t){if(!s._cache.$bar){let e=s.getMatchingVisibleMetas(t),i=[];for(let n=0,o=e.length;n<o;n++)i=i.concat(e[n].controller.getAllParsedValues(s));s._cache.$bar=li(i.sort((n,o)=>n-o))}return s._cache.$bar}function Pl(s){let t=s.iScale,e=Sl(t,s.type),i=t._length,n,o,a,r,l=()=>{a===32767||a===-32768||(he(r)&&(i=Math.min(i,Math.abs(a-r)||i)),r=a)};for(n=0,o=e.length;n<o;++n)a=t.getPixelForValue(e[n]),l();for(r=void 0,n=0,o=t.ticks.length;n<o;++n)a=t.getPixelForTick(n),l();return i}function Cl(s,t,e,i){let n=e.barThickness,o,a;return O(n)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=n*i,a=1),{chunk:o/i,ratio:a,start:t.pixels[s]-o/2}}function Dl(s,t,e,i){let n=t.pixels,o=n[s],a=s>0?n[s-1]:null,r=s<n.length-1?n[s+1]:null,l=e.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);let c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/i,ratio:e.barPercentage,start:c}}function Al(s,t,e,i){let n=e.parse(s[0],i),o=e.parse(s[1],i),a=Math.min(n,o),r=Math.max(n,o),l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function ha(s,t,e,i){return F(s)?Al(s,t,e,i):t[e.axis]=e.parse(s,i),t}function mo(s,t,e,i){let n=s.iScale,o=s.vScale,a=n.getLabels(),r=n===o,l=[],c,h,d,u;for(c=e,h=e+i;c<h;++c)u=t[c],d={},d[n.axis]=r||n.parse(a[c],c),l.push(ha(u,d,o,c));return l}function Li(s){return s&&s.barStart!==void 0&&s.barEnd!==void 0}function Ol(s,t,e){return s!==0?dt(s):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Tl(s){let t,e,i,n,o;return s.horizontal?(t=s.base>s.x,e="left",i="right"):(t=s.base<s.y,e="bottom",i="top"),t?(n="end",o="start"):(n="start",o="end"),{start:e,end:i,reverse:t,top:n,bottom:o}}function Ll(s,t,e,i){let n=t.borderSkipped,o={};if(!n){s.borderSkipped=o;return}if(n===!0){s.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:a,end:r,reverse:l,top:c,bottom:h}=Tl(s);n==="middle"&&e&&(s.enableBorderRadius=!0,(e._top||0)===i?n=c:(e._bottom||0)===i?n=h:(o[bo(h,a,r,l)]=!0,n=c)),o[bo(n,a,r,l)]=!0,s.borderSkipped=o}function bo(s,t,e,i){return i?(s=El(s,t,e),s=xo(s,e,t)):s=xo(s,t,e),s}function El(s,t,e){return s===t?e:s===e?t:s}function xo(s,t,e){return s==="start"?t:s==="end"?e:s}function Rl(s,{inflateAmount:t},e){s.inflateAmount=t==="auto"?e===1?.33:0:t}var Vi=class extends _t{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,n){return mo(t,e,i,n)}parseArrayData(t,e,i,n){return mo(t,e,i,n)}parseObjectData(t,e,i,n){let{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,h=a.axis==="x"?r:l,d=[],u,f,p,g;for(u=i,f=i+n;u<f;++u)g=e[u],p={},p[o.axis]=o.parse(Pt(g,c),u),d.push(ha(Pt(g,h),p,a,u));return d}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);let o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),a=o._custom,r=Li(a)?"["+a.start+", "+a.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){let o=n==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+i;f++){let p=this.getParsed(f),g=o||O(p[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,h),b=(p._stacks||{})[r.axis],x={horizontal:c,base:g.base,enableBorderRadius:!b||Li(p._custom)||a===b._top||a===b._bottom,x:c?g.head:m.center,y:c?m.center:g.head,height:c?m.size:Math.abs(g.size),width:c?Math.abs(g.size):m.size};u&&(x.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));let v=x.options||t[f].options;Ll(x,v,b,a),Rl(x,v,h.ratio),this.updateElement(t[f],f,x,n)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],c=h=>{let d=h._parsed.find(f=>f[i.axis]===l),u=d&&d[h.vScale.axis];if(O(u)||isNaN(u))return!0};for(let h of n)if(!(e!==void 0&&c(h))&&((o===!1||a.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[D(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let n=this._getStacks(t,i),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,n=[],o,a;for(o=0,a=e.data.length;o<a;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));let r=t.barThickness;return{min:r||Pl(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,h=Li(c),d=l[e.axis],u=0,f=i?this.applyStack(e,l,i):d,p,g;f!==d&&(u=f-d,f=d),h&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&dt(d)!==dt(c.barEnd)&&(u=0),u+=d);let m=!O(o)&&!h?o:u,b=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(u+f):p=b,g=p-b,Math.abs(g)<a){g=Ol(g,e,r)*a,d===r&&(b-=g/2);let x=e.getPixelForDecimal(0),v=e.getPixelForDecimal(1),y=Math.min(x,v),_=Math.max(x,v);b=Math.max(Math.min(b,_),y),p=b+g,i&&!h&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(p)-e.getValueForPixel(b))}if(b===e.getPixelForValue(r)){let x=dt(g)*e.getLineWidthForValue(r)/2;b+=x,g-=x}return{size:g,base:b,head:p,center:p+g/2}}_calculateBarIndexPixels(t,e){let i=e.scale,n=this.options,o=n.skipNull,a=D(n.maxBarThickness,1/0),r,l,c=this._getAxisCount();if(e.grouped){let h=o?this._getStackCount(t):e.stackCount,d=n.barThickness==="flex"?Dl(t,e,n,h*c):Cl(t,e,n,h*c),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(D(u,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=d.start+d.chunk*p+d.chunk/2,l=Math.min(a,d.chunk*d.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){let t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length,o=0;for(;o<n;++o)this.getParsed(o)[e.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}},Wi=class extends _t{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,n){let o=super.parsePrimitiveData(t,e,i,n);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+i).radius;return o}parseArrayData(t,e,i,n){let o=super.parseArrayData(t,e,i,n);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=D(r[2],this.resolveDataElementOptions(a+i).radius)}return o}parseObjectData(t,e,i,n){let o=super.parseObjectData(t,e,i,n);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=D(r&&r.r&&+r.r,this.resolveDataElementOptions(a+i).radius)}return o}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,n),h=a.axis,d=r.axis;for(let u=e;u<e+i;u++){let f=t[u],p=!o&&this.getParsed(u),g={},m=g[h]=o?a.getPixelForDecimal(.5):a.getPixelForValue(p[h]),b=g[d]=o?r.getBasePixel():r.getPixelForValue(p[d]);g.skip=isNaN(m)||isNaN(b),c&&(g.options=l||this.resolveDataElementOptions(u,f.active?"active":n),o&&(g.options.radius=0)),this.updateElement(f,u,g,n)}}resolveDataElementOptions(t,e){let i=this.getParsed(t),n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));let o=n.radius;return e!=="active"&&(n.radius=0),n.radius+=D(i&&i._custom,o),n}};function Il(s,t,e){let i=1,n=1,o=0,a=0;if(t<z){let r=s,l=r+t,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(v,y,_)=>ue(v,r,l,!0)?1:Math.max(y,y*e,_,_*e),p=(v,y,_)=>ue(v,r,l,!0)?-1:Math.min(y,y*e,_,_*e),g=f(0,c,d),m=f(W,h,u),b=p(L,c,d),x=p(L+W,h,u);i=(g-b)/2,n=(m-x)/2,o=-(g+b)/2,a=-(m+x)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:a}}var We=class extends _t{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{let d=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:n,pointStyle:i,borderRadius:a&&(r||d.borderRadius),index:c}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=i;else{let o=l=>+i[l];if(T(i[t])){let{key:l="value"}=this._parsing;o=c=>+Pt(i[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)n._parsed[a]=o(a)}}_getRotation(){return ct(this.options.rotation-90)}_getCircumference(){return ct(this.options.circumference)}_getRotationExtents(){let t=z,e=-z;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){let n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),a=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){let e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(In(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:p,offsetY:g}=Il(d,h,l),m=(i.width-a)/u,b=(i.height-a)/f,x=Math.max(Math.min(m,b)/2,0),v=ei(this.options.radius,x),y=Math.max(v*l,0),_=(v-y)/this._getVisibleDatasetWeightTotal();this.offsetX=p*v,this.offsetY=g*v,n.total=this.calculateTotal(),this.outerRadius=v-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){let i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||n._parsed[t]===null||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/z)}updateElements(t,e,i,n){let o=n==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,h=(r.left+r.right)/2,d=(r.top+r.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,p=u?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(e,n),b=this._getRotation(),x;for(x=0;x<e;++x)b+=this._circumference(x,o);for(x=e;x<e+i;++x){let v=this._circumference(x,o),y=t[x],_={x:h+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+v,circumference:v,outerRadius:p,innerRadius:f};m&&(_.options=g||this.resolveDataElementOptions(x,y.active?"active":n)),b+=v,this.updateElement(y,x,_,n)}}calculateTotal(){let t=this._cachedMeta,e=t.data,i=0,n;for(n=0;n<e.length;n++){let o=t._parsed[n];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(n)&&!e[n].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?z*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=fe(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,n,o,a,r,l;if(!t){for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){a=i.getDatasetMeta(n),t=a.data,r=a.controller;break}}if(!t)return 0;for(n=0,o=t.length;n<o;++n)l=r.resolveDataElementOptions(n),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){let o=this.resolveDataElementOptions(i);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(D(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},ji=class extends _t{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=di(e,n,a);this._drawStart=r,this._drawCount=l,ui(e)&&(r=0,l=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(n,r,l,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=r.axis,{spanGaps:p,segment:g}=this.options,m=Jt(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||n==="none",x=e+i,v=t.length,y=e>0&&this.getParsed(e-1);for(let _=0;_<v;++_){let w=t[_],k=b?w:{};if(_<e||_>=x){k.skip=!0;continue}let M=this.getParsed(_),S=O(M[f]),P=k[u]=a.getPixelForValue(M[u],_),C=k[f]=o||S?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,M,l):M[f],_);k.skip=isNaN(P)||isNaN(C)||S,k.stop=_>0&&Math.abs(M[u]-y[u])>m,g&&(k.parsed=M,k.raw=c.data[_]),d&&(k.options=h||this.resolveDataElementOptions(_,w.active?"active":n)),b||this.updateElement(w,_,k,n),y=M}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;let o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},As=class extends _t{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map((o,a)=>{let l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=fe(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return vi.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,n)=>{let o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,n){let o=n==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,u=c.getIndexAngle(0)-.5*L,f=u,p,g=360/this.countVisibleElements();for(p=0;p<e;++p)f+=this._computeAngle(p,n,g);for(p=e;p<e+i;p++){let m=t[p],b=f,x=f+this._computeAngle(p,n,g),v=a.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=x,o&&(l.animateScale&&(v=0),l.animateRotate&&(b=x=u));let y={x:h,y:d,innerRadius:0,outerRadius:v,startAngle:b,endAngle:x,options:this.resolveDataElementOptions(p,m.active?"active":n)};this.updateElement(m,p,y,n)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((i,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?ct(this.resolveDataElementOptions(t,e).angle||i):0}},Yi=class extends We{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},Ui=class extends _t{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return vi.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let r={_loop:!0,_fullLoop:o.length===n.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){let o=this._cachedMeta.rScale,a=n==="reset";for(let r=e;r<e+i;r++){let l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":n),h=o.getPointPositionForValue(r,this.getParsed(r).r),d=a?o.xCenter:h.x,u=a?o.yCenter:h.y,f={x:d,y:u,angle:h.angle,skip:isNaN(d)||isNaN(u),options:c};this.updateElement(l,r,f,n)}}},Xi=class extends _t{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:i[t]||"",value:"("+r+", "+l+")"}}update(t){let e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled,{start:o,count:a}=di(e,i,n);if(this._drawStart=o,this._drawCount=a,ui(e)&&(o=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:r,_dataset:l}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=i;let c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!n,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(h),u=this.includeOptions(n,d),f=a.axis,p=r.axis,{spanGaps:g,segment:m}=this.options,b=Jt(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||n==="none",v=e>0&&this.getParsed(e-1);for(let y=e;y<e+i;++y){let _=t[y],w=this.getParsed(y),k=x?_:{},M=O(w[p]),S=k[f]=a.getPixelForValue(w[f],y),P=k[p]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,w,l):w[p],y);k.skip=isNaN(S)||isNaN(P)||M,k.stop=y>0&&Math.abs(w[f]-v[f])>b,m&&(k.parsed=w,k.raw=c.data[y]),u&&(k.options=d||this.resolveDataElementOptions(y,_.active?"active":n)),x||this.updateElement(_,y,k,n),v=w}this.updateSharedOptions(d,n,h)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}let i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;let o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,a)/2}},Fl=Object.freeze({__proto__:null,BarController:Vi,BubbleController:Wi,DoughnutController:We,LineController:ji,PieController:Yi,PolarAreaController:As,RadarController:Ui,ScatterController:Xi});function Qt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var qi=class s{static override(t){Object.assign(s.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Qt()}parse(){return Qt()}format(){return Qt()}add(){return Qt()}diff(){return Qt()}startOf(){return Qt()}endOf(){return Qt()}},zl={_date:qi};function Bl(s,t,e,i){let{controller:n,data:o,_sorted:a}=s,r=n._cachedMeta.iScale,l=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){let c=r._reversePixels?Hn:ft;if(i){if(n._sharedOptions){let h=o[0],d=typeof h.getRange=="function"&&h.getRange(t);if(d){let u=c(o,t,e-d),f=c(o,t,e+d);return{lo:u.lo,hi:f.hi}}}}else{let h=c(o,t,e);if(l){let{vScale:d}=n._cachedMeta,{_parsed:u}=s,f=u.slice(0,h.lo+1).reverse().findIndex(g=>!O(g[d.axis]));h.lo-=Math.max(0,f);let p=u.slice(h.hi).findIndex(g=>!O(g[d.axis]));h.hi+=Math.max(0,p)}return h}}return{lo:0,hi:o.length-1}}function qe(s,t,e,i,n){let o=s.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r<l;++r){let{index:c,data:h}=o[r],{lo:d,hi:u}=Bl(o[r],t,a,n);for(let f=d;f<=u;++f){let p=h[f];p.skip||i(p,c,f)}}}function $l(s){let t=s.indexOf("x")!==-1,e=s.indexOf("y")!==-1;return function(i,n){let o=t?Math.abs(i.x-n.x):0,a=e?Math.abs(i.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Ei(s,t,e,i,n){let o=[];return!n&&!s.isPointInArea(t)||qe(s,e,t,function(r,l,c){!n&&!pt(r,s.chartArea,0)||r.inRange(t.x,t.y,i)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function Nl(s,t,e,i){let n=[];function o(a,r,l){let{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],i),{angle:d}=ai(a,{x:t.x,y:t.y});ue(d,c,h)&&n.push({element:a,datasetIndex:r,index:l})}return qe(s,e,t,o),n}function Hl(s,t,e,i,n,o){let a=[],r=$l(e),l=Number.POSITIVE_INFINITY;function c(h,d,u){let f=h.inRange(t.x,t.y,n);if(i&&!f)return;let p=h.getCenterPoint(n);if(!(!!o||s.isPointInArea(p))&&!f)return;let m=r(t,p);m<l?(a=[{element:h,datasetIndex:d,index:u}],l=m):m===l&&a.push({element:h,datasetIndex:d,index:u})}return qe(s,e,t,c),a}function Ri(s,t,e,i,n,o){return!o&&!s.isPointInArea(t)?[]:e==="r"&&!i?Nl(s,t,e,n):Hl(s,t,e,i,n,o)}function _o(s,t,e,i,n){let o=[],a=e==="x"?"inXRange":"inYRange",r=!1;return qe(s,e,t,(l,c,h)=>{l[a]&&l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,n))}),i&&!r?[]:o}var Vl={evaluateInteractionItems:qe,modes:{index(s,t,e,i){let n=Wt(t,s),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?Ei(s,n,o,i,a):Ri(s,n,o,!1,i,a),l=[];return r.length?(s.getSortedVisibleDatasetMetas().forEach(c=>{let h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(s,t,e,i){let n=Wt(t,s),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?Ei(s,n,o,i,a):Ri(s,n,o,!1,i,a);if(r.length>0){let l=r[0].datasetIndex,c=s.getDatasetMeta(l).data;r=[];for(let h=0;h<c.length;++h)r.push({element:c[h],datasetIndex:l,index:h})}return r},point(s,t,e,i){let n=Wt(t,s),o=e.axis||"xy",a=e.includeInvisible||!1;return Ei(s,n,o,i,a)},nearest(s,t,e,i){let n=Wt(t,s),o=e.axis||"xy",a=e.includeInvisible||!1;return Ri(s,n,o,e.intersect,i,a)},x(s,t,e,i){let n=Wt(t,s);return _o(s,n,"x",e.intersect,i)},y(s,t,e,i){let n=Wt(t,s);return _o(s,n,"y",e.intersect,i)}}},da=["left","top","right","bottom"];function ze(s,t){return s.filter(e=>e.pos===t)}function yo(s,t){return s.filter(e=>da.indexOf(e.pos)===-1&&e.box.axis===t)}function Be(s,t){return s.sort((e,i)=>{let n=t?i:e,o=t?e:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Wl(s){let t=[],e,i,n,o,a,r;for(e=0,i=(s||[]).length;e<i;++e)n=s[e],{position:o,options:{stack:a,stackWeight:r=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return t}function jl(s){let t={};for(let e of s){let{stack:i,pos:n,stackWeight:o}=e;if(!i||!da.includes(n))continue;let a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function Yl(s,t){let e=jl(s),{vBoxMaxWidth:i,hBoxMaxHeight:n}=t,o,a,r;for(o=0,a=s.length;o<a;++o){r=s[o];let{fullSize:l}=r.box,c=e[r.stack],h=c&&r.stackWeight/c.weight;r.horizontal?(r.width=h?h*i:l&&t.availableWidth,r.height=n):(r.width=i,r.height=h?h*n:l&&t.availableHeight)}return e}function Ul(s){let t=Wl(s),e=Be(t.filter(c=>c.box.fullSize),!0),i=Be(ze(t,"left"),!0),n=Be(ze(t,"right")),o=Be(ze(t,"top"),!0),a=Be(ze(t,"bottom")),r=yo(t,"x"),l=yo(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:ze(t,"chartArea"),vertical:i.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function vo(s,t,e,i){return Math.max(s[e],t[e])+Math.max(s[i],t[i])}function ua(s,t){s.top=Math.max(s.top,t.top),s.left=Math.max(s.left,t.left),s.bottom=Math.max(s.bottom,t.bottom),s.right=Math.max(s.right,t.right)}function Xl(s,t,e,i){let{pos:n,box:o}=e,a=s.maxPadding;if(!T(n)){e.size&&(s[n]-=e.size);let d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,s[n]+=e.size}o.getPadding&&ua(a,o.getPadding());let r=Math.max(0,t.outerWidth-vo(a,s,"left","right")),l=Math.max(0,t.outerHeight-vo(a,s,"top","bottom")),c=r!==s.w,h=l!==s.h;return s.w=r,s.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function ql(s){let t=s.maxPadding;function e(i){let n=Math.max(t[i]-s[i],0);return s[i]+=n,n}s.y+=e("top"),s.x+=e("left"),e("right"),e("bottom")}function Kl(s,t){let e=t.maxPadding;function i(n){let o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return i(s?["left","right"]:["top","bottom"])}function He(s,t,e,i){let n=[],o,a,r,l,c,h;for(o=0,a=s.length,c=0;o<a;++o){r=s[o],l=r.box,l.update(r.width||t.w,r.height||t.h,Kl(r.horizontal,t));let{same:d,other:u}=Xl(t,e,r,i);c|=d&&n.length,h=h||u,l.fullSize||n.push(r)}return c&&He(n,t,e,i)||h}function ys(s,t,e,i,n){s.top=e,s.left=t,s.right=t+i,s.bottom=e+n,s.width=i,s.height=n}function wo(s,t,e,i){let n=e.padding,{x:o,y:a}=t;for(let r of s){let l=r.box,c=i[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/c.weight||1;if(r.horizontal){let d=t.w*h,u=c.size||l.height;he(c.start)&&(a=c.start),l.fullSize?ys(l,n.left,a,e.outerWidth-n.right-n.left,u):ys(l,t.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom}else{let d=t.h*h,u=c.size||l.width;he(c.start)&&(o=c.start),l.fullSize?ys(l,o,n.top,u,e.outerHeight-n.bottom-n.top):ys(l,o,t.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=a}var tt={addBox(s,t){s.boxes||(s.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},s.boxes.push(t)},removeBox(s,t){let e=s.boxes?s.boxes.indexOf(t):-1;e!==-1&&s.boxes.splice(e,1)},configure(s,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(s,t,e,i){if(!s)return;let n=Z(s.options.layout.padding),o=Math.max(t-n.width,0),a=Math.max(e-n.height,0),r=Ul(s.boxes),l=r.vertical,c=r.horizontal;E(s.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});let h=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);ua(u,Z(i));let f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),p=Yl(l.concat(c),d);He(r.fullSize,f,d,p),He(l,f,d,p),He(c,f,d,p)&&He(l,f,d,p),ql(f),wo(r.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,wo(r.rightAndBottom,f,d,p),s.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},E(r.chartArea,g=>{let m=g.box;Object.assign(m,s.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},Os=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}},Ki=class extends Os{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Ps="$chartjs",Gl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ko=s=>s===null||s==="";function Jl(s,t){let e=s.style,i=s.getAttribute("height"),n=s.getAttribute("width");if(s[Ps]={initial:{height:i,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",ko(n)){let o=ki(s,"width");o!==void 0&&(s.width=o)}if(ko(i))if(s.style.height==="")s.height=s.width/(t||2);else{let o=ki(s,"height");o!==void 0&&(s.height=o)}return s}var fa=no?{passive:!0}:!1;function Zl(s,t,e){s&&s.addEventListener(t,e,fa)}function Ql(s,t,e){s&&s.canvas&&s.canvas.removeEventListener(t,e,fa)}function tc(s,t){let e=Gl[s.type]||s.type,{x:i,y:n}=Wt(s,t);return{type:e,chart:t,native:s,x:i!==void 0?i:null,y:n!==void 0?n:null}}function Ts(s,t){for(let e of s)if(e===t||e.contains(t))return!0}function ec(s,t,e){let i=s.canvas,n=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||Ts(r.addedNodes,i),a=a&&!Ts(r.removedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function sc(s,t,e){let i=s.canvas,n=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||Ts(r.removedNodes,i),a=a&&!Ts(r.addedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}var je=new Map,Mo=0;function pa(){let s=window.devicePixelRatio;s!==Mo&&(Mo=s,je.forEach((t,e)=>{e.currentDevicePixelRatio!==s&&t()}))}function ic(s,t){je.size||window.addEventListener("resize",pa),je.set(s,t)}function nc(s){je.delete(s),je.size||window.removeEventListener("resize",pa)}function oc(s,t,e){let i=s.canvas,n=i&&xs(i);if(!n)return;let o=hi((r,l)=>{let c=n.clientWidth;e(r,l),c<n.clientWidth&&e()},window),a=new ResizeObserver(r=>{let l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),ic(s,o),a}function Ii(s,t,e){e&&e.disconnect(),t==="resize"&&nc(s)}function ac(s,t,e){let i=s.canvas,n=hi(o=>{s.ctx!==null&&e(tc(o,s))},s);return Zl(i,t,n),n}var Gi=class extends Os{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Jl(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[Ps])return!1;let i=e[Ps].initial;["height","width"].forEach(o=>{let a=i[o];O(a)?e.removeAttribute(o):e.setAttribute(o,a)});let n=i.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Ps],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let n=t.$proxies||(t.$proxies={}),a={attach:ec,detach:sc,resize:oc}[e]||ac;n[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:Ii,detach:Ii,resize:Ii}[e]||Ql)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return io(t,e,i,n)}isAttached(t){let e=t&&xs(t);return!!(e&&e.isConnected)}};function rc(s){return!bs()||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?Ki:Gi}var ut=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Jt(this.x)&&Jt(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let n={};return t.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}};function lc(s,t){let e=s.options.ticks,i=cc(s),n=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?dc(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return uc(t,c,o,a/n),c;let h=hc(o,t,n);if(a>0){let d,u,f=a>1?Math.round((l-r)/(a-1)):null;for(vs(t,c,h,O(f)?0:r-f,r),d=0,u=a-1;d<u;d++)vs(t,c,h,o[d],o[d+1]);return vs(t,c,h,l,O(f)?t.length:l+f),c}return vs(t,c,h),c}function cc(s){let t=s.options.offset,e=s._tickSize(),i=s._length/e+(t?0:1),n=s._maxLength/e;return Math.floor(Math.min(i,n))}function hc(s,t,e){let i=fc(s),n=t.length/e;if(!i)return Math.max(n,1);let o=Bn(i);for(let a=0,r=o.length-1;a<r;a++){let l=o[a];if(l>n)return l}return Math.max(n,1)}function dc(s){let t=[],e,i;for(e=0,i=s.length;e<i;e++)s[e].major&&t.push(e);return t}function uc(s,t,e,i){let n=0,o=e[0],a;for(i=Math.ceil(i),a=0;a<s.length;a++)a===o&&(t.push(s[a]),n++,o=e[n*i])}function vs(s,t,e,i,n){let o=D(i,0),a=Math.min(D(n,s.length),s.length),r=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-i,e=l/Math.floor(l/e)),h=o;h<0;)r++,h=Math.round(o+r*e);for(c=Math.max(o,0);c<a;c++)c===h&&(t.push(s[c]),r++,h=Math.round(o+r*e))}function fc(s){let t=s.length,e,i;if(t<2)return!1;for(i=s[0],e=1;e<t;++e)if(s[e]-s[e-1]!==i)return!1;return i}var pc=s=>s==="left"?"right":s==="right"?"left":s,So=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e,Po=(s,t)=>Math.min(t||s,s);function Co(s,t){let e=[],i=s.length/t,n=s.length,o=0;for(;o<n;o+=i)e.push(s[Math.floor(o)]);return e}function gc(s,t,e){let i=s.ticks.length,n=Math.min(t,i-1),o=s._startPixel,a=s._endPixel,r=1e-6,l=s.getPixelForTick(n),c;if(!(e&&(i===1?c=Math.max(l-o,a-l):t===0?c=(s.getPixelForTick(1)-l)/2:c=(l-s.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<o-r||l>a+r)))return l}function mc(s,t){E(s,e=>{let i=e.gc,n=i.length/2,o;if(n>t){for(o=0;o<n;++o)delete e.data[i[o]];i.splice(0,n)}})}function $e(s){return s.drawTicks?s.tickLength:0}function Do(s,t){if(!s.display)return 0;let e=X(s.font,t),i=Z(s.padding);return(F(s.text)?s.text.length:1)*e.lineHeight+i.height}function bc(s,t){return Ct(s,{scale:t,type:"scale"})}function xc(s,t,e){return Ct(s,{tick:e,index:t,type:"tick"})}function _c(s,t,e){let i=us(s);return(e&&t!=="right"||!e&&t==="right")&&(i=pc(i)),i}function yc(s,t,e,i){let{top:n,left:o,bottom:a,right:r,chart:l}=s,{chartArea:c,scales:h}=l,d=0,u,f,p,g=a-n,m=r-o;if(s.isHorizontal()){if(f=J(i,o,r),T(e)){let b=Object.keys(e)[0],x=e[b];p=h[b].getPixelForValue(x)+g-t}else e==="center"?p=(c.bottom+c.top)/2+g-t:p=So(s,e,t);u=r-o}else{if(T(e)){let b=Object.keys(e)[0],x=e[b];f=h[b].getPixelForValue(x)-m+t}else e==="center"?f=(c.left+c.right)/2-m+t:f=So(s,e,t);p=J(i,a,n),d=e==="left"?-W:W}return{titleX:f,titleY:p,maxWidth:u,rotation:d}}var ee=class s extends ut{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:n}=this;return t=it(t,Number.POSITIVE_INFINITY),e=it(e,Number.NEGATIVE_INFINITY),i=it(i,Number.POSITIVE_INFINITY),n=it(n,Number.NEGATIVE_INFINITY),{min:it(t,i),max:it(e,n),minDefined:V(t),maxDefined:V(e)}}getMinMax(t){let{min:e,max:i,minDefined:n,maxDefined:o}=this.getUserBounds(),a;if(n&&o)return{min:e,max:i};let r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),n||(e=Math.min(e,a.min)),o||(i=Math.max(i,a.max));return e=o&&e>i?i:e,i=n&&e>i?e:i,{min:it(e,it(i,e)),max:it(i,it(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Jn(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r<this.ticks.length;this._convertTicksToLabels(l?Co(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=lc(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i],o.label=I(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,i=Po(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation,a=n,r,l,c;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=K(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/i:f/(i-1),d+6>r&&(r=f/(i-(t.offset?.5:1)),l=this.maxHeight-$e(t.grid)-e.padding-Do(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=hs(Math.min(Math.asin(K((h.highest.height+6)/r,-1,1)),Math.asin(K(l/c,-1,1))-Math.asin(K(u/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=Do(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=$e(o)+l):(t.height=this.maxHeight,t.width=$e(o)+l),i.display&&this.ticks.length){let{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=i.padding*2,p=ct(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(r){let b=i.mirror?0:m*d.width+g*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{let b=i.mirror?0:g*d.width+m*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,m,g)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=n*t.width,f=i*e.height):(u=i*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){I(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)O(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=Co(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){let{ctx:n,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/Po(e,i)),c=0,h=0,d,u,f,p,g,m,b,x,v,y,_;for(d=0;d<e;d+=l){if(p=t[d].label,g=this._resolveTickFontOptions(d),n.font=m=g.string,b=o[m]=o[m]||{data:{},gc:[]},x=g.lineHeight,v=y=0,!O(p)&&!F(p))v=Te(n,b.data,b.gc,v,p),y=x;else if(F(p))for(u=0,f=p.length;u<f;++u)_=p[u],!O(_)&&!F(_)&&(v=Te(n,b.data,b.gc,v,_),y+=x);a.push(v),r.push(y),c=Math.max(v,c),h=Math.max(y,h)}mc(o,e);let w=a.indexOf(c),k=r.indexOf(h),M=S=>({width:a[S]||0,height:r[S]||0});return{first:M(0),last:M(e-1),widest:M(w),highest:M(k),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return Nn(this._alignToPixels?Nt(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&t<e.length){let i=e[t];return i.$context||(i.$context=xc(this.getContext(),t,i))}return this.$context||(this.$context=bc(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=ct(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*i>r*n?r/i:l/n:l*n<r*i?l/i:r/n}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,i=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=$e(o),f=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(H){return Nt(i,H,g)},x,v,y,_,w,k,M,S,P,C,A,Y;if(a==="top")x=b(this.bottom),k=this.bottom-u,S=x-m,C=b(t.top)+m,Y=t.bottom;else if(a==="bottom")x=b(this.top),C=t.top,Y=b(t.bottom)-m,k=x+m,S=this.top+u;else if(a==="left")x=b(this.right),w=this.right-u,M=x-m,P=b(t.left)+m,A=t.right;else if(a==="right")x=b(this.left),P=t.left,A=b(t.right)-m,w=x+m,M=this.left+u;else if(e==="x"){if(a==="center")x=b((t.top+t.bottom)/2+.5);else if(T(a)){let H=Object.keys(a)[0],U=a[H];x=b(this.chart.scales[H].getPixelForValue(U))}C=t.top,Y=t.bottom,k=x+m,S=k+u}else if(e==="y"){if(a==="center")x=b((t.left+t.right)/2);else if(T(a)){let H=Object.keys(a)[0],U=a[H];x=b(this.chart.scales[H].getPixelForValue(U))}w=x-m,M=w-u,P=t.left,A=t.right}let at=D(n.ticks.maxTicksLimit,d),R=Math.max(1,Math.ceil(d/at));for(v=0;v<d;v+=R){let H=this.getContext(v),U=o.setContext(H),ht=r.setContext(H),Q=U.lineWidth,ie=U.color,Ze=ht.dash||[],ne=ht.dashOffset,Se=U.tickWidth,Ut=U.tickColor,Pe=U.tickBorderDash||[],Xt=U.tickBorderDashOffset;y=gc(this,v,l),y!==void 0&&(_=Nt(i,y,Q),c?w=M=P=A=_:k=S=C=Y=_,f.push({tx1:w,ty1:k,tx2:M,ty2:S,x1:P,y1:C,x2:A,y2:Y,width:Q,color:ie,borderDash:Ze,borderDashOffset:ne,tickWidth:Se,tickColor:Ut,tickBorderDash:Pe,tickBorderDashOffset:Xt}))}return this._ticksLength=d,this._borderValue=x,f}_computeLabelItems(t){let e=this.axis,i=this.options,{position:n,ticks:o}=i,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=$e(i.grid),f=u+h,p=d?-h:f,g=-ct(this.labelRotation),m=[],b,x,v,y,_,w,k,M,S,P,C,A,Y="middle";if(n==="top")w=this.bottom-p,k=this._getXAxisLabelAlignment();else if(n==="bottom")w=this.top+p,k=this._getXAxisLabelAlignment();else if(n==="left"){let R=this._getYAxisLabelAlignment(u);k=R.textAlign,_=R.x}else if(n==="right"){let R=this._getYAxisLabelAlignment(u);k=R.textAlign,_=R.x}else if(e==="x"){if(n==="center")w=(t.top+t.bottom)/2+f;else if(T(n)){let R=Object.keys(n)[0],H=n[R];w=this.chart.scales[R].getPixelForValue(H)+f}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")_=(t.left+t.right)/2-f;else if(T(n)){let R=Object.keys(n)[0],H=n[R];_=this.chart.scales[R].getPixelForValue(H)}k=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?Y="top":l==="end"&&(Y="bottom"));let at=this._getLabelSizes();for(b=0,x=r.length;b<x;++b){v=r[b],y=v.label;let R=o.setContext(this.getContext(b));M=this.getPixelForTick(b)+o.labelOffset,S=this._resolveTickFontOptions(b),P=S.lineHeight,C=F(y)?y.length:1;let H=C/2,U=R.color,ht=R.textStrokeColor,Q=R.textStrokeWidth,ie=k;a?(_=M,k==="inner"&&(b===x-1?ie=this.options.reverse?"left":"right":b===0?ie=this.options.reverse?"right":"left":ie="center"),n==="top"?c==="near"||g!==0?A=-C*P+P/2:c==="center"?A=-at.highest.height/2-H*P+P:A=-at.highest.height+P/2:c==="near"||g!==0?A=P/2:c==="center"?A=at.highest.height/2-H*P:A=at.highest.height-C*P,d&&(A*=-1),g!==0&&!R.showLabelBackdrop&&(_+=P/2*Math.sin(g))):(w=M,A=(1-C)*P/2);let Ze;if(R.showLabelBackdrop){let ne=Z(R.backdropPadding),Se=at.heights[b],Ut=at.widths[b],Pe=A-ne.top,Xt=0-ne.left;switch(Y){case"middle":Pe-=Se/2;break;case"bottom":Pe-=Se;break}switch(k){case"center":Xt-=Ut/2;break;case"right":Xt-=Ut;break;case"inner":b===x-1?Xt-=Ut:b>0&&(Xt-=Ut/2);break}Ze={left:Xt,top:Pe,width:Ut+ne.width,height:Se+ne.height,color:R.backdropColor}}m.push({label:y,font:S,textOffset:A,options:{rotation:g,color:U,strokeColor:ht,strokeWidth:Q,textAlign:ie,textBaseline:Y,translation:[_,w],backdrop:Ze}})}return m}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-ct(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width,c,h;return e==="left"?n?(h=this.right+o,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(o=0,a=n.length;o<a;++o){let l=n[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:e,options:{border:i,grid:n}}=this,o=i.setContext(this.getContext()),a=i.display?o.width:0;if(!a)return;let r=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,h,d,u;this.isHorizontal()?(c=Nt(t,this.left,a)-a/2,h=Nt(t,this.right,r)+r/2,d=u=l):(d=Nt(t,this.top,a)-a/2,u=Nt(t,this.bottom,r)+r/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,d),e.lineTo(h,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;let i=this.ctx,n=this._computeLabelArea();n&&Re(i,n);let o=this.getLabelItems(t);for(let a of o){let r=a.options,l=a.font,c=a.label,h=a.textOffset;Ht(i,c,0,h,l,r)}n&&Ie(i)}drawTitle(){let{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;let o=X(i.font),a=Z(i.padding),r=i.align,l=o.lineHeight/2;e==="bottom"||e==="center"||T(e)?(l+=a.bottom,F(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=a.top;let{titleX:c,titleY:h,maxWidth:d,rotation:u}=yc(this,l,e,r);Ht(t,i.text,0,0,o,{color:i.color,maxWidth:d,rotation:u,textAlign:_c(r,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,i=D(t.grid&&t.grid.z,-1),n=D(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==s.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[],o,a;for(o=0,a=e.length;o<a;++o){let r=e[o];r[i]===this.id&&(!t||r.type===t)&&n.push(r)}return n}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return X(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},be=class{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),i;kc(e)&&(i=this.register(e));let n=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,vc(t,a,i),this.override&&B.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in B[n]&&(delete B[n][i],this.override&&delete $t[i])}};function vc(s,t,e){let i=re(Object.create(null),[e?B.get(e):{},B.get(t),s.defaults]);B.set(t,i),s.defaultRoutes&&wc(t,s.defaultRoutes),s.descriptors&&B.describe(t,s.descriptors)}function wc(s,t){Object.keys(t).forEach(e=>{let i=e.split("."),n=i.pop(),o=[s].concat(i).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");B.route(o,n,l,r)})}function kc(s){return"id"in s&&"defaults"in s}var Ji=class{constructor(){this.controllers=new be(_t,"datasets",!0),this.elements=new be(ut,"elements"),this.plugins=new be(Object,"plugins"),this.scales=new be(ee,"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(n=>{let o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):E(n,a=>{let r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){let n=cs(t);I(i["before"+n],[],i),e[t](i),I(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let n=e.get(t);if(n===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return n}},xt=new Ji,Zi=class{constructor(){this._init=void 0}notify(t,e,i,n){if(e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;let o=n?this._descriptors(t).filter(n):this._descriptors(t),a=this._notify(o,t,e,i);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,i,n){n=n||{};for(let o of t){let a=o.plugin,r=a[i],l=[e,n,o.options];if(I(r,l,a)===!1&&n.cancelable)return!1}return!0}invalidate(){O(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let i=t&&t.config,n=D(i.options&&i.options.plugins,{}),o=Mc(i);return n===!1&&!e?[]:Pc(t,o,n,e)}_notifyStateChanges(t){let e=this._oldCache||[],i=this._cache,n=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}};function Mc(s){let t={},e=[],i=Object.keys(xt.plugins.items);for(let o=0;o<i.length;o++)e.push(xt.getPlugin(i[o]));let n=s.plugins||[];for(let o=0;o<n.length;o++){let a=n[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Sc(s,t){return!t&&s===!1?null:s===!0?{}:s}function Pc(s,{plugins:t,localIds:e},i,n){let o=[],a=s.getContext();for(let r of t){let l=r.id,c=Sc(i[l],n);c!==null&&o.push({plugin:r,options:Cc(s.config,{plugin:r,local:e[l]},c,a)})}return o}function Cc(s,{plugin:t,local:e},i,n){let o=s.pluginScopeKeys(t),a=s.getOptionScopes(i,o);return e&&t.defaults&&a.push(t.defaults),s.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Qi(s,t){let e=B.datasets[s]||{};return((t.datasets||{})[s]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Dc(s,t){let e=s;return s==="_index_"?e=t:s==="_value_"&&(e=t==="x"?"y":"x"),e}function Ac(s,t){return s===t?"_index_":"_value_"}function Ao(s){if(s==="x"||s==="y"||s==="r")return s}function Oc(s){if(s==="top"||s==="bottom")return"x";if(s==="left"||s==="right")return"y"}function tn(s,...t){if(Ao(s))return s;for(let e of t){let i=e.axis||Oc(e.position)||s.length>1&&Ao(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function Oo(s,t,e){if(e[t+"AxisID"]===s)return{axis:t}}function Tc(s,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(e.length)return Oo(s,"x",e[0])||Oo(s,"y",e[0])}return{}}function Lc(s,t){let e=$t[s.type]||{scales:{}},i=t.scales||{},n=Qi(s.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{let r=i[a];if(!T(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);let l=tn(a,r,Tc(a,s),B.scales[r.type]),c=Ac(l,n),h=e.scales||{};o[a]=ce(Object.create(null),[{axis:l},r,h[l],h[c]])}),s.data.datasets.forEach(a=>{let r=a.type||s.type,l=a.indexAxis||Qi(r,t),h=($t[r]||{}).scales||{};Object.keys(h).forEach(d=>{let u=Dc(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),ce(o[f],[{axis:u},i[f],h[d]])})}),Object.keys(o).forEach(a=>{let r=o[a];ce(r,[B.scales[r.type],B.scale])}),o}function ga(s){let t=s.options||(s.options={});t.plugins=D(t.plugins,{}),t.scales=Lc(s,t)}function ma(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function Ec(s){return s=s||{},s.data=ma(s.data),ga(s),s}var To=new Map,ba=new Set;function ws(s,t){let e=To.get(s);return e||(e=t(),To.set(s,e),ba.add(e)),e}var Ne=(s,t,e)=>{let i=Pt(t,e);i!==void 0&&s.add(i)},en=class{constructor(t){this._config=Ec(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=ma(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),ga(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ws(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ws(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ws(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return ws(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,n=i.get(t);return(!n||e)&&(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){let{options:n,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;let l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>Ne(l,t,d))),h.forEach(d=>Ne(l,n,d)),h.forEach(d=>Ne(l,$t[o]||{},d)),h.forEach(d=>Ne(l,B,d)),h.forEach(d=>Ne(l,fs,d))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),ba.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,$t[e]||{},B.datasets[e]||{},{type:e},B,fs]}resolveNamedOptions(t,e,i,n=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=Lo(this._resolverCache,t,n),l=a;if(Ic(a,e)){o.$shared=!1,i=Mt(i)?i():i;let c=this.createResolver(t,i,r);l=Gt(a,i,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],n){let{resolver:o}=Lo(this._resolverCache,t,i);return T(e)?Gt(o,e,void 0,n):o}};function Lo(s,t,e){let i=s.get(t);i||(i=new Map,s.set(t,i));let n=e.join(),o=i.get(n);return o||(o={resolver:ms(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},i.set(n,o)),o}var Rc=s=>T(s)&&Object.getOwnPropertyNames(s).some(t=>Mt(s[t]));function Ic(s,t){let{isScriptable:e,isIndexable:i}=xi(s);for(let n of t){let o=e(n),a=i(n),r=(a||o)&&s[n];if(o&&(Mt(r)||Rc(r))||a&&F(r))return!0}return!1}var Fc="4.5.1",zc=["top","bottom","left","right","chartArea"];function Eo(s,t){return s==="top"||s==="bottom"||zc.indexOf(s)===-1&&t==="x"}function Ro(s,t){return function(e,i){return e[s]===i[s]?e[t]-i[t]:e[s]-i[s]}}function Io(s){let t=s.chart,e=t.options.animation;t.notifyPlugins("afterRender"),I(e&&e.onComplete,[s],t)}function Bc(s){let t=s.chart,e=t.options.animation;I(e&&e.onProgress,[s],t)}function xa(s){return bs()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}var Cs={},Fo=s=>{let t=xa(s);return Object.values(Cs).filter(e=>e.canvas===t).pop()};function $c(s,t,e){let i=Object.keys(s);for(let n of i){let o=+n;if(o>=t){let a=s[n];delete s[n],(e>0||o>t)&&(s[o+e]=a)}}}function Nc(s,t,e,i){return!e||s.type==="mouseout"?null:i?t:s}var Ot=class{static defaults=B;static instances=Cs;static overrides=$t;static registry=xt;static version=Fc;static getChart=Fo;static register(...t){xt.add(...t),zo()}static unregister(...t){xt.remove(...t),zo()}constructor(t,e){let i=this.config=new en(e),n=xa(t),o=Fo(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||rc(n)),this.platform.updateConfig(i);let r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Rn(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Zi,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Yn(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Cs[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Dt.listen(this,"complete",Io),Dt.listen(this,"progress",Bc),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return O(t)?e&&o?o:n?i/n: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 xt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():wi(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return gi(this.canvas,this.ctx),this}stop(){return Dt.stop(this),this}resize(t,e){Dt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,wi(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),I(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};E(e,(i,n)=>{i.id=n})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=tn(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),E(o,a=>{let r=a.options,l=r.id,c=tn(l,r),h=D(r.type,a.dtype);(r.position===void 0||Eo(r.position,c)!==Eo(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in i&&i[l].type===h)d=i[l];else{let u=xt.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(r,t)}),E(n,(a,r)=>{a||delete i[r]}),E(i,a=>{tt.configure(this,a,a.options),tt.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((n,o)=>n.index-o.index),i>e){for(let n=e;n<i;++n)this._destroyDatasetMeta(n);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Ro("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,n)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){let o=e[i],a=this.getDatasetMeta(i),r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=r,a.indexAxis=o.indexAxis||Qi(r,this.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{let l=xt.getController(r),{datasetElementType:c,dataElementType:h}=B.datasets[r];Object.assign(l,{dataElementType:xt.getElement(h),datasetElementType:c&&xt.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){E(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c<h;c++){let{controller:d}=this.getDatasetMeta(c),u=!n&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),n||E(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ro("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){E(this.scales,t=>{tt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!si(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:n,count:o}of e){let a=i==="_removeElements"?-o:o;$c(t,n,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=i(0);for(let o=1;o<e;o++)if(!si(n,i(o)))return;return Array.from(n).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;tt.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],E(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Mt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Dt.has(this)?this.attached&&!Dt.running(this)&&Dt.start(this):(this.draw(),Io({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:i,height:n}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,n)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let e=this._sortedMetasets,i=[],n,o;for(n=0,o=e.length;n<o;++n){let a=e[n];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},n=Di(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(n&&Re(e,n),t.controller.draw(),n&&Ie(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return pt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){let o=Vl.modes[e];return typeof o=="function"?o(this,t,i,n):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,n=i.filter(o=>o&&o._dataset===e).pop();return n||(n={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(n)),n}getContext(){return this.$context||(this.$context=Ct(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let n=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);he(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Dt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),gi(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Cs[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,e=this.platform,i=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};E(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},a,r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){E(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},E(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let n=i?"set":"remove",o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];let c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[n+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],i=t.map(({datasetIndex:o,index:a})=>{let r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!Le(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){let n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=i?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,i,a),l=zn(t),c=Nc(t,this._lastEvent,i,l);i&&(this._lastEvent=null,I(o.onHover,[t,r,this],this),l&&I(o.onClick,[t,r,this],this));let h=!Le(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,n){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};function zo(){return E(Ot.instances,s=>s._plugins.invalidate())}function Hc(s,t,e){let{startAngle:i,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/a,G(i-e));if(s.beginPath(),s.arc(n,o,a-c/2,i+d/2,e-d/2),r>0){let u=Math.min(c/r,G(i-e));s.arc(n,o,r+c/2,e-u/2,i+u/2,!0)}else{let u=Math.min(c/2,a*G(i-e));if(h==="round")s.arc(n,o,u,e-L/2,i+L/2,!0);else if(h==="bevel"){let f=2*u*u,p=-f*Math.cos(e+L/2)+n,g=-f*Math.sin(e+L/2)+o,m=f*Math.cos(i+L/2)+n,b=f*Math.sin(i+L/2)+o;s.lineTo(p,g),s.lineTo(m,b)}}s.closePath(),s.moveTo(0,0),s.rect(0,0,s.canvas.width,s.canvas.height),s.clip("evenodd")}function Vc(s,t,e){let{startAngle:i,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=t,c=n/r;s.beginPath(),s.arc(o,a,r,i-c,e+c),l>n?(c=n/l,s.arc(o,a,l,e+c,i-c,!0)):s.arc(o,a,n,e+W,i-W),s.closePath(),s.clip()}function Wc(s){return gs(s,["outerStart","outerEnd","innerStart","innerEnd"])}function jc(s,t,e,i){let n=Wc(s.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),r=l=>{let c=(e-Math.min(o,l))*i/2;return K(l,0,Math.min(o,c))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:K(n.innerStart,0,a),innerEnd:K(n.innerEnd,0,a)}}function me(s,t,e,i){return{x:e+s*Math.cos(t),y:i+s*Math.sin(t)}}function Ls(s,t,e,i,n,o){let{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+i+e-c,0),u=h>0?h+i+e+c:0,f=0,p=n-l;if(i){let R=h>0?h-i:0,H=d>0?d-i:0,U=(R+H)/2,ht=U!==0?p*U/(U+i):p;f=(p-ht)/2}let g=Math.max(.001,p*d-e/L)/d,m=(p-g)/2,b=l+m+f,x=n-m-f,{outerStart:v,outerEnd:y,innerStart:_,innerEnd:w}=jc(t,u,d,x-b),k=d-v,M=d-y,S=b+v/k,P=x-y/M,C=u+_,A=u+w,Y=b+_/C,at=x-w/A;if(s.beginPath(),o){let R=(S+P)/2;if(s.arc(a,r,d,S,R),s.arc(a,r,d,R,P),y>0){let Q=me(M,P,a,r);s.arc(Q.x,Q.y,y,P,x+W)}let H=me(A,x,a,r);if(s.lineTo(H.x,H.y),w>0){let Q=me(A,at,a,r);s.arc(Q.x,Q.y,w,x+W,at+Math.PI)}let U=(x-w/u+(b+_/u))/2;if(s.arc(a,r,u,x-w/u,U,!0),s.arc(a,r,u,U,b+_/u,!0),_>0){let Q=me(C,Y,a,r);s.arc(Q.x,Q.y,_,Y+Math.PI,b-W)}let ht=me(k,b,a,r);if(s.lineTo(ht.x,ht.y),v>0){let Q=me(k,S,a,r);s.arc(Q.x,Q.y,v,b-W,S)}}else{s.moveTo(a,r);let R=Math.cos(S)*d+a,H=Math.sin(S)*d+r;s.lineTo(R,H);let U=Math.cos(P)*d+a,ht=Math.sin(P)*d+r;s.lineTo(U,ht)}s.closePath()}function Yc(s,t,e,i,n){let{fullCircles:o,startAngle:a,circumference:r}=t,l=t.endAngle;if(o){Ls(s,t,e,i,l,n);for(let c=0;c<o;++c)s.fill();isNaN(r)||(l=a+(r%z||z))}return Ls(s,t,e,i,l,n),s.fill(),l}function Uc(s,t,e,i,n){let{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u,borderRadius:f}=l,p=l.borderAlign==="inner";if(!c)return;s.setLineDash(d||[]),s.lineDashOffset=u,p?(s.lineWidth=c*2,s.lineJoin=h||"round"):(s.lineWidth=c,s.lineJoin=h||"bevel");let g=t.endAngle;if(o){Ls(s,t,e,i,g,n);for(let m=0;m<o;++m)s.stroke();isNaN(r)||(g=a+(r%z||z))}p&&Vc(s,t,g),l.selfJoin&&g-a>=L&&f===0&&h!=="miter"&&Hc(s,t,g),o||(Ls(s,t,e,i,g,n),s.stroke())}var sn=class extends ut{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){let n=this.getProps(["x","y"],i),{angle:o,distance:a}=ai(n,{x:t,y:e}),{startAngle:r,endAngle:l,innerRadius:c,outerRadius:h,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,f=D(d,l-r),p=ue(o,r,l)&&r!==l,g=f>=z||p,m=mt(a,c+u,h+u);return g&&m}getCenterPoint(t){let{x:e,y:i,startAngle:n,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,h=(n+o)/2,d=(a+r+c+l)/2;return{x:e+Math.cos(h)*d,y:i+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>z?Math.floor(i/z):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);let l=1-Math.sin(Math.min(L,i||0)),c=n*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,Yc(t,this,c,o,a),Uc(t,this,c,o,a),t.restore()}};function _a(s,t,e=t){s.lineCap=D(e.borderCapStyle,t.borderCapStyle),s.setLineDash(D(e.borderDash,t.borderDash)),s.lineDashOffset=D(e.borderDashOffset,t.borderDashOffset),s.lineJoin=D(e.borderJoinStyle,t.borderJoinStyle),s.lineWidth=D(e.borderWidth,t.borderWidth),s.strokeStyle=D(e.borderColor,t.borderColor)}function Xc(s,t,e){s.lineTo(e.x,e.y)}function qc(s){return s.stepped?Kn:s.tension||s.cubicInterpolationMode==="monotone"?Gn:Xc}function ya(s,t,e={}){let i=s.length,{start:n=0,end:o=i-1}=e,{start:a,end:r}=t,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:t.loop,ilen:c<l&&!h?i+c-l:c-l}}function Kc(s,t,e,i){let{points:n,options:o}=t,{count:a,start:r,loop:l,ilen:c}=ya(n,e,i),h=qc(o),{move:d=!0,reverse:u}=i||{},f,p,g;for(f=0;f<=c;++f)p=n[(r+(u?c-f:f))%a],!p.skip&&(d?(s.moveTo(p.x,p.y),d=!1):h(s,g,p,u,o.stepped),g=p);return l&&(p=n[(r+(u?c:0))%a],h(s,g,p,u,o.stepped)),!!l}function Gc(s,t,e,i){let n=t.points,{count:o,start:a,ilen:r}=ya(n,e,i),{move:l=!0,reverse:c}=i||{},h=0,d=0,u,f,p,g,m,b,x=y=>(a+(c?r-y:y))%o,v=()=>{g!==m&&(s.lineTo(h,m),s.lineTo(h,g),s.lineTo(h,b))};for(l&&(f=n[x(0)],s.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=n[x(u)],f.skip)continue;let y=f.x,_=f.y,w=y|0;w===p?(_<g?g=_:_>m&&(m=_),h=(d*h+y)/++d):(v(),s.lineTo(y,_),p=w,d=0,g=m=_),b=_}v()}function nn(s){let t=s.options,e=t.borderDash&&t.borderDash.length;return!s._decimated&&!s._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Gc:Kc}function Jc(s){return s.stepped?oo:s.tension||s.cubicInterpolationMode==="monotone"?ao:zt}function Zc(s,t,e,i){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,i)&&n.closePath()),_a(s,t.options),s.stroke(n)}function Qc(s,t,e,i){let{segments:n,options:o}=t,a=nn(t);for(let r of n)_a(s,o,r.style),s.beginPath(),a(s,t,r,{start:e,end:e+i-1})&&s.closePath(),s.stroke()}var th=typeof Path2D=="function";function eh(s,t,e,i){th&&!t.options.segment?Zc(s,t,e,i):Qc(s,t,e,i)}var xe=class extends ut{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let n=i.spanGaps?this._loop:this._fullLoop;so(this._points,i,t,n,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=lo(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,n=t[e],o=this.points,a=Ci(this,{property:e,start:n,end:n});if(!a.length)return;let r=[],l=Jc(i),c,h;for(c=0,h=a.length;c<h;++c){let{start:d,end:u}=a[c],f=o[d],p=o[u];if(f===p){r.push(f);continue}let g=Math.abs((n-f[e])/(p[e]-f[e])),m=l(f,p,g,i.stepped);m[e]=t[e],r.push(m)}return r.length===1?r[0]:r}pathSegment(t,e,i){return nn(this)(t,this,e,i)}path(t,e,i){let n=this.segments,o=nn(this),a=this._loop;e=e||0,i=i||this.points.length-e;for(let r of n)a&=o(t,this,r,{start:e,end:e+i-1});return!!a}draw(t,e,i,n){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),eh(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function Bo(s,t,e,i){let n=s.options,{[e]:o}=s.getProps([e],i);return Math.abs(t-o)<n.radius+n.hitRadius}var on=class extends ut{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){let n=this.options,{x:o,y:a}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-a,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return Bo(this,t,"x",e)}inYRange(t,e){return Bo(this,t,"y",e)}getCenterPoint(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);let i=e&&t.borderWidth||0;return(e+i)*2}draw(t,e){let i=this.options;this.skip||i.radius<.1||!pt(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,ps(t,i,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}};function va(s,t){let{x:e,y:i,base:n,width:o,height:a}=s.getProps(["x","y","base","width","height"],t),r,l,c,h,d;return s.horizontal?(d=a/2,r=Math.min(e,n),l=Math.max(e,n),c=i-d,h=i+d):(d=o/2,r=e-d,l=e+d,c=Math.min(i,n),h=Math.max(i,n)),{left:r,top:c,right:l,bottom:h}}function jt(s,t,e,i){return s?0:K(t,e,i)}function sh(s,t,e){let i=s.options.borderWidth,n=s.borderSkipped,o=bi(i);return{t:jt(n.top,o.top,0,e),r:jt(n.right,o.right,0,t),b:jt(n.bottom,o.bottom,0,e),l:jt(n.left,o.left,0,t)}}function ih(s,t,e){let{enableBorderRadius:i}=s.getProps(["enableBorderRadius"]),n=s.options.borderRadius,o=Vt(n),a=Math.min(t,e),r=s.borderSkipped,l=i||T(n);return{topLeft:jt(!l||r.top||r.left,o.topLeft,0,a),topRight:jt(!l||r.top||r.right,o.topRight,0,a),bottomLeft:jt(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:jt(!l||r.bottom||r.right,o.bottomRight,0,a)}}function nh(s){let t=va(s),e=t.right-t.left,i=t.bottom-t.top,n=sh(s,e/2,i/2),o=ih(s,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:o},inner:{x:t.left+n.l,y:t.top+n.t,w:e-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))}}}}function Fi(s,t,e,i){let n=t===null,o=e===null,r=s&&!(n&&o)&&va(s,i);return r&&(n||mt(t,r.left,r.right))&&(o||mt(e,r.top,r.bottom))}function oh(s){return s.topLeft||s.topRight||s.bottomLeft||s.bottomRight}function ah(s,t){s.rect(t.x,t.y,t.w,t.h)}function zi(s,t,e={}){let i=s.x!==e.x?-t:0,n=s.y!==e.y?-t:0,o=(s.x+s.w!==e.x+e.w?t:0)-i,a=(s.y+s.h!==e.y+e.h?t:0)-n;return{x:s.x+i,y:s.y+n,w:s.w+o,h:s.h+a,radius:s.radius}}var an=class extends ut{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:a}=nh(this),r=oh(a.radius)?pe:ah;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,zi(a,e,o)),t.clip(),r(t,zi(o,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,zi(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return Fi(this,t,e,i)}inXRange(t,e){return Fi(this,t,null,e)}inYRange(t,e){return Fi(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}},rh=Object.freeze({__proto__:null,ArcElement:sn,BarElement:an,LineElement:xe,PointElement:on}),rn=["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)"],$o=rn.map(s=>s.replace("rgb(","rgba(").replace(")",", 0.5)"));function wa(s){return rn[s%rn.length]}function ka(s){return $o[s%$o.length]}function lh(s,t){return s.borderColor=wa(t),s.backgroundColor=ka(t),++t}function ch(s,t){return s.backgroundColor=s.data.map(()=>wa(t++)),t}function hh(s,t){return s.backgroundColor=s.data.map(()=>ka(t++)),t}function dh(s){let t=0;return(e,i)=>{let n=s.getDatasetMeta(i).controller;n instanceof We?t=ch(e,t):n instanceof As?t=hh(e,t):n&&(t=lh(e,t))}}function No(s){let t;for(t in s)if(s[t].borderColor||s[t].backgroundColor)return!0;return!1}function uh(s){return s&&(s.borderColor||s.backgroundColor)}function fh(){return B.borderColor!=="rgba(0,0,0,0.1)"||B.backgroundColor!=="rgba(0,0,0,0.1)"}var ph={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,t,e){if(!e.enabled)return;let{data:{datasets:i},options:n}=s.config,{elements:o}=n,a=No(i)||uh(n)||o&&No(o)||fh();if(!e.forceOverride&&a)return;let r=dh(s);i.forEach(r)}};function gh(s,t,e,i,n){let o=n.samples||i;if(o>=e)return s.slice(t,t+e);let a=[],r=(e-2)/(o-2),l=0,c=t+e-1,h=t,d,u,f,p,g;for(a[l++]=s[h],d=0;d<o-2;d++){let m=0,b=0,x,v=Math.floor((d+1)*r)+1+t,y=Math.min(Math.floor((d+2)*r)+1,e)+t,_=y-v;for(x=v;x<y;x++)m+=s[x].x,b+=s[x].y;m/=_,b/=_;let w=Math.floor(d*r)+1+t,k=Math.min(Math.floor((d+1)*r)+1,e)+t,{x:M,y:S}=s[h];for(f=p=-1,x=w;x<k;x++)p=.5*Math.abs((M-m)*(s[x].y-S)-(M-s[x].x)*(b-S)),p>f&&(f=p,u=s[x],g=x);a[l++]=u,h=g}return a[l++]=s[c],a}function mh(s,t,e,i){let n=0,o=0,a,r,l,c,h,d,u,f,p,g,m=[],b=t+e-1,x=s[t].x,y=s[b].x-x;for(a=t;a<t+e;++a){r=s[a],l=(r.x-x)/y*i,c=r.y;let _=l|0;if(_===h)c<p?(p=c,d=a):c>g&&(g=c,u=a),n=(o*n+r.x)/++o;else{let w=a-1;if(!O(d)&&!O(u)){let k=Math.min(d,u),M=Math.max(d,u);k!==f&&k!==w&&m.push({...s[k],x:n}),M!==f&&M!==w&&m.push({...s[M],x:n})}a>0&&w!==f&&m.push(s[w]),m.push(r),h=_,o=0,p=g=c,d=u=f=a}}return m}function Ma(s){if(s._decimated){let t=s._data;delete s._decimated,delete s._data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Ho(s){s.data.datasets.forEach(t=>{Ma(t)})}function bh(s,t){let e=t.length,i=0,n,{iScale:o}=s,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=K(ft(t,o.axis,a).lo,0,e-1)),c?n=K(ft(t,o.axis,r).hi+1,i,e)-i:n=e-i,{start:i,count:n}}var xh={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(s,t,e)=>{if(!e.enabled){Ho(s);return}let i=s.width;s.data.datasets.forEach((n,o)=>{let{_data:a,indexAxis:r}=n,l=s.getDatasetMeta(o),c=a||n.data;if(ge([r,s.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let h=s.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||s.options.parsing)return;let{start:d,count:u}=bh(l,c),f=e.threshold||4*i;if(u<=f){Ma(n);return}O(a)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(e.algorithm){case"lttb":p=gh(c,d,u,i,e);break;case"min-max":p=mh(c,d,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}n._decimated=p})},destroy(s){Ho(s)}};function _h(s,t,e){let i=s.segments,n=s.points,o=t.points,a=[];for(let r of i){let{start:l,end:c}=r;c=Fs(l,c,n);let h=ln(e,n[l],n[c],r.loop);if(!t.segments){a.push({source:r,target:h,start:n[l],end:n[c]});continue}let d=Ci(t,h);for(let u of d){let f=ln(e,o[u.start],o[u.end],u.loop),p=Pi(r,n,f);for(let g of p)a.push({source:g,target:u,start:{[e]:Vo(h,f,"start",Math.max)},end:{[e]:Vo(h,f,"end",Math.min)}})}}return a}function ln(s,t,e,i){if(i)return;let n=t[s],o=e[s];return s==="angle"&&(n=G(n),o=G(o)),{property:s,start:n,end:o}}function yh(s,t){let{x:e=null,y:i=null}=s||{},n=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Fs(a,r,n);let l=n[a],c=n[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Fs(s,t,e){for(;t>s;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Vo(s,t,e,i){return s&&t?i(s[e],t[e]):s?s[e]:t?t[e]:0}function Sa(s,t){let e=[],i=!1;return F(s)?(i=!0,e=s):e=yh(s,t),e.length?new xe({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function Wo(s){return s&&s.fill!==!1}function vh(s,t,e){let n=s[t].fill,o=[t],a;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!V(n))return n;if(a=s[n],!a)return!1;if(a.visible)return n;o.push(n),n=a.fill}return!1}function wh(s,t,e){let i=Ph(s);if(T(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return V(n)&&Math.floor(n)===n?kh(i[0],t,n,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function kh(s,t,e,i){return(s==="-"||s==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function Mh(s,t){let e=null;return s==="start"?e=t.bottom:s==="end"?e=t.top:T(s)?e=t.getPixelForValue(s.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Sh(s,t,e){let i;return s==="start"?i=e:s==="end"?i=t.options.reverse?t.min:t.max:T(s)?i=s.value:i=t.getBaseValue(),i}function Ph(s){let t=s.options,e=t.fill,i=D(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Ch(s){let{scale:t,index:e,line:i}=s,n=[],o=i.segments,a=i.points,r=Dh(t,e);r.push(Sa({x:null,y:t.bottom},i));for(let l=0;l<o.length;l++){let c=o[l];for(let h=c.start;h<=c.end;h++)Ah(n,a[h],r)}return new xe({points:n,options:{}})}function Dh(s,t){let e=[],i=s.getMatchingVisibleMetas("line");for(let n=0;n<i.length;n++){let o=i[n];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function Ah(s,t,e){let i=[];for(let n=0;n<e.length;n++){let o=e[n],{first:a,last:r,point:l}=Oh(o,t,"x");if(!(!l||a&&r)){if(a)i.unshift(l);else if(s.push(l),!r)break}}s.push(...i)}function Oh(s,t,e){let i=s.interpolate(t,e);if(!i)return{};let n=i[e],o=s.segments,a=s.points,r=!1,l=!1;for(let c=0;c<o.length;c++){let h=o[c],d=a[h.start][e],u=a[h.end][e];if(mt(n,d,u)){r=n===d,l=n===u;break}}return{first:r,last:l,point:i}}var Es=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:n,y:o,radius:a}=this;return e=e||{start:0,end:z},t.arc(n,o,a,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}};function Th(s){let{chart:t,fill:e,line:i}=s;if(V(e))return Lh(t,e);if(e==="stack")return Ch(s);if(e==="shape")return!0;let n=Eh(s);return n instanceof Es?n:Sa(n,i)}function Lh(s,t){let e=s.getDatasetMeta(t);return e&&s.isDatasetVisible(t)?e.dataset:null}function Eh(s){return(s.scale||{}).getPointPositionForValue?Ih(s):Rh(s)}function Rh(s){let{scale:t={},fill:e}=s,i=Mh(e,t);if(V(i)){let n=t.isHorizontal();return{x:n?i:null,y:n?null:i}}return null}function Ih(s){let{scale:t,fill:e}=s,i=t.options,n=t.getLabels().length,o=i.reverse?t.max:t.min,a=Sh(e,t,o),r=[];if(i.grid.circular){let l=t.getPointPositionForValue(0,o);return new Es({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<n;++l)r.push(t.getPointPositionForValue(l,a));return r}function Bi(s,t,e){let i=Th(t),{chart:n,index:o,line:a,scale:r,axis:l}=t,c=a.options,h=c.fill,d=c.backgroundColor,{above:u=d,below:f=d}=h||{},p=n.getDatasetMeta(o),g=Di(n,p);i&&a.points.length&&(Re(s,e),Fh(s,{line:a,target:i,above:u,below:f,area:e,scale:r,axis:l,clip:g}),Ie(s))}function Fh(s,t){let{line:e,target:i,above:n,below:o,area:a,scale:r,clip:l}=t,c=e._loop?"angle":t.axis;s.save();let h=o;o!==n&&(c==="x"?(jo(s,i,a.top),$i(s,{line:e,target:i,color:n,scale:r,property:c,clip:l}),s.restore(),s.save(),jo(s,i,a.bottom)):c==="y"&&(Yo(s,i,a.left),$i(s,{line:e,target:i,color:o,scale:r,property:c,clip:l}),s.restore(),s.save(),Yo(s,i,a.right),h=n)),$i(s,{line:e,target:i,color:h,scale:r,property:c,clip:l}),s.restore()}function jo(s,t,e){let{segments:i,points:n}=t,o=!0,a=!1;s.beginPath();for(let r of i){let{start:l,end:c}=r,h=n[l],d=n[Fs(l,c,n)];o?(s.moveTo(h.x,h.y),o=!1):(s.lineTo(h.x,e),s.lineTo(h.x,h.y)),a=!!t.pathSegment(s,r,{move:a}),a?s.closePath():s.lineTo(d.x,e)}s.lineTo(t.first().x,e),s.closePath(),s.clip()}function Yo(s,t,e){let{segments:i,points:n}=t,o=!0,a=!1;s.beginPath();for(let r of i){let{start:l,end:c}=r,h=n[l],d=n[Fs(l,c,n)];o?(s.moveTo(h.x,h.y),o=!1):(s.lineTo(e,h.y),s.lineTo(h.x,h.y)),a=!!t.pathSegment(s,r,{move:a}),a?s.closePath():s.lineTo(e,d.y)}s.lineTo(e,t.first().y),s.closePath(),s.clip()}function $i(s,t){let{line:e,target:i,property:n,color:o,scale:a,clip:r}=t,l=_h(e,i,n);for(let{source:c,target:h,start:d,end:u}of l){let{style:{backgroundColor:f=o}={}}=c,p=i!==!0;s.save(),s.fillStyle=f,zh(s,a,r,p&&ln(n,d,u)),s.beginPath();let g=!!e.pathSegment(s,c),m;if(p){g?s.closePath():Uo(s,i,u,n);let b=!!i.pathSegment(s,h,{move:g,reverse:!0});m=g&&b,m||Uo(s,i,d,n)}s.closePath(),s.fill(m?"evenodd":"nonzero"),s.restore()}}function zh(s,t,e,i){let n=t.chart.chartArea,{property:o,start:a,end:r}=i||{};if(o==="x"||o==="y"){let l,c,h,d;o==="x"?(l=a,c=n.top,h=r,d=n.bottom):(l=n.left,c=a,h=n.right,d=r),s.beginPath(),e&&(l=Math.max(l,e.left),h=Math.min(h,e.right),c=Math.max(c,e.top),d=Math.min(d,e.bottom)),s.rect(l,c,h-l,d-c),s.clip()}}function Uo(s,t,e,i){let n=t.interpolate(e,i);n&&s.lineTo(n.x,n.y)}var Bh={id:"filler",afterDatasetsUpdate(s,t,e){let i=(s.data.datasets||[]).length,n=[],o,a,r,l;for(a=0;a<i;++a)o=s.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof xe&&(l={visible:s.isDatasetVisible(a),index:a,fill:wh(r,a,i),chart:s,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||l.fill===!1)&&(l.fill=vh(n,a,e.propagate))},beforeDraw(s,t,e){let i=e.drawTime==="beforeDraw",n=s.getSortedVisibleDatasetMetas(),o=s.chartArea;for(let a=n.length-1;a>=0;--a){let r=n[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&Bi(s.ctx,r,o))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){let o=i[n].$filler;Wo(o)&&Bi(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,t,e){let i=t.meta.$filler;!Wo(i)||e.drawTime!=="beforeDatasetDraw"||Bi(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},Xo=(s,t)=>{let{boxHeight:e=t,boxWidth:i=t}=s;return s.usePointStyle&&(e=Math.min(e,t),i=s.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},$h=(s,t)=>s!==null&&t!==null&&s.datasetIndex===t.datasetIndex&&s.index===t.index,Rs=class extends ut{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=I(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,n)=>t.sort(i,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,n=X(i.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=Xo(i,o),c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r,d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((p,g)=>{let m=i+e/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*r>a)&&(d+=h,c[c.length-(g>0?0:1)]=0,f+=h,u++),l[g]={left:0,top:f,row:u,width:m,height:n},c[c.length-1]+=m+r}),d}_fitCols(t,e,i,n){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t,d=r,u=0,f=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{let{itemWidth:x,itemHeight:v}=Nh(i,e,o,m,n);b>0&&f+v+2*r>h&&(d+=u+r,c.push({width:u,height:f}),p+=u+r,g++,u=f=0),l[b]={left:p,top:f,col:g,width:x,height:v},u=Math.max(u,x),f+=v+r}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,a=Zt(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=J(i,this.left+n,this.right-this.lineWidths[r]);for(let c of e)r!==c.row&&(r=c.row,l=J(i,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=J(i,this.top+t+n,this.bottom-this.columnSizes[r].height);for(let c of e)c.col!==r&&(r=c.col,l=J(i,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;Re(t,this),this._draw(),Ie(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:a}=t,r=B.color,l=Zt(t.rtl,this.left,this.width),c=X(a.font),{padding:h}=a,d=c.size,u=d/2,f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;let{boxWidth:p,boxHeight:g,itemHeight:m}=Xo(a,d),b=function(w,k,M){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;n.save();let S=D(M.lineWidth,1);if(n.fillStyle=D(M.fillStyle,r),n.lineCap=D(M.lineCap,"butt"),n.lineDashOffset=D(M.lineDashOffset,0),n.lineJoin=D(M.lineJoin,"miter"),n.lineWidth=S,n.strokeStyle=D(M.strokeStyle,r),n.setLineDash(D(M.lineDash,[])),a.usePointStyle){let P={radius:g*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:S},C=l.xPlus(w,p/2),A=k+u;mi(n,P,C,A,a.pointStyleWidth&&p)}else{let P=k+Math.max((d-g)/2,0),C=l.leftForLtr(w,p),A=Vt(M.borderRadius);n.beginPath(),Object.values(A).some(Y=>Y!==0)?pe(n,{x:C,y:P,w:p,h:g,radius:A}):n.rect(C,P,p,g),n.fill(),S!==0&&n.stroke()}n.restore()},x=function(w,k,M){Ht(n,M.text,w,k+m/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();v?f={x:J(o,this.left+h,this.right-i[0]),y:this.top+h+y,line:0}:f={x:this.left+h,y:J(o,this.top+y+h,this.bottom-e[0].height),line:0},Mi(this.ctx,t.textDirection);let _=m+h;this.legendItems.forEach((w,k)=>{n.strokeStyle=w.fontColor,n.fillStyle=w.fontColor;let M=n.measureText(w.text).width,S=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),P=p+u+M,C=f.x,A=f.y;l.setWidth(this.width),v?k>0&&C+P+h>this.right&&(A=f.y+=_,f.line++,C=f.x=J(o,this.left+h,this.right-i[f.line])):k>0&&A+_>this.bottom&&(C=f.x=C+e[f.line].width+h,f.line++,A=f.y=J(o,this.top+y+h,this.bottom-e[f.line].height));let Y=l.x(C);if(b(Y,A,w),C=Un(S,C+p+u,v?C+P:this.right,t.rtl),x(l.x(C),A,w),v)f.x+=P+h;else if(typeof w.text!="string"){let at=c.lineHeight;f.y+=Pa(w,at)+h}else f.y+=_}),Si(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=X(e.font),n=Z(e.padding);if(!e.display)return;let o=Zt(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.size/2,c=n.top+l,h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=J(t.align,d,this.right-u);else{let p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);h=c+J(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}let f=J(r,d,d+u);a.textAlign=o.textAlign(us(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,Ht(a,e.text,f,h,i)}_computeTitleHeight(){let t=this.options.title,e=X(t.font),i=Z(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(mt(t,this.left,this.right)&&mt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(n=o[i],mt(t,n.left,n.left+n.width)&&mt(e,n.top,n.top+n.height))return this.legendItems[i]}return null}handleEvent(t){let e=this.options;if(!Wh(t.type,e))return;let i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let n=this._hoveredItem,o=$h(n,i);n&&!o&&I(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&I(e.onHover,[t,i,this],this)}else i&&I(e.onClick,[t,i,this],this)}};function Nh(s,t,e,i,n){let o=Hh(i,s,t,e),a=Vh(n,i,t.lineHeight);return{itemWidth:o,itemHeight:a}}function Hh(s,t,e,i){let n=s.text;return n&&typeof n!="string"&&(n=n.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+i.measureText(n).width}function Vh(s,t,e){let i=s;return typeof t.text!="string"&&(i=Pa(t,e)),i}function Pa(s,t){let e=s.text?s.text.length:0;return t*e}function Wh(s,t){return!!((s==="mousemove"||s==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(s==="click"||s==="mouseup"))}var jh={id:"legend",_element:Rs,start(s,t,e){let i=s.legend=new Rs({ctx:s.ctx,options:e,chart:s});tt.configure(s,i,e),tt.addBox(s,i)},stop(s){tt.removeBox(s,s.legend),delete s.legend},beforeUpdate(s,t,e){let i=s.legend;tt.configure(s,i,e),i.options=e},afterUpdate(s){let t=s.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(s,t){t.replay||s.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(s,t,e){let i=t.datasetIndex,n=e.chart;n.isDatasetVisible(i)?(n.hide(i),t.hidden=!0):(n.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:s=>s.chart.options.color,boxWidth:40,padding:10,generateLabels(s){let t=s.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(e?0:void 0),h=Z(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}},Ye=class extends ut{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let n=F(i.text)?i.text.length:1;this._padding=Z(i.padding);let o=n*X(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:i,bottom:n,right:o,options:a}=this,r=a.align,l=0,c,h,d;return this.isHorizontal()?(h=J(r,i,o),d=e+t,c=o-i):(a.position==="left"?(h=i+t,d=J(r,n,e),l=L*-.5):(h=o-t,d=J(r,e,n),l=L*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=X(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);Ht(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:us(e.align),textBaseline:"middle",translation:[a,r]})}};function Yh(s,t){let e=new Ye({ctx:s.ctx,options:t,chart:s});tt.configure(s,e,t),tt.addBox(s,e),s.titleBlock=e}var Uh={id:"title",_element:Ye,start(s,t,e){Yh(s,e)},stop(s){let t=s.titleBlock;tt.removeBox(s,t),delete s.titleBlock},beforeUpdate(s,t,e){let i=s.titleBlock;tt.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},ks=new WeakMap,Xh={id:"subtitle",start(s,t,e){let i=new Ye({ctx:s.ctx,options:e,chart:s});tt.configure(s,i,e),tt.addBox(s,i),ks.set(s,i)},stop(s){tt.removeBox(s,ks.get(s)),ks.delete(s)},beforeUpdate(s,t,e){let i=ks.get(s);tt.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Ve={average(s){if(!s.length)return!1;let t,e,i=new Set,n=0,o=0;for(t=0,e=s.length;t<e;++t){let r=s[t].element;if(r&&r.hasValue()){let l=r.tooltipPosition();i.add(l.x),n+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((r,l)=>r+l)/i.size,y:n/o}},nearest(s,t){if(!s.length)return!1;let e=t.x,i=t.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=s.length;o<a;++o){let l=s[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),h=rs(t,c);h<n&&(n=h,r=l)}}if(r){let l=r.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function bt(s,t){return t&&(F(t)?Array.prototype.push.apply(s,t):s.push(t)),s}function At(s){return(typeof s=="string"||s instanceof String)&&s.indexOf(`
2
2
  `)>-1?s.split(`
3
- `):s}function Yh(s,t){let{element:e,datasetIndex:i,index:n}=t,o=s.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:s,label:a,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function Yo(s,t){let e=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:a,boxHeight:r}=t,l=X(t.bodyFont),c=X(t.titleFont),h=X(t.footerFont),d=o.length,u=n.length,f=i.length,p=Z(t.padding),g=p.height,m=0,b=i.reduce((y,_)=>y+_.before.length+_.lines.length+_.after.length,0);if(b+=s.beforeBody.length+s.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){let y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=f*y+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(g+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let x=0,v=function(y){m=Math.max(m,e.measureText(y).width+x)};return e.save(),e.font=c.string,E(s.title,v),e.font=l.string,E(s.beforeBody.concat(s.afterBody),v),x=t.displayColors?a+2+t.boxPadding:0,E(i,y=>{E(y.before,v),E(y.lines,v),E(y.after,v)}),x=0,e.font=h.string,E(s.footer,v),e.restore(),m+=p.width,{width:m,height:g}}function Uh(s,t){let{y:e,height:i}=t;return e<i/2?"top":e>s.height-i/2?"bottom":"center"}function Xh(s,t,e,i){let{x:n,width:o}=i,a=e.caretSize+e.caretPadding;if(s==="left"&&n+o+a>t.width||s==="right"&&n-o-a<0)return!0}function qh(s,t,e,i){let{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=s,c="center";return i==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),Xh(c,s,t,e)&&(c="center"),c}function Uo(s,t,e){let i=e.yAlign||t.yAlign||Uh(s,e);return{xAlign:e.xAlign||t.xAlign||qh(s,t,e,i),yAlign:i}}function Kh(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Gh(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function Xo(s,t,e,i){let{caretSize:n,caretPadding:o,cornerRadius:a}=s,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Vt(a),p=Kh(t,r),g=Gh(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(h,u)+n:r==="right"&&(p+=Math.max(d,f)+n),{x:K(p,0,i.width-t.width),y:K(g,0,i.height-t.height)}}function ws(s,t,e){let i=Z(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function qo(s){return bt([],Dt(s))}function Jh(s,t,e){return Pt(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ko(s,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}var Ma={beforeTitle:gt,title(s){if(s.length>0){let t=s[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:gt,beforeBody:gt,beforeLabel:gt,label(s){if(this&&this.options&&this.options.mode==="dataset")return s.label+": "+s.formattedValue||s.formattedValue;let t=s.dataset.label||"";t&&(t+=": ");let e=s.formattedValue;return O(e)||(t+=e),t},labelColor(s){let e=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.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(s){let e=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:gt,afterBody:gt,beforeFooter:gt,footer:gt,afterFooter:gt};function nt(s,t,e,i){let n=s[t].call(e,i);return typeof n>"u"?Ma[t].call(e,i):n}var Es=class extends ut{static positioners=Ne;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new Ps(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Jh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,n=nt(i,"beforeTitle",this,t),o=nt(i,"title",this,t),a=nt(i,"afterTitle",this,t),r=[];return r=bt(r,Dt(n)),r=bt(r,Dt(o)),r=bt(r,Dt(a)),r}getBeforeBody(t,e){return qo(nt(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:i}=e,n=[];return E(t,o=>{let a={before:[],lines:[],after:[]},r=Ko(i,o);bt(a.before,Dt(nt(r,"beforeLabel",this,o))),bt(a.lines,nt(r,"label",this,o)),bt(a.after,Dt(nt(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return qo(nt(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,n=nt(i,"beforeFooter",this,t),o=nt(i,"footer",this,t),a=nt(i,"afterFooter",this,t),r=[];return r=bt(r,Dt(n)),r=bt(r,Dt(o)),r=bt(r,Dt(a)),r}_createItems(t){let e=this._active,i=this.chart.data,n=[],o=[],a=[],r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(Yh(this.chart,e[l]));return t.filter&&(r=r.filter((h,d,u)=>t.filter(h,d,u,i))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,i))),E(r,h=>{let d=Ko(t.callbacks,h);n.push(nt(d,"labelColor",this,h)),o.push(nt(d,"labelPointStyle",this,h)),a.push(nt(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){let i=this.options.setContext(this.getContext()),n=this._active,o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{let r=Ne[i.position].call(this,n,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=Yo(this,i),c=Object.assign({},r,l),h=Uo(this.chart,i,c),d=Xo(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){let o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Vt(r),{x:u,y:f}=t,{width:p,height:g}=e,m,b,x,v,y,_;return o==="center"?(y=f+g/2,n==="left"?(m=u,b=m-a,v=y+a,_=y-a):(m=u+p,b=m+a,v=y-a,_=y+a),x=m):(n==="left"?b=u+Math.max(l,h)+a:n==="right"?b=u+p-Math.max(c,d)-a:b=this.caretX,o==="top"?(v=f,y=v-a,m=b-a,x=b+a):(v=f+g,y=v+a,m=b+a,x=b-a),_=v),{x1:m,x2:b,x3:x,y1:v,y2:y,y3:_}}drawTitle(t,e,i){let n=this.title,o=n.length,a,r,l;if(o){let c=Jt(i.rtl,this.x,this.width);for(t.x=ws(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=X(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(n[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){let a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,h=X(o.bodyFont),d=ws(this,"left",o),u=n.x(d),f=l<h.lineHeight?(h.lineHeight-l)/2:0,p=e.y+f;if(o.usePointStyle){let g={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},m=n.leftForLtr(u,c)+c/2,b=p+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,us(t,g,m,b),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,us(t,g,m,b)}else{t.lineWidth=T(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let g=n.leftForLtr(u,c),m=n.leftForLtr(n.xPlus(u,1),c-2),b=Vt(a.borderRadius);Object.values(b).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,fe(t,{x:g,y:p,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),fe(t,{x:m,y:p+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(m,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=i,d=X(i.bodyFont),u=d.lineHeight,f=0,p=Jt(i.rtl,this.x,this.width),g=function(M){e.fillText(M,p.x(t.x+f),t.y+u/2),t.y+=u+o},m=p.textAlign(a),b,x,v,y,_,w,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=ws(this,m,i),e.fillStyle=i.bodyColor,E(this.beforeBody,g),f=r&&m!=="right"?a==="center"?c/2+h:c+2+h:0,y=0,w=n.length;y<w;++y){for(b=n[y],x=this.labelTextColors[y],e.fillStyle=x,E(b.before,g),v=b.lines,r&&v.length&&(this._drawColorBox(e,t,y,p,i),u=Math.max(d.lineHeight,l)),_=0,k=v.length;_<k;++_)g(v[_]),u=d.lineHeight;E(b.after,g)}f=0,u=d.lineHeight,E(this.afterBody,g),t.y-=o}drawFooter(t,e,i){let n=this.footer,o=n.length,a,r;if(o){let l=Jt(i.rtl,this.x,this.width);for(t.x=ws(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=X(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(n[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){let{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:h}=i,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:p}=Vt(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+d,l),a==="top"&&this.drawCaret(t,e,i,n),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,i,n),e.lineTo(r+c,l+h-p),e.quadraticCurveTo(r+c,l+h,r+c-p,l+h),a==="bottom"&&this.drawCaret(t,e,i,n),e.lineTo(r+f,l+h),e.quadraticCurveTo(r,l+h,r,l+h-f),a==="center"&&o==="left"&&this.drawCaret(t,e,i,n),e.lineTo(r,l+d),e.quadraticCurveTo(r,l,r+d,l),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){let a=Ne[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=Yo(this,t),l=Object.assign({},a,this._size),c=Uo(e,t,l),h=Xo(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let a=Z(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),vi(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),wi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,n=t.map(({datasetIndex:r,index:l})=>{let c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!Oe(i,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!Oe(a,o)||r;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,n){let o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:n,options:o}=this,a=Ne[o.position].call(this,t,e);return a!==!1&&(i!==a.x||n!==a.y)}},Zh={id:"tooltip",_element:Es,positioners:Ne,afterInit(s,t,e){e&&(s.tooltip=new Es({chart:s,options:e}))},beforeUpdate(s,t,e){s.tooltip&&s.tooltip.initialize(e)},reset(s,t,e){s.tooltip&&s.tooltip.initialize(e)},afterDraw(s){let t=s.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(s.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",e)}},afterEvent(s,t){if(s.tooltip){let e=t.replay;s.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,t)=>t.bodyFont.size,boxWidth:(s,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Ma},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Qh=Object.freeze({__proto__:null,Colors:dh,Decimation:gh,Filler:Ih,Legend:Vh,SubTitle:jh,Title:Wh,Tooltip:Zh}),td=(s,t,e,i)=>(typeof t=="string"?(e=s.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function ed(s,t,e,i){let n=s.indexOf(t);if(n===-1)return td(s,t,e,i);let o=s.lastIndexOf(t);return n!==o?e:n}var sd=(s,t)=>s===null?null:K(Math.round(s),0,t);function Go(s){let t=this.getLabels();return s>=0&&s<t.length?t[s]:s}var an=class extends te{static id="category";static defaults={ticks:{callback:Go}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:n,label:o}of e)i[n]===o&&i.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(O(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:ed(i,t,D(e,t),this._addedLabels),sd(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,n=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)n.push({value:a});return n}getLabelForValue(t){return Go.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function id(s,t){let e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=s,f=o||1,p=h-1,{min:g,max:m}=t,b=!O(a),x=!O(r),v=!O(c),y=(m-g)/(d+1),_=ti((m-g)/p/f)*f,w,k,M,S;if(_<1e-14&&!b&&!x)return[{value:g},{value:m}];S=Math.ceil(m/_)-Math.floor(g/_),S>p&&(_=ti(S*_/p/f)*f),O(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),n==="ticks"?(k=Math.floor(g/_)*_,M=Math.ceil(m/_)*_):(k=g,M=m),b&&x&&o&&Fn((r-a)/o,_/1e3)?(S=Math.round(Math.min((r-a)/_,h)),_=(r-a)/S,k=a,M=r):v?(k=b?a:k,M=x?r:M,S=c-1,_=(M-k)/S):(S=(M-k)/_,he(S,Math.round(S),_/1e3)?S=Math.round(S):S=Math.ceil(S));let P=Math.max(si(_),si(k));w=Math.pow(10,O(l)?P:l),k=Math.round(k*w)/w,M=Math.round(M*w)/w;let C=0;for(b&&(u&&k!==a?(e.push({value:a}),k<a&&C++,he(Math.round((k+C*_)*w)/w,a,Jo(a,y,s))&&C++):k<a&&C++);C<S;++C){let A=Math.round((k+C*_)*w)/w;if(x&&A>r)break;e.push({value:A})}return x&&u&&M!==r?e.length&&he(e[e.length-1].value,r,Jo(r,y,s))?e[e.length-1].value=r:e.push({value:r}):(!x||M===r)&&e.push({value:M}),e}function Jo(s,t,{horizontal:e,minRotation:i}){let n=ct(i),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+s).length;return Math.min(t/o,a)}var xe=class extends te{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return O(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:n,max:o}=this,a=l=>n=e?n:l,r=l=>o=i?o:l;if(t){let l=dt(n),c=dt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(n-l)}this.min=n,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let n={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=id(n,o);return t.bounds==="ticks"&&ei(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ue(t,this.chart.options.locale,this.options.ticks.format)}},rn=class extends xe{static id="linear";static defaults={ticks:{callback:Te.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=H(t)?t:0,this.max=H(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=ct(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},je=s=>Math.floor(Mt(s)),Qt=(s,t)=>Math.pow(10,je(s)+t);function Zo(s){return s/Math.pow(10,je(s))===1}function Qo(s,t,e){let i=Math.pow(10,e),n=Math.floor(s/i);return Math.ceil(t/i)-n}function nd(s,t){let e=t-s,i=je(e);for(;Qo(s,t,i)>10;)i++;for(;Qo(s,t,i)<10;)i--;return Math.min(i,je(s))}function od(s,{min:t,max:e}){t=it(s.min,t);let i=[],n=je(t),o=nd(t,e),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10,d=Math.floor((c-h)/Math.pow(10,o)),u=it(s.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<e;)i.push({value:u,major:Zo(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;let f=it(s.max,u);return i.push({value:f,major:Zo(f),significand:d}),i}var ln=class extends te{static id="logarithmic";static defaults={ticks:{callback:Te.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=xe.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return H(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=H(t)?Math.max(0,t):null,this.max=H(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!H(this._userMin)&&(this.min=t===Qt(this.min,0)?Qt(this.min,-1):Qt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,n=this.max,o=r=>i=t?i:r,a=r=>n=e?n:r;i===n&&(i<=0?(o(1),a(10)):(o(Qt(i,-1)),a(Qt(n,1)))),i<=0&&o(Qt(n,-1)),n<=0&&a(Qt(i,1)),this.min=i,this.max=n}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=od(e,this);return t.bounds==="ticks"&&ei(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":ue(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=Mt(t),this._valueRange=Mt(this.max)-Mt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Mt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function cn(s){let t=s.ticks;if(t.display&&s.display){let e=Z(t.backdropPadding);return D(t.font&&t.font.size,B.font.size)+e.height}return 0}function ad(s,t,e){return e=F(e)?e:[e],{w:Yn(s,t.string,e),h:e.length*t.lineHeight}}function ta(s,t,e,i,n){return s===i||s===n?{start:t-e/2,end:t+e/2}:s<i||s>n?{start:t-e,end:t}:{start:t,end:t+e}}function rd(s){let t={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},e=Object.assign({},t),i=[],n=[],o=s._pointLabels.length,a=s.options.pointLabels,r=a.centerPointLabels?L/o:0;for(let l=0;l<o;l++){let c=a.setContext(s.getPointLabelContext(l));n[l]=c.padding;let h=s.getPointPosition(l,s.drawingArea+n[l],r),d=X(c.font),u=ad(s.ctx,d,s._pointLabels[l]);i[l]=u;let f=G(s.getIndexAngle(l)+r),p=Math.round(ls(f)),g=ta(p,h.x,u.w,0,180),m=ta(p,h.y,u.h,90,270);ld(e,t,f,g,m)}s.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),s._pointLabelItems=dd(s,i,n)}function ld(s,t,e,i,n){let o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),r=0,l=0;i.start<t.l?(r=(t.l-i.start)/o,s.l=Math.min(s.l,t.l-r)):i.end>t.r&&(r=(i.end-t.r)/o,s.r=Math.max(s.r,t.r+r)),n.start<t.t?(l=(t.t-n.start)/a,s.t=Math.min(s.t,t.t-l)):n.end>t.b&&(l=(n.end-t.b)/a,s.b=Math.max(s.b,t.b+l))}function cd(s,t,e){let i=s.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=e,l=s.getPointPosition(t,i+n+a,o),c=Math.round(ls(G(l.angle+W))),h=pd(l.y,r.h,c),d=ud(c),u=fd(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function hd(s,t){if(!t)return!0;let{left:e,top:i,right:n,bottom:o}=s;return!(pt({x:e,y:i},t)||pt({x:e,y:o},t)||pt({x:n,y:i},t)||pt({x:n,y:o},t))}function dd(s,t,e){let i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:cn(o)/2,additionalAngle:a?L/n:0},c;for(let h=0;h<n;h++){l.padding=e[h],l.size=t[h];let d=cd(s,h,l);i.push(d),r==="auto"&&(d.visible=hd(d,c),d.visible&&(c=d))}return i}function ud(s){return s===0||s===180?"center":s<180?"left":"right"}function fd(s,t,e){return e==="right"?s-=t:e==="center"&&(s-=t/2),s}function pd(s,t,e){return e===90||e===270?s-=t/2:(e>270||e<90)&&(s-=t),s}function gd(s,t,e){let{left:i,top:n,right:o,bottom:a}=e,{backdropColor:r}=t;if(!O(r)){let l=Vt(t.borderRadius),c=Z(t.backdropPadding);s.fillStyle=r;let h=i-c.left,d=n-c.top,u=o-i+c.width,f=a-n+c.height;Object.values(l).some(p=>p!==0)?(s.beginPath(),fe(s,{x:h,y:d,w:u,h:f,radius:l}),s.fill()):s.fillRect(h,d,u,f)}}function md(s,t){let{ctx:e,options:{pointLabels:i}}=s;for(let n=t-1;n>=0;n--){let o=s._pointLabelItems[n];if(!o.visible)continue;let a=i.setContext(s.getPointLabelContext(n));gd(e,a,o);let r=X(a.font),{x:l,y:c,textAlign:h}=o;Nt(e,s._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function Sa(s,t,e,i){let{ctx:n}=s;if(e)n.arc(s.xCenter,s.yCenter,t,0,z);else{let o=s.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let a=1;a<i;a++)o=s.getPointPosition(a,t),n.lineTo(o.x,o.y)}}function bd(s,t,e,i,n){let o=s.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!i||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Sa(s,e,a,i),o.closePath(),o.stroke(),o.restore())}function xd(s,t,e){return Pt(s,{label:e,index:t,type:"pointLabel"})}var hn=class extends xe{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:Te.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=Z(cn(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=H(t)&&!isNaN(t)?t:0,this.max=H(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/cn(this.options))}generateTickLabels(t){xe.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let n=I(this.options.pointLabels.callback,[e,i],this);return n||n===0?n:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?rd(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){let e=z/(this._pointLabels.length||1),i=this.options.startAngle||0;return G(t*e+ct(i))}getDistanceFromCenterForValue(t){if(O(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(O(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){let i=e[t];return xd(this.getContext(),t,i)}}getPointPosition(t,e,i=0){let n=this.getIndexAngle(t)-W+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),Sa(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:i,grid:n,border:o}=e,a=this._pointLabels.length,r,l,c;if(e.pointLabels.display&&md(this,a),n.display&&this.ticks.forEach((h,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let u=this.getContext(d),f=n.setContext(u),p=o.setContext(u);bd(this,f,l,a,p)}}),i.display){for(t.save(),r=a-1;r>=0;r--){let h=i.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let n=this.getIndexAngle(0),o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let c=i.setContext(this.getContext(l)),h=X(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;let d=Z(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}Nt(t,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},Is={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}},ot=Object.keys(Is);function ea(s,t){return s-t}function sa(s,t){if(O(t))return null;let e=s._adapter,{parser:i,round:n,isoWeekday:o}=s._parseOpts,a=t;return typeof i=="function"&&(a=i(a)),H(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(Gt(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,n)),+a)}function ia(s,t,e,i){let n=ot.length;for(let o=ot.indexOf(s);o<n-1;++o){let a=Is[ot[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=i)return ot[o]}return ot[n-1]}function _d(s,t,e,i,n){for(let o=ot.length-1;o>=ot.indexOf(e);o--){let a=ot[o];if(Is[a].common&&s._adapter.diff(n,i,a)>=t-1)return a}return ot[e?ot.indexOf(e):0]}function yd(s){for(let t=ot.indexOf(s)+1,e=ot.length;t<e;++t)if(Is[ot[t]].common)return ot[t]}function na(s,t,e){if(!e)s[t]=!0;else if(e.length){let{lo:i,hi:n}=cs(e,t),o=e[i]>=t?e[i]:e[n];s[o]=!0}}function vd(s,t,e,i){let n=s._adapter,o=+n.startOf(t[0].value,i),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+n.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function oa(s,t,e){let i=[],n={},o=t.length,a,r;for(a=0;a<o;++a)r=t[a],n[r]=a,i.push({value:r,major:!1});return o===0||!e?i:vd(s,i,n,e)}var Ye=class extends te{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let i=t.time||(t.time={}),n=this._adapter=new Rl._date(t.adapters.date);n.init(e),le(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:sa(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:n,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=H(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=H(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,n=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);let o=this.min,a=this.max,r=$n(n,o,a);return this._unit=e.unit||(i.autoSkip?ia(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):_d(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:yd(this._unit),this.initOffsets(n),t.reverse&&r.reverse(),oa(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=K(e,0,a),i=K(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,a=o.unit||ia(o.minUnit,e,i,this._getLabelCapacity(e)),r=D(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Gt(l)||l===!0,h={},d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);let p=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<i;u=+t.add(u,r,a),f++)na(h,u,p);return(u===i||n.bounds==="ticks"||f===1)&&na(h,u,p),Object.keys(h).sort(ea).map(g=>+g)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,n){let o=this.options,a=o.ticks.callback;if(a)return I(a,[t,e,i],this);let r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=i[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,n=ct(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),a=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*a,h:i*a+r*o}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,oa(this,[t],this._majorUnit),n),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,i=n.length;e<i;++e)t=t.concat(n[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,i;if(t.length)return t;let n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(sa(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return oi(t.sort(ea))}};function ks(s,t,e){let i=0,n=s.length-1,o,a,r,l;e?(t>=s[i].pos&&t<=s[n].pos&&({lo:i,hi:n}=ft(s,"pos",t)),{pos:o,time:r}=s[i],{pos:a,time:l}=s[n]):(t>=s[i].time&&t<=s[n].time&&({lo:i,hi:n}=ft(s,"time",t)),{time:o,pos:r}=s[i],{time:a,pos:l}=s[n]);let c=a-o;return c?r+(l-r)*(t-o)/c:r}var dn=class extends Ye{static id="timeseries";static defaults=Ye.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=ks(e,this.min),this._tableRange=ks(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,n=[],o=[],a,r,l,c,h;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=i&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,r=n.length;a<r;++a)h=n[a+1],l=n[a-1],c=n[a],Math.round((h+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){let t=this.min,e=this.max,i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((n,o)=>n-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(ks(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return ks(this._table,i*this._tableRange+this._minPos,!0)}},wd=Object.freeze({__proto__:null,CategoryScale:an,LinearScale:rn,LogarithmicScale:ln,RadialLinearScale:hn,TimeScale:Ye,TimeSeriesScale:dn}),Pa=[El,nh,Qh,wd];At.register(...Pa);window.__termweb={_callbacks:[],_receive:function(s){try{let t=typeof s=="string"?JSON.parse(s):s;this._callbacks.forEach(e=>e(t))}catch{}},onMessage:function(s){this._callbacks.push(s)}};var La,Ea,_e,rt=null,$="main",Vs=[],q=0,Tt="cpu",Bs=!1,$s="",Ra=!1,Ia=!1,Fs=null,st=null,zs=[],Ot="/",et=[],vt=0,ee=["pid","name","cpu","mem","port"],ve=20;function Fa(s){j&&Et&&j.send(JSON.stringify({type:"viewChange",view:s}))}function kd(){j&&Et&&j.send(JSON.stringify({type:"killConfirm"}))}function un(){j&&Et&&j.send(JSON.stringify({type:"killCancel"}))}function yt(s){$==="main"&&($=s,Fa(s),q=0,Ra=!1,Md())}async function Md(){document.getElementById("main-dashboard").style.display=$==="main"?"block":"none",document.getElementById("process-fullscreen").style.display=$==="processes"?"flex":"none",document.getElementById("detail-fullscreen").style.display=["cpu","memory","network","disk"].includes($)?"flex":"none",$==="processes"?Ba():["cpu","memory","network","disk"].includes($)&&(Ia=!Fs,Dd($),Fs&&Ha($,Fs),$==="network"?$a():$==="disk"&&(et=[],Hs(Ot))),Lt()}function Sd(){let s={responsive:!0,maintainAspectRatio:!1,animation:{duration:0},plugins:{legend:{display:!1}},scales:{x:{display:!1},y:{display:!0,min:0,max:100,grid:{color:"rgba(60, 60, 60, 0.5)"},ticks:{color:"#888",font:{size:10}}}}},t=(e,i)=>({labels:Array(60).fill(""),datasets:[{label:e,data:Array(60).fill(0),borderColor:i,backgroundColor:i.replace(")",", 0.15)").replace("rgb","rgba"),fill:!0,tension:.3,pointRadius:0,borderWidth:2}]});La=new At(document.getElementById("cpu-chart"),{type:"line",data:t("CPU","rgb(86, 156, 214)"),options:s}),Ea=new At(document.getElementById("mem-chart"),{type:"line",data:t("Memory","rgb(78, 201, 176)"),options:s}),_e=new At(document.getElementById("net-chart"),{type:"line",data:{labels:Array(60).fill(""),datasets:[{label:"Download",data:Array(60).fill(0),borderColor:"rgb(106, 153, 85)",backgroundColor:"rgba(106, 153, 85, 0.1)",fill:!0,tension:.3,pointRadius:0,borderWidth:2},{label:"Upload",data:Array(60).fill(0),borderColor:"rgb(206, 145, 120)",backgroundColor:"rgba(206, 145, 120, 0.1)",fill:!0,tension:.3,pointRadius:0,borderWidth:2}]},options:{...s,scales:{...s.scales,y:{...s.scales.y,max:void 0,suggestedMax:1e6}}}})}function Ca(s,t){let e=s.data.datasets[0].data;e.push(t),e.shift(),s.update("none")}function N(s){if(s===0)return"0 B";let t=1024,e=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(s)/Math.log(t));return parseFloat((s/Math.pow(t,i)).toFixed(1))+" "+e[i]}function ye(s){return N(s)+"/s"}function jt(s){return s>80?"high":s>50?"medium":"low"}function qe(){let s=[...Vs];if($s){let t=$s.toLowerCase();s=s.filter(e=>e.name.toLowerCase().includes(t)||e.pid.toString().includes(t)||e.ports&&e.ports.some(i=>i.includes(t)))}return s.sort((t,e)=>{let i=0;switch(Tt){case"pid":i=t.pid-e.pid;break;case"name":i=t.name.localeCompare(e.name);break;case"cpu":i=t.cpu-e.cpu;break;case"mem":i=t.mem-e.mem;break;case"port":let n=parseInt(t.ports?.[0],10)||0,o=parseInt(e.ports?.[0],10)||0;i=n-o;break}return Bs?i:-i}),s}function Da(s,t){let e=document.querySelector(".process-table tbody");if(!e)return!1;let i=qe();if(t<0||t>=i.length)return!1;let n=i[s]?.pid,o=i[t]?.pid;if(n!==void 0){let a=e.querySelector(`tr[data-pid="${n}"]`);a&&a.classList.remove("selected")}if(o!==void 0){let a=e.querySelector(`tr[data-pid="${o}"]`);if(a)return a.classList.add("selected"),a.scrollIntoView({block:"nearest"}),!0}return!1}function Pd(s){return s.map((t,e)=>{let i=e===q,n=t.ports?.join(", ")||"-",o=e*ve;return`<tr data-pid="${t.pid}" style="transform: translateY(${o}px)" class="${i?"selected":""}">
3
+ `):s}function qh(s,t){let{element:e,datasetIndex:i,index:n}=t,o=s.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:s,label:a,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function qo(s,t){let e=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:a,boxHeight:r}=t,l=X(t.bodyFont),c=X(t.titleFont),h=X(t.footerFont),d=o.length,u=n.length,f=i.length,p=Z(t.padding),g=p.height,m=0,b=i.reduce((y,_)=>y+_.before.length+_.lines.length+_.after.length,0);if(b+=s.beforeBody.length+s.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){let y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=f*y+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(g+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let x=0,v=function(y){m=Math.max(m,e.measureText(y).width+x)};return e.save(),e.font=c.string,E(s.title,v),e.font=l.string,E(s.beforeBody.concat(s.afterBody),v),x=t.displayColors?a+2+t.boxPadding:0,E(i,y=>{E(y.before,v),E(y.lines,v),E(y.after,v)}),x=0,e.font=h.string,E(s.footer,v),e.restore(),m+=p.width,{width:m,height:g}}function Kh(s,t){let{y:e,height:i}=t;return e<i/2?"top":e>s.height-i/2?"bottom":"center"}function Gh(s,t,e,i){let{x:n,width:o}=i,a=e.caretSize+e.caretPadding;if(s==="left"&&n+o+a>t.width||s==="right"&&n-o-a<0)return!0}function Jh(s,t,e,i){let{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=s,c="center";return i==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),Gh(c,s,t,e)&&(c="center"),c}function Ko(s,t,e){let i=e.yAlign||t.yAlign||Kh(s,e);return{xAlign:e.xAlign||t.xAlign||Jh(s,t,e,i),yAlign:i}}function Zh(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Qh(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function Go(s,t,e,i){let{caretSize:n,caretPadding:o,cornerRadius:a}=s,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Vt(a),p=Zh(t,r),g=Qh(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(h,u)+n:r==="right"&&(p+=Math.max(d,f)+n),{x:K(p,0,i.width-t.width),y:K(g,0,i.height-t.height)}}function Ms(s,t,e){let i=Z(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function Jo(s){return bt([],At(s))}function td(s,t,e){return Ct(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Zo(s,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}var Ca={beforeTitle:gt,title(s){if(s.length>0){let t=s[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:gt,beforeBody:gt,beforeLabel:gt,label(s){if(this&&this.options&&this.options.mode==="dataset")return s.label+": "+s.formattedValue||s.formattedValue;let t=s.dataset.label||"";t&&(t+=": ");let e=s.formattedValue;return O(e)||(t+=e),t},labelColor(s){let e=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.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(s){let e=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:gt,afterBody:gt,beforeFooter:gt,footer:gt,afterFooter:gt};function nt(s,t,e,i){let n=s[t].call(e,i);return typeof n>"u"?Ca[t].call(e,i):n}var Is=class extends ut{static positioners=Ve;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new Ds(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=td(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,n=nt(i,"beforeTitle",this,t),o=nt(i,"title",this,t),a=nt(i,"afterTitle",this,t),r=[];return r=bt(r,At(n)),r=bt(r,At(o)),r=bt(r,At(a)),r}getBeforeBody(t,e){return Jo(nt(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:i}=e,n=[];return E(t,o=>{let a={before:[],lines:[],after:[]},r=Zo(i,o);bt(a.before,At(nt(r,"beforeLabel",this,o))),bt(a.lines,nt(r,"label",this,o)),bt(a.after,At(nt(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return Jo(nt(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,n=nt(i,"beforeFooter",this,t),o=nt(i,"footer",this,t),a=nt(i,"afterFooter",this,t),r=[];return r=bt(r,At(n)),r=bt(r,At(o)),r=bt(r,At(a)),r}_createItems(t){let e=this._active,i=this.chart.data,n=[],o=[],a=[],r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(qh(this.chart,e[l]));return t.filter&&(r=r.filter((h,d,u)=>t.filter(h,d,u,i))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,i))),E(r,h=>{let d=Zo(t.callbacks,h);n.push(nt(d,"labelColor",this,h)),o.push(nt(d,"labelPointStyle",this,h)),a.push(nt(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){let i=this.options.setContext(this.getContext()),n=this._active,o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{let r=Ve[i.position].call(this,n,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=qo(this,i),c=Object.assign({},r,l),h=Ko(this.chart,i,c),d=Go(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){let o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Vt(r),{x:u,y:f}=t,{width:p,height:g}=e,m,b,x,v,y,_;return o==="center"?(y=f+g/2,n==="left"?(m=u,b=m-a,v=y+a,_=y-a):(m=u+p,b=m+a,v=y-a,_=y+a),x=m):(n==="left"?b=u+Math.max(l,h)+a:n==="right"?b=u+p-Math.max(c,d)-a:b=this.caretX,o==="top"?(v=f,y=v-a,m=b-a,x=b+a):(v=f+g,y=v+a,m=b+a,x=b-a),_=v),{x1:m,x2:b,x3:x,y1:v,y2:y,y3:_}}drawTitle(t,e,i){let n=this.title,o=n.length,a,r,l;if(o){let c=Zt(i.rtl,this.x,this.width);for(t.x=Ms(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=X(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(n[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){let a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,h=X(o.bodyFont),d=Ms(this,"left",o),u=n.x(d),f=l<h.lineHeight?(h.lineHeight-l)/2:0,p=e.y+f;if(o.usePointStyle){let g={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},m=n.leftForLtr(u,c)+c/2,b=p+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,ps(t,g,m,b),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,ps(t,g,m,b)}else{t.lineWidth=T(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let g=n.leftForLtr(u,c),m=n.leftForLtr(n.xPlus(u,1),c-2),b=Vt(a.borderRadius);Object.values(b).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,pe(t,{x:g,y:p,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),pe(t,{x:m,y:p+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(m,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=i,d=X(i.bodyFont),u=d.lineHeight,f=0,p=Zt(i.rtl,this.x,this.width),g=function(M){e.fillText(M,p.x(t.x+f),t.y+u/2),t.y+=u+o},m=p.textAlign(a),b,x,v,y,_,w,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Ms(this,m,i),e.fillStyle=i.bodyColor,E(this.beforeBody,g),f=r&&m!=="right"?a==="center"?c/2+h:c+2+h:0,y=0,w=n.length;y<w;++y){for(b=n[y],x=this.labelTextColors[y],e.fillStyle=x,E(b.before,g),v=b.lines,r&&v.length&&(this._drawColorBox(e,t,y,p,i),u=Math.max(d.lineHeight,l)),_=0,k=v.length;_<k;++_)g(v[_]),u=d.lineHeight;E(b.after,g)}f=0,u=d.lineHeight,E(this.afterBody,g),t.y-=o}drawFooter(t,e,i){let n=this.footer,o=n.length,a,r;if(o){let l=Zt(i.rtl,this.x,this.width);for(t.x=Ms(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=X(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(n[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){let{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:h}=i,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:p}=Vt(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+d,l),a==="top"&&this.drawCaret(t,e,i,n),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,i,n),e.lineTo(r+c,l+h-p),e.quadraticCurveTo(r+c,l+h,r+c-p,l+h),a==="bottom"&&this.drawCaret(t,e,i,n),e.lineTo(r+f,l+h),e.quadraticCurveTo(r,l+h,r,l+h-f),a==="center"&&o==="left"&&this.drawCaret(t,e,i,n),e.lineTo(r,l+d),e.quadraticCurveTo(r,l,r+d,l),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){let a=Ve[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=qo(this,t),l=Object.assign({},a,this._size),c=Ko(e,t,l),h=Go(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let a=Z(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Mi(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Si(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,n=t.map(({datasetIndex:r,index:l})=>{let c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!Le(i,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!Le(a,o)||r;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,n){let o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:n,options:o}=this,a=Ve[o.position].call(this,t,e);return a!==!1&&(i!==a.x||n!==a.y)}},ed={id:"tooltip",_element:Is,positioners:Ve,afterInit(s,t,e){e&&(s.tooltip=new Is({chart:s,options:e}))},beforeUpdate(s,t,e){s.tooltip&&s.tooltip.initialize(e)},reset(s,t,e){s.tooltip&&s.tooltip.initialize(e)},afterDraw(s){let t=s.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(s.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",e)}},afterEvent(s,t){if(s.tooltip){let e=t.replay;s.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,t)=>t.bodyFont.size,boxWidth:(s,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Ca},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},sd=Object.freeze({__proto__:null,Colors:ph,Decimation:xh,Filler:Bh,Legend:jh,SubTitle:Xh,Title:Uh,Tooltip:ed}),id=(s,t,e,i)=>(typeof t=="string"?(e=s.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function nd(s,t,e,i){let n=s.indexOf(t);if(n===-1)return id(s,t,e,i);let o=s.lastIndexOf(t);return n!==o?e:n}var od=(s,t)=>s===null?null:K(Math.round(s),0,t);function Qo(s){let t=this.getLabels();return s>=0&&s<t.length?t[s]:s}var cn=class extends ee{static id="category";static defaults={ticks:{callback:Qo}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:n,label:o}of e)i[n]===o&&i.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(O(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:nd(i,t,D(e,t),this._addedLabels),od(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,n=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)n.push({value:a});return n}getLabelForValue(t){return Qo.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function ad(s,t){let e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=s,f=o||1,p=h-1,{min:g,max:m}=t,b=!O(a),x=!O(r),v=!O(c),y=(m-g)/(d+1),_=ii((m-g)/p/f)*f,w,k,M,S;if(_<1e-14&&!b&&!x)return[{value:g},{value:m}];S=Math.ceil(m/_)-Math.floor(g/_),S>p&&(_=ii(S*_/p/f)*f),O(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),n==="ticks"?(k=Math.floor(g/_)*_,M=Math.ceil(m/_)*_):(k=g,M=m),b&&x&&o&&$n((r-a)/o,_/1e3)?(S=Math.round(Math.min((r-a)/_,h)),_=(r-a)/S,k=a,M=r):v?(k=b?a:k,M=x?r:M,S=c-1,_=(M-k)/S):(S=(M-k)/_,de(S,Math.round(S),_/1e3)?S=Math.round(S):S=Math.ceil(S));let P=Math.max(oi(_),oi(k));w=Math.pow(10,O(l)?P:l),k=Math.round(k*w)/w,M=Math.round(M*w)/w;let C=0;for(b&&(u&&k!==a?(e.push({value:a}),k<a&&C++,de(Math.round((k+C*_)*w)/w,a,ta(a,y,s))&&C++):k<a&&C++);C<S;++C){let A=Math.round((k+C*_)*w)/w;if(x&&A>r)break;e.push({value:A})}return x&&u&&M!==r?e.length&&de(e[e.length-1].value,r,ta(r,y,s))?e[e.length-1].value=r:e.push({value:r}):(!x||M===r)&&e.push({value:M}),e}function ta(s,t,{horizontal:e,minRotation:i}){let n=ct(i),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+s).length;return Math.min(t/o,a)}var _e=class extends ee{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return O(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:n,max:o}=this,a=l=>n=e?n:l,r=l=>o=i?o:l;if(t){let l=dt(n),c=dt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(n-l)}this.min=n,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let n={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=ad(n,o);return t.bounds==="ticks"&&ni(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return fe(t,this.chart.options.locale,this.options.ticks.format)}},hn=class extends _e{static id="linear";static defaults={ticks:{callback:Ee.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=ct(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},Ue=s=>Math.floor(St(s)),te=(s,t)=>Math.pow(10,Ue(s)+t);function ea(s){return s/Math.pow(10,Ue(s))===1}function sa(s,t,e){let i=Math.pow(10,e),n=Math.floor(s/i);return Math.ceil(t/i)-n}function rd(s,t){let e=t-s,i=Ue(e);for(;sa(s,t,i)>10;)i++;for(;sa(s,t,i)<10;)i--;return Math.min(i,Ue(s))}function ld(s,{min:t,max:e}){t=it(s.min,t);let i=[],n=Ue(t),o=rd(t,e),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10,d=Math.floor((c-h)/Math.pow(10,o)),u=it(s.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<e;)i.push({value:u,major:ea(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;let f=it(s.max,u);return i.push({value:f,major:ea(f),significand:d}),i}var dn=class extends ee{static id="logarithmic";static defaults={ticks:{callback:Ee.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=_e.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return V(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?Math.max(0,t):null,this.max=V(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!V(this._userMin)&&(this.min=t===te(this.min,0)?te(this.min,-1):te(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,n=this.max,o=r=>i=t?i:r,a=r=>n=e?n:r;i===n&&(i<=0?(o(1),a(10)):(o(te(i,-1)),a(te(n,1)))),i<=0&&o(te(n,-1)),n<=0&&a(te(i,1)),this.min=i,this.max=n}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=ld(e,this);return t.bounds==="ticks"&&ni(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":fe(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=St(t),this._valueRange=St(this.max)-St(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(St(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function un(s){let t=s.ticks;if(t.display&&s.display){let e=Z(t.backdropPadding);return D(t.font&&t.font.size,B.font.size)+e.height}return 0}function cd(s,t,e){return e=F(e)?e:[e],{w:qn(s,t.string,e),h:e.length*t.lineHeight}}function ia(s,t,e,i,n){return s===i||s===n?{start:t-e/2,end:t+e/2}:s<i||s>n?{start:t-e,end:t}:{start:t,end:t+e}}function hd(s){let t={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},e=Object.assign({},t),i=[],n=[],o=s._pointLabels.length,a=s.options.pointLabels,r=a.centerPointLabels?L/o:0;for(let l=0;l<o;l++){let c=a.setContext(s.getPointLabelContext(l));n[l]=c.padding;let h=s.getPointPosition(l,s.drawingArea+n[l],r),d=X(c.font),u=cd(s.ctx,d,s._pointLabels[l]);i[l]=u;let f=G(s.getIndexAngle(l)+r),p=Math.round(hs(f)),g=ia(p,h.x,u.w,0,180),m=ia(p,h.y,u.h,90,270);dd(e,t,f,g,m)}s.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),s._pointLabelItems=pd(s,i,n)}function dd(s,t,e,i,n){let o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),r=0,l=0;i.start<t.l?(r=(t.l-i.start)/o,s.l=Math.min(s.l,t.l-r)):i.end>t.r&&(r=(i.end-t.r)/o,s.r=Math.max(s.r,t.r+r)),n.start<t.t?(l=(t.t-n.start)/a,s.t=Math.min(s.t,t.t-l)):n.end>t.b&&(l=(n.end-t.b)/a,s.b=Math.max(s.b,t.b+l))}function ud(s,t,e){let i=s.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=e,l=s.getPointPosition(t,i+n+a,o),c=Math.round(hs(G(l.angle+W))),h=bd(l.y,r.h,c),d=gd(c),u=md(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function fd(s,t){if(!t)return!0;let{left:e,top:i,right:n,bottom:o}=s;return!(pt({x:e,y:i},t)||pt({x:e,y:o},t)||pt({x:n,y:i},t)||pt({x:n,y:o},t))}function pd(s,t,e){let i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:un(o)/2,additionalAngle:a?L/n:0},c;for(let h=0;h<n;h++){l.padding=e[h],l.size=t[h];let d=ud(s,h,l);i.push(d),r==="auto"&&(d.visible=fd(d,c),d.visible&&(c=d))}return i}function gd(s){return s===0||s===180?"center":s<180?"left":"right"}function md(s,t,e){return e==="right"?s-=t:e==="center"&&(s-=t/2),s}function bd(s,t,e){return e===90||e===270?s-=t/2:(e>270||e<90)&&(s-=t),s}function xd(s,t,e){let{left:i,top:n,right:o,bottom:a}=e,{backdropColor:r}=t;if(!O(r)){let l=Vt(t.borderRadius),c=Z(t.backdropPadding);s.fillStyle=r;let h=i-c.left,d=n-c.top,u=o-i+c.width,f=a-n+c.height;Object.values(l).some(p=>p!==0)?(s.beginPath(),pe(s,{x:h,y:d,w:u,h:f,radius:l}),s.fill()):s.fillRect(h,d,u,f)}}function _d(s,t){let{ctx:e,options:{pointLabels:i}}=s;for(let n=t-1;n>=0;n--){let o=s._pointLabelItems[n];if(!o.visible)continue;let a=i.setContext(s.getPointLabelContext(n));xd(e,a,o);let r=X(a.font),{x:l,y:c,textAlign:h}=o;Ht(e,s._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function Da(s,t,e,i){let{ctx:n}=s;if(e)n.arc(s.xCenter,s.yCenter,t,0,z);else{let o=s.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let a=1;a<i;a++)o=s.getPointPosition(a,t),n.lineTo(o.x,o.y)}}function yd(s,t,e,i,n){let o=s.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!i||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Da(s,e,a,i),o.closePath(),o.stroke(),o.restore())}function vd(s,t,e){return Ct(s,{label:e,index:t,type:"pointLabel"})}var fn=class extends _e{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:Ee.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=Z(un(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=V(t)&&!isNaN(t)?t:0,this.max=V(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/un(this.options))}generateTickLabels(t){_e.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let n=I(this.options.pointLabels.callback,[e,i],this);return n||n===0?n:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?hd(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){let e=z/(this._pointLabels.length||1),i=this.options.startAngle||0;return G(t*e+ct(i))}getDistanceFromCenterForValue(t){if(O(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(O(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){let i=e[t];return vd(this.getContext(),t,i)}}getPointPosition(t,e,i=0){let n=this.getIndexAngle(t)-W+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),Da(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:i,grid:n,border:o}=e,a=this._pointLabels.length,r,l,c;if(e.pointLabels.display&&_d(this,a),n.display&&this.ticks.forEach((h,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let u=this.getContext(d),f=n.setContext(u),p=o.setContext(u);yd(this,f,l,a,p)}}),i.display){for(t.save(),r=a-1;r>=0;r--){let h=i.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let n=this.getIndexAngle(0),o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let c=i.setContext(this.getContext(l)),h=X(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;let d=Z(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}Ht(t,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},zs={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}},ot=Object.keys(zs);function na(s,t){return s-t}function oa(s,t){if(O(t))return null;let e=s._adapter,{parser:i,round:n,isoWeekday:o}=s._parseOpts,a=t;return typeof i=="function"&&(a=i(a)),V(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(Jt(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,n)),+a)}function aa(s,t,e,i){let n=ot.length;for(let o=ot.indexOf(s);o<n-1;++o){let a=zs[ot[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=i)return ot[o]}return ot[n-1]}function wd(s,t,e,i,n){for(let o=ot.length-1;o>=ot.indexOf(e);o--){let a=ot[o];if(zs[a].common&&s._adapter.diff(n,i,a)>=t-1)return a}return ot[e?ot.indexOf(e):0]}function kd(s){for(let t=ot.indexOf(s)+1,e=ot.length;t<e;++t)if(zs[ot[t]].common)return ot[t]}function ra(s,t,e){if(!e)s[t]=!0;else if(e.length){let{lo:i,hi:n}=ds(e,t),o=e[i]>=t?e[i]:e[n];s[o]=!0}}function Md(s,t,e,i){let n=s._adapter,o=+n.startOf(t[0].value,i),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+n.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function la(s,t,e){let i=[],n={},o=t.length,a,r;for(a=0;a<o;++a)r=t[a],n[r]=a,i.push({value:r,major:!1});return o===0||!e?i:Md(s,i,n,e)}var Xe=class extends ee{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let i=t.time||(t.time={}),n=this._adapter=new zl._date(t.adapters.date);n.init(e),ce(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:oa(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:n,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=V(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=V(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,n=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);let o=this.min,a=this.max,r=Vn(n,o,a);return this._unit=e.unit||(i.autoSkip?aa(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):wd(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:kd(this._unit),this.initOffsets(n),t.reverse&&r.reverse(),la(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=K(e,0,a),i=K(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,a=o.unit||aa(o.minUnit,e,i,this._getLabelCapacity(e)),r=D(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Jt(l)||l===!0,h={},d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);let p=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<i;u=+t.add(u,r,a),f++)ra(h,u,p);return(u===i||n.bounds==="ticks"||f===1)&&ra(h,u,p),Object.keys(h).sort(na).map(g=>+g)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,n){let o=this.options,a=o.ticks.callback;if(a)return I(a,[t,e,i],this);let r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=i[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,n=ct(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),a=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*a,h:i*a+r*o}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,la(this,[t],this._majorUnit),n),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,i=n.length;e<i;++e)t=t.concat(n[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,i;if(t.length)return t;let n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(oa(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return li(t.sort(na))}};function Ss(s,t,e){let i=0,n=s.length-1,o,a,r,l;e?(t>=s[i].pos&&t<=s[n].pos&&({lo:i,hi:n}=ft(s,"pos",t)),{pos:o,time:r}=s[i],{pos:a,time:l}=s[n]):(t>=s[i].time&&t<=s[n].time&&({lo:i,hi:n}=ft(s,"time",t)),{time:o,pos:r}=s[i],{time:a,pos:l}=s[n]);let c=a-o;return c?r+(l-r)*(t-o)/c:r}var pn=class extends Xe{static id="timeseries";static defaults=Xe.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ss(e,this.min),this._tableRange=Ss(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,n=[],o=[],a,r,l,c,h;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=i&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,r=n.length;a<r;++a)h=n[a+1],l=n[a-1],c=n[a],Math.round((h+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){let t=this.min,e=this.max,i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((n,o)=>n-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Ss(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Ss(this._table,i*this._tableRange+this._minPos,!0)}},Sd=Object.freeze({__proto__:null,CategoryScale:cn,LinearScale:hn,LogarithmicScale:dn,RadialLinearScale:fn,TimeScale:Xe,TimeSeriesScale:pn}),Aa=[Fl,rh,sd,Sd];Ot.register(...Aa);window.__termweb={_callbacks:[],_receive:function(s){try{let t=typeof s=="string"?JSON.parse(s):s;this._callbacks.forEach(e=>e(t))}catch{}},onMessage:function(s){this._callbacks.push(s)}};var Ia,Fa,ve,rt=null,$="main",js=[],q=0,Lt="cpu",Hs=!1,Vs="",za=!1,Ba=!1,Bs=null,st=null,$s=[],Tt="/",et=[],wt=0,Ns=12,vt={cpu:{load:[],perCore:[]},memory:{percent:[],used:[]},network:{rx:[],tx:[]},disk:null,processes:null};function ye(s,t){s.push(t),s.length>Ns&&s.shift()}var se=["pid","name","cpu","mem","port"],ke=20;function $a(s){j&&Rt&&j.send(JSON.stringify({type:"viewChange",view:s}))}function Pd(){j&&Rt&&j.send(JSON.stringify({type:"killConfirm"}))}function gn(){j&&Rt&&j.send(JSON.stringify({type:"killCancel"}))}function yt(s){$==="main"&&($=s,$a(s),q=0,za=!1,Cd())}async function Cd(){document.getElementById("main-dashboard").style.display=$==="main"?"block":"none",document.getElementById("process-fullscreen").style.display=$==="processes"?"flex":"none",document.getElementById("detail-fullscreen").style.display=["cpu","memory","network","disk"].includes($)?"flex":"none",$==="processes"?Ha():["cpu","memory","network","disk"].includes($)&&(Ba=!Bs,Td($),Bs&&Ya($,Bs),$==="network"?Va():$==="disk"&&(et=[],Ys(Tt))),Et()}function Dd(){let s={responsive:!0,maintainAspectRatio:!1,animation:{duration:0},plugins:{legend:{display:!1}},scales:{x:{display:!1},y:{display:!0,min:0,max:100,grid:{color:"rgba(60, 60, 60, 0.5)"},ticks:{color:"#888",font:{size:10}}}}},t=(e,i)=>({labels:Array(60).fill(""),datasets:[{label:e,data:Array(60).fill(0),borderColor:i,backgroundColor:i.replace(")",", 0.15)").replace("rgb","rgba"),fill:!0,tension:.3,pointRadius:0,borderWidth:2}]});Ia=new Ot(document.getElementById("cpu-chart"),{type:"line",data:t("CPU","rgb(86, 156, 214)"),options:s}),Fa=new Ot(document.getElementById("mem-chart"),{type:"line",data:t("Memory","rgb(78, 201, 176)"),options:s}),ve=new Ot(document.getElementById("net-chart"),{type:"line",data:{labels:Array(60).fill(""),datasets:[{label:"Download",data:Array(60).fill(0),borderColor:"rgb(106, 153, 85)",backgroundColor:"rgba(106, 153, 85, 0.1)",fill:!0,tension:.3,pointRadius:0,borderWidth:2},{label:"Upload",data:Array(60).fill(0),borderColor:"rgb(206, 145, 120)",backgroundColor:"rgba(206, 145, 120, 0.1)",fill:!0,tension:.3,pointRadius:0,borderWidth:2}]},options:{...s,scales:{...s.scales,y:{...s.scales.y,max:void 0,suggestedMax:1e6}}}})}function Oa(s,t){let e=s.data.datasets[0].data;e.push(t),e.shift(),s.update("none")}function N(s){if(s===0)return"0 B";let t=1024,e=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(s)/Math.log(t));return parseFloat((s/Math.pow(t,i)).toFixed(1))+" "+e[i]}function we(s){return N(s)+"/s"}function Yt(s){return s>80?"high":s>50?"medium":"low"}function Ge(){let s=[...js];if(Vs){let t=Vs.toLowerCase().replace(/\s+/g,"");s=s.filter(e=>{let i=e.name.toLowerCase().replace(/\s+/g,""),n=e.pid.toString();return i.includes(t)||n.includes(t)||e.ports&&e.ports.some(o=>o.includes(t))})}return s.sort((t,e)=>{let i=0;switch(Lt){case"pid":i=t.pid-e.pid;break;case"name":i=t.name.localeCompare(e.name);break;case"cpu":i=t.cpu-e.cpu;break;case"mem":i=t.mem-e.mem;break;case"port":let n=parseInt(t.ports?.[0],10)||0,o=parseInt(e.ports?.[0],10)||0;i=n-o;break}return Hs?i:-i}),s}function Ta(s,t){let e=document.querySelector(".process-table tbody");if(!e)return!1;let i=Ge();if(t<0||t>=i.length)return!1;let n=i[s]?.pid,o=i[t]?.pid;if(n!==void 0){let a=e.querySelector(`tr[data-pid="${n}"]`);a&&a.classList.remove("selected")}if(o!==void 0){let a=e.querySelector(`tr[data-pid="${o}"]`);if(a)return a.classList.add("selected"),a.scrollIntoView({block:"nearest"}),!0}return!1}function Ad(s){return s.map((t,e)=>{let i=e===q,n=t.ports?.join(", ")||"-",o=e*ke;return`<tr data-pid="${t.pid}" style="transform: translateY(${o}px)" class="${i?"selected":""}">
4
4
  <td>${t.pid}</td>
5
5
  <td>${t.name}</td>
6
- <td class="${jt(t.cpu)}">${t.cpu.toFixed(1)}%</td>
6
+ <td class="${Yt(t.cpu)}">${t.cpu.toFixed(1)}%</td>
7
7
  <td>${t.mem.toFixed(1)}%</td>
8
8
  <td>${n}</td>
9
9
  <td>${t.state}</td>
10
10
  <td>${t.user}</td>
11
- </tr>`}).join("")}function za(){let s=document.querySelector(".process-table tbody");if(!s)return!1;let t=qe(),e=s.querySelectorAll("tr"),i=new Map;if(t.forEach((n,o)=>i.set(n.pid,o)),e.forEach(n=>{let o=parseInt(n.dataset.pid,10),a=i.get(o);a!==void 0?(n.style.transform=`translateY(${a*ve}px)`,n.style.display=""):n.style.display="none"}),e.forEach(n=>n.classList.remove("selected")),t[q]){let n=t[q].pid,o=s.querySelector(`tr[data-pid="${n}"]`);o&&(o.classList.add("selected"),o.scrollIntoView({block:"nearest"}))}return s.style.height=`${t.length*ve}px`,!0}function fn(){return ee.map(s=>{let t=Tt===s?Bs?"\u25B2":"\u25BC":"";return`<th class="${Tt===s?"sorted":""}">${s.toUpperCase()} ${t}</th>`}).join("")+"<th>STATE</th><th>USER</th>"}function Cd(){let s=document.querySelector(".process-table thead tr"),t=document.querySelector(".process-table tbody");if(!s||!t)return!1;let e=qe();q>=e.length&&(q=Math.max(0,e.length-1)),s.innerHTML=fn();let i=new Map;t.querySelectorAll("tr").forEach(a=>{i.set(parseInt(a.dataset.pid,10),a)});let n=new Set(e.map(a=>a.pid)),o=new Set(Vs.map(a=>a.pid));return e.forEach((a,r)=>{let l=i.get(a.pid),c=!l;if(c){l=document.createElement("tr"),l.dataset.pid=a.pid,l.style.transition="none",l.classList.add("row-new");for(let u=0;u<7;u++)l.appendChild(document.createElement("td"));t.appendChild(l),setTimeout(()=>l.classList.remove("row-new"),600)}let h=l.querySelectorAll("td");h[0].textContent=a.pid,h[1].textContent=a.name,h[2].textContent=a.cpu.toFixed(1)+"%",h[2].className=jt(a.cpu),h[3].textContent=a.mem.toFixed(1)+"%",h[4].textContent=a.ports?.join(", ")||"-",h[5].textContent=a.state||"",h[6].textContent=a.user||"";let d=r*ve;c?(l.style.transform=`translateY(${d}px)`,requestAnimationFrame(()=>{l.style.transition="transform 0.4s ease-out"})):l.style.transform=`translateY(${d}px)`,l.style.display="",l.classList.toggle("selected",r===q)}),i.forEach((a,r)=>{o.has(r)?n.has(r)||(a.style.display="none"):a.remove()}),t.style.height=`${e.length*ve}px`,!0}function Ba(){let s=qe(),t=document.getElementById("process-fullscreen");q>=s.length&&(q=Math.max(0,s.length-1)),t.innerHTML=`
11
+ </tr>`}).join("")}function Na(){let s=document.querySelector(".process-table tbody");if(!s)return!1;let t=Ge(),e=s.querySelectorAll("tr"),i=new Map;if(t.forEach((n,o)=>i.set(n.pid,o)),e.forEach(n=>{let o=parseInt(n.dataset.pid,10),a=i.get(o);a!==void 0?(n.style.transform=`translateY(${a*ke}px)`,n.style.display=""):n.style.display="none"}),e.forEach(n=>n.classList.remove("selected")),t[q]){let n=t[q].pid,o=s.querySelector(`tr[data-pid="${n}"]`);o&&(o.classList.add("selected"),o.scrollIntoView({block:"nearest"}))}return s.style.height=`${t.length*ke}px`,!0}function mn(){return se.map(s=>{let t=Lt===s?Hs?"\u25B2":"\u25BC":"";return`<th class="${Lt===s?"sorted":""}">${s.toUpperCase()} ${t}</th>`}).join("")+"<th>STATE</th><th>USER</th>"}function Od(){let s=document.querySelector(".process-table thead tr"),t=document.querySelector(".process-table tbody");if(!s||!t)return!1;let e=Ge();q>=e.length&&(q=Math.max(0,e.length-1)),s.innerHTML=mn();let i=new Map;t.querySelectorAll("tr").forEach(a=>{i.set(parseInt(a.dataset.pid,10),a)});let n=new Set(e.map(a=>a.pid)),o=new Set(js.map(a=>a.pid));return e.forEach((a,r)=>{let l=i.get(a.pid),c=!l;if(c){l=document.createElement("tr"),l.dataset.pid=a.pid,l.style.transition="none",l.classList.add("row-new");for(let u=0;u<7;u++)l.appendChild(document.createElement("td"));t.appendChild(l),setTimeout(()=>l.classList.remove("row-new"),600)}let h=l.querySelectorAll("td");h[0].textContent=a.pid,h[1].textContent=a.name,h[2].textContent=a.cpu.toFixed(1)+"%",h[2].className=Yt(a.cpu),h[3].textContent=a.mem.toFixed(1)+"%",h[4].textContent=a.ports?.join(", ")||"-",h[5].textContent=a.state||"",h[6].textContent=a.user||"";let d=r*ke;c?(l.style.transform=`translateY(${d}px)`,requestAnimationFrame(()=>{l.style.transition="transform 0.4s ease-out"})):l.style.transform=`translateY(${d}px)`,l.style.display="",l.classList.toggle("selected",r===q)}),i.forEach((a,r)=>{o.has(r)?n.has(r)||(a.style.display="none"):a.remove()}),t.style.height=`${e.length*ke}px`,!0}function Ha(){let s=Ge(),t=document.getElementById("process-fullscreen");q>=s.length&&(q=Math.max(0,s.length-1)),t.innerHTML=`
12
12
  <div class="process-header" tabindex="-1">
13
13
  <h2>Processes</h2>
14
- <input type="text" id="filter-input" value="${$s}" placeholder="Search by name, pid, or port..." tabindex="0" autofocus>
14
+ <input type="text" id="filter-input" value="${Vs}" placeholder="Search by name, pid, or port..." tabindex="0" autofocus>
15
15
  </div>
16
16
  <div class="process-table-wrap" tabindex="-1">
17
17
  <table class="process-table" tabindex="-1">
18
- <thead><tr>${fn()}</tr></thead>
19
- <tbody style="height: ${s.length*ve}px">${Pd(s)}</tbody>
18
+ <thead><tr>${mn()}</tr></thead>
19
+ <tbody style="height: ${s.length*ke}px">${Ad(s)}</tbody>
20
20
  </table>
21
21
  </div>
22
- `,t.style.display="flex",document.getElementById("main-dashboard").style.display="none";let e=document.getElementById("filter-input");e.focus(),e.addEventListener("input",i=>{$s=i.target.value,q=0,za()}),Lt()}function Dd(s){let t=document.getElementById("detail-fullscreen"),e={cpu:"CPU Details",memory:"Memory Details",network:"Network Details",disk:"Disk Details"};rt&&(rt.destroy(),rt=null);let i="";Ia?i='<div class="spinner">Loading...</div>':s==="cpu"?i=`
22
+ `,t.style.display="flex",document.getElementById("main-dashboard").style.display="none";let e=document.getElementById("filter-input");e.focus(),e.addEventListener("input",i=>{Vs=i.target.value,q=0,Na()}),Et()}function Td(s){let t=document.getElementById("detail-fullscreen"),e={cpu:"CPU Details",memory:"Memory Details",network:"Network Details",disk:"Disk Details"};rt&&(rt.destroy(),rt=null);let i="";Ba?i='<div class="spinner">Loading...</div>':s==="cpu"?i=`
23
23
  <div id="detail-cpu-info"></div>
24
24
  <div id="detail-cpu-cores" class="core-grid"></div>
25
25
  <div id="detail-cpu-dist" class="distribution-chart"></div>
@@ -38,22 +38,22 @@
38
38
  <h2>${e[s]}</h2>
39
39
  </div>
40
40
  <div class="detail-content">${i}</div>
41
- `;let n=document.getElementById("detail-chart-canvas");n&&s==="network"&&(rt=new At(n,{type:"line",data:{labels:Array(60).fill(""),datasets:[{label:"Download",data:Array(60).fill(0),borderColor:"rgb(106, 153, 85)",backgroundColor:"rgba(106, 153, 85, 0.1)",fill:!0,tension:.3,pointRadius:0,borderWidth:2},{label:"Upload",data:Array(60).fill(0),borderColor:"rgb(206, 145, 120)",backgroundColor:"rgba(206, 145, 120, 0.1)",fill:!0,tension:.3,pointRadius:0,borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:0},plugins:{legend:{display:!0}},scales:{x:{display:!1},y:{display:!0,min:0,grid:{color:"rgba(60, 60, 60, 0.5)"},ticks:{color:"#888",font:{size:10}}}}}}))}var we=["#569cd6","#4ec9b0","#dcdcaa","#ce9178","#c586c0","#6a9955","#d7ba7d","#9cdcfe","#f14c4c","#b5cea8"];function Xe(s,t,e,i,n,o=[]){if(s.length===0)return o;if(s.length===1)return o.push({...s[0],x:t,y:e,w:i,h:n}),o;let a=s.reduce((g,m)=>g+m.value,0);if(a===0)return o;let r=n>i,l=r?n:i,c=[],h=0,d=[...s];for(let g=0;g<s.length;g++){let m=s[g],b=[...c,m],x=h+m.value,v=x/a*i*n,y=r?v/i:v/n,_=Math.max(...b.map(w=>{let k=w.value/x*v,M=k/y,S=y;return Math.max(M/S,S/M)}));if(c.length>0){let w=h/a*i*n,k=r?w/i:w/n,M=Math.max(...c.map(S=>{let P=S.value/h*w,C=P/k,A=k;return Math.max(C/A,A/C)}));if(_>M&&c.length>0){let S=h/a*i*n,P=r?S/i:S/n,C=0;for(let A of c){let Y=A.value/h*(r?i:n);r?o.push({...A,x:t+C,y:e,w:Y,h:P}):o.push({...A,x:t,y:e+C,w:P,h:Y}),C+=Y}return r?Xe(d.slice(c.length),t,e+P,i,n-P,o):Xe(d.slice(c.length),t+P,e,i-P,n,o)}}c.push(m),h+=m.value}let u=h/a*i*n,f=r?u/i:u/n,p=0;for(let g of c){let m=g.value/h*(r?i:n);r?o.push({...g,x:t+p,y:e,w:m,h:f}):o.push({...g,x:t,y:e+p,w:f,h:m}),p+=m}return o}function Aa(s,t,e,i){let n=document.getElementById(s);if(!n||!t||t.length===0)return;let o=[...t].filter(h=>h[e]>.1).sort((h,d)=>d[e]-h[e]).slice(0,15);if(o.reduce((h,d)=>h+d[e],0)===0){n.innerHTML='<div style="color: #888; padding: 16px;">No significant usage</div>';return}let r=o.map((h,d)=>({name:h.name,pid:h.pid,value:h[e],pct:h[e],mem:h.mem,cpu:h.cpu,color:we[d%we.length]})),l=Xe(r,0,0,100,100),c=`<div class="treemap-label">${i} - Top Consumers</div><div class="treemap-2d">`;for(let h of l){let d=h.w>8&&h.h>12,u=h.w>5&&h.h>8,f=`${h.name} (PID: ${h.pid}) | CPU: ${h.cpu.toFixed(1)}% | MEM: ${h.mem.toFixed(1)}%`;c+=`
41
+ `;let n=document.getElementById("detail-chart-canvas");if(n&&s==="network"){let o=[...vt.network.rx],a=[...vt.network.tx];for(;o.length<Ns;)o.unshift(0);for(;a.length<Ns;)a.unshift(0);rt=new Ot(n,{type:"line",data:{labels:Array(Ns).fill(""),datasets:[{label:"Download",data:o,borderColor:"rgb(106, 153, 85)",backgroundColor:"rgba(106, 153, 85, 0.1)",fill:!0,tension:.3,pointRadius:0,borderWidth:2},{label:"Upload",data:a,borderColor:"rgb(206, 145, 120)",backgroundColor:"rgba(206, 145, 120, 0.1)",fill:!0,tension:.3,pointRadius:0,borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:0},plugins:{legend:{display:!0}},scales:{x:{display:!1},y:{display:!0,min:0,grid:{color:"rgba(60, 60, 60, 0.5)"},ticks:{color:"#888",font:{size:10}}}}}})}}var Me=["#569cd6","#4ec9b0","#dcdcaa","#ce9178","#c586c0","#6a9955","#d7ba7d","#9cdcfe","#f14c4c","#b5cea8"];function Ke(s,t,e,i,n,o=[]){if(s.length===0)return o;if(s.length===1)return o.push({...s[0],x:t,y:e,w:i,h:n}),o;let a=s.reduce((g,m)=>g+m.value,0);if(a===0)return o;let r=n>i,l=r?n:i,c=[],h=0,d=[...s];for(let g=0;g<s.length;g++){let m=s[g],b=[...c,m],x=h+m.value,v=x/a*i*n,y=r?v/i:v/n,_=Math.max(...b.map(w=>{let k=w.value/x*v,M=k/y,S=y;return Math.max(M/S,S/M)}));if(c.length>0){let w=h/a*i*n,k=r?w/i:w/n,M=Math.max(...c.map(S=>{let P=S.value/h*w,C=P/k,A=k;return Math.max(C/A,A/C)}));if(_>M&&c.length>0){let S=h/a*i*n,P=r?S/i:S/n,C=0;for(let A of c){let Y=A.value/h*(r?i:n);r?o.push({...A,x:t+C,y:e,w:Y,h:P}):o.push({...A,x:t,y:e+C,w:P,h:Y}),C+=Y}return r?Ke(d.slice(c.length),t,e+P,i,n-P,o):Ke(d.slice(c.length),t+P,e,i-P,n,o)}}c.push(m),h+=m.value}let u=h/a*i*n,f=r?u/i:u/n,p=0;for(let g of c){let m=g.value/h*(r?i:n);r?o.push({...g,x:t+p,y:e,w:m,h:f}):o.push({...g,x:t,y:e+p,w:f,h:m}),p+=m}return o}function La(s,t,e,i){let n=document.getElementById(s);if(!n||!t||t.length===0)return;let o=[...t].filter(h=>h[e]>.1).sort((h,d)=>d[e]-h[e]).slice(0,15);if(o.reduce((h,d)=>h+d[e],0)===0){n.innerHTML='<div style="color: #888; padding: 16px;">No significant usage</div>';return}let r=o.map((h,d)=>({name:h.name,pid:h.pid,value:h[e],pct:h[e],mem:h.mem,cpu:h.cpu,color:Me[d%Me.length]})),l=Ke(r,0,0,100,100),c=`<div class="treemap-label">${i} - Top Consumers</div><div class="treemap-2d">`;for(let h of l){let d=h.w>8&&h.h>12,u=h.w>5&&h.h>8,f=`${h.name} (PID: ${h.pid}) | CPU: ${h.cpu.toFixed(1)}% | MEM: ${h.mem.toFixed(1)}%`;c+=`
42
42
  <div class="treemap-cell" style="left:${h.x}%;top:${h.y}%;width:${h.w}%;height:${h.h}%;background:${h.color};" data-tip="${f}">
43
43
  ${d?`<span class="treemap-name">${h.name}</span>`:""}
44
44
  ${u?`<span class="treemap-value">${h.pct.toFixed(1)}%</span>`:""}
45
45
  </div>
46
- `}c+="</div>",n.innerHTML=c}function $a(){j&&Et&&j.send(JSON.stringify({type:"connections"}))}function Hs(s){j&&Et&&j.send(JSON.stringify({type:"folderSizes",path:s}))}function Na(s){let t=document.getElementById(s);if(!t||zs.length===0){t&&(t.innerHTML='<div style="color:#888;padding:16px;">No active connections</div>');return}let e=zs.reduce((a,r)=>a+(r.bytes||0),0),i=zs.map((a,r)=>({ip:a.host,hostname:a.hostname||a.host,name:a.hostname&&a.hostname!==a.host?a.hostname:a.host,value:a.bytes||1,bytes:a.bytes||0,count:a.count,ports:a.ports,processes:a.processes,color:we[r%we.length]})),n=Xe(i,0,0,100,100),o=`<div class="treemap-label">Network Traffic (${N(e)} total)</div><div class="treemap-2d">`;for(let a of n){let r=a.w>10&&a.h>15,l=a.w>6&&a.h>10,h=`${a.hostname!==a.ip?`${a.hostname} (${a.ip})`:a.ip} | ${N(a.bytes)} | ${a.count} conn | Ports: ${a.ports.join(",")} | ${a.processes.join(",")}`;o+=`
46
+ `}c+="</div>",n.innerHTML=c}function Va(){j&&Rt&&j.send(JSON.stringify({type:"connections"}))}function Ys(s){j&&Rt&&j.send(JSON.stringify({type:"folderSizes",path:s}))}function Wa(s){let t=document.getElementById(s);if(!t||$s.length===0){t&&(t.innerHTML='<div style="color:#888;padding:16px;">No active connections</div>');return}let e=$s.reduce((a,r)=>a+(r.bytes||0),0),i=$s.map((a,r)=>({ip:a.host,hostname:a.hostname||a.host,name:a.hostname&&a.hostname!==a.host?a.hostname:a.host,value:a.bytes||1,bytes:a.bytes||0,count:a.count,ports:a.ports,processes:a.processes,color:Me[r%Me.length]})),n=Ke(i,0,0,100,100),o=`<div class="treemap-label">Network Traffic (${N(e)} total)</div><div class="treemap-2d">`;for(let a of n){let r=a.w>10&&a.h>15,l=a.w>6&&a.h>10,h=`${a.hostname!==a.ip?`${a.hostname} (${a.ip})`:a.ip} | ${N(a.bytes)} | ${a.count} conn | Ports: ${a.ports.join(",")} | ${a.processes.join(",")}`;o+=`
47
47
  <div class="treemap-cell" style="left:${a.x}%;top:${a.y}%;width:${a.w}%;height:${a.h}%;background:${a.color};" data-tip="${h}">
48
48
  ${r?`<span class="treemap-name">${a.name}</span>`:""}
49
49
  ${l?`<span class="treemap-value">${N(a.bytes)}</span>`:""}
50
50
  </div>
51
- `}o+="</div>",t.innerHTML=o}function Ke(s){let t=document.getElementById(s);if(!t)return;if(et.length===0){t.innerHTML='<div class="spinner">Scanning...</div>';return}vt>=et.length&&(vt=Math.max(0,et.length-1));let e=et.filter(l=>l.confirmed).length,i=et.reduce((l,c)=>l+c.size,0),n=et.map((l,c)=>({name:l.name,path:l.path,value:l.size,size:l.size,confirmed:l.confirmed,index:c,color:we[c%we.length]})),o=Xe(n,0,0,100,100),a=e<et.length?` (scanning ${e}/${et.length})`:"",r=`<div class="treemap-label">Folder Sizes (${N(i)} total)${a}</div><div class="treemap-2d">`;for(let l of o){let c=l.w>8&&l.h>12,h=l.w>5&&l.h>8,d=i>0?(l.size/i*100).toFixed(1):0,u=l.confirmed?"":" (estimated)",f=`${l.path} | ${N(l.size)}${u} (${d}%)`,p=l.index===vt,g=l.confirmed?1:.6,m=l.confirmed?"":"background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0,0,0,0.1) 5px, rgba(0,0,0,0.1) 10px);",b=p?"outline: 3px solid #fff; outline-offset: -3px; z-index: 10;":"";r+=`
51
+ `}o+="</div>",t.innerHTML=o}function Je(s){let t=document.getElementById(s);if(!t)return;if(et.length===0){t.innerHTML='<div class="spinner">Scanning...</div>';return}wt>=et.length&&(wt=Math.max(0,et.length-1));let e=et.filter(l=>l.confirmed).length,i=et.reduce((l,c)=>l+c.size,0),n=et.map((l,c)=>({name:l.name,path:l.path,value:l.size,size:l.size,confirmed:l.confirmed,index:c,color:Me[c%Me.length]})),o=Ke(n,0,0,100,100),a=e<et.length?` (scanning ${e}/${et.length})`:"",r=`<div class="treemap-label">Folder Sizes (${N(i)} total)${a}</div><div class="treemap-2d">`;for(let l of o){let c=l.w>8&&l.h>12,h=l.w>5&&l.h>8,d=i>0?(l.size/i*100).toFixed(1):0,u=l.confirmed?"":" (estimated)",f=`${l.path} | ${N(l.size)}${u} (${d}%)`,p=l.index===wt,g=l.confirmed?1:.6,m=l.confirmed?"":"background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0,0,0,0.1) 5px, rgba(0,0,0,0.1) 10px);",b=p?"outline: 3px solid #fff; outline-offset: -3px; z-index: 10;":"";r+=`
52
52
  <div class="treemap-cell folder-cell${p?" selected":""}" style="left:${l.x}%;top:${l.y}%;width:${l.w}%;height:${l.h}%;background-color:${l.color};opacity:${g};${m}${b}" data-tip="${f}" data-path="${l.path}" data-index="${l.index}">
53
53
  ${c?`<span class="treemap-name">${l.name}</span>`:""}
54
54
  ${h?`<span class="treemap-value">${l.confirmed?N(l.size):"~"+N(l.size)}</span>`:""}
55
55
  </div>
56
- `}r+="</div>",t.innerHTML=r,t.querySelectorAll(".folder-cell").forEach(l=>{l.addEventListener("click",()=>{let c=l.dataset.path;c&&Va(c)})})}function Va(s){Ot=s,et=[],vt=0,Ws(),Ke("detail-disk-treemap"),Hs(s)}function Oa(){document.querySelectorAll(".folder-cell").forEach(t=>{let i=parseInt(t.dataset.index,10)===vt;t.classList.toggle("selected",i),t.style.outline=i?"3px solid #fff":"",t.style.outlineOffset=i?"-3px":"",t.style.zIndex=i?"10":""})}function Ws(){let s=document.getElementById("detail-disk-path");if(!s)return;let t=Ot.split("/").filter(n=>n),e='<span class="path-item" data-path="/">/</span> ',i="";for(let n of t)i+="/"+n,e+=`<span class="path-item" data-path="${i}">${n}/</span> `;s.innerHTML=e.trim(),s.querySelectorAll(".path-item").forEach(n=>{n.addEventListener("click",()=>{let o=n.dataset.path;o&&o!==Ot&&(Ot=o,et=[],Ws(),Ke("detail-disk-treemap"),Hs(o))})})}function Ad(){if(Ot==="/")return;let s=Ot.split("/").filter(t=>t);s.pop(),Ot=s.length===0?"/":"/"+s.join("/"),et=[],Ws(),Ke("detail-disk-treemap"),Hs(Ot)}function Ha(s,t){if(s==="cpu"&&t.cpu){let e=document.getElementById("detail-cpu-info"),i=document.getElementById("detail-cpu-cores");e&&(e.innerHTML=`
56
+ `}r+="</div>",t.innerHTML=r,t.querySelectorAll(".folder-cell").forEach(l=>{l.addEventListener("click",()=>{let c=l.dataset.path;c&&ja(c)})})}function ja(s){Tt=s,et=[],wt=0,Us(),Je("detail-disk-treemap"),Ys(s)}function Ea(){document.querySelectorAll(".folder-cell").forEach(t=>{let i=parseInt(t.dataset.index,10)===wt;t.classList.toggle("selected",i),t.style.outline=i?"3px solid #fff":"",t.style.outlineOffset=i?"-3px":"",t.style.zIndex=i?"10":""})}function Us(){let s=document.getElementById("detail-disk-path");if(!s)return;let t=Tt.split("/").filter(n=>n),e='<span class="path-item" data-path="/">/</span> ',i="";for(let n of t)i+="/"+n,e+=`<span class="path-item" data-path="${i}">${n}/</span> `;s.innerHTML=e.trim(),s.querySelectorAll(".path-item").forEach(n=>{n.addEventListener("click",()=>{let o=n.dataset.path;o&&o!==Tt&&(Tt=o,et=[],Us(),Je("detail-disk-treemap"),Ys(o))})})}function Ld(){if(Tt==="/")return;let s=Tt.split("/").filter(t=>t);s.pop(),Tt=s.length===0?"/":"/"+s.join("/"),et=[],Us(),Je("detail-disk-treemap"),Ys(Tt)}function Ya(s,t){if(s==="cpu"&&t.cpu){let e=document.getElementById("detail-cpu-info"),i=document.getElementById("detail-cpu-cores");e&&(e.innerHTML=`
57
57
  <div class="stat-row">
58
58
  <span class="stat-label">Model</span>
59
59
  <span class="stat-value">${t.cpu.brand||"Unknown"}</span>
@@ -68,7 +68,7 @@
68
68
  </div>
69
69
  <div class="stat-row">
70
70
  <span class="stat-label">Load</span>
71
- <span class="stat-value ${jt(t.cpu.load)}">${t.cpu.load.toFixed(1)}%</span>
71
+ <span class="stat-value ${Yt(t.cpu.load)}">${t.cpu.load.toFixed(1)}%</span>
72
72
  </div>
73
73
  <div class="progress-bar" style="margin-top: 8px;">
74
74
  <div class="progress-fill cpu" style="width: ${t.cpu.load.toFixed(1)}%"></div>
@@ -76,9 +76,9 @@
76
76
  `),i&&t.cpu.loadPerCore&&(i.innerHTML=t.cpu.loadPerCore.map((n,o)=>`
77
77
  <div class="core-item">
78
78
  <div class="label">${o+1}</div>
79
- <div class="value ${jt(n)}">${n.toFixed(0)}%</div>
79
+ <div class="value ${Yt(n)}">${n.toFixed(0)}%</div>
80
80
  </div>
81
- `).join("")),t.processes?.list&&Aa("detail-cpu-dist",t.processes.list,"cpu","CPU")}else if(s==="memory"&&t.memory){let e=t.memory,i=e.used/e.total*100,n=document.getElementById("detail-mem-info");n&&(n.innerHTML=`
81
+ `).join("")),t.processes?.list&&La("detail-cpu-dist",t.processes.list,"cpu","CPU")}else if(s==="memory"&&t.memory){let e=t.memory,i=e.used/e.total*100,n=document.getElementById("detail-mem-info");n&&(n.innerHTML=`
82
82
  <div class="stat-row">
83
83
  <span class="stat-label">Total</span>
84
84
  <span class="stat-value">${N(e.total)}</span>
@@ -118,22 +118,22 @@
118
118
  <span class="stat-label">Swap Free</span>
119
119
  <span class="stat-value">${N(e.swapFree||e.swapTotal-e.swapUsed)}</span>
120
120
  </div>
121
- `),t.processes?.list&&Aa("detail-mem-dist",t.processes.list,"mem","Memory")}else if(s==="network"&&t.network){let e=t.network.reduce((o,a)=>o+(a.rx_sec||0),0),i=t.network.reduce((o,a)=>o+(a.tx_sec||0),0);rt&&(rt.data.datasets[0].data.push(e),rt.data.datasets[0].data.shift(),rt.data.datasets[1].data.push(i),rt.data.datasets[1].data.shift(),rt.update("none"));let n=document.getElementById("detail-net-info");n&&(n.innerHTML=`
121
+ `),t.processes?.list&&La("detail-mem-dist",t.processes.list,"mem","Memory")}else if(s==="network"&&t.network){let e=t.network.reduce((o,a)=>o+(a.rx_sec||0),0),i=t.network.reduce((o,a)=>o+(a.tx_sec||0),0);rt&&(rt.data.datasets[0].data.push(e),rt.data.datasets[0].data.shift(),rt.data.datasets[1].data.push(i),rt.data.datasets[1].data.shift(),rt.update("none"));let n=document.getElementById("detail-net-info");n&&(n.innerHTML=`
122
122
  <div class="stat-row" style="margin-bottom: 8px;">
123
123
  <span class="stat-label">Total</span>
124
- <span class="stat-value">\u2193 ${ye(e)} / \u2191 ${ye(i)}</span>
124
+ <span class="stat-value">\u2193 ${we(e)} / \u2191 ${we(i)}</span>
125
125
  </div>
126
126
  `+t.network.map(o=>`
127
127
  <div class="stat-row">
128
128
  <span class="stat-label">${o.iface}</span>
129
- <span class="stat-value">\u2193 ${ye(o.rx_sec||0)} / \u2191 ${ye(o.tx_sec||0)}</span>
129
+ <span class="stat-value">\u2193 ${we(o.rx_sec||0)} / \u2191 ${we(o.tx_sec||0)}</span>
130
130
  </div>
131
- `).join("")||'<div class="stat-row"><span class="stat-label">No active interfaces</span></div>'),Na("detail-net-connections")}else s==="disk"&&(Ws(),Ke("detail-disk-treemap"))}function Ta(){rt&&(rt.destroy(),rt=null),document.getElementById("process-fullscreen").style.display="none",document.getElementById("detail-fullscreen").style.display="none",document.getElementById("main-dashboard").style.display="block",$="main",Fa("main"),Ra=!1,st=null,Lt()}function Lt(){let s=document.getElementById("hints");if($==="main")s.innerHTML="<span>c: CPU</span><span>m: Memory</span><span>n: Network</span><span>d: Disk</span><span>p: Processes</span><span>Ctrl+Q: Quit</span>";else if($==="processes")if(st){let t=st.ports?.join(",")||"-";s.innerHTML=`<span style="color: #f14c4c;">Kill "${st.name}" PID:${st.pid} CPU:${st.cpu.toFixed(1)}% MEM:${st.mem.toFixed(1)}% PORT:${t} ? Y: Confirm, N: Cancel</span>`}else s.innerHTML=`
132
- <span>Tab/Shift+Tab: Sort (${Tt})</span>
131
+ `).join("")||'<div class="stat-row"><span class="stat-label">No active interfaces</span></div>'),Wa("detail-net-connections")}else s==="disk"&&(Us(),Je("detail-disk-treemap"))}function Ra(){rt&&(rt.destroy(),rt=null),document.getElementById("process-fullscreen").style.display="none",document.getElementById("detail-fullscreen").style.display="none",document.getElementById("main-dashboard").style.display="block",$="main",$a("main"),za=!1,st=null,Et()}function Et(){let s=document.getElementById("hints");if($==="main")s.innerHTML="<span>c: CPU</span><span>m: Memory</span><span>n: Network</span><span>d: Disk</span><span>p: Processes</span><span>Ctrl+Q: Quit</span>";else if($==="processes")if(st){let t=st.ports?.join(",")||"-";s.innerHTML=`<span style="color: #f14c4c;">Kill "${st.name}" PID:${st.pid} CPU:${st.cpu.toFixed(1)}% MEM:${st.mem.toFixed(1)}% PORT:${t} ? Y: Confirm, N: Cancel</span>`}else s.innerHTML=`
132
+ <span>Tab/Shift+Tab: Sort (${Lt})</span>
133
133
  <span>\u2191\u2193: Select</span>
134
134
  <span>Ctrl+K: Kill</span>
135
135
  <span>Esc: Back</span>
136
- `;else $==="disk"?s.innerHTML="<span>\u2190\u2192\u2191\u2193: Select</span><span>Enter: Drill in</span><span>Backspace: Up</span><span>Esc: Back</span>":s.innerHTML="<span>Esc: Back</span>"}function Ns(s,t){if($==="main"){Ca(La,s.cpu.load),document.getElementById("cpu-bar").style.width=s.cpu.load.toFixed(1)+"%",t&&s.cpu.brand&&(document.getElementById("cpu-info").innerHTML=`
136
+ `;else $==="disk"?s.innerHTML="<span>\u2190\u2192\u2191\u2193: Select</span><span>Enter: Drill in</span><span>Backspace: Up</span><span>Esc: Back</span>":s.innerHTML="<span>Esc: Back</span>"}function Ws(s,t){if(s.cpu&&(ye(vt.cpu.load,s.cpu.load),s.cpu.loadPerCore&&ye(vt.cpu.perCore,[...s.cpu.loadPerCore])),s.memory){let e=t?s.memory.total:s.memory.used+s.memory.free,i=s.memory.used/e*100;ye(vt.memory.percent,i),ye(vt.memory.used,s.memory.used)}if(s.network){let e=s.network.reduce((n,o)=>n+(o.rx_sec||0),0),i=s.network.reduce((n,o)=>n+(o.tx_sec||0),0);ye(vt.network.rx,e),ye(vt.network.tx,i)}if(t&&s.disk&&(vt.disk=s.disk),t&&s.processes&&(vt.processes=s.processes),$==="main"){Oa(Ia,s.cpu.load),document.getElementById("cpu-bar").style.width=s.cpu.load.toFixed(1)+"%",t&&s.cpu.brand&&(document.getElementById("cpu-info").innerHTML=`
137
137
  <div class="stat-row">
138
138
  <span class="stat-label">Model</span>
139
139
  <span class="stat-value">${s.cpu.brand}</span>
@@ -144,14 +144,14 @@
144
144
  </div>
145
145
  <div class="stat-row">
146
146
  <span class="stat-label">Load</span>
147
- <span class="stat-value ${jt(s.cpu.load)}">${s.cpu.load.toFixed(1)}%</span>
147
+ <span class="stat-value ${Yt(s.cpu.load)}">${s.cpu.load.toFixed(1)}%</span>
148
148
  </div>
149
149
  `),s.cpu.loadPerCore&&(document.getElementById("cpu-cores").innerHTML=s.cpu.loadPerCore.map((o,a)=>`
150
150
  <div class="core-item">
151
151
  <div class="label">${a+1}</div>
152
- <div class="value ${jt(o)}">${o.toFixed(0)}%</div>
152
+ <div class="value ${Yt(o)}">${o.toFixed(0)}%</div>
153
153
  </div>
154
- `).join(""));let e=s.memory.used/(t?s.memory.total:s.memory.used+s.memory.free)*100;Ca(Ea,e),document.getElementById("mem-bar").style.width=e.toFixed(1)+"%",t&&(document.getElementById("mem-info").innerHTML=`
154
+ `).join(""));let e=s.memory.used/(t?s.memory.total:s.memory.used+s.memory.free)*100;Oa(Fa,e),document.getElementById("mem-bar").style.width=e.toFixed(1)+"%",t&&(document.getElementById("mem-info").innerHTML=`
155
155
  <div class="stat-row">
156
156
  <span class="stat-label">Used</span>
157
157
  <span class="stat-value">${N(s.memory.used)} / ${N(s.memory.total)}</span>
@@ -164,19 +164,19 @@
164
164
  <span class="stat-label">Swap</span>
165
165
  <span class="stat-value">${N(s.memory.swapUsed)} / ${N(s.memory.swapTotal)}</span>
166
166
  </div>
167
- `);let i=s.network.reduce((o,a)=>o+(a.rx_sec||0),0),n=s.network.reduce((o,a)=>o+(a.tx_sec||0),0);if(_e.data.datasets[0].data.push(i),_e.data.datasets[0].data.shift(),_e.data.datasets[1].data.push(n),_e.data.datasets[1].data.shift(),_e.update("none"),document.getElementById("net-info").innerHTML=`
167
+ `);let i=s.network.reduce((o,a)=>o+(a.rx_sec||0),0),n=s.network.reduce((o,a)=>o+(a.tx_sec||0),0);if(ve.data.datasets[0].data.push(i),ve.data.datasets[0].data.shift(),ve.data.datasets[1].data.push(n),ve.data.datasets[1].data.shift(),ve.update("none"),document.getElementById("net-info").innerHTML=`
168
168
  <div class="stat-row">
169
169
  <span class="stat-label">Download</span>
170
- <span class="stat-value">${ye(i)}</span>
170
+ <span class="stat-value">${we(i)}</span>
171
171
  </div>
172
172
  <div class="stat-row">
173
173
  <span class="stat-label">Upload</span>
174
- <span class="stat-value">${ye(n)}</span>
174
+ <span class="stat-value">${we(n)}</span>
175
175
  </div>
176
176
  `,t&&s.disk&&(document.getElementById("disk-info").innerHTML=s.disk.map(o=>`
177
177
  <div class="stat-row">
178
178
  <span class="stat-label">${o.mount}</span>
179
- <span class="stat-value ${jt(o.usePercent)}">${o.usePercent.toFixed(0)}% used</span>
179
+ <span class="stat-value ${Yt(o.usePercent)}">${o.usePercent.toFixed(0)}% used</span>
180
180
  </div>
181
181
  <div class="progress-bar">
182
182
  <div class="progress-fill disk" style="width: ${o.usePercent}%"></div>
@@ -184,7 +184,7 @@
184
184
  <div style="font-size: 11px; color: #888; margin-top: 4px; margin-bottom: 8px;">
185
185
  ${N(o.used)} used of ${N(o.size)} (${N(o.available)} free)
186
186
  </div>
187
- `).join("")),t&&s.processes){let o=document.getElementById("process-tbody"),a=document.querySelector("#process-table thead tr");if(a){let u=["pid","name","cpu","mem","port"],f=["PID","Name","CPU %","MEM %","PORT"];a.innerHTML=u.map((p,g)=>{let m=Tt===p?Bs?"\u25B2":"\u25BC":"";return`<th class="${Tt===p?"sorted":""}">${f[g]} ${m}</th>`}).join("")}let l=[...s.processes.list].sort((u,f)=>{let p=0;switch(Tt){case"pid":p=u.pid-f.pid;break;case"name":p=u.name.localeCompare(f.name);break;case"cpu":p=u.cpu-f.cpu;break;case"mem":p=u.mem-f.mem;break;case"port":let g=parseInt(u.ports?.[0],10)||0,m=parseInt(f.ports?.[0],10)||0;p=g-m;break}return Bs?p:-p}).slice(0,10),c=24,h=new Map;o.querySelectorAll("tr").forEach(u=>{u.dataset.pid&&h.set(parseInt(u.dataset.pid,10),u)});let d=new Set(l.map(u=>u.pid));l.forEach((u,f)=>{let p=h.get(u.pid);if(!p){p=document.createElement("tr"),p.dataset.pid=u.pid,p.classList.add("row-new");for(let m=0;m<5;m++)p.appendChild(document.createElement("td"));o.appendChild(p),setTimeout(()=>p.classList.remove("row-new"),600)}let g=p.querySelectorAll("td");g[0].textContent=u.pid,g[1].textContent=u.name,g[2].textContent=u.cpu.toFixed(1)+"%",g[2].className=jt(u.cpu),g[3].textContent=u.mem.toFixed(1)+"%",g[4].textContent=u.ports?.join(", ")||"-",p.style.transform=`translateY(${f*c}px)`}),h.forEach((u,f)=>{d.has(f)||u.remove()}),o.style.height=`${l.length*c}px`}t&&s.system&&s.os&&(document.getElementById("system-info").textContent=`${s.os.hostname} | ${s.os.distro} ${s.os.release} | Up: ${Math.floor(s.os.uptime/3600)}h`)}t&&s.processes&&(Vs=s.processes.list,$==="processes"&&(Cd()||Ba()))}var j=null,Et=!1;function Wa(){let s=location.protocol==="https:"?"wss:":"ws:";j=new WebSocket(`${s}//${location.host}`),j.onopen=()=>{Et=!0},j.onmessage=t=>{try{let e=JSON.parse(t.data);e.type==="full"?(Fs=e.data,Ns(e.data,!0),["cpu","memory","network"].includes($)&&Ha($,e.data),$==="network"&&$a()):e.type==="update"?Ns(e.data,!1):e.type==="kill"?j.send(JSON.stringify({type:"refresh"})):e.type==="connections"?(zs=e.data||[],$==="network"&&Na("detail-net-connections")):e.type==="folderSizes"&&(et=e.data||[],$==="disk"&&Ke("detail-disk-treemap"))}catch{}},j.onclose=()=>{Et=!1,setTimeout(Wa,1e3)}}function Od(s){j&&Et&&j.send(JSON.stringify({type:"kill",pid:s}))}function ja(s="full"){return new Promise(t=>{if(!j||!Et){t(null);return}let e=i=>{try{let n=JSON.parse(i.data);n.type==="full"&&(j.removeEventListener("message",e),t(n.data))}catch{}};j.addEventListener("message",e),j.send(JSON.stringify({type:"refresh"})),setTimeout(()=>{j.removeEventListener("message",e),t(null)},2e3)})}window.addEventListener("keydown",s=>{let t=s.key;if(st){t==="Escape"?(s.preventDefault(),s.stopPropagation(),st=null,un(),Lt()):(s.preventDefault(),s.stopPropagation());return}if($==="processes"){if(t==="Tab"){s.preventDefault(),s.stopPropagation();let e=ee.indexOf(Tt);Tt=s.shiftKey?ee[(e-1+ee.length)%ee.length]:ee[(e+1)%ee.length],q=0;let i=document.querySelector(".process-table thead tr");i&&(i.innerHTML=fn()),za(),Lt(),ja("full").then(n=>{n&&Ns(n,!0)});return}if(t==="k"&&s.ctrlKey){let e=qe()[q];if(!e)return;s.preventDefault(),s.stopPropagation(),st={pid:e.pid,name:e.name,cpu:e.cpu,mem:e.mem,ports:e.ports},kd(),Lt();return}if(t==="ArrowUp"){s.preventDefault(),s.stopPropagation();let e=q;q=Math.max(0,q-1),Da(e,q);return}if(t==="ArrowDown"){s.preventDefault(),s.stopPropagation();let e=q;q=Math.min(Vs.length-1,q+1),Da(e,q);return}if(t==="Escape"){s.preventDefault(),s.stopPropagation(),Ta();return}return}if(["cpu","memory","network","disk"].includes($)){if(t==="Escape"){Ta();return}if($==="disk"&&et.length>0){if(t==="Backspace"){s.preventDefault(),Ad();return}if(t==="ArrowUp"||t==="ArrowLeft"){s.preventDefault(),vt=Math.max(0,vt-1),Oa();return}if(t==="ArrowDown"||t==="ArrowRight"){s.preventDefault(),vt=Math.min(et.length-1,vt+1),Oa();return}if(t==="Enter"){s.preventDefault();let e=et[vt];e&&Va(e.path);return}}}},!0);function Td(){let s=document.getElementById("tooltip");document.addEventListener("mouseover",t=>{let e=t.target.closest("[data-tip]");e&&(s.textContent=e.dataset.tip,s.style.display="block")}),document.addEventListener("mouseout",t=>{t.target.closest("[data-tip]")&&(s.style.display="none")}),document.addEventListener("mousemove",t=>{if(s.style.display==="block"){let e=s.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,o=t.clientX+10,a=t.clientY+10;o+e.width>i&&(o=t.clientX-e.width-10),a+e.height>n&&(a=t.clientY-e.height-10),s.style.left=o+"px",s.style.top=a+"px"}})}document.addEventListener("DOMContentLoaded",()=>{document.body.tabIndex=-1,document.body.focus(),window.focus(),Td(),Sd(),document.getElementById("cpu-card").addEventListener("click",()=>yt("cpu")),document.getElementById("memory-card").addEventListener("click",()=>yt("memory")),document.getElementById("network-card").addEventListener("click",()=>yt("network")),document.getElementById("disk-card").addEventListener("click",()=>yt("disk")),document.getElementById("processes").addEventListener("click",()=>yt("processes")),Lt(),window.__termweb.onMessage(s=>{if(s.type==="action"){let t=s.action;if(t==="view:processes")yt("processes");else if(t==="view:cpu")yt("cpu");else if(t==="view:memory")yt("memory");else if(t==="view:network")yt("network");else if(t==="view:disk")yt("disk");else if(t==="kill:confirm"&&st){let e=st.pid;st=null,un(),Lt(),Od(e),ja("full").then(i=>{i&&Ns(i,!0)})}else t==="kill:cancel"&&st&&(st=null,un(),Lt())}}),Wa()});})();
187
+ `).join("")),t&&s.processes){let o=document.getElementById("process-tbody"),a=document.querySelector("#process-table thead tr");if(a){let u=["pid","name","cpu","mem","port"],f=["PID","Name","CPU %","MEM %","PORT"];a.innerHTML=u.map((p,g)=>{let m=Lt===p?Hs?"\u25B2":"\u25BC":"";return`<th class="${Lt===p?"sorted":""}">${f[g]} ${m}</th>`}).join("")}let l=[...s.processes.list].sort((u,f)=>{let p=0;switch(Lt){case"pid":p=u.pid-f.pid;break;case"name":p=u.name.localeCompare(f.name);break;case"cpu":p=u.cpu-f.cpu;break;case"mem":p=u.mem-f.mem;break;case"port":let g=parseInt(u.ports?.[0],10)||0,m=parseInt(f.ports?.[0],10)||0;p=g-m;break}return Hs?p:-p}).slice(0,10),c=24,h=new Map;o.querySelectorAll("tr").forEach(u=>{u.dataset.pid&&h.set(parseInt(u.dataset.pid,10),u)});let d=new Set(l.map(u=>u.pid));l.forEach((u,f)=>{let p=h.get(u.pid);if(!p){p=document.createElement("tr"),p.dataset.pid=u.pid,p.classList.add("row-new");for(let m=0;m<5;m++)p.appendChild(document.createElement("td"));o.appendChild(p),setTimeout(()=>p.classList.remove("row-new"),600)}let g=p.querySelectorAll("td");g[0].textContent=u.pid,g[1].textContent=u.name,g[2].textContent=u.cpu.toFixed(1)+"%",g[2].className=Yt(u.cpu),g[3].textContent=u.mem.toFixed(1)+"%",g[4].textContent=u.ports?.join(", ")||"-",p.style.transform=`translateY(${f*c}px)`}),h.forEach((u,f)=>{d.has(f)||u.remove()}),o.style.height=`${l.length*c}px`}t&&s.system&&s.os&&(document.getElementById("system-info").textContent=`${s.os.hostname} | ${s.os.distro} ${s.os.release} | Up: ${Math.floor(s.os.uptime/3600)}h`)}t&&s.processes&&(js=s.processes.list,$==="processes"&&(Od()||Ha()))}var j=null,Rt=!1;function Ua(){let s=location.protocol==="https:"?"wss:":"ws:";j=new WebSocket(`${s}//${location.host}`),j.onopen=()=>{Rt=!0},j.onmessage=t=>{try{let e=JSON.parse(t.data);e.type==="full"?(Bs=e.data,Ws(e.data,!0),["cpu","memory","network"].includes($)&&Ya($,e.data),$==="network"&&Va()):e.type==="update"?Ws(e.data,!1):e.type==="kill"?j.send(JSON.stringify({type:"refresh"})):e.type==="connections"?($s=e.data||[],$==="network"&&Wa("detail-net-connections")):e.type==="folderSizes"&&(et=e.data||[],$==="disk"&&Je("detail-disk-treemap"))}catch{}},j.onclose=()=>{Rt=!1,setTimeout(Ua,1e3)}}function Ed(s){j&&Rt&&j.send(JSON.stringify({type:"kill",pid:s}))}function Xa(s="full"){return new Promise(t=>{if(!j||!Rt){t(null);return}let e=i=>{try{let n=JSON.parse(i.data);n.type==="full"&&(j.removeEventListener("message",e),t(n.data))}catch{}};j.addEventListener("message",e),j.send(JSON.stringify({type:"refresh"})),setTimeout(()=>{j.removeEventListener("message",e),t(null)},2e3)})}window.addEventListener("keydown",s=>{let t=s.key;if(st){t==="Escape"?(s.preventDefault(),s.stopPropagation(),st=null,gn(),Et()):(s.preventDefault(),s.stopPropagation());return}if($==="processes"){if(t==="Tab"){s.preventDefault(),s.stopPropagation();let e=se.indexOf(Lt);Lt=s.shiftKey?se[(e-1+se.length)%se.length]:se[(e+1)%se.length],q=0;let i=document.querySelector(".process-table thead tr");i&&(i.innerHTML=mn()),Na(),Et(),Xa("full").then(n=>{n&&Ws(n,!0)});return}if(t==="k"&&s.ctrlKey){let e=Ge()[q];if(!e)return;s.preventDefault(),s.stopPropagation(),st={pid:e.pid,name:e.name,cpu:e.cpu,mem:e.mem,ports:e.ports},Pd(),Et();return}if(t==="ArrowUp"){s.preventDefault(),s.stopPropagation();let e=q;q=Math.max(0,q-1),Ta(e,q);return}if(t==="ArrowDown"){s.preventDefault(),s.stopPropagation();let e=q;q=Math.min(js.length-1,q+1),Ta(e,q);return}if(t==="Escape"){s.preventDefault(),s.stopPropagation(),Ra();return}return}if(["cpu","memory","network","disk"].includes($)){if(t==="Escape"){Ra();return}if($==="disk"&&et.length>0){if(t==="Backspace"){s.preventDefault(),Ld();return}if(t==="ArrowUp"||t==="ArrowLeft"){s.preventDefault(),wt=Math.max(0,wt-1),Ea();return}if(t==="ArrowDown"||t==="ArrowRight"){s.preventDefault(),wt=Math.min(et.length-1,wt+1),Ea();return}if(t==="Enter"){s.preventDefault();let e=et[wt];e&&ja(e.path);return}}}},!0);function Rd(){let s=document.getElementById("tooltip");document.addEventListener("mouseover",t=>{let e=t.target.closest("[data-tip]");e&&(s.textContent=e.dataset.tip,s.style.display="block")}),document.addEventListener("mouseout",t=>{t.target.closest("[data-tip]")&&(s.style.display="none")}),document.addEventListener("mousemove",t=>{if(s.style.display==="block"){let e=s.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,o=t.clientX+10,a=t.clientY+10;o+e.width>i&&(o=t.clientX-e.width-10),a+e.height>n&&(a=t.clientY-e.height-10),s.style.left=o+"px",s.style.top=a+"px"}})}document.addEventListener("DOMContentLoaded",()=>{document.body.tabIndex=-1,document.body.focus(),window.focus(),Rd(),Dd(),document.getElementById("cpu-card").addEventListener("click",()=>yt("cpu")),document.getElementById("memory-card").addEventListener("click",()=>yt("memory")),document.getElementById("network-card").addEventListener("click",()=>yt("network")),document.getElementById("disk-card").addEventListener("click",()=>yt("disk")),document.getElementById("processes").addEventListener("click",()=>yt("processes")),Et(),window.__termweb.onMessage(s=>{if(s.type==="action"){let t=s.action;if(t==="view:processes")yt("processes");else if(t==="view:cpu")yt("cpu");else if(t==="view:memory")yt("memory");else if(t==="view:network")yt("network");else if(t==="view:disk")yt("disk");else if(t==="kill:confirm"&&st){let e=st.pid;st=null,gn(),Et(),Ed(e),Xa("full").then(i=>{i&&Ws(i,!0)})}else t==="kill:cancel"&&st&&(st=null,gn(),Et())}}),Ua()});})();
188
188
  /*! Bundled license information:
189
189
 
190
190
  @kurkle/color/dist/color.esm.js: