UNPKG

homebridge-config-ui-x

Version:

A web based management, configuration and control platform for Homebridge.

5 lines • 220 kB
import{b as Fn,c as Ut,e as Bn,f as zn,h as zi,m as Vn,o as Nn,p as Wn,r as Hn}from"./chunk-YATM6BZO.js";import{a as In}from"./chunk-ORSKS7BY.js";import{e as En,m as Ln}from"./chunk-QCMOCU6Q.js";import{Ab as _n,Bb as Ai,Bc as An,Da as pn,Db as Ti,Eb as Ri,Fb as Ve,Gb as yn,Gc as Tn,Hb as vn,I as rn,Ib as wn,Jb as Mn,Kb as kn,Pb as Sn,Q as an,Qb as Cn,S as ln,Sb as Pn,Sc as Rn,Tb as Ei,W as cn,X as Ie,Xb as Ne,Y as hn,Ya as he,Zb as Lt,_ as dn,aa as Z,bb as gn,d as en,e as Le,ga as Ci,gc as Dn,ha as Pi,i as sn,ic as Li,jc as Ii,ka as un,kc as Fi,la as fn,lc as Bi,mb as Di,nb as mn,o as nn,oa as Et,ob as ze,pa as Fe,sb as Oi,v as on,wa as ce,xb as bn,xc as On,za as Be,zb as xn}from"./chunk-ZMC752RO.js";import{a as Re,b as Ee}from"./chunk-B4AJQJMI.js";function la(e,i){if(e&1&&(Mn(0,"span"),Fi(1),kn()),e&2){let t=Lt().$implicit,s=Lt();Ii(s.highlightClass),he(),Bi(t)}}function ca(e,i){if(e&1&&(Sn(0),Fi(1),Cn()),e&2){let t=Lt().$implicit;he(),Bi(t)}}function ha(e,i){if(e&1&&xn(0,la,2,3,"span",0)(1,ca,2,1,"ng-container"),e&2){let t=i.$index;_n(t%2!==0?0:1)}}var da=(e,i,t)=>({result:e,term:i,formatter:t});function ua(e,i){if(e&1&&wn(0,"ngb-highlight",2),e&2){let t=i.result,s=i.term,n=i.formatter;Ve("result",n(t))("term",s)}}function fa(e,i){}function pa(e,i){if(e&1){let t=Pn();yn(0,"button",3),Ne("mouseenter",function(){let n=Ci(t).$index,o=Lt();return Pi(o.markActive(n))})("click",function(){let n=Ci(t).$implicit,o=Lt();return Pi(o.select(n))}),Oi(1,fa,0,0,"ng-template",4),vn()}if(e&2){let t=i.$implicit,s=i.$index,n=Lt(),o=Dn(1);Li("active",s===n.activeIdx),Ve("id",n.id+"-"+s),he(),Ve("ngTemplateOutlet",n.resultTemplate||o)("ngTemplateOutletContext",An(5,da,t,n.term,n.formatter))}}var ga=(()=>{class e{constructor(){this.highlightClass="ngb-highlight",this.accentSensitive=!0}ngOnChanges(t){!this.accentSensitive&&!String.prototype.normalize&&(console.warn("The `accentSensitive` input in `ngb-highlight` cannot be set to `false` in a browser that does not implement the `String.normalize` function. You will have to include a polyfill in your application to use this feature in the current browser."),this.accentSensitive=!0);let s=Ut(this.result),n=Array.isArray(this.term)?this.term:[this.term],o=c=>this.accentSensitive?c:zi(c),r=n.map(c=>zn(o(Ut(c)))).filter(c=>c),a=this.accentSensitive?s:zi(s),l=r.length?a.split(new RegExp(`(${r.join("|")})`,"gmi")):[s];if(this.accentSensitive)this.parts=l;else{let c=0;this.parts=l.map(h=>s.substring(c,c+=h.length))}}static{this.\u0275fac=function(s){return new(s||e)}}static{this.\u0275cmp=Di({type:e,selectors:[["ngb-highlight"]],inputs:{highlightClass:"highlightClass",result:"result",term:"term",accentSensitive:"accentSensitive"},features:[ce],decls:2,vars:0,consts:[[3,"class"]],template:function(s,n){s&1&&Ti(0,ha,2,1,null,null,Ai),s&2&&Ri(n.parts)},styles:[`.ngb-highlight{font-weight:700}
`],encapsulation:2,changeDetection:0})}}return e})(),ma=(()=>{class e{constructor(){this.editable=!0,this.focusFirst=!0,this.selectOnExact=!1,this.showHint=!1,this.placement=["bottom-start","bottom-end","top-start","top-end"],this.popperOptions=t=>t}static{this.\u0275fac=function(s){return new(s||e)}}static{this.\u0275prov=Ie({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),ba=(()=>{class e{constructor(){this.activeIdx=0,this.focusFirst=!0,this.formatter=Ut,this.selectEvent=new Et,this.activeChangeEvent=new Et}hasActive(){return this.activeIdx>-1&&this.activeIdx<this.results.length}getActive(){return this.results[this.activeIdx]}markActive(t){this.activeIdx=t,this._activeChanged()}next(){this.activeIdx===this.results.length-1?this.activeIdx=this.focusFirst?(this.activeIdx+1)%this.results.length:-1:this.activeIdx++,this._activeChanged()}prev(){this.activeIdx<0?this.activeIdx=this.results.length-1:this.activeIdx===0?this.activeIdx=this.focusFirst?this.results.length-1:-1:this.activeIdx--,this._activeChanged()}resetActive(){this.activeIdx=this.focusFirst?0:-1,this._activeChanged()}select(t){this.selectEvent.emit(t)}ngOnInit(){this.resetActive()}_activeChanged(){this.activeChangeEvent.emit(this.activeIdx>=0?this.id+"-"+this.activeIdx:void 0)}static{this.\u0275fac=function(s){return new(s||e)}}static{this.\u0275cmp=Di({type:e,selectors:[["ngb-typeahead-window"]],hostAttrs:["role","listbox"],hostVars:3,hostBindings:function(s,n){s&1&&Ne("mousedown",function(r){return r.preventDefault()}),s&2&&(Ei("id",n.id),Ii("dropdown-menu show"+(n.popupClass?" "+n.popupClass:"")))},inputs:{id:"id",focusFirst:"focusFirst",results:"results",term:"term",formatter:"formatter",resultTemplate:"resultTemplate",popupClass:"popupClass"},outputs:{selectEvent:"select",activeChangeEvent:"activeChange"},exportAs:["ngbTypeaheadWindow"],decls:4,vars:0,consts:[["rt",""],["type","button","role","option",1,"dropdown-item",3,"id","active"],[3,"result","term"],["type","button","role","option",1,"dropdown-item",3,"mouseenter","click","id"],[3,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(s,n){s&1&&(Oi(0,ua,1,2,"ng-template",null,0,Tn),Ti(2,pa,2,9,"button",1,Ai)),s&2&&(he(2),Ri(n.results))},dependencies:[ga,En],encapsulation:2})}}return e})(),xa=0,yu=(()=>{class e{constructor(){this._nativeElement=Z(Be).nativeElement,this._config=Z(ma),this._live=Z(Hn),this._document=Z(fn),this._ngZone=Z(Fe),this._changeDetector=Z(Rn),this._injector=Z(un),this._popupService=new Wn(ba),this._positioning=Fn(),this._subscription=null,this._closed$=new en,this._inputValueBackup=null,this._inputValueForSelectOnExact=null,this._valueChanges$=on(this._nativeElement,"input").pipe(nn(t=>t.target.value)),this._resubscribeTypeahead$=new Le(null),this._windowRef=null,this.autocomplete="off",this.container=this._config.container,this.editable=this._config.editable,this.focusFirst=this._config.focusFirst,this.selectOnExact=this._config.selectOnExact,this.showHint=this._config.showHint,this.placement=this._config.placement,this.popperOptions=this._config.popperOptions,this.selectItem=new Et,this.activeDescendant=null,this.popupId=`ngb-typeahead-${xa++}`,this._onTouched=()=>{},this._onChange=t=>{}}ngOnInit(){this._subscribeToUserInput()}ngOnChanges({ngbTypeahead:t}){t&&!t.firstChange&&(this._unsubscribeFromUserInput(),this._subscribeToUserInput())}ngOnDestroy(){this._closePopup(),this._unsubscribeFromUserInput()}registerOnChange(t){this._onChange=t}registerOnTouched(t){this._onTouched=t}writeValue(t){this._writeInputValue(this._formatItemForInput(t)),this.showHint&&(this._inputValueBackup=t)}setDisabledState(t){this._nativeElement.disabled=t}dismissPopup(){this.isPopupOpen()&&(this._resubscribeTypeahead$.next(null),this._closePopup(),this.showHint&&this._inputValueBackup!==null&&this._writeInputValue(this._inputValueBackup),this._changeDetector.markForCheck())}isPopupOpen(){return this._windowRef!=null}handleBlur(){this._resubscribeTypeahead$.next(null),this._onTouched()}handleKeyDown(t){if(this.isPopupOpen())switch(t.key){case"ArrowDown":t.preventDefault(),this._windowRef.instance.next(),this._showHint();break;case"ArrowUp":t.preventDefault(),this._windowRef.instance.prev(),this._showHint();break;case"Enter":case"Tab":{let s=this._windowRef.instance.getActive();Bn(s)&&(t.preventDefault(),t.stopPropagation(),this._selectResult(s)),this._closePopup();break}}}_openPopup(){if(!this.isPopupOpen()){this._inputValueBackup=this._nativeElement.value;let{windowRef:t}=this._popupService.open();this._windowRef=t,this._windowRef.setInput("id",this.popupId),this._windowRef.setInput("popupClass",this.popupClass),this._windowRef.instance.selectEvent.subscribe(s=>this._selectResultClosePopup(s)),this._windowRef.instance.activeChangeEvent.subscribe(s=>this.activeDescendant=s),this.container==="body"&&(this._windowRef.location.nativeElement.style.zIndex="1055",this._document.body.appendChild(this._windowRef.location.nativeElement)),this._changeDetector.markForCheck(),this._ngZone.runOutsideAngular(()=>{this._windowRef&&(this._positioning.createPopper({hostElement:this._nativeElement,targetElement:this._windowRef.location.nativeElement,placement:this.placement,updatePopperOptions:s=>this.popperOptions(Nn([0,2])(s))}),this._afterRenderRef=gn({mixedReadWrite:()=>{this._positioning.update()}},{injector:this._injector}))}),Vn(this._ngZone,this._document,"outside",()=>this.dismissPopup(),this._closed$,[this._nativeElement,this._windowRef.location.nativeElement])}}_closePopup(){this._popupService.close().subscribe(()=>{this._positioning.destroy(),this._afterRenderRef?.destroy(),this._closed$.next(),this._windowRef=null,this.activeDescendant=null})}_selectResult(t){let s=!1;this.selectItem.emit({item:t,preventDefault:()=>{s=!0}}),this._resubscribeTypeahead$.next(null),s||(this.writeValue(t),this._onChange(t))}_selectResultClosePopup(t){this._selectResult(t),this._closePopup()}_showHint(){if(this.showHint&&this._windowRef?.instance.hasActive()&&this._inputValueBackup!=null){let t=this._inputValueBackup.toLowerCase(),s=this._formatItemForInput(this._windowRef.instance.getActive());t===s.substring(0,this._inputValueBackup.length).toLowerCase()?(this._writeInputValue(this._inputValueBackup+s.substring(this._inputValueBackup.length)),this._nativeElement.setSelectionRange.apply(this._nativeElement,[this._inputValueBackup.length,s.length])):this._writeInputValue(s)}}_formatItemForInput(t){return t!=null&&this.inputFormatter?this.inputFormatter(t):Ut(t)}_writeInputValue(t){this._nativeElement.value=Ut(t)}_subscribeToUserInput(){let t=this._valueChanges$.pipe(ln(s=>{this._inputValueBackup=this.showHint?s:null,this._inputValueForSelectOnExact=this.selectOnExact?s:null,this._onChange(this.editable?s:null)}),this.ngbTypeahead?this.ngbTypeahead:()=>sn([]));this._subscription=this._resubscribeTypeahead$.pipe(an(()=>t)).subscribe(s=>{!s||s.length===0?this._closePopup():this.selectOnExact&&s.length===1&&this._formatItemForInput(s[0])===this._inputValueForSelectOnExact?(this._selectResult(s[0]),this._closePopup()):(this._openPopup(),this._windowRef.setInput("focusFirst",this.focusFirst),this._windowRef.setInput("results",s),this._windowRef.setInput("term",this._nativeElement.value),this.resultFormatter&&this._windowRef.setInput("formatter",this.resultFormatter),this.resultTemplate&&this._windowRef.setInput("resultTemplate",this.resultTemplate),this._windowRef.instance.resetActive(),this._windowRef.changeDetectorRef.detectChanges(),this._showHint());let n=s?s.length:0;this._live.say(n===0?"No results available":`${n} result${n===1?"":"s"} available`)})}_unsubscribeFromUserInput(){this._subscription&&this._subscription.unsubscribe(),this._subscription=null}static{this.\u0275fac=function(s){return new(s||e)}}static{this.\u0275dir=ze({type:e,selectors:[["input","ngbTypeahead",""]],hostAttrs:["autocapitalize","off","autocorrect","off","role","combobox"],hostVars:7,hostBindings:function(s,n){s&1&&Ne("blur",function(){return n.handleBlur()})("keydown",function(r){return n.handleKeyDown(r)}),s&2&&(Ei("autocomplete",n.autocomplete),bn("aria-autocomplete",n.showHint?"both":"list")("aria-activedescendant",n.activeDescendant)("aria-controls",n.isPopupOpen()?n.popupId:null)("aria-expanded",n.isPopupOpen()),Li("open",n.isPopupOpen()))},inputs:{autocomplete:"autocomplete",container:"container",editable:"editable",focusFirst:"focusFirst",inputFormatter:"inputFormatter",ngbTypeahead:"ngbTypeahead",resultFormatter:"resultFormatter",resultTemplate:"resultTemplate",selectOnExact:"selectOnExact",showHint:"showHint",placement:"placement",popperOptions:"popperOptions",popupClass:"popupClass"},outputs:{selectItem:"selectItem"},exportAs:["ngbTypeahead"],features:[On([{provide:In,useExisting:cn(()=>e),multi:!0}]),ce]})}}return e})(),vu=(()=>{class e{static{this.\u0275fac=function(s){return new(s||e)}}static{this.\u0275mod=mn({type:e})}static{this.\u0275inj=hn({})}}return e})();function fe(e){return e+.5|0}var yt=(e,i,t)=>Math.max(Math.min(e,t),i);function de(e){return yt(fe(e*2.55),0,255)}function vt(e){return yt(fe(e*255),0,255)}function ft(e){return yt(fe(e/2.55)/100,0,1)}function jn(e){return yt(fe(e*100),0,100)}var it={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"],_a=e=>Ni[e&15],ya=e=>Ni[(e&240)>>4]+Ni[e&15],We=e=>(e&240)>>4===(e&15),va=e=>We(e.r)&&We(e.g)&&We(e.b)&&We(e.a);function wa(e){var i=e.length,t;return e[0]==="#"&&(i===4||i===5?t={r:255&it[e[1]]*17,g:255&it[e[2]]*17,b:255&it[e[3]]*17,a:i===5?it[e[4]]*17:255}:(i===7||i===9)&&(t={r:it[e[1]]<<4|it[e[2]],g:it[e[3]]<<4|it[e[4]],b:it[e[5]]<<4|it[e[6]],a:i===9?it[e[7]]<<4|it[e[8]]:255})),t}var Ma=(e,i)=>e<255?i(e):"";function ka(e){var i=va(e)?_a:ya;return e?"#"+i(e.r)+i(e.g)+i(e.b)+Ma(e.a,i):void 0}var Sa=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Xn(e,i,t){let s=i*Math.min(t,1-t),n=(o,r=(o+e/30)%12)=>t-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function Ca(e,i,t){let s=(n,o=(n+e/60)%6)=>t-t*i*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function Pa(e,i,t){let s=Xn(e,1,.5),n;for(i+t>1&&(n=1/(i+t),i*=n,t*=n),n=0;n<3;n++)s[n]*=1-i-t,s[n]+=i;return s}function Da(e,i,t,s,n){return e===n?(i-t)/s+(i<t?6:0):i===n?(t-e)/s+2:(e-i)/s+4}function Wi(e){let t=e.r/255,s=e.g/255,n=e.b/255,o=Math.max(t,s,n),r=Math.min(t,s,n),a=(o+r)/2,l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=Da(t,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function Hi(e,i,t,s){return(Array.isArray(i)?e(i[0],i[1],i[2]):e(i,t,s)).map(vt)}function ji(e,i,t){return Hi(Xn,e,i,t)}function Oa(e,i,t){return Hi(Pa,e,i,t)}function Aa(e,i,t){return Hi(Ca,e,i,t)}function Kn(e){return(e%360+360)%360}function Ta(e){let i=Sa.exec(e),t=255,s;if(!i)return;i[5]!==s&&(t=i[6]?de(+i[5]):vt(+i[5]));let n=Kn(+i[2]),o=+i[3]/100,r=+i[4]/100;return i[1]==="hwb"?s=Oa(n,o,r):i[1]==="hsv"?s=Aa(n,o,r):s=ji(n,o,r),{r:s[0],g:s[1],b:s[2],a:t}}function Ra(e,i){var t=Wi(e);t[0]=Kn(t[0]+i),t=ji(t),e.r=t[0],e.g=t[1],e.b=t[2]}function Ea(e){if(!e)return;let i=Wi(e),t=i[0],s=jn(i[1]),n=jn(i[2]);return e.a<255?`hsla(${t}, ${s}%, ${n}%, ${ft(e.a)})`:`hsl(${t}, ${s}%, ${n}%)`}var $n={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"},Yn={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 La(){let e={},i=Object.keys(Yn),t=Object.keys($n),s,n,o,r,a;for(s=0;s<i.length;s++){for(r=a=i[s],n=0;n<t.length;n++)o=t[n],a=a.replace(o,$n[o]);o=parseInt(Yn[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}var He;function Ia(e){He||(He=La(),He.transparent=[0,0,0,0]);let i=He[e.toLowerCase()];return i&&{r:i[0],g:i[1],b:i[2],a:i.length===4?i[3]:255}}var Fa=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Ba(e){let i=Fa.exec(e),t=255,s,n,o;if(i){if(i[7]!==s){let r=+i[7];t=i[8]?de(r):yt(r*255,0,255)}return s=+i[1],n=+i[3],o=+i[5],s=255&(i[2]?de(s):yt(s,0,255)),n=255&(i[4]?de(n):yt(n,0,255)),o=255&(i[6]?de(o):yt(o,0,255)),{r:s,g:n,b:o,a:t}}}function za(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${ft(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var Vi=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Xt=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Va(e,i,t){let s=Xt(ft(e.r)),n=Xt(ft(e.g)),o=Xt(ft(e.b));return{r:vt(Vi(s+t*(Xt(ft(i.r))-s))),g:vt(Vi(n+t*(Xt(ft(i.g))-n))),b:vt(Vi(o+t*(Xt(ft(i.b))-o))),a:e.a+t*(i.a-e.a)}}function je(e,i,t){if(e){let s=Wi(e);s[i]=Math.max(0,Math.min(s[i]+s[i]*t,i===0?360:1)),s=ji(s),e.r=s[0],e.g=s[1],e.b=s[2]}}function qn(e,i){return e&&Object.assign(i||{},e)}function Un(e){var i={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(i={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(i.a=vt(e[3]))):(i=qn(e,{r:0,g:0,b:0,a:1}),i.a=vt(i.a)),i}function Na(e){return e.charAt(0)==="r"?Ba(e):Ta(e)}var ue=class e{constructor(i){if(i instanceof e)return i;let t=typeof i,s;t==="object"?s=Un(i):t==="string"&&(s=wa(i)||Ia(i)||Na(i)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var i=qn(this._rgb);return i&&(i.a=ft(i.a)),i}set rgb(i){this._rgb=Un(i)}rgbString(){return this._valid?za(this._rgb):void 0}hexString(){return this._valid?ka(this._rgb):void 0}hslString(){return this._valid?Ea(this._rgb):void 0}mix(i,t){if(i){let s=this.rgb,n=i.rgb,o,r=t===o?.5:t,a=2*r-1,l=s.a-n.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=r*s.a+(1-r)*n.a,this.rgb=s}return this}interpolate(i,t){return i&&(this._rgb=Va(this._rgb,i._rgb,t)),this}clone(){return new e(this.rgb)}alpha(i){return this._rgb.a=vt(i),this}clearer(i){let t=this._rgb;return t.a*=1-i,this}greyscale(){let i=this._rgb,t=fe(i.r*.3+i.g*.59+i.b*.11);return i.r=i.g=i.b=t,this}opaquer(i){let t=this._rgb;return t.a*=1+i,this}negate(){let i=this._rgb;return i.r=255-i.r,i.g=255-i.g,i.b=255-i.b,this}lighten(i){return je(this._rgb,2,i),this}darken(i){return je(this._rgb,2,-i),this}saturate(i){return je(this._rgb,1,i),this}desaturate(i){return je(this._rgb,1,-i),this}rotate(i){return Ra(this._rgb,i),this}};function ct(){}var ro=(()=>{let e=0;return()=>e++})();function O(e){return e==null}function B(e){if(Array.isArray&&Array.isArray(e))return!0;let i=Object.prototype.toString.call(e);return i.slice(0,7)==="[object"&&i.slice(-6)==="Array]"}function A(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function N(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function J(e,i){return N(e)?e:i}function C(e,i){return typeof e>"u"?i:e}var ao=(e,i)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/i,Xi=(e,i)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*i:+e;function I(e,i,t){if(e&&typeof e.call=="function")return e.apply(t,i)}function E(e,i,t,s){let n,o,r;if(B(e))if(o=e.length,s)for(n=o-1;n>=0;n--)i.call(t,e[n],n);else for(n=0;n<o;n++)i.call(t,e[n],n);else if(A(e))for(r=Object.keys(e),o=r.length,n=0;n<o;n++)i.call(t,e[r[n]],r[n])}function me(e,i){let t,s,n,o;if(!e||!i||e.length!==i.length)return!1;for(t=0,s=e.length;t<s;++t)if(n=e[t],o=i[t],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function Xe(e){if(B(e))return e.map(Xe);if(A(e)){let i=Object.create(null),t=Object.keys(e),s=t.length,n=0;for(;n<s;++n)i[t[n]]=Xe(e[t[n]]);return i}return e}function lo(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Wa(e,i,t,s){if(!lo(e))return;let n=i[e],o=t[e];A(n)&&A(o)?qt(n,o,s):i[e]=Xe(o)}function qt(e,i,t){let s=B(i)?i:[i],n=s.length;if(!A(e))return e;t=t||{};let o=t.merger||Wa,r;for(let a=0;a<n;++a){if(r=s[a],!A(r))continue;let l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],e,r,t)}return e}function Zt(e,i){return qt(e,i,{merger:Ha})}function Ha(e,i,t){if(!lo(e))return;let s=i[e],n=t[e];A(s)&&A(n)?Zt(s,n):Object.prototype.hasOwnProperty.call(i,e)||(i[e]=Xe(n))}var Gn={"":e=>e,x:e=>e.x,y:e=>e.y};function ja(e){let i=e.split("."),t=[],s="";for(let n of i)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(t.push(s),s="");return t}function $a(e){let i=ja(e);return t=>{for(let s of i){if(s==="")break;t=t&&t[s]}return t}}function mt(e,i){return(Gn[i]||(Gn[i]=$a(i)))(e)}function Ze(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Jt=e=>typeof e<"u",pt=e=>typeof e=="function",Ki=(e,i)=>{if(e.size!==i.size)return!1;for(let t of e)if(!i.has(t))return!1;return!0};function co(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}var R=Math.PI,z=2*R,Ya=z+R,Ke=Number.POSITIVE_INFINITY,Ua=R/180,W=R/2,It=R/4,Zn=R*2/3,gt=Math.log10,ot=Math.sign;function Qt(e,i,t){return Math.abs(e-i)<t}function qi(e){let i=Math.round(e);e=Qt(e,i,e/1e3)?i:e;let t=Math.pow(10,Math.floor(gt(e))),s=e/t;return(s<=1?1:s<=2?2:s<=5?5:10)*t}function ho(e){let i=[],t=Math.sqrt(e),s;for(s=1;s<t;s++)e%s===0&&(i.push(s),i.push(e/s));return t===(t|0)&&i.push(t),i.sort((n,o)=>n-o).pop(),i}function Xa(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function zt(e){return!Xa(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function uo(e,i){let t=Math.round(e);return t-i<=e&&t+i>=e}function Gi(e,i,t){let s,n,o;for(s=0,n=e.length;s<n;s++)o=e[s][t],isNaN(o)||(i.min=Math.min(i.min,o),i.max=Math.max(i.max,o))}function st(e){return e*(R/180)}function Je(e){return e*(180/R)}function Zi(e){if(!N(e))return;let i=1,t=0;for(;Math.round(e*i)/i!==e;)i*=10,t++;return t}function Ji(e,i){let t=i.x-e.x,s=i.y-e.y,n=Math.sqrt(t*t+s*s),o=Math.atan2(s,t);return o<-.5*R&&(o+=z),{angle:o,distance:n}}function qe(e,i){return Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))}function Ka(e,i){return(e-i+Ya)%z-R}function U(e){return(e%z+z)%z}function te(e,i,t,s){let n=U(e),o=U(i),r=U(t),a=U(o-n),l=U(r-n),c=U(n-o),h=U(n-r);return n===o||n===r||s&&o===r||a>l&&c<h}function $(e,i,t){return Math.max(i,Math.min(t,e))}function fo(e){return $(e,-32768,32767)}function ht(e,i,t,s=1e-6){return e>=Math.min(i,t)-s&&e<=Math.max(i,t)+s}function Qe(e,i,t){t=t||(r=>e[r]<i);let s=e.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,t(o)?n=o:s=o;return{lo:n,hi:s}}var at=(e,i,t,s)=>Qe(e,t,s?n=>{let o=e[n][i];return o<t||o===t&&e[n+1][i]===t}:n=>e[n][i]<t),po=(e,i,t)=>Qe(e,t,s=>e[s][i]>=t);function go(e,i,t){let s=0,n=e.length;for(;s<n&&e[s]<i;)s++;for(;n>s&&e[n-1]>t;)n--;return s>0||n<e.length?e.slice(s,n):e}var mo=["push","pop","shift","splice","unshift"];function bo(e,i){if(e._chartjs){e._chartjs.listeners.push(i);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[i]}}),mo.forEach(t=>{let s="_onData"+Ze(t),n=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...o){let r=n.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function Qi(e,i){let t=e._chartjs;if(!t)return;let s=t.listeners,n=s.indexOf(i);n!==-1&&s.splice(n,1),!(s.length>0)&&(mo.forEach(o=>{delete e[o]}),delete e._chartjs)}function ts(e){let i=new Set(e);return i.size===e.length?e:Array.from(i)}var es=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function is(e,i){let t=[],s=!1;return function(...n){t=n,s||(s=!0,es.call(window,()=>{s=!1,e.apply(i,t)}))}}function xo(e,i){let t;return function(...s){return i?(clearTimeout(t),t=setTimeout(e,i,s)):e.apply(this,s),i}}var ti=e=>e==="start"?"left":e==="end"?"right":"center",X=(e,i,t)=>e==="start"?i:e==="end"?t:(i+t)/2,_o=(e,i,t,s)=>e===(s?"left":"right")?t:e==="center"?(i+t)/2:i;function ss(e,i,t){let s=i.length,n=0,o=s;if(e._sorted){let{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,h=r.axis,{min:d,max:u,minDefined:f,maxDefined:g}=r.getUserBounds();if(f){if(n=Math.min(at(l,h,d).lo,t?s:at(i,h,r.getPixelForValue(d)).lo),c){let p=l.slice(0,n+1).reverse().findIndex(m=>!O(m[a.axis]));n-=Math.max(0,p)}n=$(n,0,s-1)}if(g){let p=Math.max(at(l,r.axis,u,!0).hi+1,t?0:at(i,h,r.getPixelForValue(u),!0).hi+1);if(c){let m=l.slice(p-1).findIndex(b=>!O(b[a.axis]));p+=Math.max(0,m)}o=$(p,n,s)-n}else o=s-n}return{start:n,count:o}}function ns(e){let{xScale:i,yScale:t,_scaleRanges:s}=e,n={xmin:i.min,xmax:i.max,ymin:t.min,ymax:t.max};if(!s)return e._scaleRanges=n,!0;let o=s.xmin!==i.min||s.xmax!==i.max||s.ymin!==t.min||s.ymax!==t.max;return Object.assign(s,n),o}var $e=e=>e===0||e===1,Jn=(e,i,t)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-i)*z/t)),Qn=(e,i,t)=>Math.pow(2,-10*e)*Math.sin((e-i)*z/t)+1,Kt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*W)+1,easeOutSine:e=>Math.sin(e*W),easeInOutSine:e=>-.5*(Math.cos(R*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>$e(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>$e(e)?e:Jn(e,.075,.3),easeOutElastic:e=>$e(e)?e:Qn(e,.075,.3),easeInOutElastic(e){return $e(e)?e:e<.5?.5*Jn(e*2,.1125,.45):.5+.5*Qn(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let i=1.70158;return(e/=.5)<1?.5*(e*e*(((i*=1.525)+1)*e-i)):.5*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)},easeInBounce:e=>1-Kt.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Kt.easeInBounce(e*2)*.5:Kt.easeOutBounce(e*2-1)*.5+.5};function os(e){if(e&&typeof e=="object"){let i=e.toString();return i==="[object CanvasPattern]"||i==="[object CanvasGradient]"}return!1}function rs(e){return os(e)?e:new ue(e)}function $i(e){return os(e)?e:new ue(e).saturate(.5).darken(.1).hexString()}var qa=["x","y","borderWidth","radius","tension"],Ga=["color","borderColor","backgroundColor"];function Za(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:i=>i!=="onProgress"&&i!=="onComplete"&&i!=="fn"}),e.set("animations",{colors:{type:"color",properties:Ga},numbers:{type:"number",properties:qa}}),e.describe("animations",{_fallback:"animation"}),e.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:i=>i|0}}}})}function Ja(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var to=new Map;function Qa(e,i){i=i||{};let t=e+JSON.stringify(i),s=to.get(t);return s||(s=new Intl.NumberFormat(e,i),to.set(t,s)),s}function ee(e,i,t){return Qa(i,t).format(e)}var yo={values(e){return B(e)?e:""+e},numeric(e,i,t){if(e===0)return"0";let s=this.chart.options.locale,n,o=e;if(t.length>1){let c=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=tl(e,t)}let r=gt(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),ee(e,s,l)},logarithmic(e,i,t){if(e===0)return"0";let s=t[i].significand||e/Math.pow(10,Math.floor(gt(e)));return[1,2,3,5,10,15].includes(s)||i>.8*t.length?yo.numeric.call(this,e,i,t):""}};function tl(e,i){let t=i.length>3?i[2].value-i[1].value:i[1].value-i[0].value;return Math.abs(t)>=1&&e!==Math.floor(e)&&(t=e-Math.floor(e)),t}var be={formatters:yo};function el(e){e.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:(i,t)=>t.lineWidth,tickColor:(i,t)=>t.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:be.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:i=>!i.startsWith("before")&&!i.startsWith("after")&&i!=="callback"&&i!=="parser",_indexable:i=>i!=="borderDash"&&i!=="tickBorderDash"&&i!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:i=>i!=="backdropPadding"&&i!=="callback",_indexable:i=>i!=="backdropPadding"})}var kt=Object.create(null),ei=Object.create(null);function pe(e,i){if(!i)return e;let t=i.split(".");for(let s=0,n=t.length;s<n;++s){let o=t[s];e=e[o]||(e[o]=Object.create(null))}return e}function Yi(e,i,t){return typeof i=="string"?qt(pe(e,i),t):qt(pe(e,""),i)}var Ui=class{constructor(i,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.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=(s,n)=>$i(n.backgroundColor),this.hoverBorderColor=(s,n)=>$i(n.borderColor),this.hoverColor=(s,n)=>$i(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(i),this.apply(t)}set(i,t){return Yi(this,i,t)}get(i){return pe(this,i)}describe(i,t){return Yi(ei,i,t)}override(i,t){return Yi(kt,i,t)}route(i,t,s,n){let o=pe(this,i),r=pe(this,s),a="_"+t;Object.defineProperties(o,{[a]:{value:o[t],writable:!0},[t]:{enumerable:!0,get(){let l=this[a],c=r[n];return A(l)?Object.assign({},c,l):C(l,c)},set(l){this[a]=l}}})}apply(i){i.forEach(t=>t(this))}},F=new Ui({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Za,Ja,el]);function il(e){return!e||O(e.size)||O(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function ge(e,i,t,s,n){let o=i[n];return o||(o=i[n]=e.measureText(n).width,t.push(n)),o>s&&(s=o),s}function vo(e,i,t,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==i&&(n=s.data={},o=s.garbageCollect=[],s.font=i),e.save(),e.font=i;let r=0,a=t.length,l,c,h,d,u;for(l=0;l<a;l++)if(d=t[l],d!=null&&!B(d))r=ge(e,n,o,r,d);else if(B(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!B(u)&&(r=ge(e,n,o,r,u));e.restore();let f=o.length/2;if(f>t.length){for(l=0;l<f;l++)delete n[o[l]];o.splice(0,f)}return r}function St(e,i,t){let s=e.currentDevicePixelRatio,n=t!==0?Math.max(t/2,.5):0;return Math.round((i-n)*s)/s+n}function as(e,i){!i&&!e||(i=i||e.getContext("2d"),i.save(),i.resetTransform(),i.clearRect(0,0,e.width,e.height),i.restore())}function ii(e,i,t,s){ls(e,i,t,s,null)}function ls(e,i,t,s,n){let o,r,a,l,c,h,d,u,f=i.pointStyle,g=i.rotation,p=i.radius,m=(g||0)*Ua;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(t,s),e.rotate(m),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(p)||p<=0)){switch(e.beginPath(),f){default:n?e.ellipse(t,s,n/2,p,0,0,z):e.arc(t,s,p,0,z),e.closePath();break;case"triangle":h=n?n/2:p,e.moveTo(t+Math.sin(m)*h,s-Math.cos(m)*p),m+=Zn,e.lineTo(t+Math.sin(m)*h,s-Math.cos(m)*p),m+=Zn,e.lineTo(t+Math.sin(m)*h,s-Math.cos(m)*p),e.closePath();break;case"rectRounded":c=p*.516,l=p-c,r=Math.cos(m+It)*l,d=Math.cos(m+It)*(n?n/2-c:l),a=Math.sin(m+It)*l,u=Math.sin(m+It)*(n?n/2-c:l),e.arc(t-d,s-a,c,m-R,m-W),e.arc(t+u,s-r,c,m-W,m),e.arc(t+d,s+a,c,m,m+W),e.arc(t-u,s+r,c,m+W,m+R),e.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,h=n?n/2:l,e.rect(t-h,s-l,2*h,2*l);break}m+=It;case"rectRot":d=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),e.moveTo(t-d,s-a),e.lineTo(t+u,s-r),e.lineTo(t+d,s+a),e.lineTo(t-u,s+r),e.closePath();break;case"crossRot":m+=It;case"cross":d=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),e.moveTo(t-d,s-a),e.lineTo(t+d,s+a),e.moveTo(t+u,s-r),e.lineTo(t-u,s+r);break;case"star":d=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),e.moveTo(t-d,s-a),e.lineTo(t+d,s+a),e.moveTo(t+u,s-r),e.lineTo(t-u,s+r),m+=It,d=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),e.moveTo(t-d,s-a),e.lineTo(t+d,s+a),e.moveTo(t+u,s-r),e.lineTo(t-u,s+r);break;case"line":r=n?n/2:Math.cos(m)*p,a=Math.sin(m)*p,e.moveTo(t-r,s-a),e.lineTo(t+r,s+a);break;case"dash":e.moveTo(t,s),e.lineTo(t+Math.cos(m)*(n?n/2:p),s+Math.sin(m)*p);break;case!1:e.closePath();break}e.fill(),i.borderWidth>0&&e.stroke()}}function lt(e,i,t){return t=t||.5,!i||e&&e.x>i.left-t&&e.x<i.right+t&&e.y>i.top-t&&e.y<i.bottom+t}function xe(e,i){e.save(),e.beginPath(),e.rect(i.left,i.top,i.right-i.left,i.bottom-i.top),e.clip()}function _e(e){e.restore()}function wo(e,i,t,s,n){if(!i)return e.lineTo(t.x,t.y);if(n==="middle"){let o=(i.x+t.x)/2;e.lineTo(o,i.y),e.lineTo(o,t.y)}else n==="after"!=!!s?e.lineTo(i.x,t.y):e.lineTo(t.x,i.y);e.lineTo(t.x,t.y)}function Mo(e,i,t,s){if(!i)return e.lineTo(t.x,t.y);e.bezierCurveTo(s?i.cp1x:i.cp2x,s?i.cp1y:i.cp2y,s?t.cp2x:t.cp1x,s?t.cp2y:t.cp1y,t.x,t.y)}function sl(e,i){i.translation&&e.translate(i.translation[0],i.translation[1]),O(i.rotation)||e.rotate(i.rotation),i.color&&(e.fillStyle=i.color),i.textAlign&&(e.textAlign=i.textAlign),i.textBaseline&&(e.textBaseline=i.textBaseline)}function nl(e,i,t,s,n){if(n.strikethrough||n.underline){let o=e.measureText(s),r=i-o.actualBoundingBoxLeft,a=i+o.actualBoundingBoxRight,l=t-o.actualBoundingBoxAscent,c=t+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=n.decorationWidth||2,e.moveTo(r,h),e.lineTo(a,h),e.stroke()}}function ol(e,i){let t=e.fillStyle;e.fillStyle=i.color,e.fillRect(i.left,i.top,i.width,i.height),e.fillStyle=t}function Ct(e,i,t,s,n,o={}){let r=B(i)?i:[i],a=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(e.save(),e.font=n.string,sl(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&ol(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),O(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,t,s,o.maxWidth)),e.fillText(c,t,s,o.maxWidth),nl(e,t,s,c,o),s+=Number(n.lineHeight);e.restore()}function ie(e,i){let{x:t,y:s,w:n,h:o,radius:r}=i;e.arc(t+r.topLeft,s+r.topLeft,r.topLeft,1.5*R,R,!0),e.lineTo(t,s+o-r.bottomLeft),e.arc(t+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,R,W,!0),e.lineTo(t+n-r.bottomRight,s+o),e.arc(t+n-r.bottomRight,s+o-r.bottomRight,r.bottomRight,W,0,!0),e.lineTo(t+n,s+r.topRight),e.arc(t+n-r.topRight,s+r.topRight,r.topRight,0,-W,!0),e.lineTo(t+r.topLeft,s)}var rl=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,al=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function ll(e,i){let t=(""+e).match(rl);if(!t||t[1]==="normal")return i*1.2;switch(e=+t[2],t[3]){case"px":return e;case"%":e/=100;break}return i*e}var cl=e=>+e||0;function si(e,i){let t={},s=A(i),n=s?Object.keys(i):i,o=A(e)?s?r=>C(e[r],e[i[r]]):r=>e[r]:()=>e;for(let r of n)t[r]=cl(o(r));return t}function cs(e){return si(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Pt(e){return si(e,["topLeft","topRight","bottomLeft","bottomRight"])}function K(e){let i=cs(e);return i.width=i.left+i.right,i.height=i.top+i.bottom,i}function j(e,i){e=e||{},i=i||F.font;let t=C(e.size,i.size);typeof t=="string"&&(t=parseInt(t,10));let s=C(e.style,i.style);s&&!(""+s).match(al)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);let n={family:C(e.family,i.family),lineHeight:ll(C(e.lineHeight,i.lineHeight),t),size:t,style:s,weight:C(e.weight,i.weight),string:""};return n.string=il(n),n}function se(e,i,t,s){let n=!0,o,r,a;for(o=0,r=e.length;o<r;++o)if(a=e[o],a!==void 0&&(i!==void 0&&typeof a=="function"&&(a=a(i),n=!1),t!==void 0&&B(a)&&(a=a[t%a.length],n=!1),a!==void 0))return s&&!n&&(s.cacheable=!1),a}function ko(e,i,t){let{min:s,max:n}=e,o=Xi(i,(n-s)/2),r=(a,l)=>t&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function bt(e,i){return Object.assign(Object.create(e),i)}function ni(e,i=[""],t,s,n=()=>e[0]){let o=t||e;typeof s>"u"&&(s=Po("_fallback",e));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>ni([a,...e],i,o,s)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return So(a,l,()=>bl(l,i,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return io(a).includes(l)},ownKeys(a){return io(a)},set(a,l,c){let h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function Bt(e,i,t,s){let n={_cacheable:!1,_proxy:e,_context:i,_subProxy:t,_stack:new Set,_descriptors:hs(e,s),setContext:o=>Bt(e,o,t,s),override:o=>Bt(e.override(o),i,t,s)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return So(o,r,()=>dl(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function hs(e,i={scriptable:!0,indexable:!0}){let{_scriptable:t=i.scriptable,_indexable:s=i.indexable,_allKeys:n=i.allKeys}=e;return{allKeys:n,scriptable:t,indexable:s,isScriptable:pt(t)?t:()=>t,isIndexable:pt(s)?s:()=>s}}var hl=(e,i)=>e?e+Ze(i):i,ds=(e,i)=>A(i)&&e!=="adapters"&&(Object.getPrototypeOf(i)===null||i.constructor===Object);function So(e,i,t){if(Object.prototype.hasOwnProperty.call(e,i)||i==="constructor")return e[i];let s=t();return e[i]=s,s}function dl(e,i,t){let{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=e,a=s[i];return pt(a)&&r.isScriptable(i)&&(a=ul(i,a,e,t)),B(a)&&a.length&&(a=fl(i,a,e,r.isIndexable)),ds(i,a)&&(a=Bt(a,n,o&&o[i],r)),a}function ul(e,i,t,s){let{_proxy:n,_context:o,_subProxy:r,_stack:a}=t;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=i(o,r||s);return a.delete(e),ds(e,l)&&(l=us(n._scopes,n,e,l)),l}function fl(e,i,t,s){let{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=t;if(typeof o.index<"u"&&s(e))return i[o.index%i.length];if(A(i[0])){let l=i,c=n._scopes.filter(h=>h!==l);i=[];for(let h of l){let d=us(c,n,e,h);i.push(Bt(d,o,r&&r[e],a))}}return i}function Co(e,i,t){return pt(e)?e(i,t):e}var pl=(e,i)=>e===!0?i:typeof e=="string"?mt(i,e):void 0;function gl(e,i,t,s,n){for(let o of i){let r=pl(t,o);if(r){e.add(r);let a=Co(r._fallback,t,n);if(typeof a<"u"&&a!==t&&a!==s)return a}else if(r===!1&&typeof s<"u"&&t!==s)return null}return!1}function us(e,i,t,s){let n=i._rootScopes,o=Co(i._fallback,t,s),r=[...e,...n],a=new Set;a.add(s);let l=eo(a,r,t,o||t,s);return l===null||typeof o<"u"&&o!==t&&(l=eo(a,r,o,l,s),l===null)?!1:ni(Array.from(a),[""],n,o,()=>ml(i,t,s))}function eo(e,i,t,s,n){for(;t;)t=gl(e,i,t,s,n);return t}function ml(e,i,t){let s=e._getTarget();i in s||(s[i]={});let n=s[i];return B(n)&&A(t)?t:n||{}}function bl(e,i,t,s){let n;for(let o of i)if(n=Po(hl(o,e),t),typeof n<"u")return ds(e,n)?us(t,s,e,n):n}function Po(e,i){for(let t of i){if(!t)continue;let s=t[e];if(typeof s<"u")return s}}function io(e){let i=e._keys;return i||(i=e._keys=xl(e._scopes)),i}function xl(e){let i=new Set;for(let t of e)for(let s of Object.keys(t).filter(n=>!n.startsWith("_")))i.add(s);return Array.from(i)}function fs(e,i,t,s){let{iScale:n}=e,{key:o="r"}=this._parsing,r=new Array(s),a,l,c,h;for(a=0,l=s;a<l;++a)c=a+t,h=i[c],r[a]={r:n.parse(mt(h,o),c)};return r}var _l=Number.EPSILON||1e-14,Gt=(e,i)=>i<e.length&&!e[i].skip&&e[i],Do=e=>e==="x"?"y":"x";function yl(e,i,t,s){let n=e.skip?i:e,o=i,r=t.skip?i:t,a=qe(o,n),l=qe(r,o),c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;let d=s*c,u=s*h;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+u*(r.x-n.x),y:o.y+u*(r.y-n.y)}}}function vl(e,i,t){let s=e.length,n,o,r,a,l,c=Gt(e,0);for(let h=0;h<s-1;++h)if(l=c,c=Gt(e,h+1),!(!l||!c)){if(Qt(i[h],0,_l)){t[h]=t[h+1]=0;continue}n=t[h]/i[h],o=t[h+1]/i[h],a=Math.pow(n,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),t[h]=n*r*i[h],t[h+1]=o*r*i[h])}}function wl(e,i,t="x"){let s=Do(t),n=e.length,o,r,a,l=Gt(e,0);for(let c=0;c<n;++c){if(r=a,a=l,l=Gt(e,c+1),!a)continue;let h=a[t],d=a[s];r&&(o=(h-r[t])/3,a[`cp1${t}`]=h-o,a[`cp1${s}`]=d-o*i[c]),l&&(o=(l[t]-h)/3,a[`cp2${t}`]=h+o,a[`cp2${s}`]=d+o*i[c])}}function Ml(e,i="x"){let t=Do(i),s=e.length,n=Array(s).fill(0),o=Array(s),r,a,l,c=Gt(e,0);for(r=0;r<s;++r)if(a=l,l=c,c=Gt(e,r+1),!!l){if(c){let h=c[i]-l[i];n[r]=h!==0?(c[t]-l[t])/h:0}o[r]=a?c?ot(n[r-1])!==ot(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}vl(e,n,o),wl(e,o,i)}function Ye(e,i,t){return Math.max(Math.min(e,t),i)}function kl(e,i){let t,s,n,o,r,a=lt(e[0],i);for(t=0,s=e.length;t<s;++t)r=o,o=a,a=t<s-1&&lt(e[t+1],i),o&&(n=e[t],r&&(n.cp1x=Ye(n.cp1x,i.left,i.right),n.cp1y=Ye(n.cp1y,i.top,i.bottom)),a&&(n.cp2x=Ye(n.cp2x,i.left,i.right),n.cp2y=Ye(n.cp2y,i.top,i.bottom)))}function Oo(e,i,t,s,n){let o,r,a,l;if(i.spanGaps&&(e=e.filter(c=>!c.skip)),i.cubicInterpolationMode==="monotone")Ml(e,n);else{let c=s?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=yl(c,a,e[Math.min(o+1,r-(s?0:1))%r],i.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}i.capBezierPoints&&kl(e,t)}function oi(){return typeof window<"u"&&typeof document<"u"}function ri(e){let i=e.parentNode;return i&&i.toString()==="[object ShadowRoot]"&&(i=i.host),i}function Ge(e,i,t){let s;return typeof e=="string"?(s=parseInt(e,10),e.indexOf("%")!==-1&&(s=s/100*i.parentNode[t])):s=e,s}var ai=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function Sl(e,i){return ai(e).getPropertyValue(i)}var Cl=["top","right","bottom","left"];function Ft(e,i,t){let s={};t=t?"-"+t:"";for(let n=0;n<4;n++){let o=Cl[n];s[o]=parseFloat(e[i+"-"+o+t])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}var Pl=(e,i,t)=>(e>0||i>0)&&(!t||!t.shadowRoot);function Dl(e,i){let t=e.touches,s=t&&t.length?t[0]:e,{offsetX:n,offsetY:o}=s,r=!1,a,l;if(Pl(n,o,e.target))a=n,l=o;else{let c=i.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function Dt(e,i){if("native"in e)return e;let{canvas:t,currentDevicePixelRatio:s}=i,n=ai(t),o=n.boxSizing==="border-box",r=Ft(n,"padding"),a=Ft(n,"border","width"),{x:l,y:c,box:h}=Dl(e,t),d=r.left+(h&&a.left),u=r.top+(h&&a.top),{width:f,height:g}=i;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-d)/f*t.width/s),y:Math.round((c-u)/g*t.height/s)}}function Ol(e,i,t){let s,n;if(i===void 0||t===void 0){let o=e&&ri(e);if(!o)i=e.clientWidth,t=e.clientHeight;else{let r=o.getBoundingClientRect(),a=ai(o),l=Ft(a,"border","width"),c=Ft(a,"padding");i=r.width-c.width-l.width,t=r.height-c.height-l.height,s=Ge(a.maxWidth,o,"clientWidth"),n=Ge(a.maxHeight,o,"clientHeight")}}return{width:i,height:t,maxWidth:s||Ke,maxHeight:n||Ke}}var Mt=e=>Math.round(e*10)/10;function Ao(e,i,t,s){let n=ai(e),o=Ft(n,"margin"),r=Ge(n.maxWidth,e,"clientWidth")||Ke,a=Ge(n.maxHeight,e,"clientHeight")||Ke,l=Ol(e,i,t),{width:c,height:h}=l;if(n.boxSizing==="content-box"){let u=Ft(n,"border","width"),f=Ft(n,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=Mt(Math.min(c,r,l.maxWidth)),h=Mt(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Mt(c/2)),(i!==void 0||t!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=Mt(Math.floor(h*s))),{width:c,height:h}}function ps(e,i,t){let s=i||1,n=Mt(e.height*s),o=Mt(e.width*s);e.height=Mt(e.height),e.width=Mt(e.width);let r=e.canvas;return r.style&&(t||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==s||r.height!==n||r.width!==o?(e.currentDevicePixelRatio=s,r.height=n,r.width=o,e.ctx.setTransform(s,0,0,s,0,0),!0):!1}var To=(function(){let e=!1;try{let i={get passive(){return e=!0,!1}};oi()&&(window.addEventListener("test",null,i),window.removeEventListener("test",null,i))}catch(i){}return e})();function gs(e,i){let t=Sl(e,i),s=t&&t.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function wt(e,i,t,s){return{x:e.x+t*(i.x-e.x),y:e.y+t*(i.y-e.y)}}function Ro(e,i,t,s){return{x:e.x+t*(i.x-e.x),y:s==="middle"?t<.5?e.y:i.y:s==="after"?t<1?e.y:i.y:t>0?i.y:e.y}}function Eo(e,i,t,s){let n={x:e.cp2x,y:e.cp2y},o={x:i.cp1x,y:i.cp1y},r=wt(e,n,t),a=wt(n,o,t),l=wt(o,i,t),c=wt(r,a,t),h=wt(a,l,t);return wt(c,h,t)}var Al=function(e,i){return{x(t){return e+e+i-t},setWidth(t){i=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,s){return t-s},leftForLtr(t,s){return t-s}}},Tl=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,i){return e+i},leftForLtr(e,i){return e}}};function Vt(e,i,t){return e?Al(i,t):Tl()}function ms(e,i){let t,s;(i==="ltr"||i==="rtl")&&(t=e.canvas.style,s=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",i,"important"),e.prevTextDirection=s)}function bs(e,i){i!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",i[0],i[1]))}function Lo(e){return e==="angle"?{between:te,compare:Ka,normalize:U}:{between:ht,compare:(i,t)=>i-t,normalize:i=>i}}function so({start:e,end:i,count:t,loop:s,style:n}){return{start:e%t,end:i%t,loop:s&&(i-e+1)%t===0,style:n}}function Rl(e,i,t){let{property:s,start:n,end:o}=t,{between:r,normalize:a}=Lo(s),l=i.length,{start:c,end:h,loop:d}=e,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&r(a(i[c%l][s]),n,o);++u)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:e.style}}function xs(e,i,t){if(!t)return[e];let{property:s,start:n,end:o}=t,r=i.length,{compare:a,between:l,normalize:c}=Lo(s),{start:h,end:d,loop:u,style:f}=Rl(e,i,t),g=[],p=!1,m=null,b,x,y,w=()=>l(n,y,b)&&a(n,y)!==0,_=()=>a(o,b)===0||l(o,y,b),v=()=>p||w(),k=()=>!p||_();for(let M=h,S=h;M<=d;++M)x=i[M%r],!x.skip&&(b=c(x[s]),b!==y&&(p=l(b,n,o),m===null&&v()&&(m=a(b,n)===0?M:S),m!==null&&k()&&(g.push(so({start:m,end:M,loop:u,count:r,style:f})),m=null),S=M,y=b));return m!==null&&g.push(so({start:m,end:d,loop:u,count:r,style:f})),g}function _s(e,i){let t=[],s=e.segments;for(let n=0;n<s.length;n++){let o=xs(s[n],e.points,i);o.length&&t.push(...o)}return t}function El(e,i,t,s){let n=0,o=i-1;if(t&&!s)for(;n<i&&!e[n].skip;)n++;for(;n<i&&e[n].skip;)n++;for(n%=i,t&&(o+=n);o>n&&e[o%i].skip;)o--;return o%=i,{start:n,end:o}}function Ll(e,i,t,s){let n=e.length,o=[],r=i,a=e[i],l;for(l=i+1;l<=t;++l){let c=e[l%n];c.skip||c.stop?a.skip||(s=!1,o.push({start:i%n,end:(l-1)%n,loop:s}),i=r=c.stop?l:null):(r=l,a.skip&&(i=l)),a=c}return r!==null&&o.push({start:i%n,end:r%n,loop:s}),o}function Io(e,i){let t=e.points,s=e.options.spanGaps,n=t.length;if(!n)return[];let o=!!e._loop,{start:r,end:a}=El(t,n,o,s);if(s===!0)return no(e,[{start:r,end:a,loop:o}],t,i);let l=a<r?a+n:a,c=!!e._fullLoop&&r===0&&a===n-1;return no(e,Ll(t,r,l,c),t,i)}function no(e,i,t,s){return!s||!s.setContext||!t?i:Il(e,i,t,s)}function Il(e,i,t,s){let n=e._chart.getContext(),o=oo(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=t.length,c=[],h=o,d=i[0].start,u=d;function f(g,p,m,b){let x=a?-1:1;if(g!==p){for(g+=l;t[g%l].skip;)g-=x;for(;t[p%l].skip;)p+=x;g%l!==p%l&&(c.push({start:g%l,end:p%l,loop:m,style:b}),h=b,d=p%l)}}for(let g of i){d=a?d:g.start;let p=t[d%l],m;for(u=d+1;u<=g.end;u++){let b=t[u%l];m=oo(s.setContext(bt(n,{type:"segment",p0:p,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),Fl(m,h)&&f(d,u-1,g.loop,h),p=b,h=m}d<u-1&&f(d,u-1,g.loop,h)}return c}function oo(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Fl(e,i){if(!i)return!1;let t=[],s=function(n,o){return os(o)?(t.includes(o)||t.push(o),t.indexOf(o)):o};return JSON.stringify(e,s)!==JSON.stringify(i,s)}function Ue(e,i,t){return e.options.clip?e[t]:i[t]}function Bl(e,i){let{xScale:t,yScale:s}=e;return t&&s?{left:Ue(t,i,"left"),right:Ue(t,i,"right"),top:Ue(s,i,"top"),bottom:Ue(s,i,"bottom")}:i}function ys(e,i){let t=i._clip;if(t.disabled)return!1;let s=Bl(i,e.chartArea);return{left:t.left===!1?0:s.left-(t.left===!0?0:t.left),right:t.right===!1?e.width:s.right+(t.right===!0?0:t.right),top:t.top===!1?0:s.top-(t.top===!0?0:t.top),bottom:t.bottom===!1?e.height:s.bottom+(t.bottom===!0?0:t.bottom)}}var Rs=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(i,t,s,n){let o=t.listeners[n],r=t.duration;o.forEach(a=>a({chart:i,initial:t.initial,numSteps:r,currentStep:Math.min(s-t.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=es.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(i=Date.now()){let t=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;let o=s.items,r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(i),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,i,"progress")),o.length||(s.running=!1,this._notify(n,s,i,"complete"),s.initial=!1),t+=o.length}),this._lastDate=i,t===0&&(this._running=!1)}_getAnims(i){let t=this._charts,s=t.get(i);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(i,s)),s}listen(i,t,s){this._getAnims(i).listeners[t].push(s)}add(i,t){!t||!t.length||this._getAnims(i).items.push(...t)}has(i){return this._getAnims(i).items.length>0}start(i){let t=this._charts.get(i);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(i){if(!this._running)return!1;let t=this._charts.get(i);return!(!t||!t.running||!t.items.length)}stop(i){let t=this._charts.get(i);if(!t||!t.items.length)return;let s=t.items,n=s.length-1;for(;n>=0;--n)s[n].cancel();t.items=[],this._notify(i,t,Date.now(),"complete")}remove(i){return this._charts.delete(i)}},xt=new Rs,Fo="transparent",zl={boolean(e,i,t){return t>.5?i:e},color(e,i,t){let s=rs(e||Fo),n=s.valid&&rs(i||Fo);return n&&n.valid?n.mix(s,t).hexString():i},number(e,i,t){return e+(i-e)*t}},Es=class{constructor(i,t,s,n){let o=t[s];n=se([i.to,n,o,i.from]);let r=se([i.from,o,n]);this._active=!0,this._fn=i.fn||zl[i.type||typeof r],this._easing=Kt[i.easing]||Kt.linear,this._start=Math.floor(Date.now()+(i.delay||0)),this._duration=this._total=Math.floor(i.duration),this._loop=!!i.loop,this._target=t,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(i,t,s){if(this._active){this._notify(!1);let n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,i.duration)),this._total+=o,this._loop=!!i.loop,this._to=se([i.to,t,n,i.from]),this._from=se([i.from,n,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(i){let t=i-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to,l;if(this._active=o!==a&&(r||t<s),!this._active){this._target[n]=a,this._notify(!0);return}if(t<0){this._target[n]=o;return}l=t/s%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){let i=this._promises||(this._promises=[]);return new Promise((t,s)=>{i.push({res:t,rej:s})})}_notify(i){let t=i?"res":"rej",s=this._promises||[];for(let n=0;n<s.length;n++)s[n][t]()}},mi=class{constructor(i,t){this._chart=i,this._properties=new Map,this.configure(t)}configure(i){if(!A(i))return;let t=Object.keys(F.animation),s=this._properties;Object.getOwnPropertyNames(i).forEach(n=>{let o=i[n];if(!A(o))return;let r={};for(let a of t)r[a]=o[a];(B(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(i,t){let s=t.options,n=Nl(i,s);if(!n)return[];let o=this._createAnimations(n,s);return s.$shared&&Vl(i.options.$animations,s).then(()=>{i.options=s},()=>{}),o}_createAnimations(i,t){let s=this._properties,n=[],o=i.$animations||(i.$animations={}),r=Object.keys(t),a=Date.now(),l;for(l=r.length-1;l>=0;--l){let c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(i,t));continue}let h=t[c],d=o[c],u=s.get(c);if(d)if(u&&d.active()){d.update(u,h,a);continue}else d.cancel();if(!u||!u.duration){i[c]=h;continue}o[c]=d=new Es(u,i,c,h),n.push(d)}return n}update(i,t){if(this._properties.size===0){Object.assign(i,t);return}let s=this._createAnimations(i,t);if(s.length)return xt.add(this._chart,s),!0}};function Vl(e,i){let t=[],s=Object.keys(i);for(let n=0;n<s.length;n++){let o=e[s[n]];o&&o.active()&&t.push(o.wait())}return Promise.all(t)}function Nl(e,i){if(!i)return;let t=e.options;if(!t){e.options=i;return}return t.$shared&&(e.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t}function Bo(e,i){let t=e&&e.options||{},s=t.reverse,n=t.min===void 0?i:0,o=t.max===void 0?i:0;return{start:s?o:n,end:s?n:o}}function Wl(e,i,t){if(t===!1)return!1;let s=Bo(e,t),n=Bo(i,t);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function Hl(e){let i,t,s,n;return A(e)?(i=e.top,t=e.right,s=e.bottom,n=e.left):i=t=s=n=e,{top:i,right:t,bottom:s,left:n,disabled:e===!1}}function Fr(e,i){let t=[],s=e._getSortedDatasetMetas(i),n,o;for(n=0,o=s.length;n<o;++n)t.push(s[n].index);return t}function zo(e,i,t,s={}){let n=e.keys,o=s.mode==="single",r,a,l,c;if(i===null)return;let h=!1;for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===t){if(h=!0,s.all)continue;break}c=e.values[l],N(c)&&(o||i===0||ot(i)===ot(c))&&(i+=c)}return!h&&!s.all?0:i}function jl(e,i){let{iScale:t,vScale:s}=i,n=t.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length),l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[n]:h,[o]:e[h]};return a}function vs(e,i){let t=e&&e.options.stacked;return t||t===void 0&&i.stack!==void 0}function $l(e,i,t){return`${e.id}.${i.id}.${t.stack||t.type}`}function Yl(e){let{min:i,max:t,minDefined:s,maxDefined:n}=e.getUserBounds();return{min:s?i:Number.NEGATIVE_INFINITY,max:n?t:Number.POSITIVE_INFINITY}}function Ul(e,i,t){let s=e[i]||(e[i]={});return s[t]||(s[t]={})}function Vo(e,i,t,s){for(let n of i.getMatchingVisibleMetas(s).reverse()){let o=e[n.index];if(t&&o>0||!t&&o<0)return n.index}return null}function No(e,i){let{chart:t,_cachedMeta:s}=e,n=t._stacks||(t._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,h=$l(o,r,s),d=i.length,u;for(let f=0;f<d;++f){let g=i[f],{[l]:p,[c]:m}=g,b=g._stacks||(g._stacks={});u=b[c]=Ul(n,h,p),u[a]=m,u._top=Vo(u,r,!0,s.type),u._bottom=Vo(u,r,!1,s.type);let x=u._visualValues||(u._visualValues={});x[a]=m}}function ws(e,i){let t=e.scales;return Object.keys(t).filter(s=>t[s].axis===i).shift()}function Xl(e,i){return bt(e,{active:!1,dataset:void 0,datasetIndex:i,index:i,mode:"default",type:"dataset"})}function Kl(e,i,t){return bt(e,{active:!1,dataIndex:i,parsed:void 0,raw:void 0,element:t,index:i,mode:"default",type:"data"})}function ye(e,i){let t=e.controller.index,s=e.vScale&&e.vScale.axis;if(s){i=i||e._parsed;for(let n of i){let o=n._stacks;if(!o||o[s]===void 0||o[s][t]===void 0)return;delete o[s][t],o[s]._visualValues!==void 0&&o[s]._visualValues[t]!==void 0&&delete o[s]._visualValues[t]}}}var Ms=e=>e==="reset"||e==="none",Wo=(e,i)=>i?e:Object.assign({},e),ql=(e,i,t)=>e&&!i.hidden&&i._stacked&&{keys:Fr(t,!0),values:null},At=(()=>{class e{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,s){this.chart=t,this._ctx=t.ctx,this.index=s,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=vs(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ye(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,s=this._cachedMeta,n=this.getDataset(),o=(u,f,g,p)=>u==="x"?f:u==="r"?p:g,r=s.xAxisID=C(n.xAxisID,ws(t,"x")),a=s.yAxisID=C(n.yAxisID,ws(t,"y")),l=s.rAxisID=C(n.rAxisID,ws(t,"r")),c=s.indexAxis,h=s.iAxisID=o(c,r,a,l),d=s.vAxisID=o(c,a,r,l);s.xScale=this.getScaleForId(r),s.yScale=this.getScaleForId(a),s.rScale=this.getScaleForId(l),s.iScale=this.getScaleForId(h),s.vScale=this.getScaleForId(d)}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 s=this._cachedMeta;return t===s.iScale?s.vScale:s.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Qi(this._data,this),t._stacked&&ye(t)}_dataCheck(){let t=this.getDataset(),s=t.data||(t.data=[]),n=this._data;if(A(s)){let o=this._cachedMeta;this._data=jl(s,o)}else if(n!==s){if(n){Qi(n,this);let o=this._cachedMeta;ye(o),o._parsed=[]}s&&Object.isExtensible(s)&&bo(s,this),this._syncList=[],this._data=s}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let s=this._cachedMeta,n=this.getDataset(),o=!1;this._dataCheck();let r=s._stacked;s._stacked=vs(s.vScale,s),s.stack!==n.stack&&(o=!0,ye(s),s.stack=n.stack),this._resyncElements(t),(o||r!==s._stacked)&&(No(this,s._parsed),s._stacked=vs(s.vScale,s))}configure(){let t=this.chart.config,s=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),s,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,s){let{_cachedMeta:n,_data:o}=this,{iScale:r,_stacked:a}=n,l=r.axis,c=t===0&&s===o.length?!0:n._sorted,h=t>0&&n._parsed[t-1],d,u,f;if(this._parsing===!1)n._parsed=o,n._sorted=!0,f=o;else{B(o[t])?f=this.parseArrayData(n,o,t,s):A(o[t])?f=this.parseObjectData(n,o,t,s):f=this.parsePrimitiveData(n,o,t,s);let g=()=>u[l]===null||h&&u[l]<h[l];for(d=0;d<s;++d)n._parsed[d+t]=u=f[d],c&&(g()&&(c=!1),h=u);n._sorted=c}a&&No(this,f)}parsePrimitiveData(t,s,n,o){let{iScale:r,vScale:a}=t,l=r.axis,c=a.axis,h=r.getLabels(),d=r===a,u=new Array(o),f,g,p;for(f=0,g=o;f<g;++f)p=f+n,u[f]={[l]:d||r.parse(h[p],p),[c]:a.parse(s[p],p)};return u}parseArrayData(t,s,n,o){let{xScale:r,yScale:a}=t,l=new Array(o),c,h,d,u;for(c=0,h=o;c<h;++c)d=c+n,u=s[d],l[c]={x:r.parse(u[0],d),y:a.parse(u[1],d)};return l}parseObjectData(t,s,n,o){let{xScale:r,yScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,h=new Array(o),d,u,f,g;for(d=0,u=o;d<u;++d)f=d+n,g=s[f],h[d]={x:r.parse(mt(g,l),f),y:a.parse(mt(g,c),f)};return h}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,s,n){let o=this.chart,r=this._cachedMeta,a=s[t.axis],l={keys:Fr(o,!0),values:s._stacks[t.axis]._visualValues};return zo(l,a,r.index,{mode:n})}updateRangeFromParsed(t,s,n,o){let r=n[s.axis],a=r===null?NaN:r,l=o&&n._stacks[s.axis];o&&l&&(o.values=l,a=zo(o,r,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,s){let n=this._cachedMeta,o=n._parsed,r=n._sorted&&t===n.iScale,a=o.length,l=this._getOtherScale(t),c=ql(s,n,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:u}=Yl(l),f,g;function p(){g=o[f];let m=g[l.axis];return!N(g[t.axis])||d>m||u<m}for(f=0;f<a&&!(!p()&&(this.updateRangeFromParsed(h,t,g,c),r));++f);if(r){for(f=a-1;f>=0;--f)if(!p()){this.updateRangeFromParsed(h,t,g,c);break}}return h}getAllParsedValues(t){let s=this._cachedMeta._parsed,n=[],o,r,a;for(o=0,r=s.length;o<r;++o)a=s[o][t.axis],N(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(t){let s=this._cachedMeta,n=s.iScale,o=s.vScale,r=this.getParsed(t);return{label:n?""+n.getLabelForValue(r[n.axis]):"",value:o?""+o.getLabelForValue(r[o.axis]):""}}_update(t){let s=this._cachedMeta;this.update(t||"default"),s._clip=Hl(C(this.options.clip,Wl(s.xScale,s.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,s=this.chart,n=this._cachedMeta,o=n.data||[],r=s.chartArea,a=[],l=this._drawStart||0,c=this._drawCount||o.length-l,h=this.options.drawActiveElementsOnTop,d;for(n.dataset&&n.dataset.draw(t,r,l,c),d=l;d<l+c;++d){let u=o[d];u.hidden||(u.active&&h?a.push(u):u.draw(t,r))}for(d=0;d<a.length;++d)a[d].draw(t,r)}getStyle(t,s){let n=s?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,s,n){let o=this.getDataset(),r;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];r=a.$context||(a.$context=Kl(this.getContext(),t,a)),r.parsed=this.getParsed(t),r.raw=o.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Xl(this.chart.getContext(),this.index)),r.dataset=o,r.index=r.datasetIndex=this.index;return r.active=!!s,r.mode=n,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,s){return this._resolveElementOptions(this.dataElementType.id,s,t)}_resolveElementOptions(t,s="default",n){let o=s==="active",r=this._cachedDataOpts,a=t+"-"+s,l=r[a],c=this.enableOptionSharing&&Jt(n);if(l)return Wo(l,c);let h=this.chart.config,d=h.datasetElementScopeKeys(this._type,t),u=o?[`${t}Hover`,"hover",t,""]:[t,""],f=h.getOptionScopes(this.getDataset(),d),g=Object.keys(F.elements[t]),p=()=>this.getContext(n,o,s),m=h.resolveNamedOptions(f,g,p,u);return m.$shared&&(m.$shared=c,r[a]=Object.freeze(Wo(m,c))),m}_resolveAnimations(t,s,n){let o=this.chart,r=this._cachedDataOpts,a=`animation-${s}`,l=r[a];if(l)return l;let c;if(o.options.animation!==!1){let d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,s),f=d.getOptionScopes(this.getDataset(),u);c=d.createResolver(f,this.getContext(t,n,s))}let h=new mi(o,c&&c.animations);return c&&c._cacheable&&(r[a]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,s){return!s||Ms(t)||this.chart._animationsDisabled}_getSharedOptions(t,s){let n=this.resolveDataElementOptions(t,s),o=this._sharedOptions,r=this.getSharedOptions(n),a=this.includeOptions(s,r)||r!==o;return this.updateSharedOptions(r,s,n),{sharedOptions:r,includeOptions:a}}updateElement(t,s,n,o){Ms(o)?Object.assign(t,n):this._resolveAnimations(s,o).update(t,n)}updateSharedOptions(t,s,n){t&&!Ms(s)&&this._resolveAnimations(void 0,s).update(t,n)}_setStyle(t,s,n,o){t.active=o;let r=this.getStyle(s,o);this._resolveAnimations(s,n,o).update(t,{options:!o&&this.getSharedOptions(r)||r})}removeHoverStyle(t,s,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,s,n){this._setStyle(t,n,"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 s=this._data,n=this._cachedMeta.data;for(let[l,c,h]of this._syncList)this[l](c,h);this._syncList=[];let o=n.length,r=s.length,a=Math.min(r,o);a&&this.parse(0,a),r>o?this._insertElements(o,r-o,t):r<o&&this._removeElements(r,o-r)}_insertElements(t,s,n=!0){let o=this._cachedMeta,r=o.data,a=t+s,l,c=h=>{for(h.length+=s,l=h.length-1;l>=a;l--)h[l]=h[l-s]};for(c(r),l=t;l<a;++l)r[l]=new this.dataElementType;this._parsing&&c(o._parsed),this.parse(t,s),n&&this.updateElements(r,t,s,"reset")}updateElements(t,s,n,o){}_removeElements(t,s){let n=this._cachedMeta;if(this._parsing){let o=n._parsed.splice(t,s);n._stacked&&ye(n,o)}n.data.splice(t,s)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[s,n,o]=t;this[s](n,o)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,s){s&&this._sync(["_removeElements",t,s]);let n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}return e})();function Gl(e,i){if(!e._cache.$bar){let t=e.getMatchingVisibleMetas(i),s=[];for(let n=0,o=t.length;n<o;n++)s=s.concat(t[n].controller.getAllParsedValues(e));e._cache.$bar=ts(s.sort((n,o)=>n-o))}return e._cache.$bar}function Zl(e){let i=e.iScale,t=Gl(i,e.type),s=i._length,n,o,r,a,l=()=>{r===32767||r===-32768||(Jt(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(n=0,o=t.length;n<o;++n)r=i.getPixelForValue(t[n]),l();for(a=void 0,n=0,o=i.ticks.length;n<o;++n)r=i.getPixelForTick(n),l();return s}function Jl(e,i,t,s){let n=t.barThickness,o,r;return O(n)?(o=i.min*t.categoryPercentage,r=t.barPercentage):(o=n*s,r=1),{chunk:o/s,ratio:r,start:i.pixels[e]-o/2}}function Ql(e,i,t,s){let n=i.pixels,o=n[e],r=e>0?n[e-1]:null,a=e<n.length-1?n[e+1]:null,l=t.categoryPercentage;r===null&&(r=o-(a===null?i.end-i.start:a-o)),a===null&&(a=o+o-r);let c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/s,ratio:t.barPercentage,start:c}}function tc(e,i,t,s){let n=t.parse(e[0],s),o=t.parse(e[1],s),r=Math.min(n,o),a=Math.max(n,o),l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),i[t.axis]=c,i._custom={barStart:l,barEnd:c,start:n,end:o,min:r,max:a}}function Br(e,i,t,s){return B(e)?tc(e,i,t,s):i[t.axis]=t.parse(e,s),i}function Ho(e,i,t,s){let n=e.iScale,o=e.vScale,r=n.getLabels(),a=n===o,l=[],c,h,d,u;for(c=t,h=t+s;c<h;++c)u=i[c],d={},d[n.axis]=a||n.parse(r[c],c),l.push(Br(u,d,o,c));return l}function ks(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function ec(e,i,t){return e!==0?ot(e):(i.isHorizontal()?1:-1)*(i.min>=t?1:-1)}function ic(e){let i,t,s,n,o;return e.horizontal?(i=e.base>e.x,t="left",s="right"):(i=e.base<e.y,t="bottom",s="top"),i?(n="end",o="start"):(n="start",o="end"),{start:t,end:s,reverse:i,top:n,bottom:o}}function sc(e,i,t,s){let n=i.borderSkipped,o={};if(!n){e.borderSkipped=o;return}if(n===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:r,end:a,reverse:l,top:c,bottom:h}=ic(e);n==="middle"&&t&&(e.enableBorderRadius=!0,(t._top||0)===s?n=c:(t._bottom||0)===s?n=h:(o[jo(h,r,a,l)]=!0,n=c)),o[jo(n,r,a,l)]=!0,e.borderSkipped=o}function jo(e,i,t,s){return s?(e=nc(e,i,t),e=$o(e,t,i)):e=$o(e,i,t),e}function nc(e,i,t){return e===i?t:e===t?i:e}function $o(e,i,t){return e==="start"?i:e==="end"?t:e}function oc(e,{inflateAmount:i},t){e.inflateAmount=i==="auto"?t===1?.33:0:i}var rc=(()=>{class e extends At{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,s,n,o){return Ho(t,s,n,o)}parseArrayData(t,s,n,o){return Ho(t,s,n,o)}parseObjectData(t,s,n,o){let{iScale:r,vScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,h=r.axis==="x"?l:c,d=a.axis==="x"?l:c,u=[],f,g,p,m;for(f=n,g=n+o;f<g;++f)m=s[f],p={},p[r.axis]=r.parse(mt(m,h),f),u.push(Br(mt(m,d),p,a,f));return u}updateRangeFromParsed(t,s,n,o){super.updateRangeFromParsed(t,s,n,o);let r=n._custom;r&&s===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let s=this._cachedMeta,{iScale:n,vScale:o}=s,r=this.getParsed(t),a=r._custom,l=ks(a)?"["+a.start+", "+a.end+"]":""+o.getLabelForValue(r[o.axis]);return{label:""+n.getLabelForValue(r[n.axis]),value:l}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let s=this._cachedMeta;this.updateElements(s.data,0,s.data.length,t)}updateElements(t,s,n,o){let r=o==="reset",{index:a,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),h=l.isHorizontal(),d=this._getRuler(),{sharedOptions:u,includeOptions:f}=this._getSharedOptions(s,o);for(let g=s;g<s+n;g++){let p=this.getParsed(g),m=r||O(p[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(g),b=this._calculateBarIndexPixels(g,d),x=(p._stacks||{})[l.axis],y={horizontal:h,base:m.base,enableBorderRadius:!x||ks(p._custom)||a===x._top||a===x._bottom,x:h?m.head:b.center,y:h?b.center:m.head,height:h?b.size:Math.abs(m.size),width:h?Math.abs(m.size):b.size};f&&(y.options=u||this.resolveDataElementOptions(g,t[g].active?"active":o));let w=y.options||t[g].options;sc(y,w,x,a),oc(y,w,d.ratio),this.updateElement(t[g],g,y,o)}}_getStacks(t,s){let{iScale:n}=this._cachedMeta,o=n.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),r=n.options.stacked,a=[],l=this._cachedMeta.controller.getParsed(s),c=l&&l[n.axis],h=d=>{let u=d._parsed.find(g=>g[n.axis]===c),f=u&&u[d.vScale.axis];if(O(f)||isNaN(f))return!0};for(let d of o)if(!(s!==void 0&&h(d))&&((r===!1||a.indexOf(d.stack)===-1||r===void 0&&d.stack===void 0)&&a.push(d.stack),d.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,s=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===s).shift()}_getAxis(){let t={},s=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)t[C(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,s)]=!0;return Object.keys(t)}_getStackIndex(t,s,n){let o=this._getStacks(t,n),r=s!==void 0?o.indexOf(s):-1;return r===-1?o.length-1:r}_getRuler(){let t=this.options,s=this._cachedMeta,n=s.iScale,o=[],r,a;for(r=0,a=s.data.length;r<a;++r)o.push(n.getPixelForValue(this.getParsed(r)[n.axis],r));let l=t.barThickness;return{min:l||Zl(s),pixels:o,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:s,_stacked:n,index:o},options:{base:r,minBarLength:a}}=this,l=r||0,c=this.getParsed(t),h=c._custom,d=ks(h),u=c[s.axis],f=0,g=n?this.applyStack(s,c,n):u,p,m;g!==u&&(f=g-u,g=u),d&&(u=h.barStart,g=h.barEnd-h.barStart,u!==0&&ot(u)!==ot(h.barEnd)&&(f=0),f+=u);let b=!O(r)&&!d?r:f,x=s.getPixelForValue(b);if(this.chart.getDataVisibility(t)?p=s.getPixelForValue(f+g):p=x,m=p-x,Math.abs(m)<a){m=ec(m,s,l)*a,u===l&&(x-=m/2);let y=s.getPixelForDecimal(0),w=s.getPixelForDecimal(1),_=Math.min(y,w),v=Math.max(y,w);x=Math.max(Math.min(x,v),_),p=x+m,n&&!d&&(c._stacks[s.axis]._visualValues[o]=s.getValueForPixel(p)-s.getValueForPixel(x))}if(x===s.getPixelForValue(l)){let y=ot(m)*s.getLineWidthForValue(l)/2;x+=y,m-=y}return{size:m,base:x,head:p,center:p+m/2}}_calculateBarIndexPixels(t,s){let n=s.scale,o=this.options,r=o.skipNull,a=C(o.maxBarThickness,1/0),l,c,h=this._getAxisCount();if(s.grouped){let d=r?this._getStackCount(t):s.stackCount,u=o.barThickness==="flex"?Ql(t,s,o,d*h):Jl(t,s,o,d*h),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,g=this._getAxis().indexOf(C(f,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0)+g;l=u.start+u.chunk*p+u.chunk/2,c=Math.min(a,u.chunk*u.ratio)}else l=n.getPixelForValue(this.getParsed(t)[n.axis],t),c=Math.min(a,s.min*s.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){let t=this._cachedMeta,s=t.vScale,n=t.data,o=n.length,r=0;for(;r<o;++r)this.getParsed(r)[s.axis]!==null&&!n[r].hidden&&n[r].draw(this._ctx)}}return e})(),ac=(()=>{class e extends At{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,s,n,o){let r=super.parsePrimitiveData(t,s,n,o);for(let a=0;a<r.length;a++)r[a]._custom=this.resolveDataElementOptions(a+n).radius;return r}parseArrayData(t,s,n,o){let r=super.parseArrayData(t,s,n,o);for(let a=0;a<r.length;a++){let l=s[n+a];r[a]._custom=C(l[2],this.resolveDataElementOptions(a+n).radius)}return r}parseObjectData(t,s,n,o){let r=super.parseObjectData(t,s,n,o);for(let a=0;a<r.length;a++){let l=s[n+a];r[a]._custom=C(l&&l.r&&+l.r,this.resolveDataElementOptions(a+n).radius)}return r}getMaxOverflow(){let t=this._cachedMeta.data,s=0;for(let n=t.length-1;n>=0;--n)s=Math.max(s,t[n].size(this.resolveDataElementOptions(n))/2);return s>0&&s}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:o,yScale:r}=s,a=this.getParsed(t),l=o.getLabelForValue(a.x),c=r.getLabelForValue(a.y),h=a._custom;return{label:n[t]||"",value:"("+l+", "+c+(h?", "+h:"")+")"}}update(t){let s=this._cachedMeta.data;this.updateElements(s,0,s.length,t)}updateElements(t,s,n,o){let r=o==="reset",{iScale:a,vScale:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(s,o),d=a.axis,u=l.axis;for(let f=s;f<s+n;f++){let g=t[f],p=!r&&this.getParsed(f),m={},b=m[d]=r?a.getPixelForDecimal(.5):a.getPixelForValue(p[d]),x=m[u]=r?l.getBasePixel():l.getPixelForValue(p[u]);m.skip=isNaN(b)||isNaN(x),h&&(m.options=c||this.resolveDataElementOptions(f,g.active?"active":o),r&&(m.options.radius=0)),this.updateElement(g,f,m,o)}}resolveDataElementOptions(t,s){let n=this.getParsed(t),o=super.resolveDataElementOptions(t,s);o.$shared&&(o=Object.assign({},o,{$shared:!1}));let r=o.radius;return s!=="active"&&(o.radius=0),o.radius+=C(n&&n._custom,r),o}}return e})();function lc(e,i,t){let s=1,n=1,o=0,r=0;if(i<z){let a=e,l=a+i,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),u=Math.sin(l),f=(y,w,_)=>te(y,a,l,!0)?1:Math.max(w,w*t,_,_*t),g=(y,w,_)=>te(y,a,l,!0)?-1:Math.min(w,w*t,_,_*t),p=f(0,c,d),m=f(W,h,u),b=g(R,c,d),x=g(R+W,h,u);s=(p-b)/2,n=(m-x)/2,o=-(p+b)/2,r=-(m+x)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}var Qs=(()=>{class e extends At{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 s=t.data,{labels:{pointStyle:n,textAlign:o,color:r,useBorderRadius:a,borderRadius:l}}=t.legend.options;return s.labels.length&&s.datasets.length?s.labels.map((c,h)=>{let u=t.getDatasetMeta(0).controller.getStyle(h);return{text:c,fillStyle:u.backgroundColor,fontColor:r,hidden:!t.getDataVisibility(h),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:o,pointStyle:n,borderRadius:a&&(l||u.borderRadius),index:h}}):[]}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}}};constructor(t,s){super(t,s),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,s){let n=this.getDataset().data,o=this._cachedMeta;if(this._parsing===!1)o._parsed=n;else{let r=c=>+n[c];if(A(n[t])){let{key:c="value"}=this._parsing;r=h=>+mt(n[h],c)}let a,l;for(a=t,l=t+s;a<l;++a)o._parsed[a]=r(a)}}_getRotation(){return st(this.options.rotation-90)}_getCircumference(){return st(this.options.circumference)}_getRotationExtents(){let t=z,s=-z;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let o=this.chart.getDatasetMeta(n).controller,r=o._getRotation(),a=o._getCircumference();t=Math.min(t,r),s=Math.max(s,r+a)}return{rotation:t,circumference:s-t}}update(t){let s=this.chart,{chartArea:n}=s,o=this._cachedMeta,r=o.data,a=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,l=Math.max((Math.min(n.width,n.height)-a)/2,0),c=Math.min(ao(this.options.cutout,l),1),h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:p,offsetY:m}=lc(u,d,c),b=(n.width-a)/f,x=(n.height-a)/g,y=Math.max(Math.min(b,x)/2,0),w=Xi(this.options.radius,y),_=Math.max(w*c,0),v=(w-_)/this._getVisibleDatasetWeightTotal();this.offsetX=p*w,this.offsetY=m*w,o.total=this.calculateTotal(),this.outerRadius=w-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*h,0),this.updateElements(r,0,r.length,t)}_circumference(t,s){let n=this.options,o=this._cachedMeta,r=this._getCircumference();return s&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||o._parsed[t]===null||o.data[t].hidden?0:this.calculateCircumference(o._parsed[t]*r/z)}updateElements(t,s,n,o){let r=o==="reset",a=this.chart,l=a.chartArea,h=a.options.animation,d=(l.left+l.right)/2,u=(l.top+l.bottom)/2,f=r&&h.animateScale,g=f?0:this.innerRadius,p=f?0:this.outerRadius,{sharedOptions:m,includeOptions:b}=this._getSharedOptions(s,o),x=this._getRotation(),y;for(y=0;y<s;++y)x+=this._circumference(y,r);for(y=s;y<s+n;++y){let w=this._circumference(y,r),_=t[y],v={x:d+this.offsetX,y:u+this.offsetY,startAngle:x,endAngle:x+w,circumference:w,outerRadius:p,innerRadius:g};b&&(v.options=m||this.resolveDataElementOptions(y,_.active?"active":o)),x+=w,this.updateElement(_,y,v,o)}}calculateTotal(){let t=this._cachedMeta,s=t.data,n=0,o;for(o=0;o<s.length;o++){let r=t._parsed[o];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(o)&&!s[o].hidden&&(n+=Math.abs(r))}return n}calculateCircumference(t){let s=this._cachedMeta.total;return s>0&&!isNaN(t)?z*(Math.abs(t)/s):0}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart,o=n.data.labels||[],r=ee(s._parsed[t],n.options.locale);return{label:o[t]||"",value:r}}getMaxBorderWidth(t){let s=0,n=this.chart,o,r,a,l,c;if(!t){for(o=0,r=n.data.datasets.length;o<r;++o)if(n.isDatasetVisible(o)){a=n.getDatasetMeta(o),t=a.data,l=a.controller;break}}if(!t)return 0;for(o=0,r=t.length;o<r;++o)c=l.resolveDataElementOptions(o),c.borderAlign!=="inner"&&(s=Math.max(s,c.borderWidth||0,c.hoverBorderWidth||0));return s}getMaxOffset(t){let s=0;for(let n=0,o=t.length;n<o;++n){let r=this.resolveDataElementOptions(n);s=Math.max(s,r.offset||0,r.hoverOffset||0)}return s}_getRingWeightOffset(t){let s=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(s+=this._getRingWeight(n));return s}_getRingWeight(t){return Math.max(C(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}return e})(),cc=(()=>{class e extends At{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let s=this._cachedMeta,{dataset:n,data:o=[],_dataset:r}=s,a=this.chart._animationsDisabled,{start:l,count:c}=ss(s,o,a);this._drawStart=l,this._drawCount=c,ns(s)&&(l=0,c=o.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=o;let h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:h},t),this.updateElements(o,l,c,t)}updateElements(t,s,n,o){let r=o==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:h}=this._cachedMeta,{sharedOptions:d,includeOptions:u}=this._getSharedOptions(s,o),f=a.axis,g=l.axis,{spanGaps:p,segment:m}=this.options,b=zt(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||o==="none",y=s+n,w=t.length,_=s>0&&this.getParsed(s-1);for(let v=0;v<w;++v){let k=t[v],M=x?k:{};if(v<s||v>=y){M.skip=!0;continue}let S=this.getParsed(v),D=O(S[g]),P=M[f]=a.getPixelForValue(S[f],v),T=M[g]=r||D?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,S,c):S[g],v);M.skip=isNaN(P)||isNaN(T)||D,M.stop=v>0&&Math.abs(S[f]-_[f])>b,m&&(M.parsed=S,M.raw=h.data[v]),u&&(M.options=d||this.resolveDataElementOptions(v,k.active?"active":o)),x||this.updateElement(k,v,M,o),_=S}}getMaxOverflow(){let t=this._cachedMeta,s=t.dataset,n=s.options&&s.options.borderWidth||0,o=t.data||[];if(!o.length)return n;let r=o[0].size(this.resolveDataElementOptions(0)),a=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(n,r,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}return e})(),zr=(()=>{class e extends At{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 s=t.data;if(s.labels.length&&s.datasets.length){let{labels:{pointStyle:n,color:o}}=t.legend.options;return s.labels.map((r,a)=>{let c=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:o,lineWidth:c.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,s){super(t,s),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart,o=n.data.labels||[],r=ee(s._parsed[t].r,n.options.locale);return{label:o[t]||"",value:r}}parseObjectData(t,s,n,o){return fs.bind(this)(t,s,n,o)}update(t){let s=this._cachedMeta.data;this._updateRadius(),this.updateElements(s,0,s.length,t)}getMinMax(){let t=this._cachedMeta,s={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,o)=>{let r=this.getParsed(o).r;!isNaN(r)&&this.chart.getDataVisibility(o)&&(r<s.min&&(s.min=r),r>s.max&&(s.max=r))}),s}_updateRadius(){let t=this.chart,s=t.chartArea,n=t.options,o=Math.min(s.right-s.left,s.bottom-s.top),r=Math.max(o/2,0),a=Math.max(n.cutoutPercentage?r/100*n.cutoutPercentage:1,0),l=(r-a)/t.getVisibleDatasetCount();this.outerRadius=r-l*this.index,this.innerRadius=this.outerRadius-l}updateElements(t,s,n,o){let r=o==="reset",a=this.chart,c=a.options.animation,h=this._cachedMeta.rScale,d=h.xCenter,u=h.yCenter,f=h.getIndexAngle(0)-.5*R,g=f,p,m=360/this.countVisibleElements();for(p=0;p<s;++p)g+=this._computeAngle(p,o,m);for(p=s;p<s+n;p++){let b=t[p],x=g,y=g+this._computeAngle(p,o,m),w=a.getDataVisibility(p)?h.getDistanceFromCenterForValue(this.getParsed(p).r):0;g=y,r&&(c.animateScale&&(w=0),c.animateRotate&&(x=y=f));let _={x:d,y:u,innerRadius:0,outerRadius:w,startAngle:x,endAngle:y,options:this.resolveDataElementOptions(p,b.active?"active":o)};this.updateElement(b,p,_,o)}}countVisibleElements(){let t=this._cachedMeta,s=0;return t.data.forEach((n,o)=>{!isNaN(this.getParsed(o).r)&&this.chart.getDataVisibility(o)&&s++}),s}_computeAngle(t,s,n){return this.chart.getDataVisibility(t)?st(this.resolveDataElementOptions(t,s).angle||n):0}}return e})(),hc=(()=>{class e extends Qs{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}return e})(),dc=(()=>{class e extends At{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let s=this._cachedMeta.vScale,n=this.getParsed(t);return{label:s.getLabels()[t],value:""+s.getLabelForValue(n[s.axis])}}parseObjectData(t,s,n,o){return fs.bind(this)(t,s,n,o)}update(t){let s=this._cachedMeta,n=s.dataset,o=s.data||[],r=s.iScale.getLabels();if(n.points=o,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let l={_loop:!0,_fullLoop:r.length===o.length,options:a};this.updateElement(n,void 0,l,t)}this.updateElements(o,0,o.length,t)}updateElements(t,s,n,o){let r=this._cachedMeta.rScale,a=o==="reset";for(let l=s;l<s+n;l++){let c=t[l],h=this.resolveDataElementOptions(l,c.active?"active":o),d=r.getPointPositionForValue(l,this.getParsed(l).r),u=a?r.xCenter:d.x,f=a?r.yCenter:d.y,g={x:u,y:f,angle:d.angle,skip:isNaN(u)||isNaN(f),options:h};this.updateElement(c,l,g,o)}}}return e})(),uc=(()=>{class e extends At{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:o,yScale:r}=s,a=this.getParsed(t),l=o.getLabelForValue(a.x),c=r.getLabelForValue(a.y);return{label:n[t]||"",value:"("+l+", "+c+")"}}update(t){let s=this._cachedMeta,{data:n=[]}=s,o=this.chart._animationsDisabled,{start:r,count:a}=ss(s,n,o);if(this._drawStart=r,this._drawCount=a,ns(s)&&(r=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:l,_dataset:c}=s;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=n;let h=this.resolveDatasetElementOptions(t);h.segment=this.options.segment,this.updateElement(l,void 0,{animated:!o,options:h},t)}else this.datasetElementType&&(delete s.dataset,this.datasetElementType=!1);this.updateElements(n,r,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,s,n,o){let r=o==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:h}=this._cachedMeta,d=this.resolveDataElementOptions(s,o),u=this.getSharedOptions(d),f=this.includeOptions(o,u),g=a.axis,p=l.axis,{spanGaps:m,segment:b}=this.options,x=zt(m)?m:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||r||o==="none",w=s>0&&this.getParsed(s-1);for(let _=s;_<s+n;++_){let v=t[_],k=this.getParsed(_),M=y?v:{},S=O(k[p]),D=M[g]=a.getPixelForValue(k[g],_),P=M[p]=r||S?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,k,c):k[p],_);M.skip=isNaN(D)||isNaN(P)||S,M.stop=_>0&&Math.abs(k[g]-w[g])>x,b&&(M.parsed=k,M.raw=h.data[_]),f&&(M.options=u||this.resolveDataElementOptions(_,v.active?"active":o)),y||this.updateElement(v,_,M,o),w=k}this.updateSharedOptions(u,o,d)}getMaxOverflow(){let t=this._cachedMeta,s=t.data||[];if(!this.options.showLine){let l=0;for(let c=s.length-1;c>=0;--c)l=Math.max(l,s[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}let n=t.dataset,o=n.options&&n.options.borderWidth||0;if(!s.length)return o;let r=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(o,r,a)/2}}return e})(),fc=Object.freeze({__proto__:null,BarController:rc,BubbleController:ac,DoughnutController:Qs,LineController:cc,PieController:hc,PolarAreaController:zr,RadarController:dc,ScatterController:uc});function Nt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Ls=class e{static override(i){Object.assign(e.prototype,i)}options;constructor(i){this.options=i||{}}init(){}formats(){return Nt()}parse(){return Nt()}format(){return Nt()}add(){return Nt()}diff(){return Nt()}startOf(){return Nt()}endOf(){return Nt()}},pc={_date:Ls};function gc(e,i,t,s){let{controller:n,data:o,_sorted:r}=e,a=n._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&i===a.axis&&i!=="r"&&r&&o.length){let c=a._reversePixels?po:at;if(s){if(n._sharedOptions){let h=o[0],d=typeof h.getRange=="function"&&h.getRange(i);if(d){let u=c(o,i,t-d),f=c(o,i,t+d);return{lo:u.lo,hi:f.hi}}}}else{let h=c(o,i,t);if(l){let{vScale:d}=n._cachedMeta,{_parsed:u}=e,f=u.slice(0,h.lo+1).reverse().findIndex(p=>!O(p[d.axis]));h.lo-=Math.max(0,f);let g=u.slice(h.hi).findIndex(p=>!O(p[d.axis]));h.hi+=Math.max(0,g)}return h}}return{lo:0,hi:o.length-1}}function Ae(e,i,t,s,n){let o=e.getSortedVisibleDatasetMetas(),r=t[i];for(let a=0,l=o.length;a<l;++a){let{index:c,data:h}=o[a],{lo:d,hi:u}=gc(o[a],i,r,n);for(let f=d;f<=u;++f){let g=h[f];g.skip||s(g,c,f)}}}function mc(e){let i=e.indexOf("x")!==-1,t=e.indexOf("y")!==-1;return function(s,n){let o=i?Math.abs(s.x-n.x):0,r=t?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function Ss(e,i,t,s,n){let o=[];return!n&&!e.isPointInArea(i)||Ae(e,t,i,function(a,l,c){!n&&!lt(a,e.chartArea,0)||a.inRange(i.x,i.y,s)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function bc(e,i,t,s){let n=[];function o(r,a,l){let{startAngle:c,endAngle:h}=r.getProps(["startAngle","endAngle"],s),{angle:d}=Ji(r,{x:i.x,y:i.y});te(d,c,h)&&n.push({element:r,datasetIndex:a,index:l})}return Ae(e,t,i,o),n}function xc(e,i,t,s,n,o){let r=[],a=mc(t),l=Number.POSITIVE_INFINITY;function c(h,d,u){let f=h.inRange(i.x,i.y,n);if(s&&!f)return;let g=h.getCenterPoint(n);if(!(!!o||e.isPointInArea(g))&&!f)return;let m=a(i,g);m<l?(r=[{element:h,datasetIndex:d,index:u}],l=m):m===l&&r.push({element:h,datasetIndex:d,index:u})}return Ae(e,t,i,c),r}function Cs(e,i,t,s,n,o){return!o&&!e.isPointInArea(i)?[]:t==="r"&&!s?bc(e,i,t,n):xc(e,i,t,s,n,o)}function Yo(e,i,t,s,n){let o=[],r=t==="x"?"inXRange":"inYRange",a=!1;return Ae(e,t,i,(l,c,h)=>{l[r]&&l[r](i[t],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(i.x,i.y,n))}),s&&!a?[]:o}var _c={evaluateInteractionItems:Ae,modes:{index(e,i,t,s){let n=Dt(i,e),o=t.axis||"x",r=t.includeInvisible||!1,a=t.intersect?Ss(e,n,o,s,r):Cs(e,n,o,!1,s,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{let h=a[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(e,i,t,s){let n=Dt(i,e),o=t.axis||"xy",r=t.includeInvisible||!1,a=t.intersect?Ss(e,n,o,s,r):Cs(e,n,o,!1,s,r);if(a.length>0){let l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let h=0;h<c.length;++h)a.push({element:c[h],datasetIndex:l,index:h})}return a},point(e,i,t,s){let n=Dt(i,e),o=t.axis||"xy",r=t.includeInvisible||!1;return Ss(e,n,o,s,r)},nearest(e,i,t,s){let n=Dt(i,e),o=t.axis||"xy",r=t.includeInvisible||!1;return Cs(e,n,o,t.intersect,s,r)},x(e,i,t,s){let n=Dt(i,e);return Yo(e,n,"x",t.intersect,s)},y(e,i,t,s){let n=Dt(i,e);return Yo(e,n,"y",t.intersect,s)}}},Vr=["left","top","right","bottom"];function ve(e,i){return e.filter(t=>t.pos===i)}function Uo(e,i){return e.filter(t=>Vr.indexOf(t.pos)===-1&&t.box.axis===i)}function we(e,i){return e.sort((t,s)=>{let n=i?s:t,o=i?t:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function yc(e){let i=[],t,s,n,o,r,a;for(t=0,s=(e||[]).length;t<s;++t)n=e[t],{position:o,options:{stack:r,stackWeight:a=1}}=n,i.push({index:t,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&o+r,stackWeight:a});return i}function vc(e){let i={};for(let t of e){let{stack:s,pos:n,stackWeight:o}=t;if(!s||!Vr.includes(n))continue;let r=i[s]||(i[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return i}function wc(e,i){let t=vc(e),{vBoxMaxWidth:s,hBoxMaxHeight:n}=i,o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];let{fullSize:l}=a.box,c=t[a.stack],h=c&&a.stackWeight/c.weight;a.horizontal?(a.width=h?h*s:l&&i.availableWidth,a.height=n):(a.width=s,a.height=h?h*n:l&&i.availableHeight)}return t}function Mc(e){let i=yc(e),t=we(i.filter(c=>c.box.fullSize),!0),s=we(ve(i,"left"),!0),n=we(ve(i,"right")),o=we(ve(i,"top"),!0),r=we(ve(i,"bottom")),a=Uo(i,"x"),l=Uo(i,"y");return{fullSize:t,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:ve(i,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function Xo(e,i,t,s){return Math.max(e[t],i[t])+Math.max(e[s],i[s])}function Nr(e,i){e.top=Math.max(e.top,i.top),e.left=Math.max(e.left,i.left),e.bottom=Math.max(e.bottom,i.bottom),e.right=Math.max(e.right,i.right)}function kc(e,i,t,s){let{pos:n,box:o}=t,r=e.maxPadding;if(!A(n)){t.size&&(e[n]-=t.size);let d=s[t.stack]||{size:0,count:1};d.size=Math.max(d.size,t.horizontal?o.height:o.width),t.size=d.size/d.count,e[n]+=t.size}o.getPadding&&Nr(r,o.getPadding());let a=Math.max(0,i.outerWidth-Xo(r,e,"left","right")),l=Math.max(0,i.outerHeight-Xo(r,e,"top","bottom")),c=a!==e.w,h=l!==e.h;return e.w=a,e.h=l,t.horizontal?{same:c,other:h}:{same:h,other:c}}function Sc(e){let i=e.maxPadding;function t(s){let n=Math.max(i[s]-e[s],0);return e[s]+=n,n}e.y+=t("top"),e.x+=t("left"),t("right"),t("bottom")}function Cc(e,i){let t=i.maxPadding;function s(n){let o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(i[r],t[r])}),o}return s(e?["left","right"]:["top","bottom"])}function Se(e,i,t,s){let n=[],o,r,a,l,c,h;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||i.w,a.height||i.h,Cc(a.horizontal,i));let{same:d,other:u}=kc(i,t,a,s);c|=d&&n.length,h=h||u,l.fullSize||n.push(a)}return c&&Se(n,i,t,s)||h}function li(e,i,t,s,n){e.top=t,e.left=i,e.right=i+s,e.bottom=t+n,e.width=s,e.height=n}function Ko(e,i,t,s){let n=t.padding,{x:o,y:r}=i;for(let a of e){let l=a.box,c=s[a.stack]||{count:1,placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){let d=i.w*h,u=c.size||l.height;Jt(c.start)&&(r=c.start),l.fullSize?li(l,n.left,r,t.outerWidth-n.right-n.left,u):li(l,i.left+c.placed,r,d,u),c.start=r,c.placed+=d,r=l.bottom}else{let d=i.h*h,u=c.size||l.width;Jt(c.start)&&(o=c.start),l.fullSize?li(l,o,n.top,u,t.outerHeight-n.bottom-n.top):li(l,o,i.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}i.x=o,i.y=r}var G={addBox(e,i){e.boxes||(e.boxes=[]),i.fullSize=i.fullSize||!1,i.position=i.position||"top",i.weight=i.weight||0,i._layers=i._layers||function(){return[{z:0,draw(t){i.draw(t)}}]},e.boxes.push(i)},removeBox(e,i){let t=e.boxes?e.boxes.indexOf(i):-1;t!==-1&&e.boxes.splice(t,1)},configure(e,i,t){i.fullSize=t.fullSize,i.position=t.position,i.weight=t.weight},update(e,i,t,s){if(!e)return;let n=K(e.options.layout.padding),o=Math.max(i-n.width,0),r=Math.max(t-n.height,0),a=Mc(e.boxes),l=a.vertical,c=a.horizontal;E(e.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});let h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:i,outerHeight:t,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},n);Nr(u,K(s));let f=Object.assign({maxPadding:u,w:o,h:r,x:n.left,y:n.top},n),g=wc(l.concat(c),d);Se(a.fullSize,f,d,g),Se(l,f,d,g),Se(c,f,d,g)&&Se(l,f,d,g),Sc(f),Ko(a.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,Ko(a.rightAndBottom,f,d,g),e.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 m=p.box;Object.assign(m,e.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},bi=class{acquireContext(i,t){}releaseContext(i){return!1}addEventListener(i,t,s){}removeEventListener(i,t,s){}getDevicePixelRatio(){return 1}getMaximumSize(i,t,s,n){return t=Math.max(0,t||i.width),s=s||i.height,{width:t,height:Math.max(0,n?Math.floor(t/n):s)}}isAttached(i){return!0}updateConfig(i){}},Is=class extends bi{acquireContext(i){return i&&i.getContext&&i.getContext("2d")||null}updateConfig(i){i.options.animation=!1}},pi="$chartjs",Pc={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},qo=e=>e===null||e==="";function Dc(e,i){let t=e.style,s=e.getAttribute("height"),n=e.getAttribute("width");if(e[pi]={initial:{height:s,width:n,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",qo(n)){let o=gs(e,"width");o!==void 0&&(e.width=o)}if(qo(s))if(e.style.height==="")e.height=e.width/(i||2);else{let o=gs(e,"height");o!==void 0&&(e.height=o)}return e}var Wr=To?{passive:!0}:!1;function Oc(e,i,t){e&&e.addEventListener(i,t,Wr)}function Ac(e,i,t){e&&e.canvas&&e.canvas.removeEventListener(i,t,Wr)}function Tc(e,i){let t=Pc[e.type]||e.type,{x:s,y:n}=Dt(e,i);return{type:t,chart:i,native:e,x:s!==void 0?s:null,y:n!==void 0?n:null}}function xi(e,i){for(let t of e)if(t===i||t.contains(i))return!0}function Rc(e,i,t){let s=e.canvas,n=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||xi(a.addedNodes,s),r=r&&!xi(a.removedNodes,s);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}function Ec(e,i,t){let s=e.canvas,n=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||xi(a.removedNodes,s),r=r&&!xi(a.addedNodes,s);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}var Pe=new Map,Go=0;function Hr(){let e=window.devicePixelRatio;e!==Go&&(Go=e,Pe.forEach((i,t)=>{t.currentDevicePixelRatio!==e&&i()}))}function Lc(e,i){Pe.size||window.addEventListener("resize",Hr),Pe.set(e,i)}function Ic(e){Pe.delete(e),Pe.size||window.removeEventListener("resize",Hr)}function Fc(e,i,t){let s=e.canvas,n=s&&ri(s);if(!n)return;let o=is((a,l)=>{let c=n.clientWidth;t(a,l),c<n.clientWidth&&t()},window),r=new ResizeObserver(a=>{let l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),Lc(e,o),r}function Ps(e,i,t){t&&t.disconnect(),i==="resize"&&Ic(e)}function Bc(e,i,t){let s=e.canvas,n=is(o=>{e.ctx!==null&&t(Tc(o,e))},e);return Oc(s,i,n),n}var Fs=class extends bi{acquireContext(i,t){let s=i&&i.getContext&&i.getContext("2d");return s&&s.canvas===i?(Dc(i,t),s):null}releaseContext(i){let t=i.canvas;if(!t[pi])return!1;let s=t[pi].initial;["height","width"].forEach(o=>{let r=s[o];O(r)?t.removeAttribute(o):t.setAttribute(o,r)});let n=s.style||{};return Object.keys(n).forEach(o=>{t.style[o]=n[o]}),t.width=t.width,delete t[pi],!0}addEventListener(i,t,s){this.removeEventListener(i,t);let n=i.$proxies||(i.$proxies={}),r={attach:Rc,detach:Ec,resize:Fc}[t]||Bc;n[t]=r(i,t,s)}removeEventListener(i,t){let s=i.$proxies||(i.$proxies={}),n=s[t];if(!n)return;({attach:Ps,detach:Ps,resize:Ps}[t]||Ac)(i,t,n),s[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(i,t,s,n){return Ao(i,t,s,n)}isAttached(i){let t=i&&ri(i);return!!(t&&t.isConnected)}};function zc(e){return!oi()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Is:Fs}var rt=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(i){let{x:t,y:s}=this.getProps(["x","y"],i);return{x:t,y:s}}hasValue(){return zt(this.x)&&zt(this.y)}getProps(i,t){let s=this.$animations;if(!t||!s)return this;let n={};return i.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}};function Vc(e,i){let t=e.options.ticks,s=Nc(e),n=Math.min(t.maxTicksLimit||s,s),o=t.major.enabled?Hc(i):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return jc(i,c,o,r/n),c;let h=Wc(o,i,n);if(r>0){let d,u,f=r>1?Math.round((l-a)/(r-1)):null;for(ci(i,c,h,O(f)?0:a-f,a),d=0,u=r-1;d<u;d++)ci(i,c,h,o[d],o[d+1]);return ci(i,c,h,l,O(f)?i.length:l+f),c}return ci(i,c,h),c}function Nc(e){let i=e.options.offset,t=e._tickSize(),s=e._length/t+(i?0:1),n=e._maxLength/t;return Math.floor(Math.min(s,n))}function Wc(e,i,t){let s=$c(e),n=i.length/t;if(!s)return Math.max(n,1);let o=ho(s);for(let r=0,a=o.length-1;r<a;r++){let l=o[r];if(l>n)return l}return Math.max(n,1)}function Hc(e){let i=[],t,s;for(t=0,s=e.length;t<s;t++)e[t].major&&i.push(t);return i}function jc(e,i,t,s){let n=0,o=t[0],r;for(s=Math.ceil(s),r=0;r<e.length;r++)r===o&&(i.push(e[r]),n++,o=t[n*s])}function ci(e,i,t,s,n){let o=C(s,0),r=Math.min(C(n,e.length),e.length),a=0,l,c,h;for(t=Math.ceil(t),n&&(l=n-s,t=l/Math.floor(l/t)),h=o;h<0;)a++,h=Math.round(o+a*t);for(c=Math.max(o,0);c<r;c++)c===h&&(i.push(e[c]),a++,h=Math.round(o+a*t))}function $c(e){let i=e.length,t,s;if(i<2)return!1;for(s=e[0],t=1;t<i;++t)if(e[t]-e[t-1]!==s)return!1;return s}var Yc=e=>e==="left"?"right":e==="right"?"left":e,Zo=(e,i,t)=>i==="top"||i==="left"?e[i]+t:e[i]-t,Jo=(e,i)=>Math.min(i||e,e);function Qo(e,i){let t=[],s=e.length/i,n=e.length,o=0;for(;o<n;o+=s)t.push(e[Math.floor(o)]);return t}function Uc(e,i,t){let s=e.ticks.length,n=Math.min(i,s-1),o=e._startPixel,r=e._endPixel,a=1e-6,l=e.getPixelForTick(n),c;if(!(t&&(s===1?c=Math.max(l-o,r-l):i===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(n-1))/2,l+=n<i?c:-c,l<o-a||l>r+a)))return l}function Xc(e,i){E(e,t=>{let s=t.gc,n=s.length/2,o;if(n>i){for(o=0;o<n;++o)delete t.data[s[o]];s.splice(0,n)}})}function Me(e){return e.drawTicks?e.tickLength:0}function tr(e,i){if(!e.display)return 0;let t=j(e.font,i),s=K(e.padding);return(B(e.text)?e.text.length:1)*t.lineHeight+s.height}function Kc(e,i){return bt(e,{scale:i,type:"scale"})}function qc(e,i,t){return bt(e,{tick:t,index:i,type:"tick"})}function Gc(e,i,t){let s=ti(e);return(t&&i!=="right"||!t&&i==="right")&&(s=Yc(s)),s}function Zc(e,i,t,s){let{top:n,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:h}=l,d=0,u,f,g,p=r-n,m=a-o;if(e.isHorizontal()){if(f=X(s,o,a),A(t)){let b=Object.keys(t)[0],x=t[b];g=h[b].getPixelForValue(x)+p-i}else t==="center"?g=(c.bottom+c.top)/2+p-i:g=Zo(e,t,i);u=a-o}else{if(A(t)){let b=Object.keys(t)[0],x=t[b];f=h[b].getPixelForValue(x)-m+i}else t==="center"?f=(c.left+c.right)/2-m+i:f=Zo(e,t,i);g=X(s,r,n),d=t==="left"?-W:W}return{titleX:f,titleY:g,maxWidth:u,rotation:d}}var Ht=class e extends rt{constructor(i){super(),this.id=i.id,this.type=i.type,this.options=void 0,this.ctx=i.ctx,this.chart=i.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(i){this.options=i.setContext(this.getContext()),this.axis=i.axis,this._userMin=this.parse(i.min),this._userMax=this.parse(i.max),this._suggestedMin=this.parse(i.suggestedMin),this._suggestedMax=this.parse(i.suggestedMax)}parse(i,t){return i}getUserBounds(){let{_userMin:i,_userMax:t,_suggestedMin:s,_suggestedMax:n}=this;return i=J(i,Number.POSITIVE_INFINITY),t=J(t,Number.NEGATIVE_INFINITY),s=J(s,Number.POSITIVE_INFINITY),n=J(n,Number.NEGATIVE_INFINITY),{min:J(i,s),max:J(t,n),minDefined:N(i),maxDefined:N(t)}}getMinMax(i){let{min:t,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),r;if(n&&o)return{min:t,max:s};let a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,i),n||(t=Math.min(t,r.min)),o||(s=Math.max(s,r.max));return t=o&&t>s?s:t,s=n&&t>s?t:s,{min:J(t,J(s,t)),max:J(s,J(t,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let i=this.chart.data;return this.options.labels||(this.isHorizontal()?i.xLabels:i.yLabels)||i.labels||[]}getLabelItems(i=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(i))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(i,t,s){let{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=i,this.maxHeight=t,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ko(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a<this.ticks.length;this._convertTicksToLabels(l?Qo(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=Vc(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let i=this.options.reverse,t,s;this.isHorizontal()?(t=this.left,s=this.right):(t=this.top,s=this.bottom,i=!i),this._startPixel=t,this._endPixel=s,this._reversePixels=i,this._length=s-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){I(this.options.afterSetDimensions,[this])}_callHooks(i){this.chart.notifyPlugins(i,this.getContext()),I(this.options[i],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(i){let t=this.options.ticks,s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s],o.label=I(t.callback,[o.value,s,i],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let i=this.options,t=i.ticks,s=Jo(this.ticks.length,i.ticks.maxTicksLimit),n=t.minRotation||0,o=t.maxRotation,r=n,a,l,c;if(!this._isVisible()||!t.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=$(this.chart.width-d,0,this.maxWidth);a=i.offset?this.maxWidth/s:f/(s-1),d+6>a&&(a=f/(s-(i.offset?.5:1)),l=this.maxHeight-Me(i.grid)-t.padding-tr(i.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),r=Je(Math.min(Math.asin($((h.highest.height+6)/a,-1,1)),Math.asin($(l/c,-1,1))-Math.asin($(u/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){let i={width:0,height:0},{chart:t,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let l=tr(n,t.options.font);if(a?(i.width=this.maxWidth,i.height=Me(o)+l):(i.height=this.maxHeight,i.width=Me(o)+l),s.display&&this.ticks.length){let{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,g=st(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){let b=s.mirror?0:m*d.width+p*u.height;i.height=Math.min(this.maxHeight,i.height+b+f)}else{let b=s.mirror?0:p*d.width+m*u.height;i.width=Math.min(this.maxWidth,i.width+b+f)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=i.height):(this.width=i.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(i,t,s,n){let{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=n*i.width,f=s*t.height):(u=s*i.height,f=n*t.width):o==="start"?f=t.width:o==="end"?u=i.width:o!=="inner"&&(u=i.width/2,f=t.width/2),this.paddingLeft=Math.max((u-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+r)*this.width/(this.width-d),0)}else{let h=t.height/2,d=i.height/2;o==="start"?(h=0,d=i.height):o==="end"&&(h=t.height,d=0),this.paddingTop=h+r,this.paddingBottom=d+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(){I(this.options.afterFit,[this])}isHorizontal(){let{axis:i,position:t}=this.options;return t==="top"||t==="bottom"||i==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(i){this.beforeTickToLabelConversion(),this.generateTickLabels(i);let t,s;for(t=0,s=i.length;t<s;t++)O(i[t].label)&&(i.splice(t,1),s--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let i=this._labelSizes;if(!i){let t=this.options.ticks.sampleSize,s=this.ticks;t<s.length&&(s=Qo(s,t)),this._labelSizes=i=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return i}_computeLabelSizes(i,t,s){let{ctx:n,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(t/Jo(t,s)),c=0,h=0,d,u,f,g,p,m,b,x,y,w,_;for(d=0;d<t;d+=l){if(g=i[d].label,p=this._resolveTickFontOptions(d),n.font=m=p.string,b=o[m]=o[m]||{data:{},gc:[]},x=p.lineHeight,y=w=0,!O(g)&&!B(g))y=ge(n,b.data,b.gc,y,g),w=x;else if(B(g))for(u=0,f=g.length;u<f;++u)_=g[u],!O(_)&&!B(_)&&(y=ge(n,b.data,b.gc,y,_),w+=x);r.push(y),a.push(w),c=Math.max(y,c),h=Math.max(w,h)}Xc(o,t);let v=r.indexOf(c),k=a.indexOf(h),M=S=>({width:r[S]||0,height:a[S]||0});return{first:M(0),last:M(t-1),widest:M(v),highest:M(k),widths:r,heights:a}}getLabelForValue(i){return i}getPixelForValue(i,t){return NaN}getValueForPixel(i){}getPixelForTick(i){let t=this.ticks;return i<0||i>t.length-1?null:this.getPixelForValue(t[i].value)}getPixelForDecimal(i){this._reversePixels&&(i=1-i);let t=this._startPixel+i*this._length;return fo(this._alignToPixels?St(this.chart,t,0):t)}getDecimalForPixel(i){let t=(i-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:i,max:t}=this;return i<0&&t<0?t:i>0&&t>0?i:0}getContext(i){let t=this.ticks||[];if(i>=0&&i<t.length){let s=t[i];return s.$context||(s.$context=qc(this.getContext(),i,s))}return this.$context||(this.$context=Kc(this.chart.getContext(),this))}_tickSize(){let i=this.options.ticks,t=st(this.labelRotation),s=Math.abs(Math.cos(t)),n=Math.abs(Math.sin(t)),o=this._getLabelSizes(),r=i.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*s>a*n?a/s:l/n:l*n<a*s?l/s:a/n}_isVisible(){let i=this.options.display;return i!=="auto"?!!i:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(i){let t=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=Me(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(V){return St(s,V,p)},x,y,w,_,v,k,M,S,D,P,T,Y;if(r==="top")x=b(this.bottom),k=this.bottom-u,S=x-m,P=b(i.top)+m,Y=i.bottom;else if(r==="bottom")x=b(this.top),P=i.top,Y=b(i.bottom)-m,k=x+m,S=this.top+u;else if(r==="left")x=b(this.right),v=this.right-u,M=x-m,D=b(i.left)+m,T=i.right;else if(r==="right")x=b(this.left),D=i.left,T=b(i.right)-m,v=x+m,M=this.left+u;else if(t==="x"){if(r==="center")x=b((i.top+i.bottom)/2+.5);else if(A(r)){let V=Object.keys(r)[0],H=r[V];x=b(this.chart.scales[V].getPixelForValue(H))}P=i.top,Y=i.bottom,k=x+m,S=k+u}else if(t==="y"){if(r==="center")x=b((i.left+i.right)/2);else if(A(r)){let V=Object.keys(r)[0],H=r[V];x=b(this.chart.scales[V].getPixelForValue(H))}v=x-m,M=v-u,D=i.left,T=i.right}let et=C(n.ticks.maxTicksLimit,d),L=Math.max(1,Math.ceil(d/et));for(y=0;y<d;y+=L){let V=this.getContext(y),H=o.setContext(V),nt=a.setContext(V),q=H.lineWidth,$t=H.color,Te=nt.dash||[],Yt=nt.dashOffset,ae=H.tickWidth,Tt=H.tickColor,le=H.tickBorderDash||[],Rt=H.tickBorderDashOffset;w=Uc(this,y,l),w!==void 0&&(_=St(s,w,q),c?v=M=D=T=_:k=S=P=Y=_,f.push({tx1:v,ty1:k,tx2:M,ty2:S,x1:D,y1:P,x2:T,y2:Y,width:q,color:$t,borderDash:Te,borderDashOffset:Yt,tickWidth:ae,tickColor:Tt,tickBorderDash:le,tickBorderDashOffset:Rt}))}return this._ticksLength=d,this._borderValue=x,f}_computeLabelItems(i){let t=this.axis,s=this.options,{position:n,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=Me(s.grid),f=u+h,g=d?-h:f,p=-st(this.labelRotation),m=[],b,x,y,w,_,v,k,M,S,D,P,T,Y="middle";if(n==="top")v=this.bottom-g,k=this._getXAxisLabelAlignment();else if(n==="bottom")v=this.top+g,k=this._getXAxisLabelAlignment();else if(n==="left"){let L=this._getYAxisLabelAlignment(u);k=L.textAlign,_=L.x}else if(n==="right"){let L=this._getYAxisLabelAlignment(u);k=L.textAlign,_=L.x}else if(t==="x"){if(n==="center")v=(i.top+i.bottom)/2+f;else if(A(n)){let L=Object.keys(n)[0],V=n[L];v=this.chart.scales[L].getPixelForValue(V)+f}k=this._getXAxisLabelAlignment()}else if(t==="y"){if(n==="center")_=(i.left+i.right)/2-f;else if(A(n)){let L=Object.keys(n)[0],V=n[L];_=this.chart.scales[L].getPixelForValue(V)}k=this._getYAxisLabelAlignment(u).textAlign}t==="y"&&(l==="start"?Y="top":l==="end"&&(Y="bottom"));let et=this._getLabelSizes();for(b=0,x=a.length;b<x;++b){y=a[b],w=y.label;let L=o.setContext(this.getContext(b));M=this.getPixelForTick(b)+o.labelOffset,S=this._resolveTickFontOptions(b),D=S.lineHeight,P=B(w)?w.length:1;let V=P/2,H=L.color,nt=L.textStrokeColor,q=L.textStrokeWidth,$t=k;r?(_=M,k==="inner"&&(b===x-1?$t=this.options.reverse?"left":"right":b===0?$t=this.options.reverse?"right":"left":$t="center"),n==="top"?c==="near"||p!==0?T=-P*D+D/2:c==="center"?T=-et.highest.height/2-V*D+D:T=-et.highest.height+D/2:c==="near"||p!==0?T=D/2:c==="center"?T=et.highest.height/2-V*D:T=et.highest.height-P*D,d&&(T*=-1),p!==0&&!L.showLabelBackdrop&&(_+=D/2*Math.sin(p))):(v=M,T=(1-P)*D/2);let Te;if(L.showLabelBackdrop){let Yt=K(L.backdropPadding),ae=et.heights[b],Tt=et.widths[b],le=T-Yt.top,Rt=0-Yt.left;switch(Y){case"middle":le-=ae/2;break;case"bottom":le-=ae;break}switch(k){case"center":Rt-=Tt/2;break;case"right":Rt-=Tt;break;case"inner":b===x-1?Rt-=Tt:b>0&&(Rt-=Tt/2);break}Te={left:Rt,top:le,width:Tt+Yt.width,height:ae+Yt.height,color:L.backdropColor}}m.push({label:w,font:S,textOffset:T,options:{rotation:p,color:H,strokeColor:nt,strokeWidth:q,textAlign:$t,textBaseline:Y,translation:[_,v],backdrop:Te}})}return m}_getXAxisLabelAlignment(){let{position:i,ticks:t}=this.options;if(-st(this.labelRotation))return i==="top"?"left":"right";let n="center";return t.align==="start"?n="left":t.align==="end"?n="right":t.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(i){let{position:t,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=i+o,l=r.widest.width,c,h;return t==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):t==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;let i=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:i.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:i.width}}drawBackground(){let{ctx:i,options:{backgroundColor:t},left:s,top:n,width:o,height:r}=this;t&&(i.save(),i.fillStyle=t,i.fillRect(s,n,o,r),i.restore())}getLineWidthForValue(i){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(o=>o.value===i);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(i){let t=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(i)),o,r,a=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(t.display)for(o=0,r=n.length;o<r;++o){let l=n[o];t.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),t.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:i,ctx:t,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;let a=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,h,d,u;this.isHorizontal()?(c=St(i,this.left,r)-r/2,h=St(i,this.right,a)+a/2,d=u=l):(d=St(i,this.top,r)-r/2,u=St(i,this.bottom,a)+a/2,c=h=l),t.save(),t.lineWidth=o.width,t.strokeStyle=o.color,t.beginPath(),t.moveTo(c,d),t.lineTo(h,u),t.stroke(),t.restore()}drawLabels(i){if(!this.options.ticks.display)return;let s=this.ctx,n=this._computeLabelArea();n&&xe(s,n);let o=this.getLabelItems(i);for(let r of o){let a=r.options,l=r.font,c=r.label,h=r.textOffset;Ct(s,c,0,h,l,a)}n&&_e(s)}drawTitle(){let{ctx:i,options:{position:t,title:s,reverse:n}}=this;if(!s.display)return;let o=j(s.font),r=K(s.padding),a=s.align,l=o.lineHeight/2;t==="bottom"||t==="center"||A(t)?(l+=r.bottom,B(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=r.top;let{titleX:c,titleY:h,maxWidth:d,rotation:u}=Zc(this,l,t,a);Ct(i,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:u,textAlign:Gc(a,t,n),textBaseline:"middle",translation:[c,h]})}draw(i){this._isVisible()&&(this.drawBackground(),this.drawGrid(i),this.drawBorder(),this.drawTitle(),this.drawLabels(i))}_layers(){let i=this.options,t=i.ticks&&i.ticks.z||0,s=C(i.grid&&i.grid.z,-1),n=C(i.border&&i.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:t,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:t,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(i){let t=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[],o,r;for(o=0,r=t.length;o<r;++o){let a=t[o];a[s]===this.id&&(!i||a.type===i)&&n.push(a)}return n}_resolveTickFontOptions(i){let t=this.options.ticks.setContext(this.getContext(i));return j(t.font)}_maxDigits(){let i=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/i}},oe=class{constructor(i,t,s){this.type=i,this.scope=t,this.override=s,this.items=Object.create(null)}isForType(i){return Object.prototype.isPrototypeOf.call(this.type.prototype,i.prototype)}register(i){let t=Object.getPrototypeOf(i),s;th(t)&&(s=this.register(t));let n=this.items,o=i.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+i);return o in n||(n[o]=i,Jc(i,r,s),this.override&&F.override(i.id,i.overrides)),r}get(i){return this.items[i]}unregister(i){let t=this.items,s=i.id,n=this.scope;s in t&&delete t[s],n&&s in F[n]&&(delete F[n][s],this.override&&delete kt[s])}};function Jc(e,i,t){let s=qt(Object.create(null),[t?F.get(t):{},F.get(i),e.defaults]);F.set(i,s),e.defaultRoutes&&Qc(i,e.defaultRoutes),e.descriptors&&F.describe(i,e.descriptors)}function Qc(e,i){Object.keys(i).forEach(t=>{let s=t.split("."),n=s.pop(),o=[e].concat(s).join("."),r=i[t].split("."),a=r.pop(),l=r.join(".");F.route(o,n,l,a)})}function th(e){return"id"in e&&"defaults"in e}var Bs=class{constructor(){this.controllers=new oe(At,"datasets",!0),this.elements=new oe(rt,"elements"),this.plugins=new oe(Object,"plugins"),this.scales=new oe(Ht,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...i){this._each("register",i)}remove(...i){this._each("unregister",i)}addControllers(...i){this._each("register",i,this.controllers)}addElements(...i){this._each("register",i,this.elements)}addPlugins(...i){this._each("register",i,this.plugins)}addScales(...i){this._each("register",i,this.scales)}getController(i){return this._get(i,this.controllers,"controller")}getElement(i){return this._get(i,this.elements,"element")}getPlugin(i){return this._get(i,this.plugins,"plugin")}getScale(i){return this._get(i,this.scales,"scale")}removeControllers(...i){this._each("unregister",i,this.controllers)}removeElements(...i){this._each("unregister",i,this.elements)}removePlugins(...i){this._each("unregister",i,this.plugins)}removeScales(...i){this._each("unregister",i,this.scales)}_each(i,t,s){[...t].forEach(n=>{let o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(i,o,n):E(n,r=>{let a=s||this._getRegistryForType(r);this._exec(i,a,r)})})}_exec(i,t,s){let n=Ze(i);I(s["before"+n],[],s),t[i](s),I(s["after"+n],[],s)}_getRegistryForType(i){for(let t=0;t<this._typedRegistries.length;t++){let s=this._typedRegistries[t];if(s.isForType(i))return s}return this.plugins}_get(i,t,s){let n=t.get(i);if(n===void 0)throw new Error('"'+i+'" is not a registered '+s+".");return n}},ut=new Bs,zs=class{constructor(){this._init=void 0}notify(i,t,s,n){if(t==="beforeInit"&&(this._init=this._createDescriptors(i,!0),this._notify(this._init,i,"install")),this._init===void 0)return;let o=n?this._descriptors(i).filter(n):this._descriptors(i),r=this._notify(o,i,t,s);return t==="afterDestroy"&&(this._notify(o,i,"stop"),this._notify(this._init,i,"uninstall"),this._init=void 0),r}_notify(i,t,s,n){n=n||{};for(let o of i){let r=o.plugin,a=r[s],l=[t,n,o.options];if(I(a,l,r)===!1&&n.cancelable)return!1}return!0}invalidate(){O(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(i){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(i);return this._notifyStateChanges(i),t}_createDescriptors(i,t){let s=i&&i.config,n=C(s.options&&s.options.plugins,{}),o=eh(s);return n===!1&&!t?[]:sh(i,o,n,t)}_notifyStateChanges(i){let t=this._oldCache||[],s=this._cache,n=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(t,s),i,"stop"),this._notify(n(s,t),i,"start")}};function eh(e){let i={},t=[],s=Object.keys(ut.plugins.items);for(let o=0;o<s.length;o++)t.push(ut.getPlugin(s[o]));let n=e.plugins||[];for(let o=0;o<n.length;o++){let r=n[o];t.indexOf(r)===-1&&(t.push(r),i[r.id]=!0)}return{plugins:t,localIds:i}}function ih(e,i){return!i&&e===!1?null:e===!0?{}:e}function sh(e,{plugins:i,localIds:t},s,n){let o=[],r=e.getContext();for(let a of i){let l=a.id,c=ih(s[l],n);c!==null&&o.push({plugin:a,options:nh(e.config,{plugin:a,local:t[l]},c,r)})}return o}function nh(e,{plugin:i,local:t},s,n){let o=e.pluginScopeKeys(i),r=e.getOptionScopes(s,o);return t&&i.defaults&&r.push(i.defaults),e.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Vs(e,i){let t=F.datasets[e]||{};return((i.datasets||{})[e]||{}).indexAxis||i.indexAxis||t.indexAxis||"x"}function oh(e,i){let t=e;return e==="_index_"?t=i:e==="_value_"&&(t=i==="x"?"y":"x"),t}function rh(e,i){return e===i?"_index_":"_value_"}function er(e){if(e==="x"||e==="y"||e==="r")return e}function ah(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Ns(e,...i){if(er(e))return e;for(let t of i){let s=t.axis||ah(t.position)||e.length>1&&er(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function ir(e,i,t){if(t[i+"AxisID"]===e)return{axis:i}}function lh(e,i){if(i.data&&i.data.datasets){let t=i.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(t.length)return ir(e,"x",t[0])||ir(e,"y",t[0])}return{}}function ch(e,i){let t=kt[e.type]||{scales:{}},s=i.scales||{},n=Vs(e.type,i),o=Object.create(null);return Object.keys(s).forEach(r=>{let a=s[r];if(!A(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 l=Ns(r,a,lh(r,e),F.scales[a.type]),c=rh(l,n),h=t.scales||{};o[r]=Zt(Object.create(null),[{axis:l},a,h[l],h[c]])}),e.data.datasets.forEach(r=>{let a=r.type||e.type,l=r.indexAxis||Vs(a,i),h=(kt[a]||{}).scales||{};Object.keys(h).forEach(d=>{let u=oh(d,l),f=r[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),Zt(o[f],[{axis:u},s[f],h[d]])})}),Object.keys(o).forEach(r=>{let a=o[r];Zt(a,[F.scales[a.type],F.scale])}),o}function jr(e){let i=e.options||(e.options={});i.plugins=C(i.plugins,{}),i.scales=ch(e,i)}function $r(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function hh(e){return e=e||{},e.data=$r(e.data),jr(e),e}var sr=new Map,Yr=new Set;function hi(e,i){let t=sr.get(e);return t||(t=i(),sr.set(e,t),Yr.add(t)),t}var ke=(e,i,t)=>{let s=mt(i,t);s!==void 0&&e.add(s)},Ws=class{constructor(i){this._config=hh(i),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(i){this._config.type=i}get data(){return this._config.data}set data(i){this._config.data=$r(i)}get options(){return this._config.options}set options(i){this._config.options=i}get plugins(){return this._config.plugins}update(){let i=this._config;this.clearCache(),jr(i)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(i){return hi(i,()=>[[`datasets.${i}`,""]])}datasetAnimationScopeKeys(i,t){return hi(`${i}.transition.${t}`,()=>[[`datasets.${i}.transitions.${t}`,`transitions.${t}`],[`datasets.${i}`,""]])}datasetElementScopeKeys(i,t){return hi(`${i}-${t}`,()=>[[`datasets.${i}.elements.${t}`,`datasets.${i}`,`elements.${t}`,""]])}pluginScopeKeys(i){let t=i.id,s=this.type;return hi(`${s}-plugin-${t}`,()=>[[`plugins.${t}`,...i.additionalOptionScopes||[]]])}_cachedScopes(i,t){let s=this._scopeCache,n=s.get(i);return(!n||t)&&(n=new Map,s.set(i,n)),n}getOptionScopes(i,t,s){let{options:n,type:o}=this,r=this._cachedScopes(i,s),a=r.get(t);if(a)return a;let l=new Set;t.forEach(h=>{i&&(l.add(i),h.forEach(d=>ke(l,i,d))),h.forEach(d=>ke(l,n,d)),h.forEach(d=>ke(l,kt[o]||{},d)),h.forEach(d=>ke(l,F,d)),h.forEach(d=>ke(l,ei,d))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Yr.has(t)&&r.set(t,c),c}chartOptionScopes(){let{options:i,type:t}=this;return[i,kt[t]||{},F.datasets[t]||{},{type:t},F,ei]}resolveNamedOptions(i,t,s,n=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=nr(this._resolverCache,i,n),l=r;if(uh(r,t)){o.$shared=!1,s=pt(s)?s():s;let c=this.createResolver(i,s,a);l=Bt(r,s,c)}for(let c of t)o[c]=l[c];return o}createResolver(i,t,s=[""],n){let{resolver:o}=nr(this._resolverCache,i,s);return A(t)?Bt(o,t,void 0,n):o}};function nr(e,i,t){let s=e.get(i);s||(s=new Map,e.set(i,s));let n=t.join(),o=s.get(n);return o||(o={resolver:ni(i,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}var dh=e=>A(e)&&Object.getOwnPropertyNames(e).some(i=>pt(e[i]));function uh(e,i){let{isScriptable:t,isIndexable:s}=hs(e);for(let n of i){let o=t(n),r=s(n),a=(r||o)&&e[n];if(o&&(pt(a)||dh(a))||r&&B(a))return!0}return!1}var fh="4.5.1",ph=["top","bottom","left","right","chartArea"];function or(e,i){return e==="top"||e==="bottom"||ph.indexOf(e)===-1&&i==="x"}function rr(e,i){return function(t,s){return t[e]===s[e]?t[i]-s[i]:t[e]-s[e]}}function ar(e){let i=e.chart,t=i.options.animation;i.notifyPlugins("afterRender"),I(t&&t.onComplete,[e],i)}function gh(e){let i=e.chart,t=i.options.animation;I(t&&t.onProgress,[e],i)}function Ur(e){return oi()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var gi={},lr=e=>{let i=Ur(e);return Object.values(gi).filter(t=>t.canvas===i).pop()};function mh(e,i,t){let s=Object.keys(e);for(let n of s){let o=+n;if(o>=i){let r=e[n];delete e[n],(t>0||o>i)&&(e[o+t]=r)}}}function bh(e,i,t,s){return!t||e.type==="mouseout"?null:s?i:e}var wi=(()=>{class e{static defaults=F;static instances=gi;static overrides=kt;static registry=ut;static version=fh;static getChart=lr;static register(...t){ut.add(...t),cr()}static unregister(...t){ut.remove(...t),cr()}constructor(t,s){let n=this.config=new Ws(s),o=Ur(t),r=lr(o);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||zc(o)),this.platform.updateConfig(n);let l=this.platform.acquireContext(o,a.aspectRatio),c=l&&l.canvas,h=c&&c.height,d=c&&c.width;if(this.id=ro(),this.ctx=l,this.canvas=c,this.width=d,this.height=h,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new zs,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=xo(u=>this.update(u),a.resizeDelay||0),this._dataChanges=[],gi[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}xt.listen(this,"complete",ar),xt.listen(this,"progress",gh),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:s},width:n,height:o,_aspectRatio:r}=this;return O(t)?s&&r?r:o?n/o: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 ut}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ps(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return as(this.canvas,this.ctx),this}stop(){return xt.stop(this),this}resize(t,s){xt.running(this)?this._resizeBeforeDraw={width:t,height:s}:this._resize(t,s)}_resize(t,s){let n=this.options,o=this.canvas,r=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(o,t,s,r),l=n.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,ps(this,l,!0)&&(this.notifyPlugins("resize",{size:a}),I(n.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){let s=this.options.scales||{};E(s,(n,o)=>{n.id=o})}buildOrUpdateScales(){let t=this.options,s=t.scales,n=this.scales,o=Object.keys(n).reduce((a,l)=>(a[l]=!1,a),{}),r=[];s&&(r=r.concat(Object.keys(s).map(a=>{let l=s[a],c=Ns(a,l),h=c==="r",d=c==="x";return{options:l,dposition:h?"chartArea":d?"bottom":"left",dtype:h?"radialLinear":d?"category":"linear"}}))),E(r,a=>{let l=a.options,c=l.id,h=Ns(c,l),d=C(l.type,a.dtype);(l.position===void 0||or(l.position,h)!==or(a.dposition))&&(l.position=a.dposition),o[c]=!0;let u=null;if(c in n&&n[c].type===d)u=n[c];else{let f=ut.getScale(d);u=new f({id:c,type:d,ctx:this.ctx,chart:this}),n[u.id]=u}u.init(l,t)}),E(o,(a,l)=>{a||delete n[l]}),E(n,a=>{G.configure(this,a,a.options),G.addBox(this,a)})}_updateMetasets(){let t=this._metasets,s=this.data.datasets.length,n=t.length;if(t.sort((o,r)=>o.index-r.index),n>s){for(let o=s;o<n;++o)this._destroyDatasetMeta(o);t.splice(s,n-s)}this._sortedMetasets=t.slice(0).sort(rr("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:s}}=this;t.length>s.length&&delete this._stacks,t.forEach((n,o)=>{s.filter(r=>r===n._dataset).length===0&&this._destroyDatasetMeta(o)})}buildOrUpdateControllers(){let t=[],s=this.data.datasets,n,o;for(this._removeUnreferencedMetasets(),n=0,o=s.length;n<o;n++){let r=s[n],a=this.getDatasetMeta(n),l=r.type||this.config.type;if(a.type&&a.type!==l&&(this._destroyDatasetMeta(n),a=this.getDatasetMeta(n)),a.type=l,a.indexAxis=r.indexAxis||Vs(l,this.options),a.order=r.order||0,a.index=n,a.label=""+r.label,a.visible=this.isDatasetVisible(n),a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{let c=ut.getController(l),{datasetElementType:h,dataElementType:d}=F.datasets[l];Object.assign(c,{dataElementType:ut.getElement(d),datasetElementType:h&&ut.getElement(h)}),a.controller=new c(this,n),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){E(this.data.datasets,(t,s)=>{this.getDatasetMeta(s).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let s=this.config;s.update();let n=this._options=s.createResolver(s.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let h=0,d=this.data.datasets.length;h<d;h++){let{controller:u}=this.getDatasetMeta(h),f=!o&&r.indexOf(u)===-1;u.buildOrUpdateElements(f),a=Math.max(+u.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),o||E(r,h=>{h.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(rr("z","_idx"));let{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){E(this.scales,t=>{G.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,s=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!Ki(s,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,s=this._getUniformDataChanges()||[];for(let{method:n,start:o,count:r}of s){let a=n==="_removeElements"?-r:r;mh(t,o,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let s=this.data.datasets.length,n=r=>new Set(t.filter(a=>a[0]===r).map((a,l)=>l+","+a.splice(1).join(","))),o=n(0);for(let r=1;r<s;r++)if(!Ki(o,n(r)))return;return Array.from(o).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;G.update(this,this.width,this.height,t);let s=this.chartArea,n=s.width<=0||s.height<=0;this._layers=[],E(this.boxes,o=>{n&&o.position==="chartArea"||(o.configure&&o.configure(),this._layers.push(...o._layers()))},this),this._layers.forEach((o,r)=>{o._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let s=0,n=this.data.datasets.length;s<n;++s)this.getDatasetMeta(s).controller.configure();for(let s=0,n=this.data.datasets.length;s<n;++s)this._updateDataset(s,pt(t)?t({datasetIndex:s}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,s){let n=this.getDatasetMeta(t),o={meta:n,index:t,mode:s,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",o)!==!1&&(n.controller._update(s),o.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",o))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(xt.has(this)?this.attached&&!xt.running(this)&&xt.start(this):(this.draw(),ar({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:n,height:o}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,o)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let s=this._layers;for(t=0;t<s.length&&s[t].z<=0;++t)s[t].draw(this.chartArea);for(this._drawDatasets();t<s.length;++t)s[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let s=this._sortedMetasets,n=[],o,r;for(o=0,r=s.length;o<r;++o){let a=s[o];(!t||a.visible)&&n.push(a)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let s=t.length-1;s>=0;--s)this._drawDataset(t[s]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let s=this.ctx,n={meta:t,index:t.index,cancelable:!0},o=ys(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(o&&xe(s,o),t.controller.draw(),o&&_e(s),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return lt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,s,n,o){let r=_c.modes[s];return typeof r=="function"?r(this,t,n,o):[]}getDatasetMeta(t){let s=this.data.datasets[t],n=this._metasets,o=n.filter(r=>r&&r._dataset===s).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:s&&s.order||0,index:t,_dataset:s,_parsed:[],_sorted:!1},n.push(o)),o}getContext(){return this.$context||(this.$context=bt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let s=this.data.datasets[t];if(!s)return!1;let n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!s.hidden}setDatasetVisibility(t,s){let n=this.getDatasetMeta(t);n.hidden=!s}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,s,n){let o=n?"show":"hide",r=this.getDatasetMeta(t),a=r.controller._resolveAnimations(void 0,o);Jt(s)?(r.data[s].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),a.update(r,{visible:n}),this.update(l=>l.datasetIndex===t?o:void 0))}hide(t,s){this._updateVisibility(t,s,!1)}show(t,s){this._updateVisibility(t,s,!0)}_destroyDatasetMeta(t){let s=this._metasets[t];s&&s.controller&&s.controller._destroy(),delete this._metasets[t]}_stop(){let t,s;for(this.stop(),xt.remove(this),t=0,s=this.data.datasets.length;t<s;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:s}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),as(t,s),this.platform.releaseContext(s),this.canvas=null,this.ctx=null),delete gi[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,s=this.platform,n=(r,a)=>{s.addEventListener(this,r,a),t[r]=a},o=(r,a,l)=>{r.offsetX=a,r.offsetY=l,this._eventHandler(r)};E(this.options.events,r=>n(r,o))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,s=this.platform,n=(c,h)=>{s.addEventListener(this,c,h),t[c]=h},o=(c,h)=>{t[c]&&(s.removeEventListener(this,c,h),delete t[c])},r=(c,h)=>{this.canvas&&this.resize(c,h)},a,l=()=>{o("attach",l),this.attached=!0,this.resize(),n("resize",r),n("detach",a)};a=()=>{this.attached=!1,o("resize",r),this._stop(),this._resize(0,0),n("attach",l)},s.isAttached(this.canvas)?l():a()}unbindEvents(){E(this._listeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._listeners={},E(this._responsiveListeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,s,n){let o=n?"set":"remove",r,a,l,c;for(s==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+o+"DatasetHoverStyle"]()),l=0,c=t.length;l<c;++l){a=t[l];let h=a&&this.getDatasetMeta(a.datasetIndex).controller;h&&h[o+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let s=this._active||[],n=t.map(({datasetIndex:r,index:a})=>{let l=this.getDatasetMeta(r);if(!l)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:l.data[a],index:a}});!me(n,s)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,s))}notifyPlugins(t,s,n){return this._plugins.notify(this,t,s,n)}isPluginEnabled(t){return this._plugins._cache.filter(s=>s.plugin.id===t).length===1}_updateHoverStyles(t,s,n){let o=this.options.hover,r=(c,h)=>c.filter(d=>!h.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),a=r(s,t),l=n?t:r(t,s);a.length&&this.updateHoverStyle(a,o.mode,!1),l.length&&o.mode&&this.updateHoverStyle(l,o.mode,!0)}_eventHandler(t,s){let n={event:t,replay:s,cancelable:!0,inChartArea:this.isPointInArea(t)},o=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,o)===!1)return;let r=this._handleEvent(t,s,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,o),(r||n.changed)&&this.render(),this}_handleEvent(t,s,n){let{_active:o=[],options:r}=this,a=s,l=this._getActiveElements(t,o,n,a),c=co(t),h=bh(t,this._lastEvent,n,c);n&&(this._lastEvent=null,I(r.onHover,[t,l,this],this),c&&I(r.onClick,[t,l,this],this));let d=!me(l,o);return(d||s)&&(this._active=l,this._updateHoverStyles(l,o,s)),this._lastEvent=h,d}_getActiveElements(t,s,n,o){if(t.type==="mouseout")return[];if(!n)return s;let r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,o)}}return e})();function cr(){return E(wi.instances,e=>e._plugins.invalidate())}function xh(e,i,t){let{startAngle:s,x:n,y:o,outerRadius:r,innerRadius:a,options:l}=i,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/r,U(s-t));if(e.beginPath(),e.arc(n,o,r-c/2,s+d/2,t-d/2),a>0){let u=Math.min(c/a,U(s-t));e.arc(n,o,a+c/2,t-u/2,s+u/2,!0)}else{let u=Math.min(c/2,r*U(s-t));if(h==="round")e.arc(n,o,u,t-R/2,s+R/2,!0);else if(h==="bevel"){let f=2*u*u,g=-f*Math.cos(t+R/2)+n,p=-f*Math.sin(t+R/2)+o,m=f*Math.cos(s+R/2)+n,b=f*Math.sin(s+R/2)+o;e.lineTo(g,p),e.lineTo(m,b)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function _h(e,i,t){let{startAngle:s,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=i,c=n/a;e.beginPath(),e.arc(o,r,a,s-c,t+c),l>n?(c=n/l,e.arc(o,r,l,t+c,s-c,!0)):e.arc(o,r,n,t+W,s-W),e.closePath(),e.clip()}function yh(e){return si(e,["outerStart","outerEnd","innerStart","innerEnd"])}function vh(e,i,t,s){let n=yh(e.options.borderRadius),o=(t-i)/2,r=Math.min(o,s*i/2),a=l=>{let c=(t-Math.min(o,l))*s/2;return $(l,0,Math.min(o,c))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:$(n.innerStart,0,r),innerEnd:$(n.innerEnd,0,r)}}function ne(e,i,t,s){return{x:t+e*Math.cos(i),y:s+e*Math.sin(i)}}function _i(e,i,t,s,n,o){let{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=i,d=Math.max(i.outerRadius+s+t-c,0),u=h>0?h+s+t+c:0,f=0,g=n-l;if(s){let L=h>0?h-s:0,V=d>0?d-s:0,H=(L+V)/2,nt=H!==0?g*H/(H+s):g;f=(g-nt)/2}let p=Math.max(.001,g*d-t/R)/d,m=(g-p)/2,b=l+m+f,x=n-m-f,{outerStart:y,outerEnd:w,innerStart:_,innerEnd:v}=vh(i,u,d,x-b),k=d-y,M=d-w,S=b+y/k,D=x-w/M,P=u+_,T=u+v,Y=b+_/P,et=x-v/T;if(e.beginPath(),o){let L=(S+D)/2;if(e.arc(r,a,d,S,L),e.arc(r,a,d,L,D),w>0){let q=ne(M,D,r,a);e.arc(q.x,q.y,w,D,x+W)}let V=ne(T,x,r,a);if(e.lineTo(V.x,V.y),v>0){let q=ne(T,et,r,a);e.arc(q.x,q.y,v,x+W,et+Math.PI)}let H=(x-v/u+(b+_/u))/2;if(e.arc(r,a,u,x-v/u,H,!0),e.arc(r,a,u,H,b+_/u,!0),_>0){let q=ne(P,Y,r,a);e.arc(q.x,q.y,_,Y+Math.PI,b-W)}let nt=ne(k,b,r,a);if(e.lineTo(nt.x,nt.y),y>0){let q=ne(k,S,r,a);e.arc(q.x,q.y,y,b-W,S)}}else{e.moveTo(r,a);let L=Math.cos(S)*d+r,V=Math.sin(S)*d+a;e.lineTo(L,V);let H=Math.cos(D)*d+r,nt=Math.sin(D)*d+a;e.lineTo(H,nt)}e.closePath()}function wh(e,i,t,s,n){let{fullCircles:o,startAngle:r,circumference:a}=i,l=i.endAngle;if(o){_i(e,i,t,s,l,n);for(let c=0;c<o;++c)e.fill();isNaN(a)||(l=r+(a%z||z))}return _i(e,i,t,s,l,n),e.fill(),l}function Mh(e,i,t,s,n){let{fullCircles:o,startAngle:r,circumference:a,options:l}=i,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u,borderRadius:f}=l,g=l.borderAlign==="inner";if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=u,g?(e.lineWidth=c*2,e.lineJoin=h||"round"):(e.lineWidth=c,e.lineJoin=h||"bevel");let p=i.endAngle;if(o){_i(e,i,t,s,p,n);for(let m=0;m<o;++m)e.stroke();isNaN(a)||(p=r+(a%z||z))}g&&_h(e,i,p),l.selfJoin&&p-r>=R&&f===0&&h!=="miter"&&xh(e,i,p),o||(_i(e,i,t,s,p,n),e.stroke())}var Hs=class extends rt{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:i=>i!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(i){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,i&&Object.assign(this,i)}inRange(i,t,s){let n=this.getProps(["x","y"],s),{angle:o,distance:r}=Ji(n,{x:i,y:t}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:h,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),u=(this.options.spacing+this.options.borderWidth)/2,f=C(d,l-a),g=te(o,a,l)&&a!==l,p=f>=z||g,m=ht(r,c+u,h+u);return p&&m}getCenterPoint(i){let{x:t,y:s,startAngle:n,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],i),{offset:l,spacing:c}=this.options,h=(n+o)/2,d=(r+a+c+l)/2;return{x:t+Math.cos(h)*d,y:s+Math.sin(h)*d}}tooltipPosition(i){return this.getCenterPoint(i)}draw(i){let{options:t,circumference:s}=this,n=(t.offset||0)/4,o=(t.spacing||0)/2,r=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=s>z?Math.floor(s/z):0,s===0||this.innerRadius<0||this.outerRadius<0)return;i.save();let a=(this.startAngle+this.endAngle)/2;i.translate(Math.cos(a)*n,Math.sin(a)*n);let l=1-Math.sin(Math.min(R,s||0)),c=n*l;i.fillStyle=t.backgroundColor,i.strokeStyle=t.borderColor,wh(i,this,c,o,r),Mh(i,this,c,o,r),i.restore()}};function Xr(e,i,t=i){e.lineCap=C(t.borderCapStyle,i.borderCapStyle),e.setLineDash(C(t.borderDash,i.borderDash)),e.lineDashOffset=C(t.borderDashOffset,i.borderDashOffset),e.lineJoin=C(t.borderJoinStyle,i.borderJoinStyle),e.lineWidth=C(t.borderWidth,i.borderWidth),e.strokeStyle=C(t.borderColor,i.borderColor)}function kh(e,i,t){e.lineTo(t.x,t.y)}function Sh(e){return e.stepped?wo:e.tension||e.cubicInterpolationMode==="monotone"?Mo:kh}function Kr(e,i,t={}){let s=e.length,{start:n=0,end:o=s-1}=t,{start:r,end:a}=i,l=Math.max(n,r),c=Math.min(o,a),h=n<r&&o<r||n>a&&o>a;return{count:s,start:l,loop:i.loop,ilen:c<l&&!h?s+c-l:c-l}}function Ch(e,i,t,s){let{points:n,options:o}=i,{count:r,start:a,loop:l,ilen:c}=Kr(n,t,s),h=Sh(o),{move:d=!0,reverse:u}=s||{},f,g,p;for(f=0;f<=c;++f)g=n[(a+(u?c-f:f))%r],!g.skip&&(d?(e.moveTo(g.x,g.y),d=!1):h(e,p,g,u,o.stepped),p=g);return l&&(g=n[(a+(u?c:0))%r],h(e,p,g,u,o.stepped)),!!l}function Ph(e,i,t,s){let n=i.points,{count:o,start:r,ilen:a}=Kr(n,t,s),{move:l=!0,reverse:c}=s||{},h=0,d=0,u,f,g,p,m,b,x=w=>(r+(c?a-w:w))%o,y=()=>{p!==m&&(e.lineTo(h,m),e.lineTo(h,p),e.lineTo(h,b))};for(l&&(f=n[x(0)],e.moveTo(f.x,f.y)),u=0;u<=a;++u){if(f=n[x(u)],f.skip)continue;let w=f.x,_=f.y,v=w|0;v===g?(_<p?p=_:_>m&&(m=_),h=(d*h+w)/++d):(y(),e.lineTo(w,_),g=v,d=0,p=m=_),b=_}y()}function js(e){let i=e.options,t=i.borderDash&&i.borderDash.length;return!e._decimated&&!e._loop&&!i.tension&&i.cubicInterpolationMode!=="monotone"&&!i.stepped&&!t?Ph:Ch}function Dh(e){return e.stepped?Ro:e.tension||e.cubicInterpolationMode==="monotone"?Eo:wt}function Oh(e,i,t,s){let n=i._path;n||(n=i._path=new Path2D,i.path(n,t,s)&&n.closePath()),Xr(e,i.options),e.stroke(n)}function Ah(e,i,t,s){let{segments:n,options:o}=i,r=js(i);for(let a of n)Xr(e,o,a.style),e.beginPath(),r(e,i,a,{start:t,end:t+s-1})&&e.closePath(),e.stroke()}var Th=typeof Path2D=="function";function Rh(e,i,t,s){Th&&!i.options.segment?Oh(e,i,t,s):Ah(e,i,t,s)}var Mi=(()=>{class e extends rt{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,s){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let o=n.spanGaps?this._loop:this._fullLoop;Oo(this._points,n,t,o,s),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=Io(this,this.options.segment))}first(){let t=this.segments,s=this.points;return t.length&&s[t[0].start]}last(){let t=this.segments,s=this.points,n=t.length;return n&&s[t[n-1].end]}interpolate(t,s){let n=this.options,o=t[s],r=this.points,a=_s(this,{property:s,start:o,end:o});if(!a.length)return;let l=[],c=Dh(n),h,d;for(h=0,d=a.length;h<d;++h){let{start:u,end:f}=a[h],g=r[u],p=r[f];if(g===p){l.push(g);continue}let m=Math.abs((o-g[s])/(p[s]-g[s])),b=c(g,p,m,n.stepped);b[s]=t[s],l.push(b)}return l.length===1?l[0]:l}pathSegment(t,s,n){return js(this)(t,this,s,n)}path(t,s,n){let o=this.segments,r=js(this),a=this._loop;s=s||0,n=n||this.points.length-s;for(let l of o)a&=r(t,this,l,{start:s,end:s+n-1});return!!a}draw(t,s,n,o){let r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),Rh(t,this,n,o),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}return e})();function hr(e,i,t,s){let n=e.options,{[t]:o}=e.getProps([t],s);return Math.abs(i-o)<n.radius+n.hitRadius}var Eh=(()=>{class e extends rt{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,s,n){let o=this.options,{x:r,y:a}=this.getProps(["x","y"],n);return Math.pow(t-r,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(t,s){return hr(this,t,"x",s)}inYRange(t,s){return hr(this,t,"y",s)}getCenterPoint(t){let{x:s,y:n}=this.getProps(["x","y"],t);return{x:s,y:n}}size(t){t=t||this.options||{};let s=t.radius||0;s=Math.max(s,s&&t.hoverRadius||0);let n=s&&t.borderWidth||0;return(s+n)*2}draw(t,s){let n=this.options;this.skip||n.radius<.1||!lt(this,s,this.size(n)/2)||(t.strokeStyle=n.borderColor,t.lineWidth=n.borderWidth,t.fillStyle=n.backgroundColor,ii(t,n,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}}return e})();function qr(e,i){let{x:t,y:s,base:n,width:o,height:r}=e.getProps(["x","y","base","width","height"],i),a,l,c,h,d;return e.horizontal?(d=r/2,a=Math.min(t,n),l=Math.max(t,n),c=s-d,h=s+d):(d=o/2,a=t-d,l=t+d,c=Math.min(s,n),h=Math.max(s,n)),{left:a,top:c,right:l,bottom:h}}function Ot(e,i,t,s){return e?0:$(i,t,s)}function Lh(e,i,t){let s=e.options.borderWidth,n=e.borderSkipped,o=cs(s);return{t:Ot(n.top,o.top,0,t),r:Ot(n.right,o.right,0,i),b:Ot(n.bottom,o.bottom,0,t),l:Ot(n.left,o.left,0,i)}}function Ih(e,i,t){let{enableBorderRadius:s}=e.getProps(["enableBorderRadius"]),n=e.options.borderRadius,o=Pt(n),r=Math.min(i,t),a=e.borderSkipped,l=s||A(n);return{topLeft:Ot(!l||a.top||a.left,o.topLeft,0,r),topRight:Ot(!l||a.top||a.right,o.topRight,0,r),bottomLeft:Ot(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:Ot(!l||a.bottom||a.right,o.bottomRight,0,r)}}function Fh(e){let i=qr(e),t=i.right-i.left,s=i.bottom-i.top,n=Lh(e,t/2,s/2),o=Ih(e,t/2,s/2);return{outer:{x:i.left,y:i.top,w:t,h:s,radius:o},inner:{x:i.left+n.l,y:i.top+n.t,w:t-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function Ds(e,i,t,s){let n=i===null,o=t===null,a=e&&!(n&&o)&&qr(e,s);return a&&(n||ht(i,a.left,a.right))&&(o||ht(t,a.top,a.bottom))}function Bh(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function zh(e,i){e.rect(i.x,i.y,i.w,i.h)}function Os(e,i,t={}){let s=e.x!==t.x?-i:0,n=e.y!==t.y?-i:0,o=(e.x+e.w!==t.x+t.w?i:0)-s,r=(e.y+e.h!==t.y+t.h?i:0)-n;return{x:e.x+s,y:e.y+n,w:e.w+o,h:e.h+r,radius:e.radius}}var $s=class extends rt{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(i){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,i&&Object.assign(this,i)}draw(i){let{inflateAmount:t,options:{borderColor:s,backgroundColor:n}}=this,{inner:o,outer:r}=Fh(this),a=Bh(r.radius)?ie:zh;i.save(),(r.w!==o.w||r.h!==o.h)&&(i.beginPath(),a(i,Os(r,t,o)),i.clip(),a(i,Os(o,-t,r)),i.fillStyle=s,i.fill("evenodd")),i.beginPath(),a(i,Os(o,t)),i.fillStyle=n,i.fill(),i.restore()}inRange(i,t,s){return Ds(this,i,t,s)}inXRange(i,t){return Ds(this,i,null,t)}inYRange(i,t){return Ds(this,null,i,t)}getCenterPoint(i){let{x:t,y:s,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],i);return{x:o?(t+n)/2:t,y:o?s:(s+n)/2}}getRange(i){return i==="x"?this.width/2:this.height/2}},Vh=Object.freeze({__proto__:null,ArcElement:Hs,BarElement:$s,LineElement:Mi,PointElement:Eh}),Ys=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],dr=Ys.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function Gr(e){return Ys[e%Ys.length]}function Zr(e){return dr[e%dr.length]}function Nh(e,i){return e.borderColor=Gr(i),e.backgroundColor=Zr(i),++i}function Wh(e,i){return e.backgroundColor=e.data.map(()=>Gr(i++)),i}function Hh(e,i){return e.backgroundColor=e.data.map(()=>Zr(i++)),i}function jh(e){let i=0;return(t,s)=>{let n=e.getDatasetMeta(s).controller;n instanceof Qs?i=Wh(t,i):n instanceof zr?i=Hh(t,i):n&&(i=Nh(t,i))}}function ur(e){let i;for(i in e)if(e[i].borderColor||e[i].backgroundColor)return!0;return!1}function $h(e){return e&&(e.borderColor||e.backgroundColor)}function Yh(){return F.borderColor!=="rgba(0,0,0,0.1)"||F.backgroundColor!=="rgba(0,0,0,0.1)"}var Uh={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,i,t){if(!t.enabled)return;let{data:{datasets:s},options:n}=e.config,{elements:o}=n,r=ur(s)||$h(n)||o&&ur(o)||Yh();if(!t.forceOverride&&r)return;let a=jh(e);s.forEach(a)}};function Xh(e,i,t,s,n){let o=n.samples||s;if(o>=t)return e.slice(i,i+t);let r=[],a=(t-2)/(o-2),l=0,c=i+t-1,h=i,d,u,f,g,p;for(r[l++]=e[h],d=0;d<o-2;d++){let m=0,b=0,x,y=Math.floor((d+1)*a)+1+i,w=Math.min(Math.floor((d+2)*a)+1,t)+i,_=w-y;for(x=y;x<w;x++)m+=e[x].x,b+=e[x].y;m/=_,b/=_;let v=Math.floor(d*a)+1+i,k=Math.min(Math.floor((d+1)*a)+1,t)+i,{x:M,y:S}=e[h];for(f=g=-1,x=v;x<k;x++)g=.5*Math.abs((M-m)*(e[x].y-S)-(M-e[x].x)*(b-S)),g>f&&(f=g,u=e[x],p=x);r[l++]=u,h=p}return r[l++]=e[c],r}function Kh(e,i,t,s){let n=0,o=0,r,a,l,c,h,d,u,f,g,p,m=[],b=i+t-1,x=e[i].x,w=e[b].x-x;for(r=i;r<i+t;++r){a=e[r],l=(a.x-x)/w*s,c=a.y;let _=l|0;if(_===h)c<g?(g=c,d=r):c>p&&(p=c,u=r),n=(o*n+a.x)/++o;else{let v=r-1;if(!O(d)&&!O(u)){let k=Math.min(d,u),M=Math.max(d,u);k!==f&&k!==v&&m.push(Ee(Re({},e[k]),{x:n})),M!==f&&M!==v&&m.push(Ee(Re({},e[M]),{x:n}))}r>0&&v!==f&&m.push(e[v]),m.push(a),h=_,o=0,g=p=c,d=u=f=r}}return m}function Jr(e){if(e._decimated){let i=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:i})}}function fr(e){e.data.datasets.forEach(i=>{Jr(i)})}function qh(e,i){let t=i.length,s=0,n,{iScale:o}=e,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(s=$(at(i,o.axis,r).lo,0,t-1)),c?n=$(at(i,o.axis,a).hi+1,s,t)-s:n=t-s,{start:s,count:n}}var Gh={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,i,t)=>{if(!t.enabled){fr(e);return}let s=e.width;e.data.datasets.forEach((n,o)=>{let{_data:r,indexAxis:a}=n,l=e.getDatasetMeta(o),c=r||n.data;if(se([a,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let h=e.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||e.options.parsing)return;let{start:d,count:u}=qh(l,c),f=t.threshold||4*s;if(u<=f){Jr(n);return}O(r)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(t.algorithm){case"lttb":g=Xh(c,d,u,s,t);break;case"min-max":g=Kh(c,d,u,s);break;default:throw new Error(`Unsupported decimation algorithm '${t.algorithm}'`)}n._decimated=g})},destroy(e){fr(e)}};function Zh(e,i,t){let s=e.segments,n=e.points,o=i.points,r=[];for(let a of s){let{start:l,end:c}=a;c=ki(l,c,n);let h=Us(t,n[l],n[c],a.loop);if(!i.segments){r.push({source:a,target:h,start:n[l],end:n[c]});continue}let d=_s(i,h);for(let u of d){let f=Us(t,o[u.start],o[u.end],u.loop),g=xs(a,n,f);for(let p of g)r.push({source:p,target:u,start:{[t]:pr(h,f,"start",Math.max)},end:{[t]:pr(h,f,"end",Math.min)}})}}return r}function Us(e,i,t,s){if(s)return;let n=i[e],o=t[e];return e==="angle"&&(n=U(n),o=U(o)),{property:e,start:n,end:o}}function Jh(e,i){let{x:t=null,y:s=null}=e||{},n=i.points,o=[];return i.segments.forEach(({start:r,end:a})=>{a=ki(r,a,n);let l=n[r],c=n[a];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):t!==null&&(o.push({x:t,y:l.y}),o.push({x:t,y:c.y}))}),o}function ki(e,i,t){for(;i>e;i--){let s=t[i];if(!isNaN(s.x)&&!isNaN(s.y))break}return i}function pr(e,i,t,s){return e&&i?s(e[t],i[t]):e?e[t]:i?i[t]:0}function Qr(e,i){let t=[],s=!1;return B(e)?(s=!0,t=e):t=Jh(e,i),t.length?new Mi({points:t,options:{tension:0},_loop:s,_fullLoop:s}):null}function gr(e){return e&&e.fill!==!1}function Qh(e,i,t){let n=e[i].fill,o=[i],r;if(!t)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!N(n))return n;if(r=e[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function td(e,i,t){let s=nd(e);if(A(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return N(n)&&Math.floor(n)===n?ed(s[0],i,n,t):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function ed(e,i,t,s){return(e==="-"||e==="+")&&(t=i+t),t===i||t<0||t>=s?!1:t}function id(e,i){let t=null;return e==="start"?t=i.bottom:e==="end"?t=i.top:A(e)?t=i.getPixelForValue(e.value):i.getBasePixel&&(t=i.getBasePixel()),t}function sd(e,i,t){let s;return e==="start"?s=t:e==="end"?s=i.options.reverse?i.min:i.max:A(e)?s=e.value:s=i.getBaseValue(),s}function nd(e){let i=e.options,t=i.fill,s=C(t&&t.target,t);return s===void 0&&(s=!!i.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function od(e){let{scale:i,index:t,line:s}=e,n=[],o=s.segments,r=s.points,a=rd(i,t);a.push(Qr({x:null,y:i.bottom},s));for(let l=0;l<o.length;l++){let c=o[l];for(let h=c.start;h<=c.end;h++)ad(n,r[h],a)}return new Mi({points:n,options:{}})}function rd(e,i){let t=[],s=e.getMatchingVisibleMetas("line");for(let n=0;n<s.length;n++){let o=s[n];if(o.index===i)break;o.hidden||t.unshift(o.dataset)}return t}function ad(e,i,t){let s=[];for(let n=0;n<t.length;n++){let o=t[n],{first:r,last:a,point:l}=ld(o,i,"x");if(!(!l||r&&a)){if(r)s.unshift(l);else if(e.push(l),!a)break}}e.push(...s)}function ld(e,i,t){let s=e.interpolate(i,t);if(!s)return{};let n=s[t],o=e.segments,r=e.points,a=!1,l=!1;for(let c=0;c<o.length;c++){let h=o[c],d=r[h.start][t],u=r[h.end][t];if(ht(n,d,u)){a=n===d,l=n===u;break}}return{first:a,last:l,point:s}}var yi=class{constructor(i){this.x=i.x,this.y=i.y,this.radius=i.radius}pathSegment(i,t,s){let{x:n,y:o,radius:r}=this;return t=t||{start:0,end:z},i.arc(n,o,r,t.end,t.start,!0),!s.bounds}interpolate(i){let{x:t,y:s,radius:n}=this,o=i.angle;return{x:t+Math.cos(o)*n,y:s+Math.sin(o)*n,angle:o}}};function cd(e){let{chart:i,fill:t,line:s}=e;if(N(t))return hd(i,t);if(t==="stack")return od(e);if(t==="shape")return!0;let n=dd(e);return n instanceof yi?n:Qr(n,s)}function hd(e,i){let t=e.getDatasetMeta(i);return t&&e.isDatasetVisible(i)?t.dataset:null}function dd(e){return(e.scale||{}).getPointPositionForValue?fd(e):ud(e)}function ud(e){let{scale:i={},fill:t}=e,s=id(t,i);if(N(s)){let n=i.isHorizontal();return{x:n?s:null,y:n?null:s}}return null}function fd(e){let{scale:i,fill:t}=e,s=i.options,n=i.getLabels().length,o=s.reverse?i.max:i.min,r=sd(t,i,o),a=[];if(s.grid.circular){let l=i.getPointPositionForValue(0,o);return new yi({x:l.x,y:l.y,radius:i.getDistanceFromCenterForValue(r)})}for(let l=0;l<n;++l)a.push(i.getPointPositionForValue(l,r));return a}function As(e,i,t){let s=cd(i),{chart:n,index:o,line:r,scale:a,axis:l}=i,c=r.options,h=c.fill,d=c.backgroundColor,{above:u=d,below:f=d}=h||{},g=n.getDatasetMeta(o),p=ys(n,g);s&&r.points.length&&(xe(e,t),pd(e,{line:r,target:s,above:u,below:f,area:t,scale:a,axis:l,clip:p}),_e(e))}function pd(e,i){let{line:t,target:s,above:n,below:o,area:r,scale:a,clip:l}=i,c=t._loop?"angle":i.axis;e.save();let h=o;o!==n&&(c==="x"?(mr(e,s,r.top),Ts(e,{line:t,target:s,color:n,scale:a,property:c,clip:l}),e.restore(),e.save(),mr(e,s,r.bottom)):c==="y"&&(br(e,s,r.left),Ts(e,{line:t,target:s,color:o,scale:a,property:c,clip:l}),e.restore(),e.save(),br(e,s,r.right),h=n)),Ts(e,{line:t,target:s,color:h,scale:a,property:c,clip:l}),e.restore()}function mr(e,i,t){let{segments:s,points:n}=i,o=!0,r=!1;e.beginPath();for(let a of s){let{start:l,end:c}=a,h=n[l],d=n[ki(l,c,n)];o?(e.moveTo(h.x,h.y),o=!1):(e.lineTo(h.x,t),e.lineTo(h.x,h.y)),r=!!i.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(d.x,t)}e.lineTo(i.first().x,t),e.closePath(),e.clip()}function br(e,i,t){let{segments:s,points:n}=i,o=!0,r=!1;e.beginPath();for(let a of s){let{start:l,end:c}=a,h=n[l],d=n[ki(l,c,n)];o?(e.moveTo(h.x,h.y),o=!1):(e.lineTo(t,h.y),e.lineTo(h.x,h.y)),r=!!i.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(t,d.y)}e.lineTo(t,i.first().y),e.closePath(),e.clip()}function Ts(e,i){let{line:t,target:s,property:n,color:o,scale:r,clip:a}=i,l=Zh(t,s,n);for(let{source:c,target:h,start:d,end:u}of l){let{style:{backgroundColor:f=o}={}}=c,g=s!==!0;e.save(),e.fillStyle=f,gd(e,r,a,g&&Us(n,d,u)),e.beginPath();let p=!!t.pathSegment(e,c),m;if(g){p?e.closePath():xr(e,s,u,n);let b=!!s.pathSegment(e,h,{move:p,reverse:!0});m=p&&b,m||xr(e,s,d,n)}e.closePath(),e.fill(m?"evenodd":"nonzero"),e.restore()}}function gd(e,i,t,s){let n=i.chart.chartArea,{property:o,start:r,end:a}=s||{};if(o==="x"||o==="y"){let l,c,h,d;o==="x"?(l=r,c=n.top,h=a,d=n.bottom):(l=n.left,c=r,h=n.right,d=a),e.beginPath(),t&&(l=Math.max(l,t.left),h=Math.min(h,t.right),c=Math.max(c,t.top),d=Math.min(d,t.bottom)),e.rect(l,c,h-l,d-c),e.clip()}}function xr(e,i,t,s){let n=i.interpolate(t,s);n&&e.lineTo(n.x,n.y)}var md={id:"filler",afterDatasetsUpdate(e,i,t){let s=(e.data.datasets||[]).length,n=[],o,r,a,l;for(r=0;r<s;++r)o=e.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof Mi&&(l={visible:e.isDatasetVisible(r),index:r,fill:td(a,r,s),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,n.push(l);for(r=0;r<s;++r)l=n[r],!(!l||l.fill===!1)&&(l.fill=Qh(n,r,t.propagate))},beforeDraw(e,i,t){let s=t.drawTime==="beforeDraw",n=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let r=n.length-1;r>=0;--r){let a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&As(e.ctx,a,o))}},beforeDatasetsDraw(e,i,t){if(t.drawTime!=="beforeDatasetsDraw")return;let s=e.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){let o=s[n].$filler;gr(o)&&As(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,i,t){let s=i.meta.$filler;!gr(s)||t.drawTime!=="beforeDatasetDraw"||As(e.ctx,s,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},_r=(e,i)=>{let{boxHeight:t=i,boxWidth:s=i}=e;return e.usePointStyle&&(t=Math.min(t,i),s=e.pointStyleWidth||Math.min(s,i)),{boxWidth:s,boxHeight:t,itemHeight:Math.max(i,t)}},bd=(e,i)=>e!==null&&i!==null&&e.datasetIndex===i.datasetIndex&&e.index===i.index,vi=class extends rt{constructor(i){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=i.chart,this.options=i.options,this.ctx=i.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(i,t,s){this.maxWidth=i,this.maxHeight=t,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let i=this.options.labels||{},t=I(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(s=>i.filter(s,this.chart.data))),i.sort&&(t=t.sort((s,n)=>i.sort(s,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:i,ctx:t}=this;if(!i.display){this.width=this.height=0;return}let s=i.labels,n=j(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=_r(s,o),c,h;t.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,i.maxWidth||this.maxWidth),this.height=Math.min(h,i.maxHeight||this.maxHeight)}_fitRows(i,t,s,n){let{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a,d=i;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((g,p)=>{let m=s+t/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(d+=h,c[c.length-(p>0?0:1)]=0,f+=h,u++),l[p]={left:0,top:f,row:u,width:m,height:n},c[c.length-1]+=m+a}),d}_fitCols(i,t,s,n){let{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-i,d=a,u=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{let{itemWidth:x,itemHeight:y}=xd(s,t,o,m,n);b>0&&f+y+2*a>h&&(d+=u+a,c.push({width:u,height:f}),g+=u+a,p++,u=f=0),l[b]={left:g,top:f,col:p,width:x,height:y},u=Math.max(u,x),f+=y+a}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;let i=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:s,labels:{padding:n},rtl:o}}=this,r=Vt(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=X(s,this.left+n,this.right-this.lineWidths[a]);for(let c of t)a!==c.row&&(a=c.row,l=X(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+i+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=X(s,this.top+i+n,this.bottom-this.columnSizes[a].height);for(let c of t)c.col!==a&&(a=c.col,l=X(s,this.top+i+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let i=this.ctx;xe(i,this),this._draw(),_e(i)}}_draw(){let{options:i,columnSizes:t,lineWidths:s,ctx:n}=this,{align:o,labels:r}=i,a=F.color,l=Vt(i.rtl,this.left,this.width),c=j(r.font),{padding:h}=r,d=c.size,u=d/2,f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;let{boxWidth:g,boxHeight:p,itemHeight:m}=_r(r,d),b=function(v,k,M){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;n.save();let S=C(M.lineWidth,1);if(n.fillStyle=C(M.fillStyle,a),n.lineCap=C(M.lineCap,"butt"),n.lineDashOffset=C(M.lineDashOffset,0),n.lineJoin=C(M.lineJoin,"miter"),n.lineWidth=S,n.strokeStyle=C(M.strokeStyle,a),n.setLineDash(C(M.lineDash,[])),r.usePointStyle){let D={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:S},P=l.xPlus(v,g/2),T=k+u;ls(n,D,P,T,r.pointStyleWidth&&g)}else{let D=k+Math.max((d-p)/2,0),P=l.leftForLtr(v,g),T=Pt(M.borderRadius);n.beginPath(),Object.values(T).some(Y=>Y!==0)?ie(n,{x:P,y:D,w:g,h:p,radius:T}):n.rect(P,D,g,p),n.fill(),S!==0&&n.stroke()}n.restore()},x=function(v,k,M){Ct(n,M.text,v,k+m/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},y=this.isHorizontal(),w=this._computeTitleHeight();y?f={x:X(o,this.left+h,this.right-s[0]),y:this.top+h+w,line:0}:f={x:this.left+h,y:X(o,this.top+w+h,this.bottom-t[0].height),line:0},ms(this.ctx,i.textDirection);let _=m+h;this.legendItems.forEach((v,k)=>{n.strokeStyle=v.fontColor,n.fillStyle=v.fontColor;let M=n.measureText(v.text).width,S=l.textAlign(v.textAlign||(v.textAlign=r.textAlign)),D=g+u+M,P=f.x,T=f.y;l.setWidth(this.width),y?k>0&&P+D+h>this.right&&(T=f.y+=_,f.line++,P=f.x=X(o,this.left+h,this.right-s[f.line])):k>0&&T+_>this.bottom&&(P=f.x=P+t[f.line].width+h,f.line++,T=f.y=X(o,this.top+w+h,this.bottom-t[f.line].height));let Y=l.x(P);if(b(Y,T,v),P=_o(S,P+g+u,y?P+D:this.right,i.rtl),x(l.x(P),T,v),y)f.x+=D+h;else if(typeof v.text!="string"){let et=c.lineHeight;f.y+=ta(v,et)+h}else f.y+=_}),bs(this.ctx,i.textDirection)}drawTitle(){let i=this.options,t=i.title,s=j(t.font),n=K(t.padding);if(!t.display)return;let o=Vt(i.rtl,this.left,this.width),r=this.ctx,a=t.position,l=s.size/2,c=n.top+l,h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=X(i.align,d,this.right-u);else{let g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);h=c+X(i.align,this.top,this.bottom-g-i.labels.padding-this._computeTitleHeight())}let f=X(a,d,d+u);r.textAlign=o.textAlign(ti(a)),r.textBaseline="middle",r.strokeStyle=t.color,r.fillStyle=t.color,r.font=s.string,Ct(r,t.text,f,h,s)}_computeTitleHeight(){let i=this.options.title,t=j(i.font),s=K(i.padding);return i.display?t.lineHeight+s.height:0}_getLegendItemAt(i,t){let s,n,o;if(ht(i,this.left,this.right)&&ht(t,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],ht(i,n.left,n.left+n.width)&&ht(t,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(i){let t=this.options;if(!vd(i.type,t))return;let s=this._getLegendItemAt(i.x,i.y);if(i.type==="mousemove"||i.type==="mouseout"){let n=this._hoveredItem,o=bd(n,s);n&&!o&&I(t.onLeave,[i,n,this],this),this._hoveredItem=s,s&&!o&&I(t.onHover,[i,s,this],this)}else s&&I(t.onClick,[i,s,this],this)}};function xd(e,i,t,s,n){let o=_d(s,e,i,t),r=yd(n,s,i.lineHeight);return{itemWidth:o,itemHeight:r}}function _d(e,i,t,s){let n=e.text;return n&&typeof n!="string"&&(n=n.reduce((o,r)=>o.length>r.length?o:r)),i+t.size/2+s.measureText(n).width}function yd(e,i,t){let s=e;return typeof i.text!="string"&&(s=ta(i,t)),s}function ta(e,i){let t=e.text?e.text.length:0;return i*t}function vd(e,i){return!!((e==="mousemove"||e==="mouseout")&&(i.onHover||i.onLeave)||i.onClick&&(e==="click"||e==="mouseup"))}var wd={id:"legend",_element:vi,start(e,i,t){let s=e.legend=new vi({ctx:e.ctx,options:t,chart:e});G.configure(e,s,t),G.addBox(e,s)},stop(e){G.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,i,t){let s=e.legend;G.configure(e,s,t),s.options=t},afterUpdate(e){let i=e.legend;i.buildLabels(),i.adjustHitBoxes()},afterEvent(e,i){i.replay||e.legend.handleEvent(i.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,i,t){let s=i.datasetIndex,n=t.chart;n.isDatasetVisible(s)?(n.hide(s),i.hidden=!0):(n.show(s),i.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let i=e.data.datasets,{labels:{usePointStyle:t,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(t?0:void 0),h=K(c.borderWidth);return{text:i[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}},De=class extends rt{constructor(i){super(),this.chart=i.chart,this.options=i.options,this.ctx=i.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(i,t){let s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=i,this.height=this.bottom=t;let n=B(s.text)?s.text.length:1;this._padding=K(s.padding);let o=n*j(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let i=this.options.position;return i==="top"||i==="bottom"}_drawArgs(i){let{top:t,left:s,bottom:n,right:o,options:r}=this,a=r.align,l=0,c,h,d;return this.isHorizontal()?(h=X(a,s,o),d=t+i,c=o-s):(r.position==="left"?(h=s+i,d=X(a,n,t),l=R*-.5):(h=o-i,d=X(a,t,n),l=R*.5),c=n-t),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){let i=this.ctx,t=this.options;if(!t.display)return;let s=j(t.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Ct(i,t.text,0,0,s,{color:t.color,maxWidth:l,rotation:c,textAlign:ti(t.align),textBaseline:"middle",translation:[r,a]})}};function Md(e,i){let t=new De({ctx:e.ctx,options:i,chart:e});G.configure(e,t,i),G.addBox(e,t),e.titleBlock=t}var kd={id:"title",_element:De,start(e,i,t){Md(e,t)},stop(e){let i=e.titleBlock;G.removeBox(e,i),delete e.titleBlock},beforeUpdate(e,i,t){let s=e.titleBlock;G.configure(e,s,t),s.options=t},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},di=new WeakMap,Sd={id:"subtitle",start(e,i,t){let s=new De({ctx:e.ctx,options:t,chart:e});G.configure(e,s,t),G.addBox(e,s),di.set(e,s)},stop(e){G.removeBox(e,di.get(e)),di.delete(e)},beforeUpdate(e,i,t){let s=di.get(e);G.configure(e,s,t),s.options=t},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Ce={average(e){if(!e.length)return!1;let i,t,s=new Set,n=0,o=0;for(i=0,t=e.length;i<t;++i){let a=e[i].element;if(a&&a.hasValue()){let l=a.tooltipPosition();s.add(l.x),n+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+l)/s.size,y:n/o}},nearest(e,i){if(!e.length)return!1;let t=i.x,s=i.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){let l=e[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),h=qe(i,c);h<n&&(n=h,a=l)}}if(a){let l=a.tooltipPosition();t=l.x,s=l.y}return{x:t,y:s}}};function dt(e,i){return i&&(B(i)?Array.prototype.push.apply(e,i):e.push(i)),e}function _t(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
`)>-1?e.split(`
`):e}function Cd(e,i){let{element:t,datasetIndex:s,index:n}=i,o=e.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:e,label:r,parsed:o.getParsed(n),raw:e.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:t}}function yr(e,i){let t=e.chart.ctx,{body:s,footer:n,title:o}=e,{boxWidth:r,boxHeight:a}=i,l=j(i.bodyFont),c=j(i.titleFont),h=j(i.footerFont),d=o.length,u=n.length,f=s.length,g=K(i.padding),p=g.height,m=0,b=s.reduce((w,_)=>w+_.before.length+_.lines.length+_.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*i.titleSpacing+i.titleMarginBottom),b){let w=i.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*w+(b-f)*l.lineHeight+(b-1)*i.bodySpacing}u&&(p+=i.footerMarginTop+u*h.lineHeight+(u-1)*i.footerSpacing);let x=0,y=function(w){m=Math.max(m,t.measureText(w).width+x)};return t.save(),t.font=c.string,E(e.title,y),t.font=l.string,E(e.beforeBody.concat(e.afterBody),y),x=i.displayColors?r+2+i.boxPadding:0,E(s,w=>{E(w.before,y),E(w.lines,y),E(w.after,y)}),x=0,t.font=h.string,E(e.footer,y),t.restore(),m+=g.width,{width:m,height:p}}function Pd(e,i){let{y:t,height:s}=i;return t<s/2?"top":t>e.height-s/2?"bottom":"center"}function Dd(e,i,t,s){let{x:n,width:o}=s,r=t.caretSize+t.caretPadding;if(e==="left"&&n+o+r>i.width||e==="right"&&n-o-r<0)return!0}function Od(e,i,t,s){let{x:n,width:o}=t,{width:r,chartArea:{left:a,right:l}}=e,c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),Dd(c,e,i,t)&&(c="center"),c}function vr(e,i,t){let s=t.yAlign||i.yAlign||Pd(e,t);return{xAlign:t.xAlign||i.xAlign||Od(e,i,t,s),yAlign:s}}function Ad(e,i){let{x:t,width:s}=e;return i==="right"?t-=s:i==="center"&&(t-=s/2),t}function Td(e,i,t){let{y:s,height:n}=e;return i==="top"?s+=t:i==="bottom"?s-=n+t:s-=n/2,s}function wr(e,i,t,s){let{caretSize:n,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=t,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Pt(r),g=Ad(i,a),p=Td(i,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,u)+n:a==="right"&&(g+=Math.max(d,f)+n),{x:$(g,0,s.width-i.width),y:$(p,0,s.height-i.height)}}function ui(e,i,t){let s=K(t.padding);return i==="center"?e.x+e.width/2:i==="right"?e.x+e.width-s.right:e.x+s.left}function Mr(e){return dt([],_t(e))}function Rd(e,i,t){return bt(e,{tooltip:i,tooltipItems:t,type:"tooltip"})}function kr(e,i){let t=i&&i.dataset&&i.dataset.tooltip&&i.dataset.tooltip.callbacks;return t?e.override(t):e}var ea={beforeTitle:ct,title(e){if(e.length>0){let i=e[0],t=i.chart.data.labels,s=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return i.dataset.label||"";if(i.label)return i.label;if(s>0&&i.dataIndex<s)return t[i.dataIndex]}return""},afterTitle:ct,beforeBody:ct,beforeLabel:ct,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let i=e.dataset.label||"";i&&(i+=": ");let t=e.formattedValue;return O(t)||(i+=t),i},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:ct,afterBody:ct,beforeFooter:ct,footer:ct,afterFooter:ct};function Q(e,i,t,s){let n=e[i].call(t,s);return typeof n>"u"?ea[i].call(t,s):n}var Sr=(()=>{class e extends rt{static positioners=Ce;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 s=this.chart,n=this.options.setContext(this.getContext()),o=n.enabled&&s.options.animation&&n.animations,r=new mi(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=Rd(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,s){let{callbacks:n}=s,o=Q(n,"beforeTitle",this,t),r=Q(n,"title",this,t),a=Q(n,"afterTitle",this,t),l=[];return l=dt(l,_t(o)),l=dt(l,_t(r)),l=dt(l,_t(a)),l}getBeforeBody(t,s){return Mr(Q(s.callbacks,"beforeBody",this,t))}getBody(t,s){let{callbacks:n}=s,o=[];return E(t,r=>{let a={before:[],lines:[],after:[]},l=kr(n,r);dt(a.before,_t(Q(l,"beforeLabel",this,r))),dt(a.lines,Q(l,"label",this,r)),dt(a.after,_t(Q(l,"afterLabel",this,r))),o.push(a)}),o}getAfterBody(t,s){return Mr(Q(s.callbacks,"afterBody",this,t))}getFooter(t,s){let{callbacks:n}=s,o=Q(n,"beforeFooter",this,t),r=Q(n,"footer",this,t),a=Q(n,"afterFooter",this,t),l=[];return l=dt(l,_t(o)),l=dt(l,_t(r)),l=dt(l,_t(a)),l}_createItems(t){let s=this._active,n=this.chart.data,o=[],r=[],a=[],l=[],c,h;for(c=0,h=s.length;c<h;++c)l.push(Cd(this.chart,s[c]));return t.filter&&(l=l.filter((d,u,f)=>t.filter(d,u,f,n))),t.itemSort&&(l=l.sort((d,u)=>t.itemSort(d,u,n))),E(l,d=>{let u=kr(t.callbacks,d);o.push(Q(u,"labelColor",this,d)),r.push(Q(u,"labelPointStyle",this,d)),a.push(Q(u,"labelTextColor",this,d))}),this.labelColors=o,this.labelPointStyles=r,this.labelTextColors=a,this.dataPoints=l,l}update(t,s){let n=this.options.setContext(this.getContext()),o=this._active,r,a=[];if(!o.length)this.opacity!==0&&(r={opacity:0});else{let l=Ce[n.position].call(this,o,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let c=this._size=yr(this,n),h=Object.assign({},l,c),d=vr(this.chart,n,h),u=wr(n,h,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,r={opacity:1,x:u.x,y:u.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s})}drawCaret(t,s,n,o){let r=this.getCaretPosition(t,n,o);s.lineTo(r.x1,r.y1),s.lineTo(r.x2,r.y2),s.lineTo(r.x3,r.y3)}getCaretPosition(t,s,n){let{xAlign:o,yAlign:r}=this,{caretSize:a,cornerRadius:l}=n,{topLeft:c,topRight:h,bottomLeft:d,bottomRight:u}=Pt(l),{x:f,y:g}=t,{width:p,height:m}=s,b,x,y,w,_,v;return r==="center"?(_=g+m/2,o==="left"?(b=f,x=b-a,w=_+a,v=_-a):(b=f+p,x=b+a,w=_-a,v=_+a),y=b):(o==="left"?x=f+Math.max(c,d)+a:o==="right"?x=f+p-Math.max(h,u)-a:x=this.caretX,r==="top"?(w=g,_=w-a,b=x-a,y=x+a):(w=g+m,_=w+a,b=x+a,y=x-a),v=w),{x1:b,x2:x,x3:y,y1:w,y2:_,y3:v}}drawTitle(t,s,n){let o=this.title,r=o.length,a,l,c;if(r){let h=Vt(n.rtl,this.x,this.width);for(t.x=ui(this,n.titleAlign,n),s.textAlign=h.textAlign(n.titleAlign),s.textBaseline="middle",a=j(n.titleFont),l=n.titleSpacing,s.fillStyle=n.titleColor,s.font=a.string,c=0;c<r;++c)s.fillText(o[c],h.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+l,c+1===r&&(t.y+=n.titleMarginBottom-l)}}_drawColorBox(t,s,n,o,r){let a=this.labelColors[n],l=this.labelPointStyles[n],{boxHeight:c,boxWidth:h}=r,d=j(r.bodyFont),u=ui(this,"left",r),f=o.x(u),g=c<d.lineHeight?(d.lineHeight-c)/2:0,p=s.y+g;if(r.usePointStyle){let m={radius:Math.min(h,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},b=o.leftForLtr(f,h)+h/2,x=p+c/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,ii(t,m,b,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,ii(t,m,b,x)}else{t.lineWidth=A(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let m=o.leftForLtr(f,h),b=o.leftForLtr(o.xPlus(f,1),h-2),x=Pt(a.borderRadius);Object.values(x).some(y=>y!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,ie(t,{x:m,y:p,w:h,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),ie(t,{x:b,y:p+1,w:h-2,h:c-2,radius:x}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(m,p,h,c),t.strokeRect(m,p,h,c),t.fillStyle=a.backgroundColor,t.fillRect(b,p+1,h-2,c-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,s,n){let{body:o}=this,{bodySpacing:r,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:h,boxPadding:d}=n,u=j(n.bodyFont),f=u.lineHeight,g=0,p=Vt(n.rtl,this.x,this.width),m=function(S){s.fillText(S,p.x(t.x+g),t.y+f/2),t.y+=f+r},b=p.textAlign(a),x,y,w,_,v,k,M;for(s.textAlign=a,s.textBaseline="middle",s.font=u.string,t.x=ui(this,b,n),s.fillStyle=n.bodyColor,E(this.beforeBody,m),g=l&&b!=="right"?a==="center"?h/2+d:h+2+d:0,_=0,k=o.length;_<k;++_){for(x=o[_],y=this.labelTextColors[_],s.fillStyle=y,E(x.before,m),w=x.lines,l&&w.length&&(this._drawColorBox(s,t,_,p,n),f=Math.max(u.lineHeight,c)),v=0,M=w.length;v<M;++v)m(w[v]),f=u.lineHeight;E(x.after,m)}g=0,f=u.lineHeight,E(this.afterBody,m),t.y-=r}drawFooter(t,s,n){let o=this.footer,r=o.length,a,l;if(r){let c=Vt(n.rtl,this.x,this.width);for(t.x=ui(this,n.footerAlign,n),t.y+=n.footerMarginTop,s.textAlign=c.textAlign(n.footerAlign),s.textBaseline="middle",a=j(n.footerFont),s.fillStyle=n.footerColor,s.font=a.string,l=0;l<r;++l)s.fillText(o[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+n.footerSpacing}}drawBackground(t,s,n,o){let{xAlign:r,yAlign:a}=this,{x:l,y:c}=t,{width:h,height:d}=n,{topLeft:u,topRight:f,bottomLeft:g,bottomRight:p}=Pt(o.cornerRadius);s.fillStyle=o.backgroundColor,s.strokeStyle=o.borderColor,s.lineWidth=o.borderWidth,s.beginPath(),s.moveTo(l+u,c),a==="top"&&this.drawCaret(t,s,n,o),s.lineTo(l+h-f,c),s.quadraticCurveTo(l+h,c,l+h,c+f),a==="center"&&r==="right"&&this.drawCaret(t,s,n,o),s.lineTo(l+h,c+d-p),s.quadraticCurveTo(l+h,c+d,l+h-p,c+d),a==="bottom"&&this.drawCaret(t,s,n,o),s.lineTo(l+g,c+d),s.quadraticCurveTo(l,c+d,l,c+d-g),a==="center"&&r==="left"&&this.drawCaret(t,s,n,o),s.lineTo(l,c+u),s.quadraticCurveTo(l,c,l+u,c),s.closePath(),s.fill(),o.borderWidth>0&&s.stroke()}_updateAnimationTarget(t){let s=this.chart,n=this.$animations,o=n&&n.x,r=n&&n.y;if(o||r){let a=Ce[t.position].call(this,this._active,this._eventPosition);if(!a)return;let l=this._size=yr(this,t),c=Object.assign({},a,this._size),h=vr(s,t,c),d=wr(t,c,h,s);(o._to!==d.x||r._to!==d.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){let s=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(s);let o={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=K(s.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&l&&(t.save(),t.globalAlpha=n,this.drawBackground(r,t,o,s),ms(t,s.textDirection),r.y+=a.top,this.drawTitle(r,t,s),this.drawBody(r,t,s),this.drawFooter(r,t,s),bs(t,s.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,s){let n=this._active,o=t.map(({datasetIndex:l,index:c})=>{let h=this.chart.getDatasetMeta(l);if(!h)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:h.data[c],index:c}}),r=!me(n,o),a=this._positionChanged(o,s);(r||a)&&(this._active=o,this._eventPosition=s,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,s,n=!0){if(s&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let o=this.options,r=this._active||[],a=this._getActiveElements(t,r,s,n),l=this._positionChanged(a,t),c=s||!me(a,r)||l;return c&&(this._active=a,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,s))),c}_getActiveElements(t,s,n,o){let r=this.options;if(t.type==="mouseout")return[];if(!o)return s.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,r.mode,r,n);return r.reverse&&a.reverse(),a}_positionChanged(t,s){let{caretX:n,caretY:o,options:r}=this,a=Ce[r.position].call(this,t,s);return a!==!1&&(n!==a.x||o!==a.y)}}return e})(),Ed={id:"tooltip",_element:Sr,positioners:Ce,afterInit(e,i,t){t&&(e.tooltip=new Sr({chart:e,options:t}))},beforeUpdate(e,i,t){e.tooltip&&e.tooltip.initialize(t)},reset(e,i,t){e.tooltip&&e.tooltip.initialize(t)},afterDraw(e){let i=e.tooltip;if(i&&i._willRender()){let t={tooltip:i};if(e.notifyPlugins("beforeTooltipDraw",Ee(Re({},t),{cancelable:!0}))===!1)return;i.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",t)}},afterEvent(e,i){if(e.tooltip){let t=i.replay;e.tooltip.handleEvent(i.event,t,i.inChartArea)&&(i.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:(e,i)=>i.bodyFont.size,boxWidth:(e,i)=>i.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:ea},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Ld=Object.freeze({__proto__:null,Colors:Uh,Decimation:Gh,Filler:md,Legend:wd,SubTitle:Sd,Title:kd,Tooltip:Ed}),Id=(e,i,t,s)=>(typeof i=="string"?(t=e.push(i)-1,s.unshift({index:t,label:i})):isNaN(i)&&(t=null),t);function Fd(e,i,t,s){let n=e.indexOf(i);if(n===-1)return Id(e,i,t,s);let o=e.lastIndexOf(i);return n!==o?t:n}var Bd=(e,i)=>e===null?null:$(Math.round(e),0,i);function Cr(e){let i=this.getLabels();return e>=0&&e<i.length?i[e]:e}var zd=(()=>{class e extends Ht{static id="category";static defaults={ticks:{callback:Cr}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let s=this._addedLabels;if(s.length){let n=this.getLabels();for(let{index:o,label:r}of s)n[o]===r&&n.splice(o,1);this._addedLabels=[]}super.init(t)}parse(t,s){if(O(t))return null;let n=this.getLabels();return s=isFinite(s)&&n[s]===t?s:Fd(n,t,C(s,t),this._addedLabels),Bd(s,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),s||(o=this.getLabels().length-1)),this.min=n,this.max=o}buildTicks(){let t=this.min,s=this.max,n=this.options.offset,o=[],r=this.getLabels();r=t===0&&s===r.length-1?r:r.slice(t,s+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=t;a<=s;a++)o.push({value:a});return o}getLabelForValue(t){return Cr.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}return e})();function Vd(e,i){let t=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=e,f=o||1,g=h-1,{min:p,max:m}=i,b=!O(r),x=!O(a),y=!O(c),w=(m-p)/(d+1),_=qi((m-p)/g/f)*f,v,k,M,S;if(_<1e-14&&!b&&!x)return[{value:p},{value:m}];S=Math.ceil(m/_)-Math.floor(p/_),S>g&&(_=qi(S*_/g/f)*f),O(l)||(v=Math.pow(10,l),_=Math.ceil(_*v)/v),n==="ticks"?(k=Math.floor(p/_)*_,M=Math.ceil(m/_)*_):(k=p,M=m),b&&x&&o&&uo((a-r)/o,_/1e3)?(S=Math.round(Math.min((a-r)/_,h)),_=(a-r)/S,k=r,M=a):y?(k=b?r:k,M=x?a:M,S=c-1,_=(M-k)/S):(S=(M-k)/_,Qt(S,Math.round(S),_/1e3)?S=Math.round(S):S=Math.ceil(S));let D=Math.max(Zi(_),Zi(k));v=Math.pow(10,O(l)?D:l),k=Math.round(k*v)/v,M=Math.round(M*v)/v;let P=0;for(b&&(u&&k!==r?(t.push({value:r}),k<r&&P++,Qt(Math.round((k+P*_)*v)/v,r,Pr(r,w,e))&&P++):k<r&&P++);P<S;++P){let T=Math.round((k+P*_)*v)/v;if(x&&T>a)break;t.push({value:T})}return x&&u&&M!==a?t.length&&Qt(t[t.length-1].value,a,Pr(a,w,e))?t[t.length-1].value=a:t.push({value:a}):(!x||M===a)&&t.push({value:M}),t}function Pr(e,i,{horizontal:t,minRotation:s}){let n=st(s),o=(t?Math.sin(n):Math.cos(n))||.001,r=.75*i*(""+e).length;return Math.min(i/o,r)}var re=class extends Ht{constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(i,t){return O(i)||(typeof i=="number"||i instanceof Number)&&!isFinite(+i)?null:+i}handleTickRangeOptions(){let{beginAtZero:i}=this.options,{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this,r=l=>n=t?n:l,a=l=>o=s?o:l;if(i){let l=ot(n),c=ot(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),i||r(n-l)}this.min=n,this.max=o}getTickLimit(){let i=this.options.ticks,{maxTicksLimit:t,stepSize:s}=i,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let i=this.options,t=i.ticks,s=this.getTickLimit();s=Math.max(2,s);let n={maxTicks:s,bounds:i.bounds,min:i.min,max:i.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},o=this._range||this,r=Vd(n,o);return i.bounds==="ticks"&&Gi(r,this,"value"),i.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let i=this.ticks,t=this.min,s=this.max;if(super.configure(),this.options.offset&&i.length){let n=(s-t)/Math.max(i.length-1,1)/2;t-=n,s+=n}this._startValue=t,this._endValue=s,this._valueRange=s-t}getLabelForValue(i){return ee(i,this.chart.options.locale,this.options.ticks.format)}},Xs=class extends re{static id="linear";static defaults={ticks:{callback:be.formatters.numeric}};determineDataLimits(){let{min:i,max:t}=this.getMinMax(!0);this.min=N(i)?i:0,this.max=N(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let i=this.isHorizontal(),t=i?this.width:this.height,s=st(this.options.ticks.minRotation),n=(i?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/n))}getPixelForValue(i){return i===null?NaN:this.getPixelForDecimal((i-this._startValue)/this._valueRange)}getValueForPixel(i){return this._startValue+this.getDecimalForPixel(i)*this._valueRange}},Oe=e=>Math.floor(gt(e)),Wt=(e,i)=>Math.pow(10,Oe(e)+i);function Dr(e){return e/Math.pow(10,Oe(e))===1}function Or(e,i,t){let s=Math.pow(10,t),n=Math.floor(e/s);return Math.ceil(i/s)-n}function Nd(e,i){let t=i-e,s=Oe(t);for(;Or(e,i,s)>10;)s++;for(;Or(e,i,s)<10;)s--;return Math.min(s,Oe(e))}function Wd(e,{min:i,max:t}){i=J(e.min,i);let s=[],n=Oe(i),o=Nd(i,t),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((i-l)*r)/r,h=Math.floor((i-l)/a/10)*a*10,d=Math.floor((c-h)/Math.pow(10,o)),u=J(e.min,Math.round((l+h+d*Math.pow(10,o))*r)/r);for(;u<t;)s.push({value:u,major:Dr(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,r=o>=0?1:r),u=Math.round((l+h+d*Math.pow(10,o))*r)/r;let f=J(e.max,u);return s.push({value:f,major:Dr(f),significand:d}),s}var Ks=class extends Ht{static id="logarithmic";static defaults={ticks:{callback:be.formatters.logarithmic,major:{enabled:!0}}};constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(i,t){let s=re.prototype.parse.apply(this,[i,t]);if(s===0){this._zero=!0;return}return N(s)&&s>0?s:null}determineDataLimits(){let{min:i,max:t}=this.getMinMax(!0);this.min=N(i)?Math.max(0,i):null,this.max=N(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!N(this._userMin)&&(this.min=i===Wt(this.min,0)?Wt(this.min,-1):Wt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:i,maxDefined:t}=this.getUserBounds(),s=this.min,n=this.max,o=a=>s=i?s:a,r=a=>n=t?n:a;s===n&&(s<=0?(o(1),r(10)):(o(Wt(s,-1)),r(Wt(n,1)))),s<=0&&o(Wt(n,-1)),n<=0&&r(Wt(s,1)),this.min=s,this.max=n}buildTicks(){let i=this.options,t={min:this._userMin,max:this._userMax},s=Wd(t,this);return i.bounds==="ticks"&&Gi(s,this,"value"),i.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(i){return i===void 0?"0":ee(i,this.chart.options.locale,this.options.ticks.format)}configure(){let i=this.min;super.configure(),this._startValue=gt(i),this._valueRange=gt(this.max)-gt(i)}getPixelForValue(i){return(i===void 0||i===0)&&(i=this.min),i===null||isNaN(i)?NaN:this.getPixelForDecimal(i===this.min?0:(gt(i)-this._startValue)/this._valueRange)}getValueForPixel(i){let t=this.getDecimalForPixel(i);return Math.pow(10,this._startValue+t*this._valueRange)}};function qs(e){let i=e.ticks;if(i.display&&e.display){let t=K(i.backdropPadding);return C(i.font&&i.font.size,F.font.size)+t.height}return 0}function Hd(e,i,t){return t=B(t)?t:[t],{w:vo(e,i.string,t),h:t.length*i.lineHeight}}function Ar(e,i,t,s,n){return e===s||e===n?{start:i-t/2,end:i+t/2}:e<s||e>n?{start:i-t,end:i}:{start:i,end:i+t}}function jd(e){let i={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},t=Object.assign({},i),s=[],n=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?R/o:0;for(let l=0;l<o;l++){let c=r.setContext(e.getPointLabelContext(l));n[l]=c.padding;let h=e.getPointPosition(l,e.drawingArea+n[l],a),d=j(c.font),u=Hd(e.ctx,d,e._pointLabels[l]);s[l]=u;let f=U(e.getIndexAngle(l)+a),g=Math.round(Je(f)),p=Ar(g,h.x,u.w,0,180),m=Ar(g,h.y,u.h,90,270);$d(t,i,f,p,m)}e.setCenterPoint(i.l-t.l,t.r-i.r,i.t-t.t,t.b-i.b),e._pointLabelItems=Xd(e,s,n)}function $d(e,i,t,s,n){let o=Math.abs(Math.sin(t)),r=Math.abs(Math.cos(t)),a=0,l=0;s.start<i.l?(a=(i.l-s.start)/o,e.l=Math.min(e.l,i.l-a)):s.end>i.r&&(a=(s.end-i.r)/o,e.r=Math.max(e.r,i.r+a)),n.start<i.t?(l=(i.t-n.start)/r,e.t=Math.min(e.t,i.t-l)):n.end>i.b&&(l=(n.end-i.b)/r,e.b=Math.max(e.b,i.b+l))}function Yd(e,i,t){let s=e.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=t,l=e.getPointPosition(i,s+n+r,o),c=Math.round(Je(U(l.angle+W))),h=Gd(l.y,a.h,c),d=Kd(c),u=qd(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function Ud(e,i){if(!i)return!0;let{left:t,top:s,right:n,bottom:o}=e;return!(lt({x:t,y:s},i)||lt({x:t,y:o},i)||lt({x:n,y:s},i)||lt({x:n,y:o},i))}function Xd(e,i,t){let s=[],n=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:qs(o)/2,additionalAngle:r?R/n:0},c;for(let h=0;h<n;h++){l.padding=t[h],l.size=i[h];let d=Yd(e,h,l);s.push(d),a==="auto"&&(d.visible=Ud(d,c),d.visible&&(c=d))}return s}function Kd(e){return e===0||e===180?"center":e<180?"left":"right"}function qd(e,i,t){return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Gd(e,i,t){return t===90||t===270?e-=i/2:(t>270||t<90)&&(e-=i),e}function Zd(e,i,t){let{left:s,top:n,right:o,bottom:r}=t,{backdropColor:a}=i;if(!O(a)){let l=Pt(i.borderRadius),c=K(i.backdropPadding);e.fillStyle=a;let h=s-c.left,d=n-c.top,u=o-s+c.width,f=r-n+c.height;Object.values(l).some(g=>g!==0)?(e.beginPath(),ie(e,{x:h,y:d,w:u,h:f,radius:l}),e.fill()):e.fillRect(h,d,u,f)}}function Jd(e,i){let{ctx:t,options:{pointLabels:s}}=e;for(let n=i-1;n>=0;n--){let o=e._pointLabelItems[n];if(!o.visible)continue;let r=s.setContext(e.getPointLabelContext(n));Zd(t,r,o);let a=j(r.font),{x:l,y:c,textAlign:h}=o;Ct(t,e._pointLabels[n],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function ia(e,i,t,s){let{ctx:n}=e;if(t)n.arc(e.xCenter,e.yCenter,i,0,z);else{let o=e.getPointPosition(0,i);n.moveTo(o.x,o.y);for(let r=1;r<s;r++)o=e.getPointPosition(r,i),n.lineTo(o.x,o.y)}}function Qd(e,i,t,s,n){let o=e.ctx,r=i.circular,{color:a,lineWidth:l}=i;!r&&!s||!a||!l||t<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),ia(e,t,r,s),o.closePath(),o.stroke(),o.restore())}function tu(e,i,t){return bt(e,{label:t,index:i,type:"pointLabel"})}var Gs=class extends re{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:be.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(i){return i},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(i){super(i),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let i=this._padding=K(qs(this.options)/2),t=this.width=this.maxWidth-i.width,s=this.height=this.maxHeight-i.height;this.xCenter=Math.floor(this.left+t/2+i.left),this.yCenter=Math.floor(this.top+s/2+i.top),this.drawingArea=Math.floor(Math.min(t,s)/2)}determineDataLimits(){let{min:i,max:t}=this.getMinMax(!1);this.min=N(i)&&!isNaN(i)?i:0,this.max=N(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/qs(this.options))}generateTickLabels(i){re.prototype.generateTickLabels.call(this,i),this._pointLabels=this.getLabels().map((t,s)=>{let n=I(this.options.pointLabels.callback,[t,s],this);return n||n===0?n:""}).filter((t,s)=>this.chart.getDataVisibility(s))}fit(){let i=this.options;i.display&&i.pointLabels.display?jd(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(i,t,s,n){this.xCenter+=Math.floor((i-t)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(i,t,s,n))}getIndexAngle(i){let t=z/(this._pointLabels.length||1),s=this.options.startAngle||0;return U(i*t+st(s))}getDistanceFromCenterForValue(i){if(O(i))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-i)*t:(i-this.min)*t}getValueForDistanceFromCenter(i){if(O(i))return NaN;let t=i/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(i){let t=this._pointLabels||[];if(i>=0&&i<t.length){let s=t[i];return tu(this.getContext(),i,s)}}getPointPosition(i,t,s=0){let n=this.getIndexAngle(i)-W+s;return{x:Math.cos(n)*t+this.xCenter,y:Math.sin(n)*t+this.yCenter,angle:n}}getPointPositionForValue(i,t){return this.getPointPosition(i,this.getDistanceFromCenterForValue(t))}getBasePosition(i){return this.getPointPositionForValue(i||0,this.getBaseValue())}getPointLabelPosition(i){let{left:t,top:s,right:n,bottom:o}=this._pointLabelItems[i];return{left:t,top:s,right:n,bottom:o}}drawBackground(){let{backgroundColor:i,grid:{circular:t}}=this.options;if(i){let s=this.ctx;s.save(),s.beginPath(),ia(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),s.closePath(),s.fillStyle=i,s.fill(),s.restore()}}drawGrid(){let i=this.ctx,t=this.options,{angleLines:s,grid:n,border:o}=t,r=this._pointLabels.length,a,l,c;if(t.pointLabels.display&&Jd(this,r),n.display&&this.ticks.forEach((h,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let u=this.getContext(d),f=n.setContext(u),g=o.setContext(u);Qd(this,f,l,r,g)}}),s.display){for(i.save(),a=r-1;a>=0;a--){let h=s.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:u}=h;!u||!d||(i.lineWidth=u,i.strokeStyle=d,i.setLineDash(h.borderDash),i.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(a,l),i.beginPath(),i.moveTo(this.xCenter,this.yCenter),i.lineTo(c.x,c.y),i.stroke())}i.restore()}}drawBorder(){}drawLabels(){let i=this.ctx,t=this.options,s=t.ticks;if(!s.display)return;let n=this.getIndexAngle(0),o,r;i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(n),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;let c=s.setContext(this.getContext(l)),h=j(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){i.font=h.string,r=i.measureText(a.label).width,i.fillStyle=c.backdropColor;let d=K(c.backdropPadding);i.fillRect(-r/2-d.left,-o-h.size/2-d.top,r+d.width,h.size+d.height)}Ct(i,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),i.restore()}drawTitle(){}},Si={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(Si);function Tr(e,i){return e-i}function Rr(e,i){if(O(i))return null;let t=e._adapter,{parser:s,round:n,isoWeekday:o}=e._parseOpts,r=i;return typeof s=="function"&&(r=s(r)),N(r)||(r=typeof s=="string"?t.parse(r,s):t.parse(r)),r===null?null:(n&&(r=n==="week"&&(zt(o)||o===!0)?t.startOf(r,"isoWeek",o):t.startOf(r,n)),+r)}function Er(e,i,t,s){let n=tt.length;for(let o=tt.indexOf(e);o<n-1;++o){let r=Si[tt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((t-i)/(a*r.size))<=s)return tt[o]}return tt[n-1]}function eu(e,i,t,s,n){for(let o=tt.length-1;o>=tt.indexOf(t);o--){let r=tt[o];if(Si[r].common&&e._adapter.diff(n,s,r)>=i-1)return r}return tt[t?tt.indexOf(t):0]}function iu(e){for(let i=tt.indexOf(e)+1,t=tt.length;i<t;++i)if(Si[tt[i]].common)return tt[i]}function Lr(e,i,t){if(!t)e[i]=!0;else if(t.length){let{lo:s,hi:n}=Qe(t,i),o=t[s]>=i?t[s]:t[n];e[o]=!0}}function su(e,i,t,s){let n=e._adapter,o=+n.startOf(i[0].value,s),r=i[i.length-1].value,a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=t[a],l>=0&&(i[l].major=!0);return i}function Ir(e,i,t){let s=[],n={},o=i.length,r,a;for(r=0;r<o;++r)a=i[r],n[a]=r,s.push({value:a,major:!1});return o===0||!t?s:su(e,s,n,t)}var Zs=(()=>{class e extends Ht{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,s={}){let n=t.time||(t.time={}),o=this._adapter=new pc._date(t.adapters.date);o.init(s),Zt(n.displayFormats,o.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=s.normalized}parse(t,s){return t===void 0?null:Rr(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,s=this._adapter,n=t.time.unit||"day",{min:o,max:r,minDefined:a,maxDefined:l}=this.getUserBounds();function c(h){!a&&!isNaN(h.min)&&(o=Math.min(o,h.min)),!l&&!isNaN(h.max)&&(r=Math.max(r,h.max))}(!a||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),o=N(o)&&!isNaN(o)?o:+s.startOf(Date.now(),n),r=N(r)&&!isNaN(r)?r:+s.endOf(Date.now(),n)+1,this.min=Math.min(o,r-1),this.max=Math.max(o+1,r)}_getLabelBounds(){let t=this.getLabelTimestamps(),s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(s=t[0],n=t[t.length-1]),{min:s,max:n}}buildTicks(){let t=this.options,s=t.time,n=t.ticks,o=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);let r=this.min,a=this.max,l=go(o,r,a);return this._unit=s.unit||(n.autoSkip?Er(s.minUnit,this.min,this.max,this._getLabelCapacity(r)):eu(this,l.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:iu(this._unit),this.initOffsets(o),t.reverse&&l.reverse(),Ir(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let s=0,n=0,o,r;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?s=1-o:s=(this.getDecimalForValue(t[1])-o)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?n=r:n=(r-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;s=$(s,0,a),n=$(n,0,a),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){let t=this._adapter,s=this.min,n=this.max,o=this.options,r=o.time,a=r.unit||Er(r.minUnit,s,n,this._getLabelCapacity(s)),l=C(o.ticks.stepSize,1),c=a==="week"?r.isoWeekday:!1,h=zt(c)||c===!0,d={},u=s,f,g;if(h&&(u=+t.startOf(u,"isoWeek",c)),u=+t.startOf(u,h?"day":a),t.diff(n,s,a)>1e5*l)throw new Error(s+" and "+n+" are too far apart with stepSize of "+l+" "+a);let p=o.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f<n;f=+t.add(f,l,a),g++)Lr(d,f,p);return(f===n||o.bounds==="ticks"||g===1)&&Lr(d,f,p),Object.keys(d).sort(Tr).map(m=>+m)}getLabelForValue(t){let s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(t,n.tooltipFormat):s.format(t,n.displayFormats.datetime)}format(t,s){let o=this.options.time.displayFormats,r=this._unit,a=s||o[r];return this._adapter.format(t,a)}_tickFormatFunction(t,s,n,o){let r=this.options,a=r.ticks.callback;if(a)return I(a,[t,s,n],this);let l=r.time.displayFormats,c=this._unit,h=this._majorUnit,d=c&&l[c],u=h&&l[h],f=n[s],g=h&&u&&f&&f.major;return this._adapter.format(t,o||(g?u:d))}generateTickLabels(t){let s,n,o;for(s=0,n=t.length;s<n;++s)o=t[s],o.label=this._tickFormatFunction(o.value,s,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let s=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((s.start+n)*s.factor)}getValueForPixel(t){let s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){let s=this.options.ticks,n=this.ctx.measureText(t).width,o=st(this.isHorizontal()?s.maxRotation:s.minRotation),r=Math.cos(o),a=Math.sin(o),l=this._resolveTickFontOptions(0).size;return{w:n*r+l*a,h:n*a+l*r}}_getLabelCapacity(t){let s=this.options.time,n=s.displayFormats,o=n[s.unit]||n.millisecond,r=this._tickFormatFunction(t,0,Ir(this,[t],this._majorUnit),o),a=this._getLabelSize(r),l=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],s,n;if(t.length)return t;let o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(s=0,n=o.length;s<n;++s)t=t.concat(o[s].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],s,n;if(t.length)return t;let o=this.getLabels();for(s=0,n=o.length;s<n;++s)t.push(Rr(this,o[s]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return ts(t.sort(Tr))}}return e})();function fi(e,i,t){let s=0,n=e.length-1,o,r,a,l;t?(i>=e[s].pos&&i<=e[n].pos&&({lo:s,hi:n}=at(e,"pos",i)),{pos:o,time:a}=e[s],{pos:r,time:l}=e[n]):(i>=e[s].time&&i<=e[n].time&&({lo:s,hi:n}=at(e,"time",i)),{time:o,pos:a}=e[s],{time:r,pos:l}=e[n]);let c=r-o;return c?a+(l-a)*(i-o)/c:a}var Js=class extends Zs{static id="timeseries";static defaults=Zs.defaults;constructor(i){super(i),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let i=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(i);this._minPos=fi(t,this.min),this._tableRange=fi(t,this.max)-this._minPos,super.initOffsets(i)}buildLookupTable(i){let{min:t,max:s}=this,n=[],o=[],r,a,l,c,h;for(r=0,a=i.length;r<a;++r)c=i[r],c>=t&&c<=s&&n.push(c);if(n.length<2)return[{time:t,pos:0},{time:s,pos:1}];for(r=0,a=n.length;r<a;++r)h=n[r+1],l=n[r-1],c=n[r],Math.round((h+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){let i=this.min,t=this.max,s=super.getDataTimestamps();return(!s.includes(i)||!s.length)&&s.splice(0,0,i),(!s.includes(t)||s.length===1)&&s.push(t),s.sort((n,o)=>n-o)}_getTimestampsForTable(){let i=this._cache.all||[];if(i.length)return i;let t=this.getDataTimestamps(),s=this.getLabelTimestamps();return t.length&&s.length?i=this.normalize(t.concat(s)):i=t.length?t:s,i=this._cache.all=i,i}getDecimalForValue(i){return(fi(this._table,i)-this._minPos)/this._tableRange}getValueForPixel(i){let t=this._offsets,s=this.getDecimalForPixel(i)/t.factor-t.end;return fi(this._table,s*this._tableRange+this._minPos,!0)}},nu=Object.freeze({__proto__:null,CategoryScale:zd,LinearScale:Xs,LogarithmicScale:Ks,RadialLinearScale:Gs,TimeScale:Zs,TimeSeriesScale:Js}),sa=[fc,Vh,Ld,nu];function tn(e){if(!e||typeof e!="object")return!1;let i=Object.getPrototypeOf(e);return i===null||i===Object.prototype||Object.getPrototypeOf(i)===null?Object.prototype.toString.call(e)==="[object Object]":!1}function na(e){return e==="__proto__"}function jt(e,i){let t=Object.keys(i);for(let s=0;s<t.length;s++){let n=t[s];if(na(n))continue;let o=i[n],r=e[n];oa(o)&&oa(r)?e[n]=jt(r,o):Array.isArray(o)?e[n]=jt([],o):tn(o)?e[n]=jt({},o):(r===void 0||o!==void 0)&&(e[n]=o)}return e}function oa(e){return tn(e)||Array.isArray(e)}var ra=new dn("Configuration for ngCharts");function Uu(...e){return{registerables:[...sa,...e]}}function Xu(...e){let i=e.reduce(jt,{});return{provide:ra,useValue:i}}var ou=(()=>{class e{constructor(){this.colorschemesOptions=new Le(void 0)}setColorschemesOptions(t){this.pColorschemesOptions=t,this.colorschemesOptions.next(t)}getColorschemesOptions(){return this.pColorschemesOptions}static{this.\u0275fac=function(s){return new(s||e)}}static{this.\u0275prov=Ie({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),Ku=(()=>{class e{constructor(){this.type="bar",this.plugins=[],this.chartClick=new Et,this.chartHover=new Et,this.ctx=null,this.subs=[],this.themeOverrides={},this.element=Z(Be),this.zone=Z(Fe),this.themeService=Z(ou),this.config=Z(ra,{optional:!0}),this.platformId=Z(pn),this.isBrowser=Ln(this.platformId),this.config?.registerables&&wi.register(...this.config.registerables),this.config?.defaults&&F.set(this.config.defaults),this.isBrowser&&(this.ctx=this.element.nativeElement.getContext("2d")),this.subs.push(this.themeService.colorschemesOptions.pipe(rn()).subscribe(t=>this.themeChanged(t)))}ngOnChanges(t){if(!this.isBrowser)return;let s=["type"],n=Object.getOwnPropertyNames(t);if(n.some(o=>s.includes(o))||n.every(o=>t[o].isFirstChange()))this.render();else if(this.chart&&t.legend){let o=this.getChartConfiguration();o.options&&(this.chart.options=o.options),this.update()}else if(this.chart){let o=this.getChartConfiguration();o.data&&this.chart.config.data&&Object.assign(this.chart.config.data,o.data),o.plugins&&this.chart.config.plugins&&Object.assign(this.chart.config.plugins,o.plugins),o.options&&this.chart.config.options&&Object.assign(this.chart.config.options,o.options),this.update()}}ngOnDestroy(){this.chart&&(this.chart.destroy(),this.chart=void 0),this.subs.forEach(t=>t.unsubscribe())}render(){if(!(!this.isBrowser||!this.ctx))return this.chart&&this.chart.destroy(),this.zone.runOutsideAngular(()=>this.chart=new wi(this.ctx,this.getChartConfiguration()))}update(t){this.chart&&this.isBrowser&&this.zone.runOutsideAngular(()=>this.chart?.update(t))}hideDataset(t,s){this.chart&&this.isBrowser&&(this.chart.getDatasetMeta(t).hidden=s,this.update())}isDatasetHidden(t){return this.chart?.getDatasetMeta(t)?.hidden}toBase64Image(){return this.chart?.toBase64Image()}themeChanged(t){this.themeOverrides=t,this.chart&&(this.chart.config.options&&Object.assign(this.chart.config.options,this.getChartOptions()),this.update())}getChartOptions(){return[{onHover:(t,s)=>{!this.chartHover.observed&&!this.chartHover.observers?.length||this.zone.run(()=>this.chartHover.emit({event:t,active:s}))},onClick:(t,s)=>{!this.chartClick.observed&&!this.chartClick.observers?.length||this.zone.run(()=>this.chartClick.emit({event:t,active:s}))}},this.themeOverrides??{},this.options??{},{plugins:{legend:{display:this.legend}}}].reduce(jt,{})}getChartConfiguration(){return{type:this.type,data:this.getChartData(),options:this.getChartOptions(),plugins:this.plugins}}getChartData(){return this.data?this.data:{labels:this.labels||[],datasets:this.datasets||[]}}static{this.\u0275fac=function(s){return new(s||e)}}static{this.\u0275dir=ze({type:e,selectors:[["canvas","baseChart",""]],inputs:{type:"type",legend:"legend",data:"data",options:"options",plugins:"plugins",labels:"labels",datasets:"datasets"},outputs:{chartClick:"chartClick",chartHover:"chartHover"},exportAs:["base-chart"],features:[ce]})}}return e})();export{yu as a,vu as b,Uu as c,Xu as d,Ku as e};