(()=>{function Pe(n){return n+.5|0}var Ot=(n,t,e)=>Math.max(Math.min(n,e),t);function De(n){return Ot(Pe(n*2.55),0,255)}function St(n){return Ot(Pe(n*255),0,255)}function bt(n){return Ot(Pe(n/2.55)/100,0,1)}function Ls(n){return Ot(Pe(n*100),0,100)}var st={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},Ni=[..."0123456789ABCDEF"],Ua=n=>Ni[n&15],Qa=n=>Ni[(n&240)>>4]+Ni[n&15],Ze=n=>(n&240)>>4===(n&15),Ga=n=>Ze(n.r)&&Ze(n.g)&&Ze(n.b)&&Ze(n.a);function Ka(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&st[n[1]]*17,g:255&st[n[2]]*17,b:255&st[n[3]]*17,a:t===5?st[n[4]]*17:255}:(t===7||t===9)&&(e={r:st[n[1]]<<4|st[n[2]],g:st[n[3]]<<4|st[n[4]],b:st[n[5]]<<4|st[n[6]],a:t===9?st[n[7]]<<4|st[n[8]]:255})),e}var Za=(n,t)=>n<255?t(n):"";function Ja(n){var t=Ga(n)?Ua:Qa;return n?"#"+t(n.r)+t(n.g)+t(n.b)+Za(n.a,t):void 0}var tc=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Fs(n,t,e){let i=t*Math.min(e,1-e),s=(o,r=(o+n/30)%12)=>e-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function ec(n,t,e){let i=(s,o=(s+n/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function nc(n,t,e){let i=Fs(n,1,.5),s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function ic(n,t,e,i,s){return n===s?(t-e)/i+(t.5?h/(2-o-r):h/(o+r),c=ic(e,i,s,h,o),c=c*60+.5),[c|0,l||0,a]}function zi(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(St)}function Bi(n,t,e){return zi(Fs,n,t,e)}function sc(n,t,e){return zi(nc,n,t,e)}function oc(n,t,e){return zi(ec,n,t,e)}function Ns(n){return(n%360+360)%360}function rc(n){let t=tc.exec(n),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?De(+t[5]):St(+t[5]));let s=Ns(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=sc(s,o,r):t[1]==="hsv"?i=oc(s,o,r):i=Bi(s,o,r),{r:i[0],g:i[1],b:i[2],a:e}}function ac(n,t){var e=Wi(n);e[0]=Ns(e[0]+t),e=Bi(e),n.r=e[0],n.g=e[1],n.b=e[2]}function cc(n){if(!n)return;let t=Wi(n),e=t[0],i=Ls(t[1]),s=Ls(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${bt(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}var Is={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"},Es={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 lc(){let n={},t=Object.keys(Es),e=Object.keys(Is),i,s,o,r,a;for(i=0;i>16&255,o>>8&255,o&255]}return n}var Je;function hc(n){Je||(Je=lc(),Je.transparent=[0,0,0,0]);let t=Je[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var uc=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function dc(n){let t=uc.exec(n),e=255,i,s,o;if(t){if(t[7]!==i){let r=+t[7];e=t[8]?De(r):Ot(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?De(i):Ot(i,0,255)),s=255&(t[4]?De(s):Ot(s,0,255)),o=255&(t[6]?De(o):Ot(o,0,255)),{r:i,g:s,b:o,a:e}}}function fc(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${bt(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}var Fi=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Zt=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function pc(n,t,e){let i=Zt(bt(n.r)),s=Zt(bt(n.g)),o=Zt(bt(n.b));return{r:St(Fi(i+e*(Zt(bt(t.r))-i))),g:St(Fi(s+e*(Zt(bt(t.g))-s))),b:St(Fi(o+e*(Zt(bt(t.b))-o))),a:n.a+e*(t.a-n.a)}}function tn(n,t,e){if(n){let i=Wi(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=Bi(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Ws(n,t){return n&&Object.assign(t||{},n)}function Rs(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=St(n[3]))):(t=Ws(n,{r:0,g:0,b:0,a:1}),t.a=St(t.a)),t}function gc(n){return n.charAt(0)==="r"?dc(n):rc(n)}var ve=class n{constructor(t){if(t instanceof n)return t;let e=typeof t,i;e==="object"?i=Rs(t):e==="string"&&(i=Ka(t)||hc(t)||gc(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Ws(this._rgb);return t&&(t.a=bt(t.a)),t}set rgb(t){this._rgb=Rs(t)}rgbString(){return this._valid?fc(this._rgb):void 0}hexString(){return this._valid?Ja(this._rgb):void 0}hslString(){return this._valid?cc(this._rgb):void 0}mix(t,e){if(t){let i=this.rgb,s=t.rgb,o,r=e===o?.5:e,a=2*r-1,c=i.a-s.a,l=((a*c===-1?a:(a+c)/(1+a*c))+1)/2;o=1-l,i.r=255&l*i.r+o*s.r+.5,i.g=255&l*i.g+o*s.g+.5,i.b=255&l*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=pc(this._rgb,t._rgb,e)),this}clone(){return new n(this.rgb)}alpha(t){return this._rgb.a=St(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=Pe(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 tn(this._rgb,2,t),this}darken(t){return tn(this._rgb,2,-t),this}saturate(t){return tn(this._rgb,1,t),this}desaturate(t){return tn(this._rgb,1,-t),this}rotate(t){return ac(this._rgb,t),this}};function ft(){}var Qs=(()=>{let n=0;return()=>n++})();function N(n){return n===null||typeof n>"u"}function W(n){if(Array.isArray&&Array.isArray(n))return!0;let t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function L(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function $(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function K(n,t){return $(n)?n:t}function R(n,t){return typeof n>"u"?t:n}var Gs=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,ji=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function z(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function E(n,t,e,i){let s,o,r;if(W(n))if(o=n.length,i)for(s=o-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function xc(n){let t=n.split("."),e=[],i="";for(let s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function yc(n){let t=xc(n);return e=>{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function Vt(n,t){return(zs[t]||(zs[t]=yc(t)))(n)}function ln(n){return n.charAt(0).toUpperCase()+n.slice(1)}var Ce=n=>typeof n<"u",xt=n=>typeof n=="function",qi=(n,t)=>{if(n.size!==t.size)return!1;for(let e of n)if(!t.has(e))return!1;return!0};function Zs(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}var B=Math.PI,X=2*B,_c=X+B,rn=Number.POSITIVE_INFINITY,wc=B/180,G=B/2,zt=B/4,Bs=B*2/3,yt=Math.log10,Ht=Math.sign;function ie(n,t,e){return Math.abs(n-t)s-o).pop(),t}function se(n){return!isNaN(parseFloat(n))&&isFinite(n)}function to(n,t){let e=Math.round(n);return e-t<=n&&e+t>=n}function Xi(n,t,e){let i,s,o;for(i=0,s=n.length;ic&&l=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function un(n,t,e){e=e||(r=>n[r]1;)o=s+i>>1,e(o)?s=o:i=o;return{lo:s,hi:i}}var Ct=(n,t,e,i)=>un(n,e,i?s=>{let o=n[s][t];return on[s][t]un(n,e,i=>n[i][t]>=e);function oo(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{let i="_onData"+ln(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...o){let r=s.apply(this,o);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function Qi(n,t){let e=n._chartjs;if(!e)return;let i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(ro.forEach(o=>{delete n[o]}),delete n._chartjs)}function co(n){let t=new Set(n);return t.size===n.length?n:Array.from(t)}var Gi=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function Ki(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,Gi.call(window,()=>{i=!1,n.apply(t,e)}))}}function lo(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}var ho=n=>n==="start"?"left":n==="end"?"right":"center",Zi=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2;function uo(n,t,e){let i=t.length,s=0,o=i;if(n._sorted){let{iScale:r,_parsed:a}=n,c=r.axis,{min:l,max:h,minDefined:u,maxDefined:d}=r.getUserBounds();u&&(s=rt(Math.min(Ct(a,c,l).lo,e?i:Ct(t,c,r.getPixelForValue(l)).lo),0,i-1)),d?o=rt(Math.max(Ct(a,r.axis,h,!0).hi+1,e?0:Ct(t,c,r.getPixelForValue(h),!0).hi+1),s,i)-s:o=i-s}return{start:s,count:o}}function fo(n){let{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;let o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),o}var en=n=>n===0||n===1,Hs=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*X/e)),Ys=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*X/e)+1,Jt={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*G)+1,easeOutSine:n=>Math.sin(n*G),easeInOutSine:n=>-.5*(Math.cos(B*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>en(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>en(n)?n:Hs(n,.075,.3),easeOutElastic:n=>en(n)?n:Ys(n,.075,.3),easeInOutElastic(n){return en(n)?n:n<.5?.5*Hs(n*2,.1125,.45):.5+.5*Ys(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-Jt.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?Jt.easeInBounce(n*2)*.5:Jt.easeOutBounce(n*2-1)*.5+.5};function Ji(n){if(n&&typeof n=="object"){let t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ts(n){return Ji(n)?n:new ve(n)}function Hi(n){return Ji(n)?n:new ve(n).saturate(.5).darken(.1).hexString()}var kc=["x","y","borderWidth","radius","tension"],Dc=["color","borderColor","backgroundColor"];function vc(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:Dc},numbers:{type:"number",properties:kc}}),n.describe("animations",{_fallback:"animation"}),n.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 Pc(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Vs=new Map;function Oc(n,t){t=t||{};let e=n+JSON.stringify(t),i=Vs.get(e);return i||(i=new Intl.NumberFormat(n,t),Vs.set(e,i)),i}function oe(n,t,e){return Oc(t,e).format(n)}var po={values(n){return W(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";let i=this.chart.options.locale,s,o=n;if(e.length>1){let l=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(l<1e-4||l>1e15)&&(s="scientific"),o=Sc(n,e)}let r=yt(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),c={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),oe(n,i,c)},logarithmic(n,t,e){if(n===0)return"0";let i=e[t].significand||n/Math.pow(10,Math.floor(yt(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?po.numeric.call(this,n,t,e):""}};function Sc(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var Le={formatters:po};function Tc(n){n.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:Le.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}var At=Object.create(null),dn=Object.create(null);function Oe(n,t){if(!t)return n;let e=t.split(".");for(let i=0,s=e.length;ii.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,s)=>Hi(s.backgroundColor),this.hoverBorderColor=(i,s)=>Hi(s.borderColor),this.hoverColor=(i,s)=>Hi(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Yi(this,t,e)}get(t){return Oe(this,t)}describe(t,e){return Yi(dn,t,e)}override(t,e){return Yi(At,t,e)}route(t,e,i,s){let o=Oe(this,t),r=Oe(this,i),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let c=this[a],l=r[s];return L(c)?Object.assign({},l,c):R(c,l)},set(c){this[a]=c}}})}apply(t){t.forEach(e=>e(this))}},H=new Vi({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[vc,Pc,Tc]);function Cc(n){return!n||N(n.size)||N(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function Se(n,t,e,i,s){let o=t[s];return o||(o=t[s]=n.measureText(s).width,e.push(s)),o>i&&(i=o),i}function go(n,t,e,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let r=0,a=e.length,c,l,h,u,d;for(c=0;ce.length){for(c=0;c0&&n.stroke()}}function dt(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&o.strokeColor!=="",c,l;for(n.save(),n.font=s.string,Ac(n,o),c=0;c+n||0;function ss(n,t){let e={},i=L(t),s=i?Object.keys(t):t,o=L(n)?i?r=>R(n[r],n[t[r]]):r=>n[r]:()=>n;for(let r of s)e[r]=Nc(o(r));return e}function yo(n){return ss(n,{top:"y",right:"x",bottom:"y",left:"x"})}function re(n){return ss(n,["topLeft","topRight","bottomLeft","bottomRight"])}function nt(n){let t=yo(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Z(n,t){n=n||{},t=t||H.font;let e=R(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=R(n.style,t.style);i&&!(""+i).match(Rc)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);let s={family:R(n.family,t.family),lineHeight:Fc(R(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:R(n.weight,t.weight),string:""};return s.string=Cc(s),s}function Ee(n,t,e,i){let s=!0,o,r,a;for(o=0,r=n.length;oe&&a===0?0:a+c;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function _t(n,t){return Object.assign(Object.create(n),t)}function gn(n,t=[""],e,i,s=()=>n[0]){let o=e||n;typeof i>"u"&&(i=ko("_fallback",n));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>gn([a,...n],t,o,i)};return new Proxy(r,{deleteProperty(a,c){return delete a[c],delete a._keys,delete n[0][c],!0},get(a,c){return wo(a,c,()=>qc(c,t,n,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,c){return qs(a).includes(c)},ownKeys(a){return qs(a)},set(a,c,l){let h=a._storage||(a._storage=s());return a[c]=h[c]=l,delete a._keys,!0}})}function Yt(n,t,e,i){let s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:os(n,i),setContext:o=>Yt(n,o,e,i),override:o=>Yt(n.override(o),t,e,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete n[r],!0},get(o,r,a){return wo(o,r,()=>zc(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(n,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,r)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(o,r){return Reflect.has(n,r)},ownKeys(){return Reflect.ownKeys(n)},set(o,r,a){return n[r]=a,delete o[r],!0}})}function os(n,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:xt(e)?e:()=>e,isIndexable:xt(i)?i:()=>i}}var Wc=(n,t)=>n?n+ln(t):t,rs=(n,t)=>L(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function wo(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let i=e();return n[t]=i,i}function zc(n,t,e){let{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=n,a=i[t];return xt(a)&&r.isScriptable(t)&&(a=Bc(t,a,n,e)),W(a)&&a.length&&(a=Hc(t,a,n,r.isIndexable)),rs(t,a)&&(a=Yt(a,s,o&&o[t],r)),a}function Bc(n,t,e,i){let{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let c=t(o,r||i);return a.delete(n),rs(n,c)&&(c=as(s._scopes,s,n,c)),c}function Hc(n,t,e,i){let{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&i(n))return t[o.index%t.length];if(L(t[0])){let c=t,l=s._scopes.filter(h=>h!==c);t=[];for(let h of c){let u=as(l,s,n,h);t.push(Yt(u,o,r&&r[n],a))}}return t}function Mo(n,t,e){return xt(n)?n(t,e):n}var Yc=(n,t)=>n===!0?t:typeof n=="string"?Vt(t,n):void 0;function Vc(n,t,e,i,s){for(let o of t){let r=Yc(e,o);if(r){n.add(r);let a=Mo(r._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==i)return a}else if(r===!1&&typeof i<"u"&&e!==i)return null}return!1}function as(n,t,e,i){let s=t._rootScopes,o=Mo(t._fallback,e,i),r=[...n,...s],a=new Set;a.add(i);let c=js(a,r,e,o||e,i);return c===null||typeof o<"u"&&o!==e&&(c=js(a,r,o,c,i),c===null)?!1:gn(Array.from(a),[""],s,o,()=>jc(t,e,i))}function js(n,t,e,i,s){for(;e;)e=Vc(n,t,e,i,s);return e}function jc(n,t,e){let i=n._getTarget();t in i||(i[t]={});let s=i[t];return W(s)&&L(e)?e:s||{}}function qc(n,t,e,i){let s;for(let o of t)if(s=ko(Wc(o,n),e),typeof s<"u")return rs(n,s)?as(e,i,n,s):s}function ko(n,t){for(let e of t){if(!e)continue;let i=e[n];if(typeof i<"u")return i}}function qs(n){let t=n._keys;return t||(t=n._keys=$c(n._scopes)),t}function $c(n){let t=new Set;for(let e of n)for(let i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function Do(n,t,e,i){let{iScale:s}=n,{key:o="r"}=this._parsing,r=new Array(i),a,c,l,h;for(a=0,c=i;atn==="x"?"y":"x";function Uc(n,t,e,i){let s=n.skip?t:n,o=t,r=e.skip?t:e,a=an(o,s),c=an(r,o),l=a/(a+c),h=c/(a+c);l=isNaN(l)?0:l,h=isNaN(h)?0:h;let u=i*l,d=i*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function Qc(n,t,e){let i=n.length,s,o,r,a,c,l=ee(n,0);for(let h=0;h!l.skip)),t.cubicInterpolationMode==="monotone")Kc(n,s);else{let l=i?n[n.length-1]:n[0];for(o=0,r=n.length;on.ownerDocument.defaultView.getComputedStyle(n,null);function Jc(n,t){return xn(n).getPropertyValue(t)}var tl=["top","right","bottom","left"];function Bt(n,t,e){let i={};e=e?"-"+e:"";for(let s=0;s<4;s++){let o=tl[s];i[o]=parseFloat(n[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}var el=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function nl(n,t){let e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:o}=i,r=!1,a,c;if(el(s,o,n.target))a=s,c=o;else{let l=t.getBoundingClientRect();a=i.clientX-l.left,c=i.clientY-l.top,r=!0}return{x:a,y:c,box:r}}function It(n,t){if("native"in n)return n;let{canvas:e,currentDevicePixelRatio:i}=t,s=xn(e),o=s.boxSizing==="border-box",r=Bt(s,"padding"),a=Bt(s,"border","width"),{x:c,y:l,box:h}=nl(n,e),u=r.left+(h&&a.left),d=r.top+(h&&a.top),{width:f,height:m}=t;return o&&(f-=r.width+a.width,m-=r.height+a.height),{x:Math.round((c-u)/f*e.width/i),y:Math.round((l-d)/m*e.height/i)}}function il(n,t,e){let i,s;if(t===void 0||e===void 0){let o=bn(n);if(!o)t=n.clientWidth,e=n.clientHeight;else{let r=o.getBoundingClientRect(),a=xn(o),c=Bt(a,"border","width"),l=Bt(a,"padding");t=r.width-l.width-c.width,e=r.height-l.height-c.height,i=cn(a.maxWidth,o,"clientWidth"),s=cn(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||rn,maxHeight:s||rn}}var sn=n=>Math.round(n*10)/10;function Oo(n,t,e,i){let s=xn(n),o=Bt(s,"margin"),r=cn(s.maxWidth,n,"clientWidth")||rn,a=cn(s.maxHeight,n,"clientHeight")||rn,c=il(n,t,e),{width:l,height:h}=c;if(s.boxSizing==="content-box"){let d=Bt(s,"border","width"),f=Bt(s,"padding");l-=f.width+d.width,h-=f.height+d.height}return l=Math.max(0,l-o.width),h=Math.max(0,i?l/i:h-o.height),l=sn(Math.min(l,r,c.maxWidth)),h=sn(Math.min(h,a,c.maxHeight)),l&&!h&&(h=sn(l/2)),(t!==void 0||e!==void 0)&&i&&c.height&&h>c.height&&(h=c.height,l=sn(Math.floor(h*i))),{width:l,height:h}}function cs(n,t,e){let i=t||1,s=Math.floor(n.height*i),o=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);let r=n.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${n.height}px`,r.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(n.currentDevicePixelRatio=i,r.height=s,r.width=o,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}var So=function(){let n=!1;try{let t={get passive(){return n=!0,!1}};mn()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function ls(n,t){let e=Jc(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Tt(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function To(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function Co(n,t,e,i){let s={x:n.cp2x,y:n.cp2y},o={x:t.cp1x,y:t.cp1y},r=Tt(n,s,e),a=Tt(s,o,e),c=Tt(o,t,e),l=Tt(r,a,e),h=Tt(a,c,e);return Tt(l,h,e)}var sl=function(n,t){return{x(e){return n+n+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}}},ol=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function yn(n,t,e){return n?sl(t,e):ol()}function Ao(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function Lo(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function Io(n){return n==="angle"?{between:Ae,compare:Mc,normalize:ot}:{between:io,compare:(t,e)=>t-e,normalize:t=>t}}function $s({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function rl(n,t,e){let{property:i,start:s,end:o}=e,{between:r,normalize:a}=Io(i),c=t.length,{start:l,end:h,loop:u}=n,d,f;if(u){for(l+=c,h+=c,d=0,f=c;dc(s,w,b)&&a(s,w)!==0,y=()=>a(o,b)===0||c(o,w,b),S=()=>p||M(),D=()=>!p||y();for(let v=h,C=h;v<=u;++v)_=t[v%r],!_.skip&&(b=l(_[i]),b!==w&&(p=c(b,s,o),g===null&&S()&&(g=a(b,s)===0?v:C),g!==null&&D()&&(m.push($s({start:g,end:v,loop:d,count:r,style:f})),g=null),C=v,w=b));return g!==null&&m.push($s({start:g,end:u,loop:d,count:r,style:f})),m}function Ro(n,t){let e=[],i=n.segments;for(let s=0;ss&&n[o%t].skip;)o--;return o%=t,{start:s,end:o}}function cl(n,t,e,i){let s=n.length,o=[],r=t,a=n[t],c;for(c=t+1;c<=e;++c){let l=n[c%s];l.skip||l.stop?a.skip||(i=!1,o.push({start:t%s,end:(c-1)%s,loop:i}),t=r=l.stop?c:null):(r=c,a.skip&&(t=c)),a=l}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function Fo(n,t){let e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];let o=!!n._loop,{start:r,end:a}=al(e,s,o,i);if(i===!0)return Xs(n,[{start:r,end:a,loop:o}],e,t);let c=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Gi.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;let o=i.items,r=o.length-1,a=!1,c;for(;r>=0;--r)c=o[r],c._active?(c._total>i.duration&&(i.duration=c._total),c.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},wt=new gs,No="transparent",ul={boolean(n,t,e){return e>.5?t:n},color(n,t,e){let i=ts(n||No),s=i.valid&&ts(t||No);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}},ms=class{constructor(t,e,i,s){let o=e[i];s=Ee([t.to,s,o,t.from]);let r=Ee([t.from,o,s]);this._active=!0,this._fn=t.fn||ul[t.type||typeof r],this._easing=Jt[t.easing]||Jt.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=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ee([t.to,e,s,t.from]),this._from=Ee([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to,c;if(this._active=o!==a&&(r||e1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[s]=this._fn(o,a,c)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let s=0;s{let o=t[s];if(!L(o))return;let r={};for(let a of e)r[a]=o[a];(W(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,e){let i=e.options,s=fl(t,i);if(!s)return[];let o=this._createAnimations(s,i);return i.$shared&&dl(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now(),c;for(c=r.length-1;c>=0;--c){let l=r[c];if(l.charAt(0)==="$")continue;if(l==="options"){s.push(...this._animateOptions(t,e));continue}let h=e[l],u=o[l],d=i.get(l);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[l]=h;continue}o[l]=u=new ms(d,t,l,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return wt.add(this._chart,i),!0}};function dl(n,t){let e=[],i=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function Yo(n,t){let{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=i,c=o.axis,l=r.axis,h=bl(o,r,i),u=t.length,d;for(let f=0;fe[i].axis===t).shift()}function _l(n,t){return _t(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function wl(n,t,e){return _t(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Re(n,t){let e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(let s of t){let o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}var us=n=>n==="reset"||n==="none",Vo=(n,t)=>t?n:Object.assign({},n),Ml=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:Tr(e,!0),values:null},ce=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=Bo(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(),s=(u,d,f,m)=>u==="x"?d:u==="r"?m:f,o=e.xAxisID=R(i.xAxisID,hs(t,"x")),r=e.yAxisID=R(i.yAxisID,hs(t,"y")),a=e.rAxisID=R(i.rAxisID,hs(t,"r")),c=e.indexAxis,l=e.iAxisID=s(c,o,r,a),h=e.vAxisID=s(c,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Qi(this._data,this),t._stacked&&Re(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(L(e))this._data=ml(e);else if(i!==e){if(i){Qi(i,this);let s=this._cachedMeta;Re(s),s._parsed=[]}e&&Object.isExtensible(e)&&ao(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let o=e._stacked;e._stacked=Bo(e.vScale,e),e.stack!==i.stack&&(s=!0,Re(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&Yo(this,e._parsed)}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis,c=t===0&&e===s.length?!0:i._sorted,l=t>0&&i._parsed[t-1],h,u,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{W(s[t])?d=this.parseArrayData(i,s,t,e):L(s[t])?d=this.parseObjectData(i,s,t,e):d=this.parsePrimitiveData(i,s,t,e);let f=()=>u[a]===null||l&&u[a]p||u=0;--d)if(!m()){this.updateRangeFromParsed(l,t,f,c);break}}return l}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(i,s,e),p=l.resolveNamedOptions(d,f,m,u);return p.$shared&&(p.$shared=c,o[r]=Object.freeze(Vo(p,c))),p}_resolveAnimations(t,e,i){let s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let c;if(s.options.animation!==!1){let h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),u);c=h.createResolver(d,this.getContext(t,i,e))}let l=new Tn(s,c&&c.animations);return c&&c._cacheable&&(o[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||us(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:r}}updateElement(t,e,i,s){us(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!us(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[a,c,l]of this._syncList)this[a](c,l);this._syncList=[];let s=i.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(l.length+=e,a=l.length-1;a>=r;a--)l[a]=l[a-e]};for(c(o),a=t;aAe(w,a,c,!0)?1:Math.max(M,M*e,y,y*e),m=(w,M,y)=>Ae(w,a,c,!0)?-1:Math.min(M,M*e,y,y*e),p=f(0,l,u),g=f(G,h,d),b=m(B,l,u),_=m(B+G,h,d);i=(p-b)/2,s=(g-_)/2,o=-(p+b)/2,r=-(g+_)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:r}}var bs=class extends ce{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;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{let c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=c=>+i[c];if(L(i[t])){let{key:c="value"}=this._parsing;o=l=>+Vt(i[l],c)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?X*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=oe(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,s,o,r,a,c;if(!t){for(s=0,o=i.data.datasets.length;s0&&this.getParsed(e-1);for(let y=0;y=_){D.skip=!0;continue}let v=this.getParsed(y),C=N(v[f]),Y=D[d]=r.getPixelForValue(v[d],y),V=D[f]=o||C?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,v,c):v[f],y);D.skip=isNaN(Y)||isNaN(V)||C,D.stop=y>0&&Math.abs(v[d]-M[d])>g,p&&(D.parsed=v,D.raw=l.data[y]),u&&(D.options=h||this.resolveDataElementOptions(y,S.active?"active":s)),b||this.updateElement(S,y,D,s),M=v}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},xs=class extends ce{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{let c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=oe(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return Do.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{let o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){let o=s==="reset",r=this.chart,c=r.options.animation,l=this._cachedMeta.rScale,h=l.xCenter,u=l.yCenter,d=l.getIndexAngle(0)-.5*B,f=d,m,p=360/this.countVisibleElements();for(m=0;m{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?at(this.resolveDataElementOptions(t,e).angle||i):0}};function jt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var ys=class n{static override(t){Object.assign(n.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return jt()}parse(){return jt()}format(){return jt()}add(){return jt()}diff(){return jt()}startOf(){return jt()}endOf(){return jt()}},Cs={_date:ys};function Dl(n,t,e,i){let{controller:s,data:o,_sorted:r}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){let c=a._reversePixels?so:Ct;if(i){if(s._sharedOptions){let l=o[0],h=typeof l.getRange=="function"&&l.getRange(t);if(h){let u=c(o,t,e-h),d=c(o,t,e+h);return{lo:u.lo,hi:d.hi}}}}else return c(o,t,e)}return{lo:0,hi:o.length-1}}function je(n,t,e,i,s){let o=n.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,c=o.length;a{c[r](t[e],s)&&(o.push({element:c,datasetIndex:l,index:h}),a=a||c.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Sl={evaluateInteractionItems:je,modes:{index(n,t,e,i){let s=It(t,n),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?ds(n,s,o,i,r):fs(n,s,o,!1,i,r),c=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(l=>{let h=a[0].index,u=l.data[h];u&&!u.skip&&c.push({element:u,datasetIndex:l.index,index:h})}),c):[]},dataset(n,t,e,i){let s=It(t,n),o=e.axis||"xy",r=e.includeInvisible||!1,a=e.intersect?ds(n,s,o,i,r):fs(n,s,o,!1,i,r);if(a.length>0){let c=a[0].datasetIndex,l=n.getDatasetMeta(c).data;a=[];for(let h=0;he.pos===t)}function qo(n,t){return n.filter(e=>Cr.indexOf(e.pos)===-1&&e.box.axis===t)}function Ne(n,t){return n.sort((e,i)=>{let s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Tl(n){let t=[],e,i,s,o,r,a;for(e=0,i=(n||[]).length;el.box.fullSize),!0),i=Ne(Fe(t,"left"),!0),s=Ne(Fe(t,"right")),o=Ne(Fe(t,"top"),!0),r=Ne(Fe(t,"bottom")),a=qo(t,"x"),c=qo(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(c).concat(r).concat(a),chartArea:Fe(t,"chartArea"),vertical:i.concat(s).concat(c),horizontal:o.concat(r).concat(a)}}function $o(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Ar(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function Il(n,t,e,i){let{pos:s,box:o}=e,r=n.maxPadding;if(!L(s)){e.size&&(n[s]-=e.size);let u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,n[s]+=e.size}o.getPadding&&Ar(r,o.getPadding());let a=Math.max(0,t.outerWidth-$o(r,n,"left","right")),c=Math.max(0,t.outerHeight-$o(r,n,"top","bottom")),l=a!==n.w,h=c!==n.h;return n.w=a,n.h=c,e.horizontal?{same:l,other:h}:{same:h,other:l}}function El(n){let t=n.maxPadding;function e(i){let s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function Rl(n,t){let e=t.maxPadding;function i(s){let o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return i(n?["left","right"]:["top","bottom"])}function Be(n,t,e,i){let s=[],o,r,a,c,l,h;for(o=0,r=n.length,l=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});let h=c.reduce((p,g)=>g.box.options&&g.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},s);Ar(d,nt(i));let f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),m=Al(c.concat(l),u);Be(a.fullSize,f,u,m),Be(c,f,u,m),Be(l,f,u,m)&&Be(c,f,u,m),El(f),Xo(a.leftAndTop,f,u,m),f.x+=f.w,f.y+=f.h,Xo(a.rightAndBottom,f,u,m),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},E(a.chartArea,p=>{let g=p.box;Object.assign(g,n.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},An=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},_s=class extends An{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},On="$chartjs",Fl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Uo=n=>n===null||n==="";function Nl(n,t){let e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[On]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Uo(s)){let o=ls(n,"width");o!==void 0&&(n.width=o)}if(Uo(i))if(n.style.height==="")n.height=n.width/(t||2);else{let o=ls(n,"height");o!==void 0&&(n.height=o)}return n}var Lr=So?{passive:!0}:!1;function Wl(n,t,e){n.addEventListener(t,e,Lr)}function zl(n,t,e){n.canvas.removeEventListener(t,e,Lr)}function Bl(n,t){let e=Fl[n.type]||n.type,{x:i,y:s}=It(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ln(n,t){for(let e of n)if(e===t||e.contains(t))return!0}function Hl(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Ln(a.addedNodes,i),r=r&&!Ln(a.removedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Yl(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Ln(a.removedNodes,i),r=r&&!Ln(a.addedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}var Ye=new Map,Qo=0;function Ir(){let n=window.devicePixelRatio;n!==Qo&&(Qo=n,Ye.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function Vl(n,t){Ye.size||window.addEventListener("resize",Ir),Ye.set(n,t)}function jl(n){Ye.delete(n),Ye.size||window.removeEventListener("resize",Ir)}function ql(n,t,e){let i=n.canvas,s=i&&bn(i);if(!s)return;let o=Ki((a,c)=>{let l=s.clientWidth;e(a,c),l{let c=a[0],l=c.contentRect.width,h=c.contentRect.height;l===0&&h===0||o(l,h)});return r.observe(s),Vl(n,o),r}function ps(n,t,e){e&&e.disconnect(),t==="resize"&&jl(n)}function $l(n,t,e){let i=n.canvas,s=Ki(o=>{n.ctx!==null&&e(Bl(o,n))},n);return Wl(i,t,s),s}var ws=class extends An{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Nl(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[On])return!1;let i=e[On].initial;["height","width"].forEach(o=>{let r=i[o];N(r)?e.removeAttribute(o):e.setAttribute(o,r)});let s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[On],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),r={attach:Hl,detach:Yl,resize:ql}[e]||$l;s[e]=r(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:ps,detach:ps,resize:ps}[e]||zl)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Oo(t,e,i,s)}isAttached(t){let e=bn(t);return!!(e&&e.isConnected)}};function Xl(n){return!mn()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?_s:ws}var $t=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 se(this.x)&&se(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}};function Ul(n,t){let e=n.options.ticks,i=Ql(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Kl(t):[],r=o.length,a=o[0],c=o[r-1],l=[];if(r>s)return Zl(t,l,o,r/s),l;let h=Gl(o,t,s);if(r>0){let u,d,f=r>1?Math.round((c-a)/(r-1)):null;for(Mn(t,l,h,N(f)?0:a-f,a),u=0,d=r-1;us)return c}return Math.max(s,1)}function Kl(n){let t=[],e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,Go=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,Ko=(n,t)=>Math.min(t||n,n);function Zo(n,t){let e=[],i=n.length/t,s=n.length,o=0;for(;or+a)))return c}function nh(n,t){E(n,e=>{let i=e.gc,s=i.length/2,o;if(s>t){for(o=0;oi?i:e,i=s&&e>i?e:i,{min:K(e,K(i,e)),max:K(i,K(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(){z(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.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=_o(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let c=a=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}let h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=rt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:f/(i-1),u+6>a&&(a=f/(i-(t.offset?.5:1)),c=this.maxHeight-We(t.grid)-e.padding-Jo(t.title,this.chart.options.font),l=Math.sqrt(u*u+d*d),r=hn(Math.min(Math.asin(rt((h.highest.height+6)/a,-1,1)),Math.asin(rt(c/l,-1,1))-Math.asin(rt(d/l,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){z(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){z(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let c=Jo(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=We(o)+c):(t.height=this.maxHeight,t.width=We(o)+c),i.display&&this.ticks.length){let{first:l,last:h,widest:u,highest:d}=this._getLabelSizes(),f=i.padding*2,m=at(this.labelRotation),p=Math.cos(m),g=Math.sin(m);if(a){let b=i.mirror?0:g*u.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{let b=i.mirror?0:p*u.width+g*d.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(l,h,g,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){let{ticks:{align:o,padding:r},position:a}=this.options,c=this.labelRotation!==0,l=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1),d=0,f=0;c?l?(d=s*t.width,f=i*e.height):(d=i*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_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(){z(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({width:r[C]||0,height:a[C]||0});return{first:v(0),last:v(e-1),widest:v(S),highest:v(D),widths:r,heights:a}}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 no(this._alignToPixels?Lt(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&&ta*s?a/i:c/s:c*s0}_computeGridLineItems(t){let e=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,c=o.offset,l=this.isHorizontal(),u=this.ticks.length+(c?1:0),d=We(o),f=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,g=p/2,b=function(U){return Lt(i,U,p)},_,w,M,y,S,D,v,C,Y,V,q,ut;if(r==="top")_=b(this.bottom),D=this.bottom-d,C=_-g,V=b(t.top)+g,ut=t.bottom;else if(r==="bottom")_=b(this.top),V=t.top,ut=b(t.bottom)-g,D=_+g,C=this.top+d;else if(r==="left")_=b(this.right),S=this.right-d,v=_-g,Y=b(t.left)+g,q=t.right;else if(r==="right")_=b(this.left),Y=t.left,q=b(t.right)-g,S=_+g,v=this.left+d;else if(e==="x"){if(r==="center")_=b((t.top+t.bottom)/2+.5);else if(L(r)){let U=Object.keys(r)[0],it=r[U];_=b(this.chart.scales[U].getPixelForValue(it))}V=t.top,ut=t.bottom,D=_+g,C=D+d}else if(e==="y"){if(r==="center")_=b((t.left+t.right)/2);else if(L(r)){let U=Object.keys(r)[0],it=r[U];_=b(this.chart.scales[U].getPixelForValue(it))}S=_-g,v=S-d,Y=t.left,q=t.right}let Pt=R(s.ticks.maxTicksLimit,u),j=Math.max(1,Math.ceil(u/Pt));for(w=0;w0&&(Wt-=Nt/2);break}Ke={left:Wt,top:ke,width:Nt+Kt.width,height:Me+Kt.height,color:j.backdropColor}}g.push({label:M,font:C,textOffset:q,options:{rotation:p,color:it,strokeColor:Qe,strokeWidth:Ge,textAlign:Gt,textBaseline:ut,translation:[y,S],backdrop:Ke}})}return g}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-at(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,c=r.widest.width,l,h;return e==="left"?s?(h=this.right+o,i==="near"?l="left":i==="center"?(l="center",h+=c/2):(l="right",h+=c)):(h=this.right-a,i==="near"?l="right":i==="center"?(l="center",h-=c/2):(l="left",h=this.left)):e==="right"?s?(h=this.left+o,i==="near"?l="right":i==="center"?(l="center",h-=c/2):(l="left",h-=c)):(h=this.left+a,i==="near"?l="left":i==="center"?(l="center",h+=c/2):(l="right",h=this.right)):l="right",{textAlign:l,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:s,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,r,a=(c,l,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(c.x,c.y),i.lineTo(l.x,l.y),i.stroke(),i.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[],o,r;for(o=0,r=e.length;o{let i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),r=t[e].split("."),a=r.pop(),c=r.join(".");H.route(o,s,c,a)})}function lh(n){return"id"in n&&"defaults"in n}var Ms=class{constructor(){this.controllers=new ae(ce,"datasets",!0),this.elements=new ae($t,"elements"),this.plugins=new ae(Object,"plugins"),this.scales=new ae(le,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{let o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):E(s,r=>{let a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,i){let s=ln(t);z(i["before"+s],[],i),e[t](i),z(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(c=>a.plugin.id===c.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};function hh(n){let t={},e=[],i=Object.keys(gt.plugins.items);for(let o=0;o1&&tr(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function er(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function bh(n,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return er(n,"x",e[0])||er(n,"y",e[0])}return{}}function xh(n,t){let e=At[n.type]||{scales:{}},i=t.scales||{},s=Ds(n.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{let a=i[r];if(!L(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let c=vs(r,a,bh(r,n),H.scales[a.type]),l=gh(c,s),h=e.scales||{};o[r]=ne(Object.create(null),[{axis:c},a,h[c],h[l]])}),n.data.datasets.forEach(r=>{let a=r.type||n.type,c=r.indexAxis||Ds(a,t),h=(At[a]||{}).scales||{};Object.keys(h).forEach(u=>{let d=ph(u,c),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),ne(o[f],[{axis:d},i[f],h[u]])})}),Object.keys(o).forEach(r=>{let a=o[r];ne(a,[H.scales[a.type],H.scale])}),o}function Er(n){let t=n.options||(n.options={});t.plugins=R(t.plugins,{}),t.scales=xh(n,t)}function Rr(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function yh(n){return n=n||{},n.data=Rr(n.data),Er(n),n}var nr=new Map,Fr=new Set;function kn(n,t){let e=nr.get(n);return e||(e=t(),nr.set(n,e),Fr.add(e)),e}var ze=(n,t,e)=>{let i=Vt(t,e);i!==void 0&&n.add(i)},Ps=class{constructor(t){this._config=yh(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=Rr(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(),Er(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return kn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return kn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return kn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return kn(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(e);if(a)return a;let c=new Set;e.forEach(h=>{t&&(c.add(t),h.forEach(u=>ze(c,t,u))),h.forEach(u=>ze(c,s,u)),h.forEach(u=>ze(c,At[o]||{},u)),h.forEach(u=>ze(c,H,u)),h.forEach(u=>ze(c,dn,u))});let l=Array.from(c);return l.length===0&&l.push(Object.create(null)),Fr.has(e)&&r.set(e,l),l}chartOptionScopes(){let{options:t,type:e}=this;return[t,At[e]||{},H.datasets[e]||{},{type:e},H,dn]}resolveNamedOptions(t,e,i,s=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=ir(this._resolverCache,t,s),c=r;if(wh(r,e)){o.$shared=!1,i=xt(i)?i():i;let l=this.createResolver(t,i,a);c=Yt(r,i,l)}for(let l of e)o[l]=c[l];return o}createResolver(t,e,i=[""],s){let{resolver:o}=ir(this._resolverCache,t,i);return L(e)?Yt(o,e,void 0,s):o}};function ir(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));let s=e.join(),o=i.get(s);return o||(o={resolver:gn(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}var _h=n=>L(n)&&Object.getOwnPropertyNames(n).some(t=>xt(n[t]));function wh(n,t){let{isScriptable:e,isIndexable:i}=os(n);for(let s of t){let o=e(s),r=i(s),a=(r||o)&&n[s];if(o&&(xt(a)||_h(a))||r&&W(a))return!0}return!1}var Mh="4.4.1",kh=["top","bottom","left","right","chartArea"];function sr(n,t){return n==="top"||n==="bottom"||kh.indexOf(n)===-1&&t==="x"}function or(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function rr(n){let t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),z(e&&e.onComplete,[n],t)}function Dh(n){let t=n.chart,e=t.options.animation;z(e&&e.onProgress,[n],t)}function Nr(n){return mn()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}var Sn={},ar=n=>{let t=Nr(n);return Object.values(Sn).filter(e=>e.canvas===t).pop()};function vh(n,t,e){let i=Object.keys(n);for(let s of i){let o=+s;if(o>=t){let r=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=r)}}}function Ph(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function Dn(n,t,e){return n.options.clip?n[e]:t[e]}function Oh(n,t){let{xScale:e,yScale:i}=n;return e&&i?{left:Dn(e,t,"left"),right:Dn(e,t,"right"),top:Dn(i,t,"top"),bottom:Dn(i,t,"bottom")}:t}var he=class{static defaults=H;static instances=Sn;static overrides=At;static registry=gt;static version=Mh;static getChart=ar;static register(...t){gt.add(...t),cr()}static unregister(...t){gt.remove(...t),cr()}constructor(t,e){let i=this.config=new Ps(e),s=Nr(t),o=ar(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Xl(s)),this.platform.updateConfig(i);let a=this.platform.acquireContext(s,r.aspectRatio),c=a&&a.canvas,l=c&&c.height,h=c&&c.width;if(this.id=Qs(),this.ctx=a,this.canvas=c,this.width=h,this.height=l,this._options=r,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 ks,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=lo(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],Sn[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}wt.listen(this,"complete",rr),wt.listen(this,"progress",Dh),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return N(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return gt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():cs(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return es(this.canvas,this.ctx),this}stop(){return wt.stop(this),this}resize(t,e){wt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,cs(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),z(i.onResize,[this,r],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};E(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{}),o=[];e&&(o=o.concat(Object.keys(e).map(r=>{let a=e[r],c=vs(r,a),l=c==="r",h=c==="x";return{options:a,dposition:l?"chartArea":h?"bottom":"left",dtype:l?"radialLinear":h?"category":"linear"}}))),E(o,r=>{let a=r.options,c=a.id,l=vs(c,a),h=R(a.type,r.dtype);(a.position===void 0||sr(a.position,l)!==sr(r.dposition))&&(a.position=r.dposition),s[c]=!0;let u=null;if(c in i&&i[c].type===h)u=i[c];else{let d=gt.getScale(h);u=new d({id:c,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),E(s,(r,a)=>{r||delete i[a]}),E(i,r=>{wn.configure(this,r,r.options),wn.addBox(this,r)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let l=0,h=this.data.datasets.length;l{l.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(or("z","_idx"));let{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){E(this.scales,t=>{wn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!qi(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:o}of e){let r=i==="_removeElements"?-o:o;vh(t,s,r)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;wn.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],E(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i=t._clip,s=!i.disabled,o=Oh(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&ns(e,{left:i.left===!1?0:o.left-i.left,right:i.right===!1?this.width:o.right+i.right,top:i.top===!1?0:o.top-i.top,bottom:i.bottom===!1?this.height:o.bottom+i.bottom}),t.controller.draw(),s&&is(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return dt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let o=Sl.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=_t(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Ce(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),wt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};E(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(c,l)=>{e.addEventListener(this,c,l),t[c]=l},s=(c,l)=>{t[c]&&(e.removeEventListener(this,c,l),delete t[c])},o=(c,l)=>{this.canvas&&this.resize(c,l)},r,a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():r()}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 s=i?"set":"remove",o,r,a,c;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,c=t.length;a{let a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Te(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){let s=this.options.hover,o=(c,l)=>c.filter(h=>!l.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=i?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,i,r),c=Zs(t),l=Ph(t,this._lastEvent,i,c);i&&(this._lastEvent=null,z(o.onHover,[t,a,this],this),c&&z(o.onClick,[t,a,this],this));let h=!Te(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function cr(){return E(he.instances,n=>n._plugins.invalidate())}function Wr(n,t,e=t){n.lineCap=R(e.borderCapStyle,t.borderCapStyle),n.setLineDash(R(e.borderDash,t.borderDash)),n.lineDashOffset=R(e.borderDashOffset,t.borderDashOffset),n.lineJoin=R(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=R(e.borderWidth,t.borderWidth),n.strokeStyle=R(e.borderColor,t.borderColor)}function Sh(n,t,e){n.lineTo(e.x,e.y)}function Th(n){return n.stepped?bo:n.tension||n.cubicInterpolationMode==="monotone"?xo:Sh}function zr(n,t,e={}){let i=n.length,{start:s=0,end:o=i-1}=e,{start:r,end:a}=t,c=Math.max(s,r),l=Math.min(o,a),h=sa&&o>a;return{count:i,start:c,loop:t.loop,ilen:l(r+(l?a-M:M))%o,w=()=>{p!==g&&(n.lineTo(h,g),n.lineTo(h,p),n.lineTo(h,b))};for(c&&(f=s[_(0)],n.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[_(d)],f.skip)continue;let M=f.x,y=f.y,S=M|0;S===m?(yg&&(g=y),h=(u*h+M)/++u):(w(),n.lineTo(M,y),m=S,u=0,p=g=y),b=y}w()}function Os(n){let t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Ah:Ch}function Lh(n){return n.stepped?To:n.tension||n.cubicInterpolationMode==="monotone"?Co:Tt}function Ih(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Wr(n,t.options),n.stroke(s)}function Eh(n,t,e,i){let{segments:s,options:o}=t,r=Os(t);for(let a of s)Wr(n,o,a.style),n.beginPath(),r(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}var Rh=typeof Path2D=="function";function Fh(n,t,e,i){Rh&&!t.options.segment?Ih(n,t,e,i):Eh(n,t,e,i)}var In=class extends $t{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let s=i.spanGaps?this._loop:this._fullLoop;Po(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Fo(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,s=t[e],o=this.points,r=Ro(this,{property:e,start:s,end:s});if(!r.length)return;let a=[],c=Lh(i),l,h;for(l=0,h=r.length;ln.replace("rgb(","rgba(").replace(")",", 0.5)"));function Br(n){return Ss[n%Ss.length]}function Hr(n){return hr[n%hr.length]}function Nh(n,t){return n.borderColor=Br(t),n.backgroundColor=Hr(t),++t}function Wh(n,t){return n.backgroundColor=n.data.map(()=>Br(t++)),t}function zh(n,t){return n.backgroundColor=n.data.map(()=>Hr(t++)),t}function Bh(n){let t=0;return(e,i)=>{let s=n.getDatasetMeta(i).controller;s instanceof bs?t=Wh(e,t):s instanceof xs?t=zh(e,t):s&&(t=Nh(e,t))}}function ur(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Hh(n){return n&&(n.borderColor||n.backgroundColor)}var Yr={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;let{data:{datasets:i},options:s}=n.config,{elements:o}=s;if(!e.forceOverride&&(ur(i)||Hh(s)||o&&ur(o)))return;let r=Bh(n);i.forEach(r)}};var He={average(n){if(!n.length)return!1;let t,e,i=0,s=0,o=0;for(t=0,e=n.length;t-1?n.split(` `):n}function Yh(n,t){let{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:n,label:r,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function dr(n,t){let e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:r,boxHeight:a}=t,c=Z(t.bodyFont),l=Z(t.titleFont),h=Z(t.footerFont),u=o.length,d=s.length,f=i.length,m=nt(t.padding),p=m.height,g=0,b=i.reduce((M,y)=>M+y.before.length+y.lines.length+y.after.length,0);if(b+=n.beforeBody.length+n.afterBody.length,u&&(p+=u*l.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){let M=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;p+=f*M+(b-f)*c.lineHeight+(b-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let _=0,w=function(M){g=Math.max(g,e.measureText(M).width+_)};return e.save(),e.font=l.string,E(n.title,w),e.font=c.string,E(n.beforeBody.concat(n.afterBody),w),_=t.displayColors?r+2+t.boxPadding:0,E(i,M=>{E(M.before,w),E(M.lines,w),E(M.after,w)}),_=0,e.font=h.string,E(n.footer,w),e.restore(),g+=m.width,{width:g,height:p}}function Vh(n,t){let{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function jh(n,t,e,i){let{x:s,width:o}=i,r=e.caretSize+e.caretPadding;if(n==="left"&&s+o+r>t.width||n==="right"&&s-o-r<0)return!0}function qh(n,t,e,i){let{x:s,width:o}=e,{width:r,chartArea:{left:a,right:c}}=n,l="center";return i==="center"?l=s<=(a+c)/2?"left":"right":s<=o/2?l="left":s>=r-o/2&&(l="right"),jh(l,n,t,e)&&(l="center"),l}function fr(n,t,e){let i=e.yAlign||t.yAlign||Vh(n,e);return{xAlign:e.xAlign||t.xAlign||qh(n,t,e,i),yAlign:i}}function $h(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Xh(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function pr(n,t,e,i){let{caretSize:s,caretPadding:o,cornerRadius:r}=n,{xAlign:a,yAlign:c}=e,l=s+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=re(r),m=$h(t,a),p=Xh(t,c,l);return c==="center"?a==="left"?m+=l:a==="right"&&(m-=l):a==="left"?m-=Math.max(h,d)+s:a==="right"&&(m+=Math.max(u,f)+s),{x:rt(m,0,i.width-t.width),y:rt(p,0,i.height-t.height)}}function vn(n,t,e){let i=nt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function gr(n){return pt([],Mt(n))}function Uh(n,t,e){return _t(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function mr(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}var Vr={beforeTitle:ft,title(n){if(n.length>0){let t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?Vr[t].call(e,i):s}var Rn=class extends $t{static positioners=He;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new Tn(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Uh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,s=J(i,"beforeTitle",this,t),o=J(i,"title",this,t),r=J(i,"afterTitle",this,t),a=[];return a=pt(a,Mt(s)),a=pt(a,Mt(o)),a=pt(a,Mt(r)),a}getBeforeBody(t,e){return gr(J(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:i}=e,s=[];return E(t,o=>{let r={before:[],lines:[],after:[]},a=mr(i,o);pt(r.before,Mt(J(a,"beforeLabel",this,o))),pt(r.lines,J(a,"label",this,o)),pt(r.after,Mt(J(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return gr(J(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,s=J(i,"beforeFooter",this,t),o=J(i,"footer",this,t),r=J(i,"afterFooter",this,t),a=[];return a=pt(a,Mt(s)),a=pt(a,Mt(o)),a=pt(a,Mt(r)),a}_createItems(t){let e=this._active,i=this.chart.data,s=[],o=[],r=[],a=[],c,l;for(c=0,l=e.length;ct.filter(h,u,d,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),E(a,h=>{let u=mr(t.callbacks,h);s.push(J(u,"labelColor",this,h)),o.push(J(u,"labelPointStyle",this,h)),r.push(J(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){let i=this.options.setContext(this.getContext()),s=this._active,o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let a=He[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);let c=this._size=dr(this,i),l=Object.assign({},a,c),h=fr(this.chart,i,l),u=pr(i,l,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:c,topRight:l,bottomLeft:h,bottomRight:u}=re(a),{x:d,y:f}=t,{width:m,height:p}=e,g,b,_,w,M,y;return o==="center"?(M=f+p/2,s==="left"?(g=d,b=g-r,w=M+r,y=M-r):(g=d+m,b=g+r,w=M-r,y=M+r),_=g):(s==="left"?b=d+Math.max(c,h)+r:s==="right"?b=d+m-Math.max(l,u)-r:b=this.caretX,o==="top"?(w=f,M=w-r,g=b-r,_=b+r):(w=f+p,M=w+r,g=b+r,_=b-r),y=w),{x1:g,x2:b,x3:_,y1:w,y2:M,y3:y}}drawTitle(t,e,i){let s=this.title,o=s.length,r,a,c;if(o){let l=yn(i.rtl,this.x,this.width);for(t.x=vn(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",r=Z(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,c=0;c_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,pn(t,{x:p,y:m,w:l,h:c,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),pn(t,{x:g,y:m+1,w:l-2,h:c-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,m,l,c),t.strokeRect(p,m,l,c),t.fillStyle=r.backgroundColor,t.fillRect(g,m+1,l-2,c-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:c,boxWidth:l,boxPadding:h}=i,u=Z(i.bodyFont),d=u.lineHeight,f=0,m=yn(i.rtl,this.x,this.width),p=function(v){e.fillText(v,m.x(t.x+f),t.y+d/2),t.y+=d+o},g=m.textAlign(r),b,_,w,M,y,S,D;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=vn(this,g,i),e.fillStyle=i.bodyColor,E(this.beforeBody,p),f=a&&g!=="right"?r==="center"?l/2+h:l+2+h:0,M=0,S=s.length;M0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){let r=He[t.position].call(this,this._active,this._eventPosition);if(!r)return;let a=this._size=dr(this,t),c=Object.assign({},r,this._size),l=fr(e,t,c),h=pr(t,c,l,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=l.xAlign,this.yAlign=l.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.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 s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let r=nt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,e),Ao(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Lo(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,s=t.map(({datasetIndex:a,index:c})=>{let l=this.chart.getDatasetMeta(a);if(!l)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:l.data[c],index:c}}),o=!Te(i,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,i),a=this._positionChanged(r,t),c=e||!Te(r,o)||a;return c&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),c}_getActiveElements(t,e,i,s){let o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);let r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,e){let{caretX:i,caretY:s,options:o}=this,r=He[o.position].call(this,t,e);return r!==!1&&(i!==r.x||s!==r.y)}},jr={id:"tooltip",_element:Rn,positioners:He,afterInit(n,t,e){e&&(n.tooltip=new Rn({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){let t=n.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){let e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Vr},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};function Qh(n,t){let e=[],{bounds:s,step:o,min:r,max:a,precision:c,count:l,maxTicks:h,maxDigits:u,includeBounds:d}=n,f=o||1,m=h-1,{min:p,max:g}=t,b=!N(r),_=!N(a),w=!N(l),M=(g-p)/(u+1),y=$i((g-p)/m/f)*f,S,D,v,C;if(y<1e-14&&!b&&!_)return[{value:p},{value:g}];C=Math.ceil(g/y)-Math.floor(p/y),C>m&&(y=$i(C*y/m/f)*f),N(c)||(S=Math.pow(10,c),y=Math.ceil(y*S)/S),s==="ticks"?(D=Math.floor(p/y)*y,v=Math.ceil(g/y)*y):(D=p,v=g),b&&_&&o&&to((a-r)/o,y/1e3)?(C=Math.round(Math.min((a-r)/y,h)),y=(a-r)/C,D=r,v=a):w?(D=b?r:D,v=_?a:v,C=l-1,y=(v-D)/C):(C=(v-D)/y,ie(C,Math.round(C),y/1e3)?C=Math.round(C):C=Math.ceil(C));let Y=Math.max(Ui(y),Ui(D));S=Math.pow(10,N(c)?Y:c),D=Math.round(D*S)/S,v=Math.round(v*S)/S;let V=0;for(b&&(d&&D!==r?(e.push({value:r}),Da)break;e.push({value:q})}return _&&d&&v!==a?e.length&&ie(e[e.length-1].value,a,br(a,M,n))?e[e.length-1].value=a:e.push({value:a}):(!_||v===a)&&e.push({value:v}),e}function br(n,t,{horizontal:e,minRotation:i}){let s=at(i),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+n).length;return Math.min(t/o,r)}var ue=class extends le{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 N(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:s,max:o}=this,r=c=>s=e?s:c,a=c=>o=i?o:c;if(t){let c=Ht(s),l=Ht(o);c<0&&l<0?a(0):c>0&&l>0&&r(0)}if(s===o){let c=o===0?1:Math.abs(o*.05);a(o+c),t||r(s-c)}this.min=s,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Qh(s,o);return t.bounds==="ticks"&&Xi(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return oe(t,this.chart.options.locale,this.options.ticks.format)}},Fn=class extends ue{static id="linear";static defaults={ticks:{callback:Le.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=$(t)?t:0,this.max=$(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=at(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},Ve=n=>Math.floor(yt(n)),qt=(n,t)=>Math.pow(10,Ve(n)+t);function xr(n){return n/Math.pow(10,Ve(n))===1}function yr(n,t,e){let i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function Gh(n,t){let e=t-n,i=Ve(e);for(;yr(n,t,i)>10;)i++;for(;yr(n,t,i)<10;)i--;return Math.min(i,Ve(n))}function Kh(n,{min:t,max:e}){t=K(n.min,t);let i=[],s=Ve(t),o=Gh(t,e),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),c=s>o?Math.pow(10,s):0,l=Math.round((t-c)*r)/r,h=Math.floor((t-c)/a/10)*a*10,u=Math.floor((l-h)/Math.pow(10,o)),d=K(n.min,Math.round((c+h+u*Math.pow(10,o))*r)/r);for(;d=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,r=o>=0?1:r),d=Math.round((c+h+u*Math.pow(10,o))*r)/r;let f=K(n.max,d);return i.push({value:f,major:xr(f),significand:u}),i}var _r=class extends le{static id="logarithmic";static defaults={ticks:{callback:Le.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=ue.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return $(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=$(t)?Math.max(0,t):null,this.max=$(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!$(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,s=this.max,o=a=>i=t?i:a,r=a=>s=e?s:a;i===s&&(i<=0?(o(1),r(10)):(o(qt(i,-1)),r(qt(s,1)))),i<=0&&o(qt(s,-1)),s<=0&&r(qt(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=Kh(e,this);return t.bounds==="ticks"&&Xi(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":oe(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=yt(t),this._valueRange=yt(this.max)-yt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(yt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function Ts(n){let t=n.ticks;if(t.display&&n.display){let e=nt(t.backdropPadding);return R(t.font&&t.font.size,H.font.size)+e.height}return 0}function Zh(n,t,e){return e=W(e)?e:[e],{w:go(n,t.string,e),h:e.length*t.lineHeight}}function wr(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function Jh(n){let t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,r=n.options.pointLabels,a=r.centerPointLabels?B/o:0;for(let c=0;ct.r&&(a=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(c=(s.end-t.b)/r,n.b=Math.max(n.b,t.b+c))}function eu(n,t,e){let i=n.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=e,c=n.getPointPosition(t,i+s+r,o),l=Math.round(hn(ot(c.angle+G))),h=ru(c.y,a.h,l),u=su(l),d=ou(c.x,a.w,u);return{visible:!0,x:c.x,y:h,textAlign:u,left:d,top:h,right:d+a.w,bottom:h+a.h}}function nu(n,t){if(!t)return!0;let{left:e,top:i,right:s,bottom:o}=n;return!(dt({x:e,y:i},t)||dt({x:e,y:o},t)||dt({x:s,y:i},t)||dt({x:s,y:o},t))}function iu(n,t,e){let i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:r,display:a}=o.pointLabels,c={extra:Ts(o)/2,additionalAngle:r?B/s:0},l;for(let h=0;h270||e<90)&&(n-=t),n}function au(n,t,e){let{left:i,top:s,right:o,bottom:r}=e,{backdropColor:a}=t;if(!N(a)){let c=re(t.borderRadius),l=nt(t.backdropPadding);n.fillStyle=a;let h=i-l.left,u=s-l.top,d=o-i+l.width,f=r-s+l.height;Object.values(c).some(m=>m!==0)?(n.beginPath(),pn(n,{x:h,y:u,w:d,h:f,radius:c}),n.fill()):n.fillRect(h,u,d,f)}}function cu(n,t){let{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){let o=n._pointLabelItems[s];if(!o.visible)continue;let r=i.setContext(n.getPointLabelContext(s));au(e,r,o);let a=Z(r.font),{x:c,y:l,textAlign:h}=o;Ie(e,n._pointLabels[s],c,l+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function qr(n,t,e,i){let{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,X);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{let s=z(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?Jh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=X/(this._pointLabels.length||1),i=this.options.startAngle||0;return ot(t*e+at(i))}getDistanceFromCenterForValue(t){if(N(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(N(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{if(u!==0){c=this.getDistanceFromCenterForValue(h.value);let d=this.getContext(u),f=s.setContext(d),m=o.setContext(d);lu(this,f,c,r,m)}}),i.display){for(t.save(),a=r-1;a>=0;a--){let h=i.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:d}=h;!d||!u||(t.lineWidth=d,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,c=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(a,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let s=this.getIndexAngle(0),o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&!e.reverse)return;let l=i.setContext(this.getContext(c)),h=Z(l.font);if(o=this.getDistanceFromCenterForValue(this.ticks[c].value),l.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=l.backdropColor;let u=nt(l.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}Ie(t,a.label,0,-o,h,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),t.restore()}drawTitle(){}},Nn={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},tt=Object.keys(Nn);function kr(n,t){return n-t}function Dr(n,t){if(N(t))return null;let e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts,r=t;return typeof i=="function"&&(r=i(r)),$(r)||(r=typeof i=="string"?e.parse(r,i):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(se(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function vr(n,t,e,i){let s=tt.length;for(let o=tt.indexOf(n);o=tt.indexOf(e);o--){let r=tt[o];if(Nn[r].common&&n._adapter.diff(s,i,r)>=t-1)return r}return tt[e?tt.indexOf(e):0]}function du(n){for(let t=tt.indexOf(n)+1,e=tt.length;t=t?e[i]:e[s];n[o]=!0}}function fu(n,t,e,i){let s=n._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value,a,c;for(a=o;a<=r;a=+s.add(a,1,i))c=e[a],c>=0&&(t[c].major=!0);return t}function Or(n,t,e){let i=[],s={},o=t.length,r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;e=rt(e,0,r),i=rt(i,0,r),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||vr(o.minUnit,e,i,this._getLabelCapacity(e)),a=R(s.ticks.stepSize,1),c=r==="week"?o.isoWeekday:!1,l=se(c)||c===!0,h={},u=e,d,f;if(l&&(u=+t.startOf(u,"isoWeek",c)),u=+t.startOf(u,l?"day":r),t.diff(i,e,r)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+r);let m=s.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;d+p)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,i,s){let o=this.options,r=o.ticks.callback;if(r)return z(r,[t,e,i],this);let a=o.time.displayFormats,c=this._unit,l=this._majorUnit,h=c&&a[c],u=l&&a[l],d=i[e],f=l&&u&&d&&d.major;return this._adapter.format(t,s||(f?u:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ct(n,"pos",t)),{pos:o,time:a}=n[i],{pos:r,time:c}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ct(n,"time",t)),{time:o,pos:a}=n[i],{time:r,pos:c}=n[s]);let l=r-o;return l?a+(c-a)*(t-o)/l:a}var Sr=class extends de{static id="timeseries";static defaults=de.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=Pn(e,this.min),this._tableRange=Pn(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,s=[],o=[],r,a,c,l,h;for(r=0,a=t.length;r=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,a=s.length;rs-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(Pn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Pn(this._table,i*this._tableRange+this._minPos,!0)}};function x(n){let t=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&t==="[object Date]"?new n.constructor(+n):typeof n=="number"||t==="[object Number]"||typeof n=="string"||t==="[object String]"?new Date(n):new Date(NaN)}function O(n,t){return n instanceof Date?new n.constructor(t):new Date(t)}function Et(n,t){let e=x(n);return isNaN(t)?O(n,NaN):(t&&e.setDate(e.getDate()+t),e)}function fe(n,t){let e=x(n);if(isNaN(t))return O(n,NaN);if(!t)return e;let i=e.getDate(),s=O(n,e.getTime());s.setMonth(e.getMonth()+t+1,0);let o=s.getDate();return i>=o?s:(e.setFullYear(s.getFullYear(),s.getMonth(),i),e)}function Rt(n,t){let e=+x(n);return O(n,e+t)}var pu=Math.pow(10,8)*24*60*60*1e3,qd=-pu,Wn=6048e5,$r=864e5,kt=6e4,Dt=36e5,Xr=1e3;var gu=3600;var Ur=gu*24,$d=Ur*7,mu=Ur*365.2425,bu=mu/12,Xd=bu*3;function Qr(n,t){return Rt(n,t*Dt)}var xu={};function et(){return xu}function Q(n,t){let e=et(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??e.weekStartsOn??e.locale?.options?.weekStartsOn??0,s=x(n),o=s.getDay(),r=(o=s.getTime()?e+1:t.getTime()>=r.getTime()?e:e-1}function qe(n){let t=x(n);return t.setHours(0,0,0,0),t}function Xt(n){let t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),n.getTime()-t.getTime()}function Bn(n,t){let e=qe(n),i=qe(t),s=e.getTime()-Xt(e),o=i.getTime()-Xt(i);return Math.round((s-o)/$r)}function Gr(n){let t=zn(n),e=O(n,0);return e.setFullYear(t,0,4),e.setHours(0,0,0,0),ht(e)}function Kr(n,t){return Rt(n,t*kt)}function Zr(n,t){let e=t*3;return fe(n,e)}function Jr(n,t){return Rt(n,t*1e3)}function ta(n,t){let e=t*7;return Et(n,e)}function ea(n,t){return fe(n,t*12)}function Ut(n,t){let e=x(n),i=x(t),s=e.getTime()-i.getTime();return s<0?-1:s>0?1:s}function na(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Hn(n){if(!na(n)&&typeof n!="number")return!1;let t=x(n);return!isNaN(Number(t))}function ia(n,t){let e=x(n),i=x(t),s=e.getFullYear()-i.getFullYear(),o=e.getMonth()-i.getMonth();return s*12+o}function sa(n,t){let e=x(n),i=x(t);return e.getFullYear()-i.getFullYear()}function Yn(n,t){let e=x(n),i=x(t),s=oa(e,i),o=Math.abs(Bn(e,i));e.setDate(e.getDate()-s*o);let r=+(oa(e,i)===-s),a=s*(o-r);return a===0?0:a}function oa(n,t){let e=n.getFullYear()-t.getFullYear()||n.getMonth()-t.getMonth()||n.getDate()-t.getDate()||n.getHours()-t.getHours()||n.getMinutes()-t.getMinutes()||n.getSeconds()-t.getSeconds()||n.getMilliseconds()-t.getMilliseconds();return e<0?-1:e>0?1:e}function Ft(n,t){return x(n).getTime()-x(t).getTime()}function mt(n){return n?Math[n]:Math.trunc}function ra(n,t,e){let i=Ft(n,t)/Dt;return mt(e?.roundingMethod)(i)}function aa(n,t,e){let i=Ft(n,t)/kt;return mt(e?.roundingMethod)(i)}function Vn(n){let t=x(n);return t.setHours(23,59,59,999),t}function jn(n){let t=x(n),e=t.getMonth();return t.setFullYear(t.getFullYear(),e+1,0),t.setHours(23,59,59,999),t}function ca(n){let t=x(n);return+Vn(t)==+jn(t)}function qn(n,t){let e=x(n),i=x(t),s=Ut(e,i),o=Math.abs(ia(e,i)),r;if(o<1)r=0;else{e.getMonth()===1&&e.getDate()>27&&e.setDate(30),e.setMonth(e.getMonth()-s*o);let a=Ut(e,i)===-s;ca(x(n))&&o===1&&Ut(n,i)===1&&(a=!1),r=s*(o-Number(a))}return r===0?0:r}function la(n,t,e){let i=qn(n,t)/3;return mt(e?.roundingMethod)(i)}function ha(n,t,e){let i=Ft(n,t)/1e3;return mt(e?.roundingMethod)(i)}function ua(n,t,e){let i=Yn(n,t)/7;return mt(e?.roundingMethod)(i)}function da(n,t){let e=x(n),i=x(t),s=Ut(e,i),o=Math.abs(sa(e,i));e.setFullYear(1584),i.setFullYear(1584);let r=Ut(e,i)===-s,a=s*(o-+r);return a===0?0:a}function fa(n){let t=x(n);return t.setSeconds(0,0),t}function pa(n){let t=x(n),e=t.getMonth(),i=e-e%3;return t.setMonth(i,1),t.setHours(0,0,0,0),t}function ga(n){let t=x(n);return t.setDate(1),t.setHours(0,0,0,0),t}function ma(n){let t=x(n),e=t.getFullYear();return t.setFullYear(e+1,0,0),t.setHours(23,59,59,999),t}function $n(n){let t=x(n),e=O(n,0);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}function ba(n){let t=x(n);return t.setMinutes(59,59,999),t}function xa(n,t){let e=et(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??e.weekStartsOn??e.locale?.options?.weekStartsOn??0,s=x(n),o=s.getDay(),r=(o{let i,s=yu[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e?.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function Xn(n){return(t={})=>{let e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}var _u={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wu={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Mu={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ka={date:Xn({formats:_u,defaultWidth:"full"}),time:Xn({formats:wu,defaultWidth:"full"}),dateTime:Xn({formats:Mu,defaultWidth:"full"})};var ku={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Da=(n,t,e,i)=>ku[n];function pe(n){return(t,e)=>{let i=e?.context?String(e.context):"standalone",s;if(i==="formatting"&&n.formattingValues){let r=n.defaultFormattingWidth||n.defaultWidth,a=e?.width?String(e.width):r;s=n.formattingValues[a]||n.formattingValues[r]}else{let r=n.defaultWidth,a=e?.width?String(e.width):n.defaultWidth;s=n.values[a]||n.values[r]}let o=n.argumentCallback?n.argumentCallback(t):t;return s[o]}}var Du={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},vu={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Pu={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ou={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Su={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Tu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Cu=(n,t)=>{let e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},va={ordinalNumber:Cu,era:pe({values:Du,defaultWidth:"wide"}),quarter:pe({values:vu,defaultWidth:"wide",argumentCallback:n=>n-1}),month:pe({values:Pu,defaultWidth:"wide"}),day:pe({values:Ou,defaultWidth:"wide"}),dayPeriod:pe({values:Su,defaultWidth:"wide",formattingValues:Tu,defaultFormattingWidth:"wide"})};function ge(n){return(t,e={})=>{let i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],o=t.match(s);if(!o)return null;let r=o[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(a)?Lu(a,u=>u.test(r)):Au(a,u=>u.test(r)),l;l=n.valueCallback?n.valueCallback(c):c,l=e.valueCallback?e.valueCallback(l):l;let h=t.slice(r.length);return{value:l,rest:h}}}function Au(n,t){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function Lu(n,t){for(let e=0;e{let i=t.match(n.matchPattern);if(!i)return null;let s=i[0],o=t.match(n.parsePattern);if(!o)return null;let r=n.valueCallback?n.valueCallback(o[0]):o[0];r=e.valueCallback?e.valueCallback(r):r;let a=t.slice(s.length);return{value:r,rest:a}}}var Iu=/^(\d+)(th|st|nd|rd)?/i,Eu=/\d+/i,Ru={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Fu={any:[/^b/i,/^(a|c)/i]},Nu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Wu={any:[/1/i,/2/i,/3/i,/4/i]},zu={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Bu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Hu={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yu={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Vu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ju={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Oa={ordinalNumber:Pa({matchPattern:Iu,parsePattern:Eu,valueCallback:n=>parseInt(n,10)}),era:ge({matchPatterns:Ru,defaultMatchWidth:"wide",parsePatterns:Fu,defaultParseWidth:"any"}),quarter:ge({matchPatterns:Nu,defaultMatchWidth:"wide",parsePatterns:Wu,defaultParseWidth:"any",valueCallback:n=>n+1}),month:ge({matchPatterns:zu,defaultMatchWidth:"wide",parsePatterns:Bu,defaultParseWidth:"any"}),day:ge({matchPatterns:Hu,defaultMatchWidth:"wide",parsePatterns:Yu,defaultParseWidth:"any"}),dayPeriod:ge({matchPatterns:Vu,defaultMatchWidth:"any",parsePatterns:ju,defaultParseWidth:"any"})};var $e={code:"en-US",formatDistance:Ma,formatLong:ka,formatRelative:Da,localize:va,match:Oa,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Sa(n){let t=x(n);return Bn(t,$n(t))+1}function Un(n){let t=x(n),e=ht(t).getTime()-Gr(t).getTime();return Math.round(e/Wn)+1}function me(n,t){let e=x(n),i=e.getFullYear(),s=et(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,r=O(n,0);r.setFullYear(i+1,0,o),r.setHours(0,0,0,0);let a=Q(r,t),c=O(n,0);c.setFullYear(i,0,o),c.setHours(0,0,0,0);let l=Q(c,t);return e.getTime()>=a.getTime()?i+1:e.getTime()>=l.getTime()?i:i-1}function Ta(n,t){let e=et(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??e.firstWeekContainsDate??e.locale?.options?.firstWeekContainsDate??1,s=me(n,t),o=O(n,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),Q(o,t)}function Qn(n,t){let e=x(n),i=Q(e,t).getTime()-Ta(e,t).getTime();return Math.round(i/Wn)+1}function I(n,t){let e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}var vt={y(n,t){let e=n.getFullYear(),i=e>0?e:1-e;return I(t==="yy"?i%100:i,t.length)},M(n,t){let e=n.getMonth();return t==="M"?String(e+1):I(e+1,2)},d(n,t){return I(n.getDate(),t.length)},a(n,t){let e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return I(n.getHours()%12||12,t.length)},H(n,t){return I(n.getHours(),t.length)},m(n,t){return I(n.getMinutes(),t.length)},s(n,t){return I(n.getSeconds(),t.length)},S(n,t){let e=t.length,i=n.getMilliseconds(),s=Math.floor(i*Math.pow(10,e-3));return I(s,t.length)}};var be={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},La={G:function(n,t,e){let i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){let i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return vt.y(n,t)},Y:function(n,t,e,i){let s=me(n,i),o=s>0?s:1-s;if(t==="YY"){let r=o%100;return I(r,2)}return t==="Yo"?e.ordinalNumber(o,{unit:"year"}):I(o,t.length)},R:function(n,t){let e=zn(n);return I(e,t.length)},u:function(n,t){let e=n.getFullYear();return I(e,t.length)},Q:function(n,t,e){let i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return I(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){let i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return I(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){let i=n.getMonth();switch(t){case"M":case"MM":return vt.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){let i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return I(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){let s=Qn(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):I(s,t.length)},I:function(n,t,e){let i=Un(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):I(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):vt.d(n,t)},D:function(n,t,e){let i=Sa(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):I(i,t.length)},E:function(n,t,e){let i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){let s=n.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return I(o,2);case"eo":return e.ordinalNumber(o,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){let s=n.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return I(o,t.length);case"co":return e.ordinalNumber(o,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){let i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return I(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){let s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,e){let i=n.getHours(),s;switch(i===12?s=be.noon:i===0?s=be.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){let i=n.getHours(),s;switch(i>=17?s=be.evening:i>=12?s=be.afternoon:i>=4?s=be.morning:s=be.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return vt.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):vt.H(n,t)},K:function(n,t,e){let i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):I(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):I(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):vt.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):vt.s(n,t)},S:function(n,t){return vt.S(n,t)},X:function(n,t,e,i){let o=(i._originalDate||n).getTimezoneOffset();if(o===0)return"Z";switch(t){case"X":return Aa(o);case"XXXX":case"XX":return Qt(o);case"XXXXX":case"XXX":default:return Qt(o,":")}},x:function(n,t,e,i){let o=(i._originalDate||n).getTimezoneOffset();switch(t){case"x":return Aa(o);case"xxxx":case"xx":return Qt(o);case"xxxxx":case"xxx":default:return Qt(o,":")}},O:function(n,t,e,i){let o=(i._originalDate||n).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ca(o,":");case"OOOO":default:return"GMT"+Qt(o,":")}},z:function(n,t,e,i){let o=(i._originalDate||n).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ca(o,":");case"zzzz":default:return"GMT"+Qt(o,":")}},t:function(n,t,e,i){let s=i._originalDate||n,o=Math.floor(s.getTime()/1e3);return I(o,t.length)},T:function(n,t,e,i){let o=(i._originalDate||n).getTime();return I(o,t.length)}};function Ca(n,t=""){let e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),o=i%60;return o===0?e+String(s):e+String(s)+t+I(o,2)}function Aa(n,t){return n%60===0?(n>0?"-":"+")+I(Math.abs(n)/60,2):Qt(n,t)}function Qt(n,t=""){let e=n>0?"-":"+",i=Math.abs(n),s=I(Math.floor(i/60),2),o=I(i%60,2);return e+s+t+o}var Ia=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Ea=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},qu=(n,t)=>{let e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return Ia(n,t);let o;switch(i){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Ia(i,t)).replace("{{time}}",Ea(s,t))},Xe={p:Ea,P:qu};var $u=/^D+$/,Xu=/^Y+$/,Uu=["D","DD","YY","YYYY"];function Gn(n){return $u.test(n)}function Kn(n){return Xu.test(n)}function xe(n,t,e){let i=Qu(n,t,e);if(console.warn(i),Uu.includes(n))throw new RangeError(i)}function Qu(n,t,e){let i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Gu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ku=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zu=/^'([^]*?)'?$/,Ju=/''/g,td=/[a-zA-Z]/;function Ra(n,t,e){let i=et(),s=e?.locale??i.locale??$e,o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,a=x(n);if(!Hn(a))throw new RangeError("Invalid time value");let c={firstWeekContainsDate:o,weekStartsOn:r,locale:s,_originalDate:a};return t.match(Ku).map(function(h){let u=h[0];if(u==="p"||u==="P"){let d=Xe[u];return d(h,s.formatLong)}return h}).join("").match(Gu).map(function(h){if(h==="''")return"'";let u=h[0];if(u==="'")return ed(h);let d=La[u];if(d)return!e?.useAdditionalWeekYearTokens&&Kn(h)&&xe(h,t,String(n)),!e?.useAdditionalDayOfYearTokens&&Gn(h)&&xe(h,t,String(n)),d(a,h,s.localize,c);if(u.match(td))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return h}).join("")}function ed(n){let t=n.match(Zu);return t?t[1].replace(Ju,"'"):n}function Fa(){return Object.assign({},et())}function Na(n){let e=x(n).getDay();return e===0&&(e=7),e}function Wa(n,t){let e=t instanceof Date?O(t,0):new t(0);return e.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),e.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),e}var nd=10,Zn=class{subPriority=0;validate(t,e){return!0}},Jn=class extends Zn{constructor(t,e,i,s,o){super(),this.value=t,this.validateValue=e,this.setValue=i,this.priority=s,o&&(this.subPriority=o)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,i){return this.setValue(t,e,this.value,i)}},ti=class extends Zn{priority=nd;subPriority=-1;set(t,e){return e.timestampIsSet?t:O(t,Wa(t,Date))}};var k=class{run(t,e,i,s){let o=this.parse(t,e,i,s);return o?{setter:new Jn(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,e,i){return!0}};var ei=class extends k{priority=140;parse(t,e,i){switch(e){case"G":case"GG":case"GGG":return i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"});case"GGGGG":return i.era(t,{width:"narrow"});case"GGGG":default:return i.era(t,{width:"wide"})||i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"})}}set(t,e,i){return e.era=i,t.setFullYear(i,0,1),t.setHours(0,0,0,0),t}incompatibleTokens=["R","u","t","T"]};var A={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},ct={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function F(n,t){return n&&{value:t(n.value),rest:n.rest}}function T(n,t){let e=t.match(n);return e?{value:parseInt(e[0],10),rest:t.slice(e[0].length)}:null}function lt(n,t){let e=t.match(n);if(!e)return null;if(e[0]==="Z")return{value:0,rest:t.slice(1)};let i=e[1]==="+"?1:-1,s=e[2]?parseInt(e[2],10):0,o=e[3]?parseInt(e[3],10):0,r=e[5]?parseInt(e[5],10):0;return{value:i*(s*Dt+o*kt+r*Xr),rest:t.slice(e[0].length)}}function ni(n){return T(A.anyDigitsSigned,n)}function P(n,t){switch(n){case 1:return T(A.singleDigit,t);case 2:return T(A.twoDigits,t);case 3:return T(A.threeDigits,t);case 4:return T(A.fourDigits,t);default:return T(new RegExp("^\\d{1,"+n+"}"),t)}}function ye(n,t){switch(n){case 1:return T(A.singleDigitSigned,t);case 2:return T(A.twoDigitsSigned,t);case 3:return T(A.threeDigitsSigned,t);case 4:return T(A.fourDigitsSigned,t);default:return T(new RegExp("^-?\\d{1,"+n+"}"),t)}}function _e(n){switch(n){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function ii(n,t){let e=t>0,i=e?t:1-t,s;if(i<=50)s=n||100;else{let o=i+50,r=Math.floor(o/100)*100,a=n>=o%100;s=n+r-(a?100:0)}return e?s:1-s}function si(n){return n%400===0||n%4===0&&n%100!==0}var oi=class extends k{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(t,e,i){let s=o=>({year:o,isTwoDigitYear:e==="yy"});switch(e){case"y":return F(P(4,t),s);case"yo":return F(i.ordinalNumber(t,{unit:"year"}),s);default:return F(P(e.length,t),s)}}validate(t,e){return e.isTwoDigitYear||e.year>0}set(t,e,i){let s=t.getFullYear();if(i.isTwoDigitYear){let r=ii(i.year,s);return t.setFullYear(r,0,1),t.setHours(0,0,0,0),t}let o=!("era"in e)||e.era===1?i.year:1-i.year;return t.setFullYear(o,0,1),t.setHours(0,0,0,0),t}};var ri=class extends k{priority=130;parse(t,e,i){let s=o=>({year:o,isTwoDigitYear:e==="YY"});switch(e){case"Y":return F(P(4,t),s);case"Yo":return F(i.ordinalNumber(t,{unit:"year"}),s);default:return F(P(e.length,t),s)}}validate(t,e){return e.isTwoDigitYear||e.year>0}set(t,e,i,s){let o=me(t,s);if(i.isTwoDigitYear){let a=ii(i.year,o);return t.setFullYear(a,0,s.firstWeekContainsDate),t.setHours(0,0,0,0),Q(t,s)}let r=!("era"in e)||e.era===1?i.year:1-i.year;return t.setFullYear(r,0,s.firstWeekContainsDate),t.setHours(0,0,0,0),Q(t,s)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]};var ai=class extends k{priority=130;parse(t,e){return e==="R"?ye(4,t):ye(e.length,t)}set(t,e,i){let s=O(t,0);return s.setFullYear(i,0,4),s.setHours(0,0,0,0),ht(s)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]};var ci=class extends k{priority=130;parse(t,e){return e==="u"?ye(4,t):ye(e.length,t)}set(t,e,i){return t.setFullYear(i,0,1),t.setHours(0,0,0,0),t}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]};var li=class extends k{priority=120;parse(t,e,i){switch(e){case"Q":case"QQ":return P(e.length,t);case"Qo":return i.ordinalNumber(t,{unit:"quarter"});case"QQQ":return i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(t,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(t,{width:"wide",context:"formatting"})||i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"})}}validate(t,e){return e>=1&&e<=4}set(t,e,i){return t.setMonth((i-1)*3,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]};var hi=class extends k{priority=120;parse(t,e,i){switch(e){case"q":case"qq":return P(e.length,t);case"qo":return i.ordinalNumber(t,{unit:"quarter"});case"qqq":return i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(t,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(t,{width:"wide",context:"standalone"})||i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"})}}validate(t,e){return e>=1&&e<=4}set(t,e,i){return t.setMonth((i-1)*3,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]};var ui=class extends k{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(t,e,i){let s=o=>o-1;switch(e){case"M":return F(T(A.month,t),s);case"MM":return F(P(2,t),s);case"Mo":return F(i.ordinalNumber(t,{unit:"month"}),s);case"MMM":return i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(t,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(t,{width:"wide",context:"formatting"})||i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"})}}validate(t,e){return e>=0&&e<=11}set(t,e,i){return t.setMonth(i,1),t.setHours(0,0,0,0),t}};var di=class extends k{priority=110;parse(t,e,i){let s=o=>o-1;switch(e){case"L":return F(T(A.month,t),s);case"LL":return F(P(2,t),s);case"Lo":return F(i.ordinalNumber(t,{unit:"month"}),s);case"LLL":return i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(t,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(t,{width:"wide",context:"standalone"})||i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"})}}validate(t,e){return e>=0&&e<=11}set(t,e,i){return t.setMonth(i,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]};function za(n,t,e){let i=x(n),s=Qn(i,e)-t;return i.setDate(i.getDate()-s*7),i}var fi=class extends k{priority=100;parse(t,e,i){switch(e){case"w":return T(A.week,t);case"wo":return i.ordinalNumber(t,{unit:"week"});default:return P(e.length,t)}}validate(t,e){return e>=1&&e<=53}set(t,e,i,s){return Q(za(t,i,s),s)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]};function Ba(n,t){let e=x(n),i=Un(e)-t;return e.setDate(e.getDate()-i*7),e}var pi=class extends k{priority=100;parse(t,e,i){switch(e){case"I":return T(A.week,t);case"Io":return i.ordinalNumber(t,{unit:"week"});default:return P(e.length,t)}}validate(t,e){return e>=1&&e<=53}set(t,e,i){return ht(Ba(t,i))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]};var id=[31,28,31,30,31,30,31,31,30,31,30,31],sd=[31,29,31,30,31,30,31,31,30,31,30,31],gi=class extends k{priority=90;subPriority=1;parse(t,e,i){switch(e){case"d":return T(A.date,t);case"do":return i.ordinalNumber(t,{unit:"date"});default:return P(e.length,t)}}validate(t,e){let i=t.getFullYear(),s=si(i),o=t.getMonth();return s?e>=1&&e<=sd[o]:e>=1&&e<=id[o]}set(t,e,i){return t.setDate(i),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]};var mi=class extends k{priority=90;subpriority=1;parse(t,e,i){switch(e){case"D":case"DD":return T(A.dayOfYear,t);case"Do":return i.ordinalNumber(t,{unit:"date"});default:return P(e.length,t)}}validate(t,e){let i=t.getFullYear();return si(i)?e>=1&&e<=366:e>=1&&e<=365}set(t,e,i){return t.setMonth(0,i),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]};function we(n,t,e){let i=et(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,o=x(n),r=o.getDay(),c=(t%7+7)%7,l=7-s,h=t<0||t>6?t-(r+l)%7:(c+l)%7-(r+l)%7;return Et(o,h)}var bi=class extends k{priority=90;parse(t,e,i){switch(e){case"E":case"EE":case"EEE":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}}validate(t,e){return e>=0&&e<=6}set(t,e,i,s){return t=we(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["D","i","e","c","t","T"]};var xi=class extends k{priority=90;parse(t,e,i,s){let o=r=>{let a=Math.floor((r-1)/7)*7;return(r+s.weekStartsOn+6)%7+a};switch(e){case"e":case"ee":return F(P(e.length,t),o);case"eo":return F(i.ordinalNumber(t,{unit:"day"}),o);case"eee":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"eeeee":return i.day(t,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}}validate(t,e){return e>=0&&e<=6}set(t,e,i,s){return t=we(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]};var yi=class extends k{priority=90;parse(t,e,i,s){let o=r=>{let a=Math.floor((r-1)/7)*7;return(r+s.weekStartsOn+6)%7+a};switch(e){case"c":case"cc":return F(P(e.length,t),o);case"co":return F(i.ordinalNumber(t,{unit:"day"}),o);case"ccc":return i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});case"ccccc":return i.day(t,{width:"narrow",context:"standalone"});case"cccccc":return i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(t,{width:"wide",context:"standalone"})||i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"})}}validate(t,e){return e>=0&&e<=6}set(t,e,i,s){return t=we(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]};function Ha(n,t){let e=x(n),i=Na(e),s=t-i;return Et(e,s)}var _i=class extends k{priority=90;parse(t,e,i){let s=o=>o===0?7:o;switch(e){case"i":case"ii":return P(e.length,t);case"io":return i.ordinalNumber(t,{unit:"day"});case"iii":return F(i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s);case"iiiii":return F(i.day(t,{width:"narrow",context:"formatting"}),s);case"iiiiii":return F(i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s);case"iiii":default:return F(i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s)}}validate(t,e){return e>=1&&e<=7}set(t,e,i){return t=Ha(t,i),t.setHours(0,0,0,0),t}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]};var wi=class extends k{priority=80;parse(t,e,i){switch(e){case"a":case"aa":case"aaa":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,i){return t.setHours(_e(i),0,0,0),t}incompatibleTokens=["b","B","H","k","t","T"]};var Mi=class extends k{priority=80;parse(t,e,i){switch(e){case"b":case"bb":case"bbb":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,i){return t.setHours(_e(i),0,0,0),t}incompatibleTokens=["a","B","H","k","t","T"]};var ki=class extends k{priority=80;parse(t,e,i){switch(e){case"B":case"BB":case"BBB":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,i){return t.setHours(_e(i),0,0,0),t}incompatibleTokens=["a","b","t","T"]};var Di=class extends k{priority=70;parse(t,e,i){switch(e){case"h":return T(A.hour12h,t);case"ho":return i.ordinalNumber(t,{unit:"hour"});default:return P(e.length,t)}}validate(t,e){return e>=1&&e<=12}set(t,e,i){let s=t.getHours()>=12;return s&&i<12?t.setHours(i+12,0,0,0):!s&&i===12?t.setHours(0,0,0,0):t.setHours(i,0,0,0),t}incompatibleTokens=["H","K","k","t","T"]};var vi=class extends k{priority=70;parse(t,e,i){switch(e){case"H":return T(A.hour23h,t);case"Ho":return i.ordinalNumber(t,{unit:"hour"});default:return P(e.length,t)}}validate(t,e){return e>=0&&e<=23}set(t,e,i){return t.setHours(i,0,0,0),t}incompatibleTokens=["a","b","h","K","k","t","T"]};var Pi=class extends k{priority=70;parse(t,e,i){switch(e){case"K":return T(A.hour11h,t);case"Ko":return i.ordinalNumber(t,{unit:"hour"});default:return P(e.length,t)}}validate(t,e){return e>=0&&e<=11}set(t,e,i){return t.getHours()>=12&&i<12?t.setHours(i+12,0,0,0):t.setHours(i,0,0,0),t}incompatibleTokens=["h","H","k","t","T"]};var Oi=class extends k{priority=70;parse(t,e,i){switch(e){case"k":return T(A.hour24h,t);case"ko":return i.ordinalNumber(t,{unit:"hour"});default:return P(e.length,t)}}validate(t,e){return e>=1&&e<=24}set(t,e,i){let s=i<=24?i%24:i;return t.setHours(s,0,0,0),t}incompatibleTokens=["a","b","h","H","K","t","T"]};var Si=class extends k{priority=60;parse(t,e,i){switch(e){case"m":return T(A.minute,t);case"mo":return i.ordinalNumber(t,{unit:"minute"});default:return P(e.length,t)}}validate(t,e){return e>=0&&e<=59}set(t,e,i){return t.setMinutes(i,0,0),t}incompatibleTokens=["t","T"]};var Ti=class extends k{priority=50;parse(t,e,i){switch(e){case"s":return T(A.second,t);case"so":return i.ordinalNumber(t,{unit:"second"});default:return P(e.length,t)}}validate(t,e){return e>=0&&e<=59}set(t,e,i){return t.setSeconds(i,0),t}incompatibleTokens=["t","T"]};var Ci=class extends k{priority=30;parse(t,e){let i=s=>Math.floor(s*Math.pow(10,-e.length+3));return F(P(e.length,t),i)}set(t,e,i){return t.setMilliseconds(i),t}incompatibleTokens=["t","T"]};var Ai=class extends k{priority=10;parse(t,e){switch(e){case"X":return lt(ct.basicOptionalMinutes,t);case"XX":return lt(ct.basic,t);case"XXXX":return lt(ct.basicOptionalSeconds,t);case"XXXXX":return lt(ct.extendedOptionalSeconds,t);case"XXX":default:return lt(ct.extended,t)}}set(t,e,i){return e.timestampIsSet?t:O(t,t.getTime()-Xt(t)-i)}incompatibleTokens=["t","T","x"]};var Li=class extends k{priority=10;parse(t,e){switch(e){case"x":return lt(ct.basicOptionalMinutes,t);case"xx":return lt(ct.basic,t);case"xxxx":return lt(ct.basicOptionalSeconds,t);case"xxxxx":return lt(ct.extendedOptionalSeconds,t);case"xxx":default:return lt(ct.extended,t)}}set(t,e,i){return e.timestampIsSet?t:O(t,t.getTime()-Xt(t)-i)}incompatibleTokens=["t","T","X"]};var Ii=class extends k{priority=40;parse(t){return ni(t)}set(t,e,i){return[O(t,i*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"};var Ei=class extends k{priority=20;parse(t){return ni(t)}set(t,e,i){return[O(t,i),{timestampIsSet:!0}]}incompatibleTokens="*"};var Ya={G:new ei,y:new oi,Y:new ri,R:new ai,u:new ci,Q:new li,q:new hi,M:new ui,L:new di,w:new fi,I:new pi,d:new gi,D:new mi,E:new bi,e:new xi,c:new yi,i:new _i,a:new wi,b:new Mi,B:new ki,h:new Di,H:new vi,K:new Pi,k:new Oi,m:new Si,s:new Ti,S:new Ci,X:new Ai,x:new Li,t:new Ii,T:new Ei};var od=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,rd=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ad=/^'([^]*?)'?$/,cd=/''/g,ld=/\S/,hd=/[a-zA-Z]/;function Va(n,t,e,i){let s=Fa(),o=i?.locale??s.locale??$e,r=i?.firstWeekContainsDate??i?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=i?.weekStartsOn??i?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0;if(t==="")return n===""?x(e):O(e,NaN);let c={firstWeekContainsDate:r,weekStartsOn:a,locale:o},l=[new ti],h=t.match(rd).map(p=>{let g=p[0];if(g in Xe){let b=Xe[g];return b(p,o.formatLong)}return p}).join("").match(od),u=[];for(let p of h){!i?.useAdditionalWeekYearTokens&&Kn(p)&&xe(p,t,n),!i?.useAdditionalDayOfYearTokens&&Gn(p)&&xe(p,t,n);let g=p[0],b=Ya[g];if(b){let{incompatibleTokens:_}=b;if(Array.isArray(_)){let M=u.find(y=>_.includes(y.token)||y.token===g);if(M)throw new RangeError(`The format string mustn't contain \`${M.fullToken}\` and \`${p}\` at the same time`)}else if(b.incompatibleTokens==="*"&&u.length>0)throw new RangeError(`The format string mustn't contain \`${p}\` and any other token at the same time`);u.push({token:g,fullToken:p});let w=b.run(n,p,o.match,c);if(!w)return O(e,NaN);l.push(w.setter),n=w.rest}else{if(g.match(hd))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");if(p==="''"?p="'":g==="'"&&(p=ud(p)),n.indexOf(p)===0)n=n.slice(p.length);else return O(e,NaN)}}if(n.length>0&&ld.test(n))return O(e,NaN);let d=l.map(p=>p.priority).sort((p,g)=>g-p).filter((p,g,b)=>b.indexOf(p)===g).map(p=>l.filter(g=>g.priority===p).sort((g,b)=>b.subPriority-g.subPriority)).map(p=>p[0]),f=x(e);if(isNaN(f.getTime()))return O(e,NaN);let m={};for(let p of d){if(!p.validate(f,c))return O(e,NaN);let g=p.set(f,m,c);Array.isArray(g)?(f=g[0],Object.assign(m,g[1])):f=g}return O(e,f)}function ud(n){return n.match(ad)[1].replace(cd,"'")}function ja(n){let t=x(n);return t.setMinutes(0,0,0),t}function qa(n){let t=x(n);return t.setMilliseconds(0),t}function $a(n,t){let e=t?.additionalDigits??2,i=gd(n),s;if(i.date){let c=md(i.date,e);s=bd(c.restDateString,c.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);let o=s.getTime(),r=0,a;if(i.time&&(r=xd(i.time),isNaN(r)))return new Date(NaN);if(i.timezone){if(a=yd(i.timezone),isNaN(a))return new Date(NaN)}else{let c=new Date(o+r),l=new Date(0);return l.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),l.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),l}return new Date(o+r+a)}var Ri={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},dd=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,fd=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,pd=/^([+-])(\d{2})(?::?(\d{2}))?$/;function gd(n){let t={},e=n.split(Ri.dateTimeDelimiter),i;if(e.length>2)return t;if(/:/.test(e[0])?i=e[0]:(t.date=e[0],i=e[1],Ri.timeZoneDelimiter.test(t.date)&&(t.date=n.split(Ri.timeZoneDelimiter)[0],i=n.substr(t.date.length,n.length))),i){let s=Ri.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function md(n,t){let e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=n.match(e);if(!i)return{year:NaN,restDateString:""};let s=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:o===null?s:o*100,restDateString:n.slice((i[1]||i[2]).length)}}function bd(n,t){if(t===null)return new Date(NaN);let e=n.match(dd);if(!e)return new Date(NaN);let i=!!e[4],s=Ue(e[1]),o=Ue(e[2])-1,r=Ue(e[3]),a=Ue(e[4]),c=Ue(e[5])-1;if(i)return Dd(t,a,c)?_d(t,a,c):new Date(NaN);{let l=new Date(0);return!Md(t,o,r)||!kd(t,s)?new Date(NaN):(l.setUTCFullYear(t,o,Math.max(s,r)),l)}}function Ue(n){return n?parseInt(n):1}function xd(n){let t=n.match(fd);if(!t)return NaN;let e=As(t[1]),i=As(t[2]),s=As(t[3]);return vd(e,i,s)?e*Dt+i*kt+s*1e3:NaN}function As(n){return n&&parseFloat(n.replace(",","."))||0}function yd(n){if(n==="Z")return 0;let t=n.match(pd);if(!t)return 0;let e=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return Pd(i,s)?e*(i*Dt+s*kt):NaN}function _d(n,t,e){let i=new Date(0);i.setUTCFullYear(n,0,4);let s=i.getUTCDay()||7,o=(t-1)*7+e+1-s;return i.setUTCDate(i.getUTCDate()+o),i}var wd=[31,null,31,30,31,30,31,31,30,31,30,31];function Xa(n){return n%400===0||n%4===0&&n%100!==0}function Md(n,t,e){return t>=0&&t<=11&&e>=1&&e<=(wd[t]||(Xa(n)?29:28))}function kd(n,t){return t>=1&&t<=(Xa(n)?366:365)}function Dd(n,t,e){return t>=1&&t<=53&&e>=0&&e<=6}function vd(n,t,e){return n===24?t===0&&e===0:e>=0&&e<60&&t>=0&&t<60&&n>=0&&n<25}function Pd(n,t){return t>=0&&t<=59}var Od={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Cs._date.override({_id:"date-fns",formats:function(){return Od},parse:function(n,t){if(n===null||typeof n>"u")return null;let e=typeof n;return e==="number"||n instanceof Date?n=x(n):e==="string"&&(typeof t=="string"?n=Va(n,t,new Date,this.options):n=$a(n,this.options)),Hn(n)?n.getTime():null},format:function(n,t){return Ra(n,t,this.options)},add:function(n,t,e){switch(e){case"millisecond":return Rt(n,t);case"second":return Jr(n,t);case"minute":return Kr(n,t);case"hour":return Qr(n,t);case"day":return Et(n,t);case"week":return ta(n,t);case"month":return fe(n,t);case"quarter":return Zr(n,t);case"year":return ea(n,t);default:return n}},diff:function(n,t,e){switch(e){case"millisecond":return Ft(n,t);case"second":return ha(n,t);case"minute":return aa(n,t);case"hour":return ra(n,t);case"day":return Yn(n,t);case"week":return ua(n,t);case"month":return qn(n,t);case"quarter":return la(n,t);case"year":return da(n,t);default:return 0}},startOf:function(n,t,e){switch(t){case"second":return qa(n);case"minute":return fa(n);case"hour":return ja(n);case"day":return qe(n);case"week":return Q(n);case"isoWeek":return Q(n,{weekStartsOn:+e});case"month":return ga(n);case"quarter":return pa(n);case"year":return $n(n);default:return n}},endOf:function(n,t){switch(t){case"second":return wa(n);case"minute":return ya(n);case"hour":return ba(n);case"day":return Vn(n);case"week":return xa(n);case"month":return jn(n);case"quarter":return _a(n);case"year":return ma(n);default:return n}}});he.register(Yr,Cn,In,Fn,En,de,jr);document.addEventListener("DOMContentLoaded",async()=>{let n=document.getElementById("chart"),e=`/phperkaigi/2024/golf/api/quizzes/${n.dataset.quizId}/chart.json`,i=await fetch(e).then(c=>c.json());if(i.error)return;let s=i.stats;for(let c of s){let l=[];for(let h of c.scores)(l.length===0||l[l.length-1].code_size>h.code_size)&&l.push(h);c.scores=l}let o=s.flatMap(c=>c.scores.map(l=>({...l,user:c.user}))).toSorted((c,l)=>c.submitted_at-l.submitted_at),r=(()=>{let c=[],l=new Map;for(let{user:h,submitted_at:u,code_size:d}of o){l.set(h.name,{user:h,submitted_at:u,code_size:d});let f=l.values().toArray().toSorted((p,g)=>p.code_size===g.code_size?p.submitted_at-g.submitted_at:p.code_size-g.code_size),m=new Map;for(let[p,{user:g,code_size:b}]of f.entries())m.set(g.name,{user:g,code_size:b,rank:p+1});c.push({submitted_at:u,scores:m})}return c})(),a=(()=>{let c=new Map;for(let{submitted_at:l,scores:h}of r)for(let[u,{user:d,code_size:f,rank:m}]of h.entries())c.has(u)||c.set(u,[]),c.get(u).push({user:d,code_size:f,rank:m,submitted_at:l});return c.values().toArray().toSorted((l,h)=>{let u=l[l.length-1].rank,d=h[h.length-1].rank;return u-d})})();new he(n,{type:"line",data:{datasets:a.map(c=>({label:`${c[0].user.name}${c[0].user.is_admin?" (staff)":""}`,data:c.map(l=>({x:l.submitted_at*1e3,y:l.rank,code_size:l.code_size}))}))},options:{scales:{x:{type:"time",time:{parsing:!1,display:!1,unit:"day",tooltipFormat:"yyyy-MM-dd HH:mm:ss",displayFormats:{day:"yyyy-MM-dd"}},title:{display:!0,text:"\u65E5\u6642"}},y:{title:{display:!0,text:"\u9806\u4F4D"},reverse:!0,min:1,offset:!0}},plugins:{tooltip:{callbacks:{label:c=>{let l=c.dataset.label,h=c.raw.code_size;return`${l} (${h} byte)`}}}}}})});})(); /*! Bundled license information: @kurkle/color/dist/color.esm.js: (*! * @kurkle/color v0.3.2 * https://github.com/kurkle/color#readme * (c) 2023 Jukka Kurkela * Released under the MIT License *) chart.js/dist/chunks/helpers.segment.js: (*! * Chart.js v4.4.1 * https://www.chartjs.org * (c) 2023 Chart.js Contributors * Released under the MIT License *) chart.js/dist/chart.js: (*! * Chart.js v4.4.1 * https://www.chartjs.org * (c) 2023 Chart.js Contributors * Released under the MIT License *) chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.esm.js: (*! * chartjs-adapter-date-fns v3.0.0 * https://www.chartjs.org * (c) 2022 chartjs-adapter-date-fns Contributors * Released under the MIT license *) */ //# sourceMappingURL=chart.js.map