2023-06-29 11:55:02 +08:00

201 lines
322 KiB
JavaScript

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository (https://github.com/phibr0/obsidian-dictionary)
*/
var hg=Object.create;var fi=Object.defineProperty,ug=Object.defineProperties,fg=Object.getOwnPropertyDescriptor,dg=Object.getOwnPropertyDescriptors,pg=Object.getOwnPropertyNames,wl=Object.getOwnPropertySymbols,gg=Object.getPrototypeOf,Sl=Object.prototype.hasOwnProperty,mg=Object.prototype.propertyIsEnumerable;var Ml=(n,t,e)=>t in n?fi(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,di=(n,t)=>{for(var e in t||(t={}))Sl.call(t,e)&&Ml(n,e,t[e]);if(wl)for(var e of wl(t))mg.call(t,e)&&Ml(n,e,t[e]);return n},pi=(n,t)=>ug(n,dg(t)),Cl=n=>fi(n,"__esModule",{value:!0});var jr=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),bg=(n,t)=>{Cl(n);for(var e in t)fi(n,e,{get:t[e],enumerable:!0})},vg=(n,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pg(t))!Sl.call(n,i)&&i!=="default"&&fi(n,i,{get:()=>t[i],enumerable:!(e=fg(t,i))||e.enumerable});return n},Ae=n=>vg(Cl(fi(n!=null?hg(gg(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var Bh=jr((Va,Wa)=>{(function(n,t){typeof Va=="object"&&typeof Wa!="undefined"?Wa.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.chroma=t())})(Va,function(){"use strict";for(var n=function(h,f,m){return f===void 0&&(f=0),m===void 0&&(m=1),h<f?f:h>m?m:h},t=n,e=function(h){h._clipped=!1,h._unclipped=h.slice(0);for(var f=0;f<=3;f++)f<3?((h[f]<0||h[f]>255)&&(h._clipped=!0),h[f]=t(h[f],0,255)):f===3&&(h[f]=t(h[f],0,1));return h},i={},s=0,r=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];s<r.length;s+=1){var a=r[s];i["[object "+a+"]"]=a.toLowerCase()}var o=function(h){return i[Object.prototype.toString.call(h)]||"object"},l=o,c=function(h,f){return f===void 0&&(f=null),h.length>=3?Array.prototype.slice.call(h):l(h[0])=="object"&&f?f.split("").filter(function(m){return h[0][m]!==void 0}).map(function(m){return h[0][m]}):h[0]},u=o,d=function(h){if(h.length<2)return null;var f=h.length-1;return u(h[f])=="string"?h[f].toLowerCase():null},g=Math.PI,p={clip_rgb:e,limit:n,type:o,unpack:c,last:d,PI:g,TWOPI:g*2,PITHIRD:g/3,DEG2RAD:g/180,RAD2DEG:180/g},b={format:{},autodetect:[]},x=p.last,M=p.clip_rgb,C=p.type,P=b,$=function(){for(var f=[],m=arguments.length;m--;)f[m]=arguments[m];var _=this;if(C(f[0])==="object"&&f[0].constructor&&f[0].constructor===this.constructor)return f[0];var S=x(f),T=!1;if(!S){T=!0,P.sorted||(P.autodetect=P.autodetect.sort(function(j,G){return G.p-j.p}),P.sorted=!0);for(var k=0,D=P.autodetect;k<D.length;k+=1){var L=D[k];if(S=L.test.apply(L,f),S)break}}if(P.format[S]){var I=P.format[S].apply(null,T?f:f.slice(0,-1));_._rgb=M(I)}else throw new Error("unknown format: "+f);_._rgb.length===3&&_._rgb.push(1)};$.prototype.toString=function(){return C(this.hex)=="function"?this.hex():"["+this._rgb.join(",")+"]"};var R=$,F=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(F.Color,[null].concat(h)))};F.Color=R,F.version="2.4.2";var z=F,N=p.unpack,X=Math.max,U=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=N(h,"rgb"),_=m[0],S=m[1],T=m[2];_=_/255,S=S/255,T=T/255;var k=1-X(_,X(S,T)),D=k<1?1/(1-k):0,L=(1-_-k)*D,I=(1-S-k)*D,j=(1-T-k)*D;return[L,I,j,k]},nt=U,ot=p.unpack,st=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=ot(h,"cmyk");var m=h[0],_=h[1],S=h[2],T=h[3],k=h.length>4?h[4]:1;return T===1?[0,0,0,k]:[m>=1?0:255*(1-m)*(1-T),_>=1?0:255*(1-_)*(1-T),S>=1?0:255*(1-S)*(1-T),k]},kt=st,Ft=z,et=R,Ct=b,yt=p.unpack,Qt=p.type,de=nt;et.prototype.cmyk=function(){return de(this._rgb)},Ft.cmyk=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(et,[null].concat(h,["cmyk"])))},Ct.format.cmyk=kt,Ct.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=yt(h,"cmyk"),Qt(h)==="array"&&h.length===4)return"cmyk"}});var rt=p.unpack,Ot=p.last,It=function(h){return Math.round(h*100)/100},Wt=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=rt(h,"hsla"),_=Ot(h)||"lsa";return m[0]=It(m[0]||0),m[1]=It(m[1]*100)+"%",m[2]=It(m[2]*100)+"%",_==="hsla"||m.length>3&&m[3]<1?(m[3]=m.length>3?m[3]:1,_="hsla"):m.length=3,_+"("+m.join(",")+")"},Ut=Wt,w=p.unpack,v=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=w(h,"rgba");var m=h[0],_=h[1],S=h[2];m/=255,_/=255,S/=255;var T=Math.min(m,_,S),k=Math.max(m,_,S),D=(k+T)/2,L,I;return k===T?(L=0,I=Number.NaN):L=D<.5?(k-T)/(k+T):(k-T)/(2-k-T),m==k?I=(_-S)/(k-T):_==k?I=2+(S-m)/(k-T):S==k&&(I=4+(m-_)/(k-T)),I*=60,I<0&&(I+=360),h.length>3&&h[3]!==void 0?[I,L,D,h[3]]:[I,L,D]},y=v,A=p.unpack,E=p.last,O=Ut,Z=y,W=Math.round,J=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=A(h,"rgba"),_=E(h)||"rgb";return _.substr(0,3)=="hsl"?O(Z(m),_):(m[0]=W(m[0]),m[1]=W(m[1]),m[2]=W(m[2]),(_==="rgba"||m.length>3&&m[3]<1)&&(m[3]=m.length>3?m[3]:1,_="rgba"),_+"("+m.slice(0,_==="rgb"?3:4).join(",")+")")},tt=J,_t=p.unpack,zt=Math.round,Tt=function(){for(var h,f=[],m=arguments.length;m--;)f[m]=arguments[m];f=_t(f,"hsl");var _=f[0],S=f[1],T=f[2],k,D,L;if(S===0)k=D=L=T*255;else{var I=[0,0,0],j=[0,0,0],G=T<.5?T*(1+S):T+S-T*S,H=2*T-G,Q=_/360;I[0]=Q+1/3,I[1]=Q,I[2]=Q-1/3;for(var K=0;K<3;K++)I[K]<0&&(I[K]+=1),I[K]>1&&(I[K]-=1),6*I[K]<1?j[K]=H+(G-H)*6*I[K]:2*I[K]<1?j[K]=G:3*I[K]<2?j[K]=H+(G-H)*(2/3-I[K])*6:j[K]=H;h=[zt(j[0]*255),zt(j[1]*255),zt(j[2]*255)],k=h[0],D=h[1],L=h[2]}return f.length>3?[k,D,L,f[3]]:[k,D,L,1]},Nt=Tt,Ht=Nt,ae=b,_e=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,pe=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,_n=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,tn=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,yn=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,De=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,oi=Math.round,xn=function(h){h=h.toLowerCase().trim();var f;if(ae.format.named)try{return ae.format.named(h)}catch(K){}if(f=h.match(_e)){for(var m=f.slice(1,4),_=0;_<3;_++)m[_]=+m[_];return m[3]=1,m}if(f=h.match(pe)){for(var S=f.slice(1,5),T=0;T<4;T++)S[T]=+S[T];return S}if(f=h.match(_n)){for(var k=f.slice(1,4),D=0;D<3;D++)k[D]=oi(k[D]*2.55);return k[3]=1,k}if(f=h.match(tn)){for(var L=f.slice(1,5),I=0;I<3;I++)L[I]=oi(L[I]*2.55);return L[3]=+L[3],L}if(f=h.match(yn)){var j=f.slice(1,4);j[1]*=.01,j[2]*=.01;var G=Ht(j);return G[3]=1,G}if(f=h.match(De)){var H=f.slice(1,4);H[1]*=.01,H[2]*=.01;var Q=Ht(H);return Q[3]=+f[4],Q}};xn.test=function(h){return _e.test(h)||pe.test(h)||_n.test(h)||tn.test(h)||yn.test(h)||De.test(h)};var Ln=xn,Ji=z,li=R,Rn=b,Ne=p.type,kn=tt,wn=Ln;li.prototype.css=function(h){return kn(this._rgb,h)},Ji.css=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(li,[null].concat(h,["css"])))},Rn.format.css=wn,Rn.autodetect.push({p:5,test:function(h){for(var f=[],m=arguments.length-1;m-- >0;)f[m]=arguments[m+1];if(!f.length&&Ne(h)==="string"&&wn.test(h))return"css"}});var Fn=R,Qi=z,en=b,se=p.unpack;en.format.gl=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=se(h,"rgba");return m[0]*=255,m[1]*=255,m[2]*=255,m},Qi.gl=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Fn,[null].concat(h,["gl"])))},Fn.prototype.gl=function(){var h=this._rgb;return[h[0]/255,h[1]/255,h[2]/255,h[3]]};var pt=p.unpack,Kt=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=pt(h,"rgb"),_=m[0],S=m[1],T=m[2],k=Math.min(_,S,T),D=Math.max(_,S,T),L=D-k,I=L*100/255,j=k/(255-L)*100,G;return L===0?G=Number.NaN:(_===D&&(G=(S-T)/L),S===D&&(G=2+(T-_)/L),T===D&&(G=4+(_-S)/L),G*=60,G<0&&(G+=360)),[G,I,j]},nn=Kt,le=p.unpack,ts=Math.floor,xu=function(){for(var h,f,m,_,S,T,k=[],D=arguments.length;D--;)k[D]=arguments[D];k=le(k,"hcg");var L=k[0],I=k[1],j=k[2],G,H,Q;j=j*255;var K=I*255;if(I===0)G=H=Q=j;else{L===360&&(L=0),L>360&&(L-=360),L<0&&(L+=360),L/=60;var lt=ts(L),ut=L-lt,mt=j*(1-I),xt=mt+K*(1-ut),te=mt+K*ut,Jt=mt+K;switch(lt){case 0:h=[Jt,te,mt],G=h[0],H=h[1],Q=h[2];break;case 1:f=[xt,Jt,mt],G=f[0],H=f[1],Q=f[2];break;case 2:m=[mt,Jt,te],G=m[0],H=m[1],Q=m[2];break;case 3:_=[mt,xt,Jt],G=_[0],H=_[1],Q=_[2];break;case 4:S=[te,mt,Jt],G=S[0],H=S[1],Q=S[2];break;case 5:T=[Jt,mt,xt],G=T[0],H=T[1],Q=T[2];break}}return[G,H,Q,k.length>3?k[3]:1]},ku=xu,wu=p.unpack,Su=p.type,Mu=z,ho=R,uo=b,Cu=nn;ho.prototype.hcg=function(){return Cu(this._rgb)},Mu.hcg=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(ho,[null].concat(h,["hcg"])))},uo.format.hcg=ku,uo.autodetect.push({p:1,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=wu(h,"hcg"),Su(h)==="array"&&h.length===3)return"hcg"}});var Tu=p.unpack,Pu=p.last,es=Math.round,Eu=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=Tu(h,"rgba"),_=m[0],S=m[1],T=m[2],k=m[3],D=Pu(h)||"auto";k===void 0&&(k=1),D==="auto"&&(D=k<1?"rgba":"rgb"),_=es(_),S=es(S),T=es(T);var L=_<<16|S<<8|T,I="000000"+L.toString(16);I=I.substr(I.length-6);var j="0"+es(k*255).toString(16);switch(j=j.substr(j.length-2),D.toLowerCase()){case"rgba":return"#"+I+j;case"argb":return"#"+j+I;default:return"#"+I}},fo=Eu,Ou=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Du=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Au=function(h){if(h.match(Ou)){(h.length===4||h.length===7)&&(h=h.substr(1)),h.length===3&&(h=h.split(""),h=h[0]+h[0]+h[1]+h[1]+h[2]+h[2]);var f=parseInt(h,16),m=f>>16,_=f>>8&255,S=f&255;return[m,_,S,1]}if(h.match(Du)){(h.length===5||h.length===9)&&(h=h.substr(1)),h.length===4&&(h=h.split(""),h=h[0]+h[0]+h[1]+h[1]+h[2]+h[2]+h[3]+h[3]);var T=parseInt(h,16),k=T>>24&255,D=T>>16&255,L=T>>8&255,I=Math.round((T&255)/255*100)/100;return[k,D,L,I]}throw new Error("unknown hex color: "+h)},po=Au,Lu=z,go=R,Ru=p.type,mo=b,Fu=fo;go.prototype.hex=function(h){return Fu(this._rgb,h)},Lu.hex=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(go,[null].concat(h,["hex"])))},mo.format.hex=po,mo.autodetect.push({p:4,test:function(h){for(var f=[],m=arguments.length-1;m-- >0;)f[m]=arguments[m+1];if(!f.length&&Ru(h)==="string"&&[3,4,5,6,7,8,9].indexOf(h.length)>=0)return"hex"}});var $u=p.unpack,bo=p.TWOPI,Iu=Math.min,zu=Math.sqrt,Bu=Math.acos,ju=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=$u(h,"rgb"),_=m[0],S=m[1],T=m[2];_/=255,S/=255,T/=255;var k,D=Iu(_,S,T),L=(_+S+T)/3,I=L>0?1-D/L:0;return I===0?k=NaN:(k=(_-S+(_-T))/2,k/=zu((_-S)*(_-S)+(_-T)*(S-T)),k=Bu(k),T>S&&(k=bo-k),k/=bo),[k*360,I,L]},Nu=ju,Hu=p.unpack,dr=p.limit,$n=p.TWOPI,pr=p.PITHIRD,In=Math.cos,Vu=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=Hu(h,"hsi");var m=h[0],_=h[1],S=h[2],T,k,D;return isNaN(m)&&(m=0),isNaN(_)&&(_=0),m>360&&(m-=360),m<0&&(m+=360),m/=360,m<1/3?(D=(1-_)/3,T=(1+_*In($n*m)/In(pr-$n*m))/3,k=1-(D+T)):m<2/3?(m-=1/3,T=(1-_)/3,k=(1+_*In($n*m)/In(pr-$n*m))/3,D=1-(T+k)):(m-=2/3,k=(1-_)/3,D=(1+_*In($n*m)/In(pr-$n*m))/3,T=1-(k+D)),T=dr(S*T*3),k=dr(S*k*3),D=dr(S*D*3),[T*255,k*255,D*255,h.length>3?h[3]:1]},Wu=Vu,Yu=p.unpack,qu=p.type,Gu=z,vo=R,_o=b,Xu=Nu;vo.prototype.hsi=function(){return Xu(this._rgb)},Gu.hsi=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(vo,[null].concat(h,["hsi"])))},_o.format.hsi=Wu,_o.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=Yu(h,"hsi"),qu(h)==="array"&&h.length===3)return"hsi"}});var Uu=p.unpack,Ku=p.type,Zu=z,yo=R,xo=b,Ju=y;yo.prototype.hsl=function(){return Ju(this._rgb)},Zu.hsl=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(yo,[null].concat(h,["hsl"])))},xo.format.hsl=Nt,xo.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=Uu(h,"hsl"),Ku(h)==="array"&&h.length===3)return"hsl"}});var Qu=p.unpack,tf=Math.min,ef=Math.max,nf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=Qu(h,"rgb");var m=h[0],_=h[1],S=h[2],T=tf(m,_,S),k=ef(m,_,S),D=k-T,L,I,j;return j=k/255,k===0?(L=Number.NaN,I=0):(I=D/k,m===k&&(L=(_-S)/D),_===k&&(L=2+(S-m)/D),S===k&&(L=4+(m-_)/D),L*=60,L<0&&(L+=360)),[L,I,j]},sf=nf,rf=p.unpack,af=Math.floor,of=function(){for(var h,f,m,_,S,T,k=[],D=arguments.length;D--;)k[D]=arguments[D];k=rf(k,"hsv");var L=k[0],I=k[1],j=k[2],G,H,Q;if(j*=255,I===0)G=H=Q=j;else{L===360&&(L=0),L>360&&(L-=360),L<0&&(L+=360),L/=60;var K=af(L),lt=L-K,ut=j*(1-I),mt=j*(1-I*lt),xt=j*(1-I*(1-lt));switch(K){case 0:h=[j,xt,ut],G=h[0],H=h[1],Q=h[2];break;case 1:f=[mt,j,ut],G=f[0],H=f[1],Q=f[2];break;case 2:m=[ut,j,xt],G=m[0],H=m[1],Q=m[2];break;case 3:_=[ut,mt,j],G=_[0],H=_[1],Q=_[2];break;case 4:S=[xt,ut,j],G=S[0],H=S[1],Q=S[2];break;case 5:T=[j,ut,mt],G=T[0],H=T[1],Q=T[2];break}}return[G,H,Q,k.length>3?k[3]:1]},lf=of,cf=p.unpack,hf=p.type,uf=z,ko=R,wo=b,ff=sf;ko.prototype.hsv=function(){return ff(this._rgb)},uf.hsv=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(ko,[null].concat(h,["hsv"])))},wo.format.hsv=lf,wo.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=cf(h,"hsv"),hf(h)==="array"&&h.length===3)return"hsv"}});var ns={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},zn=ns,df=p.unpack,So=Math.pow,pf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=df(h,"rgb"),_=m[0],S=m[1],T=m[2],k=gf(_,S,T),D=k[0],L=k[1],I=k[2],j=116*L-16;return[j<0?0:j,500*(D-L),200*(L-I)]},gr=function(h){return(h/=255)<=.04045?h/12.92:So((h+.055)/1.055,2.4)},mr=function(h){return h>zn.t3?So(h,1/3):h/zn.t2+zn.t0},gf=function(h,f,m){h=gr(h),f=gr(f),m=gr(m);var _=mr((.4124564*h+.3575761*f+.1804375*m)/zn.Xn),S=mr((.2126729*h+.7151522*f+.072175*m)/zn.Yn),T=mr((.0193339*h+.119192*f+.9503041*m)/zn.Zn);return[_,S,T]},Mo=pf,Bn=ns,mf=p.unpack,bf=Math.pow,vf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=mf(h,"lab");var m=h[0],_=h[1],S=h[2],T,k,D,L,I,j;return k=(m+16)/116,T=isNaN(_)?k:k+_/500,D=isNaN(S)?k:k-S/200,k=Bn.Yn*vr(k),T=Bn.Xn*vr(T),D=Bn.Zn*vr(D),L=br(3.2404542*T-1.5371385*k-.4985314*D),I=br(-.969266*T+1.8760108*k+.041556*D),j=br(.0556434*T-.2040259*k+1.0572252*D),[L,I,j,h.length>3?h[3]:1]},br=function(h){return 255*(h<=.00304?12.92*h:1.055*bf(h,1/2.4)-.055)},vr=function(h){return h>Bn.t1?h*h*h:Bn.t2*(h-Bn.t0)},Co=vf,_f=p.unpack,yf=p.type,xf=z,To=R,Po=b,kf=Mo;To.prototype.lab=function(){return kf(this._rgb)},xf.lab=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(To,[null].concat(h,["lab"])))},Po.format.lab=Co,Po.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=_f(h,"lab"),yf(h)==="array"&&h.length===3)return"lab"}});var wf=p.unpack,Sf=p.RAD2DEG,Mf=Math.sqrt,Cf=Math.atan2,Tf=Math.round,Pf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=wf(h,"lab"),_=m[0],S=m[1],T=m[2],k=Mf(S*S+T*T),D=(Cf(T,S)*Sf+360)%360;return Tf(k*1e4)===0&&(D=Number.NaN),[_,k,D]},Eo=Pf,Ef=p.unpack,Of=Mo,Df=Eo,Af=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=Ef(h,"rgb"),_=m[0],S=m[1],T=m[2],k=Of(_,S,T),D=k[0],L=k[1],I=k[2];return Df(D,L,I)},Lf=Af,Rf=p.unpack,Ff=p.DEG2RAD,$f=Math.sin,If=Math.cos,zf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=Rf(h,"lch"),_=m[0],S=m[1],T=m[2];return isNaN(T)&&(T=0),T=T*Ff,[_,If(T)*S,$f(T)*S]},Oo=zf,Bf=p.unpack,jf=Oo,Nf=Co,Hf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=Bf(h,"lch");var m=h[0],_=h[1],S=h[2],T=jf(m,_,S),k=T[0],D=T[1],L=T[2],I=Nf(k,D,L),j=I[0],G=I[1],H=I[2];return[j,G,H,h.length>3?h[3]:1]},Do=Hf,Vf=p.unpack,Wf=Do,Yf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=Vf(h,"hcl").reverse();return Wf.apply(void 0,m)},qf=Yf,Gf=p.unpack,Xf=p.type,Ao=z,is=R,_r=b,Lo=Lf;is.prototype.lch=function(){return Lo(this._rgb)},is.prototype.hcl=function(){return Lo(this._rgb).reverse()},Ao.lch=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(is,[null].concat(h,["lch"])))},Ao.hcl=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(is,[null].concat(h,["hcl"])))},_r.format.lch=Do,_r.format.hcl=qf,["lch","hcl"].forEach(function(h){return _r.autodetect.push({p:2,test:function(){for(var f=[],m=arguments.length;m--;)f[m]=arguments[m];if(f=Gf(f,h),Xf(f)==="array"&&f.length===3)return h}})});var Uf={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Ro=Uf,Kf=R,Fo=b,Zf=p.type,ci=Ro,Jf=po,Qf=fo;Kf.prototype.name=function(){for(var h=Qf(this._rgb,"rgb"),f=0,m=Object.keys(ci);f<m.length;f+=1){var _=m[f];if(ci[_]===h)return _.toLowerCase()}return h},Fo.format.named=function(h){if(h=h.toLowerCase(),ci[h])return Jf(ci[h]);throw new Error("unknown color name: "+h)},Fo.autodetect.push({p:5,test:function(h){for(var f=[],m=arguments.length-1;m-- >0;)f[m]=arguments[m+1];if(!f.length&&Zf(h)==="string"&&ci[h.toLowerCase()])return"named"}});var td=p.unpack,ed=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=td(h,"rgb"),_=m[0],S=m[1],T=m[2];return(_<<16)+(S<<8)+T},nd=ed,id=p.type,sd=function(h){if(id(h)=="number"&&h>=0&&h<=16777215){var f=h>>16,m=h>>8&255,_=h&255;return[f,m,_,1]}throw new Error("unknown num color: "+h)},rd=sd,ad=z,$o=R,Io=b,od=p.type,ld=nd;$o.prototype.num=function(){return ld(this._rgb)},ad.num=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply($o,[null].concat(h,["num"])))},Io.format.num=rd,Io.autodetect.push({p:5,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h.length===1&&od(h[0])==="number"&&h[0]>=0&&h[0]<=16777215)return"num"}});var cd=z,yr=R,zo=b,Bo=p.unpack,jo=p.type,No=Math.round;yr.prototype.rgb=function(h){return h===void 0&&(h=!0),h===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(No)},yr.prototype.rgba=function(h){return h===void 0&&(h=!0),this._rgb.slice(0,4).map(function(f,m){return m<3?h===!1?f:No(f):f})},cd.rgb=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(yr,[null].concat(h,["rgb"])))},zo.format.rgb=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=Bo(h,"rgba");return m[3]===void 0&&(m[3]=1),m},zo.autodetect.push({p:3,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=Bo(h,"rgba"),jo(h)==="array"&&(h.length===3||h.length===4&&jo(h[3])=="number"&&h[3]>=0&&h[3]<=1))return"rgb"}});var ss=Math.log,hd=function(h){var f=h/100,m,_,S;return f<66?(m=255,_=f<6?0:-155.25485562709179-.44596950469579133*(_=f-2)+104.49216199393888*ss(_),S=f<20?0:-254.76935184120902+.8274096064007395*(S=f-10)+115.67994401066147*ss(S)):(m=351.97690566805693+.114206453784165*(m=f-55)-40.25366309332127*ss(m),_=325.4494125711974+.07943456536662342*(_=f-50)-28.0852963507957*ss(_),S=255),[m,_,S,1]},Ho=hd,ud=Ho,fd=p.unpack,dd=Math.round,pd=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];for(var m=fd(h,"rgb"),_=m[0],S=m[2],T=1e3,k=4e4,D=.4,L;k-T>D;){L=(k+T)*.5;var I=ud(L);I[2]/I[0]>=S/_?k=L:T=L}return dd(L)},gd=pd,xr=z,rs=R,kr=b,md=gd;rs.prototype.temp=rs.prototype.kelvin=rs.prototype.temperature=function(){return md(this._rgb)},xr.temp=xr.kelvin=xr.temperature=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(rs,[null].concat(h,["temp"])))},kr.format.temp=kr.format.kelvin=kr.format.temperature=Ho;var bd=p.unpack,wr=Math.cbrt,vd=Math.pow,_d=Math.sign,yd=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=bd(h,"rgb"),_=m[0],S=m[1],T=m[2],k=[Sr(_/255),Sr(S/255),Sr(T/255)],D=k[0],L=k[1],I=k[2],j=wr(.4122214708*D+.5363325363*L+.0514459929*I),G=wr(.2119034982*D+.6806995451*L+.1073969566*I),H=wr(.0883024619*D+.2817188376*L+.6299787005*I);return[.2104542553*j+.793617785*G-.0040720468*H,1.9779984951*j-2.428592205*G+.4505937099*H,.0259040371*j+.7827717662*G-.808675766*H]},Vo=yd;function Sr(h){var f=Math.abs(h);return f<.04045?h/12.92:(_d(h)||1)*vd((f+.055)/1.055,2.4)}var xd=p.unpack,as=Math.pow,kd=Math.sign,wd=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=xd(h,"lab");var m=h[0],_=h[1],S=h[2],T=as(m+.3963377774*_+.2158037573*S,3),k=as(m-.1055613458*_-.0638541728*S,3),D=as(m-.0894841775*_-1.291485548*S,3);return[255*Mr(4.0767416621*T-3.3077115913*k+.2309699292*D),255*Mr(-1.2684380046*T+2.6097574011*k-.3413193965*D),255*Mr(-.0041960863*T-.7034186147*k+1.707614701*D),h.length>3?h[3]:1]},Wo=wd;function Mr(h){var f=Math.abs(h);return f>.0031308?(kd(h)||1)*(1.055*as(f,1/2.4)-.055):h*12.92}var Sd=p.unpack,Md=p.type,Cd=z,Yo=R,qo=b,Td=Vo;Yo.prototype.oklab=function(){return Td(this._rgb)},Cd.oklab=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Yo,[null].concat(h,["oklab"])))},qo.format.oklab=Wo,qo.autodetect.push({p:3,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=Sd(h,"oklab"),Md(h)==="array"&&h.length===3)return"oklab"}});var Pd=p.unpack,Ed=Vo,Od=Eo,Dd=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=Pd(h,"rgb"),_=m[0],S=m[1],T=m[2],k=Ed(_,S,T),D=k[0],L=k[1],I=k[2];return Od(D,L,I)},Ad=Dd,Ld=p.unpack,Rd=Oo,Fd=Wo,$d=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=Ld(h,"lch");var m=h[0],_=h[1],S=h[2],T=Rd(m,_,S),k=T[0],D=T[1],L=T[2],I=Fd(k,D,L),j=I[0],G=I[1],H=I[2];return[j,G,H,h.length>3?h[3]:1]},Id=$d,zd=p.unpack,Bd=p.type,jd=z,Go=R,Xo=b,Nd=Ad;Go.prototype.oklch=function(){return Nd(this._rgb)},jd.oklch=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Go,[null].concat(h,["oklch"])))},Xo.format.oklch=Id,Xo.autodetect.push({p:3,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=zd(h,"oklch"),Bd(h)==="array"&&h.length===3)return"oklch"}});var Uo=R,Hd=p.type;Uo.prototype.alpha=function(h,f){return f===void 0&&(f=!1),h!==void 0&&Hd(h)==="number"?f?(this._rgb[3]=h,this):new Uo([this._rgb[0],this._rgb[1],this._rgb[2],h],"rgb"):this._rgb[3]};var Vd=R;Vd.prototype.clipped=function(){return this._rgb._clipped||!1};var Sn=R,Wd=ns;Sn.prototype.darken=function(h){h===void 0&&(h=1);var f=this,m=f.lab();return m[0]-=Wd.Kn*h,new Sn(m,"lab").alpha(f.alpha(),!0)},Sn.prototype.brighten=function(h){return h===void 0&&(h=1),this.darken(-h)},Sn.prototype.darker=Sn.prototype.darken,Sn.prototype.brighter=Sn.prototype.brighten;var Yd=R;Yd.prototype.get=function(h){var f=h.split("."),m=f[0],_=f[1],S=this[m]();if(_){var T=m.indexOf(_)-(m.substr(0,2)==="ok"?2:0);if(T>-1)return S[T];throw new Error("unknown channel "+_+" in mode "+m)}else return S};var jn=R,qd=p.type,Gd=Math.pow,Xd=1e-7,Ud=20;jn.prototype.luminance=function(h){if(h!==void 0&&qd(h)==="number"){if(h===0)return new jn([0,0,0,this._rgb[3]],"rgb");if(h===1)return new jn([255,255,255,this._rgb[3]],"rgb");var f=this.luminance(),m="rgb",_=Ud,S=function(k,D){var L=k.interpolate(D,.5,m),I=L.luminance();return Math.abs(h-I)<Xd||!_--?L:I>h?S(k,L):S(L,D)},T=(f>h?S(new jn([0,0,0]),this):S(this,new jn([255,255,255]))).rgb();return new jn(T.concat([this._rgb[3]]))}return Kd.apply(void 0,this._rgb.slice(0,3))};var Kd=function(h,f,m){return h=Cr(h),f=Cr(f),m=Cr(m),.2126*h+.7152*f+.0722*m},Cr=function(h){return h/=255,h<=.03928?h/12.92:Gd((h+.055)/1.055,2.4)},ge={},Ko=R,Zo=p.type,os=ge,Jo=function(h,f,m){m===void 0&&(m=.5);for(var _=[],S=arguments.length-3;S-- >0;)_[S]=arguments[S+3];var T=_[0]||"lrgb";if(!os[T]&&!_.length&&(T=Object.keys(os)[0]),!os[T])throw new Error("interpolation mode "+T+" is not defined");return Zo(h)!=="object"&&(h=new Ko(h)),Zo(f)!=="object"&&(f=new Ko(f)),os[T](h,f,m).alpha(h.alpha()+m*(f.alpha()-h.alpha()))},Qo=R,Zd=Jo;Qo.prototype.mix=Qo.prototype.interpolate=function(h,f){f===void 0&&(f=.5);for(var m=[],_=arguments.length-2;_-- >0;)m[_]=arguments[_+2];return Zd.apply(void 0,[this,h,f].concat(m))};var tl=R;tl.prototype.premultiply=function(h){h===void 0&&(h=!1);var f=this._rgb,m=f[3];return h?(this._rgb=[f[0]*m,f[1]*m,f[2]*m,m],this):new tl([f[0]*m,f[1]*m,f[2]*m,m],"rgb")};var Tr=R,Jd=ns;Tr.prototype.saturate=function(h){h===void 0&&(h=1);var f=this,m=f.lch();return m[1]+=Jd.Kn*h,m[1]<0&&(m[1]=0),new Tr(m,"lch").alpha(f.alpha(),!0)},Tr.prototype.desaturate=function(h){return h===void 0&&(h=1),this.saturate(-h)};var el=R,nl=p.type;el.prototype.set=function(h,f,m){m===void 0&&(m=!1);var _=h.split("."),S=_[0],T=_[1],k=this[S]();if(T){var D=S.indexOf(T)-(S.substr(0,2)==="ok"?2:0);if(D>-1){if(nl(f)=="string")switch(f.charAt(0)){case"+":k[D]+=+f;break;case"-":k[D]+=+f;break;case"*":k[D]*=+f.substr(1);break;case"/":k[D]/=+f.substr(1);break;default:k[D]=+f}else if(nl(f)==="number")k[D]=f;else throw new Error("unsupported value for Color.set");var L=new el(k,S);return m?(this._rgb=L._rgb,this):L}throw new Error("unknown channel "+T+" in mode "+S)}else return k};var Qd=R,tp=function(h,f,m){var _=h._rgb,S=f._rgb;return new Qd(_[0]+m*(S[0]-_[0]),_[1]+m*(S[1]-_[1]),_[2]+m*(S[2]-_[2]),"rgb")};ge.rgb=tp;var ep=R,Pr=Math.sqrt,Nn=Math.pow,np=function(h,f,m){var _=h._rgb,S=_[0],T=_[1],k=_[2],D=f._rgb,L=D[0],I=D[1],j=D[2];return new ep(Pr(Nn(S,2)*(1-m)+Nn(L,2)*m),Pr(Nn(T,2)*(1-m)+Nn(I,2)*m),Pr(Nn(k,2)*(1-m)+Nn(j,2)*m),"rgb")};ge.lrgb=np;var ip=R,sp=function(h,f,m){var _=h.lab(),S=f.lab();return new ip(_[0]+m*(S[0]-_[0]),_[1]+m*(S[1]-_[1]),_[2]+m*(S[2]-_[2]),"lab")};ge.lab=sp;var il=R,Hn=function(h,f,m,_){var S,T,k,D;_==="hsl"?(k=h.hsl(),D=f.hsl()):_==="hsv"?(k=h.hsv(),D=f.hsv()):_==="hcg"?(k=h.hcg(),D=f.hcg()):_==="hsi"?(k=h.hsi(),D=f.hsi()):_==="lch"||_==="hcl"?(_="hcl",k=h.hcl(),D=f.hcl()):_==="oklch"&&(k=h.oklch().reverse(),D=f.oklch().reverse());var L,I,j,G,H,Q;(_.substr(0,1)==="h"||_==="oklch")&&(S=k,L=S[0],j=S[1],H=S[2],T=D,I=T[0],G=T[1],Q=T[2]);var K,lt,ut,mt;return!isNaN(L)&&!isNaN(I)?(I>L&&I-L>180?mt=I-(L+360):I<L&&L-I>180?mt=I+360-L:mt=I-L,lt=L+m*mt):isNaN(L)?isNaN(I)?lt=Number.NaN:(lt=I,(H==1||H==0)&&_!="hsv"&&(K=G)):(lt=L,(Q==1||Q==0)&&_!="hsv"&&(K=j)),K===void 0&&(K=j+m*(G-j)),ut=H+m*(Q-H),_==="oklch"?new il([ut,K,lt],_):new il([lt,K,ut],_)},rp=Hn,sl=function(h,f,m){return rp(h,f,m,"lch")};ge.lch=sl,ge.hcl=sl;var ap=R,op=function(h,f,m){var _=h.num(),S=f.num();return new ap(_+m*(S-_),"num")};ge.num=op;var lp=Hn,cp=function(h,f,m){return lp(h,f,m,"hcg")};ge.hcg=cp;var hp=Hn,up=function(h,f,m){return hp(h,f,m,"hsi")};ge.hsi=up;var fp=Hn,dp=function(h,f,m){return fp(h,f,m,"hsl")};ge.hsl=dp;var pp=Hn,gp=function(h,f,m){return pp(h,f,m,"hsv")};ge.hsv=gp;var mp=R,bp=function(h,f,m){var _=h.oklab(),S=f.oklab();return new mp(_[0]+m*(S[0]-_[0]),_[1]+m*(S[1]-_[1]),_[2]+m*(S[2]-_[2]),"oklab")};ge.oklab=bp;var vp=Hn,_p=function(h,f,m){return vp(h,f,m,"oklch")};ge.oklch=_p;var Er=R,yp=p.clip_rgb,Or=Math.pow,Dr=Math.sqrt,Ar=Math.PI,rl=Math.cos,al=Math.sin,xp=Math.atan2,kp=function(h,f,m){f===void 0&&(f="lrgb"),m===void 0&&(m=null);var _=h.length;m||(m=Array.from(new Array(_)).map(function(){return 1}));var S=_/m.reduce(function(lt,ut){return lt+ut});if(m.forEach(function(lt,ut){m[ut]*=S}),h=h.map(function(lt){return new Er(lt)}),f==="lrgb")return wp(h,m);for(var T=h.shift(),k=T.get(f),D=[],L=0,I=0,j=0;j<k.length;j++)if(k[j]=(k[j]||0)*m[0],D.push(isNaN(k[j])?0:m[0]),f.charAt(j)==="h"&&!isNaN(k[j])){var G=k[j]/180*Ar;L+=rl(G)*m[0],I+=al(G)*m[0]}var H=T.alpha()*m[0];h.forEach(function(lt,ut){var mt=lt.get(f);H+=lt.alpha()*m[ut+1];for(var xt=0;xt<k.length;xt++)if(!isNaN(mt[xt]))if(D[xt]+=m[ut+1],f.charAt(xt)==="h"){var te=mt[xt]/180*Ar;L+=rl(te)*m[ut+1],I+=al(te)*m[ut+1]}else k[xt]+=mt[xt]*m[ut+1]});for(var Q=0;Q<k.length;Q++)if(f.charAt(Q)==="h"){for(var K=xp(I/D[Q],L/D[Q])/Ar*180;K<0;)K+=360;for(;K>=360;)K-=360;k[Q]=K}else k[Q]=k[Q]/D[Q];return H/=_,new Er(k,f).alpha(H>.99999?1:H,!0)},wp=function(h,f){for(var m=h.length,_=[0,0,0,0],S=0;S<h.length;S++){var T=h[S],k=f[S]/m,D=T._rgb;_[0]+=Or(D[0],2)*k,_[1]+=Or(D[1],2)*k,_[2]+=Or(D[2],2)*k,_[3]+=D[3]*k}return _[0]=Dr(_[0]),_[1]=Dr(_[1]),_[2]=Dr(_[2]),_[3]>.9999999&&(_[3]=1),new Er(yp(_))},Se=z,Vn=p.type,Sp=Math.pow,Lr=function(h){var f="rgb",m=Se("#ccc"),_=0,S=[0,1],T=[],k=[0,0],D=!1,L=[],I=!1,j=0,G=1,H=!1,Q={},K=!0,lt=1,ut=function(V){if(V=V||["#fff","#000"],V&&Vn(V)==="string"&&Se.brewer&&Se.brewer[V.toLowerCase()]&&(V=Se.brewer[V.toLowerCase()]),Vn(V)==="array"){V.length===1&&(V=[V[0],V[0]]),V=V.slice(0);for(var it=0;it<V.length;it++)V[it]=Se(V[it]);T.length=0;for(var ht=0;ht<V.length;ht++)T.push(ht/(V.length-1))}return ce(),L=V},mt=function(V){if(D!=null){for(var it=D.length-1,ht=0;ht<it&&V>=D[ht];)ht++;return ht-1}return 0},xt=function(V){return V},te=function(V){return V},Jt=function(V,it){var ht,ct;if(it==null&&(it=!1),isNaN(V)||V===null)return m;if(it)ct=V;else if(D&&D.length>2){var ee=mt(V);ct=ee/(D.length-2)}else G!==j?ct=(V-j)/(G-j):ct=1;ct=te(ct),it||(ct=xt(ct)),lt!==1&&(ct=Sp(ct,lt)),ct=k[0]+ct*(1-k[0]-k[1]),ct=Math.min(1,Math.max(0,ct));var Rt=Math.floor(ct*1e4);if(K&&Q[Rt])ht=Q[Rt];else{if(Vn(L)==="array")for(var bt=0;bt<T.length;bt++){var wt=T[bt];if(ct<=wt){ht=L[bt];break}if(ct>=wt&&bt===T.length-1){ht=L[bt];break}if(ct>wt&&ct<T[bt+1]){ct=(ct-wt)/(T[bt+1]-wt),ht=Se.interpolate(L[bt],L[bt+1],ct,f);break}}else Vn(L)==="function"&&(ht=L(ct));K&&(Q[Rt]=ht)}return ht},ce=function(){return Q={}};ut(h);var gt=function(V){var it=Se(Jt(V));return I&&it[I]?it[I]():it};return gt.classes=function(V){if(V!=null){if(Vn(V)==="array")D=V,S=[V[0],V[V.length-1]];else{var it=Se.analyze(S);V===0?D=[it.min,it.max]:D=Se.limits(it,"e",V)}return gt}return D},gt.domain=function(V){if(!arguments.length)return S;j=V[0],G=V[V.length-1],T=[];var it=L.length;if(V.length===it&&j!==G)for(var ht=0,ct=Array.from(V);ht<ct.length;ht+=1){var ee=ct[ht];T.push((ee-j)/(G-j))}else{for(var Rt=0;Rt<it;Rt++)T.push(Rt/(it-1));if(V.length>2){var bt=V.map(function(St,Pt){return Pt/(V.length-1)}),wt=V.map(function(St){return(St-j)/(G-j)});wt.every(function(St,Pt){return bt[Pt]===St})||(te=function(St){if(St<=0||St>=1)return St;for(var Pt=0;St>=wt[Pt+1];)Pt++;var Ce=(St-wt[Pt])/(wt[Pt+1]-wt[Pt]),an=bt[Pt]+Ce*(bt[Pt+1]-bt[Pt]);return an})}}return S=[j,G],gt},gt.mode=function(V){return arguments.length?(f=V,ce(),gt):f},gt.range=function(V,it){return ut(V),gt},gt.out=function(V){return I=V,gt},gt.spread=function(V){return arguments.length?(_=V,gt):_},gt.correctLightness=function(V){return V==null&&(V=!0),H=V,ce(),H?xt=function(it){for(var ht=Jt(0,!0).lab()[0],ct=Jt(1,!0).lab()[0],ee=ht>ct,Rt=Jt(it,!0).lab()[0],bt=ht+(ct-ht)*it,wt=Rt-bt,St=0,Pt=1,Ce=20;Math.abs(wt)>.01&&Ce-- >0;)(function(){return ee&&(wt*=-1),wt<0?(St=it,it+=(Pt-it)*.5):(Pt=it,it+=(St-it)*.5),Rt=Jt(it,!0).lab()[0],wt=Rt-bt})();return it}:xt=function(it){return it},gt},gt.padding=function(V){return V!=null?(Vn(V)==="number"&&(V=[V,V]),k=V,gt):k},gt.colors=function(V,it){arguments.length<2&&(it="hex");var ht=[];if(arguments.length===0)ht=L.slice(0);else if(V===1)ht=[gt(.5)];else if(V>1){var ct=S[0],ee=S[1]-ct;ht=Mp(0,V,!1).map(function(Pt){return gt(ct+Pt/(V-1)*ee)})}else{h=[];var Rt=[];if(D&&D.length>2)for(var bt=1,wt=D.length,St=1<=wt;St?bt<wt:bt>wt;St?bt++:bt--)Rt.push((D[bt-1]+D[bt])*.5);else Rt=S;ht=Rt.map(function(Pt){return gt(Pt)})}return Se[it]&&(ht=ht.map(function(Pt){return Pt[it]()})),ht},gt.cache=function(V){return V!=null?(K=V,gt):K},gt.gamma=function(V){return V!=null?(lt=V,gt):lt},gt.nodata=function(V){return V!=null?(m=Se(V),gt):m},gt};function Mp(h,f,m){for(var _=[],S=h<f,T=m?S?f+1:f-1:f,k=h;S?k<T:k>T;S?k++:k--)_.push(k);return _}var hi=R,Cp=Lr,Tp=function(h){for(var f=[1,1],m=1;m<h;m++){for(var _=[1],S=1;S<=f.length;S++)_[S]=(f[S]||0)+f[S-1];f=_}return f},Pp=function(h){var f,m,_,S,T,k,D;if(h=h.map(function(H){return new hi(H)}),h.length===2)f=h.map(function(H){return H.lab()}),T=f[0],k=f[1],S=function(H){var Q=[0,1,2].map(function(K){return T[K]+H*(k[K]-T[K])});return new hi(Q,"lab")};else if(h.length===3)m=h.map(function(H){return H.lab()}),T=m[0],k=m[1],D=m[2],S=function(H){var Q=[0,1,2].map(function(K){return(1-H)*(1-H)*T[K]+2*(1-H)*H*k[K]+H*H*D[K]});return new hi(Q,"lab")};else if(h.length===4){var L;_=h.map(function(H){return H.lab()}),T=_[0],k=_[1],D=_[2],L=_[3],S=function(H){var Q=[0,1,2].map(function(K){return(1-H)*(1-H)*(1-H)*T[K]+3*(1-H)*(1-H)*H*k[K]+3*(1-H)*H*H*D[K]+H*H*H*L[K]});return new hi(Q,"lab")}}else if(h.length>=5){var I,j,G;I=h.map(function(H){return H.lab()}),G=h.length-1,j=Tp(G),S=function(H){var Q=1-H,K=[0,1,2].map(function(lt){return I.reduce(function(ut,mt,xt){return ut+j[xt]*Math.pow(Q,G-xt)*Math.pow(H,xt)*mt[lt]},0)});return new hi(K,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return S},Ep=function(h){var f=Pp(h);return f.scale=function(){return Cp(f)},f},Rr=z,Me=function(h,f,m){if(!Me[m])throw new Error("unknown blend mode "+m);return Me[m](h,f)},sn=function(h){return function(f,m){var _=Rr(m).rgb(),S=Rr(f).rgb();return Rr.rgb(h(_,S))}},rn=function(h){return function(f,m){var _=[];return _[0]=h(f[0],m[0]),_[1]=h(f[1],m[1]),_[2]=h(f[2],m[2]),_}},Op=function(h){return h},Dp=function(h,f){return h*f/255},Ap=function(h,f){return h>f?f:h},Lp=function(h,f){return h>f?h:f},Rp=function(h,f){return 255*(1-(1-h/255)*(1-f/255))},Fp=function(h,f){return f<128?2*h*f/255:255*(1-2*(1-h/255)*(1-f/255))},$p=function(h,f){return 255*(1-(1-f/255)/(h/255))},Ip=function(h,f){return h===255?255:(h=255*(f/255)/(1-h/255),h>255?255:h)};Me.normal=sn(rn(Op)),Me.multiply=sn(rn(Dp)),Me.screen=sn(rn(Rp)),Me.overlay=sn(rn(Fp)),Me.darken=sn(rn(Ap)),Me.lighten=sn(rn(Lp)),Me.dodge=sn(rn(Ip)),Me.burn=sn(rn($p));for(var zp=Me,Fr=p.type,Bp=p.clip_rgb,jp=p.TWOPI,Np=Math.pow,Hp=Math.sin,Vp=Math.cos,ol=z,Wp=function(h,f,m,_,S){h===void 0&&(h=300),f===void 0&&(f=-1.5),m===void 0&&(m=1),_===void 0&&(_=1),S===void 0&&(S=[0,1]);var T=0,k;Fr(S)==="array"?k=S[1]-S[0]:(k=0,S=[S,S]);var D=function(L){var I=jp*((h+120)/360+f*L),j=Np(S[0]+k*L,_),G=T!==0?m[0]+L*T:m,H=G*j*(1-j)/2,Q=Vp(I),K=Hp(I),lt=j+H*(-.14861*Q+1.78277*K),ut=j+H*(-.29227*Q-.90649*K),mt=j+H*(1.97294*Q);return ol(Bp([lt*255,ut*255,mt*255,1]))};return D.start=function(L){return L==null?h:(h=L,D)},D.rotations=function(L){return L==null?f:(f=L,D)},D.gamma=function(L){return L==null?_:(_=L,D)},D.hue=function(L){return L==null?m:(m=L,Fr(m)==="array"?(T=m[1]-m[0],T===0&&(m=m[1])):T=0,D)},D.lightness=function(L){return L==null?S:(Fr(L)==="array"?(S=L,k=L[1]-L[0]):(S=[L,L],k=0),D)},D.scale=function(){return ol.scale(D)},D.hue(m),D},Yp=R,qp="0123456789abcdef",Gp=Math.floor,Xp=Math.random,Up=function(){for(var h="#",f=0;f<6;f++)h+=qp.charAt(Gp(Xp()*16));return new Yp(h,"hex")},$r=o,ll=Math.log,Kp=Math.pow,Zp=Math.floor,Jp=Math.abs,cl=function(h,f){f===void 0&&(f=null);var m={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return $r(h)==="object"&&(h=Object.values(h)),h.forEach(function(_){f&&$r(_)==="object"&&(_=_[f]),_!=null&&!isNaN(_)&&(m.values.push(_),m.sum+=_,_<m.min&&(m.min=_),_>m.max&&(m.max=_),m.count+=1)}),m.domain=[m.min,m.max],m.limits=function(_,S){return hl(m,_,S)},m},hl=function(h,f,m){f===void 0&&(f="equal"),m===void 0&&(m=7),$r(h)=="array"&&(h=cl(h));var _=h.min,S=h.max,T=h.values.sort(function(zr,Br){return zr-Br});if(m===1)return[_,S];var k=[];if(f.substr(0,1)==="c"&&(k.push(_),k.push(S)),f.substr(0,1)==="e"){k.push(_);for(var D=1;D<m;D++)k.push(_+D/m*(S-_));k.push(S)}else if(f.substr(0,1)==="l"){if(_<=0)throw new Error("Logarithmic scales are only possible for values > 0");var L=Math.LOG10E*ll(_),I=Math.LOG10E*ll(S);k.push(_);for(var j=1;j<m;j++)k.push(Kp(10,L+j/m*(I-L)));k.push(S)}else if(f.substr(0,1)==="q"){k.push(_);for(var G=1;G<m;G++){var H=(T.length-1)*G/m,Q=Zp(H);if(Q===H)k.push(T[Q]);else{var K=H-Q;k.push(T[Q]*(1-K)+T[Q+1]*K)}}k.push(S)}else if(f.substr(0,1)==="k"){var lt,ut=T.length,mt=new Array(ut),xt=new Array(m),te=!0,Jt=0,ce=null;ce=[],ce.push(_);for(var gt=1;gt<m;gt++)ce.push(_+gt/m*(S-_));for(ce.push(S);te;){for(var V=0;V<m;V++)xt[V]=0;for(var it=0;it<ut;it++)for(var ht=T[it],ct=Number.MAX_VALUE,ee=void 0,Rt=0;Rt<m;Rt++){var bt=Jp(ce[Rt]-ht);bt<ct&&(ct=bt,ee=Rt),xt[ee]++,mt[it]=ee}for(var wt=new Array(m),St=0;St<m;St++)wt[St]=null;for(var Pt=0;Pt<ut;Pt++)lt=mt[Pt],wt[lt]===null?wt[lt]=T[Pt]:wt[lt]+=T[Pt];for(var Ce=0;Ce<m;Ce++)wt[Ce]*=1/xt[Ce];te=!1;for(var an=0;an<m;an++)if(wt[an]!==ce[an]){te=!0;break}ce=wt,Jt++,Jt>200&&(te=!1)}for(var on={},Wn=0;Wn<m;Wn++)on[Wn]=[];for(var Yn=0;Yn<ut;Yn++)lt=mt[Yn],on[lt].push(T[Yn]);for(var Ve=[],Mn=0;Mn<m;Mn++)Ve.push(on[Mn][0]),Ve.push(on[Mn][on[Mn].length-1]);Ve=Ve.sort(function(zr,Br){return zr-Br}),k.push(Ve[0]);for(var ui=1;ui<Ve.length;ui+=2){var Cn=Ve[ui];!isNaN(Cn)&&k.indexOf(Cn)===-1&&k.push(Cn)}}return k},ul={analyze:cl,limits:hl},fl=R,Qp=function(h,f){h=new fl(h),f=new fl(f);var m=h.luminance(),_=f.luminance();return m>_?(m+.05)/(_+.05):(_+.05)/(m+.05)},dl=R,He=Math.sqrt,Yt=Math.pow,tg=Math.min,eg=Math.max,pl=Math.atan2,gl=Math.abs,ls=Math.cos,ml=Math.sin,ng=Math.exp,bl=Math.PI,ig=function(h,f,m,_,S){m===void 0&&(m=1),_===void 0&&(_=1),S===void 0&&(S=1);var T=function(Cn){return 360*Cn/(2*bl)},k=function(Cn){return 2*bl*Cn/360};h=new dl(h),f=new dl(f);var D=Array.from(h.lab()),L=D[0],I=D[1],j=D[2],G=Array.from(f.lab()),H=G[0],Q=G[1],K=G[2],lt=(L+H)/2,ut=He(Yt(I,2)+Yt(j,2)),mt=He(Yt(Q,2)+Yt(K,2)),xt=(ut+mt)/2,te=.5*(1-He(Yt(xt,7)/(Yt(xt,7)+Yt(25,7)))),Jt=I*(1+te),ce=Q*(1+te),gt=He(Yt(Jt,2)+Yt(j,2)),V=He(Yt(ce,2)+Yt(K,2)),it=(gt+V)/2,ht=T(pl(j,Jt)),ct=T(pl(K,ce)),ee=ht>=0?ht:ht+360,Rt=ct>=0?ct:ct+360,bt=gl(ee-Rt)>180?(ee+Rt+360)/2:(ee+Rt)/2,wt=1-.17*ls(k(bt-30))+.24*ls(k(2*bt))+.32*ls(k(3*bt+6))-.2*ls(k(4*bt-63)),St=Rt-ee;St=gl(St)<=180?St:Rt<=ee?St+360:St-360,St=2*He(gt*V)*ml(k(St)/2);var Pt=H-L,Ce=V-gt,an=1+.015*Yt(lt-50,2)/He(20+Yt(lt-50,2)),on=1+.045*it,Wn=1+.015*it*wt,Yn=30*ng(-Yt((bt-275)/25,2)),Ve=2*He(Yt(it,7)/(Yt(it,7)+Yt(25,7))),Mn=-Ve*ml(2*k(Yn)),ui=He(Yt(Pt/(m*an),2)+Yt(Ce/(_*on),2)+Yt(St/(S*Wn),2)+Mn*(Ce/(_*on))*(St/(S*Wn)));return eg(0,tg(100,ui))},vl=R,sg=function(h,f,m){m===void 0&&(m="lab"),h=new vl(h),f=new vl(f);var _=h.get(m),S=f.get(m),T=0;for(var k in _){var D=(_[k]||0)-(S[k]||0);T+=D*D}return Math.sqrt(T)},rg=R,ag=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];try{return new(Function.prototype.bind.apply(rg,[null].concat(h))),!0}catch(m){return!1}},_l=z,yl=Lr,og={cool:function(){return yl([_l.hsl(180,1,.9),_l.hsl(250,.7,.4)])},hot:function(){return yl(["#000","#f00","#ff0","#fff"]).mode("rgb")}},cs={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Ir=0,xl=Object.keys(cs);Ir<xl.length;Ir+=1){var kl=xl[Ir];cs[kl.toLowerCase()]=cs[kl]}var lg=cs,Zt=z;Zt.average=kp,Zt.bezier=Ep,Zt.blend=zp,Zt.cubehelix=Wp,Zt.mix=Zt.interpolate=Jo,Zt.random=Up,Zt.scale=Lr,Zt.analyze=ul.analyze,Zt.contrast=Qp,Zt.deltaE=ig,Zt.distance=sg,Zt.limits=ul.limits,Zt.valid=ag,Zt.scales=og,Zt.colors=Ro,Zt.brewer=lg;var cg=Zt;return cg})});var Vh=jr((Gs,Hh)=>{(function(n,t){typeof Gs=="object"&&typeof Hh!="undefined"?t(Gs):typeof define=="function"&&define.amd?define("@ts-stack/markdown",["exports"],t):(n=typeof globalThis!="undefined"?globalThis:n||self,t((n["ts-stack"]=n["ts-stack"]||{},n["ts-stack"].markdown={})))})(Gs,function(n){"use strict";var t=function(){function w(v,y){y===void 0&&(y=""),this.source=v.source,this.flags=y}return w.prototype.setGroup=function(v,y){var A=typeof y=="string"?y:y.source;return A=A.replace(/(^|[^\[])\^/g,"$1"),this.source=this.source.replace(v,A),this},w.prototype.getRegexp=function(){return new RegExp(this.source,this.flags)},w}();var e=/[&<>"']/,i=/[&<>"']/g,s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},r=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g;function o(w,v){if(v){if(e.test(w))return w.replace(i,function(y){return s[y]})}else if(r.test(w))return w.replace(a,function(y){return s[y]});return w}function l(w){return w.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(v,y){return y=y.toLowerCase(),y==="colon"?":":y.charAt(0)==="#"?y.charAt(1)==="x"?String.fromCharCode(parseInt(y.substring(2),16)):String.fromCharCode(+y.substring(1)):""})}n.TokenType=void 0,function(w){w[w.space=1]="space",w[w.text=2]="text",w[w.paragraph=3]="paragraph",w[w.heading=4]="heading",w[w.listStart=5]="listStart",w[w.listEnd=6]="listEnd",w[w.looseItemStart=7]="looseItemStart",w[w.looseItemEnd=8]="looseItemEnd",w[w.listItemStart=9]="listItemStart",w[w.listItemEnd=10]="listItemEnd",w[w.blockquoteStart=11]="blockquoteStart",w[w.blockquoteEnd=12]="blockquoteEnd",w[w.code=13]="code",w[w.table=14]="table",w[w.html=15]="html",w[w.hr=16]="hr"}(n.TokenType||(n.TokenType={}));var c=function(){function w(){this.gfm=!0,this.tables=!0,this.breaks=!1,this.pedantic=!1,this.sanitize=!1,this.mangle=!0,this.smartLists=!1,this.silent=!1,this.langPrefix="lang-",this.smartypants=!1,this.headerPrefix="",this.xhtml=!1,this.escape=o,this.unescape=l}return w}();var u=function(w,v){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,A){y.__proto__=A}||function(y,A){for(var E in A)Object.prototype.hasOwnProperty.call(A,E)&&(y[E]=A[E])},u(w,v)};function d(w,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");u(w,v);function y(){this.constructor=w}w.prototype=v===null?Object.create(v):(y.prototype=v.prototype,new y)}var g=function(){return g=Object.assign||function(v){for(var y,A=1,E=arguments.length;A<E;A++){y=arguments[A];for(var O in y)Object.prototype.hasOwnProperty.call(y,O)&&(v[O]=y[O])}return v},g.apply(this,arguments)};function p(w,v){var y={};for(var A in w)Object.prototype.hasOwnProperty.call(w,A)&&v.indexOf(A)<0&&(y[A]=w[A]);if(w!=null&&typeof Object.getOwnPropertySymbols=="function")for(var E=0,A=Object.getOwnPropertySymbols(w);E<A.length;E++)v.indexOf(A[E])<0&&Object.prototype.propertyIsEnumerable.call(w,A[E])&&(y[A[E]]=w[A[E]]);return y}function b(w,v,y,A){var E=arguments.length,O=E<3?v:A===null?A=Object.getOwnPropertyDescriptor(v,y):A,Z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(w,v,y,A);else for(var W=w.length-1;W>=0;W--)(Z=w[W])&&(O=(E<3?Z(O):E>3?Z(v,y,O):Z(v,y))||O);return E>3&&O&&Object.defineProperty(v,y,O),O}function x(w,v){return function(y,A){v(y,A,w)}}function M(w,v){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(w,v)}function C(w,v,y,A){function E(O){return O instanceof y?O:new y(function(Z){Z(O)})}return new(y||(y=Promise))(function(O,Z){function W(_t){try{tt(A.next(_t))}catch(zt){Z(zt)}}function J(_t){try{tt(A.throw(_t))}catch(zt){Z(zt)}}function tt(_t){_t.done?O(_t.value):E(_t.value).then(W,J)}tt((A=A.apply(w,v||[])).next())})}function P(w,v){var y={label:0,sent:function(){if(O[0]&1)throw O[1];return O[1]},trys:[],ops:[]},A,E,O,Z;return Z={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(Z[Symbol.iterator]=function(){return this}),Z;function W(tt){return function(_t){return J([tt,_t])}}function J(tt){if(A)throw new TypeError("Generator is already executing.");for(;y;)try{if(A=1,E&&(O=tt[0]&2?E.return:tt[0]?E.throw||((O=E.return)&&O.call(E),0):E.next)&&!(O=O.call(E,tt[1])).done)return O;switch(E=0,O&&(tt=[tt[0]&2,O.value]),tt[0]){case 0:case 1:O=tt;break;case 4:return y.label++,{value:tt[1],done:!1};case 5:y.label++,E=tt[1],tt=[0];continue;case 7:tt=y.ops.pop(),y.trys.pop();continue;default:if(O=y.trys,!(O=O.length>0&&O[O.length-1])&&(tt[0]===6||tt[0]===2)){y=0;continue}if(tt[0]===3&&(!O||tt[1]>O[0]&&tt[1]<O[3])){y.label=tt[1];break}if(tt[0]===6&&y.label<O[1]){y.label=O[1],O=tt;break}if(O&&y.label<O[2]){y.label=O[2],y.ops.push(tt);break}O[2]&&y.ops.pop(),y.trys.pop();continue}tt=v.call(w,y)}catch(_t){tt=[6,_t],E=0}finally{A=O=0}if(tt[0]&5)throw tt[1];return{value:tt[0]?tt[1]:void 0,done:!0}}}var $=Object.create?function(w,v,y,A){A===void 0&&(A=y),Object.defineProperty(w,A,{enumerable:!0,get:function(){return v[y]}})}:function(w,v,y,A){A===void 0&&(A=y),w[A]=v[y]};function R(w,v){for(var y in w)y!=="default"&&!Object.prototype.hasOwnProperty.call(v,y)&&$(v,w,y)}function F(w){var v=typeof Symbol=="function"&&Symbol.iterator,y=v&&w[v],A=0;if(y)return y.call(w);if(w&&typeof w.length=="number")return{next:function(){return w&&A>=w.length&&(w=void 0),{value:w&&w[A++],done:!w}}};throw new TypeError(v?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(w,v){var y=typeof Symbol=="function"&&w[Symbol.iterator];if(!y)return w;var A=y.call(w),E,O=[],Z;try{for(;(v===void 0||v-- >0)&&!(E=A.next()).done;)O.push(E.value)}catch(W){Z={error:W}}finally{try{E&&!E.done&&(y=A.return)&&y.call(A)}finally{if(Z)throw Z.error}}return O}function N(){for(var w=[],v=0;v<arguments.length;v++)w=w.concat(z(arguments[v]));return w}function X(){for(var w=0,v=0,y=arguments.length;v<y;v++)w+=arguments[v].length;for(var A=Array(w),E=0,v=0;v<y;v++)for(var O=arguments[v],Z=0,W=O.length;Z<W;Z++,E++)A[E]=O[Z];return A}function U(w,v){for(var y=0,A=v.length,E=w.length;y<A;y++,E++)w[E]=v[y];return w}function nt(w){return this instanceof nt?(this.v=w,this):new nt(w)}function ot(w,v,y){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var A=y.apply(w,v||[]),E,O=[];return E={},Z("next"),Z("throw"),Z("return"),E[Symbol.asyncIterator]=function(){return this},E;function Z(Tt){A[Tt]&&(E[Tt]=function(Nt){return new Promise(function(Ht,ae){O.push([Tt,Nt,Ht,ae])>1||W(Tt,Nt)})})}function W(Tt,Nt){try{J(A[Tt](Nt))}catch(Ht){zt(O[0][3],Ht)}}function J(Tt){Tt.value instanceof nt?Promise.resolve(Tt.value.v).then(tt,_t):zt(O[0][2],Tt)}function tt(Tt){W("next",Tt)}function _t(Tt){W("throw",Tt)}function zt(Tt,Nt){Tt(Nt),O.shift(),O.length&&W(O[0][0],O[0][1])}}function st(w){var v,y;return v={},A("next"),A("throw",function(E){throw E}),A("return"),v[Symbol.iterator]=function(){return this},v;function A(E,O){v[E]=w[E]?function(Z){return(y=!y)?{value:nt(w[E](Z)),done:E==="return"}:O?O(Z):Z}:O}}function kt(w){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var v=w[Symbol.asyncIterator],y;return v?v.call(w):(w=typeof F=="function"?F(w):w[Symbol.iterator](),y={},A("next"),A("throw"),A("return"),y[Symbol.asyncIterator]=function(){return this},y);function A(O){y[O]=w[O]&&function(Z){return new Promise(function(W,J){Z=w[O](Z),E(W,J,Z.done,Z.value)})}}function E(O,Z,W,J){Promise.resolve(J).then(function(tt){O({value:tt,done:W})},Z)}}function Ft(w,v){return Object.defineProperty?Object.defineProperty(w,"raw",{value:v}):w.raw=v,w}var et=Object.create?function(w,v){Object.defineProperty(w,"default",{enumerable:!0,value:v})}:function(w,v){w.default=v};function Ct(w){if(w&&w.__esModule)return w;var v={};if(w!=null)for(var y in w)y!=="default"&&Object.prototype.hasOwnProperty.call(w,y)&&$(v,w,y);return et(v,w),v}function yt(w){return w&&w.__esModule?w:{default:w}}function Qt(w,v){if(!v.has(w))throw new TypeError("attempted to get private field on non-instance");return v.get(w)}function de(w,v,y){if(!v.has(w))throw new TypeError("attempted to set private field on non-instance");return v.set(w,y),y}var rt=function(){function w(v){this.options=v||Wt.options}return w.prototype.code=function(v,y,A,E){if(this.options.highlight){var O=this.options.highlight(v,y);O!=null&&O!==v&&(A=!0,v=O)}var Z=A?v:this.options.escape(v,!0);if(!y)return`
<pre><code>`+Z+`
</code></pre>
`;var W=this.options.langPrefix+this.options.escape(y,!0);return`
<pre><code class="`+W+'">'+Z+`
</code></pre>
`},w.prototype.blockquote=function(v){return`<blockquote>
`+v+`</blockquote>
`},w.prototype.html=function(v){return v},w.prototype.heading=function(v,y,A){var E=this.options.headerPrefix+A.toLowerCase().replace(/[^\w]+/g,"-");return"<h"+y+' id="'+E+'">'+v+"</h"+y+`>
`},w.prototype.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},w.prototype.list=function(v,y){var A=y?"ol":"ul";return`
<`+A+`>
`+v+"</"+A+`>
`},w.prototype.listitem=function(v){return"<li>"+v+`</li>
`},w.prototype.paragraph=function(v){return"<p>"+v+`</p>
`},w.prototype.table=function(v,y){return`
<table>
<thead>
`+v+`</thead>
<tbody>
`+y+`</tbody>
</table>
`},w.prototype.tablerow=function(v){return`<tr>
`+v+`</tr>
`},w.prototype.tablecell=function(v,y){var A=y.header?"th":"td",E=y.align?"<"+A+' style="text-align:'+y.align+'">':"<"+A+">";return E+v+"</"+A+`>
`},w.prototype.strong=function(v){return"<strong>"+v+"</strong>"},w.prototype.em=function(v){return"<em>"+v+"</em>"},w.prototype.codespan=function(v){return"<code>"+v+"</code>"},w.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},w.prototype.del=function(v){return"<del>"+v+"</del>"},w.prototype.link=function(v,y,A){if(this.options.sanitize){var E=void 0;try{E=decodeURIComponent(this.options.unescape(v)).replace(/[^\w:]/g,"").toLowerCase()}catch(Z){return A}if(E.indexOf("javascript:")===0||E.indexOf("vbscript:")===0||E.indexOf("data:")===0)return A}var O='<a href="'+v+'"';return y&&(O+=' title="'+y+'"'),O+=">"+A+"</a>",O},w.prototype.image=function(v,y,A){var E='<img src="'+v+'" alt="'+A+'"';return y&&(E+=' title="'+y+'"'),E+=this.options.xhtml?"/>":">",E},w.prototype.text=function(v){return v},w}();var Ot=function(){function w(v,y,A,E){if(A===void 0&&(A=Wt.options),this.staticThis=v,this.links=y,this.options=A,this.renderer=E||this.options.renderer||new rt(this.options),!this.links)throw new Error("InlineLexer requires 'links' parameter.");this.setRules()}return w.output=function(v,y,A){var E=new this(this,y,A);return E.output(v)},w.getRulesBase=function(){if(this.rulesBase)return this.rulesBase;var v={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ <>]+(@|:\/)[^ <>]+)>/,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^<'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)([\s\S]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};return v.link=new t(v.link).setGroup("inside",v._inside).setGroup("href",v._href).getRegexp(),v.reflink=new t(v.reflink).setGroup("inside",v._inside).getRegexp(),this.rulesBase=v},w.getRulesPedantic=function(){return this.rulesPedantic?this.rulesPedantic:this.rulesPedantic=Object.assign(Object.assign({},this.getRulesBase()),{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/})},w.getRulesGfm=function(){if(this.rulesGfm)return this.rulesGfm;var v=this.getRulesBase(),y=new t(v.escape).setGroup("])","~|])").getRegexp(),A=new t(v.text).setGroup("]|","~]|").setGroup("|","|https?://|").getRegexp();return this.rulesGfm=Object.assign(Object.assign({},v),{escape:y,url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:A})},w.getRulesBreaks=function(){if(this.rulesBreaks)return this.rulesBreaks;var v=this.getRulesGfm(),y=this.getRulesGfm();return this.rulesBreaks=Object.assign(Object.assign({},y),{br:new t(v.br).setGroup("{2,}","*").getRegexp(),text:new t(y.text).setGroup("{2,}","*").getRegexp()})},w.prototype.setRules=function(){this.options.gfm?this.options.breaks?this.rules=this.staticThis.getRulesBreaks():this.rules=this.staticThis.getRulesGfm():this.options.pedantic?this.rules=this.staticThis.getRulesPedantic():this.rules=this.staticThis.getRulesBase(),this.hasRulesGfm=this.rules.url!==void 0},w.prototype.output=function(v){v=v;for(var y,A="";v;){if(y=this.rules.escape.exec(v)){v=v.substring(y[0].length),A+=y[1];continue}if(y=this.rules.autolink.exec(v)){var E=void 0,O=void 0;v=v.substring(y[0].length),y[2]==="@"?(E=this.options.escape(y[1].charAt(6)===":"?this.mangle(y[1].substring(7)):this.mangle(y[1])),O=this.mangle("mailto:")+E):(E=this.options.escape(y[1]),O=E),A+=this.renderer.link(O,null,E);continue}if(!this.inLink&&this.hasRulesGfm&&(y=this.rules.url.exec(v))){var E=void 0,O=void 0;v=v.substring(y[0].length),E=this.options.escape(y[1]),O=E,A+=this.renderer.link(O,null,E);continue}if(y=this.rules.tag.exec(v)){!this.inLink&&/^<a /i.test(y[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(y[0])&&(this.inLink=!1),v=v.substring(y[0].length),A+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(y[0]):this.options.escape(y[0]):y[0];continue}if(y=this.rules.link.exec(v)){v=v.substring(y[0].length),this.inLink=!0,A+=this.outputLink(y,{href:y[2],title:y[3]}),this.inLink=!1;continue}if((y=this.rules.reflink.exec(v))||(y=this.rules.nolink.exec(v))){v=v.substring(y[0].length);var Z=(y[2]||y[1]).replace(/\s+/g," "),W=this.links[Z.toLowerCase()];if(!W||!W.href){A+=y[0].charAt(0),v=y[0].substring(1)+v;continue}this.inLink=!0,A+=this.outputLink(y,W),this.inLink=!1;continue}if(y=this.rules.strong.exec(v)){v=v.substring(y[0].length),A+=this.renderer.strong(this.output(y[2]||y[1]));continue}if(y=this.rules.em.exec(v)){v=v.substring(y[0].length),A+=this.renderer.em(this.output(y[2]||y[1]));continue}if(y=this.rules.code.exec(v)){v=v.substring(y[0].length),A+=this.renderer.codespan(this.options.escape(y[2].trim(),!0));continue}if(y=this.rules.br.exec(v)){v=v.substring(y[0].length),A+=this.renderer.br();continue}if(this.hasRulesGfm&&(y=this.rules.del.exec(v))){v=v.substring(y[0].length),A+=this.renderer.del(this.output(y[1]));continue}if(y=this.rules.text.exec(v)){v=v.substring(y[0].length),A+=this.renderer.text(this.options.escape(this.smartypants(y[0])));continue}if(v)throw new Error("Infinite loop on byte: "+v.charCodeAt(0))}return A},w.prototype.outputLink=function(v,y){var A=this.options.escape(y.href),E=y.title?this.options.escape(y.title):null;return v[0].charAt(0)!=="!"?this.renderer.link(A,E,this.output(v[1])):this.renderer.image(A,E,this.options.escape(v[1]))},w.prototype.smartypants=function(v){return this.options.smartypants?v.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026"):v},w.prototype.mangle=function(v){if(!this.options.mangle)return v;for(var y="",A=v.length,E=0;E<A;E++){var O=void 0;Math.random()>.5&&(O="x"+v.charCodeAt(E).toString(16)),y+="&#"+O+";"}return y},w}();Ot.rulesBase=null,Ot.rulesPedantic=null,Ot.rulesGfm=null,Ot.rulesBreaks=null;var It=function(){function w(v){this.simpleRenderers=[],this.line=0,this.tokens=[],this.token=null,this.options=v||Wt.options,this.renderer=this.options.renderer||new rt(this.options)}return w.parse=function(v,y,A){var E=new this(A);return E.parse(y,v)},w.prototype.parse=function(v,y){this.inlineLexer=new Ot(Ot,v,this.options,this.renderer),this.tokens=y.reverse();for(var A="";this.next();)A+=this.tok();return A},w.prototype.debug=function(v,y){this.inlineLexer=new Ot(Ot,v,this.options,this.renderer),this.tokens=y.reverse();for(var A="";this.next();){var E=this.tok();this.token.line=this.line+=E.split(`
`).length-1,A+=E}return A},w.prototype.next=function(){return this.token=this.tokens.pop()},w.prototype.getNextElement=function(){return this.tokens[this.tokens.length-1]},w.prototype.parseText=function(){for(var v=this.token.text,y;(y=this.getNextElement())&&y.type==n.TokenType.text;)v+=`
`+this.next().text;return this.inlineLexer.output(v)},w.prototype.tok=function(){var v,y;switch(this.token.type){case n.TokenType.space:return"";case n.TokenType.paragraph:return this.renderer.paragraph(this.inlineLexer.output(this.token.text));case n.TokenType.text:return this.options.isNoP?this.parseText():this.renderer.paragraph(this.parseText());case n.TokenType.heading:return this.renderer.heading(this.inlineLexer.output(this.token.text),this.token.depth,this.token.text);case n.TokenType.listStart:{for(var A="",E=this.token.ordered;this.next().type!=n.TokenType.listEnd;)A+=this.tok();return this.renderer.list(A,E)}case n.TokenType.listItemStart:{for(var A="";this.next().type!=n.TokenType.listItemEnd;)A+=this.token.type==n.TokenType.text?this.parseText():this.tok();return this.renderer.listitem(A)}case n.TokenType.looseItemStart:{for(var A="";this.next().type!=n.TokenType.listItemEnd;)A+=this.tok();return this.renderer.listitem(A)}case n.TokenType.code:return this.renderer.code(this.token.text,this.token.lang,this.token.escaped,this.token.meta);case n.TokenType.table:{var O="",A="",Z=void 0;Z="";for(var W=0;W<this.token.header.length;W++){var J={header:!0,align:this.token.align[W]},tt=this.inlineLexer.output(this.token.header[W]);Z+=this.renderer.tablecell(tt,J)}O+=this.renderer.tablerow(Z);try{for(var _t=F(this.token.cells),zt=_t.next();!zt.done;zt=_t.next()){var Tt=zt.value;Z="";for(var Nt=0;Nt<Tt.length;Nt++)Z+=this.renderer.tablecell(this.inlineLexer.output(Tt[Nt]),{header:!1,align:this.token.align[Nt]});A+=this.renderer.tablerow(Z)}}catch(pe){v={error:pe}}finally{try{zt&&!zt.done&&(y=_t.return)&&y.call(_t)}finally{if(v)throw v.error}}return this.renderer.table(O,A)}case n.TokenType.blockquoteStart:{for(var A="";this.next().type!=n.TokenType.blockquoteEnd;)A+=this.tok();return this.renderer.blockquote(A)}case n.TokenType.hr:return this.renderer.hr();case n.TokenType.html:{var Ht=!this.token.pre&&!this.options.pedantic?this.inlineLexer.output(this.token.text):this.token.text;return this.renderer.html(Ht)}default:{if(this.simpleRenderers.length){for(var W=0;W<this.simpleRenderers.length;W++)if(this.token.type=="simpleRule"+(W+1))return this.simpleRenderers[W].call(this.renderer,this.token.execArr)}var ae='Token with "'+this.token.type+'" type was not found.';if(this.options.silent)console.log(ae);else throw new Error(ae)}}},w}();var Wt=function(){function w(){}return w.setOptions=function(v){return Object.assign(this.options,v),this},w.setBlockRule=function(v,y){return y===void 0&&(y=function(){return""}),Ut.simpleRules.push(v),this.simpleRenderers.push(y),this},w.parse=function(v,y){y===void 0&&(y=this.options);try{var A=this.callBlockLexer(v,y),E=A.tokens,O=A.links;return this.callParser(E,O,y)}catch(Z){return this.callMe(Z)}},w.debug=function(v,y){y===void 0&&(y=this.options);var A=this.callBlockLexer(v,y),E=A.tokens,O=A.links,Z=E.slice(),W=new It(y);W.simpleRenderers=this.simpleRenderers;var J=W.debug(O,E);return Z=Z.map(function(tt){tt.type=n.TokenType[tt.type]||tt.type;var _t=tt.line;return delete tt.line,_t?Object.assign({line:_t},tt):tt}),{tokens:Z,links:O,result:J}},w.callBlockLexer=function(v,y){if(v===void 0&&(v=""),typeof v!="string")throw new Error("Expected that the 'src' parameter would have a 'string' type, got '"+typeof v+"'");return v=v.replace(/\r\n|\r/g,`
`).replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,`
`).replace(/^ +$/gm,""),Ut.lex(v,y,!0)},w.callParser=function(v,y,A){if(this.simpleRenderers.length){var E=new It(A);return E.simpleRenderers=this.simpleRenderers,E.parse(y,v)}else return It.parse(v,y,A)},w.callMe=function(v){if(v.message+=`
Please report this to https://github.com/ts-stack/markdown`,this.options.silent)return"<p>An error occured:</p><pre>"+this.options.escape(v.message+"",!0)+"</pre>";throw v},w}();Wt.options=new c,Wt.simpleRenderers=[];var Ut=function(){function w(v,y){this.staticThis=v,this.links={},this.tokens=[],this.options=y||Wt.options,this.setRules()}return w.lex=function(v,y,A,E){var O=new this(this,y);return O.getTokens(v,A,E)},w.getRulesBase=function(){if(this.rulesBase)return this.rulesBase;var v={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};v.item=new t(v.item,"gm").setGroup(/bull/g,v.bullet).getRegexp(),v.list=new t(v.list).setGroup(/bull/g,v.bullet).setGroup("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))").setGroup("def","\\n+(?="+v.def.source+")").getRegexp();var y="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";return v.html=new t(v.html).setGroup("comment",/<!--[\s\S]*?-->/).setGroup("closed",/<(tag)[\s\S]+?<\/\1>/).setGroup("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/).setGroup(/tag/g,y).getRegexp(),v.paragraph=new t(v.paragraph).setGroup("hr",v.hr).setGroup("heading",v.heading).setGroup("lheading",v.lheading).setGroup("blockquote",v.blockquote).setGroup("tag","<"+y).setGroup("def",v.def).getRegexp(),this.rulesBase=v},w.getRulesGfm=function(){if(this.rulesGfm)return this.rulesGfm;var v=this.getRulesBase(),y=Object.assign(Object.assign({},v),{fences:/^ *(`{3,}|~{3,})[ \.]*((\S+)? *[^\n]*)\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),A=y.fences.source.replace("\\1","\\2"),E=v.list.source.replace("\\1","\\3");return y.paragraph=new t(v.paragraph).setGroup("(?!","(?!"+A+"|"+E+"|").getRegexp(),this.rulesGfm=y},w.getRulesTable=function(){return this.rulesTables?this.rulesTables:this.rulesTables=Object.assign(Object.assign({},this.getRulesGfm()),{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/})},w.prototype.setRules=function(){this.options.gfm?this.options.tables?this.rules=this.staticThis.getRulesTable():this.rules=this.staticThis.getRulesGfm():this.rules=this.staticThis.getRulesBase(),this.hasRulesGfm=this.rules.fences!==void 0,this.hasRulesTables=this.rules.table!==void 0},w.prototype.getTokens=function(v,y,A){var E=v,O;t:for(;E;){if((O=this.rules.newline.exec(E))&&(E=E.substring(O[0].length),O[0].length>1&&this.tokens.push({type:n.TokenType.space})),O=this.rules.code.exec(E)){E=E.substring(O[0].length);var Z=O[0].replace(/^ {4}/gm,"");this.tokens.push({type:n.TokenType.code,text:this.options.pedantic?Z:Z.replace(/\n+$/,"")});continue}if(this.hasRulesGfm&&(O=this.rules.fences.exec(E))){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.code,meta:O[2],lang:O[3],text:O[4]||""});continue}if(O=this.rules.heading.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.heading,depth:O[1].length,text:O[2]});continue}if(y&&this.hasRulesTables&&(O=this.rules.nptable.exec(E))){E=E.substring(O[0].length);for(var W={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},J=0;J<W.align.length;J++)/^ *-+: *$/.test(W.align[J])?W.align[J]="right":/^ *:-+: *$/.test(W.align[J])?W.align[J]="center":/^ *:-+ *$/.test(W.align[J])?W.align[J]="left":W.align[J]=null;for(var tt=O[3].replace(/\n$/,"").split(`
`),J=0;J<tt.length;J++)W.cells[J]=tt[J].split(/ *\| */);this.tokens.push(W);continue}if(O=this.rules.lheading.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.heading,depth:O[2]==="="?1:2,text:O[1]});continue}if(O=this.rules.hr.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.hr});continue}if(O=this.rules.blockquote.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.blockquoteStart});var _t=O[0].replace(/^ *> ?/gm,"");this.getTokens(_t),this.tokens.push({type:n.TokenType.blockquoteEnd});continue}if(O=this.rules.list.exec(E)){E=E.substring(O[0].length);var zt=O[2];this.tokens.push({type:n.TokenType.listStart,ordered:zt.length>1});for(var _t=O[0].match(this.rules.item),Tt=_t.length,Nt=!1,Ht=void 0,ae=void 0,_e=void 0,J=0;J<Tt;J++){var W=_t[J];Ht=W.length,W=W.replace(/^ *([*+-]|\d+\.) +/,""),W.indexOf(`
`)!==-1&&(Ht-=W.length,W=this.options.pedantic?W.replace(/^ {1,4}/gm,""):W.replace(new RegExp("^ {1,"+Ht+"}","gm"),"")),this.options.smartLists&&J!==Tt-1&&(ae=this.staticThis.getRulesBase().bullet.exec(_t[J+1])[0],zt!==ae&&!(zt.length>1&&ae.length>1)&&(E=_t.slice(J+1).join(`
`)+E,J=Tt-1)),_e=Nt||/\n\n(?!\s*$)/.test(W),J!==Tt-1&&(Nt=W.charAt(W.length-1)===`
`,_e||(_e=Nt)),this.tokens.push({type:_e?n.TokenType.looseItemStart:n.TokenType.listItemStart}),this.getTokens(W,!1,A),this.tokens.push({type:n.TokenType.listItemEnd})}this.tokens.push({type:n.TokenType.listEnd});continue}if(O=this.rules.html.exec(E)){E=E.substring(O[0].length);var pe=O[1],_n=pe==="pre"||pe==="script"||pe==="style";this.tokens.push({type:this.options.sanitize?n.TokenType.paragraph:n.TokenType.html,pre:!this.options.sanitizer&&_n,text:O[0]});continue}if(y&&(O=this.rules.def.exec(E))){E=E.substring(O[0].length),this.links[O[1].toLowerCase()]={href:O[2],title:O[3]};continue}if(y&&this.hasRulesTables&&(O=this.rules.table.exec(E))){E=E.substring(O[0].length);for(var W={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},J=0;J<W.align.length;J++)/^ *-+: *$/.test(W.align[J])?W.align[J]="right":/^ *:-+: *$/.test(W.align[J])?W.align[J]="center":/^ *:-+ *$/.test(W.align[J])?W.align[J]="left":W.align[J]=null;for(var tt=O[3].replace(/(?: *\| *)?\n$/,"").split(`
`),J=0;J<tt.length;J++)W.cells[J]=tt[J].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(W);continue}if(this.staticThis.simpleRules.length){for(var tn=this.staticThis.simpleRules,J=0;J<tn.length;J++)if(O=tn[J].exec(E)){E=E.substring(O[0].length);var yn="simpleRule"+(J+1);this.tokens.push({type:yn,execArr:O});continue t}}if(y&&(O=this.rules.paragraph.exec(E))){E=E.substring(O[0].length),O[1].slice(-1)===`
`?this.tokens.push({type:n.TokenType.paragraph,text:O[1].slice(0,-1)}):this.tokens.push({type:this.tokens.length>0?n.TokenType.paragraph:n.TokenType.text,text:O[1]});continue}if(O=this.rules.text.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.text,text:O[0]});continue}if(E)throw new Error("Infinite loop on byte: "+E.charCodeAt(0)+(", near text '"+E.slice(0,30)+"...'"))}return{tokens:this.tokens,links:this.links}},w}();Ut.simpleRules=[],Ut.rulesBase=null,Ut.rulesGfm=null,Ut.rulesTables=null,n.BlockLexer=Ut,n.ExtendRegexp=t,n.InlineLexer=Ot,n.Marked=Wt,n.MarkedOptions=c,n.Parser=It,n.Renderer=rt,n.escape=o,n.unescape=l,Object.defineProperty(n,"__esModule",{value:!0})})});var Wh=jr(ai=>{"use strict";var Av=ai&&ai.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var r in s)s.hasOwnProperty(r)&&(i[r]=s[r])},n(t,e)};return function(t,e){n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();Object.defineProperty(ai,"__esModule",{value:!0});ai.Extractor=void 0;var Ya=Vh(),Lv=function(n){Av(t,n);function t(e,i){var s=n.call(this)||this;return s.lowercaseKeys=i??!1,s.reset(e),s}return Object.defineProperty(t.prototype,"tables",{get:function(){return this.extractedTables},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"objects",{get:function(){var e=this;return this.extractedTables.map(function(i){return t.tableToObject(i,e.lowercaseKeys)})},enumerable:!1,configurable:!0}),t.prototype.reset=function(e){e===void 0&&(e="rows"),this.mode=e,this.currentRow=[],this.currentTable=[],this.extractedTables=[]},t.prototype.table=function(e,i){return this.extractedTables.push(this.mode==="rows"?this.currentTable:t.transposeTable(this.currentTable)),this.currentTable=[],n.prototype.table.call(this,e,i)},t.prototype.tablerow=function(e){return this.currentTable.push(this.currentRow),this.currentRow=[],n.prototype.tablerow.call(this,e)},t.prototype.tablecell=function(e,i){return this.currentRow.push(e),n.prototype.tablecell.call(this,e,i)},t.transposeTable=function(e){for(var i=[],s=e.length,r=e[0].length,a=0;a<r;a++){i.push([]);for(var o=0;o<s;o++)i[a].push(e[o][a])}return i},t.tableToObject=function(e,i){var s=e.shift().slice(1),r={};return e.forEach(function(a){var o=a.shift(),l={};a.forEach(function(c,u){l[i?s[u].toLowerCase():s[u]]=c}),r[i?o.toLowerCase():o]=l}),r},t.createExtractor=function(e,i,s){var r=new t(i,s);return Ya.Marked.setOptions({renderer:r}),Ya.Marked.parse(e),r},t.extractObject=function(e,i,s){var r=t.extractAllObjects(e,i,s);return r.length>0?r[0]:null},t.extractAllObjects=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects},t.extractTable=function(e,i,s){var r=t.extractAllTables(e,i,s);return r.length>0?r[0]:null},t.extractAllTables=function(e,i,s){var r=t.createExtractor(e,i,s);return r.tables},t.extract=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects.length>0?JSON.stringify(r.objects[0]):null},t.extractAll=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects.map(function(a){return JSON.stringify(a)})},t}(Ya.Renderer);ai.Extractor=Lv});bg(exports,{default:()=>co});var Oe=Ae(require("obsidian"));function Le(){}var Tl=function(){let n=0;return function(){return n++}}();function vt(n){return n===null||typeof n=="undefined"}function Dt(n){if(Array.isArray&&Array.isArray(n))return!0;let t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function ft(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}var jt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function me(n,t){return jt(n)?n:t}function at(n,t){return typeof n=="undefined"?t:n}var Pl=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/t,Nr=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function At(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function Mt(n,t,e,i){let s,r,a;if(Dt(n))if(r=n.length,i)for(s=r-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;s<r;s++)t.call(e,n[s],s);else if(ft(n))for(a=Object.keys(n),r=a.length,s=0;s<r;s++)t.call(e,n[a[s]],a[s])}function gi(n,t){let e,i,s,r;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],r=t[e],s.datasetIndex!==r.datasetIndex||s.index!==r.index)return!1;return!0}function hs(n){if(Dt(n))return n.map(hs);if(ft(n)){let t=Object.create(null),e=Object.keys(n),i=e.length,s=0;for(;s<i;++s)t[e[s]]=hs(n[e[s]]);return t}return n}function El(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function _g(n,t,e,i){if(!El(n))return;let s=t[n],r=e[n];ft(s)&&ft(r)?qn(s,r,i):t[n]=hs(r)}function qn(n,t,e){let i=Dt(t)?t:[t],s=i.length;if(!ft(n))return n;e=e||{};let r=e.merger||_g;for(let a=0;a<s;++a){if(t=i[a],!ft(t))continue;let o=Object.keys(t);for(let l=0,c=o.length;l<c;++l)r(o[l],n,t,e)}return n}function Gn(n,t){return qn(n,t,{merger:yg})}function yg(n,t,e){if(!El(n))return;let i=t[n],s=e[n];ft(i)&&ft(s)?Gn(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=hs(s))}var Ol={"":n=>n,x:n=>n.x,y:n=>n.y};function We(n,t){return(Ol[t]||(Ol[t]=xg(t)))(n)}function xg(n){let t=kg(n);return e=>{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function kg(n){let t=n.split("."),e=[],i="";for(let s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function us(n){return n.charAt(0).toUpperCase()+n.slice(1)}var be=n=>typeof n!="undefined",Ye=n=>typeof n=="function",Hr=(n,t)=>{if(n.size!==t.size)return!1;for(let e of n)if(!t.has(e))return!1;return!0};function Dl(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}var $t=Math.PI,Et=2*$t,wg=Et+$t,fs=Number.POSITIVE_INFINITY,Sg=$t/180,Bt=$t/2,mi=$t/4,Al=$t*2/3,ve=Math.log10,Te=Math.sign;function Vr(n){let t=Math.round(n);n=Xn(n,t,n/1e3)?t:n;let e=Math.pow(10,Math.floor(ve(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function Ll(n){let t=[],e=Math.sqrt(n),i;for(i=1;i<e;i++)n%i==0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,r)=>s-r).pop(),t}function Tn(n){return!isNaN(parseFloat(n))&&isFinite(n)}function Xn(n,t,e){return Math.abs(n-t)<e}function Rl(n,t){let e=Math.round(n);return e-t<=n&&e+t>=n}function Wr(n,t,e){let i,s,r;for(i=0,s=n.length;i<s;i++)r=n[i][e],isNaN(r)||(t.min=Math.min(t.min,r),t.max=Math.max(t.max,r))}function ye(n){return n*($t/180)}function ds(n){return n*(180/$t)}function Yr(n){if(!jt(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function qr(n,t){let e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i),r=Math.atan2(i,e);return r<-.5*$t&&(r+=Et),{angle:r,distance:s}}function ps(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function Mg(n,t){return(n-t+wg)%Et-$t}function he(n){return(n%Et+Et)%Et}function Un(n,t,e,i){let s=he(n),r=he(t),a=he(e),o=he(r-s),l=he(a-s),c=he(s-r),u=he(s-a);return s===r||s===a||i&&r===a||o>l&&c<u}function Gt(n,t,e){return Math.max(t,Math.min(e,n))}function Fl(n){return Gt(n,-32768,32767)}function Re(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function gs(n,t,e){e=e||(a=>n[a]<t);let i=n.length-1,s=0,r;for(;i-s>1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}var Fe=(n,t,e,i)=>gs(n,e,i?s=>n[s][t]<=e:s=>n[s][t]<e),$l=(n,t,e)=>gs(n,e,i=>n[i][t]>=e);function Il(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}var zl=["push","pop","shift","splice","unshift"];function Bl(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),zl.forEach(e=>{let i="_onData"+us(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){let a=s.apply(this,r);return n._chartjs.listeners.forEach(o=>{typeof o[i]=="function"&&o[i](...r)}),a}})})}function Gr(n,t){let e=n._chartjs;if(!e)return;let i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(zl.forEach(r=>{delete n[r]}),delete n._chartjs)}function Xr(n){let t=new Set,e,i;for(e=0,i=n.length;e<i;++e)t.add(n[e]);return t.size===i?n:Array.from(t)}var Ur=function(){return typeof window=="undefined"?function(n){return n()}:window.requestAnimationFrame}();function Kr(n,t,e){let i=e||(a=>Array.prototype.slice.call(a)),s=!1,r=[];return function(...a){r=i(a),s||(s=!0,Ur.call(window,()=>{s=!1,n.apply(t,r)}))}}function jl(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}var ms=n=>n==="start"?"left":n==="end"?"right":"center",ne=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,Nl=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function Zr(n,t,e){let i=t.length,s=0,r=i;if(n._sorted){let{iScale:a,_parsed:o}=n,l=a.axis,{min:c,max:u,minDefined:d,maxDefined:g}=a.getUserBounds();d&&(s=Gt(Math.min(Fe(o,a.axis,c).lo,e?i:Fe(t,l,a.getPixelForValue(c)).lo),0,i-1)),g?r=Gt(Math.max(Fe(o,a.axis,u,!0).hi+1,e?0:Fe(t,l,a.getPixelForValue(u),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function Jr(n){let{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;let r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}var bs=n=>n===0||n===1,Hl=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*Et/e)),Vl=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*Et/e)+1,Kn={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*Bt)+1,easeOutSine:n=>Math.sin(n*Bt),easeInOutSine:n=>-.5*(Math.cos($t*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>bs(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>bs(n)?n:Hl(n,.075,.3),easeOutElastic:n=>bs(n)?n:Vl(n,.075,.3),easeInOutElastic(n){let t=.1125,e=.45;return bs(n)?n:n<.5?.5*Hl(n*2,t,e):.5+.5*Vl(n*2-1,t,e)},easeInBack(n){let t=1.70158;return n*n*((t+1)*n-t)},easeOutBack(n){let t=1.70158;return(n-=1)*n*((t+1)*n+t)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-Kn.easeOutBounce(1-n),easeOutBounce(n){let t=7.5625,e=2.75;return n<1/e?t*n*n:n<2/e?t*(n-=1.5/e)*n+.75:n<2.5/e?t*(n-=2.25/e)*n+.9375:t*(n-=2.625/e)*n+.984375},easeInOutBounce:n=>n<.5?Kn.easeInBounce(n*2)*.5:Kn.easeOutBounce(n*2-1)*.5+.5};function bi(n){return n+.5|0}var ln=(n,t,e)=>Math.max(Math.min(n,e),t);function vi(n){return ln(bi(n*2.55),0,255)}function cn(n){return ln(bi(n*255),0,255)}function qe(n){return ln(bi(n/2.55)/100,0,1)}function Wl(n){return ln(bi(n*100),0,100)}var xe={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},Qr=[..."0123456789ABCDEF"],Cg=n=>Qr[n&15],Tg=n=>Qr[(n&240)>>4]+Qr[n&15],vs=n=>(n&240)>>4==(n&15),Pg=n=>vs(n.r)&&vs(n.g)&&vs(n.b)&&vs(n.a);function Eg(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&xe[n[1]]*17,g:255&xe[n[2]]*17,b:255&xe[n[3]]*17,a:t===5?xe[n[4]]*17:255}:(t===7||t===9)&&(e={r:xe[n[1]]<<4|xe[n[2]],g:xe[n[3]]<<4|xe[n[4]],b:xe[n[5]]<<4|xe[n[6]],a:t===9?xe[n[7]]<<4|xe[n[8]]:255})),e}var Og=(n,t)=>n<255?t(n):"";function Dg(n){var t=Pg(n)?Cg:Tg;return n?"#"+t(n.r)+t(n.g)+t(n.b)+Og(n.a,t):void 0}var Ag=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Yl(n,t,e){let i=t*Math.min(e,1-e),s=(r,a=(r+n/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function Lg(n,t,e){let i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function Rg(n,t,e){let i=Yl(n,1,.5),s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function Fg(n,t,e,i,s){return n===s?(t-e)/i+(t<e?6:0):t===s?(e-n)/i+2:(n-t)/i+4}function ta(n){let t=255,e=n.r/t,i=n.g/t,s=n.b/t,r=Math.max(e,i,s),a=Math.min(e,i,s),o=(r+a)/2,l,c,u;return r!==a&&(u=r-a,c=o>.5?u/(2-r-a):u/(r+a),l=Fg(e,i,s,u,r),l=l*60+.5),[l|0,c||0,o]}function ea(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(cn)}function na(n,t,e){return ea(Yl,n,t,e)}function $g(n,t,e){return ea(Rg,n,t,e)}function Ig(n,t,e){return ea(Lg,n,t,e)}function ql(n){return(n%360+360)%360}function zg(n){let t=Ag.exec(n),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?vi(+t[5]):cn(+t[5]));let s=ql(+t[2]),r=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=$g(s,r,a):t[1]==="hsv"?i=Ig(s,r,a):i=na(s,r,a),{r:i[0],g:i[1],b:i[2],a:e}}function Bg(n,t){var e=ta(n);e[0]=ql(e[0]+t),e=na(e),n.r=e[0],n.g=e[1],n.b=e[2]}function jg(n){if(!n)return;let t=ta(n),e=t[0],i=Wl(t[1]),s=Wl(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${qe(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}var Gl={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"},Xl={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 Ng(){let n={},t=Object.keys(Xl),e=Object.keys(Gl),i,s,r,a,o;for(i=0;i<t.length;i++){for(a=o=t[i],s=0;s<e.length;s++)r=e[s],o=o.replace(r,Gl[r]);r=parseInt(Xl[a],16),n[o]=[r>>16&255,r>>8&255,r&255]}return n}var _s;function Hg(n){_s||(_s=Ng(),_s.transparent=[0,0,0,0]);let t=_s[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var Vg=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Wg(n){let t=Vg.exec(n),e=255,i,s,r;if(!!t){if(t[7]!==i){let a=+t[7];e=t[8]?vi(a):ln(a*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?vi(i):ln(i,0,255)),s=255&(t[4]?vi(s):ln(s,0,255)),r=255&(t[6]?vi(r):ln(r,0,255)),{r:i,g:s,b:r,a:e}}}function Yg(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${qe(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}var ia=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Zn=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function qg(n,t,e){let i=Zn(qe(n.r)),s=Zn(qe(n.g)),r=Zn(qe(n.b));return{r:cn(ia(i+e*(Zn(qe(t.r))-i))),g:cn(ia(s+e*(Zn(qe(t.g))-s))),b:cn(ia(r+e*(Zn(qe(t.b))-r))),a:n.a+e*(t.a-n.a)}}function ys(n,t,e){if(n){let i=ta(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=na(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Ul(n,t){return n&&Object.assign(t||{},n)}function Kl(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=cn(n[3]))):(t=Ul(n,{r:0,g:0,b:0,a:1}),t.a=cn(t.a)),t}function Gg(n){return n.charAt(0)==="r"?Wg(n):zg(n)}var _i=class{constructor(t){if(t instanceof _i)return t;let e=typeof t,i;e==="object"?i=Kl(t):e==="string"&&(i=Eg(t)||Hg(t)||Gg(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Ul(this._rgb);return t&&(t.a=qe(t.a)),t}set rgb(t){this._rgb=Kl(t)}rgbString(){return this._valid?Yg(this._rgb):void 0}hexString(){return this._valid?Dg(this._rgb):void 0}hslString(){return this._valid?jg(this._rgb):void 0}mix(t,e){if(t){let i=this.rgb,s=t.rgb,r,a=e===r?.5:e,o=2*a-1,l=i.a-s.a,c=((o*l==-1?o:(o+l)/(1+o*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=qg(this._rgb,t._rgb,e)),this}clone(){return new _i(this.rgb)}alpha(t){return this._rgb.a=cn(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=bi(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ys(this._rgb,2,t),this}darken(t){return ys(this._rgb,2,-t),this}saturate(t){return ys(this._rgb,1,t),this}desaturate(t){return ys(this._rgb,1,-t),this}rotate(t){return Bg(this._rgb,t),this}};function Zl(n){return new _i(n)}function Jl(n){if(n&&typeof n=="object"){let t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function sa(n){return Jl(n)?n:Zl(n)}function ra(n){return Jl(n)?n:Zl(n).saturate(.5).darken(.1).hexString()}var hn=Object.create(null),xs=Object.create(null);function yi(n,t){if(!t)return n;let e=t.split(".");for(let i=0,s=e.length;i<s;++i){let r=e[i];n=n[r]||(n[r]=Object.create(null))}return n}function aa(n,t,e){return typeof t=="string"?qn(yi(n,t),e):qn(yi(n,""),t)}var Ql=class{constructor(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=e=>e.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=(e,i)=>ra(i.backgroundColor),this.hoverBorderColor=(e,i)=>ra(i.borderColor),this.hoverColor=(e,i)=>ra(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return aa(this,t,e)}get(t){return yi(this,t)}describe(t,e){return aa(xs,t,e)}override(t,e){return aa(hn,t,e)}route(t,e,i,s){let r=yi(this,t),a=yi(this,i),o="_"+e;Object.defineProperties(r,{[o]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[o],c=a[s];return ft(l)?Object.assign({},c,l):at(l,c)},set(l){this[o]=l}}})}},dt=new Ql({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function Xg(n){return!n||vt(n.size)||vt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function xi(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function tc(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let a=0,o=e.length,l,c,u,d,g;for(l=0;l<o;l++)if(d=e[l],d!=null&&Dt(d)!==!0)a=xi(n,s,r,a,d);else if(Dt(d))for(c=0,u=d.length;c<u;c++)g=d[c],g!=null&&!Dt(g)&&(a=xi(n,s,r,a,g));n.restore();let p=r.length/2;if(p>e.length){for(l=0;l<p;l++)delete s[r[l]];r.splice(0,p)}return a}function un(n,t,e){let i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function oa(n,t){t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore()}function ks(n,t,e,i){la(n,t,e,i,null)}function la(n,t,e,i,s){let r,a,o,l,c,u,d=t.pointStyle,g=t.rotation,p=t.radius,b=(g||0)*Sg;if(d&&typeof d=="object"&&(r=d.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(b),n.drawImage(d,-d.width/2,-d.height/2,d.width,d.height),n.restore();return}if(!(isNaN(p)||p<=0)){switch(n.beginPath(),d){default:s?n.ellipse(e,i,s/2,p,0,0,Et):n.arc(e,i,p,0,Et),n.closePath();break;case"triangle":n.moveTo(e+Math.sin(b)*p,i-Math.cos(b)*p),b+=Al,n.lineTo(e+Math.sin(b)*p,i-Math.cos(b)*p),b+=Al,n.lineTo(e+Math.sin(b)*p,i-Math.cos(b)*p),n.closePath();break;case"rectRounded":c=p*.516,l=p-c,a=Math.cos(b+mi)*l,o=Math.sin(b+mi)*l,n.arc(e-a,i-o,c,b-$t,b-Bt),n.arc(e+o,i-a,c,b-Bt,b),n.arc(e+a,i+o,c,b,b+Bt),n.arc(e-o,i+a,c,b+Bt,b+$t),n.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,u=s?s/2:l,n.rect(e-u,i-l,2*u,2*l);break}b+=mi;case"rectRot":a=Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+o,i-a),n.lineTo(e+a,i+o),n.lineTo(e-o,i+a),n.closePath();break;case"crossRot":b+=mi;case"cross":a=Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o),n.moveTo(e+o,i-a),n.lineTo(e-o,i+a);break;case"star":a=Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o),n.moveTo(e+o,i-a),n.lineTo(e-o,i+a),b+=mi,a=Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o),n.moveTo(e+o,i-a),n.lineTo(e-o,i+a);break;case"line":a=s?s/2:Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(b)*p,i+Math.sin(b)*p);break}n.fill(),t.borderWidth>0&&n.stroke()}}function Jn(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function ki(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function wi(n){n.restore()}function ec(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){let r=(t.x+e.x)/2;n.lineTo(r,t.y),n.lineTo(r,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function nc(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function fn(n,t,e,i,s,r={}){let a=Dt(t)?t:[t],o=r.strokeWidth>0&&r.strokeColor!=="",l,c;for(n.save(),n.font=s.string,Ug(n,r),l=0;l<a.length;++l)c=a[l],o&&(r.strokeColor&&(n.strokeStyle=r.strokeColor),vt(r.strokeWidth)||(n.lineWidth=r.strokeWidth),n.strokeText(c,e,i,r.maxWidth)),n.fillText(c,e,i,r.maxWidth),Kg(n,e,i,c,r),i+=s.lineHeight;n.restore()}function Ug(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),vt(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function Kg(n,t,e,i,s){if(s.strikethrough||s.underline){let r=n.measureText(i),a=t-r.actualBoundingBoxLeft,o=t+r.actualBoundingBoxRight,l=e-r.actualBoundingBoxAscent,c=e+r.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(a,u),n.lineTo(o,u),n.stroke()}}function Qn(n,t){let{x:e,y:i,w:s,h:r,radius:a}=t;n.arc(e+a.topLeft,i+a.topLeft,a.topLeft,-Bt,$t,!0),n.lineTo(e,i+r-a.bottomLeft),n.arc(e+a.bottomLeft,i+r-a.bottomLeft,a.bottomLeft,$t,Bt,!0),n.lineTo(e+s-a.bottomRight,i+r),n.arc(e+s-a.bottomRight,i+r-a.bottomRight,a.bottomRight,Bt,0,!0),n.lineTo(e+s,i+a.topRight),n.arc(e+s-a.topRight,i+a.topRight,a.topRight,0,-Bt,!0),n.lineTo(e+a.topLeft,i)}var Zg=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),Jg=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function Qg(n,t){let e=(""+n).match(Zg);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}var tm=n=>+n||0;function ws(n,t){let e={},i=ft(t),s=i?Object.keys(t):t,r=ft(n)?i?a=>at(n[a],n[t[a]]):a=>n[a]:()=>n;for(let a of s)e[a]=tm(r(a));return e}function ca(n){return ws(n,{top:"y",right:"x",bottom:"y",left:"x"})}function dn(n){return ws(n,["topLeft","topRight","bottomLeft","bottomRight"])}function ie(n){let t=ca(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function qt(n,t){n=n||{},t=t||dt.font;let e=at(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=at(n.style,t.style);i&&!(""+i).match(Jg)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");let s={family:at(n.family,t.family),lineHeight:Qg(at(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:at(n.weight,t.weight),string:""};return s.string=Xg(s),s}function ti(n,t,e,i){let s=!0,r,a,o;for(r=0,a=n.length;r<a;++r)if(o=n[r],o!==void 0&&(t!==void 0&&typeof o=="function"&&(o=o(t),s=!1),e!==void 0&&Dt(o)&&(o=o[e%o.length],s=!1),o!==void 0))return i&&!s&&(i.cacheable=!1),o}function ic(n,t,e){let{min:i,max:s}=n,r=Nr(t,(s-i)/2),a=(o,l)=>e&&o===0?0:o+l;return{min:a(i,-Math.abs(r)),max:a(s,r)}}function Ge(n,t){return Object.assign(Object.create(n),t)}function Ss(n,t=[""],e=n,i,s=()=>n[0]){be(i)||(i=oc("_fallback",n));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:e,_fallback:i,_getTarget:s,override:a=>Ss([a,...n],t,e,i)};return new Proxy(r,{deleteProperty(a,o){return delete a[o],delete a._keys,delete n[0][o],!0},get(a,o){return sc(a,o,()=>lm(o,t,n,a))},getOwnPropertyDescriptor(a,o){return Reflect.getOwnPropertyDescriptor(a._scopes[0],o)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,o){return lc(a).includes(o)},ownKeys(a){return lc(a)},set(a,o,l){let c=a._storage||(a._storage=s());return a[o]=c[o]=l,delete a._keys,!0}})}function Pn(n,t,e,i){let s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:ha(n,i),setContext:r=>Pn(n,r,e,i),override:r=>Pn(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,a){return delete r[a],delete n[a],!0},get(r,a,o){return sc(r,a,()=>nm(r,a,o))},getOwnPropertyDescriptor(r,a){return r._descriptors.allKeys?Reflect.has(n,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,a)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,a){return Reflect.has(n,a)},ownKeys(){return Reflect.ownKeys(n)},set(r,a,o){return n[a]=o,delete r[a],!0}})}function ha(n,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:Ye(e)?e:()=>e,isIndexable:Ye(i)?i:()=>i}}var em=(n,t)=>n?n+us(t):t,ua=(n,t)=>ft(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function sc(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let i=e();return n[t]=i,i}function nm(n,t,e){let{_proxy:i,_context:s,_subProxy:r,_descriptors:a}=n,o=i[t];return Ye(o)&&a.isScriptable(t)&&(o=im(t,o,n,e)),Dt(o)&&o.length&&(o=sm(t,o,n,a.isIndexable)),ua(t,o)&&(o=Pn(o,s,r&&r[t],a)),o}function im(n,t,e,i){let{_proxy:s,_context:r,_subProxy:a,_stack:o}=e;if(o.has(n))throw new Error("Recursion detected: "+Array.from(o).join("->")+"->"+n);return o.add(n),t=t(r,a||i),o.delete(n),ua(n,t)&&(t=fa(s._scopes,s,n,t)),t}function sm(n,t,e,i){let{_proxy:s,_context:r,_subProxy:a,_descriptors:o}=e;if(be(r.index)&&i(n))t=t[r.index%t.length];else if(ft(t[0])){let l=t,c=s._scopes.filter(u=>u!==l);t=[];for(let u of l){let d=fa(c,s,n,u);t.push(Pn(d,r,a&&a[n],o))}}return t}function rc(n,t,e){return Ye(n)?n(t,e):n}var rm=(n,t)=>n===!0?t:typeof n=="string"?We(t,n):void 0;function am(n,t,e,i,s){for(let r of t){let a=rm(e,r);if(a){n.add(a);let o=rc(a._fallback,e,s);if(be(o)&&o!==e&&o!==i)return o}else if(a===!1&&be(i)&&e!==i)return null}return!1}function fa(n,t,e,i){let s=t._rootScopes,r=rc(t._fallback,e,i),a=[...n,...s],o=new Set;o.add(i);let l=ac(o,a,e,r||e,i);return l===null||be(r)&&r!==e&&(l=ac(o,a,r,l,i),l===null)?!1:Ss(Array.from(o),[""],s,r,()=>om(t,e,i))}function ac(n,t,e,i,s){for(;e;)e=am(n,t,e,i,s);return e}function om(n,t,e){let i=n._getTarget();t in i||(i[t]={});let s=i[t];return Dt(s)&&ft(e)?e:s}function lm(n,t,e,i){let s;for(let r of t)if(s=oc(em(r,n),e),be(s))return ua(n,s)?fa(e,i,n,s):s}function oc(n,t){for(let e of t){if(!e)continue;let i=e[n];if(be(i))return i}}function lc(n){let t=n._keys;return t||(t=n._keys=cm(n._scopes)),t}function cm(n){let t=new Set;for(let e of n)for(let i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function da(n,t,e,i){let{iScale:s}=n,{key:r="r"}=this._parsing,a=new Array(i),o,l,c,u;for(o=0,l=i;o<l;++o)c=o+e,u=t[c],a[o]={r:s.parse(We(u,r),c)};return a}var hm=Number.EPSILON||1e-14,ei=(n,t)=>t<n.length&&!n[t].skip&&n[t],cc=n=>n==="x"?"y":"x";function um(n,t,e,i){let s=n.skip?t:n,r=t,a=e.skip?t:e,o=ps(r,s),l=ps(a,r),c=o/(o+l),u=l/(o+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;let d=i*c,g=i*u;return{previous:{x:r.x-d*(a.x-s.x),y:r.y-d*(a.y-s.y)},next:{x:r.x+g*(a.x-s.x),y:r.y+g*(a.y-s.y)}}}function fm(n,t,e){let i=n.length,s,r,a,o,l,c=ei(n,0);for(let u=0;u<i-1;++u)if(l=c,c=ei(n,u+1),!(!l||!c)){if(Xn(t[u],0,hm)){e[u]=e[u+1]=0;continue}s=e[u]/t[u],r=e[u+1]/t[u],o=Math.pow(s,2)+Math.pow(r,2),!(o<=9)&&(a=3/Math.sqrt(o),e[u]=s*a*t[u],e[u+1]=r*a*t[u])}}function dm(n,t,e="x"){let i=cc(e),s=n.length,r,a,o,l=ei(n,0);for(let c=0;c<s;++c){if(a=o,o=l,l=ei(n,c+1),!o)continue;let u=o[e],d=o[i];a&&(r=(u-a[e])/3,o[`cp1${e}`]=u-r,o[`cp1${i}`]=d-r*t[c]),l&&(r=(l[e]-u)/3,o[`cp2${e}`]=u+r,o[`cp2${i}`]=d+r*t[c])}}function pm(n,t="x"){let e=cc(t),i=n.length,s=Array(i).fill(0),r=Array(i),a,o,l,c=ei(n,0);for(a=0;a<i;++a)if(o=l,l=c,c=ei(n,a+1),!!l){if(c){let u=c[t]-l[t];s[a]=u!==0?(c[e]-l[e])/u:0}r[a]=o?c?Te(s[a-1])!==Te(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}fm(n,s,r),dm(n,r,t)}function Ms(n,t,e){return Math.max(Math.min(n,e),t)}function gm(n,t){let e,i,s,r,a,o=Jn(n[0],t);for(e=0,i=n.length;e<i;++e)a=r,r=o,o=e<i-1&&Jn(n[e+1],t),!!r&&(s=n[e],a&&(s.cp1x=Ms(s.cp1x,t.left,t.right),s.cp1y=Ms(s.cp1y,t.top,t.bottom)),o&&(s.cp2x=Ms(s.cp2x,t.left,t.right),s.cp2y=Ms(s.cp2y,t.top,t.bottom)))}function hc(n,t,e,i,s){let r,a,o,l;if(t.spanGaps&&(n=n.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")pm(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,a=n.length;r<a;++r)o=n[r],l=um(c,o,n[Math.min(r+1,a-(i?0:1))%a],t.tension),o.cp1x=l.previous.x,o.cp1y=l.previous.y,o.cp2x=l.next.x,o.cp2y=l.next.y,c=o}t.capBezierPoints&&gm(n,e)}function pa(){return typeof window!="undefined"&&typeof document!="undefined"}function Cs(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ts(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}var Ps=n=>window.getComputedStyle(n,null);function mm(n,t){return Ps(n).getPropertyValue(t)}var bm=["top","right","bottom","left"];function En(n,t,e){let i={};e=e?"-"+e:"";for(let s=0;s<4;s++){let r=bm[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}var vm=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function _m(n,t){let e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i,a=!1,o,l;if(vm(s,r,n.target))o=s,l=r;else{let c=t.getBoundingClientRect();o=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:o,y:l,box:a}}function pn(n,t){if("native"in n)return n;let{canvas:e,currentDevicePixelRatio:i}=t,s=Ps(e),r=s.boxSizing==="border-box",a=En(s,"padding"),o=En(s,"border","width"),{x:l,y:c,box:u}=_m(n,e),d=a.left+(u&&o.left),g=a.top+(u&&o.top),{width:p,height:b}=t;return r&&(p-=a.width+o.width,b-=a.height+o.height),{x:Math.round((l-d)/p*e.width/i),y:Math.round((c-g)/b*e.height/i)}}function ym(n,t,e){let i,s;if(t===void 0||e===void 0){let r=Cs(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{let a=r.getBoundingClientRect(),o=Ps(r),l=En(o,"border","width"),c=En(o,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=Ts(o.maxWidth,r,"clientWidth"),s=Ts(o.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||fs,maxHeight:s||fs}}var ga=n=>Math.round(n*10)/10;function uc(n,t,e,i){let s=Ps(n),r=En(s,"margin"),a=Ts(s.maxWidth,n,"clientWidth")||fs,o=Ts(s.maxHeight,n,"clientHeight")||fs,l=ym(n,t,e),{width:c,height:u}=l;if(s.boxSizing==="content-box"){let d=En(s,"border","width"),g=En(s,"padding");c-=g.width+d.width,u-=g.height+d.height}return c=Math.max(0,c-r.width),u=Math.max(0,i?Math.floor(c/i):u-r.height),c=ga(Math.min(c,a,l.maxWidth)),u=ga(Math.min(u,o,l.maxHeight)),c&&!u&&(u=ga(c/2)),{width:c,height:u}}function ma(n,t,e){let i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=s/i,n.width=r/i;let a=n.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${n.height}px`,a.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||a.height!==s||a.width!==r?(n.currentDevicePixelRatio=i,a.height=s,a.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}var fc=function(){let n=!1;try{let t={get passive(){return n=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(t){}return n}();function ba(n,t){let e=mm(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function gn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function dc(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function pc(n,t,e,i){let s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},a=gn(n,s,e),o=gn(s,r,e),l=gn(r,t,e),c=gn(a,o,e),u=gn(o,l,e);return gn(c,u,e)}var gc=new Map;function xm(n,t){t=t||{};let e=n+JSON.stringify(t),i=gc.get(e);return i||(i=new Intl.NumberFormat(n,t),gc.set(e,i)),i}function ni(n,t,e){return xm(t,e).format(n)}var km=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},wm=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function On(n,t,e){return n?km(t,e):wm()}function va(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function _a(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function mc(n){return n==="angle"?{between:Un,compare:Mg,normalize:he}:{between:Re,compare:(t,e)=>t-e,normalize:t=>t}}function bc({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e==0,style:s}}function Sm(n,t,e){let{property:i,start:s,end:r}=e,{between:a,normalize:o}=mc(i),l=t.length,{start:c,end:u,loop:d}=n,g,p;if(d){for(c+=l,u+=l,g=0,p=l;g<p&&a(o(t[c%l][i]),s,r);++g)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:d,style:n.style}}function ya(n,t,e){if(!e)return[n];let{property:i,start:s,end:r}=e,a=t.length,{compare:o,between:l,normalize:c}=mc(i),{start:u,end:d,loop:g,style:p}=Sm(n,t,e),b=[],x=!1,M=null,C,P,$,R=()=>l(s,$,C)&&o(s,$)!==0,F=()=>o(r,C)===0||l(r,$,C),z=()=>x||R(),N=()=>!x||F();for(let X=u,U=u;X<=d;++X)P=t[X%a],!P.skip&&(C=c(P[i]),C!==$&&(x=l(C,s,r),M===null&&z()&&(M=o(C,s)===0?X:U),M!==null&&N()&&(b.push(bc({start:M,end:X,loop:g,count:a,style:p})),M=null),U=X,$=C));return M!==null&&b.push(bc({start:M,end:d,loop:g,count:a,style:p})),b}function xa(n,t){let e=[],i=n.segments;for(let s=0;s<i.length;s++){let r=ya(i[s],n.points,t);r.length&&e.push(...r)}return e}function Mm(n,t,e,i){let s=0,r=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(r+=s);r>s&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function Cm(n,t,e,i){let s=n.length,r=[],a=t,o=n[t],l;for(l=t+1;l<=e;++l){let c=n[l%s];c.skip||c.stop?o.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=a=c.stop?l:null):(a=l,o.skip&&(t=l)),o=c}return a!==null&&r.push({start:t%s,end:a%s,loop:i}),r}function vc(n,t){let e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];let r=!!n._loop,{start:a,end:o}=Mm(e,s,r,i);if(i===!0)return _c(n,[{start:a,end:o,loop:r}],e,t);let l=o<a?o+s:o,c=!!n._fullLoop&&a===0&&o===s-1;return _c(n,Cm(e,a,l,c),e,t)}function _c(n,t,e,i){return!i||!i.setContext||!e?t:Tm(n,t,e,i)}function Tm(n,t,e,i){let s=n._chart.getContext(),r=yc(n.options),{_datasetIndex:a,options:{spanGaps:o}}=n,l=e.length,c=[],u=r,d=t[0].start,g=d;function p(b,x,M,C){let P=o?-1:1;if(b!==x){for(b+=l;e[b%l].skip;)b-=P;for(;e[x%l].skip;)x+=P;b%l!=x%l&&(c.push({start:b%l,end:x%l,loop:M,style:C}),u=C,d=x%l)}}for(let b of t){d=o?d:b.start;let x=e[d%l],M;for(g=d+1;g<=b.end;g++){let C=e[g%l];M=yc(i.setContext(Ge(s,{type:"segment",p0:x,p1:C,p0DataIndex:(g-1)%l,p1DataIndex:g%l,datasetIndex:a}))),Pm(M,u)&&p(d,g-1,b.loop,u),x=C,u=M}d<g-1&&p(d,g-1,b.loop,u)}return c}function yc(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function Pm(n,t){return t&&JSON.stringify(n)!==JSON.stringify(t)}var xc=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let r=e.listeners[s],a=e.duration;r.forEach(o=>o({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Ur.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;let r=i.items,a=r.length-1,o=!1,l;for(;a>=0;--a)l=r[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),o=!0):(r[a]=r[r.length-1],r.pop());o&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);!e||(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},Xe=new xc,kc="transparent",Em={boolean(n,t,e){return e>.5?t:n},color(n,t,e){let i=sa(n||kc),s=i.valid&&sa(t||kc);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}},wc=class{constructor(t,e,i,s){let r=e[i];s=ti([t.to,s,r,t.from]);let a=ti([t.from,r,s]);this._active=!0,this._fn=t.fn||Em[t.type||typeof a],this._easing=Kn[t.easing]||Kn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let s=this._target[this._prop],r=i-this._start,a=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=ti([t.to,e,s,t.from]),this._from=ti([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,s=this._prop,r=this._from,a=this._loop,o=this._to,l;if(this._active=r!==o&&(a||e<i),!this._active){this._target[s]=o,this._notify(!0);return}if(e<0){this._target[s]=r;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,o,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}},Om=["x","y","borderWidth","radius","tension"],Dm=["color","borderColor","backgroundColor"];dt.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});var Am=Object.keys(dt.animation);dt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:n=>n!=="onProgress"&&n!=="onComplete"&&n!=="fn"});dt.set("animations",{colors:{type:"color",properties:Dm},numbers:{type:"number",properties:Om}});dt.describe("animations",{_fallback:"animation"});dt.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:n=>n|0}}}});var ka=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!ft(t))return;let e=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{let s=t[i];if(!ft(s))return;let r={};for(let a of Am)r[a]=s[a];(Dt(s.properties)&&s.properties||[i]).forEach(a=>{(a===i||!e.has(a))&&e.set(a,r)})})}_animateOptions(t,e){let i=e.options,s=Rm(t,i);if(!s)return[];let r=this._createAnimations(s,i);return i.$shared&&Lm(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){let i=this._properties,s=[],r=t.$animations||(t.$animations={}),a=Object.keys(e),o=Date.now(),l;for(l=a.length-1;l>=0;--l){let c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}let u=e[c],d=r[c],g=i.get(c);if(d)if(g&&d.active()){d.update(g,u,o);continue}else d.cancel();if(!g||!g.duration){t[c]=u;continue}r[c]=d=new wc(g,t,c,u),s.push(d)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return Xe.add(this._chart,i),!0}};function Lm(n,t){let e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){let r=n[i[s]];r&&r.active()&&e.push(r.wait())}return Promise.all(e)}function Rm(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Sc(n,t){let e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,r=e.max===void 0?t:0;return{start:i?r:s,end:i?s:r}}function Fm(n,t,e){if(e===!1)return!1;let i=Sc(n,e),s=Sc(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function $m(n){let t,e,i,s;return ft(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function Mc(n,t){let e=[],i=n._getSortedDatasetMetas(t),s,r;for(s=0,r=i.length;s<r;++s)e.push(i[s].index);return e}function Cc(n,t,e,i={}){let s=n.keys,r=i.mode==="single",a,o,l,c;if(t!==null){for(a=0,o=s.length;a<o;++a){if(l=+s[a],l===e){if(i.all)continue;break}c=n.values[l],jt(c)&&(r||t===0||Te(t)===Te(c))&&(t+=c)}return t}}function Im(n){let t=Object.keys(n),e=new Array(t.length),i,s,r;for(i=0,s=t.length;i<s;++i)r=t[i],e[i]={x:r,y:n[r]};return e}function Tc(n,t){let e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function zm(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function Bm(n){let{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function jm(n,t,e){let i=n[t]||(n[t]={});return i[e]||(i[e]={})}function Pc(n,t,e,i){for(let s of t.getMatchingVisibleMetas(i).reverse()){let r=n[s.index];if(e&&r>0||!e&&r<0)return s.index}return null}function Ec(n,t){let{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:a,index:o}=i,l=r.axis,c=a.axis,u=zm(r,a,i),d=t.length,g;for(let p=0;p<d;++p){let b=t[p],{[l]:x,[c]:M}=b,C=b._stacks||(b._stacks={});g=C[c]=jm(s,u,x),g[o]=M,g._top=Pc(g,a,!0,i.type),g._bottom=Pc(g,a,!1,i.type)}}function wa(n,t){let e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function Nm(n,t){return Ge(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Hm(n,t,e){return Ge(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Si(n,t){let e=n.controller.index,i=n.vScale&&n.vScale.axis;if(!!i){t=t||n._parsed;for(let s of t){let r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e]}}}var Sa=n=>n==="reset"||n==="none",Oc=(n,t)=>t?n:Object.assign({},n),Vm=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:Mc(e,!0),values:null},ke=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Tc(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Si(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(d,g,p,b)=>d==="x"?g:d==="r"?b:p,r=e.xAxisID=at(i.xAxisID,wa(t,"x")),a=e.yAxisID=at(i.yAxisID,wa(t,"y")),o=e.rAxisID=at(i.rAxisID,wa(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,a,o),u=e.vAxisID=s(l,a,r,o);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Gr(this._data,this),t._stacked&&Si(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(ft(e))this._data=Im(e);else if(i!==e){if(i){Gr(i,this);let s=this._cachedMeta;Si(s),s._parsed=[]}e&&Object.isExtensible(e)&&Bl(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let r=e._stacked;e._stacked=Tc(e.vScale,e),e.stack!==i.stack&&(s=!0,Si(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&Ec(this,e._parsed)}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:a}=i,o=r.axis,l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,d,g;if(this._parsing===!1)i._parsed=s,i._sorted=!0,g=s;else{Dt(s[t])?g=this.parseArrayData(i,s,t,e):ft(s[t])?g=this.parseObjectData(i,s,t,e):g=this.parsePrimitiveData(i,s,t,e);let p=()=>d[o]===null||c&&d[o]<c[o];for(u=0;u<e;++u)i._parsed[u+t]=d=g[u],l&&(p()&&(l=!1),c=d);i._sorted=l}a&&Ec(this,g)}parsePrimitiveData(t,e,i,s){let{iScale:r,vScale:a}=t,o=r.axis,l=a.axis,c=r.getLabels(),u=r===a,d=new Array(s),g,p,b;for(g=0,p=s;g<p;++g)b=g+i,d[g]={[o]:u||r.parse(c[b],b),[l]:a.parse(e[b],b)};return d}parseArrayData(t,e,i,s){let{xScale:r,yScale:a}=t,o=new Array(s),l,c,u,d;for(l=0,c=s;l<c;++l)u=l+i,d=e[u],o[l]={x:r.parse(d[0],u),y:a.parse(d[1],u)};return o}parseObjectData(t,e,i,s){let{xScale:r,yScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=new Array(s),u,d,g,p;for(u=0,d=s;u<d;++u)g=u+i,p=e[g],c[u]={x:r.parse(We(p,o),g),y:a.parse(We(p,l),g)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let s=this.chart,r=this._cachedMeta,a=e[t.axis],o={keys:Mc(s,!0),values:e._stacks[t.axis]};return Cc(o,a,r.index,{mode:i})}updateRangeFromParsed(t,e,i,s){let r=i[e.axis],a=r===null?NaN:r,o=s&&i._stacks[e.axis];s&&o&&(s.values=o,a=Cc(s,r,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let i=this._cachedMeta,s=i._parsed,r=i._sorted&&t===i.iScale,a=s.length,o=this._getOtherScale(t),l=Vm(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=Bm(o),g,p;function b(){p=s[g];let x=p[o.axis];return!jt(p[t.axis])||u>x||d<x}for(g=0;g<a&&!(!b()&&(this.updateRangeFromParsed(c,t,p,l),r));++g);if(r){for(g=a-1;g>=0;--g)if(!b()){this.updateRangeFromParsed(c,t,p,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],s,r,a;for(s=0,r=e.length;s<r;++s)a=e[s][t.axis],jt(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,s=e.vScale,r=this.getParsed(t);return{label:i?""+i.getLabelForValue(r[i.axis]):"",value:s?""+s.getLabelForValue(r[s.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=$m(at(this.options.clip,Fm(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],r=e.chartArea,a=[],o=this._drawStart||0,l=this._drawCount||s.length-o,c=this.options.drawActiveElementsOnTop,u;for(i.dataset&&i.dataset.draw(t,r,o,l),u=o;u<o+l;++u){let d=s[u];d.hidden||(d.active&&c?a.push(d):d.draw(t,r))}for(u=0;u<a.length;++u)a[u].draw(t,r)}getStyle(t,e){let i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){let s=this.getDataset(),r;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];r=a.$context||(a.$context=Hm(this.getContext(),t,a)),r.parsed=this.getParsed(t),r.raw=s.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Nm(this.chart.getContext(),this.index)),r.dataset=s,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){let s=e==="active",r=this._cachedDataOpts,a=t+"-"+e,o=r[a],l=this.enableOptionSharing&&be(i);if(o)return Oc(o,l);let c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],g=c.getOptionScopes(this.getDataset(),u),p=Object.keys(dt.elements[t]),b=()=>this.getContext(i,s),x=c.resolveNamedOptions(g,p,b,d);return x.$shared&&(x.$shared=l,r[a]=Object.freeze(Oc(x,l))),x}_resolveAnimations(t,e,i){let s=this.chart,r=this._cachedDataOpts,a=`animation-${e}`,o=r[a];if(o)return o;let l;if(s.options.animation!==!1){let u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,e),g=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(g,this.getContext(t,i,e))}let c=new ka(s,l&&l.animations);return l&&l._cacheable&&(r[a]=Object.freeze(c)),c}getSharedOptions(t){if(!!t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Sa(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),a=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:a}}updateElement(t,e,i,s){Sa(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Sa(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[o,l,c]of this._syncList)this[o](l,c);this._syncList=[];let s=i.length,r=e.length,a=Math.min(r,s);a&&this.parse(0,a),r>s?this._insertElements(s,r-s,t):r<s&&this._removeElements(r,s-r)}_insertElements(t,e,i=!0){let s=this._cachedMeta,r=s.data,a=t+e,o,l=c=>{for(c.length+=e,o=c.length-1;o>=a;o--)c[o]=c[o-e]};for(l(r),o=t;o<a;++o)r[o]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),i&&this.updateElements(r,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let s=i._parsed.splice(t,e);i._stacked&&Si(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};ke.defaults={};ke.prototype.datasetElementType=null;ke.prototype.dataElementType=null;function Wm(n,t){if(!n._cache.$bar){let e=n.getMatchingVisibleMetas(t),i=[];for(let s=0,r=e.length;s<r;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=Xr(i.sort((s,r)=>s-r))}return n._cache.$bar}function Ym(n){let t=n.iScale,e=Wm(t,n.type),i=t._length,s,r,a,o,l=()=>{a===32767||a===-32768||(be(o)&&(i=Math.min(i,Math.abs(a-o)||i)),o=a)};for(s=0,r=e.length;s<r;++s)a=t.getPixelForValue(e[s]),l();for(o=void 0,s=0,r=t.ticks.length;s<r;++s)a=t.getPixelForTick(s),l();return i}function qm(n,t,e,i){let s=e.barThickness,r,a;return vt(s)?(r=t.min*e.categoryPercentage,a=e.barPercentage):(r=s*i,a=1),{chunk:r/i,ratio:a,start:t.pixels[n]-r/2}}function Gm(n,t,e,i){let s=t.pixels,r=s[n],a=n>0?s[n-1]:null,o=n<s.length-1?s[n+1]:null,l=e.categoryPercentage;a===null&&(a=r-(o===null?t.end-t.start:o-r)),o===null&&(o=r+r-a);let c=r-(r-Math.min(a,o))/2*l;return{chunk:Math.abs(o-a)/2*l/i,ratio:e.barPercentage,start:c}}function Xm(n,t,e,i){let s=e.parse(n[0],i),r=e.parse(n[1],i),a=Math.min(s,r),o=Math.max(s,r),l=a,c=o;Math.abs(a)>Math.abs(o)&&(l=o,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:a,max:o}}function Dc(n,t,e,i){return Dt(n)?Xm(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Ac(n,t,e,i){let s=n.iScale,r=n.vScale,a=s.getLabels(),o=s===r,l=[],c,u,d,g;for(c=e,u=e+i;c<u;++c)g=t[c],d={},d[s.axis]=o||s.parse(a[c],c),l.push(Dc(g,d,r,c));return l}function Ma(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function Um(n,t,e){return n!==0?Te(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Km(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",r="start"):(s="start",r="end"),{start:e,end:i,reverse:t,top:s,bottom:r}}function Zm(n,t,e,i){let s=t.borderSkipped,r={};if(!s){n.borderSkipped=r;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:a,end:o,reverse:l,top:c,bottom:u}=Km(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=c:(e._bottom||0)===i?s=u:(r[Lc(u,a,o,l)]=!0,s=c)),r[Lc(s,a,o,l)]=!0,n.borderSkipped=r}function Lc(n,t,e,i){return i?(n=Jm(n,t,e),n=Rc(n,e,t)):n=Rc(n,t,e),n}function Jm(n,t,e){return n===t?e:n===e?t:n}function Rc(n,t,e){return n==="start"?t:n==="end"?e:n}function Qm(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}var Mi=class extends ke{parsePrimitiveData(t,e,i,s){return Ac(t,e,i,s)}parseArrayData(t,e,i,s){return Ac(t,e,i,s)}parseObjectData(t,e,i,s){let{iScale:r,vScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=r.axis==="x"?o:l,u=a.axis==="x"?o:l,d=[],g,p,b,x;for(g=i,p=i+s;g<p;++g)x=e[g],b={},b[r.axis]=r.parse(We(x,c),g),d.push(Dc(We(x,u),b,a,g));return d}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);let r=i._custom;r&&e===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 e=this._cachedMeta,{iScale:i,vScale:s}=e,r=this.getParsed(t),a=r._custom,o=Ma(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(r[s.axis]);return{label:""+i.getLabelForValue(r[i.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){let r=s==="reset",{index:a,_cachedMeta:{vScale:o}}=this,l=o.getBasePixel(),c=o.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:g}=this._getSharedOptions(e,s);for(let p=e;p<e+i;p++){let b=this.getParsed(p),x=r||vt(b[o.axis])?{base:l,head:l}:this._calculateBarValuePixels(p),M=this._calculateBarIndexPixels(p,u),C=(b._stacks||{})[o.axis],P={horizontal:c,base:x.base,enableBorderRadius:!C||Ma(b._custom)||a===C._top||a===C._bottom,x:c?x.head:M.center,y:c?M.center:x.head,height:c?M.size:Math.abs(x.size),width:c?Math.abs(x.size):M.size};g&&(P.options=d||this.resolveDataElementOptions(p,t[p].active?"active":s));let $=P.options||t[p].options;Zm(P,$,C,a),Qm(P,$,u.ratio),this.updateElement(t[p],p,P,s)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(l=>l.controller.options.grouped),r=i.options.stacked,a=[],o=l=>{let c=l.controller.getParsed(e),u=c&&c[l.vScale.axis];if(vt(u)||isNaN(u))return!0};for(let l of s)if(!(e!==void 0&&o(l))&&((r===!1||a.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&a.push(l.stack),l.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){let s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,s=[],r,a;for(r=0,a=e.data.length;r<a;++r)s.push(i.getPixelForValue(this.getParsed(r)[i.axis],r));let o=t.barThickness;return{min:o||Ym(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:i},options:{base:s,minBarLength:r}}=this,a=s||0,o=this.getParsed(t),l=o._custom,c=Ma(l),u=o[e.axis],d=0,g=i?this.applyStack(e,o,i):u,p,b;g!==u&&(d=g-u,g=u),c&&(u=l.barStart,g=l.barEnd-l.barStart,u!==0&&Te(u)!==Te(l.barEnd)&&(d=0),d+=u);let x=!vt(s)&&!c?s:d,M=e.getPixelForValue(x);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(d+g):p=M,b=p-M,Math.abs(b)<r){b=Um(b,e,a)*r,u===a&&(M-=b/2);let C=e.getPixelForDecimal(0),P=e.getPixelForDecimal(1),$=Math.min(C,P),R=Math.max(C,P);M=Math.max(Math.min(M,R),$),p=M+b}if(M===e.getPixelForValue(a)){let C=Te(b)*e.getLineWidthForValue(a)/2;M+=C,b-=C}return{size:b,base:M,head:p,center:p+b/2}}_calculateBarIndexPixels(t,e){let i=e.scale,s=this.options,r=s.skipNull,a=at(s.maxBarThickness,1/0),o,l;if(e.grouped){let c=r?this._getStackCount(t):e.stackCount,u=s.barThickness==="flex"?Gm(t,e,s,c):qm(t,e,s,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0);o=u.start+u.chunk*d+u.chunk/2,l=Math.min(a,u.chunk*u.ratio)}else o=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:o-l/2,head:o+l/2,center:o,size:l}}draw(){let t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length,r=0;for(;r<s;++r)this.getParsed(r)[e.axis]!==null&&i[r].draw(this._ctx)}};Mi.id="bar";Mi.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};Mi.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};var Ci=class extends ke{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){let r=super.parsePrimitiveData(t,e,i,s);for(let a=0;a<r.length;a++)r[a]._custom=this.resolveDataElementOptions(a+i).radius;return r}parseArrayData(t,e,i,s){let r=super.parseArrayData(t,e,i,s);for(let a=0;a<r.length;a++){let o=e[i+a];r[a]._custom=at(o[2],this.resolveDataElementOptions(a+i).radius)}return r}parseObjectData(t,e,i,s){let r=super.parseObjectData(t,e,i,s);for(let a=0;a<r.length;a++){let o=e[i+a];r[a]._custom=at(o&&o.r&&+o.r,this.resolveDataElementOptions(a+i).radius)}return r}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,{xScale:i,yScale:s}=e,r=this.getParsed(t),a=i.getLabelForValue(r.x),o=s.getLabelForValue(r.y),l=r._custom;return{label:e.label,value:"("+a+", "+o+(l?", "+l:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){let r=s==="reset",{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),u=a.axis,d=o.axis;for(let g=e;g<e+i;g++){let p=t[g],b=!r&&this.getParsed(g),x={},M=x[u]=r?a.getPixelForDecimal(.5):a.getPixelForValue(b[u]),C=x[d]=r?o.getBasePixel():o.getPixelForValue(b[d]);x.skip=isNaN(M)||isNaN(C),c&&(x.options=l||this.resolveDataElementOptions(g,p.active?"active":s),r&&(x.options.radius=0)),this.updateElement(p,g,x,s)}}resolveDataElementOptions(t,e){let i=this.getParsed(t),s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));let r=s.radius;return e!=="active"&&(s.radius=0),s.radius+=at(i&&i._custom,r),s}};Ci.id="bubble";Ci.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};Ci.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title(){return""}}}}};function tb(n,t,e){let i=1,s=1,r=0,a=0;if(t<Et){let o=n,l=o+t,c=Math.cos(o),u=Math.sin(o),d=Math.cos(l),g=Math.sin(l),p=($,R,F)=>Un($,o,l,!0)?1:Math.max(R,R*e,F,F*e),b=($,R,F)=>Un($,o,l,!0)?-1:Math.min(R,R*e,F,F*e),x=p(0,c,d),M=p(Bt,u,g),C=b($t,c,d),P=b($t+Bt,u,g);i=(x-C)/2,s=(M-P)/2,r=-(x+C)/2,a=-(M+P)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:a}}var Dn=class extends ke{constructor(t,e){super(t,e);this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if(ft(i[t])){let{key:l="value"}=this._parsing;r=c=>+We(i[c],l)}let a,o;for(a=t,o=t+e;a<o;++a)s._parsed[a]=r(a)}}_getRotation(){return ye(this.options.rotation-90)}_getCircumference(){return ye(this.options.circumference)}_getRotationExtents(){let t=Et,e=-Et;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)){let s=this.chart.getDatasetMeta(i).controller,r=s._getRotation(),a=s._getCircumference();t=Math.min(t,r),e=Math.max(e,r+a)}return{rotation:t,circumference:e-t}}update(t){let e=this.chart,{chartArea:i}=e,s=this._cachedMeta,r=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,o=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(Pl(this.options.cutout,o),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:g,ratioY:p,offsetX:b,offsetY:x}=tb(d,u,l),M=(i.width-a)/g,C=(i.height-a)/p,P=Math.max(Math.min(M,C)/2,0),$=Nr(this.options.radius,P),R=Math.max($*l,0),F=($-R)/this._getVisibleDatasetWeightTotal();this.offsetX=b*$,this.offsetY=x*$,s.total=this.calculateTotal(),this.outerRadius=$-F*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-F*c,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){let i=this.options,s=this._cachedMeta,r=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*r/Et)}updateElements(t,e,i,s){let r=s==="reset",a=this.chart,o=a.chartArea,c=a.options.animation,u=(o.left+o.right)/2,d=(o.top+o.bottom)/2,g=r&&c.animateScale,p=g?0:this.innerRadius,b=g?0:this.outerRadius,{sharedOptions:x,includeOptions:M}=this._getSharedOptions(e,s),C=this._getRotation(),P;for(P=0;P<e;++P)C+=this._circumference(P,r);for(P=e;P<e+i;++P){let $=this._circumference(P,r),R=t[P],F={x:u+this.offsetX,y:d+this.offsetY,startAngle:C,endAngle:C+$,circumference:$,outerRadius:b,innerRadius:p};M&&(F.options=x||this.resolveDataElementOptions(P,R.active?"active":s)),C+=$,this.updateElement(R,P,F,s)}}calculateTotal(){let t=this._cachedMeta,e=t.data,i=0,s;for(s=0;s<e.length;s++){let r=t._parsed[s];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(r))}return i}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?Et*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=ni(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0,i=this.chart,s,r,a,o,l;if(!t){for(s=0,r=i.data.datasets.length;s<r;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,o=a.controller;break}}if(!t)return 0;for(s=0,r=t.length;s<r;++s)l=o.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){let r=this.resolveDataElementOptions(i);e=Math.max(e,r.offset||0,r.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(at(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}};Dn.id="doughnut";Dn.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"};Dn.descriptors={_scriptable:n=>n!=="spacing",_indexable:n=>n!=="spacing"};Dn.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){let t=n.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:e}}=n.legend.options;return t.labels.map((i,s)=>{let a=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,lineWidth:a.borderWidth,pointStyle:e,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){let t=n.label,e=": "+n.formattedValue;return Dt(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};var Ti=class extends ke{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,a=this.chart._animationsDisabled,{start:o,count:l}=Zr(e,s,a);this._drawStart=o,this._drawCount=l,Jr(e)&&(o=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(s,o,l,t)}updateElements(t,e,i,s){let r=s==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(e,s),g=a.axis,p=o.axis,{spanGaps:b,segment:x}=this.options,M=Tn(b)?b:Number.POSITIVE_INFINITY,C=this.chart._animationsDisabled||r||s==="none",P=e>0&&this.getParsed(e-1);for(let $=e;$<e+i;++$){let R=t[$],F=this.getParsed($),z=C?R:{},N=vt(F[p]),X=z[g]=a.getPixelForValue(F[g],$),U=z[p]=r||N?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,F,l):F[p],$);z.skip=isNaN(X)||isNaN(U)||N,z.stop=$>0&&Math.abs(F[g]-P[g])>M,x&&(z.parsed=F,z.raw=c.data[$]),d&&(z.options=u||this.resolveDataElementOptions($,R.active?"active":s)),C||this.updateElement(R,$,z,s),P=F}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let r=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};Ti.id="line";Ti.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};Ti.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};var Pi=class extends ke{constructor(t,e){super(t,e);this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=ni(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return da.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{let r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(r<e.min&&(e.min=r),r>e.max&&(e.max=r))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),o=(r-a)/t.getVisibleDatasetCount();this.outerRadius=r-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){let r=s==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,d=c.yCenter,g=c.getIndexAngle(0)-.5*$t,p=g,b,x=360/this.countVisibleElements();for(b=0;b<e;++b)p+=this._computeAngle(b,s,x);for(b=e;b<e+i;b++){let M=t[b],C=p,P=p+this._computeAngle(b,s,x),$=a.getDataVisibility(b)?c.getDistanceFromCenterForValue(this.getParsed(b).r):0;p=P,r&&(l.animateScale&&($=0),l.animateRotate&&(C=P=g));let R={x:u,y:d,innerRadius:0,outerRadius:$,startAngle:C,endAngle:P,options:this.resolveDataElementOptions(b,M.active?"active":s)};this.updateElement(M,b,R,s)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?ye(this.resolveDataElementOptions(t,e).angle||i):0}};Pi.id="polarArea";Pi.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Pi.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){let t=n.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:e}}=n.legend.options;return t.labels.map((i,s)=>{let a=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,lineWidth:a.borderWidth,pointStyle:e,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){return n.chart.data.labels[n.dataIndex]+": "+n.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};var Es=class extends Dn{};Es.id="pie";Es.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};var Ei=class extends ke{getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return da.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let o={_loop:!0,_fullLoop:r.length===s.length,options:a};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let r=this._cachedMeta.rScale,a=s==="reset";for(let o=e;o<e+i;o++){let l=t[o],c=this.resolveDataElementOptions(o,l.active?"active":s),u=r.getPointPositionForValue(o,this.getParsed(o).r),d=a?r.xCenter:u.x,g=a?r.yCenter:u.y,p={x:d,y:g,angle:u.angle,skip:isNaN(d)||isNaN(g),options:c};this.updateElement(l,o,p,s)}}};Ei.id="radar";Ei.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};Ei.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};var we=class{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Tn(this.x)&&Tn(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}};we.defaults={};we.defaultRoutes=void 0;var Fc={values(n){return Dt(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";let i=this.chart.options.locale,s,r=n;if(e.length>1){let c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=eb(n,e)}let a=ve(Math.abs(r)),o=Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:o,maximumFractionDigits:o};return Object.assign(l,this.options.ticks.format),ni(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";let i=n/Math.pow(10,Math.floor(ve(n)));return i===1||i===2||i===5?Fc.numeric.call(this,n,t,e):""}};function eb(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var Os={formatters:Fc};dt.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(n,t)=>t.lineWidth,tickColor:(n,t)=>t.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth: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:Os.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});dt.route("scale.ticks","color","","color");dt.route("scale.grid","color","","borderColor");dt.route("scale.grid","borderColor","","borderColor");dt.route("scale.title","color","","color");dt.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});dt.describe("scales",{_fallback:"scale"});dt.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function nb(n,t){let e=n.options.ticks,i=e.maxTicksLimit||ib(n),s=e.major.enabled?rb(t):[],r=s.length,a=s[0],o=s[r-1],l=[];if(r>i)return ab(t,l,s,r/i),l;let c=sb(s,t,i);if(r>0){let u,d,g=r>1?Math.round((o-a)/(r-1)):null;for(Ds(t,l,c,vt(g)?0:a-g,a),u=0,d=r-1;u<d;u++)Ds(t,l,c,s[u],s[u+1]);return Ds(t,l,c,o,vt(g)?t.length:o+g),l}return Ds(t,l,c),l}function ib(n){let t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function sb(n,t,e){let i=ob(n),s=t.length/e;if(!i)return Math.max(s,1);let r=Ll(i);for(let a=0,o=r.length-1;a<o;a++){let l=r[a];if(l>s)return l}return Math.max(s,1)}function rb(n){let t=[],e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function ab(n,t,e,i){let s=0,r=e[0],a;for(i=Math.ceil(i),a=0;a<n.length;a++)a===r&&(t.push(n[a]),s++,r=e[s*i])}function Ds(n,t,e,i,s){let r=at(i,0),a=Math.min(at(s,n.length),n.length),o=0,l,c,u;for(e=Math.ceil(e),s&&(l=s-i,e=l/Math.floor(l/e)),u=r;u<0;)o++,u=Math.round(r+o*e);for(c=Math.max(r,0);c<a;c++)c===u&&(t.push(n[c]),o++,u=Math.round(r+o*e))}function ob(n){let t=n.length,e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}var lb=n=>n==="left"?"right":n==="right"?"left":n,$c=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e;function Ic(n,t){let e=[],i=n.length/t,s=n.length,r=0;for(;r<s;r+=i)e.push(n[Math.floor(r)]);return e}function cb(n,t,e){let i=n.ticks.length,s=Math.min(t,i-1),r=n._startPixel,a=n._endPixel,o=1e-6,l=n.getPixelForTick(s),c;if(!(e&&(i===1?c=Math.max(l-r,a-l):t===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<r-o||l>a+o)))return l}function hb(n,t){Mt(n,e=>{let i=e.gc,s=i.length/2,r;if(s>t){for(r=0;r<s;++r)delete e.data[i[r]];i.splice(0,s)}})}function Oi(n){return n.drawTicks?n.tickLength:0}function zc(n,t){if(!n.display)return 0;let e=qt(n.font,t),i=ie(n.padding);return(Dt(n.text)?n.text.length:1)*e.lineHeight+i.height}function ub(n,t){return Ge(n,{scale:t,type:"scale"})}function fb(n,t,e){return Ge(n,{tick:e,index:t,type:"tick"})}function db(n,t,e){let i=ms(n);return(e&&t!=="right"||!e&&t==="right")&&(i=lb(i)),i}function pb(n,t,e,i){let{top:s,left:r,bottom:a,right:o,chart:l}=n,{chartArea:c,scales:u}=l,d=0,g,p,b,x=a-s,M=o-r;if(n.isHorizontal()){if(p=ne(i,r,o),ft(e)){let C=Object.keys(e)[0],P=e[C];b=u[C].getPixelForValue(P)+x-t}else e==="center"?b=(c.bottom+c.top)/2+x-t:b=$c(n,e,t);g=o-r}else{if(ft(e)){let C=Object.keys(e)[0],P=e[C];p=u[C].getPixelForValue(P)-M+t}else e==="center"?p=(c.left+c.right)/2-M+t:p=$c(n,e,t);b=ne(i,a,s),d=e==="left"?-Bt:Bt}return{titleX:p,titleY:b,maxWidth:g,rotation:d}}var mn=class extends we{constructor(t){super();this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=me(t,Number.POSITIVE_INFINITY),e=me(e,Number.NEGATIVE_INFINITY),i=me(i,Number.POSITIVE_INFINITY),s=me(s,Number.NEGATIVE_INFINITY),{min:me(t,i),max:me(e,s),minDefined:jt(t),maxDefined:jt(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:r}=this.getUserBounds(),a;if(s&&r)return{min:e,max:i};let o=this.getMatchingVisibleMetas();for(let l=0,c=o.length;l<c;++l)a=o[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),r||(i=Math.max(i,a.max));return e=r&&e>i?i:e,i=s&&e>i?e:i,{min:me(e,me(i,e)),max:me(i,me(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){At(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:s,grace:r,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ic(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=o<this.ticks.length;this._convertTicksToLabels(l?Ic(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=nb(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){At(this.options.afterUpdate,[this])}beforeSetDimensions(){At(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(){At(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),At(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){At(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,i,s,r;for(i=0,s=t.length;i<s;i++)r=t[i],r.label=At(e.callback,[r.value,i,t],this)}afterTickToLabelConversion(){At(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){At(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,i=this.ticks.length,s=e.minRotation||0,r=e.maxRotation,a=s,o,l,c;if(!this._isVisible()||!e.display||s>=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}let u=this._getLabelSizes(),d=u.widest.width,g=u.highest.height,p=Gt(this.chart.width-d,0,this.maxWidth);o=t.offset?this.maxWidth/i:p/(i-1),d+6>o&&(o=p/(i-(t.offset?.5:1)),l=this.maxHeight-Oi(t.grid)-e.padding-zc(t.title,this.chart.options.font),c=Math.sqrt(d*d+g*g),a=ds(Math.min(Math.asin(Gt((u.highest.height+6)/o,-1,1)),Math.asin(Gt(l/c,-1,1))-Math.asin(Gt(g/c,-1,1)))),a=Math.max(s,Math.min(r,a))),this.labelRotation=a}afterCalculateLabelRotation(){At(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){At(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let l=zc(s,e.options.font);if(o?(t.width=this.maxWidth,t.height=Oi(r)+l):(t.height=this.maxHeight,t.width=Oi(r)+l),i.display&&this.ticks.length){let{first:c,last:u,widest:d,highest:g}=this._getLabelSizes(),p=i.padding*2,b=ye(this.labelRotation),x=Math.cos(b),M=Math.sin(b);if(o){let C=i.mirror?0:M*d.width+x*g.height;t.height=Math.min(this.maxHeight,t.height+C+p)}else{let C=i.mirror?0:x*d.width+M*g.height;t.width=Math.min(this.maxWidth,t.width+C+p)}this._calculatePadding(c,u,M,x)}}this._handleMargins(),o?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){let{ticks:{align:r,padding:a},position:o}=this.options,l=this.labelRotation!==0,c=o!=="top"&&this.axis==="x";if(this.isHorizontal()){let u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),g=0,p=0;l?c?(g=s*t.width,p=i*e.height):(g=i*t.height,p=s*e.width):r==="start"?p=e.width:r==="end"?g=t.width:r!=="inner"&&(g=t.width/2,p=e.width/2),this.paddingLeft=Math.max((g-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((p-d+a)*this.width/(this.width-d),0)}else{let u=e.height/2,d=t.height/2;r==="start"?(u=0,d=t.height):r==="end"&&(u=e.height,d=0),this.paddingTop=u+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){At(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)vt(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=Ic(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length)}return t}_computeLabelSizes(t,e){let{ctx:i,_longestTextCache:s}=this,r=[],a=[],o=0,l=0,c,u,d,g,p,b,x,M,C,P,$;for(c=0;c<e;++c){if(g=t[c].label,p=this._resolveTickFontOptions(c),i.font=b=p.string,x=s[b]=s[b]||{data:{},gc:[]},M=p.lineHeight,C=P=0,!vt(g)&&!Dt(g))C=xi(i,x.data,x.gc,C,g),P=M;else if(Dt(g))for(u=0,d=g.length;u<d;++u)$=g[u],!vt($)&&!Dt($)&&(C=xi(i,x.data,x.gc,C,$),P+=M);r.push(C),a.push(P),o=Math.max(C,o),l=Math.max(P,l)}hb(s,e);let R=r.indexOf(o),F=a.indexOf(l),z=N=>({width:r[N]||0,height:a[N]||0});return{first:z(0),last:z(e-1),widest:z(R),highest:z(F),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return Fl(this._alignToPixels?un(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&t<e.length){let i=e[t];return i.$context||(i.$context=fb(this.getContext(),t,i))}return this.$context||(this.$context=ub(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=ye(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),r=this._getLabelSizes(),a=t.autoSkipPadding||0,o=r?r.widest.width+a:0,l=r?r.highest.height+a:0;return this.isHorizontal()?l*i>o*s?o/i:l/s:l*s<o*i?l/i:o/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,i=this.chart,s=this.options,{grid:r,position:a}=s,o=r.offset,l=this.isHorizontal(),u=this.ticks.length+(o?1:0),d=Oi(r),g=[],p=r.setContext(this.getContext()),b=p.drawBorder?p.borderWidth:0,x=b/2,M=function(et){return un(i,et,b)},C,P,$,R,F,z,N,X,U,nt,ot,st;if(a==="top")C=M(this.bottom),z=this.bottom-d,X=C-x,nt=M(t.top)+x,st=t.bottom;else if(a==="bottom")C=M(this.top),nt=t.top,st=M(t.bottom)-x,z=C+x,X=this.top+d;else if(a==="left")C=M(this.right),F=this.right-d,N=C-x,U=M(t.left)+x,ot=t.right;else if(a==="right")C=M(this.left),U=t.left,ot=M(t.right)-x,F=C+x,N=this.left+d;else if(e==="x"){if(a==="center")C=M((t.top+t.bottom)/2+.5);else if(ft(a)){let et=Object.keys(a)[0],Ct=a[et];C=M(this.chart.scales[et].getPixelForValue(Ct))}nt=t.top,st=t.bottom,z=C+x,X=z+d}else if(e==="y"){if(a==="center")C=M((t.left+t.right)/2);else if(ft(a)){let et=Object.keys(a)[0],Ct=a[et];C=M(this.chart.scales[et].getPixelForValue(Ct))}F=C-x,N=F-d,U=t.left,ot=t.right}let kt=at(s.ticks.maxTicksLimit,u),Ft=Math.max(1,Math.ceil(u/kt));for(P=0;P<u;P+=Ft){let et=r.setContext(this.getContext(P)),Ct=et.lineWidth,yt=et.color,Qt=et.borderDash||[],de=et.borderDashOffset,rt=et.tickWidth,Ot=et.tickColor,It=et.tickBorderDash||[],Wt=et.tickBorderDashOffset;$=cb(this,P,o),$!==void 0&&(R=un(i,$,Ct),l?F=N=U=ot=R:z=X=nt=st=R,g.push({tx1:F,ty1:z,tx2:N,ty2:X,x1:U,y1:nt,x2:ot,y2:st,width:Ct,color:yt,borderDash:Qt,borderDashOffset:de,tickWidth:rt,tickColor:Ot,tickBorderDash:It,tickBorderDashOffset:Wt}))}return this._ticksLength=u,this._borderValue=C,g}_computeLabelItems(t){let e=this.axis,i=this.options,{position:s,ticks:r}=i,a=this.isHorizontal(),o=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=r,g=Oi(i.grid),p=g+u,b=d?-u:p,x=-ye(this.labelRotation),M=[],C,P,$,R,F,z,N,X,U,nt,ot,st,kt="middle";if(s==="top")z=this.bottom-b,N=this._getXAxisLabelAlignment();else if(s==="bottom")z=this.top+b,N=this._getXAxisLabelAlignment();else if(s==="left"){let et=this._getYAxisLabelAlignment(g);N=et.textAlign,F=et.x}else if(s==="right"){let et=this._getYAxisLabelAlignment(g);N=et.textAlign,F=et.x}else if(e==="x"){if(s==="center")z=(t.top+t.bottom)/2+p;else if(ft(s)){let et=Object.keys(s)[0],Ct=s[et];z=this.chart.scales[et].getPixelForValue(Ct)+p}N=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")F=(t.left+t.right)/2-p;else if(ft(s)){let et=Object.keys(s)[0],Ct=s[et];F=this.chart.scales[et].getPixelForValue(Ct)}N=this._getYAxisLabelAlignment(g).textAlign}e==="y"&&(l==="start"?kt="top":l==="end"&&(kt="bottom"));let Ft=this._getLabelSizes();for(C=0,P=o.length;C<P;++C){$=o[C],R=$.label;let et=r.setContext(this.getContext(C));X=this.getPixelForTick(C)+r.labelOffset,U=this._resolveTickFontOptions(C),nt=U.lineHeight,ot=Dt(R)?R.length:1;let Ct=ot/2,yt=et.color,Qt=et.textStrokeColor,de=et.textStrokeWidth,rt=N;a?(F=X,N==="inner"&&(C===P-1?rt=this.options.reverse?"left":"right":C===0?rt=this.options.reverse?"right":"left":rt="center"),s==="top"?c==="near"||x!==0?st=-ot*nt+nt/2:c==="center"?st=-Ft.highest.height/2-Ct*nt+nt:st=-Ft.highest.height+nt/2:c==="near"||x!==0?st=nt/2:c==="center"?st=Ft.highest.height/2-Ct*nt:st=Ft.highest.height-ot*nt,d&&(st*=-1)):(z=X,st=(1-ot)*nt/2);let Ot;if(et.showLabelBackdrop){let It=ie(et.backdropPadding),Wt=Ft.heights[C],Ut=Ft.widths[C],w=z+st-It.top,v=F-It.left;switch(kt){case"middle":w-=Wt/2;break;case"bottom":w-=Wt;break}switch(N){case"center":v-=Ut/2;break;case"right":v-=Ut;break}Ot={left:v,top:w,width:Ut+It.width,height:Wt+It.height,color:et.backdropColor}}M.push({rotation:x,label:R,font:U,color:yt,strokeColor:Qt,strokeWidth:de,textOffset:st,textAlign:rt,textBaseline:kt,translation:[F,z],backdrop:Ot})}return M}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-ye(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,a=this._getLabelSizes(),o=t+r,l=a.widest.width,c,u;return e==="left"?s?(u=this.right+r,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):e==="right"?s?(u=this.left+r,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:s,width:r,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,r,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),r,a,o=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,a=s.length;r<a;++r){let l=s[r];e.drawOnChartArea&&o({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&o({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:e,options:{grid:i}}=this,s=i.setContext(this.getContext()),r=i.drawBorder?s.borderWidth:0;if(!r)return;let a=i.setContext(this.getContext(0)).lineWidth,o=this._borderValue,l,c,u,d;this.isHorizontal()?(l=un(t,this.left,r)-r/2,c=un(t,this.right,a)+a/2,u=d=o):(u=un(t,this.top,r)-r/2,d=un(t,this.bottom,a)+a/2,l=c=o),e.save(),e.lineWidth=s.borderWidth,e.strokeStyle=s.borderColor,e.beginPath(),e.moveTo(l,u),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;let i=this.ctx,s=this._computeLabelArea();s&&ki(i,s);let r=this._labelItems||(this._labelItems=this._computeLabelItems(t)),a,o;for(a=0,o=r.length;a<o;++a){let l=r[a],c=l.font,u=l.label;l.backdrop&&(i.fillStyle=l.backdrop.color,i.fillRect(l.backdrop.left,l.backdrop.top,l.backdrop.width,l.backdrop.height));let d=l.textOffset;fn(i,u,0,d,c,l)}s&&wi(i)}drawTitle(){let{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;let r=qt(i.font),a=ie(i.padding),o=i.align,l=r.lineHeight/2;e==="bottom"||e==="center"||ft(e)?(l+=a.bottom,Dt(i.text)&&(l+=r.lineHeight*(i.text.length-1))):l+=a.top;let{titleX:c,titleY:u,maxWidth:d,rotation:g}=pb(this,l,e,o);fn(t,i.text,0,0,r,{color:i.color,maxWidth:d,rotation:g,textAlign:db(o,e,s),textBaseline:"middle",translation:[c,u]})}draw(t){!this._isVisible()||(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,i=at(t.grid&&t.grid.z,-1);return!this._isVisible()||this.draw!==mn.prototype.draw?[{z:e,draw:s=>{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[],r,a;for(r=0,a=e.length;r<a;++r){let o=e[r];o[i]===this.id&&(!t||o.type===t)&&s.push(o)}return s}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return qt(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},Di=class{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),i;bb(e)&&(i=this.register(e));let s=this.items,r=t.id,a=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in s||(s[r]=t,gb(t,a,i),this.override&&dt.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in dt[s]&&(delete dt[s][i],this.override&&delete hn[i])}};function gb(n,t,e){let i=qn(Object.create(null),[e?dt.get(e):{},dt.get(t),n.defaults]);dt.set(t,i),n.defaultRoutes&&mb(t,n.defaultRoutes),n.descriptors&&dt.describe(t,n.descriptors)}function mb(n,t){Object.keys(t).forEach(e=>{let i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),a=t[e].split("."),o=a.pop(),l=a.join(".");dt.route(r,s,l,o)})}function bb(n){return"id"in n&&"defaults"in n}var Bc=class{constructor(){this.controllers=new Di(ke,"datasets",!0),this.elements=new Di(we,"elements"),this.plugins=new Di(Object,"plugins"),this.scales=new Di(mn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{let r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):Mt(s,a=>{let o=i||this._getRegistryForType(a);this._exec(t,o,a)})})}_exec(t,e,i){let s=us(t);At(i["before"+s],[],i),e[t](i),At(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}},$e=new Bc,Ai=class extends ke{update(t){let e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled,{start:r,count:a}=Zr(e,i,s);if(this._drawStart=r,this._drawCount=a,Jr(e)&&(r=0,a=i.length),this.options.showLine){let{dataset:o,_dataset:l}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!l._decimated,o.points=i;let c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(o,void 0,{animated:!s,options:c},t)}this.updateElements(i,r,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=$e.getElement("line")),super.addElements()}updateElements(t,e,i,s){let r=s==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(e,s),d=this.getSharedOptions(u),g=this.includeOptions(s,d),p=a.axis,b=o.axis,{spanGaps:x,segment:M}=this.options,C=Tn(x)?x:Number.POSITIVE_INFINITY,P=this.chart._animationsDisabled||r||s==="none",$=e>0&&this.getParsed(e-1);for(let R=e;R<e+i;++R){let F=t[R],z=this.getParsed(R),N=P?F:{},X=vt(z[b]),U=N[p]=a.getPixelForValue(z[p],R),nt=N[b]=r||X?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,z,l):z[b],R);N.skip=isNaN(U)||isNaN(nt)||X,N.stop=R>0&&Math.abs(z[p]-$[p])>C,M&&(N.parsed=z,N.raw=c.data[R]),g&&(N.options=d||this.resolveDataElementOptions(R,F.active?"active":s)),P||this.updateElement(F,R,N,s),$=z}this.updateSharedOptions(d,s,u)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let o=0;for(let l=e.length-1;l>=0;--l)o=Math.max(o,e[l].size(this.resolveDataElementOptions(l))/2);return o>0&&o}let i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;let r=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,a)/2}};Ai.id="scatter";Ai.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};Ai.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(n){return"("+n.label+", "+n.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var vb=Object.freeze({__proto__:null,BarController:Mi,BubbleController:Ci,DoughnutController:Dn,LineController:Ti,PolarAreaController:Pi,PieController:Es,RadarController:Ei,ScatterController:Ai});function An(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var As=class{constructor(t){this.options=t||{}}init(t){}formats(){return An()}parse(t,e){return An()}format(t,e){return An()}add(t,e,i){return An()}diff(t,e,i){return An()}startOf(t,e,i){return An()}endOf(t,e){return An()}};As.override=function(n){Object.assign(As.prototype,n)};var Ca={_date:As};function _b(n,t,e,i){let{controller:s,data:r,_sorted:a}=n,o=s._cachedMeta.iScale;if(o&&t===o.axis&&t!=="r"&&a&&r.length){let l=o._reversePixels?$l:Fe;if(i){if(s._sharedOptions){let c=r[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){let d=l(r,t,e-u),g=l(r,t,e+u);return{lo:d.lo,hi:g.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function Li(n,t,e,i,s){let r=n.getSortedVisibleDatasetMetas(),a=e[t];for(let o=0,l=r.length;o<l;++o){let{index:c,data:u}=r[o],{lo:d,hi:g}=_b(r[o],t,a,s);for(let p=d;p<=g;++p){let b=u[p];b.skip||i(b,c,p)}}}function yb(n){let t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){let r=t?Math.abs(i.x-s.x):0,a=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(a,2))}}function Ta(n,t,e,i,s){let r=[];return!s&&!n.isPointInArea(t)||Li(n,e,t,function(o,l,c){!s&&!Jn(o,n.chartArea,0)||o.inRange(t.x,t.y,i)&&r.push({element:o,datasetIndex:l,index:c})},!0),r}function xb(n,t,e,i){let s=[];function r(a,o,l){let{startAngle:c,endAngle:u}=a.getProps(["startAngle","endAngle"],i),{angle:d}=qr(a,{x:t.x,y:t.y});Un(d,c,u)&&s.push({element:a,datasetIndex:o,index:l})}return Li(n,e,t,r),s}function kb(n,t,e,i,s,r){let a=[],o=yb(e),l=Number.POSITIVE_INFINITY;function c(u,d,g){let p=u.inRange(t.x,t.y,s);if(i&&!p)return;let b=u.getCenterPoint(s);if(!(!!r||n.isPointInArea(b))&&!p)return;let M=o(t,b);M<l?(a=[{element:u,datasetIndex:d,index:g}],l=M):M===l&&a.push({element:u,datasetIndex:d,index:g})}return Li(n,e,t,c),a}function Pa(n,t,e,i,s,r){return!r&&!n.isPointInArea(t)?[]:e==="r"&&!i?xb(n,t,e,s):kb(n,t,e,i,s,r)}function jc(n,t,e,i,s){let r=[],a=e==="x"?"inXRange":"inYRange",o=!1;return Li(n,e,t,(l,c,u)=>{l[a](t[e],s)&&(r.push({element:l,datasetIndex:c,index:u}),o=o||l.inRange(t.x,t.y,s))}),i&&!o?[]:r}var wb={evaluateInteractionItems:Li,modes:{index(n,t,e,i){let s=pn(t,n),r=e.axis||"x",a=e.includeInvisible||!1,o=e.intersect?Ta(n,s,r,i,a):Pa(n,s,r,!1,i,a),l=[];return o.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{let u=o[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(n,t,e,i){let s=pn(t,n),r=e.axis||"xy",a=e.includeInvisible||!1,o=e.intersect?Ta(n,s,r,i,a):Pa(n,s,r,!1,i,a);if(o.length>0){let l=o[0].datasetIndex,c=n.getDatasetMeta(l).data;o=[];for(let u=0;u<c.length;++u)o.push({element:c[u],datasetIndex:l,index:u})}return o},point(n,t,e,i){let s=pn(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;return Ta(n,s,r,i,a)},nearest(n,t,e,i){let s=pn(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;return Pa(n,s,r,e.intersect,i,a)},x(n,t,e,i){let s=pn(t,n);return jc(n,s,"x",e.intersect,i)},y(n,t,e,i){let s=pn(t,n);return jc(n,s,"y",e.intersect,i)}}},Nc=["left","top","right","bottom"];function Ri(n,t){return n.filter(e=>e.pos===t)}function Hc(n,t){return n.filter(e=>Nc.indexOf(e.pos)===-1&&e.box.axis===t)}function Fi(n,t){return n.sort((e,i)=>{let s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function Sb(n){let t=[],e,i,s,r,a,o;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:r,options:{stack:a,stackWeight:o=1}}=s,t.push({index:e,box:s,pos:r,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&r+a,stackWeight:o});return t}function Mb(n){let t={};for(let e of n){let{stack:i,pos:s,stackWeight:r}=e;if(!i||!Nc.includes(s))continue;let a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=r}return t}function Cb(n,t){let e=Mb(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t,r,a,o;for(r=0,a=n.length;r<a;++r){o=n[r];let{fullSize:l}=o.box,c=e[o.stack],u=c&&o.stackWeight/c.weight;o.horizontal?(o.width=u?u*i:l&&t.availableWidth,o.height=s):(o.width=i,o.height=u?u*s:l&&t.availableHeight)}return e}function Tb(n){let t=Sb(n),e=Fi(t.filter(c=>c.box.fullSize),!0),i=Fi(Ri(t,"left"),!0),s=Fi(Ri(t,"right")),r=Fi(Ri(t,"top"),!0),a=Fi(Ri(t,"bottom")),o=Hc(t,"x"),l=Hc(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(a).concat(o),chartArea:Ri(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(a).concat(o)}}function Vc(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Wc(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function Pb(n,t,e,i){let{pos:s,box:r}=e,a=n.maxPadding;if(!ft(s)){e.size&&(n[s]-=e.size);let d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?r.height:r.width),e.size=d.size/d.count,n[s]+=e.size}r.getPadding&&Wc(a,r.getPadding());let o=Math.max(0,t.outerWidth-Vc(a,n,"left","right")),l=Math.max(0,t.outerHeight-Vc(a,n,"top","bottom")),c=o!==n.w,u=l!==n.h;return n.w=o,n.h=l,e.horizontal?{same:c,other:u}:{same:u,other:c}}function Eb(n){let t=n.maxPadding;function e(i){let s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function Ob(n,t){let e=t.maxPadding;function i(s){let r={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{r[a]=Math.max(t[a],e[a])}),r}return i(n?["left","right"]:["top","bottom"])}function $i(n,t,e,i){let s=[],r,a,o,l,c,u;for(r=0,a=n.length,c=0;r<a;++r){o=n[r],l=o.box,l.update(o.width||t.w,o.height||t.h,Ob(o.horizontal,t));let{same:d,other:g}=Pb(t,e,o,i);c|=d&&s.length,u=u||g,l.fullSize||s.push(o)}return c&&$i(s,t,e,i)||u}function Ls(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Yc(n,t,e,i){let s=e.padding,{x:r,y:a}=t;for(let o of n){let l=o.box,c=i[o.stack]||{count:1,placed:0,weight:1},u=o.stackWeight/c.weight||1;if(o.horizontal){let d=t.w*u,g=c.size||l.height;be(c.start)&&(a=c.start),l.fullSize?Ls(l,s.left,a,e.outerWidth-s.right-s.left,g):Ls(l,t.left+c.placed,a,d,g),c.start=a,c.placed+=d,a=l.bottom}else{let d=t.h*u,g=c.size||l.width;be(c.start)&&(r=c.start),l.fullSize?Ls(l,r,s.top,g,e.outerHeight-s.bottom-s.top):Ls(l,r,t.top+c.placed,g,d),c.start=r,c.placed+=d,r=l.right}}t.x=r,t.y=a}dt.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var re={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){let e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;let s=ie(n.options.layout.padding),r=Math.max(t-s.width,0),a=Math.max(e-s.height,0),o=Tb(n.boxes),l=o.vertical,c=o.horizontal;Mt(n.boxes,x=>{typeof x.beforeLayout=="function"&&x.beforeLayout()});let u=l.reduce((x,M)=>M.box.options&&M.box.options.display===!1?x:x+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:a,vBoxMaxWidth:r/2/u,hBoxMaxHeight:a/2}),g=Object.assign({},s);Wc(g,ie(i));let p=Object.assign({maxPadding:g,w:r,h:a,x:s.left,y:s.top},s),b=Cb(l.concat(c),d);$i(o.fullSize,p,d,b),$i(l,p,d,b),$i(c,p,d,b)&&$i(l,p,d,b),Eb(p),Yc(o.leftAndTop,p,d,b),p.x+=p.w,p.y+=p.h,Yc(o.rightAndBottom,p,d,b),n.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Mt(o.chartArea,x=>{let M=x.box;Object.assign(M,n.chartArea),M.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},Ea=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},qc=class extends Ea{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Rs="$chartjs",Db={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Gc=n=>n===null||n==="";function Ab(n,t){let e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[Rs]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Gc(s)){let r=ba(n,"width");r!==void 0&&(n.width=r)}if(Gc(i))if(n.style.height==="")n.height=n.width/(t||2);else{let r=ba(n,"height");r!==void 0&&(n.height=r)}return n}var Xc=fc?{passive:!0}:!1;function Lb(n,t,e){n.addEventListener(t,e,Xc)}function Rb(n,t,e){n.canvas.removeEventListener(t,e,Xc)}function Fb(n,t){let e=Db[n.type]||n.type,{x:i,y:s}=pn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Fs(n,t){for(let e of n)if(e===t||e.contains(t))return!0}function $b(n,t,e){let i=n.canvas,s=new MutationObserver(r=>{let a=!1;for(let o of r)a=a||Fs(o.addedNodes,i),a=a&&!Fs(o.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Ib(n,t,e){let i=n.canvas,s=new MutationObserver(r=>{let a=!1;for(let o of r)a=a||Fs(o.removedNodes,i),a=a&&!Fs(o.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}var Ii=new Map,Uc=0;function Kc(){let n=window.devicePixelRatio;n!==Uc&&(Uc=n,Ii.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function zb(n,t){Ii.size||window.addEventListener("resize",Kc),Ii.set(n,t)}function Bb(n){Ii.delete(n),Ii.size||window.removeEventListener("resize",Kc)}function jb(n,t,e){let i=n.canvas,s=i&&Cs(i);if(!s)return;let r=Kr((o,l)=>{let c=s.clientWidth;e(o,l),c<s.clientWidth&&e()},window),a=new ResizeObserver(o=>{let l=o[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||r(c,u)});return a.observe(s),zb(n,r),a}function Oa(n,t,e){e&&e.disconnect(),t==="resize"&&Bb(n)}function Nb(n,t,e){let i=n.canvas,s=Kr(r=>{n.ctx!==null&&e(Fb(r,n))},n,r=>{let a=r[0];return[a,a.offsetX,a.offsetY]});return Lb(i,t,s),s}var Zc=class extends Ea{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Ab(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[Rs])return!1;let i=e[Rs].initial;["height","width"].forEach(r=>{let a=i[r];vt(a)?e.removeAttribute(r):e.setAttribute(r,a)});let s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[Rs],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:$b,detach:Ib,resize:jb}[e]||Nb;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Oa,detach:Oa,resize:Oa}[e]||Rb)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return uc(t,e,i,s)}isAttached(t){let e=Cs(t);return!!(e&&e.isConnected)}};function Hb(n){return!pa()||typeof OffscreenCanvas!="undefined"&&n instanceof OffscreenCanvas?qc:Zc}var Jc=class{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));let r=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(r,t,e,i);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,i,s){s=s||{};for(let r of t){let a=r.plugin,o=a[i],l=[e,s,r.options];if(At(o,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){vt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let i=t&&t.config,s=at(i.options&&i.options.plugins,{}),r=Vb(i);return s===!1&&!e?[]:Yb(t,r,s,e)}_notifyStateChanges(t){let e=this._oldCache||[],i=this._cache,s=(r,a)=>r.filter(o=>!a.some(l=>o.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};function Vb(n){let t={},e=[],i=Object.keys($e.plugins.items);for(let r=0;r<i.length;r++)e.push($e.getPlugin(i[r]));let s=n.plugins||[];for(let r=0;r<s.length;r++){let a=s[r];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Wb(n,t){return!t&&n===!1?null:n===!0?{}:n}function Yb(n,{plugins:t,localIds:e},i,s){let r=[],a=n.getContext();for(let o of t){let l=o.id,c=Wb(i[l],s);c!==null&&r.push({plugin:o,options:qb(n.config,{plugin:o,local:e[l]},c,a)})}return r}function qb(n,{plugin:t,local:e},i,s){let r=n.pluginScopeKeys(t),a=n.getOptionScopes(i,r);return e&&t.defaults&&a.push(t.defaults),n.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Da(n,t){let e=dt.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Gb(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function Xb(n,t){return n===t?"_index_":"_value_"}function Ub(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Aa(n,t){return n==="x"||n==="y"?n:t.axis||Ub(t.position)||n.charAt(0).toLowerCase()}function Kb(n,t){let e=hn[n.type]||{scales:{}},i=t.scales||{},s=Da(n.type,t),r=Object.create(null),a=Object.create(null);return Object.keys(i).forEach(o=>{let l=i[o];if(!ft(l))return console.error(`Invalid scale configuration for scale: ${o}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);let c=Aa(o,l),u=Xb(c,s),d=e.scales||{};r[c]=r[c]||o,a[o]=Gn(Object.create(null),[{axis:c},l,d[c],d[u]])}),n.data.datasets.forEach(o=>{let l=o.type||n.type,c=o.indexAxis||Da(l,t),d=(hn[l]||{}).scales||{};Object.keys(d).forEach(g=>{let p=Gb(g,c),b=o[p+"AxisID"]||r[p]||p;a[b]=a[b]||Object.create(null),Gn(a[b],[{axis:p},i[b],d[g]])})}),Object.keys(a).forEach(o=>{let l=a[o];Gn(l,[dt.scales[l.type],dt.scale])}),a}function Qc(n){let t=n.options||(n.options={});t.plugins=at(t.plugins,{}),t.scales=Kb(n,t)}function th(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Zb(n){return n=n||{},n.data=th(n.data),Qc(n),n}var eh=new Map,nh=new Set;function $s(n,t){let e=eh.get(n);return e||(e=t(),eh.set(n,e),nh.add(e)),e}var zi=(n,t,e)=>{let i=We(t,e);i!==void 0&&n.add(i)},ih=class{constructor(t){this._config=Zb(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=th(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),Qc(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return $s(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return $s(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return $s(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return $s(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:s,type:r}=this,a=this._cachedScopes(t,i),o=a.get(e);if(o)return o;let l=new Set;e.forEach(u=>{t&&(l.add(t),u.forEach(d=>zi(l,t,d))),u.forEach(d=>zi(l,s,d)),u.forEach(d=>zi(l,hn[r]||{},d)),u.forEach(d=>zi(l,dt,d)),u.forEach(d=>zi(l,xs,d))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),nh.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,hn[e]||{},dt.datasets[e]||{},{type:e},dt,xs]}resolveNamedOptions(t,e,i,s=[""]){let r={$shared:!0},{resolver:a,subPrefixes:o}=sh(this._resolverCache,t,s),l=a;if(Qb(a,e)){r.$shared=!1,i=Ye(i)?i():i;let c=this.createResolver(t,i,o);l=Pn(a,i,c)}for(let c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){let{resolver:r}=sh(this._resolverCache,t,i);return ft(e)?Pn(r,e,void 0,s):r}};function sh(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));let s=e.join(),r=i.get(s);return r||(r={resolver:Ss(t,e),subPrefixes:e.filter(o=>!o.toLowerCase().includes("hover"))},i.set(s,r)),r}var Jb=n=>ft(n)&&Object.getOwnPropertyNames(n).reduce((t,e)=>t||Ye(n[e]),!1);function Qb(n,t){let{isScriptable:e,isIndexable:i}=ha(n);for(let s of t){let r=e(s),a=i(s),o=(a||r)&&n[s];if(r&&(Ye(o)||Jb(o))||a&&Dt(o))return!0}return!1}var t0="3.9.1",e0=["top","bottom","left","right","chartArea"];function rh(n,t){return n==="top"||n==="bottom"||e0.indexOf(n)===-1&&t==="x"}function ah(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function oh(n){let t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),At(e&&e.onComplete,[n],t)}function n0(n){let t=n.chart,e=t.options.animation;At(e&&e.onProgress,[n],t)}function lh(n){return pa()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}var Is={},ch=n=>{let t=lh(n);return Object.values(Is).filter(e=>e.canvas===t).pop()};function i0(n,t,e){let i=Object.keys(n);for(let s of i){let r=+s;if(r>=t){let a=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=a)}}}function s0(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}var ue=class{constructor(t,e){let i=this.config=new ih(e),s=lh(t),r=ch(s);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=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Hb(s)),this.platform.updateConfig(i);let o=this.platform.acquireContext(s,a.aspectRatio),l=o&&o.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Tl(),this.ctx=o,this.canvas=l,this.width=u,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Jc,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=jl(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Is[this.id]=this,!o||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Xe.listen(this,"complete",oh),Xe.listen(this,"progress",n0),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return vt(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ma(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return oa(this.canvas,this.ctx),this}stop(){return Xe.stop(this),this}resize(t,e){Xe.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,r),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,!!ma(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),At(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};Mt(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((a,o)=>(a[o]=!1,a),{}),r=[];e&&(r=r.concat(Object.keys(e).map(a=>{let o=e[a],l=Aa(a,o),c=l==="r",u=l==="x";return{options:o,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),Mt(r,a=>{let o=a.options,l=o.id,c=Aa(l,o),u=at(o.type,a.dtype);(o.position===void 0||rh(o.position,c)!==rh(a.dposition))&&(o.position=a.dposition),s[l]=!0;let d=null;if(l in i&&i[l].type===u)d=i[l];else{let g=$e.getScale(u);d=new g({id:l,type:u,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(o,t)}),Mt(s,(a,o)=>{a||delete i[o]}),Mt(i,a=>{re.configure(this,a,a.options),re.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(ah("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){let r=e[i],a=this.getDatasetMeta(i),o=r.type||this.config.type;if(a.type&&a.type!==o&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=o,a.indexAxis=r.indexAxis||Da(o,this.options),a.order=r.order||0,a.index=i,a.label=""+r.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{let l=$e.getController(o),{datasetElementType:c,dataElementType:u}=dt.datasets[o];Object.assign(l.prototype,{dataElementType:$e.getElement(u),datasetElementType:c&&$e.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){Mt(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,u=this.data.datasets.length;c<u;c++){let{controller:d}=this.getDatasetMeta(c),g=!s&&r.indexOf(d)===-1;d.buildOrUpdateElements(g),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||Mt(r,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ah("z","_idx"));let{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Mt(this.scales,t=>{re.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Hr(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:r}of e){let a=i==="_removeElements"?-r:r;i0(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=r=>new Set(t.filter(a=>a[0]===r).map((a,o)=>o+","+a.splice(1).join(","))),s=i(0);for(let r=1;r<e;r++)if(!Hr(s,i(r)))return;return Array.from(s).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;re.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],Mt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Ye(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Xe.has(this)?this.attached&&!Xe.running(this)&&Xe.start(this):(this.draw(),oh({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:i,height:s}=this._resizeBeforeDraw;this._resize(i,s),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let e=this._sortedMetasets,i=[],s,r;for(s=0,r=e.length;s<r;++s){let a=e[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i=t._clip,s=!i.disabled,r=this.chartArea,a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(s&&ki(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&wi(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return Jn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let r=wb.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Ge(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let s=i?"show":"hide",r=this.getDatasetMeta(t),a=r.controller._resolveAnimations(void 0,s);be(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(r,{visible:i}),this.update(o=>o.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Xe.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),oa(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete Is[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,e=this.platform,i=(r,a)=>{e.addEventListener(this,r,a),t[r]=a},s=(r,a,o)=>{r.offsetX=a,r.offsetY=o,this._eventHandler(r)};Mt(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)},a,o=()=>{s("attach",o),this.attached=!0,this.resize(),i("resize",r),i("detach",a)};a=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",o)},e.isAttached(this.canvas)?o():a()}unbindEvents(){Mt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},Mt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s=i?"set":"remove",r,a,o,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),o=0,l=t.length;o<l;++o){a=t[o];let c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],i=t.map(({datasetIndex:r,index:a})=>{let o=this.getDatasetMeta(r);if(!o)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:o.data[a],index:a}});!gi(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){let s=this.options.hover,r=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),a=r(e,t),o=i?t:r(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;let r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:s=[],options:r}=this,a=e,o=this._getActiveElements(t,s,i,a),l=Dl(t),c=s0(t,this._lastEvent,i,l);i&&(this._lastEvent=null,At(r.onHover,[t,o,this],this),l&&At(r.onClick,[t,o,this],this));let u=!gi(o,s);return(u||e)&&(this._active=o,this._updateHoverStyles(o,s,e)),this._lastEvent=c,u}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;let r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}},hh=()=>Mt(ue.instances,n=>n._plugins.invalidate()),bn=!0;Object.defineProperties(ue,{defaults:{enumerable:bn,value:dt},instances:{enumerable:bn,value:Is},overrides:{enumerable:bn,value:hn},registry:{enumerable:bn,value:$e},version:{enumerable:bn,value:t0},getChart:{enumerable:bn,value:ch},register:{enumerable:bn,value:(...n)=>{$e.add(...n),hh()}},unregister:{enumerable:bn,value:(...n)=>{$e.remove(...n),hh()}}});function uh(n,t,e){let{startAngle:i,pixelMargin:s,x:r,y:a,outerRadius:o,innerRadius:l}=t,c=s/o;n.beginPath(),n.arc(r,a,o,i-c,e+c),l>s?(c=s/l,n.arc(r,a,l,e+c,i-c,!0)):n.arc(r,a,s,e+Bt,i-Bt),n.closePath(),n.clip()}function r0(n){return ws(n,["outerStart","outerEnd","innerStart","innerEnd"])}function a0(n,t,e,i){let s=r0(n.options.borderRadius),r=(e-t)/2,a=Math.min(r,i*t/2),o=l=>{let c=(e-Math.min(r,l))*i/2;return Gt(l,0,Math.min(r,c))};return{outerStart:o(s.outerStart),outerEnd:o(s.outerEnd),innerStart:Gt(s.innerStart,0,a),innerEnd:Gt(s.innerEnd,0,a)}}function ii(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function La(n,t,e,i,s,r){let{x:a,y:o,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+i+e-c,0),g=u>0?u+i+e+c:0,p=0,b=s-l;if(i){let et=u>0?u-i:0,Ct=d>0?d-i:0,yt=(et+Ct)/2,Qt=yt!==0?b*yt/(yt+i):b;p=(b-Qt)/2}let x=Math.max(.001,b*d-e/$t)/d,M=(b-x)/2,C=l+M+p,P=s-M-p,{outerStart:$,outerEnd:R,innerStart:F,innerEnd:z}=a0(t,g,d,P-C),N=d-$,X=d-R,U=C+$/N,nt=P-R/X,ot=g+F,st=g+z,kt=C+F/ot,Ft=P-z/st;if(n.beginPath(),r){if(n.arc(a,o,d,U,nt),R>0){let yt=ii(X,nt,a,o);n.arc(yt.x,yt.y,R,nt,P+Bt)}let et=ii(st,P,a,o);if(n.lineTo(et.x,et.y),z>0){let yt=ii(st,Ft,a,o);n.arc(yt.x,yt.y,z,P+Bt,Ft+Math.PI)}if(n.arc(a,o,g,P-z/g,C+F/g,!0),F>0){let yt=ii(ot,kt,a,o);n.arc(yt.x,yt.y,F,kt+Math.PI,C-Bt)}let Ct=ii(N,C,a,o);if(n.lineTo(Ct.x,Ct.y),$>0){let yt=ii(N,U,a,o);n.arc(yt.x,yt.y,$,C-Bt,U)}}else{n.moveTo(a,o);let et=Math.cos(U)*d+a,Ct=Math.sin(U)*d+o;n.lineTo(et,Ct);let yt=Math.cos(nt)*d+a,Qt=Math.sin(nt)*d+o;n.lineTo(yt,Qt)}n.closePath()}function o0(n,t,e,i,s){let{fullCircles:r,startAngle:a,circumference:o}=t,l=t.endAngle;if(r){La(n,t,e,i,a+Et,s);for(let c=0;c<r;++c)n.fill();isNaN(o)||(l=a+o%Et,o%Et==0&&(l+=Et))}return La(n,t,e,i,l,s),n.fill(),l}function l0(n,t,e){let{x:i,y:s,startAngle:r,pixelMargin:a,fullCircles:o}=t,l=Math.max(t.outerRadius-a,0),c=t.innerRadius+a,u;for(e&&uh(n,t,r+Et),n.beginPath(),n.arc(i,s,c,r+Et,r,!0),u=0;u<o;++u)n.stroke();for(n.beginPath(),n.arc(i,s,l,r,r+Et),u=0;u<o;++u)n.stroke()}function c0(n,t,e,i,s,r){let{options:a}=t,{borderWidth:o,borderJoinStyle:l}=a,c=a.borderAlign==="inner";!o||(c?(n.lineWidth=o*2,n.lineJoin=l||"round"):(n.lineWidth=o,n.lineJoin=l||"bevel"),t.fullCircles&&l0(n,t,c),c&&uh(n,t,s),La(n,t,e,i,s,r),n.stroke())}var Bi=class extends we{constructor(t){super();this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.getProps(["x","y"],i),{angle:r,distance:a}=qr(s,{x:t,y:e}),{startAngle:o,endAngle:l,innerRadius:c,outerRadius:u,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),g=this.options.spacing/2,b=at(d,l-o)>=Et||Un(r,o,l),x=Re(a,c+g,u+g);return b&&x}getCenterPoint(t){let{x:e,y:i,startAngle:s,endAngle:r,innerRadius:a,outerRadius:o}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:l,spacing:c}=this.options,u=(s+r)/2,d=(a+o+c+l)/2;return{x:e+Math.cos(u)*d,y:i+Math.sin(u)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,s=(e.offset||0)/2,r=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>Et?Math.floor(i/Et):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=0;if(s){o=s/2;let c=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(c)*o,Math.sin(c)*o),this.circumference>=$t&&(o=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;let l=o0(t,this,o,r,a);c0(t,this,o,r,l,a),t.restore()}};Bi.id="arc";Bi.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};Bi.defaultRoutes={backgroundColor:"backgroundColor"};function fh(n,t,e=t){n.lineCap=at(e.borderCapStyle,t.borderCapStyle),n.setLineDash(at(e.borderDash,t.borderDash)),n.lineDashOffset=at(e.borderDashOffset,t.borderDashOffset),n.lineJoin=at(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=at(e.borderWidth,t.borderWidth),n.strokeStyle=at(e.borderColor,t.borderColor)}function h0(n,t,e){n.lineTo(e.x,e.y)}function u0(n){return n.stepped?ec:n.tension||n.cubicInterpolationMode==="monotone"?nc:h0}function dh(n,t,e={}){let i=n.length,{start:s=0,end:r=i-1}=e,{start:a,end:o}=t,l=Math.max(s,a),c=Math.min(r,o),u=s<a&&r<a||s>o&&r>o;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function f0(n,t,e,i){let{points:s,options:r}=t,{count:a,start:o,loop:l,ilen:c}=dh(s,e,i),u=u0(r),{move:d=!0,reverse:g}=i||{},p,b,x;for(p=0;p<=c;++p)b=s[(o+(g?c-p:p))%a],!b.skip&&(d?(n.moveTo(b.x,b.y),d=!1):u(n,x,b,g,r.stepped),x=b);return l&&(b=s[(o+(g?c:0))%a],u(n,x,b,g,r.stepped)),!!l}function d0(n,t,e,i){let s=t.points,{count:r,start:a,ilen:o}=dh(s,e,i),{move:l=!0,reverse:c}=i||{},u=0,d=0,g,p,b,x,M,C,P=R=>(a+(c?o-R:R))%r,$=()=>{x!==M&&(n.lineTo(u,M),n.lineTo(u,x),n.lineTo(u,C))};for(l&&(p=s[P(0)],n.moveTo(p.x,p.y)),g=0;g<=o;++g){if(p=s[P(g)],p.skip)continue;let R=p.x,F=p.y,z=R|0;z===b?(F<x?x=F:F>M&&(M=F),u=(d*u+R)/++d):($(),n.lineTo(R,F),b=z,d=0,x=M=F),C=F}$()}function Ra(n){let t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?d0:f0}function p0(n){return n.stepped?dc:n.tension||n.cubicInterpolationMode==="monotone"?pc:gn}function g0(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),fh(n,t.options),n.stroke(s)}function m0(n,t,e,i){let{segments:s,options:r}=t,a=Ra(t);for(let o of s)fh(n,r,o.style),n.beginPath(),a(n,t,o,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}var b0=typeof Path2D=="function";function v0(n,t,e,i){b0&&!t.options.segment?g0(n,t,e,i):m0(n,t,e,i)}var Ue=class extends we{constructor(t){super();this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let s=i.spanGaps?this._loop:this._fullLoop;hc(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=vc(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,s=t[e],r=this.points,a=xa(this,{property:e,start:s,end:s});if(!a.length)return;let o=[],l=p0(i),c,u;for(c=0,u=a.length;c<u;++c){let{start:d,end:g}=a[c],p=r[d],b=r[g];if(p===b){o.push(p);continue}let x=Math.abs((s-p[e])/(b[e]-p[e])),M=l(p,b,x,i.stepped);M[e]=t[e],o.push(M)}return o.length===1?o[0]:o}pathSegment(t,e,i){return Ra(this)(t,this,e,i)}path(t,e,i){let s=this.segments,r=Ra(this),a=this._loop;e=e||0,i=i||this.points.length-e;for(let o of s)a&=r(t,this,o,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){let r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),v0(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};Ue.id="line";Ue.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};Ue.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};Ue.descriptors={_scriptable:!0,_indexable:n=>n!=="borderDash"&&n!=="fill"};function ph(n,t,e,i){let s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)<s.radius+s.hitRadius}var ji=class extends we{constructor(t){super();this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.options,{x:r,y:a}=this.getProps(["x","y"],i);return Math.pow(t-r,2)+Math.pow(e-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return ph(this,t,"x",e)}inYRange(t,e){return ph(this,t,"y",e)}getCenterPoint(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);let i=e&&t.borderWidth||0;return(e+i)*2}draw(t,e){let i=this.options;this.skip||i.radius<.1||!Jn(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,ks(t,i,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}};ji.id="point";ji.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};ji.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};function gh(n,t){let{x:e,y:i,base:s,width:r,height:a}=n.getProps(["x","y","base","width","height"],t),o,l,c,u,d;return n.horizontal?(d=a/2,o=Math.min(e,s),l=Math.max(e,s),c=i-d,u=i+d):(d=r/2,o=e-d,l=e+d,c=Math.min(i,s),u=Math.max(i,s)),{left:o,top:c,right:l,bottom:u}}function vn(n,t,e,i){return n?0:Gt(t,e,i)}function _0(n,t,e){let i=n.options.borderWidth,s=n.borderSkipped,r=ca(i);return{t:vn(s.top,r.top,0,e),r:vn(s.right,r.right,0,t),b:vn(s.bottom,r.bottom,0,e),l:vn(s.left,r.left,0,t)}}function y0(n,t,e){let{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,r=dn(s),a=Math.min(t,e),o=n.borderSkipped,l=i||ft(s);return{topLeft:vn(!l||o.top||o.left,r.topLeft,0,a),topRight:vn(!l||o.top||o.right,r.topRight,0,a),bottomLeft:vn(!l||o.bottom||o.left,r.bottomLeft,0,a),bottomRight:vn(!l||o.bottom||o.right,r.bottomRight,0,a)}}function x0(n){let t=gh(n),e=t.right-t.left,i=t.bottom-t.top,s=_0(n,e/2,i/2),r=y0(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:r},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,r.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(s.b,s.r))}}}}function Fa(n,t,e,i){let s=t===null,r=e===null,o=n&&!(s&&r)&&gh(n,i);return o&&(s||Re(t,o.left,o.right))&&(r||Re(e,o.top,o.bottom))}function k0(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function w0(n,t){n.rect(t.x,t.y,t.w,t.h)}function $a(n,t,e={}){let i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,r=(n.x+n.w!==e.x+e.w?t:0)-i,a=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+r,h:n.h+a,radius:n.radius}}var Ni=class extends we{constructor(t){super();this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:r,outer:a}=x0(this),o=k0(a.radius)?Qn:w0;t.save(),(a.w!==r.w||a.h!==r.h)&&(t.beginPath(),o(t,$a(a,e,r)),t.clip(),o(t,$a(r,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),o(t,$a(r,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Fa(this,t,e,i)}inXRange(t,e){return Fa(this,t,null,e)}inYRange(t,e){return Fa(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:s,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(e+s)/2:e,y:r?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}};Ni.id="bar";Ni.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};Ni.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var S0=Object.freeze({__proto__:null,ArcElement:Bi,LineElement:Ue,PointElement:ji,BarElement:Ni});function M0(n,t,e,i,s){let r=s.samples||i;if(r>=e)return n.slice(t,t+e);let a=[],o=(e-2)/(r-2),l=0,c=t+e-1,u=t,d,g,p,b,x;for(a[l++]=n[u],d=0;d<r-2;d++){let M=0,C=0,P,$=Math.floor((d+1)*o)+1+t,R=Math.min(Math.floor((d+2)*o)+1,e)+t,F=R-$;for(P=$;P<R;P++)M+=n[P].x,C+=n[P].y;M/=F,C/=F;let z=Math.floor(d*o)+1+t,N=Math.min(Math.floor((d+1)*o)+1,e)+t,{x:X,y:U}=n[u];for(p=b=-1,P=z;P<N;P++)b=.5*Math.abs((X-M)*(n[P].y-U)-(X-n[P].x)*(C-U)),b>p&&(p=b,g=n[P],x=P);a[l++]=g,u=x}return a[l++]=n[c],a}function C0(n,t,e,i){let s=0,r=0,a,o,l,c,u,d,g,p,b,x,M=[],C=t+e-1,P=n[t].x,R=n[C].x-P;for(a=t;a<t+e;++a){o=n[a],l=(o.x-P)/R*i,c=o.y;let F=l|0;if(F===u)c<b?(b=c,d=a):c>x&&(x=c,g=a),s=(r*s+o.x)/++r;else{let z=a-1;if(!vt(d)&&!vt(g)){let N=Math.min(d,g),X=Math.max(d,g);N!==p&&N!==z&&M.push({...n[N],x:s}),X!==p&&X!==z&&M.push({...n[X],x:s})}a>0&&z!==p&&M.push(n[z]),M.push(o),u=F,r=0,b=x=c,d=g=p=a}}return M}function mh(n){if(n._decimated){let t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{value:t})}}function bh(n){n.data.datasets.forEach(t=>{mh(t)})}function T0(n,t){let e=t.length,i=0,s,{iScale:r}=n,{min:a,max:o,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(i=Gt(Fe(t,r.axis,a).lo,0,e-1)),c?s=Gt(Fe(t,r.axis,o).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var P0={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){bh(n);return}let i=n.width;n.data.datasets.forEach((s,r)=>{let{_data:a,indexAxis:o}=s,l=n.getDatasetMeta(r),c=a||s.data;if(ti([o,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let u=n.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||n.options.parsing)return;let{start:d,count:g}=T0(l,c),p=e.threshold||4*i;if(g<=p){mh(s);return}vt(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(x){this._data=x}}));let b;switch(e.algorithm){case"lttb":b=M0(c,d,g,i,e);break;case"min-max":b=C0(c,d,g,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=b})},destroy(n){bh(n)}};function E0(n,t,e){let i=n.segments,s=n.points,r=t.points,a=[];for(let o of i){let{start:l,end:c}=o;c=za(l,c,s);let u=Ia(e,s[l],s[c],o.loop);if(!t.segments){a.push({source:o,target:u,start:s[l],end:s[c]});continue}let d=xa(t,u);for(let g of d){let p=Ia(e,r[g.start],r[g.end],g.loop),b=ya(o,s,p);for(let x of b)a.push({source:x,target:g,start:{[e]:vh(u,p,"start",Math.max)},end:{[e]:vh(u,p,"end",Math.min)}})}}return a}function Ia(n,t,e,i){if(i)return;let s=t[n],r=e[n];return n==="angle"&&(s=he(s),r=he(r)),{property:n,start:s,end:r}}function O0(n,t){let{x:e=null,y:i=null}=n||{},s=t.points,r=[];return t.segments.forEach(({start:a,end:o})=>{o=za(a,o,s);let l=s[a],c=s[o];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function za(n,t,e){for(;t>n;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function vh(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function _h(n,t){let e=[],i=!1;return Dt(n)?(i=!0,e=n):e=O0(n,t),e.length?new Ue({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function yh(n){return n&&n.fill!==!1}function D0(n,t,e){let s=n[t].fill,r=[t],a;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!jt(s))return s;if(a=n[s],!a)return!1;if(a.visible)return s;r.push(s),s=a.fill}return!1}function A0(n,t,e){let i=$0(n);if(ft(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return jt(s)&&Math.floor(s)===s?L0(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function L0(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function R0(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:ft(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function F0(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:ft(n)?i=n.value:i=t.getBaseValue(),i}function $0(n){let t=n.options,e=t.fill,i=at(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function I0(n){let{scale:t,index:e,line:i}=n,s=[],r=i.segments,a=i.points,o=z0(t,e);o.push(_h({x:null,y:t.bottom},i));for(let l=0;l<r.length;l++){let c=r[l];for(let u=c.start;u<=c.end;u++)B0(s,a[u],o)}return new Ue({points:s,options:{}})}function z0(n,t){let e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){let r=i[s];if(r.index===t)break;r.hidden||e.unshift(r.dataset)}return e}function B0(n,t,e){let i=[];for(let s=0;s<e.length;s++){let r=e[s],{first:a,last:o,point:l}=j0(r,t,"x");if(!(!l||a&&o)){if(a)i.unshift(l);else if(n.push(l),!o)break}}n.push(...i)}function j0(n,t,e){let i=n.interpolate(t,e);if(!i)return{};let s=i[e],r=n.segments,a=n.points,o=!1,l=!1;for(let c=0;c<r.length;c++){let u=r[c],d=a[u.start][e],g=a[u.end][e];if(Re(s,d,g)){o=s===d,l=s===g;break}}return{first:o,last:l,point:i}}var Ba=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:s,y:r,radius:a}=this;return e=e||{start:0,end:Et},t.arc(s,r,a,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:s}=this,r=t.angle;return{x:e+Math.cos(r)*s,y:i+Math.sin(r)*s,angle:r}}};function N0(n){let{chart:t,fill:e,line:i}=n;if(jt(e))return H0(t,e);if(e==="stack")return I0(n);if(e==="shape")return!0;let s=V0(n);return s instanceof Ba?s:_h(s,i)}function H0(n,t){let e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function V0(n){return(n.scale||{}).getPointPositionForValue?Y0(n):W0(n)}function W0(n){let{scale:t={},fill:e}=n,i=R0(e,t);if(jt(i)){let s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function Y0(n){let{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,r=i.reverse?t.max:t.min,a=F0(e,t,r),o=[];if(i.grid.circular){let l=t.getPointPositionForValue(0,r);return new Ba({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)o.push(t.getPointPositionForValue(l,a));return o}function ja(n,t,e){let i=N0(t),{line:s,scale:r,axis:a}=t,o=s.options,l=o.fill,c=o.backgroundColor,{above:u=c,below:d=c}=l||{};i&&s.points.length&&(ki(n,e),q0(n,{line:s,target:i,above:u,below:d,area:e,scale:r,axis:a}),wi(n))}function q0(n,t){let{line:e,target:i,above:s,below:r,area:a,scale:o}=t,l=e._loop?"angle":t.axis;n.save(),l==="x"&&r!==s&&(xh(n,i,a.top),kh(n,{line:e,target:i,color:s,scale:o,property:l}),n.restore(),n.save(),xh(n,i,a.bottom)),kh(n,{line:e,target:i,color:r,scale:o,property:l}),n.restore()}function xh(n,t,e){let{segments:i,points:s}=t,r=!0,a=!1;n.beginPath();for(let o of i){let{start:l,end:c}=o,u=s[l],d=s[za(l,c,s)];r?(n.moveTo(u.x,u.y),r=!1):(n.lineTo(u.x,e),n.lineTo(u.x,u.y)),a=!!t.pathSegment(n,o,{move:a}),a?n.closePath():n.lineTo(d.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function kh(n,t){let{line:e,target:i,property:s,color:r,scale:a}=t,o=E0(e,i,s);for(let{source:l,target:c,start:u,end:d}of o){let{style:{backgroundColor:g=r}={}}=l,p=i!==!0;n.save(),n.fillStyle=g,G0(n,a,p&&Ia(s,u,d)),n.beginPath();let b=!!e.pathSegment(n,l),x;if(p){b?n.closePath():wh(n,i,d,s);let M=!!i.pathSegment(n,c,{move:b,reverse:!0});x=b&&M,x||wh(n,i,u,s)}n.closePath(),n.fill(x?"evenodd":"nonzero"),n.restore()}}function G0(n,t,e){let{top:i,bottom:s}=t.chart.chartArea,{property:r,start:a,end:o}=e||{};r==="x"&&(n.beginPath(),n.rect(a,i,o-a,s-i),n.clip())}function wh(n,t,e,i){let s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}var X0={id:"filler",afterDatasetsUpdate(n,t,e){let i=(n.data.datasets||[]).length,s=[],r,a,o,l;for(a=0;a<i;++a)r=n.getDatasetMeta(a),o=r.dataset,l=null,o&&o.options&&o instanceof Ue&&(l={visible:n.isDatasetVisible(a),index:a,fill:A0(o,a,i),chart:n,axis:r.controller.options.indexAxis,scale:r.vScale,line:o}),r.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=D0(s,a,e.propagate))},beforeDraw(n,t,e){let i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),r=n.chartArea;for(let a=s.length-1;a>=0;--a){let o=s[a].$filler;!o||(o.line.updateControlPoints(r,o.axis),i&&o.fill&&ja(n.ctx,o,r))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){let r=i[s].$filler;yh(r)&&ja(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,t,e){let i=t.meta.$filler;!yh(i)||e.drawTime!=="beforeDatasetDraw"||ja(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},Sh=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},U0=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index,Na=class extends we{constructor(t){super();this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=At(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,s=qt(i.font),r=s.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=Sh(i,r),c,u;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(a,r,o,l)+10):(u=this.maxHeight,c=this._fitCols(a,r,o,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){let{ctx:r,maxWidth:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+o,d=t;r.textAlign="left",r.textBaseline="middle";let g=-1,p=-u;return this.legendItems.forEach((b,x)=>{let M=i+e/2+r.measureText(b.text).width;(x===0||c[c.length-1]+M+2*o>a)&&(d+=u,c[c.length-(x>0?0:1)]=0,p+=u,g++),l[x]={left:0,top:p,row:g,width:M,height:s},c[c.length-1]+=M+o}),d}_fitCols(t,e,i,s){let{ctx:r,maxHeight:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=a-t,d=o,g=0,p=0,b=0,x=0;return this.legendItems.forEach((M,C)=>{let P=i+e/2+r.measureText(M.text).width;C>0&&p+s+2*o>u&&(d+=g+o,c.push({width:g,height:p}),b+=g+o,x++,g=p=0),l[C]={left:b,top:p,col:x,width:P,height:s},g=Math.max(g,P),p+=s+o}),d+=g,c.push({width:g,height:p}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:r}}=this,a=On(r,this.left,this.width);if(this.isHorizontal()){let o=0,l=ne(i,this.left+s,this.right-this.lineWidths[o]);for(let c of e)o!==c.row&&(o=c.row,l=ne(i,this.left+s,this.right-this.lineWidths[o])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let o=0,l=ne(i,this.top+t+s,this.bottom-this.columnSizes[o].height);for(let c of e)c.col!==o&&(o=c.col,l=ne(i,this.top+t+s,this.bottom-this.columnSizes[o].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;ki(t,this),this._draw(),wi(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:r,labels:a}=t,o=dt.color,l=On(t.rtl,this.left,this.width),c=qt(a.font),{color:u,padding:d}=a,g=c.size,p=g/2,b;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;let{boxWidth:x,boxHeight:M,itemHeight:C}=Sh(a,g),P=function(N,X,U){if(isNaN(x)||x<=0||isNaN(M)||M<0)return;s.save();let nt=at(U.lineWidth,1);if(s.fillStyle=at(U.fillStyle,o),s.lineCap=at(U.lineCap,"butt"),s.lineDashOffset=at(U.lineDashOffset,0),s.lineJoin=at(U.lineJoin,"miter"),s.lineWidth=nt,s.strokeStyle=at(U.strokeStyle,o),s.setLineDash(at(U.lineDash,[])),a.usePointStyle){let ot={radius:M*Math.SQRT2/2,pointStyle:U.pointStyle,rotation:U.rotation,borderWidth:nt},st=l.xPlus(N,x/2),kt=X+p;la(s,ot,st,kt,a.pointStyleWidth&&x)}else{let ot=X+Math.max((g-M)/2,0),st=l.leftForLtr(N,x),kt=dn(U.borderRadius);s.beginPath(),Object.values(kt).some(Ft=>Ft!==0)?Qn(s,{x:st,y:ot,w:x,h:M,radius:kt}):s.rect(st,ot,x,M),s.fill(),nt!==0&&s.stroke()}s.restore()},$=function(N,X,U){fn(s,U.text,N,X+C/2,c,{strikethrough:U.hidden,textAlign:l.textAlign(U.textAlign)})},R=this.isHorizontal(),F=this._computeTitleHeight();R?b={x:ne(r,this.left+d,this.right-i[0]),y:this.top+d+F,line:0}:b={x:this.left+d,y:ne(r,this.top+F+d,this.bottom-e[0].height),line:0},va(this.ctx,t.textDirection);let z=C+d;this.legendItems.forEach((N,X)=>{s.strokeStyle=N.fontColor||u,s.fillStyle=N.fontColor||u;let U=s.measureText(N.text).width,nt=l.textAlign(N.textAlign||(N.textAlign=a.textAlign)),ot=x+p+U,st=b.x,kt=b.y;l.setWidth(this.width),R?X>0&&st+ot+d>this.right&&(kt=b.y+=z,b.line++,st=b.x=ne(r,this.left+d,this.right-i[b.line])):X>0&&kt+z>this.bottom&&(st=b.x=st+e[b.line].width+d,b.line++,kt=b.y=ne(r,this.top+F+d,this.bottom-e[b.line].height));let Ft=l.x(st);P(Ft,kt,N),st=Nl(nt,st+x+p,R?st+ot:this.right,t.rtl),$(l.x(st),kt,N),R?b.x+=ot+d:b.y+=z}),_a(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=qt(e.font),s=ie(e.padding);if(!e.display)return;let r=On(t.rtl,this.left,this.width),a=this.ctx,o=e.position,l=i.size/2,c=s.top+l,u,d=this.left,g=this.width;if(this.isHorizontal())g=Math.max(...this.lineWidths),u=this.top+c,d=ne(t.align,d,this.right-g);else{let b=this.columnSizes.reduce((x,M)=>Math.max(x,M.height),0);u=c+ne(t.align,this.top,this.bottom-b-t.labels.padding-this._computeTitleHeight())}let p=ne(o,d,d+g);a.textAlign=r.textAlign(ms(o)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,fn(a,e.text,p,u,i)}_computeTitleHeight(){let t=this.options.title,e=qt(t.font),i=ie(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,r;if(Re(t,this.left,this.right)&&Re(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;i<r.length;++i)if(s=r[i],Re(t,s.left,s.left+s.width)&&Re(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){let e=this.options;if(!K0(t.type,e))return;let i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,r=U0(s,i);s&&!r&&At(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!r&&At(e.onHover,[t,i,this],this)}else i&&At(e.onClick,[t,i,this],this)}};function K0(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var Z0={id:"legend",_element:Na,start(n,t,e){let i=n.legend=new Na({ctx:n.ctx,options:e,chart:n});re.configure(n,i,e),re.addBox(n,i)},stop(n){re.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){let i=n.legend;re.configure(n,i,e),i.options=e},afterUpdate(n){let t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){let i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){let t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:r}}=n.legend.options;return n._getSortedDatasetMetas().map(a=>{let o=a.controller.getStyle(e?0:void 0),l=ie(o.borderWidth);return{text:t[a.index].label,fillStyle:o.backgroundColor,fontColor:r,hidden:!a.visible,lineCap:o.borderCapStyle,lineDash:o.borderDash,lineDashOffset:o.borderDashOffset,lineJoin:o.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:o.borderColor,pointStyle:i||o.pointStyle,rotation:o.rotation,textAlign:s||o.textAlign,borderRadius:0,datasetIndex:a.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}},zs=class extends we{constructor(t){super();this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let s=Dt(i.text)?i.text.length:1;this._padding=ie(i.padding);let r=s*qt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:i,bottom:s,right:r,options:a}=this,o=a.align,l=0,c,u,d;return this.isHorizontal()?(u=ne(o,i,r),d=e+t,c=r-i):(a.position==="left"?(u=i+t,d=ne(o,s,e),l=$t*-.5):(u=r-t,d=ne(o,e,s),l=$t*.5),c=s-e),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=qt(e.font),r=i.lineHeight/2+this._padding.top,{titleX:a,titleY:o,maxWidth:l,rotation:c}=this._drawArgs(r);fn(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:ms(e.align),textBaseline:"middle",translation:[a,o]})}};function J0(n,t){let e=new zs({ctx:n.ctx,options:t,chart:n});re.configure(n,e,t),re.addBox(n,e),n.titleBlock=e}var Q0={id:"title",_element:zs,start(n,t,e){J0(n,e)},stop(n){let t=n.titleBlock;re.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){let i=n.titleBlock;re.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Bs=new WeakMap,tv={id:"subtitle",start(n,t,e){let i=new zs({ctx:n.ctx,options:e,chart:n});re.configure(n,i,e),re.addBox(n,i),Bs.set(n,i)},stop(n){re.removeBox(n,Bs.get(n)),Bs.delete(n)},beforeUpdate(n,t,e){let i=Bs.get(n);re.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Hi={average(n){if(!n.length)return!1;let t,e,i=0,s=0,r=0;for(t=0,e=n.length;t<e;++t){let a=n[t].element;if(a&&a.hasValue()){let o=a.tooltipPosition();i+=o.x,s+=o.y,++r}}return{x:i/r,y:s/r}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,r,a,o;for(r=0,a=n.length;r<a;++r){let l=n[r].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),u=ps(t,c);u<s&&(s=u,o=l)}}if(o){let l=o.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function Ie(n,t){return t&&(Dt(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function Ke(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
`)>-1?n.split(`
`):n}function ev(n,t){let{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:a,value:o}=r.getLabelAndValue(s);return{chart:n,label:a,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:o,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Mh(n,t){let e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:a,boxHeight:o}=t,l=qt(t.bodyFont),c=qt(t.titleFont),u=qt(t.footerFont),d=r.length,g=s.length,p=i.length,b=ie(t.padding),x=b.height,M=0,C=i.reduce((R,F)=>R+F.before.length+F.lines.length+F.after.length,0);if(C+=n.beforeBody.length+n.afterBody.length,d&&(x+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),C){let R=t.displayColors?Math.max(o,l.lineHeight):l.lineHeight;x+=p*R+(C-p)*l.lineHeight+(C-1)*t.bodySpacing}g&&(x+=t.footerMarginTop+g*u.lineHeight+(g-1)*t.footerSpacing);let P=0,$=function(R){M=Math.max(M,e.measureText(R).width+P)};return e.save(),e.font=c.string,Mt(n.title,$),e.font=l.string,Mt(n.beforeBody.concat(n.afterBody),$),P=t.displayColors?a+2+t.boxPadding:0,Mt(i,R=>{Mt(R.before,$),Mt(R.lines,$),Mt(R.after,$)}),P=0,e.font=u.string,Mt(n.footer,$),e.restore(),M+=b.width,{width:M,height:x}}function nv(n,t){let{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function iv(n,t,e,i){let{x:s,width:r}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+r+a>t.width||n==="right"&&s-r-a<0)return!0}function sv(n,t,e,i){let{x:s,width:r}=e,{width:a,chartArea:{left:o,right:l}}=n,c="center";return i==="center"?c=s<=(o+l)/2?"left":"right":s<=r/2?c="left":s>=a-r/2&&(c="right"),iv(c,n,t,e)&&(c="center"),c}function Ch(n,t,e){let i=e.yAlign||t.yAlign||nv(n,e);return{xAlign:e.xAlign||t.xAlign||sv(n,t,e,i),yAlign:i}}function rv(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function av(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Th(n,t,e,i){let{caretSize:s,caretPadding:r,cornerRadius:a}=n,{xAlign:o,yAlign:l}=e,c=s+r,{topLeft:u,topRight:d,bottomLeft:g,bottomRight:p}=dn(a),b=rv(t,o),x=av(t,l,c);return l==="center"?o==="left"?b+=c:o==="right"&&(b-=c):o==="left"?b-=Math.max(u,g)+s:o==="right"&&(b+=Math.max(d,p)+s),{x:Gt(b,0,i.width-t.width),y:Gt(x,0,i.height-t.height)}}function js(n,t,e){let i=ie(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Ph(n){return Ie([],Ke(n))}function ov(n,t,e){return Ge(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Eh(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}var Ns=class extends we{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||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new ka(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=ov(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),r=i.title.apply(this,[t]),a=i.afterTitle.apply(this,[t]),o=[];return o=Ie(o,Ke(s)),o=Ie(o,Ke(r)),o=Ie(o,Ke(a)),o}getBeforeBody(t,e){return Ph(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){let{callbacks:i}=e,s=[];return Mt(t,r=>{let a={before:[],lines:[],after:[]},o=Eh(i,r);Ie(a.before,Ke(o.beforeLabel.call(this,r))),Ie(a.lines,o.label.call(this,r)),Ie(a.after,Ke(o.afterLabel.call(this,r))),s.push(a)}),s}getAfterBody(t,e){return Ph(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){let{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),r=i.footer.apply(this,[t]),a=i.afterFooter.apply(this,[t]),o=[];return o=Ie(o,Ke(s)),o=Ie(o,Ke(r)),o=Ie(o,Ke(a)),o}_createItems(t){let e=this._active,i=this.chart.data,s=[],r=[],a=[],o=[],l,c;for(l=0,c=e.length;l<c;++l)o.push(ev(this.chart,e[l]));return t.filter&&(o=o.filter((u,d,g)=>t.filter(u,d,g,i))),t.itemSort&&(o=o.sort((u,d)=>t.itemSort(u,d,i))),Mt(o,u=>{let d=Eh(t.callbacks,u);s.push(d.labelColor.call(this,u)),r.push(d.labelPointStyle.call(this,u)),a.push(d.labelTextColor.call(this,u))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=a,this.dataPoints=o,o}update(t,e){let i=this.options.setContext(this.getContext()),s=this._active,r,a=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{let o=Hi[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=Mh(this,i),c=Object.assign({},o,l),u=Ch(this.chart,i,c),d=Th(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,r={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:o.x,caretY:o.y}}this._tooltipItems=a,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){let{xAlign:s,yAlign:r}=this,{caretSize:a,cornerRadius:o}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=dn(o),{x:g,y:p}=t,{width:b,height:x}=e,M,C,P,$,R,F;return r==="center"?(R=p+x/2,s==="left"?(M=g,C=M-a,$=R+a,F=R-a):(M=g+b,C=M+a,$=R-a,F=R+a),P=M):(s==="left"?C=g+Math.max(l,u)+a:s==="right"?C=g+b-Math.max(c,d)-a:C=this.caretX,r==="top"?($=p,R=$-a,M=C-a,P=C+a):($=p+x,R=$+a,M=C+a,P=C-a),F=$),{x1:M,x2:C,x3:P,y1:$,y2:R,y3:F}}drawTitle(t,e,i){let s=this.title,r=s.length,a,o,l;if(r){let c=On(i.rtl,this.x,this.width);for(t.x=js(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=qt(i.titleFont),o=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<r;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o,l+1===r&&(t.y+=i.titleMarginBottom-o)}}_drawColorBox(t,e,i,s,r){let a=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:l,boxWidth:c,boxPadding:u}=r,d=qt(r.bodyFont),g=js(this,"left",r),p=s.x(g),b=l<d.lineHeight?(d.lineHeight-l)/2:0,x=e.y+b;if(r.usePointStyle){let M={radius:Math.min(c,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},C=s.leftForLtr(p,c)+c/2,P=x+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,ks(t,M,C,P),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,ks(t,M,C,P)}else{t.lineWidth=ft(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=s.leftForLtr(p,c-u),C=s.leftForLtr(s.xPlus(p,1),c-u-2),P=dn(a.borderRadius);Object.values(P).some($=>$!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Qn(t,{x:M,y:x,w:c,h:l,radius:P}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Qn(t,{x:C,y:x+1,w:c-2,h:l-2,radius:P}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(M,x,c,l),t.strokeRect(M,x,c,l),t.fillStyle=a.backgroundColor,t.fillRect(C,x+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:s}=this,{bodySpacing:r,bodyAlign:a,displayColors:o,boxHeight:l,boxWidth:c,boxPadding:u}=i,d=qt(i.bodyFont),g=d.lineHeight,p=0,b=On(i.rtl,this.x,this.width),x=function(X){e.fillText(X,b.x(t.x+p),t.y+g/2),t.y+=g+r},M=b.textAlign(a),C,P,$,R,F,z,N;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=js(this,M,i),e.fillStyle=i.bodyColor,Mt(this.beforeBody,x),p=o&&M!=="right"?a==="center"?c/2+u:c+2+u:0,R=0,z=s.length;R<z;++R){for(C=s[R],P=this.labelTextColors[R],e.fillStyle=P,Mt(C.before,x),$=C.lines,o&&$.length&&(this._drawColorBox(e,t,R,b,i),g=Math.max(d.lineHeight,l)),F=0,N=$.length;F<N;++F)x($[F]),g=d.lineHeight;Mt(C.after,x)}p=0,g=d.lineHeight,Mt(this.afterBody,x),t.y-=r}drawFooter(t,e,i){let s=this.footer,r=s.length,a,o;if(r){let l=On(i.rtl,this.x,this.width);for(t.x=js(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=qt(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,o=0;o<r;++o)e.fillText(s[o],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){let{xAlign:r,yAlign:a}=this,{x:o,y:l}=t,{width:c,height:u}=i,{topLeft:d,topRight:g,bottomLeft:p,bottomRight:b}=dn(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(o+d,l),a==="top"&&this.drawCaret(t,e,i,s),e.lineTo(o+c-g,l),e.quadraticCurveTo(o+c,l,o+c,l+g),a==="center"&&r==="right"&&this.drawCaret(t,e,i,s),e.lineTo(o+c,l+u-b),e.quadraticCurveTo(o+c,l+u,o+c-b,l+u),a==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(o+p,l+u),e.quadraticCurveTo(o,l+u,o,l+u-p),a==="center"&&r==="left"&&this.drawCaret(t,e,i,s),e.lineTo(o,l+d),e.quadraticCurveTo(o,l,o+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){let a=Hi[t.position].call(this,this._active,this._eventPosition);if(!a)return;let o=this._size=Mh(this,t),l=Object.assign({},a,this._size),c=Ch(e,t,l),u=Th(t,l,c,e);(s._to!==u.x||r._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=o.width,this.height=o.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let a=ie(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),va(t,e.textDirection),r.y+=a.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),_a(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,s=t.map(({datasetIndex:o,index:l})=>{let c=this.chart.getDatasetMeta(o);if(!c)throw new Error("Cannot find a dataset at index "+o);return{datasetIndex:o,element:c.data[l],index:l}}),r=!gi(i,s),a=this._positionChanged(s,e);(r||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,r=this._active||[],a=this._getActiveElements(t,r,e,i),o=this._positionChanged(a,t),l=e||!gi(a,r)||o;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){let r=this.options;if(t.type==="mouseout")return[];if(!s)return e;let a=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:s,options:r}=this,a=Hi[r.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}};Ns.positioners=Hi;var lv={id:"tooltip",_element:Ns,positioners:Hi,afterInit(n,t,e){e&&(n.tooltip=new Ns({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){let t=n.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",e)===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){let e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:Le,title(n){if(n.length>0){let t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Le,beforeBody:Le,beforeLabel:Le,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");let e=n.formattedValue;return vt(e)||(t+=e),t},labelColor(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Le,afterBody:Le,beforeFooter:Le,footer:Le,afterFooter:Le}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},cv=Object.freeze({__proto__:null,Decimation:P0,Filler:X0,Legend:Z0,SubTitle:tv,Title:Q0,Tooltip:lv}),hv=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function uv(n,t,e,i){let s=n.indexOf(t);if(s===-1)return hv(n,t,e,i);let r=n.lastIndexOf(t);return s!==r?e:s}var fv=(n,t)=>n===null?null:Gt(Math.round(n),0,t),Vi=class extends mn{constructor(t){super(t);this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:s,label:r}of e)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(vt(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:uv(i,t,at(e,t),this._addedLabels),fv(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,s=[],r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){let e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};Vi.id="category";Vi.defaults={ticks:{callback:Vi.prototype.getLabelForValue}};function dv(n,t){let e=[],i=1e-14,{bounds:s,step:r,min:a,max:o,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:g}=n,p=r||1,b=u-1,{min:x,max:M}=t,C=!vt(a),P=!vt(o),$=!vt(c),R=(M-x)/(d+1),F=Vr((M-x)/b/p)*p,z,N,X,U;if(F<i&&!C&&!P)return[{value:x},{value:M}];U=Math.ceil(M/F)-Math.floor(x/F),U>b&&(F=Vr(U*F/b/p)*p),vt(l)||(z=Math.pow(10,l),F=Math.ceil(F*z)/z),s==="ticks"?(N=Math.floor(x/F)*F,X=Math.ceil(M/F)*F):(N=x,X=M),C&&P&&r&&Rl((o-a)/r,F/1e3)?(U=Math.round(Math.min((o-a)/F,u)),F=(o-a)/U,N=a,X=o):$?(N=C?a:N,X=P?o:X,U=c-1,F=(X-N)/U):(U=(X-N)/F,Xn(U,Math.round(U),F/1e3)?U=Math.round(U):U=Math.ceil(U));let nt=Math.max(Yr(F),Yr(N));z=Math.pow(10,vt(l)?nt:l),N=Math.round(N*z)/z,X=Math.round(X*z)/z;let ot=0;for(C&&(g&&N!==a?(e.push({value:a}),N<a&&ot++,Xn(Math.round((N+ot*F)*z)/z,a,Oh(a,R,n))&&ot++):N<a&&ot++);ot<U;++ot)e.push({value:Math.round((N+ot*F)*z)/z});return P&&g&&X!==o?e.length&&Xn(e[e.length-1].value,o,Oh(o,R,n))?e[e.length-1].value=o:e.push({value:o}):(!P||X===o)&&e.push({value:X}),e}function Oh(n,t,{horizontal:e,minRotation:i}){let s=ye(i),r=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/r,a)}var Wi=class extends mn{constructor(t){super(t);this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return vt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:s,max:r}=this,a=l=>s=e?s:l,o=l=>r=i?r:l;if(t){let l=Te(s),c=Te(r);l<0&&c<0?o(0):l>0&&c>0&&a(0)}if(s===r){let l=1;(r>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(l=Math.abs(r*.05)),o(r+l),t||a(s-l)}this.min=s,this.max=r}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,a=dv(s,r);return t.bounds==="ticks"&&Wr(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ni(t,this.chart.options.locale,this.options.ticks.format)}},Hs=class extends Wi{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=jt(t)?t:0,this.max=jt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=ye(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}};Hs.id="linear";Hs.defaults={ticks:{callback:Os.formatters.numeric}};function Dh(n){return n/Math.pow(10,Math.floor(ve(n)))===1}function pv(n,t){let e=Math.floor(ve(t.max)),i=Math.ceil(t.max/Math.pow(10,e)),s=[],r=me(n.min,Math.pow(10,Math.floor(ve(t.min)))),a=Math.floor(ve(r)),o=Math.floor(r/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do s.push({value:r,major:Dh(r)}),++o,o===10&&(o=1,++a,l=a>=0?1:l),r=Math.round(o*Math.pow(10,a)*l)/l;while(a<e||a===e&&o<i);let c=me(n.max,r);return s.push({value:c,major:Dh(r)}),s}var Vs=class extends mn{constructor(t){super(t);this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=Wi.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return jt(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=jt(t)?Math.max(0,t):null,this.max=jt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,s=this.max,r=l=>i=t?i:l,a=l=>s=e?s:l,o=(l,c)=>Math.pow(10,Math.floor(ve(l))+c);i===s&&(i<=0?(r(1),a(10)):(r(o(i,-1)),a(o(s,1)))),i<=0&&r(o(s,-1)),s<=0&&a(o(i,1)),this._zero&&this.min!==this._suggestedMin&&i===o(this.min,0)&&r(o(i,-1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=pv(e,this);return t.bounds==="ticks"&&Wr(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":ni(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=ve(t),this._valueRange=ve(this.max)-ve(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ve(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};Vs.id="logarithmic";Vs.defaults={ticks:{callback:Os.formatters.logarithmic,major:{enabled:!0}}};function Ha(n){let t=n.ticks;if(t.display&&n.display){let e=ie(t.backdropPadding);return at(t.font&&t.font.size,dt.font.size)+e.height}return 0}function gv(n,t,e){return e=Dt(e)?e:[e],{w:tc(n,t.string,e),h:e.length*t.lineHeight}}function Ah(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function mv(n){let t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,a=n.options.pointLabels,o=a.centerPointLabels?$t/r:0;for(let l=0;l<r;l++){let c=a.setContext(n.getPointLabelContext(l));s[l]=c.padding;let u=n.getPointPosition(l,n.drawingArea+s[l],o),d=qt(c.font),g=gv(n.ctx,d,n._pointLabels[l]);i[l]=g;let p=he(n.getIndexAngle(l)+o),b=Math.round(ds(p)),x=Ah(b,u.x,g.w,0,180),M=Ah(b,u.y,g.h,90,270);bv(e,t,p,x,M)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=vv(n,i,s)}function bv(n,t,e,i,s){let r=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),o=0,l=0;i.start<t.l?(o=(t.l-i.start)/r,n.l=Math.min(n.l,t.l-o)):i.end>t.r&&(o=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+o)),s.start<t.t?(l=(t.t-s.start)/a,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,n.b=Math.max(n.b,t.b+l))}function vv(n,t,e){let i=[],s=n._pointLabels.length,r=n.options,a=Ha(r)/2,o=n.drawingArea,l=r.pointLabels.centerPointLabels?$t/s:0;for(let c=0;c<s;c++){let u=n.getPointPosition(c,o+a+e[c],l),d=Math.round(ds(he(u.angle+Bt))),g=t[c],p=xv(u.y,g.h,d),b=_v(d),x=yv(u.x,g.w,b);i.push({x:u.x,y:p,textAlign:b,left:x,top:p,right:x+g.w,bottom:p+g.h})}return i}function _v(n){return n===0||n===180?"center":n<180?"left":"right"}function yv(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function xv(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function kv(n,t){let{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){let r=i.setContext(n.getPointLabelContext(s)),a=qt(r.font),{x:o,y:l,textAlign:c,left:u,top:d,right:g,bottom:p}=n._pointLabelItems[s],{backdropColor:b}=r;if(!vt(b)){let x=dn(r.borderRadius),M=ie(r.backdropPadding);e.fillStyle=b;let C=u-M.left,P=d-M.top,$=g-u+M.width,R=p-d+M.height;Object.values(x).some(F=>F!==0)?(e.beginPath(),Qn(e,{x:C,y:P,w:$,h:R,radius:x}),e.fill()):e.fillRect(C,P,$,R)}fn(e,n._pointLabels[s],o,l+a.lineHeight/2,a,{color:r.color,textAlign:c,textBaseline:"middle"})}}function Lh(n,t,e,i){let{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,Et);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let a=1;a<i;a++)r=n.getPointPosition(a,t),s.lineTo(r.x,r.y)}}function wv(n,t,e,i){let s=n.ctx,r=t.circular,{color:a,lineWidth:o}=t;!r&&!i||!a||!o||e<0||(s.save(),s.strokeStyle=a,s.lineWidth=o,s.setLineDash(t.borderDash),s.lineDashOffset=t.borderDashOffset,s.beginPath(),Lh(n,e,r,i),s.closePath(),s.stroke(),s.restore())}function Sv(n,t,e){return Ge(n,{label:e,index:t,type:"pointLabel"})}var si=class extends Wi{constructor(t){super(t);this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=ie(Ha(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=jt(t)&&!isNaN(t)?t:0,this.max=jt(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Ha(this.options))}generateTickLabels(t){Wi.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let s=At(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?mv(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=Et/(this._pointLabels.length||1),i=this.options.startAngle||0;return he(t*e+ye(i))}getDistanceFromCenterForValue(t){if(vt(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(vt(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){let i=e[t];return Sv(this.getContext(),t,i)}}getPointPosition(t,e,i=0){let s=this.getIndexAngle(t)-Bt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:i,right:s,bottom:r}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:r}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),Lh(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:i,grid:s}=e,r=this._pointLabels.length,a,o,l;if(e.pointLabels.display&&kv(this,r),s.display&&this.ticks.forEach((c,u)=>{if(u!==0){o=this.getDistanceFromCenterForValue(c.value);let d=s.setContext(this.getContext(u-1));wv(this,d,o,r)}}),i.display){for(t.save(),a=r-1;a>=0;a--){let c=i.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:d}=c;!d||!u||(t.lineWidth=d,t.strokeStyle=u,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,o=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(a,o),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let s=this.getIndexAngle(0),r,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((o,l)=>{if(l===0&&!e.reverse)return;let c=i.setContext(this.getContext(l)),u=qt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,a=t.measureText(o.label).width,t.fillStyle=c.backdropColor;let d=ie(c.backdropPadding);t.fillRect(-a/2-d.left,-r-u.size/2-d.top,a+d.width,u.size+d.height)}fn(t,o.label,0,-r,u,{color:c.color})}),t.restore()}drawTitle(){}};si.id="radialLinear";si.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Os.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};si.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};si.descriptors={angleLines:{_fallback:"grid"}};var Ws={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}},fe=Object.keys(Ws);function Mv(n,t){return n-t}function Rh(n,t){if(vt(t))return null;let e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts,a=t;return typeof i=="function"&&(a=i(a)),jt(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Tn(r)||r===!0)?e.startOf(a,"isoWeek",r):e.startOf(a,s)),+a)}function Fh(n,t,e,i){let s=fe.length;for(let r=fe.indexOf(n);r<s-1;++r){let a=Ws[fe[r]],o=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(o*a.size))<=i)return fe[r]}return fe[s-1]}function Cv(n,t,e,i,s){for(let r=fe.length-1;r>=fe.indexOf(e);r--){let a=fe[r];if(Ws[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return fe[e?fe.indexOf(e):0]}function Tv(n){for(let t=fe.indexOf(n)+1,e=fe.length;t<e;++t)if(Ws[fe[t]].common)return fe[t]}function $h(n,t,e){if(!e)n[t]=!0;else if(e.length){let{lo:i,hi:s}=gs(e,t),r=e[i]>=t?e[i]:e[s];n[r]=!0}}function Pv(n,t,e,i){let s=n._adapter,r=+s.startOf(t[0].value,i),a=t[t.length-1].value,o,l;for(o=r;o<=a;o=+s.add(o,1,i))l=e[o],l>=0&&(t[l].major=!0);return t}function Ih(n,t,e){let i=[],s={},r=t.length,a,o;for(a=0;a<r;++a)o=t[a],s[o]=a,i.push({value:o,major:!1});return r===0||!e?i:Pv(n,i,s,e)}var ri=class extends mn{constructor(t){super(t);this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){let i=t.time||(t.time={}),s=this._adapter=new Ca._date(t.adapters.date);s.init(e),Gn(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Rh(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:s,max:r,minDefined:a,maxDefined:o}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!o&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!a||!o)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=jt(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),r=jt(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,r-1),this.max=Math.max(s+1,r)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);let r=this.min,a=this.max,o=Il(s,r,a);return this._unit=e.unit||(i.autoSkip?Fh(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):Cv(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Tv(this._unit),this.initOffsets(s),t.reverse&&o.reverse(),Ih(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=Gt(e,0,a),i=Gt(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,a=r.unit||Fh(r.minUnit,e,i,this._getLabelCapacity(e)),o=at(r.stepSize,1),l=a==="week"?r.isoWeekday:!1,c=Tn(l)||l===!0,u={},d=e,g,p;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(i,e,a)>1e5*o)throw new Error(e+" and "+i+" are too far apart with stepSize of "+o+" "+a);let b=s.ticks.source==="data"&&this.getDataTimestamps();for(g=d,p=0;g<i;g=+t.add(g,o,a),p++)$h(u,g,b);return(g===i||s.bounds==="ticks"||p===1)&&$h(u,g,b),Object.keys(u).sort((x,M)=>x-M).map(x=>+x)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){let r=this.options,a=r.time.displayFormats,o=this._unit,l=this._majorUnit,c=o&&a[o],u=l&&a[l],d=i[e],g=l&&u&&d&&d.major,p=this._adapter.format(t,s||(g?u:c)),b=r.ticks.callback;return b?At(b,[p,e,i],this):p}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,s=ye(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(s),a=Math.sin(s),o=this._resolveTickFontOptions(0).size;return{w:i*r+o*a,h:i*a+o*r}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,r=this._tickFormatFunction(t,0,Ih(this,[t],this._majorUnit),s),a=this._getLabelSize(r),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,i;if(t.length)return t;let s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Rh(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Xr(t.sort(Mv))}};ri.id="time";ri.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};function Ys(n,t,e){let i=0,s=n.length-1,r,a,o,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Fe(n,"pos",t)),{pos:r,time:o}=n[i],{pos:a,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Fe(n,"time",t)),{time:r,pos:o}=n[i],{time:a,pos:l}=n[s]);let c=a-r;return c?o+(l-o)*(t-r)/c:o}var qs=class extends ri{constructor(t){super(t);this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ys(e,this.min),this._tableRange=Ys(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,s=[],r=[],a,o,l,c,u;for(a=0,o=t.length;a<o;++a)c=t[a],c>=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,o=s.length;a<o;++a)u=s[a+1],l=s[a-1],c=s[a],Math.round((u+l)/2)!==c&&r.push({time:c,pos:a/(o-1)});return r}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Ys(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Ys(this._table,i*this._tableRange+this._minPos,!0)}};qs.id="timeseries";qs.defaults=ri.defaults;var Ev=Object.freeze({__proto__:null,CategoryScale:Vi,LinearScale:Hs,LogarithmicScale:Vs,RadialLinearScale:si,TimeScale:ri,TimeSeriesScale:qs}),zh=[vb,S0,cv,Ev];var Pe=Ae(require("obsidian"));var Ov={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};Ca._date.override(typeof Pe.moment=="function"?{_id:"moment",formats:function(){return Ov},parse:function(n,t){return typeof n=="string"&&typeof t=="string"?n=(0,Pe.moment)(n,t):n instanceof Pe.moment||(n=(0,Pe.moment)(n)),n.isValid()?n.valueOf():null},format:function(n,t){return(0,Pe.moment)(n).format(t)},add:function(n,t,e){return(0,Pe.moment)(n).add(t,e).valueOf()},diff:function(n,t,e){return(0,Pe.moment)(n).diff((0,Pe.moment)(t),e)},startOf:function(n,t,e){return n=(0,Pe.moment)(n),t==="isoWeek"?(e=Math.trunc(Math.min(Math.max(0,e),6)),n.isoWeekday(e).startOf("day").valueOf()):n.startOf(t).valueOf()},endOf:function(n,t){return(0,Pe.moment)(n).endOf(t).valueOf()}}:{});var Xs=Ae(require("obsidian"));var jh=Ae(Bh());function Ze(n,t=.25){if(typeof t!="number")throw"Provided alpha value is not a number";return n.map(e=>(0,jh.default)(e.trim()).alpha(t).hex())}function Je(n,t){var i,s;let e=t.createDiv({cls:"chart-error"});e.createEl("b",{text:"Couldn't render Chart:"}),e.createEl("pre").createEl("code",{text:(s=(i=n.toString)==null?void 0:i.call(n))!=null?s:n}),e.createEl("hr"),e.createEl("span").innerHTML="You might also want to look for further Errors in the Console: Press <kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>I</kbd> to open it."}function Dv(n){for(var t=window.atob(n),e=t.length,i=new Uint8Array(e),s=0;s<e;s++)i[s]=t.charCodeAt(s);return i.buffer}async function Nh(n,t,e,i,s){let r=await e.imageRenderer(n.getSelection(),s.imageSettings);console.log("image converted");let a=await t.vault.createBinary(await t.vault.getAvailablePathForAttachments(`Chart ${new Date().toDateString()}`,s.imageSettings.format.split("/").last(),i),Dv(r));console.log("Image saved"),n.replaceSelection(t.fileManager.generateMarkdownLink(a,i.path))}var Yh=Ae(require("obsidian")),qh=Ae(Wh());async function qa(n,t){let{labels:e,dataFields:i}=Ga(n.getSelection(),t),s=`\`\`\`chart
type: bar
labels: [${e}]
series:
${i.map(r=>` - title: ${r.dataTitle}
data: [${r.data}]`).join(`
`)}
width: 80%
beginAtZero: true
\`\`\``;n.replaceSelection(s)}function Ga(n,t,e){let i;try{i=qh.Extractor.extractObject(n,t,!1)}catch(a){throw new Yh.Notice("Table malformed"),a}let s=Object.keys(Object.values(i)[0]),r=Object.keys(i).map(a=>({dataTitle:a,data:Object.values(i[a])}));return e&&(r=r.filter(a=>e.contains(a.dataTitle))),{labels:s,dataFields:r}}ue.register(...zh);var Us=class{constructor(t){this.plugin=t}async datasetPrep(t,e,i=!1){var c,u,d,g;let s=[];if(!t.id){let p=[];if(this.plugin.settings.themeable||i){let b=1;for(;;){let x=getComputedStyle(e).getPropertyValue(`--chart-color-${b}`);if(x)p.push(x),b++;else break}}for(let b=0;t.series.length>b;b++)s.push({label:(c=t.series[b].title)!=null?c:"",data:t.series[b].data,backgroundColor:t.labelColors?p.length?Ze(p,t.transparency):Ze(this.plugin.settings.colors,t.transparency):p.length?Ze(p,t.transparency)[b]:Ze(this.plugin.settings.colors,t.transparency)[b],borderColor:t.labelColors?p.length?p:this.plugin.settings.colors:p.length?p[b]:this.plugin.settings.colors[b],borderWidth:1,fill:t.fill?t.stacked?b==0?"origin":"-1":!0:!1,tension:(u=t.tension)!=null?u:0})}let r=t.time?{type:"time",time:{unit:t.time}}:null,a=t.labels,o=getComputedStyle(e).getPropertyValue("--background-modifier-border"),l;return ue.defaults.color=getComputedStyle(e).getPropertyValue("--text-muted"),ue.defaults.font.family=getComputedStyle(e).getPropertyValue("--mermaid-font"),ue.defaults.plugins=pi(di({},ue.defaults.plugins),{legend:pi(di({},ue.defaults.plugins.legend),{display:(d=t.legend)!=null?d:!0,position:(g=t.legendPosition)!=null?g:"top"})}),ue.defaults.layout.padding=t.padding,t.type=="radar"||t.type=="polarArea"?l={type:t.type,data:{labels:a,datasets:s},options:{animation:{duration:0},scales:{r:pi(di({},r),{grid:{color:o},beginAtZero:t.beginAtZero,max:t.rMax,min:t.rMin,ticks:{backdropColor:o}})}}}:t.type=="bar"||t.type=="line"?l={type:t.type,data:{labels:a,datasets:s},options:{animation:{duration:0},indexAxis:t.indexAxis,spanGaps:t.spanGaps,scales:{y:{min:t.yMin,max:t.yMax,reverse:t.yReverse,ticks:{display:t.yTickDisplay,padding:t.yTickPadding},display:t.yDisplay,stacked:t.stacked,beginAtZero:t.beginAtZero,grid:{color:o},title:{display:t.yTitle,text:t.yTitle}},x:pi(di({},r),{min:t.xMin,max:t.xMax,reverse:t.xReverse,ticks:{display:t.xTickDisplay,padding:t.xTickPadding},display:t.xDisplay,stacked:t.stacked,grid:{color:o},title:{display:t.xTitle,text:t.xTitle}})}}}:l={type:t.type,data:{labels:a,datasets:s},options:{animation:{duration:0},spanGaps:t.spanGaps}},{chartOptions:l,width:t.width}}async imageRenderer(t,e){let i=l=>new Promise(c=>setTimeout(c,l)),s=document.createElement("canvas"),r=s.getContext("2d"),a=await this.datasetPrep(await(0,Xs.parseYaml)(t.replace("```chart","").replace("```","").replace(/\t/g," ")),document.body);new ue(r,a.chartOptions),document.body.append(s),await i(250);let o=s.toDataURL(e.format,e.quality);return document.body.removeChild(s),o.substring(o.indexOf(",")+1)}renderRaw(t,e){var s;let i=e.createEl("canvas");if(t.chartOptions)try{let r=new ue(i.getContext("2d"),t.chartOptions);return i.parentElement.style.width=(s=t.width)!=null?s:"100%",i.parentElement.style.margin="auto",r}catch(r){return Je(r,e),null}else try{return new ue(i.getContext("2d"),t)}catch(r){return Je(r,e),null}}async renderFromYaml(t,e,i){this.plugin.app.workspace.onLayoutReady(()=>i.addChild(new Gh(t,e,this,i.sourcePath)))}},Gh=class extends Xs.MarkdownRenderChild{constructor(t,e,i,s){super(e);this.el=e,this.data=t,this.renderer=i,this.ownPath=s,this.changeHandler=this.changeHandler.bind(this),this.reload=this.reload.bind(this)}async onload(){var t,e,i,s;try{let r=await this.renderer.datasetPrep(this.data,this.el),a={};if(this.data.id){let o=[];if(this.renderer.plugin.settings.themeable){let g=1;for(;;){let p=getComputedStyle(this.el).getPropertyValue(`--chart-color-${g}`);if(p)o.push(p),g++;else break}}a.datasets=[];let l;this.data.file&&(l=this.renderer.plugin.app.metadataCache.getFirstLinkpathDest(this.data.file,this.renderer.plugin.app.workspace.getActiveFile().path));let c=(t=this.renderer.plugin.app.metadataCache.getFileCache(l!=null?l:this.renderer.plugin.app.vault.getAbstractFileByPath(this.ownPath)).sections.find(g=>g.id===this.data.id))==null?void 0:t.position;if(!c)throw"Invalid id and/or file";let u=(await this.renderer.plugin.app.vault.cachedRead(this.data.file?l:this.renderer.plugin.app.vault.getAbstractFileByPath(this.ownPath))).substring(c.start.offset,c.end.offset),d;try{d=Ga(u,(e=this.data.layout)!=null?e:"columns",this.data.select)}catch(g){throw"There is no table at that id and/or file"}a.labels=d.labels;for(let g=0;d.dataFields.length>g;g++)a.datasets.push({label:(i=d.dataFields[g].dataTitle)!=null?i:"",data:d.dataFields[g].data,backgroundColor:this.data.labelColors?o.length?Ze(o,this.data.transparency):Ze(this.renderer.plugin.settings.colors,this.data.transparency):o.length?Ze(o,this.data.transparency)[g]:Ze(this.renderer.plugin.settings.colors,this.data.transparency)[g],borderColor:this.data.labelColors?o.length?o:this.renderer.plugin.settings.colors:o.length?o[g]:this.renderer.plugin.settings.colors[g],borderWidth:1,fill:this.data.fill?this.data.stacked?g==0?"origin":"-1":!0:!1,tension:(s=this.data.tension)!=null?s:0});r.chartOptions.data.labels=a.labels,r.chartOptions.data.datasets=a.datasets}this.chart=this.renderer.renderRaw(r,this.containerEl)}catch(r){Je(r,this.el)}this.data.id&&this.renderer.plugin.app.metadataCache.on("changed",this.changeHandler),this.renderer.plugin.app.workspace.on("css-change",this.reload)}changeHandler(t){(this.data.file?t.basename===this.data.file:t.path===this.ownPath)&&this.reload()}reload(){this.onunload(),this.onload()}onunload(){this.renderer.plugin.app.metadataCache.off("changed",this.changeHandler),this.renderer.plugin.app.workspace.off("css-change",this.reload),this.el.empty(),this.chart&&this.chart.destroy(),this.chart=null}};var Ks={colors:["rgba(255, 99, 132, 1)","rgba(54, 162, 235, 1)","rgba(255, 206, 86, 1)","rgba(75, 192, 192, 1)","rgba(153, 102, 255, 1)","rgba(255, 159, 64, 1)"],contextMenu:!0,imageSettings:{format:"image/png",quality:.92},themeable:!1};var Be=Ae(require("obsidian"));var Xa=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")},Ua=function(){function n(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}(),Zs=function(){function n(t,e){var i=[],s=!0,r=!1,a=void 0;try{for(var o=t[Symbol.iterator](),l;!(s=(l=o.next()).done)&&(i.push(l.value),!(e&&i.length===e));s=!0);}catch(c){r=!0,a=c}finally{try{!s&&o.return&&o.return()}finally{if(r)throw a}}return i}return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return n(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();String.prototype.startsWith=String.prototype.startsWith||function(n){return this.indexOf(n)===0};String.prototype.padStart=String.prototype.padStart||function(n,t){for(var e=this;e.length<n;)e=t+e;return e};var Rv={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Xh(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,e=t>0?n.toFixed(t).replace(/0+$/,"").replace(/\.$/,""):n.toString();return e||"0"}var Fv=function(){function n(t,e,i,s){Xa(this,n);var r=this;function a(l){if(l.startsWith("hsl")){var c=l.match(/([\-\d\.e]+)/g).map(Number),u=Zs(c,4),d=u[0],g=u[1],p=u[2],b=u[3];b===void 0&&(b=1),d/=360,g/=100,p/=100,r.hsla=[d,g,p,b]}else if(l.startsWith("rgb")){var x=l.match(/([\-\d\.e]+)/g).map(Number),M=Zs(x,4),C=M[0],P=M[1],$=M[2],R=M[3];R===void 0&&(R=1),r.rgba=[C,P,$,R]}else l.startsWith("#")?r.rgba=n.hexToRgb(l):r.rgba=n.nameToRgb(l)||n.hexToRgb(l)}if(t!==void 0)if(Array.isArray(t))this.rgba=t;else if(i===void 0){var o=t&&""+t;o&&a(o.toLowerCase())}else this.rgba=[t,e,i,s===void 0?1:s]}return Ua(n,[{key:"printRGB",value:function(e){var i=e?this.rgba:this.rgba.slice(0,3),s=i.map(function(r,a){return Xh(r,a===3?3:0)});return e?"rgba("+s+")":"rgb("+s+")"}},{key:"printHSL",value:function(e){var i=[360,100,100,1],s=["","%","%",""],r=e?this.hsla:this.hsla.slice(0,3),a=r.map(function(o,l){return Xh(o*i[l],l===3?3:1)+s[l]});return e?"hsla("+a+")":"hsl("+a+")"}},{key:"printHex",value:function(e){var i=this.hex;return e?i:i.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=n.hslToRgb(this._hsla)},set:function(e){e.length===3&&(e[3]=1),this._rgba=e,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=n.rgbToHsl(this._rgba)},set:function(e){e.length===3&&(e[3]=1),this._hsla=e,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){var e=this.rgba,i=e.map(function(s,r){return r<3?s.toString(16):Math.round(s*255).toString(16)});return"#"+i.map(function(s){return s.padStart(2,"0")}).join("")},set:function(e){this.rgba=n.hexToRgb(e)}}],[{key:"hexToRgb",value:function(e){var i=(e.startsWith("#")?e.slice(1):e).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!i.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+e);var s=i.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function(r){return parseInt(r,16)});return s[3]=s[3]/255,s}},{key:"nameToRgb",value:function(e){var i=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),s=Rv[i];return s===void 0?s:n.hexToRgb(s.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var i=Zs(e,4),s=i[0],r=i[1],a=i[2],o=i[3];s/=255,r/=255,a/=255;var l=Math.max(s,r,a),c=Math.min(s,r,a),u=void 0,d=void 0,g=(l+c)/2;if(l===c)u=d=0;else{var p=l-c;switch(d=g>.5?p/(2-l-c):p/(l+c),l){case s:u=(r-a)/p+(r<a?6:0);break;case r:u=(a-s)/p+2;break;case a:u=(s-r)/p+4;break}u/=6}return[u,d,g,o]}},{key:"hslToRgb",value:function(e){var i=Zs(e,4),s=i[0],r=i[1],a=i[2],o=i[3],l=void 0,c=void 0,u=void 0;if(r===0)l=c=u=a;else{var d=function(M,C,P){return P<0&&(P+=1),P>1&&(P-=1),P<1/6?M+(C-M)*6*P:P<1/2?C:P<2/3?M+(C-M)*(2/3-P)*6:M},g=a<.5?a*(1+r):a+r-a*r,p=2*a-g;l=d(p,g,s+1/3),c=d(p,g,s),u=d(p,g,s-1/3)}var b=[l*255,c*255,u*255].map(Math.round);return b[3]=o,b}}]),n}(),$v=function(){function n(){Xa(this,n),this._events=[]}return Ua(n,[{key:"add",value:function(e,i,s){e.addEventListener(i,s,!1),this._events.push({target:e,type:i,handler:s})}},{key:"remove",value:function(e,i,s){this._events=this._events.filter(function(r){var a=!0;return e&&e!==r.target&&(a=!1),i&&i!==r.type&&(a=!1),s&&s!==r.handler&&(a=!1),a&&n._doRemove(r.target,r.type,r.handler),!a})}},{key:"destroy",value:function(){this._events.forEach(function(e){return n._doRemove(e.target,e.type,e.handler)}),this._events=[]}}],[{key:"_doRemove",value:function(e,i,s){e.removeEventListener(i,s,!1)}}]),n}();function Iv(n){var t=document.createElement("div");return t.innerHTML=n,t.firstElementChild}function Ka(n,t,e){var i=!1;function s(l,c,u){return Math.max(c,Math.min(l,u))}function r(l,c,u){if(u&&(i=!0),!!i){l.preventDefault();var d=t.getBoundingClientRect(),g=d.width,p=d.height,b=c.clientX,x=c.clientY,M=s(b-d.left,0,g),C=s(x-d.top,0,p);e(M/g,C/p)}}function a(l,c){var u=l.buttons===void 0?l.which:l.buttons;u===1?r(l,l,c):i=!1}function o(l,c){l.touches.length===1?r(l,l.touches[0],c):i=!1}n.add(t,"mousedown",function(l){a(l,!0)}),n.add(t,"touchstart",function(l){o(l,!0)}),n.add(window,"mousemove",a),n.add(t,"touchmove",o),n.add(window,"mouseup",function(l){i=!1}),n.add(t,"touchend",function(l){i=!1}),n.add(t,"touchcancel",function(l){i=!1})}var zv=`linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,
linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`,Bv=360,Uh="keydown",Js="mousedown",Za="focusin";function ze(n,t){return(t||document).querySelector(n)}function Kh(n){n.preventDefault(),n.stopPropagation()}function Ja(n,t,e,i,s){n.add(t,Uh,function(r){e.indexOf(r.key)>=0&&(s&&Kh(r),i(r))})}var Qa=function(){function n(t){Xa(this,n),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new $v,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return Ua(n,[{key:"setOptions",value:function(e){var i=this;if(!e)return;var s=this.settings;function r(c,u,d){for(var g in c)d&&d.indexOf(g)>=0||(u[g]=c[g])}if(e instanceof HTMLElement)s.parent=e;else{s.parent&&e.parent&&s.parent!==e.parent&&(this._events.remove(s.parent),this._popupInited=!1),r(e,s),e.onChange&&(this.onChange=e.onChange),e.onDone&&(this.onDone=e.onDone),e.onOpen&&(this.onOpen=e.onOpen),e.onClose&&(this.onClose=e.onClose);var a=e.color||e.colour;a&&this._setColor(a)}var o=s.parent;if(o&&s.popup&&!this._popupInited){var l=function(u){return i.openHandler(u)};this._events.add(o,"click",l),Ja(this._events,o,[" ","Spacebar","Enter"],l),this._popupInited=!0}else e.parent&&!s.popup&&this.show()}},{key:"openHandler",value:function(e){if(this.show()){e&&e.preventDefault(),this.settings.parent.style.pointerEvents="none";var i=e&&e.type===Uh?this._domEdit:this.domElement;setTimeout(function(){return i.focus()},100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(e){var i=e&&e.type,s=!1;if(!e)s=!0;else if(i===Js||i===Za){var r=(this.__containedEvent||0)+100;e.timeStamp>r&&(s=!0)}else Kh(e),s=!0;s&&this.hide()&&(this.settings.parent.style.pointerEvents="",i!==Js&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(e,i){this.closeHandler(),this.setOptions(e),i&&this.openHandler()}},{key:"setColor",value:function(e,i){this._setColor(e,{silent:i})}},{key:"_setColor",value:function(e,i){if(typeof e=="string"&&(e=e.trim()),!!e){i=i||{};var s=void 0;try{s=new Fv(e)}catch(a){if(i.failSilently)return;throw a}if(!this.settings.alpha){var r=s.hsla;r[3]=1,s.hsla=r}this.colour=this.color=s,this._setHSLA(null,null,null,null,i)}}},{key:"setColour",value:function(e,i){this.setColor(e,i)}},{key:"show",value:function(){var e=this.settings.parent;if(!e)return!1;if(this.domElement){var i=this._toggleDOM(!0);return this._setPosition(),i}var s=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',r=Iv(s);return this.domElement=r,this._domH=ze(".picker_hue",r),this._domSL=ze(".picker_sl",r),this._domA=ze(".picker_alpha",r),this._domEdit=ze(".picker_editor input",r),this._domSample=ze(".picker_sample",r),this._domOkay=ze(".picker_done button",r),this._domCancel=ze(".picker_cancel button",r),r.classList.add("layout_"+this.settings.layout),this.settings.alpha||r.classList.add("no_alpha"),this.settings.editor||r.classList.add("no_editor"),this.settings.cancelButton||r.classList.add("no_cancel"),this._ifPopup(function(){return r.classList.add("popup")}),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var e=this,i=this,s=this.domElement,r=this._events;function a(c,u,d){r.add(c,u,d)}a(s,"click",function(c){return c.preventDefault()}),Ka(r,this._domH,function(c,u){return i._setHSLA(c)}),Ka(r,this._domSL,function(c,u){return i._setHSLA(null,c,1-u)}),this.settings.alpha&&Ka(r,this._domA,function(c,u){return i._setHSLA(null,null,null,1-u)});var o=this._domEdit;a(o,"input",function(c){i._setColor(this.value,{fromEditor:!0,failSilently:!0})}),a(o,"focus",function(c){var u=this;u.selectionStart===u.selectionEnd&&u.select()}),this._ifPopup(function(){var c=function(g){return e.closeHandler(g)};a(window,Js,c),a(window,Za,c),Ja(r,s,["Esc","Escape"],c);var u=function(g){e.__containedEvent=g.timeStamp};a(s,Js,u),a(s,Za,u),a(e._domCancel,"click",c)});var l=function(u){e._ifPopup(function(){return e.closeHandler(u)}),e.onDone&&e.onDone(e.colour)};a(this._domOkay,"click",l),Ja(r,s,["Enter"],l)}},{key:"_setPosition",value:function(){var e=this.settings.parent,i=this.domElement;e!==i.parentNode&&e.appendChild(i),this._ifPopup(function(s){getComputedStyle(e).position==="static"&&(e.style.position="relative");var r=s===!0?"popup_right":"popup_"+s;["popup_top","popup_bottom","popup_left","popup_right"].forEach(function(a){a===r?i.classList.add(a):i.classList.remove(a)}),i.classList.add(r)})}},{key:"_setHSLA",value:function(e,i,s,r,a){a=a||{};var o=this.colour,l=o.hsla;[e,i,s,r].forEach(function(c,u){(c||c===0)&&(l[u]=c)}),o.hsla=l,this._updateUI(a),this.onChange&&!a.silent&&this.onChange(o)}},{key:"_updateUI",value:function(e){if(!this.domElement)return;e=e||{};var i=this.colour,s=i.hsla,r="hsl("+s[0]*Bv+", 100%, 50%)",a=i.hslString,o=i.hslaString,l=this._domH,c=this._domSL,u=this._domA,d=ze(".picker_selector",l),g=ze(".picker_selector",c),p=ze(".picker_selector",u);function b(z,N,X){N.style.left=X*100+"%"}function x(z,N,X){N.style.top=X*100+"%"}b(l,d,s[0]),this._domSL.style.backgroundColor=this._domH.style.color=r,b(c,g,s[1]),x(c,g,1-s[2]),c.style.color=a,x(u,p,1-s[3]);var M=a,C=M.replace("hsl","hsla").replace(")",", 0)"),P="linear-gradient("+[M,C]+")";if(this._domA.style.background=P+", "+zv,!e.fromEditor){var $=this.settings.editorFormat,R=this.settings.alpha,F=void 0;switch($){case"rgb":F=i.printRGB(R);break;case"hsl":F=i.printHSL(R);break;default:F=i.printHex(R)}this._domEdit.value=F}this._domSample.style.color=o}},{key:"_ifPopup",value:function(e,i){this.settings.parent&&this.settings.popup?e&&e(this.settings.popup):i&&i()}},{key:"_toggleDOM",value:function(e){var i=this.domElement;if(!i)return!1;var s=e?"":"none",r=i.style.display!==s;return r&&(i.style.display=s),r}}]),n}();Qs=document.createElement("style"),Qs.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(Qs),Qa.StyleElement=Qs;var Qs;var to=class extends Be.PluginSettingTab{constructor(t,e){super(t,e);this.plugin=e}isColor(t){var e=new Option().style;return e.color=t,e.color==t}display(){let{containerEl:t,plugin:e}=this;t.empty(),t.createEl("h2",{text:"Settings - Obsidian Charts"}),t.createEl("h3",{text:"General"}),new Be.Setting(t).setName("Show Button in Context Menu").setDesc("If enabled, you will se a Button in your Editor Context Menu to open the Chart Creator.").addToggle(r=>{r.setValue(this.plugin.settings.contextMenu).onChange(async a=>{e.settings.contextMenu=a,await e.saveSettings()})}),new Be.Setting(t).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development:").addButton(r=>{r.buttonEl.outerHTML='<a href="https://ko-fi.com/phibr0"><img src="https://uploads-ssl.webflow.com/5c14e387dab576fe667689cf/61e11e22d8ff4a5b4a1b3346_Supportbutton-1.png"></a>'}),t.createEl("h3",{text:"Colors",attr:{style:"margin-bottom: 0"}});let i=t.createEl("p",{cls:"setting-item-description"});i.append("Set the Colors for your Charts. This will set the border Color and the inner Color will be the same, but with less opacity. This ensures better compatibility with Dark and Light Mode. ","You can use any ",i.createEl("a",{href:"https://www.w3schools.com/cssref/css_colors.asp",text:"valid CSS Color."})),new Be.Setting(t).setName("Enable Theme Colors").setDesc("If your Obsidian Theme (or snippet) provides Colors you can use them instead.").addToggle(r=>{r.setValue(e.settings.themeable).onChange(async a=>{e.settings.themeable=a,await e.saveSettings(),this.display()})}),e.settings.themeable||(e.settings.colors.forEach((r,a)=>{let o=document.createDocumentFragment();o.createSpan({text:"\u25CF",attr:{style:`color: ${r}`}}),o.appendText(` Color #${a+1}`),new Be.Setting(t).setName(o).setDesc("This will be the border Color used in the Charts you create.").addButton(l=>{l.setButtonText("Change Color"),new Qa({parent:l.buttonEl,onDone:async c=>{this.plugin.settings.colors[a]=c.hex,await this.plugin.saveSettings(),this.display()},popup:"left",color:r,alpha:!1})}).addExtraButton(l=>{l.setIcon("trash").setTooltip("Remove").onClick(async()=>{this.plugin.settings.colors.remove(r),await this.plugin.saveSettings(),this.display()}),this.plugin.settings.colors.length===1&&l.setDisabled(!0)}).addExtraButton(l=>{l.setIcon("reset").setTooltip("Reset to default").onClick(async()=>{var c;this.plugin.settings.colors[a]=(c=Ks.colors[a])!=null?c:"#ffffff",await this.plugin.saveSettings(),this.display()})})}),new Be.Setting(t).addButton(r=>{r.setButtonText("Add Color").onClick(async()=>{this.plugin.settings.colors.push("#ffffff"),await this.plugin.saveSettings(),this.display()})})),t.createEl("h3",{text:"Chart to Image Converter"});let s=t.createEl("details");s.createEl("summary",{text:"How to use"}),s.createEl("img",{attr:{src:"https://media.discordapp.net/attachments/855181471643861002/897811615037136966/charttoimage.gif"}}),new Be.Setting(t).setName("Image Format").setDesc("The Format to be used, when generating a Image from a Chart.").addDropdown(r=>{r.addOptions({"image/jpeg":"jpeg","image/png":"png","image/webp":"webp"}),r.setValue(e.settings.imageSettings.format),r.onChange(async a=>{e.settings.imageSettings.format=a,await e.saveSettings()})}),new Be.Setting(t).setName("Image Quality").setDesc("If using a lossy format, set the Image Quality.").addSlider(r=>{r.setDynamicTooltip().setLimits(.01,1,.01).setValue(e.settings.imageSettings.quality).onChange(async a=>{e.settings.imageSettings.quality=a,await e.saveSettings()})})}};var bu=Ae(require("obsidian"));function Yi(){}function jv(n,t){for(let e in t)n[e]=t[e];return n}function eo(n){return n()}function Zh(){return Object.create(null)}function Qe(n){n.forEach(eo)}function tr(n){return typeof n=="function"}function er(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}function Jh(n){return Object.keys(n).length===0}function Qh(n,t,e,i){if(n){let s=tu(n,t,e,i);return n[0](s)}}function tu(n,t,e,i){return n[1]&&i?jv(e.ctx.slice(),n[1](i(t))):e.ctx}function eu(n,t,e,i){if(n[2]&&i){let s=n[2](i(e));if(t.dirty===void 0)return s;if(typeof s=="object"){let r=[],a=Math.max(t.dirty.length,s.length);for(let o=0;o<a;o+=1)r[o]=t.dirty[o]|s[o];return r}return t.dirty|s}return t.dirty}function nu(n,t,e,i,s,r){if(s){let a=tu(t,e,i,r);n.p(a,s)}}function iu(n){if(n.ctx.length>32){let t=[],e=n.ctx.length/32;for(let i=0;i<e;i++)t[i]=-1;return t}return-1}var z_=new Set;var su=!1;function Nv(){su=!0}function Hv(){su=!1}function B(n,t){n.appendChild(t)}function nr(n,t,e){let i=Vv(n);if(!i.getElementById(t)){let s=Y("style");s.id=t,s.textContent=e,Wv(i,s)}}function Vv(n){if(!n)return document;let t=n.getRootNode?n.getRootNode():n.ownerDocument;return t&&t.host?t:n.ownerDocument}function Wv(n,t){return B(n.head||n,t),t.sheet}function je(n,t,e){n.insertBefore(t,e||null)}function Ee(n){n.parentNode&&n.parentNode.removeChild(n)}function ru(n,t){for(let e=0;e<n.length;e+=1)n[e]&&n[e].d(t)}function Y(n){return document.createElement(n)}function ir(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function no(n){return document.createTextNode(n)}function Lt(){return no(" ")}function Xt(n,t,e,i){return n.addEventListener(t,e,i),()=>n.removeEventListener(t,e,i)}function q(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}function io(n){return n===""?null:+n}function Yv(n){return Array.from(n.childNodes)}function au(n,t){t=""+t,n.wholeText!==t&&(n.data=t)}function oe(n,t){n.value=t??""}function Vt(n,t,e,i){e===null?n.style.removeProperty(t):n.style.setProperty(t,e,i?"important":"")}function so(n,t){for(let e=0;e<n.options.length;e+=1){let i=n.options[e];if(i.__value===t){i.selected=!0;return}}n.selectedIndex=-1}function ou(n){let t=n.querySelector(":checked")||n.options[0];return t&&t.__value}function qv(n,t,{bubbles:e=!1,cancelable:i=!1}={}){let s=document.createEvent("CustomEvent");return s.initCustomEvent(n,e,i,t),s}var B_=new Map;var qi;function Gi(n){qi=n}function Gv(){if(!qi)throw new Error("Function called outside component initialization");return qi}function ro(){let n=Gv();return(t,e,{cancelable:i=!1}={})=>{let s=n.$$.callbacks[t];if(s){let r=qv(t,e,{cancelable:i});return s.slice().forEach(a=>{a.call(n,r)}),!r.defaultPrevented}return!0}}var Xi=[];var sr=[],rr=[],lu=[],Xv=Promise.resolve(),ao=!1;function Uv(){ao||(ao=!0,Xv.then(cu))}function Ui(n){rr.push(n)}var oo=new Set,ar=0;function cu(){let n=qi;do{for(;ar<Xi.length;){let t=Xi[ar];ar++,Gi(t),Kv(t.$$)}for(Gi(null),Xi.length=0,ar=0;sr.length;)sr.pop()();for(let t=0;t<rr.length;t+=1){let e=rr[t];oo.has(e)||(oo.add(e),e())}rr.length=0}while(Xi.length);for(;lu.length;)lu.pop()();ao=!1,oo.clear(),Gi(n)}function Kv(n){if(n.fragment!==null){n.update(),Qe(n.before_update);let t=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,t),n.after_update.forEach(Ui)}}var or=new Set,Zv;function Ki(n,t){n&&n.i&&(or.delete(n),n.i(t))}function lr(n,t,e,i){if(n&&n.o){if(or.has(n))return;or.add(n),Zv.c.push(()=>{or.delete(n),i&&(e&&n.d(1),i())}),n.o(t)}else i&&i()}var j_=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var N_=new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);function hu(n){n&&n.c()}function lo(n,t,e,i){let{fragment:s,after_update:r}=n.$$;s&&s.m(t,e),i||Ui(()=>{let a=n.$$.on_mount.map(eo).filter(tr);n.$$.on_destroy?n.$$.on_destroy.push(...a):Qe(a),n.$$.on_mount=[]}),r.forEach(Ui)}function cr(n,t){let e=n.$$;e.fragment!==null&&(Qe(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Jv(n,t){n.$$.dirty[0]===-1&&(Xi.push(n),Uv(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<<t%31}function hr(n,t,e,i,s,r,a,o=[-1]){let l=qi;Gi(n);let c=n.$$={fragment:null,ctx:[],props:r,update:Yi,not_equal:s,bound:Zh(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:Zh(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let u=!1;if(c.ctx=e?e(n,t.props||{},(d,g,...p)=>{let b=p.length?p[0]:g;return c.ctx&&s(c.ctx[d],c.ctx[d]=b)&&(!c.skip_bound&&c.bound[d]&&c.bound[d](b),u&&Jv(n,d)),g}):[],c.update(),u=!0,Qe(c.before_update),c.fragment=i?i(c.ctx):!1,t.target){if(t.hydrate){Nv();let d=Yv(t.target);c.fragment&&c.fragment.l(d),d.forEach(Ee)}else c.fragment&&c.fragment.c();t.intro&&Ki(n.$$.fragment),lo(n,t.target,t.anchor,t.customElement),Hv(),cu()}Gi(l)}var Qv;typeof HTMLElement=="function"&&(Qv=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:n}=this.$$;this.$$.on_disconnect=n.map(eo).filter(tr);for(let t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(n,t,e){this[n]=e}disconnectedCallback(){Qe(this.$$.on_disconnect)}$destroy(){cr(this,1),this.$destroy=Yi}$on(n,t){if(!tr(t))return Yi;let e=this.$$.callbacks[n]||(this.$$.callbacks[n]=[]);return e.push(t),()=>{let i=e.indexOf(t);i!==-1&&e.splice(i,1)}}$set(n){this.$$set&&!Jh(n)&&(this.$$.skip_bound=!0,this.$$set(n),this.$$.skip_bound=!1)}});var Zi=class{$destroy(){cr(this,1),this.$destroy=Yi}$on(t,e){if(!tr(e))return Yi;let i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{let s=i.indexOf(e);s!==-1&&i.splice(s,1)}}$set(t){this.$$set&&!Jh(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}};var ur=Ae(require("obsidian"));function t_(n){nr(n,"svelte-1lboqqp","h3.svelte-1lboqqp{margin:0}button.svelte-1lboqqp{display:flex;justify-content:space-between;width:100%;border:none;margin:0;padding:1em 0.5em}button.svelte-1lboqqp{fill:currentColor}svg.svelte-1lboqqp{height:0.7em;width:0.7em}")}function e_(n){let t,e,i,s,r,a,o,l,c,u,d,g,p,b,x=n[3].default,M=Qh(x,n,n[2],null);return{c(){t=Y("div"),e=Y("h3"),i=Y("button"),s=no(n[0]),r=Lt(),a=ir("svg"),o=ir("path"),l=ir("path"),c=Lt(),u=Y("div"),M&&M.c(),q(o,"class","vert"),q(o,"d","M10 1V19"),q(o,"stroke","black"),q(o,"stroke-width","2"),q(l,"d","M1 10L19 10"),q(l,"stroke","black"),q(l,"stroke-width","2"),q(a,"viewBox","0 0 20 20"),q(a,"fill","none"),q(a,"class","svelte-1lboqqp"),q(i,"aria-expanded",n[1]),q(i,"class","svelte-1lboqqp"),q(e,"class","svelte-1lboqqp"),q(u,"class","contents"),u.hidden=d=!n[1],q(t,"class","collapsible")},m(C,P){je(C,t,P),B(t,e),B(e,i),B(i,s),B(i,r),B(i,a),B(a,o),B(a,l),B(t,c),B(t,u),M&&M.m(u,null),g=!0,p||(b=Xt(i,"click",n[4]),p=!0)},p(C,[P]){(!g||P&1)&&au(s,C[0]),(!g||P&2)&&q(i,"aria-expanded",C[1]),M&&M.p&&(!g||P&4)&&nu(M,x,C,C[2],g?eu(x,C[2],P,null):iu(C[2]),null),(!g||P&2&&d!==(d=!C[1]))&&(u.hidden=d)},i(C){g||(Ki(M,C),g=!0)},o(C){lr(M,C),g=!1},d(C){C&&Ee(t),M&&M.d(C),p=!1,b()}}}function n_(n,t,e){let{$$slots:i={},$$scope:s}=t,{headerText:r}=t,a=!1,o=()=>e(1,a=!a);return n.$$set=l=>{"headerText"in l&&e(0,r=l.headerText),"$$scope"in l&&e(2,s=l.$$scope)},[r,a,s,i,o]}var uu=class extends Zi{constructor(t){super();hr(this,t,n_,e_,er,{headerText:0},t_)}},fu=uu;function i_(n){nr(n,"svelte-1tlkntj",".addMoreButtonContainer.svelte-1tlkntj{display:flex;justify-content:flex-end;margin-top:0.4rem}.subDesc.svelte-1tlkntj{font-size:smaller;opacity:0.5;margin:0}.desc.svelte-1tlkntj{padding-right:1em}.mainDesc.svelte-1tlkntj{margin:0}table.svelte-1tlkntj{margin:auto}.controlElement.svelte-1tlkntj{text-align:center}.chart-modal.svelte-1tlkntj{overflow-y:auto}.modalColumn.svelte-1tlkntj{display:flex;gap:2em}.chartPreview.svelte-1tlkntj{width:30vw;display:flex;justify-content:center;align-items:center}")}function du(n,t,e){let i=n.slice();return i[33]=t[e],i[34]=t,i[35]=e,i}function pu(n){let t,e,i,s,r,a,o,l,c,u,d;function g(){n[23].call(r,n[34],n[35])}function p(){n[24].call(c,n[34],n[35])}return{c(){t=Y("tr"),e=Y("td"),e.innerHTML=`<p class="mainDesc svelte-1tlkntj">Y Axis</p>
<p class="subDesc svelte-1tlkntj">Set Data Fields (Comma seperated)</p>`,i=Lt(),s=Y("td"),r=Y("input"),a=Lt(),o=Y("br"),l=Lt(),c=Y("input"),q(e,"class","desc svelte-1tlkntj"),q(r,"type","text"),q(r,"placeholder","Name"),q(c,"type","text"),q(c,"placeholder","1, -2, 11, 5"),Vt(c,"margin-top","3px"),q(s,"class","controlElement svelte-1tlkntj")},m(b,x){je(b,t,x),B(t,e),B(t,i),B(t,s),B(s,r),oe(r,n[33].dataTitle),B(s,a),B(s,o),B(s,l),B(s,c),oe(c,n[33].data),u||(d=[Xt(r,"input",g),Xt(c,"input",p)],u=!0)},p(b,x){n=b,x[0]&1024&&r.value!==n[33].dataTitle&&oe(r,n[33].dataTitle),x[0]&1024&&c.value!==n[33].data&&oe(c,n[33].data)},d(b){b&&Ee(t),u=!1,Qe(d)}}}function s_(n){let t,e,i,s,r,a,o,l,c,u,d,g,p,b,x,M,C,P,$,R,F;return{c(){t=Y("hr"),e=Lt(),i=Y("table"),s=Y("tr"),r=Y("td"),r.innerHTML=`<p class="mainDesc svelte-1tlkntj">Line of Best Fit</p>
<p class="subDesc svelte-1tlkntj">Create a line of best fit</p>`,a=Y("td"),o=Y("input"),l=Lt(),c=Y("tr"),u=Y("td"),u.innerHTML=`<p class="mainDesc svelte-1tlkntj">Best Fit Line ID</p>
<p class="subDesc svelte-1tlkntj">The line ID used to create the line of best fit</p>`,d=Y("td"),g=Y("input"),p=Y("br"),b=Lt(),x=Y("tr"),M=Y("td"),M.innerHTML=`<p class="mainDesc svelte-1tlkntj">Line of Best Fit Title</p>
<p class="subDesc svelte-1tlkntj">The title for the line of best fit</p>`,C=Y("td"),P=Y("input"),$=Y("br"),q(r,"class","desc svelte-1tlkntj"),q(o,"type","checkbox"),q(o,"class","task-list-item-checkbox"),Vt(o,"width","16px"),Vt(o,"height","16px"),q(a,"class","controlElement svelte-1tlkntj"),q(u,"class","desc svelte-1tlkntj"),q(g,"type","text"),q(g,"placeholder","0"),Vt(g,"width","26px"),Vt(g,"height","32px"),q(d,"class","controlElement svelte-1tlkntj"),q(M,"class","desc svelte-1tlkntj"),q(P,"type","text"),q(P,"placeholder","Line of Best Fit"),Vt(P,"width","96px"),Vt(P,"height","32px"),q(C,"class","controlElement svelte-1tlkntj"),Vt(i,"width","100%"),q(i,"class","svelte-1tlkntj")},m(z,N){je(z,t,N),je(z,e,N),je(z,i,N),B(i,s),B(s,r),B(s,a),B(a,o),o.checked=n[6],B(i,l),B(i,c),B(c,u),B(c,d),B(d,g),oe(g,n[8]),B(d,p),B(i,b),B(i,x),B(x,M),B(x,C),B(C,P),oe(P,n[7]),B(C,$),R||(F=[Xt(o,"change",n[26]),Xt(g,"input",n[27]),Xt(P,"input",n[28])],R=!0)},p(z,N){N[0]&64&&(o.checked=z[6]),N[0]&256&&g.value!==z[8]&&oe(g,z[8]),N[0]&128&&P.value!==z[7]&&oe(P,z[7])},d(z){z&&Ee(t),z&&Ee(e),z&&Ee(i),R=!1,Qe(F)}}}function r_(n){let t,e,i,s,r,a,o,l,c,u,d,g,p,b,x,M,C,P,$,R,F,z,N,X,U,nt,ot,st,kt,Ft,et,Ct,yt,Qt,de,rt,Ot,It,Wt,Ut,w,v,y,A,E,O,Z,W,J,tt,_t,zt,Tt,Nt,Ht,ae,_e,pe,_n,tn,yn,De,oi,xn,Ln,Ji,li,Rn,Ne,kn,wn,Fn,Qi,en=n[10],se=[];for(let pt=0;pt<en.length;pt+=1)se[pt]=pu(du(n,en,pt));return De=new fu({props:{headerText:"Line of Best Fit (Line chart only)",$$slots:{default:[s_]},$$scope:{ctx:n}}}),{c(){t=Y("div"),e=Y("h3"),e.textContent="Create a new Chart",i=Lt(),s=Y("div"),r=Y("div"),a=Y("table"),o=Y("tr"),l=Y("td"),l.innerHTML=`<p class="mainDesc svelte-1tlkntj">Chart Type</p>
<p class="subDesc svelte-1tlkntj">Choose a Chart Type</p>`,c=Y("td"),u=Y("select"),d=Y("option"),d.textContent="Bar",g=Y("option"),g.textContent="Line",p=Y("option"),p.textContent="Pie",b=Y("option"),b.textContent="Doughnut",x=Y("option"),x.textContent="Radar",M=Y("option"),M.textContent="Polar Area",C=Lt(),P=Y("tr"),$=Y("td"),$.innerHTML=`<p class="mainDesc svelte-1tlkntj">Smoothness</p>
<p class="subDesc svelte-1tlkntj">Changes the smoothness of the Chart</p>`,R=Y("td"),F=Y("input"),z=Lt(),N=Y("tr"),X=Y("td"),X.innerHTML=`<p class="mainDesc svelte-1tlkntj">Width</p>
<p class="subDesc svelte-1tlkntj">Changes the horizontal width</p>`,U=Y("td"),nt=Y("input"),ot=Lt(),st=Y("tr"),kt=Y("td"),kt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Fill</p>
<p class="subDesc svelte-1tlkntj">Fill the underside of the Chart</p>`,Ft=Y("td"),et=Y("input"),Ct=Lt(),yt=Y("tr"),Qt=Y("td"),Qt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Distinct Colors</p>
<p class="subDesc svelte-1tlkntj">Use distinct Colors for each Label</p>`,de=Y("td"),rt=Y("input"),Ot=Lt(),It=Y("tr"),Wt=Y("td"),Wt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Start at Zero</p>
<p class="subDesc svelte-1tlkntj">Don&#39;t cut the graph at the bottom</p>`,Ut=Y("td"),w=Y("input"),v=Lt(),y=Y("hr"),A=Lt(),E=Y("table"),O=Y("tr"),Z=Y("td"),Z.innerHTML=`<p class="mainDesc svelte-1tlkntj">X Axis</p>
<p class="subDesc svelte-1tlkntj">Set Labels (Comma seperated)</p>`,W=Lt(),J=Y("td"),tt=Y("input"),_t=Y("br"),zt=Lt(),Tt=Y("hr"),Nt=Lt(),Ht=Y("table");for(let pt=0;pt<se.length;pt+=1)se[pt].c();ae=Lt(),_e=Y("div"),pe=Y("button"),pe.textContent="Add more",_n=Lt(),tn=Y("hr"),yn=Lt(),hu(De.$$.fragment),oi=Lt(),xn=Y("div"),Ln=Y("div"),Ji=Lt(),li=Y("hr"),Rn=Lt(),Ne=Y("div"),kn=Y("button"),kn.textContent="Insert Chart",q(l,"class","desc svelte-1tlkntj"),d.__value="bar",d.value=d.__value,g.__value="line",g.value=g.__value,p.__value="pie",p.value=p.__value,b.__value="doughnut",b.value=b.__value,x.__value="radar",x.value=x.__value,M.__value="polarArea",M.value=M.__value,q(u,"name","Chart Types"),q(u,"id","chart-types"),q(u,"class","dropdown"),n[0]===void 0&&Ui(()=>n[16].call(u)),q(c,"class","controlElement svelte-1tlkntj"),q($,"class","desc svelte-1tlkntj"),q(F,"type","range"),q(F,"min","0"),q(F,"max","100"),q(F,"class","slider"),q(R,"class","controlElement svelte-1tlkntj"),q(X,"class","desc svelte-1tlkntj"),q(nt,"type","range"),q(nt,"min","20"),q(nt,"max","100"),q(nt,"class","slider"),q(U,"class","controlElement svelte-1tlkntj"),q(kt,"class","desc svelte-1tlkntj"),q(et,"type","checkbox"),q(et,"class","task-list-item-checkbox"),Vt(et,"width","16px"),Vt(et,"height","16px"),q(Ft,"class","controlElement svelte-1tlkntj"),q(Qt,"class","desc svelte-1tlkntj"),q(rt,"type","checkbox"),q(rt,"class","task-list-item-checkbox"),Vt(rt,"width","16px"),Vt(rt,"height","16px"),q(de,"class","controlElement svelte-1tlkntj"),q(Wt,"class","desc svelte-1tlkntj"),q(w,"type","checkbox"),q(w,"class","task-list-item-checkbox"),Vt(w,"width","16px"),Vt(w,"height","16px"),q(Ut,"class","controlElement svelte-1tlkntj"),Vt(a,"width","100%"),q(a,"class","svelte-1tlkntj"),q(Z,"class","desc svelte-1tlkntj"),q(tt,"type","text"),q(tt,"placeholder","Monday, Tuesday, ..."),q(J,"class","controlElement svelte-1tlkntj"),Vt(E,"width","100%"),q(E,"class","svelte-1tlkntj"),q(_e,"class","addMoreButtonContainer svelte-1tlkntj"),Vt(Ht,"width","100%"),q(Ht,"class","svelte-1tlkntj"),q(Ln,"id","preview"),q(xn,"class","chartPreview svelte-1tlkntj"),q(s,"class","modalColumn svelte-1tlkntj"),q(t,"class","chart-modal svelte-1tlkntj"),q(kn,"class","mod-cta"),Vt(Ne,"display","flex"),Vt(Ne,"justify-content","center"),Vt(Ne,"align-items","center")},m(pt,Kt){je(pt,t,Kt),B(t,e),B(t,i),B(t,s),B(s,r),B(r,a),B(a,o),B(o,l),B(o,c),B(c,u),B(u,d),B(u,g),B(u,p),B(u,b),B(u,x),B(u,M),so(u,n[0]),B(a,C),B(a,P),B(P,$),B(P,R),B(R,F),oe(F,n[1]),B(a,z),B(a,N),B(N,X),B(N,U),B(U,nt),oe(nt,n[2]),B(a,ot),B(a,st),B(st,kt),B(st,Ft),B(Ft,et),et.checked=n[3],B(a,Ct),B(a,yt),B(yt,Qt),B(yt,de),B(de,rt),rt.checked=n[4],B(a,Ot),B(a,It),B(It,Wt),B(It,Ut),B(Ut,w),w.checked=n[5],B(r,v),B(r,y),B(r,A),B(r,E),B(E,O),B(O,Z),B(O,W),B(O,J),B(J,tt),oe(tt,n[9]),B(J,_t),B(r,zt),B(r,Tt),B(r,Nt),B(r,Ht);for(let nn=0;nn<se.length;nn+=1)se[nn].m(Ht,null);B(Ht,ae),B(Ht,_e),B(_e,pe),B(r,_n),B(r,tn),B(r,yn),lo(De,r,null),B(s,oi),B(s,xn),B(xn,Ln),n[29](Ln),B(t,Ji),B(t,li),je(pt,Rn,Kt),je(pt,Ne,Kt),B(Ne,kn),wn=!0,Fn||(Qi=[Xt(u,"change",n[16]),Xt(F,"change",n[17]),Xt(F,"input",n[17]),Xt(nt,"change",n[18]),Xt(nt,"input",n[18]),Xt(et,"change",n[19]),Xt(rt,"change",n[20]),Xt(w,"change",n[21]),Xt(tt,"input",n[22]),Xt(pe,"click",n[25]),Xt(kn,"click",n[12])],Fn=!0)},p(pt,Kt){if(Kt[0]&1&&so(u,pt[0]),Kt[0]&2&&oe(F,pt[1]),Kt[0]&4&&oe(nt,pt[2]),Kt[0]&8&&(et.checked=pt[3]),Kt[0]&16&&(rt.checked=pt[4]),Kt[0]&32&&(w.checked=pt[5]),Kt[0]&512&&tt.value!==pt[9]&&oe(tt,pt[9]),Kt[0]&1024){en=pt[10];let le;for(le=0;le<en.length;le+=1){let ts=du(pt,en,le);se[le]?se[le].p(ts,Kt):(se[le]=pu(ts),se[le].c(),se[le].m(Ht,ae))}for(;le<se.length;le+=1)se[le].d(1);se.length=en.length}let nn={};Kt[0]&448|Kt[1]&32&&(nn.$$scope={dirty:Kt,ctx:pt}),De.$set(nn)},i(pt){wn||(Ki(De.$$.fragment,pt),wn=!0)},o(pt){lr(De.$$.fragment,pt),wn=!1},d(pt){pt&&Ee(t),ru(se,pt),cr(De),n[29](null),pt&&Ee(Rn),pt&&Ee(Ne),Fn=!1,Qe(Qi)}}}function a_(n,t,e){let{editor:i}=t,{renderer:s}=t,r=ro(),a="bar",o=null,l=20,c=80,u=!1,d=!1,g=!1,p=!1,b,x="0",M="",C=[{dataTitle:"",data:""}],P,$=null,R=(0,ur.debounce)(async(rt,Ot)=>{var It;o&&o.destroy(),(It=$.lastElementChild)===null||It===void 0||It.remove(),o=s.renderRaw(await s.datasetPrep((0,ur.parseYaml)(rt),Ot),Ot)},500,!0);function F(){let rt=i.getDoc(),Ot=rt.getCursor();o.destroy(),rt.replaceRange("```chart\n"+P+"\n```",Ot),r("close")}function z(){a=ou(this),e(0,a)}function N(){l=io(this.value),e(1,l)}function X(){c=io(this.value),e(2,c)}function U(){u=this.checked,e(3,u)}function nt(){d=this.checked,e(4,d)}function ot(){g=this.checked,e(5,g)}function st(){M=this.value,e(9,M)}function kt(rt,Ot){rt[Ot].dataTitle=this.value,e(10,C)}function Ft(rt,Ot){rt[Ot].data=this.value,e(10,C)}let et=()=>e(10,C=[...C,{data:"",dataTitle:""}]);function Ct(){p=this.checked,e(6,p)}function yt(){x=this.value,e(8,x)}function Qt(){b=this.value,e(7,b)}function de(rt){sr[rt?"unshift":"push"](()=>{$=rt,e(11,$)})}return n.$$set=rt=>{"editor"in rt&&e(13,i=rt.editor),"renderer"in rt&&e(14,s=rt.renderer)},n.$$.update=()=>{if(n.$$.dirty[0]&2047){t:e(15,P=`type: ${a}
labels: [${M}]
series:
${C.map(rt=>` - title: ${rt.dataTitle}
data: [${rt.data}]`).join(`
`)}
tension: ${l/100}
width: ${c}%
labelColors: ${d}
fill: ${u}
beginAtZero: ${g}
bestFit: ${p}
bestFitTitle: ${b}
bestFitNumber: ${x}`)}if(n.$$.dirty[0]&34816){t:if($)try{R(P,$)}catch(rt){Je(rt,$)}}},[a,l,c,u,d,g,p,b,x,M,C,$,F,i,s,P,z,N,X,U,nt,ot,st,kt,Ft,et,Ct,yt,Qt,de]}var gu=class extends Zi{constructor(t){super();hr(this,t,a_,r_,er,{editor:13,renderer:14},i_,[-1,-1])}},mu=gu;var fr=class extends bu.Modal{constructor(t,e,i,s){super(t);this.settings=i,this.view=e,this.renderer=s}onOpen(){let{contentEl:t,view:e,settings:i,renderer:s}=this;t.empty(),new mu({target:t,props:{editor:e.editor,renderer:s}}).$on("close",()=>this.close())}onClose(){let{contentEl:t}=this;t.empty()}};var vu=Ae(require("obsidian")),_u={chart:'<svg xmlns="http://www.w3.org/2000/svg" fill-opacity="0.0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pie-chart"><path d="M21.21 15.89A10 10 0 1 1 8 2.83"></path><path d="M22 12A10 10 0 0 0 12 2v10z"></path></svg>'},yu=()=>{Object.keys(_u).forEach(n=>{(0,vu.addIcon)(n,_u[n])})};var co=class extends Oe.Plugin{constructor(){super(...arguments);this.postprocessor=async(t,e,i)=>{let s;try{s=await(0,Oe.parseYaml)(t.replace(/ /g," "))}catch(o){Je(o,e);return}if(!s.id&&(!s||!s.type||!s.labels||!s.series)){Je("Missing type, labels or series",e);return}if(s.bestFit===!0&&s.type==="line"){if(s.bestFitNumber!=null)var r=s.series[Number(s.bestFitNumber)].data;else var r=s.series[0].data;let o=s.labels,l=0,c=0,u=0,d=0;for(let x=0;x<r.length;++x)l=l+r[x],c=c+o[x],u=u+r[x]*r[x],d=d+r[x]*o[x];let g=(r.length*d-c*l)/(r.length*u-l*l),p=(c-g*l)/r.length,b=[];for(let x=0;x<o.length;++x)b.push((o[x]-p)/g);if(s.bestFitTitle!=null&&s.bestFitTitle!="undefined")var a=String(s.bestFitTitle);else var a="Line of Best Fit";s.series.push({title:a,data:b})}await this.renderer.renderFromYaml(s,e,i)}}async loadSettings(){this.settings=Object.assign({},Ks,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async onload(){console.log("loading plugin: Obsidian Charts"),await this.loadSettings(),yu(),this.renderer=new Us(this),window.renderChart=this.renderer.renderRaw,this.addSettingTab(new to(this.app,this)),this.addCommand({id:"creation-helper",name:"Insert new Chart",checkCallback:t=>{let e=this.app.workspace.activeLeaf;return e.view instanceof Oe.MarkdownView?(t||new fr(this.app,e.view,this.settings,this.renderer).open(),!0):!1}}),this.addCommand({id:"chart-from-table-column",name:"Create Chart from Table (Column oriented Layout)",editorCheckCallback:(t,e,i)=>{let s=e.getSelection();return i instanceof Oe.MarkdownView&&s.split(`
`).length>=3&&s.split("|").length>=2?(t||qa(e,"columns"),!0):!1}}),this.addCommand({id:"chart-from-table-row",name:"Create Chart from Table (Row oriented Layout)",editorCheckCallback:(t,e,i)=>i instanceof Oe.MarkdownView&&e.getSelection().split(`
`).length>=3&&e.getSelection().split("|").length>=2?(t||qa(e,"rows"),!0):!1}),this.addCommand({id:"chart-to-svg",name:"Create Image from Chart",editorCheckCallback:(t,e,i)=>i instanceof Oe.MarkdownView&&e.getSelection().startsWith("```chart")&&e.getSelection().endsWith("```")?(t||(new Oe.Notice("Rendering Chart..."),Nh(e,this.app,this.renderer,i.file,this.settings)),!0):!1}),this.registerMarkdownCodeBlockProcessor("chart",this.postprocessor),this.registerMarkdownCodeBlockProcessor("advanced-chart",async(t,e)=>this.renderer.renderRaw(await JSON.parse(t),e)),this.registerEvent(this.app.workspace.on("editor-menu",(t,e,i)=>{i&&this.settings.contextMenu&&t.addItem(s=>{s.setTitle("Insert Chart").setIcon("chart").onClick(r=>{new fr(this.app,i,this.settings,this.renderer).open()})})}))}onunload(){console.log("unloading plugin: Obsidian Charts")}};
/*
* @license
*
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
* https://github.com/chjj/marked
*
* Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
* https://github.com/ts-stack/markdown
*/
/*!
* chartjs-adapter-moment v1.0.0
* https://www.chartjs.org
* (c) 2021 chartjs-adapter-moment Contributors
* Released under the MIT license
*/
/*!
* @kurkle/color v0.2.1
* https://github.com/kurkle/color#readme
* (c) 2022 Jukka Kurkela
* Released under the MIT License
*/
/*!
* Chart.js v3.9.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
*/
/*!
* vanilla-picker v2.12.1
* https://vanilla-picker.js.org
*
* Copyright 2017-2021 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
* Released under the ISC license.
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/**
* @license
*
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
* https://github.com/chjj/marked
*
* Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
* https://github.com/ts-stack/markdown
*/
/**
* @license
*
* Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
* https://github.com/ts-stack/markdown
*/
/**
* chroma.js - JavaScript library for color conversions
*
* Copyright (c) 2011-2019, Gregor Aisch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name Gregor Aisch may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* -------------------------------------------------------
*
* chroma.js includes colors from colorbrewer2.org, which are released under
* the following license:
*
* Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
* and The Pennsylvania State University.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
* ------------------------------------------------------
*
* Named colors are taken from X11 Color Names.
* http://www.w3.org/TR/css3-color/#svg-color
*
* @preserve
*/